@drincs/pixi-vn 1.5.19 → 1.6.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.
Files changed (68) hide show
  1. package/dist/{HistoryChoiceMenuOption-BOHqf57l.d.ts → HistoryChoiceMenuOption-BQc_jAe-.d.ts} +2 -7
  2. package/dist/{HistoryChoiceMenuOption-PzBGGqOC.d.cts → HistoryChoiceMenuOption-ok3Zd5pB.d.cts} +2 -7
  3. package/dist/{StoredClassModel-BgRY86sq.d.ts → StoredClassModel-CUrGRJi0.d.cts} +5 -2
  4. package/dist/{StoredClassModel-BgRY86sq.d.cts → StoredClassModel-D-s0mEVj.d.ts} +5 -2
  5. package/dist/canvas.cjs +2 -3
  6. package/dist/canvas.d.cts +32 -38
  7. package/dist/canvas.d.ts +32 -38
  8. package/dist/canvas.mjs +2 -3
  9. package/dist/characters.cjs +1 -2
  10. package/dist/characters.d.cts +3 -2
  11. package/dist/characters.d.ts +3 -2
  12. package/dist/characters.mjs +1 -2
  13. package/dist/chunk-D45QSSXG.mjs +1 -0
  14. package/dist/chunk-HACUDOYJ.mjs +1 -0
  15. package/dist/chunk-IWAXXFXE.mjs +1 -0
  16. package/dist/chunk-L4IHQ3VT.mjs +1 -0
  17. package/dist/{chunk-JJFD2BVW.mjs → chunk-TTRUPDAB.mjs} +1 -2
  18. package/dist/chunk-XSN6P5JL.mjs +0 -0
  19. package/dist/chunk-ZW3MIPMS.mjs +1 -0
  20. package/dist/core.cjs +1 -1
  21. package/dist/core.d.cts +43 -16
  22. package/dist/core.d.ts +43 -16
  23. package/dist/core.mjs +1 -1
  24. package/dist/history.cjs +1 -2
  25. package/dist/history.d.cts +3 -4
  26. package/dist/history.d.ts +3 -4
  27. package/dist/history.mjs +1 -2
  28. package/dist/index.cjs +2 -3
  29. package/dist/index.d.cts +294 -122
  30. package/dist/index.d.ts +294 -122
  31. package/dist/index.mjs +2 -3
  32. package/dist/motion.cjs +1 -2
  33. package/dist/motion.d.cts +18 -0
  34. package/dist/motion.d.ts +18 -0
  35. package/dist/motion.mjs +1 -2
  36. package/dist/narration.cjs +2 -3
  37. package/dist/narration.d.cts +9 -20
  38. package/dist/narration.d.ts +9 -20
  39. package/dist/narration.mjs +2 -3
  40. package/dist/pixi/browser.js +35 -35
  41. package/dist/sound.cjs +1 -2
  42. package/dist/sound.d.cts +193 -72
  43. package/dist/sound.d.ts +193 -72
  44. package/dist/sound.mjs +1 -2
  45. package/dist/storage.cjs +1 -2
  46. package/dist/storage.d.cts +20 -71
  47. package/dist/storage.d.ts +20 -71
  48. package/dist/storage.mjs +1 -2
  49. package/dist/vite-listener.cjs +1 -2
  50. package/dist/vite-listener.mjs +1 -2
  51. package/dist/vite.cjs +1 -2
  52. package/dist/vite.mjs +1 -2
  53. package/package.json +10 -12
  54. package/dist/chunk-46QBDRUK.mjs +0 -2
  55. package/dist/chunk-52EK6LYW.mjs +0 -2
  56. package/dist/chunk-INJYRMJ3.mjs +0 -2
  57. package/dist/chunk-JJFD2BVW.mjs.map +0 -1
  58. package/dist/chunk-OXRIVLY2.mjs +0 -2
  59. package/dist/chunk-SOFV7YZ5.mjs +0 -2
  60. package/dist/chunk-XZMYXKAY.mjs +0 -2
  61. package/dist/index.cjs.map +0 -1
  62. package/dist/index.mjs.map +0 -1
  63. package/dist/motion.cjs.map +0 -1
  64. package/dist/motion.mjs.map +0 -1
  65. package/dist/vite-listener.cjs.map +0 -1
  66. package/dist/vite-listener.mjs.map +0 -1
  67. package/dist/vite.cjs.map +0 -1
  68. package/dist/vite.mjs.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { PlayOptions, Options, Sound as Sound$1, IMediaInstance, SoundLibrary, IMediaContext, Filter, SoundMap } from '@pixi/sound';
