@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
|
@@ -3955,7 +3955,7 @@ function Sr(e) {
|
|
|
3955
3955
|
"sound"
|
|
3956
3956
|
]);
|
|
3957
3957
|
if (Object.keys(t).filter((e) => !n.has(e)).length > 0 || t.unit === void 0) throw TypeError("Bubble reveal has unknown or missing properties.");
|
|
3958
|
-
let r = xr(t.unit), i = t.delimiters ?? "
|
|
3958
|
+
let r = xr(t.unit), i = t.delimiters ?? " \r\n";
|
|
3959
3959
|
if (typeof i != "string" || i.length === 0) throw TypeError("Bubble WORD delimiters must be a non-empty string.");
|
|
3960
3960
|
let a = t.showDelimiters ?? !1;
|
|
3961
3961
|
if (typeof a != "boolean") throw TypeError("Bubble reveal showDelimiters must be boolean.");
|
|
@@ -3964,18 +3964,18 @@ function Sr(e) {
|
|
|
3964
3964
|
let s = t.intervalSeconds ?? 0;
|
|
3965
3965
|
if (typeof s != "number" || !Number.isFinite(s) || s < 0) throw TypeError("Bubble reveal intervalSeconds must be zero or greater.");
|
|
3966
3966
|
let c = t.sound;
|
|
3967
|
-
if (c !== void 0 && (typeof c != "string" || c.
|
|
3967
|
+
if (c !== void 0 && (typeof c != "string" || c.length === 0)) throw TypeError("Bubble reveal sound must be a non-empty asset name.");
|
|
3968
3968
|
return Object.freeze({
|
|
3969
3969
|
unit: r,
|
|
3970
3970
|
delimiters: i,
|
|
3971
3971
|
showDelimiters: a,
|
|
3972
3972
|
layout: o,
|
|
3973
3973
|
intervalSeconds: s,
|
|
3974
|
-
...c === void 0 ? {} : { sound: c
|
|
3974
|
+
...c === void 0 ? {} : { sound: c }
|
|
3975
3975
|
});
|
|
3976
3976
|
}
|
|
3977
3977
|
function Cr(e, t, n) {
|
|
3978
|
-
let r = new Set(
|
|
3978
|
+
let r = new Set(Array.from(t)), i = [], a = "";
|
|
3979
3979
|
for (let t of br(e)) a += t, r.has(t) && ((n || a.slice(0, -t.length).length > 0) && i.push(n ? a : a.slice(0, -t.length)), a = "");
|
|
3980
3980
|
return a.length > 0 && i.push(a), i.filter((e) => e.length > 0);
|
|
3981
3981
|
}
|
|
@@ -4044,27 +4044,31 @@ function jr(e, t) {
|
|
|
4044
4044
|
if (typeof e != "string" || e.trim().length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4045
4045
|
return e.trim();
|
|
4046
4046
|
}
|
|
4047
|
-
function Mr(e, t
|
|
4047
|
+
function Mr(e, t) {
|
|
4048
|
+
if (typeof e != "string" || e.length === 0) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be a non-empty string.`);
|
|
4049
|
+
return e;
|
|
4050
|
+
}
|
|
4051
|
+
function Nr(e, t, n) {
|
|
4048
4052
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4049
4053
|
if (Ar(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"}.`);
|
|
4050
|
-
let r = Object.freeze(e.frames.map((e, n) =>
|
|
4054
|
+
let r = Object.freeze(e.frames.map((e, n) => Mr(e, `${t}.frames[${n}]`))), i = e.frameIntervalSeconds;
|
|
4051
4055
|
if (typeof i != "number" || !Number.isFinite(i) || i <= 0) throw new Z("BUBBLE-COMPOSITION-001", `${t}.frameIntervalSeconds must be a positive finite number.`);
|
|
4052
4056
|
return Object.freeze({
|
|
4053
4057
|
frames: r,
|
|
4054
4058
|
frameIntervalSeconds: i
|
|
4055
4059
|
});
|
|
4056
4060
|
}
|
|
4057
|
-
function
|
|
4061
|
+
function Pr(e) {
|
|
4058
4062
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble portrait must be an object.");
|
|
4059
4063
|
Ar(e, ["base"], ["blink", "lipSync"], "Bubble portrait");
|
|
4060
|
-
let t = e.blink === void 0 ? void 0 :
|
|
4064
|
+
let t = e.blink === void 0 ? void 0 : Nr(e.blink, "Bubble portrait blink", 1), n = e.lipSync === void 0 ? void 0 : Nr(e.lipSync, "Bubble portrait lip-sync", 1);
|
|
4061
4065
|
return Object.freeze({
|
|
4062
|
-
base:
|
|
4066
|
+
base: Mr(e.base, "Bubble portrait base"),
|
|
4063
4067
|
...t === void 0 ? {} : { blink: t },
|
|
4064
4068
|
...n === void 0 ? {} : { lipSync: n }
|
|
4065
4069
|
});
|
|
4066
4070
|
}
|
|
4067
|
-
function
|
|
4071
|
+
function Fr(e, t) {
|
|
4068
4072
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", `${t} must be an object.`);
|
|
4069
4073
|
if (Ar(e, ["name"], [
|
|
4070
4074
|
"durationSeconds",
|
|
@@ -4098,7 +4102,7 @@ function Pr(e, t) {
|
|
|
4098
4102
|
...l === void 0 ? {} : { visualStyle: l }
|
|
4099
4103
|
});
|
|
4100
4104
|
}
|
|
4101
|
-
function
|
|
4105
|
+
function Ir(e) {
|
|
4102
4106
|
if (e === void 0) return;
|
|
4103
4107
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble audio must be an object.");
|
|
4104
4108
|
Ar(e, [], [
|
|
@@ -4113,11 +4117,11 @@ function Fr(e) {
|
|
|
4113
4117
|
"finish"
|
|
4114
4118
|
]) {
|
|
4115
4119
|
let r = e[n];
|
|
4116
|
-
r !== void 0 && (t[n] =
|
|
4120
|
+
r !== void 0 && (t[n] = Mr(r, `Bubble audio ${n}`));
|
|
4117
4121
|
}
|
|
4118
4122
|
return Object.freeze(t);
|
|
4119
4123
|
}
|
|
4120
|
-
function
|
|
4124
|
+
function Lr(e) {
|
|
4121
4125
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Bubble style must be an object.");
|
|
4122
4126
|
Ar(e, ["name", "textStyle"], [
|
|
4123
4127
|
"placement",
|
|
@@ -4134,13 +4138,13 @@ function Ir(e) {
|
|
|
4134
4138
|
"showAnimation",
|
|
4135
4139
|
"hideAnimation"
|
|
4136
4140
|
], "Bubble style");
|
|
4137
|
-
let t = e.portrait === void 0 ? void 0 :
|
|
4141
|
+
let t = e.portrait === void 0 ? void 0 : Pr(e.portrait), n = e.continueIndicator === void 0 ? void 0 : Nr(e.continueIndicator, "Bubble continue indicator", 2), r;
|
|
4138
4142
|
if (e.reveal !== void 0) try {
|
|
4139
4143
|
r = Sr(e.reveal);
|
|
4140
4144
|
} catch (e) {
|
|
4141
4145
|
throw new Z("BUBBLE-COMPOSITION-001", e instanceof Error ? e.message : "Bubble reveal is invalid.");
|
|
4142
4146
|
}
|
|
4143
|
-
let i =
|
|
4147
|
+
let i = Ir(e.audio), a = e.showAnimation === void 0 ? void 0 : Fr(e.showAnimation, "Bubble showAnimation"), o = e.hideAnimation === void 0 ? void 0 : Fr(e.hideAnimation, "Bubble hideAnimation"), s;
|
|
4144
4148
|
try {
|
|
4145
4149
|
s = _(e.placement ?? "up-right");
|
|
4146
4150
|
} catch (e) {
|
|
@@ -4178,13 +4182,13 @@ function Ir(e) {
|
|
|
4178
4182
|
...o === void 0 ? {} : { hideAnimation: o }
|
|
4179
4183
|
});
|
|
4180
4184
|
}
|
|
4181
|
-
function
|
|
4185
|
+
function Rr(e) {
|
|
4182
4186
|
if (e !== void 0) {
|
|
4183
4187
|
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.");
|
|
4184
4188
|
return e;
|
|
4185
4189
|
}
|
|
4186
4190
|
}
|
|
4187
|
-
function
|
|
4191
|
+
function zr(e) {
|
|
4188
4192
|
if (e !== void 0) {
|
|
4189
4193
|
if (!Q(e) || typeof e.playSound != "function") throw TypeError("Bubble audio capability must provide playSound.");
|
|
4190
4194
|
if (e.isRegistered !== void 0 && typeof e.isRegistered != "function") throw TypeError("Bubble audio capability isRegistered must be a function.");
|
|
@@ -4192,64 +4196,64 @@ function Rr(e) {
|
|
|
4192
4196
|
return e;
|
|
4193
4197
|
}
|
|
4194
4198
|
}
|
|
4195
|
-
function
|
|
4199
|
+
function Br(e) {
|
|
4196
4200
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", "Bubble image assets require an image capability. Provide options.imageResolver.");
|
|
4197
4201
|
return e;
|
|
4198
4202
|
}
|
|
4199
|
-
function
|
|
4203
|
+
function Vr(e) {
|
|
4200
4204
|
if (!Q(e) || typeof e.setText != "function" || typeof e.releaseTarget != "function") throw TypeError("Bubble SVG Text composition must provide setText and releaseTarget.");
|
|
4201
4205
|
return e;
|
|
4202
4206
|
}
|
|
4203
|
-
function
|
|
4207
|
+
function Hr() {
|
|
4204
4208
|
return Object.freeze({
|
|
4205
4209
|
setTimeout: (e, t) => globalThis.setTimeout(e, t),
|
|
4206
4210
|
clearTimeout: (e) => globalThis.clearTimeout(e)
|
|
4207
4211
|
});
|
|
4208
4212
|
}
|
|
4209
|
-
function
|
|
4213
|
+
function Ur(e) {
|
|
4210
4214
|
if (!Q(e) || typeof e.setTimeout != "function" || typeof e.clearTimeout != "function") throw TypeError("Bubble scheduler must provide setTimeout and clearTimeout.");
|
|
4211
4215
|
return e;
|
|
4212
4216
|
}
|
|
4213
|
-
function
|
|
4217
|
+
function Wr(e, t) {
|
|
4214
4218
|
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.`);
|
|
4215
4219
|
return e;
|
|
4216
4220
|
}
|
|
4217
|
-
function
|
|
4221
|
+
function Gr(e) {
|
|
4218
4222
|
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.");
|
|
4219
4223
|
return e;
|
|
4220
4224
|
}
|
|
4221
|
-
function
|
|
4225
|
+
function Kr(e, t) {
|
|
4222
4226
|
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.");
|
|
4223
4227
|
let n = e.targets;
|
|
4224
|
-
|
|
4228
|
+
Gr(n.text);
|
|
4225
4229
|
let r = /* @__PURE__ */ new Set(), i = (e, t) => {
|
|
4226
4230
|
let i = n[e];
|
|
4227
4231
|
if (!t && i === void 0) return;
|
|
4228
|
-
let a =
|
|
4232
|
+
let a = Wr(i, `Bubble surface ${e}`);
|
|
4229
4233
|
if (r.has(a.id)) throw new Z("BUBBLE-COMPOSITION-004", "Bubble image layers must use distinct target IDs.");
|
|
4230
4234
|
r.add(a.id);
|
|
4231
4235
|
};
|
|
4232
4236
|
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;
|
|
4233
4237
|
}
|
|
4234
|
-
function
|
|
4238
|
+
function qr(e, t) {
|
|
4235
4239
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble image capability is required for: ${t}. Provide options.imageResolver.`);
|
|
4236
4240
|
if (!e.isRegistered(t)) throw new Z("BUBBLE-COMPOSITION-003", `Bubble image asset is not registered: ${t}`);
|
|
4237
4241
|
if (!e.getMimeType(t).startsWith("image/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not an image: ${t}`);
|
|
4238
4242
|
}
|
|
4239
|
-
function
|
|
4243
|
+
function Jr(e, t) {
|
|
4240
4244
|
if (e === void 0) throw new Z("BUBBLE-COMPOSITION-006", `Bubble audio assets require an audio capability: ${t}. Provide options.audio.`);
|
|
4241
4245
|
if (e.isRegistered?.(t) === !1) throw new Z("BUBBLE-COMPOSITION-003", `Bubble audio asset is not registered: ${t}`);
|
|
4242
4246
|
let n = e.getMimeType?.(t);
|
|
4243
4247
|
if (n !== void 0 && !n.startsWith("audio/")) throw new Z("BUBBLE-COMPOSITION-003", `Bubble asset is not audio: ${t}`);
|
|
4244
4248
|
}
|
|
4245
|
-
function
|
|
4249
|
+
function Yr(e) {
|
|
4246
4250
|
return [...e.portrait === void 0 ? [] : [
|
|
4247
4251
|
e.portrait.base,
|
|
4248
4252
|
...e.portrait.blink?.frames ?? [],
|
|
4249
4253
|
...e.portrait.lipSync?.frames ?? []
|
|
4250
4254
|
], ...e.continueIndicator?.frames ?? []];
|
|
4251
4255
|
}
|
|
4252
|
-
function
|
|
4256
|
+
function Xr(e, t, n) {
|
|
4253
4257
|
if (t.maxWidth === void 0) return e;
|
|
4254
4258
|
if (typeof n.measureText != "function") throw new Z("BUBBLE-COMPOSITION-007", "Bubble style maxWidth requires the text capability measureText method.");
|
|
4255
4259
|
return vr({
|
|
@@ -4262,11 +4266,11 @@ function Yr(e, t, n) {
|
|
|
4262
4266
|
}) ?? 0
|
|
4263
4267
|
}).lines.map(({ text: e }) => e).join("\n");
|
|
4264
4268
|
}
|
|
4265
|
-
function
|
|
4269
|
+
function Zr(e, t) {
|
|
4266
4270
|
if (e.length === 1) throw e[0];
|
|
4267
4271
|
if (e.length > 1) throw AggregateError(e, t);
|
|
4268
4272
|
}
|
|
4269
|
-
function
|
|
4273
|
+
function Qr(e) {
|
|
4270
4274
|
let t = !1, n = 0, r = 0, i, a = Promise.resolve(), o = async (t) => {
|
|
4271
4275
|
let n = e.animation.frames[t];
|
|
4272
4276
|
n !== void 0 && await e.imageResolver.applyToTarget(n, e.target);
|
|
@@ -4301,7 +4305,7 @@ function Zr(e) {
|
|
|
4301
4305
|
}
|
|
4302
4306
|
});
|
|
4303
4307
|
}
|
|
4304
|
-
function
|
|
4308
|
+
function $r(e) {
|
|
4305
4309
|
if (!Q(e)) throw new Z("BUBBLE-COMPOSITION-001", "Show bubble input must be an object.");
|
|
4306
4310
|
if (Ar(e, [
|
|
4307
4311
|
"actor",
|
|
@@ -4329,12 +4333,12 @@ function Qr(e) {
|
|
|
4329
4333
|
...n === void 0 ? {} : { reveal: n }
|
|
4330
4334
|
};
|
|
4331
4335
|
}
|
|
4332
|
-
function
|
|
4336
|
+
function ei(e) {
|
|
4333
4337
|
if (!Q(e)) throw TypeError("Bubble composition options must be an object.");
|
|
4334
|
-
let t =
|
|
4338
|
+
let t = Rr(e.imageResolver), n = zr(e.audio), r = Vr(e.svgText);
|
|
4335
4339
|
if (typeof e.createSurface != "function") throw TypeError("Bubble composition createSurface must be a function.");
|
|
4336
4340
|
if (e.onAnimationError !== void 0 && typeof e.onAnimationError != "function") throw TypeError("Bubble composition onAnimationError must be a function.");
|
|
4337
|
-
let i =
|
|
4341
|
+
let i = Ur(e.scheduler ?? Hr()), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = !1, l = () => {
|
|
4338
4342
|
if (c) throw new Z("BUBBLE-COMPOSITION-005", "Bubble composition has been disposed.");
|
|
4339
4343
|
}, u = async (e, t) => {
|
|
4340
4344
|
let n = (s.get(e) ?? Promise.resolve()).catch(() => void 0).then(t);
|
|
@@ -4354,8 +4358,8 @@ function $r(e) {
|
|
|
4354
4358
|
reveal: s.reveal
|
|
4355
4359
|
}));
|
|
4356
4360
|
let d = s.text, f = (e) => {
|
|
4357
|
-
let n = new Set(
|
|
4358
|
-
for (let e of n)
|
|
4361
|
+
let n = new Set(Yr(e)), r = n.size === 0 ? void 0 : Br(t);
|
|
4362
|
+
for (let e of n) qr(r, e);
|
|
4359
4363
|
return r;
|
|
4360
4364
|
}, p = f(u);
|
|
4361
4365
|
for (let e of [
|
|
@@ -4363,13 +4367,13 @@ function $r(e) {
|
|
|
4363
4367
|
u.audio?.reveal,
|
|
4364
4368
|
u.audio?.finish,
|
|
4365
4369
|
u.reveal?.sound
|
|
4366
|
-
]) e !== void 0 &&
|
|
4370
|
+
]) e !== void 0 && Jr(n, e);
|
|
4367
4371
|
let m = async (e, t = !1) => {
|
|
4368
4372
|
e !== void 0 && n !== void 0 && await n.playSound(e, { untilDone: t });
|
|
4369
4373
|
}, h = async (e, t, n) => {
|
|
4370
|
-
let r =
|
|
4374
|
+
let r = Yr(e).length === 0 ? void 0 : Br(t), i = [];
|
|
4371
4375
|
if (e.portrait) {
|
|
4372
|
-
let t =
|
|
4376
|
+
let t = Br(r);
|
|
4373
4377
|
i.push(Promise.resolve(t.applyToTarget(e.portrait.base, n.targets.portraitBase)));
|
|
4374
4378
|
let a = e.portrait.blink?.frames[0];
|
|
4375
4379
|
a !== void 0 && i.push(Promise.resolve(t.applyToTarget(a, n.targets.portraitBlink)));
|
|
@@ -4378,33 +4382,33 @@ function $r(e) {
|
|
|
4378
4382
|
}
|
|
4379
4383
|
let a = e.continueIndicator?.frames[0];
|
|
4380
4384
|
if (a !== void 0) {
|
|
4381
|
-
let e =
|
|
4385
|
+
let e = Br(r);
|
|
4382
4386
|
i.push(Promise.resolve(e.applyToTarget(a, n.targets.continueIndicator)));
|
|
4383
4387
|
}
|
|
4384
4388
|
await Promise.all(i);
|
|
4385
4389
|
}, g = (t, n, r) => {
|
|
4386
|
-
x = t.portrait?.blink === void 0 ? void 0 :
|
|
4390
|
+
x = t.portrait?.blink === void 0 ? void 0 : Qr({
|
|
4387
4391
|
actorKey: s.actorKey,
|
|
4388
4392
|
layer: "portraitBlink",
|
|
4389
4393
|
animation: t.portrait.blink,
|
|
4390
4394
|
target: r.targets.portraitBlink,
|
|
4391
|
-
imageResolver:
|
|
4395
|
+
imageResolver: Br(n),
|
|
4392
4396
|
scheduler: i,
|
|
4393
4397
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4394
|
-
}), S = t.portrait?.lipSync === void 0 ? void 0 :
|
|
4398
|
+
}), S = t.portrait?.lipSync === void 0 ? void 0 : Qr({
|
|
4395
4399
|
actorKey: s.actorKey,
|
|
4396
4400
|
layer: "portraitLipSync",
|
|
4397
4401
|
animation: t.portrait.lipSync,
|
|
4398
4402
|
target: r.targets.portraitLipSync,
|
|
4399
|
-
imageResolver:
|
|
4403
|
+
imageResolver: Br(n),
|
|
4400
4404
|
scheduler: i,
|
|
4401
4405
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4402
|
-
}), C = t.continueIndicator === void 0 ? void 0 :
|
|
4406
|
+
}), C = t.continueIndicator === void 0 ? void 0 : Qr({
|
|
4403
4407
|
actorKey: s.actorKey,
|
|
4404
4408
|
layer: "continueIndicator",
|
|
4405
4409
|
animation: t.continueIndicator,
|
|
4406
4410
|
target: r.targets.continueIndicator,
|
|
4407
|
-
imageResolver:
|
|
4411
|
+
imageResolver: Br(n),
|
|
4408
4412
|
scheduler: i,
|
|
4409
4413
|
...e.onAnimationError === void 0 ? {} : { onError: e.onAnimationError }
|
|
4410
4414
|
});
|
|
@@ -4412,13 +4416,13 @@ function $r(e) {
|
|
|
4412
4416
|
_ && await _.close();
|
|
4413
4417
|
let v, y = !1, b = !1, x, S, C, w = u.reveal, T = w ? wr(s.text, w) : Object.freeze([s.text]), E = w ? Math.min(1, T.length) : 1, D, O = 0;
|
|
4414
4418
|
try {
|
|
4415
|
-
v =
|
|
4419
|
+
v = Kr(await e.createSurface(Object.freeze({
|
|
4416
4420
|
actor: s.actor,
|
|
4417
4421
|
actorKey: s.actorKey,
|
|
4418
4422
|
kind: s.kind,
|
|
4419
4423
|
style: u
|
|
4420
4424
|
})), u);
|
|
4421
|
-
let t =
|
|
4425
|
+
let t = Xr(s.text, u, r);
|
|
4422
4426
|
w?.layout === "RESERVED" && (r.setText({
|
|
4423
4427
|
styleName: u.textStyle,
|
|
4424
4428
|
target: v.targets.text,
|
|
@@ -4426,7 +4430,7 @@ function $r(e) {
|
|
|
4426
4430
|
}), v.captureTextLayout?.()), r.setText({
|
|
4427
4431
|
styleName: u.textStyle,
|
|
4428
4432
|
target: v.targets.text,
|
|
4429
|
-
text:
|
|
4433
|
+
text: Xr(w ? Tr(T, E) : s.text, u, r)
|
|
4430
4434
|
}), y = !0, await h(u, p, v), g(u, p, v);
|
|
4431
4435
|
let a = "idle", c = !1, l = Promise.resolve(), _ = async () => {
|
|
4432
4436
|
if (!v) return;
|
|
@@ -4434,7 +4438,7 @@ function $r(e) {
|
|
|
4434
4438
|
r.setText({
|
|
4435
4439
|
styleName: u.textStyle,
|
|
4436
4440
|
target: v.targets.text,
|
|
4437
|
-
text:
|
|
4441
|
+
text: Xr(e, u, r)
|
|
4438
4442
|
}), await v.show();
|
|
4439
4443
|
}, k = () => {
|
|
4440
4444
|
O += 1, D !== void 0 && i.clearTimeout(D), D = void 0;
|
|
@@ -4464,7 +4468,7 @@ function $r(e) {
|
|
|
4464
4468
|
v && (k(), d = e, w ? (T = wr(e, w), E = Math.min(1, T.length), w.layout === "RESERVED" && (r.setText({
|
|
4465
4469
|
styleName: u.textStyle,
|
|
4466
4470
|
target: v.targets.text,
|
|
4467
|
-
text:
|
|
4471
|
+
text: Xr(e, u, r)
|
|
4468
4472
|
}), v.captureTextLayout?.()), await _(), j()) : await _());
|
|
4469
4473
|
}), l) : Promise.reject(new Z("BUBBLE-COMPOSITION-001", "Bubble text must be a string."));
|
|
4470
4474
|
},
|
|
@@ -4472,20 +4476,20 @@ function $r(e) {
|
|
|
4472
4476
|
if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
4473
4477
|
let t;
|
|
4474
4478
|
try {
|
|
4475
|
-
t =
|
|
4479
|
+
t = Lr(e);
|
|
4476
4480
|
} catch (e) {
|
|
4477
4481
|
return Promise.reject(e);
|
|
4478
4482
|
}
|
|
4479
4483
|
return l = l.then(async () => {
|
|
4480
4484
|
if (!v) return;
|
|
4481
|
-
|
|
4485
|
+
Kr(v, t);
|
|
4482
4486
|
let e = f(t);
|
|
4483
4487
|
for (let e of [
|
|
4484
4488
|
t.audio?.voice,
|
|
4485
4489
|
t.audio?.reveal,
|
|
4486
4490
|
t.audio?.finish,
|
|
4487
4491
|
t.reveal?.sound
|
|
4488
|
-
]) e !== void 0 &&
|
|
4492
|
+
]) e !== void 0 && Jr(n, e);
|
|
4489
4493
|
await Promise.all([
|
|
4490
4494
|
x?.stop(),
|
|
4491
4495
|
S?.stop(),
|
|
@@ -4493,11 +4497,11 @@ function $r(e) {
|
|
|
4493
4497
|
]), await h(t, e, v), await v.updateStyle(t), u = t, w = t.reveal, T = w ? wr(d, w) : Object.freeze([d]), E = w ? Math.min(1, T.length) : 1, k(), w?.layout === "RESERVED" && (r.setText({
|
|
4494
4498
|
styleName: t.textStyle,
|
|
4495
4499
|
target: v.targets.text,
|
|
4496
|
-
text:
|
|
4500
|
+
text: Xr(d, t, r)
|
|
4497
4501
|
}), v.captureTextLayout?.()), r.setText({
|
|
4498
4502
|
styleName: t.textStyle,
|
|
4499
4503
|
target: v.targets.text,
|
|
4500
|
-
text:
|
|
4504
|
+
text: Xr(d, t, r)
|
|
4501
4505
|
}), g(t, e, v), await Promise.all([
|
|
4502
4506
|
v.setLayerVisible("portraitBase", t.portrait !== void 0),
|
|
4503
4507
|
v.setLayerVisible("portraitBlink", t.portrait?.blink !== void 0),
|
|
@@ -4533,7 +4537,7 @@ function $r(e) {
|
|
|
4533
4537
|
}), T = wr(d, w), E = Math.min(1, T.length), w.layout === "RESERVED" && v && (r.setText({
|
|
4534
4538
|
styleName: u.textStyle,
|
|
4535
4539
|
target: v.targets.text,
|
|
4536
|
-
text:
|
|
4540
|
+
text: Xr(d, u, r)
|
|
4537
4541
|
}), v.captureTextLayout?.())), w) for (; await A(););
|
|
4538
4542
|
let n = e.condition;
|
|
4539
4543
|
if (n === void 0 && t === 0) {
|
|
@@ -4567,7 +4571,7 @@ function $r(e) {
|
|
|
4567
4571
|
if (c) return Promise.reject(new Z("BUBBLE-COMPOSITION-005", `Bubble is already closed: ${s.actorKey}`));
|
|
4568
4572
|
let t;
|
|
4569
4573
|
try {
|
|
4570
|
-
t =
|
|
4574
|
+
t = Fr(e, "Bubble motion");
|
|
4571
4575
|
} catch (e) {
|
|
4572
4576
|
return Promise.reject(e);
|
|
4573
4577
|
}
|
|
@@ -4610,7 +4614,7 @@ function $r(e) {
|
|
|
4610
4614
|
} catch (t) {
|
|
4611
4615
|
e.push(t);
|
|
4612
4616
|
}
|
|
4613
|
-
o.get(s.actorKey) === N && o.delete(s.actorKey),
|
|
4617
|
+
o.get(s.actorKey) === N && o.delete(s.actorKey), Zr(e, `Failed to close bubble: ${s.actorKey}`);
|
|
4614
4618
|
}
|
|
4615
4619
|
});
|
|
4616
4620
|
return o.set(s.actorKey, N), j(), u.showAnimation !== void 0 && await N.animate(u.showAnimation), N;
|
|
@@ -4642,7 +4646,7 @@ function $r(e) {
|
|
|
4642
4646
|
return Object.freeze({
|
|
4643
4647
|
defineStyle(e) {
|
|
4644
4648
|
l();
|
|
4645
|
-
let t =
|
|
4649
|
+
let t = Lr(e);
|
|
4646
4650
|
a.set(t.name, t);
|
|
4647
4651
|
},
|
|
4648
4652
|
hasActiveBubble(e) {
|
|
@@ -4650,7 +4654,7 @@ function $r(e) {
|
|
|
4650
4654
|
},
|
|
4651
4655
|
async show(e) {
|
|
4652
4656
|
l();
|
|
4653
|
-
let t =
|
|
4657
|
+
let t = $r(e);
|
|
4654
4658
|
return u(t.actorKey, () => d(t));
|
|
4655
4659
|
},
|
|
4656
4660
|
releaseTarget(e) {
|
|
@@ -4661,29 +4665,29 @@ function $r(e) {
|
|
|
4661
4665
|
});
|
|
4662
4666
|
},
|
|
4663
4667
|
async releaseAll() {
|
|
4664
|
-
l(), await Promise.allSettled([...s.values()]),
|
|
4668
|
+
l(), await Promise.allSettled([...s.values()]), Zr((await Promise.allSettled([...o.values()].map((e) => e.close()))).flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to release all bubbles");
|
|
4665
4669
|
},
|
|
4666
4670
|
async dispose() {
|
|
4667
4671
|
if (c) return;
|
|
4668
4672
|
c = !0, await Promise.allSettled([...s.values()]);
|
|
4669
4673
|
let e = await Promise.allSettled([...o.values()].map((e) => e.close()));
|
|
4670
|
-
a.clear(),
|
|
4674
|
+
a.clear(), Zr(e.flatMap((e) => e.status === "rejected" ? [e.reason] : []), "Failed to dispose bubble composition");
|
|
4671
4675
|
}
|
|
4672
4676
|
});
|
|
4673
4677
|
}
|
|
4674
4678
|
//#endregion
|
|
4675
4679
|
//#region src/turbowarp-adapter.ts
|
|
4676
|
-
var
|
|
4680
|
+
var ti = "sprite", ni = 96, ri = 18, ii = 8, ai = 16, oi = 0, $ = class extends Error {
|
|
4677
4681
|
code;
|
|
4678
4682
|
constructor(e, t) {
|
|
4679
4683
|
super(t), this.name = "BubbleRuntimeAdapterError", this.code = e;
|
|
4680
4684
|
}
|
|
4681
4685
|
};
|
|
4682
|
-
function
|
|
4686
|
+
function si(e) {
|
|
4683
4687
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
4684
4688
|
}
|
|
4685
|
-
function
|
|
4686
|
-
if (!
|
|
4689
|
+
function ci(e) {
|
|
4690
|
+
if (!si(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp renderer.");
|
|
4687
4691
|
let t = [
|
|
4688
4692
|
"createSVGSkin",
|
|
4689
4693
|
"createDrawable",
|
|
@@ -4699,15 +4703,15 @@ function si(e) {
|
|
|
4699
4703
|
if (t.some((t) => typeof e[t] != "function")) throw new $("BUBBLE-RUNTIME-001", `Bubble renderer must provide ${t.join(", ")}.`);
|
|
4700
4704
|
return e;
|
|
4701
4705
|
}
|
|
4702
|
-
function ci(e) {
|
|
4703
|
-
if (!oi(e) || typeof e.isLoaded != "function" || typeof e.getAssetMimeType != "function" || typeof e.resolveSkin != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-manager or provide options.imageResolver before using image features.");
|
|
4704
|
-
return e;
|
|
4705
|
-
}
|
|
4706
4706
|
function li(e) {
|
|
4707
|
-
if (!
|
|
4707
|
+
if (!si(e) || typeof e.isLoaded != "function" || typeof e.getAssetMimeType != "function" || typeof e.resolveSkin != "function") throw new $("BUBBLE-RUNTIME-002", "Bubble image assets require an imageResolver capability. Load @kubohiroya/turbowarp-asset-manager or provide options.imageResolver before using image features.");
|
|
4708
4708
|
return e;
|
|
4709
4709
|
}
|
|
4710
4710
|
function ui(e) {
|
|
4711
|
+
if (!si(e) || typeof e.setText != "function" || typeof e.releaseTextActor != "function") throw new $("BUBBLE-RUNTIME-003", "Bubble requires SVG Text. Load @kubohiroya/turbowarp-svg-text before using Bubble blocks.");
|
|
4712
|
+
return e;
|
|
4713
|
+
}
|
|
4714
|
+
function di(e) {
|
|
4711
4715
|
try {
|
|
4712
4716
|
let t = e.getBoundsForBubble?.();
|
|
4713
4717
|
if (t && [
|
|
@@ -4725,7 +4729,7 @@ function ui(e) {
|
|
|
4725
4729
|
top: n
|
|
4726
4730
|
};
|
|
4727
4731
|
}
|
|
4728
|
-
function
|
|
4732
|
+
function fi(e, t, n) {
|
|
4729
4733
|
let r = e.getCurrentSkinSize(t.drawableID);
|
|
4730
4734
|
if (!Array.isArray(r) || r.length < 2) return n;
|
|
4731
4735
|
let i = Number(r[0]), a = Number(r[1]);
|
|
@@ -4734,11 +4738,11 @@ function di(e, t, n) {
|
|
|
4734
4738
|
height: a
|
|
4735
4739
|
};
|
|
4736
4740
|
}
|
|
4737
|
-
function
|
|
4741
|
+
function pi(e) {
|
|
4738
4742
|
return Math.max(0, Math.min(1, e));
|
|
4739
4743
|
}
|
|
4740
|
-
function
|
|
4741
|
-
let n =
|
|
4744
|
+
function mi(e, t) {
|
|
4745
|
+
let n = pi(e);
|
|
4742
4746
|
switch (t) {
|
|
4743
4747
|
case "linear": return n;
|
|
4744
4748
|
case "easeIn": return n * n;
|
|
@@ -4747,14 +4751,14 @@ function pi(e, t) {
|
|
|
4747
4751
|
default: return n;
|
|
4748
4752
|
}
|
|
4749
4753
|
}
|
|
4750
|
-
function
|
|
4754
|
+
function hi(e, t, n) {
|
|
4751
4755
|
let r = Math.max(0, t * 1e3);
|
|
4752
4756
|
return r === 0 ? (n(1), Promise.resolve()) : new Promise((t, i) => {
|
|
4753
4757
|
let a = 0, o, s = () => {
|
|
4754
4758
|
let c = Math.min(16, r - a);
|
|
4755
4759
|
a += c;
|
|
4756
4760
|
try {
|
|
4757
|
-
n(
|
|
4761
|
+
n(pi(a / r));
|
|
4758
4762
|
} catch (t) {
|
|
4759
4763
|
o !== void 0 && e.clearTimeout(o), i(t);
|
|
4760
4764
|
return;
|
|
@@ -4768,8 +4772,8 @@ function mi(e, t, n) {
|
|
|
4768
4772
|
o = e.setTimeout(s, Math.min(16, r));
|
|
4769
4773
|
});
|
|
4770
4774
|
}
|
|
4771
|
-
function
|
|
4772
|
-
let i =
|
|
4775
|
+
function gi(e, t, n, r = 1) {
|
|
4776
|
+
let i = fi(e, t, {
|
|
4773
4777
|
width: n,
|
|
4774
4778
|
height: n
|
|
4775
4779
|
}), a = Math.min(n / i.width, n / i.height) * r;
|
|
@@ -4778,29 +4782,29 @@ function hi(e, t, n, r = 1) {
|
|
|
4778
4782
|
height: i.height * a
|
|
4779
4783
|
};
|
|
4780
4784
|
}
|
|
4781
|
-
function
|
|
4785
|
+
function _i(e, t, n) {
|
|
4782
4786
|
return n < t ? (t + n) / 2 : Math.min(n, Math.max(t, e));
|
|
4783
4787
|
}
|
|
4784
|
-
function
|
|
4788
|
+
function vi(e, t, n, r, i) {
|
|
4785
4789
|
let a = t + r * 2, o = n + i * 2;
|
|
4786
4790
|
return e.replace(/<svg\b[^>]*>/u, (e) => e.replace(/\bwidth="[^"]*"/u, `width="${a}"`).replace(/\bheight="[^"]*"/u, `height="${o}"`).replace(/\bviewBox="[^"]*"/u, `viewBox="${-r} ${-i} ${a} ${o}"`));
|
|
4787
4791
|
}
|
|
4788
|
-
function
|
|
4792
|
+
function yi(e) {
|
|
4789
4793
|
let t = v(e);
|
|
4790
4794
|
return (Math.atan2(-t.x, -t.y) * 180 / Math.PI % 360 + 360) % 360;
|
|
4791
4795
|
}
|
|
4792
|
-
function
|
|
4793
|
-
let a = e.renderer, o =
|
|
4794
|
-
|
|
4796
|
+
function bi(e, t, n, r, i) {
|
|
4797
|
+
let a = e.renderer, o = oi;
|
|
4798
|
+
oi += 1;
|
|
4795
4799
|
let s = [], c, l = (e) => {
|
|
4796
|
-
let t = a.createDrawable(
|
|
4800
|
+
let t = a.createDrawable(ti);
|
|
4797
4801
|
if (!Number.isInteger(t) || t < 0) throw new $("BUBBLE-RUNTIME-001", `TurboWarp did not create the Bubble ${e} drawable.`);
|
|
4798
4802
|
let r = Object.freeze({
|
|
4799
4803
|
id: `bubble:${n}:${o}:${e}`,
|
|
4800
4804
|
isStage: !1,
|
|
4801
4805
|
drawableID: t
|
|
4802
4806
|
});
|
|
4803
|
-
return s.push(r), a.updateDrawableVisible(t, !1), a.setDrawableOrder?.(t, Infinity,
|
|
4807
|
+
return s.push(r), a.updateDrawableVisible(t, !1), a.setDrawableOrder?.(t, Infinity, ti), r;
|
|
4804
4808
|
};
|
|
4805
4809
|
try {
|
|
4806
4810
|
let n = l("body"), o = r.portrait ? l("portrait-base") : void 0, u = r.portrait?.blink ? l("portrait-blink") : void 0, d = r.portrait?.lipSync ? l("portrait-lip-sync") : void 0, f = l("text"), p = r.continueIndicator ? l("continue-indicator") : void 0, m = Object.freeze({
|
|
@@ -4825,7 +4829,7 @@ function yi(e, t, n, r, i) {
|
|
|
4825
4829
|
A(), e.requestRedraw?.();
|
|
4826
4830
|
}, M = () => {
|
|
4827
4831
|
if (y) return;
|
|
4828
|
-
let e = x.placement.basis === "actor" ? x.offset.scalePercent / 100 : 1, r = S ??
|
|
4832
|
+
let e = x.placement.basis === "actor" ? x.offset.scalePercent / 100 : 1, r = S ?? fi(a, f, {
|
|
4829
4833
|
width: 180,
|
|
4830
4834
|
height: 48
|
|
4831
4835
|
});
|
|
@@ -4833,19 +4837,19 @@ function yi(e, t, n, r, i) {
|
|
|
4833
4837
|
let i = {
|
|
4834
4838
|
width: r.width * e,
|
|
4835
4839
|
height: r.height * e
|
|
4836
|
-
}, s = o ?
|
|
4840
|
+
}, s = o ? gi(a, o, ni, e) : {
|
|
4837
4841
|
width: 0,
|
|
4838
4842
|
height: 0
|
|
4839
4843
|
};
|
|
4840
|
-
for (let t of [u, d]) t &&
|
|
4841
|
-
let l = p ?
|
|
4844
|
+
for (let t of [u, d]) t && gi(a, t, ni, e);
|
|
4845
|
+
let l = p ? gi(a, p, ri, e) : {
|
|
4842
4846
|
width: 0,
|
|
4843
4847
|
height: 0
|
|
4844
|
-
}, m = s.width + (o ?
|
|
4845
|
-
if (x.placement.basis === "background") I = 0, L = x.placement.region === "HEADER_LIKE" ? P -
|
|
4848
|
+
}, m = s.width + (o ? ii * e : 0) + i.width, h = Math.max(s.height, i.height), g = m / e + 48, _ = h / e + 48, v = m, E = h, D = a.getNativeSize(), O = Array.isArray(D) && Number(D[0]) > 0 ? Number(D[0]) : 480, M = Array.isArray(D) && Number(D[1]) > 0 ? Number(D[1]) : 360, N = -O / 2, ee = O / 2, P = M / 2, te = -M / 2, ne = N + v / 2, re = ee - v / 2, ie = te + E / 2, F = P - E / 2, I, L;
|
|
4849
|
+
if (x.placement.basis === "background") I = 0, L = x.placement.region === "HEADER_LIKE" ? P - ai - E / 2 : x.placement.region === "FOOTER_LIKE" ? te + ai + E / 2 : 0;
|
|
4846
4850
|
else {
|
|
4847
4851
|
let e = w({
|
|
4848
|
-
bounds:
|
|
4852
|
+
bounds: di(t),
|
|
4849
4853
|
bubbleWidth: v,
|
|
4850
4854
|
bubbleHeight: E,
|
|
4851
4855
|
direction: x.placement.direction,
|
|
@@ -4855,8 +4859,8 @@ function yi(e, t, n, r, i) {
|
|
|
4855
4859
|
});
|
|
4856
4860
|
I = e.x, L = e.y;
|
|
4857
4861
|
}
|
|
4858
|
-
I =
|
|
4859
|
-
let R = x.placement.basis === "actor" ?
|
|
4862
|
+
I = _i(I, ne, re), L = _i(L, ie, F);
|
|
4863
|
+
let R = x.placement.basis === "actor" ? yi(x.placement.direction) : null, ae = x.placement.basis === "actor" ? [
|
|
4860
4864
|
x.offset.x,
|
|
4861
4865
|
x.offset.y,
|
|
4862
4866
|
x.offset.scalePercent
|
|
@@ -4886,7 +4890,7 @@ function yi(e, t, n, r, i) {
|
|
|
4886
4890
|
shapeTransition: k
|
|
4887
4891
|
});
|
|
4888
4892
|
if (le !== b) {
|
|
4889
|
-
let e =
|
|
4893
|
+
let e = vi(ge({
|
|
4890
4894
|
style: x.visualStyle,
|
|
4891
4895
|
lines: [],
|
|
4892
4896
|
width: g,
|
|
@@ -4907,17 +4911,17 @@ function yi(e, t, n, r, i) {
|
|
|
4907
4911
|
c = t, b = le, r !== void 0 && a.destroySkin(r);
|
|
4908
4912
|
}
|
|
4909
4913
|
a.updateDrawableScale(n.drawableID, [100, 100]), a.updateDrawablePosition(n.drawableID, [I - oe.x, L + oe.y]);
|
|
4910
|
-
let ue = I - m / 2, de = ue + s.width / 2, fe = ue + s.width + (o ?
|
|
4914
|
+
let ue = I - m / 2, de = ue + s.width / 2, fe = ue + s.width + (o ? ii * e : 0) + i.width / 2;
|
|
4911
4915
|
for (let e of [
|
|
4912
4916
|
o,
|
|
4913
4917
|
u,
|
|
4914
4918
|
d
|
|
4915
4919
|
]) e && a.updateDrawablePosition(e.drawableID, [de, L]);
|
|
4916
|
-
a.updateDrawablePosition(f.drawableID, [fe, L]), p && a.updateDrawablePosition(p.drawableID, [fe + i.width / 2 - l.width / 2 -
|
|
4920
|
+
a.updateDrawablePosition(f.drawableID, [fe, L]), p && a.updateDrawablePosition(p.drawableID, [fe + i.width / 2 - l.width / 2 - ii * e, L - i.height / 2 + l.height / 2 + ii * e]);
|
|
4917
4921
|
let pe = (e, t) => {
|
|
4918
4922
|
e && C.set(e.drawableID, t);
|
|
4919
4923
|
};
|
|
4920
|
-
pe(n, [I - oe.x, L + oe.y]), pe(f, [fe, L]), pe(o, [de, L]), pe(u, [de, L]), pe(d, [de, L]), T.set(n.drawableID, [100, 100]), T.set(f.drawableID, [e * 100, e * 100]), o && T.set(o.drawableID, [e * 100, e * 100]), u && T.set(u.drawableID, [e * 100, e * 100]), d && T.set(d.drawableID, [e * 100, e * 100]), p && T.set(p.drawableID, [e * 100, e * 100]), p && pe(p, [fe + i.width / 2 - l.width / 2 -
|
|
4924
|
+
pe(n, [I - oe.x, L + oe.y]), pe(f, [fe, L]), pe(o, [de, L]), pe(u, [de, L]), pe(d, [de, L]), T.set(n.drawableID, [100, 100]), T.set(f.drawableID, [e * 100, e * 100]), o && T.set(o.drawableID, [e * 100, e * 100]), u && T.set(u.drawableID, [e * 100, e * 100]), d && T.set(d.drawableID, [e * 100, e * 100]), p && T.set(p.drawableID, [e * 100, e * 100]), p && pe(p, [fe + i.width / 2 - l.width / 2 - ii * e, L - i.height / 2 + l.height / 2 + ii * e]), A(), j();
|
|
4921
4925
|
}, N = t.onTargetVisualChange, ee = (e) => {
|
|
4922
4926
|
N?.(e), M();
|
|
4923
4927
|
};
|
|
@@ -4934,7 +4938,7 @@ function yi(e, t, n, r, i) {
|
|
|
4934
4938
|
n && !r ? t.onTargetVisualChange === ee && (t.onTargetVisualChange = N ?? null) : !n && r && (t.onTargetVisualChange = ee), M();
|
|
4935
4939
|
},
|
|
4936
4940
|
captureTextLayout() {
|
|
4937
|
-
y || (S =
|
|
4941
|
+
y || (S = fi(a, f, {
|
|
4938
4942
|
width: 180,
|
|
4939
4943
|
height: 48
|
|
4940
4944
|
}), M());
|
|
@@ -4946,11 +4950,11 @@ function yi(e, t, n, r, i) {
|
|
|
4946
4950
|
if (y) return;
|
|
4947
4951
|
let t = Math.max(0, e.durationSeconds ?? 0), n = () => {
|
|
4948
4952
|
y || (A(), j());
|
|
4949
|
-
}, r = (t) =>
|
|
4953
|
+
}, r = (t) => mi(t, e.ease ?? "easeInOut");
|
|
4950
4954
|
if (e.name === "fadeIn" || e.name === "floatIn" || e.name === "zoomIn" || e.name === "riseUp") {
|
|
4951
4955
|
_ = !0;
|
|
4952
4956
|
let a = e.name === "floatIn" || e.name === "riseUp" ? [0, 16] : [0, 0], o = e.name === "zoomIn" ? .01 : 1;
|
|
4953
|
-
E = a, D = o, O = e.name === "fadeIn" ? 0 : 1, n(), await
|
|
4957
|
+
E = a, D = o, O = e.name === "fadeIn" ? 0 : 1, n(), await hi(i, t, (t) => {
|
|
4954
4958
|
let i = r(t);
|
|
4955
4959
|
E = [a[0] * (1 - i), a[1] * (1 - i)], D = o + (1 - o) * i, O = e.name === "fadeIn" ? i : 1, n();
|
|
4956
4960
|
}), E = [0, 0], D = 1, O = 1, M();
|
|
@@ -4958,7 +4962,7 @@ function yi(e, t, n, r, i) {
|
|
|
4958
4962
|
}
|
|
4959
4963
|
if (e.name === "fadeOut" || e.name === "floatOut" || e.name === "zoomOut" || e.name === "sink") {
|
|
4960
4964
|
let a = e.name === "floatOut" || e.name === "sink" ? [0, -16] : [0, 0], o = e.name === "zoomOut" ? .01 : 1;
|
|
4961
|
-
E = [0, 0], D = 1, O = 1, n(), await
|
|
4965
|
+
E = [0, 0], D = 1, O = 1, n(), await hi(i, t, (t) => {
|
|
4962
4966
|
let i = r(t);
|
|
4963
4967
|
E = [a[0] * i, a[1] * i], D = 1 + (o - 1) * i, O = e.name === "fadeOut" ? 1 - i : 1, n();
|
|
4964
4968
|
}), E = a, D = o, O = e.name === "fadeOut" ? 0 : 1, n(), _ = !1, j(), E = [0, 0], D = 1, O = 1;
|
|
@@ -4966,7 +4970,7 @@ function yi(e, t, n, r, i) {
|
|
|
4966
4970
|
}
|
|
4967
4971
|
if (e.name === "shake") {
|
|
4968
4972
|
let a = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : a * .08, s = v(typeof e.direction == "number" ? e.direction : e.direction ?? "right") ?? v("right");
|
|
4969
|
-
E = [0, 0], await
|
|
4973
|
+
E = [0, 0], await hi(i, o, (e) => {
|
|
4970
4974
|
let t = r(e) * a * Math.PI * 2, i = Math.sin(t) * 5;
|
|
4971
4975
|
E = [s.x * i, s.y * i], n();
|
|
4972
4976
|
}), E = [0, 0], M();
|
|
@@ -4974,7 +4978,7 @@ function yi(e, t, n, r, i) {
|
|
|
4974
4978
|
}
|
|
4975
4979
|
if (e.name === "explode") {
|
|
4976
4980
|
let a = Math.max(1, Math.floor(e.count ?? 1)), o = t > 0 ? t : a * .12, s = e.relativeScale ?? 1.15;
|
|
4977
|
-
await
|
|
4981
|
+
await hi(i, o, (e) => {
|
|
4978
4982
|
let t = r(e), i = Math.abs(Math.sin(t * a * Math.PI));
|
|
4979
4983
|
D = 1 + (s - 1) * i, n();
|
|
4980
4984
|
}), D = 1, M();
|
|
@@ -4986,12 +4990,12 @@ function yi(e, t, n, r, i) {
|
|
|
4986
4990
|
from: r,
|
|
4987
4991
|
to: n,
|
|
4988
4992
|
progress: 0
|
|
4989
|
-
}, M(), await
|
|
4990
|
-
let o = t === 0 ? 1 :
|
|
4993
|
+
}, M(), await hi(i, t, (i) => {
|
|
4994
|
+
let o = t === 0 ? 1 : pi(i * Math.max(a, 1) / 1);
|
|
4991
4995
|
k = {
|
|
4992
4996
|
from: r,
|
|
4993
4997
|
to: n,
|
|
4994
|
-
progress:
|
|
4998
|
+
progress: mi(o, e.ease ?? "easeInOut")
|
|
4995
4999
|
}, M();
|
|
4996
5000
|
}), k = void 0, M();
|
|
4997
5001
|
return;
|
|
@@ -5006,20 +5010,20 @@ function yi(e, t, n, r, i) {
|
|
|
5006
5010
|
dispose() {
|
|
5007
5011
|
if (!y) {
|
|
5008
5012
|
y = !0, x.placement.basis === "actor" && t.onTargetVisualChange === ee && (t.onTargetVisualChange = N ?? null);
|
|
5009
|
-
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID,
|
|
5013
|
+
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID, ti);
|
|
5010
5014
|
c !== void 0 && (a.destroySkin(c), c = void 0), e.requestRedraw?.();
|
|
5011
5015
|
}
|
|
5012
5016
|
}
|
|
5013
5017
|
});
|
|
5014
5018
|
} catch (e) {
|
|
5015
|
-
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID,
|
|
5019
|
+
for (let e of [...s].reverse()) a.destroyDrawable(e.drawableID, ti);
|
|
5016
5020
|
throw c !== void 0 && a.destroySkin(c), e;
|
|
5017
5021
|
}
|
|
5018
5022
|
}
|
|
5019
|
-
function
|
|
5020
|
-
if (!
|
|
5021
|
-
let n = e, r =
|
|
5022
|
-
return
|
|
5023
|
+
function xi(e, t = {}) {
|
|
5024
|
+
if (!si(e)) throw new $("BUBBLE-RUNTIME-001", "Bubble requires the TurboWarp runtime.");
|
|
5025
|
+
let n = e, r = ci(n.renderer), i = () => li(n.ext_kubohiroyaassetmanager), a = t.svgText ? null : ui(n.ext_kubohiroyasvgtext);
|
|
5026
|
+
return ei({
|
|
5023
5027
|
imageResolver: t.imageResolver ?? {
|
|
5024
5028
|
isRegistered(e) {
|
|
5025
5029
|
return i().isLoaded({ NAME: e });
|
|
@@ -5031,7 +5035,7 @@ function bi(e, t = {}) {
|
|
|
5031
5035
|
let a = t.drawableID;
|
|
5032
5036
|
if (!Number.isInteger(a) || a < 0) throw new $("BUBBLE-RUNTIME-001", "Bubble image target drawable is invalid.");
|
|
5033
5037
|
let o = await i().resolveSkin(e);
|
|
5034
|
-
if (!
|
|
5038
|
+
if (!si(o) || !Number.isInteger(o.skinId) || o.skinId < 0) throw new $("BUBBLE-RUNTIME-002", `Asset Manager did not resolve an image skin: ${String(e)}`);
|
|
5035
5039
|
r.updateDrawableSkinId(a, o.skinId), n.requestRedraw?.();
|
|
5036
5040
|
}
|
|
5037
5041
|
},
|
|
@@ -5065,8 +5069,8 @@ function bi(e, t = {}) {
|
|
|
5065
5069
|
}
|
|
5066
5070
|
},
|
|
5067
5071
|
createSurface({ actor: e, actorKey: r, style: i }) {
|
|
5068
|
-
if (!
|
|
5069
|
-
return
|
|
5072
|
+
if (!si(e) || typeof e.id != "string") throw new $("BUBBLE-RUNTIME-001", "Bubble actor target is invalid.");
|
|
5073
|
+
return bi(n, e, r, i, t.scheduler ?? {
|
|
5070
5074
|
setTimeout: (e, t) => globalThis.setTimeout(e, t),
|
|
5071
5075
|
clearTimeout: (e) => globalThis.clearTimeout(e)
|
|
5072
5076
|
});
|
|
@@ -5076,4 +5080,4 @@ function bi(e, t = {}) {
|
|
|
5076
5080
|
});
|
|
5077
5081
|
}
|
|
5078
5082
|
//#endregion
|
|
5079
|
-
export { $ as BubbleRuntimeAdapterError,
|
|
5083
|
+
export { $ as BubbleRuntimeAdapterError, xi as createTurboWarpBubbleComposition };
|