narraleaf-react 0.4.2 → 0.4.4

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.
@@ -1,13 +1,14 @@
1
1
  import { Pausing } from "../../../nlcore/elements/character/pause";
2
2
  import { Word } from "../../../nlcore/elements/character/word";
3
3
  import { GameState } from "../../../../game/nlcore/common/game";
4
- import { EventDispatcher } from "../../../../util/data";
4
+ import { EventDispatcher, EventToken } from "../../../../util/data";
5
5
  import React from "react";
6
6
  import { DialogAction, DialogStateType, SayElementProps } from "./type";
7
7
  type DialogEvents = {
8
8
  "event:dialog.requestComplete": [];
9
9
  "event:dialog.complete": [];
10
10
  "event:dialog.forceSkip": [];
11
+ "event:dialog.onFlush": [];
11
12
  };
12
13
  type DialogStateConfig = {
13
14
  useTypeEffect: boolean;
@@ -20,6 +21,7 @@ export declare class DialogState {
20
21
  requestComplete: "event:dialog.requestComplete";
21
22
  complete: "event:dialog.complete";
22
23
  forceSkip: "event:dialog.forceSkip";
24
+ onFlush: "event:dialog.onFlush";
23
25
  };
24
26
  readonly config: Readonly<DialogStateConfig>;
25
27
  readonly events: EventDispatcher<DialogEvents>;
@@ -52,13 +54,15 @@ export declare class DialogState {
52
54
  * Only call this method when the sentence is completed
53
55
  * Calling this method will schedule the exit of the dialog
54
56
  */
55
- dispatchComplete(): void;
56
- emitComplete(): void;
57
+ dispatchComplete(): this | undefined;
58
+ emitComplete(): this;
57
59
  isEnded(): boolean;
58
60
  setPause(pause: boolean): void;
59
61
  isForceSkipped(): boolean;
60
62
  tryScheduleAutoForward(): void;
61
63
  cancelAutoForward(): void;
64
+ emitFlush(): this;
65
+ onFlush(listener: () => void): EventToken;
62
66
  private scheduleAutoForward;
63
67
  }
64
68
  export default function PlayerDialog({ action, onFinished, useTypeEffect, gameState, }: Readonly<SayElementProps>): React.JSX.Element;
@@ -12,10 +12,5 @@ export type DialogContext = {
12
12
  * A custom hook that provides access to the current dialog's state and content.
13
13
  * It retrieves the dialog information from the sentence context and processes
14
14
  * the words to generate the final text.
15
- *
16
- * @returns {DialogContext} An object containing the dialog's completion status and text content
17
15
  */
18
- export declare function useDialog(): {
19
- done: boolean;
20
- text: string;
21
- };
16
+ export declare function useDialog(): DialogContext;
@@ -92,6 +92,7 @@ export declare class GameState {
92
92
  exposedState: Map<Values<ExposedKeys>, object>;
93
93
  guard: GameStateGuard;
94
94
  timelines: Timelines;
95
+ preloadingScene: Scene | null;
95
96
  readonly notificationMgr: NotificationManager;
96
97
  readonly events: EventDispatcher<GameStateEvents>;
97
98
  readonly logger: Logger;
@@ -108,6 +109,8 @@ export declare class GameState {
108
109
  findElementByScene(scene: Scene): PlayerStateElement | null;
109
110
  findElementByDisplayable(displayable: LogicAction.DisplayableElements, layer?: Layer | null): PlayerStateElement | null;
110
111
  removeElement(element: PlayerStateElement): this;
112
+ preloadScene(scene: Scene): this;
113
+ getPreloadingScene(): Scene | null;
111
114
  addElement(element: PlayerStateElement): this;
112
115
  addScene(scene: Scene): this;
113
116
  flush(): this;
@@ -5,6 +5,6 @@ type ForwardChildren = {
5
5
  type ForwardStyle = {
6
6
  className?: string;
7
7
  style?: React.CSSProperties;
8
- };
9
- declare function Full({ children, className, style }: ForwardChildren & ForwardStyle): React.JSX.Element;
8
+ } & React.HTMLAttributes<HTMLDivElement>;
9
+ declare function Full({ children, className, style, ...props }: ForwardChildren & ForwardStyle & React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
10
10
  export { Full, };
@@ -1,8 +1,7 @@
1
1
  import React, { ReactNode } from "react";
2
- export default function Isolated({ children, className, props, style, ref }: Readonly<{
2
+ export default function Isolated({ children, className, style, ref, ...props }: Readonly<{
3
3
  children: ReactNode;
4
4
  className?: string;
5
- props?: Record<any, any>;
6
5
  style?: React.CSSProperties;
7
6
  ref?: React.RefObject<HTMLDivElement | null>;
8
- }>): React.JSX.Element;
7
+ } & React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;