@momoyu-ink/kit 0.4.1 → 0.5.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.
Files changed (181) hide show
  1. package/dist/jsx-dev-runtime--ZXLAgUi.d.mts +600 -0
  2. package/dist/jsx-dev-runtime--ZXLAgUi.d.ts +600 -0
  3. package/dist/jsx-dev-runtime.cjs +27 -0
  4. package/dist/jsx-dev-runtime.d.mts +4 -0
  5. package/dist/jsx-dev-runtime.d.ts +4 -0
  6. package/dist/jsx-dev-runtime.mjs +6 -0
  7. package/dist/jsx-runtime.cjs +28 -0
  8. package/dist/jsx-runtime.d.mts +4 -0
  9. package/dist/jsx-runtime.d.ts +4 -0
  10. package/dist/jsx-runtime.mjs +7 -0
  11. package/dist/lib.cjs +1503 -0
  12. package/dist/lib.d.mts +667 -0
  13. package/dist/lib.d.ts +667 -15
  14. package/dist/lib.mjs +1534 -0
  15. package/package.json +29 -8
  16. package/dist/bindings/AnimationFormat.d.ts +0 -1
  17. package/dist/bindings/AnimationFormat.js +0 -3
  18. package/dist/bindings/AnimationFrameCallbackEvent.d.ts +0 -3
  19. package/dist/bindings/AnimationFrameCallbackEvent.js +0 -3
  20. package/dist/bindings/AnimationProps.d.ts +0 -6
  21. package/dist/bindings/AnimationProps.js +0 -2
  22. package/dist/bindings/AudioCommand.d.ts +0 -54
  23. package/dist/bindings/AudioCommand.js +0 -2
  24. package/dist/bindings/AudioSettings.d.ts +0 -42
  25. package/dist/bindings/AudioSettings.js +0 -3
  26. package/dist/bindings/BackdropProps.d.ts +0 -6
  27. package/dist/bindings/BackdropProps.js +0 -2
  28. package/dist/bindings/BeforeUnloadEvent.d.ts +0 -1
  29. package/dist/bindings/BeforeUnloadEvent.js +0 -3
  30. package/dist/bindings/ClipProps.d.ts +0 -4
  31. package/dist/bindings/ClipProps.js +0 -3
  32. package/dist/bindings/CustomEvent.d.ts +0 -18
  33. package/dist/bindings/CustomEvent.js +0 -3
  34. package/dist/bindings/EffectParams.d.ts +0 -6
  35. package/dist/bindings/EffectParams.js +0 -3
  36. package/dist/bindings/FilterKind.d.ts +0 -34
  37. package/dist/bindings/FilterKind.js +0 -3
  38. package/dist/bindings/FilterProps.d.ts +0 -4
  39. package/dist/bindings/FilterProps.js +0 -2
  40. package/dist/bindings/FocusEvent.d.ts +0 -5
  41. package/dist/bindings/FocusEvent.js +0 -2
  42. package/dist/bindings/FocusEventKind.d.ts +0 -1
  43. package/dist/bindings/FocusEventKind.js +0 -3
  44. package/dist/bindings/FullScreenEvent.d.ts +0 -4
  45. package/dist/bindings/FullScreenEvent.js +0 -2
  46. package/dist/bindings/FullscreenEventKind.d.ts +0 -1
  47. package/dist/bindings/FullscreenEventKind.js +0 -3
  48. package/dist/bindings/GameEvent.d.ts +0 -1
  49. package/dist/bindings/GameEvent.js +0 -3
  50. package/dist/bindings/Gamepad.d.ts +0 -44
  51. package/dist/bindings/Gamepad.js +0 -2
  52. package/dist/bindings/GamepadButton.d.ts +0 -20
  53. package/dist/bindings/GamepadButton.js +0 -3
  54. package/dist/bindings/GamepadCommand.d.ts +0 -9
  55. package/dist/bindings/GamepadCommand.js +0 -2
  56. package/dist/bindings/GamepadEvent.d.ts +0 -12
  57. package/dist/bindings/GamepadEvent.js +0 -2
  58. package/dist/bindings/GamepadHapticActuator.d.ts +0 -11
  59. package/dist/bindings/GamepadHapticActuator.js +0 -3
  60. package/dist/bindings/KeyboardEventKind.d.ts +0 -1
  61. package/dist/bindings/KeyboardEventKind.js +0 -3
  62. package/dist/bindings/KeyboardLocation.d.ts +0 -1
  63. package/dist/bindings/KeyboardLocation.js +0 -3
  64. package/dist/bindings/Literal.d.ts +0 -3
  65. package/dist/bindings/Literal.js +0 -3
  66. package/dist/bindings/MouseEventKind.d.ts +0 -1
  67. package/dist/bindings/MouseEventKind.js +0 -3
  68. package/dist/bindings/MoyuCursor.d.ts +0 -1
  69. package/dist/bindings/MoyuCursor.js +0 -3
  70. package/dist/bindings/NineSliceMode.d.ts +0 -1
  71. package/dist/bindings/NineSliceMode.js +0 -3
  72. package/dist/bindings/NodeEvent.d.ts +0 -4
  73. package/dist/bindings/NodeEvent.js +0 -3
  74. package/dist/bindings/NodeProps.d.ts +0 -20
  75. package/dist/bindings/NodeProps.js +0 -2
  76. package/dist/bindings/RawKeyboardEvent.d.ts +0 -16
  77. package/dist/bindings/RawKeyboardEvent.js +0 -2
  78. package/dist/bindings/RawMouseEvent.d.ts +0 -12
  79. package/dist/bindings/RawMouseEvent.js +0 -2
  80. package/dist/bindings/RawTouchEvent.d.ts +0 -13
  81. package/dist/bindings/RawTouchEvent.js +0 -2
  82. package/dist/bindings/RawWheelEvent.d.ts +0 -10
  83. package/dist/bindings/RawWheelEvent.js +0 -2
  84. package/dist/bindings/ResizeEvent.d.ts +0 -4
  85. package/dist/bindings/ResizeEvent.js +0 -3
  86. package/dist/bindings/ResolvedArgument.d.ts +0 -5
  87. package/dist/bindings/ResolvedArgument.js +0 -2
  88. package/dist/bindings/ResolvedCommandLine.d.ts +0 -5
  89. package/dist/bindings/ResolvedCommandLine.js +0 -2
  90. package/dist/bindings/ResolvedSystemCallLine.d.ts +0 -5
  91. package/dist/bindings/ResolvedSystemCallLine.js +0 -2
  92. package/dist/bindings/ScenarioCommand.d.ts +0 -103
  93. package/dist/bindings/ScenarioCommand.js +0 -2
  94. package/dist/bindings/ScenarioEvent.d.ts +0 -4
  95. package/dist/bindings/ScenarioEvent.js +0 -2
  96. package/dist/bindings/SpriteMode.d.ts +0 -1
  97. package/dist/bindings/SpriteMode.js +0 -3
  98. package/dist/bindings/SpriteProps.d.ts +0 -11
  99. package/dist/bindings/SpriteProps.js +0 -2
  100. package/dist/bindings/SystemCommand.d.ts +0 -30
  101. package/dist/bindings/SystemCommand.js +0 -2
  102. package/dist/bindings/TextCommand.d.ts +0 -9
  103. package/dist/bindings/TextCommand.js +0 -3
  104. package/dist/bindings/TextEvent.d.ts +0 -1
  105. package/dist/bindings/TextEvent.js +0 -3
  106. package/dist/bindings/TextLine.d.ts +0 -5
  107. package/dist/bindings/TextLine.js +0 -3
  108. package/dist/bindings/TextPrintMode.d.ts +0 -4
  109. package/dist/bindings/TextPrintMode.js +0 -3
  110. package/dist/bindings/TextProps.d.ts +0 -41
  111. package/dist/bindings/TextProps.js +0 -2
  112. package/dist/bindings/TouchEventKind.d.ts +0 -1
  113. package/dist/bindings/TouchEventKind.js +0 -3
  114. package/dist/bindings/VideoCommand.d.ts +0 -21
  115. package/dist/bindings/VideoCommand.js +0 -3
  116. package/dist/bindings/VideoEvent.d.ts +0 -1
  117. package/dist/bindings/VideoEvent.js +0 -3
  118. package/dist/bindings/VideoProps.d.ts +0 -7
  119. package/dist/bindings/VideoProps.js +0 -3
  120. package/dist/bindings/WheelEventDeltaMode.d.ts +0 -1
  121. package/dist/bindings/WheelEventDeltaMode.js +0 -3
  122. package/dist/bindings/WindowState.d.ts +0 -1
  123. package/dist/bindings/WindowState.js +0 -3
  124. package/dist/bindings/serde_json/JsonValue.d.ts +0 -3
  125. package/dist/bindings/serde_json/JsonValue.js +0 -3
  126. package/dist/commands.d.ts +0 -17
  127. package/dist/commands.js +0 -24
  128. package/dist/components/navigation.d.ts +0 -154
  129. package/dist/components/navigation.js +0 -252
  130. package/dist/declaration.d.ts +0 -80
  131. package/dist/declaration.js +0 -2
  132. package/dist/events/base.d.ts +0 -16
  133. package/dist/events/base.js +0 -19
  134. package/dist/events/globals.d.ts +0 -2
  135. package/dist/events/globals.js +0 -122
  136. package/dist/events/keyboard.d.ts +0 -37
  137. package/dist/events/keyboard.js +0 -2
  138. package/dist/events/listener.d.ts +0 -1
  139. package/dist/events/listener.js +0 -13
  140. package/dist/events/mouse.d.ts +0 -15
  141. package/dist/events/mouse.js +0 -2
  142. package/dist/events/touch.d.ts +0 -16
  143. package/dist/events/touch.js +0 -2
  144. package/dist/events/wheel.d.ts +0 -9
  145. package/dist/events/wheel.js +0 -2
  146. package/dist/events.d.ts +0 -33
  147. package/dist/events.js +0 -49
  148. package/dist/hooks/useFadeInOut.d.ts +0 -16
  149. package/dist/hooks/useFadeInOut.js +0 -62
  150. package/dist/hooks/useScenario.d.ts +0 -13
  151. package/dist/hooks/useScenario.js +0 -64
  152. package/dist/hooks/useSoundEffect.d.ts +0 -4
  153. package/dist/hooks/useSoundEffect.js +0 -63
  154. package/dist/hooks/useStage.d.ts +0 -126
  155. package/dist/hooks/useStage.js +0 -706
  156. package/dist/hooks.d.ts +0 -4
  157. package/dist/hooks.js +0 -20
  158. package/dist/lib.js +0 -54
  159. package/dist/moyu.d.ts +0 -19
  160. package/dist/moyu.js +0 -49
  161. package/dist/node.d.ts +0 -16
  162. package/dist/node.js +0 -105
  163. package/dist/react.d.ts +0 -20
  164. package/dist/react.js +0 -222
  165. package/dist/runtime-globals.d.ts +0 -65
  166. package/dist/runtime-globals.js +0 -2
  167. package/dist/sandbox.d.ts +0 -1
  168. package/dist/sandbox.js +0 -88
  169. package/dist/spring/animated.d.ts +0 -27
  170. package/dist/spring/animated.js +0 -2
  171. package/dist/spring/index.d.ts +0 -5
  172. package/dist/spring/index.js +0 -38
  173. package/dist/spring/primitives.d.ts +0 -3
  174. package/dist/spring/primitives.js +0 -13
  175. package/dist/state.d.ts +0 -6
  176. package/dist/state.js +0 -8
  177. package/dist/utils.d.ts +0 -10
  178. package/dist/utils.js +0 -10
  179. package/dist/zod-patch.d.ts +0 -10
  180. package/dist/zod-patch.js +0 -2
  181. package/jsx-runtime.d.ts +0 -1
