@novely/solid-renderer 0.4.1 → 0.4.2
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 +25 -10
- package/dist/styles/index.css +7 -28
- 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)}
|
|
@@ -502,11 +515,13 @@ var Game = (props) => {
|
|
|
502
515
|
aria-disabled={!props.state.text.content}
|
|
503
516
|
role="button"
|
|
504
517
|
tabIndex={0}
|
|
505
|
-
title={TextWriter.state() === "idle" ? void 0 : data.t(TextWriter.state() === "processing" ? "CompleteText" : "GoForward")}
|
|
506
518
|
onClick={TextWriter.clear}
|
|
507
519
|
onKeyPress={onKey(TextWriter.clear, "Enter")}
|
|
508
520
|
onKeyDown={onKey(TextWriter.clear, " ")}
|
|
509
521
|
><TextWriter.Typewriter
|
|
522
|
+
attributes={{
|
|
523
|
+
title: TextWriter.state() === "idle" ? void 0 : data.t(TextWriter.state() === "processing" ? "CompleteText" : "GoForward")
|
|
524
|
+
}}
|
|
510
525
|
content={props.state.text.content}
|
|
511
526
|
speed={speed()}
|
|
512
527
|
ended={onWriterEnd(TextWriter.clear)}
|
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;
|
|
@@ -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,
|
|
@@ -355,8 +340,6 @@ img {
|
|
|
355
340
|
display: flex;
|
|
356
341
|
}
|
|
357
342
|
.dialog-panel-label {
|
|
358
|
-
-webkit-user-select: none;
|
|
359
|
-
user-select: none;
|
|
360
343
|
border-radius: .25rem;
|
|
361
344
|
padding: .25rem .5rem;
|
|
362
345
|
font-size: 1.2375rem;
|
|
@@ -384,8 +367,6 @@ img {
|
|
|
384
367
|
}
|
|
385
368
|
.input-dialog-label > span {
|
|
386
369
|
min-height: 1rem;
|
|
387
|
-
-webkit-user-select: none;
|
|
388
|
-
user-select: none;
|
|
389
370
|
-webkit-tap-highlight-color: #0000;
|
|
390
371
|
-webkit-tap-highlight-color: transparent;
|
|
391
372
|
-webkit-touch-callout: none;
|
|
@@ -622,8 +603,6 @@ img {
|
|
|
622
603
|
scrollbar-color: var(--novely-scrollbar-thumb-hover-bg-color, #ffc6d8);
|
|
623
604
|
}
|
|
624
605
|
.saves__list--empty {
|
|
625
|
-
-webkit-user-select: none;
|
|
626
|
-
user-select: none;
|
|
627
606
|
color: var(--novely-saves-list-empty-color, black);
|
|
628
607
|
align-items: center;
|
|
629
608
|
display: flex;
|