narraleaf-react 0.0.1-beta.3 → 0.0.1-beta.5
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 +119 -0
- package/dist/game/nlcore/action/action.d.ts +3 -3
- package/dist/game/nlcore/action/actionTypes.d.ts +16 -14
- package/dist/game/nlcore/action/actionable.d.ts +1 -1
- package/dist/game/nlcore/action/actions.d.ts +17 -15
- package/dist/game/nlcore/action/constructable.d.ts +2 -2
- package/dist/game/nlcore/action/logicAction.d.ts +12 -12
- package/dist/game/nlcore/action/tree/actionTree.d.ts +1 -1
- package/dist/game/nlcore/common/Utils.d.ts +3 -3
- package/dist/game/nlcore/common/elements.d.ts +4 -4
- package/dist/game/nlcore/common/game.d.ts +2 -2
- package/dist/game/nlcore/common/player.d.ts +7 -4
- package/dist/game/nlcore/common/position.d.ts +1 -1
- package/dist/game/nlcore/common/transition.d.ts +4 -4
- package/dist/game/nlcore/common/types.d.ts +1 -1
- package/dist/game/nlcore/elements/condition.d.ts +4 -4
- package/dist/game/nlcore/elements/control.d.ts +2 -2
- package/dist/game/nlcore/elements/image.d.ts +7 -7
- package/dist/game/nlcore/elements/menu.d.ts +4 -4
- package/dist/game/nlcore/elements/scene.d.ts +9 -9
- package/dist/game/nlcore/elements/script.d.ts +3 -3
- package/dist/game/nlcore/elements/sound.d.ts +5 -3
- package/dist/game/nlcore/elements/srcManager.d.ts +3 -3
- package/dist/game/nlcore/elements/story.d.ts +3 -3
- package/dist/game/nlcore/elements/text.d.ts +2 -2
- package/dist/game/nlcore/elements/transform/position.d.ts +1 -1
- package/dist/game/nlcore/elements/transform/transform.d.ts +4 -4
- package/dist/game/nlcore/elements/transform/type.d.ts +2 -2
- package/dist/game/nlcore/elements/transition/base.d.ts +1 -1
- package/dist/game/nlcore/elements/transition/dissolve.d.ts +2 -2
- package/dist/game/nlcore/elements/transition/fade.d.ts +2 -2
- package/dist/game/nlcore/elements/transition/fadeIn.d.ts +4 -4
- package/dist/game/nlcore/elements/transition/type.d.ts +1 -1
- package/dist/game/nlcore/game.d.ts +9 -4
- package/dist/game/nlcore/store/storable.d.ts +1 -1
- package/dist/game/nlcore/types.d.ts +3 -2
- package/dist/game/player/elements/Player.d.ts +2 -10
- package/dist/game/player/elements/elements.d.ts +6 -0
- package/dist/game/player/elements/image/Image.d.ts +2 -2
- package/dist/game/player/elements/menu/Menu.d.ts +2 -7
- package/dist/game/player/elements/menu/Sentence.d.ts +3 -2
- package/dist/game/player/elements/menu/type.d.ts +7 -0
- package/dist/game/player/elements/preload/Preload.d.ts +2 -2
- package/dist/game/player/elements/say/Say.d.ts +2 -9
- package/dist/game/player/elements/say/TypingEffect.d.ts +1 -0
- package/dist/game/player/elements/say/type.d.ts +12 -0
- package/dist/game/player/elements/scene/BackgroundTransition.d.ts +2 -2
- package/dist/game/player/elements/scene/Scene.d.ts +2 -2
- package/dist/game/player/elements/type.d.ts +32 -0
- package/dist/game/player/gameState.d.ts +12 -23
- package/dist/game/player/gameState.type.d.ts +15 -0
- package/dist/game/player/lib/Preloaded.d.ts +4 -4
- package/dist/game/player/libElements.d.ts +4 -0
- package/dist/game/player/provider/game-state.d.ts +1 -1
- package/dist/game/player/provider/preloaded.d.ts +1 -1
- package/dist/game/player/provider/providers.d.ts +3 -1
- package/dist/game/player/type.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# NarraLeaf-React
|
|
4
|
+
|
|
5
|
+
A React visual novel player framework
|
|
6
|
+
|
|
7
|
+
## What is NarraLeaf-React?
|
|
8
|
+
|
|
9
|
+
NarraLeaf-React is a lightweight front-end visual novel player.
|
|
10
|
+
NL focuses on visual novel playing, so the user interface can be customized very easily.
|
|
11
|
+
|
|
12
|
+
It doesn't use any rendering libraries and can be used on any web platform (e.g. Electron)
|
|
13
|
+
|
|
14
|
+
## Get Started
|
|
15
|
+
|
|
16
|
+
### Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install narraleaf-react
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Example
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
"use client";
|
|
26
|
+
|
|
27
|
+
import { Character, Scene, Story, Image, Game, Player, GameProviders } from "narraleaf-react";
|
|
28
|
+
|
|
29
|
+
export default function App() {
|
|
30
|
+
const story = new Story("My First NarraLeaf Story");
|
|
31
|
+
|
|
32
|
+
const scene1 = new Scene("scene1");
|
|
33
|
+
|
|
34
|
+
const character1 = new Character("character1");
|
|
35
|
+
const image1 = new Image({
|
|
36
|
+
src: "https://placehold.it/200x200",
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Add actions to the scene
|
|
40
|
+
scene1.action([
|
|
41
|
+
// Show image1 for 1 second
|
|
42
|
+
image1.show({
|
|
43
|
+
duration: 1000,
|
|
44
|
+
}).toActions(),
|
|
45
|
+
|
|
46
|
+
// Say something
|
|
47
|
+
character1
|
|
48
|
+
.say("Hello, world!")
|
|
49
|
+
.say("This is my first NarraLeaf story.")
|
|
50
|
+
.say("Start editing this file and enjoy the journey!")
|
|
51
|
+
.toActions(),
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
story.entry(scene1);
|
|
55
|
+
|
|
56
|
+
function handleOnReady(game: Game) {
|
|
57
|
+
game.getLiveGame().newGame();
|
|
58
|
+
console.log("Game is ready!");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<GameProviders>
|
|
63
|
+
<Player
|
|
64
|
+
story={story}
|
|
65
|
+
onReady={handleOnReady}
|
|
66
|
+
width="100vw"
|
|
67
|
+
height="100vh"
|
|
68
|
+
/>
|
|
69
|
+
</GameProviders>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Read more in [Quick Start](./docs/quick-start.md)
|
|
75
|
+
|
|
76
|
+
### Performance
|
|
77
|
+
|
|
78
|
+
Please enable image cache for a better performance.
|
|
79
|
+
|
|
80
|
+
for NextJS, add this to your `next.config.js`:
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
/** @type {import('next').NextConfig} */
|
|
84
|
+
const nextConfig = {
|
|
85
|
+
async headers() {
|
|
86
|
+
return [
|
|
87
|
+
{
|
|
88
|
+
source: '/YOUR_IMAGE_ENDPOINT/(.*)', // ex: /static/images/(.*)
|
|
89
|
+
headers: [
|
|
90
|
+
{
|
|
91
|
+
key: 'Cache-Control',
|
|
92
|
+
value: 'public, max-age=31536000, immutable',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default nextConfig;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Documentation
|
|
104
|
+
|
|
105
|
+
- [Quick Start](./docs/quick-start.md)
|
|
106
|
+
- [Customization](./docs/customization.md)
|
|
107
|
+
|
|
108
|
+
in progress...
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
> NarraLeaf-React is licensed under the MIT License.
|
|
113
|
+
|
|
114
|
+
## Contributing
|
|
115
|
+
|
|
116
|
+
We welcome all contributions.
|
|
117
|
+
If you have any ideas, just open an issue or a pull request.
|
|
118
|
+
|
|
119
|
+
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LogicAction } from "./logicAction";
|
|
2
|
-
import { ContentNode } from "
|
|
2
|
+
import { ContentNode } from "../action/tree/actionTree";
|
|
3
3
|
import type { CalledActionResult } from "@core/gameTypes";
|
|
4
|
-
import { Awaitable } from "
|
|
5
|
-
import { GameState } from "
|
|
4
|
+
import { Awaitable } from "../../../util/data";
|
|
5
|
+
import { GameState } from "../../player/gameState";
|
|
6
6
|
export declare class Action<ContentNodeType = any, Callee = LogicAction.GameElement> {
|
|
7
7
|
static ActionTypes: {
|
|
8
8
|
action: string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { LogicAction } from "
|
|
2
|
-
import type { Story } from "
|
|
3
|
-
import type { ConditionData } from "
|
|
4
|
-
import { Background, CommonImage } from "
|
|
5
|
-
import { Transform } from "
|
|
6
|
-
import type { Scene } from "
|
|
7
|
-
import type { Sentence } from "
|
|
8
|
-
import type { MenuData } from "
|
|
9
|
-
import { Awaitable } from "
|
|
10
|
-
import { ITransition } from "
|
|
11
|
-
import type { Sound } from "
|
|
12
|
-
import type { Script } from "
|
|
1
|
+
import { LogicAction } from "../action/logicAction";
|
|
2
|
+
import type { Story } from "../elements/story";
|
|
3
|
+
import type { ConditionData } from "../elements/condition";
|
|
4
|
+
import { Background, CommonImage } from "../types";
|
|
5
|
+
import { Transform } from "../elements/transform/transform";
|
|
6
|
+
import type { Scene } from "../elements/scene";
|
|
7
|
+
import type { Sentence } from "../elements/text";
|
|
8
|
+
import type { MenuData } from "../elements/menu";
|
|
9
|
+
import { Awaitable } from "../../../util/data";
|
|
10
|
+
import { ITransition } from "../elements/transition/type";
|
|
11
|
+
import type { Sound } from "../elements/sound";
|
|
12
|
+
import type { Script } from "../elements/script";
|
|
13
13
|
export declare const CharacterActionTypes: {
|
|
14
14
|
readonly say: "character:say";
|
|
15
15
|
readonly action: "character:action";
|
|
@@ -79,15 +79,17 @@ export declare const SoundActionTypes: {
|
|
|
79
79
|
readonly fade: "sound:fade";
|
|
80
80
|
readonly setVolume: "sound:setVolume";
|
|
81
81
|
readonly setRate: "sound:setRate";
|
|
82
|
+
readonly pause: "sound:pause";
|
|
83
|
+
readonly resume: "sound:resume";
|
|
82
84
|
};
|
|
83
85
|
export type SoundActionContentType = {
|
|
84
86
|
[K in typeof SoundActionTypes[keyof typeof SoundActionTypes]]: K extends "sound:play" ? [void] : K extends "sound:stop" ? [void] : K extends "sound:fade" ? [
|
|
85
87
|
{
|
|
86
|
-
start
|
|
88
|
+
start?: number;
|
|
87
89
|
end: number;
|
|
88
90
|
duration: number;
|
|
89
91
|
}
|
|
90
|
-
] : K extends "sound:setVolume" ? [number] : K extends "sound:setRate" ? [number] : any;
|
|
92
|
+
] : K extends "sound:setVolume" ? [number] : K extends "sound:setRate" ? [number] : K extends "sound:pause" ? [void] : K extends "sound:resume" ? [void] : any;
|
|
91
93
|
};
|
|
92
94
|
export declare const ControlActionTypes: {
|
|
93
95
|
readonly action: "control:action";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ContentNode } from "
|
|
2
|
-
import { Awaitable } from "
|
|
3
|
-
import { Image } from "
|
|
4
|
-
import { LogicAction } from "
|
|
5
|
-
import { Action } from "
|
|
6
|
-
import type { Character } from "
|
|
7
|
-
import type { Scene } from "
|
|
8
|
-
import type { Story } from "
|
|
9
|
-
import type { Script } from "
|
|
10
|
-
import type { Menu } from "
|
|
11
|
-
import type { Condition } from "
|
|
1
|
+
import { ContentNode } from "../action/tree/actionTree";
|
|
2
|
+
import { Awaitable } from "../../../util/data";
|
|
3
|
+
import { Image } from "../elements/image";
|
|
4
|
+
import { LogicAction } from "../action/logicAction";
|
|
5
|
+
import { Action } from "../action/action";
|
|
6
|
+
import type { Character } from "../elements/text";
|
|
7
|
+
import type { Scene } from "../elements/scene";
|
|
8
|
+
import type { Story } from "../elements/story";
|
|
9
|
+
import type { Script } from "../elements/script";
|
|
10
|
+
import type { Menu } from "../elements/menu";
|
|
11
|
+
import type { Condition } from "../elements/condition";
|
|
12
12
|
import type { CalledActionResult } from "@core/gameTypes";
|
|
13
|
-
import { GameState } from "
|
|
14
|
-
import type { Sound } from "
|
|
15
|
-
import { Control } from "
|
|
16
|
-
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ControlActionTypes, ImageActionContentType, ImageActionTypes, MenuActionContentType, MenuActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, SoundActionTypes, StoryActionContentType, StoryActionTypes } from "
|
|
13
|
+
import { GameState } from "../../player/gameState";
|
|
14
|
+
import type { Sound } from "../elements/sound";
|
|
15
|
+
import { Control } from "../elements/control";
|
|
16
|
+
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ControlActionTypes, ImageActionContentType, ImageActionTypes, MenuActionContentType, MenuActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, SoundActionTypes, StoryActionContentType, StoryActionTypes } from "../action/actionTypes";
|
|
17
17
|
export declare class TypedAction<ContentType extends Record<string, any> = Record<string, any>, T extends keyof ContentType & string = keyof ContentType & string, Callee extends LogicAction.GameElement = LogicAction.GameElement> extends Action<ContentType[T], Callee> {
|
|
18
18
|
callee: Callee;
|
|
19
19
|
constructor(callee: Callee, type: any, contentNode: ContentNode<ContentType[T]>);
|
|
@@ -97,6 +97,8 @@ export declare class SoundAction<T extends typeof SoundActionTypes[keyof typeof
|
|
|
97
97
|
readonly fade: "sound:fade";
|
|
98
98
|
readonly setVolume: "sound:setVolume";
|
|
99
99
|
readonly setRate: "sound:setRate";
|
|
100
|
+
readonly pause: "sound:pause";
|
|
101
|
+
readonly resume: "sound:resume";
|
|
100
102
|
};
|
|
101
103
|
static initSound(state: GameState, sound: Sound): void;
|
|
102
104
|
executeAction(state: GameState): CalledActionResult | Awaitable<CalledActionResult, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContentNode, RenderableNode, RootNode } from "
|
|
2
|
-
import { LogicAction } from "
|
|
1
|
+
import { ContentNode, RenderableNode, RootNode } from "../action/tree/actionTree";
|
|
2
|
+
import { LogicAction } from "../action/logicAction";
|
|
3
3
|
export declare class Constructable<T extends typeof Constructable = any, TAction extends LogicAction.Actions = LogicAction.Actions, CAction extends LogicAction.Actions = LogicAction.Actions> {
|
|
4
4
|
static targetAction: any;
|
|
5
5
|
private readonly actions;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Character } from "
|
|
2
|
-
import type { Scene } from "
|
|
3
|
-
import type { Story } from "
|
|
4
|
-
import type { Image } from "
|
|
5
|
-
import type { Condition } from "
|
|
6
|
-
import type { Script } from "
|
|
7
|
-
import type { Menu } from "
|
|
8
|
-
import { Values } from "
|
|
9
|
-
import { CharacterAction, ConditionAction, ControlAction, ImageAction, MenuAction, SceneAction, ScriptAction, SoundAction, StoryAction, TypedAction } from "
|
|
10
|
-
import { Sound } from "
|
|
11
|
-
import { Control } from "
|
|
12
|
-
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ImageActionContentType, ImageActionTypes, MenuActionContentType, MenuActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, StoryActionContentType, StoryActionTypes } from "
|
|
1
|
+
import type { Character } from "../elements/text";
|
|
2
|
+
import type { Scene } from "../elements/scene";
|
|
3
|
+
import type { Story } from "../elements/story";
|
|
4
|
+
import type { Image } from "../elements/image";
|
|
5
|
+
import type { Condition } from "../elements/condition";
|
|
6
|
+
import type { Script } from "../elements/script";
|
|
7
|
+
import type { Menu } from "../elements/menu";
|
|
8
|
+
import { Values } from "../../../util/data";
|
|
9
|
+
import { CharacterAction, ConditionAction, ControlAction, ImageAction, MenuAction, SceneAction, ScriptAction, SoundAction, StoryAction, TypedAction } from "../action/actions";
|
|
10
|
+
import { Sound } from "../elements/sound";
|
|
11
|
+
import { Control } from "../elements/control";
|
|
12
|
+
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ImageActionContentType, ImageActionTypes, MenuActionContentType, MenuActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, StoryActionContentType, StoryActionTypes } from "../action/actionTypes";
|
|
13
13
|
export declare namespace LogicAction {
|
|
14
14
|
type GameElement = Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control;
|
|
15
15
|
type Actions = (TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Background, NextJSStaticImageData } from "
|
|
2
|
-
import type { Scene } from "
|
|
3
|
-
import type { Image } from "
|
|
1
|
+
import type { Background, NextJSStaticImageData } from "../types";
|
|
2
|
+
import type { Scene } from "../elements/scene";
|
|
3
|
+
import type { Image } from "../elements/image";
|
|
4
4
|
export declare class Utils {
|
|
5
5
|
static srcToString(src: string | NextJSStaticImageData): string;
|
|
6
6
|
static staticImageDataToSrc(image: NextJSStaticImageData | string): string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Character, Sentence, Word } from "../elements/text";
|
|
2
2
|
import { Condition, Lambda } from "../elements/condition";
|
|
3
|
-
import { Control } from "
|
|
4
|
-
import { Game } from "
|
|
3
|
+
import { Control } from "../elements/control";
|
|
4
|
+
import { Game } from "../game";
|
|
5
5
|
import { Image } from "../elements/image";
|
|
6
6
|
import { Menu } from "../elements/menu";
|
|
7
7
|
import { Scene } from "../elements/scene";
|
|
8
8
|
import { Script } from "../elements/script";
|
|
9
|
-
import { Sound, SoundType } from "
|
|
9
|
+
import { Sound, SoundType } from "../elements/sound";
|
|
10
10
|
import { Story } from "../elements/story";
|
|
11
|
-
import { Transform } from "
|
|
11
|
+
import { Transform } from "../elements/transform/transform";
|
|
12
12
|
import { Utils } from "./Utils";
|
|
13
13
|
export { Character, Condition, Control, Game, Image, Lambda, Menu, Scene, Script, Sentence, Sound, SoundType, Story, Transform, Utils, Word };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { LiveGame } from "
|
|
2
|
-
import { GameState } from "
|
|
1
|
+
import { LiveGame } from "../game";
|
|
2
|
+
import { GameState } from "../../player/gameState";
|
|
3
3
|
export { LiveGame, GameState };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import Player from "
|
|
2
|
-
import GameProviders from "
|
|
3
|
-
import { GameState } from "
|
|
4
|
-
|
|
1
|
+
import Player from "../../player/elements/Player";
|
|
2
|
+
import GameProviders from "../../player/provider/providers";
|
|
3
|
+
import { GameState } from "../../player/gameState";
|
|
4
|
+
import { useGame } from "../../../game/player/provider/game-state";
|
|
5
|
+
export * from "../../player/type";
|
|
6
|
+
export * from "../../player/libElements";
|
|
7
|
+
export { GameProviders, Player, useGame, GameState, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Align, CommonPosition, Coord2D, CommonPositionType } from "
|
|
1
|
+
import { Align, CommonPosition, Coord2D, CommonPositionType } from "../elements/transform/position";
|
|
2
2
|
export { Align, CommonPosition, Coord2D, CommonPositionType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ITransition } from "
|
|
2
|
-
import { Fade } from "
|
|
3
|
-
import { FadeIn } from "
|
|
4
|
-
import { Dissolve } from "
|
|
1
|
+
import { ITransition } from "../elements/transition/type";
|
|
2
|
+
import { Fade } from "../elements/transition/fade";
|
|
3
|
+
import { FadeIn } from "../elements/transition/fadeIn";
|
|
4
|
+
import { Dissolve } from "../elements/transition/dissolve";
|
|
5
5
|
export { Fade, FadeIn, Dissolve };
|
|
6
6
|
export type { ITransition };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TransformDefinitions } from "
|
|
1
|
+
import { TransformDefinitions } from "../elements/transform/type";
|
|
2
2
|
export type { TransformDefinitions, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RenderableNode } from "
|
|
2
|
-
import { LogicAction } from "
|
|
3
|
-
import { Actionable } from "
|
|
4
|
-
import { GameState } from "
|
|
1
|
+
import { RenderableNode } from "../action/tree/actionTree";
|
|
2
|
+
import { LogicAction } from "../action/logicAction";
|
|
3
|
+
import { Actionable } from "../action/actionable";
|
|
4
|
+
import { GameState } from "../../player/gameState";
|
|
5
5
|
export type ConditionConfig = {};
|
|
6
6
|
interface LambdaCtx {
|
|
7
7
|
gameState: GameState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Actionable } from "
|
|
2
|
-
import { LogicAction } from "
|
|
1
|
+
import { Actionable } from "../action/actionable";
|
|
2
|
+
import { LogicAction } from "../action/logicAction";
|
|
3
3
|
import Actions = LogicAction.Actions;
|
|
4
4
|
export declare class Control extends Actionable {
|
|
5
5
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CommonImage, NextJSStaticImageData, StaticImageData } from "@core/types";
|
|
2
|
-
import { DeepPartial, EventDispatcher } from "@lib/util/data";
|
|
3
|
-
import { Transform } from "./transform/transform";
|
|
4
|
-
import { ImageAction } from "@core/action/actions";
|
|
5
|
-
import { Actionable } from "@core/action/actionable";
|
|
6
|
-
import type { TransformDefinitions } from "@core/elements/transform/type";
|
|
7
1
|
import React from "react";
|
|
2
|
+
import type { TransformDefinitions } from "../elements/transform/type";
|
|
8
3
|
import { AnimationScope } from "framer-motion";
|
|
9
|
-
import {
|
|
4
|
+
import { ImageAction } from "../action/actions";
|
|
5
|
+
import { Actionable } from "../action/actionable";
|
|
6
|
+
import { Transform } from "./transform/transform";
|
|
7
|
+
import { CommonImage, NextJSStaticImageData, StaticImageData } from "../types";
|
|
8
|
+
import { ITransition } from "../elements/transition/type";
|
|
9
|
+
import { DeepPartial, EventDispatcher } from "../../../util/data";
|
|
10
10
|
export type ImageConfig = {
|
|
11
11
|
src: string | NextJSStaticImageData;
|
|
12
12
|
display: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Sentence, Word } from "./text";
|
|
2
|
-
import { RenderableNode } from "
|
|
3
|
-
import { LogicAction } from "
|
|
4
|
-
import { MenuAction } from "
|
|
5
|
-
import { Actionable } from "
|
|
2
|
+
import { RenderableNode } from "../action/tree/actionTree";
|
|
3
|
+
import { LogicAction } from "../action/logicAction";
|
|
4
|
+
import { MenuAction } from "../action/actions";
|
|
5
|
+
import { Actionable } from "../action/actionable";
|
|
6
6
|
import Actions = LogicAction.Actions;
|
|
7
7
|
export type MenuConfig = {};
|
|
8
8
|
export type MenuChoice = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Constructable } from "../action/constructable";
|
|
2
|
-
import { Awaitable, DeepPartial, EventDispatcher } from "
|
|
3
|
-
import { Background, CommonImage } from "
|
|
4
|
-
import { LogicAction } from "
|
|
5
|
-
import { SceneAction } from "
|
|
6
|
-
import { Transform } from "
|
|
7
|
-
import { ITransition } from "
|
|
8
|
-
import { SrcManager } from "
|
|
9
|
-
import { Sound, SoundDataRaw } from "
|
|
10
|
-
import { TransformDefinitions } from "
|
|
2
|
+
import { Awaitable, DeepPartial, EventDispatcher } from "../../../util/data";
|
|
3
|
+
import { Background, CommonImage } from "../types";
|
|
4
|
+
import { LogicAction } from "../action/logicAction";
|
|
5
|
+
import { SceneAction } from "../action/actions";
|
|
6
|
+
import { Transform } from "../elements/transform/transform";
|
|
7
|
+
import { ITransition } from "../elements/transition/type";
|
|
8
|
+
import { SrcManager } from "../elements/srcManager";
|
|
9
|
+
import { Sound, SoundDataRaw } from "../elements/sound";
|
|
10
|
+
import { TransformDefinitions } from "../elements/transform/type";
|
|
11
11
|
import Actions = LogicAction.Actions;
|
|
12
12
|
import ImageTransformProps = TransformDefinitions.ImageTransformProps;
|
|
13
13
|
export type SceneConfig = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LogicAction } from "
|
|
2
|
-
import { Actionable } from "
|
|
3
|
-
import { GameState } from "
|
|
1
|
+
import { LogicAction } from "../action/logicAction";
|
|
2
|
+
import { Actionable } from "../action/actionable";
|
|
3
|
+
import { GameState } from "../../player/gameState";
|
|
4
4
|
import Actions = LogicAction.Actions;
|
|
5
5
|
export interface ScriptCtx {
|
|
6
6
|
script: Script;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Actionable } from "
|
|
2
|
-
import { DeepPartial } from "
|
|
1
|
+
import { Actionable } from "../action/actionable";
|
|
2
|
+
import { DeepPartial } from "../../../util/data";
|
|
3
3
|
import * as Howler from "howler";
|
|
4
4
|
import { HowlOptions } from "howler";
|
|
5
5
|
export declare enum SoundType {
|
|
@@ -42,9 +42,11 @@ export declare class Sound extends Actionable<SoundDataRaw> {
|
|
|
42
42
|
constructor(config?: DeepPartial<SoundConfig>);
|
|
43
43
|
play(): this;
|
|
44
44
|
stop(): this;
|
|
45
|
-
fade(start: number, end: number, duration: number): this;
|
|
45
|
+
fade(start: number | undefined, end: number, duration: number): this;
|
|
46
46
|
setVolume(volume: number): this;
|
|
47
47
|
setRate(rate: number): this;
|
|
48
|
+
pause(fade?: number): this;
|
|
49
|
+
resume(fade?: number): this;
|
|
48
50
|
getHowlOptions(): HowlOptions;
|
|
49
51
|
getSrc(): string;
|
|
50
52
|
$setToken(token: any): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Sound } from "
|
|
2
|
-
import { Image } from "
|
|
3
|
-
import { StaticImageData } from "
|
|
1
|
+
import { Sound } from "../elements/sound";
|
|
2
|
+
import { Image } from "../elements/image";
|
|
3
|
+
import { StaticImageData } from "../types";
|
|
4
4
|
export type SrcType = "image" | "video" | "audio";
|
|
5
5
|
export type Src = {
|
|
6
6
|
type: "image";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Constructable } from "../action/constructable";
|
|
2
2
|
import { LogicAction } from "../game";
|
|
3
|
-
import { SceneAction, StoryAction } from "
|
|
4
|
-
import { RawData, RenderableNode } from "
|
|
5
|
-
import { Scene } from "
|
|
3
|
+
import { SceneAction, StoryAction } from "../action/actions";
|
|
4
|
+
import { RawData, RenderableNode } from "../action/tree/actionTree";
|
|
5
|
+
import { Scene } from "../elements/scene";
|
|
6
6
|
export type StoryConfig = {};
|
|
7
7
|
export type ElementStateRaw = Record<string, any>;
|
|
8
8
|
export type NodeChildIdMap = Map<string, string>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Background, CommonImage, CommonImagePosition } from "
|
|
1
|
+
import type { Background, CommonImage, CommonImagePosition } from "../../types";
|
|
2
2
|
import type { AnimationPlaybackControls, DOMKeyframesDefinition, DynamicAnimationOptions } from "framer-motion";
|
|
3
|
-
import { DeepPartial } from "
|
|
4
|
-
import { GameState } from "
|
|
3
|
+
import { DeepPartial } from "../../../../util/data";
|
|
4
|
+
import { GameState } from "../../../player/gameState";
|
|
5
5
|
import { TransformDefinitions } from "./type";
|
|
6
6
|
import { Align, Coord2D, IPosition } from "./position";
|
|
7
|
-
import { CSSProps } from "
|
|
7
|
+
import { CSSProps } from "../../elements/transition/type";
|
|
8
8
|
import Sequence = TransformDefinitions.Sequence;
|
|
9
9
|
import SequenceProps = TransformDefinitions.SequenceProps;
|
|
10
10
|
export type Transformers = "position" | "opacity" | "scale" | "rotation" | "display" | "src" | "backgroundColor" | "backgroundOpacity" | "transform";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Background, CommonImage } from "
|
|
2
|
-
import { DeepPartial } from "
|
|
1
|
+
import { Background, CommonImage } from "../../types";
|
|
2
|
+
import { DeepPartial } from "../../../../util/data";
|
|
3
3
|
import type { AnimationPlaybackControls, AnimationScope, AnimationSequence, DOMKeyframesDefinition, DynamicAnimationOptions, ElementOrSelector, MotionValue, ValueAnimationTransition } from "framer-motion";
|
|
4
4
|
export declare namespace TransformDefinitions {
|
|
5
5
|
type BezierDefinition = [number, number, number, number];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventDispatcher } from "
|
|
1
|
+
import { EventDispatcher } from "../../../../util/data";
|
|
2
2
|
import { ElementProp, EventTypes, ITransition } from "./type";
|
|
3
3
|
import { AnimationPlaybackControls, ValueAnimationTransition } from "framer-motion";
|
|
4
4
|
export declare class Base<T extends ElementProp> implements ITransition<T> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementProp, ITransition } from "./type";
|
|
2
2
|
import { Base } from "./base";
|
|
3
|
-
import { Scene } from "
|
|
4
|
-
import { NextJSStaticImageData } from "
|
|
3
|
+
import { Scene } from "../../elements/scene";
|
|
4
|
+
import { NextJSStaticImageData } from "../../types";
|
|
5
5
|
export type DissolveElementProps = {
|
|
6
6
|
opacity: number;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementProp, ITransition } from "./type";
|
|
2
2
|
import { Base } from "./base";
|
|
3
|
-
import { Scene } from "
|
|
4
|
-
import { StaticImageData } from "
|
|
3
|
+
import { Scene } from "../../elements/scene";
|
|
4
|
+
import { StaticImageData } from "../../types";
|
|
5
5
|
export type FadeElementProps = {
|
|
6
6
|
opacity: number;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ElementProp, ITransition } from "
|
|
2
|
-
import { Base } from "
|
|
3
|
-
import { Scene } from "
|
|
4
|
-
import { StaticImageData } from "
|
|
1
|
+
import { ElementProp, ITransition } from "../../elements/transition/type";
|
|
2
|
+
import { Base } from "../../elements/transition/base";
|
|
3
|
+
import { Scene } from "../../elements/scene";
|
|
4
|
+
import { StaticImageData } from "../../types";
|
|
5
5
|
type FadeInProps = {
|
|
6
6
|
style?: {
|
|
7
7
|
opacity: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EventDispatcher } from "
|
|
1
|
+
import type { EventDispatcher } from "../../../../util/data";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { DOMKeyframesDefinition } from "framer-motion";
|
|
4
4
|
export type ElementProp<T extends Element = Element, U extends React.HTMLAttributes<T> = React.HTMLAttributes<T>> = React.JSX.IntrinsicAttributes & React.ClassAttributes<T> & React.HTMLAttributes<T> & U;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { CalledActionResult, GameConfig, GameSettings, SavedGame } from "./gameTypes";
|
|
2
|
-
import { Awaitable, DeepPartial } from "
|
|
3
|
-
import { Storable } from "
|
|
2
|
+
import { Awaitable, DeepPartial } from "../../util/data";
|
|
3
|
+
import { Storable } from "./store/storable";
|
|
4
4
|
import { Story } from "./elements/story";
|
|
5
|
-
import { LogicAction } from "
|
|
6
|
-
import { GameState } from "
|
|
5
|
+
import { LogicAction } from "./action/logicAction";
|
|
6
|
+
import { GameState } from "../player/gameState";
|
|
7
|
+
import { ComponentsTypes } from "../player/elements/type";
|
|
7
8
|
declare const IdManager_base: {
|
|
8
9
|
new (): {};
|
|
9
10
|
_instance: {} | null;
|
|
@@ -26,6 +27,9 @@ declare enum GameSettingsNamespace {
|
|
|
26
27
|
}
|
|
27
28
|
export declare class Game {
|
|
28
29
|
static defaultSettings: GameSettings;
|
|
30
|
+
static ComponentTypes: {
|
|
31
|
+
[K in keyof ComponentsTypes]: K;
|
|
32
|
+
};
|
|
29
33
|
static DefaultConfig: GameConfig;
|
|
30
34
|
static GameSettingsNamespace: typeof GameSettingsNamespace;
|
|
31
35
|
readonly config: Readonly<GameConfig>;
|
|
@@ -36,6 +40,7 @@ export declare class Game {
|
|
|
36
40
|
*/
|
|
37
41
|
constructor(config: DeepPartial<GameConfig>);
|
|
38
42
|
static getIdManager(): IdManager;
|
|
43
|
+
useComponent<T extends keyof ComponentsTypes>(key: T, components: ComponentsTypes[T]): this;
|
|
39
44
|
getLiveGame(): LiveGame;
|
|
40
45
|
private createLiveGame;
|
|
41
46
|
}
|