eidotter 0.46.0 → 0.47.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 (61) hide show
  1. package/README.md +8 -5
  2. package/dist/components/Brand/components/Wordmark.d.ts +2 -1
  3. package/dist/components/Brand/components/Wordmark.js +3 -2
  4. package/dist/components/CalendarHeatmap/components/CalendarHeatmap.d.ts +2 -2
  5. package/dist/components/CalendarHeatmap/components/CalendarHeatmap.js +2 -2
  6. package/dist/components/ChecklistRow/components/ChecklistRow.d.ts +1 -1
  7. package/dist/components/ChecklistRow/components/ChecklistRow.js +1 -1
  8. package/dist/components/CopyButton/components/CopyButton.d.ts +1 -1
  9. package/dist/components/CopyButton/components/CopyButton.js +1 -1
  10. package/dist/components/DisplayMenu/components/DisplayMenu.d.ts +8 -5
  11. package/dist/components/DisplayMenu/components/DisplayMenu.js +69 -10
  12. package/dist/components/EmptyState/components/EmptyState.d.ts +1 -1
  13. package/dist/components/EmptyState/components/EmptyState.js +1 -1
  14. package/dist/components/Gauge/components/Gauge.js +1 -1
  15. package/dist/components/HoldToComplete/components/HoldToComplete.d.ts +1 -1
  16. package/dist/components/HoldToComplete/components/HoldToComplete.js +1 -1
  17. package/dist/components/LedgerRow/components/LedgerRow.d.ts +1 -1
  18. package/dist/components/LedgerRow/components/LedgerRow.js +1 -1
  19. package/dist/components/ProgressRing/components/ProgressRing.d.ts +1 -1
  20. package/dist/components/ProgressRing/components/ProgressRing.js +1 -1
  21. package/dist/components/RetroEffects/components/RetroEffects.d.ts +54 -0
  22. package/dist/components/RetroEffects/components/RetroEffects.js +124 -4
  23. package/dist/components/RetroEffects/components/index.d.ts +1 -1
  24. package/dist/components/RetroEffects/index.d.ts +1 -1
  25. package/dist/components/SectionHeading/components/SectionHeading.d.ts +1 -1
  26. package/dist/components/SectionHeading/components/SectionHeading.js +2 -2
  27. package/dist/components/Stat/components/Stat.js +1 -1
  28. package/dist/components/registry.d.ts +12 -1
  29. package/dist/components/registry.js +101 -98
  30. package/dist/eidotter.css +1 -1
  31. package/dist/index.d.ts +4 -3
  32. package/dist/index.es.js +731 -603
  33. package/dist/index.umd.js +3 -3
  34. package/dist/terminal/cga-amber.json +94 -0
  35. package/dist/terminal/cga-mode4-p0.json +94 -0
  36. package/dist/terminal/cga-mode4-p1.json +94 -0
  37. package/dist/terminal/cga-mode5.json +94 -0
  38. package/dist/terminal/dos-86.json +94 -0
  39. package/dist/utils/displayTheme.d.ts +32 -4
  40. package/dist/utils/displayTheme.js +33 -7
  41. package/guidelines/README.md +14 -2
  42. package/guidelines/components.md +9 -0
  43. package/guidelines/design-principles.md +1 -0
  44. package/guidelines/figma-architecture.md +1 -2
  45. package/guidelines/terminal-target.md +44 -0
  46. package/llms.txt +19 -19
  47. package/migrations/0.47.0.md +209 -0
  48. package/migrations/README.md +2 -0
  49. package/package.json +12 -6
  50. package/src/styles/dos-utilities.css +13 -3
  51. package/src/styles/shadcn.css +37 -2
  52. package/src/styles/theme.amber-paper.css +11 -7
  53. package/src/styles/theme.cga-amber.css +7 -7
  54. package/src/styles/theme.cga-mode4-p0.css +7 -7
  55. package/src/styles/theme.cga-mode4-p1.css +7 -7
  56. package/src/styles/theme.cga-mode5.css +7 -7
  57. package/src/styles/theme.dos-86.css +79 -0
  58. package/src/styles/theme.light.css +7 -7
  59. package/src/styles/{theme.amber-mono.css → theme.pure-amber.css} +8 -8
  60. package/src/styles/tokens.css +65 -23
  61. package/tailwind.preset.cjs +4 -2
package/README.md CHANGED
@@ -53,7 +53,7 @@ A single CSS import pulls everything: font, tokens, component styles, and compil
53
53
 
54
54
  ```tsx
55
55
  import 'eidotter/styles'; // Everything: font + tokens + components + utilities
56
- import 'eidotter/themes/amber-mono.css'; // Optional: theme override
56
+ import 'eidotter/themes/cga-amber.css'; // Optional: another theme (dos-86, the default, and Pure Amber are bundled)
57
57
  import 'eidotter/utilities'; // Optional: .dos-* typography classes for raw HTML
58
58
  ```
59
59
 
@@ -116,9 +116,9 @@ for client apps and `'use client'` files.
116
116
 
117
117
  ## Upgrading
118
118
 
119
- Every minor with breaking or visible changes ships an upgrade guide in the package, at `node_modules/eidotter/migrations/<version>.md` (source: [`migrations/`](./migrations/)). Read every guide between your installed version and the target, oldest first. Start with [0.41.0](./migrations/0.41.0.md), then [0.43.0](./migrations/0.43.0.md), [0.44.0](./migrations/0.44.0.md) , [0.45.0](./migrations/0.45.0.md) and [0.46.0](./migrations/0.46.0.md).
119
+ Every minor with breaking or visible changes ships an upgrade guide in the package, at `node_modules/eidotter/migrations/<version>.md` (source: [`migrations/`](./migrations/)). Read every guide between your installed version and the target, oldest first. Start with [0.41.0](./migrations/0.41.0.md), then [0.43.0](./migrations/0.43.0.md), [0.44.0](./migrations/0.44.0.md) , [0.45.0](./migrations/0.45.0.md), [0.46.0](./migrations/0.46.0.md) and [0.47.0](./migrations/0.47.0.md).
120
120
 
121
- 0.x caret ranges stop at the next minor (`^0.40.2` never resolves to 0.41.0), so bump the range explicitly: `npm install eidotter@^0.46.0`.
121
+ 0.x caret ranges stop at the next minor (`^0.40.2` never resolves to 0.41.0), so bump the range explicitly: `npm install eidotter@^0.47.0`.
122
122
 
123
123
  ## Documentation
124
124
 
@@ -126,7 +126,7 @@ Every minor with breaking or visible changes ships an upgrade guide in the packa
126
126
  |---|---|
