@momoyu-ink/kit 0.13.0 → 0.14.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.
@@ -138,6 +138,43 @@ type GamepadCommand = {
138
138
  params: EffectParams;
139
139
  };
140
140
 
141
+ type Live2dCommand = {
142
+ subCommand: 'startMotion';
143
+ group: string;
144
+ index: number;
145
+ priority?: number;
146
+ fadeIn?: number;
147
+ fadeOut?: number;
148
+ loop?: boolean;
149
+ } | {
150
+ subCommand: 'stopAllMotions';
151
+ } | {
152
+ subCommand: 'setExpression';
153
+ name: string;
154
+ } | {
155
+ subCommand: 'stopExpression';
156
+ } | {
157
+ subCommand: 'setParameter';
158
+ id: string;
159
+ value: number;
160
+ } | {
161
+ subCommand: 'setParameters';
162
+ values: {
163
+ [key in string]: number;
164
+ };
165
+ } | {
166
+ subCommand: 'resetParameters';
167
+ } | {
168
+ subCommand: 'setPartOpacity';
169
+ id: string;
170
+ value: number;
171
+ } | {
172
+ subCommand: 'hitTest';
173
+ area: string;
174
+ x: number;
175
+ y: number;
176
+ };
177
+
141
178
  type WarpBoundary = 'before' | 'after';
142
179
 
