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.
- package/dist/game/nlcore/action/actions/controlAction.d.ts +1 -1
- package/dist/game/nlcore/common/Utils.d.ts +1 -51
- package/dist/game/nlcore/common/elements.d.ts +2 -1
- package/dist/game/nlcore/elements/character/pause.d.ts +0 -1
- package/dist/game/nlcore/elements/character/sentence.d.ts +0 -22
- package/dist/game/nlcore/elements/character.d.ts +0 -6
- package/dist/game/nlcore/elements/condition.d.ts +0 -13
- package/dist/game/nlcore/elements/control.d.ts +1 -4
- package/dist/game/nlcore/elements/displayable/displayable.d.ts +1 -38
- package/dist/game/nlcore/elements/displayable/image.d.ts +12 -22
- package/dist/game/nlcore/elements/displayable/text.d.ts +0 -8
- package/dist/game/nlcore/elements/menu.d.ts +0 -4
- package/dist/game/nlcore/elements/persistent/type.d.ts +0 -18
- package/dist/game/nlcore/elements/persistent.d.ts +3 -14
- package/dist/game/nlcore/elements/scene.d.ts +3 -43
- package/dist/game/nlcore/elements/script.d.ts +0 -1
- package/dist/game/nlcore/elements/sound.d.ts +0 -5
- package/dist/game/nlcore/elements/story.d.ts +0 -2
- package/dist/game/nlcore/elements/transform/position.d.ts +3 -46
- package/dist/game/nlcore/elements/transform/transform.d.ts +5 -1
- package/dist/game/nlcore/elements/transform/type.d.ts +0 -9
- package/dist/game/nlcore/elements/transition/baseTransitions.d.ts +1 -1
- package/dist/game/nlcore/elements/transition/type.d.ts +0 -15
- package/dist/game/nlcore/game/liveGame.d.ts +0 -33
- package/dist/game/nlcore/game/preference.d.ts +3 -7
- package/dist/game/nlcore/gameTypes.d.ts +4 -0
- package/dist/game/player/elements/displayable/Displayable.d.ts +1 -23
- package/dist/game/player/elements/displayable/Displayables.d.ts +1 -7
- package/dist/game/player/elements/displayable/Text.d.ts +1 -7
- package/dist/game/player/elements/displayable/type.d.ts +1 -15
- package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -8
- package/dist/game/player/elements/image/Image.d.ts +1 -7
- package/dist/game/player/elements/menu/Menu.d.ts +1 -3
- package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -5
- package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -4
- package/dist/game/player/elements/preload/Preload.d.ts +1 -4
- package/dist/game/player/elements/say/Say.d.ts +1 -3
- package/dist/game/player/elements/say/Sentence.d.ts +1 -15
- package/dist/game/player/elements/scene/Background.d.ts +1 -5
- package/dist/game/player/elements/scene/BackgroundTransition.d.ts +1 -8
- package/dist/game/player/elements/scene/Scene.d.ts +1 -9
- package/dist/game/player/elements/type.d.ts +1 -1
- package/dist/game/player/gameState.d.ts +0 -1
- package/dist/game/player/gameState.type.d.ts +1 -20
- package/dist/game/player/lib/PlayerFrames.d.ts +5 -1
- package/dist/game/player/lib/preferences.d.ts +3 -0
- package/dist/game/player/libElements.d.ts +3 -2
- package/dist/game/player/provider/game-state.d.ts +0 -5
- package/dist/game/player/provider/preloaded.d.ts +0 -11
- package/dist/game/player/provider/ratio.d.ts +0 -50
- package/dist/main.js +6 -6
- package/dist/util/data.d.ts +2 -2
- package/package.json +10 -7
- package/dist/game/player/elements/say/TypingEffect.d.ts +0 -13
- 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:
|
|
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 {};
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,15 +1 @@
|
|
|
1
|
-
|
|
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,8 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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 {};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
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, };
|
|
@@ -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
|
-
|
|
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 {};
|