127
127
  | **Live docs** | [Storybook](https://cinimody.github.io/eiDotter/) — every component with stories, controls, and source |
128
128
  | **Design tokens** | `src/tokens/*.json` (DTCG format) → `tokens.css` via Style Dictionary |
129
- | **Themes** | `amber-mono` (default), `cga-amber`, `cga-mode4-p0/p1`, `cga-mode5` |
129
+ | **Themes** | `dos-86` (default since 0.47: amber with honest functional colours, body text in JetBrains Mono with display-face headings, calmer CRT effects), `pure-amber` (Pure Amber, the previous default; `amber-mono` is its deprecated alias), `cga-amber`, `cga-mode4-p0/p1`, `cga-mode5`, `light`, `amber-paper` (and its variant `dos-86-light`, the light theme of a `dos-86` site: same colours, body face) |
130
130
  | **Font** | [Perfect DOS VGA 437](https://www.dafont.com/perfect-dos-vga-437.font) by Zeh Fernando — pixel-perfect-vector TTF (every glyph outline axis-aligned). Free-to-redistribute per bundled license. Single-weight; all `fontWeight` tokens resolve to 400 |
131
131
  | **Icons** | [pixelarticons](https://github.com/halfmage/pixelarticons) (MIT) — DOS pixel-art glyphs |
132
132
  | **Accessibility** | WCAG AA, React Aria primitives under interactive components, `prefers-reduced-motion` + `prefers-contrast` honored throughout |
@@ -252,9 +252,12 @@ Semantic tokens (`--color-semantic-*`) and Tailwind classes (`bg-dos-*`, `text-d
252
252
  **Theming** is attribute-driven:
253
253
 
254
254
  ```html
255
- <div data-theme="amber-mono">…</div>
255
+ <html data-theme="dos-86"> <!-- the default: amber text, honest red/green/yellow/cyan -->
256
+ <html data-theme="pure-amber"> <!-- Pure Amber, the previous default; `amber-mono` still works -->
256
257
  ```
257
258
 
259
+ The default is `dos-86` (0.47): it is what `resolveDisplayTheme()` and the DisplayMenu helpers return unless a site passes another `dosDark`. To keep Pure Amber as a site's default, pass `themes={{ dosDark: 'pure-amber' }}` and set `data-theme="pure-amber"` on first paint ([migrations/0.47.0.md](./migrations/0.47.0.md)). A page that sets no `data-theme` gets the bare `:root` token defaults, which are neither theme.
260
+
258
261
  ## Development
259
262
 
260
263
  ```bash
@@ -7,7 +7,8 @@ export interface WordmarkProps extends HTMLAttributes<HTMLSpanElement> {
7
7
  /**
8
8
  * eiDotter wordmark — "eiDotter" with the "ei" prefix dimmed against the full-bright "Dotter".
9
9
  *
10
- * Uses the primary DOS font (Perfect DOS VGA 437) and the amber phosphor palette.
10
+ * Uses the heading family (the display face, Perfect DOS VGA 437, in every theme)
11
+ * and the amber phosphor palette.
11
12
  * Sized via `font-size` on the host; the component does not set its own size by
12
13
  * default so it inherits from the surrounding type scale. Wrap in a heading
13
14
  * element if you need semantic weight.
@@ -4,10 +4,11 @@ import { cn } from '../../../utils/cn.js';
4
4
  /**
5
5
  * eiDotter wordmark — "eiDotter" with the "ei" prefix dimmed against the full-bright "Dotter".
6
6
  *
7
- * Uses the primary DOS font (Perfect DOS VGA 437) and the amber phosphor palette.
7
+ * Uses the heading family (the display face, Perfect DOS VGA 437, in every theme)
8
+ * and the amber phosphor palette.
8
9
  * Sized via `font-size` on the host; the component does not set its own size by
9
10
  * default so it inherits from the surrounding type scale. Wrap in a heading
10
11
  * element if you need semantic weight.
11
12
  */
12
- export const Wordmark = forwardRef(({ glow = true, className, ...props }, ref) => (_jsxs("span", { ref: ref, className: cn('eidotter-wordmark font-dos', glow && 'eidotter-wordmark--glow', className), role: "img", "aria-label": "eiDotter", ...props, children: [_jsx("span", { className: "eidotter-wordmark__prefix", "aria-hidden": "true", children: "ei" }), _jsx("span", { className: "eidotter-wordmark__body", "aria-hidden": "true", children: "Dotter" })] })));
13
+ export const Wordmark = forwardRef(({ glow = true, className, ...props }, ref) => (_jsxs("span", { ref: ref, className: cn('eidotter-wordmark font-dos-heading', glow && 'eidotter-wordmark--glow', className), role: "img", "aria-label": "eiDotter", ...props, children: [_jsx("span", { className: "eidotter-wordmark__prefix", "aria-hidden": "true", children: "ei" }), _jsx("span", { className: "eidotter-wordmark__body", "aria-hidden": "true", children: "Dotter" })] })));
13
14
  Wordmark.displayName = 'Wordmark';
@@ -31,8 +31,8 @@ export interface CalendarHeatmapProps {
31
31
  /**
32
32
  * Month calendar rendered as DOS block characters — `█` done, `░` miss,
33
33
  * `·` off, `▒` pending. Presentational and domain-agnostic: callers pass a
34
- * `'YYYY-MM-DD'` → status map rather than any domain object. Ported from the
35
- * Tracker habit app (DMNC-1040), where it visualises a habit's month.
34
+ * `'YYYY-MM-DD'` → status map rather than any domain object. Ported from a
35
+ * private habit app (DMNC-1040), where it visualises a habit's month.
36
36
  *
37
37
  * All calendar maths run in UTC so the rendered grid never drifts by a day
38
38
  * across timezones — the `'YYYY-MM-DD'` keys are treated as plain calendar dates.
@@ -30,8 +30,8 @@ const pad2 = (n) => String(n).padStart(2, '0');
30
30
  /**
31
31
  * Month calendar rendered as DOS block characters — `█` done, `░` miss,
32
32
  * `·` off, `▒` pending. Presentational and domain-agnostic: callers pass a
33
- * `'YYYY-MM-DD'` → status map rather than any domain object. Ported from the
34
- * Tracker habit app (DMNC-1040), where it visualises a habit's month.
33
+ * `'YYYY-MM-DD'` → status map rather than any domain object. Ported from a
34
+ * private habit app (DMNC-1040), where it visualises a habit's month.
35
35
  *
36
36
  * All calendar maths run in UTC so the rendered grid never drifts by a day
37
37
  * across timezones — the `'YYYY-MM-DD'` keys are treated as plain calendar dates.
@@ -31,7 +31,7 @@ export interface ChecklistRowProps {
31
31
  }
32
32
  /**
33
33
  * DOS-styled checklist row — a `[x]`/`[ ]` toggle plus label, optional note,
34
- * and leading/trailing slots. Ported from Steuerdash (DMNC-856).
34
+ * and leading/trailing slots. Ported from a private consumer (DMNC-856).
35
35
  *
36
36
  * The toggle is a real `<button>` (keyboard + screen-reader operable); the
37
37
  * `[x]`/`[ ]` glyph is the DOS checkbox aesthetic. Tones and the note route
@@ -8,7 +8,7 @@ const labelToneClasses = {
8
8
  };
9
9
  /**
10
10
  * DOS-styled checklist row — a `[x]`/`[ ]` toggle plus label, optional note,
11
- * and leading/trailing slots. Ported from Steuerdash (DMNC-856).
11
+ * and leading/trailing slots. Ported from a private consumer (DMNC-856).
12
12
  *
13
13
  * The toggle is a real `<button>` (keyboard + screen-reader operable); the
14
14
  * `[x]`/`[ ]` glyph is the DOS checkbox aesthetic. Tones and the note route
@@ -16,7 +16,7 @@ export interface CopyButtonProps {
16
16
  /**
17
17
  * DOS-styled copy-to-clipboard button — shows `[cp]`, flips to `[OK]` for ~1.5s
18
18
  * after a successful copy. Uses the async Clipboard API with a `execCommand`
19
- * fallback. Ported from Steuerdash (DMNC-858); English default labels (was
19
+ * fallback. Ported from a private consumer (DMNC-858); English default labels (was
20
20
  * German) and `text-dos-link` semantic roles.
21
21
  */
22
22
  export declare const CopyButton: React.FC<CopyButtonProps>;
@@ -5,7 +5,7 @@ import { cn } from '../../../utils/cn.js';
5
5
  /**
6
6
  * DOS-styled copy-to-clipboard button — shows `[cp]`, flips to `[OK]` for ~1.5s
7
7
  * after a successful copy. Uses the async Clipboard API with a `execCommand`
8
- * fallback. Ported from Steuerdash (DMNC-858); English default labels (was
8
+ * fallback. Ported from a private consumer (DMNC-858); English default labels (was
9
9
  * German) and `text-dos-link` semantic roles.
10
10
  */
11
11
  export const CopyButton = ({ value, label = '[cp]', copiedLabel = '[OK]', title = 'Copy to clipboard', copiedTitle = 'Copied!', className, }) => {
@@ -17,7 +17,7 @@ export interface DisplayMenuProps {
17
17
  /** One row per display option: a label and a Switch. */
18
18
  items: DisplayMenuItem[];
19
19
  /**
20
- * Trigger label and the panel's accessible name. Default `'Display'`.
20
+ * Trigger label and the panel's accessible name (a `role="group"`). Default `'Display'`.
21
21
  * Below 640px the trigger shows only the icon; the label stays its
22
22
  * accessible name.
23
23
  */
@@ -42,10 +42,13 @@ export interface DisplayMenuProps {
42
42
  * or the amber-paper theme. Built for Header's `end` slot so every site has
43
43
  * one theme control instead of switches side by side.
44
44
  *
45
- * The panel is a React Aria popover dialog: it portals out of the header (so
46
- * the end slot's clip never cuts it), opening it focuses the first enabled
47
- * switch, Escape and a click outside close it and focus returns to the
48
- * trigger, and Tab moves between the switches.
45
+ * The panel is a non-modal React Aria popover (DMNC-1629): the page behind it
46
+ * stays scrollable, readable and clickable, nothing is hidden from assistive
47
+ * technology and no scrim is drawn. It portals out of the header (so the end
48
+ * slot's clip never cuts it). Opening it focuses the first enabled switch;
49
+ * Tab moves between the switches and Tab past the last one, Escape, a click or
50
+ * tap outside, pressing the trigger again or scrolling the page close it, and
51
+ * focus returns to the trigger.
49
52
  * Consumers own the state; DisplayMenu only renders it.
50
53
  */
51
54
  export declare const DisplayMenu: React.ForwardRefExoticComponent<DisplayMenuProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,11 +1,65 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef, useId } from 'react';
4
- import { Dialog as AriaDialog, DialogTrigger as AriaDialogTrigger, Popover as AriaPopover, } from 'react-aria-components';
3
+ import { forwardRef, useContext, useEffect, useId, useRef } from 'react';
4
+ import { DialogContext, DialogTrigger as AriaDialogTrigger, OverlayTriggerStateContext, Popover as AriaPopover, useSlottedContext, } from 'react-aria-components';
5
+ import { useInteractOutside, useObjectRef } from 'react-aria';
5
6
  import { Monitor } from 'pixelarticons/react/Monitor.js';
6
7
  import { Switch } from '../../Switch/index.js';
7
8
  import { HeaderButton } from '../../HeaderButton/index.js';
8
9
  import { cn } from '../../../utils/cn.js';
10
+ /**
11
+ * Dismissal for the non-modal panel. React Aria's non-modal popover closes
12
+ * on Escape, on page scroll and when focus moves to another element, but not
13
+ * on a tap on empty page (no focus change) and not when Tab leaves it for the
14
+ * document body (the trigger was the last tabbable element). This adds both:
15
+ * an outside pointer interaction closes it, without a scrim or a scroll lock,
16
+ * and after a Tab the panel closes if focus is no longer inside it. A press on
17
+ * the trigger is swallowed here (as React Aria does for its modal popovers), so
18
+ * the trigger's own press cannot reopen the panel the focus change just closed.
19
+ */
20
+ const NonModalDismiss = ({ popoverRef, triggerRef }) => {
21
+ const state = useContext(OverlayTriggerStateContext);
22
+ useInteractOutside({
23
+ ref: popoverRef,
24
+ isDisabled: !state?.isOpen,
25
+ onInteractOutsideStart: (e) => {
26
+ if (triggerRef.current?.contains(e.target))
27
+ e.stopPropagation();
28
+ },
29
+ onInteractOutside: () => state?.close(),
30
+ });
31
+ useEffect(() => {
32
+ const popover = popoverRef.current;
33
+ if (!popover || !state?.isOpen)
34
+ return;
35
+ const doc = popover.ownerDocument;
36
+ const onKeyDown = (e) => {
37
+ if (e.key !== 'Tab' || !popover.contains(e.target))
38
+ return;
39
+ // React Aria's focus scope handles this keydown at the document capture
40
+ // phase and stops its propagation, so listen there too and check where
41
+ // focus landed once it has moved.
42
+ setTimeout(() => {
43
+ const active = doc.activeElement;
44
+ if (!active || !popover.contains(active))
45
+ state.close();
46
+ }, 0);
47
+ };
48
+ doc.addEventListener('keydown', onKeyDown, true);
49
+ return () => doc.removeEventListener('keydown', onKeyDown, true);
50
+ }, [popoverRef, state]);
51
+ return null;
52
+ };
53
+ /**
54
+ * The panel: a labelled group, not a React Aria Dialog (Dialog turns on focus
55
+ * containment, which would keep Tab cycling inside the panel). It carries the
56
+ * overlay id DialogTrigger hands down, so the trigger's `aria-controls`
57
+ * resolves (in non-modal mode the Popover itself no longer takes the id).
58
+ */
59
+ const Panel = ({ label, children }) => {
60
+ const overlayProps = useSlottedContext(DialogContext);
61
+ return (_jsx("div", { id: overlayProps?.id, role: "group", "aria-label": label, className: "eidotter-display-menu__panel", children: children }));
62
+ };
9
63
  /**
10
64
  * DisplayMenu: one header control for display options (DMNC-1619).
11
65
  *
@@ -14,20 +68,25 @@ import { cn } from '../../../utils/cn.js';
14
68
  * or the amber-paper theme. Built for Header's `end` slot so every site has
15
69
  * one theme control instead of switches side by side.
16
70
  *
17
- * The panel is a React Aria popover dialog: it portals out of the header (so
18
- * the end slot's clip never cuts it), opening it focuses the first enabled
19
- * switch, Escape and a click outside close it and focus returns to the
20
- * trigger, and Tab moves between the switches.
71
+ * The panel is a non-modal React Aria popover (DMNC-1629): the page behind it
72
+ * stays scrollable, readable and clickable, nothing is hidden from assistive
73
+ * technology and no scrim is drawn. It portals out of the header (so the end
74
+ * slot's clip never cuts it). Opening it focuses the first enabled switch;
75
+ * Tab moves between the switches and Tab past the last one, Escape, a click or
76
+ * tap outside, pressing the trigger again or scrolling the page close it, and
77
+ * focus returns to the trigger.
21
78
  * Consumers own the state; DisplayMenu only renders it.
22
79
  */
23
80
  export const DisplayMenu = forwardRef(({ items, label = 'Display', labelDisplay = 'responsive', placement = 'bottom end', defaultOpen, className, }, ref) => {
24
81
  const baseId = useId();
82
+ const triggerRef = useObjectRef(ref);
83
+ const popoverRef = useRef(null);
25
84
  // Opening the panel puts focus on the first switch that can be toggled,
26
85
  // so Space works straight away (DMNC-1619 follow-up).
27
86
  const firstEnabled = items.findIndex((item) => !item.disabled);
28
- return (_jsxs(AriaDialogTrigger, { defaultOpen: defaultOpen, children: [_jsx(HeaderButton, { ref: ref, "aria-label": label, icon: _jsx(Monitor, { className: "eidotter-display-menu__icon", focusable: "false" }), chevron: true, labelDisplay: labelDisplay, className: cn('eidotter-display-menu', `eidotter-display-menu--${labelDisplay}`, className), children: label }), _jsx(AriaPopover, { placement: placement, offset: 6, className: "eidotter-display-menu__popover", children: _jsx(AriaDialog, { "aria-label": label, className: "eidotter-display-menu__panel", children: _jsx("ul", { className: "eidotter-display-menu__list", children: items.map((item, index) => {
29
- const hintId = item.hint ? `${baseId}-${item.id}-hint` : undefined;
30
- return (_jsxs("li", { className: "eidotter-display-menu__row", children: [_jsx(Switch, { label: item.label, checked: item.checked, onChange: item.onChange, disabled: item.disabled, "aria-describedby": hintId, autoFocus: index === firstEnabled, className: "eidotter-display-menu__switch" }), item.hint && (_jsx("span", { id: hintId, className: "eidotter-display-menu__hint", children: item.hint }))] }, item.id));
31
- }) }) }) })] }));
87
+ return (_jsxs(AriaDialogTrigger, { defaultOpen: defaultOpen, children: [_jsx(HeaderButton, { ref: triggerRef, "aria-label": label, icon: _jsx(Monitor, { className: "eidotter-display-menu__icon", focusable: "false" }), chevron: true, labelDisplay: labelDisplay, className: cn('eidotter-display-menu', `eidotter-display-menu--${labelDisplay}`, className), children: label }), _jsxs(AriaPopover, { ref: popoverRef, isNonModal: true, placement: placement, offset: 6, className: "eidotter-display-menu__popover", children: [_jsx(NonModalDismiss, { popoverRef: popoverRef, triggerRef: triggerRef }), _jsx(Panel, { label: label, children: _jsx("ul", { className: "eidotter-display-menu__list", children: items.map((item, index) => {
88
+ const hintId = item.hint ? `${baseId}-${item.id}-hint` : undefined;
89
+ return (_jsxs("li", { className: "eidotter-display-menu__row", children: [_jsx(Switch, { label: item.label, checked: item.checked, onChange: item.onChange, disabled: item.disabled, "aria-describedby": hintId, autoFocus: index === firstEnabled, className: "eidotter-display-menu__switch" }), item.hint && (_jsx("span", { id: hintId, className: "eidotter-display-menu__hint", children: item.hint }))] }, item.id));
90
+ }) }) })] })] }));
32
91
  });
33
92
  DisplayMenu.displayName = 'DisplayMenu';
@@ -19,7 +19,7 @@ export interface EmptyStateProps {
19
19
  * DOS-styled empty / zero-state — a centred title, optional description, and an
20
20
  * optional action slot. Pure presentational.
21
21
  *
22
- * Ported from Steuerdash (DMNC-859); tones and the description route through
22
+ * Ported from a private consumer (DMNC-859); tones and the description route through
23
23
  * `text-dos-*` semantic roles (not raw `cga-*`) so it re-themes and the
24
24
  * description stays AA-safe (`text-muted` → lightGray under amber-mono).
25
25
  */
@@ -10,7 +10,7 @@ const toneClasses = {
10
10
  * DOS-styled empty / zero-state — a centred title, optional description, and an
11
11
  * optional action slot. Pure presentational.
12
12
  *
13
- * Ported from Steuerdash (DMNC-859); tones and the description route through
13
+ * Ported from a private consumer (DMNC-859); tones and the description route through
14
14
  * `text-dos-*` semantic roles (not raw `cga-*`) so it re-themes and the
15
15
  * description stays AA-safe (`text-muted` → lightGray under amber-mono).
16
16
  */
@@ -76,6 +76,6 @@ export const Gauge = forwardRef(({ label, shortLabel, value, max = 100, unit, se
76
76
  const [secondaryHead, secondaryTail] = splitSecondary(secondary ?? '');
77
77
  const secondaryPart = secondary && !unknown && !loading ? (_jsxs("span", { className: "eidotter-gauge__secondary text-dos-text-brand text-dos-text-base tabular-nums leading-none", children: [_jsx("span", { className: "eidotter-gauge__secondary-head", children: secondaryHead }), secondaryTail !== null && (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "eidotter-gauge__secondary-tail", children: secondaryTail })] }))] })) : null;
78
78
  const tagText = provenanceLabel(labels, provenance);
79
- return (_jsxs("div", { ref: ref, className: cn('eidotter-gauge eidotter-health flex flex-col items-center gap-1 w-full font-dos', sizeClasses[size] ?? sizeClasses.md, toneClasses[effectiveTone], statusClasses[status], className), style: { minWidth: diameter }, "data-size": sizeKey, "data-has-short": shortLabel ? 'true' : 'false', role: "meter", "aria-valuemin": 0, "aria-valuemax": unknown ? 100 : max, "aria-valuenow": unknown || loading ? 0 : Math.max(0, Math.min(value, max)), "aria-valuetext": valuetext, "aria-label": name, "aria-busy": loading || undefined, ...props, children: [_jsxs("div", { className: "relative inline-flex items-center justify-center", children: [_jsx(ProgressRing, { decorative: true, value: loading ? 0 : pct, max: 100, size: diameter, thickness: thickness, segments: toneSegments[effectiveTone] ?? 16, color: effectiveTone === 'neutral' ? undefined : 'var(--eidotter-fill)', glow: false, className: cn(glow && 'eidotter-health-glow') }), _jsx("div", { className: "eidotter-gauge__center absolute flex flex-col items-center justify-center min-w-0 text-center leading-none", style: { inset: thickness + 2 }, children: loading ? (_jsx("div", { "aria-hidden": "true", className: "eidotter-gauge__skeleton w-full overflow-hidden", children: _jsx(Skeleton, { variant: "figure", lines: 2, animated: false }) })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('eidotter-gauge__value text-dos-text-accent tabular-nums', valueSizeClasses[sizeKey], stale && 'opacity-60'), children: valueText }), !secondaryBelow && secondaryPart] })) })] }), secondaryBelow && secondaryPart, _jsxs("div", { className: "flex flex-wrap items-center justify-center gap-1 text-dos-text-brand uppercase tracking-wider leading-tight max-w-full", children: [effectiveTone === 'critical' && (_jsx("span", { "aria-hidden": "true", className: "eidotter-gauge__glyph text-dos-text-error", children: "\u25B2" })), _jsxs("span", { className: "eidotter-gauge__label truncate", title: label, children: [_jsx("span", { className: "eidotter-gauge__label--full", children: label }), shortLabel && _jsx("span", { className: "eidotter-gauge__label--short", children: shortLabel })] }), overflow && (_jsx("span", { "aria-hidden": "true", className: "eidotter-gauge__overflow text-dos-text-warning", children: "+" })), tagText !== null && (_jsx("span", { className: "eidotter-gauge__provenance border border-dos-border-brand px-1 normal-case", children: tagText })), stale && _jsx("span", { className: "eidotter-gauge__stale normal-case", children: labels.stale })] }), resolved.label && (_jsx("span", { className: "eidotter-gauge__band text-dos-text-brand normal-case", children: resolved.label }))] }));
79
+ return (_jsxs("div", { ref: ref, className: cn('eidotter-gauge eidotter-health flex flex-col items-center gap-1 w-full font-dos', sizeClasses[size] ?? sizeClasses.md, toneClasses[effectiveTone], statusClasses[status], className), style: { minWidth: diameter }, "data-size": sizeKey, "data-has-short": shortLabel ? 'true' : 'false', role: "meter", "aria-valuemin": 0, "aria-valuemax": unknown ? 100 : max, "aria-valuenow": unknown || loading ? 0 : Math.max(0, Math.min(value, max)), "aria-valuetext": valuetext, "aria-label": name, "aria-busy": loading || undefined, ...props, children: [_jsxs("div", { className: "relative inline-flex items-center justify-center", children: [_jsx(ProgressRing, { decorative: true, value: loading ? 0 : pct, max: 100, size: diameter, thickness: thickness, segments: toneSegments[effectiveTone] ?? 16, color: effectiveTone === 'neutral' ? undefined : 'var(--eidotter-fill)', glow: false, className: cn(glow && 'eidotter-health-glow') }), _jsx("div", { className: "eidotter-gauge__center absolute flex flex-col items-center justify-center min-w-0 text-center leading-none", style: { inset: thickness + 2 }, children: loading ? (_jsx("div", { "aria-hidden": "true", className: "eidotter-gauge__skeleton w-full overflow-hidden", children: _jsx(Skeleton, { variant: "figure", lines: 2, animated: false }) })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('eidotter-gauge__value font-dos-heading text-dos-text-accent tabular-nums', valueSizeClasses[sizeKey], stale && 'opacity-60'), children: valueText }), !secondaryBelow && secondaryPart] })) })] }), secondaryBelow && secondaryPart, _jsxs("div", { className: "flex flex-wrap items-center justify-center gap-1 text-dos-text-brand uppercase tracking-wider leading-tight max-w-full", children: [effectiveTone === 'critical' && (_jsx("span", { "aria-hidden": "true", className: "eidotter-gauge__glyph text-dos-text-error", children: "\u25B2" })), _jsxs("span", { className: "eidotter-gauge__label truncate", title: label, children: [_jsx("span", { className: "eidotter-gauge__label--full", children: label }), shortLabel && _jsx("span", { className: "eidotter-gauge__label--short", children: shortLabel })] }), overflow && (_jsx("span", { "aria-hidden": "true", className: "eidotter-gauge__overflow text-dos-text-warning", children: "+" })), tagText !== null && (_jsx("span", { className: "eidotter-gauge__provenance border border-dos-border-brand px-1 normal-case", children: tagText })), stale && _jsx("span", { className: "eidotter-gauge__stale normal-case", children: labels.stale })] }), resolved.label && (_jsx("span", { className: "eidotter-gauge__band text-dos-text-brand normal-case", children: resolved.label }))] }));
80
80
  });
