narraleaf-react 0.9.0-beta.5 → 0.9.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 (56) hide show
  1. package/LICENSE +373 -373
  2. package/README.md +165 -147
  3. package/dist/built-in.d.ts +3 -0
  4. package/dist/built-in.js +1 -0
  5. package/dist/game/nlcore/action/action.d.ts +9 -5
  6. package/dist/game/nlcore/action/actionTypes.d.ts +21 -12
  7. package/dist/game/nlcore/action/actions/controlAction.d.ts +1 -0
  8. package/dist/game/nlcore/action/actions/menuAction.d.ts +1 -4
  9. package/dist/game/nlcore/action/actions/sceneAction.d.ts +7 -2
  10. package/dist/game/nlcore/action/logicAction.d.ts +29 -29
  11. package/dist/game/nlcore/action/stackModel.d.ts +1 -1
  12. package/dist/game/nlcore/common/elements.d.ts +5 -2
  13. package/dist/game/nlcore/common/transition.d.ts +2 -1
  14. package/dist/game/nlcore/elements/built-in/DevTools.d.ts +2 -0
  15. package/dist/game/nlcore/elements/built-in/built-in.d.ts +2 -0
  16. package/dist/game/nlcore/elements/built-in/screenEffects.d.ts +31 -0
  17. package/dist/game/nlcore/elements/character/avatar.d.ts +35 -0
  18. package/dist/game/nlcore/elements/character/sentence.d.ts +14 -0
  19. package/dist/game/nlcore/elements/character.d.ts +30 -0
  20. package/dist/game/nlcore/elements/control.d.ts +15 -0
  21. package/dist/game/nlcore/elements/displayable/displayable.d.ts +84 -0
  22. package/dist/game/nlcore/elements/displayable/image.d.ts +2 -2
  23. package/dist/game/nlcore/elements/displayable/text.d.ts +2 -2
  24. package/dist/game/nlcore/elements/layer.d.ts +1 -2
  25. package/dist/game/nlcore/elements/nvl.d.ts +41 -0
  26. package/dist/game/nlcore/elements/scene.d.ts +29 -1
  27. package/dist/game/nlcore/elements/transform/transform.d.ts +26 -3
  28. package/dist/game/nlcore/elements/transform/type.d.ts +30 -2
  29. package/dist/game/nlcore/elements/transition/transitions/image/maskTransition.d.ts +38 -0
  30. package/dist/game/nlcore/gameTypes.d.ts +6 -1
  31. package/dist/game/player/Tasks.d.ts +4 -1
  32. package/dist/game/player/elements/Player.d.ts +1 -1
  33. package/dist/game/player/elements/elements.d.ts +2 -0
  34. package/dist/game/player/elements/menu/type.d.ts +1 -0
  35. package/dist/game/player/elements/nvl/DefaultNvlContainer.d.ts +4 -0
  36. package/dist/game/player/elements/nvl/NvlContainer.d.ts +5 -0
  37. package/dist/game/player/elements/nvl/NvlContext.d.ts +13 -0
  38. package/dist/game/player/elements/nvl/NvlDialogList.d.ts +7 -0
  39. package/dist/game/player/elements/nvl/type.d.ts +49 -0
  40. package/dist/game/player/elements/nvl/useNvlDialogState.d.ts +14 -0
  41. package/dist/game/player/elements/player/StageClickAnnouncer.d.ts +1 -0
  42. package/dist/game/player/elements/say/Avatar.d.ts +13 -0
  43. package/dist/game/player/elements/say/Nametag.d.ts +8 -1
  44. package/dist/game/player/elements/say/Sentence.d.ts +79 -2
  45. package/dist/game/player/elements/say/UIDialog.d.ts +6 -2
  46. package/dist/game/player/elements/say/type.d.ts +4 -2
  47. package/dist/game/player/elements/say/useDialog.d.ts +3 -0
  48. package/dist/game/player/elements/type.d.ts +10 -0
  49. package/dist/game/player/gameState.d.ts +134 -0
  50. package/dist/game/player/lib/AudioManager.d.ts +1 -0
  51. package/dist/game/player/lib/ErrorFallback.d.ts +5 -1
  52. package/dist/game/player/libElements.d.ts +9 -2
  53. package/dist/game/player/provider/game-state.d.ts +1 -0
  54. package/dist/main.js +45 -43
  55. package/dist/util/data.d.ts +15 -2
  56. package/package.json +12 -5
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { INvlContainerProps } from "./type";
3
+ export declare function DefaultNvlContainer({ renderDialogItem, dialogs }: INvlContainerProps): React.JSX.Element;
4
+ export default DefaultNvlContainer;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { NvlContainerProps, INvlContainerProps } from "./type";
3
+ export declare function NvlContainer({ children, className, style }: NvlContainerProps): React.JSX.Element;
4
+ export declare function BaseNvlContainer({ renderDialogItem: _renderDialogItem, ...props }: INvlContainerProps & NvlContainerProps): React.JSX.Element;
5
+ export default NvlContainer;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { NvlDialogEntry } from "../../gameState";
3
+ import { NvlContextValue } from "./type";
4
+ declare const NvlContext: React.Context<NvlContextValue>;
5
+ export declare function useNvl(): NvlContextValue;
6
+ export declare function useNvlDialogs(): NvlDialogEntry[];
7
+ export declare function useIsNvlMode(): boolean;
8
+ export declare function useIsNvlVisible(): boolean;
9
+ export interface NvlProviderProps {
10
+ children: React.ReactNode;
11
+ }
12
+ export declare function NvlProvider({ children }: NvlProviderProps): React.JSX.Element;
13
+ export default NvlContext;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { NvlDialogListProps, NvlDialogItemProps } from "./type";
3
+ export declare function NvlDialogList({ children, className, style, renderDialogItem }: NvlDialogListProps): React.JSX.Element;
4
+ export declare function DefaultNvlDialogItem({ entry, index, className, style, texts }: NvlDialogItemProps & {
5
+ texts?: React.ReactNode;
6
+ }): React.JSX.Element;
7
+ export default NvlDialogList;
@@ -0,0 +1,49 @@
1
+ import type { GameState, NvlDialogEntry, NvlState } from "../../gameState";
2
+ import type { TransformDefinitions } from "../../../nlcore/elements/transform/type";
3
+ import type { Word } from "../../../nlcore/elements/character/word";
4
+ import type { Pausing } from "../../../nlcore/elements/character/pause";
5
+ import React from "react";
6
+ export type NvlDialogProxy = {
7
+ entry: NvlDialogEntry;
8
+ index: number;
9
+ isActive: boolean;
10
+ gameState: GameState;
11
+ words: Word<Pausing | string>[];
12
+ useTypeEffect: boolean;
13
+ };
14
+ export interface INvlContainerProps {
15
+ dialogs?: NvlDialogProxy[];
16
+ renderDialogItem?: NvlDialogItemRenderer;
17
+ }
18
+ export interface NvlContainerProps {
19
+ children?: React.ReactNode;
20
+ className?: string;
21
+ style?: React.CSSProperties;
22
+ }
23
+ export interface NvlDialogListProps {
24
+ children?: React.ReactNode;
25
+ className?: string;
26
+ style?: React.CSSProperties;
27
+ renderDialogItem?: NvlDialogItemRenderer;
28
+ }
29
+ export interface NvlDialogItemProps {
30
+ entry: NvlDialogEntry;
31
+ index: number;
32
+ className?: string;
33
+ style?: React.CSSProperties;
34
+ }
35
+ export interface NvlDialogItemRenderProps {
36
+ entry: NvlDialogEntry;
37
+ index: number;
38
+ isActive: boolean;
39
+ nametag: React.ReactNode;
40
+ texts: React.ReactNode;
41
+ }
42
+ export type NvlDialogItemRenderer = (props: NvlDialogItemRenderProps) => React.ReactNode;
43
+ export interface NvlContextValue {
44
+ state: NvlState;
45
+ dialogs: NvlDialogEntry[];
46
+ isActive: boolean;
47
+ isVisible: boolean;
48
+ transitionOptions: Partial<TransformDefinitions.CommonTransformProps> | null;
49
+ }
@@ -0,0 +1,14 @@
1
+ import { DialogState } from "../say/UIDialog";
2
+ import { GameState } from "../../gameState";
3
+ import type { NvlDialogEntry } from "../../gameState";
4
+ import type { Word } from "../../../nlcore/elements/character/word";
5
+ import type { Pausing } from "../../../nlcore/elements/character/pause";
6
+ type UseNvlDialogStateParams = {
7
+ entry: NvlDialogEntry;
8
+ gameState: GameState;
9
+ words: Word<Pausing | string>[];
10
+ isActive: boolean;
11
+ useTypeEffect: boolean;
12
+ };
13
+ export declare function useNvlDialogState({ entry, gameState, words, isActive, useTypeEffect, }: UseNvlDialogStateParams): DialogState;
14
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Character } from "../../../nlcore/elements/character";
2
+ import type { Image } from "../../../nlcore/elements/displayable/image";
3
+ import React from "react";
4
+ export type DialogAvatarContext = {
5
+ visible: boolean;
6
+ src: string | null;
7
+ character: Character | null;
8
+ portrait: Image | null;
9
+ alt: string;
10
+ };
11
+ export declare function useAvatar(): DialogAvatarContext;
12
+ export declare function Avatar({ className, style, alt, ...props }: React.ImgHTMLAttributes<HTMLImageElement>): React.JSX.Element | null;
13
+ export default Avatar;
@@ -1,2 +1,9 @@
1
1
  import React from "react";
