actual-css 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +8 -4
  3. package/components.json +21 -5
  4. package/dist/actual.full.css +410 -75
  5. package/dist/actual.full.js +2 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/app-ui.md +37 -3
  8. package/docs/design-notes/enhancement-contract.md +3 -1
  9. package/docs/design-notes/tokens.md +2 -0
  10. package/docs/navigation.json +14 -1
  11. package/docs/pages/components/accordion.md +5 -0
  12. package/docs/pages/components/alert.md +45 -17
  13. package/docs/pages/components/button.md +3 -0
  14. package/docs/pages/components/chat.md +20 -0
  15. package/docs/pages/components/dialog.md +36 -0
  16. package/docs/pages/components/drawer.md +52 -8
  17. package/docs/pages/components/navbar.md +26 -2
  18. package/docs/pages/components/rating.md +111 -12
  19. package/docs/pages/components/segmented.md +36 -1
  20. package/docs/pages/components/spinner.md +2 -0
  21. package/docs/pages/components/table.md +77 -0
  22. package/docs/pages/components/timeline.md +3 -1
  23. package/docs/pages/enhancements/flyout.md +83 -14
  24. package/docs/pages/enhancements/status-bar.md +1 -0
  25. package/docs/pages/enhancements/tabs.md +5 -0
  26. package/docs/pages/examples/overview.md +7 -1
  27. package/docs/pages/forms/ajax.md +101 -0
  28. package/docs/pages/forms/color-swatches.md +31 -2
  29. package/docs/pages/forms/date-picker.md +6 -0
  30. package/docs/pages/forms/joined-controls.md +8 -3
  31. package/docs/pages/forms/overview.md +2 -2
  32. package/docs/pages/forms/sticky-actions.md +2 -0
  33. package/docs/pages/forms/unsaved-changes.md +198 -0
  34. package/docs/pages/foundations/philosophy.md +2 -1
  35. package/docs/pages/foundations/theming.md +21 -4
  36. package/docs/pages/foundations/tokens.md +1 -1
  37. package/docs/pages/guides/introduction.md +1 -1
  38. package/docs/pages/guides/progressive-enhancement.md +30 -49
  39. package/docs/pages/guides/upgrading.md +16 -3
  40. package/docs/pages/layout/choosing.md +5 -0
  41. package/docs/pages/layout/column-layout.md +22 -8
  42. package/docs/pages/layout/scroll-snap.md +69 -2
  43. package/docs/pages/layout/sidebar-shell.md +68 -0
  44. package/docs/pages/patterns/empty-state.md +74 -0
  45. package/docs/pages/patterns/hierarchical-nav.md +40 -19
  46. package/docs/pages/patterns/navigation-list.md +3 -60
  47. package/docs/pages/patterns/stat.md +61 -0
  48. package/docs/pages/utilities/accessibility.md +32 -10
  49. package/package.json +4 -1
  50. package/reserved-classes.json +2 -0
  51. package/src/css/components/busy.css +25 -0
  52. package/src/css/components/button.css +3 -0
  53. package/src/css/components/chat.css +5 -1
  54. package/src/css/components/drawer.css +37 -3
  55. package/src/css/components/flyout.css +37 -0
  56. package/src/css/components/modal.css +3 -0
  57. package/src/css/components/navbar.css +99 -38
  58. package/src/css/components/rating.css +50 -5
  59. package/src/css/components/segmented.css +25 -2
  60. package/src/css/components/status-bar.css +4 -2
  61. package/src/css/forms/choice-card.css +5 -2
  62. package/src/css/forms/color-swatch.css +38 -19
  63. package/src/css/forms/custom-select.css +5 -0
  64. package/src/css/forms/form.css +3 -1
  65. package/src/css/layout/index.css +2 -0
  66. package/src/css/layout/sidebar-shell.css +67 -0
  67. package/src/js/ajax.js +148 -0
  68. package/src/js/dialog.js +59 -2
  69. package/src/js/dirty.js +140 -0
  70. package/src/js/dismiss.js +25 -0
  71. package/src/js/events.js +17 -0
  72. package/src/js/focus.js +12 -0
  73. package/src/js/form-submission.js +34 -0
  74. package/src/js/full.js +2 -0
  75. package/src/js/selectors.js +10 -2
  76. package/src/js/status.js +71 -10
  77. package/src/js/tab.js +16 -2
  78. package/src/js/validation.js +12 -4
  79. package/src/tooling/theme-contrast.js +3 -2
