@flare-engine/ui 0.4.8 → 0.4.11

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.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { a as FocusManager, c as createFocusManager, i as createFocusKeyboardDriver, n as FocusKeyboardDriver, o as FocusManagerOptions, r as FocusKeyboardDriverOptions, s as FocusNode, t as FocusKeySource } from "./focus-ILunQnll.js";
1
2
  import { ReactNode } from "react";
2
3
  import { StyleProp, TextProps, TextStyle, ViewStyle } from "react-native";
3
4
  type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
@@ -10,9 +11,15 @@ interface ButtonProps {
10
11
  tabIndex?: number;
11
12
  /** Stable focus id. If omitted, a generated id is used. */
12
13
  focusId?: string;
14
+ /**
15
+ * Move focus to this button when it is pressed. Defaults to `true`. Set
16
+ * `false` on touch-first screens so a tap leaves no focus ring behind;
17
+ * `onPress` still fires.
18
+ */
19
+ focusOnPress?: boolean;
13
20
  style?: StyleProp<ViewStyle>;
14
21
  }
15
- export declare function Button({ label, onPress, variant, disabled, tabIndex, focusId, style }: ButtonProps): ReactNode;
22
+ export declare function Button({ label, onPress, variant, disabled, tabIndex, focusId, focusOnPress, style }: ButtonProps): ReactNode;
16
23
  interface DialogueChoice {
17
24
  /** Display label (already localized by the caller). */
18
25
  readonly label: string;
@@ -47,42 +54,6 @@ interface DialoguePanelProps {
47
54
  * Portrait resolution is caller-owned so the UI kit stays asset-agnostic.
48
55
  */
49
56
  export declare function DialoguePanel({ speaker, text, portrait, choices, onAdvance, style }: DialoguePanelProps): ReactNode;
50
- /**
51
- * Keyboard + (future) gamepad focus navigation.
52
- *
53
- * Primitives register themselves with the focus manager by id + tab order.
54
- * The manager owns which id is currently focused and exposes `next` / `prev`
55
- * / `activate` actions for a driver (keyboard key handler, gamepad dpad)
56
- * to call. Components read `focusedId` to render a focus ring.
57
- */
58
- interface FocusNode {
59
- id: string;
60
- /** Lower tabIndex is focused first. Nodes with equal tabIndex fall back to registration order. */
61
- tabIndex: number;
62
- /** Called when this node is activated (Enter / A button). */
63
- onActivate?: () => void;
64
- /** Called when this node receives focus. */
65
- onFocus?: () => void;
66
- /** Called when this node loses focus. */
67
- onBlur?: () => void;
68
- /** If true, the node is skipped during navigation. */
69
- disabled?: boolean;
70
- }
71
- interface FocusManager {
72
- register(node: FocusNode): () => void;
73
- unregister(id: string): void;
74
- focus(id: string): void;
75
- /** Explicit opt-in initial focus: focuses the first node in tab order (or clears if empty). */
76
- focusFirst(): void;
77
- blur(): void;
78
- next(): void;
79
- prev(): void;
80
- activate(): void;
81
- getFocused(): string | null;
82
- getOrder(): readonly string[];
83
- subscribe(listener: (focusedId: string | null) => void): () => void;
84
- }
85
- export declare function createFocusManager(): FocusManager;
86
57
  interface FocusContextValue {
87
58
  manager: FocusManager;
88
59
  focusedId: string | null;
@@ -90,20 +61,6 @@ interface FocusContextValue {
90
61
  export declare const FocusContext: import("react").Context<FocusContextValue | null>;
91
62
  export declare function useFocusManager(): FocusManager | null;
92
63
  export declare function useFocusedId(): string | null;
93
- /** Structural key source — createKeyboard() from @flare-engine/input is assignable; no hard dep. */
94
- interface FocusKeySource {
95
- wasPressed(code: string): boolean;
96
- }
97
- interface FocusKeyboardDriver {
98
- /** Call once per frame; polls edges and drives the manager. */
99
- update(): void;
100
- }
101
- interface FocusKeyboardDriverOptions {
102
- next?: readonly string[];
103
- prev?: readonly string[];
104
- activate?: readonly string[];
105
- }
106
- export declare function createFocusKeyboardDriver(manager: FocusManager, keys: FocusKeySource, options?: FocusKeyboardDriverOptions): FocusKeyboardDriver;
107
64
  interface FocusProviderProps {
108
65
  manager?: FocusManager;
109
66
  /**
@@ -325,5 +282,5 @@ interface ThemeProviderProps {
325
282
  }
326
283
  export declare function ThemeProvider({ theme, children }: ThemeProviderProps): ReactNode;
327
284
  export declare function useTheme(): Theme;
328
- export type { AlignItems, ButtonProps, ButtonVariant, DialogueChoice, DialoguePanelProps, FlexDirection, FocusContextValue, FocusKeySource, FocusKeyboardDriver, FocusKeyboardDriverOptions, FocusManager, FocusNode, FocusProviderProps, HUDBarKind, HUDBarProps, JustifyContent, LabelProps, LabelTone, LabelVariant, LayoutChild, LayoutContainer, LayoutRect, ListProps, MainMenuItem, MainMenuKitProps, ModalProps, Padding, PanelProps, ProgressBarProps, Theme, ThemeColors, ThemeProviderProps, ThemeRadii, ThemeSpacing, ThemeTypography };
285
+ export { type AlignItems, type ButtonProps, type ButtonVariant, type DialogueChoice, type DialoguePanelProps, type FlexDirection, type FocusContextValue, type FocusKeySource, type FocusKeyboardDriver, type FocusKeyboardDriverOptions, type FocusManager, type FocusManagerOptions, type FocusNode, type FocusProviderProps, type HUDBarKind, type HUDBarProps, type JustifyContent, type LabelProps, type LabelTone, type LabelVariant, type LayoutChild, type LayoutContainer, type LayoutRect, type ListProps, type MainMenuItem, type MainMenuKitProps, type ModalProps, type Padding, type PanelProps, type ProgressBarProps, type Theme, type ThemeColors, type ThemeProviderProps, type ThemeRadii, type ThemeSpacing, type ThemeTypography, createFocusKeyboardDriver, createFocusManager };
329
286
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/button.tsx","../src/dialogue-panel.tsx","../src/focus.ts","../src/focus-context.ts","../src/focus-keyboard-driver.ts","../src/focus-provider.tsx","../src/hud-bar.tsx","../src/label.tsx","../src/layout.ts","../src/list.tsx","../src/main-menu-kit.tsx","../src/modal.tsx","../src/panel.tsx","../src/progress-bar.tsx","../src/theme.ts"],"mappings":";;KAKY;UAEK;EACf;EACA;EACA,UAAU;EACV;;EAEA;;EAEA;EACA,QAAQ,UAAU;;wBAGJ,SACd,OACA,SACA,SACA,UACA,UACA,SACA,SACC,cAAc;UCpBA;;WAEN;;WAEA;WACA;;UAGM;;WAEN;;WAEA;;;;;WAKA,WAAW;;;;;WAKX,mBAAmB;;WAEnB;WACA,QAAQ,UAAU;;;;;;;;;wB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OACA,QACA,SACC,mBAAmB;UCxCL;EACf;EACA,WAAW;;EAEX;;EAEA;;;;;;;wBAQc,QACd,SACA,UACA,iBACA,mBACC,aAAa;UCnBC;EACf,WAAW;;EAEX;;EAEA;;EAEA;EACA,QAAQ,UAAU;;wBAGJ,QACd,UACA,SACA,SACA,QACA,SACC,aAAa;UCjBC;;EAEf;;EAEA;;EAEA;;EAEA;EACA,QAAQ,UAAU;;wBAGJ,cACd,OACA,QACA,YACA,WACA,SACC,mBAAmB;UCpBL;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,QAAQ;EACR,SAAS;EACT,YAAY;EACZ,OAAO;;qBAGI,WAAW;qBA2BX,YAAY;UA6BR;EACf,QAAQ;EACR,UAAU;;wBAGI,gBAAgB,OAAmB,YAAY,qBAAqB;wBAIpE,YAAY"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/button.tsx","../src/dialogue-panel.tsx","../src/focus-context.ts","../src/focus-provider.tsx","../src/hud-bar.tsx","../src/label.tsx","../src/layout.ts","../src/list.tsx","../src/main-menu-kit.tsx","../src/modal.tsx","../src/panel.tsx","../src/progress-bar.tsx","../src/theme.ts"],"mappings":";;;KAKY;UAEK;EACf;EACA;EACA,UAAU;EACV;;EAEA;;EAEA;;;;;;EAMA;EACA,QAAQ,UAAU;;wBAGJ,SACd,OACA,SACA,SACA,UACA,UACA,SACA,cACA,SACC,cAAc;UC3BA;;WAEN;;WAEA;WACA;;UAGM;;WAEN;;WAEA;;;;;WAKA,WAAW;;;;;WAKX,mBAAmB;;WAEnB;WACA,QAAQ,UAAU;;;;;;;;;wBAUb,gBACd,SACA,MACA,UACA,SACA,WACA,SACC,qBAAqB;UC9CP;EACf,SAAS;EACT;;qBAGW,8BAAY,QAAA;wBA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;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,QAAQ;EACR,SAAS;EACT,YAAY;EACZ,OAAO;;qBAGI,WAAW;qBA2BX,YAAY;UA6BR;EACf,QAAQ;EACR,UAAU;;wBAGI,gBAAgB,OAAmB,YAAY,qBAAqB;wBAIpE,YAAY"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_focus = require("./focus-86LvCtcF.js");
2
3
  let react = require("react");
3
4
  let react_native = require("react-native");
4
5
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -97,28 +98,49 @@ function useTheme() {
97
98
  return (0, react.useContext)(ThemeContext);
98
99
  }
99
100
  // src/button.tsx
100
- function Button({ label, onPress, variant = "primary", disabled = false, tabIndex = 0, focusId, style }) {
101
+ function Button({ label, onPress, variant = "primary", disabled = false, tabIndex = 0, focusId, focusOnPress = true, style }) {
101
102
  const theme = useTheme();
102
103
  const manager = useFocusManager();
103
104
  const focusedId = useFocusedId();
104
105
  const generated = (0, react.useId)();
105
106
  const id = focusId ?? generated;
107
+ const latest = (0, react.useRef)({
108
+ onPress,
109
+ disabled,
110
+ tabIndex
111
+ });
112
+ latest.current = {
113
+ onPress,
114
+ disabled,
115
+ tabIndex
116
+ };
117
+ const activateRef = (0, react.useRef)(() => {
118
+ const { onPress: press, disabled: off } = latest.current;
119
+ if (!off) press?.();
120
+ });
106
121
  (0, react.useEffect)(() => {
107
122
  if (!manager) return;
123
+ const { tabIndex: order, disabled: off } = latest.current;
108
124
  return manager.register({
125
+ id,
126
+ tabIndex: order,
127
+ disabled: off,
128
+ onActivate: activateRef.current
129
+ });
130
+ }, [manager, id]);
131
+ (0, react.useEffect)(() => {
132
+ if (!manager) return;
133
+ manager.register({
109
134
  id,
110
135
  tabIndex,
111
136
  disabled,
112
- onActivate: () => {
113
- if (!disabled) onPress?.();
114
- }
137
+ onActivate: activateRef.current
115
138
  });
116
139
  }, [
117
140
  manager,
118
141
  id,
119
142
  tabIndex,
120
- disabled,
121
- onPress
143
+ disabled
122
144
  ]);
123
145
  const focused = focusedId === id;
124
146
  let bg = theme.colors.surface;
@@ -157,7 +179,7 @@ function Button({ label, onPress, variant = "primary", disabled = false, tabInde
157
179
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
158
180
  onPress: () => {
159
181
  if (disabled) return;
160
- manager?.focus(id);
182
+ if (focusOnPress) manager?.focus(id);
161
183
  onPress?.();
162
184
  },
163
185
  disabled,
@@ -295,126 +317,6 @@ function DialoguePanel({ speaker, text, portrait, choices, onAdvance, style }) {
295
317
  })
296
318
  });
297
319
  }
298
- // src/focus.ts
299
- function createFocusManager() {
300
- const nodes = /* @__PURE__ */ new Map();
301
- let seqCounter = 0;
302
- let focusedId = null;
303
- const listeners = /* @__PURE__ */ new Set();
304
- function notify() {
305
- for (const l of listeners) l(focusedId);
306
- }
307
- function orderedIds() {
308
- const entries = Array.from(nodes.values()).filter((e) => !e.disabled);
309
- entries.sort((a, b) => {
310
- if (a.tabIndex !== b.tabIndex) return a.tabIndex - b.tabIndex;
311
- return a.seq - b.seq;
312
- });
313
- return entries.map((e) => e.id);
314
- }
315
- function setFocused(next) {
316
- if (next === focusedId) return;
317
- const prev = focusedId;
318
- focusedId = next;
319
- if (prev !== null) nodes.get(prev)?.onBlur?.();
320
- if (next !== null) nodes.get(next)?.onFocus?.();
321
- notify();
322
- }
323
- function move(delta) {
324
- const order = orderedIds();
325
- if (order.length === 0) {
326
- setFocused(null);
327
- return;
328
- }
329
- if (focusedId === null) {
330
- setFocused(delta === 1 ? order[0] ?? null : order[order.length - 1] ?? null);
331
- return;
332
- }
333
- const idx = order.indexOf(focusedId);
334
- if (idx === -1) {
335
- setFocused(order[0] ?? null);
336
- return;
337
- }
338
- setFocused(order[(idx + delta + order.length) % order.length] ?? null);
339
- }
340
- return {
341
- register(node) {
342
- const entry = {
343
- ...node,
344
- seq: seqCounter++
345
- };
346
- nodes.set(node.id, entry);
347
- return () => {
348
- this.unregister(node.id);
349
- };
350
- },
351
- unregister(id) {
352
- if (!nodes.has(id)) return;
353
- nodes.delete(id);
354
- if (focusedId === id) setFocused(orderedIds()[0] ?? null);
355
- },
356
- focus(id) {
357
- const entry = nodes.get(id);
358
- if (!entry || entry.disabled) return;
359
- setFocused(id);
360
- },
361
- focusFirst() {
362
- setFocused(orderedIds()[0] ?? null);
363
- },
364
- blur() {
365
- setFocused(null);
366
- },
367
- next() {
368
- move(1);
369
- },
370
- prev() {
371
- move(-1);
372
- },
373
- activate() {
374
- if (focusedId === null) return;
375
- nodes.get(focusedId)?.onActivate?.();
376
- },
377
- getFocused() {
378
- return focusedId;
379
- },
380
- getOrder() {
381
- return orderedIds();
382
- },
383
- subscribe(listener) {
384
- listeners.add(listener);
385
- return () => {
386
- listeners.delete(listener);
387
- };
388
- }
389
- };
390
- }
391
- // src/focus-keyboard-driver.ts
392
- const DEFAULT_NEXT = [
393
- "ArrowDown",
394
- "ArrowRight",
395
- "Tab"
396
- ];
397
- const DEFAULT_PREV = ["ArrowUp", "ArrowLeft"];
398
- const DEFAULT_ACTIVATE = ["Enter", "Space"];
399
- function createFocusKeyboardDriver(manager, keys, options) {
400
- const nextCodes = options?.next ?? DEFAULT_NEXT;
401
- const prevCodes = options?.prev ?? DEFAULT_PREV;
402
- const activateCodes = options?.activate ?? DEFAULT_ACTIVATE;
403
- return { update() {
404
- for (let i = 0; i < nextCodes.length; i++) if (keys.wasPressed(nextCodes[i])) {
405
- manager.next();
406
- return;
407
- }
408
- for (let i = 0; i < prevCodes.length; i++) if (keys.wasPressed(prevCodes[i])) {
409
- manager.prev();
410
- return;
411
- }
412
- for (let i = 0; i < activateCodes.length; i++) if (keys.wasPressed(activateCodes[i])) {
413
- manager.activate();
414
- return;
415
- }
416
- } };
417
- }
418
320
  // src/focus-provider.tsx
419
321
  /**
420
322
  * Instantiates a FocusManager (or uses the one provided) and publishes
@@ -422,7 +324,7 @@ function createFocusKeyboardDriver(manager, keys, options) {
422
324
  * moves.
423
325
  */
424
326
  function FocusProvider({ manager, autoFocus, children }) {
425
- const [mgr] = (0, react.useState)(() => manager ?? createFocusManager());
327
+ const [mgr] = (0, react.useState)(() => manager ?? require_focus.createFocusManager());
426
328
  const [focusedId, setFocusedId] = (0, react.useState)(() => mgr.getFocused());
427
329
  (0, react.useEffect)(() => {
428
330
  setFocusedId(mgr.getFocused());
@@ -728,8 +630,8 @@ exports.Modal = Modal;
728
630
  exports.Panel = Panel;
729
631
  exports.ProgressBar = ProgressBar;
730
632
  exports.ThemeProvider = ThemeProvider;
731
- exports.createFocusKeyboardDriver = createFocusKeyboardDriver;
732
- exports.createFocusManager = createFocusManager;
633
+ exports.createFocusKeyboardDriver = require_focus.createFocusKeyboardDriver;
634
+ exports.createFocusManager = require_focus.createFocusManager;
733
635
  exports.darkTheme = darkTheme;
734
636
  exports.lightTheme = lightTheme;
735
637
  exports.resolveLayout = resolveLayout;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createContext","useContext","createContext","createElement","useContext","useId","Pressable","View","Text","StyleSheet","Text","View","View","Pressable","useState","useMemo","createElement","View","View","Children","View","Fragment","View","View","Pressable"],"sources":["../src/focus-context.ts","../src/theme.ts","../src/button.tsx","../src/label.tsx","../src/panel.tsx","../src/dialogue-panel.tsx","../src/focus.ts","../src/focus-keyboard-driver.ts","../src/focus-provider.tsx","../src/progress-bar.tsx","../src/hud-bar.tsx","../src/layout.ts","../src/list.tsx","../src/main-menu-kit.tsx","../src/modal.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { FocusManager } from './focus.js';\n\nexport interface FocusContextValue {\n manager: FocusManager;\n focusedId: string | null;\n}\n\nexport const FocusContext = createContext<FocusContextValue | null>(null);\n\nexport function useFocusManager(): FocusManager | null {\n const ctx = useContext(FocusContext);\n return ctx ? ctx.manager : null;\n}\n\nexport function useFocusedId(): string | null {\n const ctx = useContext(FocusContext);\n return ctx ? ctx.focusedId : null;\n}\n","import { createContext, createElement, type ReactNode, useContext } from 'react';\n\nexport interface ThemeColors {\n bg: string;\n surface: string;\n surfaceAlt: string;\n border: string;\n text: string;\n textMuted: string;\n accent: string;\n accentText: string;\n danger: string;\n success: string;\n warning: string;\n focus: string;\n}\n\nexport interface ThemeSpacing {\n xs: number;\n sm: number;\n md: number;\n lg: number;\n xl: number;\n}\n\nexport interface ThemeTypography {\n sizeXs: number;\n sizeSm: number;\n sizeMd: number;\n sizeLg: number;\n sizeXl: number;\n fontFamily?: string;\n fontFamilyMono?: string;\n}\n\nexport interface ThemeRadii {\n none: number;\n sm: number;\n md: number;\n lg: number;\n pill: number;\n}\n\nexport interface Theme {\n name: string;\n colors: ThemeColors;\n spacing: ThemeSpacing;\n typography: ThemeTypography;\n radii: ThemeRadii;\n}\n\nexport const darkTheme: Theme = {\n name: 'dark',\n colors: {\n bg: '#0b0d10',\n surface: '#14181d',\n surfaceAlt: '#1d232b',\n border: '#2a323c',\n text: '#e7ecf1',\n textMuted: '#8c96a3',\n accent: '#4aa3ff',\n accentText: '#0b0d10',\n danger: '#ff5c5c',\n success: '#5dd39e',\n warning: '#f1c40f',\n focus: '#ffd166',\n },\n spacing: { xs: 4, sm: 8, md: 12, lg: 20, xl: 32 },\n typography: {\n sizeXs: 10,\n sizeSm: 12,\n sizeMd: 14,\n sizeLg: 18,\n sizeXl: 24,\n },\n radii: { none: 0, sm: 4, md: 8, lg: 16, pill: 9999 },\n};\n\nexport const lightTheme: Theme = {\n name: 'light',\n colors: {\n bg: '#f6f8fa',\n surface: '#ffffff',\n surfaceAlt: '#eef1f4',\n border: '#d4dae0',\n text: '#13181d',\n textMuted: '#5b6670',\n accent: '#0a66d0',\n accentText: '#ffffff',\n danger: '#d12e2e',\n success: '#2f9d69',\n warning: '#c79600',\n focus: '#ff9500',\n },\n spacing: { xs: 4, sm: 8, md: 12, lg: 20, xl: 32 },\n typography: {\n sizeXs: 10,\n sizeSm: 12,\n sizeMd: 14,\n sizeLg: 18,\n sizeXl: 24,\n },\n radii: { none: 0, sm: 4, md: 8, lg: 16, pill: 9999 },\n};\n\nconst ThemeContext = createContext<Theme>(darkTheme);\n\nexport interface ThemeProviderProps {\n theme?: Theme;\n children: ReactNode;\n}\n\nexport function ThemeProvider({ theme = darkTheme, children }: ThemeProviderProps): ReactNode {\n return createElement(ThemeContext.Provider, { value: theme }, children);\n}\n\nexport function useTheme(): Theme {\n return useContext(ThemeContext);\n}\n","import { type ReactNode, useEffect, useId } from 'react';\nimport { Pressable, type StyleProp, StyleSheet, Text, View, type ViewStyle } from 'react-native';\nimport { useFocusedId, useFocusManager } from './focus-context.js';\nimport { useTheme } from './theme.js';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';\n\nexport interface ButtonProps {\n label: string;\n onPress?: () => void;\n variant?: ButtonVariant;\n disabled?: boolean;\n /** Focus-navigation tab order. Lower is earlier. Defaults to 0. */\n tabIndex?: number;\n /** Stable focus id. If omitted, a generated id is used. */\n focusId?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Button({\n label,\n onPress,\n variant = 'primary',\n disabled = false,\n tabIndex = 0,\n focusId,\n style,\n}: ButtonProps): ReactNode {\n const theme = useTheme();\n const manager = useFocusManager();\n const focusedId = useFocusedId();\n const generated = useId();\n const id = focusId ?? generated;\n\n useEffect(() => {\n if (!manager) return;\n return manager.register({\n id,\n tabIndex,\n disabled,\n onActivate: () => {\n if (!disabled) onPress?.();\n },\n });\n }, [manager, id, tabIndex, disabled, onPress]);\n\n const focused = focusedId === id;\n\n let bg = theme.colors.surface;\n let fg = theme.colors.text;\n let border = theme.colors.border;\n switch (variant) {\n case 'primary':\n bg = theme.colors.accent;\n fg = theme.colors.accentText;\n border = theme.colors.accent;\n break;\n case 'secondary':\n bg = theme.colors.surfaceAlt;\n fg = theme.colors.text;\n border = theme.colors.border;\n break;\n case 'ghost':\n bg = 'transparent';\n fg = theme.colors.text;\n border = 'transparent';\n break;\n case 'danger':\n bg = theme.colors.danger;\n fg = theme.colors.accentText;\n border = theme.colors.danger;\n break;\n }\n\n const container: ViewStyle = {\n backgroundColor: bg,\n borderColor: focused ? theme.colors.focus : border,\n borderWidth: focused ? 2 : 1,\n borderRadius: theme.radii.md,\n paddingHorizontal: theme.spacing.md,\n paddingVertical: theme.spacing.sm,\n opacity: disabled ? 0.5 : 1,\n };\n\n return (\n <Pressable\n onPress={() => {\n if (disabled) return;\n manager?.focus(id);\n onPress?.();\n }}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ disabled, selected: focused }}\n style={[styles.wrap, container, style]}\n >\n <View>\n <Text style={{ color: fg, fontSize: theme.typography.sizeMd, textAlign: 'center' }}>\n {label}\n </Text>\n </View>\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n alignSelf: 'stretch',\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n","import type { ReactNode } from 'react';\nimport { type StyleProp, Text, type TextProps, type TextStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport type LabelVariant = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\nexport type LabelTone = 'default' | 'muted' | 'accent' | 'danger' | 'success' | 'warning';\n\nexport interface LabelProps {\n children?: ReactNode;\n variant?: LabelVariant;\n tone?: LabelTone;\n mono?: boolean;\n style?: StyleProp<TextStyle>;\n numberOfLines?: number;\n ellipsizeMode?: TextProps['ellipsizeMode'];\n adjustsFontSizeToFit?: boolean;\n minimumFontScale?: number;\n}\n\nexport function Label({\n children,\n variant = 'md',\n tone = 'default',\n mono = false,\n style,\n numberOfLines,\n ellipsizeMode,\n adjustsFontSizeToFit,\n minimumFontScale,\n}: LabelProps): ReactNode {\n const theme = useTheme();\n const sizeMap = {\n xs: theme.typography.sizeXs,\n sm: theme.typography.sizeSm,\n md: theme.typography.sizeMd,\n lg: theme.typography.sizeLg,\n xl: theme.typography.sizeXl,\n };\n const toneMap = {\n default: theme.colors.text,\n muted: theme.colors.textMuted,\n accent: theme.colors.accent,\n danger: theme.colors.danger,\n success: theme.colors.success,\n warning: theme.colors.warning,\n };\n\n const base: TextStyle = {\n color: toneMap[tone],\n fontSize: sizeMap[variant],\n fontFamily: mono ? theme.typography.fontFamilyMono : theme.typography.fontFamily,\n };\n\n return (\n <Text\n numberOfLines={numberOfLines}\n ellipsizeMode={ellipsizeMode}\n adjustsFontSizeToFit={adjustsFontSizeToFit}\n minimumFontScale={minimumFontScale}\n style={[base, style]}\n >\n {children}\n </Text>\n );\n}\n","import type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport interface PanelProps {\n children?: ReactNode;\n /** Visual style: surface (default) or elevated (surfaceAlt + border). */\n variant?: 'surface' | 'elevated';\n /** Padding size token. Defaults to 'md'. */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Corner radius token. Defaults to 'md'. */\n radius?: 'none' | 'sm' | 'md' | 'lg' | 'pill';\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Panel({\n children,\n variant = 'surface',\n padding = 'md',\n radius = 'md',\n style,\n}: PanelProps): ReactNode {\n const theme = useTheme();\n const bg = variant === 'elevated' ? theme.colors.surfaceAlt : theme.colors.surface;\n const pad = padding === 'none' ? 0 : theme.spacing[padding];\n const r = theme.radii[radius];\n\n const base: ViewStyle = {\n backgroundColor: bg,\n padding: pad,\n borderRadius: r,\n borderWidth: variant === 'elevated' ? 1 : 0,\n borderColor: theme.colors.border,\n };\n\n return <View style={[base, style]}>{children}</View>;\n}\n","import type { ReactNode } from 'react';\nimport { Pressable, type StyleProp, View, type ViewStyle } from 'react-native';\nimport { Button } from './button.js';\nimport { Label } from './label.js';\nimport { Panel } from './panel.js';\nimport { useTheme } from './theme.js';\n\nexport interface DialogueChoice {\n /** Display label (already localized by the caller). */\n readonly label: string;\n /** Called when the player selects this choice. */\n readonly onPress: () => void;\n readonly disabled?: boolean;\n}\n\nexport interface DialoguePanelProps {\n /** Speaker name — rendered above the text. */\n readonly speaker: string;\n /** Line text — rendered in the body. */\n readonly text: string;\n /**\n * Portrait node. Typically an `<Image>` or a Skia/shape avatar keyed by\n * `LineNode.speakerPortraitKey`. When omitted, the portrait slot collapses.\n */\n readonly portrait?: ReactNode;\n /**\n * Optional choices. When present, renders a `Button` per option; when\n * absent, the panel tap-advances via `onAdvance`.\n */\n readonly choices?: readonly DialogueChoice[];\n /** Advance callback — used only when `choices` is empty / omitted. */\n readonly onAdvance?: () => void;\n readonly style?: StyleProp<ViewStyle>;\n}\n\n/**\n * Dialogue panel with a portrait slot. Pairs with `@flare-engine/dialogue`\n * — subscribe to `runner.onLine` and pass `speakerPortraitKey` → your\n * portrait resolver → `portrait` here.\n *\n * Portrait resolution is caller-owned so the UI kit stays asset-agnostic.\n */\nexport function DialoguePanel({\n speaker,\n text,\n portrait,\n choices,\n onAdvance,\n style,\n}: DialoguePanelProps): ReactNode {\n const theme = useTheme();\n const body = (\n <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>\n {portrait !== undefined ? (\n <View style={{ marginRight: theme.spacing.md }}>{portrait}</View>\n ) : null}\n <View style={{ flex: 1 }}>\n <Label variant=\"sm\" tone=\"accent\" style={{ marginBottom: theme.spacing.xs }}>\n {speaker}\n </Label>\n <Label variant=\"md\">{text}</Label>\n {choices && choices.length > 0 ? (\n <View style={{ marginTop: theme.spacing.md }}>\n {choices.map((c, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static choice list, never reordered\n <View key={`${c.label}-${i}`} style={{ marginTop: i === 0 ? 0 : theme.spacing.xs }}>\n <Button\n label={c.label}\n onPress={c.onPress}\n disabled={c.disabled}\n variant=\"secondary\"\n />\n </View>\n ))}\n </View>\n ) : null}\n </View>\n </View>\n );\n\n if (choices && choices.length > 0) {\n return (\n <Panel variant=\"elevated\" padding=\"md\" style={style}>\n {body}\n </Panel>\n );\n }\n\n return (\n <Pressable onPress={onAdvance}>\n <Panel variant=\"elevated\" padding=\"md\" style={style}>\n {body}\n </Panel>\n </Pressable>\n );\n}\n","/**\n * Keyboard + (future) gamepad focus navigation.\n *\n * Primitives register themselves with the focus manager by id + tab order.\n * The manager owns which id is currently focused and exposes `next` / `prev`\n * / `activate` actions for a driver (keyboard key handler, gamepad dpad)\n * to call. Components read `focusedId` to render a focus ring.\n */\n\nexport interface FocusNode {\n id: string;\n /** Lower tabIndex is focused first. Nodes with equal tabIndex fall back to registration order. */\n tabIndex: number;\n /** Called when this node is activated (Enter / A button). */\n onActivate?: () => void;\n /** Called when this node receives focus. */\n onFocus?: () => void;\n /** Called when this node loses focus. */\n onBlur?: () => void;\n /** If true, the node is skipped during navigation. */\n disabled?: boolean;\n}\n\nexport interface FocusManager {\n register(node: FocusNode): () => void;\n unregister(id: string): void;\n focus(id: string): void;\n /** Explicit opt-in initial focus: focuses the first node in tab order (or clears if empty). */\n focusFirst(): void;\n blur(): void;\n next(): void;\n prev(): void;\n activate(): void;\n getFocused(): string | null;\n getOrder(): readonly string[];\n subscribe(listener: (focusedId: string | null) => void): () => void;\n}\n\ninterface Entry extends FocusNode {\n seq: number;\n}\n\nexport function createFocusManager(): FocusManager {\n const nodes = new Map<string, Entry>();\n let seqCounter = 0;\n let focusedId: string | null = null;\n const listeners = new Set<(id: string | null) => void>();\n\n function notify(): void {\n for (const l of listeners) l(focusedId);\n }\n\n function orderedIds(): string[] {\n const entries = Array.from(nodes.values()).filter((e) => !e.disabled);\n entries.sort((a, b) => {\n if (a.tabIndex !== b.tabIndex) return a.tabIndex - b.tabIndex;\n return a.seq - b.seq;\n });\n return entries.map((e) => e.id);\n }\n\n function setFocused(next: string | null): void {\n if (next === focusedId) return;\n const prev = focusedId;\n focusedId = next;\n if (prev !== null) nodes.get(prev)?.onBlur?.();\n if (next !== null) nodes.get(next)?.onFocus?.();\n notify();\n }\n\n function move(delta: 1 | -1): void {\n const order = orderedIds();\n if (order.length === 0) {\n setFocused(null);\n return;\n }\n if (focusedId === null) {\n setFocused(delta === 1 ? (order[0] ?? null) : (order[order.length - 1] ?? null));\n return;\n }\n const idx = order.indexOf(focusedId);\n if (idx === -1) {\n setFocused(order[0] ?? null);\n return;\n }\n const nextIdx = (idx + delta + order.length) % order.length;\n setFocused(order[nextIdx] ?? null);\n }\n\n return {\n register(node) {\n // No focus side-effect: on a touch-first engine an auto-focused first\n // registrant paints a permanent focus ring with no input. Focus stays null\n // until a driver (keyboard/gamepad) or an explicit focusFirst() acts.\n const entry: Entry = { ...node, seq: seqCounter++ };\n nodes.set(node.id, entry);\n return () => {\n this.unregister(node.id);\n };\n },\n unregister(id) {\n if (!nodes.has(id)) return;\n nodes.delete(id);\n if (focusedId === id) {\n const order = orderedIds();\n setFocused(order[0] ?? null);\n }\n },\n focus(id) {\n const entry = nodes.get(id);\n if (!entry || entry.disabled) return;\n setFocused(id);\n },\n focusFirst() {\n const order = orderedIds();\n setFocused(order[0] ?? null);\n },\n blur() {\n setFocused(null);\n },\n next() {\n move(1);\n },\n prev() {\n move(-1);\n },\n activate() {\n if (focusedId === null) return;\n nodes.get(focusedId)?.onActivate?.();\n },\n getFocused() {\n return focusedId;\n },\n getOrder() {\n return orderedIds();\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n","import type { FocusManager } from './focus.js';\n\n/** Structural key source — createKeyboard() from @flare-engine/input is assignable; no hard dep. */\nexport interface FocusKeySource {\n wasPressed(code: string): boolean;\n}\n\nexport interface FocusKeyboardDriver {\n /** Call once per frame; polls edges and drives the manager. */\n update(): void;\n}\n\nexport interface FocusKeyboardDriverOptions {\n next?: readonly string[];\n prev?: readonly string[];\n activate?: readonly string[];\n}\n\nconst DEFAULT_NEXT: readonly string[] = ['ArrowDown', 'ArrowRight', 'Tab'];\nconst DEFAULT_PREV: readonly string[] = ['ArrowUp', 'ArrowLeft'];\nconst DEFAULT_ACTIVATE: readonly string[] = ['Enter', 'Space'];\n\nexport function createFocusKeyboardDriver(\n manager: FocusManager,\n keys: FocusKeySource,\n options?: FocusKeyboardDriverOptions,\n): FocusKeyboardDriver {\n const nextCodes = options?.next ?? DEFAULT_NEXT;\n const prevCodes = options?.prev ?? DEFAULT_PREV;\n const activateCodes = options?.activate ?? DEFAULT_ACTIVATE;\n\n return {\n update(): void {\n for (let i = 0; i < nextCodes.length; i++) {\n if (keys.wasPressed(nextCodes[i]!)) {\n manager.next();\n return;\n }\n }\n for (let i = 0; i < prevCodes.length; i++) {\n if (keys.wasPressed(prevCodes[i]!)) {\n manager.prev();\n return;\n }\n }\n for (let i = 0; i < activateCodes.length; i++) {\n if (keys.wasPressed(activateCodes[i]!)) {\n manager.activate();\n return;\n }\n }\n },\n };\n}\n","import { createElement, type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { createFocusManager, type FocusManager } from './focus.js';\nimport { FocusContext, type FocusContextValue } from './focus-context.js';\n\nexport interface FocusProviderProps {\n manager?: FocusManager;\n /**\n * Opt-in initial focus: focus the tab-order first node once, at the commit\n * where this provider mounts. Off by default so a touch-first tree shows no\n * focus ring until a driver acts. This is mount-time only — it picks among the\n * nodes registered by that first commit and does not re-fire for children that\n * mount later (async/lazy sets). For a dynamic set drive focus explicitly\n * (a keyboard/gamepad driver, or manager.focusFirst()).\n */\n autoFocus?: boolean;\n children: ReactNode;\n}\n\n/**\n * Instantiates a FocusManager (or uses the one provided) and publishes\n * { manager, focusedId } as context state so consumers re-render on focus\n * moves.\n */\nexport function FocusProvider({ manager, autoFocus, children }: FocusProviderProps): ReactNode {\n const [mgr] = useState<FocusManager>(() => manager ?? createFocusManager());\n const [focusedId, setFocusedId] = useState<string | null>(() => mgr.getFocused());\n\n useEffect(() => {\n setFocusedId(mgr.getFocused());\n return mgr.subscribe((id) => {\n setFocusedId(id);\n });\n }, [mgr]);\n\n useEffect(() => {\n // Child register effects run before this parent effect, so every node is\n // registered here → focusFirst() picks the true tab-order first.\n if (autoFocus && mgr.getFocused() === null) mgr.focusFirst();\n }, [autoFocus, mgr]);\n\n const value = useMemo<FocusContextValue>(() => ({ manager: mgr, focusedId }), [mgr, focusedId]);\n\n return createElement(FocusContext.Provider, { value }, children);\n}\n","import type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport interface ProgressBarProps {\n /** Progress in [0, 1]. Values outside are clamped. */\n value: number;\n /** Height of the bar in pixels. */\n height?: number;\n /** Track color override. Defaults to theme.colors.surfaceAlt. */\n trackColor?: string;\n /** Fill color override. Defaults to theme.colors.accent. */\n fillColor?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function ProgressBar({\n value,\n height = 8,\n trackColor,\n fillColor,\n style,\n}: ProgressBarProps): ReactNode {\n const theme = useTheme();\n const clamped = Number.isNaN(value) ? 0 : Math.max(0, Math.min(1, value));\n const r = theme.radii.sm;\n\n return (\n <View\n style={[\n {\n height,\n borderRadius: r,\n backgroundColor: trackColor ?? theme.colors.surfaceAlt,\n overflow: 'hidden',\n },\n style,\n ]}\n >\n <View\n style={{\n width: `${clamped * 100}%`,\n height: '100%',\n backgroundColor: fillColor ?? theme.colors.accent,\n }}\n />\n </View>\n );\n}\n","import type { ReactNode } from 'react';\nimport { View } from 'react-native';\nimport { Label } from './label.js';\nimport { ProgressBar } from './progress-bar.js';\nimport { useTheme } from './theme.js';\n\nexport type HUDBarKind = 'hp' | 'mp' | 'xp' | 'custom';\n\nexport interface HUDBarProps {\n label: string;\n value: number;\n max: number;\n kind?: HUDBarKind;\n /** When true, shows \"value / max\" next to the label. */\n showNumbers?: boolean;\n /** Override bar fill color. */\n fillColor?: string;\n}\n\nexport function HUDBar({\n label,\n value,\n max,\n kind = 'custom',\n showNumbers = true,\n fillColor,\n}: HUDBarProps): ReactNode {\n const theme = useTheme();\n const ratio = max <= 0 ? 0 : value / max;\n\n let color = fillColor;\n if (!color) {\n switch (kind) {\n case 'hp':\n color = theme.colors.danger;\n break;\n case 'mp':\n color = theme.colors.accent;\n break;\n case 'xp':\n color = theme.colors.success;\n break;\n default:\n color = theme.colors.accent;\n }\n }\n\n return (\n <View>\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n marginBottom: theme.spacing.xs,\n }}\n >\n <Label variant=\"sm\" tone=\"muted\">\n {label}\n </Label>\n {showNumbers && (\n <Label variant=\"sm\" tone=\"muted\" mono>\n {`${Math.max(0, Math.floor(value))} / ${Math.max(0, Math.floor(max))}`}\n </Label>\n )}\n </View>\n <ProgressBar value={ratio} fillColor={color} />\n </View>\n );\n}\n","/**\n * Minimal flex-like layout resolver.\n *\n * Computes positions + sizes for a single container + its direct children.\n * Supports row/column direction, gap, padding, main-axis `justifyContent`,\n * cross-axis `alignItems`, and per-child `grow` / `basis` / fixed size.\n *\n * Pure function — callers use it to drive their own renderer. React Native\n * already does its own flex, so this is primarily for Skia-rendered HUD /\n * menu layouts that need deterministic pixel positions.\n */\n\nexport type FlexDirection = 'row' | 'column';\nexport type JustifyContent =\n | 'start'\n | 'end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly';\nexport type AlignItems = 'start' | 'end' | 'center' | 'stretch';\n\nexport interface Padding {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface LayoutChild {\n /** Fixed main-axis size. Ignored when `grow > 0`. */\n basis?: number;\n /** Fractional share of leftover main-axis space. */\n grow?: number;\n /** Fixed cross-axis size. Overrides stretch. */\n crossSize?: number;\n}\n\nexport interface LayoutContainer {\n width: number;\n height: number;\n direction: FlexDirection;\n gap?: number;\n padding?: Partial<Padding>;\n justifyContent?: JustifyContent;\n alignItems?: AlignItems;\n}\n\nexport interface LayoutRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nconst ZERO_PAD: Padding = { top: 0, right: 0, bottom: 0, left: 0 };\n\nfunction resolvePadding(p: Partial<Padding> | undefined): Padding {\n if (!p) return ZERO_PAD;\n return {\n top: p.top ?? 0,\n right: p.right ?? 0,\n bottom: p.bottom ?? 0,\n left: p.left ?? 0,\n };\n}\n\nexport function resolveLayout(\n container: LayoutContainer,\n children: readonly LayoutChild[],\n): LayoutRect[] {\n const n = children.length;\n if (n === 0) return [];\n\n const pad = resolvePadding(container.padding);\n const gap = container.gap ?? 0;\n const isRow = container.direction === 'row';\n const mainSize =\n (isRow ? container.width : container.height) -\n (isRow ? pad.left + pad.right : pad.top + pad.bottom);\n const crossSize =\n (isRow ? container.height : container.width) -\n (isRow ? pad.top + pad.bottom : pad.left + pad.right);\n const mainStart = isRow ? pad.left : pad.top;\n const crossStart = isRow ? pad.top : pad.left;\n const justify = container.justifyContent ?? 'start';\n const align = container.alignItems ?? 'stretch';\n const totalGap = gap * Math.max(0, n - 1);\n\n let totalBasis = 0;\n let totalGrow = 0;\n for (const c of children) {\n totalBasis += c.basis ?? 0;\n totalGrow += c.grow ?? 0;\n }\n\n const leftover = mainSize - totalBasis - totalGap;\n const sizes: number[] = new Array(n);\n for (let i = 0; i < n; i++) {\n const c = children[i] as LayoutChild;\n const base = c.basis ?? 0;\n const growShare = totalGrow > 0 ? ((c.grow ?? 0) / totalGrow) * Math.max(0, leftover) : 0;\n sizes[i] = Math.max(0, base + growShare);\n }\n\n const used = sizes.reduce((acc, s) => acc + s, 0) + totalGap;\n const free = Math.max(0, mainSize - used);\n\n let cursor = mainStart;\n let spacing = gap;\n switch (justify) {\n case 'start':\n break;\n case 'end':\n cursor = mainStart + free;\n break;\n case 'center':\n cursor = mainStart + free / 2;\n break;\n case 'space-between':\n if (n > 1) spacing = gap + free / (n - 1);\n break;\n case 'space-around':\n if (n > 0) {\n const s = free / n;\n cursor = mainStart + s / 2;\n spacing = gap + s;\n }\n break;\n case 'space-evenly':\n if (n >= 0) {\n const s = free / (n + 1);\n cursor = mainStart + s;\n spacing = gap + s;\n }\n break;\n }\n\n const out: LayoutRect[] = new Array(n);\n for (let i = 0; i < n; i++) {\n const c = children[i] as LayoutChild;\n const mainLen = sizes[i] as number;\n const crossLen = c.crossSize !== undefined ? c.crossSize : align === 'stretch' ? crossSize : 0;\n\n let crossOffset: number;\n switch (align) {\n case 'start':\n crossOffset = 0;\n break;\n case 'end':\n crossOffset = crossSize - crossLen;\n break;\n case 'center':\n crossOffset = (crossSize - crossLen) / 2;\n break;\n case 'stretch':\n crossOffset = 0;\n break;\n }\n\n const x = isRow ? cursor : crossStart + crossOffset;\n const y = isRow ? crossStart + crossOffset : cursor;\n const w = isRow ? mainLen : crossLen;\n const h = isRow ? crossLen : mainLen;\n\n out[i] = { x, y, width: w, height: h };\n cursor += mainLen + spacing;\n }\n\n return out;\n}\n","import { Children, Fragment, type ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport interface ListProps {\n children?: ReactNode;\n /** Gap between items in pixels. Defaults to theme.spacing.sm. */\n gap?: number;\n direction?: 'column' | 'row';\n style?: StyleProp<ViewStyle>;\n}\n\n/**\n * Vertical (or horizontal) stack with consistent gap. Thin container; the\n * focus manager handles navigation between interactive children.\n */\nexport function List({ children, gap, direction = 'column', style }: ListProps): ReactNode {\n const theme = useTheme();\n const g = gap ?? theme.spacing.sm;\n\n const items: ReactNode[] = [];\n let i = 0;\n // `Children.toArray` flattens nested arrays (e.g. a `{items.map(...)}` child\n // sitting alongside JSX siblings) and drops null/undefined/boolean, unlike a\n // manual `Array.isArray` split which only unwraps one level.\n const flat = Children.toArray(children);\n for (const child of flat) {\n if (i > 0) {\n const spacerStyle: ViewStyle = direction === 'row' ? { width: g } : { height: g };\n items.push(<View key={`s-${i}`} style={spacerStyle} />);\n }\n items.push(<Fragment key={`i-${i}`}>{child}</Fragment>);\n i++;\n }\n\n return <View style={[{ flexDirection: direction }, style]}>{items}</View>;\n}\n","import type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { Button, type ButtonVariant } from './button.js';\nimport { Label } from './label.js';\nimport { useTheme } from './theme.js';\n\nexport interface MainMenuItem {\n /** Stable id — used as focus id + React key. */\n readonly id: string;\n /** Localized label. */\n readonly label: string;\n readonly onPress: () => void;\n readonly variant?: ButtonVariant;\n readonly disabled?: boolean;\n}\n\nexport interface MainMenuKitProps {\n /** Localized title. */\n readonly title: string;\n /** Optional localized subtitle — tagline, version, locale flag, etc. */\n readonly subtitle?: string;\n /** Button list. Rendered top-to-bottom in order. */\n readonly items: readonly MainMenuItem[];\n /**\n * Optional footer slot — typically a row of ghost buttons (credits, links)\n * or a version/build string.\n */\n readonly footer?: ReactNode;\n readonly style?: StyleProp<ViewStyle>;\n}\n\n/**\n * Title-screen kit: headline, optional subtitle, vertical button list,\n * optional footer slot. All strings are caller-supplied (localized upstream).\n *\n * Save-slot / settings / credits panels are built on top of this kit by the\n * consumer; the kit itself is a pure title-menu primitive.\n */\nexport function MainMenuKit({\n title,\n subtitle,\n items,\n footer,\n style,\n}: MainMenuKitProps): ReactNode {\n const theme = useTheme();\n return (\n <View\n style={[\n {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing.lg,\n },\n style,\n ]}\n >\n <Label variant=\"xl\" tone=\"accent\" style={{ marginBottom: theme.spacing.xs }}>\n {title}\n </Label>\n {subtitle !== undefined ? (\n <Label variant=\"sm\" tone=\"muted\" style={{ marginBottom: theme.spacing.lg }}>\n {subtitle}\n </Label>\n ) : (\n <View style={{ height: theme.spacing.lg }} />\n )}\n <View style={{ alignSelf: 'stretch', maxWidth: 320, width: '100%' }}>\n {items.map((item, i) => (\n <View key={item.id} style={{ marginTop: i === 0 ? 0 : theme.spacing.sm }}>\n <Button\n label={item.label}\n onPress={item.onPress}\n variant={item.variant ?? 'primary'}\n disabled={item.disabled}\n focusId={item.id}\n tabIndex={i}\n />\n </View>\n ))}\n </View>\n {footer !== undefined ? <View style={{ marginTop: theme.spacing.lg }}>{footer}</View> : null}\n </View>\n );\n}\n","import type { ReactNode } from 'react';\nimport { Pressable, View } from 'react-native';\nimport { Panel } from './panel.js';\n\nexport interface ModalProps {\n visible: boolean;\n children?: ReactNode;\n /** Called when the backdrop is pressed. Return nothing to close, or do nothing to make it non-dismissable. */\n onBackdropPress?: () => void;\n /** Backdrop opacity 0..1. Defaults to 0.6. */\n backdropOpacity?: number;\n}\n\n/**\n * Overlay modal that renders a centered `Panel` with its children. Parent is\n * responsible for controlling visibility and (if desired) focus trapping via\n * the shared FocusManager.\n */\nexport function Modal({\n visible,\n children,\n onBackdropPress,\n backdropOpacity = 0.6,\n}: ModalProps): ReactNode {\n if (!visible) return null;\n\n return (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n pointerEvents=\"box-none\"\n >\n <Pressable\n onPress={onBackdropPress}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: `rgba(0,0,0,${backdropOpacity})`,\n }}\n />\n <Panel variant=\"elevated\" padding=\"lg\" style={{ minWidth: 240, maxWidth: '80%' }}>\n {children}\n </Panel>\n </View>\n );\n}\n"],"mappings":";;;;;AAQA,MAAa,gBAAA,GAAeA,MAAAA,cAAAA,CAAwC,IAAI;AAExE,SAAgB,kBAAuC;CACrD,MAAM,OAAA,GAAMC,MAAAA,WAAAA,CAAW,YAAY;CACnC,OAAO,MAAM,IAAI,UAAU;AAC7B;AAEA,SAAgB,eAA8B;CAC5C,MAAM,OAAA,GAAMA,MAAAA,WAAAA,CAAW,YAAY;CACnC,OAAO,MAAM,IAAI,YAAY;AAC/B;;ACiCA,MAAa,YAAmB;CAC9B,MAAM;CACN,QAAQ;EACN,IAAI;EACJ,SAAS;EACT,YAAY;EACZ,QAAQ;EACR,MAAM;EACN,WAAW;EACX,QAAQ;EACR,YAAY;EACZ,QAAQ;EACR,SAAS;EACT,SAAS;EACT,OAAO;CACT;CACA,SAAS;EAAE,IAAI;EAAG,IAAI;EAAG,IAAI;EAA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AO;IAAE,UAAU;IAAK,UAAU;GAAM;GAC5E;EACI,CAAA,CACH;;AAEV"}
1
+ {"version":3,"file":"index.js","names":["createContext","useContext","createContext","createElement","useContext","useId","useRef","Pressable","View","Text","StyleSheet","Text","View","View","Pressable","useState","createFocusManager","useMemo","createElement","View","View","Children","View","Fragment","View","View","Pressable"],"sources":["../src/focus-context.ts","../src/theme.ts","../src/button.tsx","../src/label.tsx","../src/panel.tsx","../src/dialogue-panel.tsx","../src/focus-provider.tsx","../src/progress-bar.tsx","../src/hud-bar.tsx","../src/layout.ts","../src/list.tsx","../src/main-menu-kit.tsx","../src/modal.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { FocusManager } from './focus.js';\n\nexport interface FocusContextValue {\n manager: FocusManager;\n focusedId: string | null;\n}\n\nexport const FocusContext = createContext<FocusContextValue | null>(null);\n\nexport function useFocusManager(): FocusManager | null {\n const ctx = useContext(FocusContext);\n return ctx ? ctx.manager : null;\n}\n\nexport function useFocusedId(): string | null {\n const ctx = useContext(FocusContext);\n return ctx ? ctx.focusedId : null;\n}\n","import { createContext, createElement, type ReactNode, useContext } from 'react';\n\nexport interface ThemeColors {\n bg: string;\n surface: string;\n surfaceAlt: string;\n border: string;\n text: string;\n textMuted: string;\n accent: string;\n accentText: string;\n danger: string;\n success: string;\n warning: string;\n focus: string;\n}\n\nexport interface ThemeSpacing {\n xs: number;\n sm: number;\n md: number;\n lg: number;\n xl: number;\n}\n\nexport interface ThemeTypography {\n sizeXs: number;\n sizeSm: number;\n sizeMd: number;\n sizeLg: number;\n sizeXl: number;\n fontFamily?: string;\n fontFamilyMono?: string;\n}\n\nexport interface ThemeRadii {\n none: number;\n sm: number;\n md: number;\n lg: number;\n pill: number;\n}\n\nexport interface Theme {\n name: string;\n colors: ThemeColors;\n spacing: ThemeSpacing;\n typography: ThemeTypography;\n radii: ThemeRadii;\n}\n\nexport const darkTheme: Theme = {\n name: 'dark',\n colors: {\n bg: '#0b0d10',\n surface: '#14181d',\n surfaceAlt: '#1d232b',\n border: '#2a323c',\n text: '#e7ecf1',\n textMuted: '#8c96a3',\n accent: '#4aa3ff',\n accentText: '#0b0d10',\n danger: '#ff5c5c',\n success: '#5dd39e',\n warning: '#f1c40f',\n focus: '#ffd166',\n },\n spacing: { xs: 4, sm: 8, md: 12, lg: 20, xl: 32 },\n typography: {\n sizeXs: 10,\n sizeSm: 12,\n sizeMd: 14,\n sizeLg: 18,\n sizeXl: 24,\n },\n radii: { none: 0, sm: 4, md: 8, lg: 16, pill: 9999 },\n};\n\nexport const lightTheme: Theme = {\n name: 'light',\n colors: {\n bg: '#f6f8fa',\n surface: '#ffffff',\n surfaceAlt: '#eef1f4',\n border: '#d4dae0',\n text: '#13181d',\n textMuted: '#5b6670',\n accent: '#0a66d0',\n accentText: '#ffffff',\n danger: '#d12e2e',\n success: '#2f9d69',\n warning: '#c79600',\n focus: '#ff9500',\n },\n spacing: { xs: 4, sm: 8, md: 12, lg: 20, xl: 32 },\n typography: {\n sizeXs: 10,\n sizeSm: 12,\n sizeMd: 14,\n sizeLg: 18,\n sizeXl: 24,\n },\n radii: { none: 0, sm: 4, md: 8, lg: 16, pill: 9999 },\n};\n\nconst ThemeContext = createContext<Theme>(darkTheme);\n\nexport interface ThemeProviderProps {\n theme?: Theme;\n children: ReactNode;\n}\n\nexport function ThemeProvider({ theme = darkTheme, children }: ThemeProviderProps): ReactNode {\n return createElement(ThemeContext.Provider, { value: theme }, children);\n}\n\nexport function useTheme(): Theme {\n return useContext(ThemeContext);\n}\n","import { type ReactNode, useEffect, useId, useRef } from 'react';\nimport { Pressable, type StyleProp, StyleSheet, Text, View, type ViewStyle } from 'react-native';\nimport { useFocusedId, useFocusManager } from './focus-context.js';\nimport { useTheme } from './theme.js';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';\n\nexport interface ButtonProps {\n label: string;\n onPress?: () => void;\n variant?: ButtonVariant;\n disabled?: boolean;\n /** Focus-navigation tab order. Lower is earlier. Defaults to 0. */\n tabIndex?: number;\n /** Stable focus id. If omitted, a generated id is used. */\n focusId?: string;\n /**\n * Move focus to this button when it is pressed. Defaults to `true`. Set\n * `false` on touch-first screens so a tap leaves no focus ring behind;\n * `onPress` still fires.\n */\n focusOnPress?: boolean;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Button({\n label,\n onPress,\n variant = 'primary',\n disabled = false,\n tabIndex = 0,\n focusId,\n focusOnPress = true,\n style,\n}: ButtonProps): ReactNode {\n const theme = useTheme();\n const manager = useFocusManager();\n const focusedId = useFocusedId();\n const generated = useId();\n const id = focusId ?? generated;\n\n const latest = useRef({ onPress, disabled, tabIndex });\n latest.current = { onPress, disabled, tabIndex };\n const activateRef = useRef(() => {\n const { onPress: press, disabled: off } = latest.current;\n if (!off) press?.();\n });\n\n // Register once per (manager, id) and own the disposer; prop changes below\n // re-register in place so focus and tab order survive parent re-renders.\n useEffect(() => {\n if (!manager) return;\n const { tabIndex: order, disabled: off } = latest.current;\n return manager.register({\n id,\n tabIndex: order,\n disabled: off,\n onActivate: activateRef.current,\n });\n }, [manager, id]);\n\n useEffect(() => {\n if (!manager) return;\n manager.register({ id, tabIndex, disabled, onActivate: activateRef.current });\n }, [manager, id, tabIndex, disabled]);\n\n const focused = focusedId === id;\n\n let bg = theme.colors.surface;\n let fg = theme.colors.text;\n let border = theme.colors.border;\n switch (variant) {\n case 'primary':\n bg = theme.colors.accent;\n fg = theme.colors.accentText;\n border = theme.colors.accent;\n break;\n case 'secondary':\n bg = theme.colors.surfaceAlt;\n fg = theme.colors.text;\n border = theme.colors.border;\n break;\n case 'ghost':\n bg = 'transparent';\n fg = theme.colors.text;\n border = 'transparent';\n break;\n case 'danger':\n bg = theme.colors.danger;\n fg = theme.colors.accentText;\n border = theme.colors.danger;\n break;\n }\n\n const container: ViewStyle = {\n backgroundColor: bg,\n borderColor: focused ? theme.colors.focus : border,\n borderWidth: focused ? 2 : 1,\n borderRadius: theme.radii.md,\n paddingHorizontal: theme.spacing.md,\n paddingVertical: theme.spacing.sm,\n opacity: disabled ? 0.5 : 1,\n };\n\n return (\n <Pressable\n onPress={() => {\n if (disabled) return;\n if (focusOnPress) manager?.focus(id);\n onPress?.();\n }}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ disabled, selected: focused }}\n style={[styles.wrap, container, style]}\n >\n <View>\n <Text style={{ color: fg, fontSize: theme.typography.sizeMd, textAlign: 'center' }}>\n {label}\n </Text>\n </View>\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n alignSelf: 'stretch',\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n","import type { ReactNode } from 'react';\nimport { type StyleProp, Text, type TextProps, type TextStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport type LabelVariant = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\nexport type LabelTone = 'default' | 'muted' | 'accent' | 'danger' | 'success' | 'warning';\n\nexport interface LabelProps {\n children?: ReactNode;\n variant?: LabelVariant;\n tone?: LabelTone;\n mono?: boolean;\n style?: StyleProp<TextStyle>;\n numberOfLines?: number;\n ellipsizeMode?: TextProps['ellipsizeMode'];\n adjustsFontSizeToFit?: boolean;\n minimumFontScale?: number;\n}\n\nexport function Label({\n children,\n variant = 'md',\n tone = 'default',\n mono = false,\n style,\n numberOfLines,\n ellipsizeMode,\n adjustsFontSizeToFit,\n minimumFontScale,\n}: LabelProps): ReactNode {\n const theme = useTheme();\n const sizeMap = {\n xs: theme.typography.sizeXs,\n sm: theme.typography.sizeSm,\n md: theme.typography.sizeMd,\n lg: theme.typography.sizeLg,\n xl: theme.typography.sizeXl,\n };\n const toneMap = {\n default: theme.colors.text,\n muted: theme.colors.textMuted,\n accent: theme.colors.accent,\n danger: theme.colors.danger,\n success: theme.colors.success,\n warning: theme.colors.warning,\n };\n\n const base: TextStyle = {\n color: toneMap[tone],\n fontSize: sizeMap[variant],\n fontFamily: mono ? theme.typography.fontFamilyMono : theme.typography.fontFamily,\n };\n\n return (\n <Text\n numberOfLines={numberOfLines}\n ellipsizeMode={ellipsizeMode}\n adjustsFontSizeToFit={adjustsFontSizeToFit}\n minimumFontScale={minimumFontScale}\n style={[base, style]}\n >\n {children}\n </Text>\n );\n}\n","import type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport interface PanelProps {\n children?: ReactNode;\n /** Visual style: surface (default) or elevated (surfaceAlt + border). */\n variant?: 'surface' | 'elevated';\n /** Padding size token. Defaults to 'md'. */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Corner radius token. Defaults to 'md'. */\n radius?: 'none' | 'sm' | 'md' | 'lg' | 'pill';\n style?: StyleProp<ViewStyle>;\n}\n\nexport function Panel({\n children,\n variant = 'surface',\n padding = 'md',\n radius = 'md',\n style,\n}: PanelProps): ReactNode {\n const theme = useTheme();\n const bg = variant === 'elevated' ? theme.colors.surfaceAlt : theme.colors.surface;\n const pad = padding === 'none' ? 0 : theme.spacing[padding];\n const r = theme.radii[radius];\n\n const base: ViewStyle = {\n backgroundColor: bg,\n padding: pad,\n borderRadius: r,\n borderWidth: variant === 'elevated' ? 1 : 0,\n borderColor: theme.colors.border,\n };\n\n return <View style={[base, style]}>{children}</View>;\n}\n","import type { ReactNode } from 'react';\nimport { Pressable, type StyleProp, View, type ViewStyle } from 'react-native';\nimport { Button } from './button.js';\nimport { Label } from './label.js';\nimport { Panel } from './panel.js';\nimport { useTheme } from './theme.js';\n\nexport interface DialogueChoice {\n /** Display label (already localized by the caller). */\n readonly label: string;\n /** Called when the player selects this choice. */\n readonly onPress: () => void;\n readonly disabled?: boolean;\n}\n\nexport interface DialoguePanelProps {\n /** Speaker name — rendered above the text. */\n readonly speaker: string;\n /** Line text — rendered in the body. */\n readonly text: string;\n /**\n * Portrait node. Typically an `<Image>` or a Skia/shape avatar keyed by\n * `LineNode.speakerPortraitKey`. When omitted, the portrait slot collapses.\n */\n readonly portrait?: ReactNode;\n /**\n * Optional choices. When present, renders a `Button` per option; when\n * absent, the panel tap-advances via `onAdvance`.\n */\n readonly choices?: readonly DialogueChoice[];\n /** Advance callback — used only when `choices` is empty / omitted. */\n readonly onAdvance?: () => void;\n readonly style?: StyleProp<ViewStyle>;\n}\n\n/**\n * Dialogue panel with a portrait slot. Pairs with `@flare-engine/dialogue`\n * — subscribe to `runner.onLine` and pass `speakerPortraitKey` → your\n * portrait resolver → `portrait` here.\n *\n * Portrait resolution is caller-owned so the UI kit stays asset-agnostic.\n */\nexport function DialoguePanel({\n speaker,\n text,\n portrait,\n choices,\n onAdvance,\n style,\n}: DialoguePanelProps): ReactNode {\n const theme = useTheme();\n const body = (\n <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>\n {portrait !== undefined ? (\n <View style={{ marginRight: theme.spacing.md }}>{portrait}</View>\n ) : null}\n <View style={{ flex: 1 }}>\n <Label variant=\"sm\" tone=\"accent\" style={{ marginBottom: theme.spacing.xs }}>\n {speaker}\n </Label>\n <Label variant=\"md\">{text}</Label>\n {choices && choices.length > 0 ? (\n <View style={{ marginTop: theme.spacing.md }}>\n {choices.map((c, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static choice list, never reordered\n <View key={`${c.label}-${i}`} style={{ marginTop: i === 0 ? 0 : theme.spacing.xs }}>\n <Button\n label={c.label}\n onPress={c.onPress}\n disabled={c.disabled}\n variant=\"secondary\"\n />\n </View>\n ))}\n </View>\n ) : null}\n </View>\n </View>\n );\n\n if (choices && choices.length > 0) {\n return (\n <Panel variant=\"elevated\" padding=\"md\" style={style}>\n {body}\n </Panel>\n );\n }\n\n return (\n <Pressable onPress={onAdvance}>\n <Panel variant=\"elevated\" padding=\"md\" style={style}>\n {body}\n </Panel>\n </Pressable>\n );\n}\n","import { createElement, type ReactNode, useEffect, useMemo, useState } from 'react';\nimport { createFocusManager, type FocusManager } from './focus.js';\nimport { FocusContext, type FocusContextValue } from './focus-context.js';\n\nexport interface FocusProviderProps {\n manager?: FocusManager;\n /**\n * Opt-in initial focus: focus the tab-order first node once, at the commit\n * where this provider mounts. Off by default so a touch-first tree shows no\n * focus ring until a driver acts. This is mount-time only — it picks among the\n * nodes registered by that first commit and does not re-fire for children that\n * mount later (async/lazy sets). For a dynamic set drive focus explicitly\n * (a keyboard/gamepad driver, or manager.focusFirst()).\n */\n autoFocus?: boolean;\n children: ReactNode;\n}\n\n/**\n * Instantiates a FocusManager (or uses the one provided) and publishes\n * { manager, focusedId } as context state so consumers re-render on focus\n * moves.\n */\nexport function FocusProvider({ manager, autoFocus, children }: FocusProviderProps): ReactNode {\n const [mgr] = useState<FocusManager>(() => manager ?? createFocusManager());\n const [focusedId, setFocusedId] = useState<string | null>(() => mgr.getFocused());\n\n useEffect(() => {\n setFocusedId(mgr.getFocused());\n return mgr.subscribe((id) => {\n setFocusedId(id);\n });\n }, [mgr]);\n\n useEffect(() => {\n // Child register effects run before this parent effect, so every node is\n // registered here → focusFirst() picks the true tab-order first.\n if (autoFocus && mgr.getFocused() === null) mgr.focusFirst();\n }, [autoFocus, mgr]);\n\n const value = useMemo<FocusContextValue>(() => ({ manager: mgr, focusedId }), [mgr, focusedId]);\n\n return createElement(FocusContext.Provider, { value }, children);\n}\n","import type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport interface ProgressBarProps {\n /** Progress in [0, 1]. Values outside are clamped. */\n value: number;\n /** Height of the bar in pixels. */\n height?: number;\n /** Track color override. Defaults to theme.colors.surfaceAlt. */\n trackColor?: string;\n /** Fill color override. Defaults to theme.colors.accent. */\n fillColor?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function ProgressBar({\n value,\n height = 8,\n trackColor,\n fillColor,\n style,\n}: ProgressBarProps): ReactNode {\n const theme = useTheme();\n const clamped = Number.isNaN(value) ? 0 : Math.max(0, Math.min(1, value));\n const r = theme.radii.sm;\n\n return (\n <View\n style={[\n {\n height,\n borderRadius: r,\n backgroundColor: trackColor ?? theme.colors.surfaceAlt,\n overflow: 'hidden',\n },\n style,\n ]}\n >\n <View\n style={{\n width: `${clamped * 100}%`,\n height: '100%',\n backgroundColor: fillColor ?? theme.colors.accent,\n }}\n />\n </View>\n );\n}\n","import type { ReactNode } from 'react';\nimport { View } from 'react-native';\nimport { Label } from './label.js';\nimport { ProgressBar } from './progress-bar.js';\nimport { useTheme } from './theme.js';\n\nexport type HUDBarKind = 'hp' | 'mp' | 'xp' | 'custom';\n\nexport interface HUDBarProps {\n label: string;\n value: number;\n max: number;\n kind?: HUDBarKind;\n /** When true, shows \"value / max\" next to the label. */\n showNumbers?: boolean;\n /** Override bar fill color. */\n fillColor?: string;\n}\n\nexport function HUDBar({\n label,\n value,\n max,\n kind = 'custom',\n showNumbers = true,\n fillColor,\n}: HUDBarProps): ReactNode {\n const theme = useTheme();\n const ratio = max <= 0 ? 0 : value / max;\n\n let color = fillColor;\n if (!color) {\n switch (kind) {\n case 'hp':\n color = theme.colors.danger;\n break;\n case 'mp':\n color = theme.colors.accent;\n break;\n case 'xp':\n color = theme.colors.success;\n break;\n default:\n color = theme.colors.accent;\n }\n }\n\n return (\n <View>\n <View\n style={{\n flexDirection: 'row',\n justifyContent: 'space-between',\n marginBottom: theme.spacing.xs,\n }}\n >\n <Label variant=\"sm\" tone=\"muted\">\n {label}\n </Label>\n {showNumbers && (\n <Label variant=\"sm\" tone=\"muted\" mono>\n {`${Math.max(0, Math.floor(value))} / ${Math.max(0, Math.floor(max))}`}\n </Label>\n )}\n </View>\n <ProgressBar value={ratio} fillColor={color} />\n </View>\n );\n}\n","/**\n * Minimal flex-like layout resolver.\n *\n * Computes positions + sizes for a single container + its direct children.\n * Supports row/column direction, gap, padding, main-axis `justifyContent`,\n * cross-axis `alignItems`, and per-child `grow` / `basis` / fixed size.\n *\n * Pure function — callers use it to drive their own renderer. React Native\n * already does its own flex, so this is primarily for Skia-rendered HUD /\n * menu layouts that need deterministic pixel positions.\n */\n\nexport type FlexDirection = 'row' | 'column';\nexport type JustifyContent =\n | 'start'\n | 'end'\n | 'center'\n | 'space-between'\n | 'space-around'\n | 'space-evenly';\nexport type AlignItems = 'start' | 'end' | 'center' | 'stretch';\n\nexport interface Padding {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface LayoutChild {\n /** Fixed main-axis size. Ignored when `grow > 0`. */\n basis?: number;\n /** Fractional share of leftover main-axis space. */\n grow?: number;\n /** Fixed cross-axis size. Overrides stretch. */\n crossSize?: number;\n}\n\nexport interface LayoutContainer {\n width: number;\n height: number;\n direction: FlexDirection;\n gap?: number;\n padding?: Partial<Padding>;\n justifyContent?: JustifyContent;\n alignItems?: AlignItems;\n}\n\nexport interface LayoutRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nconst ZERO_PAD: Padding = { top: 0, right: 0, bottom: 0, left: 0 };\n\nfunction resolvePadding(p: Partial<Padding> | undefined): Padding {\n if (!p) return ZERO_PAD;\n return {\n top: p.top ?? 0,\n right: p.right ?? 0,\n bottom: p.bottom ?? 0,\n left: p.left ?? 0,\n };\n}\n\nexport function resolveLayout(\n container: LayoutContainer,\n children: readonly LayoutChild[],\n): LayoutRect[] {\n const n = children.length;\n if (n === 0) return [];\n\n const pad = resolvePadding(container.padding);\n const gap = container.gap ?? 0;\n const isRow = container.direction === 'row';\n const mainSize =\n (isRow ? container.width : container.height) -\n (isRow ? pad.left + pad.right : pad.top + pad.bottom);\n const crossSize =\n (isRow ? container.height : container.width) -\n (isRow ? pad.top + pad.bottom : pad.left + pad.right);\n const mainStart = isRow ? pad.left : pad.top;\n const crossStart = isRow ? pad.top : pad.left;\n const justify = container.justifyContent ?? 'start';\n const align = container.alignItems ?? 'stretch';\n const totalGap = gap * Math.max(0, n - 1);\n\n let totalBasis = 0;\n let totalGrow = 0;\n for (const c of children) {\n totalBasis += c.basis ?? 0;\n totalGrow += c.grow ?? 0;\n }\n\n const leftover = mainSize - totalBasis - totalGap;\n const sizes: number[] = new Array(n);\n for (let i = 0; i < n; i++) {\n const c = children[i] as LayoutChild;\n const base = c.basis ?? 0;\n const growShare = totalGrow > 0 ? ((c.grow ?? 0) / totalGrow) * Math.max(0, leftover) : 0;\n sizes[i] = Math.max(0, base + growShare);\n }\n\n const used = sizes.reduce((acc, s) => acc + s, 0) + totalGap;\n const free = Math.max(0, mainSize - used);\n\n let cursor = mainStart;\n let spacing = gap;\n switch (justify) {\n case 'start':\n break;\n case 'end':\n cursor = mainStart + free;\n break;\n case 'center':\n cursor = mainStart + free / 2;\n break;\n case 'space-between':\n if (n > 1) spacing = gap + free / (n - 1);\n break;\n case 'space-around':\n if (n > 0) {\n const s = free / n;\n cursor = mainStart + s / 2;\n spacing = gap + s;\n }\n break;\n case 'space-evenly':\n if (n >= 0) {\n const s = free / (n + 1);\n cursor = mainStart + s;\n spacing = gap + s;\n }\n break;\n }\n\n const out: LayoutRect[] = new Array(n);\n for (let i = 0; i < n; i++) {\n const c = children[i] as LayoutChild;\n const mainLen = sizes[i] as number;\n const crossLen = c.crossSize !== undefined ? c.crossSize : align === 'stretch' ? crossSize : 0;\n\n let crossOffset: number;\n switch (align) {\n case 'start':\n crossOffset = 0;\n break;\n case 'end':\n crossOffset = crossSize - crossLen;\n break;\n case 'center':\n crossOffset = (crossSize - crossLen) / 2;\n break;\n case 'stretch':\n crossOffset = 0;\n break;\n }\n\n const x = isRow ? cursor : crossStart + crossOffset;\n const y = isRow ? crossStart + crossOffset : cursor;\n const w = isRow ? mainLen : crossLen;\n const h = isRow ? crossLen : mainLen;\n\n out[i] = { x, y, width: w, height: h };\n cursor += mainLen + spacing;\n }\n\n return out;\n}\n","import { Children, Fragment, type ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { useTheme } from './theme.js';\n\nexport interface ListProps {\n children?: ReactNode;\n /** Gap between items in pixels. Defaults to theme.spacing.sm. */\n gap?: number;\n direction?: 'column' | 'row';\n style?: StyleProp<ViewStyle>;\n}\n\n/**\n * Vertical (or horizontal) stack with consistent gap. Thin container; the\n * focus manager handles navigation between interactive children.\n */\nexport function List({ children, gap, direction = 'column', style }: ListProps): ReactNode {\n const theme = useTheme();\n const g = gap ?? theme.spacing.sm;\n\n const items: ReactNode[] = [];\n let i = 0;\n // `Children.toArray` flattens nested arrays (e.g. a `{items.map(...)}` child\n // sitting alongside JSX siblings) and drops null/undefined/boolean, unlike a\n // manual `Array.isArray` split which only unwraps one level.\n const flat = Children.toArray(children);\n for (const child of flat) {\n if (i > 0) {\n const spacerStyle: ViewStyle = direction === 'row' ? { width: g } : { height: g };\n items.push(<View key={`s-${i}`} style={spacerStyle} />);\n }\n items.push(<Fragment key={`i-${i}`}>{child}</Fragment>);\n i++;\n }\n\n return <View style={[{ flexDirection: direction }, style]}>{items}</View>;\n}\n","import type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { Button, type ButtonVariant } from './button.js';\nimport { Label } from './label.js';\nimport { useTheme } from './theme.js';\n\nexport interface MainMenuItem {\n /** Stable id — used as focus id + React key. */\n readonly id: string;\n /** Localized label. */\n readonly label: string;\n readonly onPress: () => void;\n readonly variant?: ButtonVariant;\n readonly disabled?: boolean;\n}\n\nexport interface MainMenuKitProps {\n /** Localized title. */\n readonly title: string;\n /** Optional localized subtitle — tagline, version, locale flag, etc. */\n readonly subtitle?: string;\n /** Button list. Rendered top-to-bottom in order. */\n readonly items: readonly MainMenuItem[];\n /**\n * Optional footer slot — typically a row of ghost buttons (credits, links)\n * or a version/build string.\n */\n readonly footer?: ReactNode;\n readonly style?: StyleProp<ViewStyle>;\n}\n\n/**\n * Title-screen kit: headline, optional subtitle, vertical button list,\n * optional footer slot. All strings are caller-supplied (localized upstream).\n *\n * Save-slot / settings / credits panels are built on top of this kit by the\n * consumer; the kit itself is a pure title-menu primitive.\n */\nexport function MainMenuKit({\n title,\n subtitle,\n items,\n footer,\n style,\n}: MainMenuKitProps): ReactNode {\n const theme = useTheme();\n return (\n <View\n style={[\n {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: theme.spacing.lg,\n },\n style,\n ]}\n >\n <Label variant=\"xl\" tone=\"accent\" style={{ marginBottom: theme.spacing.xs }}>\n {title}\n </Label>\n {subtitle !== undefined ? (\n <Label variant=\"sm\" tone=\"muted\" style={{ marginBottom: theme.spacing.lg }}>\n {subtitle}\n </Label>\n ) : (\n <View style={{ height: theme.spacing.lg }} />\n )}\n <View style={{ alignSelf: 'stretch', maxWidth: 320, width: '100%' }}>\n {items.map((item, i) => (\n <View key={item.id} style={{ marginTop: i === 0 ? 0 : theme.spacing.sm }}>\n <Button\n label={item.label}\n onPress={item.onPress}\n variant={item.variant ?? 'primary'}\n disabled={item.disabled}\n focusId={item.id}\n tabIndex={i}\n />\n </View>\n ))}\n </View>\n {footer !== undefined ? <View style={{ marginTop: theme.spacing.lg }}>{footer}</View> : null}\n </View>\n );\n}\n","import type { ReactNode } from 'react';\nimport { Pressable, View } from 'react-native';\nimport { Panel } from './panel.js';\n\nexport interface ModalProps {\n visible: boolean;\n children?: ReactNode;\n /** Called when the backdrop is pressed. Return nothing to close, or do nothing to make it non-dismissable. */\n onBackdropPress?: () => void;\n /** Backdrop opacity 0..1. Defaults to 0.6. */\n backdropOpacity?: number;\n}\n\n/**\n * Overlay modal that renders a centered `Panel` with its children. Parent is\n * responsible for controlling visibility and (if desired) focus trapping via\n * the shared FocusManager.\n */\nexport function Modal({\n visible,\n children,\n onBackdropPress,\n backdropOpacity = 0.6,\n}: ModalProps): ReactNode {\n if (!visible) return null;\n\n return (\n <View\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n pointerEvents=\"box-none\"\n >\n <Pressable\n onPress={onBackdropPress}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: `rgba(0,0,0,${backdropOpacity})`,\n }}\n />\n <Panel variant=\"elevated\" padding=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