narraleaf-react 0.14.0 → 0.16.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 (45) hide show
  1. package/dist/game/nlcore/action/actionTypes.d.ts +16 -2
  2. package/dist/game/nlcore/action/actions/controlAction.d.ts +2 -0
  3. package/dist/game/nlcore/action/actions/vfxAction.d.ts +24 -0
  4. package/dist/game/nlcore/action/logicAction.d.ts +16 -13
  5. package/dist/game/nlcore/action/stackModel.d.ts +28 -0
  6. package/dist/game/nlcore/common/elements.d.ts +6 -1
  7. package/dist/game/nlcore/common/game.d.ts +2 -1
  8. package/dist/game/nlcore/common/transition.d.ts +8 -9
  9. package/dist/game/nlcore/elements/camera.d.ts +71 -0
  10. package/dist/game/nlcore/elements/character/sentence.d.ts +2 -1
  11. package/dist/game/nlcore/elements/character/textEvent.d.ts +67 -0
  12. package/dist/game/nlcore/elements/character/word.d.ts +2 -1
  13. package/dist/game/nlcore/elements/control.d.ts +62 -0
  14. package/dist/game/nlcore/elements/displayable/image.d.ts +2 -2
  15. package/dist/game/nlcore/elements/scene.d.ts +2 -2
  16. package/dist/game/nlcore/elements/story.d.ts +21 -1
  17. package/dist/game/nlcore/elements/transition/transitions/image/darkness.d.ts +16 -9
  18. package/dist/game/nlcore/elements/transition/transitions/image/dissolve.d.ts +9 -6
  19. package/dist/game/nlcore/elements/transition/transitions/image/fadeIn.d.ts +9 -8
  20. package/dist/game/nlcore/elements/transition/transitions/image/mask.d.ts +162 -0
  21. package/dist/game/nlcore/elements/transition/transitions/image/reveal.d.ts +33 -0
  22. package/dist/game/nlcore/elements/transition/transitions/image/throughColor.d.ts +34 -36
  23. package/dist/game/nlcore/elements/transition/transitions/image/transitionMaskUtils.d.ts +5 -16
  24. package/dist/game/nlcore/elements/transition/transitions/text/fontSize.d.ts +9 -2
  25. package/dist/game/nlcore/elements/vfx.d.ts +85 -0
  26. package/dist/game/nlcore/elements/video.d.ts +26 -0
  27. package/dist/game/nlcore/game/liveGame.d.ts +44 -5
  28. package/dist/game/player/elements/menu/type.d.ts +3 -2
  29. package/dist/game/player/elements/nvl/type.d.ts +2 -1
  30. package/dist/game/player/elements/nvl/useNvlDialogState.d.ts +2 -1
  31. package/dist/game/player/elements/player/Camera.d.ts +1 -0
  32. package/dist/game/player/elements/say/Sentence.d.ts +3 -2
  33. package/dist/game/player/elements/say/UIDialog.d.ts +2 -1
  34. package/dist/game/player/elements/say/textEventEffect.d.ts +19 -0
  35. package/dist/game/player/elements/say/type.d.ts +4 -3
  36. package/dist/game/player/elements/scene/SceneDialogs.d.ts +1 -0
  37. package/dist/game/player/elements/vfx/Vfx.d.ts +1 -0
  38. package/dist/game/player/gameState.d.ts +8 -0
  39. package/dist/game/player/type.d.ts +20 -1
  40. package/dist/main.js +44 -42
  41. package/package.json +1 -1
  42. package/dist/game/nlcore/elements/transition/transitions/image/blinds.d.ts +0 -28
  43. package/dist/game/nlcore/elements/transition/transitions/image/maskTransition.d.ts +0 -38
  44. package/dist/game/nlcore/elements/transition/transitions/image/softIris.d.ts +0 -28
  45. package/dist/game/nlcore/elements/transition/transitions/image/softWipe.d.ts +0 -28
@@ -15,6 +15,7 @@ import type { FadeOptions } from "../elements/type";
15
15
  import type { Transition } from "../elements/transition/transition";
