diff --git a/.changeset/attachments-final-wave.md b/.changeset/attachments-final-wave.md new file mode 100644 index 0000000..7c346fe --- /dev/null +++ b/.changeset/attachments-final-wave.md @@ -0,0 +1,18 @@ +--- +'@layerstack/svelte-attachments': minor +'@layerstack/svelte-actions': patch +--- + +feat: Port the remaining actions — `styleProps`, `computedStyles`, `sticky`, `stickyContext`, `spotlight`, and `DomTracker` — completing `@layerstack/svelte-attachments` + +`multi` is dropped rather than ported. Attachments compose natively, so several `{@attach}` on one element (or `createAttachmentKey` to pass them through a component's props) covers what it existed for. + +`DomTracker` keeps its DOM-change tracking, which is what `sticky` and `spotlight` use to reverse exactly the changes they made. Its action map is replaced by `addAttachment()`, which folds another attachment's cleanup into the tracker, plus `addCleanup()` for anything else. The map's original purpose — keeping state across an action's `update()` calls — no longer applies, since an attachment re-runs from scratch rather than updating in place. + +fix: `spotlight`, `stickyContext`, and `styleProps` now reverse what they applied. As actions they left classes and custom properties behind, which was invisible only because the element was usually destroyed anyway; an attachment re-runs on change, so the leftovers would accumulate. + +fix: `styleProps` removes properties that are no longer present in the object. The action only did this from its second update onward, so properties dropped on the first change lingered. + +fix: `stickyContext` no longer writes `NaNpx` when the computed `margin-top` is unresolved. + +deprecate: `@layerstack/svelte-actions` is superseded by `@layerstack/svelte-attachments`. It continues to ship, and to receive fixes, while `@layerstack/svelte-table` is migrated off it. diff --git a/.changeset/dark-variant-system.md b/.changeset/dark-variant-system.md new file mode 100644 index 0000000..1d04916 --- /dev/null +++ b/.changeset/dark-variant-system.md @@ -0,0 +1,23 @@ +--- +'@layerstack/tailwind': patch +'@layerstack/ui': patch +'@layerstack/docs': patch +--- + +fix: Follow `prefers-color-scheme` in the `dark:` variant, not just ``. + +There were two disagreeing sources of truth for "is it dark". The theme palettes darken from +`@media (prefers-color-scheme: dark)` on `:root`, which needs no JavaScript, but the `dark:` variant +was keyed on the `dark` class, which is only ever set by JavaScript. Any moment the two disagreed — +before hydration, or permanently when no dark themes are registered — produced dark surfaces with +every `dark:` utility still in its light state. Most visibly, code blocks styled by +`dark:text-(--shiki-dark)` rendered near-black tokens on a dark background. + +The variant now mirrors the palettes: an explicit `[data-theme]` selection wins, and everything else +follows the system setting. `@layerstack/docs`' `Code` component gets the same treatment for its +hand-written `html.dark .shiki` rules. + +Also fixes `ThemeInit` on client-only apps. It injects its pre-paint script through `{@html}`, and +the browser never executes a ` + + +``` + +Pairs with [`AppLayout`](/docs/ui/AppLayout) — the menu button toggles `settings().showDrawer`, +which the layout reads. + +An array `title` renders as a [`Breadcrumb`](/docs/ui/Breadcrumb) and joins with `›` for +`document.title`, which is kept in sync unless `head={false}`. + +## Basic + +`title` accepts a string or an array — an array renders as a [`Breadcrumb`](/docs/ui/Breadcrumb). +The `actions` snippet fills the trailing edge. + +By default the bar also writes `title` to `document.title`; pass `head={false}` to leave the page +title alone. + +:example{name="basic" showCode} + +## Menu icon + +The leading button toggles [`AppLayout`](/docs/ui/AppLayout)'s drawer. + +:example{name="menu-icon"} diff --git a/docs/src/content/components/AppLayout.md b/docs/src/content/components/AppLayout.md new file mode 100644 index 0000000..9bec440 --- /dev/null +++ b/docs/src/content/components/AppLayout.md @@ -0,0 +1,29 @@ +--- +description: App shell with a fixed header and a responsive navigation drawer +category: app +related: [ui/AppBar, ui/NavItem, ui/Drawer] +--- + +## Usage + +```svelte + + + + {#snippet nav()}