narraleaf-react 0.4.4 → 0.6.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/README.md +31 -33
- package/dist/game/nlcore/action/action.d.ts +29 -24
- package/dist/game/nlcore/action/actionHistory.d.ts +48 -37
- package/dist/game/nlcore/action/actionTypes.d.ts +142 -140
- 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 -22
- package/dist/game/nlcore/action/actions/layerAction.d.ts +16 -12
- 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 -28
- 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 +8 -7
- package/dist/game/nlcore/common/player.d.ts +7 -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 +9 -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 -51
- 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 -91
- package/dist/game/nlcore/elements/displayable/text.d.ts +74 -74
- package/dist/game/nlcore/elements/layer.d.ts +33 -23
- package/dist/game/nlcore/elements/menu.d.ts +45 -43
- 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 -75
- package/dist/game/nlcore/elements/story.d.ts +92 -78
- package/dist/game/nlcore/elements/transform/position.d.ts +99 -101
- 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 -0
- 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 -15
- package/dist/game/nlcore/elements/video.d.ts +23 -23
- package/dist/game/nlcore/game/liveGame.d.ts +148 -124
- 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.d.ts +79 -90
- package/dist/game/nlcore/gameTypes.d.ts +439 -334
- package/dist/game/nlcore/types.d.ts +67 -66
- 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 -0
- package/dist/game/player/elements/player/RenderEventAnnoucer.d.ts +4 -0
- 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 -69
- 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 -16
- package/dist/game/player/elements/scene/Scene.d.ts +1 -1
- package/dist/game/player/elements/type.d.ts +53 -53
- package/dist/game/player/elements/video/video.d.ts +1 -1
- package/dist/game/player/gameState.d.ts +193 -186
- 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 -42
- package/dist/game/player/lib/Cursor.d.ts +6 -6
- package/dist/game/player/lib/ErrorBoundary.d.ts +24 -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 +4 -0
- package/dist/game/player/lib/PageRouter/Page.d.ts +9 -9
- package/dist/game/player/lib/PageRouter/PageRouter.d.ts +27 -27
- package/dist/game/player/lib/PageRouter/Stage.d.ts +6 -6
- package/dist/game/player/lib/PageRouter/router.d.ts +28 -23
- 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/notification.d.ts +47 -47
- package/dist/game/player/lib/preferences.d.ts +8 -8
- 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 +12 -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 -64
- package/dist/index.d.ts +3 -3
- package/dist/main.js +54 -53
- package/dist/util/config.d.ts +37 -37
- package/dist/util/data.d.ts +346 -308
- package/dist/util/logger.d.ts +21 -21
- package/dist/util/singleton.d.ts +5 -5
- package/package.json +5 -3
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Game } from "../../../game/nlcore/game";
|
|
2
|
-
import { GameState } from "../gameState";
|
|
3
|
-
export type PreloadedToken = {
|
|
4
|
-
abort: () => void;
|
|
5
|
-
onFinished: (callback: () => void) => PreloadedToken;
|
|
6
|
-
onErrored: (callback: (reason: any) => void) => PreloadedToken;
|
|
7
|
-
};
|
|
8
|
-
export declare class ImageCacheManager {
|
|
9
|
-
private readonly game;
|
|
10
|
-
static getImage(src: string, abortSignal?: AbortSignal, options?: RequestInit): Promise<string>;
|
|
11
|
-
private src;
|
|
12
|
-
private preloadTasks;
|
|
13
|
-
constructor(game: Game);
|
|
14
|
-
has(name: string): boolean;
|
|
15
|
-
add(name: string, src: string): this;
|
|
16
|
-
remove(name: string): this;
|
|
17
|
-
get(name: string): string | undefined;
|
|
18
|
-
clear(): this;
|
|
19
|
-
size(): number;
|
|
20
|
-
isPreloading(src: string): boolean;
|
|
21
|
-
preload(gameState: GameState, url: string): PreloadedToken;
|
|
22
|
-
abortAll(): void;
|
|
23
|
-
abort(src: string): void;
|
|
24
|
-
preloadedSrc(): string[];
|
|
25
|
-
filter(names: string[]): this;
|
|
26
|
-
}
|
|
1
|
+
import { Game } from "../../../game/nlcore/game";
|
|
2
|
+
import { GameState } from "../gameState";
|
|
3
|
+
export type PreloadedToken = {
|
|
4
|
+
abort: () => void;
|
|
5
|
+
onFinished: (callback: () => void) => PreloadedToken;
|
|
6
|
+
onErrored: (callback: (reason: any) => void) => PreloadedToken;
|
|
7
|
+
};
|
|
8
|
+
export declare class ImageCacheManager {
|
|
9
|
+
private readonly game;
|
|
10
|
+
static getImage(src: string, abortSignal?: AbortSignal, options?: RequestInit): Promise<string>;
|
|
11
|
+
private src;
|
|
12
|
+
private preloadTasks;
|
|
13
|
+
constructor(game: Game);
|
|
14
|
+
has(name: string): boolean;
|
|
15
|
+
add(name: string, src: string): this;
|
|
16
|
+
remove(name: string): this;
|
|
17
|
+
get(name: string): string | undefined;
|
|
18
|
+
clear(): this;
|
|
19
|
+
size(): number;
|
|
20
|
+
isPreloading(src: string): boolean;
|
|
21
|
+
preload(gameState: GameState, url: string): PreloadedToken;
|
|
22
|
+
abortAll(): void;
|
|
23
|
+
abort(src: string): void;
|
|
24
|
+
preloadedSrc(): string[];
|
|
25
|
+
filter(names: string[]): this;
|
|
26
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DivElementProp } from "../../nlcore/elements/transition/type";
|
|
3
|
-
type InspectStyle = {
|
|
4
|
-
border?: "solid" | "dashed" | "dotted";
|
|
5
|
-
borderWidth?: number;
|
|
6
|
-
color?: React.CSSProperties["color"];
|
|
7
|
-
};
|
|
8
|
-
declare function InspectDiv(props: Readonly<DivElementProp & {
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
tag?: string;
|
|
11
|
-
} & InspectStyle>): React.JSX.Element;
|
|
12
|
-
declare function InspectSpan(props: Readonly<DivElementProp & {
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
tag?: string;
|
|
15
|
-
} & InspectStyle>): React.JSX.Element;
|
|
16
|
-
declare function InspectImg(props: Readonly<DivElementProp & {
|
|
17
|
-
tag?: string;
|
|
18
|
-
} & InspectStyle>): React.JSX.Element;
|
|
19
|
-
declare function InspectButton(props: Readonly<DivElementProp & {
|
|
20
|
-
children?: React.ReactNode;
|
|
21
|
-
tag?: string;
|
|
22
|
-
} & InspectStyle>): React.JSX.Element;
|
|
23
|
-
declare function InspectFramerMotionDiv(props: Readonly<DivElementProp & {
|
|
24
|
-
children?: React.ReactNode;
|
|
25
|
-
tag?: string;
|
|
26
|
-
ref?: React.RefObject<HTMLDivElement | null>;
|
|
27
|
-
layout?: boolean;
|
|
28
|
-
} & InspectStyle>): React.JSX.Element;
|
|
29
|
-
declare const Inspect: {
|
|
30
|
-
Div: typeof InspectDiv;
|
|
31
|
-
Span: typeof InspectSpan;
|
|
32
|
-
Button: typeof InspectButton;
|
|
33
|
-
Img: typeof InspectImg;
|
|
34
|
-
mDiv: typeof InspectFramerMotionDiv;
|
|
35
|
-
};
|
|
36
|
-
export default Inspect;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DivElementProp } from "../../nlcore/elements/transition/type";
|
|
3
|
+
type InspectStyle = {
|
|
4
|
+
border?: "solid" | "dashed" | "dotted";
|
|
5
|
+
borderWidth?: number;
|
|
6
|
+
color?: React.CSSProperties["color"];
|
|
7
|
+
};
|
|
8
|
+
declare function InspectDiv(props: Readonly<DivElementProp & {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
tag?: string;
|
|
11
|
+
} & InspectStyle>): React.JSX.Element;
|
|
12
|
+
declare function InspectSpan(props: Readonly<DivElementProp & {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
tag?: string;
|
|
15
|
+
} & InspectStyle>): React.JSX.Element;
|
|
16
|
+
declare function InspectImg(props: Readonly<DivElementProp & {
|
|
17
|
+
tag?: string;
|
|
18
|
+
} & InspectStyle>): React.JSX.Element;
|
|
19
|
+
declare function InspectButton(props: Readonly<DivElementProp & {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
tag?: string;
|
|
22
|
+
} & InspectStyle>): React.JSX.Element;
|
|
23
|
+
declare function InspectFramerMotionDiv(props: Readonly<DivElementProp & {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
tag?: string;
|
|
26
|
+
ref?: React.RefObject<HTMLDivElement | null>;
|
|
27
|
+
layout?: boolean;
|
|
28
|
+
} & InspectStyle>): React.JSX.Element;
|
|
29
|
+
declare const Inspect: {
|
|
30
|
+
Div: typeof InspectDiv;
|
|
31
|
+
Span: typeof InspectSpan;
|
|
32
|
+
Button: typeof InspectButton;
|
|
33
|
+
Img: typeof InspectImg;
|
|
34
|
+
mDiv: typeof InspectFramerMotionDiv;
|
|
35
|
+
};
|
|
36
|
+
export default Inspect;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { HTMLMotionProps } from "motion/react";
|
|
3
|
-
export type PageProps = Readonly<{
|
|
4
|
-
id: string;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
} & HTMLMotionProps<"div">>;
|
|
9
|
-
export declare function Page({ id, children, className, style, ...motionProps }: PageProps): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HTMLMotionProps } from "motion/react";
|
|
3
|
+
export type PageProps = Readonly<{
|
|
4
|
+
id: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
} & HTMLMotionProps<"div">>;
|
|
9
|
+
export declare function Page({ id, children, className, style, ...motionProps }: PageProps): React.JSX.Element;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type PageRouterProps = Readonly<{
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
}>;
|
|
5
|
-
/**
|
|
6
|
-
* Page Router for NarraLeaf-React
|
|
7
|
-
*
|
|
8
|
-
* **Note**: only `Page` and `Stage` components are allowed as children, other components will be ignored.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* const router = useRouter("home");
|
|
13
|
-
* ```
|
|
14
|
-
* ```tsx
|
|
15
|
-
* <PageRouter router={router}>
|
|
16
|
-
* <Page id="home">
|
|
17
|
-
* <Home />
|
|
18
|
-
* </Page>
|
|
19
|
-
* <Page id="about">
|
|
20
|
-
* <About />
|
|
21
|
-
* <Contact />
|
|
22
|
-
* </Page>
|
|
23
|
-
* </PageRouter>
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export declare function PageRouter({ children, }: PageRouterProps): React.JSX.Element | null;
|
|
27
|
-
export {};
|
|
1
|
+
import React from "react";
|
|
2
|
+
type PageRouterProps = Readonly<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Page Router for NarraLeaf-React
|
|
7
|
+
*
|
|
8
|
+
* **Note**: only `Page` and `Stage` components are allowed as children, other components will be ignored.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const router = useRouter("home");
|
|
13
|
+
* ```
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <PageRouter router={router}>
|
|
16
|
+
* <Page id="home">
|
|
17
|
+
* <Home />
|
|
18
|
+
* </Page>
|
|
19
|
+
* <Page id="about">
|
|
20
|
+
* <About />
|
|
21
|
+
* <Contact />
|
|
22
|
+
* </Page>
|
|
23
|
+
* </PageRouter>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function PageRouter({ children, }: PageRouterProps): React.JSX.Element | null;
|
|
27
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export declare function Stage({ children, className, style, }: Readonly<{
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
className?: string;
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
}>): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function Stage({ children, className, style, }: Readonly<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
}>): React.JSX.Element;
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { LiveGameEventToken } from "../../../../game/nlcore/types";
|
|
2
|
+
export declare class Router {
|
|
3
|
+
getCurrentId(): string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Push a new page id to the router history
|
|
6
|
+
*/
|
|
7
|
+
push(id: string): this;
|
|
8
|
+
/**
|
|
9
|
+
* Go back to the previous page id in the router history
|
|
10
|
+
*/
|
|
11
|
+
back(): this;
|
|
12
|
+
/**
|
|
13
|
+
* Go forward to the next page id in the router history
|
|
14
|
+
*/
|
|
15
|
+
forward(): this;
|
|
16
|
+
/**
|
|
17
|
+
* Clear the current page id and history
|
|
18
|
+
*
|
|
19
|
+
* All pages will be removed from the stage
|
|
20
|
+
*/
|
|
21
|
+
clear(): this;
|
|
22
|
+
cleanHistory(): this;
|
|
23
|
+
onExitComplete(handler: () => void): LiveGameEventToken;
|
|
24
|
+
onceExitComplete(handler: () => void): LiveGameEventToken;
|
|
25
|
+
onPageMount(handler: () => void): LiveGameEventToken;
|
|
26
|
+
oncePageMount(handler: () => void): LiveGameEventToken;
|
|
27
|
+
}
|
|
28
|
+
export declare function useRouter(): Router;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type ForwardChildren = {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
};
|
|
5
|
-
type ForwardStyle = {
|
|
6
|
-
className?: string;
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
} & React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
-
declare function Full({ children, className, style, ...props }: ForwardChildren & ForwardStyle & React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
10
|
-
export { Full, };
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ForwardChildren = {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
type ForwardStyle = {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
declare function Full({ children, className, style, ...props }: ForwardChildren & ForwardStyle & React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
10
|
+
export { Full, };
|
|
@@ -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];
|
|
@@ -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,12 @@
|
|
|
1
|
-
import Isolated from "./lib/isolated";
|
|
2
|
-
import { usePreference } from "./lib/preferences";
|
|
3
|
-
import { Stage } from "./lib/PageRouter/Stage";
|
|
4
|
-
import { Page } from "./lib/PageRouter/Page";
|
|
5
|
-
import GameMenu from "./elements/menu/UIMenu/Menu";
|
|
6
|
-
import Item from "./elements/menu/UIMenu/Item";
|
|
7
|
-
import Notifications from "./elements/notification/Notifications";
|
|
8
|
-
import Texts from "./elements/say/Sentence";
|
|
9
|
-
import Nametag from "./elements/say/Nametag";
|
|
10
|
-
import Dialog from "./elements/say/Dialog";
|
|
11
|
-
import { useDialog } from "./elements/say/useDialog";
|
|
12
|
-
export { Isolated, usePreference, Stage, Page, GameMenu, Item, Notifications, Texts, Nametag, Dialog, useDialog, };
|
|
1
|
+
import Isolated from "./lib/isolated";
|
|
2
|
+
import { usePreference } from "./lib/preferences";
|
|
3
|
+
import { Stage } from "./lib/PageRouter/Stage";
|
|
4
|
+
import { Page } from "./lib/PageRouter/Page";
|
|
5
|
+
import GameMenu from "./elements/menu/UIMenu/Menu";
|
|
6
|
+
import Item from "./elements/menu/UIMenu/Item";
|
|
7
|
+
import Notifications from "./elements/notification/Notifications";
|
|
8
|
+
import Texts from "./elements/say/Sentence";
|
|
9
|
+
import Nametag from "./elements/say/Nametag";
|
|
10
|
+
import Dialog from "./elements/say/Dialog";
|
|
11
|
+
import { useDialog } from "./elements/say/useDialog";
|
|
12
|
+
export { Isolated, usePreference, Stage, Page, GameMenu, Item, Notifications, Texts, Nametag, Dialog, useDialog, };
|
|
@@ -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 {};
|