narraleaf-react 0.2.2 → 0.2.4-beta.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 (55) hide show
  1. package/dist/game/nlcore/action/actions/controlAction.d.ts +1 -1
  2. package/dist/game/nlcore/common/Utils.d.ts +1 -51
  3. package/dist/game/nlcore/common/elements.d.ts +2 -1
  4. package/dist/game/nlcore/elements/character/pause.d.ts +0 -1
  5. package/dist/game/nlcore/elements/character/sentence.d.ts +0 -22
  6. package/dist/game/nlcore/elements/character.d.ts +0 -6
  7. package/dist/game/nlcore/elements/condition.d.ts +0 -13
  8. package/dist/game/nlcore/elements/control.d.ts +1 -4
  9. package/dist/game/nlcore/elements/displayable/displayable.d.ts +1 -38
  10. package/dist/game/nlcore/elements/displayable/image.d.ts +12 -22
  11. package/dist/game/nlcore/elements/displayable/text.d.ts +0 -8
  12. package/dist/game/nlcore/elements/menu.d.ts +0 -4
  13. package/dist/game/nlcore/elements/persistent/type.d.ts +0 -18
  14. package/dist/game/nlcore/elements/persistent.d.ts +3 -14
  15. package/dist/game/nlcore/elements/scene.d.ts +3 -43
  16. package/dist/game/nlcore/elements/script.d.ts +0 -1
  17. package/dist/game/nlcore/elements/sound.d.ts +0 -5
  18. package/dist/game/nlcore/elements/story.d.ts +0 -2
  19. package/dist/game/nlcore/elements/transform/position.d.ts +3 -46
  20. package/dist/game/nlcore/elements/transform/transform.d.ts +5 -1
  21. package/dist/game/nlcore/elements/transform/type.d.ts +0 -9
  22. package/dist/game/nlcore/elements/transition/baseTransitions.d.ts +1 -1
  23. package/dist/game/nlcore/elements/transition/type.d.ts +0 -15
  24. package/dist/game/nlcore/game/liveGame.d.ts +0 -33
  25. package/dist/game/nlcore/game/preference.d.ts +3 -7
  26. package/dist/game/nlcore/gameTypes.d.ts +4 -0
  27. package/dist/game/player/elements/displayable/Displayable.d.ts +1 -23
  28. package/dist/game/player/elements/displayable/Displayables.d.ts +1 -7
  29. package/dist/game/player/elements/displayable/Text.d.ts +1 -7
  30. package/dist/game/player/elements/displayable/type.d.ts +1 -15
  31. package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -8
  32. package/dist/game/player/elements/image/Image.d.ts +1 -7
  33. package/dist/game/player/elements/menu/Menu.d.ts +1 -3
  34. package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -5
  35. package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -4
  36. package/dist/game/player/elements/preload/Preload.d.ts +1 -4
  37. package/dist/game/player/elements/say/Say.d.ts +1 -3
  38. package/dist/game/player/elements/say/Sentence.d.ts +1 -15
  39. package/dist/game/player/elements/scene/Background.d.ts +1 -5
  40. package/dist/game/player/elements/scene/BackgroundTransition.d.ts +1 -8
  41. package/dist/game/player/elements/scene/Scene.d.ts +1 -9
  42. package/dist/game/player/elements/type.d.ts +1 -1
  43. package/dist/game/player/gameState.d.ts +0 -1
  44. package/dist/game/player/gameState.type.d.ts +1 -20
  45. package/dist/game/player/lib/PlayerFrames.d.ts +5 -1
  46. package/dist/game/player/lib/preferences.d.ts +3 -0
  47. package/dist/game/player/libElements.d.ts +3 -2
  48. package/dist/game/player/provider/game-state.d.ts +0 -5
  49. package/dist/game/player/provider/preloaded.d.ts +0 -11
  50. package/dist/game/player/provider/ratio.d.ts +0 -50
  51. package/dist/main.js +6 -6
  52. package/dist/util/data.d.ts +2 -2
  53. package/package.json +10 -7
  54. package/dist/game/player/elements/say/TypingEffect.d.ts +0 -13
  55. package/dist/game/player/lib/Motion.d.ts +0 -4
