eidotter 0.46.1 → 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.
- package/README.md +8 -5
- package/dist/components/Brand/components/Wordmark.d.ts +2 -1
- package/dist/components/Brand/components/Wordmark.js +3 -2
- package/dist/components/CalendarHeatmap/components/CalendarHeatmap.d.ts +2 -2
- package/dist/components/CalendarHeatmap/components/CalendarHeatmap.js +2 -2
- package/dist/components/ChecklistRow/components/ChecklistRow.d.ts +1 -1
- package/dist/components/ChecklistRow/components/ChecklistRow.js +1 -1
- package/dist/components/CopyButton/components/CopyButton.d.ts +1 -1
- package/dist/components/CopyButton/components/CopyButton.js +1 -1
- package/dist/components/EmptyState/components/EmptyState.d.ts +1 -1
- package/dist/components/EmptyState/components/EmptyState.js +1 -1
- package/dist/components/Gauge/components/Gauge.js +1 -1
- package/dist/components/HoldToComplete/components/HoldToComplete.d.ts +1 -1
- package/dist/components/HoldToComplete/components/HoldToComplete.js +1 -1
- package/dist/components/LedgerRow/components/LedgerRow.d.ts +1 -1
- package/dist/components/LedgerRow/components/LedgerRow.js +1 -1
- package/dist/components/ProgressRing/components/ProgressRing.d.ts +1 -1
- package/dist/components/ProgressRing/components/ProgressRing.js +1 -1
- package/dist/components/RetroEffects/components/RetroEffects.d.ts +54 -0
- package/dist/components/RetroEffects/components/RetroEffects.js +124 -4
- package/dist/components/RetroEffects/components/index.d.ts +1 -1
- package/dist/components/RetroEffects/index.d.ts +1 -1
- package/dist/components/SectionHeading/components/SectionHeading.d.ts +1 -1
- package/dist/components/SectionHeading/components/SectionHeading.js +2 -2
- package/dist/components/Stat/components/Stat.js +1 -1
- package/dist/components/registry.d.ts +12 -1
- package/dist/components/registry.js +100 -98
- package/dist/eidotter.css +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.es.js +689 -599
- package/dist/index.umd.js +1 -1
- package/dist/terminal/cga-amber.json +94 -0
- package/dist/terminal/cga-mode4-p0.json +94 -0
- package/dist/terminal/cga-mode4-p1.json +94 -0
- package/dist/terminal/cga-mode5.json +94 -0
- package/dist/terminal/dos-86.json +94 -0
- package/dist/utils/displayTheme.d.ts +32 -4
- package/dist/utils/displayTheme.js +33 -7
- package/guidelines/README.md +14 -2
- package/guidelines/components.md +9 -0
- package/guidelines/design-principles.md +1 -0
- package/guidelines/figma-architecture.md +1 -2
- package/guidelines/terminal-target.md +44 -0
- package/llms.txt +19 -19
- package/migrations/0.47.0.md +209 -0
- package/migrations/README.md +2 -0
- package/package.json +9 -3
- package/src/styles/dos-utilities.css +13 -3
- package/src/styles/shadcn.css +37 -2
- package/src/styles/theme.amber-paper.css +5 -1
- package/src/styles/theme.dos-86.css +79 -0
- package/src/styles/{theme.amber-mono.css → theme.pure-amber.css} +1 -1
- package/src/styles/tokens.css +44 -2
- 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
|
|
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)
|
|
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.
|
|
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-
|
|
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
|
-
<
|
|
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
|
|
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
|
|
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
|
|
35
|
-
*
|
|
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
|
|
34
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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, }) => {
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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
|
-
|
|
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';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { RetroEffects } from './components/index.js';
|
|
2
|
-
export type { RetroEffectsProps, PowerState } from './components/index.js';
|
|
2
|
+
export type { RetroEffectsProps, PowerState, RetroEffectsPreset, RetroEffectsGlowMode } from './components/index.js';
|
|
@@ -19,7 +19,7 @@ export interface SectionHeadingProps {
|
|
|
19
19
|
* DOS-styled section heading — an uppercase `<h3>` label with an optional
|
|
20
20
|
* trailing `(count)` and tone-driven colour. Pure presentational.
|
|
21
21
|
*
|
|
22
|
-
* Ported from
|
|
22
|
+
* Ported from a private consumer (DMNC-855); that version hardcoded
|
|
23
23
|
* `text-cga-*` — this routes tones through `text-dos-*` semantic roles instead
|
|
24
24
|
* so the heading re-themes and stays AA-safe under amber-mono.
|
|
25
25
|
*/
|
|
@@ -10,9 +10,9 @@ const toneClasses = {
|
|
|
10
10
|
* DOS-styled section heading — an uppercase `<h3>` label with an optional
|
|
11
11
|
* trailing `(count)` and tone-driven colour. Pure presentational.
|
|
12
12
|
*
|
|
13
|
-
* Ported from
|
|
13
|
+
* Ported from a private consumer (DMNC-855); that version hardcoded
|
|
14
14
|
* `text-cga-*` — this routes tones through `text-dos-*` semantic roles instead
|
|
15
15
|
* so the heading re-themes and stays AA-safe under amber-mono.
|
|
16
16
|
*/
|
|
17
|
-
export const SectionHeading = ({ title, count, tone = 'default', children, className, }) => (_jsxs("h3", { className: cn('eidotter-section-heading', 'font-dos uppercase tracking-wider mb-2 text-dos-text-sm', toneClasses[tone], className), children: [title, count !== undefined && ` (${count})`, children] }));
|
|
17
|
+
export const SectionHeading = ({ title, count, tone = 'default', children, className, }) => (_jsxs("h3", { className: cn('eidotter-section-heading', 'font-dos-heading uppercase tracking-wider mb-2 text-dos-text-sm', toneClasses[tone], className), children: [title, count !== undefined && ` (${count})`, children] }));
|
|
18
18
|
SectionHeading.displayName = 'SectionHeading';
|
|
@@ -37,6 +37,6 @@ export const Stat = forwardRef(({ label, value, trend, trendValue, size = 'md',
|
|
|
37
37
|
});
|
|
38
38
|
const displayValue = scramble ? scrambledValue : String(value);
|
|
39
39
|
const s = sizeClasses[size] || sizeClasses.md;
|
|
40
|
-
return (_jsxs("div", { ref: ref, className: cn('flex flex-col font-dos', 'eidotter-stat', s.root, className), ...props, children: [_jsx("span", { className: cn('text-dos-text-brand uppercase tracking-wider leading-tight', s.label), children: label }), _jsxs("span", { className: cn('text-dos-text-accent font-bold leading-none tabular-nums', s.value), children: [displayValue, unit && (_jsxs("span", { className: "eidotter-stat__unit text-[0.5em] font-normal text-dos-text-brand", children: [' ', unit] }))] }), note && (_jsx("span", { className: `eidotter-stat__note text-dos-text-muted leading-tight ${s.trend}`, children: note })), target && (_jsx("span", { className: `eidotter-stat__target text-dos-text-brand leading-tight ${s.trend}`, children: target })), trend && (_jsxs("span", { className: cn('inline-flex items-center gap-1 leading-none', trendColorClasses[trend], s.trend), "aria-label": `Trend: ${trendLabels[trend]}${trendValue ? `, ${trendValue}` : ''}`, children: [_jsx("span", { className: "text-[0.8em]", "aria-hidden": "true", children: trendIcons[trend] }), trendValue && (_jsx("span", { className: "tabular-nums", children: trendValue }))] }))] }));
|
|
40
|
+
return (_jsxs("div", { ref: ref, className: cn('flex flex-col font-dos', 'eidotter-stat', s.root, className), ...props, children: [_jsx("span", { className: cn('text-dos-text-brand uppercase tracking-wider leading-tight', s.label), children: label }), _jsxs("span", { className: cn('font-dos-heading text-dos-text-accent font-bold leading-none tabular-nums', s.value), children: [displayValue, unit && (_jsxs("span", { className: "eidotter-stat__unit text-[0.5em] font-normal text-dos-text-brand", children: [' ', unit] }))] }), note && (_jsx("span", { className: `eidotter-stat__note text-dos-text-muted leading-tight ${s.trend}`, children: note })), target && (_jsx("span", { className: `eidotter-stat__target text-dos-text-brand leading-tight ${s.trend}`, children: target })), trend && (_jsxs("span", { className: cn('inline-flex items-center gap-1 leading-none', trendColorClasses[trend], s.trend), "aria-label": `Trend: ${trendLabels[trend]}${trendValue ? `, ${trendValue}` : ''}`, children: [_jsx("span", { className: "text-[0.8em]", "aria-hidden": "true", children: trendIcons[trend] }), trendValue && (_jsx("span", { className: "tabular-nums", children: trendValue }))] }))] }));
|
|
41
41
|
});
|
|
42
42
|
Stat.displayName = 'Stat';
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Projects the registry may name. This file ships in the public package and the
|
|
3
|
+
* public Storybook, so only eiDotter itself and the public sites appear here.
|
|
4
|
+
* A private project must never be added (guarded by registry.public-names.test.ts).
|
|
5
|
+
*/
|
|
6
|
+
export type ProjectId = 'eidotter' | 'rizomorf' | 'dmnctech' | 'eidotter-home' | 'dmnc-online';
|
|
2
7
|
export interface ProjectInfo {
|
|
3
8
|
displayName: string;
|
|
4
9
|
url?: string;
|
|
@@ -45,3 +50,9 @@ export declare function getComponentsByConsumer(projectId: ProjectId): string[];
|
|
|
45
50
|
export declare function getVariantsUsedBy(componentName: string, projectId: ProjectId): string[];
|
|
46
51
|
/** Returns a map of variant name → consumers[] for a component */
|
|
47
52
|
export declare function getVariantConsumerMap(componentName: string): Record<string, ProjectId[]>;
|
|
53
|
+
/**
|
|
54
|
+
* The provenance line printed above every Storybook story. Only names the registry
|
|
55
|
+
* is allowed to carry reach it, and an empty consumer list drops the "Used by" part
|
|
56
|
+
* instead of printing a dangling label.
|
|
57
|
+
*/
|
|
58
|
+
export declare function formatProvenanceLine(meta: ComponentMeta): string;
|