@drincs/pixi-vn-json 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.d.cts CHANGED
@@ -1,532 +1,16 @@
1
- import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptionsWithChannel, MediaInterface, LabelRunModeType, StorageObjectType, StepLabelPropsType, ContainerChild } from '@drincs/pixi-vn';
2
- import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
3
- import { UPDATE_PRIORITY } from 'pixi.js';
1
+ import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, StepLabelPropsType, StorageElementType } from '@drincs/pixi-vn';
2
+ import { P as PixiVNJsonOperation, a as PixiVNJsonIfElse, b as PixiVNJsonOperationString, c as PixiVNJsonSound, d as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonImageEdit, f as PixiVNJsonCanvasRemove, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasTextShow, l as PixiVNJsonTextEdit, m as PixiVNJsonUnknownEdit, n as PixiVNJsonValueSet, o as PixiVNJsonOnlyStorageSet, p as PixiVNJsonNarration, q as PixiVNJsonCanvasEffect, r as PixiVNJsonCanvasAnimate, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonConditionalStatements, w as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-dVwPLFMT.cjs';
3
+ import '@drincs/pixi-vn/motion';
4
+ import 'pixi.js';
4
5
 
5
- type PixiVNJsonStepSwitchElementType<Then> = Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>;
6
- type PixiVNJsonStepSwitchElementsType<Then> = PixiVNJsonStepSwitchElementType<Then>[] | PixiVNJsonConditionalStatements<Then[]>;
7
- interface PixiVNJsonRandom<Then> {
8
- type: "stepswitch";
9
- choiceType: "random";
10
- elements: PixiVNJsonStepSwitchElementsType<Then>;
11
- }
12
- interface PixiVNJsonSequentialRandom<Then> {
13
- type: "stepswitch";
14
- choiceType: "sequentialrandom";
15
- elements: PixiVNJsonStepSwitchElementsType<Then>;
16
- /**
17
- * When the sequential ends, what should be the value? If undefined, it will return undefined.
18
- * If "lastItem", it will return the last item in the array.
19
- */
20
- end: undefined | "lastItem";
21
- /**
22
- * The subId is used for manager nested switches
23
- */
24
- nestedId?: string;
25
- }
26
- interface PixiVNJsonSequential<Then> {
27
- type: "stepswitch";
28
- choiceType: "sequential";
29
- elements: PixiVNJsonStepSwitchElementsType<Then>;
30
- /**
31
- * When the sequential ends, what should be the value? If undefined, it will return undefined.
32
- * If "lastItem", it will return the last item in the array.
33
- */
34
- end: undefined | "lastItem";
35
- /**
36
- * The subId is used for manager nested switches
37
- */
38
- nestedId?: string;
39
- }
40
- interface PixiVNJsonLoop<Then> {
41
- type: "stepswitch";
42
- choiceType: "loop";
43
- elements: PixiVNJsonStepSwitchElementsType<Then>;
44
- nestedId?: string;
45
- }
46
- type PixiVNJsonStepSwitch<Then> = PixiVNJsonRandom<Then> | PixiVNJsonSequential<Then> | PixiVNJsonLoop<Then> | PixiVNJsonSequentialRandom<Then>;
47
-
48
- /**
49
- * This element is used in case a {@link PixiVNJsonConditionalStatements} gives a result that must be combined with another calculated through other {@link PixiVNJsonConditionalStatements}.
50
- * in case this possibility is not managed, it will be taken into consideration {@link PixiVNJsonConditionalResultToCombine.firstItem}
51
- */
52
- type PixiVNJsonConditionalResultToCombine<T> = {
53
- type: "resulttocombine";
54
- /**
55
- * This variable is interpreted differently by Pixi'VN depending on the value
56
- */
57
- combine: "cross" | "union";
58
- firstItem?: T;
59
- secondConditionalItem?: PixiVNJsonStepSwitchElementType<T>[];
60
- };
61
-
62
- type PixiVNJsonConditionalStatements<Then> = PixiVNJsonStepSwitch<Then> | PixiVNJsonIfElse<Then | PixiVNJsonConditionalStatements<Then> | PixiVNJsonConditionalResultToCombine<Then>>;
63
-
64
- type PixiVNJsonStorageGet = {
65
- type: "value";
66
- storageOperationType: "get";
67
- /**
68
- * Key of the storage
69
- */
70
- key: string;
71
- /**
72
- * Type of the storage, if it is a flagStorage or a storage.
73
- * If it is a flagStorage, the value will be get with the function {@link getFlag}
74
- */
75
- storageType: "storage" | "flagStorage" | "tempstorage";
76
- };
77
- type PixiVNJsonParamGet = {
78
- type: "value";
79
- storageOperationType: "get";
80
- /**
81
- * Key of the storage
82
- */
83
- key: number;
84
- storageType: "params";
85
- };
86
- type PixiVNJsonLabelGet = {
87
- type: "value";
88
- storageOperationType: "get";
89
- /**
90
- * Id of the label
91
- */
92
- label: string;
93
- /**
94
- * If it is a label, the value will be get with the function {@link narration.getTimesLabelOpened}
95
- */
96
- storageType: "label";
97
- };
98
- type PixiVNJsonChoiceGet = {
99
- type: "value";
100
- storageOperationType: "get";
101
- /**
102
- * index of the choice
103
- */
104
- index: number;
105
- /**
106
- * If it is a choice, the value will be get with the function {@link narration.getTimesChoiceOpened}
107
- */
108
- storageType: "choice";
109
- };
110
- type PixiVNJsonLogicGet = {
111
- type: "value";
112
- storageOperationType: "get";
113
- operation: PixiVNJsonArithmeticOperations | PixiVNJsonConditions;
114
- storageType: "logic";
115
- };
116
- type PixiVNJsonValueGet = PixiVNJsonStorageGet | PixiVNJsonParamGet | PixiVNJsonLabelGet | PixiVNJsonChoiceGet | PixiVNJsonLogicGet;
117
- type PixiVNJsonOnlyStorageSet = {
118
- type: "value";
119
- storageOperationType: "set";
120
- /**
121
- * Key of the storage
122
- */
123
- key: string;
124
- /**
125
- * Value to be set in the storage
126
- */
127
- value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
128
- /**
129
- * Type of the storage, if it is a flagStorage or a storage.
130
- */
131
- storageType: "storage" | "tempstorage";
132
- };
133
- type PixiVNJsonOnlyParamSet = {
134
- type: "value";
135
- storageOperationType: "set";
136
- /**
137
- * Key of the storage
138
- */
139
- key: number;
140
- /**
141
- * Value to be set in the storage
142
- */
143
- value: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType>;
144
- storageType: "params";
145
- };
146
- type PixiVNJsonFlagSet = {
147
- type: "value";
148
- storageOperationType: "set";
149
- /**
150
- * Key of the storage
151
- */
152
- key: string;
153
- /**
154
- * Value to be set in the storage
155
- */
156
- value: boolean;
157
- /**
158
- * Type of the storage, if it is a flagStorage or a storage.
159
- */
160
- storageType: "flagStorage";
161
- };
162
- type PixiVNJsonValueSet = PixiVNJsonOnlyStorageSet | PixiVNJsonFlagSet | PixiVNJsonOnlyParamSet;
163
-
164
- interface PixiVNJsonArithmeticOperationsArithmetic {
165
- type: "arithmetic";
166
- /**
167
- * Left value of the arithmetic operation
168
- */
169
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
170
- /**
171
- * Right value of the arithmetic operation
172
- */
173
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
174
- /**
175
- * Operator of the arithmetic operation
176
- */
177
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
178
- }
179
- interface PixiVNJsonArithmeticOperationsArithmeticSingle {
180
- type: "arithmeticsingle";
181
- /**
182
- * Left value of the arithmetic operation
183
- */
184
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditionalStatements<StorageElementType | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations>;
185
- /**
186
- * Operator of the arithmetic operation
187
- */
188
- operator: "INT" | "FLOOR" | "FLOAT";
189
- }
190
- /**
191
- * Arithmetic operations for the PixiVNJson
192
- */
193
- type PixiVNJsonArithmeticOperations = PixiVNJsonArithmeticOperationsArithmeticSingle | PixiVNJsonArithmeticOperationsArithmetic;
194
-
195
- type PixiVNJsonUnionConditionAndOr = {
196
- type: "union";
197
- conditions: PixiVNJsonConditions[];
198
- unionType: "and" | "or";
199
- };
200
- type PixiVNJsonUnionConditionNot = {
201
- type: "union";
202
- condition: PixiVNJsonConditions;
203
- unionType: "not";
204
- };
205
- type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionConditionNot;
206
-
207
- /**
208
- * Comparation for PixiVNJson.
209
- * In this comparation, the values to be converted to string and compared.
210
- */
211
- type PixiVNJsonComparation = {
212
- type: "compare";
213
- /**
214
- * Left value of the comparation
215
- */
216
- leftValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
217
- /**
218
- * Right value of the comparation
219
- */
220
- rightValue: StorageElementType | PixiVNJsonValueGet | PixiVNJsonConditions;
221
- /**
222
- * Operator of the comparation
223
- */
224
- operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
225
- };
226
- type PixiVNJsonValueCondition = StorageElementType | PixiVNJsonValueGet;
227
- /**
228
- * Conditions for PixiVNJson
229
- */
230
- type PixiVNJsonConditions = PixiVNJsonComparation | PixiVNJsonValueCondition | PixiVNJsonUnionCondition | PixiVNJsonArithmeticOperations;
231
-
232
- /**
233
- * If-Else condition for PixiVNJson
234
- */
235
- interface PixiVNJsonIfElse<Then> {
236
- type: "ifelse";
237
- /**
238
- * The list of conditions to be checked.
239
- */
240
- condition: PixiVNJsonConditions;
241
- /**
242
- * The value to be returned if the condition is true.
243
- */
244
- then: Then | PixiVNJsonIfElse<Then>;
245
- /**
246
- * The value to be returned if the condition is false.
247
- */
248
- else?: Then | PixiVNJsonIfElse<Then>;
249
- }
250
-
251
- type PixiVNJsonAnimateBase<T extends CanvasBaseInterface<any>> = {
252
- type: "animate";
253
- alias: string | string[];
254
- keyframes: KeyframesType<T>;
255
- options?: AnimationOptions;
256
- priority?: UPDATE_PRIORITY;
257
- };
258
- type PixiVNJsonAnimateSequence<T extends CanvasBaseInterface<any>> = {
259
- type: "animate-sequence";
260
- alias: string;
261
- sequence: (ObjectSegment<T> | ObjectSegmentWithTransition<T>)[];
262
- options?: SequenceOptions;
263
- priority?: UPDATE_PRIORITY;
264
- };
265
- type PixiVNJsonCanvasAnimate<T extends CanvasBaseInterface<any> = ImageSprite> = PixiVNJsonAnimateBase<T> | PixiVNJsonAnimateSequence<T>;
266
-
267
- type PixiVNJsonEffectShake = {
268
- type: "shake";
269
- alias: string;
270
- props: ShakeEffectProps;
271
- priority?: UPDATE_PRIORITY;
272
- };
273
- type PixiVNJsonCanvasEffect = PixiVNJsonEffectShake;
274
-
275
- type DissolveTransition = {
276
- type: "dissolve";
277
- props?: ShowWithDissolveTransitionProps;
278
- priority?: UPDATE_PRIORITY;
279
- };
280
- type FadeTransition = {
281
- type: "fade";
282
- props?: ShowWithFadeTransitionProps;
283
- priority?: UPDATE_PRIORITY;
284
- };
285
- type MoveInOutTransition = {
286
- type: "movein" | "moveout";
287
- props?: MoveInOutProps;
288
- priority?: UPDATE_PRIORITY;
289
- };
290
- type ZoomInOutTransition = {
291
- type: "zoomin" | "zoomout";
292
- props?: ZoomInOutProps;
293
- priority?: UPDATE_PRIORITY;
294
- };
295
- type PushInOutTransition = {
296
- type: "pushin" | "pushout";
297
- props?: PushInOutProps;
298
- priority?: UPDATE_PRIORITY;
299
- };
300
- type PixiVNJsonMediaTransiotions = DissolveTransition | FadeTransition | MoveInOutTransition | ZoomInOutTransition | PushInOutTransition;
301
-
302
- type PixiVNJsonCanvasImageVideoShow = {
303
- type: "image" | "video";
304
- operationType: "show";
305
- alias: string;
306
- /**
307
- * The url of the image or video.
308
- * If the url is not provided, the url will be set to the alias.
309
- */
310
- url?: string;
311
- props?: ImageSpriteOptions;
312
- transition?: PixiVNJsonMediaTransiotions;
313
- };
314
- type PixiVNJsonCanvasImageContainerShow = {
315
- type: "imagecontainer";
316
- operationType: "show";
317
- alias: string;
318
- urls: string[];
319
- props?: ImageContainerOptions<ImageSprite>;
320
- transition?: PixiVNJsonMediaTransiotions;
321
- };
322
- type PixiVNJsonCanvasTextShow = {
323
- type: "text";
324
- operationType: "show";
325
- alias: string;
326
- text: string;
327
- props?: TextOptions;
328
- transition?: PixiVNJsonMediaTransiotions;
329
- };
330
- type PixiVNJsonImageEdit = {
331
- type: "image";
332
- operationType: "edit";
333
- alias: string;
334
- props?: Partial<ImageSpriteMemory>;
335
- };
336
- type PixiVNJsonVideoEdit = {
337
- type: "video";
338
- operationType: "edit";
339
- alias: string;
340
- props?: Partial<VideoSpriteMemory>;
341
- };
342
- type PixiVNJsonImageContainerEdit = {
343
- type: "imagecontainer";
344
- operationType: "edit";
345
- alias: string;
346
- props?: Partial<ImageContainerMemory>;
347
- };
348
- type PixiVNJsonTextEdit = {
349
- type: "text";
350
- operationType: "edit";
351
- alias: string;
352
- props?: Partial<TextMemory>;
353
- };
354
- type PixiVNJsonUnknownEdit<T extends ContainerOptions<any>> = {
355
- type: "canvaselement";
356
- operationType: "edit";
357
- alias: string;
358
- props?: Partial<T>;
359
- };
360
- type PixiVNJsonCanvasRemove = {
361
- type: "image" | "video" | "imagecontainer" | "canvaselement" | "text";
362
- operationType: "remove";
363
- alias: string;
364
- transition?: PixiVNJsonMediaTransiotions;
365
- };
366
- type PixiVNJsonVideoPauseResume = {
367
- type: "video";
368
- operationType: "pause" | "resume";
369
- alias: string;
370
- };
371
- type PixiVNJsonAssetsLoad = {
372
- type: "assets" | "bundle";
373
- operationType: "load" | "lazyload";
374
- aliases: string[];
375
- };
376
- type PixiVNJsonCanvasShow = PixiVNJsonCanvasImageContainerShow | PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasTextShow;
377
- type PixiVNJsonCanvasEdit = PixiVNJsonImageEdit | PixiVNJsonVideoEdit | PixiVNJsonImageContainerEdit | PixiVNJsonTextEdit | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory | TextMemory>;
378
- type PixiVNJsonCanvas = PixiVNJsonCanvasShow | PixiVNJsonCanvasEdit | PixiVNJsonCanvasRemove | PixiVNJsonVideoPauseResume | PixiVNJsonAssetsLoad | PixiVNJsonCanvasAnimate | PixiVNJsonCanvasEffect;
379
-
380
- type PixiVNJsonInputRequest = {
381
- type: "input";
382
- operationType: "request";
383
- valueType?: string;
384
- defaultValue?: any;
385
- };
386
- type PixiVNJsonDialogue = {
387
- type: "dialogue";
388
- operationType: "clean";
389
- };
390
- type PixiVNJsonNarration = PixiVNJsonDialogue | PixiVNJsonInputRequest;
391
-
392
- type PixiVNJsonSoundPlay = {
393
- type: "sound";
394
- operationType: "play";
395
- alias: string;
396
- url?: string;
397
- props?: SoundPlayOptionsWithChannel;
398
- };
399
- type PixiVNJsonSoundRemove = {
400
- type: "sound";
401
- operationType: "stop";
402
- alias: string;
403
- };
404
- type PixiVNJsonSoundPauseResume = {
405
- type: "sound" | "channel";
406
- operationType: "pause" | "resume";
407
- alias: string;
408
- } | {
409
- type: "all";
410
- operationType: "pause" | "resume" | "stop";
411
- };
412
- type PixiVNJsonSoundEdit = {
413
- type: "sound";
414
- operationType: "edit";
415
- alias: string;
416
- props: Partial<Pick<MediaInterface, "speed" | "volume" | "muted" | "loop" | "paused">>;
417
- };
418
- type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundEdit;
419
-
420
- type PixiVNJsonOperationString = {
421
- type: "operationtoconvert";
422
- values: (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet>)[];
423
- };
424
- type PixiVNJsonOperation = PixiVNJsonValueSet | PixiVNJsonCanvas | PixiVNJsonSound | PixiVNJsonNarration;
425
- type PixiVNJsonConditionalOperation = PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString;
426
-
427
- type PixiVNJsonChoice = {
428
- /**
429
- * The text to be displayed.
430
- */
431
- text: PixiVNJsonDialogText;
432
- /**
433
- * The label id to be opened.
434
- */
435
- label: string;
436
- /**
437
- * Label opening mode
438
- */
439
- type: LabelRunModeType;
440
- /**
441
- * The properties to be passed to the label.
442
- */
443
- props: StorageObjectType;
444
- /**
445
- * If this is true, the choice can only be made once.
446
- */
447
- oneTime?: boolean;
448
- /**
449
- * If this is true, the choice can see only if there are no other choices. For example, all choices are one-time choices and they are already selected.
450
- */
451
- onlyHaveNoChoice?: boolean;
452
- /**
453
- * If this is true and if is the only choice, it will be automatically selected, and call/jump to the label.
454
- */
455
- autoSelect?: boolean;
456
- };
457
- type PixiVNJsonChoices = (PixiVNJsonChoice | PixiVNJsonConditionalStatements<PixiVNJsonChoice>)[];
458
- type PixiVNJsonDialogText = string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]> | (string | PixiVNJsonValueGet | PixiVNJsonConditionalStatements<string | PixiVNJsonValueGet | string[]>)[];
459
- type PixiVNJsonDialog<Text = string> = {
460
- /**
461
- * The character id that will speak.
462
- */
463
- character: string;
464
- /**
465
- * The text to be displayed.
466
- */
467
- text: Text;
468
- } | Text;
469
- type PixiVNJsonLabelToOpen<T extends {} = {}> = {
470
- /**
471
- * The id of the label to open.
472
- */
473
- label: string | PixiVNJsonValueGet;
474
- /**
475
- * Label opening mode
476
- */
477
- type: LabelRunModeType;
478
- /**
479
- * The properties to be passed to the label. if you don't want to pass a object, but a list of parameters, you can use the {@link PixiVNJsonLabelToOpen.params} attribute.
480
- */
481
- props?: StepLabelPropsType<T>;
482
- /**
483
- * **It is not recommended to use it, use it only if necessary**. The parameters to be passed to the label. If you want to pass an object, use the {@link PixiVNJsonLabelToOpen.props} attribute.
484
- * "params" attribute will be stored in the temp storage with the key: {@link PIXIVNJSON_PARAM_ID} + ({@link narration.openedLabels.length} - 1).
485
- */
486
- params?: any[];
487
- };
488
- /**
489
- * Steps of a label.
490
- * Order of operations:
491
- * 1. run all {@link PixiVNJsonLabelStep.operations}
492
- * 2. set {@link PixiVNJsonLabelStep.choices}, {@link PixiVNJsonLabelStep.dialogue}, {@link PixiVNJsonLabelStep.glueEnabled}
493
- * 3. open {@link PixiVNJsonLabelStep.labelToOpen}
494
- * 4. go to next step if {@link PixiVNJsonLabelStep.goNextStep} is true
495
- * 5. end the label if {@link PixiVNJsonLabelStep.end} is "label_end"
496
- */
497
- type PixiVNJsonLabelStep = {
498
- operations?: PixiVNJsonConditionalOperation[];
499
- /**
500
- * Variable used to display a choice menu.
501
- */
502
- choices?: PixiVNJsonChoices | PixiVNJsonConditionalStatements<PixiVNJsonChoices>;
503
- /**
504
- * Variable used to display a dialog.
505
- */
506
- dialogue?: PixiVNJsonDialog<PixiVNJsonDialogText> | PixiVNJsonConditionalStatements<PixiVNJsonDialog<PixiVNJsonDialogText>>;
507
- /**
508
- * This variable is used to add the next dialog text into the current dialog memory.
509
- * This value was added to introduce Ink Glue functionality https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#glue
510
- */
511
- glueEnabled?: boolean | PixiVNJsonConditionalStatements<boolean>;
512
- /**
513
- * Variable used to open a label.
514
- */
515
- labelToOpen?: PixiVNJsonLabelToOpen | PixiVNJsonConditionalStatements<PixiVNJsonLabelToOpen> | (PixiVNJsonLabelToOpen | PixiVNJsonConditionalStatements<PixiVNJsonLabelToOpen>)[];
516
- /**
517
- * If is true, the next step will be executed automatically.
518
- */
519
- goNextStep?: boolean | PixiVNJsonConditionalStatements<boolean>;
6
+ declare class JsonUnifier {
520
7
  /**
521
- * Variable used to end some elements of the narrative.
522
- * - game_end: ends the game
523
- * - label_end: ends the label
8
+ * Registers the operation handlers that pixi-vn-json will delegate to at runtime.
9
+ * Call this once at application startup (e.g. via {@link init}) before importing any labels.
10
+ *
11
+ * All parameters are optional except `setInitialStorageValue`, which is required because
12
+ * it must be available for initial-operation processing during label import.
524
13
  */
525
- end?: "game_end" | "label_end" | PixiVNJsonConditionalStatements<"game_end" | "label_end">;
526
- conditionalStep?: PixiVNJsonConditionalStatements<PixiVNJsonLabelStep | PixiVNJsonLabelStep[]>;
527
- };
528
-
529
- declare class JsonUnifier {
530
14
  static init(options: {
531
15
  loadAssets?: (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
532
16
  soundOperation?: (operation: PixiVNJsonSound) => void;
@@ -535,42 +19,55 @@ declare class JsonUnifier {
535
19
  imageContainerOperation?: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
536
20
  textOperation?: (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
537
21
  canvasElementOperation?: (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
538
- setStorageValue?: (value: PixiVNJsonValueSet) => void;
539
- setInitialStorageValue: (value: PixiVNJsonOnlyStorageSet) => void;
22
+ setStorageValue?: (value: PixiVNJsonValueSet, props?: StepLabelPropsType) => void;
23
+ setInitialStorageValue: (value: PixiVNJsonOnlyStorageSet, props?: StepLabelPropsType) => void;
540
24
  narrationOperation?: (operation: PixiVNJsonNarration) => void;
541
25
  effectOperation?: (operation: PixiVNJsonCanvasEffect) => Promise<void>;
542
26
  animateOperation?: (operation: PixiVNJsonCanvasAnimate) => void;
543
- getLogichValue?: <T = StorageElementType>(value: T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions | PixiVNJsonConditionalStatements<T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions>) => T | undefined;
544
- getConditionalStep?: (originalStep: PixiVNJsonLabelStep) => PixiVNJsonLabelStep;
27
+ getLogichValue?: <T = StorageElementType>(value: T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions | PixiVNJsonConditionalStatements<T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions>, props?: StepLabelPropsType) => T | undefined;
28
+ getConditionalStep?: (originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType) => PixiVNJsonLabelStep;
545
29
  }): void;
546
30
  private static _loadAssets;
31
+ /** Registered handler for loading/lazy-loading assets. */
547
32
  static get loadAssets(): (origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString) => Promise<void> | void;
548
33
  private static _soundOperation;
34
+ /** Registered handler for sound play/stop/pause/resume/edit operations. */
549
35
  static get soundOperation(): (operation: PixiVNJsonSound) => void;
550
36
  private static _imageOperation;
37
+ /** Registered handler for {@link ImageSprite} show/edit/remove operations. */
551
38
  static get imageOperation(): (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonImageEdit | PixiVNJsonCanvasRemove) => Promise<void>;
552
39
  private static _videoOperation;
40
+ /** Registered handler for {@link VideoSprite} show/edit/remove/pause/resume operations. */
553
41
  static get videoOperation(): (operation: PixiVNJsonCanvasImageVideoShow | PixiVNJsonCanvasRemove | PixiVNJsonVideoEdit | PixiVNJsonVideoPauseResume) => Promise<void>;
554
42
  private static _imageContainerOperation;
555
- static get textOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
556
- private static _textOperation;
557
43
  static get imageContainerOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasImageContainerShow | PixiVNJsonImageContainerEdit) => Promise<void>;
44
+ private static _textOperation;
45
+ /** Registered handler for {@link Text} show/edit/remove operations. */
46
+ static get textOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonCanvasTextShow | PixiVNJsonTextEdit) => Promise<void>;
558
47
  private static _canvasElementOperation;
48
+ /** Registered handler for generic canvas-element edit/remove operations. */
559
49
  static get canvasElementOperation(): (operation: PixiVNJsonCanvasRemove | PixiVNJsonUnknownEdit<ImageSpriteMemory | VideoSpriteMemory | ContainerMemory<ContainerChild>>) => Promise<void>;
560
50
  private static _setStorageValue;
561
- static get setStorageValue(): (value: PixiVNJsonValueSet) => void;
51
+ /** Registered handler for setting a storage value during label execution. */
52
+ static get setStorageValue(): (value: PixiVNJsonValueSet, props?: StepLabelPropsType) => void;
562
53
  private static _setInitialStorageValue;
563
- static get setInitialStorageValue(): (value: PixiVNJsonOnlyStorageSet) => void;
54
+ /** Registered handler for setting a default (initial) storage value at import time. */
55
+ static get setInitialStorageValue(): (value: PixiVNJsonOnlyStorageSet, props?: StepLabelPropsType) => void;
564
56
  private static _narrationOperation;
57
+ /** Registered handler for narration operations (input requests, dialogue resets). */
565
58
  static get narrationOperation(): (operation: PixiVNJsonNarration) => void;
566
59
  private static _effectOperation;
60
+ /** Registered handler for canvas visual effects (e.g. shake). */
567
61
  static get effectOperation(): (operation: PixiVNJsonCanvasEffect) => Promise<void>;
568
62
  private static _animateOperation;
63
+ /** Registered handler for keyframe animation operations. */
569
64
  static get animateOperation(): (operation: PixiVNJsonCanvasAnimate) => void;
570
65
  private static _getLogichValue;
571
- static get getLogichValue(): <T = StorageElementType>(value: T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions | PixiVNJsonConditionalStatements<T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions>) => T | undefined;
66
+ /** Registered handler that evaluates a JSON logic expression to a plain value. */
67
+ static get getLogichValue(): <T = StorageElementType>(value: T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions | PixiVNJsonConditionalStatements<T | PixiVNJsonValueGet | PixiVNJsonArithmeticOperations | PixiVNJsonConditions>, props?: StepLabelPropsType) => T | undefined;
572
68
  private static _getConditionalStep;
573
- static get getConditionalStep(): (originalStep: PixiVNJsonLabelStep) => PixiVNJsonLabelStep;
69
+ /** Registered handler that resolves a label step's `conditionalStep` field. */
70
+ static get getConditionalStep(): (originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType) => PixiVNJsonLabelStep;
574
71
  }
575
72
 
576
73
  export { JsonUnifier };