1
+ import { IMediaInstance as IMediaInstance$1, PlayOptions, Options, SoundLibrary, Sound } from '@pixi/sound';
2
2
  import * as canvasUtils from '@drincs/pixi-vn/canvas';
3
3
  import { StoredChoiceInterface, StorageElementType as StorageElementType$1, OpenedLabel as OpenedLabel$1 } from '@drincs/pixi-vn/canvas';
4
4
  export * from '@drincs/pixi-vn/canvas';
5
5
  import * as characterUtils from '@drincs/pixi-vn/characters';
6
6
  export * from '@drincs/pixi-vn/characters';
7
- import { GameUnifier } from '@drincs/pixi-vn/core';
7
+ import { OnErrorHandler, GameUnifier } from '@drincs/pixi-vn/core';
8
8
  export * from '@drincs/pixi-vn/core';
9
9
  import * as historyUtils from '@drincs/pixi-vn/history';
10
10
  export * from '@drincs/pixi-vn/history';
@@ -19,26 +19,95 @@ import * as storageUtils from '@drincs/pixi-vn/storage';
19
19
  export * from '@drincs/pixi-vn/storage';
20
20
  import { LRUCache } from 'lru-cache';
21
21
  import { CharacterInterface, GameStepState } from '@drincs/pixi-vn';
22
- import deepDiff from 'deep-diff';
23
22
  import { Difference } from 'microdiff';
24
23
  import { Devtools } from '@pixi/devtools';
25
24
 
25
+ type IMediaInstance = Omit<IMediaInstance$1, "on" | "destroy" | "init" | "off" | "once" | "toString">;
26
+
26
27
  interface SoundOptions extends Omit<Options, "complete" | "loaded" | "sprites" | "source"> {
27
28
  }
28
29
  interface SoundPlayOptions extends Omit<PlayOptions, "complete" | "loaded"> {
30
+ /**
31
+ * The delay in seconds before playback becomes audible or resumes. If specified, the sound will be started immediately but delayed (for example, via pause/unpause) so that it is effectively heard only after the delay. If not specified, the sound will play without any additional delay.
32
+ */
33
+ delay?: number;
34
+ }
35
+ interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
36
+ /**
37
+ * The alias of the audio channel to play the sound on. If the channel does not exist, it will be created.
38
+ * If not specified, the sound will be played on the default channel (see `SoundManagerInterface.defaultChannelAlias`).
39
+ */
40
+ channel?: string;
41
+ }
42
+ interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"> {
43
+ /**
44
+ * Whether this channel is a background channel.
45
+ * Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
46
+ */
47
+ background?: boolean;
29
48
  }
30
49
 
