@kubohiroya/turbowarp-bubble 0.3.0 → 0.3.1
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 +1 -1
- package/dist/composition.js +70 -66
- package/dist/turbowarp-adapter.js +126 -122
- package/dist/turbowarp-bubble.js +12 -8
- 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 +1 -1
package/README.md
CHANGED
|
@@ -247,7 +247,7 @@ https://unpkg.com/@kubohiroya/turbowarp-async-input@0.3.0/dist/async-input.js
|
|
|
247
247
|
https://unpkg.com/@kubohiroya/turbowarp-runtime-expression@0.3.0/dist/runtime-expression.js
|
|
248
248
|
|
|
249
249
|
# Bubble(必ず最後)
|
|
250
|
-
https://unpkg.com/@kubohiroya/turbowarp-bubble@0.3.
|
|
250
|
+
https://unpkg.com/@kubohiroya/turbowarp-bubble@0.3.1/dist/turbowarp-bubble.js
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
TurboWarpのカスタム拡張機能はURLからJavaScriptを読み込むため、初回読み込み時にネットワーク接続が必要です。開発中は、リポジトリをローカルHTTPサーバーで配信して`dist/turbowarp-bubble.js`を指定できます。`file://`で直接開いたファイルや、サンドボックス付きの拡張機能としては動作しません。
|
package/dist/composition.js
CHANGED
|
@@ -3972,7 +3972,7 @@ function Er(e) {
|
|
|
3972
3972
|
"sound"
|
|
3973
3973
|
]);
|
|
3974
3974
|
if (Object.keys(t).filter((e) => !n.has(e)).length > 0 || t.unit === void 0) throw TypeError("Bubble reveal has unknown or missing properties.");
|
|
3975
|
-
let r = Tr(t.unit), i = t.delimiters ?? "
|
|
3975
|
+
let r = Tr(t.unit), i = t.delimiters ?? " \r\n";
|
|
3976
3976
|
if (typeof i != "string" || i.length === 0) throw TypeError("Bubble WORD delimiters must be a non-empty string.");
|
|
3977
3977
|
let a = t.showDelimiters ?? !1;
|
|
3978
3978
|
if (typeof a != "boolean") throw TypeError("Bubble reveal showDelimiters must be boolean.");
|
|
@@ -3981,18 +3981,18 @@ function Er(e) {
|
|
|
3981
3981
|
let s = t.intervalSeconds ?? 0;
|
|
3982
3982
|
if (typeof s != "number" || !Number.isFinite(s) || s < 0) throw TypeError("Bubble reveal intervalSeconds must be zero or greater.");
|
|
3983
3983
|
let c = t.sound;
|
|
3984
|
-
if (c !== void 0 && (typeof c != "string" || c.
|
|
3984
|
+
if (c !== void 0 && (typeof c != "string" || c.length === 0)) throw TypeError("Bubble reveal sound must be a non-empty asset name.");
|
|
3985
3985
|
return Object.freeze({
|
|
3986
3986
|
unit: r,
|
|
3987
3987
|
delimiters: i,
|
|
3988
3988
|
showDelimiters: a,
|
|
3989
3989
|
layout: o,
|
|
3990
3990
|
intervalSeconds: s,
|
|
3991
|
-
...c === void 0 ? {} : { sound: c
|
|
3991
|
+
...c === void 0 ? {} : { sound: c }
|
|
3992
3992
|
});
|
|
3993
3993
|
}
|
|
3994
3994
|
function Dr(e, t, n) {
|
|
3995
|
-
let r = new Set(
|
|
3995
|
+
let r = new Set(Array.from(t)), i = [], a = "";
|
|
3996
3996
|
for (let t of wr(e)) a += t, r.has(t) && ((n || a.slice(0, -t.length).length > 0) && i.push(n ? a : a.slice(0, -t.length)), a = "");
|
|
3997
3997
|
return a.length > 0 && i.push(a), i.filter((e) => e.length > 0);
|
|
3998
3998
|
}
|
|
@@ -4061,27 +4061,31 @@ function $(e, t) {
|
|
|
4061
4061
|
if (typeof e != "string" || e.trim().length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4062
4062
|
return e.trim();
|
|
4063
4063
|
}
|
|
4064
|
-
function Fr(e, t
|
|
4064
|
+
function Fr(e, t) {
|
|
4065
|
+
if (typeof e != "string" || e.length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4066
|
+
return e;
|
|
4067
|
+
}
|
|
4068
|
+
function Ir(e, t, n) {
|
|
4065
4069
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4066
4070
|
if (Pr(e, ["frames", "frameIntervalSeconds"], [], t), !Array.isArray(e.frames) || e.frames.length < n) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frames must contain at least ${n} image asset name${n === 1 ? "" : "s"}.`);
|
|
4067
|
-
let r = Object.freeze(e.frames.map((e, n) =>
|
|
4071
|
+
let r = Object.freeze(e.frames.map((e, n) => Fr(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
|
|
4068
4072
|
if (typeof i != "number" || !Number.isFinite(i) || i <= 0) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frameIntervalSeconds must be a positive finite number.`);
|
|
4069
4073
|
return Object.freeze({
|
|
4070
4074
|
frames: r,
|
|
4071
4075
|
frameIntervalSeconds: i
|
|
4072
4076
|
});
|
|
4073
4077
|
}
|
|
4074
|
-
function
|
|
4078
|
+
function Lr(e) {
|
|
4075
4079
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
|
|
4076
4080
|
Pr(e, ["base"], ["blink", "lipSync"], "Bubble portrait");
|
|
4077
|
-
let t = e.blink === void 0 ? void 0 :
|
|
4081
|
+
let t = e.blink === void 0 ? void 0 : Ir(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : Ir(e.lipSync, "Bubble portrait lip-sync", 1);
|
|
4078
4082
|
return Object.freeze({
|
|
4079
|
-
base:
|
|
4083
|
+
base: Fr(e.base, "Bubble portrait base"),
|
|
4080
4084
|
...t === void 0 ? {} : { blink: t },
|
|
4081
4085
|
...n === void 0 ? {} : { lipSync: n }
|
|
4082
4086
|
});
|
|
4083
4087
|
}
|
|
4084
|
-
function
|
|
4088
|
+
function Rr(e, t) {
|
|
4085
4089
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4086
4090
|
if (Pr(e, ["name"], [
|
|
4087
4091
|
"durationSeconds",
|
|
@@ -4115,7 +4119,7 @@ function Lr(e, t) {
|
|
|
4115
4119
|
...l === void 0 ? {} : { visualStyle: l }
|
|
4116
4120
|
});
|
|
4117
4121
|
}
|
|
4118
|
-
function
|
|
4122
|
+
function zr(e) {
|
|
4119
4123
|
if (e === void 0) return;
|
|
4120
4124
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
|
|
4121
4125
|
Pr(e, [], [
|
|
@@ -4130,11 +4134,11 @@ function Rr(e) {
|
|
|
4130
4134
|
"finish"
|
|
4131
4135
|
]) {
|
|
4132
4136
|
let r = e[n];
|
|
4133
|
-
r !== void 0 && (t[n] =
|
|
4137
|
+
r !== void 0 && (t[n] = Fr(r, `Bubble audio ${n}`));
|
|
4134
4138
|
}
|
|
4135
4139
|
return Object.freeze(t);
|
|
4136
4140
|
}
|
|
4137
|
-
function
|
|
4141
|
+
function Br(e) {
|
|
4138
4142
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
|
|
4139
4143
|
Pr(e, ["name", "textStyle"], [
|
|
4140
4144
|
"placement",
|
|
@@ -4151,13 +4155,13 @@ function zr(e) {
|
|
|
4151
4155
|
"showAnimation",
|
|
4152
4156
|
"hideAnimation"
|
|
4153
4157
|
], "Bubble style");
|
|
4154
|
-
let t = e.portrait === void 0 ? void 0 :
|
|
4158
|
+
let t = e.portrait === void 0 ? void 0 : Lr(e.portrait), n = e.continueIndicator === void 0 ? void 0 : Ir(e.continueIndicator, "Bubble continue indicator", 2), r;
|
|
4155
4159
|
if (e.reveal !== void 0) try {
|
|
4156
4160
|
r = Er(e.reveal);
|
|
4157
4161
|
} catch (e) {
|
|
4158
4162
|
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
|
|
4159
4163
|
}
|
|
4160
|
-
let i =
|
|
4164
|
+
let i = zr(e.audio), a = e.showAnimation === void 0 ? void 0 : Rr(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : Rr(e.hideAnimation, "Bubble hideAnimation"), s;
|
|
4161
4165
|
try {
|
|
4162
4166
|
s = y(e.placement ?? "up-right");
|
|
4163
4167
|
} catch (e) {
|
|
@@ -4195,13 +4199,13 @@ function zr(e) {
|
|
|
4195
4199
|
...o === void 0 ? {} : { hideAnimation: o }
|
|
4196
4200
|
});
|
|
4197
4201
|
}
|
|
4198
|
-
function
|
|
4202
|
+
function Vr(e) {
|
|
4199
4203
|
if (e !== void 0) {
|
|
4200
4204
|
if (!Q(e) || typeof e.applyToTarget != "function" || typeof e.getMimeType != "function" || typeof e.isRegistered != "function") throw TypeError("Bubble image capability must provide applyToTarget, getMimeType, and isRegistered.");
|
|
4201
4205
|
return e;
|
|
4202
4206
|
}
|
|
4203
4207
|
}
|
|
4204
|
-
function
|
|
4208
|
+
function Hr(e) {
|
|
4205
4209
|
if (e !== void 0) {
|
|
4206
4210
|
if (!Q(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
|
|
4207
4211
|
if (e.isRegistered !== void 0 && typeof e.isRegistered != "function") throw TypeError("Bubble audio capability isRegistered must be a function.");
|
|
@@ -4209,64 +4213,64 @@ function Vr(e) {
|
|
|
4209
4213
|
return e;
|
|
4210
4214
|
}
|
|
4211
4215
|
}
|
|
4212
|
-
function
|
|
4216
|
+
function Ur(e) {
|
|
4213
4217
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", "Bubble image assets require an image capability. Provide options.imageResolver.");
|
|
4214
4218
|
return e;
|
|
4215
4219
|
}
|
|
4216
|
-
function
|
|
4220
|
+
function Wr(e) {
|
|
4217
4221
|
if (!Q(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble SVG Text composition must provide setText and releaseTarget.");
|
|
4218
4222
|
return e;
|
|
4219
4223
|
}
|
|
4220
|
-
function
|
|
4224
|
+
function Gr() {
|
|
4221
4225
|
return Object.freeze({
|
|
4222
4226
|
setTimeout: (e, t) => globalThis.setTimeout(e, t),
|
|
4223
4227
|
clearTimeout: (e) => globalThis.clearTimeout(e)
|
|
4224
4228
|
});
|
|
4225
4229
|
}
|
|
4226
|
-
function
|
|
4230
|
+
function Kr(e) {
|
|
4227
4231
|
if (!Q(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
|
|
4228
4232
|
return e;
|
|
4229
4233
|
}
|
|
4230
|
-
function
|
|
4234
|
+
function qr(e, t) {
|
|
4231
4235
|
if (!Q(e) || typeof e.id != "string" || e.id.length === 0 || typeof e.isStage != "boolean") throw new Z("BUBBLE-COMPOSITION-004", `${t} must provide id and isStage.`);
|
|
4232
4236
|
return e;
|
|
4233
4237
|
}
|
|
4234
|
-
function
|
|
4238
|
+
function Jr(e) {
|
|
4235
4239
|
if (!Q(e) || typeof e.drawableID != "number" || !Number.isInteger(e.drawableID) || e.drawableID < 0) throw new Z("BUBBLE-COMPOSITION-004", "Bubble text target must provide a non-negative integer drawableID.");
|
|
4236
4240
|
return e;
|
|
4237
4241
|
}
|
|
4238
|
-
function
|
|
4242
|
+
function Yr(e, t) {
|
|
4239
4243
|
if (!Q(e) || !Q(e.targets) || typeof e.setLayerVisible != "function" || typeof e.updateStyle != "function" || typeof e.show != "function" || typeof e.hide != "function" || typeof e.dispose != "function") throw new Z("BUBBLE-COMPOSITION-004", "Bubble surface is invalid.");
|
|
4240
4244
|
let n = e.targets;
|
|
4241
|
-
|
|
4245
|
+
Jr(n.text);
|
|
4242
4246
|
let r = /* @__PURE__ */ new Set(), i = (e, t) => {
|
|
4243
4247
|
let i = n[e];
|
|
4244
4248
|
if (!t && i === void 0) return;
|
|
4245
|
-
let a =
|
|
4249
|
+
let a = qr(i, `Bubble surface ${e}`);
|
|
4246
4250
|
if (r.has(a.id)) throw new Z("BUBBLE-COMPOSITION-004", "Bubble image layers must use distinct target IDs.");
|
|
4247
4251
|
r.add(a.id);
|
|
4248
4252
|
};
|
|
4249
4253
|
return i("portraitBase", t.portrait !== void 0), i("portraitBlink", t.portrait?.blink !== void 0), i("portraitLipSync", t.portrait?.lipSync !== void 0), i("continueIndicator", t.continueIndicator !== void 0), e;
|
|
4250
4254
|
}
|
|
4251
|
-
function
|
|
4255
|
+
function Xr(e, t) {
|
|
4252
4256
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble image capability is required for: ${t}. Provide options.imageResolver.`);
|
|
4253
4257
|
if (!e.isRegistered(t)) throw new Z("BUBBLE-COMPOSITION-003", `Bubble image asset is not registered: ${t}`);
|
|
4254
4258
|
if (!e.getMimeType(t).startsWith("image/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not an image: ${t}`);
|
|
4255
4259
|
}
|
|
4256
|
-
function
|
|
4260
|
+
function Zr(e, t) {
|
|
4257
4261
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble audio assets require an audio capability: ${t}. Provide options.audio.`);
|
|
4258
4262
|
if (e.isRegistered?.(t) === !1) throw new Z("BUBBLE-COMPOSITION-003", `Bubble audio asset is not registered: ${t}`);
|
|
4259
4263
|
let n = e.getMimeType?.(t);
|
|
4260
4264
|
if (n !== void 0 && !n.startsWith("audio/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not audio: ${t}`);
|
|
4261
4265
|
}
|
|
4262
|
-
function
|
|
4266
|
+
function Qr(e) {
|
|
4263
4267
|
return [...e.portrait === void 0 ? [] : [
|
|
4264
4268
|
e.portrait.base,
|
|
4265
4269
|
...e.portrait.blink?.frames ?? [],
|
|
4266
4270
|
...e.portrait.lipSync?.frames ?? []
|
|
4267
4271
|
], ...e.continueIndicator?.frames ?? []];
|
|
4268
4272
|
}
|
|
4269
|
-
function
|
|
4273
|
+
function $r(e, t, n) {
|
|
4270
4274
|
if (t.maxWidth === void 0) return e;
|
|
4271
4275
|
if (typeof n.measureText != "function") throw new Z("BUBBLE-COMPOSITION-007", "Bubble style maxWidth requires the text capability measureText method.");
|
|
4272
4276
|
return Sr({
|
|
@@ -4279,11 +4283,11 @@ function Qr(e, t, n) {
|
|
|
4279
4283
|
}) ?? 0
|
|
4280
4284
|
}).lines.map(({ text: e }) => e).join("\n");
|
|
4281
4285
|
}
|
|
4282
|
-
function
|
|
4286
|
+
function ei(e, t) {
|
|
4283
4287
|
if (e.length === 1) throw e[0];
|
|
4284
4288
|
if (e.length > 1) throw AggregateError(e, t);
|
|
4285
4289
|
}
|
|
4286
|
-
function
|
|
4290
|
+
function ti(e) {
|
|
4287
4291
|
let t = !1, n = 0, r = 0, i, a = Promise.resolve(), o = async (t) => {
|
|
4288
4292
|
let n = e.animation.frames[t];
|
|
4289
4293
|
n !== void 0 && await e.imageResolver.applyToTarget(n, e.target);
|
|
@@ -4318,7 +4322,7 @@ function ei(e) {
|
|
|
4318
4322
|
}
|
|
4319
4323
|
});
|
|
4320
4324
|
}
|
|
4321
|
-
function
|
|
4325
|
+
function ni(e) {
|
|
4322
4326
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
|
|
4323
4327
|
if (Pr(e, [
|
|
4324
4328
|
"actor",
|
|
@@ -4346,12 +4350,12 @@ function ti(e) {
|
|
|
4346
4350
|
...n === void 0 ? {} : { reveal: n }
|
|
4347
4351
|
};
|
|
4348
4352
|
}
|
|
4349
|
-
function
|
|
4353
|
+
function ri(e) {
|
|
4350
4354
|
if (!Q(e)) throw TypeError("Bubble composition options must be an object.");
|
|
4351
|
-
let t =
|
|
4355
|
+
let t = Vr(e.imageResolver), n = Hr(e.audio), r = Wr(e.svgText);
|
|
4352
4356
|
if (typeof e.createSurface != "function") throw TypeError("Bubble composition createSurface must be a function.");
|
|
4353
4357
|
if (e.onAnimationError !== void 0 && typeof e.onAnimationError != "function") throw TypeError("Bubble composition onAnimationError must be a function.");
|
|
4354
|
-
let i =
|
|
4358
|
+
let i = Kr(e.scheduler ?? Gr()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
|
|
4355
4359
|
if (c) throw new Z("BUBBLE-COMPOSITION-005", "Bubble composition has been disposed.");
|
|
4356
4360
|
}, u = async (e, t) => {
|
|
4357
4361
|
let n = (s.get(e) ?? Promise.resolve()).catch(() => void 0).then(t);
|
|
@@ -4371,8 +4375,8 @@ function ni(e) {
|
|
|
4371
4375
|
reveal: s.reveal
|
|
4372
4376
|
}));
|
|
4373
4377
|
let d = s.text, f = (e) => {
|
|
4374
|
-
let n = new Set(
|
|
4375
|
-
for (let e of n)
|
|
4378
|
+
let n = new Set(Qr(e)), r = n.size === 0 ? void 0 : Ur(t);
|
|
4379
|
+
for (let e of n) Xr(r, e);
|
|
4376
4380
|
return r;
|
|
4377
4381
|
}, p = f(u);
|
|
4378
4382
|
for (let e of [
|
|
@@ -4380,13 +4384,13 @@ function ni(e) {
|
|
|
4380
4384
|
u.audio?.reveal,
|
|
4381
4385
|
u.audio?.finish,
|
|
4382
4386
|
u.reveal?.sound
|
|
4383
|
-
]) e !== void 0 &&
|
|
4387
|
+
]) e !== void 0 && Zr(n, e);
|
|
4384
4388
|
let m = async (e, t = !1) => {
|
|
4385
4389
|
e !== void 0 && n !== void 0 && await n.playSound(e, { untilDone: t });
|
|
4386
4390
|
}, h = async (e, t, n) => {
|
|
4387
|
-
let r =
|
|
4391
|
+
let r = Qr(e).length === 0 ? void 0 : Ur(t), i = [];
|
|
4388
4392
|
if (e.portrait) {
|
|
4389
|
-
let t =
|
|
4393
|
+
let t = Ur(r);
|
|
4390
4394
|
i.push(Promise.resolve(t.applyToTarget(e.portrait.base, n.targets.portraitBase)));
|
|
4391
4395
|
let a = e.portrait.blink?.frames[0];
|
|
4392
4396
|
a !== void 0 && i.push(Promise.resolve(t.applyToTarget(a, n.targets.portraitBlink)));
|
|
@@ -4395,33 +4399,33 @@ function ni(e) {
|
|
|
4395
4399
|
}
|
|
4396
4400
|
let a = e.continueIndicator?.frames[0];
|
|
4397
4401
|
if (a !== void 0) {
|
|
4398
|
-
let e =
|
|
4402
|
+
let e = Ur(r);
|
|
4399
4403
|
i.push(Promise.resolve(e.applyToTarget(a, n.targets.continueIndicator)));
|
|
4400
4404
|
}
|
|
4401
4405
|
await Promise.all(i);
|
|
4402
4406
|
}, g = (t, n, r) => {
|
|
4403
|
-
x = t.portrait?.blink === void 0 ? void 0 :
|
|
4407
|
+
x = t.portrait?.blink === void 0 ? void 0 : ti({
|
|
4404
4408
|
actorKey: s.actorKey,
|
|
4405
4409
|
layer: "portraitBlink",
|
|
4406
4410
|
animation: t.portrait.blink,
|
|
4407
4411
|
target: r.targets.portraitBlink,
|
|
4408
|
-
imageResolver:
|
|
4412
|
+
imageResolver: Ur(n),
|
|
4409
4413
|
scheduler: i,
|
|
4410
4414
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4411
|
-
}), S = t.portrait?.lipSync === void 0 ? void 0 :
|
|
4415
|
+
}), S = t.portrait?.lipSync === void 0 ? void 0 : ti({
|
|
4412
4416
|
actorKey: s.actorKey,
|
|
4413
4417
|
layer: "portraitLipSync",
|
|
4414
4418
|
animation: t.portrait.lipSync,
|
|
4415
4419
|
target: r.targets.portraitLipSync,
|
|
4416
|
-
imageResolver:
|
|
4420
|
+
imageResolver: Ur(n),
|
|
4417
4421
|
scheduler: i,
|
|
4418
4422
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4419
|
-
}), C = t.continueIndicator === void 0 ? void 0 :
|
|
4423
|
+
}), C = t.continueIndicator === void 0 ? void 0 : ti({
|
|
4420
4424
|
actorKey: s.actorKey,
|
|
4421
4425
|
layer: "continueIndicator",
|
|
4422
4426
|
animation: t.continueIndicator,
|
|
4423
4427
|
target: r.targets.continueIndicator,
|
|
4424
|
-
imageResolver:
|
|
4428
|
+
imageResolver: Ur(n),
|
|
4425
4429
|
scheduler: i,
|
|
4426
4430
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4427
4431
|
});
|
|
@@ -4429,13 +4433,13 @@ function ni(e) {
|
|
|
4429
4433
|
_ && await _.close();
|
|
4430
4434
|
let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? Or(s.text, w) : Object.freeze([s.text]), E = w ? Math.min(1, T.length) : 1, D, ee = 0;
|
|
4431
4435
|
try {
|
|
4432
|
-
v =
|
|
4436
|
+
v = Yr(await e.createSurface(Object.freeze({
|
|
4433
4437
|
actor: s.actor,
|
|
4434
4438
|
actorKey: s.actorKey,
|
|
4435
4439
|
kind: s.kind,
|
|
4436
4440
|
style: u
|
|
4437
4441
|
})), u);
|
|
4438
|
-
let t =
|
|
4442
|
+
let t = $r(s.text, u, r);
|
|
4439
4443
|
w?.layout === "RESERVED" && (r.setText({
|
|
4440
4444
|
styleName: u.textStyle,
|
|
4441
4445
|
target: v.targets.text,
|
|
@@ -4443,7 +4447,7 @@ function ni(e) {
|
|
|
4443
4447
|
}), v.captureTextLayout?.()), r.setText({
|
|
4444
4448
|
styleName: u.textStyle,
|
|
4445
4449
|
target: v.targets.text,
|
|
4446
|
-
text:
|
|
4450
|
+
text: $r(w ? kr(T, E) : s.text, u, r)
|
|
4447
4451
|
}), y = !0, await h(u, p, v), g(u, p, v);
|
|
4448
4452
|
let a = "idle", c = !1, l = Promise.resolve(), _ = async () => {
|
|
4449
4453
|
if (!v) return;
|
|
@@ -4451,7 +4455,7 @@ function ni(e) {
|
|
|
4451
4455
|
r.setText({
|
|
4452
4456
|
styleName: u.textStyle,
|
|
4453
4457
|
target: v.targets.text,
|
|
4454
|
-
text:
|
|
4458
|
+
text: $r(e, u, r)
|
|
4455
4459
|
}), await v.show();
|
|
4456
4460
|
}, O = () => {
|
|
4457
4461
|
ee += 1, D !== void 0 && i.clearTimeout(D), D = void 0;
|
|
@@ -4481,7 +4485,7 @@ function ni(e) {
|
|
|
4481
4485
|
v && (O(), d = e, w ? (T = Or(e, w), E = Math.min(1, T.length), w.layout === "RESERVED" && (r.setText({
|
|
4482
4486
|
styleName: u.textStyle,
|
|
4483
4487
|
target: v.targets.text,
|
|
4484
|
-
text:
|
|
4488
|
+
text: $r(e, u, r)
|
|
4485
4489
|
}), v.captureTextLayout?.()), await _(), k()) : await _());
|
|
4486
4490
|
}), l) : Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble text must be a string."));
|
|
4487
4491
|
},
|
|
@@ -4489,20 +4493,20 @@ function ni(e) {
|
|
|
4489
4493
|
if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
4490
4494
|
let t;
|
|
4491
4495
|
try {
|
|
4492
|
-
t =
|
|
4496
|
+
t = Br(e);
|
|
4493
4497
|
} catch (e) {
|
|
4494
4498
|
return Promise.reject(e);
|
|
4495
4499
|
}
|
|
4496
4500
|
return l = l.then(async () => {
|
|
4497
4501
|
if (!v) return;
|
|
4498
|
-
|
|
4502
|
+
Yr(v, t);
|
|
4499
4503
|
let e = f(t);
|
|
4500
4504
|
for (let e of [
|
|
4501
4505
|
t.audio?.voice,
|
|
4502
4506
|
t.audio?.reveal,
|
|
4503
4507
|
t.audio?.finish,
|
|
4504
4508
|
t.reveal?.sound
|
|
4505
|
-
]) e !== void 0 &&
|
|
4509
|
+
]) e !== void 0 && Zr(n, e);
|
|
4506
4510
|
await Promise.all([
|
|
4507
4511
|
x?.stop(),
|
|
4508
4512
|
S?.stop(),
|
|
@@ -4510,11 +4514,11 @@ function ni(e) {
|
|
|
4510
4514
|
]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? Or(d, w) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, O(), w?.layout === "RESERVED" && (r.setText({
|
|
4511
4515
|
styleName: t.textStyle,
|
|
4512
4516
|
target: v.targets.text,
|
|
4513
|
-
text:
|
|
4517
|
+
text: $r(d, t, r)
|
|
4514
4518
|
}), v.captureTextLayout?.()), r.setText({
|
|
4515
4519
|
styleName: t.textStyle,
|
|
4516
4520
|
target: v.targets.text,
|
|
4517
|
-
text:
|
|
4521
|
+
text: $r(d, t, r)
|
|
4518
4522
|
}), g(t, e, v), await Promise.all([
|
|
4519
4523
|
v.setLayerVisible("portraitBase", t.portrait !== void 0),
|
|
4520
4524
|
v.setLayerVisible("portraitBlink", t.portrait?.blink !== void 0),
|
|
@@ -4550,7 +4554,7 @@ function ni(e) {
|
|
|
4550
4554
|
}), T = Or(d, w), E = Math.min(1, T.length), w.layout === "RESERVED" && v && (r.setText({
|
|
4551
4555
|
styleName: u.textStyle,
|
|
4552
4556
|
target: v.targets.text,
|
|
4553
|
-
text:
|
|
4557
|
+
text: $r(d, u, r)
|
|
4554
4558
|
}), v.captureTextLayout?.())), w) for (; await te(););
|
|
4555
4559
|
let n = e.condition;
|
|
4556
4560
|
if (n === void 0 && t === 0) {
|
|
@@ -4584,7 +4588,7 @@ function ni(e) {
|
|
|
4584
4588
|
if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
4585
4589
|
let t;
|
|
4586
4590
|
try {
|
|
4587
|
-
t =
|
|
4591
|
+
t = Rr(e, "Bubble motion");
|
|
4588
4592
|
} catch (e) {
|
|
4589
4593
|
return Promise.reject(e);
|
|
4590
4594
|
}
|
|
@@ -4627,7 +4631,7 @@ function ni(e) {
|
|
|
4627
4631
|
} catch (t) {
|
|
4628
4632
|
e.push(t);
|
|
4629
4633
|
}
|
|
4630
|
-
o.get(s.actorKey) === j && o.delete(s.actorKey),
|
|
4634
|
+
o.get(s.actorKey) === j && o.delete(s.actorKey), ei(e, `Failed to close bubble: ${s.actorKey}`);
|
|
4631
4635
|
}
|
|
4632
4636
|
});
|
|
4633
4637
|
return o.set(s.actorKey, j), k(), u.showAnimation !== void 0 && await j.animate(u.showAnimation), j;
|
|
@@ -4659,7 +4663,7 @@ function ni(e) {
|
|
|
4659
4663
|
return Object.freeze({
|
|
4660
4664
|
defineStyle(e) {
|
|
4661
4665
|
l();
|
|
4662
|
-
let t =
|
|
4666
|
+
let t = Br(e);
|
|
4663
4667
|
a.set(t.name, t);
|
|
4664
4668
|
},
|
|
4665
4669
|
hasActiveBubble(e) {
|
|
@@ -4667,7 +4671,7 @@ function ni(e) {
|
|
|
4667
4671
|
},
|
|
4668
4672
|
async show(e) {
|
|
4669
4673
|
l();
|
|
4670
|
-
let t =
|
|
4674
|
+
let t = ni(e);
|
|
4671
4675
|
return u(t.actorKey, () => d(t));
|
|
4672
4676
|
},
|
|
4673
4677
|
releaseTarget(e) {
|
|
@@ -4678,15 +4682,15 @@ function ni(e) {
|
|
|
4678
4682
|
});
|
|
4679
4683
|
},
|
|
4680
4684
|
async releaseAll() {
|
|
4681
|
-
l(), await Promise.allSettled([...s.values()]),
|
|
4685
|
+
l(), await Promise.allSettled([...s.values()]), ei((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
|
|
4682
4686
|
},
|
|
4683
4687
|
async dispose() {
|
|
4684
4688
|
if (c) return;
|
|
4685
4689
|
c = !0, await Promise.allSettled([...s.values()]);
|
|
4686
4690
|
let e = await Promise.allSettled([...o.values()].map((e) => e.close()));
|
|
4687
|
-
a.clear(),
|
|
4691
|
+
a.clear(), ei(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
|
|
4688
4692
|
}
|
|
4689
4693
|
});
|
|
4690
4694
|
}
|
|
4691
4695
|
//#endregion
|
|
4692
|
-
export { Z as BubbleCompositionError, hr as UnicodeLineBreakProvider, ee as actorRelativeBubbleCenter, d as bubbleBackgroundRegions, be as bubbleBodyCenterOffset, u as bubbleDirectionAliases, l as bubbleDirectionNames, Cr as bubbleRevealUnits, M as bubbleVisualStyles,
|
|
4696
|
+
export { Z as BubbleCompositionError, hr as UnicodeLineBreakProvider, ee as actorRelativeBubbleCenter, d as bubbleBackgroundRegions, be as bubbleBodyCenterOffset, u as bubbleDirectionAliases, l as bubbleDirectionNames, Cr as bubbleRevealUnits, M as bubbleVisualStyles, ri as createBubbleComposition, x as defaultBubbleDistance, C as defaultBubbleOffset, f as defaultBubblePlacementInput, S as defaultBubbleTailLength, T as normalizeBubbleDistance, D as normalizeBubbleOffset, y as normalizeBubblePlacement, Er as normalizeBubbleReveal, E as normalizeBubbleTailLength, Se as renderBubbleSvg, kr as revealedBubbleText, Or as splitBubbleText, Sr as wrapText };
|