16
16
  import type { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
17
17
  import type { Layer } from "../elements/layer";
18
+ import type { VfxFadeOptions } from "../elements/vfx";
18
19
  export declare const DisplayableActionTypes: {
19
20
  readonly action: "displayable:action";
20
21
  readonly applyTransform: "displayable:applyTransform";
@@ -112,9 +113,11 @@ export declare const ControlActionTypes: {
112
113
  readonly break: "control:break";
113
114
  readonly sleep: "control:sleep";
114
115
  readonly waitForClick: "control:waitForClick";
116
+ readonly label: "control:label";
117
+ readonly jump: "control:jump";
115
118
  };
116
119
  export type ControlActionContentType = {
117
- [K in typeof ControlActionTypes[keyof typeof ControlActionTypes]]: K extends "control:do" ? [LogicAction.Actions[]] : K extends "control:doAsync" ? [LogicAction.Actions[]] : K extends "control:any" ? [LogicAction.Actions[]] : K extends "control:all" ? [LogicAction.Actions[]] : K extends "control:parallel" ? [LogicAction.Actions[]] : K extends "control:allAsync" ? [LogicAction.Actions[]] : K extends "control:repeat" ? [LogicAction.Actions[], number] : K extends "control:while" ? [LogicAction.Actions[], Lambda<boolean>] : K extends "control:break" ? [] : K extends "control:sleep" ? [LogicAction.Actions[], number | Awaitable<any> | Promise<any>] : K extends "control:waitForClick" ? [] : any;
120
+ [K in typeof ControlActionTypes[keyof typeof ControlActionTypes]]: K extends "control:do" ? [LogicAction.Actions[]] : K extends "control:doAsync" ? [LogicAction.Actions[]] : K extends "control:any" ? [LogicAction.Actions[]] : K extends "control:all" ? [LogicAction.Actions[]] : K extends "control:parallel" ? [LogicAction.Actions[]] : K extends "control:allAsync" ? [LogicAction.Actions[]] : K extends "control:repeat" ? [LogicAction.Actions[], number] : K extends "control:while" ? [LogicAction.Actions[], Lambda<boolean>] : K extends "control:break" ? [] : K extends "control:sleep" ? [LogicAction.Actions[], number | Awaitable<any> | Promise<any>] : K extends "control:waitForClick" ? [] : K extends "control:label" ? [string] : K extends "control:jump" ? [string] : any;
118
121
  };
119
122
  export declare const TextActionTypes: {
120
123
  readonly action: "text:action";
@@ -150,5 +153,16 @@ export declare const VideoActionTypes: {
150
153
  readonly seek: "video:seek";
151
154
  };
152
155
  export type VideoActionContentType = {
153
- [K in typeof VideoActionTypes[keyof typeof VideoActionTypes]]: K extends "video:action" ? any : K extends "video:show" | "video:hide" | "video:play" | "video:pause" | "video:stop" ? [] : K extends "video:seek" ? [number] : any;
156
+ [K in typeof VideoActionTypes[keyof typeof VideoActionTypes]]: K extends "video:action" ? any : K extends "video:show" | "video:hide" | "video:play" | "video:pause" | "video:stop" | "video:resume" ? [] : K extends "video:seek" ? [number] : any;
157
+ };
158
+ export declare const VfxActionTypes: {
159
+ readonly action: "vfx:action";
160
+ readonly show: "vfx:show";
161
+ readonly hide: "vfx:hide";
162
+ readonly pause: "vfx:pause";
163
+ readonly resume: "vfx:resume";
164
+ readonly setRate: "vfx:setRate";
165
+ };
166
+ export type VfxActionContentType = {
167
+ [K in typeof VfxActionTypes[keyof typeof VfxActionTypes]]: K extends "vfx:action" ? any : K extends "vfx:show" | "vfx:hide" ? [VfxFadeOptions?] : K extends "vfx:pause" | "vfx:resume" ? [] : K extends "vfx:setRate" ? [number] : any;
154
168
  };
@@ -20,6 +20,8 @@ export declare class ControlAction<T extends typeof ControlActionTypes[keyof typ
20
20
  readonly break: "control:break";
21
21
  readonly sleep: "control:sleep";
22
22
  readonly waitForClick: "control:waitForClick";
23
+ readonly label: "control:label";
24
+ readonly jump: "control:jump";
23
25
  };
24
26
  static executeActionsAsync(gameState: GameState, action: LogicAction.Actions): Awaitable<void>;
25
27
  checkActionChain(actions: LogicAction.Actions[]): LogicAction.Actions[];
@@ -0,0 +1,24 @@
1
+ import { VfxActionContentType, VfxActionTypes } from "../../action/actionTypes";
2
+ import { TypedAction } from "../../action/actions";
3
+ import { Vfx } from "../../elements/vfx";
4
+ import { GameState } from "../../../player/gameState";
5
+ import { Awaitable, Values } from "../../../../util/data";
6
+ import type { CalledActionResult } from "../../gameTypes";
7
+ import { ActionExecutionInjection } from "../../action/action";
8
+ import { LogicAction } from "../../action/logicAction";
9
+ import { Story } from "../../elements/story";
10
+ export declare class VfxAction<T extends Values<typeof VfxActionTypes> = Values<typeof VfxActionTypes>> extends TypedAction<VfxActionContentType, T, Vfx> {
11
+ static ActionTypes: {
12
+ readonly action: "vfx:action";
13
+ readonly show: "vfx:show";
14
+ readonly hide: "vfx:hide";
15
+ readonly pause: "vfx:pause";
16
+ readonly resume: "vfx:resume";
17
+ readonly setRate: "vfx:setRate";
18
+ };
19
+ executeAction(gameState: GameState, injection: ActionExecutionInjection): Awaitable<CalledActionResult>;
20
+ private changeStateBase;
21
+ private changeState;
22
+ private changeStateAsync;
23
+ stringify(_story: Story, _seen: Set<LogicAction.Actions>, _strict: boolean): string;
24
+ }
@@ -9,7 +9,7 @@ import type { StringKeyOf, Values } from "../../../util/data";
9
9
  import type { TypedAction } from "../action/actions";
10
10
  import type { Sound } from "../elements/sound";
11
11
  import type { Control } from "../elements/control";
12
- import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ControlActionTypes, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, SoundActionTypes, StoryActionContentType, StoryActionTypes, TextActionContentType, TextActionTypes, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
12
+ import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ControlActionTypes, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, SoundActionTypes, StoryActionContentType, StoryActionTypes, TextActionContentType, TextActionTypes, VfxActionContentType, VfxActionTypes, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
13
13
  import type { CharacterAction } from "../action/actions/characterAction";
14
14
  import type { SceneAction } from "../action/actions/sceneAction";
15
15
  import type { StoryAction } from "../action/actions/storyAction";
@@ -29,24 +29,27 @@ import type { ServiceSkeleton } from "../elements/service";
29
29
  import type { ServiceAction, ServiceActionContentType } from "../action/serviceAction";
30
30
  import type { Layer } from "../elements/layer";
31
31
  import type { LayerAction } from "../action/actions/layerAction";
32
+ import type { Camera } from "../elements/camera";
32
33
  import type { ExposedStateType } from "../../player/type";
33
34
  import type { Video } from "../elements/video";
34
35
  import type { VideoAction } from "../action/actions/videoAction";
36
+ import type { Vfx } from "../elements/vfx";
37
+ import type { VfxAction } from "../action/actions/vfxAction";
35
38
  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 SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | 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;
39
+ DisplayableElements: Text | Image | Layer | Camera | AbstractDisplayable<any, any>;
40
+ DisplayableExposed: ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text | ExposedStateType.camera;
41
+ GameElement: Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | Layer | Camera | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video | Vfx;
42
+ Actions: TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction | VfxAction;
43
+ ActionTypes: Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes> | Values<typeof VfxActionTypes>;
44
+ ActionContents: CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType & VfxActionContentType;
42
45
  }
43
46
  export declare const LogicAction: {};
44
47
  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 SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | 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;
48
+ type DisplayableElements = Text | Image | Layer | Camera | AbstractDisplayable<any, any>;
49
+ type DisplayableExposed = ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text | ExposedStateType.camera;
50
+ type GameElement = Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | Layer | Camera | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video | Vfx;
51
+ type Actions = TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction | VfxAction;
52
+ 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 SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes> | Values<typeof VfxActionTypes>;
53
+ type ActionContents = CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType & VfxActionContentType;
51
54
  }
52
55
  export type LogicAction = typeof LogicAction;
@@ -61,6 +61,34 @@ export type StackModelRawData = {
61
61
  items: StackModelItemData[];
62
62
  loop?: StackModelLoopRawData;
63
63
  };
64
+ /**
65
+ * One frame of a read-only {@link StackModel.snapshot} — an action currently on the execution
66
+ * stack. A frame that is a concurrent group ({@link Control.all}/{@link Control.any}) also lists
67
+ * its branches (each a top-to-bottom frame list).
68
+ *
69
+ * **Experimental / read-only.** For tooling (Studio's call-stack view). The exact shape is not a
70
+ * stable contract and may change; do not serialize it or drive game logic from it.
71
+ */
72
+ export type StackFrameSnapshot = {
73
+ actionId: string | null;
74
+ actionType: string | null;
75
+ branchWaitType?: StackModelWaiting["type"];
76
+ branches?: StackFrameSnapshot[][];
77
+ };
78
+ /**
79
+ * Read-only view of a StackModel's execution stack. `frames` are ordered top-first (the frame
80
+ * currently executing is `frames[0]`). See {@link StackFrameSnapshot} — experimental.
81
+ */
82
+ export type StackSnapshot = {
83
+ tag?: string;
84
+ frames: StackFrameSnapshot[];
85
+ loop?: {
86
+ type: StackModelLoopType;
87
+ counter: number;
88
+ limit?: number;
89
+ broken: boolean;
90
+ };
91
+ };
64
92
  export declare class StackModel {
65
93
  private liveGame;
66
94
  __tag: string | undefined;
@@ -12,12 +12,17 @@ import { Sentence } from "../elements/character/sentence";
12
12
  import { Word } from "../elements/character/word";
13
13
  import { Text } from "../elements/displayable/text";
14
14
  import { Pause } from "../elements/character/pause";
15
+ import { TextEvent } from "../elements/character/textEvent";
15
16
  import { Persistent } from "../elements/persistent";
16
17
  import { Service } from "../elements/service";
17
18
  import { Layer } from "../elements/layer";
19
+ import { Camera } from "../elements/camera";
18
20
  import { Video } from "../elements/video";
21
+ import { Vfx } from "../elements/vfx";
19
22
  import { NVLToken } from "../elements/nvl";
20
- export { Character, Narrator, Condition, Control, Image, Lambda, Menu, NVLToken, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, Persistent, Service, Layer, Video, };
23
+ export { Character, Narrator, Condition, Control, Image, Lambda, Menu, NVLToken, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, TextEvent, Persistent, Service, Layer, Camera, Video, Vfx, };
24
+ export type { VfxConfig, VfxBlendMode, VfxFadeOptions } from "../elements/vfx";
21
25
  export type { LayeredDefinition, LayerGroupDefinition, LayerResolver, LayerSlot, LayerTagsOf, LayerVariants, } from "../elements/displayable/image";
22
26
  export type { SentenceMetadata } from "../elements/character/sentence";
27
+ export type { TextEventAppearance, TextEventConfig, TextEventExpression, } from "../elements/character/textEvent";
23
28
  export type { CharacterPortraitConfig, DialogAvatar, DialogAvatarResolver, DialogAvatarResolverContext, DialogAvatarResolution, DialogAvatarSource, } from "../elements/character/avatar";
@@ -4,6 +4,7 @@ import { Storable, Namespace } from "../elements/persistent/storable";
4
4
  import { LiveGame } from "../game/liveGame";
5
5
  import { Preference } from "../game/preference";
6
6
  import type { SavedGame } from "../gameTypes";
7
+ import type { StackSnapshot, StackFrameSnapshot } from "../action/stackModel";
7
8
  import { KeyMap } from "../game/keyMap";
8
9
  export { LiveGame, GameState, Game, Storable, Namespace, Preference, KeyMap, };
9
- export type { SavedGame, };
10
+ export type { SavedGame, StackSnapshot, StackFrameSnapshot, };
@@ -1,20 +1,19 @@
1
1
  import { Dissolve } from "../elements/transition/transitions/image/dissolve";
2
2
  import { FadeIn } from "../elements/transition/transitions/image/fadeIn";
3
- import { MaskTransition } from "../elements/transition/transitions/image/maskTransition";
4
3
  import { Transition } from "../elements/transition/transition";
5
4
  import { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
6
5
  import { TextTransition } from "../elements/transition/transitions/text/textTransition";
7
- import { SoftWipe } from "../elements/transition/transitions/image/softWipe";
8
- import { Blinds } from "../elements/transition/transitions/image/blinds";
9
- import { SoftIris } from "../elements/transition/transitions/image/softIris";
10
6
  import { BlurDissolve } from "../elements/transition/transitions/image/blurDissolve";
11
7
  import { Push } from "../elements/transition/transitions/image/push";
12
8
  import { ThroughColor } from "../elements/transition/transitions/image/throughColor";
13
- export { Transition, ImageTransition, TextTransition, Dissolve, FadeIn, MaskTransition, SoftWipe, Blinds, SoftIris, BlurDissolve, Push, ThroughColor, };
14
- export type { SoftWipeOptions } from "../elements/transition/transitions/image/softWipe";
15
- export type { BlindsOptions } from "../elements/transition/transitions/image/blinds";
16
- export type { SoftIrisOptions } from "../elements/transition/transitions/image/softIris";
9
+ import { Reveal } from "../elements/transition/transitions/image/reveal";
10
+ import { Mask } from "../elements/transition/transitions/image/mask";
11
+ export { Transition, ImageTransition, TextTransition, Dissolve, FadeIn, BlurDissolve, Push, ThroughColor, Reveal, Mask, };
12
+ export type { DissolveOptions } from "../elements/transition/transitions/image/dissolve";
13
+ export type { FadeInOptions } from "../elements/transition/transitions/image/fadeIn";
17
14
  export type { BlurDissolveOptions } from "../elements/transition/transitions/image/blurDissolve";
18
15
  export type { PushOptions } from "../elements/transition/transitions/image/push";
19
- export type { ThroughColorFadeOptions, ThroughColorWipeOptions, ThroughColorBlindsOptions, ThroughColorIrisOptions, } from "../elements/transition/transitions/image/throughColor";
16
+ export type { ThroughColorOptions, ThroughColorUncover, } from "../elements/transition/transitions/image/throughColor";
17
+ export type { RevealOptions } from "../elements/transition/transitions/image/reveal";
18
+ export type { MaskPattern, WipePatternOptions, BarnDoorPatternOptions, IrisPatternOptions, ClockPatternOptions, FanPatternOptions, BlindsPatternOptions, DotsPatternOptions, } from "../elements/transition/transitions/image/mask";
20
19
  export type { BlindsOrientation } from "../elements/transition/transitions/image/transitionMaskUtils";
@@ -0,0 +1,71 @@
1
+ import { LogicAction } from "../action/logicAction";
2
+ import { TransformDefinitions } from "../elements/transform/type";
3
+ import { Displayable } from "../elements/displayable/displayable";
4
+ import { EventfulDisplayable } from "../../player/elements/displayable/type";
5
+ import { Chained, Proxied } from "../action/chain";
6
+ /**
7
+ * The public constructor config for a {@link Camera}.
8
+ *
9
+ * A camera is transformed exactly like any other displayable, so its initial pose is described
10
+ * with the same {@link TransformDefinitions.ImageTransformProps} fields (position, zoom, scale,
11
+ * rotation, opacity, filter, ...).
12
+ */
13
+ export type ICameraUserConfig = TransformDefinitions.ImageTransformProps;
14
+ /**
15
+ * A stage-wide camera.
16
+ *
17
+ * The camera applies a {@link Transform} (pan / zoom / rotate / scale / opacity) and a
18
+ * darken/color-grade to the **whole stage as a single unit** — every scene, its backgrounds and
19
+ * sprites, and videos move together, while the dialog box, menus and NVL layer stay fixed.
20
+ *
21
+ * A story always has one default camera, reachable as {@link Story.camera}; you rarely construct
22
+ * one yourself. Camera actions are authored like any other displayable action:
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * scene.action([
27
+ * story.camera.zoom(2, 800, "easeInOut"), // zoom the whole stage in
28
+ * story.camera.pan({ xalign: 0.3 }, 800), // slide the view left
29
+ * story.camera.darken(0.6, 500), // dim the stage
30
+ * jS`It's getting dark...`,
31
+ * story.camera.reset(600), // return to the neutral pose
32
+ * ]);
33
+ * ```
34
+ */
35
+ export declare class Camera extends Displayable<CameraDataRaw, Camera, TransformDefinitions.ImageTransformProps> implements EventfulDisplayable {
36
+ /**
37
+ * Create a camera. A story already owns a default one ({@link Story.camera}); construct your
38
+ * own only to override the initial pose via the story config.
39
+ * @param config - Optional initial pose (zoom, position, rotation, ...).
40
+ * @example
41
+ * ```ts
42
+ * const camera = new Camera({ zoom: 1.2 });
43
+ * const story = new Story("entry", { camera });
44
+ * ```
45
+ */
46
+ constructor(config?: Partial<ICameraUserConfig>);
47
+ /**
48
+ * Pan the camera so the given position sits at the centre of the view.
49
+ *
50
+ * Alias of {@link Displayable.pos} with camera-oriented naming.
51
+ * @chainable
52
+ */
53
+ pan(position: TransformDefinitions.ImageTransformProps["position"], duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Camera, Chained<LogicAction.Actions>>;
54
+ /**
55
+ * Darken the whole stage.
56
+ *
57
+ * Uses the same mechanism as {@link Image.darken}: it drives the camera's CSS `filter` to
58
+ * `brightness(1 - darkness)`. Because darken shares the single `filter` channel, combining it
59
+ * with other filters (e.g. `blur`) means writing the full filter string yourself via
60
+ * {@link Displayable.filter}.
61
+ * @param darkness - How dark, between `0` (normal) and `1` (black).
62
+ * @chainable
63
+ */
64
+ darken(darkness: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Camera, Chained<LogicAction.Actions, Camera>>;
65
+ /**
66
+ * Return the camera to its neutral pose: centred, zoom `1`, no rotation, fully opaque and no
67
+ * filter (which also clears {@link Camera.darken}).
68
+ * @chainable
69
+ */
70
+ reset(duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied<Camera, Chained<LogicAction.Actions, Camera>>;
71
+ }
@@ -1,5 +1,6 @@
1
1
  import type { Character } from "../../elements/character";
2
2
  import { Pausing } from "../../elements/character/pause";
3
+ import { TextEvent } from "../../elements/character/textEvent";
3
4
  import { Word } from "../../elements/character/word";
4
5
  import type { ScriptCtx } from "../../elements/script";
5
6
  import { Sound } from "../../elements/sound";
@@ -26,7 +27,7 @@ export type SentenceUserConfig = Partial<Omit<SentenceConfig, "voice"> & {
26
27
  }>;
27
28
  export type DynamicWord = (ctx: ScriptCtx) => DynamicWordResult;
28
29
  export type DynamicWordResult = string | Word | Pausing | (string | Word | Pausing)[];
29
- export type StaticWord<T extends string | DynamicWord | Pausing = string | DynamicWord | Pausing> = string | Pausing | Word<T>;
30
+ export type StaticWord<T extends string | DynamicWord | Pausing | TextEvent = string | DynamicWord | Pausing | TextEvent> = string | Pausing | TextEvent | Word<T>;
30
31
  export type SingleWord = StaticWord | DynamicWord;
31
32
  export type SentencePrompt = SingleWord[] | SingleWord;
32
33
  export declare class Sentence {
@@ -0,0 +1,67 @@
1
+ import type { Color, ImageSrc } from "../../types";
2
+ import type { Image } from "../../elements/displayable/image";
3
+ import type { Sound } from "../../elements/sound";
4
+ /**
5
+ * The appearance a text-event may switch a character/image to when the typewriter reaches it.
6
+ * Mirrors the runtime forms {@link Image.char} accepts: a tag list (array), or a static
7
+ * `src`/`Color`. A bare string is treated as a `src` (as with `char`), so tag switches must be an
8
+ * array (e.g. `["happy"]`).
9
+ */
10
+ export type TextEventAppearance = ImageSrc | Color | string[];
11
+ /**
12
+ * A character-expression effect: switch `image` to `appearance` (no transition — the swap is
13
+ * instant, applied directly to the element the moment the typewriter reveals this point).
14
+ */
15
+ export type TextEventExpression = {
16
+ image: Image;
17
+ appearance: TextEventAppearance;
18
+ };
19
+ /**
20
+ * The (deliberately restricted) closed set of effects a first-version text-event may carry:
21
+ * a character-expression switch and/or a sound effect. It is NOT a general action escape hatch —
22
+ * the effect is applied directly to element state, never pushed onto the execution stack.
23
+ */
24
+ export type TextEventConfig = {
25
+ expression?: TextEventExpression;
26
+ sound?: Sound;
27
+ };
28
+ /**
29
+ * An inline dialogue token that fires a restricted side effect when the typewriter reveals it —
30
+ * the text analogue of {@link Pause}. Unlike a normal {@link Word} it renders nothing; unlike an
31
+ * action it never enters the stack model, so it adds no save burden. Its effect rides on the
32
+ * ordinary element state (which IS serialized) and re-fires naturally when the owning `say` action
33
+ * is re-evaluated.
34
+ *
35
+ * First version carries a closed set: a character-expression switch and/or a sound effect.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // switch Alice's portrait to "angry" the moment the typewriter reaches this point
40
+ * character.say(["Don't ", TextEvent.expression(alice, ["angry"]), "test me."]);
41
+ * // play a sting, no expression change
42
+ * character.say(["...", TextEvent.sound(sting)]);
43
+ * ```
44
+ */
45
+ export declare class TextEvent {
46
+ /**
47
+ * Build a text-event that switches an image's appearance (a character portrait/expression)
48
+ * when the typewriter reveals it, optionally alongside a sound effect.
49
+ * @param image - The image whose appearance is switched.
50
+ * @param appearance - Tag list (e.g. `["happy"]`) or a static `src`/`Color`.
51
+ * @param options - Optional extras; `sound` plays a sound effect at the same point.
52
+ */
53
+ static expression(image: Image, appearance: TextEventAppearance, options?: {
54
+ sound?: Sound;
55
+ }): TextEvent;
56
+ /**
57
+ * Build a text-event that only plays a sound effect when the typewriter reveals it.
58
+ * @param sound - The sound effect to play.
59
+ */
60
+ static sound(sound: Sound): TextEvent;
61
+ /**
62
+ * Build a text-event from an explicit effect descriptor. Prefer the {@link TextEvent.expression}
63
+ * / {@link TextEvent.sound} factories for the common cases.
64
+ * @param config - The closed-set effect descriptor.
65
+ */
66
+ constructor(config: TextEventConfig);
67
+ }
@@ -1,6 +1,7 @@
1
1
  import { Color, Font } from "../../types";
2
2
  import { DynamicWord } from "../../elements/character/sentence";
3
3
  import { Pausing } from "../../elements/character/pause";
4
+ import { TextEvent } from "../../elements/character/textEvent";
4
5
  export type WordConfig = {
5
6
  className: string;
6
7
  ruby: string;
@@ -8,7 +9,7 @@ export type WordConfig = {
8
9
  pause: boolean;
9
10
  cps?: number;
10
11
  } & Font;
11
- export declare class Word<T extends string | DynamicWord | Pausing = string | DynamicWord | Pausing> {
12
+ export declare class Word<T extends string | DynamicWord | Pausing | TextEvent = string | DynamicWord | Pausing | TextEvent> {
12
13
  static isWord(obj: any): obj is Word;
13
14
  /**
14
15
  * Create a word with an explicit color or re-color an existing word.
@@ -25,6 +25,11 @@ export declare class Control extends Actionable {
25
25
  static doAsync(actions: ActionStatements): ChainedControl;
26
26
  /**
27
27
  * Execute actions concurrently, resolving once any finishes.
28
+ *
29
+ * Each entry runs as its own parallel branch, so a single chained statement (e.g.
30
+ * `image.pos(a).pos(b)`) is split into multiple branches and they will conflict when
31
+ * they target the same element. Wrap sequential steps in `Control.do([...])` to keep
32
+ * them in one branch.
28
33
  * @param actions - Actions to run in parallel.
29
34
  * @chainable
30
35
  * @example
@@ -35,6 +40,11 @@ export declare class Control extends Actionable {
35
40
  static any(actions: ActionStatements): ChainedControl;
36
41
  /**
37
42
  * Execute actions concurrently and wait until all finish.
43
+ *
44
+ * Each entry runs as its own parallel branch, so a single chained statement (e.g.
45
+ * `image.pos(a).pos(b)`) is split into multiple branches and they will conflict when
46
+ * they target the same element. Wrap sequential steps in `Control.do([...])` to keep
47
+ * them in one branch.
38
48
  * @param actions - Actions to run at the same time.
39
49
  * @chainable
40
50
  * @example
@@ -45,6 +55,11 @@ export declare class Control extends Actionable {
45
55
  static all(actions: ActionStatements): ChainedControl;
46
56
  /**
47
57
  * Execute actions concurrently and continue without waiting.
58
+ *
59
+ * Each entry runs as its own parallel branch, so a single chained statement (e.g.
60
+ * `image.pos(a).pos(b)`) is split into multiple branches and they will conflict when
61
+ * they target the same element. Wrap sequential steps in `Control.do([...])` to keep
62
+ * them in one branch.
48
63
  * @param actions - Actions to fire simultaneously.
49
64
  * @chainable
50
65
  */
@@ -89,6 +104,43 @@ export declare class Control extends Actionable {
89
104
  * ```
90
105
  */
91
106
  static waitForClick(): ChainedControl;
107
+ /**
108
+ * Mark a named point inside the current scene that {@link Control.jump} can jump to.
109
+ * A label is invisible at runtime — it simply passes through to the next action.
110
+ *
111
+ * Label names are scoped to the scene they are declared in, so the same name may be
112
+ * reused across different scenes. Declaring the same name twice in one scene is an error.
113
+ * @param name - The label name, unique within its scene.
114
+ * @chainable
115
+ * @example
116
+ * ```ts
117
+ * scene.action([
118
+ * Control.label("intro"),
119
+ * character.say("Let's begin."),
120
+ * ]);
121
+ * ```
122
+ */
123
+ static label(name: string): ChainedControl;
124
+ /**
125
+ * Jump to a {@link Control.label} elsewhere in the same scene and resume playing from there.
126
+ *
127
+ * Unlike {@link Scene.jumpTo}, this stays inside the current scene — no scene is unloaded or
128
+ * re-initialized, only the play head moves. The jump target must be a label declared in the
129
+ * same scene, otherwise the story fails to build.
130
+ * @param name - The name of the target label, declared in the same scene.
131
+ * @chainable
132
+ * @example
133
+ * ```ts
134
+ * scene.action([
135
+ * Control.label("start"),
136
+ * menu("Again?", [
137
+ * choice("Yes", [Control.jump("start")]),
138
+ * choice("No", []),
139
+ * ]),
140
+ * ]);
141
+ * ```
142
+ */
143
+ static jump(name: string): ChainedControl;
92
144
  constructor(/**@internal */ config?: Partial<ControlConfig>);
93
145
  /**
94
146
  * Execute actions in order, waiting for each action to complete
@@ -141,4 +193,14 @@ export declare class Control extends Actionable {
141
193
  * @chainable
142
194
  */
143
195
  waitForClick(): ChainedControl;
196
+ /**
197
+ * Mark a named point inside the current scene that {@link Control.jump} can jump to.
198
+ * @chainable
199
+ */
200
+ label(name: string): ChainedControl;
201
+ /**
202
+ * Jump to a {@link Control.label} in the same scene and resume playing from there.
203
+ * @chainable
204
+ */
205
+ jump(name: string): ChainedControl;
144
206
  }
@@ -104,11 +104,11 @@ export declare class Image<Tags extends TagGroupDefinition | null = TagGroupDefi
104
104
  * - Static image: the src will be a string or StaticImageData
105
105
  * @example
106
106
  * ```ts
107
- * image.char("path/to/image.png", new Dissolve(1000));
107
+ * image.char("path/to/image.png", new Dissolve({duration: 1000}));
108
108
  * ```
109
109
  * @example
110
110
  * ```ts
111
- * image.char(["happy", "t-shirt", "shorts"], new Dissolve(1000));
111
+ * image.char(["happy", "t-shirt", "shorts"], new Dissolve({duration: 1000}));
112
112
  * ```
113
113
  * @chainable
114
114
  */
@@ -51,7 +51,7 @@ export declare class Scene extends Constructable<LogicAction.Actions, Scene> {
51
51
  * @example
52
52
  * ```ts
53
53
  * scene.action([
54
- * scene.setBackground("#000", new FadeIn(1000))
54
+ * scene.setBackground("#000", new FadeIn({duration: 1000}))
55
55
  * ]);
56
56
  * ```
57
57
  */
@@ -66,7 +66,7 @@ export declare class Scene extends Constructable<LogicAction.Actions, Scene> {
66
66
  * @example
67
67
  * ```ts
68
68
  * scene.action([
69
- * scene.jumpTo(nextScene, new FadeIn(800))
69
+ * scene.jumpTo(nextScene, new FadeIn({duration: 800}))
70
70
  * ]);
71
71
  * ```
72
72
  */
@@ -3,6 +3,7 @@ import { Scene } from "../elements/scene";
3
3
  import { SceneAction } from "../action/actions/sceneAction";
4
4
  import { Persistent, PersistentContent } from "../elements/persistent";
5
5
  import { Service } from "../elements/service";
6
+ import { Camera } from "../elements/camera";
6
7
  export declare enum Origins {
7
8
  topLeft = "top left",
8
9
  topRight = "top right",
@@ -11,9 +12,28 @@ export declare enum Origins {
11
12
  }
12
13
  export interface IStoryConfig {
13
14
  origin: Origins;
15
+ /**
16
+ * The story's stage {@link Camera}. Omit to use a default camera; provide one only to set the
17
+ * initial pose. There is exactly one camera per story.
18
+ */
19
+ camera?: Camera;
14
20
  }
15
21
  export declare class Story extends Constructable<SceneAction<"scene:action">, Story> {
16
- constructor(name: string, config?: IStoryConfig);
22
+ constructor(name: string, config?: Partial<IStoryConfig>);
23
+ /**
24
+ * The story's stage camera.
25
+ *
26
+ * A single {@link Camera} that applies a transform and darken/color-grade to the whole stage
27
+ * as one unit, persisting across scene changes. Author camera actions like any other element:
28
+ * @example
29
+ * ```ts
30
+ * scene.action([
31
+ * story.camera.zoom(1.5, 600),
32
+ * story.camera.darken(0.5, 400),
33
+ * ]);
34
+ * ```
35
+ */
36
+ get camera(): Camera;
17
37
  /**
18
38
  * Set the entry scene of the story
19
39
  * @example
@@ -2,18 +2,25 @@ import { TransitionAnimationType, TransitionTask } from "../../../../elements/tr
2
2
  import { TransformDefinitions } from "../../../../elements/transform/type";
3
3
  import { ImageTransition } from "../../../../elements/transition/transitions/image/imageTransition";
4
4
  type AnimationType = [TransitionAnimationType.Number];
5
+ export type DarknessOptions = {
6
+ /** Darkness (0–1) the image starts from. */
7
+ from: number;
8
+ /** Darkness (0–1) the image ends at. */
9
+ to: number;
10
+ /** Duration in milliseconds. */
11
+ duration: number;
12
+ easing?: TransformDefinitions.EasingDefinition;
13
+ };
14
+ /**
15
+ * Darken the original image and fade in the target image at the same time.
16
+ * Internal: drives `image.darken(x, duration)`.
17
+ */
5
18
  export declare class Darkness extends ImageTransition<AnimationType> {
6
- private prevDarkness;
7
- private targetDarkness;
19
+ private from;
20
+ private to;
8
21
  private duration;
9
22
  private easing?;
10
- /**
11
- * Darken the original image and fade in the target image at the same time.
12
- * @param darkness darkness of the image, between 0 and 1
13
- * @param duration duration in milliseconds
14
- * @param easing easing definition or existing easing name
15
- */
16
- constructor(prevDarkness: number, targetDarkness: number, duration: number, easing?: TransformDefinitions.EasingDefinition | undefined);
23
+ constructor(options: DarknessOptions);
17
24
  createTask(): TransitionTask<HTMLImageElement, AnimationType>;
18
25
  copy(): Darkness;
19
26
  }
@@ -2,15 +2,18 @@ import { TransitionAnimationType, TransitionTask } from "../../../../elements/tr
2
2
  import { TransformDefinitions } from "../../../../elements/transform/type";
3
3
  import { ImageTransition } from "../../../../elements/transition/transitions/image/imageTransition";
4
4
  type AnimationType = [TransitionAnimationType.Number];
5
+ export type DissolveOptions = {
6
+ /** Duration in milliseconds. */
7
+ duration: number;
8
+ easing?: TransformDefinitions.EasingDefinition;
9
+ };
10
+ /**
11
+ * Fade out the original image and fade in the target image at the same time.
12
+ */
5
13
  export declare class Dissolve extends ImageTransition<AnimationType> {
6
14
  private duration;
7
15
  private easing?;
8
- /**
9
- * Fade out the original image and fade in the target image at the same time.
10
- * @param duration duration in milliseconds
11
- * @param easing easing definition or existing easing name
12
- */
13
- constructor(duration: number, easing?: TransformDefinitions.EasingDefinition | undefined);
16
+ constructor(options: DissolveOptions);
14
17
  createTask(): TransitionTask<HTMLImageElement, AnimationType>;
15
18
  copy(): Dissolve;
16
19
  }