2
- export default function Nametag({ ...props }: Readonly<React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;
2
+ import type { Character } from "../../../nlcore/elements/character";
3
+ import type { NvlDialogEntry } from "../../gameState";
4
+ type NametagProps = React.HTMLAttributes<HTMLDivElement> & {
5
+ entry?: NvlDialogEntry;
6
+ character?: Character | null;
7
+ };
8
+ export default function Nametag({ entry, character, ...props }: Readonly<NametagProps>): React.JSX.Element;
9
+ export {};
@@ -1,11 +1,12 @@
1
1
  import { Pausing } from "../../../nlcore/elements/character/pause";
2
- import { Sentence } from "../../../nlcore/elements/character/sentence";
2
+ import { Sentence, type StaticWord } from "../../../nlcore/elements/character/sentence";
3
3
  import { Word } from "../../../nlcore/elements/character/word";
4
4
  import { GameState } from "../../../../game/nlcore/common/game";
5
5
  import { Color } from "../../../../game/nlcore/types";
6
6
  import React from "react";
7
7
  import { DialogElementProps } from "./type";
8
8
  import { DialogState } from "./UIDialog";
9
+ import type { NvlDialogEntry } from "../../gameState";
9
10
  type BaseTextsProps = {
10
11
  /**
11
12
  * The default color of the text
@@ -15,6 +16,74 @@ type BaseTextsProps = {
15
16
  style?: React.CSSProperties;
16
17
  dialog?: DialogState;
17
18
  } & React.HTMLAttributes<HTMLDivElement>;
19
+ export type TextsPreviewInput = StaticWord<string | Pausing> | StaticWord<string | Pausing>[];
20
+ export type TextsPreviewLoop = boolean | {
21
+ /**
22
+ * Whether the preview restarts after the current type effect completes.
23
+ * @default true
24
+ */
25
+ enabled?: boolean;
26
+ /**
27
+ * Delay before the next preview cycle starts, in milliseconds.
28
+ * @default 1000
29
+ */
30
+ delay?: number;
31
+ };
32
+ export interface TextsPreviewProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
33
+ /**
34
+ * Static text or words to preview.
35
+ */
36
+ text?: TextsPreviewInput;
37
+ /**
38
+ * Sentence to preview. Dynamic words are not evaluated; pass `words` when
39
+ * previewing already-evaluated runtime content.
40
+ */
41
+ sentence?: Sentence;
42
+ /**
43
+ * Already-evaluated words, useful when previewing dynamic sentence content.
44
+ */
45
+ words?: Word<Pausing | string>[];
46
+ /**
47
+ * Whether the preview should use the rolling type effect.
48
+ * @default true
49
+ */
50
+ useTypeEffect?: boolean;
51
+ /**
52
+ * Loop behavior for settings screens and other static previews.
53
+ * @default true
54
+ */
55
+ loop?: TextsPreviewLoop;
56
+ /**
57
+ * Delay before replay when `loop` is `true`, in milliseconds.
58
+ * Ignored when `loop` is an object with `delay`.
59
+ * @default 1000
60
+ */
61
+ restartDelay?: number;
62
+ /**
63
+ * Characters per second used by the preview.
64
+ * @default current game's `cps` preference, or Game.DefaultPreference.cps outside GameProvider
65
+ */
66
+ cps?: number;
67
+ /**
68
+ * Speed multiplier used by the preview.
69
+ * @default current game's `gameSpeed` preference, or Game.DefaultPreference.gameSpeed outside GameProvider
70
+ */
71
+ gameSpeed?: number;
72
+ /**
73
+ * Duration for a pause without an explicit duration, in milliseconds.
74
+ * @default current game's `autoForwardDefaultPause` config, or Game.DefaultConfig.autoForwardDefaultPause outside GameProvider
75
+ */
76
+ pauseDuration?: number;
77
+ /**
78
+ * Fallback color when neither the word nor the sentence defines one.
79
+ */
80
+ defaultColor?: Color;
81
+ fontSize?: React.CSSProperties["fontSize"];
82
+ fontWeight?: React.CSSProperties["fontWeight"];
83
+ fontWeightBold?: React.CSSProperties["fontWeight"];
84
+ fontFamily?: React.CSSProperties["fontFamily"];
85
+ onCompleted?: () => void;
86
+ }
18
87
  /**
19
88
  * Props-based wrapper component
20
89
  * Provides a clean interface for direct prop usage
@@ -28,10 +97,18 @@ export interface TextsProps extends DialogElementProps {
28
97
  count?: number;
29
98
  words?: Word<Pausing | string>[];
30
99
  }
100
+ export type EntryTextsProps = BaseTextsProps & {
101
+ entry: NvlDialogEntry;
102
+ gameState: GameState;
103
+ words: Word<Pausing | string>[];
104
+ useTypeEffect: boolean;
105
+ isActive: boolean;
106
+ };
107
+ export declare function TextsPreview({ text, sentence, words, useTypeEffect, loop, restartDelay, cps, gameSpeed, pauseDuration, defaultColor, className, style, fontSize, fontWeight, fontWeightBold, fontFamily, onCompleted, ...props }: TextsPreviewProps): React.JSX.Element;
31
108
  export declare function RawTexts(props: BaseTextsProps): React.JSX.Element;
32
109
  /**
33
110
  * Context-based wrapper component
34
111
  * Provides integration with the sentence context
35
112
  */
