narraleaf-react 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/game/nlcore/action/action.d.ts +29 -24
  2. package/dist/game/nlcore/action/actionHistory.d.ts +48 -39
  3. package/dist/game/nlcore/action/actionTypes.d.ts +142 -142
  4. package/dist/game/nlcore/action/actionable.d.ts +5 -5
  5. package/dist/game/nlcore/action/actions/characterAction.d.ts +19 -17
  6. package/dist/game/nlcore/action/actions/conditionAction.d.ts +26 -17
  7. package/dist/game/nlcore/action/actions/controlAction.d.ts +26 -38
  8. package/dist/game/nlcore/action/actions/displayableAction.d.ts +26 -22
  9. package/dist/game/nlcore/action/actions/imageAction.d.ts +25 -23
  10. package/dist/game/nlcore/action/actions/layerAction.d.ts +16 -13
  11. package/dist/game/nlcore/action/actions/menuAction.d.ts +21 -16
  12. package/dist/game/nlcore/action/actions/persistentAction.d.ts +17 -13
  13. package/dist/game/nlcore/action/actions/sceneAction.d.ts +47 -44
  14. package/dist/game/nlcore/action/actions/scriptAction.d.ts +14 -10
  15. package/dist/game/nlcore/action/actions/soundAction.d.ts +20 -18
  16. package/dist/game/nlcore/action/actions/storyAction.d.ts +8 -8
  17. package/dist/game/nlcore/action/actions/textAction.d.ts +16 -14
  18. package/dist/game/nlcore/action/actions/videoAction.d.ts +26 -22
  19. package/dist/game/nlcore/action/actions.d.ts +20 -13
  20. package/dist/game/nlcore/action/baseElement.d.ts +2 -2
  21. package/dist/game/nlcore/action/chain.d.ts +17 -17
  22. package/dist/game/nlcore/action/constructable.d.ts +5 -5
  23. package/dist/game/nlcore/action/gameHistory.d.ts +32 -32
  24. package/dist/game/nlcore/action/logicAction.d.ts +52 -52
  25. package/dist/game/nlcore/action/serviceAction.d.ts +24 -11
  26. package/dist/game/nlcore/action/srcManager.d.ts +47 -47
  27. package/dist/game/nlcore/action/stackModel.d.ts +106 -0
  28. package/dist/game/nlcore/action/tree/actionTree.d.ts +56 -56
  29. package/dist/game/nlcore/common/Utils.d.ts +25 -25
  30. package/dist/game/nlcore/common/core.d.ts +8 -8
  31. package/dist/game/nlcore/common/elements.d.ts +19 -19
  32. package/dist/game/nlcore/common/game.d.ts +8 -7
  33. package/dist/game/nlcore/common/player.d.ts +7 -7
  34. package/dist/game/nlcore/common/position.d.ts +2 -2
  35. package/dist/game/nlcore/common/transition.d.ts +6 -6
  36. package/dist/game/nlcore/common/types.d.ts +9 -9
  37. package/dist/game/nlcore/elements/character/pause.d.ts +8 -8
  38. package/dist/game/nlcore/elements/character/sentence.d.ts +25 -25
  39. package/dist/game/nlcore/elements/character/word.d.ts +18 -18
  40. package/dist/game/nlcore/elements/character.d.ts +56 -52
  41. package/dist/game/nlcore/elements/condition.d.ts +20 -20
  42. package/dist/game/nlcore/elements/control.d.ts +76 -76
  43. package/dist/game/nlcore/elements/displayable/displayable.d.ts +76 -76
  44. package/dist/game/nlcore/elements/displayable/image.d.ts +102 -102
  45. package/dist/game/nlcore/elements/displayable/text.d.ts +74 -74
  46. package/dist/game/nlcore/elements/layer.d.ts +33 -33
  47. package/dist/game/nlcore/elements/menu.d.ts +45 -45
  48. package/dist/game/nlcore/elements/persistent/storable.d.ts +24 -24
  49. package/dist/game/nlcore/elements/persistent/type.d.ts +3 -3
  50. package/dist/game/nlcore/elements/persistent.d.ts +86 -86
  51. package/dist/game/nlcore/elements/scene.d.ts +76 -76
  52. package/dist/game/nlcore/elements/script.d.ts +16 -16
  53. package/dist/game/nlcore/elements/service.d.ts +59 -59
  54. package/dist/game/nlcore/elements/sound.d.ts +89 -89
  55. package/dist/game/nlcore/elements/story.d.ts +92 -78
  56. package/dist/game/nlcore/elements/transform/position.d.ts +99 -103
  57. package/dist/game/nlcore/elements/transform/transform.d.ts +119 -119
  58. package/dist/game/nlcore/elements/transform/type.d.ts +32 -32
  59. package/dist/game/nlcore/elements/transition/transition.d.ts +29 -29
  60. package/dist/game/nlcore/elements/transition/transitions/image/darkness.d.ts +20 -20
  61. package/dist/game/nlcore/elements/transition/transitions/image/dissolve.d.ts +17 -17
  62. package/dist/game/nlcore/elements/transition/transitions/image/fadeIn.d.ts +20 -20
  63. package/dist/game/nlcore/elements/transition/transitions/image/imageTransition.d.ts +28 -28
  64. package/dist/game/nlcore/elements/transition/transitions/text/fontSize.d.ts +13 -13
  65. package/dist/game/nlcore/elements/transition/transitions/text/textTransition.d.ts +10 -10
  66. package/dist/game/nlcore/elements/transition/type.d.ts +51 -51
  67. package/dist/game/nlcore/elements/type.d.ts +16 -16
  68. package/dist/game/nlcore/elements/video.d.ts +23 -23
  69. package/dist/game/nlcore/game/liveGame.d.ts +148 -138
  70. package/dist/game/nlcore/game/plugin/plugin.d.ts +16 -16
  71. package/dist/game/nlcore/game/preference.d.ts +32 -32
  72. package/dist/game/nlcore/game.d.ts +79 -116
  73. package/dist/game/nlcore/gameTypes.d.ts +439 -337
  74. package/dist/game/nlcore/types.d.ts +67 -67
  75. package/dist/game/player/Tasks.d.ts +125 -106
  76. package/dist/game/player/elements/Player.d.ts +4 -4
  77. package/dist/game/player/elements/displayable/Displayable.d.ts +1 -1
  78. package/dist/game/player/elements/displayable/Displayables.d.ts +1 -1
  79. package/dist/game/player/elements/displayable/Text.d.ts +1 -1
  80. package/dist/game/player/elements/displayable/type.d.ts +1 -1
  81. package/dist/game/player/elements/elements.d.ts +8 -8
  82. package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -1
  83. package/dist/game/player/elements/image/Image.d.ts +3 -3
  84. package/dist/game/player/elements/menu/PlayerMenu.d.ts +3 -3
  85. package/dist/game/player/elements/menu/UIMenu/Item.d.ts +12 -12
  86. package/dist/game/player/elements/menu/UIMenu/Menu.d.ts +6 -6
  87. package/dist/game/player/elements/menu/UIMenu/context.d.ts +23 -23
  88. package/dist/game/player/elements/menu/type.d.ts +16 -16
  89. package/dist/game/player/elements/notification/Notifications.d.ts +3 -3
  90. package/dist/game/player/elements/notification/PlayerNotification.d.ts +4 -4
  91. package/dist/game/player/elements/notification/context.d.ts +11 -11
  92. package/dist/game/player/elements/notification/type.d.ts +18 -19
  93. package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -1
  94. package/dist/game/player/elements/player/Layer.d.ts +8 -8
  95. package/dist/game/player/elements/player/PreferenceUpdateAnnouncer.d.ts +4 -4
  96. package/dist/game/player/elements/player/RenderEventAnnoucer.d.ts +4 -4
  97. package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -1
  98. package/dist/game/player/elements/preload/Preload.d.ts +1 -1
  99. package/dist/game/player/elements/say/Dialog.d.ts +13 -13
  100. package/dist/game/player/elements/say/Nametag.d.ts +2 -2
  101. package/dist/game/player/elements/say/Sentence.d.ts +37 -37
  102. package/dist/game/player/elements/say/UIDialog.d.ts +72 -71
  103. package/dist/game/player/elements/say/context.d.ts +4 -4
  104. package/dist/game/player/elements/say/type.d.ts +53 -53
  105. package/dist/game/player/elements/say/useDialog.d.ts +18 -18
  106. package/dist/game/player/elements/scene/Scene.d.ts +1 -1
  107. package/dist/game/player/elements/type.d.ts +53 -53
  108. package/dist/game/player/elements/video/video.d.ts +1 -1
  109. package/dist/game/player/gameState.d.ts +193 -191
  110. package/dist/game/player/gameState.type.d.ts +1 -1
  111. package/dist/game/player/guard.d.ts +24 -24
  112. package/dist/game/player/lib/AspectRatio.d.ts +7 -7
  113. package/dist/game/player/lib/AudioManager.d.ts +50 -50
  114. package/dist/game/player/lib/Cursor.d.ts +6 -6
  115. package/dist/game/player/lib/ErrorBoundary.d.ts +24 -24
  116. package/dist/game/player/lib/ErrorFallback.d.ts +5 -5
  117. package/dist/game/player/lib/ImageCacheManager.d.ts +26 -26
  118. package/dist/game/player/lib/Inspect.d.ts +36 -36
  119. package/dist/game/player/lib/PageRouter/AnimatePresence.d.ts +4 -4
  120. package/dist/game/player/lib/PageRouter/Page.d.ts +9 -9
  121. package/dist/game/player/lib/PageRouter/PageRouter.d.ts +27 -27
  122. package/dist/game/player/lib/PageRouter/Stage.d.ts +6 -6
  123. package/dist/game/player/lib/PageRouter/router.d.ts +28 -23
  124. package/dist/game/player/lib/PlayerFrames.d.ts +10 -10
  125. package/dist/game/player/lib/Preloaded.d.ts +48 -48
  126. package/dist/game/player/lib/flush.d.ts +5 -5
  127. package/dist/game/player/lib/isolated.d.ts +7 -7
  128. package/dist/game/player/lib/notification.d.ts +47 -47
  129. package/dist/game/player/lib/preferences.d.ts +8 -8
  130. package/dist/game/player/lib/useElementVisibility.d.ts +5 -5
  131. package/dist/game/player/lib/useExposeState.d.ts +10 -10
  132. package/dist/game/player/lib/useLiveGame.d.ts +1 -1
  133. package/dist/game/player/libElements.d.ts +12 -12
  134. package/dist/game/player/provider/game-state.d.ts +24 -24
  135. package/dist/game/player/provider/preloaded.d.ts +1 -1
  136. package/dist/game/player/provider/providers.d.ts +7 -7
  137. package/dist/game/player/provider/ratio.d.ts +1 -1
  138. package/dist/game/player/type.d.ts +68 -68
  139. package/dist/index.d.ts +3 -3
  140. package/dist/main.js +43 -45
  141. package/dist/util/config.d.ts +37 -37
  142. package/dist/util/data.d.ts +346 -309
  143. package/dist/util/logger.d.ts +21 -21
  144. package/dist/util/singleton.d.ts +5 -5
  145. package/package.json +5 -3
