@momoyu-ink/kit 0.4.2 → 0.5.1
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/jsx-dev-runtime--ZXLAgUi.d.mts +600 -0
- package/dist/jsx-dev-runtime--ZXLAgUi.d.ts +600 -0
- package/dist/jsx-dev-runtime.cjs +27 -0
- package/dist/jsx-dev-runtime.d.mts +4 -0
- package/dist/jsx-dev-runtime.d.ts +4 -0
- package/dist/jsx-dev-runtime.mjs +6 -0
- package/dist/jsx-runtime.cjs +28 -0
- package/dist/jsx-runtime.d.mts +4 -0
- package/dist/jsx-runtime.d.ts +4 -0
- package/dist/jsx-runtime.mjs +7 -0
- package/dist/lib.cjs +1610 -0
- package/dist/lib.d.mts +668 -0
- package/dist/lib.d.ts +668 -15
- package/dist/lib.mjs +1641 -0
- package/package.json +29 -8
- package/dist/bindings/AnimationFormat.d.ts +0 -1
- package/dist/bindings/AnimationFormat.js +0 -3
- package/dist/bindings/AnimationFrameCallbackEvent.d.ts +0 -3
- package/dist/bindings/AnimationFrameCallbackEvent.js +0 -3
- package/dist/bindings/AnimationProps.d.ts +0 -6
- package/dist/bindings/AnimationProps.js +0 -2
- package/dist/bindings/AudioCommand.d.ts +0 -54
- package/dist/bindings/AudioCommand.js +0 -2
- package/dist/bindings/AudioSettings.d.ts +0 -42
- package/dist/bindings/AudioSettings.js +0 -3
- package/dist/bindings/BackdropProps.d.ts +0 -6
- package/dist/bindings/BackdropProps.js +0 -2
- package/dist/bindings/BeforeUnloadEvent.d.ts +0 -1
- package/dist/bindings/BeforeUnloadEvent.js +0 -3
- package/dist/bindings/ClipProps.d.ts +0 -4
- package/dist/bindings/ClipProps.js +0 -3
- package/dist/bindings/CustomEvent.d.ts +0 -18
- package/dist/bindings/CustomEvent.js +0 -3
- package/dist/bindings/EffectParams.d.ts +0 -6
- package/dist/bindings/EffectParams.js +0 -3
- package/dist/bindings/FilterKind.d.ts +0 -34
- package/dist/bindings/FilterKind.js +0 -3
- package/dist/bindings/FilterProps.d.ts +0 -4
- package/dist/bindings/FilterProps.js +0 -2
- package/dist/bindings/FocusEvent.d.ts +0 -5
- package/dist/bindings/FocusEvent.js +0 -2
- package/dist/bindings/FocusEventKind.d.ts +0 -1
- package/dist/bindings/FocusEventKind.js +0 -3
- package/dist/bindings/FullScreenEvent.d.ts +0 -4
- package/dist/bindings/FullScreenEvent.js +0 -2
- package/dist/bindings/FullscreenEventKind.d.ts +0 -1
- package/dist/bindings/FullscreenEventKind.js +0 -3
- package/dist/bindings/GameEvent.d.ts +0 -1
- package/dist/bindings/GameEvent.js +0 -3
- package/dist/bindings/Gamepad.d.ts +0 -44
- package/dist/bindings/Gamepad.js +0 -2
- package/dist/bindings/GamepadButton.d.ts +0 -20
- package/dist/bindings/GamepadButton.js +0 -3
- package/dist/bindings/GamepadCommand.d.ts +0 -9
- package/dist/bindings/GamepadCommand.js +0 -2
- package/dist/bindings/GamepadEvent.d.ts +0 -12
- package/dist/bindings/GamepadEvent.js +0 -2
- package/dist/bindings/GamepadHapticActuator.d.ts +0 -11
- package/dist/bindings/GamepadHapticActuator.js +0 -3
- package/dist/bindings/KeyboardEventKind.d.ts +0 -1
- package/dist/bindings/KeyboardEventKind.js +0 -3
- package/dist/bindings/KeyboardLocation.d.ts +0 -1
- package/dist/bindings/KeyboardLocation.js +0 -3
- package/dist/bindings/Literal.d.ts +0 -3
- package/dist/bindings/Literal.js +0 -3
- package/dist/bindings/MouseEventKind.d.ts +0 -1
- package/dist/bindings/MouseEventKind.js +0 -3
- package/dist/bindings/MoyuCursor.d.ts +0 -1
- package/dist/bindings/MoyuCursor.js +0 -3
- package/dist/bindings/NineSliceMode.d.ts +0 -1
- package/dist/bindings/NineSliceMode.js +0 -3
- package/dist/bindings/NodeEvent.d.ts +0 -4
- package/dist/bindings/NodeEvent.js +0 -3
- package/dist/bindings/NodeProps.d.ts +0 -20
- package/dist/bindings/NodeProps.js +0 -2
- package/dist/bindings/RawKeyboardEvent.d.ts +0 -16
- package/dist/bindings/RawKeyboardEvent.js +0 -2
- package/dist/bindings/RawMouseEvent.d.ts +0 -12
- package/dist/bindings/RawMouseEvent.js +0 -2
- package/dist/bindings/RawTouchEvent.d.ts +0 -13
- package/dist/bindings/RawTouchEvent.js +0 -2
- package/dist/bindings/RawWheelEvent.d.ts +0 -10
- package/dist/bindings/RawWheelEvent.js +0 -2
- package/dist/bindings/ResizeEvent.d.ts +0 -4
- package/dist/bindings/ResizeEvent.js +0 -3
- package/dist/bindings/ResolvedArgument.d.ts +0 -5
- package/dist/bindings/ResolvedArgument.js +0 -2
- package/dist/bindings/ResolvedCommandLine.d.ts +0 -5
- package/dist/bindings/ResolvedCommandLine.js +0 -2
- package/dist/bindings/ResolvedSystemCallLine.d.ts +0 -5
- package/dist/bindings/ResolvedSystemCallLine.js +0 -2
- package/dist/bindings/ScenarioCommand.d.ts +0 -103
- package/dist/bindings/ScenarioCommand.js +0 -2
- package/dist/bindings/ScenarioEvent.d.ts +0 -4
- package/dist/bindings/ScenarioEvent.js +0 -2
- package/dist/bindings/SpriteMode.d.ts +0 -1
- package/dist/bindings/SpriteMode.js +0 -3
- package/dist/bindings/SpriteProps.d.ts +0 -11
- package/dist/bindings/SpriteProps.js +0 -2
- package/dist/bindings/SystemCommand.d.ts +0 -30
- package/dist/bindings/SystemCommand.js +0 -2
- package/dist/bindings/TextCommand.d.ts +0 -9
- package/dist/bindings/TextCommand.js +0 -3
- package/dist/bindings/TextEvent.d.ts +0 -1
- package/dist/bindings/TextEvent.js +0 -3
- package/dist/bindings/TextLine.d.ts +0 -5
- package/dist/bindings/TextLine.js +0 -3
- package/dist/bindings/TextPrintMode.d.ts +0 -4
- package/dist/bindings/TextPrintMode.js +0 -3
- package/dist/bindings/TextProps.d.ts +0 -41
- package/dist/bindings/TextProps.js +0 -2
- package/dist/bindings/TouchEventKind.d.ts +0 -1
- package/dist/bindings/TouchEventKind.js +0 -3
- package/dist/bindings/VideoCommand.d.ts +0 -21
- package/dist/bindings/VideoCommand.js +0 -3
- package/dist/bindings/VideoEvent.d.ts +0 -1
- package/dist/bindings/VideoEvent.js +0 -3
- package/dist/bindings/VideoProps.d.ts +0 -7
- package/dist/bindings/VideoProps.js +0 -3
- package/dist/bindings/WheelEventDeltaMode.d.ts +0 -1
- package/dist/bindings/WheelEventDeltaMode.js +0 -3
- package/dist/bindings/WindowState.d.ts +0 -1
- package/dist/bindings/WindowState.js +0 -3
- package/dist/bindings/serde_json/JsonValue.d.ts +0 -3
- package/dist/bindings/serde_json/JsonValue.js +0 -3
- package/dist/commands.d.ts +0 -17
- package/dist/commands.js +0 -24
- package/dist/components/navigation.d.ts +0 -154
- package/dist/components/navigation.js +0 -252
- package/dist/declaration.d.ts +0 -80
- package/dist/declaration.js +0 -2
- package/dist/events/base.d.ts +0 -16
- package/dist/events/base.js +0 -19
- package/dist/events/globals.d.ts +0 -2
- package/dist/events/globals.js +0 -122
- package/dist/events/keyboard.d.ts +0 -37
- package/dist/events/keyboard.js +0 -2
- package/dist/events/listener.d.ts +0 -1
- package/dist/events/listener.js +0 -13
- package/dist/events/mouse.d.ts +0 -15
- package/dist/events/mouse.js +0 -2
- package/dist/events/touch.d.ts +0 -16
- package/dist/events/touch.js +0 -2
- package/dist/events/wheel.d.ts +0 -9
- package/dist/events/wheel.js +0 -2
- package/dist/events.d.ts +0 -33
- package/dist/events.js +0 -49
- package/dist/hooks/useFadeInOut.d.ts +0 -16
- package/dist/hooks/useFadeInOut.js +0 -62
- package/dist/hooks/useScenario.d.ts +0 -13
- package/dist/hooks/useScenario.js +0 -64
- package/dist/hooks/useSoundEffect.d.ts +0 -4
- package/dist/hooks/useSoundEffect.js +0 -63
- package/dist/hooks/useStage.d.ts +0 -126
- package/dist/hooks/useStage.js +0 -706
- package/dist/hooks.d.ts +0 -4
- package/dist/hooks.js +0 -20
- package/dist/lib.js +0 -54
- package/dist/moyu.d.ts +0 -19
- package/dist/moyu.js +0 -49
- package/dist/node.d.ts +0 -16
- package/dist/node.js +0 -105
- package/dist/react.d.ts +0 -20
- package/dist/react.js +0 -222
- package/dist/runtime-globals.d.ts +0 -65
- package/dist/runtime-globals.js +0 -2
- package/dist/sandbox.d.ts +0 -1
- package/dist/sandbox.js +0 -88
- package/dist/spring/animated.d.ts +0 -27
- package/dist/spring/animated.js +0 -2
- package/dist/spring/index.d.ts +0 -5
- package/dist/spring/index.js +0 -35
- package/dist/spring/primitives.d.ts +0 -3
- package/dist/spring/primitives.js +0 -13
- package/dist/state.d.ts +0 -6
- package/dist/state.js +0 -8
- package/dist/utils.d.ts +0 -10
- package/dist/utils.js +0 -10
- package/dist/zod-patch.d.ts +0 -10
- package/dist/zod-patch.js +0 -2
- package/jsx-runtime.d.ts +0 -1
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import 'react/jsx-runtime';
|
|
2
|
+
import 'react/jsx-dev-runtime';
|
|
3
|
+
import { ReactNode, ClassAttributes } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Settings for audio playback, including delay, start position, volume, etc.
|
|
7
|
+
*/
|
|
8
|
+
type AudioSettings = {
|
|
9
|
+
/**
|
|
10
|
+
* Optional delay time in seconds before the audio starts playing.
|
|
11
|
+
*/
|
|
12
|
+
delayTime?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The position in seconds where the audio should start playing.
|
|
15
|
+
*/
|
|
16
|
+
startPosition?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the sound should be played in reverse.
|
|
19
|
+
*/
|
|
20
|
+
reverse?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Loop region defined by a start and end time in seconds. `-1` for end means loop to the end of the audio.
|
|
23
|
+
*/
|
|
24
|
+
loopRegion?: [number, number];
|
|
25
|
+
/**
|
|
26
|
+
* Volume of the audio, ranges from 0.0 (silence) to 1.0 (normal volume),
|
|
27
|
+
* values greater than 1.0 can be used for amplification.
|
|
28
|
+
*/
|
|
29
|
+
volume?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Playback rate of the audio, where 1.0 is normal speed.
|
|
32
|
+
*/
|
|
33
|
+
playbackRate?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Panning value from -1.0 (left) to 1.0 (right), with 0.0 being center.
|
|
36
|
+
*/
|
|
37
|
+
panning?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the audio should start playing automatically after loading.
|
|
40
|
+
*/
|
|
41
|
+
autoPlay?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Optional fade time in milliseconds for audio transitions.
|
|
44
|
+
*/
|
|
45
|
+
fadeTime?: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type AudioCommand = {
|
|
49
|
+
subCommand: 'load';
|
|
50
|
+
name: string;
|
|
51
|
+
src: string;
|
|
52
|
+
settings?: AudioSettings;
|
|
53
|
+
} | {
|
|
54
|
+
subCommand: 'release';
|
|
55
|
+
name: string;
|
|
56
|
+
fadeTime?: number;
|
|
57
|
+
} | {
|
|
58
|
+
subCommand: 'play';
|
|
59
|
+
name: string;
|
|
60
|
+
fadeTime?: number;
|
|
61
|
+
waitForEnd?: boolean;
|
|
62
|
+
} | {
|
|
63
|
+
subCommand: 'stop';
|
|
64
|
+
name: string;
|
|
65
|
+
fadeTime?: number;
|
|
66
|
+
} | {
|
|
67
|
+
subCommand: 'pause';
|
|
68
|
+
name: string;
|
|
69
|
+
fadeTime?: number;
|
|
70
|
+
} | {
|
|
71
|
+
subCommand: 'resume';
|
|
72
|
+
name: string;
|
|
73
|
+
fadeTime?: number;
|
|
74
|
+
} | {
|
|
75
|
+
subCommand: 'setVolume';
|
|
76
|
+
name: string;
|
|
77
|
+
volume: number;
|
|
78
|
+
fadeTime?: number;
|
|
79
|
+
} | {
|
|
80
|
+
subCommand: 'seekBy';
|
|
81
|
+
name: string;
|
|
82
|
+
time: number;
|
|
83
|
+
} | {
|
|
84
|
+
subCommand: 'seekTo';
|
|
85
|
+
name: string;
|
|
86
|
+
time: number;
|
|
87
|
+
} | {
|
|
88
|
+
subCommand: 'setPlaybackRate';
|
|
89
|
+
name: string;
|
|
90
|
+
rate: number;
|
|
91
|
+
} | {
|
|
92
|
+
subCommand: 'setLoopRegion';
|
|
93
|
+
name: string;
|
|
94
|
+
start: number;
|
|
95
|
+
end: number;
|
|
96
|
+
} | {
|
|
97
|
+
subCommand: 'setPanning';
|
|
98
|
+
name: string;
|
|
99
|
+
panning: number;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type EffectParams = {
|
|
103
|
+
duration: number;
|
|
104
|
+
startDelay: number;
|
|
105
|
+
weakMagnitude: number;
|
|
106
|
+
strongMagnitude: number;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type GamepadCommand = {
|
|
110
|
+
subCommand: 'getGamepads';
|
|
111
|
+
} | {
|
|
112
|
+
subCommand: 'playEffect';
|
|
113
|
+
index: number;
|
|
114
|
+
effect: string;
|
|
115
|
+
params: EffectParams;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type JsonValue = number | string | boolean | Array<JsonValue> | {
|
|
119
|
+
[key in string]: JsonValue;
|
|
120
|
+
} | null;
|
|
121
|
+
|
|
122
|
+
type ScenarioCommand = {
|
|
123
|
+
subCommand: 'addStory';
|
|
124
|
+
name: string;
|
|
125
|
+
} | {
|
|
126
|
+
subCommand: 'removeStory';
|
|
127
|
+
name: string;
|
|
128
|
+
} | {
|
|
129
|
+
subCommand: 'hasStory';
|
|
130
|
+
name: string;
|
|
131
|
+
} | {
|
|
132
|
+
subCommand: 'getStoryList';
|
|
133
|
+
} | {
|
|
134
|
+
subCommand: 'startStory';
|
|
135
|
+
/**
|
|
136
|
+
* The name of the story to start
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
/**
|
|
140
|
+
* The entry point to start from
|
|
141
|
+
*/
|
|
142
|
+
entry?: string;
|
|
143
|
+
} | {
|
|
144
|
+
subCommand: 'terminateStory';
|
|
145
|
+
} | {
|
|
146
|
+
subCommand: 'nextLine';
|
|
147
|
+
} | {
|
|
148
|
+
subCommand: 'setWaiting';
|
|
149
|
+
/**
|
|
150
|
+
* waiting time in milliseconds
|
|
151
|
+
* use f64 to avoid conversion issues with JavaScript numbers
|
|
152
|
+
*/
|
|
153
|
+
time: number;
|
|
154
|
+
/**
|
|
155
|
+
* whether the waiting can be skipped by user input
|
|
156
|
+
*/
|
|
157
|
+
skippable: boolean;
|
|
158
|
+
} | {
|
|
159
|
+
subCommand: 'setVariable';
|
|
160
|
+
name: string;
|
|
161
|
+
value: JsonValue;
|
|
162
|
+
} | {
|
|
163
|
+
subCommand: 'getVariable';
|
|
164
|
+
name: string;
|
|
165
|
+
} | {
|
|
166
|
+
subCommand: 'setVariables';
|
|
167
|
+
variables: {
|
|
168
|
+
[key in string]: JsonValue;
|
|
169
|
+
};
|
|
170
|
+
} | {
|
|
171
|
+
subCommand: 'getVariables';
|
|
172
|
+
} | {
|
|
173
|
+
subCommand: 'setPermanentVariable';
|
|
174
|
+
key: string;
|
|
175
|
+
value: JsonValue;
|
|
176
|
+
} | {
|
|
177
|
+
subCommand: 'getPermanentVariable';
|
|
178
|
+
key: string;
|
|
179
|
+
} | {
|
|
180
|
+
subCommand: 'setPermanentVariables';
|
|
181
|
+
variables: {
|
|
182
|
+
[key in string]: JsonValue;
|
|
183
|
+
};
|
|
184
|
+
} | {
|
|
185
|
+
subCommand: 'getPermanentVariables';
|
|
186
|
+
} | {
|
|
187
|
+
subCommand: 'clearPermanentVariables';
|
|
188
|
+
} | {
|
|
189
|
+
subCommand: 'saveGame';
|
|
190
|
+
name: string;
|
|
191
|
+
extra?: JsonValue;
|
|
192
|
+
} | {
|
|
193
|
+
subCommand: 'record';
|
|
194
|
+
meta: {
|
|
195
|
+
[key in string]: JsonValue;
|
|
196
|
+
};
|
|
197
|
+
} | {
|
|
198
|
+
subCommand: 'getRecords';
|
|
199
|
+
offset?: number;
|
|
200
|
+
limit?: number;
|
|
201
|
+
} | {
|
|
202
|
+
subCommand: 'jumpToRecord';
|
|
203
|
+
recordId: string;
|
|
204
|
+
} | {
|
|
205
|
+
subCommand: 'loadGame';
|
|
206
|
+
name: string;
|
|
207
|
+
/**
|
|
208
|
+
* if true, will overwrite the current game session with the loaded one,
|
|
209
|
+
* otherwise an error will be returned if the current session is not empty
|
|
210
|
+
*/
|
|
211
|
+
overwrite: boolean;
|
|
212
|
+
} | {
|
|
213
|
+
subCommand: 'resetGame';
|
|
214
|
+
} | {
|
|
215
|
+
subCommand: 'removeGame';
|
|
216
|
+
name: string;
|
|
217
|
+
} | {
|
|
218
|
+
subCommand: 'getGameList';
|
|
219
|
+
/**
|
|
220
|
+
* matches the name of the game session
|
|
221
|
+
*/
|
|
222
|
+
pattern?: string;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
type WindowState = 'idle' | 'maximized' | 'minimized' | 'fullscreen';
|
|
226
|
+
|
|
227
|
+
type SystemCommand = {
|
|
228
|
+
subCommand: 'setWindowSize';
|
|
229
|
+
width: number;
|
|
230
|
+
height: number;
|
|
231
|
+
factor?: number;
|
|
232
|
+
} | {
|
|
233
|
+
subCommand: 'setWindowState';
|
|
234
|
+
state: WindowState;
|
|
235
|
+
} | {
|
|
236
|
+
subCommand: 'setTitle';
|
|
237
|
+
title: string;
|
|
238
|
+
} | {
|
|
239
|
+
subCommand: 'getWindowState';
|
|
240
|
+
} | {
|
|
241
|
+
subCommand: 'getWindowInnerPosition';
|
|
242
|
+
} | {
|
|
243
|
+
subCommand: 'getWindowInnerSize';
|
|
244
|
+
} | {
|
|
245
|
+
subCommand: 'getStageSize';
|
|
246
|
+
} | {
|
|
247
|
+
subCommand: 'takeSnapshot';
|
|
248
|
+
width?: number;
|
|
249
|
+
height?: number;
|
|
250
|
+
keepAspectRatio?: boolean;
|
|
251
|
+
} | {
|
|
252
|
+
subCommand: 'getParams';
|
|
253
|
+
} | {
|
|
254
|
+
subCommand: 'quit';
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
type TextCommand = {
|
|
258
|
+
subCommand: 'setText';
|
|
259
|
+
text: string;
|
|
260
|
+
instant?: boolean;
|
|
261
|
+
} | {
|
|
262
|
+
subCommand: 'finishPrinting';
|
|
263
|
+
} | {
|
|
264
|
+
subCommand: 'getCursorPosition';
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
declare function getStageSize(): {
|
|
268
|
+
width: number;
|
|
269
|
+
height: number;
|
|
270
|
+
scaleFactor: number;
|
|
271
|
+
};
|
|
272
|
+
type MakeNullOptional<T> = T extends any ? {
|
|
273
|
+
[K in keyof T as null extends T[K] ? never : K]: T[K];
|
|
274
|
+
} & {
|
|
275
|
+
[K in keyof T as null extends T[K] ? K : never]?: T[K];
|
|
276
|
+
} : never;
|
|
277
|
+
|
|
278
|
+
type _Command = AudioCommand | TextCommand | GamepadCommand | ScenarioCommand | SystemCommand;
|
|
279
|
+
type Command = MakeNullOptional<_Command>;
|
|
280
|
+
type MaybePromise = any;
|
|
281
|
+
|
|
282
|
+
interface MoyuEvent<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
283
|
+
name: string;
|
|
284
|
+
body: T;
|
|
285
|
+
}
|
|
286
|
+
interface BubbleEvent {
|
|
287
|
+
targetId: number;
|
|
288
|
+
bubbleTargetIds: number[];
|
|
289
|
+
currentTargetId: number;
|
|
290
|
+
stopPropagation: () => void;
|
|
291
|
+
preventDefault: () => void;
|
|
292
|
+
defaultPrevented: boolean;
|
|
293
|
+
bubbles: boolean;
|
|
294
|
+
}
|
|
295
|
+
declare function createBubbleEvent<T extends BubbleEvent>(body: Record<string, any> & {
|
|
296
|
+
bubbleTargetIds: number[];
|
|
297
|
+
}, targetId: number): T;
|
|
298
|
+
|
|
299
|
+
declare class Node {
|
|
300
|
+
nodeId: number;
|
|
301
|
+
label?: string;
|
|
302
|
+
props: Record<string, any>;
|
|
303
|
+
listeners: Record<string, (evt?: BubbleEvent | Record<string, any>) => any>;
|
|
304
|
+
static create(label: string, type: string, props: Record<string, any>): Node;
|
|
305
|
+
static rootNode(): Node;
|
|
306
|
+
addChild(child: Node): void;
|
|
307
|
+
insertChild(_index: number, child: Node): void;
|
|
308
|
+
insertChildBefore(beforeChild: Node, child: Node): void;
|
|
309
|
+
removeChild(child: Node): void;
|
|
310
|
+
updateProps(props: Record<string, any>): void;
|
|
311
|
+
executeCommand(payload: Command): any;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
type KeyboardEventKind = 'KeyDown' | 'KeyUp' | 'KeyPress';
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* KeyboardEvent objects describe a user interaction with the keyboard; each event describes a single interaction between the user and a key (or combination of a key with modifier keys) on the keyboard.
|
|
318
|
+
*
|
|
319
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent)
|
|
320
|
+
*/
|
|
321
|
+
interface KeyboardEvent extends BubbleEvent {
|
|
322
|
+
readonly kind: KeyboardEventKind;
|
|
323
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/altKey) */
|
|
324
|
+
readonly altKey: boolean;
|
|
325
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/code) */
|
|
326
|
+
readonly code: string;
|
|
327
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/ctrlKey) */
|
|
328
|
+
readonly ctrlKey: boolean;
|
|
329
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/isComposing) */
|
|
330
|
+
readonly isComposing: boolean;
|
|
331
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/key) */
|
|
332
|
+
readonly key: string;
|
|
333
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/location) */
|
|
334
|
+
readonly location: number;
|
|
335
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/metaKey) */
|
|
336
|
+
readonly metaKey: boolean;
|
|
337
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/repeat) */
|
|
338
|
+
readonly repeat: boolean;
|
|
339
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/shiftKey) */
|
|
340
|
+
readonly shiftKey: boolean;
|
|
341
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/getModifierState)
|
|
342
|
+
*
|
|
343
|
+
* Not implemented yet
|
|
344
|
+
*/
|
|
345
|
+
getModifierState(keyArg: string): boolean;
|
|
346
|
+
readonly DOM_KEY_LOCATION_STANDARD: 0x00;
|
|
347
|
+
readonly DOM_KEY_LOCATION_LEFT: 0x01;
|
|
348
|
+
readonly DOM_KEY_LOCATION_RIGHT: 0x02;
|
|
349
|
+
readonly DOM_KEY_LOCATION_NUMPAD: 0x03;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
type MouseEventKind = 'MouseEnter' | 'MouseLeave' | 'MouseDown' | 'MouseUp' | 'MouseMove' | 'Click' | 'DoubleClick' | 'ContextMenu';
|
|
353
|
+
|
|
354
|
+
interface MouseEvent extends BubbleEvent {
|
|
355
|
+
kind: MouseEventKind;
|
|
356
|
+
targetId: number;
|
|
357
|
+
currentTargetId: number;
|
|
358
|
+
targetLabel?: string;
|
|
359
|
+
currentTargetLabel?: string;
|
|
360
|
+
clientX: number;
|
|
361
|
+
clientY: number;
|
|
362
|
+
screenX: number;
|
|
363
|
+
screenY: number;
|
|
364
|
+
offsetX: number;
|
|
365
|
+
offsetY: number;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
type TouchEventKind = 'TouchStart' | 'TouchMove' | 'TouchEnd' | 'TouchCancel';
|
|
369
|
+
|
|
370
|
+
interface TouchEvent extends BubbleEvent {
|
|
371
|
+
kind: TouchEventKind;
|
|
372
|
+
targetId: number;
|
|
373
|
+
currentTargetId: number;
|
|
374
|
+
targetLabel: string;
|
|
375
|
+
currentTargetLabel: string;
|
|
376
|
+
clientX: number;
|
|
377
|
+
clientY: number;
|
|
378
|
+
screenX: number;
|
|
379
|
+
screenY: number;
|
|
380
|
+
offsetX: number;
|
|
381
|
+
offsetY: number;
|
|
382
|
+
identifier: number;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
type MoyuCursor = 'hidden' | 'default' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out' | 'dnd-ask' | 'all-resize';
|
|
386
|
+
|
|
387
|
+
type NodeProps = {
|
|
388
|
+
label?: string;
|
|
389
|
+
anchor?: [number, number];
|
|
390
|
+
pivot?: [number, number];
|
|
391
|
+
x?: number;
|
|
392
|
+
y?: number;
|
|
393
|
+
scale?: number;
|
|
394
|
+
scaleX?: number;
|
|
395
|
+
scaleY?: number;
|
|
396
|
+
rotation?: number;
|
|
397
|
+
skew?: number;
|
|
398
|
+
skewX?: number;
|
|
399
|
+
skewY?: number;
|
|
400
|
+
visible?: boolean;
|
|
401
|
+
tint?: string;
|
|
402
|
+
opacity?: number;
|
|
403
|
+
interactive?: boolean;
|
|
404
|
+
cursor?: MoyuCursor;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
type ClipProps = {
|
|
408
|
+
width?: number;
|
|
409
|
+
height?: number;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* 滤镜配置(可序列化,用于 JS 互操作)
|
|
414
|
+
*/
|
|
415
|
+
type FilterKind = {
|
|
416
|
+
type: 'blur-perfect';
|
|
417
|
+
radius: number;
|
|
418
|
+
} | {
|
|
419
|
+
type: 'blur';
|
|
420
|
+
radius: number;
|
|
421
|
+
continuous?: boolean;
|
|
422
|
+
} | {
|
|
423
|
+
type: 'brightness';
|
|
424
|
+
amount: number;
|
|
425
|
+
} | {
|
|
426
|
+
type: 'contrast';
|
|
427
|
+
amount: number;
|
|
428
|
+
} | {
|
|
429
|
+
type: 'saturation';
|
|
430
|
+
amount: number;
|
|
431
|
+
} | {
|
|
432
|
+
type: 'hue-rotate';
|
|
433
|
+
degrees: number;
|
|
434
|
+
} | {
|
|
435
|
+
type: 'grayscale';
|
|
436
|
+
amount: number;
|
|
437
|
+
} | {
|
|
438
|
+
type: 'sepia';
|
|
439
|
+
amount: number;
|
|
440
|
+
} | {
|
|
441
|
+
type: 'invert';
|
|
442
|
+
amount: number;
|
|
443
|
+
} | {
|
|
444
|
+
type: 'unknown';
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
type FilterProps = {
|
|
448
|
+
filters?: Array<FilterKind>;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
type BackdropProps = {
|
|
452
|
+
filters?: Array<FilterKind>;
|
|
453
|
+
width?: number;
|
|
454
|
+
height?: number;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
type NineSliceMode = 'stretch' | 'repeat' | 'mirror' | 'blank';
|
|
458
|
+
|
|
459
|
+
type SpriteMode = 'normal' | 'nineslice';
|
|
460
|
+
|
|
461
|
+
type SpriteProps = {
|
|
462
|
+
src: string | null;
|
|
463
|
+
mode?: SpriteMode;
|
|
464
|
+
area?: [number, number, number, number];
|
|
465
|
+
bounds?: [number, number, number, number];
|
|
466
|
+
nineSliceMode?: NineSliceMode;
|
|
467
|
+
targetWidth?: number;
|
|
468
|
+
targetHeight?: number;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Text print mode
|
|
473
|
+
*/
|
|
474
|
+
type TextPrintMode = 'instant' | 'typewriter' | 'printer';
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* To be compatible with react-spring inside JS runtime, we have to flatten the struct.
|
|
478
|
+
* FIXME: But `#[serde(flatten)]` works not quite well when there are more than one `#[serde(flatten)]` in a struct.
|
|
479
|
+
* So we do it manually.
|
|
480
|
+
*/
|
|
481
|
+
type TextProps = {
|
|
482
|
+
text?: string;
|
|
483
|
+
printMode?: TextPrintMode;
|
|
484
|
+
printSpeed?: number;
|
|
485
|
+
/**
|
|
486
|
+
* the writing direction of the text in the box,
|
|
487
|
+
* only `Horizontal` (right-to-left) or `Vertical` (top-to-bottom) is valid.
|
|
488
|
+
*/
|
|
489
|
+
direction?: 'horizontal' | 'vertical';
|
|
490
|
+
/**
|
|
491
|
+
* the width of box.
|
|
492
|
+
*/
|
|
493
|
+
boxWidth?: number;
|
|
494
|
+
/**
|
|
495
|
+
* the height of box.
|
|
496
|
+
*/
|
|
497
|
+
boxHeight?: number;
|
|
498
|
+
/**
|
|
499
|
+
* the size of the glyph grid which each character be fit to, usually equals to `font_size`.
|
|
500
|
+
*/
|
|
501
|
+
glyphGridSize?: number;
|
|
502
|
+
fontSize?: number;
|
|
503
|
+
fillColor?: string;
|
|
504
|
+
lineHeight?: number;
|
|
505
|
+
indent?: number;
|
|
506
|
+
stroke?: boolean;
|
|
507
|
+
shadow?: boolean;
|
|
508
|
+
strokeColor?: string;
|
|
509
|
+
strokeWidth?: number;
|
|
510
|
+
shadowColor?: string;
|
|
511
|
+
shadowOffsetX?: number;
|
|
512
|
+
shadowOffsetY?: number;
|
|
513
|
+
shadowBlur?: number;
|
|
514
|
+
shadowWidth?: number;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
type AnimationFormat = 'apng' | 'webp';
|
|
518
|
+
|
|
519
|
+
type AnimationProps = {
|
|
520
|
+
src: string | null;
|
|
521
|
+
area?: [number, number, number, number];
|
|
522
|
+
format?: AnimationFormat;
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
type VideoProps = {
|
|
526
|
+
src: string | null;
|
|
527
|
+
loop?: boolean;
|
|
528
|
+
autoPlay?: boolean;
|
|
529
|
+
volume?: number;
|
|
530
|
+
muted?: boolean;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
type Tuple2 = [number, number];
|
|
534
|
+
type Tuple3 = [number, number, number];
|
|
535
|
+
type Tuple4 = [number, number, number, number];
|
|
536
|
+
type DetailedMoyuProps<E extends MoyuNodeAttributes> = ClassAttributes<Node> & E;
|
|
537
|
+
type MoyuEventHandler<T extends BubbleEvent> = (event: T) => void;
|
|
538
|
+
interface MoyuListenerAttributes {
|
|
539
|
+
onClick?: MoyuEventHandler<MouseEvent>;
|
|
540
|
+
onMouseEnter?: MoyuEventHandler<MouseEvent>;
|
|
541
|
+
onMouseLeave?: MoyuEventHandler<MouseEvent>;
|
|
542
|
+
onMouseDown?: MoyuEventHandler<MouseEvent>;
|
|
543
|
+
onMouseUp?: MoyuEventHandler<MouseEvent>;
|
|
544
|
+
onMouseMove?: MoyuEventHandler<MouseEvent>;
|
|
545
|
+
onKeyDown?: MoyuEventHandler<KeyboardEvent>;
|
|
546
|
+
onKeyUp?: MoyuEventHandler<KeyboardEvent>;
|
|
547
|
+
onKeyPress?: MoyuEventHandler<KeyboardEvent>;
|
|
548
|
+
onTouchStart?: MoyuEventHandler<TouchEvent>;
|
|
549
|
+
onTouchMove?: MoyuEventHandler<TouchEvent>;
|
|
550
|
+
onTouchEnd?: MoyuEventHandler<TouchEvent>;
|
|
551
|
+
onTouchCancel?: MoyuEventHandler<TouchEvent>;
|
|
552
|
+
}
|
|
553
|
+
type MoyuNodeAttributes = MoyuListenerAttributes & NodeProps & {
|
|
554
|
+
children?: ReactNode;
|
|
555
|
+
};
|
|
556
|
+
type MoyuContainerAttributes = MoyuNodeAttributes;
|
|
557
|
+
type MoyuClipAttributes = ClipProps & MoyuNodeAttributes;
|
|
558
|
+
type MoyuFilterAttributes = FilterProps & MoyuNodeAttributes;
|
|
559
|
+
type MoyuBackdropAttributes = BackdropProps & MoyuNodeAttributes;
|
|
560
|
+
type MoyuAnimationAttributes = AnimationProps & MoyuNodeAttributes;
|
|
561
|
+
type MoyuVideoAttributes = VideoProps & MoyuNodeAttributes & {
|
|
562
|
+
onEnded?: () => void;
|
|
563
|
+
onStateChange?: (state: string) => void;
|
|
564
|
+
};
|
|
565
|
+
type MoyuSpriteAttributes = SpriteProps & MoyuNodeAttributes;
|
|
566
|
+
type MoyuTextAttributes = TextProps & MoyuNodeAttributes & {
|
|
567
|
+
onStart?: () => void;
|
|
568
|
+
onFinish?: () => void;
|
|
569
|
+
onProgress?: (progress: number) => void;
|
|
570
|
+
};
|
|
571
|
+
declare namespace JSX {
|
|
572
|
+
type ElementType = string | React.JSXElementConstructor<any>;
|
|
573
|
+
interface Element extends React.ReactElement<any, any> {
|
|
574
|
+
}
|
|
575
|
+
interface ElementClass extends React.Component<any> {
|
|
576
|
+
render(): React.ReactNode;
|
|
577
|
+
}
|
|
578
|
+
interface ElementAttributesProperty {
|
|
579
|
+
props: {};
|
|
580
|
+
}
|
|
581
|
+
interface ElementChildrenAttribute {
|
|
582
|
+
children: {};
|
|
583
|
+
}
|
|
584
|
+
interface IntrinsicAttributes extends React.Attributes {
|
|
585
|
+
}
|
|
586
|
+
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {
|
|
587
|
+
}
|
|
588
|
+
interface IntrinsicElements {
|
|
589
|
+
container: DetailedMoyuProps<MoyuContainerAttributes>;
|
|
590
|
+
sprite: DetailedMoyuProps<MoyuSpriteAttributes>;
|
|
591
|
+
text: DetailedMoyuProps<MoyuTextAttributes>;
|
|
592
|
+
clip: DetailedMoyuProps<MoyuClipAttributes>;
|
|
593
|
+
filter: DetailedMoyuProps<MoyuFilterAttributes>;
|
|
594
|
+
backdrop: DetailedMoyuProps<MoyuBackdropAttributes>;
|
|
595
|
+
animation: DetailedMoyuProps<MoyuAnimationAttributes>;
|
|
596
|
+
video: DetailedMoyuProps<MoyuVideoAttributes>;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export { type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EffectParams as E, type GamepadCommand as G, JSX as J, type KeyboardEvent as K, type MouseEvent as M, Node as N, type ScenarioCommand as S, type TextCommand as T, type WindowState as W, type MoyuEvent as a, type MaybePromise as b, type AudioSettings as c, type KeyboardEventKind as d, type MakeNullOptional as e, type MouseEventKind as f, type MoyuAnimationAttributes as g, type MoyuBackdropAttributes as h, type MoyuClipAttributes as i, type MoyuContainerAttributes as j, type MoyuEventHandler as k, type MoyuFilterAttributes as l, type MoyuListenerAttributes as m, type MoyuNodeAttributes as n, type MoyuSpriteAttributes as o, type MoyuTextAttributes as p, type MoyuVideoAttributes as q, type SystemCommand as r, type TouchEvent as s, type TouchEventKind as t, type Tuple2 as u, type Tuple3 as v, type Tuple4 as w, createBubbleEvent as x, getStageSize as y };
|