@hadoku/game-ui 0.1.119 → 0.1.120
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/dist/front/LobbyShell.d.ts +8 -1
- package/dist/front/LobbyShell.js +3 -3
- package/dist/front/gate.d.ts +11 -2
- package/dist/front/gate.js +12 -4
- package/package.json +4 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type FrontPart } from './gate.js';
|
|
2
3
|
import './LobbyShell.css';
|
|
3
4
|
export interface LobbyShellProps {
|
|
4
5
|
/** The header's own tools row (settings, decks, stats, …) — omitted renders no `<nav>` at all. */
|
|
@@ -9,5 +10,11 @@ export interface LobbyShellProps {
|
|
|
9
10
|
children: ReactNode;
|
|
10
11
|
/** A footer line under the page's own scroll (a licensing disclaimer, today) — omitted draws none. */
|
|
11
12
|
disclaimer?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The parts this page draws, which the page waits on before it shows itself (`./gate.ts`). Every
|
|
15
|
+
* part by default, as cardtable's page has. A page without the live slot, the calendar or the
|
|
16
|
+
* wildcard names only what it has, so it does not sit out the whole hold for parts it never draws.
|
|
17
|
+
*/
|
|
18
|
+
parts?: readonly FrontPart[];
|
|
12
19
|
}
|
|
13
|
-
export declare function LobbyShell({ navTools, banner, children, disclaimer }: LobbyShellProps): import("react").JSX.Element;
|
|
20
|
+
export declare function LobbyShell({ navTools, banner, children, disclaimer, parts }: LobbyShellProps): import("react").JSX.Element;
|
package/dist/front/LobbyShell.js
CHANGED
|
@@ -22,13 +22,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
* is the new behaviour this module exists to offer.
|
|
23
23
|
*/
|
|
24
24
|
import { useEffect } from 'react';
|
|
25
|
-
import { FrontGateContext, useFrontGateState } from "./gate.js";
|
|
25
|
+
import { FRONT_PARTS, FrontGateContext, HOLD_MS, useFrontGateState } from "./gate.js";
|
|
26
26
|
import { useSiteTrim } from "../settings/siteTrim.js";
|
|
27
27
|
import { useChromeShell } from '@wolffm/ui-shell/chrome/shell';
|
|
28
28
|
import './LobbyShell.css';
|
|
29
|
-
export function LobbyShell({ navTools, banner, children, disclaimer }) {
|
|
29
|
+
export function LobbyShell({ navTools, banner, children, disclaimer, parts = FRONT_PARTS }) {
|
|
30
30
|
const shellRef = useChromeShell('fit');
|
|
31
|
-
const gate = useFrontGateState();
|
|
31
|
+
const gate = useFrontGateState(HOLD_MS, parts);
|
|
32
32
|
const trimLoaded = useSiteTrim().loaded;
|
|
33
33
|
const { settle } = gate;
|
|
34
34
|
useEffect(() => {
|
package/dist/front/gate.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ import { type FrontShape } from './shape.js';
|
|
|
4
4
|
* the site's look (`../settings/siteTrim.ts`), drawn on the whole page: the page is not shown before it.
|
|
5
5
|
*/
|
|
6
6
|
export type FrontPart = 'rooms' | 'live' | 'upcoming' | 'wildcard' | 'trim';
|
|
7
|
+
/**
|
|
8
|
+
* Every part a front page can have: cardtable's, which draws them all. A page with fewer (bomberman's
|
|
9
|
+
* has the room list and the trim) declares its own (`LobbyShell`'s `parts`), or it would wait out
|
|
10
|
+
* the whole `HOLD_MS` on parts it never draws.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FRONT_PARTS: readonly FrontPart[];
|
|
7
13
|
/** The longest the page waits on a slow part before showing the rest. The wildcard's own wait is 2 s. */
|
|
8
14
|
export declare const HOLD_MS = 2500;
|
|
9
15
|
export interface FrontGate {
|
|
@@ -17,7 +23,10 @@ export interface FrontGate {
|
|
|
17
23
|
remember: (seen: Partial<FrontShape>) => void;
|
|
18
24
|
}
|
|
19
25
|
export declare const FrontGateContext: import("react").Context<FrontGate>;
|
|
20
|
-
/**
|
|
21
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The gate itself, held by the front page: revealed once every one of `parts` has settled, or
|
|
28
|
+
* `HOLD_MS` has passed. `parts` is the page's for its life: read once, on the first draw.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useFrontGateState(holdMs?: number, parts?: readonly FrontPart[]): FrontGate;
|
|
22
31
|
/** Whether `part` draws its content now: it is ready, and the page has shown itself. */
|
|
23
32
|
export declare function usePartShown(part: FrontPart, ready: boolean): boolean;
|
package/dist/front/gate.js
CHANGED
|
@@ -13,14 +13,22 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
15
15
|
import { FIRST_VISIT, loadFrontShape, saveFrontShape } from "./shape.js";
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Every part a front page can have: cardtable's, which draws them all. A page with fewer (bomberman's
|
|
18
|
+
* has the room list and the trim) declares its own (`LobbyShell`'s `parts`), or it would wait out
|
|
19
|
+
* the whole `HOLD_MS` on parts it never draws.
|
|
20
|
+
*/
|
|
21
|
+
export const FRONT_PARTS = ['rooms', 'live', 'upcoming', 'wildcard', 'trim'];
|
|
17
22
|
/** The longest the page waits on a slow part before showing the rest. The wildcard's own wait is 2 s. */
|
|
18
23
|
export const HOLD_MS = 2_500;
|
|
19
24
|
const UNGATED = { revealed: true, settle: () => undefined, shape: FIRST_VISIT, remember: () => undefined };
|
|
20
25
|
export const FrontGateContext = createContext(UNGATED);
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The gate itself, held by the front page: revealed once every one of `parts` has settled, or
|
|
28
|
+
* `HOLD_MS` has passed. `parts` is the page's for its life: read once, on the first draw.
|
|
29
|
+
*/
|
|
30
|
+
export function useFrontGateState(holdMs = HOLD_MS, parts = FRONT_PARTS) {
|
|
31
|
+
const [waiting, setWaiting] = useState(() => new Set(parts));
|
|
24
32
|
const [held, setHeld] = useState(false);
|
|
25
33
|
useEffect(() => {
|
|
26
34
|
const timer = setTimeout(() => setHeld(true), holdMs);
|
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.120",
|
|
4
|
+
"gitHead": "eaae4ceab51eec970f822ecb53aac0443d9d2f15",
|
|
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.",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"react-dom": "^19.2.8"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
58
|
-
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.
|
|
57
|
+
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.124",
|
|
58
|
+
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.124",
|
|
59
59
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.2.0",
|
|
60
60
|
"@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.134",
|
|
61
61
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.134",
|