@@ -4,38 +4,6 @@ import { GameState } from "../../player/gameState";
4
4
  import { Storable } from "../elements/persistent/storable";
5
5
  import { Game } from "../game";
6
6
  import { LiveGameEventHandler, LiveGameEventToken } from "../types";
7
- import { Character } from "../elements/character";
8
- import { Sentence } from "../elements/character/sentence";
9
- type LiveGameEvent = {
10
- "event:character.prompt": [
11
- {
12
- /**
13
- * The character who says the sentence
14
- */
15
- character: Character | null;
16
- /**
17
- * The sentence said by the character
18
- */
19
- sentence: Sentence;
20
- /**
21
- * The text of the sentence
22
- */
23
- text: string;
24
- }
25
- ];
26
- "event:menu.choose": [
27
- {
28
- /**
29
- * The sentence selected by the player
30
- */
31
- sentence: Sentence;
32
- /**
33
- * The text of the sentence
34
- */
35
- text: string;
36
- }
37
- ];
38
- };
39
7
  export declare class LiveGame {
40
8
  static DefaultNamespaces: {
41
9
  game: {};
@@ -81,4 +49,3 @@ export declare class LiveGame {
81
49
  newGame(): this;
82
50
  getGameState(): GameState | undefined;
83
51
  }
84
- export {};
@@ -1,8 +1,4 @@
1
- import { EventDispatcher } from "../../../util/data";
2
- type PreferenceEventToken = {
3
- cancel: () => void;
4
- };
5
- type StringKeyof<T> = Extract<keyof T, string>;
1
+ import { BooleanValueKeyOf, EventDispatcher } from "../../../util/data";
6
2
  export declare class Preference<T extends Record<string, string | boolean | number | null | undefined>> {
7
3
  private readonly settings;
8
4
  static EventTypes: {
@@ -20,12 +16,12 @@ export declare class Preference<T extends Record<string, string | boolean | numb
20
16
  /**
21
17
  * Import preferences
22
18
  *
23
- * Note: This will override the existing preferences, and trigger the change event
19
+ * Note: this will override the existing preferences and trigger the change event
24
20
  */
25
21
  importPreferences(preferences: Partial<T>): void;
26
22
  /**
27
23
  * Export preferences
28
24
  */
29
25
  exportPreferences(): Partial<T>;
26
+ togglePreference<K extends BooleanValueKeyOf<T>>(key: K): void;
30
27
  }
31
- export {};
@@ -105,6 +105,10 @@ export type GameConfig = {
105
105
  * Cursor height in pixels
106
106
  */
107
107
  cursorHeight: number;
108
+ /**
109
+ * Show overflowed content
110
+ */
111
+ showOverflow: boolean;
108
112
  };
109
113
  elements: {
110
114
  say: {
@@ -1,23 +1 @@
1
- import React from "react";
2
- import { EventfulDisplayable } from "../../../nlcore/types";
3
- import { DisplayableChildHandler, StatefulDisplayable } from "../../elements/displayable/type";
4
- import { TransformersMap, TransformHandler } from "../../../nlcore/elements/transform/transform";
5
- import { GameState } from "../../gameState";
6
- export type DisplayableProps = {
7
- displayable: {
8
- skipTransition?: boolean;
9
- skipTransform?: boolean;
10
- transformOverwrites?: {
11
- [K in keyof TransformersMap]?: TransformHandler<TransformersMap[K]>;
12
- };
13
- } & ({
14
- element: EventfulDisplayable & StatefulDisplayable;
15
- state?: StatefulDisplayable;
16
- } | {
17
- element: EventfulDisplayable;
18
- state: StatefulDisplayable;
19
- });
20
- child: DisplayableChildHandler;
21
- state: GameState;
22
- };
23
- export default function Displayable({ state: gameState, displayable, child, }: Readonly<DisplayableProps>): React.JSX.Element;
1
+ export {};
@@ -1,7 +1 @@
1
- import React from "react";
2
- import { GameState } from "../../gameState";
3
- import { LogicAction } from "../../../nlcore/action/logicAction";
4
- export default function Displayables({ state, displayable }: Readonly<{
5
- state: GameState;
6
- displayable: LogicAction.DisplayableElements[];
7
- }>): React.JSX.Element;
1
+ export {};
@@ -1,7 +1 @@
1
- import { GameState } from "../../gameState";
2
- import { Text as GameText } from "../../../nlcore/elements/displayable/text";
3
- import React from "react";
4
- export default function Text({ state, text }: Readonly<{
5
- state: GameState;
6
- text: GameText;
7
- }>): React.JSX.Element;
1
+ export {};
@@ -1,15 +1 @@
1
- import { ElementProp, ITransition } from "../../../nlcore/elements/transition/type";
2
- import React from "react";
3
- import { Transform } from "../../../nlcore/elements/transform/transform";
4
- import { GameState } from "../../gameState";
5
- export type DisplayableChildProps = {
6
- transition: ITransition | null;
7
- transform: Transform | null;
8
- transformProps: ElementProp<Element, React.HTMLAttributes<Element>>;
9
- transformRef: React.MutableRefObject<HTMLDivElement | null>;
10
- state: GameState;
11
- };
12
- export type DisplayableChildHandler = (props: Readonly<DisplayableChildProps>) => React.ReactElement;
13
- export type StatefulDisplayable = {
14
- state: Record<any, any>;
15
- };
1
+ export {};
@@ -1,8 +1 @@
1
- import React from "react";
2
- import { ImgElementProp } from "../../../nlcore/elements/transition/type";
3
- export default function AspectScaleImage({ props, onLoad, id, Ref, }: Readonly<{
4
- props: Omit<ImgElementProp, "onLoad">;
5
- onLoad: (event: React.SyntheticEvent<HTMLImageElement, Event>) => void;
6
- id?: string;
7
- Ref?: React.RefObject<HTMLImageElement>;
8
- }>): React.JSX.Element;
1
+ export {};
@@ -1,7 +1 @@
1
- import { Image as GameImage } from "../../../nlcore/elements/displayable/image";
2
- import React from "react";
3
- import { GameState } from "../../gameState";
4
- export default function Image({ image, state, }: Readonly<{
5
- image: GameImage;
6
- state: GameState;
7
- }>): React.JSX.Element;
1
+ export {};
@@ -1,3 +1 @@
1
- import React from "react";
2
- import { MenuElementProps } from "../../elements/menu/type";
3
- export default function Menu({ prompt, choices, afterChoose, state, words, }: Readonly<MenuElementProps>): React.JSX.Element;
1
+ export {};
@@ -1,5 +1 @@
1
- import React from "react";
2
- import { GameState } from "../../gameState";
3
- export declare function KeyEventAnnouncer({ state }: Readonly<{
4
- state: GameState;
5
- }>): React.JSX.Element;
1
+ export {};
@@ -1,4 +1 @@
1
- import React from "react";
2
- export default function SizeUpdateAnnouncer({ containerRef }: Readonly<{
3
- containerRef: React.RefObject<HTMLDivElement>;
4
- }>): null;
1
+ export {};
@@ -1,4 +1 @@
1
- import { GameState } from "../../gameState";
2
- export declare function Preload({ state, }: Readonly<{
3
- state: GameState;
4
- }>): null;
1
+ export {};
@@ -1,3 +1 @@
1
- import React from "react";
2
- import { SayElementProps } from "../../elements/say/type";
3
- export default function Say({ action, onClick, useTypeEffect, className, state, }: Readonly<SayElementProps>): React.JSX.Element;
1
+ export {};
@@ -1,15 +1 @@
1
- import React from "react";
2
- import { GameState } from "../../gameState";
3
- import { Sentence as GameSentence } from "../../../nlcore/elements/character/sentence";
4
- import { Word } from "../../../nlcore/elements/character/word";
5
- import { Pausing } from "../../../nlcore/elements/character/pause";
6
- export default function Sentence({ sentence, gameState, useTypeEffect, onCompleted, finished, count, className, words: w, }: Readonly<{
7
- sentence: GameSentence;
8
- gameState: GameState;
9
- useTypeEffect?: boolean;
10
- onCompleted?: () => void;
11
- finished?: boolean;
12
- count?: number;
13
- className?: string;
14
- words?: Word<string | Pausing>[];
15
- }>): React.JSX.Element;
1
+ export {};
@@ -1,5 +1 @@
1
- import type { ReactNode } from "react";
2
- import React from "react";
3
- export default function Background({ children }: Readonly<{
4
- children: ReactNode;
5
- }>): React.JSX.Element;
1
+ export {};
@@ -1,8 +1 @@
1
- import React from "react";
2
- import { Scene as GameScene } from "../../../nlcore/elements/scene";
3
- import { GameState } from "../../gameState";
4
- export default function BackgroundTransition({ scene, props, state }: {
5
- scene: GameScene;
6
- props: Record<string, any>;
7
- state: GameState;
8
- }): React.JSX.Element;
1
+ export {};
@@ -1,9 +1 @@
1
- import { Scene as GameScene } from "../../../nlcore/elements/scene";
2
- import React from "react";
3
- import { GameState } from "../../gameState";
4
- export default function Scene({ scene, state, children, className }: Readonly<{
5
- scene: GameScene;
6
- state: GameState;
7
- children?: React.ReactNode;
8
- className?: string;
9
- }>): React.JSX.Element;
1
+ export {};
@@ -22,7 +22,7 @@ export type PlayerEventContext = {
22
22
  storable: Storable;
23
23
  };
24
24
  export interface PlayerProps {
25
- story: Story;
25
+ story?: Story;
26
26
  width?: string | number;
27
27
  height?: string | number;
28
28
  className?: clsx.ClassValue;
@@ -37,7 +37,6 @@ export type PlayerStateData = {
37
37
  };
38
38
  }[];
39
39
  };
40
- export type PlayerAction = CalledActionResult;
41
40
  interface StageUtils {
42
41
  update: () => void;
43
42
  forceUpdate: () => void;
@@ -1,20 +1 @@
1
- import { Character } from "../nlcore/elements/character";
2
- import { Choice } from "../nlcore/elements/menu";
3
- import { Sentence } from "../nlcore/elements/character/sentence";
4
- import { Word } from "../nlcore/elements/character/word";
5
- import { Pausing } from "../nlcore/elements/character/pause";
6
- export type Clickable<T, U = undefined> = {
7
- action: T;
8
- onClick: U extends undefined ? () => void : (arg0: U) => void;
9
- };
10
- export type TextElement = {
11
- character: Character | null;
12
- sentence: Sentence;
13
- id: string;
14
- words: Word<Pausing | string>[];
15
- };
16
- export type MenuElement = {
17
- prompt: Sentence;
18
- choices: Choice[];
19
- words: Word<Pausing | string>[];
20
- };
1
+ export {};
@@ -6,7 +6,11 @@ type ForwardSize = {
6
6
  type ForwardChildren = {
7
7
  children?: React.ReactNode;
8
8
  };
9
+ type ForwardClassName = {
10
+ className?: string;
11
+ };
9
12
  type FrameComponentProps = ForwardSize & ForwardChildren;
13
+ declare function Full({ children, className }: ForwardChildren & ForwardClassName): React.JSX.Element;
10
14
  declare const Top: {
11
15
  Left: (props: FrameComponentProps) => React.JSX.Element;
12
16
  Center: (props: FrameComponentProps) => React.JSX.Element;
@@ -22,4 +26,4 @@ declare const Bottom: {
22
26
  Center: (props: FrameComponentProps) => React.JSX.Element;
23
27
  Right: (props: FrameComponentProps) => React.JSX.Element;
24
28
  };
25
- export { Top, Center, Bottom, };
29
+ export { Top, Center, Bottom, Full, };
@@ -0,0 +1,3 @@
1
+ import { StringKeyOf } from "../../../util/data";
2
+ import { GamePreference } from "../../nlcore/game";
3
+ export declare function usePreference<K extends StringKeyOf<GamePreference>>(key: K): [GamePreference[K], (value: GamePreference[K]) => void];
@@ -1,5 +1,6 @@
1
1
  import Isolated from "./lib/isolated";
2
2
  import Say from "./elements/say/Say";
3
- import { Top, Center, Bottom } from "./lib/PlayerFrames";
3
+ import { Top, Center, Bottom, Full } from "./lib/PlayerFrames";
4
4
  import { VBox, HBox } from "./lib/UtilComponents";
5
- export { Isolated, Say, Top, Center, Bottom, VBox, HBox, };
5
+ import { usePreference } from "./lib/preferences";
6
+ export { Isolated, Say, Top, Center, Bottom, VBox, HBox, Full, usePreference, };
@@ -1,13 +1,8 @@
1
- import React, { ReactNode } from "react";
2
1
  import { Game } from "../../nlcore/game";
3
2
  type GameContextType = {
4
3
  game: Game;
5
4
  setGame: (update: (prevGame: Game) => Game) => void;
6
5
  };
7
- export declare function GameProvider({ children, game }: {
8
- children?: ReactNode;
9
- game?: Game;
10
- }): React.JSX.Element;
11
6
  /**
12
7
  * use {@link Game} context
13
8
  * @returns {GameContextType}
@@ -1,12 +1 @@
1
- import React from "react";
2
- import { Preloaded } from "../lib/Preloaded";
3
- import { ImageCacheManager } from "../lib/ImageCacheManager";
4
- type PreloadedContextType = {
5
- preloaded: Preloaded;
6
- cacheManager: ImageCacheManager;
7
- };
8
- export declare function PreloadedProvider({ children }: {
9
- children: React.ReactNode;
10
- }): React.JSX.Element;
11
- export declare function usePreloaded(): PreloadedContextType;
12
1
  export {};
@@ -1,51 +1 @@
1
- import React from "react";
2
- import { EventDispatcher } from "../../../util/data";
3
- export type AspectRatioState = {
4
- width: number;
5
- height: number;
6
- minWidth: number;
7
- minHeight: number;
8
- paused: boolean;
9
- scale: number;
10
- };
11
- type AspectRatioEvents = {
12
- "event:aspectRatio.update": [width: number, height: number];
13
- "event:aspectRatio.pause": [];
14
- "event:aspectRatio.resume": [];
15
- "event:aspectRatio.requestUpdate": [];
16
- };
17
- declare class AspectRatio {
18
- static EventTypes: {
19
- [K in keyof AspectRatioEvents]: K;
20
- };
21
- state: AspectRatioState;
22
- readonly events: EventDispatcher<AspectRatioEvents, AspectRatioEvents & {
23
- "event:EventDispatcher.register": [string | number, import("../../../util/data").EventListener<any>];
24
- }>;
25
- private lockers;
26
- private updater;
27
- constructor();
28
- update(width: number, height: number, scale: number): void;
29
- updateMin(width: number, height: number): void;
30
- lock(): symbol;
31
- unlock(locker: symbol | null | undefined): null;
32
- isLocked(): boolean;
33
- getStyle(): {
34
- width: string;
35
- height: string;
36
- };
37
- setUpdate(updater: () => void): void;
38
- pause(): void;
39
- resume(): void;
40
- onUpdate(callback: (width: number, height: number) => void): () => void;
41
- requestUpdate(): void;
42
- onRequestedUpdate(callback: () => void): () => void;
43
- private triggerUpdate;
44
- }
45
- export declare function RatioProvider({ children }: {
46
- children: React.ReactNode;
47
- }): React.JSX.Element;
48
- export declare function useRatio(): {
49
- ratio: AspectRatio;
50
- };
51
1
  export {};