@hadoku/game-ui 0.1.30 → 0.1.32

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.
@@ -0,0 +1,33 @@
1
+ /*
2
+ * One look for the small bordered action button (the operator, 2026-11-17: Reset had no
3
+ * highlight beside Join/Watch): Reset/Close, a deck's rename/delete, a pod seat's own action, a
4
+ * table's scorekeeping buttons. `.ct-action` is the colour and hover/focus fill; `.ct-action--danger`
5
+ * fills the theme's danger instead. No size here — that differs per site, and gets duplicated
6
+ * either way (`css-ownership.test.ts` forbids one block split across sheets); SHARED there, like `.button`.
7
+ */
8
+
9
+ .ct-action {
10
+ color: var(--color-text);
11
+ background: var(--color-bg);
12
+ border: 1px solid var(--color-border);
13
+ cursor: pointer;
14
+ }
15
+
16
+ .ct-action:hover,
17
+ .ct-action:focus-visible {
18
+ background: var(--color-primary);
19
+ color: var(--color-on-primary);
20
+ border-color: var(--color-primary);
21
+ }
22
+
23
+ .ct-action:disabled {
24
+ opacity: 0.5;
25
+ cursor: default;
26
+ }
27
+
28
+ .ct-action--danger:hover,
29
+ .ct-action--danger:focus-visible {
30
+ background: var(--danger);
31
+ color: var(--on-danger);
32
+ border-color: var(--danger);
33
+ }
@@ -238,7 +238,7 @@ function RoomRow({ room, client, rowExtras, matches, onGone, onOpenRoom, beforeO
238
238
  const names = room.members.map((m) => m.name);
239
239
  const view = room.view;
240
240
  const extras = rowExtras?.(room) ?? {};
241
- return (_jsxs("li", { className: "room-card", "data-testid": "room-row", "data-room-id": room.id, "data-mine": isMine(room) ? '' : undefined, "data-match": matches(room) ? undefined : 'false', "data-family": extras.family, children: [extras.scene !== undefined && (_jsx("span", { className: "room-card__mark", "aria-hidden": "true", children: extras.scene })), _jsxs("div", { className: "room-card__body", children: [_jsxs("div", { className: "room-card__row1", children: [extras.typeIcon !== undefined && (_jsx("span", { className: "room-card__type-icon", "aria-hidden": "true", children: extras.typeIcon })), _jsx("span", { ref: nameRef, className: "room-card__name", "data-testid": "room-name", "data-tip": nameTruncated ? room.name : undefined, tabIndex: nameTruncated ? 0 : undefined, children: room.name }), extras.trophy !== undefined && _jsx("span", { className: "room-card__trophy", children: extras.trophy }), _jsxs("span", { className: "room-card__seats", "data-testid": "room-seats", children: [_jsx(PersonIcon, {}), view.seatsFilled, "/", view.seatsCapacity] })] }), (extras.modeChip !== undefined || extras.seriesChip !== undefined) && (_jsxs("div", { className: "room-card__row2", children: [extras.modeChip, extras.seriesChip] })), _jsxs("div", { className: "room-card__row3", children: [_jsxs("span", { className: "room-card__state", "data-testid": "room-state", "data-state": view.state.key, children: [_jsx("span", { className: "room-card__dot", "aria-hidden": "true" }), view.state.label] }), view.state.detail !== null && _jsx("span", { className: "room-card__state-detail", children: view.state.detail })] }), _jsxs("span", { className: "rooms__members rooms__sr", "data-testid": "room-members", children: [room.members.map((m) => (_jsx(Avatar, { ...faceOf(m), fallback: "none", className: "rooms__face", "data-testid": "room-face", "data-avatar-id": m.avatarId, title: m.name, width: 18, height: 18, loading: "lazy" }, m.id))), names.join(', ')] }), _jsxs("div", { className: "room-card__row4", children: [!asking && (_jsxs("button", { type: "button", className: "rooms__enter room-card__go", "data-testid": "room-enter", "aria-label": `${view.primaryAction} ${room.name}`, disabled: busy, onClick: onEnterClick, children: [room.locked && (_jsx("span", { className: "room-card__lock", "data-testid": "room-locked", "aria-hidden": "true", children: _jsx(LockIcon, {}) })), view.primaryAction] })), !asking && view.extraWatch && (_jsx("button", { type: "button", className: "rooms__enter room-card__go room-card__go--watch", "data-testid": "room-watch", "aria-label": `Watch ${room.name}`, disabled: busy, onClick: onEnterClick, children: "Watch" })), !asking && room.testing === true && client.reset !== undefined && (_jsx("button", { type: "button", className: "rooms__enter", "data-testid": "room-reset", "aria-label": `Reset ${room.name}`, disabled: busy, onClick: () => void onResetClick(), children: "Reset" })), extras.legacyMeta !== undefined && _jsx("div", { className: "rooms__meta room-card__legacy", children: extras.legacyMeta })] })] }), asking && (_jsxs("form", { className: "rooms__password", onSubmit: onPassword, children: [_jsxs("label", { htmlFor: `room-password-${room.id}`, children: ["Password for ", room.name] }), _jsx("input", { id: `room-password-${room.id}`, "data-testid": "room-password", type: "password", maxLength: passwordMaxLength, autoComplete: "off", autoFocus: true, value: password, onChange: (e) => {
241
+ return (_jsxs("li", { className: "room-card", "data-testid": "room-row", "data-room-id": room.id, "data-mine": isMine(room) ? '' : undefined, "data-match": matches(room) ? undefined : 'false', "data-family": extras.family, children: [extras.scene !== undefined && (_jsx("span", { className: "room-card__mark", "aria-hidden": "true", children: extras.scene })), _jsxs("div", { className: "room-card__body", children: [_jsxs("div", { className: "room-card__row1", children: [extras.typeIcon !== undefined && (_jsx("span", { className: "room-card__type-icon", "aria-hidden": "true", children: extras.typeIcon })), _jsx("span", { ref: nameRef, className: "room-card__name", "data-testid": "room-name", "data-tip": nameTruncated ? room.name : undefined, tabIndex: nameTruncated ? 0 : undefined, children: room.name }), extras.trophy !== undefined && _jsx("span", { className: "room-card__trophy", children: extras.trophy }), _jsxs("span", { className: "room-card__seats", "data-testid": "room-seats", children: [_jsx(PersonIcon, {}), view.seatsFilled, "/", view.seatsCapacity] })] }), (extras.modeChip !== undefined || extras.seriesChip !== undefined) && (_jsxs("div", { className: "room-card__row2", children: [extras.modeChip, extras.seriesChip] })), _jsxs("div", { className: "room-card__row3", children: [_jsxs("span", { className: "room-card__state", "data-testid": "room-state", "data-state": view.state.key, children: [_jsx("span", { className: "room-card__dot", "aria-hidden": "true" }), view.state.label] }), view.state.detail !== null && _jsx("span", { className: "room-card__state-detail", children: view.state.detail })] }), _jsxs("span", { className: "rooms__members rooms__sr", "data-testid": "room-members", children: [room.members.map((m) => (_jsx(Avatar, { ...faceOf(m), fallback: "none", className: "rooms__face", "data-testid": "room-face", "data-avatar-id": m.avatarId, title: m.name, width: 18, height: 18, loading: "lazy" }, m.id))), names.join(', ')] }), _jsxs("div", { className: "room-card__row4", children: [!asking && (_jsxs("button", { type: "button", className: "rooms__enter room-card__go", "data-testid": "room-enter", "aria-label": `${view.primaryAction} ${room.name}`, disabled: busy, onClick: onEnterClick, children: [room.locked && (_jsx("span", { className: "room-card__lock", "data-testid": "room-locked", "aria-hidden": "true", children: _jsx(LockIcon, {}) })), view.primaryAction] })), !asking && view.extraWatch && (_jsx("button", { type: "button", className: "rooms__enter room-card__go room-card__go--watch", "data-testid": "room-watch", "aria-label": `Watch ${room.name}`, disabled: busy, onClick: onEnterClick, children: "Watch" })), !asking && room.testing === true && client.reset !== undefined && (_jsx("button", { type: "button", className: "rooms__enter room-card__go", "data-testid": "room-reset", "aria-label": `Reset ${room.name}`, disabled: busy, onClick: () => void onResetClick(), children: "Reset" })), extras.legacyMeta !== undefined && _jsx("div", { className: "rooms__meta room-card__legacy", children: extras.legacyMeta })] })] }), asking && (_jsxs("form", { className: "rooms__password", onSubmit: onPassword, children: [_jsxs("label", { htmlFor: `room-password-${room.id}`, children: ["Password for ", room.name] }), _jsx("input", { id: `room-password-${room.id}`, "data-testid": "room-password", type: "password", maxLength: passwordMaxLength, autoComplete: "off", autoFocus: true, value: password, onChange: (e) => {
242
242
  setPassword(e.target.value);
243
243
  setError(null);
244
244
  } }), _jsx("button", { type: "submit", "data-testid": "room-password-submit", "aria-label": `Enter ${room.name}`, disabled: busy, children: "Enter" }), _jsx("button", { type: "button", className: "rooms__cancel", onClick: () => {
@@ -1,4 +1,5 @@
1
1
  import type { Look } from '@wolffm/platform-wire/look';
2
+ import '../components/Button.css';
2
3
  /** The same crown `magic-room-ui.tsx` draws for its own direct uses — duplicated, not imported, so this file pulls in nothing of Magic's. */
3
4
  export declare const SEAT_CROWN_PATH = "M2 9V3.5l2.2 2L6 2.6l1.8 2.9L10 3.5V9Z";
4
5
  /**
@@ -18,22 +18,23 @@ import { ActionButton } from "../components/ActionButton.js";
18
18
  import { Avatar } from "../components/Avatar.js";
19
19
  import { PlayerName } from "../room/look.js";
20
20
  import { StatusPill } from "../components/StatusPill.js";
21
+ import '../components/Button.css';
21
22
  /** The same crown `magic-room-ui.tsx` draws for its own direct uses — duplicated, not imported, so this file pulls in nothing of Magic's. */
22
23
  export const SEAT_CROWN_PATH = 'M2 9V3.5l2.2 2L6 2.6l1.8 2.9L10 3.5V9Z';
23
24
  /** A strip of seats, one `<li>` each: dashed-open / "×"-closed / the bot's own look / a member's avatar, a label underneath, every action its own always-visible button. */
24
25
  export function SeatList({ slots, iLead, shut = false, fieldFixed = false, realSeatCount, mySeat, onSit, onBotOn, onBotOff, onCloseSeat, onOpenSeat, onRemoveMember, onBotReplace, onMakeLeader }) {
25
26
  return (_jsx("ul", { className: "pod-seats", "data-testid": "pod-seats", children: slots.map(({ seat, occupant }) => {
26
27
  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 && 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
+ 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 ct-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 ct-action", "data-testid": "pod-seat-close", "data-seat": seat, "aria-label": `Close seat ${seat + 1}`, onPress: () => onCloseSeat?.(seat), children: "Close" }))] }))] }, seat));
28
29
  }
29
30
  if (occupant.kind === 'closed') {
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
+ 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 ct-action", "data-testid": "pod-seat-open", "data-seat": seat, "aria-label": `Open seat ${seat + 1}`, onPress: () => onOpenSeat?.(seat), children: "Open" }) }))] }, seat));
31
32
  }
32
33
  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 && 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
+ 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 ct-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
35
  }
35
36
  const { id, name, avatarId, look, ready, leader, mine } = occupant;
36
37
  const face = { id: avatarId ?? null, look };
37
- return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, "data-mine": mine ? '' : undefined, children: [_jsxs("span", { className: "pod-seats__avatar-wrap", children: [_jsx("span", { className: "pod-seats__avatar", "data-ready": ready ? 'true' : 'false', children: _jsx(Avatar, { ...face, fallback: "initial", name: name, className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), leader && (_jsxs("svg", { className: "pod-seats__crown", "data-testid": `pod-seat-${seat}-leader`, viewBox: "0 0 12 12", role: "img", "aria-label": "Room owner", children: [_jsx("title", { children: "Room owner" }), _jsx("path", { d: SEAT_CROWN_PATH })] }))] }), _jsx(PlayerName, { name: name, face: face, className: "pod-seats__label" }), _jsx(StatusPill, { testId: `pod-seat-${seat}-ready`, state: ready ? 'yes' : 'no', mark: ready ? 'tick' : 'ring', label: ready ? 'ready' : 'not ready' }), iLead && !mine && (onRemoveMember !== undefined || onBotReplace !== undefined || onMakeLeader !== undefined) && (_jsxs("span", { className: "pod-seats__actions", children: [onRemoveMember !== undefined && (_jsx(ActionButton, { action: "remove", className: "pod-seats__action", "data-testid": "pod-seat-remove", "data-seat": seat, "aria-label": `Remove ${name} from the table`, onPress: () => onRemoveMember(seat, id), children: "Remove" })), onBotReplace !== undefined && (_jsx(ActionButton, { action: "bot-replace", className: "pod-seats__action", "data-testid": "pod-seat-bot-replace", "data-seat": seat, "aria-label": `Put the bot in ${name}'s seat`, onPress: () => onBotReplace(seat, id), children: "Bot" })), onMakeLeader !== undefined && (_jsx(ActionButton, { action: "make-leader", className: "pod-seats__action", "data-testid": "pod-seat-make-leader", "data-seat": seat, "aria-label": `Make ${name} the room leader`, onPress: () => onMakeLeader(id), children: _jsx("svg", { className: "pod-seats__action-icon", viewBox: "0 0 12 12", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: SEAT_CROWN_PATH }) }) }))] }))] }, seat));
38
+ return (_jsxs("li", { className: "pod-seats__seat", "data-testid": `pod-seat-${seat}`, "data-mine": mine ? '' : undefined, children: [_jsxs("span", { className: "pod-seats__avatar-wrap", children: [_jsx("span", { className: "pod-seats__avatar", "data-ready": ready ? 'true' : 'false', children: _jsx(Avatar, { ...face, fallback: "initial", name: name, className: "pod-seats__avatar-img", fallbackClassName: "pod-seats__avatar-fallback" }) }), leader && (_jsxs("svg", { className: "pod-seats__crown", "data-testid": `pod-seat-${seat}-leader`, viewBox: "0 0 12 12", role: "img", "aria-label": "Room owner", children: [_jsx("title", { children: "Room owner" }), _jsx("path", { d: SEAT_CROWN_PATH })] }))] }), _jsx(PlayerName, { name: name, face: face, className: "pod-seats__label" }), _jsx(StatusPill, { testId: `pod-seat-${seat}-ready`, state: ready ? 'yes' : 'no', mark: ready ? 'tick' : 'ring', label: ready ? 'ready' : 'not ready' }), iLead && !mine && (onRemoveMember !== undefined || onBotReplace !== undefined || onMakeLeader !== undefined) && (_jsxs("span", { className: "pod-seats__actions", children: [onRemoveMember !== undefined && (_jsx(ActionButton, { action: "remove", className: "pod-seats__action ct-action", "data-testid": "pod-seat-remove", "data-seat": seat, "aria-label": `Remove ${name} from the table`, onPress: () => onRemoveMember(seat, id), children: "Remove" })), onBotReplace !== undefined && (_jsx(ActionButton, { action: "bot-replace", className: "pod-seats__action ct-action", "data-testid": "pod-seat-bot-replace", "data-seat": seat, "aria-label": `Put the bot in ${name}'s seat`, onPress: () => onBotReplace(seat, id), children: "Bot" })), onMakeLeader !== undefined && (_jsx(ActionButton, { action: "make-leader", className: "pod-seats__action ct-action", "data-testid": "pod-seat-make-leader", "data-seat": seat, "aria-label": `Make ${name} the room leader`, onPress: () => onMakeLeader(id), children: _jsx("svg", { className: "pod-seats__action-icon", viewBox: "0 0 12 12", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: SEAT_CROWN_PATH }) }) }))] }))] }, seat));
38
39
  }) }));
39
40
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/game-ui",
3
- "version": "0.1.30",
4
- "gitHead": "d927b26bdcbe7df569841cff3f8145bc2040ca1a",
3
+ "version": "0.1.32",
4
+ "gitHead": "6a54778142158a75c3cc6dac3a9b3ba4889e9e47",
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.",
@@ -49,14 +49,14 @@
49
49
  "react-dom": "^19.2.8"
50
50
  },
51
51
  "dependencies": {
52
- "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.30",
53
- "@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.30",
52
+ "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.32",
53
+ "@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.32",
54
54
  "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.27",
55
- "@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.104",
56
- "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.104",
55
+ "@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.105",
56
+ "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.105",
57
57
  "@wolffm/task-ui-components": "npm:@hadoku/task-ui-components@^4.23.35",
58
58
  "@wolffm/themes": "npm:@hadoku/themes@^5.14.4",
59
- "@wolffm/watchparty-ui": "npm:@hadoku/watchparty-ui@^0.45.104",
59
+ "@wolffm/watchparty-ui": "npm:@hadoku/watchparty-ui@^0.45.105",
60
60
  "socket.io-client": "^4.8.3",
61
61
  "zod": "4.5.4"
62
62
  },