@@ -0,0 +1,198 @@
1
+ # Unsaved Changes
2
+
3
+ > Track whether a form holds data that differs from what was last saved.
4
+
5
+ **Related terms:** dirty form, modified form, unsaved edits, leave page warning, discard changes.
6
+
7
+ ## Dirty state
8
+
9
+ Opt in with `data-enhance="dirty"` on the form. While the data it would submit
10
+ differs from its baseline, the form carries `data-dirty`. The baseline is the
11
+ data present when the form is enhanced.
12
+
13
+ ```html demo
14
+ <form class="stack" data-enhance="dirty">
15
+ <label class="field">
16
+ <span class="field-label">Name</span>
17
+ <input class="input" name="name" value="Alice" />
18
+ </label>
19
+ <div class="cluster form-actions">
20
+ <button class="btn primary" type="submit">Save</button>
21
+ <button class="btn neutral outline" type="reset">Reset</button>
22
+ </div>
23
+ </form>
24
+ ```
25
+
26
+ Style the state from application CSS, for example a hint shown only while there
27
+ is something to save:
28
+
29
+ ```css
30
+ form:not([data-dirty]) .save-hint { visibility: hidden; }
31
+ ```
32
+
33
+ The comparison covers what a submission would send: disabled and unnamed
34
+ controls do not count, controls associated through `form="…"` and
35
+ form-associated custom elements do. Add `data-dirty-ignore` to a control to
36
+ leave its name out, such as a CSRF token. Files compare by name, size and
37
+ modification time.
38
+
39
+ Each comparison fires the form's `formdata` event. An entry a listener adds
40
+ there counts too, so a volatile one (a nonce) keeps the form dirty: give it the
41
+ name of a hidden `data-dirty-ignore` input.
42
+
43
+ `actual:dirty-change` bubbles from the form after each transition, with
44
+ `{ form, dirty }`. It reports the state and cannot be canceled.
45
+
46
+ The module is part of the full runtime and importable on its own as
47
+ `actual-css/js/dirty`. It works alongside `validation` and never submits the
48
+ form or blocks navigation.
49
+
50
+ ## After saving
51
+
52
+ A native submission reloads the page and the new form starts clean. When the
53
+ form stays on the page, tell the module what was saved:
54
+
55
+ ```js
56
+ import { FormDirty } from "actual-css/js/dirty";
57
+
58
+ const snapshot = FormDirty.capture(form); // when the request starts
59
+ // … request succeeds …
60
+ FormDirty.markClean(form, snapshot);
61
+ ```
62
+
63
+ Passing the snapshot keeps edits made during the request dirty. Without one,
64
+ `markClean()` accepts the current data. A failed or rejected save should not
65
+ call it.
66
+
67
+ Edits through events update the state on their own. After setting values or
68
+ adding controls from code, call `FormDirty.refresh(form)`. A widget with no
69
+ form control of its own (a canvas, a sortable list) marks the form dirty by
70
+ writing its state to a hidden input, then calling `refresh()`.
71
+
72
+ Reset restores the HTML default values, which are the baseline only until the
73
+ first `markClean()`. A removed and reinserted form keeps its baseline. A form
74
+ replaced by new server markup starts a new one, even when the save failed.
75
+
76
+ With the [Ajax Submission](ajax.md) enhancer, wire the snapshot to its events
77
+ as shown there.
78
+
79
+ ## Autosave
80
+
81
+ Save a `form[data-autosave]` after a pause in typing, without a submit
82
+ button. The form keeps its `action` and `method`, so it still saves without
83
+ JavaScript.
84
+
85
+ ```html
86
+ <form class="stack" action="/notes" method="post" data-enhance="dirty" data-autosave>
87
+ <label class="field">
88
+ <span class="field-label">Notes</span>
89
+ <textarea class="input" name="notes" required></textarea>
90
+ </label>
91
+ <p class="muted" aria-hidden="true">
92
+ <span data-autosave-when="dirty">Saving…</span>
93
+ <span data-autosave-when="clean">All changes saved</span>
94
+ </p>
95
+ <noscript><button class="btn primary" type="submit">Save</button></noscript>
96
+ </form>
97
+ ```
98
+
99
+ ```css
100
+ form[data-dirty] [data-autosave-when="clean"],
101
+ form:not([data-dirty]) [data-autosave-when="dirty"] { display: none; }
102
+ ```
103
+
104
+ ```js
105
+ import { FormDirty } from "actual-css/js/dirty";
106
+ import { status } from "actual-css/js/status";
107
+
108
+ const DELAY = 1500; // idle time before saving
109
+ const timers = new WeakMap();
110
+
111
+ const schedule = (form) => {
112
+ clearTimeout(timers.get(form));
113
+ timers.set(form, setTimeout(() => save(form), DELAY));
114
+ };
115
+
116
+ async function save(form) {
117
+ if (!form.hasAttribute("data-dirty")) return;
118
+ if (form.getAttribute("aria-busy") === "true") return; // the running save reschedules
119
+ // checkValidity() stays silent; requestSubmit() would show errors mid-typing.
120
+ if (!form.checkValidity()) return;
121
+
122
+ const snapshot = FormDirty.capture(form);
123
+ form.setAttribute("aria-busy", "true");
124
+ try {
125
+ const response = await fetch(form.action, { method: form.method, body: new FormData(form) });
126
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
127
+ FormDirty.markClean(form, snapshot);
128
+ if (form.hasAttribute("data-dirty")) schedule(form); // typed during the request
129
+ } catch {
130
+ status("Changes not saved. Check your connection.", { intent: "danger" });
131
+ } finally {
132
+ form.removeAttribute("aria-busy");
133
+ }
134
+ }
135
+
136
+ document.addEventListener("input", ({ target }) => {
137
+ if (target.form?.matches("[data-autosave]")) schedule(target.form);
138
+ });
139
+ ```
140
+
141
+ - Edits made during a request stay dirty and trigger the next save.
142
+ - Invalid data is never saved. The form stays dirty until it becomes valid.
143
+ - A failed save is not retried in a loop. The next edit tries again, and the
144
+ warning below still protects the page.
145
+ - The status bar reports failures only. Announcing every successful save
146
+ would interrupt screen readers at each pause; the inline state is hidden
147
+ from them for the same reason.
148
+
149
+ ## Warning before leaving
150
+
151
+ The module does not guard navigation. This recipe asks for confirmation when
152
+ the page unloads with a dirty form, except the one being submitted natively:
153
+
154
+ ```js
155
+ let lastSubmit = null;
156
+ // Read at unload time, once every submit listener has had its say: a
157
+ // canceled submission (validation, Ajax), a dialog close or a submission into
158
+ // another window or frame does not leave.
159
+ const leavesBySubmit = (form) => {
160
+ if (lastSubmit?.target !== form || lastSubmit.defaultPrevented) return false;
161
+ const { submitter } = lastSubmit;
162
+ // Attributes, not form.method / form.target: a control with that name
163
+ // shadows the property. An empty formtarget="" still means the page itself.
164
+ const method = submitter?.getAttribute("formmethod") ?? form.getAttribute("method") ?? "";
165
+ const target =
166
+ submitter?.getAttribute("formtarget") ??
167
+ form.getAttribute("target") ??
168
+ document.querySelector("base[target]")?.getAttribute("target") ??
169
+ "";
170
+ if (target && !["_self", "_top", "_parent"].includes(target.toLowerCase())) return false;
171
+ return method.toLowerCase() !== "dialog";
172
+ };
173
+ const guard = (event) => {
174
+ for (const form of document.querySelectorAll("form[data-dirty]")) {
175
+ if (leavesBySubmit(form)) continue;
176
+ event.preventDefault();
177
+ event.returnValue = true; // Chromium before 119
178
+ return;
179
+ }
180
+ };
181
+
182
+ document.addEventListener("submit", (event) => { lastSubmit = event; });
183
+ addEventListener("pageshow", () => { lastSubmit = null; });
184
+
185
+ // Register only while needed: some browsers skip the back/forward cache for
186
+ // pages that listen to beforeunload.
187
+ document.addEventListener("actual:dirty-change", () => {
188
+ if (document.querySelector("form[data-dirty]")) addEventListener("beforeunload", guard);
189
+ else removeEventListener("beforeunload", guard);
190
+ });
191
+ ```
192
+
193
+ `beforeunload` covers reloads, closing the tab and full-page navigation.
194
+ Navigation inside the page (a client router, a region swap) does not fire it:
195
+ guard it in that router. Mobile browsers may skip the prompt when the page is
196
+ discarded in the background. A submission answered with a download keeps the
197
+ page, but the recipe cannot tell in advance: that form stays unguarded until
198
+ the next submission.
@@ -166,7 +166,8 @@ inside them. `.sm` on a plain element has no effect.
166
166
 