81
81
  Gauge.displayName = 'Gauge';
@@ -25,6 +25,6 @@ export interface HoldToCompleteProps {
25
25
  * Press-and-hold to complete, with a chunky {@link ProgressRing} filling during
26
26
  * the hold and reversing on an early release. Works with mouse, touch, and pen
27
27
  * via Pointer Events; keyboard users complete directly with Enter or Space.
28
- * Ported from the Tracker habit app's hold-to-complete tile (DMNC-1040).
28
+ * Ported from a private habit app's hold-to-complete tile (DMNC-1040).
29
29
  */
30
30
  export declare const HoldToComplete: React.ForwardRefExoticComponent<HoldToCompleteProps & React.RefAttributes<HTMLDivElement>>;
@@ -12,7 +12,7 @@ const CANCEL_MS = 120;
12
12
  * Press-and-hold to complete, with a chunky {@link ProgressRing} filling during
13
13
  * the hold and reversing on an early release. Works with mouse, touch, and pen
14
14
  * via Pointer Events; keyboard users complete directly with Enter or Space.
15
- * Ported from the Tracker habit app's hold-to-complete tile (DMNC-1040).
15
+ * Ported from a private habit app's hold-to-complete tile (DMNC-1040).
16
16
  */
17
17
  export const HoldToComplete = forwardRef(({ onHold, onTap, onHoldProgress, holdDuration = 700, ringColor, ringScale = 0.72, disabled = false, 'aria-label': ariaLabel, className, children, }, ref) => {
18
18
  const [progress, setProgress] = useState(0);
@@ -23,7 +23,7 @@ export interface LedgerRowProps {
23
23
  * DOS-styled ledger row — a label/note on the left and a right-aligned value
24
24
  * with optional copy + trailing slot. A generic value-row primitive.
25
25
  *
26
- * Generalised from Steuerdash's money-specific LedgerRow (DMNC-857): currency
26
+ * Generalised from a private consumer's money-specific LedgerRow (DMNC-857): currency
27
27
  * formatting, Paperless links, and verify/shared badges are intentionally NOT
28
28
  * built in — pass a pre-formatted `value`, a raw `copyValue` for the copy
29
29
  * affordance, and compose domain chrome via `trailing`. Routes through
@@ -5,7 +5,7 @@ import { CopyButton } from '../../CopyButton/index.js';
5
5
  * DOS-styled ledger row — a label/note on the left and a right-aligned value
6
6
  * with optional copy + trailing slot. A generic value-row primitive.
7
7
  *
8
- * Generalised from Steuerdash's money-specific LedgerRow (DMNC-857): currency
8
+ * Generalised from a private consumer's money-specific LedgerRow (DMNC-857): currency
9
9
  * formatting, Paperless links, and verify/shared badges are intentionally NOT
10
10
  * built in — pass a pre-formatted `value`, a raw `copyValue` for the copy
11
11
  * affordance, and compose domain chrome via `trailing`. Routes through
@@ -34,7 +34,7 @@ export interface ProgressRingProps {
34
34
  * Blocky DOS-style progress ring: the arc is split into `segments` chunky
35
35
  * quantized blocks. Filled blocks paint in the ring colour; the remainder
36
36
  * stays as a faint track. Driven by a plain `value` prop so the renderer is
37
- * presentational and swappable. Ported from the Tracker habit app (DMNC-1040),
37
+ * presentational and swappable. Ported from a private habit app (DMNC-1040),
38
38
  * where it powers the hold-to-complete feedback ring.
39
39
  */
40
40
  export declare const ProgressRing: React.ForwardRefExoticComponent<ProgressRingProps & React.RefAttributes<HTMLDivElement>>;
@@ -6,7 +6,7 @@ const clamp = (n, lo, hi) => Math.min(hi, Math.max(lo, n));
6
6
  * Blocky DOS-style progress ring: the arc is split into `segments` chunky
7
7
  * quantized blocks. Filled blocks paint in the ring colour; the remainder
8
8
  * stays as a faint track. Driven by a plain `value` prop so the renderer is
9
- * presentational and swappable. Ported from the Tracker habit app (DMNC-1040),
9
+ * presentational and swappable. Ported from a private habit app (DMNC-1040),
10
10
  * where it powers the hold-to-complete feedback ring.
11
11
  */
12
12
  export const ProgressRing = forwardRef(({ value = 0, max = 100, size = 64, thickness = 8, segments = 16, color, showLabel = false, glow = false, decorative = false, className, 'aria-label': ariaLabel, ...props }, ref) => {
@@ -1,5 +1,21 @@
1
1
  import React from 'react';
2
2
  export type PowerState = 'on' | 'powering-on' | 'powering-off' | 'off';
3
+ /**
4
+ * Named effect value sets (DMNC-1643). `default` is the eidotter monitor, tuned
5
+ * for a page seen for seconds; `long-reading` is the DOS-86 monitor, tuned for
6
+ * text read for hours (scanlines 0.20 at a 3px pitch and still, no flicker,
7
+ * aperture grille 0.06, vignette 0.22, bloom 0.22).
8
+ */
9
+ export type RetroEffectsPreset = 'default' | 'long-reading';
10
+ /**
11
+ * Where the phosphor glow comes from (DMNC-1643). `element` (default) is
12
+ * today's rendering: each component draws its own glow (text-shadow,
13
+ * box-shadow). `sampled` also blurs the rendered page itself, like the DOS-86
14
+ * terminal shader, with an SVG filter on the html element.
15
+ */
16
+ export type RetroEffectsGlowMode = 'element' | 'sampled';
17
+ /** The id the `:root[data-eidotter-glow="sampled"]` rule in RetroEffects.css points at. */
18
+ export declare const RETRO_GLOW_FILTER_ID = "eidotter-retro-glow-filter";
3
19
  export interface RetroEffectsProps {
4
20
  /**
5
21
  * Enable scanline overlay effect
@@ -18,6 +34,42 @@ export interface RetroEffectsProps {
18
34
  * Defaults to false for performance - adds an extra compositing layer.
19
35
  */
20
36
  bloom?: boolean;
37
+ /**
38
+ * Render the aperture grille overlay (faint vertical red, green and blue
39
+ * stripes). Its strength is the `--effect-mask-intensity` token, 0 by
40
+ * default, so the layer only shows once a preset or the token raises it.
41
+ * Defaults to on under `preset="long-reading"`, off otherwise (an extra
42
+ * compositing layer, like `bloom`). Under the `dos-86` theme the grille is
43
+ * on without this prop (drawn by the overlay root itself, at 0.06);
44
+ * `mask={false}` turns it off there too.
45
+ */
46
+ mask?: boolean;
47
+ /**
48
+ * Effect value set. `'long-reading'` sets `data-effects="long-reading"` on the
49
+ * root, which redefines the `--effect-*` tokens for this overlay. `'default'`
50
+ * (the default) sets no attribute, so a `data-effects` on an ancestor still
51
+ * applies. Layer toggles (`scanlines`, `glow`, `flicker`, `bloom`) are not
52
+ * changed by the preset; `mask` defaults to on under it. Under the `dos-86`
53
+ * theme (the default since DMNC-1643 PR E) the long-reading values apply
54
+ * whatever this prop says: they are that theme's effect values.
55
+ */
56
+ preset?: RetroEffectsPreset;
57
+ /**
58
+ * Where the phosphor glow comes from (DMNC-1643). `'element'` (the default)
59
+ * renders exactly as before: each component draws its own glow. `'sampled'`
60
+ * also takes the glow from the rendered picture: an SVG filter on the html
61
+ * element blurs the page at two radii and screens both back over it (the
62
+ * `--effect-phosphor-sampled-*` tokens; the long-reading preset carries the
63
+ * DOS-86 values). Opt-in, and client-only: the server render and the first
64
+ * client render are the element path, and the filter is applied after mount.
65
+ * Stays on the element path under `prefers-reduced-transparency: reduce`,
66
+ * `prefers-contrast: more`, in a browser without SVG filter support, on the
67
+ * light grounds (`light`, `amber-paper`) and while powered off. One
68
+ * RetroEffects per page should use it. Costly on long pages without GPU
69
+ * rasterisation; see the component docs. Unrelated to `glow`, which is the
70
+ * vignette layer.
71
+ */
72
+ glowMode?: RetroEffectsGlowMode;
21
73
  /**
22
74
  * Whether the CRT is powered on. Animates on/off transitions.
23
75
  */
@@ -108,6 +160,8 @@ export interface RetroEffectsProps {
108
160
  * - Glow vignette (phosphor edge darkening)
109
161
  * - Subtle CRT flicker animation (WCAG 2.3.1 compliant)
110
162
  * - Phosphor bloom effect (opt-in)
163
+ * - Aperture grille (opt-in; on under the long-reading preset)
164
+ * - Effect presets (`preset="long-reading"`)
111
165
  * - Power on/off animations
112
166
  * - Configurable intensity
113
167
  * - Respects reduced motion preferences
@@ -1,8 +1,69 @@
1
1
  'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from 'react';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { cn } from '../../../utils/cn.js';
5
5
  import { prefersReducedMotion } from '../../../utils/prefersReducedMotion.js';
6
+ /** The id the `:root[data-eidotter-glow="sampled"]` rule in RetroEffects.css points at. */
7
+ export const RETRO_GLOW_FILTER_ID = 'eidotter-retro-glow-filter';
8
+ const GLOW_ATTRIBUTE = 'data-eidotter-glow';
9
+ /**
10
+ * Instances whose sampled glow is active. The html attribute is shared, so it is
11
+ * set by the first and removed only when the last one lets go (a route change
12
+ * can mount the new overlay before the old one unmounts).
13
+ */
14
+ let sampledGlowOwners = 0;
15
+ /** Layout effect in the browser (no server warning); the attribute must change in the same commit as the filter. */
16
+ const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
17
+ /** Media queries under which the sampled glow falls back to the element path. */
18
+ const SAMPLED_GLOW_FALLBACK_QUERIES = [
19
+ '(prefers-reduced-transparency: reduce)',
20
+ '(prefers-contrast: more)',
21
+ '(prefers-contrast: high)',
22
+ ];
23
+ /** Browser feature check: CSS `filter: url()` on HTML and SVG Gaussian blur. */
24
+ const supportsSampledGlow = () => {
25
+ if (typeof window === 'undefined')
26
+ return false;
27
+ try {
28
+ return (typeof window.CSS?.supports === 'function' &&
29
+ window.CSS.supports('filter', `url(#${RETRO_GLOW_FILTER_ID})`) &&
30
+ typeof window.SVGFEGaussianBlurElement !== 'undefined');
31
+ }
32
+ catch {
33
+ return false;
34
+ }
35
+ };
36
+ const fallbackMediaMatches = () => typeof window.matchMedia === 'function' &&
37
+ SAMPLED_GLOW_FALLBACK_QUERIES.some((query) => window.matchMedia(query).matches);
38
+ /**
39
+ * Read the --effect-phosphor-sampled-* tokens as resolved on the overlay root
40
+ * (so a preset or theme on it or an ancestor applies). Returns null when a value
41
+ * is missing or both strengths are 0: then there is nothing to draw.
42
+ */
43
+ const readSampledGlowValues = (el) => {
44
+ const style = window.getComputedStyle(el);
45
+ const read = (name) => parseFloat(style.getPropertyValue(`--effect-phosphor-sampled-${name}`));
46
+ const values = {
47
+ tightRadius: read('tight-radius'),
48
+ tightIntensity: read('tight-intensity'),
49
+ haloRadius: read('halo-radius'),
50
+ haloIntensity: read('halo-intensity'),
51
+ };
52
+ if (Object.values(values).some((v) => !Number.isFinite(v) || v < 0))
53
+ return null;
54
+ if (values.tightIntensity === 0 && values.haloIntensity === 0)
55
+ return null;
56
+ return values;
57
+ };
58
+ const sameGlowValues = (a, b) => a === b ||
59
+ (!!a &&
60
+ !!b &&
61
+ a.tightRadius === b.tightRadius &&
62
+ a.tightIntensity === b.tightIntensity &&
63
+ a.haloRadius === b.haloRadius &&
64
+ a.haloIntensity === b.haloIntensity);
65
+ /** One blur pass scaled by its strength (premultiplied, so all four channels). */
66
+ const GlowPass = ({ radius, intensity, result, }) => (_jsxs(_Fragment, { children: [_jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: radius, result: `${result}-blur` }), _jsxs("feComponentTransfer", { in: `${result}-blur`, result: result, children: [_jsx("feFuncR", { type: "linear", slope: intensity }), _jsx("feFuncG", { type: "linear", slope: intensity }), _jsx("feFuncB", { type: "linear", slope: intensity }), _jsx("feFuncA", { type: "linear", slope: intensity })] })] }));
6
67
  const DEFAULT_BOOT_STORAGE_KEY = 'eidotter:retro-boot';
7
68
  const BOOT_FLAG_VALUE = '1';
8
69
  /** Read a sessionStorage flag, swallowing access errors (private mode, SSR). */
@@ -35,11 +96,13 @@ const markBootedThisSession = (key) => {
35
96
  * - Glow vignette (phosphor edge darkening)
36
97
  * - Subtle CRT flicker animation (WCAG 2.3.1 compliant)
37
98
  * - Phosphor bloom effect (opt-in)
99
+ * - Aperture grille (opt-in; on under the long-reading preset)
100
+ * - Effect presets (`preset="long-reading"`)
38
101
  * - Power on/off animations
39
102
  * - Configurable intensity
40
103
  * - Respects reduced motion preferences
41
104
  */
42
- export const RetroEffects = ({ scanlines = true, glow = true, flicker = true, bloom = false, powered = true, boot = false, bootOnce = false, bootStorageKey = DEFAULT_BOOT_STORAGE_KEY, intensity = 1, className, onPowerStateChange, onPowerOn, onPowerOff, onBootComplete, }) => {
105
+ export const RetroEffects = ({ scanlines = true, glow = true, flicker = true, bloom = false, mask, preset = 'default', glowMode = 'element', powered = true, boot = false, bootOnce = false, bootStorageKey = DEFAULT_BOOT_STORAGE_KEY, intensity = 1, className, onPowerStateChange, onPowerOn, onPowerOff, onBootComplete, }) => {
43
106
  const prevPoweredRef = useRef(powered);
44
107
  const [powerState, setPowerState] = useState(powered ? 'on' : 'off');
45
108
  // The opaque boot cover renders on first paint for BOTH the gated and
@@ -172,8 +235,65 @@ export const RetroEffects = ({ scanlines = true, glow = true, flicker = true, bl
172
235
  return;
173
236
  settlePowerState();
174
237
  };
238
+ // `mask={false}` also turns off the grille a theme draws on its own (dos-86
239
+ // draws it as the root's ::after, DMNC-1643 PR E). Only an explicit false
240
+ // writes the variable, so the default markup is unchanged.
175
241
  const opacityStyle = { '--retro-intensity': intensity };
242
+ if (mask === false)
243
+ opacityStyle['--effect-mask-intensity'] = 0;
176
244
  // Don't render children when fully off
177
245
  const isVisible = powerState !== 'off';
178
- return (_jsxs("div", { className: cn('fixed inset-0 pointer-events-none z-[9999]', 'eidotter-retro-effects', powerState === 'powering-off' && 'eidotter-retro-effects--powering-off', powerState === 'powering-on' && 'eidotter-retro-effects--powering-on', powerState === 'off' && 'eidotter-retro-effects--off', className), style: opacityStyle, "aria-hidden": "true", onAnimationEnd: handleAnimationEnd, onTransitionEnd: handleTransitionEnd, children: [isVisible && (_jsxs(_Fragment, { children: [scanlines && _jsx("div", { className: "eidotter-retro-effects__scanlines" }), glow && _jsx("div", { className: "eidotter-retro-effects__glow" }), flicker && _jsx("div", { className: "eidotter-retro-effects__flicker" }), bloom && _jsx("div", { className: "eidotter-retro-effects__bloom" })] })), booting && (_jsxs("div", { className: "eidotter-retro-effects__boot", onAnimationEnd: handleBootAnimationEnd, children: [_jsx("div", { className: "eidotter-retro-effects__boot-panel eidotter-retro-effects__boot-panel--top" }), _jsx("div", { className: "eidotter-retro-effects__boot-panel eidotter-retro-effects__boot-panel--bottom" }), _jsx("div", { className: "eidotter-retro-effects__boot-line" }), _jsx("div", { className: "eidotter-retro-effects__boot-glow" })] }))] }));
246
+ const showMask = mask ?? preset === 'long-reading';
247
+ // Sampled glow (DMNC-1643). null = element path. Starts null on the server and
248
+ // on the first client render, so hydration always matches; decided after mount.
249
+ const rootRef = useRef(null);
250
+ const [sampledGlow, setSampledGlow] = useState(null);
251
+ const sampledWanted = glowMode === 'sampled' && isVisible;
252
+ useEffect(() => {
253
+ const root = rootRef.current;
254
+ if (!sampledWanted || !root || !supportsSampledGlow()) {
255
+ setSampledGlow(null);
256
+ return;
257
+ }
258
+ const evaluate = () => {
259
+ const next = fallbackMediaMatches() ? null : readSampledGlowValues(root);
260
+ setSampledGlow((prev) => (sameGlowValues(prev, next) ? prev : next));
261
+ };
262
+ evaluate();
263
+ // Re-evaluate when the user changes a preference or the site switches theme
264
+ // or effect preset (the tokens are read, not hardcoded).
265
+ const queries = typeof window.matchMedia === 'function'
266
+ ? SAMPLED_GLOW_FALLBACK_QUERIES.map((query) => window.matchMedia(query))
267
+ : [];
268
+ queries.forEach((mql) => mql.addEventListener?.('change', evaluate));
269
+ const observer = typeof MutationObserver === 'undefined' ? null : new MutationObserver(evaluate);
270
+ const watched = { attributes: true, attributeFilter: ['data-theme', 'class', 'data-effects', 'style'] };
271
+ observer?.observe(document.documentElement, watched);
272
+ if (document.body)
273
+ observer?.observe(document.body, watched);
274
+ // A stylesheet that arrives after mount changes the tokens without a mutation.
275
+ window.addEventListener('load', evaluate);
276
+ return () => {
277
+ queries.forEach((mql) => mql.removeEventListener?.('change', evaluate));
278
+ observer?.disconnect();
279
+ window.removeEventListener('load', evaluate);
280
+ };
281
+ }, [sampledWanted, preset]);
282
+ // Point the html element at the filter only while the <filter> is in the DOM
283
+ // (a url() to a missing filter is not reliably ignored across browsers): a
284
+ // layout effect, so set and removal land in the same commit as the filter.
285
+ const sampledActive = sampledGlow !== null;
286
+ useIsomorphicLayoutEffect(() => {
287
+ if (!sampledActive)
288
+ return;
289
+ const html = document.documentElement;
290
+ sampledGlowOwners += 1;
291
+ html.setAttribute(GLOW_ATTRIBUTE, 'sampled');
292
+ return () => {
293
+ sampledGlowOwners -= 1;
294
+ if (sampledGlowOwners === 0)
295
+ html.removeAttribute(GLOW_ATTRIBUTE);
296
+ };
297
+ }, [sampledActive]);
298
+ return (_jsxs("div", { ref: rootRef, className: cn('fixed inset-0 pointer-events-none z-[9999]', 'eidotter-retro-effects', powerState === 'powering-off' && 'eidotter-retro-effects--powering-off', powerState === 'powering-on' && 'eidotter-retro-effects--powering-on', powerState === 'off' && 'eidotter-retro-effects--off', className), style: opacityStyle, "data-effects": preset === 'default' ? undefined : preset, "aria-hidden": "true", onAnimationEnd: handleAnimationEnd, onTransitionEnd: handleTransitionEnd, children: [isVisible && (_jsxs(_Fragment, { children: [scanlines && _jsx("div", { className: "eidotter-retro-effects__scanlines" }), glow && _jsx("div", { className: "eidotter-retro-effects__glow" }), flicker && _jsx("div", { className: "eidotter-retro-effects__flicker" }), bloom && _jsx("div", { className: "eidotter-retro-effects__bloom" }), showMask && _jsx("div", { className: "eidotter-retro-effects__mask" })] })), sampledGlow && (_jsx("svg", { className: "eidotter-retro-effects__glow-filter", focusable: "false", children: _jsxs("filter", { id: RETRO_GLOW_FILTER_ID, x: "0", y: "0", width: "100%", height: "100%", colorInterpolationFilters: "sRGB", children: [_jsx(GlowPass, { radius: sampledGlow.tightRadius, intensity: sampledGlow.tightIntensity, result: "tight" }), _jsx(GlowPass, { radius: sampledGlow.haloRadius, intensity: sampledGlow.haloIntensity, result: "halo" }), _jsx("feBlend", { in: "SourceGraphic", in2: "tight", mode: "screen", result: "with-tight" }), _jsx("feBlend", { in: "with-tight", in2: "halo", mode: "screen" })] }) })), booting && (_jsxs("div", { className: "eidotter-retro-effects__boot", onAnimationEnd: handleBootAnimationEnd, children: [_jsx("div", { className: "eidotter-retro-effects__boot-panel eidotter-retro-effects__boot-panel--top" }), _jsx("div", { className: "eidotter-retro-effects__boot-panel eidotter-retro-effects__boot-panel--bottom" }), _jsx("div", { className: "eidotter-retro-effects__boot-line" }), _jsx("div", { className: "eidotter-retro-effects__boot-glow" })] }))] }));
179
299
  };
@@ -1,2 +1,2 @@
1
1
  export { RetroEffects } from './RetroEffects.js';
2
- export type { RetroEffectsProps, PowerState } from './RetroEffects.js';
2
+ export type { RetroEffectsProps, PowerState, RetroEffectsPreset, RetroEffectsGlowMode } from './RetroEffects.js';