@hadoku/game-ui 0.1.23 → 0.1.24
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.
|
@@ -149,17 +149,25 @@ export interface RoomFrontProps<V extends RoomFrontRoom> {
|
|
|
149
149
|
/** The list's own `<section>`, the moment it mounts and again on unmount — a caller's own tooltip or scroll mechanism attaches here, same as it would to any other section it owns. */
|
|
150
150
|
onSectionRef?: (el: HTMLElement | null) => void;
|
|
151
151
|
/**
|
|
152
|
-
* The create dialog's own panel
|
|
152
|
+
* The create dialog's own panel class (default: an unstyled block of this module's own,
|
|
153
153
|
* `room-front-create`). A caller with its own "raised surface" convention supplies its exact
|
|
154
154
|
* class string here rather than this file hard-coding one — Magic's `RoomList.tsx` passes
|
|
155
155
|
* `"rooms__create ct-surface ct-panel"`, the same classes base's own `CreateRoomDialog` always
|
|
156
156
|
* drew, from the one file (`RoomList.tsx`, through `CreateEventDialog.tsx`'s own import of
|
|
157
157
|
* `Modal.tsx`) `css-ownership.test.ts` already knows reaches the tree that owns `.ct-surface` —
|
|
158
|
-
* this module never does, and must not have to.
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* a
|
|
158
|
+
* this module never does, and must not have to.
|
|
159
|
+
*
|
|
160
|
+
* Named `createPanelClassName`, not the bare `className` an earlier draft of this prop used
|
|
161
|
+
* (`docs/planning/s3-2026-11-17.md` §G.5): a plain `className` on a component that is not a
|
|
162
|
+
* simple DOM wrapper reads as "the root element's own class", when this is actually one nested
|
|
163
|
+
* CREATE DIALOG panel's — a different, narrower thing a careless caller could otherwise pass
|
|
164
|
+
* believing it styled the whole list. `css-ownership.test.ts`'s own "is this really a class
|
|
165
|
+
* list" check (`CLASS_AT`) used to recognise ONLY a literal sitting right after a bare
|
|
166
|
+
* `className=`/`class=`, which is exactly why that draft kept the confusing name — any camelCase
|
|
167
|
+
* prefix broke the check. `CLASS_AT` now also matches `\w*ClassName=` generically, so a
|
|
168
|
+
* caller's own call-site literal (`<RoomFront createPanelClassName="rooms__create ct-surface
|
|
169
|
+
* ct-panel" />`) is still recognised as a real class list, the same as a bare `className=` is.
|
|
162
170
|
*/
|
|
163
|
-
|
|
171
|
+
createPanelClassName?: string;
|
|
164
172
|
}
|
|
165
|
-
export declare function RoomFront<V extends RoomFrontRoom>({ rooms: client, gameTypes, createFields, rowExtras, banner, navTools, featured, onOpenRoom, headExtras, actionsExtras, feed, matches: matchesFilter, beforeOpenRoom, nameMaxLength, passwordMaxLength, testingStorageKey, defaultName, onSectionRef,
|
|
173
|
+
export declare function RoomFront<V extends RoomFrontRoom>({ rooms: client, gameTypes, createFields, rowExtras, banner, navTools, featured, onOpenRoom, headExtras, actionsExtras, feed, matches: matchesFilter, beforeOpenRoom, nameMaxLength, passwordMaxLength, testingStorageKey, defaultName, onSectionRef, createPanelClassName: createSurfaceClassName, }: RoomFrontProps<V>): import("react").JSX.Element;
|
package/dist/front/RoomFront.js
CHANGED
|
@@ -84,7 +84,7 @@ function saveTestingFolded(key, folded) {
|
|
|
84
84
|
// Unremembered is the whole fallback; nothing else to do.
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
export function RoomFront({ rooms: client, gameTypes, createFields, rowExtras, banner, navTools, featured, onOpenRoom, headExtras, actionsExtras, feed = NEVER_FOLLOWED, matches: matchesFilter, beforeOpenRoom, nameMaxLength = DEFAULT_NAME_MAX, passwordMaxLength = DEFAULT_PASSWORD_MAX, testingStorageKey = DEFAULT_TESTING_KEY, defaultName, onSectionRef,
|
|
87
|
+
export function RoomFront({ rooms: client, gameTypes, createFields, rowExtras, banner, navTools, featured, onOpenRoom, headExtras, actionsExtras, feed = NEVER_FOLLOWED, matches: matchesFilter, beforeOpenRoom, nameMaxLength = DEFAULT_NAME_MAX, passwordMaxLength = DEFAULT_PASSWORD_MAX, testingStorageKey = DEFAULT_TESTING_KEY, defaultName, onSectionRef, createPanelClassName: createSurfaceClassName = 'room-front-create', }) {
|
|
88
88
|
const [state, setState] = useState({ kind: 'loading' });
|
|
89
89
|
const [creating, setCreating] = useState(false);
|
|
90
90
|
const [testingFolded, setTestingFolded] = useState(() => loadTestingFolded(testingStorageKey));
|
package/dist/seats/SeatChip.d.ts
CHANGED
|
@@ -30,7 +30,13 @@ export interface SeatSlot {
|
|
|
30
30
|
}
|
|
31
31
|
export interface SeatListProps {
|
|
32
32
|
slots: readonly SeatSlot[];
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Whether the viewer leads the room: gates every seat-shaping control — AI/Remove-AI on an open
|
|
35
|
+
* or bot-held seat, Close/Open, and Remove/Bot on a member's seat — and an open seat's Close
|
|
36
|
+
* past `realSeatCount`. Before this field gated AI and Remove-AI too, bm1 saw the AI button
|
|
37
|
+
* offered to, and clickable by, a non-leader (a no-op server-side, but a control nobody but the
|
|
38
|
+
* leader should ever see at all — Close/Open and the member Remove/Bot were already gated).
|
|
39
|
+
*/
|
|
34
40
|
iLead: boolean;
|
|
35
41
|
/** An event's room before its seats open: nobody sits, nor gives a seat to the bot. */
|
|
36
42
|
shut?: boolean;
|
package/dist/seats/SeatChip.js
CHANGED
|
@@ -24,13 +24,13 @@ export const SEAT_CROWN_PATH = 'M2 9V3.5l2.2 2L6 2.6l1.8 2.9L10 3.5V9Z';
|
|
|
24
24
|
export function SeatList({ slots, iLead, shut = false, fieldFixed = false, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember, onBotReplace }) {
|
|
25
25
|
return (_jsx("ul", { className: "pod-seats", "data-testid": "pod-seats", children: slots.map(({ seat, occupant }) => {
|
|
26
26
|
if (occupant.kind === 'open') {
|
|
27
|
-
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, children: [_jsx(ActionButton, { action: "sit", className: "pod-seats__avatar pod-seats__avatar--open", "data-testid": "pod-seat-sit", "data-seat": seat, "aria-label": `Sit in seat ${seat + 1}`, disabled: shut || (mySeat !== null && seat >= realSeatCount), onPress: () => onSit?.(seat), children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M12 5v14M5 12h14" }) }) }), _jsx("span", { className: "pod-seats__label", children: "Open" }), !fieldFixed && (_jsxs("span", { className: "pod-seats__actions", children: [_jsx(ActionButton, { action: "ai", className: "pod-seats__action", "data-testid": "pod-seat-ai", "data-seat": seat, "aria-label": `Fill seat ${seat + 1} with AI`, disabled: shut, onPress: () => onBotOn?.(seat), children: "AI" }),
|
|
27
|
+
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, children: [_jsx(ActionButton, { action: "sit", className: "pod-seats__avatar pod-seats__avatar--open", "data-testid": "pod-seat-sit", "data-seat": seat, "aria-label": `Sit in seat ${seat + 1}`, disabled: shut || (mySeat !== null && seat >= realSeatCount), onPress: () => onSit?.(seat), children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M12 5v14M5 12h14" }) }) }), _jsx("span", { className: "pod-seats__label", children: "Open" }), !fieldFixed && iLead && (_jsxs("span", { className: "pod-seats__actions", children: [_jsx(ActionButton, { action: "ai", className: "pod-seats__action", "data-testid": "pod-seat-ai", "data-seat": seat, "aria-label": `Fill seat ${seat + 1} with AI`, disabled: shut, onPress: () => onBotOn?.(seat), children: "AI" }), seat < realSeatCount && (_jsx(ActionButton, { action: "close", className: "pod-seats__action", "data-testid": "pod-seat-close", "data-seat": seat, "aria-label": `Close seat ${seat + 1}`, onPress: () => onCloseSeat?.(seat), children: "Close" }))] }))] }, seat));
|
|
28
28
|
}
|
|
29
29
|
if (occupant.kind === 'closed') {
|
|
30
30
|
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, "data-closed": "", children: [_jsx("span", { className: "pod-seats__avatar pod-seats__avatar--closed", "aria-hidden": "true", children: "\u00D7" }), _jsx("span", { className: "pod-seats__label", children: "Closed" }), iLead && (_jsx("span", { className: "pod-seats__actions", children: _jsx(ActionButton, { action: "open", className: "pod-seats__action", "data-testid": "pod-seat-open", "data-seat": seat, "aria-label": `Open seat ${seat + 1}`, onPress: () => onOpenSeat?.(seat), children: "Open" }) }))] }, seat));
|
|
31
31
|
}
|
|
32
32
|
if (occupant.kind === 'bot') {
|
|
33
|
-
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, "data-ai": "", children: [_jsx("span", { className: "pod-seats__avatar pod-seats__avatar--ai", children: _jsx(Avatar, { id: occupant.avatarId, fallback: "mark", className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), _jsx("span", { className: "pod-seats__label", children: occupant.name }), !fieldFixed && (_jsx("span", { className: "pod-seats__actions", children: _jsx(ActionButton, { action: "ai-remove", className: "pod-seats__action", "data-testid": "pod-seat-ai-remove", "data-seat": seat, "aria-label": `Remove AI from seat ${seat + 1}`, onPress: () => onBotOff?.(seat), children: "Remove" }) }))] }, seat));
|
|
33
|
+
return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, "data-ai": "", children: [_jsx("span", { className: "pod-seats__avatar pod-seats__avatar--ai", children: _jsx(Avatar, { id: occupant.avatarId, fallback: "mark", className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), _jsx("span", { className: "pod-seats__label", children: occupant.name }), !fieldFixed && iLead && (_jsx("span", { className: "pod-seats__actions", children: _jsx(ActionButton, { action: "ai-remove", className: "pod-seats__action", "data-testid": "pod-seat-ai-remove", "data-seat": seat, "aria-label": `Remove AI from seat ${seat + 1}`, onPress: () => onBotOff?.(seat), children: "Remove" }) }))] }, seat));
|
|
34
34
|
}
|
|
35
35
|
const { id, name, avatarId, look, ready, leader, mine } = occupant;
|
|
36
36
|
const face = { id: avatarId ?? null, look };
|
package/package.json
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/game-ui",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.24",
|
|
4
|
+
"gitHead": "35defc017916a0dc77eb43290de8332a21270853",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "The browser parts any hosted game shares, above ui-shell: the room shell and session, seats and looks, the room route, the front page's generic pieces (gate, polls, gallery, patch notes), the bundle slot and relay channel a game's client mounts in, settings and trim screens, the HTTP and socket helpers, and the generic components (modal, popover, avatar, action button, radio cards). Knows no game; Magic's UI (games/magic/ui) plugs in, composed by the site (apps/ui). MIT; imports only react, react-dom, socket.io-client, @wolffm/* and the platform packages.",
|
|
8
8
|
"exports": {
|
|
9
|
+
"./front/Gallery": {
|
|
10
|
+
"types": "./dist/front/Gallery.d.ts",
|
|
11
|
+
"import": "./dist/front/Gallery.js"
|
|
12
|
+
},
|
|
13
|
+
"./front/icons": {
|
|
14
|
+
"types": "./dist/front/icons.d.ts",
|
|
15
|
+
"import": "./dist/front/icons.js"
|
|
16
|
+
},
|
|
17
|
+
"./front/LobbyShell": {
|
|
18
|
+
"types": "./dist/front/LobbyShell.d.ts",
|
|
19
|
+
"import": "./dist/front/LobbyShell.js"
|
|
20
|
+
},
|
|
21
|
+
"./front/PatchNotesCard": {
|
|
22
|
+
"types": "./dist/front/PatchNotesCard.d.ts",
|
|
23
|
+
"import": "./dist/front/PatchNotesCard.js"
|
|
24
|
+
},
|
|
25
|
+
"./front/RoomFront": {
|
|
26
|
+
"types": "./dist/front/RoomFront.d.ts",
|
|
27
|
+
"import": "./dist/front/RoomFront.js"
|
|
28
|
+
},
|
|
29
|
+
"./seats/SeatChip": {
|
|
30
|
+
"types": "./dist/seats/SeatChip.d.ts",
|
|
31
|
+
"import": "./dist/seats/SeatChip.js"
|
|
32
|
+
},
|
|
33
|
+
"./seats/SpectatorRow": {
|
|
34
|
+
"types": "./dist/seats/SpectatorRow.d.ts",
|
|
35
|
+
"import": "./dist/seats/SpectatorRow.js"
|
|
36
|
+
},
|
|
9
37
|
"./*.ts": {
|
|
10
38
|
"types": "./dist/*.d.ts",
|
|
11
39
|
"import": "./dist/*.js"
|
|
@@ -21,8 +49,8 @@
|
|
|
21
49
|
"react-dom": "^19.2.8"
|
|
22
50
|
},
|
|
23
51
|
"dependencies": {
|
|
24
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
25
|
-
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.
|
|
52
|
+
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.24",
|
|
53
|
+
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.24",
|
|
26
54
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.27",
|
|
27
55
|
"@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.102",
|
|
28
56
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.102",
|