167
167
  Density affects controls and layout spacing. Badges, avatars, spinners,
168
168
  ratings, keys, prose, and inline choices keep their own size. One density
169
- class applies to the whole subtree:
169
+ class applies to the whole subtree; for a product-wide density, put
170
+ `class="compact"` on `<html>`:
170
171
 
171
172
  ```html demo
172
173
  <div class="compact stack">
@@ -200,7 +200,7 @@ controls and scrollbars.
200
200
 
201
201
  → Foundations · Tokens (theme contract)
202
202
 
203
- ### Replace the palette with my own brand
203
+ ### Replace the palette with my own brand / bring your own palette
204
204
 
205
205
  Override the whole minimal recolor set (Tokens · Theme contract), not just
206
206
  `--primary`. Every neutral of the default theme — surfaces, text, border,
@@ -223,8 +223,24 @@ It reads the theme in headless Chrome, in every scheme it declares, and exits 1
223
223
  when a soft, focus, invalid-focus or inverse pair misses its threshold, so it
224
224
  can gate a CI job.
225
225
 
226
- Starting from a color scale (Tailwind `--color-zinc-*`, a brand ramp): map one
227
- step per role rather than importing the scale.
226
+ Starting from a color scale (Open Props, Radix Colors, Uchū, Tailwind
227
+ `--color-zinc-*`, a brand ramp): map one step per role rather than importing
228
+ the scale. Reference the library's variables in the theme or copy the few
229
+ values you use; components keep reading roles, never a scale step.
230
+
231
+ ```css
232
+ [data-theme="brand"] {
233
+ --primary: var(--indigo-9);
234
+ --primary-fg: white;
235
+ --danger: var(--red-9);
236
+ --danger-fg: white;
237
+ /* … the rest of the recolor set */
238
+ }
239
+ ```
240
+
241
+ Actual ships no color scales (`blue-100` … `blue-900`). Colors with no
242
+ component role — chart series, illustrations, logo colors — are application
243
+ tokens.
228
244
 
229
245
  → Foundations · Tokens (theme contract) · Guides · Tailwind (Map the palette to theme roles)
230
246
 
@@ -257,6 +273,7 @@ lets the core derive everything else.
257
273
  - `gradient`: outer focus halos on fields.
258
274
  - `neo-brutalist`: hard shadows, pastel fills, and plus-shaped accordion
259
275
  markers. Use it as a page skin: its rules cross nested theme boundaries.
260
- - `material`: filled underline fields and pill buttons.
276
+ - `material`: filled underline fields, pill buttons, and a table hover that
277
+ slides between rows.
261
278
  - `glass`: translucent surfaces over a backdrop. Keep `--surface-opaque` and
262
279
  `--surface-solid-fg` opaque, and check soft fills against the actual backdrop.
@@ -569,7 +569,7 @@ Selected state has three roles:
569
569
 
570
570
  - `--state-selected` — the selected fill or accent: a pressed button, a checked switch, a completed step.
571
571
  - `--state-selected-fg` — ink on that fill.
572
- - `--state-selected-text` — selected ink on a regular surface: the current nav link, the selected tab, the current step's number and ring.
572
+ - `--state-selected-text` — selected ink on a regular surface: the selected tab, the current step's number and ring.
573
573
 
574
574
  `--state-selected-text` falls back to `--state-selected` within each theme.
575
575
  Set it separately when the selected fill lacks contrast as text, especially
@@ -52,7 +52,7 @@ optimizing — the bare `actual-css` entrypoint and `actual-css/full` both resol
52
52
  to the complete compiled framework:
53
53
 
54
54
  ```html
