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,67 +1,67 @@
|
|
|
1
|
-
import { IPosition, RawPosition } from "./elements/transform/position";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export type Color = NamedColor | RGBAColor | HexColor;
|
|
4
|
-
export type RGBAColor = {
|
|
5
|
-
r: number;
|
|
6
|
-
g: number;
|
|
7
|
-
b: number;
|
|
8
|
-
a?: number;
|
|
9
|
-
};
|
|
10
|
-
export type Font = {
|
|
11
|
-
italic?: boolean;
|
|
12
|
-
bold?: boolean;
|
|
13
|
-
fontFamily?: React.CSSProperties["fontFamily"];
|
|
14
|
-
fontSize?: React.CSSProperties["fontSize"];
|
|
15
|
-
};
|
|
16
|
-
export type NextJSStaticImageData = StaticImageData;
|
|
17
|
-
export interface StaticImageData {
|
|
18
|
-
src: string;
|
|
19
|
-
height: number;
|
|
20
|
-
width: number;
|
|
21
|
-
blurDataURL?: string;
|
|
22
|
-
blurWidth?: number;
|
|
23
|
-
blurHeight?: number;
|
|
24
|
-
}
|
|
25
|
-
export type ImageSrc = string | StaticImageData;
|
|
26
|
-
export type HexColor = `#${string}`;
|
|
27
|
-
export type Length = number | `${number}px`;
|
|
28
|
-
export type RelativeLength = Length | "100%";
|
|
29
|
-
export type CommonImagePosition = "left" | "center" | "right";
|
|
30
|
-
export type CommonDisplayableConfig = {
|
|
31
|
-
/**
|
|
32
|
-
* Scale of the element, between 0 and 1
|
|
33
|
-
* @default 1
|
|
34
|
-
*/
|
|
35
|
-
scale?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Rotation of the element, in degrees
|
|
38
|
-
* @default 0
|
|
39
|
-
*/
|
|
40
|
-
rotation?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Position of the element
|
|
43
|
-
* @default {@link CommonPosition.Positions.Center}
|
|
44
|
-
*/
|
|
45
|
-
position?: RawPosition | IPosition;
|
|
46
|
-
/**
|
|
47
|
-
* Opacity of the element, between 0 and 1
|
|
48
|
-
* @default 1
|
|
49
|
-
*/
|
|
50
|
-
opacity?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Alt text of the element
|
|
53
|
-
*/
|
|
54
|
-
alt?: string;
|
|
55
|
-
};
|
|
56
|
-
export declare const ImagePosition: {
|
|
57
|
-
[K in CommonImagePosition]: K;
|
|
58
|
-
};
|
|
59
|
-
export type LiveGameEventHandler<T extends Array<any>> = (...args: T) => void;
|
|
60
|
-
export type LiveGameEventToken = {
|
|
61
|
-
cancel(): void;
|
|
62
|
-
};
|
|
63
|
-
export type NamedColor = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "transparent" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
64
|
-
export interface ActionSearchOptions {
|
|
65
|
-
allowFutureScene?: boolean;
|
|
66
|
-
}
|
|
67
|
-
export type { SavedGame } from "./gameTypes";
|
|
1
|
+
import { IPosition, RawPosition } from "./elements/transform/position";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type Color = NamedColor | RGBAColor | HexColor;
|
|
4
|
+
export type RGBAColor = {
|
|
5
|
+
r: number;
|
|
6
|
+
g: number;
|
|
7
|
+
b: number;
|
|
8
|
+
a?: number;
|
|
9
|
+
};
|
|
10
|
+
export type Font = {
|
|
11
|
+
italic?: boolean;
|
|
12
|
+
bold?: boolean;
|
|
13
|
+
fontFamily?: React.CSSProperties["fontFamily"];
|
|
14
|
+
fontSize?: React.CSSProperties["fontSize"];
|
|
15
|
+
};
|
|
16
|
+
export type NextJSStaticImageData = StaticImageData;
|
|
17
|
+
export interface StaticImageData {
|
|
18
|
+
src: string;
|
|
19
|
+
height: number;
|
|
20
|
+
width: number;
|
|
21
|
+
blurDataURL?: string;
|
|
22
|
+
blurWidth?: number;
|
|
23
|
+
blurHeight?: number;
|
|
24
|
+
}
|
|
25
|
+
export type ImageSrc = string | StaticImageData;
|
|
26
|
+
export type HexColor = `#${string}`;
|
|
27
|
+
export type Length = number | `${number}px`;
|
|
28
|
+
export type RelativeLength = Length | "100%";
|
|
29
|
+
export type CommonImagePosition = "left" | "center" | "right";
|
|
30
|
+
export type CommonDisplayableConfig = {
|
|
31
|
+
/**
|
|
32
|
+
* Scale of the element, between 0 and 1
|
|
33
|
+
* @default 1
|
|
34
|
+
*/
|
|
35
|
+
scale?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Rotation of the element, in degrees
|
|
38
|
+
* @default 0
|
|
39
|
+
*/
|
|
40
|
+
rotation?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Position of the element
|
|
43
|
+
* @default {@link CommonPosition.Positions.Center}
|
|
44
|
+
*/
|
|
45
|
+
position?: RawPosition | IPosition;
|
|
46
|
+
/**
|
|
47
|
+
* Opacity of the element, between 0 and 1
|
|
48
|
+
* @default 1
|
|
49
|
+
*/
|
|
50
|
+
opacity?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Alt text of the element
|
|
53
|
+
*/
|
|
54
|
+
alt?: string;
|
|
55
|
+
};
|
|
56
|
+
export declare const ImagePosition: {
|
|
57
|
+
[K in CommonImagePosition]: K;
|
|
58
|
+
};
|
|
59
|
+
export type LiveGameEventHandler<T extends Array<any>> = (...args: T) => void;
|
|
60
|
+
export type LiveGameEventToken = {
|
|
61
|
+
cancel(): void;
|
|
62
|
+
};
|
|
63
|
+
export type NamedColor = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "transparent" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
|
|
64
|
+
export interface ActionSearchOptions {
|
|
65
|
+
allowFutureScene?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export type { SavedGame, SavedGameMetaData } from "./gameTypes";
|
|
@@ -1,106 +1,125 @@
|
|
|
1
|
-
import { Awaitable } from "../../util/data";
|
|
2
|
-
import { GameStateGuard } from "./guard";
|
|
3
|
-
type TimelineStatus = "pending" | "cancelled" | "resolved";
|
|
4
|
-
export declare class Timeline {
|
|
5
|
-
awaitable: Awaitable;
|
|
6
|
-
guard?: GameStateGuard | undefined;
|
|
7
|
-
static proxy<T>(onSettled: (resolved: Timeline[], canceled: Timeline[]) => void): [awaitable: Awaitable<T>, timeline: Timeline];
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new awaitable that resolves when any of the given awaitables resolves.
|
|
10
|
-
* All input awaitables are attached to a timeline for global tracking and cancellation.
|
|
11
|
-
*
|
|
12
|
-
* Behavior:
|
|
13
|
-
* - The returned `awaitable` resolves with the value of the first resolved awaitable.
|
|
14
|
-
* - Cancellations of individual awaitables are ignored.
|
|
15
|
-
* - If the outer awaitable is aborted, the entire timeline and all child awaitables are aborted.
|
|
16
|
-
* - The `timeline` is returned for centralized management, but does not affect resolution logic.
|
|
17
|
-
*
|
|
18
|
-
* This is conceptually similar to `Promise.any`, but built for the Awaitable + Timeline system.
|
|
19
|
-
*
|
|
20
|
-
* @template T The resolved type of the input awaitables.
|
|
21
|
-
* @param {Awaitable<T>[]} awaitables An array of awaitables to monitor.
|
|
22
|
-
* @returns {[Awaitable<T>, Timeline]} A tuple containing:
|
|
23
|
-
* - an awaitable that resolves with the first resolved value
|
|
24
|
-
* - a timeline that includes all provided awaitables as children
|
|
25
|
-
*/
|
|
26
|
-
static any<T>(awaitables: Awaitable[]): [Awaitable<T>, Timeline];
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* -
|
|
35
|
-
* -
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
private
|
|
75
|
-
private
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
private
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
import { Awaitable } from "../../util/data";
|
|
2
|
+
import { GameStateGuard } from "./guard";
|
|
3
|
+
type TimelineStatus = "pending" | "cancelled" | "resolved";
|
|
4
|
+
export declare class Timeline {
|
|
5
|
+
awaitable: Awaitable;
|
|
6
|
+
guard?: GameStateGuard | undefined;
|
|
7
|
+
static proxy<T>(onSettled: (resolved: Timeline[], canceled: Timeline[]) => void): [awaitable: Awaitable<T>, timeline: Timeline];
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new awaitable that resolves when any of the given awaitables resolves.
|
|
10
|
+
* All input awaitables are attached to a timeline for global tracking and cancellation.
|
|
11
|
+
*
|
|
12
|
+
* Behavior:
|
|
13
|
+
* - The returned `awaitable` resolves with the value of the first resolved awaitable.
|
|
14
|
+
* - Cancellations of individual awaitables are ignored.
|
|
15
|
+
* - If the outer awaitable is aborted, the entire timeline and all child awaitables are aborted.
|
|
16
|
+
* - The `timeline` is returned for centralized management, but does not affect resolution logic.
|
|
17
|
+
*
|
|
18
|
+
* This is conceptually similar to `Promise.any`, but built for the Awaitable + Timeline system.
|
|
19
|
+
*
|
|
20
|
+
* @template T The resolved type of the input awaitables.
|
|
21
|
+
* @param {Awaitable<T>[]} awaitables An array of awaitables to monitor.
|
|
22
|
+
* @returns {[Awaitable<T>, Timeline]} A tuple containing:
|
|
23
|
+
* - an awaitable that resolves with the first resolved value
|
|
24
|
+
* - a timeline that includes all provided awaitables as children
|
|
25
|
+
*/
|
|
26
|
+
static any<T>(awaitables: Awaitable[]): [Awaitable<T>, Timeline];
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new awaitable that resolves when all of the given awaitables resolve.
|
|
29
|
+
* All input awaitables are attached to a timeline for global tracking and cancellation.
|
|
30
|
+
*
|
|
31
|
+
* Behavior:
|
|
32
|
+
* - The returned `awaitable` resolves with an array of all resolved values in the same order as input.
|
|
33
|
+
* - If any awaitable is cancelled, the entire timeline is cancelled.
|
|
34
|
+
* - If the outer awaitable is aborted, the entire timeline and all child awaitables are aborted.
|
|
35
|
+
* - The `timeline` is returned for centralized management, but does not affect resolution logic.
|
|
36
|
+
*
|
|
37
|
+
* This is conceptually similar to `Promise.all`, but built for the Awaitable + Timeline system.
|
|
38
|
+
*
|
|
39
|
+
* @template T The resolved type of the input awaitables.
|
|
40
|
+
* @param {Awaitable<T>[]} awaitables An array of awaitables to monitor.
|
|
41
|
+
* @returns {[Awaitable<T[]>, Timeline]} A tuple containing:
|
|
42
|
+
* - an awaitable that resolves with an array of all resolved values
|
|
43
|
+
* - a timeline that includes all provided awaitables as children
|
|
44
|
+
*/
|
|
45
|
+
static all<T>(awaitables: Awaitable<T>[]): [Awaitable<T[]>, Timeline];
|
|
46
|
+
/**
|
|
47
|
+
* Executes a chain of asynchronous steps in sequence using the provided generator function.
|
|
48
|
+
*
|
|
49
|
+
* Each step receives the result of the previous step and returns an `Awaitable<T>`.
|
|
50
|
+
* The process continues until the generator returns `null`, at which point the last value is returned as the final result.
|
|
51
|
+
*
|
|
52
|
+
* This method ensures that:
|
|
53
|
+
* - Only one awaitable runs at a time (strict sequencing).
|
|
54
|
+
* - Cancellation propagates both ways:
|
|
55
|
+
* - If the outer awaitable is aborted, the currently running inner awaitable is also aborted.
|
|
56
|
+
* - If the inner awaitable triggers an abort, the sequence is cancelled and no further steps are executed.
|
|
57
|
+
*
|
|
58
|
+
* Designed for use cases such as chained animations, step-based workflows, task pipelining, or recursive async structures.
|
|
59
|
+
*
|
|
60
|
+
* @template T The type of the value passed and returned between steps.
|
|
61
|
+
*
|
|
62
|
+
* @param {function(prev: T): Awaitable<T> | null} generator
|
|
63
|
+
* A function that receives the result of the previous step and returns:
|
|
64
|
+
* - a new Awaitable<T> to continue the sequence
|
|
65
|
+
* - or `null` to terminate the sequence and return the last value.
|
|
66
|
+
*
|
|
67
|
+
* @param {T} initial
|
|
68
|
+
* The initial value passed to the generator for the first step.
|
|
69
|
+
*
|
|
70
|
+
* @returns {Awaitable<T>} A single awaitable that resolves with the last non-null result
|
|
71
|
+
* in the sequence, or aborts if interrupted.
|
|
72
|
+
*/
|
|
73
|
+
static sequence<T>(generator: (prev: T) => Awaitable<T> | null, initial: T): Awaitable<T>;
|
|
74
|
+
private children;
|
|
75
|
+
private _onResolved;
|
|
76
|
+
private _onCancelled;
|
|
77
|
+
private _onTimelineRegistered;
|
|
78
|
+
private _ableToAttach;
|
|
79
|
+
private _status;
|
|
80
|
+
get status(): TimelineStatus;
|
|
81
|
+
constructor(awaitable: Awaitable, guard?: GameStateGuard | undefined);
|
|
82
|
+
isSettled(): boolean;
|
|
83
|
+
isResolved(): boolean;
|
|
84
|
+
isCancelled(): boolean;
|
|
85
|
+
onResolved(callback: () => void): void;
|
|
86
|
+
onCancelled(callback: () => void): void;
|
|
87
|
+
onSettled(callback: () => void): void;
|
|
88
|
+
abort(): void;
|
|
89
|
+
attachChild(arg0: Awaitable | Timeline): this;
|
|
90
|
+
setGuard(guard: GameStateGuard): this;
|
|
91
|
+
protected catSettled(): [resolved: Timeline[], cancelled: Timeline[]];
|
|
92
|
+
protected onTimelineRegistered(callback: () => void): this;
|
|
93
|
+
private resolveStatus;
|
|
94
|
+
private emitEvents;
|
|
95
|
+
/**
|
|
96
|
+
* Set the status of the timeline
|
|
97
|
+
*
|
|
98
|
+
* if the status is already resolved or canceled, it'll silently ignore the status change
|
|
99
|
+
*/
|
|
100
|
+
private setStatus;
|
|
101
|
+
private preventAttach;
|
|
102
|
+
}
|
|
103
|
+
export declare class Timelines {
|
|
104
|
+
private guard?;
|
|
105
|
+
private timelines;
|
|
106
|
+
constructor(guard?: GameStateGuard | undefined);
|
|
107
|
+
/**
|
|
108
|
+
* Attaches a new timeline or an awaitable to the task pool.
|
|
109
|
+
* If an Awaitable is provided, it wraps it into a new Timeline.
|
|
110
|
+
* Automatically removes any settled timelines before pushing the new one.
|
|
111
|
+
*
|
|
112
|
+
* @param input - An Awaitable instance or an existing Timeline.
|
|
113
|
+
* @returns The attached Timeline instance.
|
|
114
|
+
*/
|
|
115
|
+
attachTimeline(input: Awaitable | Timeline): Timeline;
|
|
116
|
+
/**
|
|
117
|
+
* Aborts all active timelines and removes any that are already settled.
|
|
118
|
+
*/
|
|
119
|
+
abortAll(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Removes timelines that have already been resolved or cancelled.
|
|
122
|
+
*/
|
|
123
|
+
private cleanupSettled;
|
|
124
|
+
}
|
|
125
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "client-only";
|
|
2
|
-
import { PlayerProps } from "../elements/type";
|
|
3
|
-
import React from "react";
|
|
4
|
-
export default function Player({ story, width, height, className, onReady, onEnd, children, active, }: Readonly<PlayerProps>): React.JSX.Element;
|
|
1
|
+
import "client-only";
|
|
2
|
+
import { PlayerProps } from "../elements/type";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export default function Player({ story, width, height, className, onReady, onEnd, onError, children, active, }: Readonly<PlayerProps>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DefaultDialog } from "../../../game/player/elements/say/Dialog";
|
|
2
|
-
import { DefaultMenu } from "../../../game/player/elements/menu/PlayerMenu";
|
|
3
|
-
import { DefaultNotification } from "../elements/notification/PlayerNotification";
|
|
4
|
-
export declare const DefaultElements: {
|
|
5
|
-
readonly say: typeof DefaultDialog;
|
|
6
|
-
readonly menu: typeof DefaultMenu;
|
|
7
|
-
readonly notification: typeof DefaultNotification;
|
|
8
|
-
};
|
|
1
|
+
import { DefaultDialog } from "../../../game/player/elements/say/Dialog";
|
|
2
|
+
import { DefaultMenu } from "../../../game/player/elements/menu/PlayerMenu";
|
|
3
|
+
import { DefaultNotification } from "../elements/notification/PlayerNotification";
|
|
4
|
+
export declare const DefaultElements: {
|
|
5
|
+
readonly say: typeof DefaultDialog;
|
|
6
|
+
readonly menu: typeof DefaultMenu;
|
|
7
|
+
readonly notification: typeof DefaultNotification;
|
|
8
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default AspectScaleImage;
|
|
1
|
+
export default AspectScaleImage;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type ImageEvents = {
|
|
2
|
-
"event:image.onLoad": [];
|
|
3
|
-
};
|
|
1
|
+
export type ImageEvents = {
|
|
2
|
+
"event:image.onLoad": [];
|
|
3
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { IUserMenuProps } from "../../elements/menu/type";
|
|
3
|
-
export declare function DefaultMenu({ items }: IUserMenuProps): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IUserMenuProps } from "../../elements/menu/type";
|
|
3
|
+
export declare function DefaultMenu({ items }: IUserMenuProps): React.JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface ItemProps {
|
|
3
|
-
className?: string;
|
|
4
|
-
style?: React.CSSProperties;
|
|
5
|
-
/**
|
|
6
|
-
* The keyboard binding for this item, see [Key_Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) for more information
|
|
7
|
-
*
|
|
8
|
-
* When this key is pressed, the item will be selected and the action will be executed
|
|
9
|
-
*/
|
|
10
|
-
bindKey?: string;
|
|
11
|
-
}
|
|
12
|
-
export default function Item({ className, style, bindKey }: ItemProps): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ItemProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: React.CSSProperties;
|
|
5
|
+
/**
|
|
6
|
+
* The keyboard binding for this item, see [Key_Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) for more information
|
|
7
|
+
*
|
|
8
|
+
* When this key is pressed, the item will be selected and the action will be executed
|
|
9
|
+
*/
|
|
10
|
+
bindKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export default function Item({ className, style, bindKey }: ItemProps): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type MenuProps = {
|
|
3
|
-
className?: string;
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
} & React.HTMLAttributes<HTMLDivElement>;
|
|
6
|
-
export default function GameMenu({ className, children, ...props }: MenuProps): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type MenuProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
export default function GameMenu({ className, children, ...props }: MenuProps): React.JSX.Element;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Pausing } from "../../../../nlcore/elements/character/pause";
|
|
2
|
-
import { Word } from "../../../../nlcore/elements/character/word";
|
|
3
|
-
import { Choice } from "../../../../nlcore/elements/menu";
|
|
4
|
-
import { GameState } from "../../../../../game/player/gameState";
|
|
5
|
-
import { Chosen } from "../../../type";
|
|
6
|
-
import React from "react";
|
|
7
|
-
interface UIMenuContext {
|
|
8
|
-
evaluated: (Choice & {
|
|
9
|
-
words: Word<Pausing | string>[];
|
|
10
|
-
})[];
|
|
11
|
-
choose: (choice: Chosen) => void;
|
|
12
|
-
gameState: GameState;
|
|
13
|
-
}
|
|
14
|
-
export declare const UIMenuContext: React.Context<UIMenuContext | null>;
|
|
15
|
-
export declare function useUIMenuContext(): UIMenuContext;
|
|
16
|
-
interface UIListContext {
|
|
17
|
-
register: (ref: React.RefObject<HTMLElement>) => number;
|
|
18
|
-
unregister: (ref: React.RefObject<HTMLElement>) => void;
|
|
19
|
-
getIndex: (ref: React.RefObject<HTMLElement>) => number;
|
|
20
|
-
}
|
|
21
|
-
export declare const UIListContext: React.Context<UIListContext | null>;
|
|
22
|
-
export declare function useUIListContext(): UIListContext;
|
|
23
|
-
export {};
|
|
1
|
+
import { Pausing } from "../../../../nlcore/elements/character/pause";
|
|
2
|
+
import { Word } from "../../../../nlcore/elements/character/word";
|
|
3
|
+
import { Choice } from "../../../../nlcore/elements/menu";
|
|
4
|
+
import { GameState } from "../../../../../game/player/gameState";
|
|
5
|
+
import { Chosen } from "../../../type";
|
|
6
|
+
import React from "react";
|
|
7
|
+
interface UIMenuContext {
|
|
8
|
+
evaluated: (Choice & {
|
|
9
|
+
words: Word<Pausing | string>[];
|
|
10
|
+
})[];
|
|
11
|
+
choose: (choice: Chosen) => void;
|
|
12
|
+
gameState: GameState;
|
|
13
|
+
}
|
|
14
|
+
export declare const UIMenuContext: React.Context<UIMenuContext | null>;
|
|
15
|
+
export declare function useUIMenuContext(): UIMenuContext;
|
|
16
|
+
interface UIListContext {
|
|
17
|
+
register: (ref: React.RefObject<HTMLElement>) => number;
|
|
18
|
+
unregister: (ref: React.RefObject<HTMLElement>) => void;
|
|
19
|
+
getIndex: (ref: React.RefObject<HTMLElement>) => number;
|
|
20
|
+
}
|
|
21
|
+
export declare const UIListContext: React.Context<UIListContext | null>;
|
|
22
|
+
export declare function useUIListContext(): UIListContext;
|
|
23
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Choice } from "../../../nlcore/elements/menu";
|
|
2
|
-
import type { GameState } from "../../gameState";
|
|
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
|
-
import { Chosen } from "../../type";
|
|
7
|
-
export interface MenuElementProps {
|
|
8
|
-
prompt: Sentence | null;
|
|
9
|
-
choices: Choice[];
|
|
10
|
-
afterChoose: (choice: Chosen) => void;
|
|
11
|
-
state: GameState;
|
|
12
|
-
words: Word<Pausing | string>[] | null;
|
|
13
|
-
}
|
|
14
|
-
export interface IUserMenuProps {
|
|
15
|
-
items: number[];
|
|
16
|
-
}
|
|
1
|
+
import type { Choice } from "../../../nlcore/elements/menu";
|
|
2
|
+
import type { GameState } from "../../gameState";
|
|
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
|
+
import { Chosen } from "../../type";
|
|
7
|
+
export interface MenuElementProps {
|
|
8
|
+
prompt: Sentence | null;
|
|
9
|
+
choices: Choice[];
|
|
10
|
+
afterChoose: (choice: Chosen) => void;
|
|
11
|
+
state: GameState;
|
|
12
|
+
words: Word<Pausing | string>[] | null;
|
|
13
|
+
}
|
|
14
|
+
export interface IUserMenuProps {
|
|
15
|
+
items: number[];
|
|
16
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { NotificationsProps } from "./type";
|
|
3
|
-
export default function Notifications({ children, ...props }: NotificationsProps): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NotificationsProps } from "./type";
|
|
3
|
+
export default function Notifications({ children, ...props }: NotificationsProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PlayerNotificationProps, INotificationsProps } from "./type";
|
|
3
|
-
export default function PlayerNotification({ gameState }: PlayerNotificationProps): React.JSX.Element;
|
|
4
|
-
export declare function DefaultNotification({ notifications }: INotificationsProps): React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PlayerNotificationProps, INotificationsProps } from "./type";
|
|
3
|
+
export default function PlayerNotification({ gameState }: PlayerNotificationProps): React.JSX.Element;
|
|
4
|
+
export declare function DefaultNotification({ notifications }: INotificationsProps): React.JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { EmptyObject } from "../../../../game/nlcore/elements/transition/type";
|
|
2
|
-
import { Notification } from "./type";
|
|
3
|
-
import React from "react";
|
|
4
|
-
interface NotificationsContext {
|
|
5
|
-
register: (ref: React.RefObject<EmptyObject>) => void;
|
|
6
|
-
unregister: (ref: React.RefObject<EmptyObject>) => void;
|
|
7
|
-
getNotification: (ref: React.RefObject<EmptyObject>) => Notification | null;
|
|
8
|
-
}
|
|
9
|
-
export declare const NotificationsContext: React.Context<NotificationsContext | null>;
|
|
10
|
-
export declare function useNotificationsContext(): NotificationsContext;
|
|
11
|
-
export {};
|
|
1
|
+
import { EmptyObject } from "../../../../game/nlcore/elements/transition/type";
|
|
2
|
+
import { Notification } from "./type";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface NotificationsContext {
|
|
5
|
+
register: (ref: React.RefObject<EmptyObject>) => void;
|
|
6
|
+
unregister: (ref: React.RefObject<EmptyObject>) => void;
|
|
7
|
+
getNotification: (ref: React.RefObject<EmptyObject>) => Notification | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const NotificationsContext: React.Context<NotificationsContext | null>;
|
|
10
|
+
export declare function useNotificationsContext(): NotificationsContext;
|
|
11
|
+
export {};
|