@supersuit/components 0.0.0-stage → 0.3.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/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/README.md +338 -2
- package/bin/supersuit-theme.mjs +116 -0
- package/dist/app-shell/app-shell.d.ts +68 -0
- package/dist/app-shell/app-shell.js +62 -0
- package/dist/app-shell/index.d.ts +3 -0
- package/dist/app-shell/index.js +5 -0
- package/dist/app-shell/sheet.d.ts +14 -0
- package/dist/app-shell/sheet.js +57 -0
- package/dist/app-shell/styles.css +112 -0
- package/dist/check/depth/bar.d.ts +27 -0
- package/dist/check/depth/bar.js +40 -0
- package/dist/check/depth/check.d.ts +40 -0
- package/dist/check/depth/check.js +50 -0
- package/dist/check/depth/crop.d.ts +24 -0
- package/dist/check/depth/crop.js +126 -0
- package/dist/check/depth/index.d.ts +3 -0
- package/dist/check/depth/index.js +5 -0
- package/dist/check/depth/measure.d.ts +42 -0
- package/dist/check/depth/measure.js +141 -0
- package/dist/check/depth/parts-page.d.ts +6 -0
- package/dist/check/depth/parts-page.js +69 -0
- package/dist/check/depth/playwright.d.ts +4 -0
- package/dist/check/depth/playwright.js +10 -0
- package/dist/check/depth/png.d.ts +3 -0
- package/dist/check/depth/png.js +12 -0
- package/dist/check/depth/shoot.d.ts +37 -0
- package/dist/check/depth/shoot.js +30 -0
- package/dist/choice-chips/choice-chips.d.ts +40 -0
- package/dist/choice-chips/choice-chips.js +106 -0
- package/dist/choice-chips/index.d.ts +1 -0
- package/dist/choice-chips/index.js +3 -0
- package/dist/choice-chips/styles.css +38 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -0
- package/dist/page-header/index.d.ts +2 -0
- package/dist/page-header/index.js +4 -0
- package/dist/page-header/page-header.d.ts +58 -0
- package/dist/page-header/page-header.js +124 -0
- package/dist/page-header/shell-context.d.ts +12 -0
- package/dist/page-header/shell-context.js +21 -0
- package/dist/page-header/styles.css +77 -0
- package/dist/row/index.d.ts +1 -0
- package/dist/row/index.js +3 -0
- package/dist/row/row.d.ts +76 -0
- package/dist/row/row.js +69 -0
- package/dist/row/styles.css +69 -0
- package/dist/sound/engine.d.ts +59 -0
- package/dist/sound/engine.js +325 -0
- package/dist/sound/index.d.ts +18 -0
- package/dist/sound/index.js +10 -0
- package/dist/sound/synth.d.ts +24 -0
- package/dist/sound/synth.js +139 -0
- package/dist/theme/color.d.ts +29 -0
- package/dist/theme/color.js +116 -0
- package/dist/theme/compile.d.ts +23 -0
- package/dist/theme/compile.js +138 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/record.d.ts +90 -0
- package/dist/theme/record.js +222 -0
- package/dist/voice-field/box-trace.d.ts +18 -0
- package/dist/voice-field/box-trace.js +87 -0
- package/dist/voice-field/index.d.ts +8 -0
- package/dist/voice-field/index.js +10 -0
- package/dist/voice-field/recorder.d.ts +71 -0
- package/dist/voice-field/recorder.js +211 -0
- package/dist/voice-field/rules.d.ts +27 -0
- package/dist/voice-field/rules.js +62 -0
- package/dist/voice-field/saved-take.d.ts +7 -0
- package/dist/voice-field/saved-take.js +66 -0
- package/dist/voice-field/store.d.ts +27 -0
- package/dist/voice-field/store.js +40 -0
- package/dist/voice-field/styles.css +161 -0
- package/dist/voice-field/toast.d.ts +13 -0
- package/dist/voice-field/toast.js +26 -0
- package/dist/voice-field/voice-field.d.ts +80 -0
- package/dist/voice-field/voice-field.js +259 -0
- package/dist/voice-field/words.d.ts +37 -0
- package/dist/voice-field/words.js +33 -0
- package/package.json +126 -4
- package/specs/brand-theme/v1/SPEC.md +130 -0
- package/specs/brand-theme/v1/default-bar.json +1196 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// The depth measures, read from a screenshot's pixels, because the eye sees pixels, not CSS.
|
|
2
|
+
// Imports nothing but the colour arithmetic, so an app can vendor src/check/depth with src/theme/color.ts.
|
|
3
|
+
//
|
|
4
|
+
// Conventions:
|
|
5
|
+
// - `img` is RGBA, device pixels (a 3x screenshot of a 390 px page is 1170 px wide).
|
|
6
|
+
// - A Rect is in CSS px, as getBoundingClientRect gives it (so it includes a transform), and `scale` is the
|
|
7
|
+
// device scale. A part is keyed by its name (`primary`, `card`, ...); its pressed twin is keyed
|
|
8
|
+
// `<name>@pressed`. On a parts page that is `[data-part="<name>"]` and `[data-part="<name>"][data-pressed]`.
|
|
9
|
+
// - The pressed twin must share its resting part's layout top (side by side, aligned to the top), so the
|
|
10
|
+
// difference of the two rects' tops is the press move.
|
|
11
|
+
// - A part drawn several times takes Rect[]; each measure keeps its worst value.
|
|
12
|
+
// - An optional `ground` rect is a patch of bare page. When it is given, drop and raise read the page there;
|
|
13
|
+
// without it they read the ground 24 px below the part.
|
|
14
|
+
//
|
|
15
|
+
// What the first calibration (2026-11-30) taught, each a fix to the measure, never to a threshold:
|
|
16
|
+
// - The face is read in its side padding (6-14% and 86-94% of the width, middle row), never the middle
|
|
17
|
+
// third, where the label or icon sits: "Delete" in Chromium's font covered the middle third's middle row
|
|
18
|
+
// and read as a dark face.
|
|
19
|
+
// - The ledge is the second pixel row under the face (1 to 2 px), so the 1px hairline ring every flat or
|
|
20
|
+
// pressed part has is not read as a ledge; and it counts either way (absolute), because on a dark ground
|
|
21
|
+
// a bronze button's ledge is lighter than the page and still plainly visible.
|
|
22
|
+
// - A face already at the light limit (L 99.5 or more, white on white) cannot show a top light: `top` is
|
|
23
|
+
// skipped for it, and the skip is named.
|
|
24
|
+
// - Drop reads the bare page, not the ground 24 px away, when the page gives a ground patch: a menu's
|
|
25
|
+
// level 3 shadow still darkens the page 24 px below it, which made the menu read shallower than a card.
|
|
26
|
+
import { toOklab } from "../../theme/color.js";
|
|
27
|
+
/**
|
|
28
|
+
* Which measures a part takes. A name not listed is a filled button. A filled or tinted face (primary,
|
|
29
|
+
* a hand-drawn bg-primary button, destructive's red tint) is lit by its own colour, so `raise` is not
|
|
30
|
+
* asked of it; quiet buttons and surfaces are neutral faces raised off the page.
|
|
31
|
+
*/
|
|
32
|
+
export const PART_KINDS = {
|
|
33
|
+
primary: 'button', 'hand-drawn': 'button', destructive: 'button',
|
|
34
|
+
secondary: 'quiet', outline: 'quiet', mic: 'quiet',
|
|
35
|
+
card: 'surface', menu: 'surface',
|
|
36
|
+
field: 'field',
|
|
37
|
+
};
|
|
38
|
+
export const kindOf = (part, kinds = PART_KINDS) => kinds[part] ?? 'button';
|
|
39
|
+
/** Which measures each kind takes (`raise` is judged on dark grounds only). */
|
|
40
|
+
export const KIND_MEASURES = {
|
|
41
|
+
button: ['ledge', 'drop', 'top', 'pressMove', 'pressLedge'],
|
|
42
|
+
quiet: ['ledge', 'drop', 'top', 'raise', 'pressMove', 'pressLedge'],
|
|
43
|
+
surface: ['drop', 'top', 'raise'],
|
|
44
|
+
field: ['well'],
|
|
45
|
+
};
|
|
46
|
+
/** In CSS px. Rows below the face's bottom edge, or inside the field's top edge. */
|
|
47
|
+
export const GEOMETRY = { ledgeRow: [1, 2], ledgeGround: 12, dropBand: [3, 10], dropGround: 24, wellRows: [1, 4], faceSides: [[0.06, 0.14], [0.86, 0.94]], lightLimit: 99.5 };
|
|
48
|
+
function median(xs) {
|
|
49
|
+
if (!xs.length)
|
|
50
|
+
return NaN;
|
|
51
|
+
const s = [...xs].sort((a, b) => a - b);
|
|
52
|
+
const m = s.length >> 1;
|
|
53
|
+
return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2;
|
|
54
|
+
}
|
|
55
|
+
function lightness(img, x0, x1, y0, y1, scale, into) {
|
|
56
|
+
const ys = Math.max(0, Math.floor(y0 * scale)), ye = Math.min(img.height, Math.ceil(y1 * scale));
|
|
57
|
+
const xs = Math.max(0, Math.floor(x0 * scale)), xe = Math.min(img.width, Math.ceil(x1 * scale));
|
|
58
|
+
for (let y = ys; y < ye; y++)
|
|
59
|
+
for (let x = xs; x < xe; x++) {
|
|
60
|
+
const i = (y * img.width + x) * 4;
|
|
61
|
+
into.push(toOklab({ r: img.data[i], g: img.data[i + 1], b: img.data[i + 2] })[0] * 100);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** The median OKLab L (0-100) of the pixels in a CSS px box. NaN when the box is off the picture. */
|
|
65
|
+
export function bandL(img, x0, x1, y0, y1, scale) {
|
|
66
|
+
const ls = [];
|
|
67
|
+
lightness(img, x0, x1, y0, y1, scale, ls);
|
|
68
|
+
return median(ls);
|
|
69
|
+
}
|
|
70
|
+
const r2 = (v) => Math.round(v * 100) / 100;
|
|
71
|
+
const num = (v) => (Number.isFinite(v) ? r2(v) : undefined);
|
|
72
|
+
function measureOne(img, r, s, kind, pageL) {
|
|
73
|
+
const x0 = r.x + r.width / 3, x1 = r.x + (2 * r.width) / 3;
|
|
74
|
+
const row = (y0, y1) => bandL(img, x0, x1, y0, y1, s);
|
|
75
|
+
const B = r.y + r.height;
|
|
76
|
+
const mid = r.y + r.height / 2;
|
|
77
|
+
const side = [];
|
|
78
|
+
for (const [a, b] of GEOMETRY.faceSides)
|
|
79
|
+
lightness(img, r.x + a * r.width, r.x + b * r.width, mid - 0.5, mid + 0.5, s, side);
|
|
80
|
+
const face = median(side);
|
|
81
|
+
const ground = pageL ?? row(B + GEOMETRY.dropGround, B + GEOMETRY.dropGround + 1);
|
|
82
|
+
const m = {};
|
|
83
|
+
const want = KIND_MEASURES[kind];
|
|
84
|
+
if (want.includes('ledge'))
|
|
85
|
+
m.ledge = num(Math.abs(row(B + GEOMETRY.ledgeGround, B + GEOMETRY.ledgeGround + 1) - row(B + GEOMETRY.ledgeRow[0], B + GEOMETRY.ledgeRow[1])));
|
|
86
|
+
if (want.includes('drop'))
|
|
87
|
+
m.drop = num(ground - row(B + GEOMETRY.dropBand[0], B + GEOMETRY.dropBand[1]));
|
|
88
|
+
if (want.includes('top')) {
|
|
89
|
+
if (face >= GEOMETRY.lightLimit)
|
|
90
|
+
m.skipped = { ...m.skipped, top: `the face is at L ${r2(face)}, white: no room for a top light` };
|
|
91
|
+
else
|
|
92
|
+
m.top = num(row(r.y, r.y + 1) - face);
|
|
93
|
+
}
|
|
94
|
+
if (want.includes('raise'))
|
|
95
|
+
m.raise = num(face - ground);
|
|
96
|
+
if (want.includes('well'))
|
|
97
|
+
m.well = num(face - row(r.y + GEOMETRY.wellRows[0], r.y + GEOMETRY.wellRows[1]));
|
|
98
|
+
return m;
|
|
99
|
+
}
|
|
100
|
+
const HIGHER_IS_WORSE = ['pressLedge'];
|
|
101
|
+
function worst(a, b) {
|
|
102
|
+
const out = { ...a };
|
|
103
|
+
for (const [k, v] of Object.entries(b)) {
|
|
104
|
+
if (k === 'skipped') {
|
|
105
|
+
out.skipped = { ...out.skipped, ...v };
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (typeof v !== 'number')
|
|
109
|
+
continue;
|
|
110
|
+
const have = out[k];
|
|
111
|
+
out[k] = have === undefined ? v : HIGHER_IS_WORSE.includes(k) ? Math.max(have, v) : Math.min(have, v);
|
|
112
|
+
}
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
/** Measure every part in `rects` (CSS px) on `img` (device px at `scale`). */
|
|
116
|
+
export function measureParts(img, rects, scale, o = {}) {
|
|
117
|
+
const list = (v) => (v === undefined ? [] : Array.isArray(v) ? v : [v]);
|
|
118
|
+
const g = list(rects.ground)[0];
|
|
119
|
+
const pageL = g ? num(bandL(img, g.x, g.x + g.width, g.y, g.y + g.height, scale)) : undefined;
|
|
120
|
+
const out = {};
|
|
121
|
+
for (const [name, value] of Object.entries(rects)) {
|
|
122
|
+
if (name === 'ground' || name.endsWith('@pressed'))
|
|
123
|
+
continue;
|
|
124
|
+
const kind = kindOf(name, o.kinds);
|
|
125
|
+
const rest = list(value);
|
|
126
|
+
const pressed = list(rects[`${name}@pressed`]);
|
|
127
|
+
let m;
|
|
128
|
+
rest.forEach((r, i) => {
|
|
129
|
+
const one = measureOne(img, r, scale, kind, pageL);
|
|
130
|
+
const p = pressed[i];
|
|
131
|
+
if (p && KIND_MEASURES[kind].includes('pressMove')) {
|
|
132
|
+
one.pressMove = r2(p.y - r.y);
|
|
133
|
+
one.pressLedge = measureOne(img, p, scale, 'button', pageL).ledge;
|
|
134
|
+
}
|
|
135
|
+
m = m ? worst(m, one) : one;
|
|
136
|
+
});
|
|
137
|
+
if (m)
|
|
138
|
+
out[name] = m;
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PAGE_PARTS: readonly ["primary", "secondary", "outline", "destructive", "mic", "field", "card", "menu"];
|
|
2
|
+
export declare function partsPage(themeCss: string, o: {
|
|
3
|
+
theme: string;
|
|
4
|
+
ground: 'light' | 'dark';
|
|
5
|
+
parts?: readonly string[];
|
|
6
|
+
}): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// partsPage: one self-contained page that draws each raised part on its theme's ground, so a theme's
|
|
2
|
+
// depth can be measured with no Tailwind build. It inlines the compiled theme CSS and the depth utilities
|
|
3
|
+
// as plain classes (the same variables the @utility rules apply), and draws each part with the classes the
|
|
4
|
+
// vibe check's round 3 gave it (own-the-components-depth*.py):
|
|
5
|
+
// primary bg-primary sheen-primary elev-primary
|
|
6
|
+
// secondary bg-secondary sheen-tint elev-btn
|
|
7
|
+
// outline bg-raised sheen-quiet elev-btn
|
|
8
|
+
// destructive bg mix(destructive 12%, raised) sheen-tint elev-btn
|
|
9
|
+
// mic bg-raised sheen-quiet elev-btn
|
|
10
|
+
// card bg-card elev-1 sheen-surface
|
|
11
|
+
// field bg-field well, a 1px input border
|
|
12
|
+
// menu bg-popover elev-3 sheen-popover
|
|
13
|
+
// Each button and the mic has a pressed twin beside it, top-aligned: [data-part="<name>"][data-pressed="true"].
|
|
14
|
+
// `[data-ground]` is a patch of bare page.
|
|
15
|
+
import { utilityRules } from "../../theme/compile.js";
|
|
16
|
+
export const PAGE_PARTS = ['primary', 'secondary', 'outline', 'destructive', 'mic', 'field', 'card', 'menu'];
|
|
17
|
+
const PRESSABLE = new Set(['primary', 'secondary', 'outline', 'destructive', 'mic']);
|
|
18
|
+
const MIC = '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/></svg>';
|
|
19
|
+
function part(name, pressed) {
|
|
20
|
+
const attrs = `data-part="${name}"${pressed ? ' data-pressed="true"' : ''}`;
|
|
21
|
+
const press = pressed ? ' pressed' : '';
|
|
22
|
+
switch (name) {
|
|
23
|
+
case 'primary': return `<button ${attrs} class="btn p-primary sheen-primary elev-primary${press}">Main action</button>`;
|
|
24
|
+
case 'secondary': return `<button ${attrs} class="btn p-secondary sheen-tint elev-btn${press}">Second</button>`;
|
|
25
|
+
case 'outline': return `<button ${attrs} class="btn p-outline sheen-quiet elev-btn${press}">Outline</button>`;
|
|
26
|
+
case 'destructive': return `<button ${attrs} class="btn p-destructive sheen-tint elev-btn${press}">Delete</button>`;
|
|
27
|
+
case 'mic': return `<button ${attrs} class="btn p-mic sheen-quiet elev-btn${press}" aria-label="Record">${MIC}</button>`;
|
|
28
|
+
case 'card': return `<div ${attrs} class="p-card elev-1 sheen-surface"><span class="chip">Awaiting you</span></div>`;
|
|
29
|
+
case 'field': return `<div ${attrs} class="p-field well" role="textbox" aria-label="Message"></div>`;
|
|
30
|
+
case 'menu': return `<div ${attrs} class="p-menu elev-3 sheen-popover"><div class="item">Rename</div></div>`;
|
|
31
|
+
default: throw new Error(`unknown part ${name}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function partsPage(themeCss, o) {
|
|
35
|
+
const parts = o.parts ?? PAGE_PARTS;
|
|
36
|
+
const rows = parts.map((p) => `<div class="row row-${p}">${part(p, false)}${PRESSABLE.has(p) ? part(p, true) : ''}</div>`).join('\n');
|
|
37
|
+
return `<!doctype html>
|
|
38
|
+
<html class="theme-${o.theme}" data-theme="${o.theme}" lang="en">
|
|
39
|
+
<head>
|
|
40
|
+
<meta charset="utf-8">
|
|
41
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
42
|
+
<title>Depth parts: ${o.theme}</title>
|
|
43
|
+
<style>
|
|
44
|
+
${themeCss}
|
|
45
|
+
${utilityRules('.')}
|
|
46
|
+
html, body { margin: 0; background: var(--background); color: var(--foreground); }
|
|
47
|
+
body { padding: 0 24px 200px; font: 500 16px/1.2 var(--font-text); -webkit-font-smoothing: antialiased; }
|
|
48
|
+
[data-ground] { height: 48px; margin: 0 -24px 24px; }
|
|
49
|
+
.row { display: flex; align-items: flex-start; gap: 40px; margin-bottom: 96px; }
|
|
50
|
+
.btn { height: 44px; padding: 0 20px; border: 0; border-radius: var(--radius); font: inherit; display: inline-flex; align-items: center; justify-content: center; }
|
|
51
|
+
.p-primary { background-color: var(--primary); color: var(--primary-foreground); }
|
|
52
|
+
.p-secondary { background-color: var(--secondary); color: var(--secondary-foreground); }
|
|
53
|
+
.p-outline { background-color: var(--raised); color: var(--foreground); }
|
|
54
|
+
.p-destructive { background-color: color-mix(in oklab, var(--destructive) 12%, var(--raised)); color: var(--destructive); }
|
|
55
|
+
.p-mic { width: 44px; padding: 0; background-color: var(--raised); color: var(--foreground); }
|
|
56
|
+
.p-card { box-sizing: border-box; width: 100%; height: 120px; padding: 14px 16px; border-radius: var(--radius); background-color: var(--card); color: var(--card-foreground); }
|
|
57
|
+
.chip { font-size: 13px; }
|
|
58
|
+
.p-field { box-sizing: border-box; width: 100%; height: 48px; border: 1px solid var(--input); border-radius: var(--radius); background-color: var(--field); }
|
|
59
|
+
.p-menu { box-sizing: border-box; width: 220px; height: 140px; padding: 10px 14px; border-radius: var(--radius); background-color: var(--popover); color: var(--popover-foreground); }
|
|
60
|
+
.row-card { margin-bottom: 120px; }
|
|
61
|
+
</style>
|
|
62
|
+
</head>
|
|
63
|
+
<body>
|
|
64
|
+
<div data-ground></div>
|
|
65
|
+
${rows}
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @supersuit/components/check/depth/playwright: the tools that drive a browser page for the depth check.
|
|
2
|
+
// shootParts draws a theme's parts page and reads back the picture and the rects; depthCompare writes the
|
|
3
|
+
// flat-beside-compiled crop picture; decodePng and encodePng read and write PNGs; the bar math turns
|
|
4
|
+
// measured round 1 and round 3 values into thresholds. They take any page with Playwright's setContent,
|
|
5
|
+
// evaluate and screenshot, so nothing here imports Playwright. The PNG helpers need `pngjs`, an optional
|
|
6
|
+
// peer: install it to use this subpath. `@supersuit/components/check/depth` needs neither.
|
|
7
|
+
export * from "./shoot.js";
|
|
8
|
+
export * from "./crop.js";
|
|
9
|
+
export * from "./png.js";
|
|
10
|
+
export * from "./bar.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// PNG decoding for the depth check's own Playwright helpers and tests. Kept apart from measure.ts and
|
|
2
|
+
// check.ts so an app can vendor those two without a PNG decoder.
|
|
3
|
+
import { PNG } from 'pngjs';
|
|
4
|
+
export function decodePng(buf) {
|
|
5
|
+
const png = PNG.sync.read(Buffer.from(buf));
|
|
6
|
+
return { width: png.width, height: png.height, data: png.data };
|
|
7
|
+
}
|
|
8
|
+
export function encodePng(img) {
|
|
9
|
+
const png = new PNG({ width: img.width, height: img.height });
|
|
10
|
+
png.data.set(img.data);
|
|
11
|
+
return PNG.sync.write(png);
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Rect } from './measure.ts';
|
|
2
|
+
/** Where depth is measured: a phone, 390 px wide, device scale 3, touch on (Chromium and WebKit). */
|
|
3
|
+
export declare const DEPTH_DEVICE: {
|
|
4
|
+
readonly viewport: {
|
|
5
|
+
readonly width: 390;
|
|
6
|
+
readonly height: 844;
|
|
7
|
+
};
|
|
8
|
+
readonly deviceScaleFactor: 3;
|
|
9
|
+
readonly isMobile: true;
|
|
10
|
+
readonly hasTouch: true;
|
|
11
|
+
};
|
|
12
|
+
export type PageLike = {
|
|
13
|
+
setContent(html: string, o?: {
|
|
14
|
+
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle';
|
|
15
|
+
}): Promise<unknown>;
|
|
16
|
+
evaluate<R>(fn: () => R | Promise<R>): Promise<R>;
|
|
17
|
+
screenshot(o: {
|
|
18
|
+
fullPage?: boolean;
|
|
19
|
+
type?: 'png';
|
|
20
|
+
animations?: 'disabled';
|
|
21
|
+
clip?: Rect;
|
|
22
|
+
}): Promise<Uint8Array>;
|
|
23
|
+
};
|
|
24
|
+
/** The rects of every `[data-part]` (pressed twins as `<part>@pressed`) and `[data-ground]`, in CSS px. */
|
|
25
|
+
export declare function readRects(page: PageLike): Promise<{
|
|
26
|
+
rects: Record<string, Rect[]>;
|
|
27
|
+
scale: number;
|
|
28
|
+
}>;
|
|
29
|
+
export declare function shootParts(page: PageLike, themeCss: string, o: {
|
|
30
|
+
theme: string;
|
|
31
|
+
ground: 'light' | 'dark';
|
|
32
|
+
parts?: readonly string[];
|
|
33
|
+
}): Promise<{
|
|
34
|
+
png: Uint8Array<ArrayBufferLike>;
|
|
35
|
+
rects: Record<string, Rect[]>;
|
|
36
|
+
scale: number;
|
|
37
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// shootParts: draw a theme's parts page in a browser page and read back the picture and the rects.
|
|
2
|
+
// Takes any page with Playwright's setContent / evaluate / screenshot, so it needs no Playwright import.
|
|
3
|
+
import { partsPage } from "./parts-page.js";
|
|
4
|
+
/** Where depth is measured: a phone, 390 px wide, device scale 3, touch on (Chromium and WebKit). */
|
|
5
|
+
export const DEPTH_DEVICE = { viewport: { width: 390, height: 844 }, deviceScaleFactor: 3, isMobile: true, hasTouch: true };
|
|
6
|
+
/** The rects of every `[data-part]` (pressed twins as `<part>@pressed`) and `[data-ground]`, in CSS px. */
|
|
7
|
+
export async function readRects(page) {
|
|
8
|
+
return page.evaluate(() => {
|
|
9
|
+
const rects = {};
|
|
10
|
+
const add = (key, el) => {
|
|
11
|
+
const r = el.getBoundingClientRect();
|
|
12
|
+
(rects[key] ??= []).push({ x: r.x + window.scrollX, y: r.y + window.scrollY, width: r.width, height: r.height });
|
|
13
|
+
};
|
|
14
|
+
document.querySelectorAll('[data-part]').forEach((el) => {
|
|
15
|
+
const name = el.getAttribute('data-part');
|
|
16
|
+
add(el.hasAttribute('data-pressed') ? `${name}@pressed` : name, el);
|
|
17
|
+
});
|
|
18
|
+
const g = document.querySelector('[data-ground]');
|
|
19
|
+
if (g)
|
|
20
|
+
add('ground', g);
|
|
21
|
+
return { rects, scale: window.devicePixelRatio };
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export async function shootParts(page, themeCss, o) {
|
|
25
|
+
await page.setContent(partsPage(themeCss, o), { waitUntil: 'load' });
|
|
26
|
+
await page.evaluate(() => document.fonts.ready.then(() => undefined));
|
|
27
|
+
const { rects, scale } = await readRects(page);
|
|
28
|
+
const png = await page.screenshot({ fullPage: true, type: 'png', animations: 'disabled' });
|
|
29
|
+
return { png, rects, scale };
|
|
30
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface ChoiceOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
/** Shown in place, never chosen. Say why in the help line. */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ChoiceChipsWords {
|
|
9
|
+
/** The marker after the label of an optional question. */
|
|
10
|
+
optional: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const defaultChoiceChipsWords: ChoiceChipsWords;
|
|
13
|
+
interface Common {
|
|
14
|
+
label: ReactNode;
|
|
15
|
+
options: ChoiceOption[];
|
|
16
|
+
/** Under the chips. Also the description of every disabled chip. */
|
|
17
|
+
help?: ReactNode;
|
|
18
|
+
/** Adds "(optional)" after the label. In pick one, also lets a second tap clear the choice. */
|
|
19
|
+
optional?: boolean;
|
|
20
|
+
words?: Partial<ChoiceChipsWords>;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SeveralProps extends Common {
|
|
24
|
+
mode: 'several';
|
|
25
|
+
value: string[];
|
|
26
|
+
onChange: (value: string[]) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface OneProps extends Common {
|
|
29
|
+
mode: 'one';
|
|
30
|
+
value: string | null;
|
|
31
|
+
onChange: (value: string | null) => void;
|
|
32
|
+
/** A required question: a second tap never clears it. */
|
|
33
|
+
required?: boolean;
|
|
34
|
+
/** `auto` (default) measures: a track that does not fit draws as wrapping chips. `track` and `wrap` force one form. */
|
|
35
|
+
layout?: 'auto' | 'track' | 'wrap';
|
|
36
|
+
}
|
|
37
|
+
export type ChoiceChipsProps = SeveralProps | OneProps;
|
|
38
|
+
export declare const Tick: () => import("react").JSX.Element;
|
|
39
|
+
export declare function ChoiceChips(p: ChoiceChipsProps): import("react").JSX.Element;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// PICK ONE OR PICK SEVERAL, AS PILLS (spec approved 2026-12-02). Pick several is a row of toggle chips, each a
|
|
4
|
+
// <button aria-pressed> with a tick when chosen, so the state never rests on colour. Pick one is a segmented track
|
|
5
|
+
// with radio semantics: one option in the tab order, arrow keys that move the choice and skip disabled options. A
|
|
6
|
+
// track that does not fit its container draws as wrapping chips and keeps the radio semantics; that switch is
|
|
7
|
+
// measured, never set by a breakpoint. Changes are immediate: onChange on every tap, no Apply button.
|
|
8
|
+
import { useCallback, useId, useLayoutEffect, useEffect, useRef, useState } from 'react';
|
|
9
|
+
export const defaultChoiceChipsWords = { optional: '(optional)' };
|
|
10
|
+
const useIso = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
11
|
+
const idOf = (raw) => raw.replace(/[^a-zA-Z0-9_-]/g, '');
|
|
12
|
+
export const Tick = () => (_jsx("svg", { className: "ss-chip-tick", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M5 12.5 10 17.5 19 7" }) }));
|
|
13
|
+
/** The track's form: measured against the container, so the same set sits on one line where it fits. */
|
|
14
|
+
function useForm(layout, key) {
|
|
15
|
+
const host = useRef(null);
|
|
16
|
+
const natural = useRef(0);
|
|
17
|
+
const [measured, setMeasured] = useState('track');
|
|
18
|
+
const measure = useCallback(() => {
|
|
19
|
+
const h = host.current;
|
|
20
|
+
if (!h)
|
|
21
|
+
return;
|
|
22
|
+
const track = h.querySelector('.ss-seg-track');
|
|
23
|
+
if (track) {
|
|
24
|
+
natural.current = track.scrollWidth;
|
|
25
|
+
if (track.scrollWidth > h.clientWidth)
|
|
26
|
+
setMeasured('wrap');
|
|
27
|
+
}
|
|
28
|
+
else if (natural.current && h.clientWidth >= natural.current)
|
|
29
|
+
setMeasured('track');
|
|
30
|
+
}, []);
|
|
31
|
+
// A new set of options has a new natural width: draw it as a track again and measure that.
|
|
32
|
+
useIso(() => { natural.current = 0; setMeasured('track'); }, [key]);
|
|
33
|
+
useIso(() => { if (layout === 'auto')
|
|
34
|
+
measure(); });
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (layout !== 'auto' || typeof ResizeObserver === 'undefined' || !host.current)
|
|
37
|
+
return;
|
|
38
|
+
const ro = new ResizeObserver(() => measure());
|
|
39
|
+
ro.observe(host.current);
|
|
40
|
+
return () => ro.disconnect();
|
|
41
|
+
}, [layout, measure]);
|
|
42
|
+
return { host, form: layout === 'auto' ? measured : layout };
|
|
43
|
+
}
|
|
44
|
+
export function ChoiceChips(p) {
|
|
45
|
+
const w = { ...defaultChoiceChipsWords, ...p.words };
|
|
46
|
+
const id = idOf(useId());
|
|
47
|
+
const labelId = `ss-chips-label-${id}`;
|
|
48
|
+
const helpId = `ss-chips-help-${id}`;
|
|
49
|
+
const optionsKey = p.options.map((o) => o.value).join('\u0000');
|
|
50
|
+
const { host, form } = useForm(p.mode === 'one' ? (p.layout ?? 'auto') : 'wrap', optionsKey);
|
|
51
|
+
const refs = useRef([]);
|
|
52
|
+
const label = _jsxs("div", { id: labelId, className: "ss-chips-label", children: [p.label, p.optional && _jsxs(_Fragment, { children: [" ", _jsx("small", { children: w.optional })] })] });
|
|
53
|
+
const help = p.help != null ? _jsx("p", { id: helpId, className: "ss-chips-help", children: p.help }) : null;
|
|
54
|
+
const describedBy = p.help != null ? helpId : undefined;
|
|
55
|
+
let body;
|
|
56
|
+
if (p.mode === 'several') {
|
|
57
|
+
const chosen = new Set(p.value);
|
|
58
|
+
body = (_jsx("div", { role: "group", "aria-labelledby": labelId, "aria-describedby": describedBy, className: "ss-chips-set", children: p.options.map((o) => {
|
|
59
|
+
const on = chosen.has(o.value);
|
|
60
|
+
return (_jsxs("button", { type: "button", className: "ss-chip", "aria-pressed": on, "aria-disabled": o.disabled ? true : undefined, "aria-describedby": o.disabled ? describedBy : undefined, onClick: () => {
|
|
61
|
+
if (o.disabled)
|
|
62
|
+
return;
|
|
63
|
+
p.onChange(on ? p.value.filter((v) => v !== o.value) : [...p.value, o.value]);
|
|
64
|
+
}, children: [on && _jsx(Tick, {}), _jsx("span", { children: o.label })] }, o.value));
|
|
65
|
+
}) }));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const one = p;
|
|
69
|
+
const enabled = one.options.map((o, i) => (o.disabled ? -1 : i)).filter((i) => i >= 0);
|
|
70
|
+
const chosenAt = one.options.findIndex((o) => o.value === one.value && !o.disabled);
|
|
71
|
+
const stop = chosenAt >= 0 ? chosenAt : (enabled[0] ?? -1);
|
|
72
|
+
const pick = (i) => {
|
|
73
|
+
const o = one.options[i];
|
|
74
|
+
if (!o || o.disabled)
|
|
75
|
+
return;
|
|
76
|
+
if (o.value === one.value) {
|
|
77
|
+
if (one.optional && !one.required)
|
|
78
|
+
one.onChange(null);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
one.onChange(o.value);
|
|
82
|
+
};
|
|
83
|
+
const key = (e, i) => {
|
|
84
|
+
const step = e.key === 'ArrowRight' || e.key === 'ArrowDown' ? 1 : e.key === 'ArrowLeft' || e.key === 'ArrowUp' ? -1 : 0;
|
|
85
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
if (one.options[i]?.value !== one.value)
|
|
88
|
+
pick(i);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!step || !enabled.length)
|
|
92
|
+
return;
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
const at = enabled.indexOf(i);
|
|
95
|
+
const next = enabled[((at < 0 ? 0 : at + step) + enabled.length) % enabled.length];
|
|
96
|
+
one.onChange(one.options[next].value);
|
|
97
|
+
refs.current[next]?.focus();
|
|
98
|
+
};
|
|
99
|
+
const wrap = form === 'wrap';
|
|
100
|
+
body = (_jsx("div", { role: "radiogroup", "aria-labelledby": labelId, "aria-describedby": describedBy, "aria-required": one.required ? true : undefined, className: wrap ? 'ss-chips-set' : 'ss-seg-track', children: one.options.map((o, i) => {
|
|
101
|
+
const on = i === chosenAt;
|
|
102
|
+
return (_jsxs("button", { ref: (el) => { refs.current[i] = el; }, type: "button", role: "radio", "aria-checked": on, "aria-disabled": o.disabled ? true : undefined, tabIndex: i === stop ? 0 : -1, className: wrap ? 'ss-chip' : 'ss-seg-option', onClick: () => pick(i), onKeyDown: (e) => key(e, i), children: [wrap && on && _jsx(Tick, {}), _jsx("span", { children: o.label })] }, o.value));
|
|
103
|
+
}) }));
|
|
104
|
+
}
|
|
105
|
+
return (_jsxs("div", { ref: host, className: ['ss-chips', p.className].filter(Boolean).join(' '), "data-mode": p.mode, "data-form": p.mode === 'one' ? form : 'wrap', children: [label, body, help] }));
|
|
106
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChoiceChips, Tick, defaultChoiceChipsWords, type ChoiceChipsProps, type SeveralProps, type OneProps, type ChoiceOption, type ChoiceChipsWords } from './choice-chips.js';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* @supersuit/components/choice-chips: pick one or pick several, as pills (spec approved 2026-12-02).
|
|
2
|
+
*
|
|
3
|
+
* Every colour is a theme role (--card, --input, --primary, --primary-foreground, --muted, --border, --placeholder,
|
|
4
|
+
* --foreground, --muted-foreground, --ring), as a compiled brand theme names them: put `.theme-maison-dawn` or
|
|
5
|
+
* `.theme-maison-night` on any element above. With no theme, the Maison Dawn values are the fallbacks. The part has
|
|
6
|
+
* no breakpoint: toggle chips wrap when they run out of room, and a track that does not fit draws as chips.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
.ss-chips { min-width: 0; font-family: var(--font-text, "DM Sans", system-ui, sans-serif); color: var(--foreground, #2A231B); }
|
|
10
|
+
.ss-chips-label { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
|
|
11
|
+
.ss-chips-label small { font-size: 14px; font-weight: 400; color: var(--muted-foreground, #665B4D); }
|
|
12
|
+
.ss-chips-help { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: var(--muted-foreground, #665B4D); }
|
|
13
|
+
|
|
14
|
+
/* Toggle chips, and a pick-one set too wide for its track. */
|
|
15
|
+
.ss-chips-set { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
16
|
+
.ss-chip {
|
|
17
|
+
box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 0 16px;
|
|
18
|
+
border: 0; border-radius: 999px; background: var(--card, #FAF7F2); color: var(--foreground, #2A231B);
|
|
19
|
+
box-shadow: inset 0 0 0 1px var(--input, #C5B399); font: inherit; font-size: 15px; font-weight: 500; white-space: nowrap; cursor: pointer;
|
|
20
|
+
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
|
|
21
|
+
}
|
|
22
|
+
.ss-chip[aria-pressed="true"], .ss-chip[aria-checked="true"] { background: var(--primary, #22324A); color: var(--primary-foreground, #F3EDE3); box-shadow: none; }
|
|
23
|
+
.ss-chip[aria-disabled="true"] { background: var(--muted, #EFE4D6); color: var(--placeholder, #A39C93); box-shadow: none; cursor: default; }
|
|
24
|
+
.ss-chip:focus { outline: none; }
|
|
25
|
+
.ss-chip:focus-visible { outline: 2px solid var(--ring, #2B3B50); outline-offset: 2px; }
|
|
26
|
+
.ss-chip-tick { flex: none; width: 16px; height: 16px; margin-left: -4px; }
|
|
27
|
+
|
|
28
|
+
/* Pick one: the segmented track. It never wraps or scrolls inside itself. */
|
|
29
|
+
.ss-seg-track { box-sizing: border-box; display: inline-flex; flex-wrap: nowrap; overflow: hidden; max-width: none; gap: 2px; padding: 2px; border-radius: 999px; background: var(--muted, #EFE4D6); box-shadow: inset 0 0 0 1px var(--border, #D9CDBB); }
|
|
30
|
+
.ss-seg-option {
|
|
31
|
+
box-sizing: border-box; flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; padding: 0 16px;
|
|
32
|
+
border: 0; border-radius: 999px; background: transparent; color: var(--foreground, #2A231B); font: inherit; font-size: 15px; font-weight: 500; white-space: nowrap; cursor: pointer;
|
|
33
|
+
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
|
|
34
|
+
}
|
|
35
|
+
.ss-seg-option[aria-checked="true"] { background: var(--primary, #22324A); color: var(--primary-foreground, #F3EDE3); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); }
|
|
36
|
+
.ss-seg-option[aria-disabled="true"] { color: var(--placeholder, #A39C93); cursor: default; }
|
|
37
|
+
.ss-seg-option:focus { outline: none; }
|
|
38
|
+
.ss-seg-option:focus-visible { outline: 2px solid var(--ring, #2B3B50); outline-offset: 1px; }
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const components: readonly ["app-shell", "choice-chips", "page-header", "row", "voice-field"];
|
|
2
|
+
export type ComponentName = (typeof components)[number];
|
|
3
|
+
export declare const modules: readonly ["sound", "theme", "check/depth"];
|
|
4
|
+
export type ModuleName = (typeof modules)[number];
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @supersuit/components: the Supersuit component library. Each component is its own subpath, so an app
|
|
2
|
+
// that imports one gets only that one:
|
|
3
|
+
// import { VoiceField } from '@supersuit/components/voice-field'
|
|
4
|
+
// import '@supersuit/components/voice-field/styles.css'
|
|
5
|
+
// The root imports no component on purpose. It names the components this version ships.
|
|
6
|
+
export const components = ['app-shell', 'choice-chips', 'page-header', 'row', 'voice-field'];
|
|
7
|
+
// The modules: shared behaviour with no part of its own (no spec, no mockup), each its own subpath too.
|
|
8
|
+
// import { sound } from '@supersuit/components/sound'
|
|
9
|
+
// import { compileTheme } from '@supersuit/components/theme'
|
|
10
|
+
// import { checkDepth } from '@supersuit/components/check/depth'
|
|
11
|
+
export const modules = ['sound', 'theme', 'check/depth'];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { PageHeader, defaultPageHeaderWords, TALL_SCROLLER, type PageHeaderProps, type PageHeaderWords, type BackRevealRule, type HeaderAction, type MenuItem, } from './page-header.js';
|
|
2
|
+
export { ShellContext, useShell, useDesktop, DESKTOP_QUERY, type ShellState } from './shell-context.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @supersuit/components/page-header: the top of every screen below the home. Import the styles once:
|
|
2
|
+
// import '@supersuit/components/page-header/styles.css'
|
|
3
|
+
export { PageHeader, defaultPageHeaderWords, TALL_SCROLLER, } from './page-header.js';
|
|
4
|
+
export { ShellContext, useShell, useDesktop, DESKTOP_QUERY } from './shell-context.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ElementType, type ReactNode } from 'react';
|
|
2
|
+
export interface PageHeaderWords {
|
|
3
|
+
back: string;
|
|
4
|
+
backTo: (parent: string) => string;
|
|
5
|
+
more: string;
|
|
6
|
+
suggest: string;
|
|
7
|
+
mySuggestions: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const defaultPageHeaderWords: PageHeaderWords;
|
|
10
|
+
/** The floating Back's rule: `backRevealAt` and `backReveal` from `@supersuit/home-screen-app`, passed as is. */
|
|
11
|
+
export interface BackRevealRule<S extends {
|
|
12
|
+
shown: boolean;
|
|
13
|
+
} = {
|
|
14
|
+
shown: boolean;
|
|
15
|
+
}> {
|
|
16
|
+
backRevealAt: (y: number) => S;
|
|
17
|
+
backReveal: (prev: S, y: number) => S;
|
|
18
|
+
}
|
|
19
|
+
export interface HeaderAction {
|
|
20
|
+
label: string;
|
|
21
|
+
icon: ReactNode;
|
|
22
|
+
href?: string;
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}
|
|
25
|
+
export interface MenuItem {
|
|
26
|
+
label: string;
|
|
27
|
+
onSelect: () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface PageHeaderProps {
|
|
30
|
+
/** The screen's name: the h1 (the h2 of a detail pane). */
|
|
31
|
+
title: string;
|
|
32
|
+
/** The screen's fixed parent. `label` is the parent's name ("Home", "Expenses"); without it Back says "Back". */
|
|
33
|
+
back?: {
|
|
34
|
+
href: string;
|
|
35
|
+
label?: string;
|
|
36
|
+
};
|
|
37
|
+
/** The screen's own buttons: icon buttons on a phone, filled pills with their word on a desktop. */
|
|
38
|
+
actions?: HeaderAction[];
|
|
39
|
+
/** Signed out, there is no More. Default true. */
|
|
40
|
+
signedIn?: boolean;
|
|
41
|
+
/** The app's own items, drawn above Suggest a change and My suggestions. */
|
|
42
|
+
menu?: MenuItem[];
|
|
43
|
+
onSuggest?: () => void;
|
|
44
|
+
onMySuggestions?: () => void;
|
|
45
|
+
/** In a list-and-detail screen: the list pane keeps the screen's name (h1), the detail pane names the item (h2). */
|
|
46
|
+
pane?: 'list' | 'detail';
|
|
47
|
+
/** A screen deeper than its tile with no list beside it: on a desktop, a "‹ Parent" crumb before the title. */
|
|
48
|
+
deep?: boolean;
|
|
49
|
+
/** The floating Back's rule. Pass `@supersuit/home-screen-app` (or its two functions). Without it, nothing floats. */
|
|
50
|
+
backReveal?: BackRevealRule<any>;
|
|
51
|
+
/** The link component, e.g. Next.js `Link`. Default `a`. */
|
|
52
|
+
linkAs?: ElementType;
|
|
53
|
+
words?: Partial<PageHeaderWords>;
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/** A scroller at least this share of the window tall moves the floating Back; a smaller one (a chip row) never does. */
|
|
57
|
+
export declare const TALL_SCROLLER = 0.6;
|
|
58
|
+
export declare function PageHeader(p: PageHeaderProps): import("react").JSX.Element;
|