@flare-engine/ui 0.2.0 → 0.3.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/LICENSE +201 -21
- package/NOTICE +2 -0
- package/README.md +28 -11
- package/dist/index.d.mts +323 -279
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +323 -279
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +784 -737
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +763 -692
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,60 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
success: string;
|
|
16
|
-
warning: string;
|
|
17
|
-
focus: string;
|
|
18
|
-
}
|
|
19
|
-
interface ThemeSpacing {
|
|
20
|
-
xs: number;
|
|
21
|
-
sm: number;
|
|
22
|
-
md: number;
|
|
23
|
-
lg: number;
|
|
24
|
-
xl: number;
|
|
25
|
-
}
|
|
26
|
-
interface ThemeTypography {
|
|
27
|
-
sizeXs: number;
|
|
28
|
-
sizeSm: number;
|
|
29
|
-
sizeMd: number;
|
|
30
|
-
sizeLg: number;
|
|
31
|
-
sizeXl: number;
|
|
32
|
-
fontFamily?: string;
|
|
33
|
-
fontFamilyMono?: string;
|
|
34
|
-
}
|
|
35
|
-
interface ThemeRadii {
|
|
36
|
-
none: number;
|
|
37
|
-
sm: number;
|
|
38
|
-
md: number;
|
|
39
|
-
lg: number;
|
|
40
|
-
pill: number;
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { TextStyle, ViewStyle } from "react-native";
|
|
3
|
+
//#region src/button.d.ts
|
|
4
|
+
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
5
|
+
interface ButtonProps {
|
|
6
|
+
label: string;
|
|
7
|
+
onPress?: () => void;
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Focus-navigation tab order. Lower is earlier. Defaults to 0. */
|
|
11
|
+
tabIndex?: number;
|
|
12
|
+
/** Stable focus id. If omitted, a generated id is used. */
|
|
13
|
+
focusId?: string;
|
|
14
|
+
style?: ViewStyle;
|
|
41
15
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
16
|
+
declare function Button({ label, onPress, variant, disabled, tabIndex, focusId, style }: ButtonProps): ReactNode;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/dialogue-panel.d.ts
|
|
19
|
+
interface DialogueChoice {
|
|
20
|
+
/** Display label (already localized by the caller). */
|
|
21
|
+
readonly label: string;
|
|
22
|
+
/** Called when the player selects this choice. */
|
|
23
|
+
readonly onPress: () => void;
|
|
24
|
+
readonly disabled?: boolean;
|
|
48
25
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
26
|
+
interface DialoguePanelProps {
|
|
27
|
+
/** Speaker name — rendered above the text. */
|
|
28
|
+
readonly speaker: string;
|
|
29
|
+
/** Line text — rendered in the body. */
|
|
30
|
+
readonly text: string;
|
|
31
|
+
/**
|
|
32
|
+
* Portrait node. Typically an `<Image>` or a Skia/shape avatar keyed by
|
|
33
|
+
* `LineNode.speakerPortraitKey`. When omitted, the portrait slot collapses.
|
|
34
|
+
*/
|
|
35
|
+
readonly portrait?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Optional choices. When present, renders a `Button` per option; when
|
|
38
|
+
* absent, the panel tap-advances via `onAdvance`.
|
|
39
|
+
*/
|
|
40
|
+
readonly choices?: readonly DialogueChoice[];
|
|
41
|
+
/** Advance callback — used only when `choices` is empty / omitted. */
|
|
42
|
+
readonly onAdvance?: () => void;
|
|
43
|
+
readonly style?: ViewStyle;
|
|
54
44
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Dialogue panel with a portrait slot. Pairs with `@flare-engine/dialogue`
|
|
47
|
+
* — subscribe to `runner.onLine` and pass `speakerPortraitKey` → your
|
|
48
|
+
* portrait resolver → `portrait` here.
|
|
49
|
+
*
|
|
50
|
+
* Portrait resolution is caller-owned so the UI kit stays asset-agnostic.
|
|
51
|
+
*/
|
|
52
|
+
declare function DialoguePanel({ speaker, text, portrait, choices, onAdvance, style }: DialoguePanelProps): ReactNode;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/focus.d.ts
|
|
58
55
|
/**
|
|
59
56
|
* Keyboard + (future) gamepad focus navigation.
|
|
60
57
|
*
|
|
@@ -64,46 +61,107 @@ declare function useTheme(): Theme;
|
|
|
64
61
|
* to call. Components read `focusedId` to render a focus ring.
|
|
65
62
|
*/
|
|
66
63
|
interface FocusNode {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
id: string;
|
|
65
|
+
/** Lower tabIndex is focused first. Nodes with equal tabIndex fall back to registration order. */
|
|
66
|
+
tabIndex: number;
|
|
67
|
+
/** Called when this node is activated (Enter / A button). */
|
|
68
|
+
onActivate?: () => void;
|
|
69
|
+
/** Called when this node receives focus. */
|
|
70
|
+
onFocus?: () => void;
|
|
71
|
+
/** Called when this node loses focus. */
|
|
72
|
+
onBlur?: () => void;
|
|
73
|
+
/** If true, the node is skipped during navigation. */
|
|
74
|
+
disabled?: boolean;
|
|
78
75
|
}
|
|
79
76
|
interface FocusManager {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
register(node: FocusNode): () => void;
|
|
78
|
+
unregister(id: string): void;
|
|
79
|
+
focus(id: string): void;
|
|
80
|
+
/** Explicit opt-in initial focus: focuses the first node in tab order (or clears if empty). */
|
|
81
|
+
focusFirst(): void;
|
|
82
|
+
blur(): void;
|
|
83
|
+
next(): void;
|
|
84
|
+
prev(): void;
|
|
85
|
+
activate(): void;
|
|
86
|
+
getFocused(): string | null;
|
|
87
|
+
getOrder(): readonly string[];
|
|
88
|
+
subscribe(listener: (focusedId: string | null) => void): () => void;
|
|
90
89
|
}
|
|
91
90
|
declare function createFocusManager(): FocusManager;
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/focus-context.d.ts
|
|
93
|
+
interface FocusContextValue {
|
|
94
|
+
manager: FocusManager;
|
|
95
|
+
focusedId: string | null;
|
|
96
|
+
}
|
|
97
|
+
declare const FocusContext: import("react").Context<FocusContextValue | null>;
|
|
94
98
|
declare function useFocusManager(): FocusManager | null;
|
|
95
|
-
|
|
99
|
+
declare function useFocusedId(): string | null;
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/focus-keyboard-driver.d.ts
|
|
102
|
+
/** Structural key source — createKeyboard() from @flare-engine/input is assignable; no hard dep. */
|
|
103
|
+
interface FocusKeySource {
|
|
104
|
+
wasPressed(code: string): boolean;
|
|
105
|
+
}
|
|
106
|
+
interface FocusKeyboardDriver {
|
|
107
|
+
/** Call once per frame; polls edges and drives the manager. */
|
|
108
|
+
update(): void;
|
|
109
|
+
}
|
|
110
|
+
interface FocusKeyboardDriverOptions {
|
|
111
|
+
next?: readonly string[];
|
|
112
|
+
prev?: readonly string[];
|
|
113
|
+
activate?: readonly string[];
|
|
114
|
+
}
|
|
115
|
+
declare function createFocusKeyboardDriver(manager: FocusManager, keys: FocusKeySource, options?: FocusKeyboardDriverOptions): FocusKeyboardDriver;
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/focus-provider.d.ts
|
|
96
118
|
interface FocusProviderProps {
|
|
97
|
-
|
|
98
|
-
|
|
119
|
+
manager?: FocusManager;
|
|
120
|
+
/**
|
|
121
|
+
* Opt-in initial focus: focus the tab-order first node once, at the commit
|
|
122
|
+
* where this provider mounts. Off by default so a touch-first tree shows no
|
|
123
|
+
* focus ring until a driver acts. This is mount-time only — it picks among the
|
|
124
|
+
* nodes registered by that first commit and does not re-fire for children that
|
|
125
|
+
* mount later (async/lazy sets). For a dynamic set drive focus explicitly
|
|
126
|
+
* (a keyboard/gamepad driver, or manager.focusFirst()).
|
|
127
|
+
*/
|
|
128
|
+
autoFocus?: boolean;
|
|
129
|
+
children: ReactNode;
|
|
99
130
|
}
|
|
100
131
|
/**
|
|
101
|
-
* Instantiates a FocusManager (or uses the one provided) and
|
|
102
|
-
*
|
|
103
|
-
*
|
|
132
|
+
* Instantiates a FocusManager (or uses the one provided) and publishes
|
|
133
|
+
* { manager, focusedId } as context state so consumers re-render on focus
|
|
134
|
+
* moves.
|
|
104
135
|
*/
|
|
105
|
-
declare function FocusProvider({ manager, children }: FocusProviderProps): ReactNode;
|
|
106
|
-
|
|
136
|
+
declare function FocusProvider({ manager, autoFocus, children }: FocusProviderProps): ReactNode;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/hud-bar.d.ts
|
|
139
|
+
type HUDBarKind = 'hp' | 'mp' | 'xp' | 'custom';
|
|
140
|
+
interface HUDBarProps {
|
|
141
|
+
label: string;
|
|
142
|
+
value: number;
|
|
143
|
+
max: number;
|
|
144
|
+
kind?: HUDBarKind;
|
|
145
|
+
/** When true, shows "value / max" next to the label. */
|
|
146
|
+
showNumbers?: boolean;
|
|
147
|
+
/** Override bar fill color. */
|
|
148
|
+
fillColor?: string;
|
|
149
|
+
}
|
|
150
|
+
declare function HUDBar({ label, value, max, kind, showNumbers, fillColor }: HUDBarProps): ReactNode;
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/label.d.ts
|
|
153
|
+
type LabelVariant = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
154
|
+
type LabelTone = 'default' | 'muted' | 'accent' | 'danger' | 'success' | 'warning';
|
|
155
|
+
interface LabelProps {
|
|
156
|
+
children?: ReactNode;
|
|
157
|
+
variant?: LabelVariant;
|
|
158
|
+
tone?: LabelTone;
|
|
159
|
+
mono?: boolean;
|
|
160
|
+
style?: TextStyle;
|
|
161
|
+
}
|
|
162
|
+
declare function Label({ children, variant, tone, mono, style }: LabelProps): ReactNode;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/layout.d.ts
|
|
107
165
|
/**
|
|
108
166
|
* Minimal flex-like layout resolver.
|
|
109
167
|
*
|
|
@@ -119,232 +177,218 @@ type FlexDirection = 'row' | 'column';
|
|
|
119
177
|
type JustifyContent = 'start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
120
178
|
type AlignItems = 'start' | 'end' | 'center' | 'stretch';
|
|
121
179
|
interface Padding {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
180
|
+
top: number;
|
|
181
|
+
right: number;
|
|
182
|
+
bottom: number;
|
|
183
|
+
left: number;
|
|
126
184
|
}
|
|
127
185
|
interface LayoutChild {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
186
|
+
/** Fixed main-axis size. Ignored when `grow > 0`. */
|
|
187
|
+
basis?: number;
|
|
188
|
+
/** Fractional share of leftover main-axis space. */
|
|
189
|
+
grow?: number;
|
|
190
|
+
/** Fixed cross-axis size. Overrides stretch. */
|
|
191
|
+
crossSize?: number;
|
|
134
192
|
}
|
|
135
193
|
interface LayoutContainer {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
194
|
+
width: number;
|
|
195
|
+
height: number;
|
|
196
|
+
direction: FlexDirection;
|
|
197
|
+
gap?: number;
|
|
198
|
+
padding?: Partial<Padding>;
|
|
199
|
+
justifyContent?: JustifyContent;
|
|
200
|
+
alignItems?: AlignItems;
|
|
143
201
|
}
|
|
144
202
|
interface LayoutRect {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
203
|
+
x: number;
|
|
204
|
+
y: number;
|
|
205
|
+
width: number;
|
|
206
|
+
height: number;
|
|
149
207
|
}
|
|
150
208
|
declare function resolveLayout(container: LayoutContainer, children: readonly LayoutChild[]): LayoutRect[];
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
children?: ReactNode;
|
|
154
|
-
/** Visual style: surface (default) or elevated (surfaceAlt + border). */
|
|
155
|
-
variant?: 'surface' | 'elevated';
|
|
156
|
-
/** Padding size token. Defaults to 'md'. */
|
|
157
|
-
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
158
|
-
/** Corner radius token. Defaults to 'md'. */
|
|
159
|
-
radius?: 'none' | 'sm' | 'md' | 'lg' | 'pill';
|
|
160
|
-
style?: ViewStyle;
|
|
161
|
-
}
|
|
162
|
-
declare function Panel({ children, variant, padding, radius, style, }: PanelProps): ReactNode;
|
|
163
|
-
|
|
164
|
-
type LabelVariant = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
165
|
-
type LabelTone = 'default' | 'muted' | 'accent' | 'danger' | 'success' | 'warning';
|
|
166
|
-
interface LabelProps {
|
|
167
|
-
children?: ReactNode;
|
|
168
|
-
variant?: LabelVariant;
|
|
169
|
-
tone?: LabelTone;
|
|
170
|
-
mono?: boolean;
|
|
171
|
-
style?: TextStyle;
|
|
172
|
-
}
|
|
173
|
-
declare function Label({ children, variant, tone, mono, style, }: LabelProps): ReactNode;
|
|
174
|
-
|
|
175
|
-
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
176
|
-
interface ButtonProps {
|
|
177
|
-
label: string;
|
|
178
|
-
onPress?: () => void;
|
|
179
|
-
variant?: ButtonVariant;
|
|
180
|
-
disabled?: boolean;
|
|
181
|
-
/** Focus-navigation tab order. Lower is earlier. Defaults to 0. */
|
|
182
|
-
tabIndex?: number;
|
|
183
|
-
/** Stable focus id. If omitted, a generated id is used. */
|
|
184
|
-
focusId?: string;
|
|
185
|
-
style?: ViewStyle;
|
|
186
|
-
}
|
|
187
|
-
declare function Button({ label, onPress, variant, disabled, tabIndex, focusId, style, }: ButtonProps): ReactNode;
|
|
188
|
-
|
|
189
|
-
interface ProgressBarProps {
|
|
190
|
-
/** Progress in [0, 1]. Values outside are clamped. */
|
|
191
|
-
value: number;
|
|
192
|
-
/** Height of the bar in pixels. */
|
|
193
|
-
height?: number;
|
|
194
|
-
/** Track color override. Defaults to theme.colors.surfaceAlt. */
|
|
195
|
-
trackColor?: string;
|
|
196
|
-
/** Fill color override. Defaults to theme.colors.accent. */
|
|
197
|
-
fillColor?: string;
|
|
198
|
-
style?: ViewStyle;
|
|
199
|
-
}
|
|
200
|
-
declare function ProgressBar({ value, height, trackColor, fillColor, style, }: ProgressBarProps): ReactNode;
|
|
201
|
-
|
|
202
|
-
type HUDBarKind = 'hp' | 'mp' | 'xp' | 'custom';
|
|
203
|
-
interface HUDBarProps {
|
|
204
|
-
label: string;
|
|
205
|
-
value: number;
|
|
206
|
-
max: number;
|
|
207
|
-
kind?: HUDBarKind;
|
|
208
|
-
/** When true, shows "value / max" next to the label. */
|
|
209
|
-
showNumbers?: boolean;
|
|
210
|
-
/** Override bar fill color. */
|
|
211
|
-
fillColor?: string;
|
|
212
|
-
}
|
|
213
|
-
declare function HUDBar({ label, value, max, kind, showNumbers, fillColor, }: HUDBarProps): ReactNode;
|
|
214
|
-
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/list.d.ts
|
|
215
211
|
interface ListProps {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
children?: ReactNode;
|
|
213
|
+
/** Gap between items in pixels. Defaults to theme.spacing.sm. */
|
|
214
|
+
gap?: number;
|
|
215
|
+
direction?: 'column' | 'row';
|
|
216
|
+
style?: ViewStyle;
|
|
221
217
|
}
|
|
222
218
|
/**
|
|
223
219
|
* Vertical (or horizontal) stack with consistent gap. Thin container; the
|
|
224
220
|
* focus manager handles navigation between interactive children.
|
|
225
221
|
*/
|
|
226
222
|
declare function List({ children, gap, direction, style }: ListProps): ReactNode;
|
|
227
|
-
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/main-menu-kit.d.ts
|
|
225
|
+
interface MainMenuItem {
|
|
226
|
+
/** Stable id — used as focus id + React key. */
|
|
227
|
+
readonly id: string;
|
|
228
|
+
/** Localized label. */
|
|
229
|
+
readonly label: string;
|
|
230
|
+
readonly onPress: () => void;
|
|
231
|
+
readonly variant?: ButtonVariant;
|
|
232
|
+
readonly disabled?: boolean;
|
|
233
|
+
}
|
|
234
|
+
interface MainMenuKitProps {
|
|
235
|
+
/** Localized title. */
|
|
236
|
+
readonly title: string;
|
|
237
|
+
/** Optional localized subtitle — tagline, version, locale flag, etc. */
|
|
238
|
+
readonly subtitle?: string;
|
|
239
|
+
/** Button list. Rendered top-to-bottom in order. */
|
|
240
|
+
readonly items: readonly MainMenuItem[];
|
|
241
|
+
/**
|
|
242
|
+
* Optional footer slot — typically a row of ghost buttons (credits, links)
|
|
243
|
+
* or a version/build string.
|
|
244
|
+
*/
|
|
245
|
+
readonly footer?: ReactNode;
|
|
246
|
+
readonly style?: ViewStyle;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Title-screen kit: headline, optional subtitle, vertical button list,
|
|
250
|
+
* optional footer slot. All strings are caller-supplied (localized upstream).
|
|
251
|
+
*
|
|
252
|
+
* Save-slot / settings / credits panels are built on top of this kit by the
|
|
253
|
+
* consumer; the kit itself is a pure title-menu primitive.
|
|
254
|
+
*/
|
|
255
|
+
declare function MainMenuKit({ title, subtitle, items, footer, style }: MainMenuKitProps): ReactNode;
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/modal.d.ts
|
|
228
258
|
interface ModalProps {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
259
|
+
visible: boolean;
|
|
260
|
+
children?: ReactNode;
|
|
261
|
+
/** Called when the backdrop is pressed. Return nothing to close, or do nothing to make it non-dismissable. */
|
|
262
|
+
onBackdropPress?: () => void;
|
|
263
|
+
/** Backdrop opacity 0..1. Defaults to 0.6. */
|
|
264
|
+
backdropOpacity?: number;
|
|
235
265
|
}
|
|
236
266
|
/**
|
|
237
267
|
* Overlay modal that renders a centered `Panel` with its children. Parent is
|
|
238
268
|
* responsible for controlling visibility and (if desired) focus trapping via
|
|
239
269
|
* the shared FocusManager.
|
|
240
270
|
*/
|
|
241
|
-
declare function Modal({ visible, children, onBackdropPress, backdropOpacity
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
271
|
+
declare function Modal({ visible, children, onBackdropPress, backdropOpacity }: ModalProps): ReactNode;
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/panel.d.ts
|
|
274
|
+
interface PanelProps {
|
|
275
|
+
children?: ReactNode;
|
|
276
|
+
/** Visual style: surface (default) or elevated (surfaceAlt + border). */
|
|
277
|
+
variant?: 'surface' | 'elevated';
|
|
278
|
+
/** Padding size token. Defaults to 'md'. */
|
|
279
|
+
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
280
|
+
/** Corner radius token. Defaults to 'md'. */
|
|
281
|
+
radius?: 'none' | 'sm' | 'md' | 'lg' | 'pill';
|
|
282
|
+
style?: ViewStyle;
|
|
249
283
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
*/
|
|
264
|
-
readonly choices?: readonly DialogueChoice[];
|
|
265
|
-
/** Advance callback — used only when `choices` is empty / omitted. */
|
|
266
|
-
readonly onAdvance?: () => void;
|
|
267
|
-
readonly style?: ViewStyle;
|
|
284
|
+
declare function Panel({ children, variant, padding, radius, style }: PanelProps): ReactNode;
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/progress-bar.d.ts
|
|
287
|
+
interface ProgressBarProps {
|
|
288
|
+
/** Progress in [0, 1]. Values outside are clamped. */
|
|
289
|
+
value: number;
|
|
290
|
+
/** Height of the bar in pixels. */
|
|
291
|
+
height?: number;
|
|
292
|
+
/** Track color override. Defaults to theme.colors.surfaceAlt. */
|
|
293
|
+
trackColor?: string;
|
|
294
|
+
/** Fill color override. Defaults to theme.colors.accent. */
|
|
295
|
+
fillColor?: string;
|
|
296
|
+
style?: ViewStyle;
|
|
268
297
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
* portrait resolver → `portrait` here.
|
|
273
|
-
*
|
|
274
|
-
* Extracted from Pan Tvardowski per Phase 11.14 (M9.4). Portrait resolution
|
|
275
|
-
* is caller-owned so the UI kit stays asset-agnostic.
|
|
276
|
-
*/
|
|
277
|
-
declare function DialoguePanel({ speaker, text, portrait, choices, onAdvance, style, }: DialoguePanelProps): ReactNode;
|
|
278
|
-
|
|
298
|
+
declare function ProgressBar({ value, height, trackColor, fillColor, style }: ProgressBarProps): ReactNode;
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/shop-panel.d.ts
|
|
279
301
|
interface ShopItem {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
302
|
+
/** Store product id — forwarded verbatim to `onPurchase`. */
|
|
303
|
+
readonly productId: string;
|
|
304
|
+
/** Localized display title. */
|
|
305
|
+
readonly title: string;
|
|
306
|
+
/** Localized price string (from `Product.priceDisplay`). */
|
|
307
|
+
readonly priceDisplay: string;
|
|
308
|
+
/** Optional localized description. */
|
|
309
|
+
readonly description?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Entitlement key(s) that mark this product as already owned. When the
|
|
312
|
+
* store reports any of these as entitled, the purchase button is replaced
|
|
313
|
+
* with an "owned" label.
|
|
314
|
+
*/
|
|
315
|
+
readonly ownedKeys?: readonly string[];
|
|
316
|
+
readonly disabled?: boolean;
|
|
295
317
|
}
|
|
296
318
|
interface ShopPanelProps {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
319
|
+
readonly items: readonly ShopItem[];
|
|
320
|
+
/** Returns `true` when the given entitlement key is already owned. */
|
|
321
|
+
readonly isEntitled: (key: string) => boolean;
|
|
322
|
+
/** Called when a not-owned item's purchase button is pressed. */
|
|
323
|
+
readonly onPurchase: (productId: string) => void;
|
|
324
|
+
/** Localized label for already-owned items. Defaults to "Owned". */
|
|
325
|
+
readonly ownedLabel?: string;
|
|
326
|
+
/** Localized label for the purchase action. Defaults to the item's price. */
|
|
327
|
+
readonly purchaseLabelFor?: (item: ShopItem) => string;
|
|
328
|
+
readonly style?: ViewStyle;
|
|
307
329
|
}
|
|
308
330
|
/**
|
|
309
331
|
* List-style shop panel. Caller builds the `items` array by joining a
|
|
310
332
|
* `ProductCatalog` with the `Product[]` returned by `IAPProvider.getProducts`.
|
|
311
333
|
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
334
|
+
* Price strings and ownership copy are caller-provided so the UI kit stays
|
|
335
|
+
* localization-free.
|
|
314
336
|
*/
|
|
315
|
-
declare function ShopPanel({ items, isEntitled, onPurchase, ownedLabel, purchaseLabelFor, style
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
337
|
+
declare function ShopPanel({ items, isEntitled, onPurchase, ownedLabel, purchaseLabelFor, style }: ShopPanelProps): ReactNode;
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/theme.d.ts
|
|
340
|
+
interface ThemeColors {
|
|
341
|
+
bg: string;
|
|
342
|
+
surface: string;
|
|
343
|
+
surfaceAlt: string;
|
|
344
|
+
border: string;
|
|
345
|
+
text: string;
|
|
346
|
+
textMuted: string;
|
|
347
|
+
accent: string;
|
|
348
|
+
accentText: string;
|
|
349
|
+
danger: string;
|
|
350
|
+
success: string;
|
|
351
|
+
warning: string;
|
|
352
|
+
focus: string;
|
|
325
353
|
}
|
|
326
|
-
interface
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
readonly items: readonly MainMenuItem[];
|
|
333
|
-
/**
|
|
334
|
-
* Optional footer slot — typically a row of ghost buttons (credits, links)
|
|
335
|
-
* or a version/build string.
|
|
336
|
-
*/
|
|
337
|
-
readonly footer?: ReactNode;
|
|
338
|
-
readonly style?: ViewStyle;
|
|
354
|
+
interface ThemeSpacing {
|
|
355
|
+
xs: number;
|
|
356
|
+
sm: number;
|
|
357
|
+
md: number;
|
|
358
|
+
lg: number;
|
|
359
|
+
xl: number;
|
|
339
360
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
361
|
+
interface ThemeTypography {
|
|
362
|
+
sizeXs: number;
|
|
363
|
+
sizeSm: number;
|
|
364
|
+
sizeMd: number;
|
|
365
|
+
sizeLg: number;
|
|
366
|
+
sizeXl: number;
|
|
367
|
+
fontFamily?: string;
|
|
368
|
+
fontFamilyMono?: string;
|
|
369
|
+
}
|
|
370
|
+
interface ThemeRadii {
|
|
371
|
+
none: number;
|
|
372
|
+
sm: number;
|
|
373
|
+
md: number;
|
|
374
|
+
lg: number;
|
|
375
|
+
pill: number;
|
|
376
|
+
}
|
|
377
|
+
interface Theme {
|
|
378
|
+
name: string;
|
|
379
|
+
colors: ThemeColors;
|
|
380
|
+
spacing: ThemeSpacing;
|
|
381
|
+
typography: ThemeTypography;
|
|
382
|
+
radii: ThemeRadii;
|
|
383
|
+
}
|
|
384
|
+
declare const darkTheme: Theme;
|
|
385
|
+
declare const lightTheme: Theme;
|
|
386
|
+
interface ThemeProviderProps {
|
|
387
|
+
theme?: Theme;
|
|
388
|
+
children: ReactNode;
|
|
389
|
+
}
|
|
390
|
+
declare function ThemeProvider({ theme, children }: ThemeProviderProps): ReactNode;
|
|
391
|
+
declare function useTheme(): Theme;
|
|
392
|
+
//#endregion
|
|
393
|
+
export { type AlignItems, Button, type ButtonProps, type ButtonVariant, type DialogueChoice, DialoguePanel, type DialoguePanelProps, type FlexDirection, FocusContext, type FocusContextValue, type FocusKeySource, type FocusKeyboardDriver, type FocusKeyboardDriverOptions, type FocusManager, type FocusNode, FocusProvider, type FocusProviderProps, HUDBar, type HUDBarKind, type HUDBarProps, type JustifyContent, Label, type LabelProps, type LabelTone, type LabelVariant, type LayoutChild, type LayoutContainer, type LayoutRect, List, type ListProps, type MainMenuItem, MainMenuKit, type MainMenuKitProps, Modal, type ModalProps, type Padding, Panel, type PanelProps, ProgressBar, type ProgressBarProps, type ShopItem, ShopPanel, type ShopPanelProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ThemeRadii, type ThemeSpacing, type ThemeTypography, createFocusKeyboardDriver, createFocusManager, darkTheme, lightTheme, resolveLayout, useFocusManager, useFocusedId, useTheme };
|
|
394
|
+
//# sourceMappingURL=index.d.ts.map
|