55
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.16/dist/actual.full.min.css">
55
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.17/dist/actual.full.min.css">
56
56
  ```
57
57
 
58
58
  The package does not maintain separate partial bundles. Modular entrypoints map
@@ -126,6 +126,8 @@ status bar, for example:
126
126
  | `actual-css/js/password` | Password reveal toggle |
127
127
  | `actual-css/js/range` | Range fill and named values (token `range`) |
128
128
  | `actual-css/js/validation` | Form validation (token `validation`) |
129
+ | `actual-css/js/dirty` | Unsaved-changes state on forms (token `dirty`) |
130
+ | `actual-css/js/ajax` | Form submission through `fetch` (token `ajax`) |
129
131
  | `actual-css/js/status` | Singleton status bar on `[data-status][role="status"]` |
130
132
  | `actual-css/js/enhancement-loader` | Declared enhancement manifests |
131
133
 
@@ -142,8 +144,9 @@ needed.
142
144
  The JS is designed to run on its own, without Actual's stylesheet.
143
145
 
144
146
  - **`data-enhance` tokens** register named behaviors. The runtime discovers
145
- components through `data-enhance="tabs"`, `data-enhance="flyout"`, `data-enhance="range"`, `data-enhance="scrollspy"`, and
146
- `data-enhance="validation"` — no Actual presentation class needed.
147
+ components through `data-enhance="tabs"`, `data-enhance="flyout"`, `data-enhance="range"`, `data-enhance="scrollspy"`,
148
+ `data-enhance="validation"`, `data-enhance="dirty"`, and
149
+ `data-enhance="ajax"` — no Actual presentation class needed.
147
150
  Self-describing attributes (`data-mask`, `data-tooltip`,
148
151
  `data-context-menu`) stay framework-neutral by construction.
149
152
  - **`selectors.js`** lists the state classes the runtime *writes* (`is-open`,
@@ -322,14 +325,19 @@ The runtime dispatches a small set of public `actual:*` events. All are
322
325
  listenable on the document; cancelable events veto the associated action when
323
326
  `preventDefault()` is called.
324
327
 
325
- | Event | Dispatch | `detail` |
326
- | ---------------------- | ----------------------------- | ------------------------------------ |
327
- | `actual:surface-open` | before a surface opens | `{ surface, options }` |
328
- | `actual:context-menu` | before a context menu opens | `{ menu, context, origin, trigger }` |
329
- | `actual:status` | status module, or any code | `{ message, intent, duration }` |
330
- | `actual:invalid` | after a submit was blocked | `{ form, firstInvalid, message }` |
331
- | `actual:dialog-cancel` | before a native cancel close | `{ dialog, sourceEvent }` |
332
- | `actual:dismiss` | after a `--dismiss` dismissal | `{ trigger }` |
328
+ | Event | Dispatch | `detail` |
329
+ | ---------------------- | ------------------------------ | ------------------------------------ |
330
+ | `actual:surface-open` | before a surface opens | `{ surface, options }` |
331
+ | `actual:context-menu` | before a context menu opens | `{ menu, context, origin, trigger }` |
332
+ | `actual:status` | status module, or any code | `{ message, intent, duration }` |
333
+ | `actual:invalid` | after a submit was blocked | `{ form, firstInvalid, message }` |
334
+ | `actual:dirty-change` | after `data-dirty` flips | `{ form, dirty }` |
335
+ | `actual:ajax-start` | an ajax request starts | `{ form, submitter }` |
336
+ | `actual:ajax-response` | an ajax response arrived | `{ form, submitter, response }` |
337
+ | `actual:ajax-error` | an ajax request failed | `{ form, submitter, error }` |
338
+ | `actual:tab-change` | after the selected tab changed | `{ tab, panel, previousTab }` |
339
+ | `actual:dialog-cancel` | before a native cancel close | `{ dialog, sourceEvent }` |
340
+ | `actual:dismiss` | after a `--dismiss` dismissal | `{ trigger }` |
333
341
 
334
342
  `actual:surface-open`, `actual:context-menu` and `actual:dialog-cancel` are
335
343
  cancelable. `actual:status` both shows and clears the status bar — omit
@@ -379,9 +387,14 @@ or a direct dialog API call to delegate their commands to Actual.
379
387
 
380
388
  ### Dismiss command
381
389
 
382
- The runtime includes a generic `--dismiss` command for hiding any resolved
383
- target. It prevents the trigger's default action, sets `hidden`, and emits a
384
- bubbling `actual:dismiss` event with the trigger in `event.detail.trigger`.
390
+ The runtime includes a generic `--dismiss` command for hiding the element its
391
+ `commandfor` names; without a resolved target it does nothing. It prevents the
392
+ trigger's default action, sets `hidden`, and emits a bubbling `actual:dismiss`
393
+ event with the trigger in `event.detail.trigger`.
394
+
395
+ When focus was inside the target, it moves to the next tab stop after the
396
+ target, or to the nearest ancestor with a `tabindex` when nothing follows. A
397
+ listener that places focus itself keeps it.
385
398
  On an open surface (flyout, context menu), the surface consumes the event to
386
399
  close through its own lifecycle instead of staying hidden — by the time the
387
400
  event reaches document listeners, `hidden` has already been lifted again and
@@ -727,42 +740,10 @@ enhance({
727
740
  });
728
741
  ```