31
- declare class Sound extends Sound$1 {
32
- alias?: string;
33
- pause(): this;
34
- resume(): this;
35
- destroy(): void;
36
- stop(): this;
37
- play(options?: string | SoundPlayOptions): IMediaInstance | Promise<IMediaInstance>;
50
+ interface AudioChannelInterface {
51
+ /**
52
+ * The alias of the audio channel. This is used to reference the channel when playing sounds. The alias must be unique among all channels.
53
+ */
54
+ readonly alias: string;
55
+ /**
56
+ * Plays a sound.
57
+ * @param alias The media and sound (asset) alias reference.
58
+ * @param options The options
59
+ * @return The sound instance,
60
+ * this cannot be reused after it is done playing. Returns a Promise if the sound
61
+ * has not yet loaded.
62
+ */
63
+ play(alias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
64
+ /**
65
+ * Plays a sound.
66
+ * @param mediaAlias The media alias reference.
67
+ * @param soundAlias The sound (asset) alias reference.
68
+ * @param options The options
69
+ * @return The sound instance,
70
+ * this cannot be reused after it is done playing. Returns a Promise if the sound
71
+ * has not yet loaded.
72
+ */
73
+ play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
74
+ /**
75
+ * The volume of the audio channel, between 0 and 1. This is multiplied with the volume of each sound played through this channel.
76
+ */
77
+ volume: number;
78
+ /**
79
+ * Whether the audio channel is muted. This is combined with the muted state of each sound played through this channel.
80
+ */
81
+ muted: boolean;
38
82
  /**
39
- * https://github.com/pixijs/sound/blob/main/src/Sound.ts#L235
83
+ * The MediaInstances currently playing through this channel. This is read-only and cannot be modified directly. Use the play method to add new MediaInstances to this channel.
40
84
  */
41
- static from(source: string | string[] | SoundOptions | ArrayBuffer | HTMLAudioElement | AudioBuffer): Sound;
85
+ readonly mediaInstances: IMediaInstance[];
86
+ /**
87
+ * Whether this channel is a background channel.
88
+ * Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
89
+ */
90
+ readonly background: boolean;
91
+ /**
92
+ * Stops all media currently playing through this channel.
93
+ * @return Instance for chaining.
94
+ */
95
+ stopAll(): this;
96
+ /**
97
+ * Pauses any playing sounds.
98
+ * @return Instance for chaining.
99
+ */
100
+ pauseAll(): this;
101
+ /**
102
+ * Resumes any sounds.
103
+ * @return Instance for chaining.
104
+ */
105
+ resumeAll(): this;
106
+ /**
107
+ * Toggle muted property for all sounds.
108
+ * @return `true` if all sounds are muted.
109
+ */
110
+ toggleMuteAll(): boolean;
42
111
  }
43
112
 
44
113
  type DistortionFilter = {
@@ -95,76 +164,121 @@ interface ExportedSoundPlay extends SoundPlay {
95
164
  * Interface exported sounds
96
165
  */
97
166
  interface SoundGameState {
98
- soundAliasesOrder: string[];
99
167
  filters?: SoundFilterMemory[];
100
- soundsPlaying: {
101
- [key: string]: ExportedSoundPlay;
102
- };
103
168
  /**
104
169
  * @deprecated
105
170
  */
106
- playInStepIndex?: {
107
- [key: string]: SoundPlay;
171
+ soundsPlaying?: {
172
+ [key: string]: ExportedSoundPlay;
108
173
  };
109
- /**
110
- * @deprecated
111
- */
112
- sounds?: ExportedSoundOld;
113
- }
114
- interface ExportedSoundOld {
115
- [key: string]: {
116
- options: SoundOptions;
117
- filters?: SoundFilterMemory[];
174
+ mediaInstances: {
175
+ [key: string]: {
176
+ channelAlias: string;
177
+ soundAlias: string;
178
+ stepCounter: number;
179
+ options: Omit<SoundPlayOptions, "filters"> & {
180
+ filters?: SoundFilterMemory[];
181
+ };
182
+ paused: boolean;
183
+ };
118
184
  };
119
185
  }
120
186
 
121
- declare class SoundManager extends SoundLibrary {
122
- constructor();
123
- get context(): IMediaContext;
124
- get filtersAll(): Filter[];
125
- set filtersAll(filtersAll: Filter[]);
126
- get supported(): boolean;
127
- /**
128
- * https://github.com/pixijs/sound/blob/main/src/SoundLibrary.ts#L187
129
- */
130
- private getOptions;
131
- add(alias: string, options: SoundOptions | string): Sound;
132
- /**
133
- * @deprecated: Use `add(alias: string, options: Options | string | ArrayBuffer | AudioBuffer | HTMLAudioElement | Sound): Sound;` instead.
134
- */
135
- add(map: any, globalOptions?: SoundOptions): SoundMap;
136
- get useLegacy(): boolean;
137
- set useLegacy(legacy: boolean);
138
- get disableAutoPause(): boolean;
139
- set disableAutoPause(autoPause: boolean);
140
- remove(alias: string): this;
141
- get volumeAll(): number;
142
- set volumeAll(volume: number);
143
- get speedAll(): number;
144
- set speedAll(speed: number);
145
- togglePauseAll(): boolean;
187
+ interface SoundManagerInterface extends Omit<SoundLibrary, "init" | "close" | "add" | "play" | "volume" | "speed" | "remove" | "exists" | "find" | "stop" | "pause" | "resume" | "pauseAll" | "resumeAll" | "muteAll" | "unmuteAll" | "stopAll" | "removeAll" | "togglePauseAll"> {
188
+ /**
189
+ * @deprecated You can define sound assets directly in `PIXI.Assets`
190
+ */
191
+ add(alias: string, options: string): Sound;
192
+ /**
193
+ * Plays a sound.
194
+ * @param alias The media and sound (asset) alias reference.
195
+ * @param options The options
196
+ * @return The sound instance,
197
+ * this cannot be reused after it is done playing. Returns a Promise if the sound
198
+ * has not yet loaded.
199
+ */
200
+ play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
201
+ play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
202
+ /**
203
+ * Find a media by alias.
204
+ * @param alias - The media alias reference.
205
+ * @return Media object.
206
+ */
207
+ find(alias: string): IMediaInstance | undefined;
208
+ /**
209
+ * Stops a media and removes it from the manager.
210
+ * @param alias - The media alias reference.
211
+ */
212
+ stop(alias: string): void;
213
+ /**
214
+ * Pauses a media.
215
+ * @param alias - The media alias reference.
216
+ * @return Media object.
217
+ */
218
+ pause(alias: string): IMediaInstance | undefined;
219
+ /**
220
+ * Resumes a media.
221
+ * @param alias - The media alias reference.
222
+ * @return Media object.
223
+ */
224
+ resume(alias: string): IMediaInstance | undefined;
225
+ /**
226
+ * Edits the options of an existing sound (asset).
227
+ * If the asset is not yet loaded, it will be loaded with the new options.
228
+ */
229
+ edit(alias: string, options: SoundOptions): Promise<void>;
230
+ /**
231
+ * Pauses any playing sounds.
232
+ * @return Instance for chaining.
233
+ */
146
234
  pauseAll(): this;
235
+ /**
236
+ * Resumes any sounds.
237
+ * @return Instance for chaining.
238
+ */
147
239
  resumeAll(): this;
148
- toggleMuteAll(): boolean;
240
+ /**
241
+ * Mutes all playing sounds.
242
+ * @return Instance for chaining.
243
+ */
149
244
  muteAll(): this;
245
+ /**
246
+ * Unmutes all playing sounds.
247
+ * @return Instance for chaining.
248
+ */
150
249
  unmuteAll(): this;
151
- removeAll(): this;
250
+ /**
251
+ * Stops all sounds.
252
+ * @return Instance for chaining.
253
+ */
152
254
  stopAll(): this;
153
- exists(alias: string, assert?: boolean): boolean;
154
- isPlaying(): boolean;
155
- find(alias: string): Sound;
156
- play(alias: string, options?: SoundPlayOptions | string): IMediaInstance | Promise<IMediaInstance>;
157
- stop(alias: string): Sound;
158
- pause(alias: string): Sound;
159
- resume(alias: string): Sound;
160
- volume(alias: string, volume?: number): number;
161
- speed(alias: string, speed?: number): number;
162
- duration(alias: string): number;
163
- close(): this;
255
+ load(alias: string | string[]): Promise<void>;
256
+ backgroundLoad(alias: string | string[]): Promise<void>;
257
+ backgroundLoadBundle(alias: string): Promise<void>;
164
258
  clear(): void;
259
+ /**
260
+ * Adds a new audio channel with the specified alias(es).
261
+ * @param alias The alias or aliases for the new channel.
262
+ * @returns The created AudioChannelInterface instance, or undefined if a channel with the alias already exists.
263
+ */
264
+ addChannel(alias: string | string[], options?: ChannelOptions): AudioChannelInterface | undefined;
265
+ /**
266
+ * Finds and returns the audio channel associated with the given alias. If the channel does not exist, it will be created.
267
+ * @param alias The alias of the audio channel to find.
268
+ * @returns The AudioChannelInterface instance associated with the alias.
269
+ */
270
+ findChannel(alias: string): AudioChannelInterface;
271
+ /**
272
+ * Returns an array of all existing audio channels.
273
+ */
274
+ readonly channels: AudioChannelInterface[];
275
+ /**
276
+ * The default channel alias to use when playing a sound without specifying a channel.
277
+ * By default, this is set to `GENERAL_CHANNEL` ("general"), but it can be changed to any string; if the channel does not yet exist, it will be created on demand when used.
278
+ */
279
+ defaultChannelAlias: string;
165
280
  export(): SoundGameState;
166
- removeOldSoundAndExport(): SoundGameState;
167
- restore(data: object): void;
281
+ restore(data: object): Promise<void>;
168
282
  }
169
283
 
170
284
  declare class CachedMap<K extends {}, V extends {}> implements Map<K, V> {
@@ -277,10 +391,12 @@ declare class CanvasBaseItem<T2 extends CanvasBaseItemMemory> {
277
391
  constructor(..._options: any);
278
392
  /**
279
393
  * This method return the memory of the canvas element.
394
+ * @throws {PixiError} when the method is not overridden in the subclass.
280
395
  */
281
396
  get memory(): T2;
282
397
  /**
283
398
  * This method set the memory of the canvas element.
399
+ * @throws {PixiError} when the method is not overridden in the subclass.
284
400
  */
285
401
  setMemory(_value: T2): Promise<void> | void;
286
402
  /**
@@ -294,19 +410,17 @@ declare class CanvasBaseItem<T2 extends CanvasBaseItemMemory> {
294
410
  */
295
411
  interface CanvasBaseItemMemory {
296
412
  pixivnId: string;
297
- zIndex?: number;
298
- }
299
-
300
- type PauseTickerType = {
301
413
  /**
302
- * Ticker ids excluded
414
+ * The index of the container in its parent, if it has one
303
415
  */
304
- tickerIdsExcluded?: string[];
416
+ index?: number;
305
417
  /**
306
- * Ticker ids included
418
+ * The label of the parent container, if it has one
307
419
  */
308
- tickerIdsIncluded?: string[];
309
- };
420
+ parentLabel?: string;
421
+ label?: string;
422
+ zIndex?: number;
423
+ }
310
424
 
311
425
  /**
312
426
  * Interface exported canvas
@@ -328,12 +442,6 @@ interface CanvasGameState {
328
442
  * @deprecated
329
443
  */
330
444
  elementAliasesOrder: string[];
331
- /**
332
- * @deprecated
333
- */
334
- tickersOnPause: {
335
- [alias: string]: PauseTickerType;
336
- };
337
445
  tickersToCompleteOnStepEnd: {
338
446
  tikersIds: {
339
447
  id: string;
@@ -425,29 +533,85 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
425
533
  * The elements contained in this container
426
534
  */
427
535
  elements: CanvasBaseItemMemory[];
428
- /**
429
- * The index of the container in its parent, if it has one
430
- */
431
- index?: number;
432
- /**
433
- * The label of the parent container, if it has one
434
- */
435
- parentLabel?: string;
436
536
  }
437
537
 
438
- var version = "1.5.19";
538
+ var version = "1.6.1";
439
539
 
540
+ /**
541
+ * @deprecated
542
+ */
440
543
  declare const Repeat: RepeatType;
441
544
  /**
442
545
  * Pause the tickers for a duration.
443
546
  * @param duration Duration in seconds
444
547
  * @returns The pause object
548
+ * @deprecated
445
549
  */
446
550
  declare function Pause(duration: number): PauseType;
447
551
  /**
448
552
  * Is a special alias to indicate the game layer.
449
553
  */
450
554
  declare const CANVAS_APP_GAME_LAYER_ALIAS = "__game_layer__";
555
+ /**
556
+ * The default audio channel for sounds that don't specify one.
557
+ */
558
+ declare const GENERAL_CHANNEL = "general";
559
+ declare const SYSTEM_RESERVED_STORAGE_KEYS: {
560
+ /**
561
+ * The key of the current dialogue memory
562
+ */
563
+ CURRENT_DIALOGUE_MEMORY_KEY: string;
564
+ /**
565
+ * The key of step counter of the current dialogue memory
566
+ */
567
+ LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: string;
568
+ /**
569
+ * The key of the current menu options memory
570
+ */
571
+ CURRENT_MENU_OPTIONS_MEMORY_KEY: string;
572
+ /**
573
+ * The key of the last menu options added in the step memory
574
+ */
575
+ LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: string;
576
+ /**
577
+ * The key of the input memory. This value can be read by pixi-vn json importer
578
+ */
579
+ CURRENT_INPUT_VALUE_MEMORY_KEY: string;
580
+ /**
581
+ * The key of the last input added in the step memory
582
+ */
583
+ LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY: string;
584
+ /**
585
+ * The key of the current input info
586
+ */
587
+ CURRENT_INPUT_INFO_MEMORY_KEY: string;
588
+ /**
589
+ * The key of the characters memory
590
+ */
591
+ CHARACTER_CATEGORY_KEY: string;
592
+ /**
593
+ * This variable is used to add the next dialog text into the current dialog memory.
594
+ * This value was added to introduce Ink Glue functionality https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#glue
595
+ */
596
+ ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY: string;
597
+ /**
598
+ * The key of a list of all labels that have been opened during the progression of the steps.
599
+ */
600
+ OPENED_LABELS_COUNTER_KEY: string;
601
+ /**
602
+ * The key of a list of all choices that have been made during the progression of the steps.
603
+ */
604
+ ALL_CHOICES_MADE_KEY: string;
605
+ /**
606
+ * The key of the current step times counter.
607
+ * This value was added to introduce Ink Sequences, cycles and other alternatives https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#sequences-cycles-and-other-alternatives
608
+ */
609
+ CURRENT_STEP_TIMES_COUNTER_KEY: string;
610
+ /**
611
+ * The key of the last dialogue step glued in the step memory
612
+ */
613
+ LAST_STEP_GLUED: string;
614
+ };
451
615
 
452
616
  type StorageElementPrimaryType = string | number | boolean | undefined | null | StorageElementPrimaryType[];
453
617
  type StorageElementInternalType = StorageElementPrimaryType | Record<string | number | symbol, StorageElementPrimaryType> | StorageElementInternalType[];
@@ -470,12 +634,20 @@ interface StorageGameStateItem<T = StorageElementType> {
470
634
  * Interface exported storage data
471
635
  */
472
636
  type StorageGameState = {
473
- base: StorageGameStateItem[];
474
- temp: StorageGameStateItem[];
637
+ /**
638
+ * @deprecated
639
+ */
640
+ base?: StorageGameStateItem[];
641
+ /**
642
+ * @deprecated
643
+ */
644
+ temp?: StorageGameStateItem[];
475
645
  tempDeadlines: StorageGameStateItem<number>[];
476
- flags: string[];
477
- } | StorageGameStateItem[] | {
478
- [key: string]: StorageElementType;
646
+ /**
647
+ * @deprecated
648
+ */
649
+ flags?: string[];
650
+ main: StorageGameStateItem[];
479
651
  };
480
652
 
481
653
  /**
@@ -502,7 +674,7 @@ interface HistoryStep {
502
674
  /**
503
675
  * The difference between the previous step and the current step.
504
676
  */
505
- diff?: deepDiff.Diff<GameStepState, GameStepState>[] | Difference[];
677
+ diff?: Difference[];
506
678
  /**
507
679
  * The label id of the current step.
508
680
  */
@@ -519,10 +691,6 @@ interface HistoryStep {
519
691
  * The data of the step of the label.
520
692
  */
521
693
  labelStepIndex: number | null;
522
- /**
523
- * @deprecated
524
- */
525
- dialoge?: StoredDialogue;
526
694
  /**
527
695
  * Dialogue to be shown in the game
528
696
  */
@@ -610,6 +778,7 @@ interface GameStepStateData {
610
778
  * This function is used to create a deep copy of the element
611
779
  * @param element The element to be copied
612
780
  * @returns The copied element
781
+ * @throws {PixiError} when the element is not JSON serializable (e.g. contains functions or class instances).
613
782
  */
614
783
  declare function createExportableElement<T>(element: T): T;
615
784
 
@@ -679,6 +848,13 @@ declare namespace Game {
679
848
  * @param navigate The function to navigate to a path
680
849
  */
681
850
  function restoreGameState(data: GameState, navigate: (path: string) => void | Promise<void>): Promise<void>;
851
+ /**
852
+ * Start the game with a label. This function will clear the canvas, stop all sounds and start the narration with the given label.
853
+ * @param label The label to start the game with. It can be a string or a LabelAbstract instance. If it is a string, it will be used as the id of the label to start. If it is a LabelAbstract instance, it will be used directly. If the label is not found, an error will be thrown.
854
+ * @param props The properties to pass to the label. It will be passed to the {@link StepLabelType} of the label when it is executed.
855
+ * @returns The result of the label execution. It can be a {@link StepLabelResultType} or a Promise that resolves to a {@link StepLabelResultType}.
856
+ */
857
+ function start<T extends {} = {}>(label: narrationUtils.LabelAbstract<any, T> | string, props: narrationUtils.StepLabelPropsType<T>): Promise<narrationUtils.StepLabelResultType>;
682
858
  /**
683
859
  * Convert a JSON string to a save data
684
860
  * @param json The JSON string
@@ -696,43 +872,39 @@ declare namespace Game {
696
872
  */
697
873
  function onEnd(value: narrationUtils.StepLabelType): void;
698
874
  /**
699
- * Function to be executed when an error occurs in the step.
700
- * Supports both synchronous and asynchronous error handlers.
875
+ * @deprecated Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers.
876
+ */
877
+ function onError(handler: (type: "step", error: any, props: narrationUtils.StepLabelPropsType) => void | Promise<void>): () => void;
878
+ /**
879
+ * Register an error handler. Multiple handlers can be registered; they
880
+ * will be executed in registration order.
701
881
  * @example
702
882
  * ```typescript
703
- * // Synchronous error handler
704
- * Game.onError((type, error, props) => {
883
+ * // Register a synchronous error handler
884
+ * Game.addOnError((error, props) => {
705
885
  * props.notify("An error occurred")
706
886
  * // send a notification to GlitchTip, Sentry, etc...
707
887
  * })
708
888
  *
709
- * // Asynchronous error handler
710
- * Game.onError(async (type, error, props) => {
889
+ * // Register an asynchronous error handler
890
+ * Game.addOnError(async (error, props) => {
711
891
  * await logErrorToServer(error)
712
892
  * props.notify("An error occurred")
713
893
  * })
714
894
  *
715
- * // Error handler with step restoration/rollback
716
- * Game.onError(async (type, error, props) => {
895
+ * // Register an error handler with step restoration/rollback
896
+ * Game.addOnError(async (error, props) => {
717
897
  * // Restore the game state to the previous step
718
898
  * await stepHistory.back(props)
719
899
  * props.notify("An error occurred, returning to previous step")
720
900
  * })
721
901
  * ```
722
902
  */
723
- function onError(value: (
724
- /**
725
- * The type of error. Currently, only "step" type is supported.
726
- */
727
- type: "step",
728
- /**
729
- * The error object
730
- */
731
- error: any,
903
+ function addOnError(value: OnErrorHandler): () => void;
732
904
  /**
733
- * The step label properties
905
+ * Remove a previously registered error handler.
734
906
  */
735
- props: narrationUtils.StepLabelPropsType) => void | Promise<void>): void;
907
+ function removeOnError(handler: OnErrorHandler): void;
736
908
  /**
737
909
  * Is a function that will be executed before any step is executed.
738
910
  * @param stepId Step id
@@ -786,7 +958,7 @@ declare namespace Game {
786
958
  declare const _default: {
787
959
  canvas: canvasUtils.CanvasManagerInterface;
788
960
  narration: narrationUtils.NarrationManagerInterface;
789
- sound: SoundManager;
961
+ sound: SoundManagerInterface;
790
962
  storage: storageUtils.StorageManagerInterface;
791
963
  history: historyUtils.HistoryManagerInterface;
792
964
  Game: typeof Game;
@@ -802,4 +974,4 @@ declare const _default: {
802
974
  PIXIVN_VERSION: string;
803
975
  };
804
976
 
805
- export { CANVAS_APP_GAME_LAYER_ALIAS, CachedMap, Game, type GameState, type GameStepStateData, version as PIXIVN_VERSION, Pause, Repeat, createExportableElement, _default as default };
977
+ export { CANVAS_APP_GAME_LAYER_ALIAS, CachedMap, GENERAL_CHANNEL, Game, type GameState, type GameStepStateData, version as PIXIVN_VERSION, Pause, Repeat, SYSTEM_RESERVED_STORAGE_KEYS, createExportableElement, _default as default };