@hadoku/ui-shell 0.0.0-stage → 0.1.6

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/dist/app-id/index.d.ts +4 -0
  3. package/dist/app-id/index.js +14 -0
  4. package/dist/chrome/AppChrome.d.ts +9 -0
  5. package/dist/chrome/AppChrome.js +201 -0
  6. package/dist/chrome/chrome.css +336 -0
  7. package/dist/chrome/index.d.ts +3 -0
  8. package/dist/chrome/index.js +3 -0
  9. package/dist/chrome/matchMedia.d.ts +2 -0
  10. package/dist/chrome/matchMedia.js +51 -0
  11. package/dist/chrome/shell.d.ts +17 -0
  12. package/dist/chrome/shell.js +47 -0
  13. package/dist/chrome/trim.css +334 -0
  14. package/dist/components/Reveal.d.ts +20 -0
  15. package/dist/components/Reveal.js +38 -0
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/components/index.js +7 -0
  18. package/dist/components/reveal.css +110 -0
  19. package/dist/embed/index.d.ts +1 -0
  20. package/dist/embed/index.js +1 -0
  21. package/dist/embed/styles.d.ts +4 -0
  22. package/dist/embed/styles.js +49 -0
  23. package/dist/motion/index.d.ts +6 -0
  24. package/dist/motion/index.js +8 -0
  25. package/dist/settings/index.d.ts +1 -0
  26. package/dist/settings/index.js +1 -0
  27. package/dist/settings/ui-scale.d.ts +45 -0
  28. package/dist/settings/ui-scale.js +142 -0
  29. package/dist/sound/GainSlider.d.ts +6 -0
  30. package/dist/sound/GainSlider.js +15 -0
  31. package/dist/sound/index.d.ts +65 -0
  32. package/dist/sound/index.js +204 -0
  33. package/dist/sound/mix.d.ts +69 -0
  34. package/dist/sound/mix.js +117 -0
  35. package/dist/sound/mixer.d.ts +37 -0
  36. package/dist/sound/mixer.js +301 -0
  37. package/dist/sound/mute.d.ts +62 -0
  38. package/dist/sound/mute.js +250 -0
  39. package/dist/sound/queue.d.ts +32 -0
  40. package/dist/sound/queue.js +80 -0
  41. package/dist/theme/index.d.ts +18 -0
  42. package/dist/theme/index.js +41 -0
  43. package/dist/trim/index.d.ts +2 -0
  44. package/dist/trim/index.js +2 -0
  45. package/dist/trim/siteTrim.d.ts +23 -0
  46. package/dist/trim/siteTrim.js +91 -0
  47. package/dist/trim/trim.d.ts +72 -0
  48. package/dist/trim/trim.js +63 -0
  49. package/dist/usage/index.d.ts +32 -0
  50. package/dist/usage/index.js +84 -0
  51. package/package.json +69 -4
  52. package/README.md +0 -3