729
742
 
730
- ## Ajax forms
731
-
732
- Keep the native form as the baseline: set `action`, `method`, fields, and submit
733
- buttons normally. The enhancer can intercept submission only when JavaScript is
734
- available.
735
-
736
- ```js
737
- import enhance from "actual-css/js/enhance";
738
-
739
- enhance({
740
- "form[data-ajax]": (form) => {
741
- const controller = new AbortController();
742
-
743
- form.addEventListener("submit", async (event) => {
744
- event.preventDefault();
745
-
746
- const submitter = event.submitter;
747
- const data = new FormData(form, submitter);
748
- const response = await fetch(form.action, {
749
- method: form.method || "GET",
750
- body: form.method.toUpperCase() === "GET" ? null : data,
751
- signal: controller.signal,
752
- });
753
-
754
- form.dispatchEvent(new CustomEvent("actual:ajax", {
755
- bubbles: true,
756
- detail: { response },
757
- }));
758
- }, { signal: controller.signal });
759
-
760
- return () => controller.abort();
761
- },
762
- });
763
- ```
743
+ ## Ajax fragments
764
744
 
765
- For htmx-like fragment swaps, keep the first version narrow: one trigger, one
745
+ Forms submit through `fetch` with the built-in [Ajax Submission](../forms/ajax.md)
746
+ enhancer. For a trigger that loads a fragment, keep the first version narrow: one trigger, one
766
747
  target, one swap rule. If the behavior grows into history management, out-of-band