package/dist/lib.d.mts ADDED
@@ -0,0 +1,667 @@
1
+ import * as React$1 from 'react';
2
+ import React__default, { Component, ReactElement, ForwardRefExoticComponent, CSSProperties, FC } from 'react';
3
+ import Reconciler, { BaseErrorInfo } from 'react-reconciler';
4
+ import { N as Node, M as MouseEvent, a as MoyuEvent, C as Command, b as MaybePromise, J as JSX } from './jsx-dev-runtime--ZXLAgUi.mjs';
5
+ export { A as AudioCommand, c as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, E as EffectParams, G as GamepadCommand, K as KeyboardEvent, d as KeyboardEventKind, e as MakeNullOptional, f as MouseEventKind, g as MoyuAnimationAttributes, h as MoyuBackdropAttributes, i as MoyuClipAttributes, j as MoyuContainerAttributes, k as MoyuEventHandler, l as MoyuFilterAttributes, m as MoyuListenerAttributes, n as MoyuNodeAttributes, o as MoyuSpriteAttributes, p as MoyuTextAttributes, q as MoyuVideoAttributes, S as ScenarioCommand, r as SystemCommand, T as TextCommand, s as TouchEvent, t as TouchEventKind, u as Tuple2, v as Tuple3, w as Tuple4, W as WindowState, x as createBubbleEvent, y as getStageSize } from './jsx-dev-runtime--ZXLAgUi.mjs';
6
+ import { FluidValue } from '@react-spring/shared';
7
+ import { ElementType, AssignableKeys, ComponentPropsWithRef } from '@react-spring/types';
8
+ import { Snapshot } from 'valtio';
9
+ import { SpringValues, SpringRef } from '@react-spring/core';
10
+ export * from '@react-spring/core';
11
+ import { ZodType } from 'zod';
12
+ import 'react/jsx-runtime';
13
+ import 'react/jsx-dev-runtime';
14
+
15
+ declare const MoyuRenderer: Reconciler.Reconciler<Node, Node, never, never, never, any>;
16
+ interface RootOptions {
17
+ /**
18
+ * Prefix for `useId`.
19
+ */
20
+ identifierPrefix?: string;
21
+ onUncaughtError: (error: Error, info: BaseErrorInfo & {
22
+ errorBoundary?: Component;
23
+ }) => void;
24
+ onCaughtError: (error: Error, info: BaseErrorInfo) => void;
25
+ onRecoverableError: (error: Error, info: BaseErrorInfo) => void;
26
+ onDefaultTransitionIndicator: () => void;
27
+ }
28
+ declare function createRoot(options?: RootOptions): {
29
+ render: (reactElement: ReactElement, callback?: (() => void) | null) => Reconciler.Lane;
30
+ };
31
+
32
+ declare const globalEventListeners: Record<string, ((event: unknown) => void)[]>;
33
+ declare const globalRequestAnimationFrameListeners: FrameRequestCallback[];
34
+
35
+ declare function addEventListener(name: string, callback: (...args: any[]) => void): () => void;
36
+
37
+ interface WheelEvent extends Omit<MouseEvent, 'kind'> {
38
+ kind: 'wheel';
39
+ deltaX: number;
40
+ deltaY: number;
41
+ deltaZ: number;
42
+ deltaMode: WheelEventDeltaMode;
43
+ }
44
+
45
+ type AnimationFrameCallbackEvent = {
46
+ timestamp: number;
47
+ };
48
+
49
+ type BeforeUnloadEvent = Record<symbol, never>;
50
+
51
+ /**
52
+ * Custom event for user-defined events
53
+ */
54
+ type CustomEvent<T> = {
55
+ kind: 'CustomEvent';
56
+ /**
57
+ * target node id, or 0 for global
58
+ */
59
+ targetId: number;
60
+ /**
61
+ * event name for `addEventListener` or `onXXX`
62
+ */
63
+ name: string;
64
+ /**
65
+ * event body, pass as parameter to callback
66
+ */
67
+ body?: T;
68
+ };
69
+
70
+ type FocusEventKind = 'focus' | 'blur';
71
+
72
+ type FocusEvent = {
73
+ kind: FocusEventKind;
74
+ targetId: number;
75
+ };
76
+
77
+ type FullscreenEventKind = 'change' | 'error';
78
+
79
+ type FullScreenEvent = {
80
+ kind: FullscreenEventKind;
81
+ };
82
+
83
+ type GameEvent = 'ready';
84
+
85
+ /**
86
+ * The GamepadButton interface defines an individual button of a gamepad or other controller, allowing
87
+ * access to the current state of different types of buttons available on the control device.
88
+ */
89
+ type GamepadButton = {
90
+ /**
91
+ * A boolean value indicating whether the button is currently pressed (`true`) or unpressed (`false`).
92
+ */
93
+ pressed: boolean;
94
+ /**
95
+ * A boolean value indicating whether the button is currently touched (`true`) or not touched (`false`).
96
+ */
97
+ touched: boolean;
98
+ /**
99
+ * A double value used to represent the current state of analog buttons, such as the triggers on many
100
+ * modern gamepads. The values are normalized to the range 0.0 — 1.0, with 0.0 representing a button that
101
+ * is not pressed, and 1.0 representing a button that is fully pressed.
102
+ */
103
+ value: number;
104
+ };
105
+
106
+ /**
107
+ * The GamepadHapticActuator interface of the [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API)
108
+ * represents hardware in the controller designed to provide haptic feedback to the user (if available),
109
+ * most commonly vibration hardware.
110
+ */
111
+ type GamepadHapticActuator = {
112
+ /**
113
+ * Returns an array of enumerated values representing the different haptic effects that the actuator supports.
114
+ */
115
+ effects: Array<string>;
116
+ };
117
+
118
+ /**
119
+ * The Gamepad interface of the [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API)
120
+ * defines an individual gamepad or other controller, allowing access to information such as button presses,
121
+ * axis positions, and id.
122
+ */
123
+ type Gamepad = {
124
+ /**
125
+ * A string containing identifying information about the controller.
126
+ */
127
+ id: string;
128
+ /**
129
+ * An integer that is auto-incremented to be unique for each device currently connected to the system.
130
+ */
131
+ index: number;
132
+ /**
133
+ * A boolean indicating whether the gamepad is still connected to the system.
134
+ */
135
+ connected: boolean;
136
+ /**
137
+ * A string indicating whether the browser has remapped the controls on the device to a known layout.
138
+ * Currently, the only value that is returned is "standard", which indicates that the browser has
139
+ * remapped the controls to a standard layout.
140
+ * See [gamepad#remapping](https://w3c.github.io/gamepad/#remapping)
141
+ */
142
+ mapping: string;
143
+ /**
144
+ * An array of [GamepadButton] objects representing the buttons present on the device.
145
+ */
146
+ buttons: Array<GamepadButton>;
147
+ /**
148
+ * An array representing the controls with axes present on the device (e.g. analog thumb sticks).
149
+ */
150
+ axes: Array<number>;
151
+ /**
152
+ * A GamepadHapticActuator object, which represents haptic feedback hardware available on the controller.
153
+ */
154
+ vibrationActuator: GamepadHapticActuator | null;
155
+ /**
156
+ * A f64 representing the last time the data for this gamepad was updated.
157
+ */
158
+ timestamp: number;
159
+ };
160
+
161
+ type GamepadEvent = {
162
+ gamepad: Gamepad;
163
+ } | {
164
+ gamepad: Gamepad;
165
+ button: GamepadButton;
166
+ } | {
167
+ gamepad: Gamepad;
168
+ axis: number;
169
+ value: number;
170
+ };
171
+
172
+ type KeyboardLocation = 'Standard' | 'Left' | 'Right' | 'Numpad';
173
+
174
+ type Literal = null | string | bigint | number | boolean | Array<Literal> | {
175
+ [key in string]: Literal;
176
+ };
177
+
178
+ type NodeEvent = {
179
+ kind: 'Destory';
180
+ targetId: number;
181
+ };
182
+
183
+ type ResizeEvent = {
184
+ width: number;
185
+ height: number;
186
+ };
187
+
188
+ type ResolvedArgument = {
189
+ name: string;
190
+ value: Literal;
191
+ };
192
+
193
+ type ResolvedCommandLine = {
194
+ command: string;
195
+ arguments: Array<ResolvedArgument>;
196
+ };
197
+
198
+ type ResolvedSystemCallLine = {
199
+ command: string;
200
+ arguments: Array<ResolvedArgument>;
201
+ };
202
+
203
+ type TextLine = {
204
+ leading: string | null;
205
+ text: string | null;
206
+ tailing: string | null;
207
+ };
208
+
209
+ type ScenarioEvent = ResolvedCommandLine | ResolvedSystemCallLine | TextLine | null;
210
+
211
+ type TextEvent = null | number;
212
+
213
+ type WheelEventDeltaMode = 'pixel' | 'line' | 'page';
214
+
215
+ declare global {
216
+ interface Window {
217
+ moyu: any;
218
+ }
219
+ var __moyu_receive_event: (event: MoyuEvent) => void;
220
+ var __moyu_eval_sandbox: (code: string) => any;
221
+ }
222
+ declare function createInstance(nodeType: string, label: string | undefined, props: Record<string, any>): number;
223
+ declare function destroyInstance(nodeId: number): void;
224
+ declare function addChild(nodeId: number, childNodeId: number): void;
225
+ declare function insertChild(nodeId: number, index: number, childNodeId: number): void;
226
+ declare function insertChildBefore(nodeId: number, beforeChildNodeId: number, childNodeId: number): void;
227
+ declare function removeChildAt(nodeId: number, index: number): void;
228
+ declare function removeChild(nodeId: number, childNodeId: number): void;
229
+ declare function updateProps(nodeId: number, props: Record<string, any>): void;
230
+ declare function executeNodeCommand(nodeId: number, payload: Command): MaybePromise;
231
+ declare function executePluginCommand(pluginName: string, payload: Command): MaybePromise;
232
+
233
+ declare const moyu_addChild: typeof addChild;
234
+ declare const moyu_createInstance: typeof createInstance;
235
+ declare const moyu_destroyInstance: typeof destroyInstance;
236
+ declare const moyu_executeNodeCommand: typeof executeNodeCommand;
237
+ declare const moyu_executePluginCommand: typeof executePluginCommand;
238
+ declare const moyu_insertChild: typeof insertChild;
239
+ declare const moyu_insertChildBefore: typeof insertChildBefore;
240
+ declare const moyu_removeChild: typeof removeChild;
241
+ declare const moyu_removeChildAt: typeof removeChildAt;
242
+ declare const moyu_updateProps: typeof updateProps;
243
+ declare namespace moyu {
244
+ export { moyu_addChild as addChild, moyu_createInstance as createInstance, moyu_destroyInstance as destroyInstance, moyu_executeNodeCommand as executeNodeCommand, moyu_executePluginCommand as executePluginCommand, moyu_insertChild as insertChild, moyu_insertChildBefore as insertChildBefore, moyu_removeChild as removeChild, moyu_removeChildAt as removeChildAt, moyu_updateProps as updateProps };
245
+ }
246
+
247
+ type Primitives = keyof JSX.IntrinsicElements;
248
+
249
+ type AnimatedPrimitives = {
250
+ [P in Primitives]: AnimatedComponent<FC<JSX.IntrinsicElements[P]>>;
251
+ };
252
+ /** The type of the `animated()` function */
253
+ type WithAnimated = (<T extends ElementType>(wrappedComponent: T) => AnimatedComponent<T>) & AnimatedPrimitives;
254
+ /** The type of an `animated()` component */
255
+ type AnimatedComponent<T extends ElementType> = ForwardRefExoticComponent<AnimatedProps<ComponentPropsWithRef<T>>>;
256
+ /** The props of an `animated()` component */
257
+ type AnimatedProps<Props extends object> = {
258
+ [P in keyof Props]: P extends 'ref' | 'key' ? Props[P] : AnimatedProp<Props[P]>;
259
+ };
260
+ type AnimatedProp<T> = [T, T] extends [infer T, infer DT] ? [DT] extends [never] ? never : DT extends void ? undefined : DT extends object ? [AssignableKeys<DT, CSSProperties>] extends [never] ? DT extends ReadonlyArray<any> ? AnimatedStyles<DT> : DT : AnimatedStyle<T> : DT | AnimatedLeaf<T> : never;
261
+ type AnimatedStyles<T extends ReadonlyArray<any>> = {
262
+ [P in keyof T]: [T[P]] extends [infer DT] ? DT extends object ? [AssignableKeys<DT, CSSProperties>] extends [never] ? DT extends ReadonlyArray<any> ? AnimatedStyles<DT> : DT : {
263
+ [P in keyof DT]: AnimatedProp<DT[P]>;
264
+ } : DT : never;
265
+ };
266
+ type AnimatedStyle<T> = [T, T] extends [infer T, infer DT] ? DT extends void ? undefined : [DT] extends [never] ? never : DT extends object ? {
267
+ [P in keyof DT]: AnimatedStyle<DT[P]>;
268
+ } : DT | AnimatedLeaf<T> : never;
269
+ type AnimatedLeaf<T> = Exclude<T, object | undefined> | Extract<T, ReadonlyArray<number | string>> extends infer U ? [U] extends [never] ? never : FluidValue<U | Exclude<T, object | undefined>> : never;
270
+
271
+ declare const animated: WithAnimated;
272
+
273
+ declare global {
274
+ /**
275
+ * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).
276
+ *
277
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)
278
+ */
279
+ interface Console {
280
+ /**
281
+ * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.
282
+ *
283
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)
284
+ */
285
+ debug(...data: any[]): void;
286
+ /**
287
+ * The **`console.error()`** static method outputs a message to the console at the 'error' log level.
288
+ *
289
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)
290
+ */
291
+ error(...data: any[]): void;
292
+ /**
293
+ * The **`console.info()`** static method outputs a message to the console at the 'info' log level.
294
+ *
295
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)
296
+ */
297
+ info(...data: any[]): void;
298
+ /**
299
+ * The **`console.log()`** static method outputs a message to the console.
300
+ *
301
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)
302
+ */
303
+ log(...data: any[]): void;
304
+ /**
305
+ * The **`console.trace()`** static method outputs a stack trace to the console.
306
+ *
307
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)
308
+ */
309
+ trace(...data: any[]): void;
310
+ /**
311
+ * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.
312
+ *
313
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)
314
+ */
315
+ warn(...data: any[]): void;
316
+ }
317
+ var console: Console;
318
+ type TimerHandler = string | Function;
319
+ function clearInterval(id: number | undefined): void;
320
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
321
+ function clearTimeout(id: number | undefined): void;
322
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
323
+ function setInterval(handler: TimerHandler, timeout?: number, ...args: any[]): number;
324
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
325
+ function setTimeout(handler: TimerHandler, timeout?: number, ...args: any[]): number;
326
+ type DOMHighResTimeStamp = number;
327
+ type FrameRequestCallback = (time: DOMHighResTimeStamp) => void;
328
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/cancelAnimationFrame) */
329
+ function cancelAnimationFrame(handle: number): void;
330
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DedicatedWorkerGlobalScope/requestAnimationFrame) */
331
+ function requestAnimationFrame(callback: FrameRequestCallback): number;
332
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/queueMicrotask) */
333
+ function queueMicrotask(callback: () => void): void;
334
+ }
335
+
336
+ /** biome-ignore-all lint/suspicious/noExplicitAny: too tight for this file */
337
+
338
+ /**
339
+ * Context for page parameters
340
+ * Used to provide params to page components via React tree
341
+ */
342
+ declare const PageParamsContext: React__default.Context<Record<string, any> | undefined>;
343
+ /**
344
+ * Context for overlay parameters
345
+ * Used to provide params to overlay components via React tree
346
+ */
347
+ declare const OverlayParamsContext: React__default.Context<Record<string, any> | undefined>;
348
+ /**
349
+ * Placeholder for global navigation types.
350
+ * Projects can augment this interface to provide type safety for the global navigator.
351
+ * @example
352
+ * declare module './utils/navigation' {
353
+ * interface RootNavigatorList {
354
+ * pages: typeof myPages;
355
+ * overlays: typeof myOverlays;
356
+ * }
357
+ * }
358
+ */
359
+ interface RootNavigatorList {
360
+ }
361
+ /**
362
+ * Type helper to register a navigator instance's types globally.
363
+ * Use this in a declare module block to get automatic type safety.
364
+ */
365
+ type RegisterNavigator<T extends Navigator<any, any>> = {
366
+ pages: T extends Navigator<infer P, any> ? Record<P, any> : never;
367
+ overlays: T extends Navigator<any, infer O> ? Record<O, any> : never;
368
+ };
369
+ type GetPages<T> = T extends {
370
+ pages: infer P;
371
+ } ? (P extends Record<string, any> ? keyof P & string : string) : string;
372
+ type GetOverlays<T> = T extends {
373
+ overlays: infer O;
374
+ } ? O extends Record<string, any> ? keyof O & string : string : string;
375
+ type DefaultPageName = GetPages<RootNavigatorList>;
376
+ type DefaultOverlayName = GetOverlays<RootNavigatorList>;
377
+ interface PageDescriptor {
378
+ component: React__default.ComponentType<any>;
379
+ options?: Record<string, any>;
380
+ requiredParams?: string[];
381
+ }
382
+ interface OverlayDescriptor {
383
+ component: React__default.ComponentType<any>;
384
+ options?: Record<string, any>;
385
+ requiredParams?: string[];
386
+ }
387
+ type PageConfig = PageDescriptor['component'] | PageDescriptor;
388
+ type OverlayConfig = OverlayDescriptor['component'] | OverlayDescriptor;
389
+ interface StackNavigatorOptions<Pages extends Record<string, PageConfig>, Overlays extends Record<string, OverlayConfig>> {
390
+ initialPage: keyof Pages & string;
391
+ pages: Pages;
392
+ overlays?: Overlays;
393
+ }
394
+ interface Navigator<PageName extends string = DefaultPageName, OverlayName extends string = DefaultOverlayName> {
395
+ /**
396
+ * Navigate to a page
397
+ * @param page Page name
398
+ * @param params Parameters to pass to the page (optional)
399
+ */
400
+ navigate: (page: PageName, params?: Record<string, any>) => void;
401
+ /**
402
+ * Go back to the previous page (not implemented yet)
403
+ */
404
+ goBack: () => void;
405
+ /**
406
+ * Push an overlay to the overlay stack
407
+ * @param overlay Overlay name
408
+ * @param params Parameters to pass to the overlay (optional)
409
+ */
410
+ pushOverlay: (overlay: OverlayName, params?: Record<string, any>) => void;
411
+ /**
412
+ * Pop the top overlay from the stack
413
+ */
414
+ popOverlay: () => void;
415
+ /**
416
+ * Clear all overlays
417
+ */
418
+ clearOverlays: () => void;
419
+ /**
420
+ * Get current page name
421
+ */
422
+ getCurrentPage: () => PageName;
423
+ /**
424
+ * Get current page parameters
425
+ */
426
+ getParams: () => Record<string, any> | undefined;
427
+ /**
428
+ * Get overlay stack
429
+ */
430
+ getOverlayStack: () => OverlayInfo[];
431
+ /**
432
+ * Check if an overlay is active
433
+ * @param type Overlay type/name
434
+ */
435
+ isOverlayActive: (type: OverlayName) => boolean;
436
+ /** @internal */
437
+ _descriptors: {
438
+ pages: Record<string, PageDescriptor>;
439
+ overlays: Record<string, OverlayDescriptor>;
440
+ };
441
+ /** @internal */
442
+ _state: NavigationState;
443
+ }
444
+ interface OverlayInfo {
445
+ type: string;
446
+ id: string;
447
+ }
448
+ interface NavigationState {
449
+ currentPage: string;
450
+ pageParams: Record<string, Record<string, any>>;
451
+ overlayStack: OverlayInfo[];
452
+ overlayParams: Record<string, Record<string, any>>;
453
+ }
454
+ /**
455
+ * Create a stack navigator
456
+ * @param options Navigator configuration
457
+ * @returns Navigator instance
458
+ */
459
+ declare function createStackNavigator<Pages extends Record<string, PageConfig>, Overlays extends Record<string, OverlayConfig>>(options: StackNavigatorOptions<Pages, Overlays>): Navigator<keyof Pages & string, keyof Overlays & string>;
460
+ /**
461
+ * Create a navigation component for a navigator
462
+ * @param navigator The navigator instance
463
+ * @returns A React component that renders the navigation state
464
+ */
465
+ declare function createStaticNavigation(navigator: Navigator<any, any>): React__default.FC;
466
+ /**
467
+ * Get the navigator instance (stable reference)
468
+ * Can be used in both components and state logic
469
+ * @returns Navigator object
470
+ */
471
+ declare function getNavigator<PageName extends string = DefaultPageName, OverlayName extends string = DefaultOverlayName>(): Navigator<PageName, OverlayName>;
472
+ /**
473
+ * Hook to get the navigator instance in components
474
+ */
475
+ declare const useNavigation: typeof getNavigator;
476
+ /**
477
+ * Reactively read the global navigation state.
478
+ * This keeps the Valtio proxy encapsulated inside kit so consumers don't need
479
+ * to touch the internal `_state` field directly.
480
+ */
481
+ declare function useNavigationState(): Snapshot<NavigationState>;
482
+ /**
483
+ * Get navigation parameters for current component
484
+ * @returns Parameters object (cast as T)
485
+ *
486
+ * This hook reads params from React Context, which is provided by the router.
487
+ * - If called from within an overlay context, returns overlay params
488
+ * - If called from within a page context, returns page params
489
+ * - Supports multiple nested overlays (each gets its own params)
490
+ *
491
+ * Note: We cast the result to T and provide an empty object as fallback.
492
+ * Since required parameters are validated at navigation entry points, we can
493
+ * safely assume the runtime object matches T.
494
+ */
495
+ declare function useNavigationParams<T = Record<string, any>>(): T;
496
+
497
+ declare function useFadeInOut(inTime: number, _keepTime: number, _outTime: number, pause?: boolean, onFinished?: () => void): [SpringValues<{
498
+ opacity: number;
499
+ }>, SpringRef<{
500
+ opacity: number;
501
+ }>, () => void];
502
+ declare function useFadeIn(inTime: number, pause?: boolean, onFinished?: () => void): [SpringValues<{
503
+ opacity: number;
504
+ }>, SpringRef<{
505
+ opacity: number;
506
+ }>, () => void];
507
+ declare function useFadeOut(outTime: number, pause?: boolean, onFinished?: () => void): [SpringValues<{
508
+ opacity: number;
509
+ }>, SpringRef<{
510
+ opacity: number;
511
+ }>, () => void];
512
+
513
+ /** Advance to the next line in the current story. */
514
+ declare function nextLine(): any;
515
+ /** Set a timed wait, optionally skippable. */
516
+ declare function setWaiting(time: number, skippable: boolean): void;
517
+ /**
518
+ * Custom hook to manage scenario lifecycle (load, start, terminate).
519
+ *
520
+ * @param {string[]} stories - An array of story names to load.
521
+ * @param {string} [startName] - The name of the story to start.
522
+ * @param {string} [entryName] - The entry point within the story to start from.
523
+ * @param {boolean} [goNextOnLoad=false] - Whether to automatically advance to the next line after loading.
524
+ */
525
+ declare function useScenario(stories: string[], startName?: string, entryName?: string, goNextOnLoad?: boolean): void;
526
+
527
+ /**
528
+ * Used to load a sound effect and provide a function to play it.
529
+ */
530
+ declare function useSoundEffect(src: string): () => void;
531
+
532
+ /** Flow control interface passed to every handler. */
533
+ interface GameControl {
534
+ /** Timed wait — blocks auto-advance. Engine fires scenariowaitingcancelled on timeout or skip. */
535
+ setWaiting(time: number, skippable: boolean): void;
536
+ /** Indefinite hold — blocks auto-advance until user action. */
537
+ hold(): void;
538
+ /** Manually advance (rarely needed, e.g. `!` tailing). */
539
+ nextLine(): void;
540
+ /** Mark this dispatch cycle as unskippable. If skipping, hold() will stop skip instead of advancing. */
541
+ unskippable(): void;
542
+ /** Record the current runtime snapshot for backlog usage. */
543
+ record(meta: Record<string, any>): string;
544
+ }
545
+ interface ScenarioCommandBaseType {
546
+ command: string;
547
+ [key: string]: unknown;
548
+ }
549
+ /** Command handler function. */
550
+ type CommandHandler<T extends ScenarioCommandBaseType = ScenarioCommandBaseType> = (cmd: T, control: GameControl) => void;
551
+ /** Text line handler function. */
552
+ type TextLineHandler = (text: TextLine, control: GameControl) => void;
553
+ interface AutoTicketOptions {
554
+ label?: string;
555
+ tailMs?: number;
556
+ }
557
+ interface AutoTicketHandle {
558
+ done(): void;
559
+ cancel(): void;
560
+ }
561
+ /** Reactive skip state. Actors read via useIsSkipping(). */
562
+ declare const skipState: {
563
+ active: boolean;
564
+ };
565
+ /** Reactive auto state. Actors read via useIsAutoing(). */
566
+ declare const autoState: {
567
+ active: boolean;
568
+ };
569
+ /** Reactively returns whether skip (Ctrl fast-forward) is active. */
570
+ declare function useIsSkipping(): boolean;
571
+ /** Reactively returns whether auto mode is active. */
572
+ declare function useIsAutoing(): boolean;
573
+ /** Set the default tail delay in milliseconds for newly created auto tickets. */
574
+ declare function setDefaultAutoTailMs(ms: number): void;
575
+ declare function createStage(): {
576
+ registerCommandSchema: <T extends ZodType>(schema: T) => () => void;
577
+ registerCommand: <T extends ScenarioCommandBaseType>(commands: string | string[], handler: CommandHandler<T>) => () => void;
578
+ registerTextLine: (handler: TextLineHandler) => () => void;
579
+ addSkipCallback: (cb: () => void) => () => void;
580
+ addInterruptCallback: (cb: () => boolean) => () => void;
581
+ addSkipBlocker: (cb: () => boolean) => () => void;
582
+ addAutoBlocker: (cb: () => boolean) => () => void;
583
+ addBeforeHandleCommandCallback: (cb: (upcomingCommand: ResolvedCommandLine) => void) => () => void;
584
+ issueAutoTicket: (options?: AutoTicketOptions) => AutoTicketHandle | null;
585
+ tryInterrupt: () => boolean;
586
+ startSkip: () => void;
587
+ stopSkip: () => void;
588
+ isSkipping: () => boolean;
589
+ startAuto: () => void;
590
+ stopAuto: () => void;
591
+ isAutoing: () => boolean;
592
+ bindEvents: () => () => void;
593
+ };
594
+ type StageInstance = ReturnType<typeof createStage>;
595
+ /** Access the stage instance from within StageContextProvider. */
596
+ declare function useStageContext(): StageInstance;
597
+ declare function StageContextProvider({ stage, children }: {
598
+ stage: StageInstance;
599
+ children: React.ReactNode;
600
+ }): React$1.FunctionComponentElement<React$1.ProviderProps<{
601
+ registerCommandSchema: <T extends ZodType>(schema: T) => () => void;
602
+ registerCommand: <T extends ScenarioCommandBaseType>(commands: string | string[], handler: CommandHandler<T>) => () => void;
603
+ registerTextLine: (handler: TextLineHandler) => () => void;
604
+ addSkipCallback: (cb: () => void) => () => void;
605
+ addInterruptCallback: (cb: () => boolean) => () => void;
606
+ addSkipBlocker: (cb: () => boolean) => () => void;
607
+ addAutoBlocker: (cb: () => boolean) => () => void;
608
+ addBeforeHandleCommandCallback: (cb: (upcomingCommand: ResolvedCommandLine) => void) => () => void;
609
+ issueAutoTicket: (options?: AutoTicketOptions) => AutoTicketHandle | null;
610
+ tryInterrupt: () => boolean;
611
+ startSkip: () => void;
612
+ stopSkip: () => void;
613
+ isSkipping: () => boolean;
614
+ startAuto: () => void;
615
+ stopAuto: () => void;
616
+ isAutoing: () => boolean;
617
+ bindEvents: () => () => void;
618
+ } | null>>;
619
+ /**
620
+ * Register a skip callback that fires when scenariowaitingcancelled is received.
621
+ * Automatically removed on unmount.
622
+ */
623
+ declare function useSkipCallback(callback: () => void): void;
624
+ /**
625
+ * Register an interrupt callback for user click handling.
626
+ * Return `true` from the callback to consume the click.
627
+ * Automatically removed on unmount.
628
+ */
629
+ declare function useInterruptCallback(callback: () => boolean): void;
630
+ /**
631
+ * Register a skip blocker callback. Return `true` to block skipping.
632
+ * When any blocker is active, skip mode cannot start or will be stopped.
633
+ * Automatically removed on unmount.
634
+ *
635
+ * NOTE: `callback` must be a stable reference (wrap with `useCallback`).
636
+ */
637
+ declare function useSkipBlocker(callback: () => boolean): void;
638
+ /**
639
+ * Register an auto blocker callback. Return `true` to block auto mode.
640
+ * Automatically removed on unmount.
641
+ *
642
+ * NOTE: `callback` must be a stable reference (wrap with `useCallback`).
643
+ */
644
+ declare function useAutoBlocker(callback: () => boolean): void;
645
+ /**
646
+ * Get a function that issues an auto ticket for the current active barrier.
647
+ * Returns `null` when auto is inactive or the collection window has closed.
648
+ */
649
+ declare function useAutoTicket(): (options?: AutoTicketOptions) => AutoTicketHandle | null;
650
+ /**
651
+ * Register a callback to be invoked before handling each command.
652
+ * The callback receives the upcoming command object, allowing conditional logic.
653
+ * Automatically removed on unmount.
654
+ */
655
+ declare function useBeforeHandleCommandCallback(callback: (upcomingCommand: ResolvedCommandLine) => void): void;
656
+
657
+ declare module 'zod' {
658
+ interface GlobalMeta {
659
+ title?: string;
660
+ format?: string;
661
+ 'x-asset-kind'?: 'audio' | 'image' | 'font' | 'video' | 'other';
662
+ 'x-i18n'?: Record<string, string>;
663
+ 'x-i18n-desc'?: Record<string, string>;
664
+ }
665
+ }
666
+
667
+ export { type AnimatedComponent, type AnimatedProps, type AnimationFrameCallbackEvent, type AutoTicketHandle, type AutoTicketOptions, type BeforeUnloadEvent, Command, type CommandHandler, type CustomEvent, type DefaultOverlayName, type DefaultPageName, type FocusEvent, type FocusEventKind, type FullScreenEvent, type FullscreenEventKind, type GameControl, type GameEvent, type Gamepad, type GamepadButton, type GamepadEvent, type GamepadHapticActuator, JSX, type KeyboardLocation, type Literal, MaybePromise, MouseEvent, MoyuEvent, MoyuRenderer, type NavigationState, type Navigator, Node, type NodeEvent, type OverlayConfig, type OverlayDescriptor, type OverlayInfo, OverlayParamsContext, type PageConfig, type PageDescriptor, PageParamsContext, type RegisterNavigator, type ResizeEvent, type ResolvedArgument, type ResolvedCommandLine, type ResolvedSystemCallLine, type RootNavigatorList, type RootOptions, type ScenarioCommandBaseType, type ScenarioEvent, type StackNavigatorOptions, StageContextProvider, type StageInstance, type TextEvent, type TextLine, type TextLineHandler, type WheelEvent, type WheelEventDeltaMode, type WithAnimated, animated as a, addEventListener, animated, autoState, createRoot, createStackNavigator, createStage, createStaticNavigation, executeNodeCommand, executePluginCommand, getNavigator, globalEventListeners, globalRequestAnimationFrameListeners, moyu, nextLine, setDefaultAutoTailMs, setWaiting, skipState, useAutoBlocker, useAutoTicket, useBeforeHandleCommandCallback, useFadeIn, useFadeInOut, useFadeOut, useInterruptCallback, useIsAutoing, useIsSkipping, useNavigation, useNavigationParams, useNavigationState, useScenario, useSkipBlocker, useSkipCallback, useSoundEffect, useStageContext };