@valerius_petrini/corekit-ui 0.1.24 → 0.1.26
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.
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
const action = actions[i];
|
|
14
14
|
switch (action.type) {
|
|
15
15
|
case "write":
|
|
16
|
-
const segment = { text: "", color:
|
|
16
|
+
const segment = { text: "", color: "", label: action.label };
|
|
17
17
|
displaySegments.push(segment);
|
|
18
18
|
|
|
19
19
|
const segmentProxy = displaySegments[displaySegments.length - 1];
|
|
20
20
|
|
|
21
21
|
const resolvedValue = typeof action.value === "function" ? action.value() : action.value;
|
|
22
|
+
const resolvedColor = typeof action.color === "function" ? action.color() : action.color;
|
|
23
|
+
segmentProxy.color = resolvedColor;
|
|
22
24
|
for (const char of resolvedValue) {
|
|
23
25
|
segmentProxy.text += char;
|
|
24
26
|
const speed = Math.random() * ((action.maxspeed || 100) - (action.minspeed || 50)) + (action.minspeed || 50);
|
|
@@ -28,11 +30,13 @@
|
|
|
28
30
|
case "delete":
|
|
29
31
|
const index = displaySegments.findIndex(s => s.label === action.to);
|
|
30
32
|
if (index === -1) break;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
deleteSegment.text
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
for (let j = displaySegments.length - 1; j >= index; j--) {
|
|
34
|
+
const deleteSegment = displaySegments[j];
|
|
35
|
+
while (deleteSegment.text.length > 0) {
|
|
36
|
+
deleteSegment.text = deleteSegment.text.slice(0, -1);
|
|
37
|
+
const speed = Math.random() * ((action.maxspeed || 100) - (action.minspeed || 50)) + (action.minspeed || 50);
|
|
38
|
+
await new Promise(resolve => setTimeout(resolve, speed));
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
displaySegments.splice(index, 1);
|
|
38
42
|
break;
|