@kubohiroya/turbowarp-bubble 0.5.0 → 0.6.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 +13 -1
- package/dist/reveal.js +77 -0
- package/dist/turbowarp-bubble.js +1 -1
- package/docs/block-manual.ja.md +1 -1
- package/docs/block-manual.md +1 -1
- package/docs/index.html +2 -2
- package/docs/ja/index.html +2 -2
- package/package.json +28 -25
package/README.md
CHANGED
|
@@ -206,6 +206,18 @@ npmを使う場合は同じ依存を次のように追加します。
|
|
|
206
206
|
npm install @kubohiroya/turbowarp-bubble
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
+
逐次表示の正規化と文字列分割だけが必要な利用側は、Bubble composition全体を含めずに小さな`reveal` entryをimportできます。
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
import {
|
|
213
|
+
normalizeBubbleReveal,
|
|
214
|
+
splitBubbleText,
|
|
215
|
+
} from "@kubohiroya/turbowarp-bubble/reveal";
|
|
216
|
+
|
|
217
|
+
const reveal = normalizeBubbleReveal({ unit: "CHARACTER" });
|
|
218
|
+
const chunks = splitBubbleText("A👩🚀B", reveal);
|
|
219
|
+
```
|
|
220
|
+
|
|
209
221
|
現在のpeer dependency範囲は、SVG Textが`>=0.4.0 <1`、Asset Managerが`>=0.7.0 <1`、Async InputとRuntime Expressionがそれぞれ`>=0.3.0 <1`です。4つすべてoptional peer dependencyで、SVG TextはTurboWarp adapterの既定adapterを使う場合だけ必要です。別の`textCapability`を注入するhostはSVG Textをインストールする必要がありません。
|
|
210
222
|
|
|
211
223
|
TurboWarp adapterの既定文字経路を使う場合は、SVG Textを追加します。
|
|
@@ -257,7 +269,7 @@ https://unpkg.com/@kubohiroya/turbowarp-async-input@0.3.0/dist/async-input.js
|
|
|
257
269
|
https://unpkg.com/@kubohiroya/turbowarp-runtime-expression@0.3.0/dist/runtime-expression.js
|
|
258
270
|
|
|
259
271
|
# Bubble(必ず最後)
|
|
260
|
-
https://unpkg.com/@kubohiroya/turbowarp-bubble@0.
|
|
272
|
+
https://unpkg.com/@kubohiroya/turbowarp-bubble@0.6.0/dist/turbowarp-bubble.js
|
|
261
273
|
```
|
|
262
274
|
|
|
263
275
|
TurboWarpのカスタム拡張機能はURLからJavaScriptを読み込むため、初回読み込み時にネットワーク接続が必要です。開発中は、リポジトリをローカルHTTPサーバーで配信して`dist/turbowarp-bubble.js`を指定できます。`file://`で直接開いたファイルや、サンドボックス付きの拡張機能としては動作しません。
|
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 };
|
package/dist/turbowarp-bubble.js
CHANGED
|
@@ -9947,7 +9947,7 @@
|
|
|
9947
9947
|
"easeInOut"
|
|
9948
9948
|
]);
|
|
9949
9949
|
var EXTENSION_DOCS_URI = "https://kubohiroya.github.io/turbowarp-bubble/";
|
|
9950
|
-
var EXTENSION_VERSION = "0.
|
|
9950
|
+
var EXTENSION_VERSION = "0.6.0";
|
|
9951
9951
|
var BLOCK_ICON_URI = `data:image/svg+xml,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><path fill=\"none\" stroke=\"#fff\" stroke-width=\"5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 13h40a5 5 0 0 1 5 5v23a5 5 0 0 1-5 5H30L17 55v-9h-5a5 5 0 0 1-5-5V18a5 5 0 0 1 5-5Z\"/><g fill=\"#fff\"><circle cx=\"23\" cy=\"30\" r=\"3\"/><circle cx=\"32\" cy=\"30\" r=\"3\"/><circle cx=\"41\" cy=\"30\" r=\"3\"/></g></svg>")}`;
|
|
9952
9952
|
function extensionError(message) {
|
|
9953
9953
|
const error = /* @__PURE__ */ new Error(`[Bubble] ${message}`);
|
package/docs/block-manual.ja.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
| 3 | Runtime Expression 0.3.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-runtime-expression@0.3.0/dist/runtime-expression.js` |
|
|
16
16
|
| 4 | Asset Manager 0.7.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-manager@0.7.0/dist/asset-manager.js` |
|
|
17
17
|
| 5 | SVG Text 0.4.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-svg-text@0.4.0/dist/svg-text.js` |
|
|
18
|
-
| 6 | Bubble 0.
|
|
18
|
+
| 6 | Bubble 0.6.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-bubble@0.6.0/dist/turbowarp-bubble.js` |
|
|
19
19
|
|
|
20
20
|
開発中のBubbleを試す場合は、このリポジトリの`dist/turbowarp-bubble.js`をローカルカスタム拡張機能として読み込みます。表示時に既定のSVG Text adapterが、画像・メディア機能の使用時にAsset Managerが、待機開始時にAsync InputかRuntime Expressionが見つからなければ、Bubbleは明示的なエラーを返します。低レベルComposition APIでは別のtext capabilityを注入でき、その場合SVG Textは不要です。
|
|
21
21
|
|
package/docs/block-manual.md
CHANGED
|
@@ -15,7 +15,7 @@ The complete input-wait example uses six extensions. Add Temporary Variables fro
|
|
|
15
15
|
| 3 | Runtime Expression 0.3.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-runtime-expression@0.3.0/dist/runtime-expression.js` |
|
|
16
16
|
| 4 | Asset Manager 0.7.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-asset-manager@0.7.0/dist/asset-manager.js` |
|
|
17
17
|
| 5 | SVG Text 0.4.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-svg-text@0.4.0/dist/svg-text.js` |
|
|
18
|
-
| 6 | Bubble 0.
|
|
18
|
+
| 6 | Bubble 0.6.0 | `https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-bubble@0.6.0/dist/turbowarp-bubble.js` |
|
|
19
19
|
|
|
20
20
|
To try a development build, load this repository's `dist/turbowarp-bubble.js` as a local custom extension. Bubble reports an explicit error if the default SVG Text adapter is missing when it displays a Bubble, if an image/media feature is used without Asset Manager, or if Async Input or Runtime Expression is missing when it starts a Bubble wait. The lower-level Composition API can use another text capability and does not require SVG Text.
|
|
21
21
|
|
package/docs/index.html
CHANGED
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
</tr>
|
|
108
108
|
<tr>
|
|
109
109
|
<td align="right">6</td>
|
|
110
|
-
<td>Bubble 0.
|
|
111
|
-
<td><code>https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-bubble@0.
|
|
110
|
+
<td>Bubble 0.6.0</td>
|
|
111
|
+
<td><code>https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-bubble@0.6.0/dist/turbowarp-bubble.js</code></td>
|
|
112
112
|
</tr>
|
|
113
113
|
</tbody></table>
|
|
114
114
|
<p>To try a development build, load this repository's <code>dist/turbowarp-bubble.js</code> as a local custom extension. Bubble reports an explicit error if the default SVG Text adapter is missing when it displays a Bubble, if an image/media feature is used without Asset Manager, or if Async Input or Runtime Expression is missing when it starts a Bubble wait. The lower-level Composition API can use another text capability and does not require SVG Text.</p>
|
package/docs/ja/index.html
CHANGED
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
</tr>
|
|
108
108
|
<tr>
|
|
109
109
|
<td align="right">6</td>
|
|
110
|
-
<td>Bubble 0.
|
|
111
|
-
<td><code>https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-bubble@0.
|
|
110
|
+
<td>Bubble 0.6.0</td>
|
|
111
|
+
<td><code>https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-bubble@0.6.0/dist/turbowarp-bubble.js</code></td>
|
|
112
112
|
</tr>
|
|
113
113
|
</tbody></table>
|
|
114
114
|
<p>開発中のBubbleを試す場合は、このリポジトリの<code>dist/turbowarp-bubble.js</code>をローカルカスタム拡張機能として読み込みます。表示時に既定のSVG Text adapterが、画像・メディア機能の使用時にAsset Managerが、待機開始時にAsync InputかRuntime Expressionが見つからなければ、Bubbleは明示的なエラーを返します。低レベルComposition APIでは別のtext capabilityを注入でき、その場合SVG Textは不要です。</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-bubble",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Composable say and think bubbles with portrait layers and animated continue indicators for TurboWarp.",
|
|
5
5
|
"author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"types": "./dist/types/composition.d.ts",
|
|
23
23
|
"import": "./dist/composition.js"
|
|
24
24
|
},
|
|
25
|
+
"./reveal": {
|
|
26
|
+
"types": "./dist/types/reveal.d.ts",
|
|
27
|
+
"import": "./dist/reveal.js"
|
|
28
|
+
},
|
|
25
29
|
"./turbowarp-adapter": {
|
|
26
30
|
"types": "./dist/types/turbowarp-adapter.d.ts",
|
|
27
31
|
"import": "./dist/turbowarp-adapter.js"
|
|
@@ -43,29 +47,6 @@
|
|
|
43
47
|
"access": "public",
|
|
44
48
|
"registry": "https://registry.npmjs.org/"
|
|
45
49
|
},
|
|
46
|
-
"packageManager": "pnpm@11.18.0",
|
|
47
|
-
"scripts": {
|
|
48
|
-
"typecheck": "tsc --noEmit",
|
|
49
|
-
"build": "pnpm build:extension && pnpm build:composition && pnpm build:turbowarp-adapter && pnpm build:types",
|
|
50
|
-
"build:extension": "vite build",
|
|
51
|
-
"build:composition": "vite build --config vite.composition.config.ts",
|
|
52
|
-
"build:turbowarp-adapter": "vite build --config vite.turbowarp-adapter.config.ts",
|
|
53
|
-
"build:types": "tsc --project tsconfig.build.json",
|
|
54
|
-
"types:composition:check": "tsc --project tsconfig.composition-consumer.json",
|
|
55
|
-
"lint": "eslint src tests scripts vite.config.ts vite.composition.config.ts vite.turbowarp-adapter.config.ts eslint.config.mjs",
|
|
56
|
-
"format": "prettier --check .",
|
|
57
|
-
"format:write": "prettier --write .",
|
|
58
|
-
"docs:render": "node scripts/render-block-manual-assets.mjs && pnpm docs:pages",
|
|
59
|
-
"docs:pages": "node scripts/render-pages.mjs",
|
|
60
|
-
"docs:pages:check": "node scripts/render-pages.mjs --check",
|
|
61
|
-
"docs:check": "node scripts/check-block-manual.mjs && pnpm docs:pages:check",
|
|
62
|
-
"test": "vitest run",
|
|
63
|
-
"check:dist": "pnpm build && node scripts/check-dist.mjs",
|
|
64
|
-
"pack:check": "npm pack --dry-run --ignore-scripts",
|
|
65
|
-
"release:check": "pnpm publish --dry-run --access public",
|
|
66
|
-
"check": "pnpm typecheck && pnpm lint && pnpm format && pnpm test && pnpm docs:check && pnpm check:dist && pnpm types:composition:check && pnpm pack:check",
|
|
67
|
-
"prepack": "pnpm check"
|
|
68
|
-
},
|
|
69
50
|
"peerDependencies": {
|
|
70
51
|
"@kubohiroya/turbowarp-asset-manager": ">=0.7.0 <1",
|
|
71
52
|
"@kubohiroya/turbowarp-async-input": ">=0.3.0 <1",
|
|
@@ -116,5 +97,27 @@
|
|
|
116
97
|
],
|
|
117
98
|
"dependencies": {
|
|
118
99
|
"@cto.af/linebreak": "4.0.3"
|
|
100
|
+
},
|
|
101
|
+
"scripts": {
|
|
102
|
+
"typecheck": "tsc --noEmit",
|
|
103
|
+
"build": "pnpm build:extension && pnpm build:composition && pnpm build:reveal && pnpm build:turbowarp-adapter && pnpm build:types",
|
|
104
|
+
"build:extension": "vite build",
|
|
105
|
+
"build:composition": "vite build --config vite.composition.config.ts",
|
|
106
|
+
"build:reveal": "vite build --config vite.reveal.config.ts",
|
|
107
|
+
"build:turbowarp-adapter": "vite build --config vite.turbowarp-adapter.config.ts",
|
|
108
|
+
"build:types": "tsc --project tsconfig.build.json",
|
|
109
|
+
"types:composition:check": "tsc --project tsconfig.composition-consumer.json",
|
|
110
|
+
"lint": "eslint src tests scripts vite.config.ts vite.composition.config.ts vite.reveal.config.ts vite.turbowarp-adapter.config.ts eslint.config.mjs",
|
|
111
|
+
"format": "prettier --check .",
|
|
112
|
+
"format:write": "prettier --write .",
|
|
113
|
+
"docs:render": "node scripts/render-block-manual-assets.mjs && pnpm docs:pages",
|
|
114
|
+
"docs:pages": "node scripts/render-pages.mjs",
|
|
115
|
+
"docs:pages:check": "node scripts/render-pages.mjs --check",
|
|
116
|
+
"docs:check": "node scripts/check-block-manual.mjs && pnpm docs:pages:check",
|
|
117
|
+
"test": "vitest run",
|
|
118
|
+
"check:dist": "pnpm build && node scripts/check-dist.mjs",
|
|
119
|
+
"pack:check": "npm pack --dry-run --ignore-scripts",
|
|
120
|
+
"release:check": "pnpm publish --dry-run --access public",
|
|
121
|
+
"check": "pnpm typecheck && pnpm lint && pnpm format && pnpm test && pnpm docs:check && pnpm check:dist && pnpm types:composition:check && pnpm pack:check"
|
|
119
122
|
}
|
|
120
|
-
}
|
|
123
|
+
}
|