@kubohiroya/turbowarp-bubble 0.1.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/LICENSE +8 -0
- package/README.md +293 -0
- package/THIRD_PARTY_NOTICES.md +123 -0
- package/dist/composition.js +4317 -0
- package/dist/extension-manifest.json +245 -0
- package/dist/turbowarp-adapter.js +3977 -0
- package/dist/turbowarp-bubble.js +7887 -0
- package/dist/types/actor-transform.d.ts +36 -0
- package/dist/types/bubble-svg.d.ts +36 -0
- package/dist/types/composition.d.ts +121 -0
- package/dist/types/placement.d.ts +24 -0
- package/dist/types/text-layout.d.ts +42 -0
- package/dist/types/turbowarp-adapter.d.ts +69 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/actor-transform-guide.svg +68 -0
- package/docs/assets/animation-mode-guide.svg +126 -0
- package/docs/assets/block-quick-start.svg +230 -0
- package/docs/assets/bubble-lifecycle.gif +0 -0
- package/docs/assets/bubble-style-gallery.svg +138 -0
- package/docs/assets/placement-guide.svg +292 -0
- package/docs/assets/width-linebreak-guide.svg +99 -0
- package/docs/block-manual.ja.md +292 -0
- package/docs/block-manual.md +292 -0
- package/docs/index.html +486 -0
- package/docs/ja/index.html +486 -0
- package/package.json +104 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Mozilla Public License Version 2.0
|
|
2
|
+
|
|
3
|
+
This Source Code Form is subject to the terms of the Mozilla Public License,
|
|
4
|
+
v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
|
5
|
+
obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
|
|
7
|
+
The corresponding Source Code Form is available at:
|
|
8
|
+
https://github.com/kubohiroya/turbowarp-bubble
|
package/README.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# TurboWarp Bubble
|
|
2
|
+
|
|
3
|
+
`@kubohiroya/turbowarp-bubble`は、TurboWarp上の`say`/`think`表示を、文字、キャラクター表情、入力待ちアイコンに分けて管理するunsandboxed機能拡張です。同じ機能をアプリから直接利用するためのcomposition APIも提供します。紙芝居固有のDSLやシーン遷移には依存しません。
|
|
4
|
+
|
|
5
|
+
## パッケージ境界
|
|
6
|
+
|
|
7
|
+
| パッケージ | 責務 |
|
|
8
|
+
| ------------------------------------------ | ------------------------------------------------------------------------- |
|
|
9
|
+
| `@kubohiroya/turbowarp-asset-manager` | アセット名の登録、画像種別の検証、画像targetへの適用 |
|
|
10
|
+
| `@kubohiroya/turbowarp-svg-text` | 名前付き文字styleと、文字列からSVGスキンへの変換 |
|
|
11
|
+
| `@kubohiroya/turbowarp-async-input` | キー入力・タップをTemporary Variablesのruntime変数へ反映 |
|
|
12
|
+
| `@kubohiroya/turbowarp-runtime-expression` | runtime変数を参照する安全な待機条件の評価 |
|
|
13
|
+
| `@kubohiroya/turbowarp-bubble` | 吹き出しsurface、配置、say/think、表情レイヤー、animation mode、入力待機 |
|
|
14
|
+
| アプリ/host | 必要に応じたDSLからcomposition APIへの変換 |
|
|
15
|
+
|
|
16
|
+
Bubbleは依存パッケージを再exportしません。このため、Asset ManagerとSVG文字ActorはBubbleを使わない画面でも従来どおり単独で利用できます。
|
|
17
|
+
|
|
18
|
+
## 自動改行と禁則処理の基盤
|
|
19
|
+
|
|
20
|
+
Bubbleの任意`maxWidth`による自動改行では、`@cto.af/linebreak`を利用してUnicode UAX #14準拠の改行可能位置を求めます。依存は`LineBreakProvider` interfaceの内側へ閉じ込め、実際のフォントで測った幅から、上限内に収まる最も後ろの候補をBubble側で選びます。
|
|
21
|
+
|
|
22
|
+
`UnicodeLineBreakProvider`はUAX #14の候補を`Intl.Segmenter`の書記素境界で絞るため、句読点や小書き仮名の禁則に加え、結合文字や絵文字の途中分割も避けます。明示改行は維持し、URLなど分割可能な候補がない文字列だけを書記素境界でfallback分割します。
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { wrapText } from "@kubohiroya/turbowarp-bubble/composition";
|
|
26
|
+
|
|
27
|
+
const layout = wrapText({
|
|
28
|
+
text: "これは長いセリフです。",
|
|
29
|
+
maxWidth: 320,
|
|
30
|
+
measureText: (text) => textRenderer.measure(text),
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
この基盤は改行位置と行幅を返します。Bubble surfaceへ`maxWidth`を渡し、SVG Textの実測値と吹き出し形状へ接続する処理は、後続の表示統合で追加します。
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
図の各行はproductionの`wrapText`を直接呼んだ結果です。図版専用の手作業改行は使っていません。
|
|
39
|
+
|
|
40
|
+
## Bubble visual styleの形状
|
|
41
|
+
|
|
42
|
+
形状候補は`NORMAL`、`THINKING`、`DREAMING`、`YELLING`、`OFF_PANEL`、`WAVY`、`WHISPERING`、`ANNOUNCEMENT`、`NARRATION`、`NO_BUBBLE`です。
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
この図はBubble側の共有`renderBubbleSvg`から生成しています。三角形tailを持つ形状は、tail基部の2点を実際の本体border上から求め、[platener/jsclipper](https://github.com/platener/jsclipper)で本体polygonとtail三角形の和集合を作り、単一の外周pathだけを描画します。`THINKING`/`DREAMING`の丸trailは独立形状のままです。
|
|
47
|
+
|
|
48
|
+
standalone機能拡張では、`set bubble visual style`ブロックで形状を選択できます。runtimeは共有`renderBubbleSvg`から本体用SVG skinを生成し、文字・表情より背面の専用drawableへ適用します。Actor相対ではActorを向くtailを生成し、背景相対ではtailを付けません。`NO_BUBBLE`では本体を非表示にして文字・表情などだけを表示します。`NEGATIVE`はfill colorとborder colorで表現できるため独立styleにせず、orientationとsegmentsも公開入力にしません。
|
|
49
|
+
|
|
50
|
+
配布bundleに含まれる依存ライブラリのライセンスは、[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)を参照してください。
|
|
51
|
+
|
|
52
|
+
## ライセンスとソースコード
|
|
53
|
+
|
|
54
|
+
このパッケージのSource Code Formは[MPL-2.0](https://www.mozilla.org/MPL/2.0/)の条件で提供します。対応するソースコードは[GitHubリポジトリ](https://github.com/kubohiroya/turbowarp-bubble)から取得できます。npmおよびCDNで配布するJavaScript bundleに対応するソースコードも、このリポジトリの同じpackage versionから参照できます。
|
|
55
|
+
|
|
56
|
+
配布物に組み込まれる第三者ソフトウェアの著作権表示とライセンス条件は、[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)にまとめています。
|
|
57
|
+
|
|
58
|
+
## インストール
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pnpm add @kubohiroya/turbowarp-bubble \
|
|
62
|
+
@kubohiroya/turbowarp-asset-manager \
|
|
63
|
+
@kubohiroya/turbowarp-svg-text \
|
|
64
|
+
@kubohiroya/turbowarp-async-input \
|
|
65
|
+
@kubohiroya/turbowarp-runtime-expression
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
現在のpeer dependency範囲は、Asset Manager `>=0.7.0 <1`、SVG Text、Async Input、Runtime Expressionがそれぞれ`>=0.3.0 <1`です。
|
|
69
|
+
|
|
70
|
+
## TurboWarp機能拡張
|
|
71
|
+
|
|
72
|
+
ブロックの組み方、表情差分の準備、入力待ち、clone、エラー対処を含む手順は、ブロック利用マニュアル([English](https://kubohiroya.github.io/turbowarp-bubble/) / [日本語](https://kubohiroya.github.io/turbowarp-bubble/ja/))を参照してください。`talking`から`awaiting-advance`、入力成立、`close`までのアニメーション例も掲載しています。
|
|
73
|
+
|
|
74
|
+
TurboWarpの拡張機能ライブラリからTemporary Variablesを追加し、「カスタム拡張機能」から次の5本をサンドボックスなしで読み込みます。Async InputとRuntime ExpressionはBubble待機より前に、Asset ManagerとSVG Textは最初のBubble表示より前にロードします。
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
https://unpkg.com/@kubohiroya/turbowarp-asset-manager/dist/asset-manager.js
|
|
78
|
+
https://unpkg.com/@kubohiroya/turbowarp-svg-text/dist/svg-text.js
|
|
79
|
+
https://unpkg.com/@kubohiroya/turbowarp-async-input/dist/async-input.js
|
|
80
|
+
https://unpkg.com/@kubohiroya/turbowarp-runtime-expression/dist/runtime-expression.js
|
|
81
|
+
https://unpkg.com/@kubohiroya/turbowarp-bubble/dist/turbowarp-bubble.js
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Bubbleは呼び出し元のsprite、clone、またはStageごとに表示を所有します。SVG本体、文字、表情ベース、目パチ、口パク、次へアイコンのrenderer drawableは自動生成されるため、レイヤー用spriteをプロジェクトへ追加する必要はありません。Stageから表示できるのは背景相対placementを使うstyleだけです。
|
|
85
|
+
|
|
86
|
+
### 提供ブロック
|
|
87
|
+
|
|
88
|
+
| ブロック | 動作 |
|
|
89
|
+
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
90
|
+
| `define bubble style [STYLE] using text style [TEXT_STYLE]` | Bubble styleを定義し、SVG Textで定義した文字style名を関連付ける |
|
|
91
|
+
| `set bubble placement [PLACEMENT] for bubble style [STYLE]` | Actor相対方向・角度、または背景相対領域を設定する |
|
|
92
|
+
| `set bubble distance [DISTANCE] for bubble style [STYLE]` | Actor boundsからtail先端までの距離を設定する |
|
|
93
|
+
| `set bubble visual style [VISUAL_STYLE] for bubble style [STYLE]` | Bubble本体のSVG形状を10種類から設定する |
|
|
94
|
+
| `set bubble tail length [LENGTH] for bubble style [STYLE]` | Bubble borderからtail先端までの基準長を設定する |
|
|
95
|
+
| `set bubble offset x [X] y [Y] scale [SCALE] % for bubble style [STYLE]` | 本体位置と、文字を含むBubble全体の拡大率を設定する |
|
|
96
|
+
| `set portrait base [ASSET] for bubble style [STYLE]` | 表情ベース画像を設定する。空文字でportrait全体を解除する |
|
|
97
|
+
| `set blink frames [ASSETS] every [SECONDS] seconds for bubble style [STYLE]` | 目パチ差分を設定する。空リストで解除する |
|
|
98
|
+
| `set talk frames [ASSETS] every [SECONDS] seconds for bubble style [STYLE]` | 口パク差分を設定する。空リストで解除する |
|
|
99
|
+
| `set advance frames [ASSETS] every [SECONDS] seconds for bubble style [STYLE]` | 入力待ちアイコンを設定する。2フレーム以上必要。空リストで解除する |
|
|
100
|
+
| `say [MESSAGE] with bubble style [STYLE]` | `talking` modeでsay表示を開始または置換する |
|
|
101
|
+
| `think [MESSAGE] with bubble style [STYLE]` | `talking` modeでthink表示を開始または置換する |
|
|
102
|
+
| `set this bubble animation mode [MODE]` | `talking`/`awaiting-advance`/`idle`を切り替える |
|
|
103
|
+
| `wait with this bubble until condition [CONDITION] or timeout after [TIMEOUT] seconds` | 条件成立またはtimeoutまでBubbleを表示したまま待つ |
|
|
104
|
+
| `close this bubble` | 呼び出し元のBubbleと所有resourceを解放する |
|
|
105
|
+
| `Bubble version` | 実装versionを返す |
|
|
106
|
+
|
|
107
|
+
`ASSETS`はAsset Managerへ登録済みの画像アセット名をカンマ区切りで指定します。アセット名自体にカンマは使用できません。すべての`SECONDS`は0より大きい秒数です。
|
|
108
|
+
|
|
109
|
+
visual styleを設定しない場合は`NORMAL`です。本体drawableは文字・表情より背面に生成され、close、対象停止、runtime破棄時にSVG skinとともに解放されます。
|
|
110
|
+
|
|
111
|
+
### Placement
|
|
112
|
+
|
|
113
|
+
`PLACEMENT`はActor相対と背景相対の二系統です。省略時は`up-right`です。
|
|
114
|
+
|
|
115
|
+
- Actor相対:16の正規方向名、そのcompass alias、またはScratch方向と同じ0〜360度。`0`は上、`90`は右、`180`は下、`270`は左で、`360`は`0`へ正規化します。任意角度は16方向へ丸めません。
|
|
116
|
+
- 背景相対:`HEADER_LIKE`、`CENTER`、`FOOTER_LIKE`。Stage安全領域の上部、中央、下部へ水平中央揃えで置き、Actor位置・bounds・可視性には依存しません。
|
|
117
|
+
|
|
118
|
+
Actor相対の正規方向名は次の16個です。別名は大文字小文字を区別せず、正規名へ変換されます。
|
|
119
|
+
|
|
120
|
+
| 正規名 | compass alias | 正規名 | compass alias |
|
|
121
|
+
| ------------------ | ----------------- | ---------------- | ----------------- |
|
|
122
|
+
| `up` | `north` | `down` | `south` |
|
|
123
|
+
| `up-up-right` | `north-northeast` | `down-down-left` | `south-southwest` |
|
|
124
|
+
| `up-right` | `northeast` | `down-left` | `southwest` |
|
|
125
|
+
| `right-up-right` | `east-northeast` | `left-down-left` | `west-southwest` |
|
|
126
|
+
| `right` | `east` | `left` | `west` |
|
|
127
|
+
| `right-down-right` | `east-southeast` | `left-up-left` | `west-northwest` |
|
|
128
|
+
| `down-right` | `southeast` | `up-left` | `northwest` |
|
|
129
|
+
| `down-down-right` | `south-southeast` | `up-up-left` | `north-northwest` |
|
|
130
|
+
|
|
131
|
+

|
|
132
|
+
|
|
133
|
+
図中の16方向は、それぞれActor、実際のBubble外形、tail、文字を含むミニシーンです。本体とtailはJSClipperのunionによる単一pathなので、接合部に内部border線はありません。背景相対3図はStage外枠、安全領域、外形寸法、水平中央線、基準辺/中心を示します。図とTurboWarp Editorの本体drawableは、どちらも共有`renderBubbleSvg`から生成します。
|
|
134
|
+
|
|
135
|
+

|
|
136
|
+
|
|
137
|
+
Actor相対の`distance`はActorのStage座標AABB(axis-aligned bounding box。rendererの`getBoundsForBubble()`が返す上下左右)からtail先端までで、既定値は`12`です。`tail length`は通常位置における本体borderからtail先端までで、既定値は`18`です。
|
|
138
|
+
|
|
139
|
+
`offset x/y/scale`の既定値は`[0, 0, 100]`です。xは右、yは上が正です。scaleはBubble外形だけでなく、SVG Textの文字(フォントサイズ)、表情画像、次へアイコン、内部余白へ一体で適用します。scaleだけを変えた場合は、拡大量の半径分だけ本体中心をActorから離し、Actor側の間隔を維持します。その後x/y offsetを加え、固定したtail先端へ向けてtailを再生成するため、offset後の実長は`tail length`から変化し得ます。Stage端では全体が画面内に収まるようクランプします。これら3設定は背景相対placementでは無視します。
|
|
140
|
+
|
|
141
|
+
### Animation mode
|
|
142
|
+
|
|
143
|
+
| mode | 目パチ | 口パク | advance frames |
|
|
144
|
+
| ------------------ | ------ | ------------ | -------------- |
|
|
145
|
+
| `talking` | 実行 | 実行 | 非表示 |
|
|
146
|
+
| `awaiting-advance` | 実行 | 停止・非表示 | ループ実行 |
|
|
147
|
+
| `idle` | 実行 | 停止・非表示 | 停止・非表示 |
|
|
148
|
+
|
|
149
|
+
`say`/`think`ブロックは`talking`で表示を開始し、すぐ次のブロックへ進みます。`wait with this bubble ...`は自動的に`awaiting-advance`へ移り、Async Inputが更新するruntime変数をRuntime Expressionで評価します。条件成立またはtimeout後は`idle`へ移って次のブロックへ進みます。
|
|
150
|
+
|
|
151
|
+
### ブロック構成例
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
define bubble style [hero-dialogue] using text style [dialogue-text]
|
|
155
|
+
set bubble placement [up-right] for bubble style [hero-dialogue]
|
|
156
|
+
set bubble distance [12] for bubble style [hero-dialogue]
|
|
157
|
+
set bubble visual style [NORMAL] for bubble style [hero-dialogue]
|
|
158
|
+
set bubble tail length [18] for bubble style [hero-dialogue]
|
|
159
|
+
set bubble offset x [10] y [-10] scale [120] % for bubble style [hero-dialogue]
|
|
160
|
+
set portrait base [HeroFace] for bubble style [hero-dialogue]
|
|
161
|
+
set blink frames [HeroEyesOpen,HeroEyesClosed] every [0.4] seconds for bubble style [hero-dialogue]
|
|
162
|
+
set talk frames [HeroMouthClosed,HeroMouthOpen] every [0.1] seconds for bubble style [hero-dialogue]
|
|
163
|
+
set advance frames [Next1,Next2] every [0.2] seconds for bubble style [hero-dialogue]
|
|
164
|
+
set runtime variable [input] to []
|
|
165
|
+
listen for key [Space] set runtime var [input] to [pressed]
|
|
166
|
+
listen for touch on this sprite set runtime var [input] to [pressed]
|
|
167
|
+
say [海へ出発!] with bubble style [hero-dialogue]
|
|
168
|
+
wait with this bubble until condition [input == "pressed"] or timeout after [10] seconds
|
|
169
|
+
close this bubble
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
プロジェクト開始・停止、対象sprite/cloneの停止、runtime破棄でも、所有するtimer、SVG text skin、drawableを自動解放します。依存拡張が未ロードの場合は、必要なnpmパッケージ名を含むerrorを返します。
|
|
173
|
+
|
|
174
|
+
## Composition API
|
|
175
|
+
|
|
176
|
+
TurboWarp runtimeのrenderer、Asset Manager、SVG Textへ直接接続するhostでは、公開adapterを利用できます。
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
import { createTurboWarpBubbleComposition } from "@kubohiroya/turbowarp-bubble/turbowarp-adapter";
|
|
180
|
+
|
|
181
|
+
const bubbles = createTurboWarpBubbleComposition(runtime);
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
描画surfaceをhost側で実装する場合は、以下の低レベルComposition APIを利用します。
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
import { createAssetManagerComposition } from "@kubohiroya/turbowarp-asset-manager/composition";
|
|
188
|
+
import { createSvgTextComposition } from "@kubohiroya/turbowarp-svg-text/composition";
|
|
189
|
+
import { createBubbleComposition } from "@kubohiroya/turbowarp-bubble/composition";
|
|
190
|
+
|
|
191
|
+
const assetManager = createAssetManagerComposition();
|
|
192
|
+
const svgText = createSvgTextComposition({ runtime });
|
|
193
|
+
|
|
194
|
+
svgText.defineStyle({
|
|
195
|
+
name: "dialogue-text",
|
|
196
|
+
backgroundColor: "#ffffff",
|
|
197
|
+
textColor: "#332200",
|
|
198
|
+
font: "Noto Sans JP",
|
|
199
|
+
fontPercent: 100,
|
|
200
|
+
alignment: "left",
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
const bubbles = createBubbleComposition({
|
|
204
|
+
assetManager,
|
|
205
|
+
svgText,
|
|
206
|
+
async createSurface({ actor, actorKey, kind, style }) {
|
|
207
|
+
// hostがActorの近くへsurfaceを配置し、各レイヤー用のtargetを返します。
|
|
208
|
+
return bubbleSurfaceHost.create({ actor, actorKey, kind, style });
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`createSurface`が返すsurfaceは、次のtargetを持ちます。
|
|
214
|
+
|
|
215
|
+
- `text`: SVG Textが文字スキンを適用するtarget
|
|
216
|
+
- `portraitBase`: キャラクター表情のベース画像target
|
|
217
|
+
- `portraitBlink`: 目パチ差分target
|
|
218
|
+
- `portraitTalk`: 口パク差分target
|
|
219
|
+
- `advanceIndicator`: 「次へ」アイコンtarget
|
|
220
|
+
|
|
221
|
+
画像レイヤーのtarget IDは互いに異なる必要があります。styleで使わないレイヤーのtargetは省略できます。
|
|
222
|
+
|
|
223
|
+
## Styleと表示
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
bubbles.defineStyle({
|
|
227
|
+
name: "hero-dialogue",
|
|
228
|
+
textStyle: "dialogue-text",
|
|
229
|
+
placement: "north-northeast",
|
|
230
|
+
distance: 12,
|
|
231
|
+
visualStyle: "NORMAL",
|
|
232
|
+
tailLength: 18,
|
|
233
|
+
offset: [10, -10, 120],
|
|
234
|
+
portrait: {
|
|
235
|
+
base: "HeroFace",
|
|
236
|
+
blink: {
|
|
237
|
+
frames: ["HeroEyesOpen", "HeroEyesClosed"],
|
|
238
|
+
frameIntervalSeconds: 0.4,
|
|
239
|
+
},
|
|
240
|
+
talk: {
|
|
241
|
+
frames: ["HeroMouthClosed", "HeroMouthOpen"],
|
|
242
|
+
frameIntervalSeconds: 0.1,
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
advanceIndicator: {
|
|
246
|
+
frames: ["Next1", "Next2"],
|
|
247
|
+
frameIntervalSeconds: 0.2,
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
bubbles.defineStyle({
|
|
252
|
+
name: "narration",
|
|
253
|
+
textStyle: "dialogue-text",
|
|
254
|
+
placement: "FOOTER_LIKE",
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
const bubble = await bubbles.show({
|
|
258
|
+
actor: heroTarget,
|
|
259
|
+
actorKey: "Hero",
|
|
260
|
+
kind: "say",
|
|
261
|
+
text: "海へ出発!",
|
|
262
|
+
styleName: "hero-dialogue",
|
|
263
|
+
});
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`show`の初期animation modeは`talking`です。目パチは表示中継続し、口パクが動きます。全文表示後にアプリが「次へ」操作待ちへ移るとき、modeを`awaiting-advance`へ変更します。
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
await bubble.setAnimationMode("awaiting-advance");
|
|
270
|
+
// 口パクを停止して非表示にし、「次へ」アイコンをループ表示します。
|
|
271
|
+
|
|
272
|
+
await bubble.setAnimationMode("idle");
|
|
273
|
+
// 吹き出しを残したまま、口パクと「次へ」アイコンを停止します。
|
|
274
|
+
|
|
275
|
+
await bubble.close();
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
返されたhandleの`setText(text)`は同じsurface上の本文を更新し、文字送りなどに利用できます。同じ`actorKey`へ新しいBubbleを表示すると、以前のBubbleを完全に破棄してから置き換えます。`releaseTarget`、`releaseAll`、`dispose`も、所有するtimer、SVG Text target、surfaceを解放します。composition間で状態は共有しません。
|
|
279
|
+
|
|
280
|
+
## DSL 4.0との関係
|
|
281
|
+
|
|
282
|
+
このパッケージは`bubbleStyles`を含むDSLを解析しません。紙芝居アプリ側のadapterが、例えば`placement: north-northeast`、`placement: 33.75`、`placement: FOOTER_LIKE`を`defineStyle`へ渡し、表示ライフサイクルに合わせて`show`、`setAnimationMode`、`close`を呼び出します。
|
|
283
|
+
|
|
284
|
+
アプリ統合は起動時固定・既定OFFのfeature flagで段階導入します。ロールバック時はflagをOFFにし、既存のTurboWarp say/think経路へ戻します。
|
|
285
|
+
|
|
286
|
+
## 開発
|
|
287
|
+
|
|
288
|
+
```sh
|
|
289
|
+
pnpm install
|
|
290
|
+
pnpm check
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
`pnpm check`は型検査、lint、format、単体テスト、配布物検査、外部consumer型検査、npm pack dry-runを実行します。
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The distributed JavaScript bundles include the following third-party software.
|
|
4
|
+
|
|
5
|
+
## jsclipper
|
|
6
|
+
|
|
7
|
+
Repository: https://github.com/platener/jsclipper
|
|
8
|
+
|
|
9
|
+
The package adapter is distributed under the ISC License.
|
|
10
|
+
|
|
11
|
+
Copyright (c) Sven Mischkewitz
|
|
12
|
+
|
|
13
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
14
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
15
|
+
copyright notice and this permission notice appear in all copies.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
18
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
22
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
24
|
+
|
|
25
|
+
The bundled Clipper core is distributed under the Boost Software License 1.0.
|
|
26
|
+
|
|
27
|
+
Copyright (c) 2010-2014 Angus Johnson
|
|
28
|
+
|
|
29
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
32
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
33
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
34
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
35
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
36
|
+
do so, all subject to the following:
|
|
37
|
+
|
|
38
|
+
The copyright notices in the Software and this entire statement, including
|
|
39
|
+
the above license grant, this restriction and the following disclaimer,
|
|
40
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
41
|
+
all derivative works of the Software, unless such copies or derivative
|
|
42
|
+
works are solely in the form of machine-executable object code generated by
|
|
43
|
+
a source language processor.
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
48
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR
|
|
49
|
+
ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
50
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
51
|
+
DEALINGS IN THE SOFTWARE.
|
|
52
|
+
|
|
53
|
+
## @cto.af/linebreak
|
|
54
|
+
|
|
55
|
+
MIT License
|
|
56
|
+
|
|
57
|
+
Copyright (c) 2023-present Joe Hildebrand
|
|
58
|
+
|
|
59
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
60
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
61
|
+
in the Software without restriction, including without limitation the rights
|
|
62
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
63
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
64
|
+
furnished to do so, subject to the following conditions:
|
|
65
|
+
|
|
66
|
+
The above copyright notice and this permission notice shall be included in all
|
|
67
|
+
copies or substantial portions of the Software.
|
|
68
|
+
|
|
69
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
70
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
71
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
72
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
73
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
74
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
75
|
+
SOFTWARE.
|
|
76
|
+
|
|
77
|
+
## @cto.af/unicode-trie-runtime
|
|
78
|
+
|
|
79
|
+
Initial code copied from https://github.com/foliojs/unicode-trie/
|
|
80
|
+
|
|
81
|
+
Copyright 2023
|
|
82
|
+
|
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
84
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
85
|
+
in the Software without restriction, including without limitation the rights
|
|
86
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
87
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
88
|
+
furnished to do so, subject to the following conditions:
|
|
89
|
+
|
|
90
|
+
The above copyright notice and this permission notice shall be included in all
|
|
91
|
+
copies or substantial portions of the Software.
|
|
92
|
+
|
|
93
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
94
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
95
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
96
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
97
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
98
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
99
|
+
SOFTWARE.
|
|
100
|
+
|
|
101
|
+
## fflate
|
|
102
|
+
|
|
103
|
+
MIT License
|
|
104
|
+
|
|
105
|
+
Copyright (c) 2026 Arjun Barrett
|
|
106
|
+
|
|
107
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
108
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
109
|
+
in the Software without restriction, including without limitation the rights
|
|
110
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
111
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
112
|
+
furnished to do so, subject to the following conditions:
|
|
113
|
+
|
|
114
|
+
The above copyright notice and this permission notice shall be included in all
|
|
115
|
+
copies or substantial portions of the Software.
|
|
116
|
+
|
|
117
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
118
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
119
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
120
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
121
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
122
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
123
|
+
SOFTWARE.
|