@novely/solid-renderer 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.jsx +59 -12
- package/dist/renderer.d.ts +1 -0
- package/dist/styles/index.css +44 -35
- package/package.json +1 -1
package/dist/index.jsx
CHANGED
|
@@ -187,18 +187,29 @@ var collectTextNodes = (el) => {
|
|
|
187
187
|
});
|
|
188
188
|
return items;
|
|
189
189
|
};
|
|
190
|
+
var map = (it, cb) => {
|
|
191
|
+
const result = [];
|
|
192
|
+
for (const value of [...it]) {
|
|
193
|
+
const val = cb(value, result[result.length - 1]);
|
|
194
|
+
if (val) {
|
|
195
|
+
result.push(val);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
};
|
|
190
200
|
var typewriter = ({ node, text, ended, speed = defaultSpeed }) => {
|
|
191
201
|
node.innerHTML = text;
|
|
192
202
|
const nodes = collectTextNodes(node).map((child) => {
|
|
193
|
-
const letters =
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
203
|
+
const letters = map(child.textContent, (char, prev) => {
|
|
204
|
+
if (char === " " && prev) {
|
|
205
|
+
prev.textContent += " ";
|
|
206
|
+
return void 0;
|
|
197
207
|
} else {
|
|
208
|
+
const text2 = document.createElement("span");
|
|
198
209
|
text2.textContent = char;
|
|
210
|
+
text2.style.opacity = "0";
|
|
211
|
+
return text2;
|
|
199
212
|
}
|
|
200
|
-
text2.style.opacity = "0";
|
|
201
|
-
return text2;
|
|
202
213
|
});
|
|
203
214
|
child.replaceWith(...letters);
|
|
204
215
|
return letters;
|
|
@@ -259,7 +270,7 @@ var typewriter = ({ node, text, ended, speed = defaultSpeed }) => {
|
|
|
259
270
|
node.innerHTML = "";
|
|
260
271
|
return end;
|
|
261
272
|
}
|
|
262
|
-
node.innerHTML = text
|
|
273
|
+
node.innerHTML = text;
|
|
263
274
|
end = true;
|
|
264
275
|
return false;
|
|
265
276
|
},
|
|
@@ -298,7 +309,7 @@ var createTypewriter = ({ resolve }) => {
|
|
|
298
309
|
if (!node)
|
|
299
310
|
return;
|
|
300
311
|
if (PRM.matches) {
|
|
301
|
-
node.innerHTML = text
|
|
312
|
+
node.innerHTML = text;
|
|
302
313
|
bypassed = true;
|
|
303
314
|
setState("done");
|
|
304
315
|
return;
|
|
@@ -434,7 +445,6 @@ var Game = (props) => {
|
|
|
434
445
|
aria-disabled={!props.state.dialog.content}
|
|
435
446
|
role="button"
|
|
436
447
|
tabIndex={0}
|
|
437
|
-
title={DialogWriter.state() === "idle" ? void 0 : data.t(DialogWriter.state() === "processing" ? "CompleteText" : "GoForward")}
|
|
438
448
|
onClick={DialogWriter.clear}
|
|
439
449
|
onKeyPress={onKey(DialogWriter.clear, "Enter")}
|
|
440
450
|
onKeyDown={onKey(DialogWriter.clear, " ")}
|
|
@@ -453,6 +463,9 @@ var Game = (props) => {
|
|
|
453
463
|
return canvas;
|
|
454
464
|
}}</Show3></div>
|
|
455
465
|
<div class="action-dialog-content"><DialogWriter.Typewriter
|
|
466
|
+
attributes={{
|
|
467
|
+
title: DialogWriter.state() === "idle" ? void 0 : data.t(DialogWriter.state() === "processing" ? "CompleteText" : "GoForward")
|
|
468
|
+
}}
|
|
456
469
|
content={props.state.dialog.content}
|
|
457
470
|
speed={speed()}
|
|
458
471
|
ended={onWriterEnd(DialogWriter.clear)}
|
|
@@ -495,6 +508,31 @@ var Game = (props) => {
|
|
|
495
508
|
>{data.t("Sumbit")}</button>
|
|
496
509
|
</div>
|
|
497
510
|
</div></Modal>
|
|
511
|
+
<Modal isOpen={() => props.state.exitPromptShown}><div class="dialog-container">
|
|
512
|
+
<span class="dialog-fix" aria-hidden="true"></span>
|
|
513
|
+
<div class="dialog-backdrop" />
|
|
514
|
+
<div class="dialog-panel exit-dialog-panel">
|
|
515
|
+
<span
|
|
516
|
+
class="dialog-panel-label"
|
|
517
|
+
>{data.t("ExitDialogWarning")}</span>
|
|
518
|
+
<div class="exit-dialog-panel-buttons">
|
|
519
|
+
<button
|
|
520
|
+
type="button"
|
|
521
|
+
class="button"
|
|
522
|
+
onClick={() => {
|
|
523
|
+
setState("exitPromptShown", false);
|
|
524
|
+
}}
|
|
525
|
+
>{data.t("ExitDialogBack")}</button>
|
|
526
|
+
<button
|
|
527
|
+
type="button"
|
|
528
|
+
class="button"
|
|
529
|
+
onClick={() => {
|
|
530
|
+
data.options.exit(true);
|
|
531
|
+
}}
|
|
532
|
+
>{data.t("ExitDialogExit")}</button>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
</div></Modal>
|
|
498
536
|
<div data-custom={true}><For each={layers()}>{(value) => value.dom}</For></div>
|
|
499
537
|
<div
|
|
500
538
|
class="action-text"
|
|
@@ -502,11 +540,13 @@ var Game = (props) => {
|
|
|
502
540
|
aria-disabled={!props.state.text.content}
|
|
503
541
|
role="button"
|
|
504
542
|
tabIndex={0}
|
|
505
|
-
title={TextWriter.state() === "idle" ? void 0 : data.t(TextWriter.state() === "processing" ? "CompleteText" : "GoForward")}
|
|
506
543
|
onClick={TextWriter.clear}
|
|
507
544
|
onKeyPress={onKey(TextWriter.clear, "Enter")}
|
|
508
545
|
onKeyDown={onKey(TextWriter.clear, " ")}
|
|
509
546
|
><TextWriter.Typewriter
|
|
547
|
+
attributes={{
|
|
548
|
+
title: TextWriter.state() === "idle" ? void 0 : data.t(TextWriter.state() === "processing" ? "CompleteText" : "GoForward")
|
|
549
|
+
}}
|
|
510
550
|
content={props.state.text.content}
|
|
511
551
|
speed={speed()}
|
|
512
552
|
ended={onWriterEnd(TextWriter.clear)}
|
|
@@ -561,7 +601,9 @@ var Game = (props) => {
|
|
|
561
601
|
type="button"
|
|
562
602
|
class="button control-panel__button"
|
|
563
603
|
title={data.t("Exit")}
|
|
564
|
-
onClick={
|
|
604
|
+
onClick={() => {
|
|
605
|
+
data.options.exit();
|
|
606
|
+
}}
|
|
565
607
|
>
|
|
566
608
|
<span class="control-panel__button__content">{data.t("Exit")}</span>
|
|
567
609
|
<Icon class="control-panel__button__icon" children={Icon.Exit()} />
|
|
@@ -749,7 +791,8 @@ var createSolidRenderer = ({ fullscreen = false, controls = "outside" } = {}) =>
|
|
|
749
791
|
mainmenu: {
|
|
750
792
|
items: []
|
|
751
793
|
},
|
|
752
|
-
screen: "mainmenu"
|
|
794
|
+
screen: "mainmenu",
|
|
795
|
+
exitPromptShown: false
|
|
753
796
|
});
|
|
754
797
|
const store = {
|
|
755
798
|
characters: {},
|
|
@@ -848,6 +891,7 @@ var createSolidRenderer = ({ fullscreen = false, controls = "outside" } = {}) =>
|
|
|
848
891
|
},
|
|
849
892
|
clear(goingBack, keep, keepCharacters) {
|
|
850
893
|
return (resolve) => {
|
|
894
|
+
setState("exitPromptShown", false);
|
|
851
895
|
if (!keep.has("showBackground"))
|
|
852
896
|
setState("background", "#000");
|
|
853
897
|
if (!keep.has("choice"))
|
|
@@ -979,6 +1023,9 @@ var createSolidRenderer = ({ fullscreen = false, controls = "outside" } = {}) =>
|
|
|
979
1023
|
ui: {
|
|
980
1024
|
showScreen(name) {
|
|
981
1025
|
setState("screen", name);
|
|
1026
|
+
},
|
|
1027
|
+
showExitPrompt() {
|
|
1028
|
+
setState("exitPromptShown", true);
|
|
982
1029
|
}
|
|
983
1030
|
}
|
|
984
1031
|
};
|
package/dist/renderer.d.ts
CHANGED
package/dist/styles/index.css
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
/* src/styles/global/global.css */
|
|
2
|
-
canvas,
|
|
3
|
-
img {
|
|
4
|
-
-webkit-user-select: none;
|
|
5
|
-
user-select: none;
|
|
6
|
-
-webkit-tap-highlight-color: #0000;
|
|
7
|
-
-webkit-tap-highlight-color: transparent;
|
|
8
|
-
-webkit-touch-callout: none;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/* src/styles/global/index.css */
|
|
12
|
-
|
|
13
1
|
/* src/styles/root/root.css */
|
|
14
2
|
.root {
|
|
15
3
|
background-repeat: var(--novely-root-background-repeat, no-repeat);
|
|
16
4
|
background-position: var(--novely-root-background-position, center);
|
|
17
5
|
background-size: var(--novely-root-background-size, cover);
|
|
6
|
+
-webkit-user-select: none;
|
|
7
|
+
user-select: none;
|
|
8
|
+
-webkit-tap-highlight-color: #0000;
|
|
9
|
+
-webkit-tap-highlight-color: transparent;
|
|
10
|
+
-webkit-touch-callout: none;
|
|
18
11
|
width: 100vw;
|
|
19
12
|
height: 100vh;
|
|
20
13
|
font-family:
|
|
@@ -47,8 +40,6 @@ img {
|
|
|
47
40
|
border: 4px solid var(--novely-button-border-color, #ffc7df);
|
|
48
41
|
color: var(--novely-button-color, #000);
|
|
49
42
|
cursor: pointer;
|
|
50
|
-
-webkit-user-select: none;
|
|
51
|
-
user-select: none;
|
|
52
43
|
-webkit-tap-highlight-color: #0000;
|
|
53
44
|
-webkit-tap-highlight-color: transparent;
|
|
54
45
|
-webkit-touch-callout: none;
|
|
@@ -89,7 +80,7 @@ img {
|
|
|
89
80
|
|
|
90
81
|
/* src/styles/control-panel/control-panel.css */
|
|
91
82
|
.control-panel {
|
|
92
|
-
z-index:
|
|
83
|
+
z-index: 30;
|
|
93
84
|
justify-content: end;
|
|
94
85
|
display: flex;
|
|
95
86
|
position: fixed;
|
|
@@ -168,8 +159,6 @@ img {
|
|
|
168
159
|
}
|
|
169
160
|
.action-text[data-shown=true] > span {
|
|
170
161
|
cursor: pointer;
|
|
171
|
-
-webkit-user-select: none;
|
|
172
|
-
user-select: none;
|
|
173
162
|
word-wrap: break-word;
|
|
174
163
|
word-break: break-word;
|
|
175
164
|
}
|
|
@@ -178,8 +167,6 @@ img {
|
|
|
178
167
|
}
|
|
179
168
|
.action-text,
|
|
180
169
|
.action-text > span {
|
|
181
|
-
-webkit-user-select: none;
|
|
182
|
-
user-select: none;
|
|
183
170
|
-webkit-tap-highlight-color: #0000;
|
|
184
171
|
-webkit-tap-highlight-color: transparent;
|
|
185
172
|
-webkit-touch-callout: none;
|
|
@@ -210,8 +197,6 @@ img {
|
|
|
210
197
|
.select__label {
|
|
211
198
|
background: var(--novely-select-label-background, #ffe9f3);
|
|
212
199
|
color: var(--novely-select-color, #000);
|
|
213
|
-
-webkit-user-select: none;
|
|
214
|
-
user-select: none;
|
|
215
200
|
border-radius: .25rem;
|
|
216
201
|
padding: .25rem .5rem;
|
|
217
202
|
font-size: 1.02rem;
|
|
@@ -224,8 +209,6 @@ img {
|
|
|
224
209
|
z-index: 22;
|
|
225
210
|
text-align: left;
|
|
226
211
|
cursor: default;
|
|
227
|
-
-webkit-user-select: none;
|
|
228
|
-
user-select: none;
|
|
229
212
|
flex-direction: column;
|
|
230
213
|
justify-content: flex-end;
|
|
231
214
|
width: 75%;
|
|
@@ -277,6 +260,8 @@ img {
|
|
|
277
260
|
box-shadow: 1px 1px 3px #00000042;
|
|
278
261
|
}
|
|
279
262
|
.action-dialog-content {
|
|
263
|
+
word-wrap: break-word;
|
|
264
|
+
word-break: break-word;
|
|
280
265
|
text-shadow:
|
|
281
266
|
1px 1px #000,
|
|
282
267
|
-1px -1px #000,
|
|
@@ -324,13 +309,23 @@ img {
|
|
|
324
309
|
|
|
325
310
|
/* src/styles/dialog/dialog.css */
|
|
326
311
|
.dialog {
|
|
327
|
-
z-index:
|
|
312
|
+
z-index: 25;
|
|
328
313
|
position: absolute;
|
|
329
314
|
top: 0;
|
|
330
315
|
bottom: 0;
|
|
331
316
|
left: 0;
|
|
332
317
|
right: 0;
|
|
333
318
|
}
|
|
319
|
+
.dialog-backdrop {
|
|
320
|
+
z-index: 23;
|
|
321
|
+
pointer-events: none;
|
|
322
|
+
background-color: var(--novely-dialog-backdrop-background-color, #1616166c);
|
|
323
|
+
position: fixed;
|
|
324
|
+
top: 0;
|
|
325
|
+
bottom: 0;
|
|
326
|
+
left: 0;
|
|
327
|
+
right: 0;
|
|
328
|
+
}
|
|
334
329
|
.dialog-container {
|
|
335
330
|
justify-content: center;
|
|
336
331
|
align-items: center;
|
|
@@ -344,7 +339,7 @@ img {
|
|
|
344
339
|
}
|
|
345
340
|
.dialog-panel {
|
|
346
341
|
text-align: left;
|
|
347
|
-
z-index:
|
|
342
|
+
z-index: 24;
|
|
348
343
|
flex-direction: column;
|
|
349
344
|
align-items: stretch;
|
|
350
345
|
min-width: 50vw;
|
|
@@ -355,8 +350,6 @@ img {
|
|
|
355
350
|
display: flex;
|
|
356
351
|
}
|
|
357
352
|
.dialog-panel-label {
|
|
358
|
-
-webkit-user-select: none;
|
|
359
|
-
user-select: none;
|
|
360
353
|
border-radius: .25rem;
|
|
361
354
|
padding: .25rem .5rem;
|
|
362
355
|
font-size: 1.2375rem;
|
|
@@ -384,8 +377,6 @@ img {
|
|
|
384
377
|
}
|
|
385
378
|
.input-dialog-label > span {
|
|
386
379
|
min-height: 1rem;
|
|
387
|
-
-webkit-user-select: none;
|
|
388
|
-
user-select: none;
|
|
389
380
|
-webkit-tap-highlight-color: #0000;
|
|
390
381
|
-webkit-tap-highlight-color: transparent;
|
|
391
382
|
-webkit-touch-callout: none;
|
|
@@ -398,10 +389,10 @@ img {
|
|
|
398
389
|
}
|
|
399
390
|
.input-dialog-panel {
|
|
400
391
|
color: #fff;
|
|
401
|
-
background-
|
|
402
|
-
background-
|
|
403
|
-
background-position: 0 0, 50px 50px;
|
|
404
|
-
background-size: 100px 100px;
|
|
392
|
+
background-image: var(--novely-dialog-background-image, radial-gradient(#d6608998 20%, transparent 20%), radial-gradient(#d6608998 20%, transparent 20%));
|
|
393
|
+
background-color: var(--novely-dialog-background-color, #f092b4d8);
|
|
394
|
+
background-position: var(--novely-dialog-background-position, 0 0, 50px 50px);
|
|
395
|
+
background-size: var(--novely-dialog-background-size, 100px 100px);
|
|
405
396
|
border: 3px solid #fff;
|
|
406
397
|
border-radius: 14px;
|
|
407
398
|
justify-content: center;
|
|
@@ -418,6 +409,26 @@ img {
|
|
|
418
409
|
|
|
419
410
|
/* src/styles/input-dialog/index.css */
|
|
420
411
|
|
|
412
|
+
/* src/styles/exit-dialog/exit-dialog.css */
|
|
413
|
+
.exit-dialog-panel {
|
|
414
|
+
color: #fff;
|
|
415
|
+
background-image: var(--novely-dialog-background-image, radial-gradient(#d6608998 20%, transparent 20%), radial-gradient(#d6608998 20%, transparent 20%));
|
|
416
|
+
background-color: var(--novely-dialog-background-color, #f092b4d8);
|
|
417
|
+
background-position: var(--novely-dialog-background-position, 0 0, 50px 50px);
|
|
418
|
+
background-size: var(--novely-dialog-background-size, 100px 100px);
|
|
419
|
+
border: 3px solid #fff;
|
|
420
|
+
border-radius: 14px;
|
|
421
|
+
justify-content: center;
|
|
422
|
+
align-items: center;
|
|
423
|
+
box-shadow: 1px 1px 4px #00000072;
|
|
424
|
+
}
|
|
425
|
+
.exit-dialog-panel-buttons {
|
|
426
|
+
gap: .5rem;
|
|
427
|
+
display: flex;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/* src/styles/exit-dialog/index.css */
|
|
431
|
+
|
|
421
432
|
/* src/styles/main-menu/main-menu.css */
|
|
422
433
|
.main-menu {
|
|
423
434
|
background-image: var(--novely-main-menu-background-image);
|
|
@@ -622,8 +633,6 @@ img {
|
|
|
622
633
|
scrollbar-color: var(--novely-scrollbar-thumb-hover-bg-color, #ffc6d8);
|
|
623
634
|
}
|
|
624
635
|
.saves__list--empty {
|
|
625
|
-
-webkit-user-select: none;
|
|
626
|
-
user-select: none;
|
|
627
636
|
color: var(--novely-saves-list-empty-color, black);
|
|
628
637
|
align-items: center;
|
|
629
638
|
display: flex;
|