narraleaf-react 0.5.0 → 0.7.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.
- package/dist/game/nlcore/action/action.d.ts +29 -24
- package/dist/game/nlcore/action/actionHistory.d.ts +48 -39
- package/dist/game/nlcore/action/actionTypes.d.ts +142 -142
- package/dist/game/nlcore/action/actionable.d.ts +5 -5
- package/dist/game/nlcore/action/actions/characterAction.d.ts +19 -17
- package/dist/game/nlcore/action/actions/conditionAction.d.ts +26 -17
- package/dist/game/nlcore/action/actions/controlAction.d.ts +26 -38
- package/dist/game/nlcore/action/actions/displayableAction.d.ts +26 -22
- package/dist/game/nlcore/action/actions/imageAction.d.ts +25 -23
- package/dist/game/nlcore/action/actions/layerAction.d.ts +16 -13
- package/dist/game/nlcore/action/actions/menuAction.d.ts +21 -16
- package/dist/game/nlcore/action/actions/persistentAction.d.ts +17 -13
- package/dist/game/nlcore/action/actions/sceneAction.d.ts +47 -44
- package/dist/game/nlcore/action/actions/scriptAction.d.ts +14 -10
- package/dist/game/nlcore/action/actions/soundAction.d.ts +20 -18
- package/dist/game/nlcore/action/actions/storyAction.d.ts +8 -8
- package/dist/game/nlcore/action/actions/textAction.d.ts +16 -14
- package/dist/game/nlcore/action/actions/videoAction.d.ts +26 -22
- package/dist/game/nlcore/action/actions.d.ts +20 -13
- package/dist/game/nlcore/action/baseElement.d.ts +2 -2
- package/dist/game/nlcore/action/chain.d.ts +17 -17
- package/dist/game/nlcore/action/constructable.d.ts +5 -5
- package/dist/game/nlcore/action/gameHistory.d.ts +32 -32
- package/dist/game/nlcore/action/logicAction.d.ts +52 -52
- package/dist/game/nlcore/action/serviceAction.d.ts +24 -11
- package/dist/game/nlcore/action/srcManager.d.ts +47 -47
- package/dist/game/nlcore/action/stackModel.d.ts +106 -0
- package/dist/game/nlcore/action/tree/actionTree.d.ts +56 -56
- package/dist/game/nlcore/common/Utils.d.ts +25 -25
- package/dist/game/nlcore/common/core.d.ts +8 -8
- package/dist/game/nlcore/common/elements.d.ts +19 -19
- package/dist/game/nlcore/common/game.d.ts +9 -7
- package/dist/game/nlcore/common/player.d.ts +9 -7
- package/dist/game/nlcore/common/position.d.ts +2 -2
- package/dist/game/nlcore/common/transition.d.ts +6 -6
- package/dist/game/nlcore/common/types.d.ts +13 -9
- package/dist/game/nlcore/elements/character/pause.d.ts +8 -8
- package/dist/game/nlcore/elements/character/sentence.d.ts +25 -25
- package/dist/game/nlcore/elements/character/word.d.ts +18 -18
- package/dist/game/nlcore/elements/character.d.ts +56 -52
- package/dist/game/nlcore/elements/condition.d.ts +20 -20
- package/dist/game/nlcore/elements/control.d.ts +76 -76
- package/dist/game/nlcore/elements/displayable/displayable.d.ts +76 -76
- package/dist/game/nlcore/elements/displayable/image.d.ts +102 -102
- package/dist/game/nlcore/elements/displayable/text.d.ts +74 -74
- package/dist/game/nlcore/elements/layer.d.ts +33 -33
- package/dist/game/nlcore/elements/menu.d.ts +45 -45
- package/dist/game/nlcore/elements/persistent/storable.d.ts +24 -24
- package/dist/game/nlcore/elements/persistent/type.d.ts +3 -3
- package/dist/game/nlcore/elements/persistent.d.ts +86 -86
- package/dist/game/nlcore/elements/scene.d.ts +76 -76
- package/dist/game/nlcore/elements/script.d.ts +16 -16
- package/dist/game/nlcore/elements/service.d.ts +59 -59
- package/dist/game/nlcore/elements/sound.d.ts +89 -89
- package/dist/game/nlcore/elements/story.d.ts +92 -78
- package/dist/game/nlcore/elements/transform/position.d.ts +99 -103
- package/dist/game/nlcore/elements/transform/transform.d.ts +119 -119
- package/dist/game/nlcore/elements/transform/type.d.ts +32 -32
- package/dist/game/nlcore/elements/transition/transition.d.ts +29 -29
- package/dist/game/nlcore/elements/transition/transitions/image/darkness.d.ts +20 -20
- package/dist/game/nlcore/elements/transition/transitions/image/dissolve.d.ts +17 -17
- package/dist/game/nlcore/elements/transition/transitions/image/fadeIn.d.ts +20 -20
- package/dist/game/nlcore/elements/transition/transitions/image/imageTransition.d.ts +28 -28
- package/dist/game/nlcore/elements/transition/transitions/text/fontSize.d.ts +13 -13
- package/dist/game/nlcore/elements/transition/transitions/text/textTransition.d.ts +10 -10
- package/dist/game/nlcore/elements/transition/type.d.ts +51 -51
- package/dist/game/nlcore/elements/type.d.ts +16 -16
- package/dist/game/nlcore/elements/video.d.ts +23 -23
- package/dist/game/nlcore/game/keyMap.d.ts +82 -0
- package/dist/game/nlcore/game/liveGame.d.ts +148 -138
- package/dist/game/nlcore/game/plugin/plugin.d.ts +16 -16
- package/dist/game/nlcore/game/preference.d.ts +32 -32
- package/dist/game/nlcore/game/types.d.ts +22 -0
- package/dist/game/nlcore/game.d.ts +86 -116
- package/dist/game/nlcore/gameTypes.d.ts +432 -337
- package/dist/game/nlcore/types.d.ts +67 -67
- package/dist/game/player/Tasks.d.ts +125 -106
- package/dist/game/player/elements/Player.d.ts +4 -4
- package/dist/game/player/elements/displayable/Displayable.d.ts +1 -1
- package/dist/game/player/elements/displayable/Displayables.d.ts +1 -1
- package/dist/game/player/elements/displayable/Text.d.ts +1 -1
- package/dist/game/player/elements/displayable/type.d.ts +1 -1
- package/dist/game/player/elements/elements.d.ts +8 -8
- package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -1
- package/dist/game/player/elements/image/Image.d.ts +3 -3
- package/dist/game/player/elements/menu/PlayerMenu.d.ts +3 -3
- package/dist/game/player/elements/menu/UIMenu/Item.d.ts +12 -12
- package/dist/game/player/elements/menu/UIMenu/Menu.d.ts +6 -6
- package/dist/game/player/elements/menu/UIMenu/context.d.ts +23 -23
- package/dist/game/player/elements/menu/type.d.ts +16 -16
- package/dist/game/player/elements/notification/Notifications.d.ts +3 -3
- package/dist/game/player/elements/notification/PlayerNotification.d.ts +4 -4
- package/dist/game/player/elements/notification/context.d.ts +11 -11
- package/dist/game/player/elements/notification/type.d.ts +18 -19
- package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -1
- package/dist/game/player/elements/player/Layer.d.ts +8 -8
- package/dist/game/player/elements/player/PreferenceUpdateAnnouncer.d.ts +4 -4
- package/dist/game/player/elements/player/RenderEventAnnoucer.d.ts +4 -4
- package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -1
- package/dist/game/player/elements/preload/Preload.d.ts +1 -1
- package/dist/game/player/elements/say/Dialog.d.ts +13 -13
- package/dist/game/player/elements/say/Nametag.d.ts +2 -2
- package/dist/game/player/elements/say/Sentence.d.ts +37 -37
- package/dist/game/player/elements/say/UIDialog.d.ts +72 -71
- package/dist/game/player/elements/say/context.d.ts +4 -4
- package/dist/game/player/elements/say/type.d.ts +53 -53
- package/dist/game/player/elements/say/useDialog.d.ts +18 -18
- package/dist/game/player/elements/scene/Scene.d.ts +1 -1
- package/dist/game/player/elements/type.d.ts +59 -53
- package/dist/game/player/elements/video/video.d.ts +1 -1
- package/dist/game/player/gameState.d.ts +192 -191
- package/dist/game/player/gameState.type.d.ts +1 -1
- package/dist/game/player/guard.d.ts +24 -24
- package/dist/game/player/lib/AspectRatio.d.ts +7 -7
- package/dist/game/player/lib/AudioManager.d.ts +50 -50
- package/dist/game/player/lib/Cursor.d.ts +6 -6
- package/dist/game/player/lib/ErrorBoundary.d.ts +25 -24
- package/dist/game/player/lib/ErrorFallback.d.ts +5 -5
- package/dist/game/player/lib/ImageCacheManager.d.ts +26 -26
- package/dist/game/player/lib/Inspect.d.ts +36 -36
- package/dist/game/player/lib/PageRouter/AnimatePresence.d.ts +5 -4
- package/dist/game/player/lib/PageRouter/Layout.d.ts +48 -0
- package/dist/game/player/lib/PageRouter/Page.d.ts +46 -9
- package/dist/game/player/lib/PageRouter/Stage.d.ts +6 -6
- package/dist/game/player/lib/PageRouter/router.d.ts +638 -23
- package/dist/game/player/lib/PageRouter/routerHooks.d.ts +6 -0
- package/dist/game/player/lib/PlayerFrames.d.ts +10 -10
- package/dist/game/player/lib/Preloaded.d.ts +48 -48
- package/dist/game/player/lib/flush.d.ts +5 -5
- package/dist/game/player/lib/isolated.d.ts +7 -7
- package/dist/game/player/lib/keyMap.d.ts +3 -0
- package/dist/game/player/lib/notification.d.ts +47 -47
- package/dist/game/player/lib/preferences.d.ts +8 -8
- package/dist/game/player/lib/useConstant.d.ts +1 -0
- package/dist/game/player/lib/useElementVisibility.d.ts +5 -5
- package/dist/game/player/lib/useExposeState.d.ts +10 -10
- package/dist/game/player/lib/useLiveGame.d.ts +1 -1
- package/dist/game/player/libElements.d.ts +15 -12
- package/dist/game/player/provider/game-state.d.ts +24 -24
- package/dist/game/player/provider/preloaded.d.ts +1 -1
- package/dist/game/player/provider/providers.d.ts +7 -7
- package/dist/game/player/provider/ratio.d.ts +1 -1
- package/dist/game/player/type.d.ts +68 -68
- package/dist/index.d.ts +3 -3
- package/dist/main.js +44 -78
- package/dist/util/config.d.ts +37 -37
- package/dist/util/data.d.ts +346 -309
- package/dist/util/logger.d.ts +21 -21
- package/dist/util/singleton.d.ts +5 -5
- package/package.json +8 -5
- package/dist/game/player/lib/PageRouter/PageRouter.d.ts +0 -27
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { Sound } from "../../nlcore/elements/sound";
|
|
2
|
-
import { Src } from "../../nlcore/action/srcManager";
|
|
3
|
-
import { EventDispatcher } from "../../../util/data";
|
|
4
|
-
import { Image } from "../../nlcore/elements/displayable/image";
|
|
5
|
-
export type PreloadedSrcTypes = "image" | "audio" | "video";
|
|
6
|
-
export type PreloadedSrc<T extends PreloadedSrcTypes = any> = ({
|
|
7
|
-
type: "image";
|
|
8
|
-
src: Image;
|
|
9
|
-
} | {
|
|
10
|
-
type: "audio";
|
|
11
|
-
src: Sound;
|
|
12
|
-
} | {
|
|
13
|
-
type: "video";
|
|
14
|
-
src: string;
|
|
15
|
-
}) & (T extends undefined ? {} : ({
|
|
16
|
-
type: T;
|
|
17
|
-
} & T extends "image" ? {
|
|
18
|
-
src: Image;
|
|
19
|
-
} : T extends "audio" ? {
|
|
20
|
-
src: Sound;
|
|
21
|
-
} : T extends "video" ? {
|
|
22
|
-
src: string;
|
|
23
|
-
} : {}));
|
|
24
|
-
export type PreloadedEventTypes = {
|
|
25
|
-
"event:preloaded.add": [PreloadedSrc | string];
|
|
26
|
-
"event:preloaded.remove": [PreloadedSrc | string];
|
|
27
|
-
"event:preloaded.change": [];
|
|
28
|
-
"event:preloaded.mount": [];
|
|
29
|
-
"event:preloaded.ready": [];
|
|
30
|
-
"event:preloaded.unmount": [];
|
|
31
|
-
};
|
|
32
|
-
export declare class Preloaded {
|
|
33
|
-
static EventTypes: {
|
|
34
|
-
[K in keyof PreloadedEventTypes]: K;
|
|
35
|
-
};
|
|
36
|
-
preloaded: PreloadedSrc[];
|
|
37
|
-
events: EventDispatcher<PreloadedEventTypes>;
|
|
38
|
-
add<T extends PreloadedSrcTypes = PreloadedSrcTypes>(src: PreloadedSrc<T>): this;
|
|
39
|
-
get<T extends PreloadedSrcTypes = any>(src: string): PreloadedSrc<T> | undefined;
|
|
40
|
-
has(src: string): boolean;
|
|
41
|
-
has(src: string[]): boolean;
|
|
42
|
-
remove(src: string): this;
|
|
43
|
-
remove(src: PreloadedSrc): this;
|
|
44
|
-
remove(src: string[]): this;
|
|
45
|
-
remove(src: PreloadedSrc[]): this;
|
|
46
|
-
clear(): this;
|
|
47
|
-
getSrc(src: Src | string): string | null;
|
|
48
|
-
}
|
|
1
|
+
import { Sound } from "../../nlcore/elements/sound";
|
|
2
|
+
import { Src } from "../../nlcore/action/srcManager";
|
|
3
|
+
import { EventDispatcher } from "../../../util/data";
|
|
4
|
+
import { Image } from "../../nlcore/elements/displayable/image";
|
|
5
|
+
export type PreloadedSrcTypes = "image" | "audio" | "video";
|
|
6
|
+
export type PreloadedSrc<T extends PreloadedSrcTypes = any> = ({
|
|
7
|
+
type: "image";
|
|
8
|
+
src: Image;
|
|
9
|
+
} | {
|
|
10
|
+
type: "audio";
|
|
11
|
+
src: Sound;
|
|
12
|
+
} | {
|
|
13
|
+
type: "video";
|
|
14
|
+
src: string;
|
|
15
|
+
}) & (T extends undefined ? {} : ({
|
|
16
|
+
type: T;
|
|
17
|
+
} & T extends "image" ? {
|
|
18
|
+
src: Image;
|
|
19
|
+
} : T extends "audio" ? {
|
|
20
|
+
src: Sound;
|
|
21
|
+
} : T extends "video" ? {
|
|
22
|
+
src: string;
|
|
23
|
+
} : {}));
|
|
24
|
+
export type PreloadedEventTypes = {
|
|
25
|
+
"event:preloaded.add": [PreloadedSrc | string];
|
|
26
|
+
"event:preloaded.remove": [PreloadedSrc | string];
|
|
27
|
+
"event:preloaded.change": [];
|
|
28
|
+
"event:preloaded.mount": [];
|
|
29
|
+
"event:preloaded.ready": [];
|
|
30
|
+
"event:preloaded.unmount": [];
|
|
31
|
+
};
|
|
32
|
+
export declare class Preloaded {
|
|
33
|
+
static EventTypes: {
|
|
34
|
+
[K in keyof PreloadedEventTypes]: K;
|
|
35
|
+
};
|
|
36
|
+
preloaded: PreloadedSrc[];
|
|
37
|
+
events: EventDispatcher<PreloadedEventTypes>;
|
|
38
|
+
add<T extends PreloadedSrcTypes = PreloadedSrcTypes>(src: PreloadedSrc<T>): this;
|
|
39
|
+
get<T extends PreloadedSrcTypes = any>(src: string): PreloadedSrc<T> | undefined;
|
|
40
|
+
has(src: string): boolean;
|
|
41
|
+
has(src: string[]): boolean;
|
|
42
|
+
remove(src: string): this;
|
|
43
|
+
remove(src: PreloadedSrc): this;
|
|
44
|
+
remove(src: string[]): this;
|
|
45
|
+
remove(src: PreloadedSrc[]): this;
|
|
46
|
+
clear(): this;
|
|
47
|
+
getSrc(src: Src | string): string | null;
|
|
48
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export declare function useFlush(deps?: React.DependencyList): [
|
|
3
|
-
() => void,
|
|
4
|
-
number
|
|
5
|
-
];
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function useFlush(deps?: React.DependencyList): [
|
|
3
|
+
() => void,
|
|
4
|
+
number
|
|
5
|
+
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
export default function Isolated({ children, className, style, ref, ...props }: Readonly<{
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
className?: string;
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
ref?: React.RefObject<HTMLDivElement | null>;
|
|
7
|
-
} & React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export default function Isolated({ children, className, style, ref, ...props }: Readonly<{
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
ref?: React.RefObject<HTMLDivElement | null>;
|
|
7
|
+
} & React.HTMLAttributes<HTMLDivElement>>): React.JSX.Element;
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { Awaitable } from "../../../util/data";
|
|
2
|
-
import { GameState } from "../gameState";
|
|
3
|
-
import { LiveGameEventToken } from "../../../game/nlcore/types";
|
|
4
|
-
export type Notification = {
|
|
5
|
-
message: string;
|
|
6
|
-
id: string;
|
|
7
|
-
duration: number;
|
|
8
|
-
};
|
|
9
|
-
export declare class NotificationArray {
|
|
10
|
-
private readonly notifications;
|
|
11
|
-
static create(notifications: Notification[]): NotificationArray;
|
|
12
|
-
private readonly stringified;
|
|
13
|
-
private constructor();
|
|
14
|
-
private wrap;
|
|
15
|
-
/**
|
|
16
|
-
* Map the notifications to a new array
|
|
17
|
-
*
|
|
18
|
-
* **Note:** The callback function is called with the notification message, the **id** of the notification, and the array of notifications.
|
|
19
|
-
*
|
|
20
|
-
* @param callbackfn - The callback function
|
|
21
|
-
* @returns The new array
|
|
22
|
-
*/
|
|
23
|
-
map<U>(callbackfn: (notification: string, id: string, array: string[]) => U): U[];
|
|
24
|
-
filter(callbackfn: (notification: string, id: string, array: string[]) => boolean): string[];
|
|
25
|
-
forEach(callbackfn: (notification: string, id: string, array: string[]) => void): void;
|
|
26
|
-
find(callbackfn: (notification: string, id: string, array: string[]) => boolean): string | undefined;
|
|
27
|
-
findIndex(callbackfn: (notification: string, id: string, array: string[]) => boolean): number;
|
|
28
|
-
}
|
|
29
|
-
export declare class NotificationManager {
|
|
30
|
-
gameState: GameState;
|
|
31
|
-
notifications: Notification[];
|
|
32
|
-
private readonly events;
|
|
33
|
-
constructor(gameState: GameState, notifications: Notification[]);
|
|
34
|
-
addNotification(notification: Notification): void;
|
|
35
|
-
removeNotification(notification: Notification): void;
|
|
36
|
-
clearNotifications(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Consume a notification
|
|
39
|
-
*
|
|
40
|
-
* @param notification - The notification to consume
|
|
41
|
-
* @returns A promise that resolves when the notification is consumed
|
|
42
|
-
*/
|
|
43
|
-
consume(notification: Notification): Awaitable<void>;
|
|
44
|
-
onFlush(callback: () => void): LiveGameEventToken;
|
|
45
|
-
toArray(): Notification[];
|
|
46
|
-
private flush;
|
|
47
|
-
}
|
|
1
|
+
import { Awaitable } from "../../../util/data";
|
|
2
|
+
import { GameState } from "../gameState";
|
|
3
|
+
import { LiveGameEventToken } from "../../../game/nlcore/types";
|
|
4
|
+
export type Notification = {
|
|
5
|
+
message: string;
|
|
6
|
+
id: string;
|
|
7
|
+
duration: number | null;
|
|
8
|
+
};
|
|
9
|
+
export declare class NotificationArray {
|
|
10
|
+
private readonly notifications;
|
|
11
|
+
static create(notifications: Notification[]): NotificationArray;
|
|
12
|
+
private readonly stringified;
|
|
13
|
+
private constructor();
|
|
14
|
+
private wrap;
|
|
15
|
+
/**
|
|
16
|
+
* Map the notifications to a new array
|
|
17
|
+
*
|
|
18
|
+
* **Note:** The callback function is called with the notification message, the **id** of the notification, and the array of notifications.
|
|
19
|
+
*
|
|
20
|
+
* @param callbackfn - The callback function
|
|
21
|
+
* @returns The new array
|
|
22
|
+
*/
|
|
23
|
+
map<U>(callbackfn: (notification: string, id: string, array: string[]) => U): U[];
|
|
24
|
+
filter(callbackfn: (notification: string, id: string, array: string[]) => boolean): string[];
|
|
25
|
+
forEach(callbackfn: (notification: string, id: string, array: string[]) => void): void;
|
|
26
|
+
find(callbackfn: (notification: string, id: string, array: string[]) => boolean): string | undefined;
|
|
27
|
+
findIndex(callbackfn: (notification: string, id: string, array: string[]) => boolean): number;
|
|
28
|
+
}
|
|
29
|
+
export declare class NotificationManager {
|
|
30
|
+
gameState: GameState;
|
|
31
|
+
notifications: Notification[];
|
|
32
|
+
private readonly events;
|
|
33
|
+
constructor(gameState: GameState, notifications: Notification[]);
|
|
34
|
+
addNotification(notification: Notification): void;
|
|
35
|
+
removeNotification(notification: Notification): void;
|
|
36
|
+
clearNotifications(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Consume a notification
|
|
39
|
+
*
|
|
40
|
+
* @param notification - The notification to consume
|
|
41
|
+
* @returns A promise that resolves when the notification is consumed
|
|
42
|
+
*/
|
|
43
|
+
consume(notification: Notification): Awaitable<void>;
|
|
44
|
+
onFlush(callback: () => void): LiveGameEventToken;
|
|
45
|
+
toArray(): Notification[];
|
|
46
|
+
private flush;
|
|
47
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { StringKeyOf } from "../../../util/data";
|
|
2
|
-
import { GamePreference } from "
|
|
3
|
-
/**
|
|
4
|
-
* Custom hook for managing game preferences
|
|
5
|
-
* @param key - Preference key to access/modify
|
|
6
|
-
* @returns Tuple containing current preference value and setter function
|
|
7
|
-
*/
|
|
8
|
-
export declare function usePreference<K extends StringKeyOf<GamePreference>>(key: K): [GamePreference[K], (value: GamePreference[K]) => void];
|
|
1
|
+
import { StringKeyOf } from "../../../util/data";
|
|
2
|
+
import { GamePreference } from "../../../game/nlcore/gameTypes";
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook for managing game preferences
|
|
5
|
+
* @param key - Preference key to access/modify
|
|
6
|
+
* @returns Tuple containing current preference value and setter function
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePreference<K extends StringKeyOf<GamePreference>>(key: K): [GamePreference[K], (value: GamePreference[K]) => void];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useConstant<T>(fn: () => T): T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
2
|
-
export declare function useElementVisibility<T extends HTMLElement>(ref: RefObject<T | null>): {
|
|
3
|
-
show: () => void;
|
|
4
|
-
hide: () => void;
|
|
5
|
-
};
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
export declare function useElementVisibility<T extends HTMLElement>(ref: RefObject<T | null>): {
|
|
3
|
+
show: () => void;
|
|
4
|
+
hide: () => void;
|
|
5
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ExposedKeys, ExposedState, ExposedStateType } from "../type";
|
|
2
|
-
import React from "react";
|
|
3
|
-
/**
|
|
4
|
-
* Custom hook for exposing state to the game state manager
|
|
5
|
-
* @param key - Unique identifier for the state
|
|
6
|
-
* @param value - State value or function returning state value
|
|
7
|
-
* @param deps - Dependency array for state updates
|
|
8
|
-
* @returns Empty array (for consistency with React hooks)
|
|
9
|
-
*/
|
|
10
|
-
export declare function useExposeState<T extends ExposedStateType>(key: ExposedKeys[T], value: ExposedState[T] | (() => ExposedState[T]), deps?: React.DependencyList): [];
|
|
1
|
+
import { ExposedKeys, ExposedState, ExposedStateType } from "../type";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook for exposing state to the game state manager
|
|
5
|
+
* @param key - Unique identifier for the state
|
|
6
|
+
* @param value - State value or function returning state value
|
|
7
|
+
* @param deps - Dependency array for state updates
|
|
8
|
+
* @returns Empty array (for consistency with React hooks)
|
|
9
|
+
*/
|
|
10
|
+
export declare function useExposeState<T extends ExposedStateType>(key: ExposedKeys[T], value: ExposedState[T] | (() => ExposedState[T]), deps?: React.DependencyList): [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useLiveGame(): import("../../..").LiveGame;
|
|
1
|
+
export declare function useLiveGame(): import("../../..").LiveGame;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import Isolated from "./lib/isolated";
|
|
2
|
-
import { usePreference } from "./lib/preferences";
|
|
3
|
-
import { Stage } from "./lib/PageRouter/Stage";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import Isolated from "./lib/isolated";
|
|
2
|
+
import { usePreference } from "./lib/preferences";
|
|
3
|
+
import { Stage } from "./lib/PageRouter/Stage";
|
|
4
|
+
import GameMenu from "./elements/menu/UIMenu/Menu";
|
|
5
|
+
import Item from "./elements/menu/UIMenu/Item";
|
|
6
|
+
import Notifications from "./elements/notification/Notifications";
|
|
7
|
+
import Texts from "./elements/say/Sentence";
|
|
8
|
+
import Nametag from "./elements/say/Nametag";
|
|
9
|
+
import Dialog from "./elements/say/Dialog";
|
|
10
|
+
import { useDialog } from "./elements/say/useDialog";
|
|
11
|
+
import { Page, PageInjectContext } from "./lib/PageRouter/Page";
|
|
12
|
+
import { Layout, LayoutRouterProvider } from "./lib/PageRouter/Layout";
|
|
13
|
+
import { RootPath } from "./lib/PageRouter/router";
|
|
14
|
+
import { useKeyBinding } from "./lib/keyMap";
|
|
15
|
+
export { Isolated, usePreference, Stage, GameMenu, Item, Notifications, Texts, Nametag, Dialog, useDialog, Page, Layout, LayoutRouterProvider, PageInjectContext, RootPath, useKeyBinding, };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import "client-only";
|
|
2
|
-
import React, { ReactNode } from "react";
|
|
3
|
-
import { Game } from "../../nlcore/game";
|
|
4
|
-
/**
|
|
5
|
-
* Context type definition for game state management
|
|
6
|
-
*/
|
|
7
|
-
type GameContextType = Game;
|
|
8
|
-
/**
|
|
9
|
-
* Game state provider component
|
|
10
|
-
* Provides game state context to all child components
|
|
11
|
-
* @param children - React children components
|
|
12
|
-
* @param game - Optional initial game instance
|
|
13
|
-
*/
|
|
14
|
-
export declare function GameProvider({ children, game }: {
|
|
15
|
-
children?: ReactNode;
|
|
16
|
-
game?: Game;
|
|
17
|
-
}): React.JSX.Element;
|
|
18
|
-
/**
|
|
19
|
-
* Custom hook to access game state context
|
|
20
|
-
* @returns GameContextType object containing game instance and setter
|
|
21
|
-
* @throws Error if used outside of GameProvider
|
|
22
|
-
*/
|
|
23
|
-
export declare function useGame(): GameContextType;
|
|
24
|
-
export {};
|
|
1
|
+
import "client-only";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import { Game } from "../../nlcore/game";
|
|
4
|
+
/**
|
|
5
|
+
* Context type definition for game state management
|
|
6
|
+
*/
|
|
7
|
+
type GameContextType = Game;
|
|
8
|
+
/**
|
|
9
|
+
* Game state provider component
|
|
10
|
+
* Provides game state context to all child components
|
|
11
|
+
* @param children - React children components
|
|
12
|
+
* @param game - Optional initial game instance
|
|
13
|
+
*/
|
|
14
|
+
export declare function GameProvider({ children, game }: {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
game?: Game;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Custom hook to access game state context
|
|
20
|
+
* @returns GameContextType object containing game instance and setter
|
|
21
|
+
* @throws Error if used outside of GameProvider
|
|
22
|
+
*/
|
|
23
|
+
export declare function useGame(): GameContextType;
|
|
24
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "client-only";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Game } from "../../nlcore/game";
|
|
4
|
-
export default function GameProviders({ children, game }: Readonly<{
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
game?: Game;
|
|
7
|
-
}>): React.JSX.Element;
|
|
1
|
+
import "client-only";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Game } from "../../nlcore/game";
|
|
4
|
+
export default function GameProviders({ children, game }: Readonly<{
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
game?: Game;
|
|
7
|
+
}>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { Choice } from "../nlcore/elements/menu";
|
|
2
|
-
import { Image } from "../nlcore/elements/displayable/image";
|
|
3
|
-
import { EventDispatcher } from "../../util/data";
|
|
4
|
-
import { ImageEvents } from "./elements/image/Image";
|
|
5
|
-
import { Transform } from "../nlcore/elements/transform/transform";
|
|
6
|
-
import { Transition } from "../nlcore/elements/transition/transition";
|
|
7
|
-
import { Layer } from "../nlcore/elements/layer";
|
|
8
|
-
import { Text } from "../nlcore/elements/displayable/text";
|
|
9
|
-
import { Displayable } from "../nlcore/elements/displayable/displayable";
|
|
10
|
-
import { Scene } from "../nlcore/elements/scene";
|
|
11
|
-
import { Sound } from "../nlcore/elements/sound";
|
|
12
|
-
import { Video } from "../nlcore/elements/video";
|
|
13
|
-
import { Timeline } from "./Tasks";
|
|
14
|
-
export * from "./elements/type";
|
|
15
|
-
export type Chosen = Choice & {
|
|
16
|
-
evaluated: string;
|
|
17
|
-
};
|
|
18
|
-
export declare enum ExposedStateType {
|
|
19
|
-
image = "narraleaf:image",
|
|
20
|
-
text = "narraleaf:text",
|
|
21
|
-
layer = "narraleaf:layer",
|
|
22
|
-
scene = "narraleaf:scene",
|
|
23
|
-
video = "narraleaf:video"
|
|
24
|
-
}
|
|
25
|
-
export type ExposedState = {
|
|
26
|
-
[ExposedStateType.image]: {
|
|
27
|
-
createWearable: (wearable: Image) => void;
|
|
28
|
-
disposeWearable: (wearable: Image) => void;
|
|
29
|
-
events: EventDispatcher<ImageEvents>;
|
|
30
|
-
initDisplayable: (onResolve: () => void) => Timeline;
|
|
31
|
-
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
32
|
-
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
33
|
-
updateStyleSync: () => void;
|
|
34
|
-
};
|
|
35
|
-
[ExposedStateType.text]: {
|
|
36
|
-
initDisplayable: (onResolve: () => void) => Timeline;
|
|
37
|
-
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
38
|
-
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
39
|
-
updateStyleSync: () => void;
|
|
40
|
-
flush: () => void;
|
|
41
|
-
};
|
|
42
|
-
[ExposedStateType.layer]: {
|
|
43
|
-
initDisplayable: (onResolve: () => void) => Timeline;
|
|
44
|
-
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
45
|
-
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
46
|
-
updateStyleSync: () => void;
|
|
47
|
-
};
|
|
48
|
-
[ExposedStateType.scene]: {
|
|
49
|
-
setBackgroundMusic: (music: Sound | null, fade: number) => Promise<void>;
|
|
50
|
-
};
|
|
51
|
-
[ExposedStateType.video]: {
|
|
52
|
-
show: () => void;
|
|
53
|
-
hide: () => void;
|
|
54
|
-
play: () => Promise<void>;
|
|
55
|
-
pause: () => void;
|
|
56
|
-
resume: () => Promise<void>;
|
|
57
|
-
stop: () => void;
|
|
58
|
-
seek: (time: number) => void;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export type ExposedKeys = {
|
|
62
|
-
[ExposedStateType.image]: Image | Displayable<any, any>;
|
|
63
|
-
[ExposedStateType.text]: Text | Displayable<any, any>;
|
|
64
|
-
[ExposedStateType.layer]: Layer | Displayable<any, any>;
|
|
65
|
-
[ExposedStateType.scene]: Scene;
|
|
66
|
-
[ExposedStateType.video]: Video;
|
|
67
|
-
};
|
|
68
|
-
export type { INotificationsProps } from "./elements/notification/type";
|
|
1
|
+
import { Choice } from "../nlcore/elements/menu";
|
|
2
|
+
import { Image } from "../nlcore/elements/displayable/image";
|
|
3
|
+
import { EventDispatcher } from "../../util/data";
|
|
4
|
+
import { ImageEvents } from "./elements/image/Image";
|
|
5
|
+
import { Transform } from "../nlcore/elements/transform/transform";
|
|
6
|
+
import { Transition } from "../nlcore/elements/transition/transition";
|
|
7
|
+
import { Layer } from "../nlcore/elements/layer";
|
|
8
|
+
import { Text } from "../nlcore/elements/displayable/text";
|
|
9
|
+
import { Displayable } from "../nlcore/elements/displayable/displayable";
|
|
10
|
+
import { Scene } from "../nlcore/elements/scene";
|
|
11
|
+
import { Sound } from "../nlcore/elements/sound";
|
|
12
|
+
import { Video } from "../nlcore/elements/video";
|
|
13
|
+
import { Timeline } from "./Tasks";
|
|
14
|
+
export * from "./elements/type";
|
|
15
|
+
export type Chosen = Choice & {
|
|
16
|
+
evaluated: string;
|
|
17
|
+
};
|
|
18
|
+
export declare enum ExposedStateType {
|
|
19
|
+
image = "narraleaf:image",
|
|
20
|
+
text = "narraleaf:text",
|
|
21
|
+
layer = "narraleaf:layer",
|
|
22
|
+
scene = "narraleaf:scene",
|
|
23
|
+
video = "narraleaf:video"
|
|
24
|
+
}
|
|
25
|
+
export type ExposedState = {
|
|
26
|
+
[ExposedStateType.image]: {
|
|
27
|
+
createWearable: (wearable: Image) => void;
|
|
28
|
+
disposeWearable: (wearable: Image) => void;
|
|
29
|
+
events: EventDispatcher<ImageEvents>;
|
|
30
|
+
initDisplayable: (onResolve: () => void) => Timeline;
|
|
31
|
+
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
32
|
+
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
33
|
+
updateStyleSync: () => void;
|
|
34
|
+
};
|
|
35
|
+
[ExposedStateType.text]: {
|
|
36
|
+
initDisplayable: (onResolve: () => void) => Timeline;
|
|
37
|
+
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
38
|
+
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
39
|
+
updateStyleSync: () => void;
|
|
40
|
+
flush: () => void;
|
|
41
|
+
};
|
|
42
|
+
[ExposedStateType.layer]: {
|
|
43
|
+
initDisplayable: (onResolve: () => void) => Timeline;
|
|
44
|
+
applyTransform: (transform: Transform, onResolve: () => void) => Timeline;
|
|
45
|
+
applyTransition: (transition: Transition<any>, onResolve: () => void) => Timeline;
|
|
46
|
+
updateStyleSync: () => void;
|
|
47
|
+
};
|
|
48
|
+
[ExposedStateType.scene]: {
|
|
49
|
+
setBackgroundMusic: (music: Sound | null, fade: number) => Promise<void>;
|
|
50
|
+
};
|
|
51
|
+
[ExposedStateType.video]: {
|
|
52
|
+
show: () => void;
|
|
53
|
+
hide: () => void;
|
|
54
|
+
play: () => Promise<void>;
|
|
55
|
+
pause: () => void;
|
|
56
|
+
resume: () => Promise<void>;
|
|
57
|
+
stop: () => void;
|
|
58
|
+
seek: (time: number) => void;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export type ExposedKeys = {
|
|
62
|
+
[ExposedStateType.image]: Image | Displayable<any, any>;
|
|
63
|
+
[ExposedStateType.text]: Text | Displayable<any, any>;
|
|
64
|
+
[ExposedStateType.layer]: Layer | Displayable<any, any>;
|
|
65
|
+
[ExposedStateType.scene]: Scene;
|
|
66
|
+
[ExposedStateType.video]: Video;
|
|
67
|
+
};
|
|
68
|
+
export type { INotificationsProps } from "./elements/notification/type";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./game/nlcore/common/core";
|
|
2
|
-
export * from "./game/nlcore/common/player";
|
|
3
|
-
import "./styles/index.css";
|
|
1
|
+
export * from "./game/nlcore/common/core";
|
|
2
|
+
export * from "./game/nlcore/common/player";
|
|
3
|
+
import "./styles/index.css";
|