@hadoku/game-ui 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.
- package/LICENSE +21 -0
- package/dist/chrome/HeaderLinks.d.ts +16 -0
- package/dist/chrome/HeaderLinks.js +24 -0
- package/dist/components/ActionButton.d.ts +9 -0
- package/dist/components/ActionButton.js +49 -0
- package/dist/components/Avatar.d.ts +43 -0
- package/dist/components/Avatar.js +53 -0
- package/dist/components/ConnectionBanner.css +77 -0
- package/dist/components/ConnectionBanner.d.ts +33 -0
- package/dist/components/ConnectionBanner.js +33 -0
- package/dist/components/Modal.css +69 -0
- package/dist/components/Modal.d.ts +12 -0
- package/dist/components/Modal.js +31 -0
- package/dist/components/OverPage.d.ts +4 -0
- package/dist/components/OverPage.js +21 -0
- package/dist/components/Popover.css +58 -0
- package/dist/components/Popover.d.ts +20 -0
- package/dist/components/Popover.js +63 -0
- package/dist/components/RadioCards.css +178 -0
- package/dist/components/RadioCards.d.ts +33 -0
- package/dist/components/RadioCards.js +41 -0
- package/dist/components/StatusPill.d.ts +16 -0
- package/dist/components/StatusPill.js +17 -0
- package/dist/components/connection-state.d.ts +32 -0
- package/dist/components/connection-state.js +5 -0
- package/dist/dom.d.ts +17 -0
- package/dist/dom.js +57 -0
- package/dist/front/Gallery.d.ts +22 -0
- package/dist/front/Gallery.js +48 -0
- package/dist/front/PatchNotesCard.d.ts +1 -0
- package/dist/front/PatchNotesCard.js +59 -0
- package/dist/front/camera.d.ts +80 -0
- package/dist/front/camera.js +120 -0
- package/dist/front/countdown.d.ts +2 -0
- package/dist/front/countdown.js +16 -0
- package/dist/front/discordChat.d.ts +22 -0
- package/dist/front/discordChat.js +52 -0
- package/dist/front/gallery.d.ts +13 -0
- package/dist/front/gallery.js +32 -0
- package/dist/front/gate.d.ts +23 -0
- package/dist/front/gate.js +55 -0
- package/dist/front/icons.d.ts +43 -0
- package/dist/front/icons.js +99 -0
- package/dist/front/patchNotes.d.ts +37 -0
- package/dist/front/patchNotes.js +95 -0
- package/dist/front/polls.d.ts +24 -0
- package/dist/front/polls.js +95 -0
- package/dist/front/shape.d.ts +11 -0
- package/dist/front/shape.js +52 -0
- package/dist/http.d.ts +28 -0
- package/dist/http.js +83 -0
- package/dist/idle.d.ts +2 -0
- package/dist/idle.js +7 -0
- package/dist/lazy.d.ts +9 -0
- package/dist/lazy.js +63 -0
- package/dist/popover.d.ts +13 -0
- package/dist/popover.js +39 -0
- package/dist/registered.d.ts +5 -0
- package/dist/registered.js +6 -0
- package/dist/restart-notice.d.ts +20 -0
- package/dist/restart-notice.js +54 -0
- package/dist/room/RoomShell.d.ts +116 -0
- package/dist/room/RoomShell.js +222 -0
- package/dist/room/SessionPrompt.d.ts +12 -0
- package/dist/room/SessionPrompt.js +54 -0
- package/dist/room/avatar.d.ts +31 -0
- package/dist/room/avatar.js +60 -0
- package/dist/room/look.css +13 -0
- package/dist/room/look.d.ts +35 -0
- package/dist/room/look.js +189 -0
- package/dist/room/seatsOpen.d.ts +7 -0
- package/dist/room/seatsOpen.js +37 -0
- package/dist/room/session.d.ts +26 -0
- package/dist/room/session.js +108 -0
- package/dist/room/socket-options.d.ts +33 -0
- package/dist/room/socket-options.js +40 -0
- package/dist/room/tab-id.d.ts +6 -0
- package/dist/room/tab-id.js +90 -0
- package/dist/room/whoami.d.ts +15 -0
- package/dist/room/whoami.js +48 -0
- package/dist/rooms/bundle-slot.fixture.d.ts +11 -0
- package/dist/rooms/bundle-slot.fixture.js +21 -0
- package/dist/rooms/game-clients.d.ts +12 -0
- package/dist/rooms/game-clients.js +30 -0
- package/dist/rooms/game-setup.d.ts +63 -0
- package/dist/rooms/game-setup.js +33 -0
- package/dist/rooms/relay-channel.d.ts +29 -0
- package/dist/rooms/relay-channel.js +123 -0
- package/dist/rooms/screen/RoomShell.d.ts +33 -0
- package/dist/rooms/screen/RoomShell.js +7 -0
- package/dist/screens/route.d.ts +143 -0
- package/dist/screens/route.js +359 -0
- package/dist/settings/Settings.d.ts +39 -0
- package/dist/settings/Settings.js +131 -0
- package/dist/settings/TrimScreen.d.ts +2 -0
- package/dist/settings/TrimScreen.js +29 -0
- package/dist/settings/settings.css +116 -0
- package/dist/settings/siteTrim.d.ts +3 -0
- package/dist/settings/siteTrim.js +9 -0
- package/dist/settings/trim-screen.css +30 -0
- package/dist/sound/index.d.ts +12 -0
- package/dist/sound/index.js +34 -0
- package/dist/stale-build.d.ts +16 -0
- package/dist/stale-build.js +59 -0
- package/dist/top-layer.css +22 -0
- package/dist/topLayer.d.ts +19 -0
- package/dist/topLayer.js +44 -0
- package/dist/usage.d.ts +5 -0
- package/dist/usage.js +17 -0
- package/dist/visible.d.ts +14 -0
- package/dist/visible.js +35 -0
- package/package.json +41 -4
- package/README.md +0 -3
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* `RadioCards`: the format tabs' look (`.lobby__format-tabs button`) for a row
|
|
3
|
+
* of native radios. Two classes per selector, so the create form's generic
|
|
4
|
+
* `.rooms__create label` / `.rooms__create input` rules never reach a card.
|
|
5
|
+
*/
|
|
6
|
+
.radio-cards {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-wrap: wrap;
|
|
9
|
+
gap: 4px;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.radio-cards .radio-cards__card {
|
|
14
|
+
position: relative;
|
|
15
|
+
flex: 0 0 auto;
|
|
16
|
+
padding: 0.35rem 0.75rem;
|
|
17
|
+
background: var(--color-bg-alt);
|
|
18
|
+
color: var(--color-text-secondary);
|
|
19
|
+
border: 1px solid var(--color-border-light);
|
|
20
|
+
border-radius: var(--hdk-radius);
|
|
21
|
+
font: inherit;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
text-transform: none;
|
|
24
|
+
letter-spacing: normal;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.radio-cards .radio-cards__card:has(:checked) {
|
|
30
|
+
background: var(--color-primary);
|
|
31
|
+
color: var(--color-on-primary);
|
|
32
|
+
border-color: var(--color-primary);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.radio-cards .radio-cards__card:has(:disabled) {
|
|
36
|
+
cursor: default;
|
|
37
|
+
opacity: 0.6;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.radio-cards .radio-cards__card:has(:focus-visible) {
|
|
41
|
+
outline: 2px solid var(--color-primary);
|
|
42
|
+
outline-offset: 2px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* A small row of plain cards is one segmented bar (the operator, 2026-11-09: "join each group into
|
|
47
|
+
* a segmented bar"), so two groups side by side read as two choices, not one run of pills. The
|
|
48
|
+
* format tabs (`.lobby__format-tabs`, `screens.css`) draw the same bar. Neighbours share a border;
|
|
49
|
+
* the chosen or focused segment sits over its neighbours so its whole border shows.
|
|
50
|
+
*/
|
|
51
|
+
.radio-cards--segmented {
|
|
52
|
+
gap: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.radio-cards--segmented > .radio-cards__card + .radio-cards__card {
|
|
56
|
+
margin-inline-start: -1px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.radio-cards--segmented > .radio-cards__card:not(:first-child) {
|
|
60
|
+
border-start-start-radius: 0;
|
|
61
|
+
border-end-start-radius: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.radio-cards--segmented > .radio-cards__card:not(:last-child) {
|
|
65
|
+
border-start-end-radius: 0;
|
|
66
|
+
border-end-end-radius: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.radio-cards--segmented > .radio-cards__card:is(:has(:checked), :has(:focus-visible)) {
|
|
70
|
+
z-index: 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* The input is the whole card, and invisible: the card is what is drawn. */
|
|
74
|
+
.radio-cards .radio-cards__input {
|
|
75
|
+
position: absolute;
|
|
76
|
+
inset: 0;
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
margin: 0;
|
|
80
|
+
padding: 0;
|
|
81
|
+
border: 0;
|
|
82
|
+
opacity: 0;
|
|
83
|
+
cursor: inherit;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/*
|
|
87
|
+
* The large size: a choice that is the whole screen until it is made — the room's
|
|
88
|
+
* mode before the leader picks one. Tiles, each its name on top and its art filling
|
|
89
|
+
* the tile behind it (the operator, 2026-10-21).
|
|
90
|
+
*/
|
|
91
|
+
.radio-cards--large {
|
|
92
|
+
justify-content: center;
|
|
93
|
+
gap: 16px;
|
|
94
|
+
width: 100%;
|
|
95
|
+
padding: 12px 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.radio-cards--large .radio-cards__card {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: flex-start;
|
|
103
|
+
width: 200px;
|
|
104
|
+
height: 184px;
|
|
105
|
+
padding: 12px;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
background: var(--color-bg-card);
|
|
108
|
+
color: var(--color-text);
|
|
109
|
+
border-radius: calc(var(--hdk-radius) * 2);
|
|
110
|
+
font-size: 17px;
|
|
111
|
+
font-weight: 650;
|
|
112
|
+
transition:
|
|
113
|
+
transform 160ms ease,
|
|
114
|
+
border-color 160ms ease,
|
|
115
|
+
box-shadow 160ms ease;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.radio-cards--large .radio-cards__card:not(:has(:disabled)):hover {
|
|
119
|
+
transform: translateY(-3px);
|
|
120
|
+
border-color: var(--color-primary);
|
|
121
|
+
box-shadow: 0 8px 22px color-mix(in srgb, var(--color-primary) 18%, transparent);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.radio-cards__art {
|
|
125
|
+
position: absolute;
|
|
126
|
+
inset: 22px 10px 6px;
|
|
127
|
+
width: calc(100% - 20px);
|
|
128
|
+
height: calc(100% - 28px);
|
|
129
|
+
object-fit: contain;
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
user-select: none;
|
|
132
|
+
transition: transform 160ms ease;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.radio-cards--large .radio-cards__card:not(:has(:disabled)):hover .radio-cards__art {
|
|
136
|
+
transform: scale(1.04);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* The name over the art: above it in the stack, with a halo in the card's own colour so it reads on any art. */
|
|
140
|
+
.radio-cards--large .radio-cards__label {
|
|
141
|
+
position: relative;
|
|
142
|
+
z-index: 1;
|
|
143
|
+
text-shadow:
|
|
144
|
+
0 0 6px var(--color-bg-card),
|
|
145
|
+
0 0 2px var(--color-bg-card),
|
|
146
|
+
0 1px 1px var(--color-bg-card);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* The art is in the page at both sizes, so it is loaded before a card grows; the small button hides it. */
|
|
150
|
+
.radio-cards:not(.radio-cards--large) .radio-cards__art {
|
|
151
|
+
opacity: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* A size change in flight (`data-morphing` on the row's host, `constructed-mode/ModeRow.tsx`):
|
|
156
|
+
* the cards are taken out of the row's flow and placed by the animation itself, each from where
|
|
157
|
+
* it was to where it will be, so the row's own layout never moves them mid-way.
|
|
158
|
+
*/
|
|
159
|
+
[data-morphing] > .radio-cards {
|
|
160
|
+
position: relative;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[data-morphing] > .radio-cards > .radio-cards__card {
|
|
164
|
+
position: absolute;
|
|
165
|
+
box-sizing: border-box;
|
|
166
|
+
margin: 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@media (prefers-reduced-motion: reduce) {
|
|
170
|
+
.radio-cards--large .radio-cards__card {
|
|
171
|
+
transition: none;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.radio-cards--large .radio-cards__card:not(:has(:disabled)):hover,
|
|
175
|
+
.radio-cards--large .radio-cards__card:not(:has(:disabled)):hover .radio-cards__art {
|
|
176
|
+
transform: none;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './RadioCards.css';
|
|
3
|
+
export interface RadioCard<T extends string> {
|
|
4
|
+
value: T;
|
|
5
|
+
label: string;
|
|
6
|
+
/** An image URL drawn behind the label on a large card; decoration, the label names the card. */
|
|
7
|
+
art?: string;
|
|
8
|
+
/**
|
|
9
|
+
* This ONE card, disabled for a reason specific to IT — a choice
|
|
10
|
+
* temporarily off limits (tournament mode's Gauntlet, while a Constructed
|
|
11
|
+
* room's Tournament toggle is on) — rather than the whole group being
|
|
12
|
+
* somebody else's to move (the group's own `disabled`). The two combine:
|
|
13
|
+
* a card is disabled when either is true.
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function RadioCards<T extends string>({ name, label, options, value, disabled, onChange, testId, size, className, renderRow, }: {
|
|
18
|
+
/** The inputs' shared `name`: unique on the page, so two groups never join. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** The group's accessible name. Not drawn: the cards say what they are. */
|
|
21
|
+
label: string;
|
|
22
|
+
options: readonly RadioCard<T>[];
|
|
23
|
+
value: T | null;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
onChange: (value: T) => void;
|
|
26
|
+
/** The group's test id; each card's input is `<testId>-<value>`. */
|
|
27
|
+
testId: string;
|
|
28
|
+
size?: 'small' | 'large';
|
|
29
|
+
/** Appended to the group's own `radio-cards` class, for a caller that lays its rows out differently (wave 73 §B's cube picker: a column of full-width rows). */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** See the header. `undefined` (every caller but the cube picker) draws the plain card. */
|
|
32
|
+
renderRow?: (option: RadioCard<T>, input: ReactNode) => ReactNode;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* A choice of one, drawn as a row of cards: the room's type and mode in the
|
|
4
|
+
* create form, the mode in the room, and each mode's own options.
|
|
5
|
+
*
|
|
6
|
+
* Native radio inputs, one per card, laid over the whole card and transparent:
|
|
7
|
+
* the keyboard (Tab to the group, arrows between cards), `disabled` and
|
|
8
|
+
* `checked` are the browser's own, and a press anywhere on a card lands on its
|
|
9
|
+
* input. The checked card wears the format tabs' look (`.lobby__format-tabs`),
|
|
10
|
+
* which is this app's one signal for "the one chosen".
|
|
11
|
+
*
|
|
12
|
+
* `value` may be null: nothing chosen yet is a state of its own (a room whose
|
|
13
|
+
* mode the leader has not picked), not a default the reader cannot see.
|
|
14
|
+
*
|
|
15
|
+
* `size="large"` draws each card as a tile, its label on top and its `art` filling
|
|
16
|
+
* the tile behind it, for a choice that is the whole screen until it is made. The
|
|
17
|
+
* art is drawn at both sizes and hidden on the small one, so a card that grows
|
|
18
|
+
* already has it (`constructed-mode/ModeRow.tsx` animates the change).
|
|
19
|
+
*
|
|
20
|
+
* `renderRow`, wave 73 §B's cube picker: a row that needs more than a label —
|
|
21
|
+
* a size, an importer, its own refresh/delete buttons beside the radio, not
|
|
22
|
+
* inside it. `input` is the SAME wired element every other card gets (name,
|
|
23
|
+
* value, checked, disabled, onChange, test id); `renderRow` only chooses what
|
|
24
|
+
* markup it sits in, so the input's own behaviour is never duplicated.
|
|
25
|
+
* Every other caller leaves it unset and gets the plain card exactly as
|
|
26
|
+
* before — this is additive, not a second way to draw the same thing.
|
|
27
|
+
*/
|
|
28
|
+
import { Fragment } from 'react';
|
|
29
|
+
import './RadioCards.css';
|
|
30
|
+
export function RadioCards({ name, label, options, value, disabled = false, onChange, testId, size = 'small', className, renderRow, }) {
|
|
31
|
+
const large = size === 'large';
|
|
32
|
+
// A small row of plain cards is one segmented bar; a large row and a `renderRow` gallery are tiles.
|
|
33
|
+
const shape = large ? 'radio-cards--large' : renderRow === undefined ? 'radio-cards--segmented' : null;
|
|
34
|
+
const rootClass = ['radio-cards', shape, className].filter((c) => c !== undefined && c !== null && c !== '').join(' ');
|
|
35
|
+
return (_jsx("div", { className: rootClass, role: "radiogroup", "aria-label": label, "aria-disabled": disabled ? 'true' : undefined, "data-testid": testId, children: options.map((option) => {
|
|
36
|
+
const input = (_jsx("input", { className: "radio-cards__input", type: "radio", name: name, value: option.value, "data-testid": `${testId}-${option.value}`, checked: value === option.value, disabled: disabled || option.disabled === true, onChange: () => onChange(option.value) }));
|
|
37
|
+
if (renderRow !== undefined)
|
|
38
|
+
return _jsx(Fragment, { children: renderRow(option, input) }, option.value);
|
|
39
|
+
return (_jsxs("label", { className: "radio-cards__card", children: [input, option.art !== undefined && _jsx("img", { className: "radio-cards__art", src: option.art, alt: "", decoding: "async", draggable: false }), _jsx("span", { className: "radio-cards__label", children: option.label })] }, option.value));
|
|
40
|
+
}) }));
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** A pass: the ready pill's tick. */
|
|
2
|
+
export declare const TICK = "M2.6 6.3 4.9 8.8 9.4 3.3";
|
|
3
|
+
/**
|
|
4
|
+
* A status, drawn: a shape, a colour and a word.
|
|
5
|
+
*
|
|
6
|
+
* Colour alone is not a status — a third of the operator's friends could not
|
|
7
|
+
* read it — so each state has its OWN SHAPE (`data-mark`, drawn in an inline
|
|
8
|
+
* `<svg>` we own) and its own border style as well. `screens/screens.css` colours it;
|
|
9
|
+
* remove every colour from that file and this still reads.
|
|
10
|
+
*/
|
|
11
|
+
export declare function StatusPill({ testId, state, mark, label }: {
|
|
12
|
+
testId: string;
|
|
13
|
+
state: 'yes' | 'no';
|
|
14
|
+
mark: 'tick' | 'ring';
|
|
15
|
+
label: string;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* A ready state, drawn: the table's seats, a pod's seats and building list, a Gauntlet's choice.
|
|
4
|
+
*/
|
|
5
|
+
/** A pass: the ready pill's tick. */
|
|
6
|
+
export const TICK = 'M2.6 6.3 4.9 8.8 9.4 3.3';
|
|
7
|
+
/**
|
|
8
|
+
* A status, drawn: a shape, a colour and a word.
|
|
9
|
+
*
|
|
10
|
+
* Colour alone is not a status — a third of the operator's friends could not
|
|
11
|
+
* read it — so each state has its OWN SHAPE (`data-mark`, drawn in an inline
|
|
12
|
+
* `<svg>` we own) and its own border style as well. `screens/screens.css` colours it;
|
|
13
|
+
* remove every colour from that file and this still reads.
|
|
14
|
+
*/
|
|
15
|
+
export function StatusPill({ testId, state, mark, label }) {
|
|
16
|
+
return (_jsxs("span", { className: "pill pill--ready", "data-testid": testId, "data-state": state, "data-mark": mark, children: [_jsx("svg", { className: "pill__mark", viewBox: "0 0 12 12", "aria-hidden": "true", focusable: "false", children: mark === 'tick' ? _jsx("path", { d: TICK }) : _jsx("circle", { cx: "6", cy: "6", r: "3.4" }) }), label] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type ConnectionPhase =
|
|
2
|
+
/** No connection has ever been established. */
|
|
3
|
+
'connecting'
|
|
4
|
+
/** Connected, in sync, nothing to say. */
|
|
5
|
+
| 'live'
|
|
6
|
+
/** Connected, but we asked for a full snapshot and it has not arrived. */
|
|
7
|
+
| 'resyncing'
|
|
8
|
+
/** We were connected and are not now. The seat is held for the TTL. */
|
|
9
|
+
| 'offline'
|
|
10
|
+
/** Connected again; nothing has arrived since the re-join. */
|
|
11
|
+
| 'reconnecting'
|
|
12
|
+
/** Connected again and the first payload has landed. */
|
|
13
|
+
| 'recovered';
|
|
14
|
+
export interface ConnectionState {
|
|
15
|
+
phase: ConnectionPhase;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the server is holding THIS client's seat right now.
|
|
18
|
+
*
|
|
19
|
+
* True only while offline with a seat: `releaseSeat` and the reconnect guard
|
|
20
|
+
* in `games/magic/server/src/room/draftRooms.ts` hold a seat against everyone else
|
|
21
|
+
* for the reservation TTL, and a spectator has no seat to hold.
|
|
22
|
+
*/
|
|
23
|
+
seatHeld: boolean;
|
|
24
|
+
/** Whether the draft is frozen from the player's point of view. */
|
|
25
|
+
stalled: boolean;
|
|
26
|
+
/** One short line for the banner. */
|
|
27
|
+
label: string;
|
|
28
|
+
/** The sentence under it. Says what is happening, never "something failed". */
|
|
29
|
+
detail: string;
|
|
30
|
+
}
|
|
31
|
+
/** Whether the banner has anything worth showing. `live` is silence. */
|
|
32
|
+
export declare function isWorthShowing(state: ConnectionState): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* What a connection is doing, as `./ConnectionBanner.tsx` shows it; a game computes it from its socket (`../draft/connection.ts`). */
|
|
2
|
+
/** Whether the banner has anything worth showing. `live` is silence. */
|
|
3
|
+
export function isWorthShowing(state) {
|
|
4
|
+
return state.phase !== 'live';
|
|
5
|
+
}
|
package/dist/dom.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The embed registers its shadow root for the life of a mount; the returned function unregisters it. */
|
|
2
|
+
export declare function setDocumentScope(root: ShadowRoot): () => void;
|
|
3
|
+
/** Mounted inside another page (the watchparty embed), whose bundle this app's is part of. */
|
|
4
|
+
export declare function isEmbedded(): boolean;
|
|
5
|
+
/** Where the app's own elements live: the embed's shadow root, or the document. */
|
|
6
|
+
export declare function documentScope(): Document | ShadowRoot;
|
|
7
|
+
/** The document or shadow root `node` is in. */
|
|
8
|
+
export declare function scopeOf(node: Node): Document | ShadowRoot;
|
|
9
|
+
/**
|
|
10
|
+
* The element the event actually happened on, through any shadow boundary.
|
|
11
|
+
*
|
|
12
|
+
* `composedPath()` is empty once dispatch has finished, and absent on a plain
|
|
13
|
+
* object a test hands a handler, so `target` is the fallback in both cases.
|
|
14
|
+
*/
|
|
15
|
+
export declare function eventTarget(event: Event): EventTarget | null;
|
|
16
|
+
/** `elementFromPoint`, inside the app's own tree. Null where the environment has no layout (jsdom). */
|
|
17
|
+
export declare function hitAt(scope: Document | ShadowRoot, x: number, y: number): Element | null;
|
package/dist/dom.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The three DOM questions whose answer changes when the app is not the page.
|
|
3
|
+
*
|
|
4
|
+
* Standalone, cardtable owns its document. Embedded in a watchparty room
|
|
5
|
+
* (D21, `embed/`), it renders inside a SHADOW ROOT on someone else's page, and
|
|
6
|
+
* the shadow boundary changes three things this app used to take for granted:
|
|
7
|
+
*
|
|
8
|
+
* 1. **An event seen at `window` or `document` is retargeted.** Its `target`
|
|
9
|
+
* (and `relatedTarget`) is the shadow HOST, not the card under the pointer,
|
|
10
|
+
* so every `target.closest('[data-board-card]')` in a window-level drag
|
|
11
|
+
* handler answers null. `eventTarget` reads the real one off the composed
|
|
12
|
+
* path. Standalone, the path's first entry IS `event.target`.
|
|
13
|
+
* 2. **`document.querySelector` cannot see inside the shadow tree.** A lookup
|
|
14
|
+
* with no element at hand to start from asks `documentScope()` instead —
|
|
15
|
+
* the shadow root when embedded, the document otherwise.
|
|
16
|
+
* 3. **`document.elementFromPoint` stops at the host.** `hitAt` asks the scope,
|
|
17
|
+
* which on a `ShadowRoot` answers with the element inside it.
|
|
18
|
+
*
|
|
19
|
+
* A function that already holds an element inside the app should prefer
|
|
20
|
+
* `scopeOf(el)` — it is the same answer and needs no registration.
|
|
21
|
+
*/
|
|
22
|
+
let registered = null;
|
|
23
|
+
/** The embed registers its shadow root for the life of a mount; the returned function unregisters it. */
|
|
24
|
+
export function setDocumentScope(root) {
|
|
25
|
+
registered = root;
|
|
26
|
+
return () => {
|
|
27
|
+
if (registered === root)
|
|
28
|
+
registered = null;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Mounted inside another page (the watchparty embed), whose bundle this app's is part of. */
|
|
32
|
+
export function isEmbedded() {
|
|
33
|
+
return registered !== null;
|
|
34
|
+
}
|
|
35
|
+
/** Where the app's own elements live: the embed's shadow root, or the document. */
|
|
36
|
+
export function documentScope() {
|
|
37
|
+
return registered ?? document;
|
|
38
|
+
}
|
|
39
|
+
/** The document or shadow root `node` is in. */
|
|
40
|
+
export function scopeOf(node) {
|
|
41
|
+
const root = node.getRootNode();
|
|
42
|
+
return root instanceof ShadowRoot || root instanceof Document ? root : document;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The element the event actually happened on, through any shadow boundary.
|
|
46
|
+
*
|
|
47
|
+
* `composedPath()` is empty once dispatch has finished, and absent on a plain
|
|
48
|
+
* object a test hands a handler, so `target` is the fallback in both cases.
|
|
49
|
+
*/
|
|
50
|
+
export function eventTarget(event) {
|
|
51
|
+
const path = typeof event.composedPath === 'function' ? event.composedPath() : [];
|
|
52
|
+
return path[0] ?? event.target;
|
|
53
|
+
}
|
|
54
|
+
/** `elementFromPoint`, inside the app's own tree. Null where the environment has no layout (jsdom). */
|
|
55
|
+
export function hitAt(scope, x, y) {
|
|
56
|
+
return typeof scope.elementFromPoint === 'function' ? scope.elementFromPoint(x, y) : null;
|
|
57
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The arrow inside a gallery's round button, drawn, not typed: a text ‹ › sits wherever its font
|
|
4
|
+
* puts the glyph in its line box (1.25 px low and 0.4 px aside, measured on Linux; it moves with the
|
|
5
|
+
* system font), so it never centred in the circle. The chevron's box is the viewBox's centre.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ArrowGlyph({ dir }: {
|
|
8
|
+
dir: 'prev' | 'next';
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
export interface GalleryPage {
|
|
11
|
+
key: string;
|
|
12
|
+
title: string;
|
|
13
|
+
body: ReactNode;
|
|
14
|
+
/** The page's own action, beside the dots. */
|
|
15
|
+
action?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/** `opening` is the page shown until the reader turns one; the first page without it. */
|
|
18
|
+
export declare function Gallery({ testId, pages, opening }: {
|
|
19
|
+
testId: string;
|
|
20
|
+
pages: readonly GalleryPage[];
|
|
21
|
+
opening?: string;
|
|
22
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* A front card as a manual gallery (`./gallery.ts`): one page at a time, its title in the card's
|
|
4
|
+
* head with the arrows beside it, its own action in the foot with the dots. The reader turns it
|
|
5
|
+
* with the arrows, a dot or a sideways swipe; it never turns itself. Upcoming (Calendar | Polls)
|
|
6
|
+
* and the wildcard are both one.
|
|
7
|
+
*/
|
|
8
|
+
import { useRef, useState } from 'react';
|
|
9
|
+
import { playRole } from "../sound/index.js";
|
|
10
|
+
import { keepPage, stepPage, swipeStep } from "./gallery.js";
|
|
11
|
+
/**
|
|
12
|
+
* The arrow inside a gallery's round button, drawn, not typed: a text ‹ › sits wherever its font
|
|
13
|
+
* puts the glyph in its line box (1.25 px low and 0.4 px aside, measured on Linux; it moves with the
|
|
14
|
+
* system font), so it never centred in the circle. The chevron's box is the viewBox's centre.
|
|
15
|
+
*/
|
|
16
|
+
export function ArrowGlyph({ dir }) {
|
|
17
|
+
return (_jsx("svg", { className: "gallery__chevron", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { d: dir === 'prev' ? 'M15.5 5l-7 7 7 7' : 'M8.5 5l7 7-7 7' }) }));
|
|
18
|
+
}
|
|
19
|
+
/** `opening` is the page shown until the reader turns one; the first page without it. */
|
|
20
|
+
export function Gallery({ testId, pages, opening }) {
|
|
21
|
+
const [key, setKey] = useState(null);
|
|
22
|
+
const at = keepPage(pages.map((p) => p.key), key ?? opening ?? null, 0);
|
|
23
|
+
const page = pages[at];
|
|
24
|
+
const down = useRef(null);
|
|
25
|
+
if (page === undefined)
|
|
26
|
+
return null;
|
|
27
|
+
const turn = (to) => {
|
|
28
|
+
const next = pages[to];
|
|
29
|
+
if (next === undefined || next.key === page.key)
|
|
30
|
+
return;
|
|
31
|
+
playRole('ui.select');
|
|
32
|
+
setKey(next.key);
|
|
33
|
+
};
|
|
34
|
+
const many = pages.length > 1;
|
|
35
|
+
return (_jsxs(_Fragment, { children: [_jsxs("header", { className: "front-card__head", children: [_jsx("h3", { className: "front-card__title", "data-testid": `${testId}-title`, children: page.title }), many && (_jsxs("span", { className: "gallery__arrows", children: [_jsx("button", { type: "button", className: "gallery__arrow", "aria-label": "Previous", "data-testid": `${testId}-prev`, onClick: () => turn(stepPage(at, -1, pages.length)), children: _jsx(ArrowGlyph, { dir: "prev" }) }), _jsx("button", { type: "button", className: "gallery__arrow", "aria-label": "Next", "data-testid": `${testId}-next`, onClick: () => turn(stepPage(at, 1, pages.length)), children: _jsx(ArrowGlyph, { dir: "next" }) })] }))] }), _jsx("div", { className: "gallery__page", "data-testid": `${testId}-page`, "data-page": page.key, onPointerDown: (e) => {
|
|
36
|
+
down.current = { x: e.clientX, y: e.clientY };
|
|
37
|
+
}, onPointerUp: (e) => {
|
|
38
|
+
const from = down.current;
|
|
39
|
+
down.current = null;
|
|
40
|
+
if (from === null || !many)
|
|
41
|
+
return;
|
|
42
|
+
const step = swipeStep(e.clientX - from.x, e.clientY - from.y);
|
|
43
|
+
if (step !== 0)
|
|
44
|
+
turn(stepPage(at, step, pages.length));
|
|
45
|
+
}, onPointerCancel: () => {
|
|
46
|
+
down.current = null;
|
|
47
|
+
}, children: page.body }, page.key), (many || page.action !== undefined) && (_jsxs("div", { className: "front-card__foot", children: [many && (_jsx("span", { className: "gallery__dots", children: pages.map((p, i) => (_jsx("button", { type: "button", className: "gallery__dot", "aria-label": p.title, "aria-current": i === at ? 'true' : undefined, "data-testid": `${testId}-dot`, "data-page": p.key, onClick: () => turn(i) }, p.key))) })), page.action] }))] }));
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PatchNotesCard(): import("react").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* The banner's "Patch notes" card (`docs/planning/wave77-2026-10-27.md` §A): the newest
|
|
4
|
+
* `docs/releases/v*.md`, bundled at build time — no server route, because the notes already ship
|
|
5
|
+
* in this repo. "Read all" opens every bundled release, newest first, in a modal on the site.
|
|
6
|
+
*/
|
|
7
|
+
import { Fragment, useLayoutEffect, useRef, useState } from 'react';
|
|
8
|
+
import { Modal } from "../components/Modal.js";
|
|
9
|
+
import { creditRuns, fittingBullets, newestFirst, parseReleaseNotes, versionOfPath } from "./patchNotes.js";
|
|
10
|
+
// Vite bundles every match eagerly, as raw text, at build time (no server round trip for the notes).
|
|
11
|
+
const RELEASE_FILES = import.meta.glob('../../../../docs/releases/v*.md', { query: '?raw', eager: true, import: 'default' });
|
|
12
|
+
/** Every release this build shipped with, parsed, newest first. Computed once per build, not per render. */
|
|
13
|
+
const RELEASES = (() => {
|
|
14
|
+
const out = [];
|
|
15
|
+
for (const [path, markdown] of Object.entries(RELEASE_FILES)) {
|
|
16
|
+
const version = versionOfPath(path);
|
|
17
|
+
if (version === null)
|
|
18
|
+
continue;
|
|
19
|
+
const parsed = parseReleaseNotes(markdown, version);
|
|
20
|
+
if (parsed !== null)
|
|
21
|
+
out.push(parsed);
|
|
22
|
+
}
|
|
23
|
+
return newestFirst(out);
|
|
24
|
+
})();
|
|
25
|
+
/** A bullet's `**bold**` lead drawn bold, each credited name marked as the Discord post marks it; everything else as plain text. */
|
|
26
|
+
function inline(text) {
|
|
27
|
+
return text.split(/\*\*(.+?)\*\*/g).map((part, i) => (i % 2 === 1 ? _jsx("strong", { children: part }, i) : _jsx(Fragment, { children: credits(part.replace(/\*(.+?)\*/g, '$1')) }, i)));
|
|
28
|
+
}
|
|
29
|
+
function credits(text) {
|
|
30
|
+
return creditRuns(text).map((run, i) => (run.credit ? _jsx("span", { className: "patch-notes__credit", children: run.text }, i) : _jsx(Fragment, { children: run.text }, i)));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* As many of the list's bullets as the card has room for, the rest hidden whole, never cut in half.
|
|
34
|
+
* Hidden by `visibility`, so hiding one moves nothing and the measure never chases itself.
|
|
35
|
+
*/
|
|
36
|
+
function useFittingBullets() {
|
|
37
|
+
const ref = useRef(null);
|
|
38
|
+
useLayoutEffect(() => {
|
|
39
|
+
const list = ref.current;
|
|
40
|
+
if (list === null)
|
|
41
|
+
return;
|
|
42
|
+
const fit = () => {
|
|
43
|
+
const items = [...list.children];
|
|
44
|
+
const shown = fittingBullets(items.map((li) => li.getBoundingClientRect().bottom), list.getBoundingClientRect().bottom);
|
|
45
|
+
items.forEach((li, i) => (li.style.visibility = i < shown ? '' : 'hidden'));
|
|
46
|
+
};
|
|
47
|
+
fit();
|
|
48
|
+
const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(fit);
|
|
49
|
+
observer?.observe(list);
|
|
50
|
+
return () => observer?.disconnect();
|
|
51
|
+
}, []);
|
|
52
|
+
return ref;
|
|
53
|
+
}
|
|
54
|
+
export function PatchNotesCard() {
|
|
55
|
+
const [open, setOpen] = useState(false);
|
|
56
|
+
const release = RELEASES[0] ?? null;
|
|
57
|
+
const bulletsRef = useFittingBullets();
|
|
58
|
+
return (_jsxs("section", { className: "front-card front-card--patch-notes", "data-testid": "front-patch-notes", children: [_jsxs("header", { className: "front-card__head", children: [_jsx("h3", { className: "front-card__title", children: "Patch notes" }), release !== null && _jsx("span", { className: "front-card__version", children: release.version })] }), release === null ? (_jsx("p", { className: "front-card__empty", children: "No releases yet." })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "front-card__release-title", children: release.title }), _jsx("ul", { className: "front-card__bullets", ref: bulletsRef, "data-testid": "front-patch-notes-bullets", children: release.bullets.map((b, i) => (_jsx("li", { children: b }, i))) }), _jsx("div", { className: "front-card__foot", children: _jsx("button", { type: "button", className: "button front-card__more", "data-testid": "front-patch-notes-read-all", onClick: () => setOpen(true), children: "Read all" }) })] })), open && (_jsx(Modal, { title: "Patch notes", testId: "front-patch-notes-modal", wide: true, onClose: () => setOpen(false), children: _jsx("div", { className: "patch-notes", children: RELEASES.map((r) => (_jsxs("article", { className: "patch-notes__release", children: [_jsxs("h4", { className: "patch-notes__title", children: [_jsx("span", { className: "patch-notes__version", children: r.version }), r.title] }), r.summary !== '' && _jsx("p", { className: "patch-notes__summary", children: r.summary }), r.sections.map((s) => (_jsxs("section", { children: [_jsx("h5", { className: "patch-notes__section", children: s.heading }), _jsx("ul", { className: "patch-notes__bullets", children: s.bullets.map((b, i) => (_jsx("li", { children: inline(b) }, i))) })] }, s.heading)))] }, r.version))) }) }))] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export declare const BOARD_WIDTH = 1280;
|
|
2
|
+
export declare const BOARD_HEIGHT = 800;
|
|
3
|
+
/**
|
|
4
|
+
* Every tunable of the camera, in one place. **Change a default for good here.** A viewer can try
|
|
5
|
+
* other values without a deploy through the front page's hash ({@link cameraConfigFromHash}).
|
|
6
|
+
*/
|
|
7
|
+
export interface CameraConfig {
|
|
8
|
+
/**
|
|
9
|
+
* How long the cursor must stay outside the default region before a temporary region opens, in
|
|
10
|
+
* ms. The operator, 2026-11-05: *"let's try it with the camera moving immediately … however
|
|
11
|
+
* immediate is probably too aggressive. maybe 0.5s timer for now"* — 1500 before.
|
|
12
|
+
*/
|
|
13
|
+
temporaryAfterMs: number;
|
|
14
|
+
/** How long the cursor must be back in the default region (or gone) before the temporary region retires, in ms: a pass through it is not a return. */
|
|
15
|
+
defaultAfterMs: number;
|
|
16
|
+
/**
|
|
17
|
+
* The default region's outer band, as a share of its side, that counts as outside: the operator,
|
|
18
|
+
* 2026-11-05, *"make it so the camera starts moving once it reaches the outer 20% of the default
|
|
19
|
+
* camera area"*. The view the region shows is still the whole {@link CameraConfig.corner} square.
|
|
20
|
+
*/
|
|
21
|
+
edgeBand: number;
|
|
22
|
+
/**
|
|
23
|
+
* How long a pan from rest takes to cover 95% of the way to its region, in ms: the spring's
|
|
24
|
+
* stiffness. The operator, 2026-11-05: *"camera pan speed should be relative to how far it has to
|
|
25
|
+
* travel. it should accelerate faster if the target is further away"*, after *"slow down the camera
|
|
26
|
+
* pan by 30%"*: the exponential glide it replaced covered 95% in 750 ms; this takes 1.3× as long.
|
|
27
|
+
*/
|
|
28
|
+
panSettleMs: number;
|
|
29
|
+
/** The side of every capture region, in board pixels: how far the card is zoomed in (the operator approved 540). */
|
|
30
|
+
corner: number;
|
|
31
|
+
}
|
|
32
|
+
export declare const CAMERA: Readonly<CameraConfig>;
|
|
33
|
+
/**
|
|
34
|
+
* {@link CAMERA}, with whatever the page's hash overrides for this viewer only: `cam=` followed by
|
|
35
|
+
* `key:value` pairs joined by commas, anywhere in the hash (`#cam=…`, `#/?cam=…`). Unknown keys and
|
|
36
|
+
* values that are not numbers are ignored; the rest are clamped to their range.
|
|
37
|
+
*/
|
|
38
|
+
export declare function cameraConfigFromHash(hash: string): CameraConfig;
|
|
39
|
+
export interface Point {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
}
|
|
43
|
+
/** The default capture region's top-left corner. */
|
|
44
|
+
export declare const defaultRegion: (config?: CameraConfig) => Point;
|
|
45
|
+
export interface CameraState {
|
|
46
|
+
/** Where the camera is now (its square's top-left): panning toward the region it captures. */
|
|
47
|
+
at: Point;
|
|
48
|
+
/** How fast it is moving, in board pixels per ms. */
|
|
49
|
+
vel: Point;
|
|
50
|
+
/** Which capture region it is on. */
|
|
51
|
+
region: 'default' | 'temporary';
|
|
52
|
+
/** Since when the cursor has been calling for the other region; null while it is not. */
|
|
53
|
+
since: number | null;
|
|
54
|
+
/** The player at the bottom when last stepped: a change is a turn change. */
|
|
55
|
+
bottom: number | null;
|
|
56
|
+
/** The last step's time. */
|
|
57
|
+
now: number;
|
|
58
|
+
}
|
|
59
|
+
export declare function initialCamera(now: number, bottom: number | null, config?: CameraConfig): CameraState;
|
|
60
|
+
/**
|
|
61
|
+
* Whether `p` is home: inside the default capture region's inner square, the {@link CameraConfig.edgeBand} at its
|
|
62
|
+
* open edges counting as outside. The same test both ways, so a cursor resting in the band never
|
|
63
|
+
* swings the camera out and back.
|
|
64
|
+
*/
|
|
65
|
+
export declare function inDefaultRegion(p: Point, config?: CameraConfig): boolean;
|
|
66
|
+
/** A temporary capture region: the square centred on `p`, kept on the board. */
|
|
67
|
+
export declare function temporaryRegion(p: Point, config?: CameraConfig): Point;
|
|
68
|
+
/**
|
|
69
|
+
* One axis of a pan, `dt` ms on: a critically damped spring toward `target` (acceleration
|
|
70
|
+
* ω²·(target − pos) − 2ω·vel), so it starts from rest, pulls harder the further it has to go, and
|
|
71
|
+
* comes to rest on the target without passing it. Its exact solution over the step, not an
|
|
72
|
+
* integration, so no frame rate can make it overshoot; a target that moves between steps keeps the
|
|
73
|
+
* velocity it had, so a pan following a moving cursor never restarts.
|
|
74
|
+
*/
|
|
75
|
+
export declare function panStep(pos: number, vel: number, target: number, dt: number, settleMs?: number): {
|
|
76
|
+
pos: number;
|
|
77
|
+
vel: number;
|
|
78
|
+
};
|
|
79
|
+
/** One step: `cursor` is the active player's cursor as the board draws it now (null when none is drawn). */
|
|
80
|
+
export declare function stepCamera(state: CameraState, now: number, cursor: Point | null, bottom: number | null, config?: CameraConfig): CameraState;
|