767
748
  swaps, request queues, and event policies, use a dedicated library.
768
749
 
@@ -780,7 +761,7 @@ enhance({
780
761
  const response = await fetch(trigger.dataset.get, {
781
762
  signal: controller.signal,
782
763
  });
783
- target.innerHTML = await response.text();
764
+ if (response.ok) target.innerHTML = await response.text();
784
765
  }, { signal: controller.signal });
785
766
 
786
767
  return () => controller.abort();
@@ -7,6 +7,19 @@ sections in order when skipping a release.
7
7
 
8
8
  **Related terms:** migration, breaking changes, update, version.
9
9
 
10
+ ## 0.16 to 0.17
11
+
12
+ ### Current nav link
13
+
14
+ The current `.nav-link` is neutral: `--text` ink on a fill one step above
15
+ hover, no inline-start trait outside forced colors. `--state-selected-text`
16
+ no longer reaches it.
17
+
18
+ - To keep a colored current link, set `--nav-current-fg` (and
19
+ `--nav-current-bg`) on the nav; check the pair with `actual-css contrast`.
20
+ - Rules that removed the trait (`.nav-list .nav-link[aria-current]::before {
21
+ content: none }`) now only remove the forced-colors cue: delete them.
22
+
10
23
  ## 0.14 to 0.15
11
24
 
12
25
  No class or hook is removed: markup and application CSS keep working.
@@ -25,7 +38,7 @@ No class or hook is removed: markup and application CSS keep working.
25
38
  package, so this only affects a copy of it: keep the copy, or drop it since
26
39
  the core focus line and fields now match it.
27
40
  - The combobox, date picker and data grid recipes target
28
- `@lekoala/combobox` 0.8.0, `@lekoala/date-picker` 0.6.0 and
41
+ `@lekoala/combobox` 0.8.0, `@lekoala/date-picker` 0.6.1 and
29
42
  `data-grid-component` 3.8.0. Compare a copied bridge with the current one in
30
43
  [Combobox](../forms/combobox.md) and [Date picker](../forms/date-picker.md).
31
44
 
@@ -124,8 +137,8 @@ row, set `--step-min: 7rem` on it.
124
137
 
125
138
  ### Current links and rows
126
139
 
127
- `.nav-link` shows its current state only for `aria-current="page"` or
128
- `aria-current="location"`, and `a.list-item` only for `aria-current="page"` or
140
+ `.nav-link` shows its current state only for `aria-current="page"`,
141
+ `aria-current="location"` or `aria-current="true"`, and `a.list-item` only for `aria-current="page"` or
129
142
  `aria-current="true"`. Search markup for other values on these classes and
130
143
  use the matching one.
131
144
 
@@ -9,6 +9,7 @@ number of children visible in one mockup.
9
9
  | ----------------------------------------------- | ------------------------------------------- |
10
10
  | A normally scrolling page | Semantic landmarks, optionally `.app-shell` |
11
11
  | Full-width bands over a centered content column | `.center` inside each landmark |
12
+ | Persistent sidebar + main, drawer on a phone | `.sidebar-shell` |
12
13
  | Topbar + scrolling main + adaptive nav | `.app-layout` |
13
14
 
14
15
  For public, marketing, and editorial pages, use semantic landmarks and add