@@ -1,32 +1,32 @@
1
- import { Action } from "./action";
2
- import { ActionHistoryManager } from "./actionHistory";
3
- type GameHistoryAction = {
4
- token: string;
5
- action: Action;
6
- isPending?: boolean;
7
- };
8
- type GameElementHistory = {
9
- type: "say";
10
- text: string;
11
- voice: string | null;
12
- character: string | null;
13
- } | {
14
- type: "menu";
15
- text: string | null;
16
- selected: string | null;
17
- };
18
- export type GameHistory = GameHistoryAction & {
19
- element: GameElementHistory;
20
- };
21
- export declare class GameHistoryManager {
22
- private history;
23
- private actionHistoryMgr;
24
- constructor(actionHistoryMgr: ActionHistoryManager);
25
- push(action: GameHistory): this;
26
- getHistory(): GameHistory[];
27
- reset(): void;
28
- updateByToken(id: string, handler: (result: GameHistory | null) => void): void;
29
- resolvePending(id: string): void;
30
- private crossFilter;
31
- }
32
- export {};
1
+ import { Action } from "./action";
2
+ import { ActionHistoryManager } from "./actionHistory";
3
+ type GameHistoryAction = {
4
+ token: string;
5
+ action: Action;
6
+ isPending?: boolean;
7
+ };
8
+ type GameElementHistory = {
9
+ type: "say";
10
+ text: string;
11
+ voice: string | null;
12
+ character: string | null;
13
+ } | {
14
+ type: "menu";
15
+ text: string | null;
16
+ selected: string | null;
17
+ };
18
+ export type GameHistory = GameHistoryAction & {
19
+ element: GameElementHistory;
20
+ };
21
+ export declare class GameHistoryManager {
22
+ private history;
23
+ private actionHistoryMgr;
24
+ constructor(actionHistoryMgr: ActionHistoryManager);
25
+ push(action: GameHistory): this;
26
+ getHistory(): GameHistory[];
27
+ reset(): void;
28
+ updateByToken(id: string, handler: (result: GameHistory | null) => void): void;
29
+ resolvePending(id: string): void;
30
+ private crossFilter;
31
+ }
32
+ export {};
@@ -1,52 +1,52 @@
1
- import type { Character } from "../elements/character";
2
- import type { Scene } from "../elements/scene";
3
- import type { Story } from "../elements/story";
4
- import type { Image } from "../elements/displayable/image";
5
- import type { Condition } from "../elements/condition";
6
- import type { Script } from "../elements/script";
7
- import type { Menu } from "../elements/menu";
8
- import { StringKeyOf, Values } from "../../../util/data";
9
- import { TypedAction } from "../action/actions";
10
- import { Sound } from "../elements/sound";
11
- import { Control } from "../elements/control";
12
- import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, StoryActionContentType, StoryActionTypes, TextActionContentType, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
13
- import { CharacterAction } from "../action/actions/characterAction";
14
- import { SceneAction } from "../action/actions/sceneAction";
15
- import { StoryAction } from "../action/actions/storyAction";
16
- import { ImageAction } from "../action/actions/imageAction";
17
- import { ConditionAction } from "../action/actions/conditionAction";
18
- import { ScriptAction } from "../action/actions/scriptAction";
19
- import { MenuAction } from "../action/actions/menuAction";
20
- import { SoundAction } from "../action/actions/soundAction";
21
- import { ControlAction } from "../action/actions/controlAction";
22
- import { Text } from "../elements/displayable/text";
23
- import { TextAction } from "../action/actions/textAction";
24
- import { Displayable as AbstractDisplayable } from "../elements/displayable/displayable";
25
- import { DisplayableAction } from "../action/actions/displayableAction";
26
- import { Persistent } from "../elements/persistent";
27
- import { PersistentAction } from "../action/actions/persistentAction";
28
- import { ServiceSkeleton } from "../elements/service";
29
- import { ServiceAction, ServiceActionContentType } from "../action/serviceAction";
30
- import { Layer } from "../elements/layer";
31
- import { LayerAction } from "../action/actions/layerAction";
32
- import { ExposedStateType } from "../../player/type";
33
- import { Video } from "../elements/video";
34
- import { VideoAction } from "../action/actions/videoAction";
35
- export interface LogicActionInterface {
36
- DisplayableElements: Text | Image | Layer | AbstractDisplayable<any, any>;
37
- DisplayableExposed: ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text;
38
- GameElement: Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video;
39
- Actions: TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction;
40
- ActionTypes: Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundAction.ActionTypes> | Values<typeof ControlAction.ActionTypes> | Values<typeof TextAction.ActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes>;
41
- ActionContents: CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType;
42
- }
43
- export declare const LogicAction: {};
44
- export declare namespace LogicAction {
45
- type DisplayableElements = Text | Image | Layer | AbstractDisplayable<any, any>;
46
- type DisplayableExposed = ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text;
47
- type GameElement = Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video;
48
- type Actions = TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction;
49
- type ActionTypes = Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundAction.ActionTypes> | Values<typeof ControlAction.ActionTypes> | Values<typeof TextAction.ActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes>;
50
- type ActionContents = CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType;
51
- }
52
- export type LogicAction = typeof LogicAction;
1
+ import type { Character } from "../elements/character";
2
+ import type { Scene } from "../elements/scene";
3
+ import type { Story } from "../elements/story";
4
+ import type { Image } from "../elements/displayable/image";
5
+ import type { Condition } from "../elements/condition";
6
+ import type { Script } from "../elements/script";
7
+ import type { Menu } from "../elements/menu";
8
+ import { StringKeyOf, Values } from "../../../util/data";
9
+ import { TypedAction } from "../action/actions";
10
+ import { Sound } from "../elements/sound";
11
+ import { Control } from "../elements/control";
12
+ import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, StoryActionContentType, StoryActionTypes, TextActionContentType, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
13
+ import { CharacterAction } from "../action/actions/characterAction";
14
+ import { SceneAction } from "../action/actions/sceneAction";
15
+ import { StoryAction } from "../action/actions/storyAction";
16
+ import { ImageAction } from "../action/actions/imageAction";
17
+ import { ConditionAction } from "../action/actions/conditionAction";
18
+ import { ScriptAction } from "../action/actions/scriptAction";
19
+ import { MenuAction } from "../action/actions/menuAction";
20
+ import { SoundAction } from "../action/actions/soundAction";
21
+ import { ControlAction } from "../action/actions/controlAction";
22
+ import { Text } from "../elements/displayable/text";
23
+ import { TextAction } from "../action/actions/textAction";
24
+ import { Displayable as AbstractDisplayable } from "../elements/displayable/displayable";
25
+ import { DisplayableAction } from "../action/actions/displayableAction";
26
+ import { Persistent } from "../elements/persistent";
27
+ import { PersistentAction } from "../action/actions/persistentAction";
28
+ import { ServiceSkeleton } from "../elements/service";
29
+ import { ServiceAction, ServiceActionContentType } from "../action/serviceAction";
30
+ import { Layer } from "../elements/layer";
31
+ import { LayerAction } from "../action/actions/layerAction";
32
+ import { ExposedStateType } from "../../player/type";
33
+ import { Video } from "../elements/video";
34
+ import { VideoAction } from "../action/actions/videoAction";
35
+ export interface LogicActionInterface {
36
+ DisplayableElements: Text | Image | Layer | AbstractDisplayable<any, any>;
37
+ DisplayableExposed: ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text;
38
+ GameElement: Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video;
39
+ Actions: TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction;
40
+ ActionTypes: Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundAction.ActionTypes> | Values<typeof ControlAction.ActionTypes> | Values<typeof TextAction.ActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes>;
41
+ ActionContents: CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType;
42
+ }
43
+ export declare const LogicAction: {};
44
+ export declare namespace LogicAction {
45
+ type DisplayableElements = Text | Image | Layer | AbstractDisplayable<any, any>;
46
+ type DisplayableExposed = ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text;
47
+ type GameElement = Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video;
48
+ type Actions = TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction;
49
+ type ActionTypes = Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundAction.ActionTypes> | Values<typeof ControlAction.ActionTypes> | Values<typeof TextAction.ActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes>;
50
+ type ActionContents = CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType;
51
+ }
52
+ export type LogicAction = typeof LogicAction;
@@ -1,11 +1,24 @@
1
- import { TypedAction } from "../action/actions";
2
- import { Awaitable, StringKeyOf } from "../../../util/data";
3
- import { ServiceSkeleton } from "../elements/service";
4
- import { GameState } from "../../player/gameState";
5
- import { CalledActionResult } from "../gameTypes";
6
- export type ServiceActionContentType = {
7
- "service:action": [type: string, args: unknown[]];
8
- };
9
- export declare class ServiceAction extends TypedAction<ServiceActionContentType, StringKeyOf<ServiceActionContentType>, ServiceSkeleton> {
10
- executeAction(gameState: GameState): CalledActionResult | Awaitable<CalledActionResult, any>;
11
- }
1
+ import { TypedAction } from "../action/actions";
2
+ import { ServiceSkeleton } from "../elements/service";
3
+ import { Awaitable, StringKeyOf } from "../../../util/data";
4
+ import { GameState } from "../../player/gameState";
5
+ import { ActionExecutionInjection } from "./action";
6
+ import { LogicAction } from "../action/logicAction";
7
+ import { Story } from "../elements/story";
8
+ export type ServiceActionContentType = {
9
+ "service:action": [type: string, args: unknown[]];
10
+ };
11
+ export declare class ServiceAction extends TypedAction<ServiceActionContentType, StringKeyOf<ServiceActionContentType>, ServiceSkeleton> {
12
+ executeAction(gameState: GameState, injection: ActionExecutionInjection): {
13
+ type: any;
14
+ node: import("./tree/actionTree").ContentNode<any> | null;
15
+ wait?: import("../gameTypes").StackModelWaiting | null;
16
+ } | Awaitable<import("../gameTypes").CalledActionResult, any> | (import("../gameTypes").CalledActionResult | Awaitable<import("../gameTypes").CalledActionResult, any>)[] | Awaitable<{
17
+ type: any;
18
+ node: import("./tree/actionTree").RenderableNode | null;
19
+ }, {
20
+ type: any;
21
+ node: import("./tree/actionTree").RenderableNode | null;
22
+ }> | null;
23
+ stringify(_story: Story, _seen: Set<LogicAction.Actions>, _strict: boolean): string;
24
+ }
@@ -1,47 +1,47 @@
1
- import { Sound } from "../elements/sound";
2
- import { Image } from "../elements/displayable/image";
3
- import { Story } from "../common/core";
4
- import { StaticImageData } from "../types";
5
- import { LogicAction } from "../action/logicAction";
6
- export type SrcType = "image" | "video" | "audio";
7
- export type Src = {
8
- type: "image";
9
- src: Image | string;
10
- } | {
11
- type: "video";
12
- src: string;
13
- } | {
14
- type: "audio";
15
- src: Sound;
16
- };
17
- export type ActiveSrc<T extends "scene" | "once" = "scene" | "once"> = Src & {
18
- activeType: T;
19
- };
20
- export declare class SrcManager {
21
- static SrcTypes: {
22
- [key in SrcType]: key;
23
- };
24
- static catSrc(src: Src[]): {
25
- image: (Image | string)[];
26
- video: string[];
27
- audio: Sound[];
28
- };
29
- static getSrc(src: Src | string | Image): string | null;
30
- static getPreloadableSrc(story: Story, action: LogicAction.Actions): (Src & {
31
- activeType: "scene" | "once";
32
- }) | null;
33
- src: Src[];
34
- future: SrcManager[];
35
- register(src: Src): this;
36
- register(src: Src[]): this;
37
- register(src: Sound): this;
38
- register(src: Image | StaticImageData): this;
39
- register(type: SrcType, src: Src["src"]): this;
40
- registerRawSrc(src: string): this;
41
- isSrcRegistered(src: string | Sound | Image | null): boolean;
42
- getSrc(): Src[];
43
- getSrcByType(type: SrcType): Src[];
44
- registerFuture(srcManager: SrcManager): this;
45
- hasFuture(s: SrcManager): boolean;
46
- getFutureSrc(): Src[];
47
- }
1
+ import { Sound } from "../elements/sound";
2
+ import { Image } from "../elements/displayable/image";
3
+ import { Story } from "../common/core";
4
+ import { StaticImageData } from "../types";
5
+ import { LogicAction } from "../action/logicAction";
6
+ export type SrcType = "image" | "video" | "audio";
7
+ export type Src = {
8
+ type: "image";
9
+ src: Image | string;
10
+ } | {
11
+ type: "video";
12
+ src: string;
13
+ } | {
14
+ type: "audio";
15
+ src: Sound;
16
+ };
17
+ export type ActiveSrc<T extends "scene" | "once" = "scene" | "once"> = Src & {
18
+ activeType: T;
19
+ };
20
+ export declare class SrcManager {
21
+ static SrcTypes: {
22
+ [key in SrcType]: key;
23
+ };
24
+ static catSrc(src: Src[]): {
25
+ image: (Image | string)[];
26
+ video: string[];
27
+ audio: Sound[];
28
+ };
29
+ static getSrc(src: Src | string | Image): string | null;
30
+ static getPreloadableSrc(story: Story, action: LogicAction.Actions): (Src & {
31
+ activeType: "scene" | "once";
32
+ }) | null;
33
+ src: Src[];
34
+ future: SrcManager[];
35
+ register(src: Src): this;
36
+ register(src: Src[]): this;
37
+ register(src: Sound): this;
38
+ register(src: Image | StaticImageData): this;
39
+ register(type: SrcType, src: Src["src"]): this;
40
+ registerRawSrc(src: string): this;
41
+ isSrcRegistered(src: string | Sound | Image | null): boolean;
42
+ getSrc(): Src[];
43
+ getSrcByType(type: SrcType): Src[];
44
+ registerFuture(srcManager: SrcManager): this;
45
+ hasFuture(s: SrcManager): boolean;
46
+ getFutureSrc(): Src[];
47
+ }
@@ -0,0 +1,106 @@
1
+ import { Awaitable } from "../../../util/data";
2
+ import { LiveGame } from "../common/game";
3
+ import { CalledActionResult, StackModelWaiting } from "../gameTypes";
4
+ import { LogicAction } from "./logicAction";
5
+ export declare enum StackModelItemType {
6
+ Action = "action",
7
+ Link = "link"
8
+ }
9
+ export type StackModelRawData = ({
10
+ type: StackModelItemType.Action;
11
+ actionType: string | null;
12
+ action: string | null;
13
+ } | {
14
+ type: StackModelItemType.Link;
15
+ actionType: string | null;
16
+ action: string | null;
17
+ stacks: StackModelRawData[];
18
+ stackWaitType: StackModelWaiting["type"] | null;
19
+ })[];
20
+ /**
21
+ * Nested Stack Model is a new concept designed to control serialization/deserialization of complex nested operations
22
+ *
23
+ * Core concepts for saving state:
24
+ * 1. Do not save operations that cannot be immediately resolved, such as Awaitables
25
+ * 2. If an action returns an Awaitable, to prevent re-execution of the previous operation after deserialization:
26
+ * - Store the operation in waitingAction and add it to the tail stack during serialization
27
+ * - When restoring data, retrying the tail stack operation will retry this operation
28
+ * - Awaitables should not be saved due to their scope and complex behavior, instead save their parent operation
29
+ * 3. If an action returns a regular child (synchronous operation), add it to the tail stack
30
+ * - The child will continue on the next stack operation
31
+ * 4. If an action returns multiple children, add them sequentially to the tail stack
32
+ * - These children are treated as having a call relationship, e.g. in [a,b], a waits for b to complete before continuing
33
+ * - This requires all elements except the stack top to be fully synchronous operations
34
+ * 5. If an action returns a StackAction (not yet implemented), wait according to the StackAction definition
35
+ * - This operation is considered semi-synchronous since it contains child information
36
+ * - Serialization mechanism: treat as synchronous operation, including async info and stack contents
37
+ * - When restored, operation remains at stack top and continues waiting for stack operations to complete
38
+ * - This ensures stack operations are not abnormally re-executed or skipped after deserialization
39
+ *
40
+ * Example scenarios:
41
+ * 1. Action returns Awaitable:
42
+ * - Async operation: add Awaitable to tail stack, set sync operation as waitingAction
43
+ * - During save: exclude Awaitable, add waitingAction to stack for retry on deserialize
44
+ * - During runtime: wait for resolution, pop self and add return value to stack
45
+ * 2. Action returns direct child:
46
+ * - Sync operation: add operation to tail stack
47
+ * - During save: add operation to stack
48
+ * - During runtime: pop self and add child to stack
49
+ * 3. Action returns multiple children:
50
+ * - Sync/async nature determined by last child
51
+ * - Push all children to stack in order, last child on top
52
+ * - Save behavior follows above rules
53
+ * 4. Action returns StackAction:
54
+ * - Semi-sync operation treated as sync, includes async info and stack contents
55
+ * - During save: includes direct children, wait info (type e.g. any, all) and stack
56
+ * - Runtime with non-empty stack: continue waiting for stack operations
57
+ * - Runtime with empty stack: resolve operation, pop self and add direct children
58
+ * 5. Action returns direct child but async executes StackModel:
59
+ * - Serialize StackModel and execute directly on deserialize
60
+ */
61
+ export declare class StackModel {
62
+ private liveGame;
63
+ __tag: string | undefined;
64
+ static isStackModel(action: CalledActionResult | Awaitable<CalledActionResult> | StackModel): action is StackModel;
65
+ static createStackModel(liveGame: LiveGame, data: StackModelRawData, actionMap: Map<string, LogicAction.Actions>): StackModel;
66
+ static isCalledActionResult(action: CalledActionResult | Awaitable<CalledActionResult> | StackModel | undefined | null): action is CalledActionResult;
67
+ static fromAction(action: LogicAction.Actions): CalledActionResult;
68
+ static executeStackModelGroup(type: StackModelWaiting["type"], stackModels: StackModel[]): Awaitable<void>;
69
+ static isStackModelsAwaiting(type: StackModelWaiting["type"], stackModels: StackModel[]): boolean;
70
+ private stack;
71
+ private waitingAction;
72
+ constructor(liveGame: LiveGame, tag?: string | undefined);
73
+ /**
74
+ * Executes the next operation in the stack
75
+ *
76
+ * Main responsibilities:
77
+ * 1. Check and handle waiting states at the top of the stack
78
+ * 2. Execute current operation and handle its results
79
+ * 3. Manage asynchronous operations and nested stack models
80
+ *
81
+ * Execution flow:
82
+ * 1. If stack is empty, return null
83
+ * 2. Check top element:
84
+ * - If it's an unsettled Awaitable, return the Awaitable
85
+ * - If it's a waiting operation (with nested stack models), check nested stack status
86
+ * 3. Pop and execute current operation:
87
+ * - If it's an Awaitable, wait for completion and handle result
88
+ * - If it's a regular operation, execute and handle return value
89
+ *
90
+ * @returns One of the following:
91
+ * - CalledActionResult: Execution result (returned a synchronous operation)
92
+ * - Awaitable<CalledActionResult>: Asynchronous operation
93
+ * - null: No more operations if the stack is empty, or the top element is exited
94
+ */
95
+ rollNext(): CalledActionResult | Awaitable<CalledActionResult> | null;
96
+ execute(): Awaitable<void>;
97
+ abortStackTop(): CalledActionResult | null;
98
+ getTopSync(): CalledActionResult | null;
99
+ executeActions(result: CalledActionResult): CalledActionResult | Awaitable<CalledActionResult> | null;
100
+ isWaiting(): boolean;
101
+ serialize(): StackModelRawData;
102
+ reset(): void;
103
+ deserialize(data: StackModelRawData, actionMap: Map<string, LogicAction.Actions>): this;
104
+ isEmpty(): boolean;
105
+ push(...items: (CalledActionResult | Awaitable<CalledActionResult>)[]): this;
106
+ }
@@ -1,56 +1,56 @@
1
- import { LogicAction } from "../../action/logicAction";
2
- export declare enum NodeType {
3
- TreeNode = "TreeNode",
4
- ContentNode = "ContentNode"
5
- }
6
- export type RawData<T> = {
7
- id: string;
8
- data: T;
9
- };
10
- export declare class Node<C = any> {
11
- type: string;
12
- content: C | undefined;
13
- constructor(type: string);
14
- setContent(content: C): this;
15
- getContent(): C;
16
- }
17
- export type RenderableNode = ContentNode;
18
- export type RenderableNodeData = ContentNodeData | TreeNodeData;
19
- export type ContentNodeData = {
20
- id: string;
21
- data: any;
22
- };
23
- export declare class ContentNode<T = any> extends Node<T> {
24
- static create<T>(content: T): ContentNode<T>;
25
- static forEachParent(node: RenderableNode, callback: (node: RenderableNode) => void): void;
26
- static forEachChild(node: RenderableNode, callback: (node: RenderableNode) => void): void;
27
- action: LogicAction.Actions | null;
28
- private child?;
29
- private parent;
30
- constructor(callee?: LogicAction.Actions, parent?: RenderableNode | null, child?: RenderableNode);
31
- setParent(parent: RenderableNode | null): this;
32
- setChild(child: RenderableNode | null): this;
33
- getChild(): RenderableNode | null;
34
- getParent(): RenderableNode | null;
35
- /**
36
- * Public method for setting the content of the node
37
- * should only be called when changing the state in-game
38
- */
39
- addChild(child: RenderableNode | null): this;
40
- removeChild(child: RenderableNode | null): this;
41
- /**
42
- * Remove this node from the parent's children
43
- */
44
- remove(): this;
45
- hasChild(): boolean;
46
- }
47
- export declare class RootNode extends ContentNode {
48
- constructor();
49
- setParent(_: RenderableNode | null): this;
50
- remove(): this;
51
- forEach(callback: (node: RenderableNode) => void): void;
52
- }
53
- export type TreeNodeData = {
54
- id: string;
55
- data: any;
56
- };
1
+ import { LogicAction } from "../../action/logicAction";
2
+ export declare enum NodeType {
3
+ TreeNode = "TreeNode",
4
+ ContentNode = "ContentNode"
5
+ }
6
+ export type RawData<T> = {
7
+ id: string;
8
+ data: T;
9
+ };
10
+ export declare class Node<C = any> {
11
+ type: string;
12
+ content: C | undefined;
13
+ constructor(type: string);
14
+ setContent(content: C): this;
15
+ getContent(): C;
16
+ }
17
+ export type RenderableNode = ContentNode;
18
+ export type RenderableNodeData = ContentNodeData | TreeNodeData;
19
+ export type ContentNodeData = {
20
+ id: string;
21
+ data: any;
22
+ };
23
+ export declare class ContentNode<T = any> extends Node<T> {
24
+ static create<T>(content: T): ContentNode<T>;
25
+ static forEachParent(node: RenderableNode, callback: (node: RenderableNode) => void): void;
26
+ static forEachChild(node: RenderableNode, callback: (node: RenderableNode) => void): void;
27
+ action: LogicAction.Actions | null;
28
+ private child?;
29
+ private parent;
30
+ constructor(callee?: LogicAction.Actions, parent?: RenderableNode | null, child?: RenderableNode);
31
+ setParent(parent: RenderableNode | null): this;
32
+ setChild(child: RenderableNode | null): this;
33
+ getChild(): RenderableNode | null;
34
+ getParent(): RenderableNode | null;
35
+ /**
36
+ * Public method for setting the content of the node
37
+ * should only be called when changing the state in-game
38
+ */
39
+ addChild(child: RenderableNode | null): this;
40
+ removeChild(child: RenderableNode | null): this;
41
+ /**
42
+ * Remove this node from the parent's children
43
+ */
44
+ remove(): this;
45
+ hasChild(): boolean;
46
+ }
47
+ export declare class RootNode extends ContentNode {
48
+ constructor();
49
+ setParent(_: RenderableNode | null): this;
50
+ remove(): this;
51
+ forEach(callback: (node: RenderableNode) => void): void;
52
+ }
53
+ export type TreeNodeData = {
54
+ id: string;
55
+ data: any;
56
+ };
@@ -1,25 +1,25 @@
1
- import type { Color, HexColor } from "../types";
2
- import { Word } from "../elements/character/word";
3
- export declare class RGBColor {
4
- static isHexString(color: any): color is HexColor;
5
- static fromHex(hex: HexColor): RGBColor;
6
- r: number;
7
- g: number;
8
- b: number;
9
- a: number;
10
- constructor(r: number, g: number, b: number, a?: number);
11
- toString(): string;
12
- toHex(): string;
13
- }
14
- /**
15
- * Alias for {@link Word.color}
16
- */
17
- export declare function c(text: string | Word, color: Color): Word;
18
- /**
19
- * Alias for {@link Word.bold}
20
- */
21
- export declare function b(text: string | Word): Word;
22
- /**
23
- * Alias for {@link Word.italic}
24
- */
25
- export declare function i(text: string | Word): Word;
1
+ import type { Color, HexColor } from "../types";
2
+ import { Word } from "../elements/character/word";
3
+ export declare class RGBColor {
4
+ static isHexString(color: any): color is HexColor;
5
+ static fromHex(hex: HexColor): RGBColor;
6
+ r: number;
7
+ g: number;
8
+ b: number;
9
+ a: number;
10
+ constructor(r: number, g: number, b: number, a?: number);
11
+ toString(): string;
12
+ toHex(): string;
13
+ }
14
+ /**
15
+ * Alias for {@link Word.color}
16
+ */
17
+ export declare function c(text: string | Word, color: Color): Word;
18
+ /**
19
+ * Alias for {@link Word.bold}
20
+ */
21
+ export declare function b(text: string | Word): Word;
22
+ /**
23
+ * Alias for {@link Word.italic}
24
+ */
25
+ export declare function i(text: string | Word): Word;
@@ -1,8 +1,8 @@
1
- import { i, c, b } from "./Utils";
2
- export * from "./elements";
3
- export * from "./game";
4
- export * from "./player";
5
- export * from "./types";
6
- export * from "./position";
7
- export * from "./transition";
8
- export { i, c, b, };
1
+ import { i, c, b } from "./Utils";
2
+ export * from "./elements";
3
+ export * from "./game";
4
+ export * from "./player";
5
+ export * from "./types";
6
+ export * from "./position";
7
+ export * from "./transition";
8
+ export { i, c, b, };
@@ -1,19 +1,19 @@
1
- import { Character } from "../elements/character";
2
- import { Condition, Lambda } from "../elements/condition";
3
- import { Control } from "../elements/control";
4
- import { Image } from "../elements/displayable/image";
5
- import { Menu } from "../elements/menu";
6
- import { Scene } from "../elements/scene";
7
- import { Script } from "../elements/script";
8
- import { Sound } from "../elements/sound";
9
- import { Story } from "../elements/story";
10
- import { Transform } from "../elements/transform/transform";
11
- import { Sentence } from "../elements/character/sentence";
12
- import { Word } from "../elements/character/word";
13
- import { Text } from "../elements/displayable/text";
14
- import { Pause } from "../elements/character/pause";
15
- import { Persistent } from "../elements/persistent";
16
- import { Service } from "../elements/service";
17
- import { Layer } from "../elements/layer";
18
- import { Video } from "../elements/video";
19
- export { Character, Condition, Control, Image, Lambda, Menu, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, Persistent, Service, Layer, Video, };
1
+ import { Character } from "../elements/character";
2
+ import { Condition, Lambda } from "../elements/condition";
3
+ import { Control } from "../elements/control";
4
+ import { Image } from "../elements/displayable/image";
5
+ import { Menu } from "../elements/menu";
6
+ import { Scene } from "../elements/scene";
7
+ import { Script } from "../elements/script";
8
+ import { Sound } from "../elements/sound";
9
+ import { Story } from "../elements/story";
10
+ import { Transform } from "../elements/transform/transform";
11
+ import { Sentence } from "../elements/character/sentence";
12
+ import { Word } from "../elements/character/word";
13
+ import { Text } from "../elements/displayable/text";
14
+ import { Pause } from "../elements/character/pause";
15
+ import { Persistent } from "../elements/persistent";
16
+ import { Service } from "../elements/service";
17
+ import { Layer } from "../elements/layer";
18
+ import { Video } from "../elements/video";
19
+ export { Character, Condition, Control, Image, Lambda, Menu, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, Persistent, Service, Layer, Video, };