@pieai/swimmer-ui-kit 3.0.0 → 3.1.0
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/CHANGELOG.md +11 -2
- package/README.md +3 -3
- package/dist/GameAvatar-CRJ1r8l5.js +920 -0
- package/dist/GameStageTile-F41PxXDG.js +687 -0
- package/dist/{LiquidGroup-BXw1tv9H.js → LiquidGroup-RTK_Uvgw.js} +845 -376
- package/dist/index.d.ts +10 -1
- package/dist/index.js +159 -159
- package/dist/liquid-effects.js +36 -37
- package/dist/liquid-presence.d.ts +48 -0
- package/dist/liquid-presence.js +584 -413
- package/dist/preview.js +132 -132
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/GameStageTile-DwU_Vvi8.js +0 -1597
- package/dist/reducedMotion-B8kv-v64.js +0 -473
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { A as e, D as t, E as n, F as r, M as i, N as a, O as o, P as s, T as c, a as l, j as u, w as d } from "./LiquidGroup-RTK_Uvgw.js";
|
|
3
|
+
import { a as f, c as p, d as m, i as h, l as g, n as _, o as v, s as y, u as b } from "./GameAvatar-CRJ1r8l5.js";
|
|
4
|
+
import { A as x, B as S, C, D as w, E as ee, F as te, G as ne, H as re, I as ie, J as ae, K as oe, L as se, M as ce, N as le, O as ue, P as de, R as T, S as E, T as D, U as O, V as k, W as A, _ as j, a as M, b as N, c as P, d as F, f as I, g as L, h as R, i as z, j as B, k as V, l as H, m as fe, n as pe, o as me, p as he, q as ge, r as _e, s as ve, t as ye, u as be, v as xe, w as Se, x as Ce, y as we, z as Te } from "./paths-B7D0h7Mh.js";
|
|
5
|
+
import { cloneElement as Ee, forwardRef as U, isValidElement as De, useId as W, useLayoutEffect as G, useRef as K, useState as q } from "react";
|
|
6
|
+
import { jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
7
|
+
//#region src/tokens/index.ts
|
|
8
|
+
var Oe = {
|
|
9
|
+
...i,
|
|
10
|
+
...r,
|
|
11
|
+
...a,
|
|
12
|
+
...e,
|
|
13
|
+
scrollbarSize: u.size,
|
|
14
|
+
scrollbarTrack: u.track,
|
|
15
|
+
scrollbarThumb: u.thumb,
|
|
16
|
+
scrollbarThumbHover: u.thumbHover,
|
|
17
|
+
...c,
|
|
18
|
+
...o,
|
|
19
|
+
...n,
|
|
20
|
+
...d,
|
|
21
|
+
...t
|
|
22
|
+
}, ke = {
|
|
23
|
+
toneAttr: "data-game-ui-tone",
|
|
24
|
+
toneGlass: "glass",
|
|
25
|
+
densityAttr: "data-game-ui-density",
|
|
26
|
+
densityCompact: "compact",
|
|
27
|
+
scopeClass: "game-ui-overlay-scope"
|
|
28
|
+
}, Ae = s, je = [
|
|
29
|
+
"--game-ui-bg",
|
|
30
|
+
"--game-ui-surface",
|
|
31
|
+
"--game-ui-surface-raised",
|
|
32
|
+
"--game-ui-surface-sunken",
|
|
33
|
+
"--game-ui-text",
|
|
34
|
+
"--game-ui-text-muted",
|
|
35
|
+
"--game-ui-accent",
|
|
36
|
+
"--game-ui-accent-bright",
|
|
37
|
+
"--game-ui-secondary",
|
|
38
|
+
"--game-ui-success",
|
|
39
|
+
"--game-ui-success-bright",
|
|
40
|
+
"--game-ui-danger",
|
|
41
|
+
"--game-ui-danger-bright",
|
|
42
|
+
"--game-ui-warning",
|
|
43
|
+
"--game-ui-focus-ring",
|
|
44
|
+
"--game-ui-border-subtle",
|
|
45
|
+
"--game-ui-border-strong",
|
|
46
|
+
"--game-ui-disabled",
|
|
47
|
+
"--game-ui-ink-deep",
|
|
48
|
+
"--game-ui-border-ink",
|
|
49
|
+
"--game-ui-wood",
|
|
50
|
+
"--game-ui-ink-title",
|
|
51
|
+
"--game-ui-ink-heading"
|
|
52
|
+
];
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/controls/GameCheckbox/GameCheckbox.tsx
|
|
55
|
+
function Me({ className: e, label: t, hue: n, ...r }) {
|
|
56
|
+
return /* @__PURE__ */ Y("label", {
|
|
57
|
+
className: ["game-ui-checkbox", e].filter(Boolean).join(" "),
|
|
58
|
+
"data-game-ui-paint": "",
|
|
59
|
+
style: v(n),
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ J(y, {}),
|
|
62
|
+
/* @__PURE__ */ J("input", {
|
|
63
|
+
className: "game-ui-checkbox-input",
|
|
64
|
+
type: "checkbox",
|
|
65
|
+
...r
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ J(p, {}),
|
|
68
|
+
/* @__PURE__ */ J("span", {
|
|
69
|
+
className: "game-ui-checkbox-label",
|
|
70
|
+
children: t
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/controls/GameField/GameField.tsx
|
|
77
|
+
function Ne({ children: e, className: t, error: n, hint: r, label: i, required: a }) {
|
|
78
|
+
return /* @__PURE__ */ Y("label", {
|
|
79
|
+
className: ["game-ui-field", t].filter(Boolean).join(" "),
|
|
80
|
+
"data-invalid": n ? "true" : void 0,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ Y("span", {
|
|
83
|
+
className: "game-ui-field-label",
|
|
84
|
+
children: [i, a ? /* @__PURE__ */ Y("span", {
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
className: "game-ui-field-required",
|
|
87
|
+
children: [" ", "*"]
|
|
88
|
+
}) : null]
|
|
89
|
+
}),
|
|
90
|
+
e,
|
|
91
|
+
r && !n ? /* @__PURE__ */ J("span", {
|
|
92
|
+
className: "game-ui-field-hint",
|
|
93
|
+
children: r
|
|
94
|
+
}) : null,
|
|
95
|
+
n ? /* @__PURE__ */ J("span", {
|
|
96
|
+
className: "game-ui-field-error",
|
|
97
|
+
role: "alert",
|
|
98
|
+
children: n
|
|
99
|
+
}) : null
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/controls/GameIconButton/GameIconButton.tsx
|
|
105
|
+
var Pe = U(function({ children: e, className: t, label: n, hue: r, size: i = "md", style: a, ...o }, s) {
|
|
106
|
+
return /* @__PURE__ */ Y(f, {
|
|
107
|
+
...o,
|
|
108
|
+
ref: s,
|
|
109
|
+
"aria-label": n,
|
|
110
|
+
className: ["game-ui-icon-button", t].filter(Boolean).join(" "),
|
|
111
|
+
"data-game-ui-paint": "",
|
|
112
|
+
"data-game-ui-size": i,
|
|
113
|
+
style: {
|
|
114
|
+
...v(r),
|
|
115
|
+
...a
|
|
116
|
+
},
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ J(y, {}),
|
|
119
|
+
e,
|
|
120
|
+
o["aria-pressed"] === void 0 ? null : /* @__PURE__ */ J(p, {})
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
}), Fe = U(function({ className: e, invalid: t, hue: n, type: r = "text", ...i }, a) {
|
|
124
|
+
return /* @__PURE__ */ J("input", {
|
|
125
|
+
className: ["game-ui-input", e].filter(Boolean).join(" "),
|
|
126
|
+
"data-invalid": t ? "true" : void 0,
|
|
127
|
+
ref: a,
|
|
128
|
+
type: r,
|
|
129
|
+
...i,
|
|
130
|
+
style: {
|
|
131
|
+
...v(n),
|
|
132
|
+
...i.style
|
|
133
|
+
},
|
|
134
|
+
"aria-invalid": i["aria-invalid"] ?? (t || void 0),
|
|
135
|
+
"data-game-ui-paint": ""
|
|
136
|
+
});
|
|
137
|
+
}), X = {
|
|
138
|
+
ai: ye,
|
|
139
|
+
alert: pe,
|
|
140
|
+
card: M,
|
|
141
|
+
chat: me,
|
|
142
|
+
check: ve,
|
|
143
|
+
close: be,
|
|
144
|
+
coin: F,
|
|
145
|
+
compass: I,
|
|
146
|
+
copy: he,
|
|
147
|
+
crown: fe,
|
|
148
|
+
energy: L,
|
|
149
|
+
gem: xe,
|
|
150
|
+
gift: we,
|
|
151
|
+
globe: N,
|
|
152
|
+
history: Ce,
|
|
153
|
+
redo: ie,
|
|
154
|
+
undo: oe,
|
|
155
|
+
home: E,
|
|
156
|
+
hourglass: C,
|
|
157
|
+
laurel: Se,
|
|
158
|
+
lock: D,
|
|
159
|
+
lucky: ee,
|
|
160
|
+
mail: w,
|
|
161
|
+
medal: ue,
|
|
162
|
+
mission: B,
|
|
163
|
+
mobile: ce,
|
|
164
|
+
portal: te,
|
|
165
|
+
scroll: se,
|
|
166
|
+
settings: Te,
|
|
167
|
+
shirt: S,
|
|
168
|
+
shop: k,
|
|
169
|
+
smile: re,
|
|
170
|
+
timer: A,
|
|
171
|
+
trophy: ne,
|
|
172
|
+
vote: ae,
|
|
173
|
+
"arrow-left": _e,
|
|
174
|
+
"arrow-right": z,
|
|
175
|
+
"chevron-down": P,
|
|
176
|
+
"chevron-up": H,
|
|
177
|
+
download: R,
|
|
178
|
+
external: j,
|
|
179
|
+
menu: V,
|
|
180
|
+
minus: x,
|
|
181
|
+
moon: le,
|
|
182
|
+
plus: de,
|
|
183
|
+
search: T,
|
|
184
|
+
sun: O,
|
|
185
|
+
user: ge
|
|
186
|
+
}, Ie = Object.keys(X);
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/icons/GameIcon/GameIcon.tsx
|
|
189
|
+
function Z({ icon: e, size: t = "md", label: n, className: r, ...i }) {
|
|
190
|
+
let a = typeof e == "string" ? X[e] : e, o = {
|
|
191
|
+
sm: 16,
|
|
192
|
+
md: 20,
|
|
193
|
+
lg: 24
|
|
194
|
+
}[t];
|
|
195
|
+
return /* @__PURE__ */ J("svg", {
|
|
196
|
+
...i,
|
|
197
|
+
className: ["game-ui-icon", r].filter(Boolean).join(" "),
|
|
198
|
+
viewBox: "0 0 24 24",
|
|
199
|
+
width: o,
|
|
200
|
+
height: o,
|
|
201
|
+
fill: "none",
|
|
202
|
+
stroke: "currentColor",
|
|
203
|
+
strokeWidth: 2,
|
|
204
|
+
strokeLinecap: "round",
|
|
205
|
+
strokeLinejoin: "round",
|
|
206
|
+
focusable: "false",
|
|
207
|
+
role: n ? "img" : void 0,
|
|
208
|
+
"aria-label": n || void 0,
|
|
209
|
+
"aria-hidden": !n || void 0,
|
|
210
|
+
"data-icon": a.name,
|
|
211
|
+
"data-icon-size": t,
|
|
212
|
+
children: a.paths.map((e, t) => /* @__PURE__ */ J("path", { d: e }, t))
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/controls/GameLanguageMenu/GameLanguageMenu.tsx
|
|
217
|
+
function Le({ className: e, currentLabel: t, label: n, options: r, value: i, defaultValue: a, onSelect: o }) {
|
|
218
|
+
let [s, c] = q(!1), [l, u] = q(a ?? r[0]?.id ?? ""), d = W(), f = ["game-ui-language-menu", e].filter(Boolean).join(" "), m = i ?? l, h = r.find((e) => e.id === m), g = t ?? h?.label ?? r[0]?.label ?? "", _ = (e) => {
|
|
219
|
+
i === void 0 && u(e), o?.(e), c(!1);
|
|
220
|
+
};
|
|
221
|
+
return /* @__PURE__ */ Y("div", {
|
|
222
|
+
className: f,
|
|
223
|
+
children: [/* @__PURE__ */ Y("button", {
|
|
224
|
+
"aria-controls": d,
|
|
225
|
+
"aria-expanded": s,
|
|
226
|
+
className: "game-ui-language-trigger",
|
|
227
|
+
onClick: () => c((e) => !e),
|
|
228
|
+
type: "button",
|
|
229
|
+
"data-game-ui-paint": "",
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ J(y, {}),
|
|
232
|
+
/* @__PURE__ */ J(Z, {
|
|
233
|
+
icon: "globe",
|
|
234
|
+
size: "sm"
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ J("span", { children: g })
|
|
237
|
+
]
|
|
238
|
+
}), s ? /* @__PURE__ */ J("div", {
|
|
239
|
+
"aria-label": n,
|
|
240
|
+
className: "game-ui-language-popover",
|
|
241
|
+
id: d,
|
|
242
|
+
role: "menu",
|
|
243
|
+
children: r.map((e) => /* @__PURE__ */ Y("button", {
|
|
244
|
+
"aria-checked": e.id === m,
|
|
245
|
+
"data-selected": e.id === m,
|
|
246
|
+
onClick: () => _(e.id),
|
|
247
|
+
role: "menuitemradio",
|
|
248
|
+
type: "button",
|
|
249
|
+
"data-game-ui-paint": "",
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ J(y, {}),
|
|
252
|
+
/* @__PURE__ */ Y("span", { children: [/* @__PURE__ */ J("strong", { children: e.label }), /* @__PURE__ */ J("small", { children: e.meta })] }),
|
|
253
|
+
/* @__PURE__ */ J(p, {})
|
|
254
|
+
]
|
|
255
|
+
}, e.id))
|
|
256
|
+
}) : null]
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/controls/GameSegmentedControl/GameSegmentedControl.tsx
|
|
261
|
+
function Re({ activeId: e, label: t, onSelect: n, options: r, disabled: i, hue: a }) {
|
|
262
|
+
return /* @__PURE__ */ J("div", {
|
|
263
|
+
"aria-label": t,
|
|
264
|
+
className: "game-ui-segmented",
|
|
265
|
+
role: "group",
|
|
266
|
+
children: r.map((t) => /* @__PURE__ */ Y("button", {
|
|
267
|
+
type: "button",
|
|
268
|
+
className: "game-ui-segmented-option",
|
|
269
|
+
"aria-pressed": t.id === e,
|
|
270
|
+
disabled: i,
|
|
271
|
+
onClick: n ? () => n(t.id) : void 0,
|
|
272
|
+
"data-game-ui-paint": "",
|
|
273
|
+
style: v(t.hue ?? a),
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ J(y, {}),
|
|
276
|
+
/* @__PURE__ */ J("span", { children: t.label }),
|
|
277
|
+
/* @__PURE__ */ J(p, {})
|
|
278
|
+
]
|
|
279
|
+
}, t.id))
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/controls/GameSlider/GameSlider.tsx
|
|
284
|
+
function ze({ label: e, max: t, min: n, step: r, disabled: i, name: a, id: o, onChange: s, value: c }) {
|
|
285
|
+
return /* @__PURE__ */ Y("label", {
|
|
286
|
+
className: "game-ui-slider",
|
|
287
|
+
children: [/* @__PURE__ */ J("span", { children: e }), /* @__PURE__ */ J("input", {
|
|
288
|
+
"aria-label": e,
|
|
289
|
+
max: t,
|
|
290
|
+
min: n,
|
|
291
|
+
step: r,
|
|
292
|
+
disabled: i,
|
|
293
|
+
name: a,
|
|
294
|
+
id: o,
|
|
295
|
+
onChange: s ? (e) => s(Number(e.currentTarget.value)) : void 0,
|
|
296
|
+
readOnly: !s,
|
|
297
|
+
type: "range",
|
|
298
|
+
value: c,
|
|
299
|
+
"data-game-ui-paint": ""
|
|
300
|
+
})]
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
//#endregion
|
|
304
|
+
//#region src/controls/GameTextArea/GameTextArea.tsx
|
|
305
|
+
var Be = U(function({ className: e, invalid: t, hue: n, rows: r = 3, ...i }, a) {
|
|
306
|
+
return /* @__PURE__ */ J("textarea", {
|
|
307
|
+
className: [
|
|
308
|
+
"game-ui-input",
|
|
309
|
+
"game-ui-textarea",
|
|
310
|
+
e
|
|
311
|
+
].filter(Boolean).join(" "),
|
|
312
|
+
"data-invalid": t ? "true" : void 0,
|
|
313
|
+
ref: a,
|
|
314
|
+
rows: r,
|
|
315
|
+
...i,
|
|
316
|
+
style: {
|
|
317
|
+
...v(n),
|
|
318
|
+
...i.style
|
|
319
|
+
},
|
|
320
|
+
"aria-invalid": i["aria-invalid"] ?? (t || void 0),
|
|
321
|
+
"data-game-ui-paint": ""
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/controls/GameToggle/GameToggle.tsx
|
|
326
|
+
function Ve({ checked: e, disabled: t, label: n, onClick: r, hue: i }) {
|
|
327
|
+
return /* @__PURE__ */ Y("button", {
|
|
328
|
+
type: "button",
|
|
329
|
+
className: "game-ui-toggle",
|
|
330
|
+
role: "switch",
|
|
331
|
+
"aria-checked": e,
|
|
332
|
+
disabled: t,
|
|
333
|
+
onClick: r,
|
|
334
|
+
"data-game-ui-paint": "",
|
|
335
|
+
style: v(i),
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ J(y, {}),
|
|
338
|
+
/* @__PURE__ */ J("span", { children: n }),
|
|
339
|
+
/* @__PURE__ */ J(p, {}),
|
|
340
|
+
/* @__PURE__ */ J("span", {
|
|
341
|
+
className: "game-ui-toggle-track",
|
|
342
|
+
"aria-hidden": "true",
|
|
343
|
+
children: /* @__PURE__ */ J("span", { className: "game-ui-toggle-thumb" })
|
|
344
|
+
})
|
|
345
|
+
]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/feedback/GameEmptyState/GameEmptyState.tsx
|
|
350
|
+
function He({ action: e, className: t, description: n, icon: r, title: i }) {
|
|
351
|
+
return /* @__PURE__ */ Y("div", {
|
|
352
|
+
className: ["game-ui-empty-state", t].filter(Boolean).join(" "),
|
|
353
|
+
children: [
|
|
354
|
+
r ? /* @__PURE__ */ J(Z, {
|
|
355
|
+
icon: r,
|
|
356
|
+
size: "lg"
|
|
357
|
+
}) : null,
|
|
358
|
+
/* @__PURE__ */ J("strong", {
|
|
359
|
+
className: "game-ui-empty-state-title",
|
|
360
|
+
children: i
|
|
361
|
+
}),
|
|
362
|
+
n ? /* @__PURE__ */ J("p", {
|
|
363
|
+
className: "game-ui-empty-state-body",
|
|
364
|
+
children: n
|
|
365
|
+
}) : null,
|
|
366
|
+
e ? /* @__PURE__ */ J("div", {
|
|
367
|
+
className: "game-ui-empty-state-action",
|
|
368
|
+
children: e
|
|
369
|
+
}) : null
|
|
370
|
+
]
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/feedback/GameLoadingState/GameLoadingState.tsx
|
|
375
|
+
function Q({ label: e, tone: t = "loading" }) {
|
|
376
|
+
return /* @__PURE__ */ Y("div", {
|
|
377
|
+
className: "game-ui-loading-state",
|
|
378
|
+
"data-loading-tone": t,
|
|
379
|
+
role: t === "error" ? "alert" : "status",
|
|
380
|
+
children: [/* @__PURE__ */ J(Z, {
|
|
381
|
+
icon: t === "error" ? "alert" : "timer",
|
|
382
|
+
size: "lg"
|
|
383
|
+
}), /* @__PURE__ */ J("span", { children: e })]
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/feedback/GameProgress/geometry.ts
|
|
388
|
+
function $(e, t, n = 0, r = 4) {
|
|
389
|
+
let i = Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 0, a = Number.isFinite(e) ? Math.max(1, e) : 1, o = r, s = o + 10;
|
|
390
|
+
if (i === 0) return "M0 0Z";
|
|
391
|
+
if (i === 1) return `M0 0H${a + 2 * o}V${s + o}H0Z`;
|
|
392
|
+
let c = o + i * a, l = Math.min(1.2, i * a * .3), u = Math.min(1.4, Math.max(-1.4, Number.isFinite(n) ? n : 0)), d = (e) => Math.round(e * 1e3) / 1e3;
|
|
393
|
+
return `M0 0H${d(c)}V${o}C${d(c - l + u)} ${o + 2} ${d(c - l - u)} ${s - 2} ${d(c)} ${s}V${s + o}H0Z`;
|
|
394
|
+
}
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/feedback/GameProgress/controller.ts
|
|
397
|
+
function Ue(e, t, n, r) {
|
|
398
|
+
let i = e.parentElement, a = e.querySelector("[data-progress-track]"), o = e.querySelector("[data-progress-clip]"), s = e.querySelector("[data-progress-front]"), c = 0, l = n, u = n, d = n, f, p = 0, m = !1, h = (e, t) => {
|
|
399
|
+
e.getAttribute("d") !== t && e.setAttribute("d", t);
|
|
400
|
+
}, _ = (e = 0) => h(s, $(c || 100, l, e)), v = () => {
|
|
401
|
+
f !== void 0 && cancelAnimationFrame(f), f = void 0;
|
|
402
|
+
}, y = () => {
|
|
403
|
+
v(), l = u, _(), e.dataset.progressMotion = "static";
|
|
404
|
+
}, x = () => {
|
|
405
|
+
let n = Number.parseFloat(getComputedStyle(i).width) || i.clientWidth;
|
|
406
|
+
if (!n || n === c) return;
|
|
407
|
+
c = n, e.setAttribute("viewBox", `0 0 ${c + 8} 18`);
|
|
408
|
+
let r = b(g(c, 10, 5), 1, 0, t, 4);
|
|
409
|
+
h(a, r), h(o, r), e.dataset.progressReady = "true", _(), f === void 0 && (e.dataset.progressMotion = "static");
|
|
410
|
+
}, S = (t) => {
|
|
411
|
+
if (f = void 0, m) return;
|
|
412
|
+
if (document.hidden || !e.isConnected) {
|
|
413
|
+
y();
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
let n = Math.min(1, Math.max(0, (t - p) / 600));
|
|
417
|
+
l = d + (u - d) * (1 - (1 - n) ** 3), _(Math.sin(n * Math.PI * 6) * (1 - n) * 1.4 * Math.sign(u - d)), n < 1 ? f = requestAnimationFrame(S) : y();
|
|
418
|
+
}, C = () => {
|
|
419
|
+
document.hidden && y();
|
|
420
|
+
};
|
|
421
|
+
x();
|
|
422
|
+
let w = new ResizeObserver(x);
|
|
423
|
+
return w.observe(i), document.addEventListener("visibilitychange", C), {
|
|
424
|
+
update(t) {
|
|
425
|
+
let n = Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 0;
|
|
426
|
+
if (n !== u) {
|
|
427
|
+
if (v(), d = l, u = n, !r || document.hidden) {
|
|
428
|
+
y();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
e.dataset.progressMotion = "moving", p = performance.now(), f = requestAnimationFrame(S);
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
dispose() {
|
|
435
|
+
m = !0, v(), w.disconnect(), document.removeEventListener("visibilitychange", C);
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/feedback/GameProgress/GameProgress.tsx
|
|
441
|
+
function We({ value: e, max: t = 100, label: n, showValue: r = !1, valueLabel: i, className: a }) {
|
|
442
|
+
let o = !Number.isFinite(t) || t <= 0 ? 100 : t, s = Math.max(0, Math.min(o, Number.isFinite(e) ? e : 0)), c = s / o, u = c * 100, d = `progress-${W().replace(/[^a-zA-Z0-9_-]/g, "")}`, f = l(), p = K(null), h = K(null), _ = K(c).current, v = K(c);
|
|
443
|
+
v.current = c, G(() => {
|
|
444
|
+
if (!p.current) return;
|
|
445
|
+
let e = Ue(p.current, m(d), v.current, !f);
|
|
446
|
+
return h.current = e, () => {
|
|
447
|
+
e.dispose(), h.current = null;
|
|
448
|
+
};
|
|
449
|
+
}, [d, f]), G(() => h.current?.update(c), [c, f]);
|
|
450
|
+
let y = b(g(100, 10, 5), 1, 0, m(d), 4);
|
|
451
|
+
return /* @__PURE__ */ Y("div", {
|
|
452
|
+
className: ["game-ui-progress", a].filter(Boolean).join(" "),
|
|
453
|
+
children: [/* @__PURE__ */ J("div", {
|
|
454
|
+
role: "progressbar",
|
|
455
|
+
"aria-label": n,
|
|
456
|
+
"aria-valuemin": 0,
|
|
457
|
+
"aria-valuemax": o,
|
|
458
|
+
"aria-valuenow": s,
|
|
459
|
+
"aria-valuetext": i || void 0,
|
|
460
|
+
className: "game-ui-progress-track",
|
|
461
|
+
children: /* @__PURE__ */ Y("svg", {
|
|
462
|
+
ref: p,
|
|
463
|
+
viewBox: "0 0 108 18",
|
|
464
|
+
preserveAspectRatio: "none",
|
|
465
|
+
"aria-hidden": "true",
|
|
466
|
+
focusable: "false",
|
|
467
|
+
children: [
|
|
468
|
+
/* @__PURE__ */ Y("defs", { children: [/* @__PURE__ */ J("clipPath", {
|
|
469
|
+
id: `${d}-clip`,
|
|
470
|
+
children: /* @__PURE__ */ J("path", {
|
|
471
|
+
"data-progress-clip": "",
|
|
472
|
+
d: y
|
|
473
|
+
})
|
|
474
|
+
}), /* @__PURE__ */ Y("linearGradient", {
|
|
475
|
+
id: `${d}-fill`,
|
|
476
|
+
children: [/* @__PURE__ */ J("stop", {
|
|
477
|
+
offset: "0%",
|
|
478
|
+
style: { stopColor: "var(--game-ui-cta-from)" }
|
|
479
|
+
}), /* @__PURE__ */ J("stop", {
|
|
480
|
+
offset: "100%",
|
|
481
|
+
style: { stopColor: "var(--game-ui-cta-to)" }
|
|
482
|
+
})]
|
|
483
|
+
})] }),
|
|
484
|
+
/* @__PURE__ */ J("path", {
|
|
485
|
+
"data-progress-track": "",
|
|
486
|
+
d: y
|
|
487
|
+
}),
|
|
488
|
+
/* @__PURE__ */ J("path", {
|
|
489
|
+
"data-progress-front": "",
|
|
490
|
+
d: $(100, _),
|
|
491
|
+
clipPath: `url(#${d}-clip)`,
|
|
492
|
+
fill: `url(#${d}-fill)`
|
|
493
|
+
})
|
|
494
|
+
]
|
|
495
|
+
})
|
|
496
|
+
}), i || r ? /* @__PURE__ */ J("span", {
|
|
497
|
+
className: "game-ui-progress-value",
|
|
498
|
+
children: i || `${Math.round(u)}%`
|
|
499
|
+
}) : null]
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region src/feedback/GameToast/GameToast.tsx
|
|
504
|
+
function Ge({ children: e, tone: t = "info" }) {
|
|
505
|
+
return /* @__PURE__ */ Y("div", {
|
|
506
|
+
className: "game-ui-toast",
|
|
507
|
+
"data-toast-tone": t,
|
|
508
|
+
"data-game-ui-paint": "",
|
|
509
|
+
"data-game-ui-meaning": t === "success" ? "true" : void 0,
|
|
510
|
+
"data-game-ui-danger": t === "danger" ? "true" : void 0,
|
|
511
|
+
style: v(t === "success" ? "leaf" : "sky"),
|
|
512
|
+
role: t === "danger" ? "alert" : "status",
|
|
513
|
+
children: [/* @__PURE__ */ J(y, { static: !0 }), e]
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/feedback/GameTooltip/GameTooltip.tsx
|
|
518
|
+
function Ke({ children: e, label: t, align: n = "center", placement: r = "top" }) {
|
|
519
|
+
let i = W();
|
|
520
|
+
return /* @__PURE__ */ Y("span", {
|
|
521
|
+
className: "game-ui-tooltip",
|
|
522
|
+
children: [De(e) ? Ee(e, { "aria-describedby": [e.props["aria-describedby"], i].filter(Boolean).join(" ") }) : e, /* @__PURE__ */ Y("span", {
|
|
523
|
+
id: i,
|
|
524
|
+
role: "tooltip",
|
|
525
|
+
"data-game-ui-paint": "",
|
|
526
|
+
"data-tooltip-align": n,
|
|
527
|
+
"data-tooltip-placement": r,
|
|
528
|
+
children: [/* @__PURE__ */ J(y, { static: !0 }), t]
|
|
529
|
+
})]
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/containers/GameDialog/GameDialog.tsx
|
|
534
|
+
function qe({ children: e, className: t, title: n }) {
|
|
535
|
+
let r = W();
|
|
536
|
+
return /* @__PURE__ */ Y("section", {
|
|
537
|
+
"aria-labelledby": r,
|
|
538
|
+
"aria-modal": "true",
|
|
539
|
+
className: ["game-ui-dialog", t].filter(Boolean).join(" "),
|
|
540
|
+
role: "dialog",
|
|
541
|
+
children: [/* @__PURE__ */ J("h2", {
|
|
542
|
+
id: r,
|
|
543
|
+
children: n
|
|
544
|
+
}), /* @__PURE__ */ J("div", {
|
|
545
|
+
className: "game-ui-dialog-body",
|
|
546
|
+
children: e
|
|
547
|
+
})]
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region src/containers/GameHistoryPanel/GameHistoryPanel.tsx
|
|
552
|
+
function Je({ entries: e, label: t }) {
|
|
553
|
+
return /* @__PURE__ */ J("section", {
|
|
554
|
+
"aria-label": t,
|
|
555
|
+
className: "game-ui-history",
|
|
556
|
+
children: e.map((e) => /* @__PURE__ */ Y("article", {
|
|
557
|
+
className: "game-ui-history-entry",
|
|
558
|
+
"data-entry-kind": e.kind,
|
|
559
|
+
children: [/* @__PURE__ */ Y("div", {
|
|
560
|
+
className: "game-ui-history-entry-header",
|
|
561
|
+
children: [/* @__PURE__ */ J("strong", { children: e.speaker }), /* @__PURE__ */ J("span", { children: e.meta })]
|
|
562
|
+
}), /* @__PURE__ */ J("p", { children: e.text })]
|
|
563
|
+
}, e.id))
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region src/containers/GameHudActions/GameHudActions.tsx
|
|
568
|
+
function Ye({ children: e, className: t, label: n, ...r }) {
|
|
569
|
+
return /* @__PURE__ */ J("nav", {
|
|
570
|
+
"aria-label": n,
|
|
571
|
+
className: ["game-ui-hud-actions", t].filter(Boolean).join(" "),
|
|
572
|
+
"data-safe-area": "hud-actions",
|
|
573
|
+
...r,
|
|
574
|
+
children: e
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region src/containers/GamePanel/GamePanel.tsx
|
|
579
|
+
function Xe({ children: e, className: t, title: n, tone: r = "default", ...i }) {
|
|
580
|
+
let a = ["game-ui-panel", t].filter(Boolean).join(" ");
|
|
581
|
+
return /* @__PURE__ */ Y("section", {
|
|
582
|
+
...i,
|
|
583
|
+
className: a,
|
|
584
|
+
"data-panel-tone": r,
|
|
585
|
+
children: [n ? /* @__PURE__ */ J("h3", { children: n }) : null, e]
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/game/FirstSessionOnboarding/FirstSessionOnboarding.tsx
|
|
590
|
+
function Ze({ labels: e, onDismiss: t, open: n }) {
|
|
591
|
+
return n ? /* @__PURE__ */ Y("aside", {
|
|
592
|
+
"aria-labelledby": "swimmer-first-session-onboarding-title",
|
|
593
|
+
"aria-modal": "true",
|
|
594
|
+
className: "swimmer-first-session-onboarding",
|
|
595
|
+
role: "dialog",
|
|
596
|
+
children: [/* @__PURE__ */ J("div", { className: "swimmer-first-session-onboarding-scrim" }), /* @__PURE__ */ Y("div", {
|
|
597
|
+
className: "swimmer-first-session-onboarding-card",
|
|
598
|
+
children: [
|
|
599
|
+
/* @__PURE__ */ J(Z, {
|
|
600
|
+
icon: "trophy",
|
|
601
|
+
size: "lg"
|
|
602
|
+
}),
|
|
603
|
+
/* @__PURE__ */ J(_, {
|
|
604
|
+
tone: "warning",
|
|
605
|
+
children: e.badge
|
|
606
|
+
}),
|
|
607
|
+
/* @__PURE__ */ J("h2", {
|
|
608
|
+
id: "swimmer-first-session-onboarding-title",
|
|
609
|
+
children: e.title
|
|
610
|
+
}),
|
|
611
|
+
/* @__PURE__ */ J("p", { children: e.body }),
|
|
612
|
+
/* @__PURE__ */ J("ol", {
|
|
613
|
+
className: "swimmer-first-session-onboarding-steps",
|
|
614
|
+
children: e.steps.map((e, t) => /* @__PURE__ */ Y("li", { children: [
|
|
615
|
+
/* @__PURE__ */ J("span", { children: String(t + 1).padStart(2, "0") }),
|
|
616
|
+
/* @__PURE__ */ J("strong", { children: e.title }),
|
|
617
|
+
/* @__PURE__ */ J("small", { children: e.body })
|
|
618
|
+
] }, e.title))
|
|
619
|
+
}),
|
|
620
|
+
/* @__PURE__ */ Y("div", {
|
|
621
|
+
className: "swimmer-first-session-onboarding-actions",
|
|
622
|
+
children: [/* @__PURE__ */ J(h, {
|
|
623
|
+
onClick: t,
|
|
624
|
+
variant: "primary",
|
|
625
|
+
children: e.start
|
|
626
|
+
}), /* @__PURE__ */ J(h, {
|
|
627
|
+
onClick: t,
|
|
628
|
+
variant: "ghost",
|
|
629
|
+
children: e.skip
|
|
630
|
+
})]
|
|
631
|
+
})
|
|
632
|
+
]
|
|
633
|
+
})]
|
|
634
|
+
}) : null;
|
|
635
|
+
}
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region src/game/GameRadialMenu/GameRadialMenu.tsx
|
|
638
|
+
function Qe({ items: e, label: t, onSelect: n }) {
|
|
639
|
+
return /* @__PURE__ */ J("div", {
|
|
640
|
+
"aria-label": t,
|
|
641
|
+
className: "game-ui-radial-menu",
|
|
642
|
+
role: "group",
|
|
643
|
+
style: { "--radial-count": e.length },
|
|
644
|
+
children: e.map((e, t) => /* @__PURE__ */ Y("button", {
|
|
645
|
+
className: "game-ui-radial-item",
|
|
646
|
+
onClick: n ? () => n(e.id) : void 0,
|
|
647
|
+
style: { "--radial-index": t },
|
|
648
|
+
type: "button",
|
|
649
|
+
"data-game-ui-paint": "",
|
|
650
|
+
children: [/* @__PURE__ */ J(y, {}), e.label]
|
|
651
|
+
}, e.id))
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region src/game/GameStageTile/GameStageTile.tsx
|
|
656
|
+
function $e({ badge: e, className: t, icon: n, kicker: r, selected: i = !1, summary: a, title: o, tone: s = "daily", type: c = "button", ...l }) {
|
|
657
|
+
return /* @__PURE__ */ Y("button", {
|
|
658
|
+
"aria-pressed": i,
|
|
659
|
+
className: ["game-ui-stage-tile", t].filter(Boolean).join(" "),
|
|
660
|
+
"data-stage-tone": s,
|
|
661
|
+
type: c,
|
|
662
|
+
...l,
|
|
663
|
+
"data-game-ui-paint": "",
|
|
664
|
+
children: [
|
|
665
|
+
/* @__PURE__ */ J(y, {}),
|
|
666
|
+
n ? /* @__PURE__ */ J(Z, {
|
|
667
|
+
icon: n,
|
|
668
|
+
size: "lg"
|
|
669
|
+
}) : null,
|
|
670
|
+
/* @__PURE__ */ Y("span", {
|
|
671
|
+
className: "game-ui-stage-tile-copy",
|
|
672
|
+
children: [
|
|
673
|
+
/* @__PURE__ */ J("small", { children: r }),
|
|
674
|
+
/* @__PURE__ */ J("strong", { children: o }),
|
|
675
|
+
/* @__PURE__ */ J("span", { children: a })
|
|
676
|
+
]
|
|
677
|
+
}),
|
|
678
|
+
e ? /* @__PURE__ */ J(_, {
|
|
679
|
+
tone: i ? "success" : "neutral",
|
|
680
|
+
children: e
|
|
681
|
+
}) : null,
|
|
682
|
+
/* @__PURE__ */ J(p, {})
|
|
683
|
+
]
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
//#endregion
|
|
687
|
+
export { Me as C, Oe as D, je as E, Ne as S, Ae as T, Le as _, Ye as a, Fe as b, Ke as c, Q as d, He as f, Re as g, ze as h, Xe as i, Ge as l, Be as m, Qe as n, Je as o, Ve as p, Ze as r, qe as s, $e as t, We as u, Z as v, ke as w, Pe as x, Ie as y };
|