@@ -23,6 +24,10 @@ rather than the row (see
23
24
  [Marketing](../../demo/templates/marketing.html) and
24
25
  [Blog](../../demo/templates/blog.html) compose bands this way.
25
26
 
27
+ Use `.sidebar-shell` for an admin or dashboard whose sidebar stays beside the
28
+ content on a wide screen and moves to a drawer on a phone, where the document
29
+ scrolls normally. See [Sidebar Shell](sidebar-shell.md).
30
+
26
31
  Use `.app-layout` for a viewport-sized shell where the main region scrolls
27
32
  independently and navigation moves from bottom to side. Follow its
28
33
  [required structure](app-layout.md). For other arrangements, compose the
@@ -9,6 +9,9 @@ are a collection, a known density, peers that switch together, or a main region
9
9
  with an aside, one of the other primitives already says so — and says it with
10
10
  intrinsic responsive behavior this one does not have.
11
11
 
12
+ **Related terms:** twelve-column grid, bento, bento grid, mosaic, uneven
13
+ feature grid, offset column.
14
+
12
15
  ```css
13
16
  .article-main {
14
17
  --column-span: 8;
@@ -111,6 +114,23 @@ Both sections use start 3 and span 8, so their content shares a left edge and
111
114
  an alignment gutter without a wrapping grid. In an application, give that pair
112
115
  one class and reuse it.
113
116
 
117
+ ## Uneven feature grids
118
+
119
+ A bento or mosaic layout is spans plus a row span. The canvas places columns;
120
+ `grid-row` on the region adds the height, as plain CSS Grid.
121
+
122
+ ```html demo
123
+ <div class="column-layout">
124
+ <article class="card" style="--column-span: 6; grid-row: span 2">Featured — 6 columns, 2 rows</article>
125
+ <article class="card" style="--column-span: 6">6</article>
126
+ <article class="card" style="--column-span: 3">3</article>
127
+ <article class="card" style="--column-span: 3">3</article>
128
+ </div>
129
+ ```
130
+
131
+ Give the tiles a class and recompose them in your container query like any
132
+ other region.
133
+
114
134
  ## The responsive contract
115
135
 
116
136
  `.column-layout` has **no automatic collapse**. The canvas stays twelve columns
@@ -215,14 +235,8 @@ its track. Define a narrow representation where the composition needs one.
215
235
 
216
236
  The primitive is horizontal only. There are no row, area, or order hooks, and no
217
237
  breakpoint variants — those would move responsive strategy back into markup.
218
- For genuinely two-dimensional placement, use CSS Grid directly on your own
219
- class:
220
-
221
- ```css
222
- .dashboard-summary {
223
- grid-row: 1 / span 2;
224
- }
225
- ```
238
+ Row placement is plain CSS Grid on your own class, as in
239
+ [uneven feature grids](#uneven-feature-grids).
226
240
 
227
241
  The column count is fixed at twelve and is not configurable. Twelve is what
228
242
  makes the coordinates shared and lets `6 + 6`, `4 + 4 + 4`, `3 + 3 + 3 + 3`,
@@ -6,7 +6,7 @@ Horizontal rails that stay useful without JavaScript and snap in modern browsers
6
6
 
7
7
  Use `.scroll-snap` for a niche row of items that should scroll horizontally, such as card rails, media strips, overflow tabs, or a simple touch-friendly carousel baseline. Scrolling only appears when the items are wider than the container; set `--scroll-snap-item-size` for card rails.
8
8
 
9
- **Related terms:** carousel, card carousel, horizontal scroller, media rail, scrolling rail.
9
+ **Related terms:** carousel, card carousel, horizontal scroller, media rail, scrolling rail, grid to slider, swipe on mobile, pagination dots.
10
10
 
11
11
  ```html demo
12
12
  <section class="stack" aria-labelledby="featured-title">
@@ -55,4 +55,71 @@ Keep scrollbars visible by default. If a product deliberately hides them, make t
55
55
  </div>
56
56
  ```
57
57
 
58
- `.scroll-snap` is not a full interactive carousel. For previous/next controls, pagination, active state, mouse drag, looping, autoplay, or robust accessibility behavior, use a dedicated carousel library such as Swiper and compose it with Actual components.
58
+ ## Grid on wide, rail on narrow
59
+
60
+ To show one list as a grid in a wide container and as a swipeable rail in a narrow one, keep a single `.scroll-snap` list and turn it into a grid from an `actual-container` query:
61
+
62
+ ```html
63
+ <div class="container-query">
64
+ <ul class="scroll-snap list-reset card-rail">
65
+ <li class="card">…</li>
66
+ </ul>
67
+ </div>
68
+ ```
69
+
70
+ ```css
71
+ .card-rail {
72
+ --scroll-snap-item-size: min(80%, 18rem);
73
+ }
74
+
75
+ @container actual-container (min-width: 48rem) {
76
+ .card-rail {
77
+ display: grid;
78
+ grid-template-columns: repeat(3, minmax(0, 1fr));
79
+ overflow: visible;
80
+ margin-block: 0;
81
+ padding: 0;
82
+ }
83
+ }
84
+ ```
85
+
86
+ Keep the item size under `100%` so the next card peeks in: iOS hides the scrollbar at rest, so the cut-off card is the scroll cue. In the grid, `overflow: visible` ends the scroll container, and resetting `margin-block` and `padding` removes the focus reserve that only a clipping rail needs.
87
+
88
+ ### Pagination dots
89
+
90
+ CSS scroll markers add one dot per item in Chromium. Other browsers drop these declarations and keep the peek.
91
+
92
+ ```css
93
+ .card-rail {
94
+ scroll-marker-group: after;
95
+ }
96
+
97
+ .card-rail > li::scroll-marker {
98
+ content: "" / attr(data-marker-label);
99
+ inline-size: 0.5rem;
100
+ block-size: 0.5rem;
101
+ border-radius: var(--radius-full);
102
+ background: var(--text-subtle);
103
+ }
104
+
105
+ .card-rail > li::scroll-marker:target-current {
106
+ inline-size: 1.5rem;
107
+ background: var(--primary);
108
+ }
109
+
110
+ @supports (scroll-marker-group: after) {
111
+ .card-rail {
112
+ scrollbar-width: none;
113
+ }
114
+ }
115
+ ```
116
+
117
+ - Each dot is a link: give every item a `data-marker-label`, because `content: ""` alone leaves the links nameless.
118
+ - The dots are controls and need 3:1 against the page: `--text-subtle` is the quietest text tone that holds it, `--border` does not. Mark the current dot by size, not color alone.
119
+ - The dots replace the scrollbar, so hide it only where they exist; `data-scrollbar="hidden"` would also hide it in browsers without markers.
120
+ - Each dot is a tab stop, placed before the items in Chromium's tab order.
121
+ - The grid needs no `scroll-marker-group` reset: markers exist only on a scroll container.
122
+
123
+ The [card rail template](../../demo/templates/card-rail.html) has the full recipe, focus ring and forced colors included.
124
+
125
+ `.scroll-snap` is not a full interactive carousel. For previous/next controls, pagination dots in every browser, mouse drag, looping, autoplay, or robust accessibility behavior, use a dedicated carousel library such as Swiper and compose it with Actual components.
@@ -0,0 +1,68 @@
1
+ # Sidebar Shell
2
+
3
+ > A persistent sidebar beside the main region on a wide screen, each scrolling on its own; a drawer on a phone.
4
+
5
+ **Related terms:** admin layout, dashboard shell, persistent sidebar, side navigation, app frame.
6
+
7
+ `.sidebar-shell` takes two direct children: an `aside`, the side region, and
8
+ one other element, the main region. From `64rem`, they sit side by side at the
9
+ height of the viewport and each scrolls on its own, so the sidebar stays put
10
+ while the content scrolls. Below `64rem`, the `aside` is hidden and the
11
+ document scrolls as any page does; the page offers the same navigation in a
12
+ [drawer](../components/drawer.md).
13
+
14
+ ```html demo
15
+ <div class="sidebar-shell" style="--viewport-block: 14rem; --sidebar-shell-size: 12rem">
16
+ <aside class="stack" aria-label="Primary" style="padding: var(--space-40); border-inline-end: var(--border-width) solid var(--border)">
17
+ <strong>Product</strong>
18
+ <nav aria-label="Primary">
19
+ <ul class="nav-list">
20
+ <li><a class="nav-link" href="#overview" aria-current="page">Overview</a></li>
21
+ <li><a class="nav-link" href="#orders">Orders</a></li>
22
+ <li><a class="nav-link" href="#customers">Customers</a></li>
23
+ <li><a class="nav-link" href="#settings">Settings</a></li>
24
+ </ul>
25
+ </nav>
26
+ </aside>
27
+ <main class="stack" style="padding: var(--space-40)">
28
+ <h2>Overview</h2>
29
+ <p>The main region scrolls; the sidebar beside it does not move.</p>
30
+ <p>Orders, revenue and recent activity would follow here.</p>
31
+ <p>Keep scrolling: the content is taller than the shell.</p>
32
+ <p>The sidebar keeps its place.</p>
33
+ <p>Each region has its own scrollbar.</p>
34
+ <p>The page itself does not scroll.</p>
35
+ <p>End of the content.</p>
36
+ </main>
37
+ </div>
38
+ ```
39
+
40
+ The demo sets `--viewport-block` to fit the page; an application leaves it to
41
+ the viewport. The `aside` keeps its own `display`, so `.stack` lays it out.
42
+ Put the topbar inside the main region: it then spans the content column only.
43
+
44
+ ## Drawer on a phone
45
+
46
+ Keep the drawer outside the shell and open it from a button that only the
47
+ narrow layout shows. A drawer left open when the window widens past `64rem`
48
+ would sit over the sidebar it mirrors; close it from the page:
49
+
50
+ ```html
51
+ <script>
52
+ const wide = matchMedia("(width >= 64rem)");
53
+ wide.addEventListener("change", () => {
54
+ if (wide.matches) document.getElementById("main-drawer").close();
55
+ });
56
+ </script>
57
+ ```
58
+
59
+ [App](../../demo/templates/app.html) composes the shell, its drawer and this
60
+ script.
61
+
62
+ ## Hooks
63
+
64
+ - `--sidebar-shell-size` — width of the side region.
65
+
66
+ The breakpoint is a literal `64rem`: a custom property cannot sit in a media
67
+ condition. For another breakpoint, copy the two media rules of
68
+ `sidebar-shell.css` into the application.