@hadoku/game-ui 0.1.205 → 0.1.207
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The ONE config for every external game cardtable may host as a room type: the HOST's half of
|
|
3
3
|
* each, pure data. "Deleting that one entry removes bomberman from cardtable" (wave 119's settled
|
|
4
|
-
* rule): an entry names the game's id,
|
|
4
|
+
* rule): an entry names the game's id, whether it runs on cardtable's relay, where its same-origin
|
|
5
5
|
* embed bundle is, and who may play it. Nothing here is the game's to decide: its name, seat range
|
|
6
6
|
* and seat hold are in the `manifest.json` it publishes beside its embed entry
|
|
7
7
|
* (`@hadoku/platform-wire/external-game-manifest`, `docs/GAME_AUTHORS.md`), which the server reads.
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* - `apps/server/src/plugins/external-games.ts` (the site) reads each entry's manifest, builds the
|
|
11
11
|
* pair into a `GameTypeSpec` (`@hadoku/shared`'s `externalGameSpec`) and registers it, gated on
|
|
12
12
|
* `CARDTABLE_EXPERIMENTAL_GAMES=1`, and answers `GET /api/external-games` with the labels.
|
|
13
|
-
* - `./external-games.tsx` (platform) registers each entry's room UI, a `BundleSlot` on the relay
|
|
14
|
-
* unconditionally: a room already made keeps rendering whatever today's deployment flag says.
|
|
13
|
+
* - `./external-games.tsx` (platform) registers each entry's room UI, a `BundleSlot` (on the relay
|
|
14
|
+
* for a `runtime: 'relay'` entry), unconditionally: a room already made keeps rendering whatever today's deployment flag says.
|
|
15
15
|
*/
|
|
16
16
|
import type { ExternalGameManifestInput } from '@wolffm/platform-wire/external-game-manifest';
|
|
17
17
|
import type { RoomFloorTier } from '@wolffm/platform-wire/tiers';
|
|
@@ -19,10 +19,13 @@ export interface ExternalGameConfig {
|
|
|
19
19
|
/** The room's wire `gameType`. */
|
|
20
20
|
id: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* of its own for it, only seats, watchers and a channel each seat's bundle speaks over.
|
|
22
|
+
* `'relay'`: this game type's match runs on cardtable's relay (`RelaySession`): the host has no
|
|
23
|
+
* engine of its own for it, only seats, watchers and a channel each seat's bundle speaks over.
|
|
24
|
+
* Absent: the game runs its own match on its own server, and the host only gives its bundle the
|
|
25
|
+
* room (`ctx.roomKey`, who is looking, the room's seats) — no relay match is opened behind the
|
|
26
|
+
* room and the bundle gets no `ctx.channel`.
|
|
24
27
|
*/
|
|
25
|
-
runtime
|
|
28
|
+
runtime?: 'relay';
|
|
26
29
|
/** The same-origin path the client's `BundleSlot` loads this game's bundle from; its `manifest.json` is beside it. */
|
|
27
30
|
embedSrc: string;
|
|
28
31
|
/**
|
|
@@ -46,6 +49,6 @@ export interface ExternalGameConfig {
|
|
|
46
49
|
/**
|
|
47
50
|
* One entry per external game cardtable may host, plus one e2e-only fixture entry. Bomberman's own
|
|
48
51
|
* repo serves `/bomberman/embed/bomberman-embed.js` same-origin, the same path watchparty loads it
|
|
49
|
-
* from.
|
|
52
|
+
* from; its bundle binds a room on bomberman's own server from `ctx.roomKey`, so it takes no relay.
|
|
50
53
|
*/
|
|
51
54
|
export declare const EXTERNAL_GAMES: readonly ExternalGameConfig[];
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One entry per external game cardtable may host, plus one e2e-only fixture entry. Bomberman's own
|
|
3
3
|
* repo serves `/bomberman/embed/bomberman-embed.js` same-origin, the same path watchparty loads it
|
|
4
|
-
* from.
|
|
4
|
+
* from; its bundle binds a room on bomberman's own server from `ctx.roomKey`, so it takes no relay.
|
|
5
5
|
*/
|
|
6
6
|
export const EXTERNAL_GAMES = [
|
|
7
7
|
{
|
|
8
8
|
id: 'bomberman',
|
|
9
|
-
runtime: 'relay',
|
|
10
9
|
embedSrc: '/bomberman/embed/bomberman-embed.js',
|
|
11
10
|
},
|
|
12
11
|
// An outside author's game (Cozmiverse/crossover-cards), served friends-only from
|
|
@@ -35,6 +35,18 @@ export interface GameSetupProps {
|
|
|
35
35
|
};
|
|
36
36
|
/** The room's game has started: a match is running, or (for a pod game type) the deal happened. */
|
|
37
37
|
underway: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The game says a match is (`true`) or is no longer (`false`) being played in it: while it is,
|
|
40
|
+
* the room screen hides its own head row (the title, Leave, the leader's tools), and shows it
|
|
41
|
+
* again on `false`. A game that draws its own full screen calls it; one that does not, never
|
|
42
|
+
* does. Absent: the screen has no chrome to step aside.
|
|
43
|
+
*/
|
|
44
|
+
onLive?: (live: boolean) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Leave the room and go home, as the head row's Leave does: the way out a game offers itself
|
|
47
|
+
* while the head row is hidden. Absent where the host has no home to leave to.
|
|
48
|
+
*/
|
|
49
|
+
leave?: () => void;
|
|
38
50
|
}
|
|
39
51
|
/**
|
|
40
52
|
* What a game type renders inside the platform room screen: its setup before the start, its game
|
|
@@ -42,7 +42,9 @@ export interface RoomShellProps {
|
|
|
42
42
|
onPasswordSubmit: () => void;
|
|
43
43
|
/** The table could not be read at all, and no password prompt is standing between here and it. */
|
|
44
44
|
roomMissingMessage: string | null;
|
|
45
|
+
/** The game in the body is playing a match (`GameSetupProps.onLive`): the head row steps aside until it is not. */
|
|
46
|
+
live?: boolean;
|
|
45
47
|
/** The game type's own content: its setup, its game, in that order. */
|
|
46
48
|
children: ReactNode;
|
|
47
49
|
}
|
|
48
|
-
export declare function RoomShell({ shellRef, dataMembers, roomTitle, titleAside, settled, leave, leaveAsks, headerTools, streamed, streamedSubLine, resolved, pending, pendingBody, streamedBody, locked, password, onPasswordChange, onPasswordSubmit, roomMissingMessage, children, }: RoomShellProps): import("react").JSX.Element;
|
|
50
|
+
export declare function RoomShell({ shellRef, dataMembers, roomTitle, titleAside, settled, leave, leaveAsks, headerTools, streamed, streamedSubLine, resolved, pending, pendingBody, streamedBody, locked, password, onPasswordChange, onPasswordSubmit, roomMissingMessage, live, children, }: RoomShellProps): import("react").JSX.Element;
|
|
@@ -10,15 +10,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
10
10
|
* room's body arrives as `children`, rendered only once `resolved` is true and the room is not
|
|
11
11
|
* streamed — a streamed room draws `streamedBody` instead, and neither draws until the room record
|
|
12
12
|
* has answered.
|
|
13
|
+
*
|
|
14
|
+
* While the game in the body says a match is live (`live`), the head row is not drawn at all —
|
|
15
|
+
* no title, no Leave, no tools — so the game has the room to itself, and its own menu offers the
|
|
16
|
+
* way out (`GameSetupProps.leave`). It comes back the moment `live` is false again. The room's
|
|
17
|
+
* leave stays registered throughout, so the page's top bar still leaves through it.
|
|
13
18
|
*/
|
|
14
19
|
import { useState } from 'react';
|
|
15
20
|
import { leaveRoomThen, useRoomHome, useRoomLeave } from "./room-exit.js";
|
|
16
21
|
import '../../components/Button.css';
|
|
17
22
|
import './RoomShell.css';
|
|
18
|
-
export function RoomShell({ shellRef, dataMembers, roomTitle, titleAside, settled, leave, leaveAsks, headerTools, streamed, streamedSubLine, resolved, pending, pendingBody, streamedBody, locked, password, onPasswordChange, onPasswordSubmit, roomMissingMessage, children, }) {
|
|
23
|
+
export function RoomShell({ shellRef, dataMembers, roomTitle, titleAside, settled, leave, leaveAsks, headerTools, streamed, streamedSubLine, resolved, pending, pendingBody, streamedBody, locked, password, onPasswordChange, onPasswordSubmit, roomMissingMessage, live = false, children, }) {
|
|
19
24
|
useRoomLeave(leaveAsks === undefined ? (leave ?? null) : null);
|
|
20
25
|
const home = useRoomHome();
|
|
21
|
-
return (_jsxs("div", { ref: shellRef, className: "shell shell--fit", "data-testid": "constructed", "data-members": dataMembers, children: [_jsxs("header", { className: "shell__head", children: [roomTitle !== undefined ? (_jsx("h1", { className: "shell__title", "data-testid": "room-name", children: roomTitle })) : settled ? (_jsx("h1", { className: "shell__title", children: "Room" })) : (_jsx("span", { className: "skeleton skeleton--title" })), roomTitle !== undefined && titleAside, _jsxs("div", { className: "shell__tools", children: [leave !== undefined && home !== null && _jsx(RoomLeave, { leave: leave, asks: leaveAsks, home: home }), headerTools] }), resolved && streamed && streamedSubLine] }), _jsxs("main", { className: "lobby lobby--room", "aria-busy": pending ? 'true' : undefined, children: [pending && pendingBody, streamed && streamedBody, !streamed && resolved && (_jsxs(_Fragment, { children: [locked !== null && (_jsxs("form", { className: "lobby__locked ct-panel", "data-testid": "room-locked", onSubmit: (e) => {
|
|
26
|
+
return (_jsxs("div", { ref: shellRef, className: "shell shell--fit", "data-testid": "constructed", "data-members": dataMembers, "data-live": live ? 'true' : undefined, children: [!live && (_jsxs("header", { className: "shell__head", children: [roomTitle !== undefined ? (_jsx("h1", { className: "shell__title", "data-testid": "room-name", children: roomTitle })) : settled ? (_jsx("h1", { className: "shell__title", children: "Room" })) : (_jsx("span", { className: "skeleton skeleton--title" })), roomTitle !== undefined && titleAside, _jsxs("div", { className: "shell__tools", children: [leave !== undefined && home !== null && _jsx(RoomLeave, { leave: leave, asks: leaveAsks, home: home }), headerTools] }), resolved && streamed && streamedSubLine] })), _jsxs("main", { className: "lobby lobby--room", "aria-busy": pending ? 'true' : undefined, children: [pending && pendingBody, streamed && streamedBody, !streamed && resolved && (_jsxs(_Fragment, { children: [locked !== null && (_jsxs("form", { className: "lobby__locked ct-panel", "data-testid": "room-locked", onSubmit: (e) => {
|
|
22
27
|
e.preventDefault();
|
|
23
28
|
onPasswordSubmit();
|
|
24
29
|
}, children: [_jsx("p", { role: "alert", children: locked === 'need' ? 'This room needs a password.' : locked === 'wrong' ? 'Wrong password.' : 'Too many attempts.' }), _jsx("label", { htmlFor: "room-password", children: "Password" }), _jsx("input", { id: "room-password", "data-testid": "room-password", type: "password", autoComplete: "off", value: password, onChange: (e) => onPasswordChange(e.target.value) }), _jsx("button", { type: "submit", "data-testid": "room-password-submit", disabled: locked === 'rate-limited', children: "Join" })] })), locked === null && roomMissingMessage !== null && (_jsx("p", { className: "ct-error", role: "alert", "data-testid": "room-missing", children: roomMissingMessage })), children] }))] })] }));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/game-ui",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.207",
|
|
4
|
+
"gitHead": "0ea202e41619bdb176bbbc6c030ed3940611a093",
|
|
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.",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"react-dom": "^19.2.8"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
57
|
-
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.
|
|
56
|
+
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.211",
|
|
57
|
+
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.211",
|
|
58
58
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.2.3",
|
|
59
59
|
"@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.152",
|
|
60
60
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.152",
|