36
- export declare function Texts(props: BaseTextsProps): React.JSX.Element;
113
+ export declare function Texts(props: BaseTextsProps | EntryTextsProps): React.JSX.Element;
37
114
  export default Texts;
@@ -6,7 +6,7 @@ import React from "react";
6
6
  import { DialogAction, DialogStateType, SayElementProps } from "./type";
7
7
  type DialogEvents = {
8
8
  "event:dialog.requestComplete": [];
9
- "event:dialog.complete": [force: boolean];
9
+ "event:dialog.complete": [force?: boolean];
10
10
  "event:dialog.forceSkip": [];
11
11
  "event:dialog.onFlush": [];
12
12
  "event:dialog.simulateClick": [];
@@ -16,6 +16,7 @@ type DialogStateConfig = {
16
16
  action: DialogAction;
17
17
  evaluatedWords: Word<Pausing | string>[];
18
18
  gameState: GameState;
19
+ suppressInitialAnimation?: boolean;
19
20
  };
20
21
  export declare class DialogState {
21
22
  static Events: {
@@ -31,12 +32,15 @@ export declare class DialogState {
31
32
  private _count;
32
33
  private _forceSkipped;
33
34
  private _idle;
35
+ private _active;
34
36
  private autoForwardScheduler;
35
37
  constructor(config: DialogStateConfig);
36
38
  get state(): DialogStateType;
37
39
  get deps(): React.DependencyList;
38
40
  isIdle(): boolean;
39
41
  setIdle(idle: boolean): void;
42
+ isActive(): boolean;
43
+ setActive(active: boolean): this;
40
44
  /**
41
45
  * Only for dialog component to call
42
46
  *
@@ -68,5 +72,5 @@ export declare class DialogState {
68
72
  safeEmit(event: keyof DialogEvents, ...args: DialogEvents[keyof DialogEvents]): this;
69
73
  private scheduleAutoForward;
70
74
  }
71
- export default function PlayerDialog({ action, onFinished, useTypeEffect, gameState, }: Readonly<SayElementProps>): React.JSX.Element;
75
+ export default function PlayerDialog({ action, onFinished, useTypeEffect, gameState, active, }: Readonly<SayElementProps>): React.JSX.Element;
72
76
  export {};
@@ -4,6 +4,7 @@ import { Sentence } from "../../../nlcore/elements/character/sentence";
4
4
  import { Word } from "../../../nlcore/elements/character/word";
5
5
  import { Pausing } from "../../../nlcore/elements/character/pause";
6
6
  import React from "react";
7
+ import type { HTMLMotionProps } from "motion/react";
7
8
  export interface SayElementProps {
8
9
  action: {
9
10
  sentence: Sentence | null;
@@ -19,12 +20,13 @@ export interface SayElementProps {
19
20
  onFinished?: (skiped?: boolean) => void;
20
21
  useTypeEffect?: boolean;
21
22
  gameState: GameState;
23
+ active?: boolean;
22
24
  }
23
25
  export interface IDialogProps {
24
26
  }
25
27
  export type DialogProps = {
26
- children: React.ReactNode;
27
- } & React.HTMLAttributes<HTMLDivElement>;
28
+ children?: React.ReactNode;
29
+ } & HTMLMotionProps<"div">;
28
30
  export type DialogElementProps = {
29
31
  children?: never;
30
32
  } & React.HTMLAttributes<HTMLDivElement>;
@@ -1,3 +1,4 @@
1
+ import type { SentenceMetadata } from "../../../nlcore/elements/character/sentence";
1
2
  /**
2
3
  * Represents the context of a dialog, containing information about its completion status
3
4
  * and the text content.
@@ -9,6 +10,8 @@ export type DialogContext = {
9
10
  text: string;
10
11
  /** Whether the dialog is the narrator */
11
12
  isNarrator: boolean;
13
+ /** User-provided runtime metadata from the current sentence, if any */
14
+ metadata?: SentenceMetadata;
12
15
  };
13
16
  /**
14
17
  * A custom hook that provides access to the current dialog's state and content.
@@ -8,16 +8,20 @@ import { GameState } from "../gameState";
8
8
  import { Storable } from "../../nlcore/elements/persistent/storable";
9
9
  import { LiveGame } from "../../nlcore/game/liveGame";
10
10
  import { INotificationsProps, NotificationsProps } from "./notification/type";
11
+ import { INvlContainerProps } from "./nvl/type";
11
12
  export type Components<T extends Record<string, any>> = (props: Readonly<T>) => React.JSX.Element;
12
13
  export type SayComponent = Components<IDialogProps>;
13
14
  export type MenuComponent = Components<IUserMenuProps>;
14
15
  export type NotificationComponent = Components<INotificationsProps>;
16
+ export type NvlDialogComponent = Components<INvlContainerProps>;
15
17
  export type ComponentsTypes = {
16
18
  say: SayComponent;
17
19
  menu: MenuComponent;
18
20
  notification: NotificationComponent;
21
+ nvlDialog: NvlDialogComponent;
19
22
  };
20
23
  export type { SayElementProps, MenuElementProps, NotificationsProps as INotificationProps, };
24
+ export type { INvlContainerProps, NvlDialogItemRenderProps } from "./nvl/type";
21
25
  export type PlayerEventContext = {
22
26
  game: Game;
23
27
  gameState: GameState;
@@ -35,6 +39,12 @@ export interface PlayerProps {
35
39
  * only called each lifecycle once
36
40
  */
37
41
  onReady?: (ctx: PlayerEventContext) => void;
42
+ /**
43
+ * Once the internal preload pass is ready and the Player has committed that state.
44
+ *
45
+ * only called each lifecycle once
46
+ */
47
+ onPreloadedReady?: (ctx: PlayerEventContext) => void;
38
48
  /**
39
49
  * Once the game is ended
40
50
  *
@@ -10,6 +10,7 @@ import { Storable } from "../nlcore/elements/persistent/storable";
10
10
  import { Game } from "../nlcore/game";
11
11
  import { Clickable, MenuElement, TextElement } from "./gameState.type";
12
12
  import { Sentence } from "../nlcore/elements/character/sentence";
13
+ import { type SceneSnapshot } from "../nlcore/action/actions/sceneAction";
13
14
  import { Logger } from "../../util/logger";
14
15
  import { Story } from "../nlcore/elements/story";
15
16
  import { LiveGame } from "../nlcore/game/liveGame";
@@ -24,6 +25,29 @@ import { Timelines } from "./Tasks";
24
25
  import { Notification, NotificationManager } from "./lib/notification";
25
26
  import { ActionHistoryManager } from "../../game/nlcore/action/actionHistory";
26
27
  import { GameHistoryManager } from "../../game/nlcore/action/gameHistory";
28
+ import type { Character } from "../nlcore/elements/character";
29
+ import type { TransformDefinitions } from "../nlcore/elements/transform/type";
30
+ import type { NvlBlockOptions } from "../nlcore/action/actionTypes";
31
+ import { type NormalizedCharacterPortraitConfig } from "../nlcore/elements/character/avatar";
32
+ export type NvlDialogEntry = {
33
+ id: string;
34
+ actionId: string;
35
+ character: Character | null;
36
+ sentence: Sentence;
37
+ text: string;
38
+ };
39
+ export type NvlDialogPhase = "idle" | "typing" | "awaitAdvance";
40
+ export type NvlState = {
41
+ active: boolean;
42
+ visible: boolean;
43
+ sessionId: string | null;
44
+ dialogs: NvlDialogEntry[];
45
+ options: NvlBlockOptions | null;
46
+ activeDialogId: string | null;
47
+ phase: NvlDialogPhase;
48
+ pendingAdvance: boolean;
49
+ isTyping: boolean;
50
+ };
27
51
  type Legacy_PlayerStateElement = {
28
52
  texts: Clickable<TextElement>[];
29
53
  menus: Clickable<MenuElement, Chosen>[];
@@ -47,6 +71,23 @@ export type PlayerStateElement = {
47
71
  texts: Clickable<TextElement>[];
48
72
  menus: Clickable<MenuElement, Chosen>[];
49
73
  };
74
+ export type NvlStateData = {
75
+ active: boolean;
76
+ visible: boolean;
77
+ sessionId: string | null;
78
+ options?: NvlBlockOptions | null;
79
+ activeDialogId?: string | null;
80
+ phase?: NvlDialogPhase;
81
+ pendingAdvance?: boolean;
82
+ dialogIds?: string[];
83
+ dialogs?: NvlDialogEntryData[];
84
+ };
85
+ export type NvlDialogEntryData = {
86
+ id: string;
87
+ actionId?: string;
88
+ text: string;
89
+ characterId: string | null;
90
+ };
50
91
  export type PlayerStateData = {
51
92
  scenes: {
52
93
  sceneId: string;
@@ -61,6 +102,11 @@ export type PlayerStateData = {
61
102
  }[];
62
103
  audio: AudioManagerDataRaw;
63
104
  videos: [videoId: string, videoState: VideoStateRaw][];
105
+ nvlState?: NvlStateData;
106
+ };
107
+ export type PresentationSnapshot = {
108
+ scenes: SceneSnapshot[];
109
+ nvlState: NvlState;
64
110
  };
65
111
  interface StageUtils {
66
112
  update: () => void;
@@ -73,9 +119,16 @@ type GameStateEvents = {
73
119
  "event:state.player.skip": [force?: boolean];
74
120
  "event:state.player.lineEnd": [];
75
121
  "event:state.player.requestFlush": [];
122
+ "event:state.player.stageClick": [];
76
123
  "event.state.onExpose": [unknown, ExposedState[ExposedStateType]];
77
124
  "event:state.onRender": [];
78
125
  "event:state:flushPreloadedScenes": [];
126
+ "event:state.nvl.enter": [sessionId: string, options: NvlBlockOptions | null];
127
+ "event:state.nvl.exit": [];
128
+ "event:state.nvl.dialogComplete": [dialogId: string];
129
+ "event:state.nvl.dialogAppend": [entry: NvlDialogEntry];
130
+ "event:state.nvl.visibilityChange": [visible: boolean, options?: Partial<TransformDefinitions.CommonTransformProps>];
131
+ "event:state.nvl.change": [state: NvlState];
79
132
  };
80
133
  /**
81
134
  * Core game state management class
@@ -86,6 +139,8 @@ export declare class GameState {
86
139
  [K in keyof GameStateEvents]: K;
87
140
  };
88
141
  private state;
142
+ private nvlState;
143
+ private _suppressNextNvlTyping;
89
144
  currentHandling: CalledActionResult | null;
90
145
  stage: StageUtils;
91
146
  game: Game;
@@ -106,6 +161,8 @@ export declare class GameState {
106
161
  readonly actionHistory: ActionHistoryManager;
107
162
  readonly gameHistory: GameHistoryManager;
108
163
  pageRouter: null;
164
+ private stageClickBuffer;
165
+ private readonly nvlAdvanceWaiters;
109
166
  constructor(game: Game, stage: StageUtils);
110
167
  get deps(): number;
111
168
  addVideo(video: Video): this;
@@ -126,6 +183,7 @@ export declare class GameState {
126
183
  getSceneElements(): PlayerStateElement[];
127
184
  getLastScene(): Scene | null;
128
185
  getCurrentScene(): Scene | null;
186
+ findCurrentPortraitForCharacter(character: Character): NormalizedCharacterPortraitConfig | null;
129
187
  sceneExists(scene?: Scene): boolean;
130
188
  isSceneActive(scene: Scene): boolean;
131
189
  wait(ms: number): Promise<void>;
@@ -138,6 +196,78 @@ export declare class GameState {
138
196
  createMenu(menu: MenuData, afterChoose?: (choice: Chosen) => void, scene?: Scene): LiveGameEventToken & {
139
197
  prompt: null | string;
140
198
  };
199
+ /**
200
+ * Enter NVL mode
201
+ * @param options - Optional block options for transitions
202
+ */
203
+ enterNvlMode(options?: NvlBlockOptions | null): this;
204
+ /**
205
+ * Exit NVL mode
206
+ * @param options - Optional block options for transitions
207
+ */
208
+ exitNvlMode(options?: NvlBlockOptions | null): this;
209
+ /**
210
+ * Set NVL layer visibility without exiting NVL mode
211
+ * @param visible - Whether to show or hide the NVL layer
212
+ * @param options - Optional transition properties
213
+ */
214
+ setNvlVisibility(visible: boolean, options?: Partial<TransformDefinitions.CommonTransformProps>): this;
215
+ /**
216
+ * Append a dialog to the NVL dialog list
217
+ * @param entry - The dialog entry to append
218
+ */
219
+ appendNvlDialog(entry: NvlDialogEntry): this;
220
+ /**
221
+ * Remove a dialog from the NVL dialog list
222
+ * @param id - The dialog id to remove
223
+ */
224
+ removeNvlDialog(id: string): this;
225
+ /**
226
+ * Get current NVL dialogs
227
+ */
228
+ getNvlDialogs(): NvlDialogEntry[];
229
+ /**
230
+ * Check if currently in NVL mode
231
+ */
232
+ isNvlMode(): boolean;
233
+ /**
234
+ * Get NVL state
235
+ */
236
+ getNvlState(): NvlState;
237
+ /**
238
+ * Create a snapshot of the current NVL state.
239
+ */
240
+ createNvlSnapshot(): NvlState;
241
+ createPresentationSnapshot(): PresentationSnapshot;
242
+ /**
243
+ * Restore NVL state and refresh UI.
244
+ */
245
+ restoreNvlSnapshot(snapshot: NvlState): this;
246
+ restorePresentationSnapshot(snapshot: PresentationSnapshot): this;
247
+ /**
248
+ * Clear NVL dialogs
249
+ */
250
+ clearNvlDialogs(): this;
251
+ setNvlActiveDialog(dialogId: string | null, isTyping: boolean): this;
252
+ setNvlTyping(isTyping: boolean): this;
253
+ getNvlDialog(dialogId: string): NvlDialogEntry | null;
254
+ getActiveNvlDialogForAction(actionId: string): NvlDialogEntry | null;
255
+ getLatestNvlDialogForAction(actionId: string): NvlDialogEntry | null;
256
+ allocateNvlDialogId(actionId: string): string;
257
+ ensureNvlDialog(entry: NvlDialogEntry): {
258
+ created: boolean;
259
+ entry: NvlDialogEntry;
260
+ };
261
+ activateNvlDialog(dialogId: string, phase?: Exclude<NvlDialogPhase, "idle">, preserveProgress?: boolean): this;
262
+ waitForNvlAdvance(dialogId: string, resolve: () => void): LiveGameEventToken;
263
+ requestNvlAdvance(dialogId: string): "ignore" | "typing" | "advance";
264
+ requestNvlSkip(dialogId: string): "ignore" | "typing" | "advance";
265
+ completeNvlTyping(dialogId: string): boolean;
266
+ settleNvlDialog(dialogId: string): this;
267
+ suppressNextNvlTyping(): this;
268
+ consumeNvlTypingSuppression(): boolean;
269
+ recordStageClick(): this;
270
+ consumeStageClick(maxAgeMs?: number): boolean;
141
271
  createDisplayable(displayable: LogicAction.DisplayableElements, scene?: Scene | null, layer?: Layer | null): this;
142
272
  disposeDisplayable(displayable: LogicAction.DisplayableElements, scene?: Scene | null, layer?: Layer | null): this;
143
273
  forceReset(): void;
@@ -186,6 +316,10 @@ export declare class GameState {
186
316
  fromElementSnapshot(snapshot: PlayerStateElementSnapshot): PlayerStateElement;
187
317
  private removeElements;
188
318
  private resetLayers;
319
+ private syncNvlDerivedState;
320
+ private emitNvlStateChange;
321
+ private resolveNvlAdvance;
322
+ private isDisplayableVisible;
189
323
  private createWaitableAction;
190
324
  private sceneNotFound;
191
325
  private layerNotFound;
@@ -21,6 +21,7 @@ export declare class AudioManager {
21
21
  private sound;
22
22
  private ready;
23
23
  private isReady;
24
+ private isInitializing;
24
25
  constructor(gameState: GameState);
25
26
  /**
26
27
  * Must be called ONCE on the client side to prepare audio subsystem.
@@ -1,5 +1,9 @@
1
1
  import React, { ErrorInfo } from "react";
2
+ type ErrorFallbackInfo = ErrorInfo & {
3
+ digest?: string;
4
+ };
2
5
  export default function ErrorFallback({ error, errorInfo }: {
3
6
  error: Error;
4
- errorInfo: ErrorInfo;
7
+ errorInfo: ErrorFallbackInfo;
5
8
  }): React.JSX.Element;
9
+ export {};
@@ -4,9 +4,10 @@ import { Stage } from "./lib/PageRouter/Stage";
4
4
  import GameMenu from "./elements/menu/UIMenu/Menu";
5
5
  import Item from "./elements/menu/UIMenu/Item";
6
6
  import Notifications from "./elements/notification/Notifications";
7
- import Texts from "./elements/say/Sentence";
7
+ import Texts, { TextsPreview } from "./elements/say/Sentence";
8
8
  import Nametag from "./elements/say/Nametag";
9
9
  import Dialog from "./elements/say/Dialog";
10
+ import Avatar, { useAvatar } from "./elements/say/Avatar";
10
11
  import { useDialog } from "./elements/say/useDialog";
11
12
  import { useVoiceState } from "./elements/say/useVoiceState";
12
13
  import { Page, PageInjectContext } from "./lib/PageRouter/Page";
@@ -15,4 +16,10 @@ import { RootPath } from "./lib/PageRouter/router";
15
16
  import { FixedAspectRatioContainer } from "./lib/FixedAspectRatioContainer";
16
17
  import { useKeyBinding } from "./lib/keyMap";
17
18
  import { useLiveGame } from "./lib/useLiveGame";
18
- export { Isolated, usePreference, Stage, GameMenu, Item, Notifications, Texts, Nametag, Dialog, useDialog, useVoiceState, Page, Layout, LayoutRouterProvider, PageInjectContext, RootPath, FixedAspectRatioContainer, useKeyBinding, useLiveGame, };
19
+ import { NvlContainer } from "./elements/nvl/NvlContainer";
20
+ import { DefaultNvlContainer } from "./elements/nvl/DefaultNvlContainer";
21
+ import { NvlDialogList, DefaultNvlDialogItem } from "./elements/nvl/NvlDialogList";
22
+ import { NvlProvider, useNvl, useNvlDialogs, useIsNvlMode, useIsNvlVisible } from "./elements/nvl/NvlContext";
23
+ export type { DialogAvatarContext } from "./elements/say/Avatar";
24
+ export type { TextsPreviewInput, TextsPreviewLoop, TextsPreviewProps } from "./elements/say/Sentence";
25
+ export { Isolated, usePreference, Stage, GameMenu, Item, Notifications, Texts, TextsPreview, Nametag, Dialog, Avatar, useAvatar, useDialog, useVoiceState, Page, Layout, LayoutRouterProvider, PageInjectContext, RootPath, FixedAspectRatioContainer, useKeyBinding, useLiveGame, NvlContainer, DefaultNvlContainer, NvlDialogList, DefaultNvlDialogItem, NvlProvider, useNvl, useNvlDialogs, useIsNvlMode, useIsNvlVisible, };
@@ -21,4 +21,5 @@ export declare function GameProvider({ children, game }: {
21
21
  * @throws Error if used outside of GameProvider
22
22
  */
23
23
  export declare function useGame(): GameContextType;
24
+ export declare function useOptionalGame(): GameContextType | null;
24
25
  export {};