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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* See [Key_Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values)
|
|
3
|
+
*
|
|
4
|
+
* Case-insensitive
|
|
5
|
+
*/
|
|
6
|
+
export type WebKeyboardKey = string;
|
|
7
|
+
export declare enum KeyBindingType {
|
|
8
|
+
/**
|
|
9
|
+
* When the player presses one of these keys, the game will show the next sentence
|
|
10
|
+
*
|
|
11
|
+
* See [Key_Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values)
|
|
12
|
+
* @default [" "]
|
|
13
|
+
*/
|
|
14
|
+
skipAction = "skipAction",
|
|
15
|
+
/**
|
|
16
|
+
* When the player presses one of these keys, the game will skip the current action
|
|
17
|
+
*
|
|
18
|
+
* See [Key_Values](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values)
|
|
19
|
+
* @default ["Control"]
|
|
20
|
+
*/
|
|
21
|
+
nextAction = "nextAction"
|
|
22
|
+
}
|
|
@@ -1,116 +1,86 @@
|
|
|
1
|
-
import type { GameConfig } from "./gameTypes";
|
|
2
|
-
import { DeepPartial, Hooks } from "../../util/data";
|
|
3
|
-
import { LogicAction } from "./action/logicAction";
|
|
4
|
-
import { LiveGame } from "./game/liveGame";
|
|
5
|
-
import { Preference } from "./game/preference";
|
|
6
|
-
import { Plugins, IGamePluginRegistry } from "./game/plugin/plugin";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*/
|
|
88
|
-
plugins: Plugins;
|
|
89
|
-
/**
|
|
90
|
-
* Create a new game
|
|
91
|
-
* @param config - Game configuration
|
|
92
|
-
*/
|
|
93
|
-
constructor(config: DeepPartial<GameConfig>);
|
|
94
|
-
/**
|
|
95
|
-
* Configure the game
|
|
96
|
-
*/
|
|
97
|
-
configure(config: DeepPartial<GameConfig>): this;
|
|
98
|
-
/**
|
|
99
|
-
* Use a plugin
|
|
100
|
-
* @param plugin - The plugin to use
|
|
101
|
-
*/
|
|
102
|
-
use(plugin: IGamePluginRegistry): this;
|
|
103
|
-
getLiveGame(): LiveGame;
|
|
104
|
-
/**
|
|
105
|
-
* Dispose the game and all its resources
|
|
106
|
-
*
|
|
107
|
-
* **Note**: This action is irreversible.
|
|
108
|
-
*/
|
|
109
|
-
dispose(): void;
|
|
110
|
-
}
|
|
111
|
-
declare const _default: {
|
|
112
|
-
Game: typeof Game;
|
|
113
|
-
LiveGame: typeof LiveGame;
|
|
114
|
-
};
|
|
115
|
-
export default _default;
|
|
116
|
-
export type { LogicAction };
|
|
1
|
+
import type { GameConfig, GamePreference } from "./gameTypes";
|
|
2
|
+
import { DeepPartial, Hooks, StringKeyOf } from "../../util/data";
|
|
3
|
+
import { LogicAction } from "./action/logicAction";
|
|
4
|
+
import { LiveGame } from "./game/liveGame";
|
|
5
|
+
import { Preference } from "./game/preference";
|
|
6
|
+
import { Plugins, IGamePluginRegistry } from "./game/plugin/plugin";
|
|
7
|
+
import { LayoutRouter } from "../player/lib/PageRouter/router";
|
|
8
|
+
import { KeyMap } from "./game/keyMap";
|
|
9
|
+
declare enum GameSettingsNamespace {
|
|
10
|
+
game = "game"
|
|
11
|
+
}
|
|
12
|
+
export type GameHooks = {
|
|
13
|
+
/**
|
|
14
|
+
* Hook when the game is initialized
|
|
15
|
+
*
|
|
16
|
+
* This hook's behavior is similar to the `useEffect` hook in React. It will be called twice when the strict mode is enabled.
|
|
17
|
+
* It is used to configure the game.
|
|
18
|
+
*/
|
|
19
|
+
"init": [];
|
|
20
|
+
/**
|
|
21
|
+
* Hook when preloading images
|
|
22
|
+
*
|
|
23
|
+
* @param src - The source of the image
|
|
24
|
+
* @param set - Calling this function will set the src and options of the fetch request. This is useful to proxy
|
|
25
|
+
* - **Note**: "signal" is preserved from the original options
|
|
26
|
+
*/
|
|
27
|
+
"preloadImage": [src: string, set: (src: string, options?: RequestInit) => void];
|
|
28
|
+
};
|
|
29
|
+
export declare class Game {
|
|
30
|
+
static GameSettingsNamespace: typeof GameSettingsNamespace;
|
|
31
|
+
readonly hooks: Hooks<GameHooks>;
|
|
32
|
+
/**
|
|
33
|
+
* Game settings
|
|
34
|
+
*/
|
|
35
|
+
preference: Preference<GamePreference>;
|
|
36
|
+
/**
|
|
37
|
+
* Game key bindings
|
|
38
|
+
*/
|
|
39
|
+
keyMap: KeyMap;
|
|
40
|
+
/**
|
|
41
|
+
* Plugin registry
|
|
42
|
+
*/
|
|
43
|
+
plugins: Plugins;
|
|
44
|
+
router: LayoutRouter;
|
|
45
|
+
/**
|
|
46
|
+
* Create a new game
|
|
47
|
+
* @param config - Game configuration
|
|
48
|
+
*/
|
|
49
|
+
constructor(config: DeepPartial<GameConfig>);
|
|
50
|
+
/**
|
|
51
|
+
* Configure the game
|
|
52
|
+
*/
|
|
53
|
+
configure(config: DeepPartial<GameConfig>): this;
|
|
54
|
+
/**
|
|
55
|
+
* Configure the game and freeze the fields
|
|
56
|
+
*
|
|
57
|
+
* This method is not recommended to be used without using NarraLeaf Engine or Plugin Environment.
|
|
58
|
+
* @param config - Game configuration
|
|
59
|
+
*/
|
|
60
|
+
configureAndFreeze(config: DeepPartial<GameConfig>): this;
|
|
61
|
+
/**
|
|
62
|
+
* Freeze the fields
|
|
63
|
+
*
|
|
64
|
+
* This method is not recommended to be used without using NarraLeaf Engine or Plugin Environment.
|
|
65
|
+
* @param fields - The fields to freeze
|
|
66
|
+
*/
|
|
67
|
+
freeze(fields: (StringKeyOf<GameConfig>)[]): this;
|
|
68
|
+
/**
|
|
69
|
+
* Use a plugin
|
|
70
|
+
* @param plugin - The plugin to use
|
|
71
|
+
*/
|
|
72
|
+
use(plugin: IGamePluginRegistry): this;
|
|
73
|
+
getLiveGame(): LiveGame;
|
|
74
|
+
/**
|
|
75
|
+
* Dispose the game and all its resources
|
|
76
|
+
*
|
|
77
|
+
* **Note**: This action is irreversible.
|
|
78
|
+
*/
|
|
79
|
+
dispose(): void;
|
|
80
|
+
}
|
|
81
|
+
declare const _default: {
|
|
82
|
+
Game: typeof Game;
|
|
83
|
+
LiveGame: typeof LiveGame;
|
|
84
|
+
};
|
|
85
|
+
export default _default;
|
|
86
|
+
export type { LogicAction };
|