@kubohiroya/turbowarp-bubble 0.5.0 → 0.7.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/README.md +24 -1
- package/dist/composition.js +297 -245
- package/dist/extension-manifest.json +35 -0
- package/dist/reveal.js +77 -0
- package/dist/turbowarp-adapter.js +497 -399
- package/dist/turbowarp-bubble.js +233 -22
- package/dist/types/composition.d.ts +10 -0
- package/dist/types/portrait-layout.d.ts +14 -0
- package/docs/block-manual.ja.md +36 -31
- package/docs/block-manual.md +36 -31
- package/docs/index.html +11 -3
- package/docs/ja/index.html +11 -3
- package/package.json +28 -25
|
@@ -376,6 +376,37 @@
|
|
|
376
376
|
}
|
|
377
377
|
]
|
|
378
378
|
},
|
|
379
|
+
{
|
|
380
|
+
"opcode": "setPortraitLayout",
|
|
381
|
+
"blockType": "COMMAND",
|
|
382
|
+
"arguments": [
|
|
383
|
+
{
|
|
384
|
+
"id": "PLACEMENT",
|
|
385
|
+
"type": "STRING",
|
|
386
|
+
"menu": "portraitPlacement"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"id": "RADIUS",
|
|
390
|
+
"type": "NUMBER"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"id": "STYLE",
|
|
394
|
+
"type": "STRING"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"id": "X",
|
|
398
|
+
"type": "NUMBER"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"id": "Y",
|
|
402
|
+
"type": "NUMBER"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"id": "ZOOM",
|
|
406
|
+
"type": "NUMBER"
|
|
407
|
+
}
|
|
408
|
+
]
|
|
409
|
+
},
|
|
379
410
|
{
|
|
380
411
|
"opcode": "shakeBubble",
|
|
381
412
|
"blockType": "COMMAND",
|
|
@@ -449,6 +480,10 @@
|
|
|
449
480
|
"id": "placement",
|
|
450
481
|
"acceptReporters": true
|
|
451
482
|
},
|
|
483
|
+
{
|
|
484
|
+
"id": "portraitPlacement",
|
|
485
|
+
"acceptReporters": true
|
|
486
|
+
},
|
|
452
487
|
{
|
|
453
488
|
"id": "revealLayout",
|
|
454
489
|
"acceptReporters": true
|
package/dist/reveal.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region src/reveal.ts
|
|
2
|
+
var e = Object.freeze([
|
|
3
|
+
"CHARACTER",
|
|
4
|
+
"WORD",
|
|
5
|
+
"LINE",
|
|
6
|
+
"BLOCK"
|
|
7
|
+
]);
|
|
8
|
+
function t(e) {
|
|
9
|
+
let t = globalThis.Intl?.Segmenter;
|
|
10
|
+
return typeof t == "function" ? [...new t(void 0, { granularity: "grapheme" }).segment(e)].map(({ segment: e }) => e) : Array.from(e);
|
|
11
|
+
}
|
|
12
|
+
function n(t) {
|
|
13
|
+
if (typeof t != "string" || !e.includes(t)) throw TypeError("Bubble reveal unit must be CHARACTER, WORD, LINE, or BLOCK.");
|
|
14
|
+
return t;
|
|
15
|
+
}
|
|
16
|
+
function r(e) {
|
|
17
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("Bubble reveal must be an object.");
|
|
18
|
+
let t = e, r = /* @__PURE__ */ new Set([
|
|
19
|
+
"unit",
|
|
20
|
+
"delimiters",
|
|
21
|
+
"showDelimiters",
|
|
22
|
+
"layout",
|
|
23
|
+
"intervalSeconds",
|
|
24
|
+
"sound"
|
|
25
|
+
]);
|
|
26
|
+
if (Object.keys(t).filter((e) => !r.has(e)).length > 0 || t.unit === void 0) throw TypeError("Bubble reveal has unknown or missing properties.");
|
|
27
|
+
let i = n(t.unit), a = t.delimiters ?? " \r\n";
|
|
28
|
+
if (typeof a != "string" || a.length === 0) throw TypeError("Bubble WORD delimiters must be a non-empty string.");
|
|
29
|
+
let o = t.showDelimiters ?? !1;
|
|
30
|
+
if (typeof o != "boolean") throw TypeError("Bubble reveal showDelimiters must be boolean.");
|
|
31
|
+
let s = t.layout ?? "DYNAMIC";
|
|
32
|
+
if (s !== "DYNAMIC" && s !== "RESERVED") throw TypeError("Bubble reveal layout must be DYNAMIC or RESERVED.");
|
|
33
|
+
let c = t.intervalSeconds ?? 0;
|
|
34
|
+
if (typeof c != "number" || !Number.isFinite(c) || c < 0) throw TypeError("Bubble reveal intervalSeconds must be zero or greater.");
|
|
35
|
+
let l = t.sound;
|
|
36
|
+
if (l !== void 0 && (typeof l != "string" || l.length === 0)) throw TypeError("Bubble reveal sound must be a non-empty asset name.");
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
unit: i,
|
|
39
|
+
delimiters: a,
|
|
40
|
+
showDelimiters: o,
|
|
41
|
+
layout: s,
|
|
42
|
+
intervalSeconds: c,
|
|
43
|
+
...l === void 0 ? {} : { sound: l }
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function i(e, n, r) {
|
|
47
|
+
let i = new Set(Array.from(n)), a = [], o = "";
|
|
48
|
+
for (let n of t(e)) o += n, i.has(n) && ((r || o.slice(0, -n.length).length > 0) && a.push(r ? o : o.slice(0, -n.length)), o = "");
|
|
49
|
+
return o.length > 0 && a.push(o), a.filter((e) => e.length > 0);
|
|
50
|
+
}
|
|
51
|
+
function a(e, n) {
|
|
52
|
+
if (e.length === 0) return Object.freeze([""]);
|
|
53
|
+
if (n.unit === "CHARACTER") return Object.freeze(t(e));
|
|
54
|
+
if (n.unit === "WORD") {
|
|
55
|
+
let t = i(e, n.delimiters, n.showDelimiters);
|
|
56
|
+
if (n.showDelimiters) return Object.freeze(t);
|
|
57
|
+
let r = [], a = 0;
|
|
58
|
+
for (let i of t) {
|
|
59
|
+
let t = e.indexOf(i, a);
|
|
60
|
+
if (t < 0) r.push(i);
|
|
61
|
+
else for (r.push(i), a = t + i.length; a < e.length && n.delimiters.includes(e[a] ?? "");) a += 1;
|
|
62
|
+
}
|
|
63
|
+
return Object.freeze(r);
|
|
64
|
+
}
|
|
65
|
+
let r = n.unit === "LINE" ? /(?<=\n)/u : /\n{2,}/u, a = e.split(r).filter((e) => e.length > 0);
|
|
66
|
+
if (n.unit === "BLOCK") {
|
|
67
|
+
let t = [...e.matchAll(/\n{2,}/gu)].map(([e]) => e), n = a.map((e, n) => n < t.length ? `${e}${t[n] ?? ""}` : e);
|
|
68
|
+
return Object.freeze(n.length > 0 ? n : [e]);
|
|
69
|
+
}
|
|
70
|
+
let o = a;
|
|
71
|
+
return Object.freeze(o.length > 0 ? o : [e]);
|
|
72
|
+
}
|
|
73
|
+
function o(e, t) {
|
|
74
|
+
return e.slice(0, Math.max(0, Math.min(t, e.length))).join("");
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { e as bubbleRevealUnits, r as normalizeBubbleReveal, o as revealedBubbleText, a as splitBubbleText };
|