narraleaf-react 0.9.0 → 0.9.1
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/LICENSE +373 -373
- package/README.md +165 -147
- package/dist/built-in.d.ts +3 -0
- package/dist/built-in.js +1 -0
- package/dist/game/nlcore/action/action.d.ts +9 -5
- package/dist/game/nlcore/action/actionTypes.d.ts +10 -10
- package/dist/game/nlcore/action/actions/menuAction.d.ts +1 -4
- package/dist/game/nlcore/action/logicAction.d.ts +29 -29
- package/dist/game/nlcore/common/elements.d.ts +4 -2
- package/dist/game/nlcore/common/transition.d.ts +2 -1
- package/dist/game/nlcore/elements/built-in/DevTools.d.ts +2 -0
- package/dist/game/nlcore/elements/built-in/built-in.d.ts +2 -0
- package/dist/game/nlcore/elements/built-in/screenEffects.d.ts +31 -0
- package/dist/game/nlcore/elements/character/avatar.d.ts +35 -0
- package/dist/game/nlcore/elements/character/sentence.d.ts +14 -0
- package/dist/game/nlcore/elements/character.d.ts +30 -0
- package/dist/game/nlcore/elements/displayable/displayable.d.ts +84 -0
- package/dist/game/nlcore/elements/displayable/image.d.ts +2 -2
- package/dist/game/nlcore/elements/displayable/text.d.ts +2 -2
- package/dist/game/nlcore/elements/layer.d.ts +1 -2
- package/dist/game/nlcore/elements/scene.d.ts +2 -1
- package/dist/game/nlcore/elements/transform/transform.d.ts +26 -3
- package/dist/game/nlcore/elements/transform/type.d.ts +30 -2
- package/dist/game/nlcore/elements/transition/transitions/image/maskTransition.d.ts +38 -0
- package/dist/game/player/Tasks.d.ts +4 -1
- package/dist/game/player/elements/Player.d.ts +1 -1
- package/dist/game/player/elements/menu/type.d.ts +1 -0
- package/dist/game/player/elements/say/Avatar.d.ts +13 -0
- package/dist/game/player/elements/say/Sentence.d.ts +70 -1
- package/dist/game/player/elements/say/UIDialog.d.ts +6 -2
- package/dist/game/player/elements/say/type.d.ts +4 -2
- package/dist/game/player/elements/say/useDialog.d.ts +3 -0
- package/dist/game/player/elements/type.d.ts +6 -0
- package/dist/game/player/gameState.d.ts +3 -0
- package/dist/game/player/lib/AudioManager.d.ts +1 -0
- package/dist/game/player/lib/ErrorFallback.d.ts +5 -1
- package/dist/game/player/libElements.d.ts +5 -2
- package/dist/game/player/provider/game-state.d.ts +1 -0
- package/dist/main.js +42 -40
- package/dist/util/data.d.ts +15 -2
- package/package.json +114 -107
package/README.md
CHANGED
|
@@ -1,147 +1,165 @@
|
|
|
1
|
-
<picture>
|
|
2
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-transparent.png">
|
|
3
|
-
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-light.png">
|
|
4
|
-
<img alt="NarraLeaf Logo" src="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-light.png">
|
|
5
|
-
</picture>
|
|
6
|
-
|
|
7
|
-
<h1 align="center">NarraLeaf-React</h1>
|
|
8
|
-
|
|
9
|
-
<h4 align="center">A React visual novel player framework</
|
|
10
|
-
|
|
11
|
-
<p align="center">English | <a href="docs/README.zh-CN.md">简体中文</a></p>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## What is NarraLeaf-React?
|
|
15
|
-
|
|
16
|
-
NarraLeaf-React is a lightweight front-end visual novel player.
|
|
17
|
-
NL focuses on visual novel playing, so the user interface can be customized very easily.
|
|
18
|
-
|
|
19
|
-
It doesn't use any rendering libraries and can be used on any web platform (e.g. Electron)
|
|
20
|
-
|
|
21
|
-
## Why NarraLeaf-React?
|
|
22
|
-
|
|
23
|
-
- **Lightweight**: NarraLeaf-React is a front-end framework, and it doesn't use any rendering libraries.
|
|
24
|
-
- **Customizable**: You can customize the UI as you like, even replace the whole components.
|
|
25
|
-
- **Easy to use**: It is easy to use and has a simple API that is built for developers. Based on OOP principles.
|
|
26
|
-
|
|
27
|
-
### Scripting
|
|
28
|
-
|
|
29
|
-
NarraLeaf-React uses TypeScript for all scripting, so you don't have to learn a whole new language to use it.
|
|
30
|
-
|
|
31
|
-
It also has a highly abstracted and easy-to-use API, for example:
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
import {Character, Menu, Scene, c, b} from "narraleaf-react";
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
const scene1 = new Scene("Scene1: Hello World", {
|
|
39
|
-
background: "/link/to/background.jpg",
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const jS = new Character("John Smith");
|
|
43
|
-
const jD = new Character("John Doe");
|
|
44
|
-
|
|
45
|
-
scene1.action([
|
|
46
|
-
jS`Hello, world!`,
|
|
47
|
-
jS`This is my first ${b("NarraLeaf")} story.`,
|
|
48
|
-
jS`Start editing ${c("src/story.js", "#00f")} and enjoy the journey!`,
|
|
49
|
-
|
|
50
|
-
jD`Also, don't forget to check out the ${c("documentation", "#00f")}!`,
|
|
51
|
-
|
|
52
|
-
"By the way, the documentation is available on https://
|
|
53
|
-
"You can also visit the website for demo and more information.",
|
|
54
|
-
|
|
55
|
-
Menu.prompt("Start the journey")
|
|
56
|
-
|
|
57
|
-
.choose("Yes I will!", [
|
|
58
|
-
jS`Great! Let's start the journey!`,
|
|
59
|
-
jS`You can open issues on GitHub if you have any questions.`
|
|
60
|
-
])
|
|
61
|
-
|
|
62
|
-
.choose("No, I'm going to check the documentation", [
|
|
63
|
-
jS`Sure! Take your time!`
|
|
64
|
-
])
|
|
65
|
-
]);
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
For more information, please visit [
|
|
69
|
-
|
|
70
|
-
## Get Started
|
|
71
|
-
|
|
72
|
-
### Install
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npm install narraleaf-react
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Documentation
|
|
79
|
-
|
|
80
|
-
- [Introduction](https://
|
|
81
|
-
- [Quick Start](https://
|
|
82
|
-
- [Installation](https://
|
|
83
|
-
- [Basic](https://
|
|
84
|
-
- [Create a Scene](https://
|
|
85
|
-
- [Add Actions](https://
|
|
86
|
-
- [Show Dialog](https://
|
|
87
|
-
- [Show Image](https://
|
|
88
|
-
- [Play Story](https://
|
|
89
|
-
- [Make Choices](https://
|
|
90
|
-
- [Play Sound](https://
|
|
91
|
-
- [Store Data](https://
|
|
92
|
-
- [Conditional](https://
|
|
93
|
-
- [Voice](https://
|
|
94
|
-
- [Manage Preferences](https://
|
|
95
|
-
- [Solutions](https://
|
|
96
|
-
- [Customizing the
|
|
97
|
-
- [Migration from Ren'Py](https://
|
|
98
|
-
- [
|
|
99
|
-
- [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
- [
|
|
110
|
-
- [
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
- [
|
|
115
|
-
- [
|
|
116
|
-
- [
|
|
117
|
-
- [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
- [
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- [
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
- [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-transparent.png">
|
|
3
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-light.png">
|
|
4
|
+
<img alt="NarraLeaf Logo" src="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-light.png">
|
|
5
|
+
</picture>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">NarraLeaf-React</h1>
|
|
8
|
+
|
|
9
|
+
<h4 align="center">A React visual novel player framework</h4>
|
|
10
|
+
|
|
11
|
+
<p align="center">English | <a href="docs/README.zh-CN.md">简体中文</a></p>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## What is NarraLeaf-React?
|
|
15
|
+
|
|
16
|
+
NarraLeaf-React is a lightweight front-end visual novel player.
|
|
17
|
+
NL focuses on visual novel playing, so the user interface can be customized very easily.
|
|
18
|
+
|
|
19
|
+
It doesn't use any rendering libraries and can be used on any web platform (e.g. Electron)
|
|
20
|
+
|
|
21
|
+
## Why NarraLeaf-React?
|
|
22
|
+
|
|
23
|
+
- **Lightweight**: NarraLeaf-React is a front-end framework, and it doesn't use any rendering libraries.
|
|
24
|
+
- **Customizable**: You can customize the UI as you like, even replace the whole components.
|
|
25
|
+
- **Easy to use**: It is easy to use and has a simple API that is built for developers. Based on OOP principles.
|
|
26
|
+
|
|
27
|
+
### Scripting
|
|
28
|
+
|
|
29
|
+
NarraLeaf-React uses TypeScript for all scripting, so you don't have to learn a whole new language to use it.
|
|
30
|
+
|
|
31
|
+
It also has a highly abstracted and easy-to-use API, for example:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import {Character, Menu, Scene, c, b} from "narraleaf-react";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const scene1 = new Scene("Scene1: Hello World", {
|
|
39
|
+
background: "/link/to/background.jpg",
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const jS = new Character("John Smith");
|
|
43
|
+
const jD = new Character("John Doe");
|
|
44
|
+
|
|
45
|
+
scene1.action([
|
|
46
|
+
jS`Hello, world!`,
|
|
47
|
+
jS`This is my first ${b("NarraLeaf")} story.`,
|
|
48
|
+
jS`Start editing ${c("src/story.js", "#00f")} and enjoy the journey!`,
|
|
49
|
+
|
|
50
|
+
jD`Also, don't forget to check out the ${c("documentation", "#00f")}!`,
|
|
51
|
+
|
|
52
|
+
"By the way, the documentation is available on https://www.narraleaf.com/docs/narraleaf-react",
|
|
53
|
+
"You can also visit the website for demo and more information.",
|
|
54
|
+
|
|
55
|
+
Menu.prompt("Start the journey")
|
|
56
|
+
|
|
57
|
+
.choose("Yes I will!", [
|
|
58
|
+
jS`Great! Let's start the journey!`,
|
|
59
|
+
jS`You can open issues on GitHub if you have any questions.`
|
|
60
|
+
])
|
|
61
|
+
|
|
62
|
+
.choose("No, I'm going to check the documentation", [
|
|
63
|
+
jS`Sure! Take your time!`
|
|
64
|
+
])
|
|
65
|
+
]);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
For more information, please visit the [NarraLeaf-React documentation](https://www.narraleaf.com/docs/narraleaf-react).
|
|
69
|
+
|
|
70
|
+
## Get Started
|
|
71
|
+
|
|
72
|
+
### Install
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install narraleaf-react
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Documentation
|
|
79
|
+
|
|
80
|
+
- [Introduction](https://www.narraleaf.com/docs/narraleaf-react)
|
|
81
|
+
- [Quick Start](https://www.narraleaf.com/docs/narraleaf-react/quick-start)
|
|
82
|
+
- [Installation](https://www.narraleaf.com/docs/narraleaf-react/installation)
|
|
83
|
+
- [Basic](https://www.narraleaf.com/docs/narraleaf-react/basic)
|
|
84
|
+
- [Create a Scene](https://www.narraleaf.com/docs/narraleaf-react/basic/create-scene)
|
|
85
|
+
- [Add Actions](https://www.narraleaf.com/docs/narraleaf-react/basic/add-actions)
|
|
86
|
+
- [Show Dialog](https://www.narraleaf.com/docs/narraleaf-react/basic/show-dialog)
|
|
87
|
+
- [Show Image](https://www.narraleaf.com/docs/narraleaf-react/basic/show-image)
|
|
88
|
+
- [Play Story](https://www.narraleaf.com/docs/narraleaf-react/basic/play-story)
|
|
89
|
+
- [Make Choices](https://www.narraleaf.com/docs/narraleaf-react/basic/make-choices)
|
|
90
|
+
- [Play Sound](https://www.narraleaf.com/docs/narraleaf-react/basic/sound)
|
|
91
|
+
- [Store Data](https://www.narraleaf.com/docs/narraleaf-react/basic/store-data)
|
|
92
|
+
- [Conditional](https://www.narraleaf.com/docs/narraleaf-react/basic/conditional)
|
|
93
|
+
- [Voice](https://www.narraleaf.com/docs/narraleaf-react/basic/voice)
|
|
94
|
+
- [Manage Preferences](https://www.narraleaf.com/docs/narraleaf-react/basic/manage-preferences)
|
|
95
|
+
- [Solutions](https://www.narraleaf.com/docs/narraleaf-react/solutions)
|
|
96
|
+
- [Customizing the Font](https://www.narraleaf.com/docs/narraleaf-react/solutions/font)
|
|
97
|
+
- [Migration from Ren'Py](https://www.narraleaf.com/docs/narraleaf-react/solutions/from-renpy)
|
|
98
|
+
- [Quick Menu](https://www.narraleaf.com/docs/narraleaf-react/solutions/quick-menu)
|
|
99
|
+
- [Dialog Avatar](https://www.narraleaf.com/docs/narraleaf-react/solutions/dialog-avatar)
|
|
100
|
+
- [Custom Dialog](https://www.narraleaf.com/docs/narraleaf-react/solutions/custom-dialog)
|
|
101
|
+
- [Custom NVL Dialog](https://www.narraleaf.com/docs/narraleaf-react/solutions/custom-nvl-dialog)
|
|
102
|
+
- [Custom Menu](https://www.narraleaf.com/docs/narraleaf-react/solutions/custom-menu)
|
|
103
|
+
- [Page Overlay Settings](https://www.narraleaf.com/docs/narraleaf-react/solutions/page-overlay-settings)
|
|
104
|
+
- [Save System with localStorage](https://www.narraleaf.com/docs/narraleaf-react/solutions/save-system-localstorage)
|
|
105
|
+
- [Custom Notification](https://www.narraleaf.com/docs/narraleaf-react/solutions/custom-notification)
|
|
106
|
+
- [Gallery Service with localStorage](https://www.narraleaf.com/docs/narraleaf-react/solutions/gallery-service-localstorage)
|
|
107
|
+
- [Core](https://www.narraleaf.com/docs/narraleaf-react/core)
|
|
108
|
+
- [Elements](https://www.narraleaf.com/docs/narraleaf-react/core/elements)
|
|
109
|
+
- [Scene](https://www.narraleaf.com/docs/narraleaf-react/core/elements/scene)
|
|
110
|
+
- [Character](https://www.narraleaf.com/docs/narraleaf-react/core/elements/character)
|
|
111
|
+
- [Sentence](https://www.narraleaf.com/docs/narraleaf-react/core/elements/character/sentence)
|
|
112
|
+
- [Word](https://www.narraleaf.com/docs/narraleaf-react/core/elements/character/word)
|
|
113
|
+
- [Pause](https://www.narraleaf.com/docs/narraleaf-react/core/elements/character/pause)
|
|
114
|
+
- [Image](https://www.narraleaf.com/docs/narraleaf-react/core/elements/image)
|
|
115
|
+
- [Sound](https://www.narraleaf.com/docs/narraleaf-react/core/elements/sound)
|
|
116
|
+
- [Menu](https://www.narraleaf.com/docs/narraleaf-react/core/elements/menu)
|
|
117
|
+
- [Script](https://www.narraleaf.com/docs/narraleaf-react/core/elements/script)
|
|
118
|
+
- [Condition](https://www.narraleaf.com/docs/narraleaf-react/core/elements/condition)
|
|
119
|
+
- [Control](https://www.narraleaf.com/docs/narraleaf-react/core/elements/control)
|
|
120
|
+
- [Text](https://www.narraleaf.com/docs/narraleaf-react/core/elements/text)
|
|
121
|
+
- [Persistent](https://www.narraleaf.com/docs/narraleaf-react/core/elements/persistent)
|
|
122
|
+
- [Story](https://www.narraleaf.com/docs/narraleaf-react/core/elements/story)
|
|
123
|
+
- [Displayable](https://www.narraleaf.com/docs/narraleaf-react/core/elements/displayable)
|
|
124
|
+
- [Layer](https://www.narraleaf.com/docs/narraleaf-react/core/elements/layer)
|
|
125
|
+
- [Service](https://www.narraleaf.com/docs/narraleaf-react/core/elements/service)
|
|
126
|
+
- [Video](https://www.narraleaf.com/docs/narraleaf-react/core/elements/video)
|
|
127
|
+
- [Built-in Gallery](https://www.narraleaf.com/docs/narraleaf-react/core/elements/built-in/gallery)
|
|
128
|
+
- [Animation](https://www.narraleaf.com/docs/narraleaf-react/core/animation)
|
|
129
|
+
- [Transform](https://www.narraleaf.com/docs/narraleaf-react/core/animation/transform)
|
|
130
|
+
- [Transitions](https://www.narraleaf.com/docs/narraleaf-react/core/animation/transition)
|
|
131
|
+
- [Game](https://www.narraleaf.com/docs/narraleaf-react/core/game)
|
|
132
|
+
- [LiveGame](https://www.narraleaf.com/docs/narraleaf-react/core/game/live-game)
|
|
133
|
+
- [Storable](https://www.narraleaf.com/docs/narraleaf-react/core/game/storable)
|
|
134
|
+
- [Preference](https://www.narraleaf.com/docs/narraleaf-react/core/game/preference/preference)
|
|
135
|
+
- [Key Map](https://www.narraleaf.com/docs/narraleaf-react/core/game/key-map)
|
|
136
|
+
- [Hooks](https://www.narraleaf.com/docs/narraleaf-react/core/game/hooks)
|
|
137
|
+
- [Plugin](https://www.narraleaf.com/docs/narraleaf-react/core/plugin)
|
|
138
|
+
- [Utils](https://www.narraleaf.com/docs/narraleaf-react/core/utils)
|
|
139
|
+
- [Player](https://www.narraleaf.com/docs/narraleaf-react/player)
|
|
140
|
+
- [Player](https://www.narraleaf.com/docs/narraleaf-react/player/player)
|
|
141
|
+
- [FixedAspectRatioContainer](https://www.narraleaf.com/docs/narraleaf-react/player/fixed-aspect-ratio-container)
|
|
142
|
+
- [GameProviders](https://www.narraleaf.com/docs/narraleaf-react/player/game-providers)
|
|
143
|
+
- [Hooks](https://www.narraleaf.com/docs/narraleaf-react/player/hooks)
|
|
144
|
+
- [LayoutRouter](https://www.narraleaf.com/docs/narraleaf-react/player/page-router)
|
|
145
|
+
- [Dialog](https://www.narraleaf.com/docs/narraleaf-react/player/dialog)
|
|
146
|
+
- [Notification](https://www.narraleaf.com/docs/narraleaf-react/player/notification)
|
|
147
|
+
- [Menu](https://www.narraleaf.com/docs/narraleaf-react/player/menu)
|
|
148
|
+
- [NvlContainer](https://www.narraleaf.com/docs/narraleaf-react/player/nvl-container)
|
|
149
|
+
- About
|
|
150
|
+
- [License](https://www.narraleaf.com/docs/narraleaf-react/info/license)
|
|
151
|
+
- [Incompatible Changes](https://www.narraleaf.com/docs/narraleaf-react/info/incompatible-changes)
|
|
152
|
+
|
|
153
|
+
Read more in the [NarraLeaf-React documentation](https://www.narraleaf.com/docs/narraleaf-react).
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
> NarraLeaf-React is licensed under the MPL-2.0 License.
|
|
158
|
+
>
|
|
159
|
+
> We updated the license to MPL-2.0 on 2024-9-24.
|
|
160
|
+
|
|
161
|
+
## Contributing
|
|
162
|
+
|
|
163
|
+
We welcome all contributions.
|
|
164
|
+
If you have any ideas, just open an issue or a pull request.
|
|
165
|
+
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Gallery, DevTools, } from "narraleaf-react";
|
|
2
|
+
export { blink, effectLayer, vignette, } from "./game/nlcore/elements/built-in/screenEffects";
|
|
3
|
+
export type { BlinkOptions, EffectLayerOptions, ScreenEffectColor, VignetteOptions, } from "./game/nlcore/elements/built-in/screenEffects";
|
package/dist/built-in.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Gallery as L,DevTools as S}from"narraleaf-react";import{Control as r,Image as b,Layer as T,Transform as h}from"narraleaf-react";var d=new WeakMap;function y(e,t={}){let n=d.get(e);if(n)return n;let o=new T(t.name??"[[Effect Layer of "+e.config.name+"]]",{zIndex:t.zIndex??1e3});return e.config.layers.push(o),d.set(e,o),o}function k(e,t={}){let{closeDuration:n=180,hold:o=100,openDuration:p=220,easing:i="easeInOut",color:l="#000"}=t,f=y(e),a=u("[[Blink Top of "+e.config.name+"]]",l,f),s=u("[[Blink Bottom of "+e.config.name+"]]",l,f);return r.do([r.all([a.transform(c([[{opacity:1,clipPath:"inset(0 0 100% 0)"},{duration:0}],[{clipPath:"inset(0 0 50% 0)"},{duration:n,ease:i}]])),s.transform(c([[{opacity:1,clipPath:"inset(100% 0 0 0)"},{duration:0}],[{clipPath:"inset(50% 0 0 0)"},{duration:n,ease:i}]]))]),...o>0?[r.sleep(o)]:[],r.all([a.transform(c([[{clipPath:"inset(0 0 50% 0)"},{duration:0}],[{clipPath:"inset(0 0 100% 0)"},{duration:p,ease:i}],[{opacity:0,clipPath:"inset(0 0 100% 0)"},{duration:0}]])),s.transform(c([[{clipPath:"inset(50% 0 0 0)"},{duration:0}],[{clipPath:"inset(100% 0 0 0)"},{duration:p,ease:i}],[{opacity:0,clipPath:"inset(100% 0 0 0)"},{duration:0}]]))]),r.all([r.do([a.opacity(0,0),a.clearClip({duration:0})]),r.do([s.opacity(0,0),s.clearClip({duration:0})])])])}function E(e,t={}){let{duration:n=300,opacity:o=.72,color:p="#000",inner:i="44%",outer:l="78%",hold:f=600,easing:a="easeInOut"}=t,s=y(e),m=u("[[Vignette of "+e.config.name+"]]",p,s),g=`radial-gradient(circle at center, transparent ${i}, black ${l})`;return r.do([m.transform(c([[{opacity:0,maskImage:g,maskSize:"100% 100%",maskPosition:"center",maskRepeat:"no-repeat",maskMode:"alpha"},{duration:0}],[{opacity:o},{duration:n,ease:a}]])),...f>0?[r.sleep(f)]:[],m.transform(c([[{opacity:0},{duration:n,ease:a}]])),m.clearMask({duration:0})])}function u(e,t,n){return new b({name:e,src:t,autoFit:!0,opacity:0,layer:n})}function c(e){return new h(e.map(([t,n])=>({props:t,options:n})))}export{S as DevTools,L as Gallery,k as blink,y as effectLayer,E as vignette};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LogicAction } from "./logicAction";
|
|
1
|
+
import type { LogicAction } from "./logicAction";
|
|
2
2
|
import { ContentNode } from "../action/tree/actionTree";
|
|
3
3
|
import type { CalledActionResult } from "../gameTypes";
|
|
4
|
-
import { Awaitable } from "../../../util/data";
|
|
5
|
-
import { GameState } from "../../player/gameState";
|
|
6
|
-
import { Story } from "../elements/story";
|
|
7
|
-
import { ActionSearchOptions } from "../types";
|
|
4
|
+
import type { Awaitable } from "../../../util/data";
|
|
5
|
+
import type { GameState } from "../../player/gameState";
|
|
6
|
+
import type { Story } from "../elements/story";
|
|
7
|
+
import type { ActionSearchOptions } from "../types";
|
|
8
8
|
import type { StackModel } from "./stackModel";
|
|
9
9
|
export type ActionExecutionInjection = {
|
|
10
10
|
stackModel: StackModel;
|
|
@@ -18,11 +18,15 @@ export declare class Action<ContentNodeType = any, Callee = LogicAction.GameElem
|
|
|
18
18
|
type: Type;
|
|
19
19
|
contentNode: ContentNode<ContentNodeType>;
|
|
20
20
|
_id: string;
|
|
21
|
+
private _staticId;
|
|
21
22
|
readonly __stack: string;
|
|
22
23
|
constructor(callee: Callee, type: Type, contentNode: ContentNode<ContentNodeType>);
|
|
23
24
|
executeAction(_state: GameState, _injection: ActionExecutionInjection): ExecutedActionResult;
|
|
24
25
|
getId(): string;
|
|
25
26
|
setId(id: string): void;
|
|
27
|
+
getStaticId(): string | null;
|
|
28
|
+
setStaticId(id: string | null): this;
|
|
29
|
+
resolveId(generatedId: string): this;
|
|
26
30
|
setContent(content: ContentNodeType): this;
|
|
27
31
|
setContentNode(contentNode: ContentNode<ContentNodeType>): this;
|
|
28
32
|
getFutureActions(_story: Story, _options: ActionSearchOptions): LogicAction.Actions[];
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { LogicAction } from "../action/logicAction";
|
|
1
|
+
import type { LogicAction } from "../action/logicAction";
|
|
2
2
|
import type { Story } from "../elements/story";
|
|
3
3
|
import type { ConditionData, Lambda } from "../elements/condition";
|
|
4
|
-
import { Color, ImageSrc } from "../types";
|
|
5
|
-
import { Transform } from "../elements/transform/transform";
|
|
4
|
+
import type { Color, ImageSrc } from "../types";
|
|
5
|
+
import type { Transform } from "../elements/transform/transform";
|
|
6
6
|
import type { Scene } from "../elements/scene";
|
|
7
7
|
import type { MenuData } from "../elements/menu";
|
|
8
|
-
import { Awaitable, FlexibleTuple, SelectElementFromEach } from "../../../util/data";
|
|
8
|
+
import type { Awaitable, FlexibleTuple, SelectElementFromEach } from "../../../util/data";
|
|
9
9
|
import type { Sound } from "../elements/sound";
|
|
10
10
|
import type { Script } from "../elements/script";
|
|
11
|
-
import { Sentence } from "../elements/character/sentence";
|
|
11
|
+
import type { Sentence } from "../elements/character/sentence";
|
|
12
12
|
import type { TransformDefinitions } from "../elements/transform/type";
|
|
13
|
-
import { Image, TagGroupDefinition } from "../elements/displayable/image";
|
|
14
|
-
import { FadeOptions } from "../elements/type";
|
|
15
|
-
import { Transition } from "../elements/transition/transition";
|
|
16
|
-
import { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
|
|
17
|
-
import { Layer } from "../elements/layer";
|
|
13
|
+
import type { Image, TagGroupDefinition } from "../elements/displayable/image";
|
|
14
|
+
import type { FadeOptions } from "../elements/type";
|
|
15
|
+
import type { Transition } from "../elements/transition/transition";
|
|
16
|
+
import type { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
|
|
17
|
+
import type { Layer } from "../elements/layer";
|
|
18
18
|
export declare const DisplayableActionTypes: {
|
|
19
19
|
readonly action: "displayable:action";
|
|
20
20
|
readonly applyTransform: "displayable:applyTransform";
|
|
@@ -12,10 +12,7 @@ export declare class MenuAction<T extends typeof MenuActionTypes[keyof typeof Me
|
|
|
12
12
|
static ActionTypes: {
|
|
13
13
|
readonly action: "menu:action";
|
|
14
14
|
};
|
|
15
|
-
executeAction(gameState: GameState, injection: ActionExecutionInjection):
|
|
16
|
-
type: T;
|
|
17
|
-
node: import("../../action/tree/actionTree").RenderableNode | null;
|
|
18
|
-
})[];
|
|
15
|
+
executeAction(gameState: GameState, injection: ActionExecutionInjection): Awaitable<CalledActionResult, CalledActionResult>;
|
|
19
16
|
getFutureActions(story: Story, options: ActionSearchOptions): LogicAction.Actions[];
|
|
20
17
|
stringify(_story: Story, _seen: Set<LogicAction.Actions>, _strict: boolean): string;
|
|
21
18
|
}
|
|
@@ -5,39 +5,39 @@ import type { Image } from "../elements/displayable/image";
|
|
|
5
5
|
import type { Condition } from "../elements/condition";
|
|
6
6
|
import type { Script } from "../elements/script";
|
|
7
7
|
import type { Menu } from "../elements/menu";
|
|
8
|
-
import { StringKeyOf, Values } from "../../../util/data";
|
|
9
|
-
import { TypedAction } from "../action/actions";
|
|
10
|
-
import { Sound } from "../elements/sound";
|
|
11
|
-
import { Control } from "../elements/control";
|
|
12
|
-
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, StoryActionContentType, StoryActionTypes, TextActionContentType, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
|
|
13
|
-
import { CharacterAction } from "../action/actions/characterAction";
|
|
14
|
-
import { SceneAction } from "../action/actions/sceneAction";
|
|
15
|
-
import { StoryAction } from "../action/actions/storyAction";
|
|
16
|
-
import { ImageAction } from "../action/actions/imageAction";
|
|
17
|
-
import { ConditionAction } from "../action/actions/conditionAction";
|
|
18
|
-
import { ScriptAction } from "../action/actions/scriptAction";
|
|
19
|
-
import { MenuAction } from "../action/actions/menuAction";
|
|
20
|
-
import { SoundAction } from "../action/actions/soundAction";
|
|
21
|
-
import { ControlAction } from "../action/actions/controlAction";
|
|
22
|
-
import { Text } from "../elements/displayable/text";
|
|
23
|
-
import { TextAction } from "../action/actions/textAction";
|
|
24
|
-
import { Displayable as AbstractDisplayable } from "../elements/displayable/displayable";
|
|
25
|
-
import { DisplayableAction } from "../action/actions/displayableAction";
|
|
26
|
-
import { Persistent } from "../elements/persistent";
|
|
27
|
-
import { PersistentAction } from "../action/actions/persistentAction";
|
|
28
|
-
import { ServiceSkeleton } from "../elements/service";
|
|
29
|
-
import { ServiceAction, ServiceActionContentType } from "../action/serviceAction";
|
|
30
|
-
import { Layer } from "../elements/layer";
|
|
31
|
-
import { LayerAction } from "../action/actions/layerAction";
|
|
32
|
-
import { ExposedStateType } from "../../player/type";
|
|
33
|
-
import { Video } from "../elements/video";
|
|
34
|
-
import { VideoAction } from "../action/actions/videoAction";
|
|
8
|
+
import type { StringKeyOf, Values } from "../../../util/data";
|
|
9
|
+
import type { TypedAction } from "../action/actions";
|
|
10
|
+
import type { Sound } from "../elements/sound";
|
|
11
|
+
import type { Control } from "../elements/control";
|
|
12
|
+
import { CharacterActionContentType, CharacterActionTypes, ConditionActionContentType, ConditionActionTypes, ControlActionContentType, ControlActionTypes, DisplayableActionContentType, DisplayableActionTypes, ImageActionContentType, ImageActionTypes, LayerActionContentType, LayerActionTypes, MenuActionContentType, MenuActionTypes, PersistentActionContentType, PersistentActionTypes, SceneActionContentType, SceneActionTypes, ScriptActionContentType, ScriptActionTypes, SoundActionContentType, SoundActionTypes, StoryActionContentType, StoryActionTypes, TextActionContentType, TextActionTypes, VideoActionContentType, VideoActionTypes } from "../action/actionTypes";
|
|
13
|
+
import type { CharacterAction } from "../action/actions/characterAction";
|
|
14
|
+
import type { SceneAction } from "../action/actions/sceneAction";
|
|
15
|
+
import type { StoryAction } from "../action/actions/storyAction";
|
|
16
|
+
import type { ImageAction } from "../action/actions/imageAction";
|
|
17
|
+
import type { ConditionAction } from "../action/actions/conditionAction";
|
|
18
|
+
import type { ScriptAction } from "../action/actions/scriptAction";
|
|
19
|
+
import type { MenuAction } from "../action/actions/menuAction";
|
|
20
|
+
import type { SoundAction } from "../action/actions/soundAction";
|
|
21
|
+
import type { ControlAction } from "../action/actions/controlAction";
|
|
22
|
+
import type { Text } from "../elements/displayable/text";
|
|
23
|
+
import type { TextAction } from "../action/actions/textAction";
|
|
24
|
+
import type { Displayable as AbstractDisplayable } from "../elements/displayable/displayable";
|
|
25
|
+
import type { DisplayableAction } from "../action/actions/displayableAction";
|
|
26
|
+
import type { Persistent } from "../elements/persistent";
|
|
27
|
+
import type { PersistentAction } from "../action/actions/persistentAction";
|
|
28
|
+
import type { ServiceSkeleton } from "../elements/service";
|
|
29
|
+
import type { ServiceAction, ServiceActionContentType } from "../action/serviceAction";
|
|
30
|
+
import type { Layer } from "../elements/layer";
|
|
31
|
+
import type { LayerAction } from "../action/actions/layerAction";
|
|
32
|
+
import type { ExposedStateType } from "../../player/type";
|
|
33
|
+
import type { Video } from "../elements/video";
|
|
34
|
+
import type { VideoAction } from "../action/actions/videoAction";
|
|
35
35
|
export interface LogicActionInterface {
|
|
36
36
|
DisplayableElements: Text | Image | Layer | AbstractDisplayable<any, any>;
|
|
37
37
|
DisplayableExposed: ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text;
|
|
38
38
|
GameElement: Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video;
|
|
39
39
|
Actions: TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction;
|
|
40
|
-
ActionTypes: Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof
|
|
40
|
+
ActionTypes: Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes>;
|
|
41
41
|
ActionContents: CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType;
|
|
42
42
|
}
|
|
43
43
|
export declare const LogicAction: {};
|
|
@@ -46,7 +46,7 @@ export declare namespace LogicAction {
|
|
|
46
46
|
type DisplayableExposed = ExposedStateType.image | ExposedStateType.layer | ExposedStateType.text;
|
|
47
47
|
type GameElement = Character | Scene | Story | Image | Condition | Script | Menu | Sound | Control | Text | AbstractDisplayable<any, any> | Persistent<any> | ServiceSkeleton | Video;
|
|
48
48
|
type Actions = TypedAction | CharacterAction | ConditionAction | ImageAction | SceneAction | ScriptAction | StoryAction | MenuAction | SoundAction | ControlAction | TextAction | DisplayableAction | PersistentAction | ServiceAction | LayerAction | VideoAction;
|
|
49
|
-
type ActionTypes = Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof
|
|
49
|
+
type ActionTypes = Values<typeof CharacterActionTypes> | Values<typeof ConditionActionTypes> | Values<typeof ImageActionTypes> | Values<typeof SceneActionTypes> | Values<typeof ScriptActionTypes> | Values<typeof StoryActionTypes> | Values<typeof MenuActionTypes> | Values<typeof SoundActionTypes> | Values<typeof ControlActionTypes> | Values<typeof TextActionTypes> | Values<typeof DisplayableActionTypes> | Values<typeof PersistentActionTypes> | StringKeyOf<ServiceActionContentType> | Values<typeof LayerActionTypes> | Values<typeof VideoActionTypes>;
|
|
50
50
|
type ActionContents = CharacterActionContentType & ConditionActionContentType & ImageActionContentType & SceneActionContentType & ScriptActionContentType & StoryActionContentType & MenuActionContentType & SoundActionContentType & ControlActionContentType & TextActionContentType & DisplayableActionContentType & PersistentActionContentType & ServiceActionContentType & LayerActionContentType & VideoActionContentType;
|
|
51
51
|
}
|
|
52
52
|
export type LogicAction = typeof LogicAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Character } from "../elements/character";
|
|
1
|
+
import { Character, Narrator } from "../elements/character";
|
|
2
2
|
import { Condition, Lambda } from "../elements/condition";
|
|
3
3
|
import { Control } from "../elements/control";
|
|
4
4
|
import { Image } from "../elements/displayable/image";
|
|
@@ -17,4 +17,6 @@ import { Service } from "../elements/service";
|
|
|
17
17
|
import { Layer } from "../elements/layer";
|
|
18
18
|
import { Video } from "../elements/video";
|
|
19
19
|
import { NVLToken } from "../elements/nvl";
|
|
20
|
-
export { Character, Condition, Control, Image, Lambda, Menu, NVLToken, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, Persistent, Service, Layer, Video, };
|
|
20
|
+
export { Character, Narrator, Condition, Control, Image, Lambda, Menu, NVLToken, Scene, Script, Sentence, Sound, Story, Transform, Word, Text, Pause, Persistent, Service, Layer, Video, };
|
|
21
|
+
export type { SentenceMetadata } from "../elements/character/sentence";
|
|
22
|
+
export type { CharacterPortraitConfig, DialogAvatar, DialogAvatarResolver, DialogAvatarResolverContext, DialogAvatarResolution, DialogAvatarSource, } from "../elements/character/avatar";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dissolve } from "../elements/transition/transitions/image/dissolve";
|
|
2
2
|
import { FadeIn } from "../elements/transition/transitions/image/fadeIn";
|
|
3
|
+
import { MaskTransition } from "../elements/transition/transitions/image/maskTransition";
|
|
3
4
|
import { Transition } from "../elements/transition/transition";
|
|
4
5
|
import { ImageTransition } from "../elements/transition/transitions/image/imageTransition";
|
|
5
6
|
import { TextTransition } from "../elements/transition/transitions/text/textTransition";
|
|
6
|
-
export { Transition, ImageTransition, TextTransition, Dissolve, FadeIn, };
|
|
7
|
+
export { Transition, ImageTransition, TextTransition, Dissolve, FadeIn, MaskTransition, };
|
|
@@ -7,6 +7,8 @@ import { Scene } from "../scene";
|
|
|
7
7
|
export declare class DevTools {
|
|
8
8
|
static getActionId(action: LogicAction.Actions): string;
|
|
9
9
|
static setActionId(action: LogicAction.Actions, id: string): LogicAction.Actions;
|
|
10
|
+
static getStaticId(action: LogicAction.Actions): string | null;
|
|
11
|
+
static setStaticId(action: LogicAction.Actions, id: string | null): LogicAction.Actions;
|
|
10
12
|
static chainToActions(chain: Proxied<LogicAction.GameElement, Chained<LogicAction.Actions>>): LogicAction.Actions[];
|
|
11
13
|
static wrapAction(action: LogicAction.Actions[] | Proxied<LogicAction.GameElement, Chained<LogicAction.Actions>>): ControlAction;
|
|
12
14
|
static getNamespaceName(persistent: Persistent<any>): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Control, Layer } from "narraleaf-react";
|
|
2
|
+
import type { Scene, TransformDefinitions } from "narraleaf-react";
|
|
3
|
+
export type ScreenEffectColor = string | {
|
|
4
|
+
r: number;
|
|
5
|
+
g: number;
|
|
6
|
+
b: number;
|
|
7
|
+
a?: number;
|
|
8
|
+
};
|
|
9
|
+
export type EffectLayerOptions = {
|
|
10
|
+
name?: string;
|
|
11
|
+
zIndex?: number;
|
|
12
|
+
};
|
|
13
|
+
export type BlinkOptions = {
|
|
14
|
+
closeDuration?: number;
|
|
15
|
+
hold?: number;
|
|
16
|
+
openDuration?: number;
|
|
17
|
+
easing?: TransformDefinitions.EasingDefinition;
|
|
18
|
+
color?: ScreenEffectColor;
|
|
19
|
+
};
|
|
20
|
+
export type VignetteOptions = {
|
|
21
|
+
duration?: number;
|
|
22
|
+
opacity?: number;
|
|
23
|
+
color?: ScreenEffectColor;
|
|
24
|
+
inner?: string;
|
|
25
|
+
outer?: string;
|
|
26
|
+
hold?: number;
|
|
27
|
+
easing?: TransformDefinitions.EasingDefinition;
|
|
28
|
+
};
|
|
29
|
+
export declare function effectLayer(scene: Scene, options?: EffectLayerOptions): Layer;
|
|
30
|
+
export declare function blink(scene: Scene, options?: BlinkOptions): ReturnType<typeof Control.do>;
|
|
31
|
+
export declare function vignette(scene: Scene, options?: VignetteOptions): ReturnType<typeof Control.do>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ImageSrc } from "../../types";
|
|
2
|
+
import type { Character } from "../../elements/character";
|
|
3
|
+
import type { Image } from "../../elements/displayable/image";
|
|
4
|
+
import type { Sentence } from "../../elements/character/sentence";
|
|
5
|
+
import type { GameState } from "../../../player/gameState";
|
|
6
|
+
export type DialogAvatarSource = ImageSrc | null;
|
|
7
|
+
export type DialogAvatarResolverContext = {
|
|
8
|
+
character: Character;
|
|
9
|
+
sentence: Sentence | null;
|
|
10
|
+
portrait: Image | null;
|
|
11
|
+
currentSrc: string | null;
|
|
12
|
+
tags: string[] | null;
|
|
13
|
+
gameState: GameState;
|
|
14
|
+
};
|
|
15
|
+
export type DialogAvatarResolver = (ctx: DialogAvatarResolverContext) => DialogAvatarSource | undefined;
|
|
16
|
+
export type DialogAvatar = DialogAvatarSource | DialogAvatarResolver;
|
|
17
|
+
export type CharacterPortraitConfig = {
|
|
18
|
+
image: Image;
|
|
19
|
+
avatar?: DialogAvatar;
|
|
20
|
+
};
|
|
21
|
+
export type NormalizedCharacterPortraitConfig = {
|
|
22
|
+
image: Image;
|
|
23
|
+
avatar?: DialogAvatar;
|
|
24
|
+
};
|
|
25
|
+
export type DialogAvatarResolution = {
|
|
26
|
+
source: DialogAvatarSource;
|
|
27
|
+
character: Character | null;
|
|
28
|
+
portrait: Image | null;
|
|
29
|
+
};
|
|
30
|
+
export declare function normalizeCharacterPortraitConfig(portrait: Image | CharacterPortraitConfig): NormalizedCharacterPortraitConfig;
|
|
31
|
+
export declare function resolveDialogAvatar(ctx: DialogAvatarResolverContext & {
|
|
32
|
+
sentenceAvatar?: DialogAvatar | false;
|
|
33
|
+
portraitAvatar?: DialogAvatar;
|
|
34
|
+
characterAvatar?: DialogAvatar | false;
|
|
35
|
+
}): DialogAvatarResolution;
|