@@ -0,0 +1,17 @@
1
+ /**
2
+ * What the page frame holds, as attributes on `.cardtable-chrome` (`chrome.css` keys its height and its
3
+ * edges on them): `data-shell` names the screen's own shell while it is drawn — `fit` and `match` take
4
+ * the window's height, `sound` too — and `data-room-frame` is there while watchparty's room frame is.
5
+ *
6
+ * Until 2026-10-23 the stylesheet asked the page itself (`.cardtable-chrome:has(.shell--match)`). A `:has()`
7
+ * on the page's own root is checked again on every change anywhere under it, and answering it restyled
8
+ * the whole page: in a six-creature attack, about thirty times in two seconds, 20,000 element matches
9
+ * each time the board so much as marked a card (`e2e/combat-perf.spec.ts`'s selector stats). A screen
10
+ * says so once, as it is drawn and as it goes.
11
+ */
12
+ import { type RefCallback } from 'react';
13
+ export type ChromeShell = 'fit' | 'match' | 'sound';
14
+ /** A screen's shell: a ref for its root element. Stable for a `kind`, so a redraw writes nothing. */
15
+ export declare function useChromeShell(kind: ChromeShell): RefCallback<HTMLElement>;
16
+ /** Watchparty's room frame, drawn around a room's screens: a ref for the element that holds it. */
17
+ export declare function useRoomFrame(): RefCallback<HTMLElement>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * What the page frame holds, as attributes on `.cardtable-chrome` (`chrome.css` keys its height and its
3
+ * edges on them): `data-shell` names the screen's own shell while it is drawn — `fit` and `match` take
4
+ * the window's height, `sound` too — and `data-room-frame` is there while watchparty's room frame is.
5
+ *
6
+ * Until 2026-10-23 the stylesheet asked the page itself (`.cardtable-chrome:has(.shell--match)`). A `:has()`
7
+ * on the page's own root is checked again on every change anywhere under it, and answering it restyled
8
+ * the whole page: in a six-creature attack, about thirty times in two seconds, 20,000 element matches
9
+ * each time the board so much as marked a card (`e2e/combat-perf.spec.ts`'s selector stats). A screen
10
+ * says so once, as it is drawn and as it goes.
11
+ */
12
+ import { useCallback } from 'react';
13
+ /** The frame `el` is drawn in: the app's own, or the embed's. */
14
+ const frameOf = (el) => el.closest('.cardtable-chrome');
15
+ /**
16
+ * Mark the page frame with `name`=`value` for as long as `el` is drawn. Several marking it at once (a
17
+ * screen redrawn into a new element before the old one goes) each hold it; it goes with the last.
18
+ */
19
+ function hold(el, name, value) {
20
+ const frame = frameOf(el);
21
+ if (frame === null)
22
+ return () => undefined;
23
+ const holders = HELD.get(frame) ?? new Map();
24
+ HELD.set(frame, holders);
25
+ const key = `${name}=${value}`;
26
+ holders.set(key, (holders.get(key) ?? 0) + 1);
27
+ frame.setAttribute(name, value);
28
+ return () => {
29
+ const left = (holders.get(key) ?? 1) - 1;
30
+ if (left > 0)
31
+ holders.set(key, left);
32
+ else {
33
+ holders.delete(key);
34
+ if (frame.getAttribute(name) === value)
35
+ frame.removeAttribute(name);
36
+ }
37
+ };
38
+ }
39
+ const HELD = new WeakMap();
40
+ /** A screen's shell: a ref for its root element. Stable for a `kind`, so a redraw writes nothing. */
41
+ export function useChromeShell(kind) {
42
+ return useCallback((el) => (el === null ? undefined : hold(el, 'data-shell', kind)), [kind]);
43
+ }
44
+ /** Watchparty's room frame, drawn around a room's screens: a ref for the element that holds it. */
45
+ export function useRoomFrame() {
46
+ return useCallback((el) => (el === null ? undefined : hold(el, 'data-room-frame', '')), []);
47
+ }
@@ -0,0 +1,334 @@
1
+ /*
2
+ * Trim (`../trim/trim.ts`): decoration the operator composes in Settings → Trim.
3
+ *
4
+ * Every family is a list of background layers, handed to the panel as four custom properties
5
+ * (image, position, size, repeat) so that one rule can stack whichever families are chosen. Layers,
6
+ * not pseudo-elements: a background stays put while the panel's own content scrolls (the room
7
+ * list, the log book), adds nothing to layout or to scroll overflow, and opens no stacking context.
8
+ * Frame shapes are the one exception: they cut the panel itself with a clip-path or a mask, which
9
+ * also clips its shadow and everything drawn inside it, a dialog that overflows the panel included
10
+ * (the create-room dialog lives in the room list's section). So a panel holding a popover
11
+ * (`.ct-surface`) is never cut while it does.
12
+ *
13
+ * A frame's polygon cuts the corners only: its straight edges run 1px outside the panel and each
14
+ * diagonal is the same line extended. A clip edge on the border box itself antialiases at a
15
+ * fractional position and shaved half the 1px border away (the operator, 2026-10-22: "at certain
16
+ * screensizes the edge of panels is not visible"; measured: 40 of 160 edges at half strength at
17
+ * 100% scaling, none once the edges sit outside).
18
+ *
19
+ * Nothing applies until a family is chosen: each rule hangs off a `data-trim-*` attribute that is
20
+ * only present then. `.ct-panel.ct-panel` out-ranks a panel's own background shorthand, which
21
+ * would otherwise reset the image list; the panel keeps its own fill colour.
22
+ *
23
+ * `scoop`'s ring has two colour stops at the exact same radius (`transparent 11px, …-light 11px
24
+ * 12px`): a zero-width transition. At `--ui-scale`/`--fit` 1 that radius is a whole px and nothing
25
+ * shows it; at any other scale (the board's own scale-to-fit is essentially never exactly 1, and
26
+ * movable dialogs are where a player looks closely while dragging) it lands on a fractional px, and
27
+ * Firefox's radial-gradient rasterizer dithers the degenerate edge into a speckled, partly-missing
28
+ * ring instead of antialiasing it — the operator, 2026-10-27: "the colored edge disappears... my
29
+ * guess is this is the firefox renderer behaving poorly" (confirmed: Chromium was never affected,
30
+ * Firefox speckled at every non-1 scale tried). The two stops are nudged 0.1px apart so the
31
+ * transition is never zero-width; measured zero pixel difference at rest (scale 1, dpr 1, either
32
+ * browser) and zero speckled samples at scale 1.1/dpr 1.25 where the unfixed ring speckled on every
33
+ * sample. `chamfer`/`hud`/`step` write the identical zero-width-stop shape for their own corner cut,
34
+ * but as a `linear-gradient`, not a circle — tried at the same fractional scale, neither browser
35
+ * dithers it, so they are left alone.
36
+ */
37
+
38
+ :is([data-trim-frame], [data-trim-corner], [data-trim-edge], [data-trim-texture]) .ct-panel.ct-panel {
39
+ background-image: var(--trim-corner-i, none), var(--trim-frame-i, none), var(--trim-edge-i, none), var(--trim-texture-i, none);
40
+ background-position: var(--trim-corner-p, 0 0), var(--trim-frame-p, 0 0), var(--trim-edge-p, 0 0), var(--trim-texture-p, 0 0);
41
+ background-size: var(--trim-corner-s, auto), var(--trim-frame-s, auto), var(--trim-edge-s, auto), var(--trim-texture-s, auto);
42
+ background-repeat: var(--trim-corner-r, no-repeat), var(--trim-frame-r, no-repeat), var(--trim-edge-r, no-repeat), var(--trim-texture-r, no-repeat);
43
+ background-origin: border-box;
44
+ /*
45
+ * A panel that is its own scroller (the stats popout, a modal, the settings popover) keeps these
46
+ * layers still while its content scrolls, and wears scoop's mask. Chromium will not composite
47
+ * that scroll on its own, so it re-rastered the whole panel every frame: measured over 30 wheel
48
+ * steps on the stats popout with the default Trim, 1101 ms of raster, 7.5 ms with this hint. On a
49
+ * panel that does not scroll it does nothing.
50
+ */
51
+ will-change: scroll-position;
52
+ }
53
+
54
+ [data-trim-frame='glint'] .ct-panel {
55
+ --trim-frame-i:
56
+ linear-gradient(90deg, transparent 8%, var(--color-primary) 16% 30%, transparent 40%),
57
+ linear-gradient(90deg, transparent 60%, var(--color-primary) 70% 84%, transparent 92%);
58
+ --trim-frame-p: 0 1px, 0 calc(100% - 1px);
59
+ --trim-frame-s: 100% 1px, 100% 1px;
60
+ --trim-frame-r: no-repeat, no-repeat;
61
+ border-color: color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
62
+ }
63
+ [data-trim-frame='chamfer'] .ct-panel:not(:has(.ct-surface)) {
64
+ --trim-frame-i:
65
+ linear-gradient(135deg, transparent 50%, var(--color-border-light) 50% calc(50% + 1px), transparent 0),
66
+ linear-gradient(45deg, transparent calc(50% - 1px), var(--color-border-light) calc(50% - 1px) 50%, transparent 0),
67
+ linear-gradient(135deg, transparent calc(50% - 1px), var(--color-border-light) calc(50% - 1px) 50%, transparent 0),
68
+ linear-gradient(45deg, transparent 50%, var(--color-border-light) 50% calc(50% + 1px), transparent 0);
69
+ --trim-frame-p: 0 0, 100% 0, 100% 100%, 0 100%;
70
+ --trim-frame-s: 12px 12px, 12px 12px, 12px 12px, 12px 12px;
71
+ --trim-frame-r: no-repeat, no-repeat, no-repeat, no-repeat;
72
+ border-radius: 0;
73
+ clip-path: polygon(13px -1px, calc(100% - 13px) -1px, calc(100% + 1px) 13px, calc(100% + 1px) calc(100% - 13px), calc(100% - 13px) calc(100% + 1px), 13px calc(100% + 1px), -1px calc(100% - 13px), -1px 13px);
74
+ }
75
+ [data-trim-frame='hud'] .ct-panel:not(:has(.ct-surface)) {
76
+ --trim-frame-i:
77
+ linear-gradient(135deg, transparent 50%, var(--color-primary) 50% calc(50% + 1px), transparent 0),
78
+ linear-gradient(135deg, transparent calc(50% - 1px), var(--color-primary) calc(50% - 1px) 50%, transparent 0);
79
+ --trim-frame-p: 0 0, 100% 100%;
80
+ --trim-frame-s: 18px 18px, 18px 18px;
81
+ --trim-frame-r: no-repeat, no-repeat;
82
+ border-radius: 0;
83
+ clip-path: polygon(19px -1px, calc(100% + 1px) -1px, calc(100% + 1px) calc(100% - 19px), calc(100% - 19px) calc(100% + 1px), -1px calc(100% + 1px), -1px 19px);
84
+ }
85
+ [data-trim-frame='step'] .ct-panel:not(:has(.ct-surface)) {
86
+ --trim-frame-i:
87
+ linear-gradient(var(--color-border-light) 0 0),
88
+ linear-gradient(var(--color-border-light) 0 0),
89
+ linear-gradient(var(--color-border-light) 0 0),
90
+ linear-gradient(var(--color-border-light) 0 0),
91
+ linear-gradient(var(--color-border-light) 0 0),
92
+ linear-gradient(var(--color-border-light) 0 0),
93
+ linear-gradient(var(--color-border-light) 0 0),
94
+ linear-gradient(var(--color-border-light) 0 0),
95
+ linear-gradient(var(--color-border-light) 0 0),
96
+ linear-gradient(var(--color-border-light) 0 0),
97
+ linear-gradient(var(--color-border-light) 0 0),
98
+ linear-gradient(var(--color-border-light) 0 0),
99
+ linear-gradient(var(--color-border-light) 0 0),
100
+ linear-gradient(var(--color-border-light) 0 0),
101
+ linear-gradient(var(--color-border-light) 0 0),
102
+ linear-gradient(var(--color-border-light) 0 0);
103
+ --trim-frame-p: left 0 top 12px, left 6px top 6px, left 6px top 6px, left 12px top 0, right 0 top 12px, right 6px top 6px, right 6px top 6px, right 12px top 0, right 0 bottom 12px, right 6px bottom 6px, right 6px bottom 6px, right 12px bottom 0, left 0 bottom 12px, left 6px bottom 6px, left 6px bottom 6px, left 12px bottom 0;
104
+ --trim-frame-s: 7px 1px, 1px 7px, 7px 1px, 1px 7px, 7px 1px, 1px 7px, 7px 1px, 1px 7px, 7px 1px, 1px 7px, 7px 1px, 1px 7px, 7px 1px, 1px 7px, 7px 1px, 1px 7px;
105
+ --trim-frame-r: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
106
+ border-radius: 0;
107
+ clip-path: polygon(-1px 12px, 6px 12px, 6px 6px, 12px 6px, 12px -1px, calc(100% - 12px) -1px, calc(100% - 12px) 6px, calc(100% - 6px) 6px, calc(100% - 6px) 12px, calc(100% + 1px) 12px, calc(100% + 1px) calc(100% - 12px), calc(100% - 6px) calc(100% - 12px), calc(100% - 6px) calc(100% - 6px), calc(100% - 12px) calc(100% - 6px), calc(100% - 12px) calc(100% + 1px), 12px calc(100% + 1px), 12px calc(100% - 6px), 6px calc(100% - 6px), 6px calc(100% - 12px), -1px calc(100% - 12px));
108
+ }
109
+ [data-trim-frame='scoop'] .ct-panel:not(:has(.ct-surface)) {
110
+ --trim-frame-i:
111
+ radial-gradient(in srgb circle at 0 0, transparent 10.9px, var(--color-border-light) 11.1px 12px, transparent 12.5px),
112
+ radial-gradient(in srgb circle at 100% 0, transparent 10.9px, var(--color-border-light) 11.1px 12px, transparent 12.5px),
113
+ radial-gradient(in srgb circle at 100% 100%, transparent 10.9px, var(--color-border-light) 11.1px 12px, transparent 12.5px),
114
+ radial-gradient(in srgb circle at 0 100%, transparent 10.9px, var(--color-border-light) 11.1px 12px, transparent 12.5px);
115
+ --trim-frame-p: 0 0, 100% 0, 100% 100%, 0 100%;
116
+ --trim-frame-s: 13px 13px, 13px 13px, 13px 13px, 13px 13px;
117
+ --trim-frame-r: no-repeat, no-repeat, no-repeat, no-repeat;
118
+ border-radius: 0;
119
+ -webkit-mask: radial-gradient(in srgb 11px at 0 0, transparent 98%, var(--color-text)) 0 0 / 51% 51% no-repeat, radial-gradient(in srgb 11px at 100% 0, transparent 98%, var(--color-text)) 100% 0 / 51% 51% no-repeat, radial-gradient(in srgb 11px at 0 100%, transparent 98%, var(--color-text)) 0 100% / 51% 51% no-repeat, radial-gradient(in srgb 11px at 100% 100%, transparent 98%, var(--color-text)) 100% 100% / 51% 51% no-repeat;
120
+ mask: radial-gradient(in srgb 11px at 0 0, transparent 98%, var(--color-text)) 0 0 / 51% 51% no-repeat, radial-gradient(in srgb 11px at 100% 0, transparent 98%, var(--color-text)) 100% 0 / 51% 51% no-repeat, radial-gradient(in srgb 11px at 0 100%, transparent 98%, var(--color-text)) 0 100% / 51% 51% no-repeat, radial-gradient(in srgb 11px at 100% 100%, transparent 98%, var(--color-text)) 100% 100% / 51% 51% no-repeat;
121
+ }
122
+ [data-trim-corner='brackets'] .ct-panel {
123
+ --trim-corner-i:
124
+ linear-gradient(var(--color-primary) 0 0),
125
+ linear-gradient(var(--color-primary) 0 0),
126
+ linear-gradient(var(--color-primary) 0 0),
127
+ linear-gradient(var(--color-primary) 0 0),
128
+ linear-gradient(var(--color-primary) 0 0),
129
+ linear-gradient(var(--color-primary) 0 0),
130
+ linear-gradient(var(--color-primary) 0 0),
131
+ linear-gradient(var(--color-primary) 0 0);
132
+ --trim-corner-p: left 4px top 4px, left 4px top 4px, right 4px top 4px, right 4px top 4px, left 4px bottom 4px, left 4px bottom 4px, right 4px bottom 4px, right 4px bottom 4px;
133
+ --trim-corner-s: 12px 2px, 2px 12px, 12px 2px, 2px 12px, 12px 2px, 2px 12px, 12px 2px, 2px 12px;
134
+ --trim-corner-r: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
135
+ }
136
+ [data-trim-corner='triangles'] .ct-panel {
137
+ --trim-corner-i:
138
+ linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 85%, transparent) 50%, transparent 0),
139
+ linear-gradient(225deg, color-mix(in srgb, var(--color-primary) 85%, transparent) 50%, transparent 0),
140
+ linear-gradient(45deg, color-mix(in srgb, var(--color-primary) 85%, transparent) 50%, transparent 0),
141
+ linear-gradient(315deg, color-mix(in srgb, var(--color-primary) 85%, transparent) 50%, transparent 0);
142
+ --trim-corner-p: left 4px top 4px, right 4px top 4px, left 4px bottom 4px, right 4px bottom 4px;
143
+ --trim-corner-s: 11px 11px, 11px 11px, 11px 11px, 11px 11px;
144
+ --trim-corner-r: no-repeat, no-repeat, no-repeat, no-repeat;
145
+ }
146
+ [data-trim-corner='rivets'] .ct-panel {
147
+ --trim-corner-i:
148
+ radial-gradient(in srgb circle at 38% 38%, color-mix(in srgb, var(--color-text) 75%, transparent) 0 1px, var(--color-border-light) 1.6px 3px, var(--color-border) 3.4px 4px, transparent 4.5px),
149
+ radial-gradient(in srgb circle at 38% 38%, color-mix(in srgb, var(--color-text) 75%, transparent) 0 1px, var(--color-border-light) 1.6px 3px, var(--color-border) 3.4px 4px, transparent 4.5px),
150
+ radial-gradient(in srgb circle at 38% 38%, color-mix(in srgb, var(--color-text) 75%, transparent) 0 1px, var(--color-border-light) 1.6px 3px, var(--color-border) 3.4px 4px, transparent 4.5px),
151
+ radial-gradient(in srgb circle at 38% 38%, color-mix(in srgb, var(--color-text) 75%, transparent) 0 1px, var(--color-border-light) 1.6px 3px, var(--color-border) 3.4px 4px, transparent 4.5px);
152
+ --trim-corner-p: left 6px top 6px, right 6px top 6px, left 6px bottom 6px, right 6px bottom 6px;
153
+ --trim-corner-s: 9px 9px, 9px 9px, 9px 9px, 9px 9px;
154
+ --trim-corner-r: no-repeat, no-repeat, no-repeat, no-repeat;
155
+ }
156
+ [data-trim-corner='gems'] .ct-panel {
157
+ --trim-corner-i:
158
+ conic-gradient(from 135deg at 50% 0, var(--color-primary) 0 90deg, transparent 0),
159
+ conic-gradient(from -45deg at 50% 100%, var(--color-primary) 0 90deg, transparent 0),
160
+ conic-gradient(from 135deg at 50% 0, var(--color-primary) 0 90deg, transparent 0),
161
+ conic-gradient(from -45deg at 50% 100%, var(--color-primary) 0 90deg, transparent 0),
162
+ conic-gradient(from 135deg at 50% 0, var(--color-primary) 0 90deg, transparent 0),
163
+ conic-gradient(from -45deg at 50% 100%, var(--color-primary) 0 90deg, transparent 0),
164
+ conic-gradient(from 135deg at 50% 0, var(--color-primary) 0 90deg, transparent 0),
165
+ conic-gradient(from -45deg at 50% 100%, var(--color-primary) 0 90deg, transparent 0);
166
+ --trim-corner-p: left 5px top 5px, left 5px top 10px, left 5px bottom 10px, left 5px bottom 5px, right 5px top 5px, right 5px top 10px, right 5px bottom 10px, right 5px bottom 5px;
167
+ --trim-corner-s: 10px 5px, 10px 5px, 10px 5px, 10px 5px, 10px 5px, 10px 5px, 10px 5px, 10px 5px;
168
+ --trim-corner-r: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
169
+ }
170
+ [data-trim-edge='keystone'] .ct-panel {
171
+ --trim-edge-i:
172
+ conic-gradient(from 135deg at 50% 0, var(--color-primary) 0 90deg, transparent 0),
173
+ linear-gradient(90deg, transparent, var(--color-primary) 35% 65%, transparent);
174
+ --trim-edge-p: 50% calc(100% - 1px), 50% calc(100% - 1px);
175
+ --trim-edge-s: 14px 7px, 30% 1px;
176
+ --trim-edge-r: no-repeat, no-repeat;
177
+ }
178
+ [data-trim-texture='felt'] .ct-panel {
179
+ --trim-texture-i:
180
+ radial-gradient(in srgb, color-mix(in srgb, var(--color-text) 9%, transparent) 1px, transparent 1.5px),
181
+ linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 9%, transparent), transparent 45%);
182
+ --trim-texture-p: 0 0, 0 0;
183
+ --trim-texture-s: 9px 9px, 100% 100%;
184
+ --trim-texture-r: repeat, no-repeat;
185
+ }
186
+ [data-trim-texture='linen'] .ct-panel {
187
+ --trim-texture-i:
188
+ repeating-linear-gradient(0deg, color-mix(in srgb, var(--color-text) 4%, transparent) 0 1px, transparent 1px 3px),
189
+ repeating-linear-gradient(90deg, color-mix(in srgb, var(--color-text) 4%, transparent) 0 1px, transparent 1px 3px);
190
+ --trim-texture-p: 0 0, 0 0;
191
+ --trim-texture-s: auto, auto;
192
+ --trim-texture-r: repeat, repeat;
193
+ }
194
+ [data-trim-texture='lattice'] .ct-panel {
195
+ --trim-texture-i:
196
+ repeating-linear-gradient(45deg, color-mix(in srgb, var(--color-text) 6%, transparent) 0 1px, transparent 1px 14px),
197
+ repeating-linear-gradient(-45deg, color-mix(in srgb, var(--color-text) 6%, transparent) 0 1px, transparent 1px 14px);
198
+ --trim-texture-p: 0 0, 0 0;
199
+ --trim-texture-s: auto, auto;
200
+ --trim-texture-r: repeat, repeat;
201
+ }
202
+
203
+ /* ── titles ── */
204
+
205
+ [data-trim-title='rail'] .ct-panel__title {
206
+ display: flex;
207
+ align-items: center;
208
+ gap: 10px;
209
+ }
210
+
211
+ [data-trim-title='rail'] .ct-panel__title::before {
212
+ content: '';
213
+ flex: none;
214
+ width: 6px;
215
+ height: 6px;
216
+ transform: rotate(45deg);
217
+ background: var(--color-primary);
218
+ }
219
+
220
+ [data-trim-title='rail'] .ct-panel__title::after {
221
+ content: '';
222
+ flex: 1;
223
+ min-width: 12px;
224
+ height: 1px;
225
+ background: linear-gradient(90deg, var(--color-border-light), transparent);
226
+ }
227
+
228
+ [data-trim-title='centred'] .ct-panel__title {
229
+ display: flex;
230
+ align-items: center;
231
+ gap: 10px;
232
+ text-align: center;
233
+ }
234
+
235
+ [data-trim-title='centred'] .ct-panel__title::before,
236
+ [data-trim-title='centred'] .ct-panel__title::after {
237
+ content: '';
238
+ flex: 1;
239
+ min-width: 12px;
240
+ height: 7px;
241
+ background:
242
+ radial-gradient(in srgb circle, var(--color-primary) 2.5px, transparent 3px) left / 7px 7px no-repeat,
243
+ linear-gradient(var(--color-border-light) 0 0) center / 100% 1px no-repeat;
244
+ }
245
+
246
+ [data-trim-title='centred'] .ct-panel__title::after {
247
+ transform: scaleX(-1);
248
+ }
249
+
250
+ [data-trim-title='ribbon'] .ct-panel__title {
251
+ width: fit-content;
252
+ max-width: 100%;
253
+ padding: 3px 22px;
254
+ color: var(--color-text);
255
+ background: linear-gradient(90deg, color-mix(in srgb, var(--color-primary) 32%, var(--color-bg-card)), color-mix(in srgb, var(--color-primary) 12%, var(--color-bg-card)));
256
+ clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%, 9px 50%);
257
+ }
258
+
259
+ /* ── the page's ground: the chrome root, which paints the background every screen sits on ── */
260
+
261
+ .cardtable-chrome:is([data-trim-ground], [data-trim-ground] *, [data-trim-ground-corner], [data-trim-ground-corner] *) {
262
+ background-image: var(--trim-ground-corner-i, none), var(--trim-ground-i, none);
263
+ background-position: var(--trim-ground-corner-p, 0 0), var(--trim-ground-p, 0 0);
264
+ background-size: var(--trim-ground-corner-s, auto), var(--trim-ground-s, auto);
265
+ background-repeat: var(--trim-ground-corner-r, no-repeat), var(--trim-ground-r, no-repeat);
266
+ background-origin: border-box;
267
+ }
268
+
269
+ .cardtable-chrome:is([data-trim-ground='glow'], [data-trim-ground='glow'] *) {
270
+ --trim-ground-i:
271
+ radial-gradient(in srgb ellipse 70% 60% at 50% -10%, color-mix(in srgb, var(--color-primary) 16%, transparent), transparent);
272
+ --trim-ground-p: 0 0;
273
+ --trim-ground-s: 100% 700px;
274
+ --trim-ground-r: no-repeat;
275
+ }
276
+ .cardtable-chrome:is([data-trim-ground='felt'], [data-trim-ground='felt'] *) {
277
+ --trim-ground-i:
278
+ radial-gradient(in srgb, color-mix(in srgb, var(--color-text) 5%, transparent) 1px, transparent 1.5px),
279
+ radial-gradient(in srgb ellipse at 50% 40%, color-mix(in srgb, var(--color-bg-hover) 75%, var(--color-bg)), var(--color-bg) 75%);
280
+ --trim-ground-p: 0 0, 0 0;
281
+ --trim-ground-s: 7px 7px, 100% 100%;
282
+ --trim-ground-r: repeat, no-repeat;
283
+ }
284
+ .cardtable-chrome:is([data-trim-ground='dots'], [data-trim-ground='dots'] *) {
285
+ --trim-ground-i:
286
+ radial-gradient(in srgb, color-mix(in srgb, var(--color-text) 10%, transparent) 1.2px, transparent 1.6px);
287
+ --trim-ground-p: 0 0;
288
+ --trim-ground-s: 22px 22px;
289
+ --trim-ground-r: repeat;
290
+ }
291
+ .cardtable-chrome:is([data-trim-ground='grid'], [data-trim-ground='grid'] *) {
292
+ --trim-ground-i:
293
+ linear-gradient(color-mix(in srgb, var(--color-primary) 11%, transparent) 0 1px, transparent 1px),
294
+ linear-gradient(90deg, color-mix(in srgb, var(--color-primary) 11%, transparent) 0 1px, transparent 1px),
295
+ linear-gradient(color-mix(in srgb, var(--color-primary) 5%, transparent) 0 1px, transparent 1px),
296
+ linear-gradient(90deg, color-mix(in srgb, var(--color-primary) 5%, transparent) 0 1px, transparent 1px);
297
+ --trim-ground-p: 0 0, 0 0, 0 0, 0 0;
298
+ --trim-ground-s: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
299
+ --trim-ground-r: repeat, repeat, repeat, repeat;
300
+ }
301
+ .cardtable-chrome:is([data-trim-ground='triangles'], [data-trim-ground='triangles'] *) {
302
+ --trim-ground-i:
303
+ repeating-linear-gradient(60deg, color-mix(in srgb, var(--color-text) 4%, transparent) 0 1px, transparent 1px 30px),
304
+ repeating-linear-gradient(-60deg, color-mix(in srgb, var(--color-text) 4%, transparent) 0 1px, transparent 1px 30px);
305
+ --trim-ground-p: 0 0, 0 0;
306
+ --trim-ground-s: auto, auto;
307
+ --trim-ground-r: repeat, repeat;
308
+ }
309
+ .cardtable-chrome:is([data-trim-ground-corner='wedge'], [data-trim-ground-corner='wedge'] *) {
310
+ --trim-ground-corner-i:
311
+ linear-gradient(to top right, color-mix(in srgb, var(--color-primary) 18%, transparent), transparent 45%),
312
+ linear-gradient(to top left, color-mix(in srgb, var(--color-primary) 18%, transparent), transparent 45%);
313
+ --trim-ground-corner-p: left bottom, right bottom;
314
+ --trim-ground-corner-s: 220px 220px, 220px 220px;
315
+ --trim-ground-corner-r: no-repeat, no-repeat;
316
+ }
317
+ .cardtable-chrome:is([data-trim-ground-corner='gems'], [data-trim-ground-corner='gems'] *) {
318
+ --trim-ground-corner-i:
319
+ conic-gradient(from 135deg at 50% 0, color-mix(in srgb, var(--color-primary) 55%, transparent) 0 90deg, transparent 0),
320
+ conic-gradient(from -45deg at 50% 100%, color-mix(in srgb, var(--color-primary) 55%, transparent) 0 90deg, transparent 0),
321
+ conic-gradient(from 135deg at 50% 0, color-mix(in srgb, var(--color-primary) 40%, transparent) 0 90deg, transparent 0),
322
+ conic-gradient(from -45deg at 50% 100%, color-mix(in srgb, var(--color-primary) 40%, transparent) 0 90deg, transparent 0),
323
+ conic-gradient(from 135deg at 50% 0, color-mix(in srgb, var(--color-primary) 28%, transparent) 0 90deg, transparent 0),
324
+ conic-gradient(from -45deg at 50% 100%, color-mix(in srgb, var(--color-primary) 28%, transparent) 0 90deg, transparent 0),
325
+ conic-gradient(from 135deg at 50% 0, color-mix(in srgb, var(--color-primary) 55%, transparent) 0 90deg, transparent 0),
326
+ conic-gradient(from -45deg at 50% 100%, color-mix(in srgb, var(--color-primary) 55%, transparent) 0 90deg, transparent 0),
327
+ conic-gradient(from 135deg at 50% 0, color-mix(in srgb, var(--color-primary) 40%, transparent) 0 90deg, transparent 0),
328
+ conic-gradient(from -45deg at 50% 100%, color-mix(in srgb, var(--color-primary) 40%, transparent) 0 90deg, transparent 0),
329
+ conic-gradient(from 135deg at 50% 0, color-mix(in srgb, var(--color-primary) 28%, transparent) 0 90deg, transparent 0),
330
+ conic-gradient(from -45deg at 50% 100%, color-mix(in srgb, var(--color-primary) 28%, transparent) 0 90deg, transparent 0);
331
+ --trim-ground-corner-p: left 22px bottom 39px, left 22px bottom 30px, left 48px bottom 19px, left 48px bottom 14px, left 12px bottom 66px, left 12px bottom 62px, right 22px bottom 39px, right 22px bottom 30px, right 48px bottom 19px, right 48px bottom 14px, right 12px bottom 66px, right 12px bottom 62px;
332
+ --trim-ground-corner-s: 18px 9px, 18px 9px, 10px 5px, 10px 5px, 8px 4px, 8px 4px, 18px 9px, 18px 9px, 10px 5px, 10px 5px, 8px 4px, 8px 4px;
333
+ --trim-ground-corner-r: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
334
+ }
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from 'react';
2
+ import './reveal.css';
3
+ /** How long the crossfade runs: `reveal.css`'s own `--reveal-ms`. */
4
+ export declare const REVEAL_MS = 280;
5
+ export interface RevealProps {
6
+ /** The content is ready to be seen. */
7
+ shown: boolean;
8
+ /** What stands in its place until then, in the content's own boxes. */
9
+ skeleton: ReactNode;
10
+ children: ReactNode;
11
+ /** The box's name, for `data-reveal`. */
12
+ name: string;
13
+ /** Classes for the box itself (how it sits in its parent). */
14
+ className?: string;
15
+ /** Classes for each of the two layers (how each lays out what it holds), so both lay out alike. */
16
+ layerClassName?: string;
17
+ /** Told, after the box is drawn that way, whether it is shown: true once the crossfade is done. */
18
+ onShown?: (shown: boolean) => void;
19
+ }
20
+ export declare function Reveal({ shown, skeleton, children, name, className, layerClassName, onShown }: RevealProps): import("react").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * A box's skeleton, then its content, crossfaded in the same place (the operator, 2026-10-31, of the
4
+ * front page: *"introduce a loading skeleton … that waits for things to be ready. help me with a nice
5
+ * transition between the loading skeleton and the page"*).
6
+ *
7
+ * Both layers sit in one grid cell, so the content lands exactly where its skeleton stood. The content
8
+ * is mounted from the start, hidden: whatever it reads or measures while it waits, it has done by the
9
+ * time it is shown. `shown` going true fades the content in over the skeleton (`reveal.css`), then the
10
+ * skeleton is dropped; going false again (a Retry) brings the skeleton back.
11
+ *
12
+ * `data-reveal` names the box and `data-phase` says where it is, for `e2e/front-skeleton.spec.ts`.
13
+ * `onShown` hears when the crossfade has finished (and when the skeleton comes back): work that must
14
+ * wait until the box is shown waits on this, never on a timer of its own the same length as the fade.
15
+ */
16
+ import { useEffect, useRef, useState } from 'react';
17
+ import './reveal.css';
18
+ /** How long the crossfade runs: `reveal.css`'s own `--reveal-ms`. */
19
+ export const REVEAL_MS = 280;
20
+ export function Reveal({ shown, skeleton, children, name, className, layerClassName, onShown }) {
21
+ const [phase, setPhase] = useState(shown ? 'shown' : 'waiting');
22
+ const told = useRef(onShown);
23
+ told.current = onShown;
24
+ useEffect(() => {
25
+ told.current?.(phase === 'shown');
26
+ }, [phase]);
27
+ useEffect(() => {
28
+ if (!shown) {
29
+ setPhase('waiting');
30
+ return undefined;
31
+ }
32
+ setPhase((p) => (p === 'shown' ? p : 'fading'));
33
+ const done = setTimeout(() => setPhase('shown'), REVEAL_MS);
34
+ return () => clearTimeout(done);
35
+ }, [shown]);
36
+ const layer = layerClassName === undefined ? 'reveal__layer' : `reveal__layer ${layerClassName}`;
37
+ return (_jsxs("div", { className: className === undefined ? 'reveal' : `reveal ${className}`, "data-reveal": name, "data-phase": phase, children: [phase !== 'shown' && (_jsx("div", { className: `${layer} reveal__skeleton`, "aria-hidden": "true", children: skeleton })), _jsx("div", { className: `${layer} reveal__content`, children: children })] }));
38
+ }
@@ -0,0 +1 @@
1
+ export { Reveal, REVEAL_MS, type RevealProps } from './Reveal.js';
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Generic components any game's UI keeps. `Modal` stays in cardtable this wave: it portals through
3
+ * `OverPage.tsx` (the chrome-root-or-body choice, shadow-root-aware via `packages/game-ui/src/dom.ts`), and
4
+ * neither file is this wave's to move — both have outside importers (`Popover.tsx`, `RoomList.tsx`,
5
+ * `DeckPeek.tsx`, and the embed mount) this lane does not own. Reported, not guessed around.
6
+ */
7
+ export { Reveal, REVEAL_MS } from "./Reveal.js";
@@ -0,0 +1,110 @@
1
+ /*
2
+ * `Reveal.tsx`: a skeleton and its content in one grid cell, crossfaded. And `ghost`, the placeholder
3
+ * a skeleton draws with: it takes the box of the thing it stands for (wrap the real text in it, in
4
+ * the real element's classes, and the line lands where the text will), breathing in opacity only, so
5
+ * the compositor runs it (`../composited-loops.test.ts`). Theme tokens only.
6
+ */
7
+
8
+ .reveal {
9
+ --reveal-ms: 280ms;
10
+
11
+ display: grid;
12
+ grid-template: minmax(0, 1fr) / minmax(0, 1fr);
13
+ }
14
+
15
+ .reveal__layer {
16
+ grid-area: 1 / 1;
17
+ min-width: 0;
18
+ min-height: 0;
19
+ }
20
+
21
+ .reveal__skeleton {
22
+ pointer-events: none;
23
+ }
24
+
25
+ /* Laid out and reading, never seen or reached, until it is ready. */
26
+ .reveal[data-phase='waiting'] > .reveal__content {
27
+ visibility: hidden;
28
+ }
29
+
30
+ @media (prefers-reduced-motion: no-preference) {
31
+ .reveal[data-phase='fading'] > .reveal__content {
32
+ animation: reveal-in var(--reveal-ms) ease-out both;
33
+ }
34
+
35
+ .reveal[data-phase='fading'] > .reveal__skeleton {
36
+ animation: reveal-out var(--reveal-ms) ease-in both;
37
+ }
38
+ }
39
+
40
+ /* No fade: the content replaces its skeleton at once. */
41
+ @media (prefers-reduced-motion: reduce) {
42
+ .reveal[data-phase='fading'] > .reveal__skeleton {
43
+ visibility: hidden;
44
+ }
45
+ }
46
+
47
+ @keyframes reveal-in {
48
+ from {
49
+ opacity: 0;
50
+ }
51
+ }
52
+
53
+ @keyframes reveal-out {
54
+ to {
55
+ opacity: 0;
56
+ }
57
+ }
58
+
59
+ .ghost {
60
+ border-radius: 4px;
61
+ animation: ghost-breathe 1.6s ease-in-out infinite alternate;
62
+ }
63
+
64
+ /*
65
+ * Inside a skeleton, a ghost's words and glyphs are never seen, whatever colour the real element's own
66
+ * classes give them (a chip, a tag, a button): two classes, so it outranks every one-class colour rule.
67
+ */
68
+ .reveal__skeleton .ghost {
69
+ color: transparent;
70
+ background: color-mix(in srgb, var(--ink-faint) 22%, var(--bg-card));
71
+ border-color: transparent;
72
+ box-shadow: none;
73
+ }
74
+
75
+ .reveal__skeleton .ghost * {
76
+ color: transparent;
77
+ background: transparent;
78
+ }
79
+
80
+ /* A line of text: as tall as the text it stands for, as wide as the words it wraps. */
81
+ .ghost--text {
82
+ display: inline-block;
83
+ max-width: 100%;
84
+ overflow: hidden;
85
+ white-space: nowrap;
86
+ vertical-align: top;
87
+ }
88
+
89
+ /* A block that fills the box it is put in. */
90
+ .ghost--fill {
91
+ display: block;
92
+ width: 100%;
93
+ height: 100%;
94
+ }
95
+
96
+ @keyframes ghost-breathe {
97
+ from {
98
+ opacity: 1;
99
+ }
100
+
101
+ to {
102
+ opacity: 0.55;
103
+ }
104
+ }
105
+
106
+ @media (prefers-reduced-motion: reduce) {
107
+ .ghost {
108
+ animation: none;
109
+ }
110
+ }
@@ -0,0 +1 @@
1
+ export * from './styles.js';
@@ -0,0 +1 @@
1
+ export * from "./styles.js";
@@ -0,0 +1,4 @@
1
+ /** Split `css` into the shadow root's sheet and the document's, and adopt both. Returns the undo. */
2
+ export declare function adoptStyles(shadow: ShadowRoot, css: string): () => void;
3
+ /** The embed's stylesheet text. A failure is the mount's failure: a table with no styles is not a table. */
4
+ export declare function fetchStyles(href: string): Promise<string>;
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Cardtable's stylesheet, inside a shadow root.
3
+ *
4
+ * The embed build (`../../vite.embed.config.ts`) emits every sheet the app
5
+ * imports as ONE file, `embed/cardtable-embed.css`, with `:root`, `html` and
6
+ * `body` already rewritten to `:host` — none of the three exists inside a
7
+ * shadow tree, and the theme tokens and the table palette are declared on
8
+ * `:root`. What cannot be fixed at build time is fixed here:
9
+ *
10
+ * - **`@font-face` and `@property` are ignored inside a shadow root** (Chromium
11
+ * registers neither from a shadow-scoped sheet), so the Mana and Keyrune
12
+ * glyph fonts and the shimmer's `@property` would silently not exist. They
13
+ * are lifted into a sheet adopted by the DOCUMENT for the life of the mount.
14
+ * Both are keyed by a name only cardtable uses, so they cannot restyle the
15
+ * page they are lent to.
16
+ * - Everything else is adopted by the shadow root alone, so nothing of ours
17
+ * reaches watchparty's page and nothing of theirs reaches the table except
18
+ * what CSS inherits across the boundary (custom properties, font, colour).
19
+ */
20
+ /** Rules a shadow-scoped sheet does not register; they live on the document while mounted. */
21
+ function documentOnly(rule) {
22
+ return rule.cssText.startsWith('@font-face') || rule.cssText.startsWith('@property');
23
+ }
24
+ /** Split `css` into the shadow root's sheet and the document's, and adopt both. Returns the undo. */
25
+ export function adoptStyles(shadow, css) {
26
+ const scoped = new CSSStyleSheet();
27
+ scoped.replaceSync(css);
28
+ const page = new CSSStyleSheet();
29
+ for (let i = scoped.cssRules.length - 1; i >= 0; i -= 1) {
30
+ const rule = scoped.cssRules[i];
31
+ if (!documentOnly(rule))
32
+ continue;
33
+ page.insertRule(rule.cssText, 0);
34
+ scoped.deleteRule(i);
35
+ }
36
+ shadow.adoptedStyleSheets = [scoped];
37
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, page];
38
+ return () => {
39
+ shadow.adoptedStyleSheets = [];
40
+ document.adoptedStyleSheets = document.adoptedStyleSheets.filter((sheet) => sheet !== page);
41
+ };
42
+ }
43
+ /** The embed's stylesheet text. A failure is the mount's failure: a table with no styles is not a table. */
44
+ export async function fetchStyles(href) {
45
+ const res = await fetch(href, { credentials: 'same-origin' });
46
+ if (!res.ok)
47
+ throw new Error(`cardtable embed: ${href} answered ${res.status}`);
48
+ return res.text();
49
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Whether the viewer asked for less motion. Any game's board can read this
3
+ * without caring where the question lives; cardtable's own `play/motion.ts`
4
+ * re-exports it so none of its 20+ importers moved.
5
+ */
6
+ export declare function prefersReducedMotion(): boolean;