@flare-engine/ui 0.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/dist/index.js ADDED
@@ -0,0 +1,760 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Button: () => Button,
24
+ DialoguePanel: () => DialoguePanel,
25
+ FocusContext: () => FocusContext,
26
+ FocusProvider: () => FocusProvider,
27
+ HUDBar: () => HUDBar,
28
+ Label: () => Label,
29
+ List: () => List,
30
+ MainMenuKit: () => MainMenuKit,
31
+ Modal: () => Modal,
32
+ Panel: () => Panel,
33
+ ProgressBar: () => ProgressBar,
34
+ ShopPanel: () => ShopPanel,
35
+ ThemeProvider: () => ThemeProvider,
36
+ createFocusManager: () => createFocusManager,
37
+ darkTheme: () => darkTheme,
38
+ lightTheme: () => lightTheme,
39
+ resolveLayout: () => resolveLayout,
40
+ useFocusManager: () => useFocusManager,
41
+ useTheme: () => useTheme
42
+ });
43
+ module.exports = __toCommonJS(index_exports);
44
+
45
+ // src/theme.ts
46
+ var import_react = require("react");
47
+ var darkTheme = {
48
+ name: "dark",
49
+ colors: {
50
+ bg: "#0b0d10",
51
+ surface: "#14181d",
52
+ surfaceAlt: "#1d232b",
53
+ border: "#2a323c",
54
+ text: "#e7ecf1",
55
+ textMuted: "#8c96a3",
56
+ accent: "#4aa3ff",
57
+ accentText: "#0b0d10",
58
+ danger: "#ff5c5c",
59
+ success: "#5dd39e",
60
+ warning: "#f1c40f",
61
+ focus: "#ffd166"
62
+ },
63
+ spacing: { xs: 4, sm: 8, md: 12, lg: 20, xl: 32 },
64
+ typography: {
65
+ sizeXs: 10,
66
+ sizeSm: 12,
67
+ sizeMd: 14,
68
+ sizeLg: 18,
69
+ sizeXl: 24
70
+ },
71
+ radii: { none: 0, sm: 4, md: 8, lg: 16, pill: 9999 }
72
+ };
73
+ var lightTheme = {
74
+ name: "light",
75
+ colors: {
76
+ bg: "#f6f8fa",
77
+ surface: "#ffffff",
78
+ surfaceAlt: "#eef1f4",
79
+ border: "#d4dae0",
80
+ text: "#13181d",
81
+ textMuted: "#5b6670",
82
+ accent: "#0a66d0",
83
+ accentText: "#ffffff",
84
+ danger: "#d12e2e",
85
+ success: "#2f9d69",
86
+ warning: "#c79600",
87
+ focus: "#ff9500"
88
+ },
89
+ spacing: { xs: 4, sm: 8, md: 12, lg: 20, xl: 32 },
90
+ typography: {
91
+ sizeXs: 10,
92
+ sizeSm: 12,
93
+ sizeMd: 14,
94
+ sizeLg: 18,
95
+ sizeXl: 24
96
+ },
97
+ radii: { none: 0, sm: 4, md: 8, lg: 16, pill: 9999 }
98
+ };
99
+ var ThemeContext = (0, import_react.createContext)(darkTheme);
100
+ function ThemeProvider({ theme = darkTheme, children }) {
101
+ return (0, import_react.createElement)(ThemeContext.Provider, { value: theme }, children);
102
+ }
103
+ function useTheme() {
104
+ return (0, import_react.useContext)(ThemeContext);
105
+ }
106
+
107
+ // src/focus.ts
108
+ function createFocusManager() {
109
+ const nodes = /* @__PURE__ */ new Map();
110
+ let seqCounter = 0;
111
+ let focusedId = null;
112
+ const listeners = /* @__PURE__ */ new Set();
113
+ function notify() {
114
+ for (const l of listeners) l(focusedId);
115
+ }
116
+ function orderedIds() {
117
+ const entries = Array.from(nodes.values()).filter((e) => !e.disabled);
118
+ entries.sort((a, b) => {
119
+ if (a.tabIndex !== b.tabIndex) return a.tabIndex - b.tabIndex;
120
+ return a.seq - b.seq;
121
+ });
122
+ return entries.map((e) => e.id);
123
+ }
124
+ function setFocused(next) {
125
+ if (next === focusedId) return;
126
+ const prev = focusedId;
127
+ focusedId = next;
128
+ if (prev !== null) nodes.get(prev)?.onBlur?.();
129
+ if (next !== null) nodes.get(next)?.onFocus?.();
130
+ notify();
131
+ }
132
+ function move(delta) {
133
+ const order = orderedIds();
134
+ if (order.length === 0) {
135
+ setFocused(null);
136
+ return;
137
+ }
138
+ if (focusedId === null) {
139
+ setFocused(delta === 1 ? order[0] ?? null : order[order.length - 1] ?? null);
140
+ return;
141
+ }
142
+ const idx = order.indexOf(focusedId);
143
+ if (idx === -1) {
144
+ setFocused(order[0] ?? null);
145
+ return;
146
+ }
147
+ const nextIdx = (idx + delta + order.length) % order.length;
148
+ setFocused(order[nextIdx] ?? null);
149
+ }
150
+ return {
151
+ register(node) {
152
+ const entry = { ...node, seq: seqCounter++ };
153
+ nodes.set(node.id, entry);
154
+ if (focusedId === null && !node.disabled) {
155
+ setFocused(node.id);
156
+ }
157
+ return () => {
158
+ this.unregister(node.id);
159
+ };
160
+ },
161
+ unregister(id) {
162
+ if (!nodes.has(id)) return;
163
+ nodes.delete(id);
164
+ if (focusedId === id) {
165
+ const order = orderedIds();
166
+ setFocused(order[0] ?? null);
167
+ }
168
+ },
169
+ focus(id) {
170
+ const entry = nodes.get(id);
171
+ if (!entry || entry.disabled) return;
172
+ setFocused(id);
173
+ },
174
+ blur() {
175
+ setFocused(null);
176
+ },
177
+ next() {
178
+ move(1);
179
+ },
180
+ prev() {
181
+ move(-1);
182
+ },
183
+ activate() {
184
+ if (focusedId === null) return;
185
+ nodes.get(focusedId)?.onActivate?.();
186
+ },
187
+ getFocused() {
188
+ return focusedId;
189
+ },
190
+ getOrder() {
191
+ return orderedIds();
192
+ },
193
+ subscribe(listener) {
194
+ listeners.add(listener);
195
+ return () => {
196
+ listeners.delete(listener);
197
+ };
198
+ }
199
+ };
200
+ }
201
+
202
+ // src/focus-context.ts
203
+ var import_react2 = require("react");
204
+ var FocusContext = (0, import_react2.createContext)(null);
205
+ function useFocusManager() {
206
+ return (0, import_react2.useContext)(FocusContext);
207
+ }
208
+
209
+ // src/focus-provider.tsx
210
+ var import_react3 = require("react");
211
+ function FocusProvider({ manager, children }) {
212
+ const [mgr] = (0, import_react3.useState)(() => manager ?? createFocusManager());
213
+ const [, force] = (0, import_react3.useState)(0);
214
+ (0, import_react3.useEffect)(() => {
215
+ return mgr.subscribe(() => {
216
+ force((n) => n + 1);
217
+ });
218
+ }, [mgr]);
219
+ return (0, import_react3.createElement)(FocusContext.Provider, { value: mgr }, children);
220
+ }
221
+
222
+ // src/layout.ts
223
+ var ZERO_PAD = { top: 0, right: 0, bottom: 0, left: 0 };
224
+ function resolvePadding(p) {
225
+ if (!p) return ZERO_PAD;
226
+ return {
227
+ top: p.top ?? 0,
228
+ right: p.right ?? 0,
229
+ bottom: p.bottom ?? 0,
230
+ left: p.left ?? 0
231
+ };
232
+ }
233
+ function resolveLayout(container, children) {
234
+ const n = children.length;
235
+ if (n === 0) return [];
236
+ const pad = resolvePadding(container.padding);
237
+ const gap = container.gap ?? 0;
238
+ const isRow = container.direction === "row";
239
+ const mainSize = (isRow ? container.width : container.height) - (isRow ? pad.left + pad.right : pad.top + pad.bottom);
240
+ const crossSize = (isRow ? container.height : container.width) - (isRow ? pad.top + pad.bottom : pad.left + pad.right);
241
+ const mainStart = isRow ? pad.left : pad.top;
242
+ const crossStart = isRow ? pad.top : pad.left;
243
+ const justify = container.justifyContent ?? "start";
244
+ const align = container.alignItems ?? "stretch";
245
+ const totalGap = gap * Math.max(0, n - 1);
246
+ let totalBasis = 0;
247
+ let totalGrow = 0;
248
+ for (const c of children) {
249
+ totalBasis += c.basis ?? 0;
250
+ totalGrow += c.grow ?? 0;
251
+ }
252
+ const leftover = mainSize - totalBasis - totalGap;
253
+ const sizes = new Array(n);
254
+ for (let i = 0; i < n; i++) {
255
+ const c = children[i];
256
+ const base = c.basis ?? 0;
257
+ const growShare = totalGrow > 0 ? (c.grow ?? 0) / totalGrow * Math.max(0, leftover) : 0;
258
+ sizes[i] = Math.max(0, base + growShare);
259
+ }
260
+ const used = sizes.reduce((acc, s) => acc + s, 0) + totalGap;
261
+ const free = Math.max(0, mainSize - used);
262
+ let cursor = mainStart;
263
+ let spacing = gap;
264
+ switch (justify) {
265
+ case "start":
266
+ break;
267
+ case "end":
268
+ cursor = mainStart + free;
269
+ break;
270
+ case "center":
271
+ cursor = mainStart + free / 2;
272
+ break;
273
+ case "space-between":
274
+ if (n > 1) spacing = gap + free / (n - 1);
275
+ break;
276
+ case "space-around":
277
+ if (n > 0) {
278
+ const s = free / n;
279
+ cursor = mainStart + s / 2;
280
+ spacing = gap + s;
281
+ }
282
+ break;
283
+ case "space-evenly":
284
+ if (n >= 0) {
285
+ const s = free / (n + 1);
286
+ cursor = mainStart + s;
287
+ spacing = gap + s;
288
+ }
289
+ break;
290
+ }
291
+ const out = new Array(n);
292
+ for (let i = 0; i < n; i++) {
293
+ const c = children[i];
294
+ const mainLen = sizes[i];
295
+ const crossLen = c.crossSize !== void 0 ? c.crossSize : align === "stretch" ? crossSize : 0;
296
+ let crossOffset;
297
+ switch (align) {
298
+ case "start":
299
+ crossOffset = 0;
300
+ break;
301
+ case "end":
302
+ crossOffset = crossSize - crossLen;
303
+ break;
304
+ case "center":
305
+ crossOffset = (crossSize - crossLen) / 2;
306
+ break;
307
+ case "stretch":
308
+ crossOffset = 0;
309
+ break;
310
+ }
311
+ const x = isRow ? cursor : crossStart + crossOffset;
312
+ const y = isRow ? crossStart + crossOffset : cursor;
313
+ const w = isRow ? mainLen : crossLen;
314
+ const h = isRow ? crossLen : mainLen;
315
+ out[i] = { x, y, width: w, height: h };
316
+ cursor += mainLen + spacing;
317
+ }
318
+ return out;
319
+ }
320
+
321
+ // src/panel.tsx
322
+ var import_react_native = require("react-native");
323
+ var import_jsx_runtime = require("react/jsx-runtime");
324
+ function Panel({
325
+ children,
326
+ variant = "surface",
327
+ padding = "md",
328
+ radius = "md",
329
+ style
330
+ }) {
331
+ const theme = useTheme();
332
+ const bg = variant === "elevated" ? theme.colors.surfaceAlt : theme.colors.surface;
333
+ const pad = padding === "none" ? 0 : theme.spacing[padding];
334
+ const r = theme.radii[radius];
335
+ const base = {
336
+ backgroundColor: bg,
337
+ padding: pad,
338
+ borderRadius: r,
339
+ borderWidth: variant === "elevated" ? 1 : 0,
340
+ borderColor: theme.colors.border
341
+ };
342
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, { style: [base, style], children });
343
+ }
344
+
345
+ // src/label.tsx
346
+ var import_react_native2 = require("react-native");
347
+ var import_jsx_runtime2 = require("react/jsx-runtime");
348
+ function Label({
349
+ children,
350
+ variant = "md",
351
+ tone = "default",
352
+ mono = false,
353
+ style
354
+ }) {
355
+ const theme = useTheme();
356
+ const sizeMap = {
357
+ xs: theme.typography.sizeXs,
358
+ sm: theme.typography.sizeSm,
359
+ md: theme.typography.sizeMd,
360
+ lg: theme.typography.sizeLg,
361
+ xl: theme.typography.sizeXl
362
+ };
363
+ const toneMap = {
364
+ default: theme.colors.text,
365
+ muted: theme.colors.textMuted,
366
+ accent: theme.colors.accent,
367
+ danger: theme.colors.danger,
368
+ success: theme.colors.success,
369
+ warning: theme.colors.warning
370
+ };
371
+ const base = {
372
+ color: toneMap[tone],
373
+ fontSize: sizeMap[variant],
374
+ fontFamily: mono ? theme.typography.fontFamilyMono : theme.typography.fontFamily
375
+ };
376
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style: [base, style], children });
377
+ }
378
+
379
+ // src/button.tsx
380
+ var import_react4 = require("react");
381
+ var import_react_native3 = require("react-native");
382
+ var import_jsx_runtime3 = require("react/jsx-runtime");
383
+ function Button({
384
+ label,
385
+ onPress,
386
+ variant = "primary",
387
+ disabled = false,
388
+ tabIndex = 0,
389
+ focusId,
390
+ style
391
+ }) {
392
+ const theme = useTheme();
393
+ const manager = useFocusManager();
394
+ const generated = (0, import_react4.useId)();
395
+ const id = focusId ?? generated;
396
+ (0, import_react4.useEffect)(() => {
397
+ if (!manager) return;
398
+ return manager.register({
399
+ id,
400
+ tabIndex,
401
+ disabled,
402
+ onActivate: () => {
403
+ if (!disabled) onPress?.();
404
+ }
405
+ });
406
+ }, [manager, id, tabIndex, disabled, onPress]);
407
+ const focused = manager?.getFocused() === id;
408
+ let bg = theme.colors.surface;
409
+ let fg = theme.colors.text;
410
+ let border = theme.colors.border;
411
+ switch (variant) {
412
+ case "primary":
413
+ bg = theme.colors.accent;
414
+ fg = theme.colors.accentText;
415
+ border = theme.colors.accent;
416
+ break;
417
+ case "secondary":
418
+ bg = theme.colors.surfaceAlt;
419
+ fg = theme.colors.text;
420
+ border = theme.colors.border;
421
+ break;
422
+ case "ghost":
423
+ bg = "transparent";
424
+ fg = theme.colors.text;
425
+ border = "transparent";
426
+ break;
427
+ case "danger":
428
+ bg = theme.colors.danger;
429
+ fg = theme.colors.accentText;
430
+ border = theme.colors.danger;
431
+ break;
432
+ }
433
+ const container = {
434
+ backgroundColor: bg,
435
+ borderColor: focused ? theme.colors.focus : border,
436
+ borderWidth: focused ? 2 : 1,
437
+ borderRadius: theme.radii.md,
438
+ paddingHorizontal: theme.spacing.md,
439
+ paddingVertical: theme.spacing.sm,
440
+ opacity: disabled ? 0.5 : 1
441
+ };
442
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
443
+ import_react_native3.Pressable,
444
+ {
445
+ onPress: () => {
446
+ if (disabled) return;
447
+ manager?.focus(id);
448
+ onPress?.();
449
+ },
450
+ disabled,
451
+ accessibilityRole: "button",
452
+ accessibilityLabel: label,
453
+ accessibilityState: { disabled, selected: focused },
454
+ style: [styles.wrap, container, style],
455
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: { color: fg, fontSize: theme.typography.sizeMd, textAlign: "center" }, children: label }) })
456
+ }
457
+ );
458
+ }
459
+ var styles = import_react_native3.StyleSheet.create({
460
+ wrap: {
461
+ alignSelf: "stretch",
462
+ alignItems: "center",
463
+ justifyContent: "center"
464
+ }
465
+ });
466
+
467
+ // src/progress-bar.tsx
468
+ var import_react_native4 = require("react-native");
469
+ var import_jsx_runtime4 = require("react/jsx-runtime");
470
+ function ProgressBar({
471
+ value,
472
+ height = 8,
473
+ trackColor,
474
+ fillColor,
475
+ style
476
+ }) {
477
+ const theme = useTheme();
478
+ const clamped = Number.isNaN(value) ? 0 : Math.max(0, Math.min(1, value));
479
+ const r = theme.radii.sm;
480
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
481
+ import_react_native4.View,
482
+ {
483
+ style: [
484
+ {
485
+ height,
486
+ borderRadius: r,
487
+ backgroundColor: trackColor ?? theme.colors.surfaceAlt,
488
+ overflow: "hidden"
489
+ },
490
+ style
491
+ ],
492
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
493
+ import_react_native4.View,
494
+ {
495
+ style: {
496
+ width: `${clamped * 100}%`,
497
+ height: "100%",
498
+ backgroundColor: fillColor ?? theme.colors.accent
499
+ }
500
+ }
501
+ )
502
+ }
503
+ );
504
+ }
505
+
506
+ // src/hud-bar.tsx
507
+ var import_react_native5 = require("react-native");
508
+ var import_jsx_runtime5 = require("react/jsx-runtime");
509
+ function HUDBar({
510
+ label,
511
+ value,
512
+ max,
513
+ kind = "custom",
514
+ showNumbers = true,
515
+ fillColor
516
+ }) {
517
+ const theme = useTheme();
518
+ const ratio = max <= 0 ? 0 : value / max;
519
+ let color = fillColor;
520
+ if (!color) {
521
+ switch (kind) {
522
+ case "hp":
523
+ color = theme.colors.danger;
524
+ break;
525
+ case "mp":
526
+ color = theme.colors.accent;
527
+ break;
528
+ case "xp":
529
+ color = theme.colors.success;
530
+ break;
531
+ default:
532
+ color = theme.colors.accent;
533
+ }
534
+ }
535
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native5.View, { children: [
536
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
537
+ import_react_native5.View,
538
+ {
539
+ style: {
540
+ flexDirection: "row",
541
+ justifyContent: "space-between",
542
+ marginBottom: theme.spacing.xs
543
+ },
544
+ children: [
545
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { variant: "sm", tone: "muted", children: label }),
546
+ showNumbers && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { variant: "sm", tone: "muted", mono: true, children: `${Math.max(0, Math.floor(value))} / ${Math.max(0, Math.floor(max))}` })
547
+ ]
548
+ }
549
+ ),
550
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ProgressBar, { value: ratio, fillColor: color })
551
+ ] });
552
+ }
553
+
554
+ // src/list.tsx
555
+ var import_react5 = require("react");
556
+ var import_react_native6 = require("react-native");
557
+ var import_jsx_runtime6 = require("react/jsx-runtime");
558
+ function List({ children, gap, direction = "column", style }) {
559
+ const theme = useTheme();
560
+ const g = gap ?? theme.spacing.sm;
561
+ const items = [];
562
+ let i = 0;
563
+ const flat = Array.isArray(children) ? children : [children];
564
+ for (const child of flat) {
565
+ if (child === null || child === void 0 || child === false) continue;
566
+ if (i > 0) {
567
+ const spacerStyle = direction === "row" ? { width: g } : { height: g };
568
+ items.push(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native6.View, { style: spacerStyle }, `s-${i}`));
569
+ }
570
+ items.push(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react5.Fragment, { children: child }, `i-${i}`));
571
+ i++;
572
+ }
573
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native6.View, { style: [{ flexDirection: direction }, style], children: items });
574
+ }
575
+
576
+ // src/modal.tsx
577
+ var import_react_native7 = require("react-native");
578
+ var import_jsx_runtime7 = require("react/jsx-runtime");
579
+ function Modal({
580
+ visible,
581
+ children,
582
+ onBackdropPress,
583
+ backdropOpacity = 0.6
584
+ }) {
585
+ if (!visible) return null;
586
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
587
+ import_react_native7.View,
588
+ {
589
+ style: {
590
+ position: "absolute",
591
+ top: 0,
592
+ left: 0,
593
+ right: 0,
594
+ bottom: 0,
595
+ alignItems: "center",
596
+ justifyContent: "center"
597
+ },
598
+ pointerEvents: "box-none",
599
+ children: [
600
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
601
+ import_react_native7.Pressable,
602
+ {
603
+ onPress: onBackdropPress,
604
+ style: {
605
+ position: "absolute",
606
+ top: 0,
607
+ left: 0,
608
+ right: 0,
609
+ bottom: 0,
610
+ backgroundColor: `rgba(0,0,0,${backdropOpacity})`
611
+ }
612
+ }
613
+ ),
614
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Panel, { variant: "elevated", padding: "lg", style: { minWidth: 240, maxWidth: "80%" }, children })
615
+ ]
616
+ }
617
+ );
618
+ }
619
+
620
+ // src/dialogue-panel.tsx
621
+ var import_react_native8 = require("react-native");
622
+ var import_jsx_runtime8 = require("react/jsx-runtime");
623
+ function DialoguePanel({
624
+ speaker,
625
+ text,
626
+ portrait,
627
+ choices,
628
+ onAdvance,
629
+ style
630
+ }) {
631
+ const theme = useTheme();
632
+ const body = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native8.View, { style: { flexDirection: "row", alignItems: "flex-start" }, children: [
633
+ portrait !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native8.View, { style: { marginRight: theme.spacing.md }, children: portrait }) : null,
634
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native8.View, { style: { flex: 1 }, children: [
635
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label, { variant: "sm", tone: "accent", style: { marginBottom: theme.spacing.xs }, children: speaker }),
636
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Label, { variant: "md", children: text }),
637
+ choices && choices.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native8.View, { style: { marginTop: theme.spacing.md }, children: choices.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native8.View, { style: { marginTop: i === 0 ? 0 : theme.spacing.xs }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
638
+ Button,
639
+ {
640
+ label: c.label,
641
+ onPress: c.onPress,
642
+ disabled: c.disabled,
643
+ variant: "secondary"
644
+ }
645
+ ) }, `${c.label}-${i}`)) }) : null
646
+ ] })
647
+ ] });
648
+ if (choices && choices.length > 0) {
649
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Panel, { variant: "elevated", padding: "md", style, children: body });
650
+ }
651
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native8.Pressable, { onPress: onAdvance, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Panel, { variant: "elevated", padding: "md", style, children: body }) });
652
+ }
653
+
654
+ // src/shop-panel.tsx
655
+ var import_react_native9 = require("react-native");
656
+ var import_jsx_runtime9 = require("react/jsx-runtime");
657
+ function ShopPanel({
658
+ items,
659
+ isEntitled,
660
+ onPurchase,
661
+ ownedLabel = "Owned",
662
+ purchaseLabelFor,
663
+ style
664
+ }) {
665
+ const theme = useTheme();
666
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Panel, { variant: "elevated", padding: "md", style, children: items.map((item, i) => {
667
+ const owned = item.ownedKeys?.some((k) => isEntitled(k)) ?? false;
668
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
669
+ import_react_native9.View,
670
+ {
671
+ style: {
672
+ marginTop: i === 0 ? 0 : theme.spacing.md,
673
+ paddingTop: i === 0 ? 0 : theme.spacing.md,
674
+ borderTopWidth: i === 0 ? 0 : 1,
675
+ borderTopColor: theme.colors.border
676
+ },
677
+ children: [
678
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label, { variant: "md", children: item.title }),
679
+ item.description !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label, { variant: "sm", tone: "muted", style: { marginTop: theme.spacing.xs }, children: item.description }) : null,
680
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native9.View, { style: { marginTop: theme.spacing.sm }, children: owned ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { label: ownedLabel, variant: "ghost", disabled: true }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
681
+ Button,
682
+ {
683
+ label: purchaseLabelFor ? purchaseLabelFor(item) : item.priceDisplay,
684
+ variant: "primary",
685
+ disabled: item.disabled,
686
+ onPress: () => onPurchase(item.productId)
687
+ }
688
+ ) })
689
+ ]
690
+ },
691
+ item.productId
692
+ );
693
+ }) });
694
+ }
695
+
696
+ // src/main-menu-kit.tsx
697
+ var import_react_native10 = require("react-native");
698
+ var import_jsx_runtime10 = require("react/jsx-runtime");
699
+ function MainMenuKit({
700
+ title,
701
+ subtitle,
702
+ items,
703
+ footer,
704
+ style
705
+ }) {
706
+ const theme = useTheme();
707
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
708
+ import_react_native10.View,
709
+ {
710
+ style: [
711
+ {
712
+ flex: 1,
713
+ alignItems: "center",
714
+ justifyContent: "center",
715
+ padding: theme.spacing.lg
716
+ },
717
+ style
718
+ ],
719
+ children: [
720
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Label, { variant: "xl", tone: "accent", style: { marginBottom: theme.spacing.xs }, children: title }),
721
+ subtitle !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Label, { variant: "sm", tone: "muted", style: { marginBottom: theme.spacing.lg }, children: subtitle }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native10.View, { style: { height: theme.spacing.lg } }),
722
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native10.View, { style: { alignSelf: "stretch", maxWidth: 320, width: "100%" }, children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native10.View, { style: { marginTop: i === 0 ? 0 : theme.spacing.sm }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
723
+ Button,
724
+ {
725
+ label: item.label,
726
+ onPress: item.onPress,
727
+ variant: item.variant ?? "primary",
728
+ disabled: item.disabled,
729
+ focusId: item.id,
730
+ tabIndex: i
731
+ }
732
+ ) }, item.id)) }),
733
+ footer !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native10.View, { style: { marginTop: theme.spacing.lg }, children: footer }) : null
734
+ ]
735
+ }
736
+ );
737
+ }
738
+ // Annotate the CommonJS export names for ESM import in node:
739
+ 0 && (module.exports = {
740
+ Button,
741
+ DialoguePanel,
742
+ FocusContext,
743
+ FocusProvider,
744
+ HUDBar,
745
+ Label,
746
+ List,
747
+ MainMenuKit,
748
+ Modal,
749
+ Panel,
750
+ ProgressBar,
751
+ ShopPanel,
752
+ ThemeProvider,
753
+ createFocusManager,
754
+ darkTheme,
755
+ lightTheme,
756
+ resolveLayout,
757
+ useFocusManager,
758
+ useTheme
759
+ });
760
+ //# sourceMappingURL=index.js.map