143
180
  type JsonValue = number | string | boolean | Array<JsonValue> | {
@@ -147,6 +184,10 @@ type JsonValue = number | string | boolean | Array<JsonValue> | {
147
184
  type ScenarioCommand = {
148
185
  subCommand: 'addStory';
149
186
  name: string;
187
+ } | {
188
+ subCommand: 'addStoryFromContent';
189
+ name: string;
190
+ content: string;
150
191
  } | {
151
192
  subCommand: 'replaceStoryData';
152
193
  name: string;
@@ -297,6 +338,56 @@ type ShaderCommand = {
297
338
  subCommand: 'reset';
298
339
  };
299
340
 
341
+ type SpineCommand = {
342
+ "subCommand": "setAnimation";
343
+ track: number;
344
+ animation: string;
345
+ loop?: boolean;
346
+ /**
347
+ * Transition duration; negative keeps the runtime's default.
348
+ */
349
+ mix?: number;
350
+ delay?: number;
351
+ /**
352
+ * Start offset in seconds.
353
+ */
354
+ time?: number;
355
+ } | {
356
+ "subCommand": "addAnimation";
357
+ track: number;
358
+ animation: string;
359
+ loop?: boolean;
360
+ mix?: number;
361
+ delay?: number;
362
+ time?: number;
363
+ } | {
364
+ "subCommand": "clearTrack";
365
+ track: number;
366
+ mix?: number;
367
+ } | {
368
+ "subCommand": "clearTracks";
369
+ } | {
370
+ "subCommand": "setDefaultMix";
371
+ duration: number;
372
+ } | {
373
+ "subCommand": "setMix";
374
+ from: string;
375
+ to: string;
376
+ duration: number;
377
+ } | {
378
+ "subCommand": "setAttachment";
379
+ slot: string;
380
+ name: string;
381
+ } | {
382
+ "subCommand": "resetToSetupPose";
383
+ } | {
384
+ "subCommand": "resetPhysics";
385
+ } | {
386
+ "subCommand": "hitTest";
387
+ x: number;
388
+ y: number;
389
+ };
390
+
300
391
  type OverlayDialog = 'friends' | 'community' | 'players' | 'settings' | 'officialGameGroup' | 'stats' | 'achievements';
301
392
 
302
393
  type OverlayNotificationPosition = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
@@ -429,7 +520,7 @@ type SteamCommand = {
429
520
 
430
521
  type ReadFormat = 'text' | 'binary';
431
522
 
432
- type WindowState = "idle" | "maximized" | "minimized" | "fullscreen";
523
+ type WindowState = 'idle' | 'maximized' | 'minimized' | 'fullscreen';
433
524
 
434
525
  type SystemCommand = {
435
526
  subCommand: 'setWindowSize';
@@ -976,6 +1067,250 @@ type VideoProps = {
976
1067
  muted?: boolean;
977
1068
  };
978
1069
 
1070
+ /**
1071
+ * Canvas geometry of a model, in canvas pixels.
1072
+ */
1073
+ type Live2dCanvas = {
1074
+ width: number;
1075
+ height: number;
1076
+ originX: number;
1077
+ originY: number;
1078
+ pixelsPerUnit: number;
1079
+ };
1080
+
1081
+ /**
1082
+ * One expression of the model.
1083
+ */
1084
+ type Live2dExpression = {
1085
+ name: string;
1086
+ fadeIn: number;
1087
+ fadeOut: number;
1088
+ };
1089
+
1090
+ /**
1091
+ * One motion of the model.
1092
+ */
1093
+ type Live2dMotion = {
1094
+ group: string;
1095
+ index: number;
1096
+ duration: number;
1097
+ fadeIn: number;
1098
+ fadeOut: number;
1099
+ /**
1100
+ * Sound file path relative to the model directory; absent when the motion
1101
+ * carries no sound.
1102
+ */
1103
+ sound?: string;
1104
+ };
1105
+
1106
+ /**
1107
+ * One model parameter.
1108
+ */
1109
+ type Live2dParameter = {
1110
+ id: string;
1111
+ /**
1112
+ * Parameter type: -1 unknown, 0 normal, 1 blend shape.
1113
+ */
1114
+ kind: number;
1115
+ min: number;
1116
+ max: number;
1117
+ default: number;
1118
+ };
1119
+
1120
+ /**
1121
+ * Everything the `ready` event reports about a loaded model.
1122
+ */
1123
+ type Live2dMetadata = {
1124
+ canvas: Live2dCanvas;
1125
+ motions: Array<Live2dMotion>;
1126
+ expressions: Array<Live2dExpression>;
1127
+ hitAreas: Array<string>;
1128
+ parameters: Array<Live2dParameter>;
1129
+ };
1130
+
1131
+ /**
1132
+ * Events emitted by the `live2d` node.
1133
+ */
1134
+ type Live2dEvent = ({
1135
+ type: 'ready';
1136
+ } & Live2dMetadata) | {
1137
+ type: 'motionFinished';
1138
+ group: string;
1139
+ index: number;
1140
+ } | {
1141
+ type: 'motionEvent';
1142
+ value: string;
1143
+ } | {
1144
+ type: 'blendModeUnsupported';
1145
+ value: number;
1146
+ } | {
1147
+ type: 'hit';
1148
+ area: string;
1149
+ x: number;
1150
+ y: number;
1151
+ } | {
1152
+ type: 'error';
1153
+ code: number;
1154
+ message: string;
1155
+ };
1156
+
1157
+ type Live2dProps = {
1158
+ src: string | null;
1159
+ physics?: boolean;
1160
+ pose?: boolean;
1161
+ blink?: boolean;
1162
+ breath?: boolean;
1163
+ look?: boolean;
1164
+ idle?: boolean;
1165
+ hitTest?: boolean;
1166
+ };
1167
+
1168
+ /**
1169
+ * Identity of one playback.
1170
+ *
1171
+ * `entry` is assigned by the plugin and stays unique within one loaded model;
1172
+ * `epoch` is bumped by the host on every model change. Together they survive a
1173
+ * reload: an entry id is reused after the plugin drops the old model, so a
1174
+ * waiter that only compared `entry` would match the wrong playback.
1175
+ */
1176
+ type EntryIdentity = {
1177
+ entry: bigint;
1178
+ epoch: bigint;
1179
+ };
1180
+
1181
+ /**
1182
+ * One animation of the model.
1183
+ */
1184
+ type SpineAnimation = {
1185
+ name: string;
1186
+ /**
1187
+ * Length in seconds; zero for animations that only hold a pose.
1188
+ */
1189
+ duration: number;
1190
+ };
1191
+
1192
+ /**
1193
+ * A rectangle in world units with y up.
1194
+ */
1195
+ type SpineBounds = {
1196
+ x: number;
1197
+ y: number;
1198
+ width: number;
1199
+ height: number;
1200
+ };
1201
+
1202
+ /**
1203
+ * Where the `premultiplied` flag came from.
1204
+ */
1205
+ type AlphaSource = "atlas" | "image";
1206
+
1207
+ /**
1208
+ * One texture page of the model.
1209
+ */
1210
+ type SpinePage = {
1211
+ /**
1212
+ * Image path relative to the asset root.
1213
+ */
1214
+ path: string;
1215
+ width: number;
1216
+ height: number;
1217
+ /**
1218
+ * Whether the source alpha is already premultiplied.
1219
+ */
1220
+ premultiplied: boolean;
1221
+ /**
1222
+ * How the page declares premultiplied alpha, for diagnostics.
1223
+ */
1224
+ alphaSource: AlphaSource;
1225
+ };
1226
+
1227
+ /**
1228
+ * Everything the `ready` event reports about a loaded model.
1229
+ */
1230
+ type SpineMetadata = {
1231
+ /**
1232
+ * Skeleton data version string, as written by the Spine Editor.
1233
+ *
1234
+ * Diagnostic only: it never selects a runtime.
1235
+ */
1236
+ dataVersion: string;
1237
+ /**
1238
+ * Bounds measured once at load in the setup pose, in world units.
1239
+ *
1240
+ * This is the layout rectangle: it does not follow animations or skin
1241
+ * changes, and it is not a clip boundary.
1242
+ */
1243
+ bounds: SpineBounds;
1244
+ animations: Array<SpineAnimation>;
1245
+ skins: Array<string>;
1246
+ pages: Array<SpinePage>;
1247
+ boundingBoxes: Array<string>;
1248
+ };
1249
+
1250
+ /**
1251
+ * Events emitted by the `spine` node.
1252
+ */
1253
+ type SpineEvent = {
1254
+ "type": "ready";
1255
+ } & SpineMetadata | {
1256
+ "type": "trackStart";
1257
+ track: number;
1258
+ id: EntryIdentity;
1259
+ animation: string;
1260
+ } | {
1261
+ "type": "trackComplete";
1262
+ track: number;
1263
+ id: EntryIdentity;
1264
+ animation: string;
1265
+ } | {
1266
+ "type": "trackEnd";
1267
+ track: number;
1268
+ id: EntryIdentity;
1269
+ animation: string;
1270
+ } | {
1271
+ "type": "trackDispose";
1272
+ track: number;
1273
+ id: EntryIdentity;
1274
+ animation: string;
1275
+ } | {
1276
+ "type": "trackEvent";
1277
+ track: number;
1278
+ id: EntryIdentity;
1279
+ animation: string;
1280
+ name: string;
1281
+ intValue: number;
1282
+ floatValue: number;
1283
+ stringValue: string;
1284
+ audioPath: string;
1285
+ volume: number;
1286
+ balance: number;
1287
+ } | {
1288
+ "type": "hit";
1289
+ epoch: bigint;
1290
+ name: string;
1291
+ x: number;
1292
+ y: number;
1293
+ } | {
1294
+ "type": "error";
1295
+ code: number;
1296
+ message: string;
1297
+ };
1298
+
1299
+ /**
1300
+ * How the runtime advances physics constraints.
1301
+ */
1302
+ type PhysicsMode = "none" | "pose" | "update";
1303
+
1304
+ type SpineProps = {
1305
+ src: string | null;
1306
+ atlas?: string;
1307
+ skin?: string;
1308
+ timeScale?: number;
1309
+ paused?: boolean;
1310
+ physics?: PhysicsMode;
1311
+ hitArea?: boolean;
1312
+ };
1313
+
979
1314
  type Tuple2 = [number, number];
980
1315
  type Tuple3 = [number, number, number];
981
1316
  type Tuple4 = [number, number, number, number];
@@ -1046,6 +1381,63 @@ type MoyuVideoAttributes = VideoProps & MoyuNodeAttributes & {
1046
1381
  onEnded?: () => void;
1047
1382
  onStateChange?: (state: string) => void;
1048
1383
  };
1384
+ type MoyuLive2dAttributes = Live2dProps & MoyuNodeAttributes & {
1385
+ /** The model finished loading; the payload holds its full metadata. */
1386
+ onReady?: (event: Extract<Live2dEvent, {
1387
+ type: 'ready';
1388
+ }>) => void;
1389
+ onMotionFinished?: (event: Extract<Live2dEvent, {
1390
+ type: 'motionFinished';
1391
+ }>) => void;
1392
+ onMotionEvent?: (event: Extract<Live2dEvent, {
1393
+ type: 'motionEvent';
1394
+ }>) => void;
1395
+ onBlendModeUnsupported?: (event: Extract<Live2dEvent, {
1396
+ type: 'blendModeUnsupported';
1397
+ }>) => void;
1398
+ /**
1399
+ * A press landed on a hit area, reported per area when several overlap.
1400
+ * Requires the `hitTest` prop.
1401
+ */
1402
+ onHit?: (event: Extract<Live2dEvent, {
1403
+ type: 'hit';
1404
+ }>) => void;
1405
+ onError?: (event: Extract<Live2dEvent, {
1406
+ type: 'error';
1407
+ }>) => void;
1408
+ };
1409
+ type MoyuSpineAttributes = SpineProps & MoyuNodeAttributes & {
1410
+ /** The model finished parsing; the payload holds its full metadata. */
1411
+ onReady?: (event: Extract<SpineEvent, {
1412
+ type: 'ready';
1413
+ }>) => void;
1414
+ onTrackStart?: (event: Extract<SpineEvent, {
1415
+ type: 'trackStart';
1416
+ }>) => void;
1417
+ onTrackComplete?: (event: Extract<SpineEvent, {
1418
+ type: 'trackComplete';
1419
+ }>) => void;
1420
+ onTrackEnd?: (event: Extract<SpineEvent, {
1421
+ type: 'trackEnd';
1422
+ }>) => void;
1423
+ /**
1424
+ * The terminal signal for a playback: it fires for completion,
1425
+ * interruption and cancellation alike, so waiting on it always returns.
1426
+ */
1427
+ onTrackDispose?: (event: Extract<SpineEvent, {
1428
+ type: 'trackDispose';
1429
+ }>) => void;
1430
+ onTrackEvent?: (event: Extract<SpineEvent, {
1431
+ type: 'trackEvent';
1432
+ }>) => void;
1433
+ /** A press landed inside a named bounding box; requires the `hitArea` prop. */
1434
+ onHit?: (event: Extract<SpineEvent, {
1435
+ type: 'hit';
1436
+ }>) => void;
1437
+ onError?: (event: Extract<SpineEvent, {
1438
+ type: 'error';
1439
+ }>) => void;
1440
+ };
1049
1441
  type MoyuSpriteAttributes = SpriteProps & MoyuNodeAttributes;
1050
1442
  type MoyuTextAttributes = TextProps & MoyuNodeAttributes & {
1051
1443
  onStart?: () => void;
@@ -1085,6 +1477,8 @@ declare namespace JSX {
1085
1477
  shader: DetailedMoyuProps<MoyuShaderAttributes>;
1086
1478
  'shader-slot': DetailedMoyuProps<MoyuShaderSlotAttributes>;
1087
1479
  video: DetailedMoyuProps<MoyuVideoAttributes>;
1480
+ live2d: DetailedMoyuProps<MoyuLive2dAttributes>;
1481
+ spine: DetailedMoyuProps<MoyuSpineAttributes>;
1088
1482
  }
1089
1483
  }
1090
1484
 
@@ -1101,8 +1495,8 @@ type MakeNullOptional<T> = T extends unknown ? {
1101
1495
  } : never;
1102
1496
  declare function mergeEvent<T extends BubbleEvent, K extends BubbleEvent>(handlers: MoyuEventHandler<T> | readonly MoyuEventHandler<T>[] | undefined, defaultHandler?: MoyuEventHandler<K>): (event: T | K) => void;
1103
1497
 
1104
- type _Command = AudioCommand | EditableCommand | TextCommand | GamepadCommand | ScenarioCommand | ShaderCommand | SteamCommand | SystemCommand | VideoCommand;
1498
+ type _Command = AudioCommand | EditableCommand | TextCommand | GamepadCommand | Live2dCommand | ScenarioCommand | ShaderCommand | SpineCommand | SteamCommand | SystemCommand | VideoCommand;
1105
1499
  type Command = MakeNullOptional<_Command>;
1106
1500
  type MaybePromise = any;
1107
1501
 
1108
- export { type ShaderParam as $, type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EditableState as E, type MoyuHBoxAttributes as F, type GamepadCommand as G, type MoyuListenerAttributes as H, type MoyuShaderAttributes as I, JSX as J, type KeyboardEvent as K, type LayoutEvent as L, type MoyuEvent as M, type MoyuShaderSlotAttributes as N, type MoyuVideoAttributes as O, Node as P, type OverlayDialog as Q, type OverlayNotificationPosition as R, type ShaderDirection as S, type TouchEvent as T, type OverlayStoreFlag as U, type PlatformInfo as V, type WheelEvent as W, type PointerEventKind as X, type RetainMode as Y, type ScenarioCommand as Z, type ShaderCommand as _, type MaybePromise as a, type ShaderParamType as a0, type ShaderSource as a1, type ShaderTimeControl as a2, type SteamCommand as a3, type SystemCommand as a4, type TextCommand as a5, type TextInteractionEvent as a6, type TextLayoutEvent as a7, type TimelinePossibleClip as a8, type TouchEventKind as a9, type Tuple2 as aa, type Tuple3 as ab, type Tuple4 as ac, type VideoCommand as ad, type WheelEventDeltaMode as ae, type WindowState as af, createBubbleEvent as ag, getPlatform as ah, getStageSize as ai, mergeEvent as aj, type MoyuClipAttributes as b, type MoyuVBoxAttributes as c, type MoyuSpriteAttributes as d, type TextProps as e, type MoyuNodeAttributes as f, type MouseEvent as g, type MoyuTextAttributes as h, type EditableChangeSource as i, type SpriteProps as j, type JsonValue as k, type AudioSettings as l, type EditableCommand as m, type EditableEvent as n, type EffectParams as o, type KeyboardEventKind as p, type MakeNullOptional as q, MouseButton as r, MouseButtons as s, type MouseEventKind as t, type MoyuAnimationAttributes as u, type MoyuBackdropAttributes as v, type MoyuContainerAttributes as w, type MoyuEditableAttributes as x, type MoyuEventHandler as y, type MoyuFilterAttributes as z };
1502
+ export { type OverlayStoreFlag as $, type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EditableState as E, type MoyuContainerAttributes as F, type GamepadCommand as G, type MoyuEditableAttributes as H, type MoyuEventHandler as I, JSX as J, type KeyboardEvent as K, type LayoutEvent as L, type MoyuEvent as M, type MoyuFilterAttributes as N, type MoyuHBoxAttributes as O, type MoyuListenerAttributes as P, type MoyuLive2dAttributes as Q, type MoyuShaderAttributes as R, type ShaderDirection as S, type TouchEvent as T, type MoyuShaderSlotAttributes as U, type MoyuSpineAttributes as V, type WheelEvent as W, type MoyuVideoAttributes as X, Node as Y, type OverlayDialog as Z, type OverlayNotificationPosition as _, type MaybePromise as a, type PlatformInfo as a0, type PointerEventKind as a1, type RetainMode as a2, type ScenarioCommand as a3, type ShaderCommand as a4, type ShaderParam as a5, type ShaderParamType as a6, type ShaderSource as a7, type ShaderTimeControl as a8, type SpineCommand as a9, type SpineEvent as aa, type SpineMetadata as ab, type SteamCommand as ac, type SystemCommand as ad, type TextCommand as ae, type TextInteractionEvent as af, type TextLayoutEvent as ag, type TimelinePossibleClip as ah, type TouchEventKind as ai, type Tuple2 as aj, type Tuple3 as ak, type Tuple4 as al, type VideoCommand as am, type WheelEventDeltaMode as an, type WindowState as ao, createBubbleEvent as ap, getPlatform as aq, getStageSize as ar, mergeEvent as as, type MoyuClipAttributes as b, type MoyuVBoxAttributes as c, type MoyuSpriteAttributes as d, type TextProps as e, type MoyuNodeAttributes as f, type MouseEvent as g, type MoyuTextAttributes as h, type EditableChangeSource as i, type SpriteProps as j, type JsonValue as k, type AudioSettings as l, type EditableCommand as m, type EditableEvent as n, type EffectParams as o, type EntryIdentity as p, type KeyboardEventKind as q, type Live2dCommand as r, type Live2dEvent as s, type Live2dMetadata as t, type MakeNullOptional as u, MouseButton as v, MouseButtons as w, type MouseEventKind as x, type MoyuAnimationAttributes as y, type MoyuBackdropAttributes as z };
@@ -138,6 +138,43 @@ type GamepadCommand = {
138
138
  params: EffectParams;
139
139
  };
140
140
 
141
+ type Live2dCommand = {
142
+ subCommand: 'startMotion';
143
+ group: string;
144
+ index: number;
145
+ priority?: number;
146
+ fadeIn?: number;
147
+ fadeOut?: number;
148
+ loop?: boolean;
149
+ } | {
150
+ subCommand: 'stopAllMotions';
151
+ } | {
152
+ subCommand: 'setExpression';
153
+ name: string;
154
+ } | {
155
+ subCommand: 'stopExpression';
156
+ } | {
157
+ subCommand: 'setParameter';
158
+ id: string;
159
+ value: number;
160
+ } | {
161
+ subCommand: 'setParameters';
162
+ values: {
163
+ [key in string]: number;
164
+ };
165
+ } | {
166
+ subCommand: 'resetParameters';
167
+ } | {
168
+ subCommand: 'setPartOpacity';
169
+ id: string;
170
+ value: number;
171
+ } | {
172
+ subCommand: 'hitTest';
173
+ area: string;
174
+ x: number;
175
+ y: number;
176
+ };
177
+
141
178
  type WarpBoundary = 'before' | 'after';
142
179
 
143
180
  type JsonValue = number | string | boolean | Array<JsonValue> | {
@@ -147,6 +184,10 @@ type JsonValue = number | string | boolean | Array<JsonValue> | {
147
184
  type ScenarioCommand = {
148
185
  subCommand: 'addStory';
149
186
  name: string;
187
+ } | {
188
+ subCommand: 'addStoryFromContent';
189
+ name: string;
190
+ content: string;
150
191
  } | {
151
192
  subCommand: 'replaceStoryData';
152
193
  name: string;
@@ -297,6 +338,56 @@ type ShaderCommand = {
297
338
  subCommand: 'reset';
298
339
  };
299
340
 
341
+ type SpineCommand = {
342
+ "subCommand": "setAnimation";
343
+ track: number;
344
+ animation: string;
345
+ loop?: boolean;
346
+ /**
347
+ * Transition duration; negative keeps the runtime's default.
348
+ */
349
+ mix?: number;
350
+ delay?: number;
351
+ /**
352
+ * Start offset in seconds.
353
+ */
354
+ time?: number;
355
+ } | {
356
+ "subCommand": "addAnimation";
357
+ track: number;
358
+ animation: string;
359
+ loop?: boolean;
360
+ mix?: number;
361
+ delay?: number;
362
+ time?: number;
363
+ } | {
364
+ "subCommand": "clearTrack";
365
+ track: number;
366
+ mix?: number;
367
+ } | {
368
+ "subCommand": "clearTracks";
369
+ } | {
370
+ "subCommand": "setDefaultMix";
371
+ duration: number;
372
+ } | {
373
+ "subCommand": "setMix";
374
+ from: string;
375
+ to: string;
376
+ duration: number;
377
+ } | {
378
+ "subCommand": "setAttachment";
379
+ slot: string;
380
+ name: string;
381
+ } | {
382
+ "subCommand": "resetToSetupPose";
383
+ } | {
384
+ "subCommand": "resetPhysics";
385
+ } | {
386
+ "subCommand": "hitTest";
387
+ x: number;
388
+ y: number;
389
+ };
390
+
300
391
  type OverlayDialog = 'friends' | 'community' | 'players' | 'settings' | 'officialGameGroup' | 'stats' | 'achievements';
301
392
 
302
393
  type OverlayNotificationPosition = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
@@ -429,7 +520,7 @@ type SteamCommand = {
429
520
 
430
521
  type ReadFormat = 'text' | 'binary';
431
522
 
432
- type WindowState = "idle" | "maximized" | "minimized" | "fullscreen";
523
+ type WindowState = 'idle' | 'maximized' | 'minimized' | 'fullscreen';
433
524
 
434
525
  type SystemCommand = {
435
526
  subCommand: 'setWindowSize';
@@ -976,6 +1067,250 @@ type VideoProps = {
976
1067
  muted?: boolean;
977
1068
  };
978
1069
 
1070
+ /**
1071
+ * Canvas geometry of a model, in canvas pixels.
1072
+ */
1073
+ type Live2dCanvas = {
1074
+ width: number;
1075
+ height: number;
1076
+ originX: number;
1077
+ originY: number;
1078
+ pixelsPerUnit: number;
1079
+ };
1080
+
1081
+ /**
1082
+ * One expression of the model.
1083
+ */
1084
+ type Live2dExpression = {
1085
+ name: string;
1086
+ fadeIn: number;
1087
+ fadeOut: number;
1088
+ };
1089
+
1090
+ /**
1091
+ * One motion of the model.
1092
+ */
1093
+ type Live2dMotion = {
1094
+ group: string;
1095
+ index: number;
1096
+ duration: number;
1097
+ fadeIn: number;
1098
+ fadeOut: number;
1099
+ /**
1100
+ * Sound file path relative to the model directory; absent when the motion
1101
+ * carries no sound.
1102
+ */
1103
+ sound?: string;
1104
+ };
1105
+
1106
+ /**
1107
+ * One model parameter.
1108
+ */
1109
+ type Live2dParameter = {
1110
+ id: string;
1111
+ /**
1112
+ * Parameter type: -1 unknown, 0 normal, 1 blend shape.
1113
+ */
1114
+ kind: number;
1115
+ min: number;
1116
+ max: number;
1117
+ default: number;
1118
+ };
1119
+
1120
+ /**
1121
+ * Everything the `ready` event reports about a loaded model.
1122
+ */
1123
+ type Live2dMetadata = {
1124
+ canvas: Live2dCanvas;
1125
+ motions: Array<Live2dMotion>;
1126
+ expressions: Array<Live2dExpression>;
1127
+ hitAreas: Array<string>;
1128
+ parameters: Array<Live2dParameter>;
1129
+ };
1130
+
1131
+ /**
1132
+ * Events emitted by the `live2d` node.
1133
+ */
1134
+ type Live2dEvent = ({
1135
+ type: 'ready';
1136
+ } & Live2dMetadata) | {
1137
+ type: 'motionFinished';
1138
+ group: string;
1139
+ index: number;
1140
+ } | {
1141
+ type: 'motionEvent';
1142
+ value: string;
1143
+ } | {
1144
+ type: 'blendModeUnsupported';
1145
+ value: number;
1146
+ } | {
1147
+ type: 'hit';
1148
+ area: string;
1149
+ x: number;
1150
+ y: number;
1151
+ } | {
1152
+ type: 'error';
1153
+ code: number;
1154
+ message: string;
1155
+ };
1156
+
1157
+ type Live2dProps = {
1158
+ src: string | null;
1159
+ physics?: boolean;
1160
+ pose?: boolean;
1161
+ blink?: boolean;
1162
+ breath?: boolean;
1163
+ look?: boolean;
1164
+ idle?: boolean;
1165
+ hitTest?: boolean;
1166
+ };
1167
+
1168
+ /**
1169
+ * Identity of one playback.
1170
+ *
1171
+ * `entry` is assigned by the plugin and stays unique within one loaded model;
1172
+ * `epoch` is bumped by the host on every model change. Together they survive a
1173
+ * reload: an entry id is reused after the plugin drops the old model, so a
1174
+ * waiter that only compared `entry` would match the wrong playback.
1175
+ */
1176
+ type EntryIdentity = {
1177
+ entry: bigint;
1178
+ epoch: bigint;
1179
+ };
1180
+
1181
+ /**
1182
+ * One animation of the model.
1183
+ */
1184
+ type SpineAnimation = {
1185
+ name: string;
1186
+ /**
1187
+ * Length in seconds; zero for animations that only hold a pose.
1188
+ */
1189
+ duration: number;
1190
+ };
1191
+
1192
+ /**
1193
+ * A rectangle in world units with y up.
1194
+ */
1195
+ type SpineBounds = {
1196
+ x: number;
1197
+ y: number;
1198
+ width: number;
1199
+ height: number;
1200
+ };
1201
+
1202
+ /**
1203
+ * Where the `premultiplied` flag came from.
1204
+ */
1205
+ type AlphaSource = "atlas" | "image";
1206
+
1207
+ /**
1208
+ * One texture page of the model.
1209
+ */
1210
+ type SpinePage = {
1211
+ /**
1212
+ * Image path relative to the asset root.
1213
+ */
1214
+ path: string;
1215
+ width: number;
1216
+ height: number;
1217
+ /**
1218
+ * Whether the source alpha is already premultiplied.
1219
+ */
1220
+ premultiplied: boolean;
1221
+ /**
1222
+ * How the page declares premultiplied alpha, for diagnostics.
1223
+ */
1224
+ alphaSource: AlphaSource;
1225
+ };
1226
+
1227
+ /**
1228
+ * Everything the `ready` event reports about a loaded model.
1229
+ */
1230
+ type SpineMetadata = {
1231
+ /**
1232
+ * Skeleton data version string, as written by the Spine Editor.
1233
+ *
1234
+ * Diagnostic only: it never selects a runtime.
1235
+ */
1236
+ dataVersion: string;
1237
+ /**
1238
+ * Bounds measured once at load in the setup pose, in world units.
1239
+ *
1240
+ * This is the layout rectangle: it does not follow animations or skin
1241
+ * changes, and it is not a clip boundary.
1242
+ */
1243
+ bounds: SpineBounds;
1244
+ animations: Array<SpineAnimation>;
1245
+ skins: Array<string>;
1246
+ pages: Array<SpinePage>;
1247
+ boundingBoxes: Array<string>;
1248
+ };
1249
+
1250
+ /**
1251
+ * Events emitted by the `spine` node.
1252
+ */
1253
+ type SpineEvent = {
1254
+ "type": "ready";
1255
+ } & SpineMetadata | {
1256
+ "type": "trackStart";
1257
+ track: number;
1258
+ id: EntryIdentity;
1259
+ animation: string;
1260
+ } | {
1261
+ "type": "trackComplete";
1262
+ track: number;
1263
+ id: EntryIdentity;
1264
+ animation: string;
1265
+ } | {
1266
+ "type": "trackEnd";
1267
+ track: number;
1268
+ id: EntryIdentity;
1269
+ animation: string;
1270
+ } | {
1271
+ "type": "trackDispose";
1272
+ track: number;
1273
+ id: EntryIdentity;
1274
+ animation: string;
1275
+ } | {
1276
+ "type": "trackEvent";
1277
+ track: number;
1278
+ id: EntryIdentity;
1279
+ animation: string;
1280
+ name: string;
1281
+ intValue: number;
1282
+ floatValue: number;
1283
+ stringValue: string;
1284
+ audioPath: string;
1285
+ volume: number;
1286
+ balance: number;
1287
+ } | {
1288
+ "type": "hit";
1289
+ epoch: bigint;
1290
+ name: string;
1291
+ x: number;
1292
+ y: number;
1293
+ } | {
1294
+ "type": "error";
1295
+ code: number;
1296
+ message: string;
1297
+ };
1298
+
1299
+ /**
1300
+ * How the runtime advances physics constraints.
1301
+ */
1302
+ type PhysicsMode = "none" | "pose" | "update";
1303
+
1304
+ type SpineProps = {
1305
+ src: string | null;
1306
+ atlas?: string;
1307
+ skin?: string;
1308
+ timeScale?: number;
1309
+ paused?: boolean;
1310
+ physics?: PhysicsMode;
1311
+ hitArea?: boolean;
1312
+ };
1313
+
979
1314
  type Tuple2 = [number, number];
980
1315
  type Tuple3 = [number, number, number];
981
1316
  type Tuple4 = [number, number, number, number];
@@ -1046,6 +1381,63 @@ type MoyuVideoAttributes = VideoProps & MoyuNodeAttributes & {
1046
1381
  onEnded?: () => void;
1047
1382
  onStateChange?: (state: string) => void;
1048
1383
  };
1384
+ type MoyuLive2dAttributes = Live2dProps & MoyuNodeAttributes & {
1385
+ /** The model finished loading; the payload holds its full metadata. */
1386
+ onReady?: (event: Extract<Live2dEvent, {
1387
+ type: 'ready';
1388
+ }>) => void;
1389
+ onMotionFinished?: (event: Extract<Live2dEvent, {
1390
+ type: 'motionFinished';
1391
+ }>) => void;
1392
+ onMotionEvent?: (event: Extract<Live2dEvent, {
1393
+ type: 'motionEvent';
1394
+ }>) => void;
1395
+ onBlendModeUnsupported?: (event: Extract<Live2dEvent, {
1396
+ type: 'blendModeUnsupported';
1397
+ }>) => void;
1398
+ /**
1399
+ * A press landed on a hit area, reported per area when several overlap.
1400
+ * Requires the `hitTest` prop.
1401
+ */
1402
+ onHit?: (event: Extract<Live2dEvent, {
1403
+ type: 'hit';
1404
+ }>) => void;
1405
+ onError?: (event: Extract<Live2dEvent, {
1406
+ type: 'error';
1407
+ }>) => void;
1408
+ };
1409
+ type MoyuSpineAttributes = SpineProps & MoyuNodeAttributes & {
1410
+ /** The model finished parsing; the payload holds its full metadata. */
1411
+ onReady?: (event: Extract<SpineEvent, {
1412
+ type: 'ready';
1413
+ }>) => void;
1414
+ onTrackStart?: (event: Extract<SpineEvent, {
1415
+ type: 'trackStart';
1416
+ }>) => void;
1417
+ onTrackComplete?: (event: Extract<SpineEvent, {
1418
+ type: 'trackComplete';
1419
+ }>) => void;
1420
+ onTrackEnd?: (event: Extract<SpineEvent, {
1421
+ type: 'trackEnd';
1422
+ }>) => void;
1423
+ /**
1424
+ * The terminal signal for a playback: it fires for completion,
1425
+ * interruption and cancellation alike, so waiting on it always returns.
1426
+ */
1427
+ onTrackDispose?: (event: Extract<SpineEvent, {
1428
+ type: 'trackDispose';
1429
+ }>) => void;
1430
+ onTrackEvent?: (event: Extract<SpineEvent, {
1431
+ type: 'trackEvent';
1432
+ }>) => void;
1433
+ /** A press landed inside a named bounding box; requires the `hitArea` prop. */
1434
+ onHit?: (event: Extract<SpineEvent, {
1435
+ type: 'hit';
1436
+ }>) => void;
1437
+ onError?: (event: Extract<SpineEvent, {
1438
+ type: 'error';
1439
+ }>) => void;
1440
+ };
1049
1441
  type MoyuSpriteAttributes = SpriteProps & MoyuNodeAttributes;
1050
1442
  type MoyuTextAttributes = TextProps & MoyuNodeAttributes & {
1051
1443
  onStart?: () => void;
@@ -1085,6 +1477,8 @@ declare namespace JSX {
1085
1477
  shader: DetailedMoyuProps<MoyuShaderAttributes>;
1086
1478
  'shader-slot': DetailedMoyuProps<MoyuShaderSlotAttributes>;
1087
1479
  video: DetailedMoyuProps<MoyuVideoAttributes>;
1480
+ live2d: DetailedMoyuProps<MoyuLive2dAttributes>;
1481
+ spine: DetailedMoyuProps<MoyuSpineAttributes>;
1088
1482
  }
1089
1483
  }
1090
1484
 
@@ -1101,8 +1495,8 @@ type MakeNullOptional<T> = T extends unknown ? {
1101
1495
  } : never;
1102
1496
  declare function mergeEvent<T extends BubbleEvent, K extends BubbleEvent>(handlers: MoyuEventHandler<T> | readonly MoyuEventHandler<T>[] | undefined, defaultHandler?: MoyuEventHandler<K>): (event: T | K) => void;
1103
1497
 
1104
- type _Command = AudioCommand | EditableCommand | TextCommand | GamepadCommand | ScenarioCommand | ShaderCommand | SteamCommand | SystemCommand | VideoCommand;
1498
+ type _Command = AudioCommand | EditableCommand | TextCommand | GamepadCommand | Live2dCommand | ScenarioCommand | ShaderCommand | SpineCommand | SteamCommand | SystemCommand | VideoCommand;
1105
1499
  type Command = MakeNullOptional<_Command>;
1106
1500
  type MaybePromise = any;
1107
1501
 
1108
- export { type ShaderParam as $, type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EditableState as E, type MoyuHBoxAttributes as F, type GamepadCommand as G, type MoyuListenerAttributes as H, type MoyuShaderAttributes as I, JSX as J, type KeyboardEvent as K, type LayoutEvent as L, type MoyuEvent as M, type MoyuShaderSlotAttributes as N, type MoyuVideoAttributes as O, Node as P, type OverlayDialog as Q, type OverlayNotificationPosition as R, type ShaderDirection as S, type TouchEvent as T, type OverlayStoreFlag as U, type PlatformInfo as V, type WheelEvent as W, type PointerEventKind as X, type RetainMode as Y, type ScenarioCommand as Z, type ShaderCommand as _, type MaybePromise as a, type ShaderParamType as a0, type ShaderSource as a1, type ShaderTimeControl as a2, type SteamCommand as a3, type SystemCommand as a4, type TextCommand as a5, type TextInteractionEvent as a6, type TextLayoutEvent as a7, type TimelinePossibleClip as a8, type TouchEventKind as a9, type Tuple2 as aa, type Tuple3 as ab, type Tuple4 as ac, type VideoCommand as ad, type WheelEventDeltaMode as ae, type WindowState as af, createBubbleEvent as ag, getPlatform as ah, getStageSize as ai, mergeEvent as aj, type MoyuClipAttributes as b, type MoyuVBoxAttributes as c, type MoyuSpriteAttributes as d, type TextProps as e, type MoyuNodeAttributes as f, type MouseEvent as g, type MoyuTextAttributes as h, type EditableChangeSource as i, type SpriteProps as j, type JsonValue as k, type AudioSettings as l, type EditableCommand as m, type EditableEvent as n, type EffectParams as o, type KeyboardEventKind as p, type MakeNullOptional as q, MouseButton as r, MouseButtons as s, type MouseEventKind as t, type MoyuAnimationAttributes as u, type MoyuBackdropAttributes as v, type MoyuContainerAttributes as w, type MoyuEditableAttributes as x, type MoyuEventHandler as y, type MoyuFilterAttributes as z };
1502
+ export { type OverlayStoreFlag as $, type AudioCommand as A, type BubbleEvent as B, type Command as C, type DetailedMoyuProps as D, type EditableState as E, type MoyuContainerAttributes as F, type GamepadCommand as G, type MoyuEditableAttributes as H, type MoyuEventHandler as I, JSX as J, type KeyboardEvent as K, type LayoutEvent as L, type MoyuEvent as M, type MoyuFilterAttributes as N, type MoyuHBoxAttributes as O, type MoyuListenerAttributes as P, type MoyuLive2dAttributes as Q, type MoyuShaderAttributes as R, type ShaderDirection as S, type TouchEvent as T, type MoyuShaderSlotAttributes as U, type MoyuSpineAttributes as V, type WheelEvent as W, type MoyuVideoAttributes as X, Node as Y, type OverlayDialog as Z, type OverlayNotificationPosition as _, type MaybePromise as a, type PlatformInfo as a0, type PointerEventKind as a1, type RetainMode as a2, type ScenarioCommand as a3, type ShaderCommand as a4, type ShaderParam as a5, type ShaderParamType as a6, type ShaderSource as a7, type ShaderTimeControl as a8, type SpineCommand as a9, type SpineEvent as aa, type SpineMetadata as ab, type SteamCommand as ac, type SystemCommand as ad, type TextCommand as ae, type TextInteractionEvent as af, type TextLayoutEvent as ag, type TimelinePossibleClip as ah, type TouchEventKind as ai, type Tuple2 as aj, type Tuple3 as ak, type Tuple4 as al, type VideoCommand as am, type WheelEventDeltaMode as an, type WindowState as ao, createBubbleEvent as ap, getPlatform as aq, getStageSize as ar, mergeEvent as as, type MoyuClipAttributes as b, type MoyuVBoxAttributes as c, type MoyuSpriteAttributes as d, type TextProps as e, type MoyuNodeAttributes as f, type MouseEvent as g, type MoyuTextAttributes as h, type EditableChangeSource as i, type SpriteProps as j, type JsonValue as k, type AudioSettings as l, type EditableCommand as m, type EditableEvent as n, type EffectParams as o, type EntryIdentity as p, type KeyboardEventKind as q, type Live2dCommand as r, type Live2dEvent as s, type Live2dMetadata as t, type MakeNullOptional as u, MouseButton as v, MouseButtons as w, type MouseEventKind as x, type MoyuAnimationAttributes as y, type MoyuBackdropAttributes as z };
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsxDEV } from 'react/jsx-dev-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-Dvhilv0K.mjs';
2
+ export { J as JSX } from './jsx-dev-runtime-CowyIagD.mjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsxDEV } from 'react/jsx-dev-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-Dvhilv0K.js';
2
+ export { J as JSX } from './jsx-dev-runtime-CowyIagD.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsx, jsxs } from 'react/jsx-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-Dvhilv0K.mjs';
2
+ export { J as JSX } from './jsx-dev-runtime-CowyIagD.mjs';
3
3
  import 'react/jsx-dev-runtime';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
1
  export { Fragment, jsx, jsxs } from 'react/jsx-runtime';
2
- export { J as JSX } from './jsx-dev-runtime-Dvhilv0K.js';
2
+ export { J as JSX } from './jsx-dev-runtime-CowyIagD.js';
3
3
  import 'react/jsx-dev-runtime';
4
4
  import 'react';
package/dist/lib.cjs CHANGED
@@ -2925,7 +2925,7 @@ async function startRuntimeDebugSession() {
2925
2925
  }
2926
2926
 
2927
2927
  // src/hooks/useFadeInOut.ts
2928
- function useFadeInOut(inTime, _keepTime, _outTime, pause = false, onFinished) {
2928
+ function useFadeInOut(inTime, keepTime, outTime, pause = false, onFinished) {
2929
2929
  const [style, api] = (0, spring_exports.useSpring)(
2930
2930
  () => ({
2931
2931
  from: { opacity: 0 },
@@ -2934,7 +2934,7 @@ function useFadeInOut(inTime, _keepTime, _outTime, pause = false, onFinished) {
2934
2934
  pause,
2935
2935
  onRest: (result) => {
2936
2936
  if (result.value.opacity === 1) {
2937
- void api.start({ reverse: true, delay: 1500, config: { duration: 1e3 } });
2937
+ void api.start({ reverse: true, delay: keepTime, config: { duration: outTime } });
2938
2938
  } else {
2939
2939
  onFinished?.();
2940
2940
  }
package/dist/lib.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement, Component, ForwardRefExoticComponent, CSSProperties, FC, ReactNode, ComponentType } from 'react';
3
- import { S as ShaderDirection, M as MoyuEvent, C as Command, a as MaybePromise, J as JSX, L as LayoutEvent, W as WheelEvent, T as TouchEvent, b as MoyuClipAttributes, c as MoyuVBoxAttributes, d as MoyuSpriteAttributes, e as TextProps, f as MoyuNodeAttributes, g as MouseEvent, h as MoyuTextAttributes, E as EditableState, i as EditableChangeSource, j as SpriteProps, k as JsonValue } from './jsx-dev-runtime-Dvhilv0K.mjs';
4
- export { A as AudioCommand, l as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, m as EditableCommand, n as EditableEvent, o as EffectParams, G as GamepadCommand, K as KeyboardEvent, p as KeyboardEventKind, q as MakeNullOptional, r as MouseButton, s as MouseButtons, t as MouseEventKind, u as MoyuAnimationAttributes, v as MoyuBackdropAttributes, w as MoyuContainerAttributes, x as MoyuEditableAttributes, y as MoyuEventHandler, z as MoyuFilterAttributes, F as MoyuHBoxAttributes, H as MoyuListenerAttributes, I as MoyuShaderAttributes, N as MoyuShaderSlotAttributes, O as MoyuVideoAttributes, P as Node, Q as OverlayDialog, R as OverlayNotificationPosition, U as OverlayStoreFlag, V as PlatformInfo, X as PointerEventKind, Y as RetainMode, Z as ScenarioCommand, _ as ShaderCommand, $ as ShaderParam, a0 as ShaderParamType, a1 as ShaderSource, a2 as ShaderTimeControl, a3 as SteamCommand, a4 as SystemCommand, a5 as TextCommand, a6 as TextInteractionEvent, a7 as TextLayoutEvent, a8 as TimelinePossibleClip, a9 as TouchEventKind, aa as Tuple2, ab as Tuple3, ac as Tuple4, ad as VideoCommand, ae as WheelEventDeltaMode, af as WindowState, ag as createBubbleEvent, ah as getPlatform, ai as getStageSize, aj as mergeEvent } from './jsx-dev-runtime-Dvhilv0K.mjs';
3
+ import { S as ShaderDirection, M as MoyuEvent, C as Command, a as MaybePromise, J as JSX, L as LayoutEvent, W as WheelEvent, T as TouchEvent, b as MoyuClipAttributes, c as MoyuVBoxAttributes, d as MoyuSpriteAttributes, e as TextProps, f as MoyuNodeAttributes, g as MouseEvent, h as MoyuTextAttributes, E as EditableState, i as EditableChangeSource, j as SpriteProps, k as JsonValue } from './jsx-dev-runtime-CowyIagD.mjs';
4
+ export { A as AudioCommand, l as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, m as EditableCommand, n as EditableEvent, o as EffectParams, p as EntryIdentity, G as GamepadCommand, K as KeyboardEvent, q as KeyboardEventKind, r as Live2dCommand, s as Live2dEvent, t as Live2dMetadata, u as MakeNullOptional, v as MouseButton, w as MouseButtons, x as MouseEventKind, y as MoyuAnimationAttributes, z as MoyuBackdropAttributes, F as MoyuContainerAttributes, H as MoyuEditableAttributes, I as MoyuEventHandler, N as MoyuFilterAttributes, O as MoyuHBoxAttributes, P as MoyuListenerAttributes, Q as MoyuLive2dAttributes, R as MoyuShaderAttributes, U as MoyuShaderSlotAttributes, V as MoyuSpineAttributes, X as MoyuVideoAttributes, Y as Node, Z as OverlayDialog, _ as OverlayNotificationPosition, $ as OverlayStoreFlag, a0 as PlatformInfo, a1 as PointerEventKind, a2 as RetainMode, a3 as ScenarioCommand, a4 as ShaderCommand, a5 as ShaderParam, a6 as ShaderParamType, a7 as ShaderSource, a8 as ShaderTimeControl, a9 as SpineCommand, aa as SpineEvent, ab as SpineMetadata, ac as SteamCommand, ad as SystemCommand, ae as TextCommand, af as TextInteractionEvent, ag as TextLayoutEvent, ah as TimelinePossibleClip, ai as TouchEventKind, aj as Tuple2, ak as Tuple3, al as Tuple4, am as VideoCommand, an as WheelEventDeltaMode, ao as WindowState, ap as createBubbleEvent, aq as getPlatform, ar as getStageSize, as as mergeEvent } from './jsx-dev-runtime-CowyIagD.mjs';
5
5
  import { FluidValue, addFluidObserver as addFluidObserver$1, removeFluidObserver as removeFluidObserver$1 } from '@react-spring/shared';
6
6
  import { ElementType, AssignableKeys, ComponentPropsWithRef } from '@react-spring/types';
7
7
  import { Snapshot } from 'valtio';
@@ -1020,7 +1020,7 @@ declare function useDebugSession(): {
1020
1020
  declare function stopRuntimeDebugSession(): Promise<void>;
1021
1021
  declare function startRuntimeDebugSession(): Promise<void>;
1022
1022
 
1023
- declare function useFadeInOut(inTime: number, _keepTime: number, _outTime: number, pause?: boolean, onFinished?: () => void): [SpringValues<{
1023
+ declare function useFadeInOut(inTime: number, keepTime: number, outTime: number, pause?: boolean, onFinished?: () => void): [SpringValues<{
1024
1024
  opacity: number;
1025
1025
  }>, SpringRef<{
1026
1026
  opacity: number;
package/dist/lib.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactElement, Component, ForwardRefExoticComponent, CSSProperties, FC, ReactNode, ComponentType } from 'react';
3
- import { S as ShaderDirection, M as MoyuEvent, C as Command, a as MaybePromise, J as JSX, L as LayoutEvent, W as WheelEvent, T as TouchEvent, b as MoyuClipAttributes, c as MoyuVBoxAttributes, d as MoyuSpriteAttributes, e as TextProps, f as MoyuNodeAttributes, g as MouseEvent, h as MoyuTextAttributes, E as EditableState, i as EditableChangeSource, j as SpriteProps, k as JsonValue } from './jsx-dev-runtime-Dvhilv0K.js';
4
- export { A as AudioCommand, l as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, m as EditableCommand, n as EditableEvent, o as EffectParams, G as GamepadCommand, K as KeyboardEvent, p as KeyboardEventKind, q as MakeNullOptional, r as MouseButton, s as MouseButtons, t as MouseEventKind, u as MoyuAnimationAttributes, v as MoyuBackdropAttributes, w as MoyuContainerAttributes, x as MoyuEditableAttributes, y as MoyuEventHandler, z as MoyuFilterAttributes, F as MoyuHBoxAttributes, H as MoyuListenerAttributes, I as MoyuShaderAttributes, N as MoyuShaderSlotAttributes, O as MoyuVideoAttributes, P as Node, Q as OverlayDialog, R as OverlayNotificationPosition, U as OverlayStoreFlag, V as PlatformInfo, X as PointerEventKind, Y as RetainMode, Z as ScenarioCommand, _ as ShaderCommand, $ as ShaderParam, a0 as ShaderParamType, a1 as ShaderSource, a2 as ShaderTimeControl, a3 as SteamCommand, a4 as SystemCommand, a5 as TextCommand, a6 as TextInteractionEvent, a7 as TextLayoutEvent, a8 as TimelinePossibleClip, a9 as TouchEventKind, aa as Tuple2, ab as Tuple3, ac as Tuple4, ad as VideoCommand, ae as WheelEventDeltaMode, af as WindowState, ag as createBubbleEvent, ah as getPlatform, ai as getStageSize, aj as mergeEvent } from './jsx-dev-runtime-Dvhilv0K.js';
3
+ import { S as ShaderDirection, M as MoyuEvent, C as Command, a as MaybePromise, J as JSX, L as LayoutEvent, W as WheelEvent, T as TouchEvent, b as MoyuClipAttributes, c as MoyuVBoxAttributes, d as MoyuSpriteAttributes, e as TextProps, f as MoyuNodeAttributes, g as MouseEvent, h as MoyuTextAttributes, E as EditableState, i as EditableChangeSource, j as SpriteProps, k as JsonValue } from './jsx-dev-runtime-CowyIagD.js';
4
+ export { A as AudioCommand, l as AudioSettings, B as BubbleEvent, D as DetailedMoyuProps, m as EditableCommand, n as EditableEvent, o as EffectParams, p as EntryIdentity, G as GamepadCommand, K as KeyboardEvent, q as KeyboardEventKind, r as Live2dCommand, s as Live2dEvent, t as Live2dMetadata, u as MakeNullOptional, v as MouseButton, w as MouseButtons, x as MouseEventKind, y as MoyuAnimationAttributes, z as MoyuBackdropAttributes, F as MoyuContainerAttributes, H as MoyuEditableAttributes, I as MoyuEventHandler, N as MoyuFilterAttributes, O as MoyuHBoxAttributes, P as MoyuListenerAttributes, Q as MoyuLive2dAttributes, R as MoyuShaderAttributes, U as MoyuShaderSlotAttributes, V as MoyuSpineAttributes, X as MoyuVideoAttributes, Y as Node, Z as OverlayDialog, _ as OverlayNotificationPosition, $ as OverlayStoreFlag, a0 as PlatformInfo, a1 as PointerEventKind, a2 as RetainMode, a3 as ScenarioCommand, a4 as ShaderCommand, a5 as ShaderParam, a6 as ShaderParamType, a7 as ShaderSource, a8 as ShaderTimeControl, a9 as SpineCommand, aa as SpineEvent, ab as SpineMetadata, ac as SteamCommand, ad as SystemCommand, ae as TextCommand, af as TextInteractionEvent, ag as TextLayoutEvent, ah as TimelinePossibleClip, ai as TouchEventKind, aj as Tuple2, ak as Tuple3, al as Tuple4, am as VideoCommand, an as WheelEventDeltaMode, ao as WindowState, ap as createBubbleEvent, aq as getPlatform, ar as getStageSize, as as mergeEvent } from './jsx-dev-runtime-CowyIagD.js';
5
5
  import { FluidValue, addFluidObserver as addFluidObserver$1, removeFluidObserver as removeFluidObserver$1 } from '@react-spring/shared';
6
6
  import { ElementType, AssignableKeys, ComponentPropsWithRef } from '@react-spring/types';
7
7
  import { Snapshot } from 'valtio';
@@ -1020,7 +1020,7 @@ declare function useDebugSession(): {
1020
1020
  declare function stopRuntimeDebugSession(): Promise<void>;
1021
1021
  declare function startRuntimeDebugSession(): Promise<void>;
1022
1022
 
1023
- declare function useFadeInOut(inTime: number, _keepTime: number, _outTime: number, pause?: boolean, onFinished?: () => void): [SpringValues<{
1023
+ declare function useFadeInOut(inTime: number, keepTime: number, outTime: number, pause?: boolean, onFinished?: () => void): [SpringValues<{
1024
1024
  opacity: number;
1025
1025
  }>, SpringRef<{
1026
1026
  opacity: number;
package/dist/lib.mjs CHANGED
@@ -2919,7 +2919,7 @@ async function startRuntimeDebugSession() {
2919
2919
  }
2920
2920
 
2921
2921
  // src/hooks/useFadeInOut.ts
2922
- function useFadeInOut(inTime, _keepTime, _outTime, pause = false, onFinished) {
2922
+ function useFadeInOut(inTime, keepTime, outTime, pause = false, onFinished) {
2923
2923
  const [style, api] = (0, spring_exports.useSpring)(
2924
2924
  () => ({
2925
2925
  from: { opacity: 0 },
@@ -2928,7 +2928,7 @@ function useFadeInOut(inTime, _keepTime, _outTime, pause = false, onFinished) {
2928
2928
  pause,
2929
2929
  onRest: (result) => {
2930
2930
  if (result.value.opacity === 1) {
2931
- void api.start({ reverse: true, delay: 1500, config: { duration: 1e3 } });
2931
+ void api.start({ reverse: true, delay: keepTime, config: { duration: outTime } });
2932
2932
  } else {
2933
2933
  onFinished?.();
2934
2934
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momoyu-ink/kit",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Software Development Kit of Moyu Visual Novel Engine",
5
5
  "main": "dist/lib.cjs",
6
6
  "module": "dist/lib.mjs",