@novely/solid-renderer 0.0.0-alpha
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 +91 -0
- package/dist/context/index.d.ts +17 -0
- package/dist/index.css +383 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.jsx +636 -0
- package/dist/renderer.d.ts +98 -0
- package/dist/screens/game.d.ts +13 -0
- package/dist/screens/loading.d.ts +5 -0
- package/dist/screens/mainmenu.d.ts +8 -0
- package/dist/screens/saves.d.ts +8 -0
- package/dist/screens/settings.d.ts +8 -0
- package/dist/styles/styles.d.ts +2 -0
- package/dist/utils.d.ts +10 -0
- package/license +15 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @novely/solid-renderer
|
|
2
|
+
|
|
3
|
+
Рендерер для @novely/core на основе solid.js
|
|
4
|
+
|
|
5
|
+
## Использование
|
|
6
|
+
|
|
7
|
+
Убедитесь, что у вас установлен [solid.js](https://www.solidjs.com/) и настроена сборка.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// @see https://www.solidjs.com/docs/latest/api#render
|
|
11
|
+
import { render } from "solid-js/web";
|
|
12
|
+
|
|
13
|
+
import { novely, localStorageStorage } from "@novely/core";
|
|
14
|
+
import { createT9N } from "@novely/t9n";
|
|
15
|
+
import { createSolidRenderer } from "@novely/solid-renderer";
|
|
16
|
+
|
|
17
|
+
// Важно - импортируйте css!
|
|
18
|
+
import "@novely/solid-renderer/dist/index.css";
|
|
19
|
+
|
|
20
|
+
// Специфичная для `@novely/solid-renderer` настройка
|
|
21
|
+
const { createRenderer, Novely } = createSolidRenderer();
|
|
22
|
+
|
|
23
|
+
// Задайте начальные настройки
|
|
24
|
+
const engine = novely({
|
|
25
|
+
languages: ["ru"],
|
|
26
|
+
storage: localStorageStorage({ key: "my-story" }),
|
|
27
|
+
renderer: createRenderer,
|
|
28
|
+
characters: {
|
|
29
|
+
Spike: {
|
|
30
|
+
name: {
|
|
31
|
+
ru: "Спайк",
|
|
32
|
+
},
|
|
33
|
+
color: "#99d41e",
|
|
34
|
+
emotions: {
|
|
35
|
+
ok: "./brawl-start-spike.png",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
t9n: createT9N({
|
|
40
|
+
ru: {
|
|
41
|
+
pluralization: {},
|
|
42
|
+
strings: {
|
|
43
|
+
Hello: "Привет, я - Спайк. А как зовут тебя?",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Опишите историю
|
|
50
|
+
engine.withStory({
|
|
51
|
+
start: [],
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Запустите рендер
|
|
55
|
+
render(
|
|
56
|
+
() => (
|
|
57
|
+
<Novely
|
|
58
|
+
style={{
|
|
59
|
+
"--novely-settings-background-image": `url("./settings-background-image.png")`,
|
|
60
|
+
"--novely-main-menu-background-image": `url("./main-menu-background-image.png")`,
|
|
61
|
+
"--novely-saves-background-image": `url("./saves-background-image.png")`,
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
),
|
|
65
|
+
document.body
|
|
66
|
+
);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## CSS Variables API
|
|
70
|
+
|
|
71
|
+
Возможность настройки пользовательского интерфейса через [CSS Variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) реализуется через следующие переменные:
|
|
72
|
+
|
|
73
|
+
| Name | Default Value |
|
|
74
|
+
| ---------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
75
|
+
| `--novely-button-background-color` | `#ffe9f3` |
|
|
76
|
+
| `--novely-button-border-color` | `#ffc7df` |
|
|
77
|
+
| `--novely-button-color` | `#000000` |
|
|
78
|
+
| `--novely-button-hover-background-color` | `#ffffff` |
|
|
79
|
+
| `--novely-button-hover-border-color` | `#ffc6d8` |
|
|
80
|
+
| `--novely-button-hover-color` | `#ffb7a2` |
|
|
81
|
+
| `--novely-dialog-color` | `#ffffff` |
|
|
82
|
+
| `--novely-dialog-border-color` | `#ffffff` |
|
|
83
|
+
| `--novely-dialog-border-radius` | `14px` |
|
|
84
|
+
| `--novely-dialog-box-shadow-color` | `#00000072` |
|
|
85
|
+
| `--novely-dialog-background-image` | `radial-gradient(#d6608998 20%, transparent 20%), radial-gradient(#d6608998 20%, transparent 20%))` |
|
|
86
|
+
| `--novely-dialog-background-color` | `#f092b4d8` |
|
|
87
|
+
| `--novely-dialog-background-position` | `0 0, 50px 50px` |
|
|
88
|
+
| `--novely-dialog-background-size` | `100px 100px` |
|
|
89
|
+
| `--novely-settings-background-image` | none |
|
|
90
|
+
| `--novely-main-menu-background-image` | none |
|
|
91
|
+
| `--novely-saves-background-image` | none |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Accessor, FlowComponent } from 'solid-js';
|
|
2
|
+
import type { Renderer, RendererInit, StorageData, Stored, BaseTranslationStrings } from '@novely/core';
|
|
3
|
+
interface DataContext {
|
|
4
|
+
storeData: Accessor<StorageData | undefined>;
|
|
5
|
+
storeDataUpdate: (fn: (prev: StorageData) => StorageData) => void;
|
|
6
|
+
options: RendererInit;
|
|
7
|
+
renderer: Renderer;
|
|
8
|
+
t: (key: BaseTranslationStrings) => string;
|
|
9
|
+
}
|
|
10
|
+
interface ProviderProps {
|
|
11
|
+
storeData: Stored<StorageData>;
|
|
12
|
+
options: RendererInit;
|
|
13
|
+
renderer: Renderer;
|
|
14
|
+
}
|
|
15
|
+
declare const Provider: FlowComponent<ProviderProps>;
|
|
16
|
+
declare const useData: () => DataContext | undefined;
|
|
17
|
+
export { Provider, useData };
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/root.module.css?esbuild-css-modules-plugin-built */
|
|
2
|
+
.n-root {
|
|
3
|
+
height: 100vh;
|
|
4
|
+
background-position: center;
|
|
5
|
+
background-repeat: no-repeat;
|
|
6
|
+
background-size: cover;
|
|
7
|
+
font-family:
|
|
8
|
+
ui-sans-serif,
|
|
9
|
+
system-ui,
|
|
10
|
+
-apple-system,
|
|
11
|
+
BlinkMacSystemFont,
|
|
12
|
+
Segoe UI,
|
|
13
|
+
Roboto,
|
|
14
|
+
Helvetica Neue,
|
|
15
|
+
Arial,
|
|
16
|
+
Noto Sans,
|
|
17
|
+
sans-serif,
|
|
18
|
+
Apple Color Emoji,
|
|
19
|
+
Segoe UI Emoji,
|
|
20
|
+
Segoe UI Symbol,
|
|
21
|
+
Noto Color Emoji;
|
|
22
|
+
font-size: 1em;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/button.module.css?esbuild-css-modules-plugin-built */
|
|
26
|
+
.n-button {
|
|
27
|
+
background-color: var(--novely-button-background-color, #ffe9f3);
|
|
28
|
+
border: 4px solid var(--novely-button-border-color, #ffc7df);
|
|
29
|
+
color: var(--novely-button-color, #000);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
user-select: none;
|
|
32
|
+
margin: .4em 0;
|
|
33
|
+
padding: .4em;
|
|
34
|
+
font-size: 1.8375em;
|
|
35
|
+
line-height: 1.2;
|
|
36
|
+
}
|
|
37
|
+
.n-button:hover {
|
|
38
|
+
background-color: var(--novely-button-hover-background-color, #fff);
|
|
39
|
+
border-color: var(--novely-button-hover-border-color, #ffc6d8);
|
|
40
|
+
color: var(--novely-button-hover-color, #ffb7a2);
|
|
41
|
+
}
|
|
42
|
+
.n-button[aria-disabled=true] {
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
opacity: .9;
|
|
45
|
+
}
|
|
46
|
+
.n-buttonInputDialogPanel {
|
|
47
|
+
width: -moz-fit-content;
|
|
48
|
+
width: fit-content;
|
|
49
|
+
padding: .4em .6em;
|
|
50
|
+
font-size: 1.2375em;
|
|
51
|
+
}
|
|
52
|
+
.n-buttonChoices {
|
|
53
|
+
font-size: 1.02em;
|
|
54
|
+
}
|
|
55
|
+
.n-buttonMainMenu,
|
|
56
|
+
.n-buttonSaves {
|
|
57
|
+
width: 100%;
|
|
58
|
+
font-size: 1.02em;
|
|
59
|
+
}
|
|
60
|
+
.n-buttonSavesDelete {
|
|
61
|
+
margin-left: 1em;
|
|
62
|
+
font-size: 1.02em;
|
|
63
|
+
}
|
|
64
|
+
.n-buttonSettings {
|
|
65
|
+
width: 100%;
|
|
66
|
+
font-size: 1.02em;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/characters.module.css?esbuild-css-modules-plugin-built */
|
|
70
|
+
.n-characters {
|
|
71
|
+
z-index: 1;
|
|
72
|
+
position: absolute;
|
|
73
|
+
inset: 0;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
}
|
|
76
|
+
.n-characters > canvas[style] {
|
|
77
|
+
height: 85vmin;
|
|
78
|
+
max-height: 70vh;
|
|
79
|
+
position: absolute;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/dialog.module.css?esbuild-css-modules-plugin-built */
|
|
84
|
+
.n-dialog {
|
|
85
|
+
min-height: 25vh;
|
|
86
|
+
max-height: 30vh;
|
|
87
|
+
width: 75%;
|
|
88
|
+
z-index: 22;
|
|
89
|
+
text-align: left;
|
|
90
|
+
cursor: default;
|
|
91
|
+
user-select: none;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
justify-content: flex-end;
|
|
94
|
+
position: absolute;
|
|
95
|
+
bottom: .4em;
|
|
96
|
+
left: 50%;
|
|
97
|
+
transform: translateX(-50%);
|
|
98
|
+
}
|
|
99
|
+
.n-dialogContainer {
|
|
100
|
+
height: 100%;
|
|
101
|
+
min-height: 14.5vh;
|
|
102
|
+
max-height: 25vh;
|
|
103
|
+
color: var(--novely-dialog-color, #fff);
|
|
104
|
+
border: 3px solid var(--novely-dialog-border-color, #fff);
|
|
105
|
+
border-radius: var(--novely-dialog-border-radius, 14px);
|
|
106
|
+
box-shadow: 1px 1px 4px var(--novely-dialog-box-shadow-color, #00000072);
|
|
107
|
+
background-image: var(--novely-dialog-background-image, radial-gradient(#d6608998 20%, transparent 20%), radial-gradient(#d6608998 20%, transparent 20%));
|
|
108
|
+
background-color: var(--novely-dialog-background-color, #f092b4d8);
|
|
109
|
+
background-position: var(--novely-dialog-background-position, 0 0, 50px 50px);
|
|
110
|
+
background-size: var(--novely-dialog-background-size, 100px 100px);
|
|
111
|
+
grid-template-rows: auto 1fr;
|
|
112
|
+
grid-template-columns: 10vmax 1fr;
|
|
113
|
+
display: grid;
|
|
114
|
+
}
|
|
115
|
+
.n-dialogPerson {
|
|
116
|
+
max-height: 25vh;
|
|
117
|
+
max-width: 25vw;
|
|
118
|
+
}
|
|
119
|
+
.n-dialogContainerWithPerson[data-no-person=true] {
|
|
120
|
+
display: block;
|
|
121
|
+
}
|
|
122
|
+
.n-dialogContainerWithPerson[data-no-person=true] > .n-dialogPerson {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
.n-dialogName,
|
|
126
|
+
.n-dialogContent {
|
|
127
|
+
margin: 0;
|
|
128
|
+
padding: 1vmin;
|
|
129
|
+
display: block;
|
|
130
|
+
}
|
|
131
|
+
.n-dialogName {
|
|
132
|
+
width: -moz-fit-content;
|
|
133
|
+
width: fit-content;
|
|
134
|
+
background: #fff;
|
|
135
|
+
border-radius: 7px 7px 0 0;
|
|
136
|
+
margin-left: 5vmin;
|
|
137
|
+
font-size: 1.4375em;
|
|
138
|
+
line-height: 1.2;
|
|
139
|
+
box-shadow: 1px 1px 3px #00000042;
|
|
140
|
+
}
|
|
141
|
+
.n-dialogContent {
|
|
142
|
+
width: 100%;
|
|
143
|
+
text-shadow:
|
|
144
|
+
1px 0 #000,
|
|
145
|
+
0 1px #000,
|
|
146
|
+
-1px 0 #000,
|
|
147
|
+
0 -1px #000;
|
|
148
|
+
font-size: 2.2375em;
|
|
149
|
+
line-height: 1.2;
|
|
150
|
+
}
|
|
151
|
+
.n-dialogPerson > canvas,
|
|
152
|
+
.n-dialogPerson > img {
|
|
153
|
+
height: 100%;
|
|
154
|
+
}
|
|
155
|
+
@media (max-width: 768px) {
|
|
156
|
+
.n-dialog {
|
|
157
|
+
width: 100%;
|
|
158
|
+
bottom: 0;
|
|
159
|
+
left: unset;
|
|
160
|
+
transform: unset;
|
|
161
|
+
}
|
|
162
|
+
.n-dialogName,
|
|
163
|
+
.n-dialogContent {
|
|
164
|
+
font-size: 1.02em;
|
|
165
|
+
}
|
|
166
|
+
.n-dialogContainer {
|
|
167
|
+
border-radius: 14px 14px 0 0;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/headlessDialog.module.css?esbuild-css-modules-plugin-built */
|
|
172
|
+
.n-headlessDialog {
|
|
173
|
+
z-index: 20;
|
|
174
|
+
position: fixed;
|
|
175
|
+
inset: 0;
|
|
176
|
+
overflow-y: auto;
|
|
177
|
+
}
|
|
178
|
+
.n-headlessDialogContainer {
|
|
179
|
+
min-height: 100vh;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
align-items: center;
|
|
182
|
+
display: flex;
|
|
183
|
+
}
|
|
184
|
+
.n-headlessDialogFix {
|
|
185
|
+
height: 100vh;
|
|
186
|
+
vertical-align: middle;
|
|
187
|
+
display: inline-block;
|
|
188
|
+
}
|
|
189
|
+
.n-headlessDialogPanel {
|
|
190
|
+
text-align: left;
|
|
191
|
+
z-index: 21;
|
|
192
|
+
width: 100%;
|
|
193
|
+
max-width: 40vw;
|
|
194
|
+
min-height: 40vh;
|
|
195
|
+
flex-direction: column;
|
|
196
|
+
align-items: stretch;
|
|
197
|
+
display: flex;
|
|
198
|
+
}
|
|
199
|
+
@media (max-width: 768px) {
|
|
200
|
+
.n-headlessDialogPanel {
|
|
201
|
+
max-width: 95vw;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
.n-inputDialogLabel {
|
|
205
|
+
width: 100%;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
justify-content: center;
|
|
208
|
+
align-items: center;
|
|
209
|
+
font-size: 1.2375em;
|
|
210
|
+
display: flex;
|
|
211
|
+
}
|
|
212
|
+
.n-inputDialogLabel > span {
|
|
213
|
+
min-height: 1em;
|
|
214
|
+
min-height: 1lh;
|
|
215
|
+
margin: .4em 0;
|
|
216
|
+
}
|
|
217
|
+
.n-inputDialogPanel {
|
|
218
|
+
color: #fff;
|
|
219
|
+
background-color: #f092b4d8;
|
|
220
|
+
background-image: radial-gradient(#d6608998 20%, #0000 20%), radial-gradient(#d6608998 20%, #0000 20%);
|
|
221
|
+
background-position: 0 0, 50px 50px;
|
|
222
|
+
background-size: 100px 100px;
|
|
223
|
+
border: 3px solid #fff;
|
|
224
|
+
border-radius: 14px;
|
|
225
|
+
justify-content: center;
|
|
226
|
+
align-items: center;
|
|
227
|
+
box-shadow: 1px 1px 4px #00000072;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/mainMenu.module.css?esbuild-css-modules-plugin-built */
|
|
231
|
+
.n-mainMenu {
|
|
232
|
+
z-index: 1;
|
|
233
|
+
background-image: var(--novely-main-menu-background-image);
|
|
234
|
+
position: absolute;
|
|
235
|
+
inset: 0;
|
|
236
|
+
overflow: hidden;
|
|
237
|
+
}
|
|
238
|
+
.n-mainMenu > .n-controls {
|
|
239
|
+
width: 30vw;
|
|
240
|
+
height: 100%;
|
|
241
|
+
flex-direction: column;
|
|
242
|
+
justify-content: center;
|
|
243
|
+
align-items: center;
|
|
244
|
+
padding-left: 1em;
|
|
245
|
+
display: flex;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/saves.module.css?esbuild-css-modules-plugin-built */
|
|
249
|
+
.n-saves {
|
|
250
|
+
z-index: 1;
|
|
251
|
+
background-image: var(--novely-saves-background-image);
|
|
252
|
+
display: flex;
|
|
253
|
+
position: absolute;
|
|
254
|
+
inset: 0;
|
|
255
|
+
overflow: hidden;
|
|
256
|
+
}
|
|
257
|
+
.n-saves > .n-controls {
|
|
258
|
+
width: 30vw;
|
|
259
|
+
height: 100%;
|
|
260
|
+
flex-direction: column;
|
|
261
|
+
align-items: center;
|
|
262
|
+
padding-left: 1em;
|
|
263
|
+
display: flex;
|
|
264
|
+
}
|
|
265
|
+
.n-saves > .n-list {
|
|
266
|
+
width: 100%;
|
|
267
|
+
height: 100%;
|
|
268
|
+
flex-direction: column;
|
|
269
|
+
flex: 1 1 0;
|
|
270
|
+
justify-content: center;
|
|
271
|
+
align-items: center;
|
|
272
|
+
padding-left: 1em;
|
|
273
|
+
list-style: none;
|
|
274
|
+
display: flex;
|
|
275
|
+
}
|
|
276
|
+
.n-saves > .n-list > li {
|
|
277
|
+
display: flex;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/controlPanel.module.css?esbuild-css-modules-plugin-built */
|
|
281
|
+
.n-controlPanel {
|
|
282
|
+
z-index: 23;
|
|
283
|
+
position: absolute;
|
|
284
|
+
bottom: .4em;
|
|
285
|
+
right: 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/settings.module.css?esbuild-css-modules-plugin-built */
|
|
289
|
+
.n-settings {
|
|
290
|
+
z-index: 1;
|
|
291
|
+
background-image: var(--novely-settings-background-image);
|
|
292
|
+
display: flex;
|
|
293
|
+
position: absolute;
|
|
294
|
+
inset: 0;
|
|
295
|
+
overflow: hidden;
|
|
296
|
+
}
|
|
297
|
+
.n-settings .n-controls {
|
|
298
|
+
width: 30vw;
|
|
299
|
+
height: 100%;
|
|
300
|
+
flex-direction: column;
|
|
301
|
+
justify-content: center;
|
|
302
|
+
align-items: center;
|
|
303
|
+
padding-left: 1em;
|
|
304
|
+
display: flex;
|
|
305
|
+
}
|
|
306
|
+
.n-content {
|
|
307
|
+
width: 100%;
|
|
308
|
+
height: 100%;
|
|
309
|
+
flex-direction: column;
|
|
310
|
+
flex: 1 1 0;
|
|
311
|
+
justify-content: center;
|
|
312
|
+
align-items: center;
|
|
313
|
+
padding-left: 1em;
|
|
314
|
+
list-style: none;
|
|
315
|
+
display: flex;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* esbuild-css-modules-plugin-namespace:./src/styles/loading.module.css?esbuild-css-modules-plugin-built */
|
|
319
|
+
.n-loading {
|
|
320
|
+
z-index: 1;
|
|
321
|
+
background: #000;
|
|
322
|
+
justify-content: center;
|
|
323
|
+
align-items: center;
|
|
324
|
+
display: flex;
|
|
325
|
+
position: absolute;
|
|
326
|
+
inset: 0;
|
|
327
|
+
overflow: hidden;
|
|
328
|
+
}
|
|
329
|
+
.n-lds-ellipsis {
|
|
330
|
+
width: 80px;
|
|
331
|
+
height: 80px;
|
|
332
|
+
display: inline-block;
|
|
333
|
+
position: relative;
|
|
334
|
+
}
|
|
335
|
+
.n-lds-ellipsis div {
|
|
336
|
+
width: 13px;
|
|
337
|
+
height: 13px;
|
|
338
|
+
background: #fff;
|
|
339
|
+
border-radius: 50%;
|
|
340
|
+
animation-timing-function: cubic-bezier(0, 1, 1, 0);
|
|
341
|
+
position: absolute;
|
|
342
|
+
top: 33px;
|
|
343
|
+
}
|
|
344
|
+
.n-lds-ellipsis div:nth-child(1) {
|
|
345
|
+
animation: .6s infinite n-lds-ellipsis1;
|
|
346
|
+
left: 8px;
|
|
347
|
+
}
|
|
348
|
+
.n-lds-ellipsis div:nth-child(2) {
|
|
349
|
+
animation: .6s infinite n-lds-ellipsis2;
|
|
350
|
+
left: 8px;
|
|
351
|
+
}
|
|
352
|
+
.n-lds-ellipsis div:nth-child(3) {
|
|
353
|
+
animation: .6s infinite n-lds-ellipsis2;
|
|
354
|
+
left: 32px;
|
|
355
|
+
}
|
|
356
|
+
.n-lds-ellipsis div:nth-child(4) {
|
|
357
|
+
animation: .6s infinite n-lds-ellipsis3;
|
|
358
|
+
left: 56px;
|
|
359
|
+
}
|
|
360
|
+
@keyframes n-lds-ellipsis1 {
|
|
361
|
+
0% {
|
|
362
|
+
transform: scale(0);
|
|
363
|
+
}
|
|
364
|
+
100% {
|
|
365
|
+
transform: scale(1);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
@keyframes n-lds-ellipsis3 {
|
|
369
|
+
0% {
|
|
370
|
+
transform: scale(1);
|
|
371
|
+
}
|
|
372
|
+
100% {
|
|
373
|
+
transform: scale(0);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
@keyframes n-lds-ellipsis2 {
|
|
377
|
+
0% {
|
|
378
|
+
transform: translate(0);
|
|
379
|
+
}
|
|
380
|
+
100% {
|
|
381
|
+
transform: translate(24px);
|
|
382
|
+
}
|
|
383
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSolidRenderer } from './renderer';
|
package/dist/index.jsx
ADDED
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
// src/renderer.tsx
|
|
2
|
+
import { Switch, Match } from "solid-js";
|
|
3
|
+
import { createStore } from "solid-js/store";
|
|
4
|
+
|
|
5
|
+
// src/utils.ts
|
|
6
|
+
var capitalize = (str) => {
|
|
7
|
+
return str[0].toUpperCase() + str.slice(1);
|
|
8
|
+
};
|
|
9
|
+
var isCSSImage = (str) => {
|
|
10
|
+
const startsWith = String.prototype.startsWith.bind(str);
|
|
11
|
+
return startsWith("http") || startsWith("/") || startsWith(".") || startsWith("data");
|
|
12
|
+
};
|
|
13
|
+
var createImage = (src) => {
|
|
14
|
+
const img = document.createElement("img");
|
|
15
|
+
return img.src = src, img.crossOrigin = "*", img;
|
|
16
|
+
};
|
|
17
|
+
var canvasDrawImages = (canvas = document.createElement("canvas"), ctx = canvas.getContext("2d"), images) => {
|
|
18
|
+
let set = false;
|
|
19
|
+
for (const image of images) {
|
|
20
|
+
const isLoaded = image.complete && image.naturalHeight !== 0;
|
|
21
|
+
const draw = () => {
|
|
22
|
+
if (!set)
|
|
23
|
+
set = true, canvas.width = image.naturalWidth, canvas.height = image.naturalHeight;
|
|
24
|
+
ctx.drawImage(image, 0, 0);
|
|
25
|
+
image.removeEventListener("load", draw);
|
|
26
|
+
};
|
|
27
|
+
isLoaded ? draw() : image.addEventListener("load", draw);
|
|
28
|
+
}
|
|
29
|
+
return [canvas, ctx];
|
|
30
|
+
};
|
|
31
|
+
var url = (str) => {
|
|
32
|
+
return `url(${str})`;
|
|
33
|
+
};
|
|
34
|
+
var join = (...elements) => {
|
|
35
|
+
return elements.filter(Boolean).join(" ");
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/context/index.tsx
|
|
39
|
+
import { from, createContext, useContext } from "solid-js";
|
|
40
|
+
var Context = createContext();
|
|
41
|
+
var Provider = (props) => {
|
|
42
|
+
const storeData = from(props.storeData);
|
|
43
|
+
const value = {
|
|
44
|
+
storeData,
|
|
45
|
+
storeDataUpdate: props.storeData.update,
|
|
46
|
+
options: props.options,
|
|
47
|
+
renderer: props.renderer,
|
|
48
|
+
t: (key) => {
|
|
49
|
+
return props.options.t(key, storeData().meta[0]);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return <Context.Provider value={value}>{props.children}</Context.Provider>;
|
|
53
|
+
};
|
|
54
|
+
var useData = () => {
|
|
55
|
+
return useContext(Context);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/screens/game.tsx
|
|
59
|
+
import { createEffect, createMemo, createSignal, For, Show } from "solid-js";
|
|
60
|
+
import { Dialog, DialogPanel } from "solid-headless";
|
|
61
|
+
|
|
62
|
+
// ../typewriter/dist/index.js
|
|
63
|
+
var C = () => Math.min(100 * Math.random() + 100, 140);
|
|
64
|
+
var M = (h, d, c) => {
|
|
65
|
+
let p, e = document.createElement("span");
|
|
66
|
+
e.innerHTML = d;
|
|
67
|
+
let o = (m, f) => {
|
|
68
|
+
let a = [];
|
|
69
|
+
return m.childNodes.forEach((n) => {
|
|
70
|
+
n.nodeName === "#text" && (a.push(n), f && (n.textContent = "")), a.push(...o(n, f));
|
|
71
|
+
}), a;
|
|
72
|
+
}, r = o(e.cloneNode(true), false).map((m) => [...m.textContent]), T = o(e, true);
|
|
73
|
+
h.appendChild(e);
|
|
74
|
+
let t = 0, s = 0, l = false, i = () => {
|
|
75
|
+
clearTimeout(p);
|
|
76
|
+
}, u = () => {
|
|
77
|
+
r[t]?.length > s ? (T[t].textContent += r[t][s++], setTimeout(u, C())) : t++ < r.length ? (s = 0, u()) : (l = true, c && (p = setTimeout(c, 790)));
|
|
78
|
+
};
|
|
79
|
+
return u(), { end() {
|
|
80
|
+
return l ? (i(), e.remove(), true) : (i(), e.innerHTML = d, l = true, false);
|
|
81
|
+
}, destroy() {
|
|
82
|
+
i(), e.remove();
|
|
83
|
+
} };
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/root.module.css?esbuild-css-modules-plugin-building
|
|
87
|
+
var root_module_default = { "root": "n-root" };
|
|
88
|
+
|
|
89
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/button.module.css?esbuild-css-modules-plugin-building
|
|
90
|
+
var button_module_default = { "button": "n-button", "buttonChoices": "n-buttonChoices", "buttonInputDialogPanel": "n-buttonInputDialogPanel", "buttonMainMenu": "n-buttonMainMenu", "buttonSaves": "n-buttonSaves", "buttonSavesDelete": "n-buttonSavesDelete", "buttonSettings": "n-buttonSettings" };
|
|
91
|
+
|
|
92
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/characters.module.css?esbuild-css-modules-plugin-building
|
|
93
|
+
var characters_module_default = { "characters": "n-characters" };
|
|
94
|
+
|
|
95
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/dialog.module.css?esbuild-css-modules-plugin-building
|
|
96
|
+
var dialog_module_default = { "dialog": "n-dialog", "dialogContainer": "n-dialogContainer", "dialogContainerWithPerson": "n-dialogContainerWithPerson", "dialogContent": "n-dialogContent", "dialogName": "n-dialogName", "dialogPerson": "n-dialogPerson" };
|
|
97
|
+
|
|
98
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/headlessDialog.module.css?esbuild-css-modules-plugin-building
|
|
99
|
+
var headlessDialog_module_default = { "headlessDialog": "n-headlessDialog", "headlessDialogContainer": "n-headlessDialogContainer", "headlessDialogFix": "n-headlessDialogFix", "headlessDialogPanel": "n-headlessDialogPanel", "inputDialogLabel": "n-inputDialogLabel", "inputDialogPanel": "n-inputDialogPanel" };
|
|
100
|
+
|
|
101
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/mainMenu.module.css?esbuild-css-modules-plugin-building
|
|
102
|
+
var mainMenu_module_default = { "controls": "n-controls", "mainMenu": "n-mainMenu" };
|
|
103
|
+
|
|
104
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/saves.module.css?esbuild-css-modules-plugin-building
|
|
105
|
+
var saves_module_default = { "controls": "n-controls", "list": "n-list", "saves": "n-saves" };
|
|
106
|
+
|
|
107
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/controlPanel.module.css?esbuild-css-modules-plugin-building
|
|
108
|
+
var controlPanel_module_default = { "controlPanel": "n-controlPanel" };
|
|
109
|
+
|
|
110
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/settings.module.css?esbuild-css-modules-plugin-building
|
|
111
|
+
var settings_module_default = { "content": "n-content", "controls": "n-controls", "settings": "n-settings" };
|
|
112
|
+
|
|
113
|
+
// esbuild-css-modules-plugin-namespace:./src/styles/loading.module.css?esbuild-css-modules-plugin-building
|
|
114
|
+
var loading_module_default = { "ldsEllipsis": "n-lds-ellipsis", "ldsEllipsis1": "n-lds-ellipsis1", "ldsEllipsis2": "n-lds-ellipsis2", "ldsEllipsis3": "n-lds-ellipsis3", "loading": "n-loading" };
|
|
115
|
+
|
|
116
|
+
// src/styles/styles.ts
|
|
117
|
+
Object.assign(root_module_default, button_module_default, characters_module_default, dialog_module_default, headlessDialog_module_default, mainMenu_module_default, saves_module_default, controlPanel_module_default, settings_module_default, loading_module_default);
|
|
118
|
+
|
|
119
|
+
// src/screens/game.tsx
|
|
120
|
+
var Game = (props) => {
|
|
121
|
+
const data = useData();
|
|
122
|
+
const { setState, characters, store, renderer } = props;
|
|
123
|
+
let writer;
|
|
124
|
+
const background = createMemo(() => {
|
|
125
|
+
const is = isCSSImage(props.state.background);
|
|
126
|
+
return { "background-image": is ? url(props.state.background) : "", "background-color": is ? void 0 : props.state.background };
|
|
127
|
+
});
|
|
128
|
+
const [auto, setAuto] = createSignal(false);
|
|
129
|
+
createEffect(() => {
|
|
130
|
+
if (props.state && store.dialogRef) {
|
|
131
|
+
writer?.destroy();
|
|
132
|
+
writer = M(store.dialogRef, props.state.dialog.content, () => {
|
|
133
|
+
if (auto())
|
|
134
|
+
onDialogClick();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
const onChoicesButtonClick = ([disabled, i]) => {
|
|
139
|
+
if (disabled)
|
|
140
|
+
return;
|
|
141
|
+
const resolve = props.state.choices.resolve;
|
|
142
|
+
setState("choices", { choices: [], visible: false, resolve: void 0 });
|
|
143
|
+
resolve?.(i);
|
|
144
|
+
};
|
|
145
|
+
const onDialogClick = () => {
|
|
146
|
+
if (writer && writer.end()) {
|
|
147
|
+
const resolve = props.state.dialog.resolve;
|
|
148
|
+
setState("dialog", { content: "", character: void 0, emotion: void 0, visible: false, resolve: void 0 });
|
|
149
|
+
resolve?.();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const onInputButtonClick = () => {
|
|
153
|
+
if (props.state.input.error || !props.state.input.element?.validity.valid)
|
|
154
|
+
return;
|
|
155
|
+
const resolve = props.state.input.resolve;
|
|
156
|
+
setState("input", { element: void 0, question: "", visible: false });
|
|
157
|
+
resolve?.();
|
|
158
|
+
};
|
|
159
|
+
return <div class={root_module_default.root} style={background()}>
|
|
160
|
+
<div class={root_module_default.characters}><For each={Object.entries(props.state.characters)}>{([character, data2]) => <Show when={data2.visible}>{() => {
|
|
161
|
+
const canvas = store.characters[character].canvas;
|
|
162
|
+
createEffect(() => {
|
|
163
|
+
void canvas.offsetWidth;
|
|
164
|
+
if (data2.className)
|
|
165
|
+
canvas.classList.value = data2.className;
|
|
166
|
+
if (data2.style)
|
|
167
|
+
canvas.style.cssText = data2.style;
|
|
168
|
+
});
|
|
169
|
+
return canvas;
|
|
170
|
+
}}</Show>}</For></div>
|
|
171
|
+
<div
|
|
172
|
+
class={root_module_default.dialog}
|
|
173
|
+
style={{ display: props.state.dialog.visible ? "flex" : "none" }}
|
|
174
|
+
onClick={onDialogClick}
|
|
175
|
+
>
|
|
176
|
+
{() => {
|
|
177
|
+
const character = () => props.state.dialog.character;
|
|
178
|
+
const color = () => {
|
|
179
|
+
const c = character();
|
|
180
|
+
const color2 = c ? c in characters ? characters[c].color : "#000" : "#000";
|
|
181
|
+
return color2;
|
|
182
|
+
};
|
|
183
|
+
const name = () => {
|
|
184
|
+
const c = character();
|
|
185
|
+
const lang = data.storeData().meta[0];
|
|
186
|
+
return c ? c in characters ? typeof characters[c].name === "string" ? characters[c].name : characters[c].name[lang] : c : "";
|
|
187
|
+
};
|
|
188
|
+
return <span
|
|
189
|
+
class={root_module_default.dialogName}
|
|
190
|
+
style={{
|
|
191
|
+
color: color(),
|
|
192
|
+
display: character() ? "block" : "none"
|
|
193
|
+
}}
|
|
194
|
+
>{name()}</span>;
|
|
195
|
+
}}
|
|
196
|
+
<div class={join(root_module_default.dialogContainer, root_module_default.dialogContainerWithPerson)} data-no-person={!(props.state.dialog.character && props.state.dialog.emotion)}>
|
|
197
|
+
<div class={root_module_default.dialogPerson}><Show when={props.state.dialog.character && props.state.dialog.emotion}>{() => {
|
|
198
|
+
const character = props.state.dialog.character;
|
|
199
|
+
const emotion = props.state.dialog.emotion;
|
|
200
|
+
if (!store["characters"][character] || !store["characters"][character]["emotions"][emotion]) {
|
|
201
|
+
renderer.character(character).withEmotion(emotion);
|
|
202
|
+
}
|
|
203
|
+
;
|
|
204
|
+
const image = store["characters"][character]["emotions"][emotion];
|
|
205
|
+
if ("src" in image)
|
|
206
|
+
return image.alt = "", image;
|
|
207
|
+
const [canvas] = canvasDrawImages(void 0, void 0, Object.values(image));
|
|
208
|
+
return canvas;
|
|
209
|
+
}}</Show></div>
|
|
210
|
+
<p class={root_module_default.dialogContent} ref={store.dialogRef}> </p>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
<Dialog
|
|
214
|
+
isOpen={props.state.choices.visible}
|
|
215
|
+
class={root_module_default.headlessDialog}
|
|
216
|
+
><div class={root_module_default.headlessDialogContainer}>
|
|
217
|
+
<span
|
|
218
|
+
class={root_module_default.headlessDialogFix}
|
|
219
|
+
aria-hidden="true"
|
|
220
|
+
></span>
|
|
221
|
+
<DialogPanel class={root_module_default.headlessDialogPanel}><For each={props.state.choices.choices}>{([text, _, active], i) => {
|
|
222
|
+
const disabled = active ? !active() : false;
|
|
223
|
+
return <button
|
|
224
|
+
type="button"
|
|
225
|
+
aria-disabled={disabled}
|
|
226
|
+
class={join(root_module_default.button, root_module_default.buttonChoices)}
|
|
227
|
+
onClick={[onChoicesButtonClick, [disabled, i()]]}
|
|
228
|
+
>{text}</button>;
|
|
229
|
+
}}</For></DialogPanel>
|
|
230
|
+
</div></Dialog>
|
|
231
|
+
<Dialog
|
|
232
|
+
isOpen={props.state.input.visible}
|
|
233
|
+
class={root_module_default.headlessDialog}
|
|
234
|
+
><div class={root_module_default.headlessDialogContainer}>
|
|
235
|
+
<span
|
|
236
|
+
class={root_module_default.headlessDialogFix}
|
|
237
|
+
aria-hidden="true"
|
|
238
|
+
></span>
|
|
239
|
+
<DialogPanel class={join(root_module_default.headlessDialogPanel, root_module_default.inputDialogPanel)}>
|
|
240
|
+
<label for="novely-input" class={root_module_default.inputDialogLabel}>
|
|
241
|
+
<span>{props.state.input.question}</span>
|
|
242
|
+
{props.state.input.element}
|
|
243
|
+
<span aria-live="polite">{props.state.input.error}</span>
|
|
244
|
+
</label>
|
|
245
|
+
<button
|
|
246
|
+
onClick={onInputButtonClick}
|
|
247
|
+
class={join(root_module_default.button, root_module_default.buttonInputDialogPanel)}
|
|
248
|
+
aria-disabled={props.state.input.error || !props.state.input.element?.validity.valid ? "true" : "false"}
|
|
249
|
+
>{data.t("Sumbit")}</button>
|
|
250
|
+
</DialogPanel>
|
|
251
|
+
</div></Dialog>
|
|
252
|
+
<div><For each={Object.values(props.state.layers)}>{(item) => item?.element}</For></div>
|
|
253
|
+
<div class={root_module_default.controlPanel}>
|
|
254
|
+
<button
|
|
255
|
+
type="button"
|
|
256
|
+
onClick={() => {
|
|
257
|
+
data.options.stack.back();
|
|
258
|
+
data.options.restore(data.options.stack.value);
|
|
259
|
+
}}
|
|
260
|
+
>{data.t("GoBack")}</button>
|
|
261
|
+
<button
|
|
262
|
+
type="button"
|
|
263
|
+
onClick={() => {
|
|
264
|
+
data.options.save(false, "manual");
|
|
265
|
+
}}
|
|
266
|
+
>{data.t("DoSave")}</button>
|
|
267
|
+
<button
|
|
268
|
+
type="button"
|
|
269
|
+
onClick={() => {
|
|
270
|
+
setAuto((prev) => !prev);
|
|
271
|
+
}}
|
|
272
|
+
>{data.t(auto() ? "Auto" : "Stop")}</button>
|
|
273
|
+
<button
|
|
274
|
+
type="button"
|
|
275
|
+
onClick={() => {
|
|
276
|
+
data.options.save(false, "auto").then(() => {
|
|
277
|
+
props.setState("screen", "settings");
|
|
278
|
+
});
|
|
279
|
+
}}
|
|
280
|
+
>{data.t("Settings")}</button>
|
|
281
|
+
<button
|
|
282
|
+
type="button"
|
|
283
|
+
onClick={() => {
|
|
284
|
+
data.options.stack.clear();
|
|
285
|
+
props.setState("screen", "mainmenu");
|
|
286
|
+
}}
|
|
287
|
+
>{data.t("Exit")}</button>
|
|
288
|
+
</div>
|
|
289
|
+
</div>;
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// src/screens/mainmenu.tsx
|
|
293
|
+
var MainMenu = (props) => {
|
|
294
|
+
const data = useData();
|
|
295
|
+
return <div
|
|
296
|
+
classList={{
|
|
297
|
+
[root_module_default.root]: true,
|
|
298
|
+
[root_module_default.mainMenu]: true
|
|
299
|
+
}}
|
|
300
|
+
><div class={root_module_default.controls}>
|
|
301
|
+
<button type="button" class={join(root_module_default.button, root_module_default.buttonMainMenu)} onClick={data.options.newGame}>{data.t("NewGame")}</button>
|
|
302
|
+
<button type="button" class={join(root_module_default.button, root_module_default.buttonMainMenu)} onClick={() => data.options.restore()}>{data.t("LoadSave")}</button>
|
|
303
|
+
<button type="button" class={join(root_module_default.button, root_module_default.buttonMainMenu)} onClick={() => props.setState("screen", "saves")}>{data.t("Saves")}</button>
|
|
304
|
+
<button type="button" class={join(root_module_default.button, root_module_default.buttonMainMenu)} onClick={() => props.setState("screen", "settings")}>{data.t("Settings")}</button>
|
|
305
|
+
</div></div>;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// src/screens/saves.tsx
|
|
309
|
+
import { Show as Show2, For as For2 } from "solid-js";
|
|
310
|
+
var Saves = (props) => {
|
|
311
|
+
const data = useData();
|
|
312
|
+
const saves = () => data.storeData().saves;
|
|
313
|
+
const language = () => data.storeData().meta[0];
|
|
314
|
+
const removeSave = (date) => {
|
|
315
|
+
const _saves = saves();
|
|
316
|
+
for (let i = 0; i < _saves.length; i++) {
|
|
317
|
+
const current = _saves[i];
|
|
318
|
+
if (current[2][0] === date) {
|
|
319
|
+
_saves.splice(i, 1);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
data.storeDataUpdate((prev) => {
|
|
323
|
+
return prev.saves = _saves, prev;
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
return <div
|
|
327
|
+
classList={{
|
|
328
|
+
[root_module_default.root]: true,
|
|
329
|
+
[root_module_default.saves]: true
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
<div class={root_module_default.controls}><button type="button" class={join(root_module_default.button, root_module_default.buttonSaves)} onClick={() => props.setState("screen", "mainmenu")}>{data.t("GoBack")}</button></div>
|
|
333
|
+
<Show2 when={saves()} fallback={data.t("NoSaves")}><ol class={root_module_default.list}><For2 each={saves()}>{(save) => {
|
|
334
|
+
const [date, type] = save[2];
|
|
335
|
+
const stringDate = capitalize(new Date(date).toLocaleDateString(language(), { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }));
|
|
336
|
+
const stringType = data.t(type === "auto" ? "Automatic" : "Manual");
|
|
337
|
+
return <li>
|
|
338
|
+
<button
|
|
339
|
+
type="button"
|
|
340
|
+
class={join(root_module_default.button, root_module_default.buttonSaves)}
|
|
341
|
+
aria-label={data.t("LoadASaveFrom") + " " + stringDate}
|
|
342
|
+
onClick={() => data.options.set(save)}
|
|
343
|
+
>
|
|
344
|
+
{stringDate}
|
|
345
|
+
<span style={{ "margin-left": "1em" }}>{stringType}</span>
|
|
346
|
+
</button>
|
|
347
|
+
<button type="reset" class={join(root_module_default.button, root_module_default.buttonSavesDelete)} aria-label={data.t("DeleteASaveFrom") + " " + stringDate} onClick={[removeSave, date]}><span>{data.t("Remove")}</span></button>
|
|
348
|
+
</li>;
|
|
349
|
+
}}</For2></ol></Show2>
|
|
350
|
+
</div>;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// src/screens/settings.tsx
|
|
354
|
+
import { Show as Show3, For as For3, createUniqueId } from "solid-js";
|
|
355
|
+
var Settings = (props) => {
|
|
356
|
+
const data = useData();
|
|
357
|
+
const saves = () => data.storeData().saves;
|
|
358
|
+
const language = () => data.storeData().meta[0];
|
|
359
|
+
const onSelect = (e) => {
|
|
360
|
+
const selected = e.currentTarget.value;
|
|
361
|
+
data.storeDataUpdate((prev) => {
|
|
362
|
+
return prev.meta[0] = selected, prev;
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
const id = createUniqueId();
|
|
366
|
+
return <div
|
|
367
|
+
classList={{
|
|
368
|
+
[root_module_default.root]: true,
|
|
369
|
+
[root_module_default.settings]: true
|
|
370
|
+
}}
|
|
371
|
+
>
|
|
372
|
+
<div class={root_module_default.controls}>
|
|
373
|
+
<button type="button" class={join(root_module_default.button, root_module_default.buttonSettings)} onClick={() => props.setState("screen", "mainmenu")}>{data.t("HomeScreen")}</button>
|
|
374
|
+
<button type="button" class={join(root_module_default.button, root_module_default.buttonSettings)} onClick={() => data.options.restore()}>{data.t("ToTheGame")}</button>
|
|
375
|
+
</div>
|
|
376
|
+
<Show3 when={saves()} fallback={data.t("NoSaves")}>{() => {
|
|
377
|
+
const languageNames = new Intl.DisplayNames([language()], {
|
|
378
|
+
type: "language"
|
|
379
|
+
});
|
|
380
|
+
return <div class={root_module_default.content}>
|
|
381
|
+
<label for={id}>{data.t("Language")}</label>
|
|
382
|
+
<select id={id} onChange={onSelect}><For3 each={data.options.languages}>{(lang) => <option value={lang} selected={lang === language()}>{capitalize(languageNames.of(lang) || lang)}</option>}</For3></select>
|
|
383
|
+
</div>;
|
|
384
|
+
}}</Show3>
|
|
385
|
+
</div>;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/screens/loading.tsx
|
|
389
|
+
var Loading = () => {
|
|
390
|
+
return <div
|
|
391
|
+
classList={{
|
|
392
|
+
[root_module_default.root]: true,
|
|
393
|
+
[root_module_default.loading]: true
|
|
394
|
+
}}
|
|
395
|
+
><div class={root_module_default.ldsEllipsis}>
|
|
396
|
+
<div />
|
|
397
|
+
<div />
|
|
398
|
+
<div />
|
|
399
|
+
<div />
|
|
400
|
+
</div></div>;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// src/renderer.tsx
|
|
404
|
+
var createSolidRenderer = () => {
|
|
405
|
+
const [state, setState] = createStore({
|
|
406
|
+
background: "",
|
|
407
|
+
characters: {},
|
|
408
|
+
dialog: {
|
|
409
|
+
content: "",
|
|
410
|
+
visible: false
|
|
411
|
+
},
|
|
412
|
+
choices: {
|
|
413
|
+
visible: false,
|
|
414
|
+
choices: []
|
|
415
|
+
},
|
|
416
|
+
input: {
|
|
417
|
+
question: "",
|
|
418
|
+
error: "",
|
|
419
|
+
visible: false
|
|
420
|
+
},
|
|
421
|
+
layers: {},
|
|
422
|
+
screen: "mainmenu"
|
|
423
|
+
});
|
|
424
|
+
const store = {
|
|
425
|
+
characters: {},
|
|
426
|
+
audio: {
|
|
427
|
+
music: void 0
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
let characters;
|
|
431
|
+
let renderer;
|
|
432
|
+
let options;
|
|
433
|
+
return {
|
|
434
|
+
createRenderer(init) {
|
|
435
|
+
options = init, characters = init.characters;
|
|
436
|
+
return renderer = {
|
|
437
|
+
background(background) {
|
|
438
|
+
setState("background", background);
|
|
439
|
+
},
|
|
440
|
+
character(character) {
|
|
441
|
+
if (store.characters[character])
|
|
442
|
+
return store.characters[character];
|
|
443
|
+
const canvas = <canvas />;
|
|
444
|
+
const ctx = canvas.getContext("2d");
|
|
445
|
+
return store.characters[character] = {
|
|
446
|
+
canvas,
|
|
447
|
+
ctx,
|
|
448
|
+
emotions: {},
|
|
449
|
+
withEmotion(emotion) {
|
|
450
|
+
const stored = store.characters[character].emotions[emotion];
|
|
451
|
+
const render = (...images) => {
|
|
452
|
+
return () => {
|
|
453
|
+
canvasDrawImages(canvas, ctx, images);
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
if (stored)
|
|
457
|
+
return render(..."head" in stored ? [stored.head, stored.left, stored.right] : [stored]);
|
|
458
|
+
const emotionData = characters[character].emotions[emotion];
|
|
459
|
+
if (typeof emotionData === "string") {
|
|
460
|
+
return render(store.characters[character].emotions[emotion] = createImage(emotionData));
|
|
461
|
+
}
|
|
462
|
+
const head = createImage(emotionData.head);
|
|
463
|
+
const left = createImage(emotionData.body.left);
|
|
464
|
+
const right = createImage(emotionData.body.right);
|
|
465
|
+
store.characters[character].emotions[emotion] = {
|
|
466
|
+
head,
|
|
467
|
+
left,
|
|
468
|
+
right
|
|
469
|
+
};
|
|
470
|
+
return render(head, left, right);
|
|
471
|
+
},
|
|
472
|
+
append(className, style) {
|
|
473
|
+
clearTimeout(state.characters[character]?.timeoutId);
|
|
474
|
+
setState("characters", character, { className, style, visible: true });
|
|
475
|
+
},
|
|
476
|
+
remove(className, style, duration) {
|
|
477
|
+
return (resolve) => {
|
|
478
|
+
const timeoutId = setTimeout(() => {
|
|
479
|
+
setState("characters", character, { visible: false });
|
|
480
|
+
resolve();
|
|
481
|
+
}, duration);
|
|
482
|
+
setState("characters", character, { className, style, timeoutId });
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
},
|
|
487
|
+
dialog(content, character, emotion) {
|
|
488
|
+
return (resolve) => {
|
|
489
|
+
setState("dialog", () => ({ content, character, emotion, visible: true, resolve }));
|
|
490
|
+
};
|
|
491
|
+
},
|
|
492
|
+
choices(choices) {
|
|
493
|
+
return (resolve) => {
|
|
494
|
+
setState("choices", { choices, resolve, visible: true });
|
|
495
|
+
};
|
|
496
|
+
},
|
|
497
|
+
clear(goingBack) {
|
|
498
|
+
return (resolve) => {
|
|
499
|
+
setState("background", "#000");
|
|
500
|
+
setState("choices", { visible: false });
|
|
501
|
+
setState("input", { element: void 0, question: "", visible: false });
|
|
502
|
+
setState("dialog", { visible: false });
|
|
503
|
+
for (const character of Object.keys(state.characters)) {
|
|
504
|
+
setState("characters", character, { visible: false });
|
|
505
|
+
}
|
|
506
|
+
for (const layer of Object.values(state.layers)) {
|
|
507
|
+
if (!layer)
|
|
508
|
+
continue;
|
|
509
|
+
if (!(goingBack && layer.skipClearOnGoingBack()))
|
|
510
|
+
layer.delete();
|
|
511
|
+
}
|
|
512
|
+
resolve();
|
|
513
|
+
};
|
|
514
|
+
},
|
|
515
|
+
input(question, onInput, setup) {
|
|
516
|
+
return (resolve) => {
|
|
517
|
+
const errorHandler = (value) => {
|
|
518
|
+
setState("input", { error: value });
|
|
519
|
+
};
|
|
520
|
+
const onInputHandler = (event) => {
|
|
521
|
+
onInput({ input, event, error: errorHandler });
|
|
522
|
+
};
|
|
523
|
+
const input = <input type="text" name="novely-input" required autocomplete="off" onInput={onInputHandler} />;
|
|
524
|
+
if (setup)
|
|
525
|
+
setup(input);
|
|
526
|
+
setState("input", { element: input, question, visible: true, resolve });
|
|
527
|
+
};
|
|
528
|
+
},
|
|
529
|
+
music(source, method) {
|
|
530
|
+
const stored = store.audio?.[method];
|
|
531
|
+
if (stored && stored.element.src.endsWith(source))
|
|
532
|
+
return stored.element.currentTime = 0, stored;
|
|
533
|
+
const element = new Audio(source);
|
|
534
|
+
const handle = {
|
|
535
|
+
element,
|
|
536
|
+
pause: element.pause,
|
|
537
|
+
play() {
|
|
538
|
+
const onClick = () => {
|
|
539
|
+
removeEventListener("click", onClick), element.play();
|
|
540
|
+
};
|
|
541
|
+
addEventListener("click", onClick);
|
|
542
|
+
},
|
|
543
|
+
stop() {
|
|
544
|
+
element.pause();
|
|
545
|
+
element.currentTime = 0;
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
return store.audio[method] = handle;
|
|
549
|
+
},
|
|
550
|
+
custom(fn, goingBack, resolve) {
|
|
551
|
+
const get = (id) => {
|
|
552
|
+
if (state.layers[id])
|
|
553
|
+
return state.layers[id];
|
|
554
|
+
const local = {
|
|
555
|
+
skipClearOnGoingBack: false,
|
|
556
|
+
storage: {},
|
|
557
|
+
clear: () => {
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
const data = (data2) => {
|
|
561
|
+
if (!data2) {
|
|
562
|
+
return local.storage;
|
|
563
|
+
} else {
|
|
564
|
+
local.storage = data2;
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
const skipClearOnGoingBack = (value) => {
|
|
568
|
+
if (value) {
|
|
569
|
+
local.skipClearOnGoingBack = value;
|
|
570
|
+
} else {
|
|
571
|
+
return local.skipClearOnGoingBack;
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
setState("layers", id, () => ({
|
|
575
|
+
element: <div id={id} />,
|
|
576
|
+
data,
|
|
577
|
+
skipClearOnGoingBack,
|
|
578
|
+
clear(fn2) {
|
|
579
|
+
local.clear = fn2;
|
|
580
|
+
},
|
|
581
|
+
delete() {
|
|
582
|
+
local.clear();
|
|
583
|
+
setState("layers", id, void 0);
|
|
584
|
+
}
|
|
585
|
+
}));
|
|
586
|
+
return state.layers[id];
|
|
587
|
+
};
|
|
588
|
+
const result = fn(get, goingBack, fn.requireUserAction ? resolve : () => {
|
|
589
|
+
});
|
|
590
|
+
if (!fn.requireUserAction)
|
|
591
|
+
result ? result.then(resolve) : resolve();
|
|
592
|
+
return result;
|
|
593
|
+
},
|
|
594
|
+
store,
|
|
595
|
+
ui: {
|
|
596
|
+
showScreen(name) {
|
|
597
|
+
setState("screen", name);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
},
|
|
602
|
+
Novely(props) {
|
|
603
|
+
return <div {...props}><Provider storeData={options.$} options={options} renderer={renderer}><Switch fallback={<>No</>}>
|
|
604
|
+
<Match when={state.screen === "game"}><Game state={state} setState={
|
|
605
|
+
/* @once */
|
|
606
|
+
setState
|
|
607
|
+
} store={
|
|
608
|
+
/* @once */
|
|
609
|
+
store
|
|
610
|
+
} characters={
|
|
611
|
+
/* @once */
|
|
612
|
+
characters
|
|
613
|
+
} renderer={
|
|
614
|
+
/* @once */
|
|
615
|
+
renderer
|
|
616
|
+
} /></Match>
|
|
617
|
+
<Match when={state.screen === "mainmenu"}><MainMenu setState={
|
|
618
|
+
/* @once */
|
|
619
|
+
setState
|
|
620
|
+
} /></Match>
|
|
621
|
+
<Match when={state.screen === "saves"}><Saves setState={
|
|
622
|
+
/* @once */
|
|
623
|
+
setState
|
|
624
|
+
} /></Match>
|
|
625
|
+
<Match when={state.screen === "settings"}><Settings setState={
|
|
626
|
+
/* @once */
|
|
627
|
+
setState
|
|
628
|
+
} /></Match>
|
|
629
|
+
<Match when={state.screen === "loading"}><Loading /></Match>
|
|
630
|
+
</Switch></Provider></div>;
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
};
|
|
634
|
+
export {
|
|
635
|
+
createSolidRenderer
|
|
636
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Renderer, RendererInit, RendererStore, ValidAction, CustomHandlerGetResult } from '@novely/core';
|
|
2
|
+
import type { JSX } from 'solid-js';
|
|
3
|
+
interface StateCharacter {
|
|
4
|
+
/**
|
|
5
|
+
* `element.className`
|
|
6
|
+
*/
|
|
7
|
+
className: string;
|
|
8
|
+
/**
|
|
9
|
+
* `element.style`
|
|
10
|
+
*/
|
|
11
|
+
style: string;
|
|
12
|
+
/**
|
|
13
|
+
* Показывать ли элемент
|
|
14
|
+
*/
|
|
15
|
+
visible: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* `id` для `setTimeout`, который отвечает за `duration` в `hideCharacter`
|
|
18
|
+
*/
|
|
19
|
+
timeoutId: number;
|
|
20
|
+
}
|
|
21
|
+
interface StateDialog {
|
|
22
|
+
/**
|
|
23
|
+
* Контент диалога
|
|
24
|
+
*/
|
|
25
|
+
content: string;
|
|
26
|
+
/**
|
|
27
|
+
* Мини-персонаж
|
|
28
|
+
*/
|
|
29
|
+
character?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Эмоция мини-персонажа
|
|
32
|
+
*/
|
|
33
|
+
emotion?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Должен ли диалог быть показан
|
|
36
|
+
*/
|
|
37
|
+
visible: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Функция `resolve`
|
|
40
|
+
*/
|
|
41
|
+
resolve?: () => void;
|
|
42
|
+
}
|
|
43
|
+
interface StateChoices {
|
|
44
|
+
/**
|
|
45
|
+
* Функция `resolve`
|
|
46
|
+
* @param selected `index` выбранного
|
|
47
|
+
*/
|
|
48
|
+
resolve?: (selected: number) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Выборы
|
|
51
|
+
*/
|
|
52
|
+
choices: ([string, ValidAction[]] | [string, ValidAction[], () => boolean])[];
|
|
53
|
+
/**
|
|
54
|
+
* Должен ли отображаться диалог
|
|
55
|
+
*/
|
|
56
|
+
visible: boolean;
|
|
57
|
+
}
|
|
58
|
+
interface StateInput {
|
|
59
|
+
/**
|
|
60
|
+
* Вопрос (что делает этот input)
|
|
61
|
+
*/
|
|
62
|
+
question: string;
|
|
63
|
+
/**
|
|
64
|
+
* Элемент `input`
|
|
65
|
+
*/
|
|
66
|
+
element?: HTMLInputElement;
|
|
67
|
+
/**
|
|
68
|
+
* Должен ли отображаться диалог с `input`
|
|
69
|
+
*/
|
|
70
|
+
visible: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Функция `resolve`
|
|
73
|
+
*/
|
|
74
|
+
resolve?: () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Ошибка
|
|
77
|
+
*/
|
|
78
|
+
error: string;
|
|
79
|
+
}
|
|
80
|
+
type StateLayers = Record<string, CustomHandlerGetResult | undefined>;
|
|
81
|
+
interface State {
|
|
82
|
+
background: string;
|
|
83
|
+
characters: Record<string, StateCharacter>;
|
|
84
|
+
dialog: StateDialog;
|
|
85
|
+
choices: StateChoices;
|
|
86
|
+
input: StateInput;
|
|
87
|
+
layers: StateLayers;
|
|
88
|
+
screen: "mainmenu" | "game" | "saves" | "settings" | 'loading';
|
|
89
|
+
}
|
|
90
|
+
interface SolidRendererStore extends RendererStore {
|
|
91
|
+
dialogRef?: HTMLParagraphElement;
|
|
92
|
+
}
|
|
93
|
+
declare const createSolidRenderer: () => {
|
|
94
|
+
createRenderer(init: RendererInit): Renderer;
|
|
95
|
+
Novely(props: Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children'>): JSX.Element;
|
|
96
|
+
};
|
|
97
|
+
export { createSolidRenderer };
|
|
98
|
+
export type { State, SolidRendererStore };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Renderer, Character } from '@novely/core';
|
|
2
|
+
import type { VoidComponent } from 'solid-js';
|
|
3
|
+
import type { SetStoreFunction } from 'solid-js/store';
|
|
4
|
+
import type { State, SolidRendererStore } from '../renderer';
|
|
5
|
+
interface GameProps {
|
|
6
|
+
state: State;
|
|
7
|
+
setState: SetStoreFunction<State>;
|
|
8
|
+
store: SolidRendererStore;
|
|
9
|
+
characters: Record<string, Character>;
|
|
10
|
+
renderer: Renderer;
|
|
11
|
+
}
|
|
12
|
+
declare const Game: VoidComponent<GameProps>;
|
|
13
|
+
export { Game };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VoidComponent } from 'solid-js';
|
|
2
|
+
import type { SetStoreFunction } from 'solid-js/store';
|
|
3
|
+
import type { State } from '../renderer';
|
|
4
|
+
interface MainMenuProps {
|
|
5
|
+
setState: SetStoreFunction<State>;
|
|
6
|
+
}
|
|
7
|
+
declare const MainMenu: VoidComponent<MainMenuProps>;
|
|
8
|
+
export { MainMenu };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VoidComponent } from 'solid-js';
|
|
2
|
+
import type { SetStoreFunction } from 'solid-js/store';
|
|
3
|
+
import type { State } from '../renderer';
|
|
4
|
+
interface SavesProps {
|
|
5
|
+
setState: SetStoreFunction<State>;
|
|
6
|
+
}
|
|
7
|
+
declare const Saves: VoidComponent<SavesProps>;
|
|
8
|
+
export { Saves };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VoidComponent } from 'solid-js';
|
|
2
|
+
import type { SetStoreFunction } from 'solid-js/store';
|
|
3
|
+
import type { State } from '../renderer';
|
|
4
|
+
interface SettingsProps {
|
|
5
|
+
setState: SetStoreFunction<State>;
|
|
6
|
+
}
|
|
7
|
+
declare const Settings: VoidComponent<SettingsProps>;
|
|
8
|
+
export { Settings };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const capitalize: (str: string) => string;
|
|
2
|
+
declare const isCSSImage: (str: string) => boolean;
|
|
3
|
+
declare const createImage: (src: string) => HTMLImageElement;
|
|
4
|
+
/**
|
|
5
|
+
* Рисует `images` на `canvas`
|
|
6
|
+
*/
|
|
7
|
+
declare const canvasDrawImages: (canvas: HTMLCanvasElement | undefined, ctx: CanvasRenderingContext2D | undefined, images: HTMLImageElement[]) => readonly [HTMLCanvasElement, CanvasRenderingContext2D];
|
|
8
|
+
declare const url: <T extends string>(str: T) => `url(${T})`;
|
|
9
|
+
declare const join: (...elements: (string | boolean)[]) => string;
|
|
10
|
+
export { isCSSImage, canvasDrawImages, url, createImage, capitalize, join };
|
package/license
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Artem Schukin
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@novely/solid-renderer",
|
|
3
|
+
"version": "0.0.0-alpha",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"main": "./dist/index.jsx",
|
|
10
|
+
"module": "./dist/index.jsx",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "node ./build.js --watch",
|
|
14
|
+
"build": "node ./build.js && tsc"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"esbuild": "^0.16.3",
|
|
18
|
+
"esbuild-css-modules-plugin": "^2.7.1",
|
|
19
|
+
"typescript": "^4.9.5"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@novely/core": "workspace:*",
|
|
23
|
+
"@novely/typewriter": "workspace:*",
|
|
24
|
+
"solid-headless": "^0.13.1",
|
|
25
|
+
"solid-js": "1.6.10"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@novely/core": "*",
|
|
29
|
+
"solid-headless": "*",
|
|
30
|
+
"solid-js": "*"
|
|
31
|
+
},
|
|
32
|
+
"license": "ISC",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/yhdgms1/novely/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/yhdgms1/novely/tree/main/packages/solid-renderer",
|
|
37
|
+
"keywords": [
|
|
38
|
+
"novely",
|
|
39
|
+
"solid-js",
|
|
40
|
+
"solid",
|
|
41
|
+
"renderer",
|
|
42
|
+
"novel"
|
|
43
|
+
],
|
|
44
|
+
"author": {
|
|
45
|
+
"name": "Artemiy Schukin",
|
|
46
|
+
"url": "https://github.com/yhdgms1"
|
|
47
|
+
},
|
|
48
|
+
"contributors": [],
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/yhdgms1/novely.git"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist/*"
|
|
55
|
+
]
|
|
56
|
+
}
|