@hadoku/game-ui 0.1.268 → 0.1.269
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/Gallery.d.ts +1 -0
- package/dist/front/Gallery.js +1 -0
- package/dist/front/PatchNotesCard.d.ts +1 -0
- package/dist/front/PatchNotesCard.js +1 -0
- package/dist/front/front-card.css +233 -0
- package/dist/rooms/screen/RoomShell.css +104 -2
- package/dist/rooms/screen/RoomShell.js +1 -1
- package/package.json +4 -4
package/dist/front/Gallery.d.ts
CHANGED
package/dist/front/Gallery.js
CHANGED
|
@@ -9,6 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import { playRole } from "../sound/index.js";
|
|
11
11
|
import { keepPage, stepPage } from "./gallery.js";
|
|
12
|
+
import './front-card.css';
|
|
12
13
|
/**
|
|
13
14
|
* The arrow inside a gallery's round button, drawn, not typed: a text ‹ › sits wherever its font
|
|
14
15
|
* puts the glyph in its line box (1.25 px low and 0.4 px aside, measured on Linux; it moves with the
|
|
@@ -7,6 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
7
7
|
import { Fragment, useLayoutEffect, useRef, useState } from 'react';
|
|
8
8
|
import { Modal } from "../components/Modal.js";
|
|
9
9
|
import { creditRuns, fittingBullets, newestFirst, parseReleaseNotes, versionOfPath } from "./patchNotes.js";
|
|
10
|
+
import './front-card.css';
|
|
10
11
|
// Vite bundles every match eagerly, as raw text, at build time (no server round trip for the notes).
|
|
11
12
|
const RELEASE_FILES = import.meta.glob('../../../../docs/releases/v*.md', { query: '?raw', eager: true, import: 'default' });
|
|
12
13
|
/** Every release this build shipped with, parsed, newest first. Computed once per build, not per render. */
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A front card (`PatchNotesCard.tsx`, and a game's own cards around a `Gallery`): a raised surface
|
|
3
|
+
* with a 3px top border by kind, a head, its body and a foot with its one action. The game's own
|
|
4
|
+
* kinds (`front-card--<kind>`) set the border's colour, and its own rows go in its own sheet.
|
|
5
|
+
* Theme tokens only.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.front-card {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 8px;
|
|
12
|
+
min-height: 0;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
background: var(--color-bg-card);
|
|
15
|
+
border: 1px solid var(--color-border);
|
|
16
|
+
border-top: 3px solid var(--color-border);
|
|
17
|
+
border-radius: var(--hdk-radius-lg);
|
|
18
|
+
padding: 14px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.front-card--patch-notes {
|
|
22
|
+
border-top-color: var(--color-primary);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.front-card__head {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: baseline;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
gap: 8px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.front-card__title {
|
|
33
|
+
margin: 0;
|
|
34
|
+
font-size: 15px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.front-card__version {
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
color: var(--color-text-secondary);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.front-card__empty {
|
|
43
|
+
margin: 0;
|
|
44
|
+
color: var(--color-text-secondary);
|
|
45
|
+
font-size: 13px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.front-card__release-title {
|
|
49
|
+
margin: 0;
|
|
50
|
+
font-size: 15px;
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.front-card__bullets {
|
|
55
|
+
margin: 0;
|
|
56
|
+
padding-left: 18px;
|
|
57
|
+
font-size: 12px;
|
|
58
|
+
color: var(--color-text-secondary);
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
flex: 1 1 auto;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.front-card__foot {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
gap: 10px;
|
|
68
|
+
margin-top: auto;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* A card's one action ("Read all", a game's own link drawn as one), right-aligned, in the theme's
|
|
73
|
+
* primary: as text it is mixed 35% toward the ink, which keeps the hue and stays readable on a card.
|
|
74
|
+
*/
|
|
75
|
+
.front-card__more {
|
|
76
|
+
margin-left: auto;
|
|
77
|
+
display: inline-flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
color: color-mix(in srgb, var(--color-primary) 35%, var(--color-text));
|
|
81
|
+
border-color: var(--color-primary);
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.front-card__more:hover,
|
|
86
|
+
.front-card__more:focus-visible {
|
|
87
|
+
background: var(--color-primary);
|
|
88
|
+
color: var(--color-on-primary);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* The full notes, in `../components/Modal.tsx`: every release, newest first. */
|
|
92
|
+
.patch-notes {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 18px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.patch-notes__release + .patch-notes__release {
|
|
99
|
+
padding-top: 18px;
|
|
100
|
+
border-top: 1px solid var(--color-border);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.patch-notes__title {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: baseline;
|
|
106
|
+
gap: 10px;
|
|
107
|
+
margin: 0;
|
|
108
|
+
font-size: 15px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.patch-notes__version {
|
|
112
|
+
font-size: 12px;
|
|
113
|
+
font-weight: 400;
|
|
114
|
+
color: var(--color-text-secondary);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.patch-notes__summary {
|
|
118
|
+
margin: 6px 0 0;
|
|
119
|
+
font-size: 13px;
|
|
120
|
+
color: var(--color-text-secondary);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.patch-notes__section {
|
|
124
|
+
margin: 12px 0 4px;
|
|
125
|
+
font-size: 12px;
|
|
126
|
+
text-transform: uppercase;
|
|
127
|
+
letter-spacing: 0.04em;
|
|
128
|
+
color: var(--color-text-secondary);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.patch-notes__bullets {
|
|
132
|
+
margin: 0;
|
|
133
|
+
padding-left: 18px;
|
|
134
|
+
font-size: 13px;
|
|
135
|
+
line-height: 1.45;
|
|
136
|
+
color: var(--color-text-secondary);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.patch-notes__bullets li + li {
|
|
140
|
+
margin-top: 4px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.patch-notes__bullets strong {
|
|
144
|
+
color: var(--color-text);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* A credited name, marked as the Discord post marks it: bold, italic, underlined. */
|
|
148
|
+
.patch-notes__credit {
|
|
149
|
+
color: var(--color-text);
|
|
150
|
+
font-weight: 700;
|
|
151
|
+
font-style: italic;
|
|
152
|
+
text-decoration: underline;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
* A card as a manual gallery (`Gallery.tsx`): the arrows in its head, the page between, the dots
|
|
157
|
+
* in its foot. A page fills what the card has left and scrolls inside itself, never the card.
|
|
158
|
+
*/
|
|
159
|
+
.gallery__arrows {
|
|
160
|
+
display: inline-flex;
|
|
161
|
+
gap: 4px;
|
|
162
|
+
margin-left: auto;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.gallery__arrow {
|
|
166
|
+
width: 26px;
|
|
167
|
+
height: 26px;
|
|
168
|
+
display: inline-flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
justify-content: center;
|
|
171
|
+
padding: 0;
|
|
172
|
+
color: var(--color-text-secondary);
|
|
173
|
+
background: transparent;
|
|
174
|
+
border: 1px solid var(--color-border);
|
|
175
|
+
border-radius: 999px;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.gallery__chevron {
|
|
180
|
+
width: 14px;
|
|
181
|
+
height: 14px;
|
|
182
|
+
fill: none;
|
|
183
|
+
stroke: currentColor;
|
|
184
|
+
stroke-width: 2.25;
|
|
185
|
+
stroke-linecap: round;
|
|
186
|
+
stroke-linejoin: round;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.gallery__arrow:hover,
|
|
190
|
+
.gallery__arrow:focus-visible {
|
|
191
|
+
color: var(--color-text);
|
|
192
|
+
border-color: var(--color-text-secondary);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.gallery__page {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
min-height: 0;
|
|
199
|
+
flex: 1 1 auto;
|
|
200
|
+
overflow: hidden;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
204
|
+
.gallery__page {
|
|
205
|
+
animation: gallery-page-in 200ms ease-out;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@keyframes gallery-page-in {
|
|
210
|
+
from {
|
|
211
|
+
opacity: 0;
|
|
212
|
+
transform: translateX(8px);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.gallery__dots {
|
|
217
|
+
display: inline-flex;
|
|
218
|
+
gap: 6px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.gallery__dot {
|
|
222
|
+
width: 8px;
|
|
223
|
+
height: 8px;
|
|
224
|
+
padding: 0;
|
|
225
|
+
border: 0;
|
|
226
|
+
border-radius: 999px;
|
|
227
|
+
background: var(--color-border);
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.gallery__dot[aria-current='true'] {
|
|
232
|
+
background: var(--color-text-secondary);
|
|
233
|
+
}
|
|
@@ -1,5 +1,107 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* What the room screen draws inside the host's shell (`shell`, `shell__head`, `shell__title` and
|
|
3
|
+
* `shell__tools` are the host's): its body, its password gate, the title's skeleton and Leave.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* The room is rows, not columns, and it scrolls as one: each card a row at its content height, the
|
|
8
|
+
* host's fitted shell the one box that scrolls.
|
|
9
|
+
*/
|
|
10
|
+
.room-screen {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: stretch;
|
|
14
|
+
gap: 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* A room holding a bundled game (`BundleSlot`) gives it the rest of the screen, down to the
|
|
18
|
+
window's bottom: the game sizes its board to that box. Every other room stays rows at their
|
|
19
|
+
content height. */
|
|
20
|
+
.room-screen:has(> .room-bundle-slot) {
|
|
21
|
+
flex: 1 0 auto;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* The locked-room prompt. A direct link to a room you have the password for
|
|
25
|
+
is a valid way in: the screen asks rather than sending you to the list. */
|
|
26
|
+
.room-screen__locked {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: 10px;
|
|
31
|
+
margin: 16px 0;
|
|
32
|
+
padding: 16px;
|
|
33
|
+
border: 1px solid var(--color-border);
|
|
34
|
+
border-radius: var(--hdk-radius-lg);
|
|
35
|
+
background: var(--color-bg-card);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.room-screen__locked p {
|
|
39
|
+
flex: 1 1 100%;
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.room-screen__locked input {
|
|
44
|
+
padding: 7px 10px;
|
|
45
|
+
border: 1px solid var(--color-border-light);
|
|
46
|
+
border-radius: var(--hdk-radius);
|
|
47
|
+
background: var(--color-bg-alt);
|
|
48
|
+
color: var(--color-text);
|
|
49
|
+
font: inherit;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.room-screen__locked button {
|
|
53
|
+
padding: 7px 16px;
|
|
54
|
+
border: 1px solid var(--color-border-light);
|
|
55
|
+
border-radius: var(--hdk-radius);
|
|
56
|
+
background: var(--color-bg-hover);
|
|
57
|
+
color: var(--color-text);
|
|
58
|
+
font: inherit;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.room-screen__locked button:disabled {
|
|
63
|
+
opacity: 0.45;
|
|
64
|
+
cursor: default;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* A placeholder takes the box of the thing it stands for, so the loaded room lands on the same
|
|
68
|
+
lines; a slow sheen says it is coming. A game's own placeholders add their sizes. */
|
|
69
|
+
.skeleton {
|
|
70
|
+
display: block;
|
|
71
|
+
border-radius: var(--hdk-radius);
|
|
72
|
+
background: linear-gradient(
|
|
73
|
+
90deg,
|
|
74
|
+
var(--color-bg-alt) 0%,
|
|
75
|
+
var(--color-bg-hover) 50%,
|
|
76
|
+
var(--color-bg-alt) 100%
|
|
77
|
+
);
|
|
78
|
+
background-size: 200% 100%;
|
|
79
|
+
animation: skeleton-sheen 1.6s ease-in-out infinite;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@keyframes skeleton-sheen {
|
|
83
|
+
from {
|
|
84
|
+
background-position: 100% 0;
|
|
85
|
+
}
|
|
86
|
+
to {
|
|
87
|
+
background-position: -100% 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media (prefers-reduced-motion: reduce) {
|
|
92
|
+
.skeleton {
|
|
93
|
+
animation: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* The title's line box: 28px type at the UA's normal line height. */
|
|
98
|
+
.skeleton--title {
|
|
99
|
+
width: min(16rem, 70%);
|
|
100
|
+
height: 34px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Leave, first in the room's head row, the same size as the game's own tools beside it.
|
|
104
|
+
Colour and hover are `.ct-action`'s. */
|
|
3
105
|
.room-leave {
|
|
4
106
|
flex: none;
|
|
5
107
|
align-self: flex-start;
|
|
@@ -5,7 +5,7 @@ import './RoomShell.css';
|
|
|
5
5
|
export function RoomShell({ shellRef, dataMembers, roomTitle, titleAside, settled = false, leave, leaveAsks, headerTools = null, streamed = false, streamedSubLine = null, resolved, pending = false, pendingBody = null, streamedBody = null, locked = null, password = '', onPasswordChange, onPasswordSubmit, roomMissingMessage = null, live = false, children, }) {
|
|
6
6
|
useRoomLeave(leaveAsks === undefined ? (leave ?? null) : null);
|
|
7
7
|
const home = useRoomHome();
|
|
8
|
-
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: "
|
|
8
|
+
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: "room-screen", "aria-busy": pending ? 'true' : undefined, children: [pending && pendingBody, streamed && streamedBody, !streamed && resolved && (_jsxs(_Fragment, { children: [locked !== null && (_jsxs("form", { className: "room-screen__locked ct-panel", "data-testid": "room-locked", onSubmit: (e) => {
|
|
9
9
|
e.preventDefault();
|
|
10
10
|
onPasswordSubmit?.();
|
|
11
11
|
}, 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.269",
|
|
4
|
+
"gitHead": "0d0a26aa24a3182a2ee10015ea804aaff80a0320",
|
|
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.273",
|
|
57
|
+
"@wolffm/ui-shell": "npm:@hadoku/ui-shell@0.1.273",
|
|
58
58
|
"@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.2.4",
|
|
59
59
|
"@wolffm/rooms-client": "npm:@hadoku/rooms-client@^0.45.159",
|
|
60
60
|
"@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.159",
|