@novely/solid-renderer 0.0.0-alpha.5 → 0.0.0-alpha.7
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 +3 -0
- package/dist/index.css +44 -12
- package/dist/index.jsx +56 -43
- package/dist/renderer.d.ts +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,6 +78,9 @@ render(
|
|
|
78
78
|
| `--novely-button-hover-background-color` | `#ffffff` |
|
|
79
79
|
| `--novely-button-hover-border-color` | `#ffc6d8` |
|
|
80
80
|
| `--novely-button-hover-color` | `#ffb7a2` |
|
|
81
|
+
| `--novely-select-background-color` | `#ffe9f3` |
|
|
82
|
+
| `--novely-select-border-color` | `#ffc7df` |
|
|
83
|
+
| `--novely-select-color` | `#000000` |
|
|
81
84
|
| `--novely-dialog-color` | `#ffffff` |
|
|
82
85
|
| `--novely-dialog-border-color` | `#ffffff` |
|
|
83
86
|
| `--novely-dialog-border-radius` | `14px` |
|
package/dist/index.css
CHANGED
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
Noto Color Emoji;
|
|
22
22
|
font-size: 1em;
|
|
23
23
|
}
|
|
24
|
+
.n-root * {
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
/* esbuild-css-modules-plugin-namespace:./src/styles/button.module.css?esbuild-css-modules-plugin-built */
|
|
26
29
|
.n-button {
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
user-select: none;
|
|
32
35
|
margin: .4em 0;
|
|
33
36
|
padding: .4em;
|
|
34
|
-
font-size: 1.
|
|
37
|
+
font-size: 1.02em;
|
|
35
38
|
line-height: 1.2;
|
|
36
39
|
}
|
|
37
40
|
.n-button:hover {
|
|
@@ -49,21 +52,22 @@
|
|
|
49
52
|
padding: .4em .6em;
|
|
50
53
|
font-size: 1.2375em;
|
|
51
54
|
}
|
|
52
|
-
.n-buttonChoices {
|
|
53
|
-
font-size: 1.02em;
|
|
54
|
-
}
|
|
55
55
|
.n-buttonMainMenu,
|
|
56
56
|
.n-buttonSaves {
|
|
57
57
|
width: 100%;
|
|
58
|
-
font-size: 1.02em;
|
|
59
58
|
}
|
|
60
59
|
.n-buttonSavesDelete {
|
|
61
60
|
margin-left: 1em;
|
|
62
|
-
font-size: 1.02em;
|
|
63
61
|
}
|
|
64
62
|
.n-buttonSettings {
|
|
65
63
|
width: 100%;
|
|
66
|
-
|
|
64
|
+
}
|
|
65
|
+
.n-buttonControlPanel {
|
|
66
|
+
border: 2px solid var(--novely-button-border-color, #ffc7df);
|
|
67
|
+
margin: 0;
|
|
68
|
+
padding: .2em .4em;
|
|
69
|
+
font-size: 1em;
|
|
70
|
+
line-height: 1;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/* esbuild-css-modules-plugin-namespace:./src/styles/characters.module.css?esbuild-css-modules-plugin-built */
|
|
@@ -259,30 +263,41 @@
|
|
|
259
263
|
height: 100%;
|
|
260
264
|
flex-direction: column;
|
|
261
265
|
align-items: center;
|
|
262
|
-
padding
|
|
266
|
+
padding: 0 1em;
|
|
263
267
|
display: flex;
|
|
264
268
|
}
|
|
265
269
|
.n-saves > .n-list {
|
|
266
270
|
width: 100%;
|
|
267
271
|
height: 100%;
|
|
268
272
|
flex-direction: column;
|
|
269
|
-
flex: 1 1 0;
|
|
270
|
-
justify-content: center;
|
|
271
273
|
align-items: center;
|
|
272
|
-
padding
|
|
274
|
+
padding: 0 1em;
|
|
273
275
|
list-style: none;
|
|
274
276
|
display: flex;
|
|
277
|
+
overflow-y: scroll;
|
|
275
278
|
}
|
|
276
279
|
.n-saves > .n-list > li {
|
|
277
280
|
display: flex;
|
|
278
281
|
}
|
|
282
|
+
@media (max-width: 768px) {
|
|
283
|
+
.n-saves {
|
|
284
|
+
flex-direction: column;
|
|
285
|
+
}
|
|
286
|
+
.n-saves > .n-controls {
|
|
287
|
+
width: auto;
|
|
288
|
+
height: auto;
|
|
289
|
+
}
|
|
290
|
+
.n-saves > .n-list {
|
|
291
|
+
height: auto;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
279
294
|
|
|
280
295
|
/* esbuild-css-modules-plugin-namespace:./src/styles/controlPanel.module.css?esbuild-css-modules-plugin-built */
|
|
281
296
|
.n-controlPanel {
|
|
282
297
|
z-index: 23;
|
|
283
298
|
position: absolute;
|
|
284
299
|
bottom: .4em;
|
|
285
|
-
right:
|
|
300
|
+
right: .4em;
|
|
286
301
|
}
|
|
287
302
|
|
|
288
303
|
/* esbuild-css-modules-plugin-namespace:./src/styles/settings.module.css?esbuild-css-modules-plugin-built */
|
|
@@ -314,6 +329,23 @@
|
|
|
314
329
|
list-style: none;
|
|
315
330
|
display: flex;
|
|
316
331
|
}
|
|
332
|
+
.n-settings .n-select {
|
|
333
|
+
flex-direction: column;
|
|
334
|
+
align-items: start;
|
|
335
|
+
display: flex;
|
|
336
|
+
}
|
|
337
|
+
.n-settings .n-select > select {
|
|
338
|
+
background-color: var(--novely-select-background-color, #ffe9f3);
|
|
339
|
+
border: 4px solid var(--novely-select-border-color, #ffc7df);
|
|
340
|
+
color: var(--novely-select-color, #000);
|
|
341
|
+
margin: .4em 0;
|
|
342
|
+
padding: .4em;
|
|
343
|
+
font-size: 1.02em;
|
|
344
|
+
}
|
|
345
|
+
.n-settings .n-select > label {
|
|
346
|
+
color: var(--novely-select-color, #000);
|
|
347
|
+
font-size: 1.42em;
|
|
348
|
+
}
|
|
317
349
|
|
|
318
350
|
/* esbuild-css-modules-plugin-namespace:./src/styles/loading.module.css?esbuild-css-modules-plugin-built */
|
|
319
351
|
.n-loading {
|
package/dist/index.jsx
CHANGED
|
@@ -87,7 +87,7 @@ var M = (h, d, c) => {
|
|
|
87
87
|
var root_module_default = { "root": "n-root" };
|
|
88
88
|
|
|
89
89
|
// esbuild-css-modules-plugin-namespace:./src/styles/button.module.css?esbuild-css-modules-plugin-building
|
|
90
|
-
var button_module_default = { "button": "n-button", "
|
|
90
|
+
var button_module_default = { "button": "n-button", "buttonControlPanel": "n-buttonControlPanel", "buttonInputDialogPanel": "n-buttonInputDialogPanel", "buttonMainMenu": "n-buttonMainMenu", "buttonSaves": "n-buttonSaves", "buttonSavesDelete": "n-buttonSavesDelete", "buttonSettings": "n-buttonSettings" };
|
|
91
91
|
|
|
92
92
|
// esbuild-css-modules-plugin-namespace:./src/styles/characters.module.css?esbuild-css-modules-plugin-building
|
|
93
93
|
var characters_module_default = { "characters": "n-characters" };
|
|
@@ -108,7 +108,7 @@ var saves_module_default = { "controls": "n-controls", "list": "n-list", "saves"
|
|
|
108
108
|
var controlPanel_module_default = { "controlPanel": "n-controlPanel" };
|
|
109
109
|
|
|
110
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" };
|
|
111
|
+
var settings_module_default = { "content": "n-content", "controls": "n-controls", "select": "n-select", "settings": "n-settings" };
|
|
112
112
|
|
|
113
113
|
// esbuild-css-modules-plugin-namespace:./src/styles/loading.module.css?esbuild-css-modules-plugin-building
|
|
114
114
|
var loading_module_default = { "ldsEllipsis": "n-lds-ellipsis", "ldsEllipsis1": "n-lds-ellipsis1", "ldsEllipsis2": "n-lds-ellipsis2", "ldsEllipsis3": "n-lds-ellipsis3", "loading": "n-loading" };
|
|
@@ -156,6 +156,7 @@ var Game = (props) => {
|
|
|
156
156
|
setState("input", { element: void 0, question: "", visible: false });
|
|
157
157
|
resolve?.();
|
|
158
158
|
};
|
|
159
|
+
const layers = () => Object.values(props.state.layers);
|
|
159
160
|
return <div class={root_module_default.root} style={background()}>
|
|
160
161
|
<div data-characters={true} class={root_module_default.characters}><For each={Object.entries(props.state.characters)}>{([character, data2]) => <Show when={data2.visible}>{() => {
|
|
161
162
|
const canvas = store.characters[character].canvas;
|
|
@@ -249,10 +250,14 @@ var Game = (props) => {
|
|
|
249
250
|
>{data.t("Sumbit")}</button>
|
|
250
251
|
</DialogPanel>
|
|
251
252
|
</div></Dialog>
|
|
252
|
-
<div><For each={
|
|
253
|
+
<div data-custom={true}><For each={layers()}>{(value) => value.dom}</For></div>
|
|
253
254
|
<div class={root_module_default.controlPanel}>
|
|
254
255
|
<button
|
|
255
256
|
type="button"
|
|
257
|
+
classList={{
|
|
258
|
+
[root_module_default.button]: true,
|
|
259
|
+
[root_module_default.buttonControlPanel]: true
|
|
260
|
+
}}
|
|
256
261
|
onClick={() => {
|
|
257
262
|
data.options.stack.back();
|
|
258
263
|
data.options.restore(data.options.stack.value);
|
|
@@ -260,18 +265,30 @@ var Game = (props) => {
|
|
|
260
265
|
>{data.t("GoBack")}</button>
|
|
261
266
|
<button
|
|
262
267
|
type="button"
|
|
268
|
+
classList={{
|
|
269
|
+
[root_module_default.button]: true,
|
|
270
|
+
[root_module_default.buttonControlPanel]: true
|
|
271
|
+
}}
|
|
263
272
|
onClick={() => {
|
|
264
273
|
data.options.save(false, "manual");
|
|
265
274
|
}}
|
|
266
275
|
>{data.t("DoSave")}</button>
|
|
267
276
|
<button
|
|
268
277
|
type="button"
|
|
278
|
+
classList={{
|
|
279
|
+
[root_module_default.button]: true,
|
|
280
|
+
[root_module_default.buttonControlPanel]: true
|
|
281
|
+
}}
|
|
269
282
|
onClick={() => {
|
|
270
283
|
setAuto((prev) => !prev);
|
|
271
284
|
}}
|
|
272
|
-
>{data.t(auto() ? "
|
|
285
|
+
>{data.t(auto() ? "Stop" : "Auto")}</button>
|
|
273
286
|
<button
|
|
274
287
|
type="button"
|
|
288
|
+
classList={{
|
|
289
|
+
[root_module_default.button]: true,
|
|
290
|
+
[root_module_default.buttonControlPanel]: true
|
|
291
|
+
}}
|
|
275
292
|
onClick={() => {
|
|
276
293
|
data.options.save(false, "auto").then(() => {
|
|
277
294
|
props.setState("screen", "settings");
|
|
@@ -280,6 +297,10 @@ var Game = (props) => {
|
|
|
280
297
|
>{data.t("Settings")}</button>
|
|
281
298
|
<button
|
|
282
299
|
type="button"
|
|
300
|
+
classList={{
|
|
301
|
+
[root_module_default.button]: true,
|
|
302
|
+
[root_module_default.buttonControlPanel]: true
|
|
303
|
+
}}
|
|
283
304
|
onClick={() => {
|
|
284
305
|
data.options.stack.clear();
|
|
285
306
|
props.setState("screen", "mainmenu");
|
|
@@ -377,10 +398,10 @@ var Settings = (props) => {
|
|
|
377
398
|
const languageNames = new Intl.DisplayNames([language()], {
|
|
378
399
|
type: "language"
|
|
379
400
|
});
|
|
380
|
-
return <div class={root_module_default.content}>
|
|
401
|
+
return <div class={root_module_default.content}><div class={root_module_default.select}>
|
|
381
402
|
<label for={id}>{data.t("Language")}</label>
|
|
382
403
|
<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>;
|
|
404
|
+
</div></div>;
|
|
384
405
|
}}</Show3>
|
|
385
406
|
</div>;
|
|
386
407
|
};
|
|
@@ -504,11 +525,12 @@ var createSolidRenderer = () => {
|
|
|
504
525
|
for (const character of Object.keys(state.characters)) {
|
|
505
526
|
setState("characters", character, { visible: false });
|
|
506
527
|
}
|
|
507
|
-
for (const layer of Object.
|
|
528
|
+
for (const [id, layer] of Object.entries(state.layers)) {
|
|
508
529
|
if (!layer)
|
|
509
530
|
continue;
|
|
510
|
-
if (!(goingBack && layer.skipClearOnGoingBack
|
|
511
|
-
layer.
|
|
531
|
+
if (!(goingBack && layer.fn.skipClearOnGoingBack)) {
|
|
532
|
+
layer.clear(), setState("layers", id, void 0);
|
|
533
|
+
}
|
|
512
534
|
}
|
|
513
535
|
resolve();
|
|
514
536
|
};
|
|
@@ -549,43 +571,34 @@ var createSolidRenderer = () => {
|
|
|
549
571
|
return store.audio[method] = handle;
|
|
550
572
|
},
|
|
551
573
|
custom(fn, goingBack, resolve) {
|
|
552
|
-
const get = (id) => {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
storage: {},
|
|
558
|
-
clear: () => {
|
|
559
|
-
}
|
|
574
|
+
const get = (id, insert = true) => {
|
|
575
|
+
const cached = state.layers[id];
|
|
576
|
+
if (cached)
|
|
577
|
+
return cached.value;
|
|
578
|
+
let clear = () => {
|
|
560
579
|
};
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
} else {
|
|
565
|
-
local.storage = data2;
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
const skipClearOnGoingBack = (value) => {
|
|
569
|
-
if (value) {
|
|
570
|
-
local.skipClearOnGoingBack = value;
|
|
571
|
-
} else {
|
|
572
|
-
return local.skipClearOnGoingBack;
|
|
573
|
-
}
|
|
580
|
+
let store2 = {};
|
|
581
|
+
const topLevelClear = () => {
|
|
582
|
+
clear(), setState("layers", id, void 0);
|
|
574
583
|
};
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
584
|
+
const element = insert ? <div id={id} /> : null;
|
|
585
|
+
setState("layers", id, {
|
|
586
|
+
fn,
|
|
587
|
+
dom: element,
|
|
588
|
+
clear: topLevelClear,
|
|
589
|
+
value: {
|
|
590
|
+
root,
|
|
591
|
+
element,
|
|
592
|
+
delete: topLevelClear,
|
|
593
|
+
data(data) {
|
|
594
|
+
return data ? store2 = data : store2;
|
|
595
|
+
},
|
|
596
|
+
clear(cb) {
|
|
597
|
+
clear = cb;
|
|
598
|
+
}
|
|
586
599
|
}
|
|
587
|
-
})
|
|
588
|
-
return state.layers[id];
|
|
600
|
+
});
|
|
601
|
+
return state.layers[id].value;
|
|
589
602
|
};
|
|
590
603
|
const result = fn(get, goingBack, fn.requireUserAction ? resolve : () => {
|
|
591
604
|
});
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Renderer, RendererInit, RendererStore, ValidAction, CustomHandlerGetResult } from '@novely/core';
|
|
1
|
+
import type { Renderer, RendererInit, RendererStore, ValidAction, CustomHandler, CustomHandlerGetResult } from '@novely/core';
|
|
2
2
|
import type { JSX } from 'solid-js';
|
|
3
3
|
interface StateCharacter {
|
|
4
4
|
/**
|
|
@@ -77,7 +77,12 @@ interface StateInput {
|
|
|
77
77
|
*/
|
|
78
78
|
error: string;
|
|
79
79
|
}
|
|
80
|
-
type StateLayers = Record<string,
|
|
80
|
+
type StateLayers = Record<string, {
|
|
81
|
+
value: CustomHandlerGetResult;
|
|
82
|
+
fn: CustomHandler;
|
|
83
|
+
clear: (() => void);
|
|
84
|
+
dom: null | HTMLDivElement;
|
|
85
|
+
} | undefined>;
|
|
81
86
|
interface State {
|
|
82
87
|
background: string;
|
|
83
88
|
characters: Record<string, StateCharacter>;
|