@monster-orange/den-ui 0.7.5 → 0.8.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.
package/src/kit.d.ts CHANGED
@@ -25,6 +25,7 @@ import type {
25
25
  hydrateBell,
26
26
  hydrateScope,
27
27
  hydrateSearch,
28
+ PageMenuHydrateOptions,
28
29
  } from "./shell-client.js";
29
30
  import type {
30
31
  ShellModel,
@@ -48,11 +49,24 @@ import type {
48
49
  appearanceButtonHtml,
49
50
  appearanceMenuHtml,
50
51
  waitingHtml,
52
+ menuRowHtml,
53
+ pageMenuButtonHtml,
54
+ pageMenuHtml,
51
55
  icon,
52
56
  esc,
53
57
  } from "./shell-html.js";
58
+ import type { buttonHtml } from "./button.js";
59
+ import type {
60
+ SettingRow,
61
+ SettingRowHydrateOptions,
62
+ SettingRowOptions,
63
+ settingRowHtml,
64
+ } from "./setting-row.js";
54
65
  import type { syncPinToggles } from "./shell-client.js";
55
66
  import type { UpdatePill } from "./update-pill.js";
67
+ import type { SaveState, SaveStateOptions } from "./savestate.js";
68
+ import type { FilterBar, FilterBarOptions } from "./filter-bar.js";
69
+ import type { BulkBar, BulkBarOptions } from "./bulk-bar.js";
56
70
 
57
71
  /** Every call to the product goes through it; the kit names no URL. */
58
72
  export interface Adapter extends ReportAdapter {
@@ -158,6 +172,31 @@ export declare const busy: {
158
172
  ): Promise<T | null>;
159
173
  configure: typeof configureBusy;
160
174
  };
175
+ /** An autosaving editor's save-state line, in the kit's language. */
176
+ export declare function saveState(
177
+ el: HTMLElement,
178
+ opts: SaveStateOptions,
179
+ ): SaveState;
180
+ /** A list's filter bar, in the kit's language. */
181
+ export declare function filterBar(
182
+ el: HTMLElement,
183
+ opts: FilterBarOptions,
184
+ ): FilterBar;
185
+ /** A list's bulk bar, in the kit's language. */
186
+ export declare function bulkBar(el: HTMLElement, opts: BulkBarOptions): BulkBar;
187
+ /** The page action menu on a drawn More ▾ button, in the kit's language. */
188
+ export declare function pageMenu(
189
+ btn: HTMLElement,
190
+ opts: PageMenuHydrateOptions,
191
+ ): AppearanceHandle;
192
+ /**
193
+ * The settings on/off row, in the kit's language: with a row's data (a
194
+ * label), drawn into el first; else the row el holds is wired.
195
+ */
196
+ export declare function settingRow(
197
+ el: HTMLElement,
198
+ opts: SettingRowHydrateOptions & Partial<SettingRowOptions>,
199
+ ): SettingRow;
161
200
  export declare function hydrate(
162
201
  root: ParentNode,
163
202
  opts?: KitHydrateOptions,
@@ -208,6 +247,16 @@ export interface DenUIKit {
208
247
  update: typeof update;
209
248
  report: typeof report;
210
249
  busy: typeof busy;
250
+ saveState: typeof saveState;
251
+ filterBar: typeof filterBar;
252
+ bulkBar: typeof bulkBar;
253
+ buttonHtml: typeof buttonHtml;
254
+ menuRowHtml: typeof menuRowHtml;
255
+ pageMenuButtonHtml: typeof pageMenuButtonHtml;
256
+ pageMenuHtml: typeof pageMenuHtml;
257
+ pageMenu: typeof pageMenu;
258
+ settingRowHtml: typeof settingRowHtml;
259
+ settingRow: typeof settingRow;
211
260
  }
212
261
  declare const DenUI: DenUIKit;
213
262
  export default DenUI;
package/src/kit.js CHANGED
@@ -42,6 +42,20 @@
42
42
  * focus goes back to opener (else the
43
43
  * control that opened it) on close
44
44
  * DenUI.busy.run(action, run, opts) the working pop-up (busy.js)
45
+ * DenUI.saveState(el, { save, copyText, watch }) an autosaving
46
+ * editor's save-state line (savestate.js),
47
+ * in the kit's language
48
+ * DenUI.filterBar(el, { facets, selected, onChange, start, end })
49
+ * a list's Filters button, chosen chips
50
+ * and facet panel (filter-bar.js)
51
+ * DenUI.bulkBar(el, { count, actions, onAction, onClear })
52
+ * a list's bar while rows are selected
53
+ * (bulk-bar.js)
54
+ * DenUI.buttonHtml(o) the general button (button.js, issue 556)
55
+ * DenUI.pageMenu(btn, { items, onSelect }) the page action menu on a
56
+ * pageMenuButtonHtml button (issue 555)
57
+ * DenUI.settingRow(el, { onSave, ...row }) the settings on/off row
58
+ * (setting-row.js, issue 554)
45
59
  * DenUI.strings(lang, table) the product's own words, or its versions
46
60
  * of the kit's; DenUI.t(key, vars)
47
61
  */
@@ -67,6 +81,9 @@ import {
67
81
  shellHtml,
68
82
  topBarHtml,
69
83
  markHtml,
84
+ menuRowHtml,
85
+ pageMenuButtonHtml,
86
+ pageMenuHtml,
70
87
  versionChipHtml,
71
88
  waitingHtml,
72
89
  } from "./shell-html.js";
@@ -75,6 +92,7 @@ import {
75
92
  attachMenuFilter,
76
93
  hydrateAppearance,
77
94
  hydrateBell,
95
+ hydratePageMenu,
78
96
  hydrateScope,
79
97
  hydrateSearch,
80
98
  hydrateShell,
@@ -92,6 +110,15 @@ import {
92
110
  import { configureReport, openReport } from "./report.js";
93
111
  import { showUpdate } from "./update-pill.js";
94
112
  import { busyAction, configureBusy } from "./busy.js";
113
+ import { createSaveState } from "./savestate.js";
114
+ import { mountFilterBar } from "./filter-bar.js";
115
+ import { mountBulkBar } from "./bulk-bar.js";
116
+ import { buttonHtml } from "./button.js";
117
+ import {
118
+ hydrateSettingRow,
119
+ mountSettingRow,
120
+ settingRowHtml,
121
+ } from "./setting-row.js";
95
122
 
96
123
  const state = {
97
124
  lang: "en",
@@ -183,6 +210,39 @@ export const busy = {
183
210
  configure: configureBusy,
184
211
  };
185
212
 
213
+ /** An autosaving editor's save-state line, in the kit's language. */
214
+ export function saveState(el, opts = {}) {
215
+ return createSaveState(el, { lang, ...opts });
216
+ }
217
+
218
+ /** A list's filter bar, in the kit's language. */
219
+ export function filterBar(el, opts = {}) {
220
+ return mountFilterBar(el, { lang, ...opts });
221
+ }
222
+
223
+ /** A list's bulk bar, in the kit's language. */
224
+ export function bulkBar(el, opts = {}) {
225
+ return mountBulkBar(el, { lang, ...opts });
226
+ }
227
+
228
+ /**
229
+ * The page action menu (issue 555) on a drawn More ▾ button, in the
230
+ * kit's language (hydratePageMenu).
231
+ */
232
+ export function pageMenu(btn, opts = {}) {
233
+ return hydratePageMenu(btn, { lang, ...opts });
234
+ }
235
+
236
+ /**
237
+ * The settings on/off row (issue 554), in the kit's language. With
238
+ * opts.label (a row's data), it draws the row into el first; else it wires
239
+ * the row el already holds.
240
+ */
241
+ export function settingRow(el, opts = {}) {
242
+ const o = { lang: lang(), ...opts };
243
+ return opts.label != null ? mountSettingRow(el, o) : hydrateSettingRow(el, o);
244
+ }
245
+
186
246
  /**
187
247
  * Binds the drawn shell, the chip and Report (see the top), and the 0.7.0
188
248
  * pieces it finds: the scope crumbs (opts.scope), the search
@@ -294,6 +354,16 @@ const DenUI = {
294
354
  update,
295
355
  report,
296
356
  busy,
357
+ saveState,
358
+ filterBar,
359
+ bulkBar,
360
+ buttonHtml,
361
+ menuRowHtml,
362
+ pageMenuButtonHtml,
363
+ pageMenuHtml,
364
+ pageMenu,
365
+ settingRowHtml,
366
+ settingRow,
297
367
  };
298
368
 
299
369
  if (typeof window !== "undefined") window.DenUI = DenUI;
@@ -0,0 +1,150 @@
1
+ /* den-ui: the panel fold toggle (issue 548) and the folded panel's edge
2
+ strip (issue 549), panel-fold.js. Tokens only: no colour of its own.
3
+ Linked, never injected: clean under style-src 'self'. The host shows or
4
+ hides each with the hidden attribute and lays its page out itself. */
5
+
6
+ /* The fold toggle: an icon and a word; pressed (the panel shows) is the
7
+ sunken fill and the strong border. */
8
+ .den-fold {
9
+ display: inline-flex;
10
+ align-items: center;
11
+ gap: 6px;
12
+ min-height: 32px;
13
+ margin: 0;
14
+ padding: 0 10px;
15
+ border: 1px solid var(--border);
16
+ border-radius: var(--r-btn);
17
+ background: transparent;
18
+ color: var(--text);
19
+ font-family: var(--sans);
20
+ font-size: var(--fs-s);
21
+ font-weight: 400;
22
+ line-height: 1;
23
+ cursor: pointer;
24
+ transition:
25
+ background-color var(--dur-fast) ease,
26
+ border-color var(--dur-fast) ease;
27
+ }
28
+ .den-fold[hidden] {
29
+ display: none;
30
+ }
31
+ .den-fold:hover {
32
+ border-color: var(--border-strong);
33
+ }
34
+ .den-fold[aria-pressed="true"] {
35
+ background: var(--sunken);
36
+ border-color: var(--border-strong);
37
+ font-weight: 500;
38
+ }
39
+ .den-fold svg,
40
+ .den-strip-show svg {
41
+ flex: none;
42
+ fill: none;
43
+ stroke: currentColor;
44
+ stroke-width: 1.8;
45
+ stroke-linecap: round;
46
+ stroke-linejoin: round;
47
+ }
48
+ .den-fold svg {
49
+ width: 14px;
50
+ height: 14px;
51
+ }
52
+
53
+ /* The edge strip: 40px wide where the folded panel was; Show panel, then
54
+ the count under it. */
55
+ .den-strip {
56
+ display: flex;
57
+ flex-direction: column;
58
+ align-items: center;
59
+ gap: 6px;
60
+ box-sizing: border-box;
61
+ width: 40px;
62
+ min-height: 120px;
63
+ padding: var(--space-2) 0;
64
+ align-self: start;
65
+ background: var(--surface);
66
+ border: 1px solid var(--border);
67
+ border-radius: var(--r);
68
+ }
69
+ .den-strip[hidden] {
70
+ display: none;
71
+ }
72
+ .den-strip-show {
73
+ position: relative;
74
+ display: inline-flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ flex: none;
78
+ box-sizing: border-box;
79
+ width: 32px;
80
+ height: 32px;
81
+ margin: 0;
82
+ padding: 0;
83
+ border: 1px solid var(--border);
84
+ border-radius: var(--r-btn);
85
+ background: var(--surface);
86
+ color: var(--text);
87
+ cursor: pointer;
88
+ }
89
+ .den-strip-show:hover {
90
+ border-color: var(--border-strong);
91
+ background: var(--sunken);
92
+ }
93
+ .den-strip-show svg {
94
+ width: 16px;
95
+ height: 16px;
96
+ }
97
+ .den-strip-n {
98
+ min-width: 24px;
99
+ font-family: var(--mono);
100
+ font-size: var(--fs-xs);
101
+ font-weight: 500;
102
+ line-height: 16px;
103
+ text-align: center;
104
+ color: var(--accent-text);
105
+ }
106
+ /* The count's words: heard, never seen. */
107
+ .den-strip-sr {
108
+ position: absolute;
109
+ width: 1px;
110
+ height: 1px;
111
+ padding: 0;
112
+ margin: -1px;
113
+ overflow: hidden;
114
+ clip: rect(0 0 0 0);
115
+ white-space: nowrap;
116
+ border: 0;
117
+ }
118
+
119
+ .den-fold:focus-visible,
120
+ .den-strip-show:focus-visible {
121
+ outline: 2px solid var(--accent);
122
+ outline-offset: 2px;
123
+ }
124
+
125
+ /* A phone or a touch screen: the toggle is a 44px row; Show panel keeps
126
+ its 32px look inside the 40px strip, with a 44×44px tap centred on it
127
+ (as .den-hit). */
128
+ @media (pointer: coarse), (max-width: 720px) {
129
+ .den-fold {
130
+ min-height: var(--tap);
131
+ }
132
+ .den-strip-show::after {
133
+ content: "";
134
+ position: absolute;
135
+ left: 50%;
136
+ top: 50%;
137
+ width: 100%;
138
+ height: 100%;
139
+ min-width: var(--tap);
140
+ min-height: var(--tap);
141
+ transform: translate(-50%, -50%);
142
+ background: transparent;
143
+ }
144
+ }
145
+
146
+ @media (prefers-reduced-motion: reduce) {
147
+ .den-fold {
148
+ transition: none;
149
+ }
150
+ }
@@ -0,0 +1,67 @@
1
+ /** What a strip's count counts, worded as the kit's badges are. */
2
+ export type EdgeStripCountKind = "open" | "waiting" | "down" | "running";
3
+
4
+ export interface FoldToggleModel {
5
+ /** The panel shows (default true): aria-pressed. */
6
+ pressed?: boolean;
7
+ /** The panel's id: aria-controls. */
8
+ controls?: string;
9
+ /** The kit's words' language: en, es or ja (default en). */
10
+ lang?: string;
11
+ }
12
+
13
+ export interface EdgeStripModel {
14
+ /** The count under Show panel; 0 or none draws none; 99+ past 99. */
15
+ count?: number;
16
+ /** What it counts (default "open"); any other is "open". */
17
+ what?: EdgeStripCountKind;
18
+ /** The folded panel's id: Show panel's aria-controls. */
19
+ controls?: string;
20
+ lang?: string;
21
+ }
22
+
23
+ export interface FoldToggleOptions {
24
+ /** A press: next is true when the panel should show. */
25
+ onToggle?: (next: boolean) => void;
26
+ }
27
+
28
+ export interface FoldToggle {
29
+ /** Moves aria-pressed with no call (the host's own change). */
30
+ set(pressed: boolean): void;
31
+ pressed(): boolean;
32
+ destroy(): void;
33
+ }
34
+
35
+ export interface EdgeStripOptions {
36
+ /** Show panel: the host shows the panel and hides the strip. */
37
+ onShow?: () => void;
38
+ /** The count's words' language (default: the nearest [lang], else en). */
39
+ lang?: string;
40
+ }
41
+
42
+ export interface EdgeStrip {
43
+ setCount(n: number, what?: EdgeStripCountKind): void;
44
+ destroy(): void;
45
+ }
46
+
47
+ /** <button class="den-fold" aria-pressed>: an icon, then "Panel". */
48
+ export declare function foldToggleHtml(model?: FoldToggleModel): string;
49
+
50
+ /** <div class="den-strip" role="complementary">, 40px: Show panel, the count. */
51
+ export declare function edgeStripHtml(model?: EdgeStripModel): string;
52
+
53
+ /** A press moves aria-pressed and calls onToggle(next). */
54
+ export declare function hydrateFoldToggle(
55
+ button: HTMLElement | null,
56
+ opts?: FoldToggleOptions,
57
+ ): FoldToggle;
58
+
59
+ /**
60
+ * Show panel calls onShow(); then, when focus is still in the strip (now
61
+ * hidden) or on the body, it goes to the fold toggle for the same panel,
62
+ * else to the panel when it takes focus.
63
+ */
64
+ export declare function hydrateEdgeStrip(
65
+ strip: HTMLElement | null,
66
+ opts?: EdgeStripOptions,
67
+ ): EdgeStrip;
@@ -0,0 +1,152 @@
1
+ /**
2
+ * The panel fold toggle (issue 548) and the folded panel's edge strip
3
+ * (issue 549). A page with a side panel (comments, details, a list) lets a
4
+ * person fold it away to read the main column clean, and bring it back.
5
+ * The host keeps the state (shown or folded, remembered or not) and lays
6
+ * the page out; the kit draws the two controls, owns their words (en, es,
7
+ * ja) and their keys and focus. Pure builders run in Node too:
8
+ *
9
+ * foldToggleHtml({ pressed, controls, lang })
10
+ * <button class="den-fold" aria-pressed>: an icon, then "Panel".
11
+ * pressed (default true) = the panel shows. controls: the panel's id.
12
+ * edgeStripHtml({ count, what, controls, lang })
13
+ * <div class="den-strip" role="complementary" aria-label="Panel,
14
+ * hidden">, 40px wide, for where the folded panel was: a "Show panel"
15
+ * icon button, then the count under it (none at 0; 99+ past 99). The
16
+ * count is seen as a number and heard as the kit's badge words:
17
+ * what is "open" (default), "waiting", "down" or "running".
18
+ *
19
+ * In the page, the same elements come alive:
20
+ *
21
+ * const fold = hydrateFoldToggle(button, { onToggle: (next) => … });
22
+ * A press (click, Enter, Space) moves aria-pressed and calls
23
+ * onToggle(next): true = show the panel. fold.set(pressed) moves it
24
+ * with no call (the host's own change, a kept layout); fold.pressed();
25
+ * fold.destroy().
26
+ * const strip = hydrateEdgeStrip(div, { onShow: () => …, lang });
27
+ * Show panel calls onShow(). The host shows the panel and hides the
28
+ * strip. When focus is still in the strip after that (or fell to the
29
+ * body), it goes to the fold toggle for the same panel, else to the
30
+ * panel when it can take focus. A focus the host moved itself is
31
+ * kept. strip.setCount(n, what?); strip.destroy().
32
+ *
33
+ * Host words are never used: a label, title or aria-label passed to a
34
+ * builder is ignored. The look is panel-fold.css: link it after
35
+ * tokens.css. The host shows or hides each with the `hidden` attribute.
36
+ */
37
+ import { icon } from "./icons.js";
38
+ import { esc, kitT } from "./strings.js";
39
+
40
+ /** The counts a strip may say, worded as the kit's badges are. */
41
+ const WHAT = ["open", "waiting", "down", "running"];
42
+
43
+ const langOf = (lang) => lang || "en";
44
+
45
+ /** The fold toggle's markup (see the top of this file). */
46
+ export function foldToggleHtml(o = {}) {
47
+ const lang = langOf(o.lang);
48
+ const pressed = o.pressed !== false;
49
+ const controls = o.controls ? ` aria-controls="${esc(o.controls)}"` : "";
50
+ return (
51
+ `<button type="button" class="den-fold" aria-pressed="${pressed}"` +
52
+ `${controls} data-den-fold>${icon("panel")}` +
53
+ `<span class="den-fold-word">${esc(kitT(lang, "kit.fold.panel"))}</span>` +
54
+ "</button>"
55
+ );
56
+ }
57
+
58
+ /** The count under Show panel: the number seen, the words heard. */
59
+ function countHtml(n, what, lang) {
60
+ const count = Math.max(0, Math.floor(Number(n) || 0));
61
+ if (!count) return "";
62
+ const kind = WHAT.includes(what) ? what : "open";
63
+ const seen = count > 99 ? "99+" : String(count);
64
+ const heard = kitT(lang, `kit.badge.${kind}`, { n: count });
65
+ return (
66
+ `<span class="den-strip-n" data-den-strip-n>` +
67
+ `<span aria-hidden="true">${esc(seen)}</span>` +
68
+ `<span class="den-strip-sr">${esc(heard)}</span></span>`
69
+ );
70
+ }
71
+
72
+ /** The edge strip's markup (see the top of this file). */
73
+ export function edgeStripHtml(o = {}) {
74
+ const lang = langOf(o.lang);
75
+ const show = esc(kitT(lang, "kit.fold.show"));
76
+ const controls = o.controls ? ` aria-controls="${esc(o.controls)}"` : "";
77
+ return (
78
+ `<div class="den-strip" role="complementary"` +
79
+ ` aria-label="${esc(kitT(lang, "kit.fold.hidden"))}" data-den-strip>` +
80
+ `<button type="button" class="den-strip-show" aria-label="${show}"` +
81
+ ` title="${show}"${controls} data-den-strip-show>${icon("panelShow")}` +
82
+ `</button>${countHtml(o.count, o.what, lang)}</div>`
83
+ );
84
+ }
85
+
86
+ /** The fold toggle in the page (see the top of this file). */
87
+ export function hydrateFoldToggle(btn, opts = {}) {
88
+ const read = () => btn?.getAttribute("aria-pressed") === "true";
89
+ const set = (on) => btn?.setAttribute("aria-pressed", String(Boolean(on)));
90
+ // A <button>: Enter and Space are clicks.
91
+ const onClick = () => {
92
+ const next = !read();
93
+ set(next);
94
+ opts.onToggle?.(next);
95
+ };
96
+ btn?.addEventListener("click", onClick);
97
+ return {
98
+ set,
99
+ pressed: read,
100
+ destroy() {
101
+ btn?.removeEventListener("click", onClick);
102
+ },
103
+ };
104
+ }
105
+
106
+ /** Can a person see it (laid out, not hidden by an ancestor)? */
107
+ const shown = (el) =>
108
+ Boolean(el && el.isConnected && el.getClientRects().length > 0);
109
+
110
+ /** The edge strip in the page (see the top of this file). */
111
+ export function hydrateEdgeStrip(strip, opts = {}) {
112
+ const btn = strip?.querySelector("[data-den-strip-show]");
113
+ const lang = () =>
114
+ opts.lang ||
115
+ strip?.closest("[lang]")?.getAttribute("lang")?.slice(0, 2) ||
116
+ "en";
117
+
118
+ /** Where focus goes when the host left it in a strip now out of sight. */
119
+ function returnFocus() {
120
+ const a = document.activeElement;
121
+ const lost = !a || a === document.body || (strip.contains(a) && !shown(a));
122
+ if (!lost) return;
123
+ const id = btn?.getAttribute("aria-controls");
124
+ const toggle = id
125
+ ? document.querySelector(
126
+ `[data-den-fold][aria-controls="${CSS.escape(id)}"]`,
127
+ )
128
+ : null;
129
+ if (shown(toggle)) return toggle.focus({ preventScroll: true });
130
+ const panel = id ? document.getElementById(id) : null;
131
+ if (shown(panel) && panel.tabIndex >= 0)
132
+ panel.focus({ preventScroll: true });
133
+ }
134
+
135
+ const onClick = () => {
136
+ opts.onShow?.();
137
+ returnFocus();
138
+ };
139
+ btn?.addEventListener("click", onClick);
140
+
141
+ return {
142
+ setCount(n, what) {
143
+ if (!strip) return;
144
+ strip.querySelector("[data-den-strip-n]")?.remove();
145
+ const html = countHtml(n, what, lang());
146
+ if (html) strip.insertAdjacentHTML("beforeend", html);
147
+ },
148
+ destroy() {
149
+ btn?.removeEventListener("click", onClick);
150
+ },
151
+ };
152
+ }
@@ -0,0 +1,75 @@
1
+ /* den-ui: the save-state line's look (savestate.js). Tokens only: no
2
+ colour of its own. Linked, never injected: clean under style-src 'self'.
3
+ The dot's colour is the only thing that moves (var(--dur-fast)). */
4
+ .den-savestate {
5
+ display: flex;
6
+ align-items: center;
7
+ gap: var(--space-1);
8
+ margin: 0;
9
+ min-height: 20px;
10
+ font-family: var(--sans);
11
+ font-size: var(--fs-s);
12
+ font-weight: 400;
13
+ line-height: 20px;
14
+ color: var(--muted);
15
+ }
16
+ .den-savestate::before {
17
+ content: "";
18
+ flex: none;
19
+ width: 6px;
20
+ height: 6px;
21
+ border-radius: 50%;
22
+ background-color: transparent;
23
+ transition: background-color var(--dur-fast) ease;
24
+ }
25
+ /* idle: no words and no dot; the line keeps its height. */
26
+ .den-savestate[data-state="idle"]::before {
27
+ visibility: hidden;
28
+ }
29
+ .den-savestate[data-state="saving"]::before {
30
+ background-color: var(--faint);
31
+ }
32
+ .den-savestate[data-state="saved"]::before {
33
+ background-color: var(--ok);
34
+ }
35
+ .den-savestate[data-state="error"] {
36
+ color: var(--bad);
37
+ }
38
+ .den-savestate[data-state="error"]::before {
39
+ background-color: var(--bad);
40
+ }
41
+ /* Copy text: a link-style button after the words. */
42
+ .den-savestate-copy {
43
+ font: inherit;
44
+ margin: 0;
45
+ margin-inline-start: var(--space-1);
46
+ padding: 0;
47
+ border: 0;
48
+ background: none;
49
+ color: var(--accent-text);
50
+ text-decoration: underline;
51
+ text-underline-offset: 2px;
52
+ cursor: pointer;
53
+ }
54
+ .den-savestate-copy:focus-visible {
55
+ outline: 2px solid var(--accent);
56
+ outline-offset: 2px;
57
+ border-radius: 2px;
58
+ }
59
+ /* The live region beside the line: heard, never seen. */
60
+ .den-savestate-sr {
61
+ position: absolute;
62
+ width: 1px;
63
+ height: 1px;
64
+ padding: 0;
65
+ margin: -1px;
66
+ overflow: hidden;
67
+ clip: rect(0 0 0 0);
68
+ white-space: nowrap;
69
+ border: 0;
70
+ }
71
+ @media (prefers-reduced-motion: reduce) {
72
+ .den-savestate::before {
73
+ transition: none;
74
+ }
75
+ }