@algorisys/tinyfly 0.67.1 → 0.69.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 +17 -16
- package/bin/tinyfly.mjs +20 -6
- package/lib/addons/gsap-compat.js +202 -198
- package/lib/browser/tinyfly.iife.js +18 -3
- package/lib/browser/tinyfly.js +1153 -954
- package/lib/browser/tinyfly.umd.js +18 -3
- package/lib/cli/tools.js +34 -1
- package/lib/embed/tinyfly-embed.iife.js +18 -3
- package/lib/embed/tinyfly-embed.js +972 -749
- package/lib/player/tinyfly-player.es.js +200 -128
- package/lib/player/tinyfly-player.iife.js +2 -2
- package/lib/player/tinyfly-player.umd.js +2 -2
- package/lib/types/browser/index.d.ts +1 -0
- package/lib/types/compat/gsap/live.d.ts +1 -1
- package/lib/types/compat/gsap/stage.d.ts +8 -0
- package/lib/types/embed/choices.d.ts +3 -0
- package/lib/types/embed/controls.d.ts +10 -2
- package/lib/types/embed/index.d.ts +3 -2
- package/lib/types/embed/mount.d.ts +7 -0
- package/lib/types/embed/tools.d.ts +10 -0
- package/lib/types/player/index.d.ts +1 -1
- package/lib/types/player/player.d.ts +50 -0
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ function Xt(i) {
|
|
|
11
11
|
function ut(i) {
|
|
12
12
|
return i.kind === "inertia" && "inertia" in i;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function dt(i) {
|
|
15
15
|
return i.kind === "spring" && "spring" in i;
|
|
16
16
|
}
|
|
17
17
|
function se(i) {
|
|
@@ -173,29 +173,29 @@ function St(i, t) {
|
|
|
173
173
|
const s = gt(i);
|
|
174
174
|
return i.from + (e - i.from) * (1 - Math.exp(-s * t / 1e3));
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
linear:
|
|
176
|
+
const ft = (i) => i, de = (i) => i * i, fe = (i) => 1 - (1 - i) * (1 - i), pe = (i) => i < 0.5 ? 2 * i * i : 1 - Math.pow(-2 * i + 2, 2) / 2, Ut = (i) => i * i * i, Ht = (i) => 1 - Math.pow(1 - i, 3), Qt = (i) => i < 0.5 ? 4 * i * i * i : 1 - Math.pow(-2 * i + 2, 3) / 2, me = Ut, ge = Ht, ye = Qt, Te = {
|
|
177
|
+
linear: ft,
|
|
178
178
|
"ease-in": me,
|
|
179
179
|
"ease-out": ge,
|
|
180
180
|
"ease-in-out": ye,
|
|
181
|
-
"ease-in-quad":
|
|
182
|
-
"ease-out-quad":
|
|
181
|
+
"ease-in-quad": de,
|
|
182
|
+
"ease-out-quad": fe,
|
|
183
183
|
"ease-in-out-quad": pe,
|
|
184
184
|
"ease-in-cubic": Ut,
|
|
185
185
|
"ease-out-cubic": Ht,
|
|
186
186
|
"ease-in-out-cubic": Qt
|
|
187
187
|
};
|
|
188
188
|
function be(i) {
|
|
189
|
-
const [t, e, s, n] = i, r = 3 * t, a = 3 * (s - t) - r, o = 1 - r - a, c = 3 * e, h = 3 * (n - e) - c, u = 1 - c - h, l = (p) => ((o * p + a) * p + r) * p,
|
|
189
|
+
const [t, e, s, n] = i, r = 3 * t, a = 3 * (s - t) - r, o = 1 - r - a, c = 3 * e, h = 3 * (n - e) - c, u = 1 - c - h, l = (p) => ((o * p + a) * p + r) * p, d = (p) => ((u * p + h) * p + c) * p, f = (p) => (3 * o * p + 2 * a) * p + r, b = (p) => {
|
|
190
190
|
let g = p;
|
|
191
191
|
for (let A = 0; A < 8; A++) {
|
|
192
|
-
const
|
|
193
|
-
if (Math.abs(
|
|
192
|
+
const M = l(g) - p;
|
|
193
|
+
if (Math.abs(M) < 1e-7)
|
|
194
194
|
return g;
|
|
195
|
-
const m =
|
|
195
|
+
const m = f(g);
|
|
196
196
|
if (Math.abs(m) < 1e-7)
|
|
197
197
|
break;
|
|
198
|
-
g -=
|
|
198
|
+
g -= M / m;
|
|
199
199
|
}
|
|
200
200
|
let y = 0, T = 1;
|
|
201
201
|
for (g = p; y < T; ) {
|
|
@@ -210,7 +210,7 @@ function be(i) {
|
|
|
210
210
|
if (p <= 0) return 0;
|
|
211
211
|
if (p >= 1) return 1;
|
|
212
212
|
const g = b(p);
|
|
213
|
-
return
|
|
213
|
+
return d(g);
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
function st(i, t = "out") {
|
|
@@ -237,7 +237,7 @@ const Se = (i) => {
|
|
|
237
237
|
const s = i - 2.625 / 2.75;
|
|
238
238
|
return 7.5625 * s * s + 0.984375;
|
|
239
239
|
};
|
|
240
|
-
function
|
|
240
|
+
function Me(i = 1.70158) {
|
|
241
241
|
return (t) => {
|
|
242
242
|
if (t <= 0) return 0;
|
|
243
243
|
if (t >= 1) return 1;
|
|
@@ -263,7 +263,7 @@ function ke(i, t = "end") {
|
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function _e(i) {
|
|
267
267
|
switch (i.type) {
|
|
268
268
|
case "steps":
|
|
269
269
|
return ke(i.count, i.position);
|
|
@@ -272,13 +272,13 @@ function Me(i) {
|
|
|
272
272
|
case "bounce":
|
|
273
273
|
return st(Se, i.mode);
|
|
274
274
|
case "back":
|
|
275
|
-
return st(
|
|
275
|
+
return st(Me(i.overshoot), i.mode);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
function we(i) {
|
|
279
|
-
return i === void 0 ?
|
|
279
|
+
return i === void 0 ? ft : ee(i) ? be(i.points) : ie(i) ? _e(i) : Te[i] ?? ft;
|
|
280
280
|
}
|
|
281
|
-
const
|
|
281
|
+
const Mt = 32, Pe = 256, Y = /* @__PURE__ */ new Map(), xe = /[MmLlHhVvCcSsQqTtAaZz]/, ve = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Ce = {
|
|
282
282
|
M: 2,
|
|
283
283
|
L: 2,
|
|
284
284
|
H: 1,
|
|
@@ -319,27 +319,27 @@ function Re(i, t, e, s, n, r, a, o, c) {
|
|
|
319
319
|
if (i === o && t === c) return [];
|
|
320
320
|
let h = Math.abs(e), u = Math.abs(s);
|
|
321
321
|
if (h === 0 || u === 0) return [[i, t, o, c, o, c]];
|
|
322
|
-
const l = n * Math.PI / 180,
|
|
322
|
+
const l = n * Math.PI / 180, d = Math.cos(l), f = Math.sin(l), b = (i - o) / 2, p = (t - c) / 2, g = d * b + f * p, y = -f * b + d * p, T = g * g / (h * h) + y * y / (u * u);
|
|
323
323
|
if (T > 1) {
|
|
324
324
|
const w = Math.sqrt(T);
|
|
325
325
|
h *= w, u *= w;
|
|
326
326
|
}
|
|
327
|
-
const A = r === a ? -1 : 1,
|
|
328
|
-
const it = w * I + v *
|
|
329
|
-
return w *
|
|
327
|
+
const A = r === a ? -1 : 1, M = h * h * u * u - h * h * y * y - u * u * g * g, m = h * h * y * y + u * u * g * g, k = A * Math.sqrt(Math.max(0, M / m)), S = k * h * y / u, R = -k * u * g / h, Q = d * S - f * R + (i + o) / 2, _ = f * S + d * R + (t + c) / 2, C = (w, v, I, O) => {
|
|
328
|
+
const it = w * I + v * O, z = Math.sqrt((w * w + v * v) * (I * I + O * O)), q = Math.acos(Math.max(-1, Math.min(1, it / z)));
|
|
329
|
+
return w * O - v * I < 0 ? -q : q;
|
|
330
330
|
}, P = C(1, 0, (g - S) / h, (y - R) / u);
|
|
331
331
|
let x = C((g - S) / h, (y - R) / u, (-g - S) / h, (-y - R) / u);
|
|
332
332
|
!a && x > 0 && (x -= 2 * Math.PI), a && x < 0 && (x += 2 * Math.PI);
|
|
333
333
|
const E = Math.max(1, Math.ceil(Math.abs(x) / (Math.PI / 2))), et = x / E, j = 4 / 3 * Math.tan(et / 4), yt = (w) => {
|
|
334
334
|
const v = h * Math.cos(w), I = u * Math.sin(w);
|
|
335
|
-
return [
|
|
335
|
+
return [d * v - f * I + Q, f * v + d * I + _];
|
|
336
336
|
}, Tt = (w) => {
|
|
337
337
|
const v = -h * Math.sin(w), I = u * Math.cos(w);
|
|
338
|
-
return [
|
|
338
|
+
return [d * v - f * I, f * v + d * I];
|
|
339
339
|
}, bt = [];
|
|
340
340
|
for (let w = 0; w < E; w++) {
|
|
341
|
-
const v = P + w * et, I = v + et, [
|
|
342
|
-
bt.push([
|
|
341
|
+
const v = P + w * et, I = v + et, [O, it] = yt(v), [z, q] = w === E - 1 ? [o, c] : yt(I), [Zt, Kt] = Tt(v), [Jt, te] = Tt(I);
|
|
342
|
+
bt.push([O + j * Zt, it + j * Kt, z - j * Jt, q - j * te, z, q]);
|
|
343
343
|
}
|
|
344
344
|
return bt;
|
|
345
345
|
}
|
|
@@ -365,10 +365,10 @@ function N(i, t, e, s) {
|
|
|
365
365
|
}
|
|
366
366
|
function Z(i, t, e) {
|
|
367
367
|
const [s, n, r, a, o, c] = e, h = [0];
|
|
368
|
-
let u = i, l = t,
|
|
369
|
-
for (let
|
|
370
|
-
const b =
|
|
371
|
-
|
|
368
|
+
let u = i, l = t, d = 0;
|
|
369
|
+
for (let f = 1; f <= Mt; f++) {
|
|
370
|
+
const b = f / Mt, p = B(i, s, r, o, b), g = B(t, n, a, c, b);
|
|
371
|
+
d += Math.hypot(p - u, g - l), h.push(d), u = p, l = g;
|
|
372
372
|
}
|
|
373
373
|
return {
|
|
374
374
|
subpath: 0,
|
|
@@ -378,7 +378,7 @@ function Z(i, t, e) {
|
|
|
378
378
|
startY: t,
|
|
379
379
|
endX: o,
|
|
380
380
|
endY: c,
|
|
381
|
-
length:
|
|
381
|
+
length: d,
|
|
382
382
|
lengths: h
|
|
383
383
|
};
|
|
384
384
|
}
|
|
@@ -396,12 +396,12 @@ function J(i) {
|
|
|
396
396
|
(s !== r || n !== a) && l(N(s, n, r, a)), h >= 0 && u.add(h), s = r, n = a, o = c = null;
|
|
397
397
|
continue;
|
|
398
398
|
}
|
|
399
|
-
for (let
|
|
400
|
-
const m = g.slice(
|
|
399
|
+
for (let M = 0; M + A <= g.length; M += A) {
|
|
400
|
+
const m = g.slice(M, M + A), k = T ? s : 0, S = T ? n : 0;
|
|
401
401
|
let R = null, Q = null;
|
|
402
402
|
switch (y) {
|
|
403
403
|
case "M":
|
|
404
|
-
|
|
404
|
+
M === 0 ? (s = m[0] + k, n = m[1] + S, r = s, a = n, (h < 0 || e[e.length - 1]?.subpath === h) && h++) : (l(N(s, n, m[0] + k, m[1] + S)), s = m[0] + k, n = m[1] + S);
|
|
405
405
|
break;
|
|
406
406
|
case "L":
|
|
407
407
|
l(N(s, n, m[0] + k, m[1] + S)), s = m[0] + k, n = m[1] + S;
|
|
@@ -413,53 +413,53 @@ function J(i) {
|
|
|
413
413
|
l(N(s, n, s, m[0] + S)), n = m[0] + S;
|
|
414
414
|
break;
|
|
415
415
|
case "C": {
|
|
416
|
-
const
|
|
417
|
-
l(Z(s, n,
|
|
416
|
+
const _ = [m[0] + k, m[1] + S, m[2] + k, m[3] + S, m[4] + k, m[5] + S];
|
|
417
|
+
l(Z(s, n, _)), R = [_[2], _[3]], s = _[4], n = _[5];
|
|
418
418
|
break;
|
|
419
419
|
}
|
|
420
420
|
case "S": {
|
|
421
|
-
const [
|
|
421
|
+
const [_, C] = o ? [2 * s - o[0], 2 * n - o[1]] : [s, n], P = [_, C, m[0] + k, m[1] + S, m[2] + k, m[3] + S];
|
|
422
422
|
l(Z(s, n, P)), R = [P[2], P[3]], s = P[4], n = P[5];
|
|
423
423
|
break;
|
|
424
424
|
}
|
|
425
425
|
case "Q":
|
|
426
426
|
case "T": {
|
|
427
|
-
let
|
|
428
|
-
y === "Q" ? (
|
|
427
|
+
let _ = s, C = n;
|
|
428
|
+
y === "Q" ? (_ = m[0] + k, C = m[1] + S) : c && (_ = 2 * s - c[0], C = 2 * n - c[1]);
|
|
429
429
|
const P = y === "Q" ? m[2] + k : m[0] + k, x = y === "Q" ? m[3] + S : m[1] + S;
|
|
430
430
|
l(
|
|
431
431
|
Z(s, n, [
|
|
432
|
-
s + 2 / 3 * (
|
|
432
|
+
s + 2 / 3 * (_ - s),
|
|
433
433
|
n + 2 / 3 * (C - n),
|
|
434
|
-
P + 2 / 3 * (
|
|
434
|
+
P + 2 / 3 * (_ - P),
|
|
435
435
|
x + 2 / 3 * (C - x),
|
|
436
436
|
P,
|
|
437
437
|
x
|
|
438
438
|
])
|
|
439
|
-
), Q = [
|
|
439
|
+
), Q = [_, C], s = P, n = x;
|
|
440
440
|
break;
|
|
441
441
|
}
|
|
442
442
|
case "A": {
|
|
443
|
-
const
|
|
443
|
+
const _ = m[5] + k, C = m[6] + S;
|
|
444
444
|
let P = s, x = n;
|
|
445
|
-
for (const E of Re(s, n, m[0], m[1], m[2], m[3], m[4],
|
|
445
|
+
for (const E of Re(s, n, m[0], m[1], m[2], m[3], m[4], _, C))
|
|
446
446
|
l(Z(P, x, E)), P = E[4], x = E[5];
|
|
447
|
-
s =
|
|
447
|
+
s = _, n = C;
|
|
448
448
|
break;
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
o = R, c = Q;
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
const
|
|
454
|
+
const d = e.reduce((p, g) => p + g.length, 0), f = [];
|
|
455
455
|
for (let p = 0; p < e.length; ) {
|
|
456
456
|
const g = e[p].subpath;
|
|
457
457
|
let y = p, T = 0;
|
|
458
458
|
for (; y < e.length && e[y].subpath === g; ) T += e[y++].length;
|
|
459
|
-
const A = e[p],
|
|
460
|
-
|
|
459
|
+
const A = e[p], M = e[y - 1], m = u.has(g) || Math.abs(M.endX - A.startX) < 1e-9 && Math.abs(M.endY - A.startY) < 1e-9;
|
|
460
|
+
f.push({ start: p, end: y, length: T, closed: m }), p = y;
|
|
461
461
|
}
|
|
462
|
-
const b = { segments: e, totalLength:
|
|
462
|
+
const b = { segments: e, totalLength: d, subpaths: f };
|
|
463
463
|
return Y.size >= Pe && Y.delete(Y.keys().next().value), Y.set(i, b), b;
|
|
464
464
|
}
|
|
465
465
|
function De(i, t) {
|
|
@@ -486,8 +486,8 @@ function Be(i, t) {
|
|
|
486
486
|
const [e, s, n, r, a, o] = i.points, c = De(i, t);
|
|
487
487
|
let h = kt(i.startX, e, n, a, c), u = kt(i.startY, s, r, o, c);
|
|
488
488
|
if (Math.hypot(h, u) < 1e-9) {
|
|
489
|
-
const l = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3),
|
|
490
|
-
h = c < 0.5 ?
|
|
489
|
+
const l = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), d = B(i.startX, e, n, a, l), f = B(i.startY, s, r, o, l), b = B(i.startX, e, n, a, c), p = B(i.startY, s, r, o, c);
|
|
490
|
+
h = c < 0.5 ? d - b : b - d, u = c < 0.5 ? f - p : p - f;
|
|
491
491
|
}
|
|
492
492
|
return {
|
|
493
493
|
x: B(i.startX, e, n, a, c),
|
|
@@ -510,9 +510,9 @@ function Ee(i, t) {
|
|
|
510
510
|
const { segments: e, totalLength: s } = J(i);
|
|
511
511
|
return jt(e, Math.max(0, Math.min(1, t)) * s);
|
|
512
512
|
}
|
|
513
|
-
const Le = 24,
|
|
513
|
+
const Le = 24, $e = 320, Oe = 2.5, V = 72, Fe = 0.2, Xe = 128, K = /* @__PURE__ */ new Map();
|
|
514
514
|
let nt = 0, L;
|
|
515
|
-
const
|
|
515
|
+
const _t = (i) => Math.round(i * 100) / 100;
|
|
516
516
|
function wt(i, t) {
|
|
517
517
|
const { segments: e, subpaths: s, totalLength: n } = J(i);
|
|
518
518
|
if (e.length === 0) return [];
|
|
@@ -554,12 +554,12 @@ function qe(i, t, e) {
|
|
|
554
554
|
for (const h of [!1, !0]) {
|
|
555
555
|
const u = s ? a : 1;
|
|
556
556
|
for (let l = 0; l < u; l++) {
|
|
557
|
-
let
|
|
558
|
-
for (let
|
|
559
|
-
const b = s ? h ? (l -
|
|
560
|
-
|
|
557
|
+
let d = 0;
|
|
558
|
+
for (let f = 0; f < a && d < c; f++) {
|
|
559
|
+
const b = s ? h ? (l - f + a) % a : (f + l) % a : h ? a - 1 - f : f, p = n[f][0] - r[b][0], g = n[f][1] - r[b][1];
|
|
560
|
+
d += p * p + g * g;
|
|
561
561
|
}
|
|
562
|
-
|
|
562
|
+
d < c && (c = d, o = { offset: s ? l / a : 0, reversed: h });
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
return o;
|
|
@@ -573,12 +573,12 @@ function Ne(i, t, e) {
|
|
|
573
573
|
function Ve(i, t, e) {
|
|
574
574
|
const s = i.closed && t.closed, n = qe(i, t, e.shapeIndex), r = Math.max(
|
|
575
575
|
Le,
|
|
576
|
-
Math.min(
|
|
576
|
+
Math.min($e, Math.ceil(Math.max(i.length, t.length) / Oe))
|
|
577
577
|
), a = /* @__PURE__ */ new Set(), o = (l) => a.add(Math.round(l * 1e7) / 1e7);
|
|
578
578
|
for (let l = 0; l <= r; l++) o(l / r);
|
|
579
579
|
for (const l of Pt(i)) o(l);
|
|
580
580
|
for (const l of Pt(t)) o(Ne(l, n, s));
|
|
581
|
-
let c = [...a].sort((l,
|
|
581
|
+
let c = [...a].sort((l, d) => l - d);
|
|
582
582
|
s && (c = c.filter((l) => l < 1));
|
|
583
583
|
const h = [], u = [];
|
|
584
584
|
for (const l of c)
|
|
@@ -615,14 +615,14 @@ function Ue(i, t, e) {
|
|
|
615
615
|
const r = K.get(String(s ?? "auto"))?.get(i)?.get(t);
|
|
616
616
|
if (r)
|
|
617
617
|
return L = { from: i, to: t, shapeIndex: s, plan: r }, r;
|
|
618
|
-
const a = J(i).subpaths.filter((
|
|
619
|
-
pairs: o.map((
|
|
618
|
+
const a = J(i).subpaths.filter((f) => f.length > 0).length === J(t).subpaths.filter((f) => f.length > 0).length, o = wt(i, !a), c = wt(t, !a), h = {
|
|
619
|
+
pairs: o.map((f, b) => Ve(f, c[b], e))
|
|
620
620
|
};
|
|
621
621
|
nt >= Xe && (K.clear(), nt = 0);
|
|
622
622
|
const u = String(s ?? "auto"), l = K.get(u) ?? /* @__PURE__ */ new Map();
|
|
623
623
|
K.set(u, l);
|
|
624
|
-
const
|
|
625
|
-
return l.set(i,
|
|
624
|
+
const d = l.get(i) ?? /* @__PURE__ */ new Map();
|
|
625
|
+
return l.set(i, d), d.set(t, h), nt++, L = { from: i, to: t, shapeIndex: s, plan: h }, h;
|
|
626
626
|
}
|
|
627
627
|
function He(i, t, e, s = {}) {
|
|
628
628
|
if (!i) return t;
|
|
@@ -635,7 +635,7 @@ function He(i, t, e, s = {}) {
|
|
|
635
635
|
let a = "";
|
|
636
636
|
for (const o of r.pairs) {
|
|
637
637
|
for (let c = 0; c < o.from.length; c += 2) {
|
|
638
|
-
const h =
|
|
638
|
+
const h = _t(o.from[c] + (o.to[c] - o.from[c]) * n), u = _t(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * n);
|
|
639
639
|
a += `${c === 0 ? a ? " M" : "M" : " L"}${h} ${u}`;
|
|
640
640
|
}
|
|
641
641
|
o.closed && (a += " Z");
|
|
@@ -699,7 +699,7 @@ function ti(i) {
|
|
|
699
699
|
keyframes: t
|
|
700
700
|
};
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function $(i) {
|
|
703
703
|
return i.targets && i.targets.length > 0 ? i.targets : [i.target];
|
|
704
704
|
}
|
|
705
705
|
function X(i, t, e, s) {
|
|
@@ -710,7 +710,7 @@ class ct {
|
|
|
710
710
|
track;
|
|
711
711
|
targets;
|
|
712
712
|
constructor(t) {
|
|
713
|
-
this.track = t, this.targets =
|
|
713
|
+
this.track = t, this.targets = $(t);
|
|
714
714
|
}
|
|
715
715
|
/**
|
|
716
716
|
* Get the interpolated value at a specific time.
|
|
@@ -785,7 +785,7 @@ class ei {
|
|
|
785
785
|
targets;
|
|
786
786
|
sampler;
|
|
787
787
|
constructor(t) {
|
|
788
|
-
this.track = t, this.targets =
|
|
788
|
+
this.track = t, this.targets = $(t), this.sampler = new ae(t.spring);
|
|
789
789
|
}
|
|
790
790
|
getValueAtTime(t) {
|
|
791
791
|
return this.sampler.valueAt(t - X(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
@@ -812,7 +812,7 @@ class ii {
|
|
|
812
812
|
targets;
|
|
813
813
|
duration;
|
|
814
814
|
constructor(t) {
|
|
815
|
-
this.track = t, this.targets =
|
|
815
|
+
this.track = t, this.targets = $(t), this.duration = Wt(t.inertia);
|
|
816
816
|
}
|
|
817
817
|
getValueAtTime(t) {
|
|
818
818
|
return St(this.track.inertia, t - X(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
@@ -839,8 +839,8 @@ function si(i, t) {
|
|
|
839
839
|
if (i.matrix) {
|
|
840
840
|
const [s, n, r, a, o, c] = i.matrix, { x: h, y: u } = e;
|
|
841
841
|
e.x = s * h + r * u + o, e.y = n * h + a * u + c;
|
|
842
|
-
const l = e.angle * Math.PI / 180,
|
|
843
|
-
e.angle = Math.atan2(n *
|
|
842
|
+
const l = e.angle * Math.PI / 180, d = Math.cos(l), f = Math.sin(l);
|
|
843
|
+
e.angle = Math.atan2(n * d + a * f, s * d + r * f) * 180 / Math.PI;
|
|
844
844
|
}
|
|
845
845
|
return i.autoRotate && i.rotateOffset && (e.angle += i.rotateOffset), e;
|
|
846
846
|
}
|
|
@@ -867,12 +867,12 @@ function oi(i, t, e = 0) {
|
|
|
867
867
|
const T = Math.round(r * Math.max(a.length, o.length));
|
|
868
868
|
return c ? a.slice(0, Math.max(0, a.length - T)).join("") + o.slice(Math.max(0, o.length - T)).join("") : o.slice(0, T).join("") + a.slice(T).join("");
|
|
869
869
|
}
|
|
870
|
-
const h = Math.max(0, Math.min(0.999, i.revealDelay ?? 0)), u = Math.max(0, (r - h) / (1 - h)), l = Math.floor(u * o.length),
|
|
870
|
+
const h = Math.max(0, Math.min(0.999, i.revealDelay ?? 0)), u = Math.max(0, (r - h) / (1 - h)), l = Math.floor(u * o.length), d = i.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * r), f = ri(i.chars), b = i.refreshRate ?? ni, p = b > 0 ? Math.floor(e * b / 1e3) : 0, g = i.seed ?? 1;
|
|
871
871
|
let y = "";
|
|
872
|
-
for (let T = 0; T <
|
|
873
|
-
const A = c ? T >=
|
|
874
|
-
A &&
|
|
875
|
-
` ? y +=
|
|
872
|
+
for (let T = 0; T < d; T++) {
|
|
873
|
+
const A = c ? T >= d - l : T < l, M = c ? o[o.length - (d - T)] : o[T];
|
|
874
|
+
A && M !== void 0 || M === " " || M === `
|
|
875
|
+
` ? y += M : y += f[ai(g, T, p) % f.length];
|
|
876
876
|
}
|
|
877
877
|
return y;
|
|
878
878
|
}
|
|
@@ -1057,8 +1057,8 @@ class ci {
|
|
|
1057
1057
|
for (const [n, r] of this._trackPlayers) {
|
|
1058
1058
|
const a = r.getTrack().property;
|
|
1059
1059
|
for (const { target: o, value: c, start: h } of r.getTargetValues(t)) {
|
|
1060
|
-
const u = `${o}\0${a}`, l = h <= t,
|
|
1061
|
-
(!
|
|
1060
|
+
const u = `${o}\0${a}`, l = h <= t, d = s.get(u);
|
|
1061
|
+
(!d || (l !== d.started ? l : l ? h >= d.start : h <= d.start)) && s.set(u, { trackId: n, target: o, property: a, value: c, start: h, started: l });
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
1064
|
for (const { trackId: n, target: r, property: a, value: o, start: c } of s.values())
|
|
@@ -1092,7 +1092,7 @@ class ci {
|
|
|
1092
1092
|
const t = /* @__PURE__ */ new Set();
|
|
1093
1093
|
this._sharedWrites = !1;
|
|
1094
1094
|
t: for (const e of this._tracks)
|
|
1095
|
-
for (const s of
|
|
1095
|
+
for (const s of $(e)) {
|
|
1096
1096
|
const n = `${s}\0${e.property}`;
|
|
1097
1097
|
if (t.has(n)) {
|
|
1098
1098
|
this._sharedWrites = !0;
|
|
@@ -1111,7 +1111,7 @@ class ci {
|
|
|
1111
1111
|
this._trackPlayers.set(t.id, new ii(t));
|
|
1112
1112
|
return;
|
|
1113
1113
|
}
|
|
1114
|
-
if (
|
|
1114
|
+
if (dt(t)) {
|
|
1115
1115
|
this._trackPlayers.set(t.id, new ei(t)), this._springTracks.set(t.id, t);
|
|
1116
1116
|
return;
|
|
1117
1117
|
}
|
|
@@ -1181,7 +1181,7 @@ class ci {
|
|
|
1181
1181
|
const e = this._trackPlayers.get(t);
|
|
1182
1182
|
if (!e) return;
|
|
1183
1183
|
const s = e.getTrack(), n = s.delay ?? 0;
|
|
1184
|
-
if (
|
|
1184
|
+
if (dt(s) || ut(s))
|
|
1185
1185
|
return { from: n, to: e.getDuration() };
|
|
1186
1186
|
const r = s.keyframes;
|
|
1187
1187
|
if (!(!r || r.length === 0))
|
|
@@ -1203,7 +1203,7 @@ class ci {
|
|
|
1203
1203
|
for (let r = 0; r < e; r++) {
|
|
1204
1204
|
const a = this._tracks[r];
|
|
1205
1205
|
if (a.property !== s.property) continue;
|
|
1206
|
-
const o =
|
|
1206
|
+
const o = $(a).filter((l) => $(s).includes(l));
|
|
1207
1207
|
if (o.length === 0) continue;
|
|
1208
1208
|
const c = this.getTrackSpan(a.id);
|
|
1209
1209
|
if (!c || !(c.from <= n.to && n.from <= c.to)) continue;
|
|
@@ -1220,7 +1220,7 @@ class ci {
|
|
|
1220
1220
|
return t;
|
|
1221
1221
|
}
|
|
1222
1222
|
_matches(t, e) {
|
|
1223
|
-
if (e.id !== void 0 && t.id !== e.id || e.property !== void 0 && t.property !== e.property || e.target !== void 0 &&
|
|
1223
|
+
if (e.id !== void 0 && t.id !== e.id || e.property !== void 0 && t.property !== e.property || e.target !== void 0 && !$(t).includes(e.target)) return !1;
|
|
1224
1224
|
if (e.timeRange) {
|
|
1225
1225
|
const s = this.getTrackSpan(t.id);
|
|
1226
1226
|
if (!s || s.to < e.timeRange.from || s.from > e.timeRange.to) return !1;
|
|
@@ -1292,21 +1292,21 @@ class ci {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
const hi = 100;
|
|
1294
1294
|
function li(i, t, e, s) {
|
|
1295
|
-
const n = [], r = [], { duration: a, alternate: o } = s, c = (
|
|
1296
|
-
r.push([
|
|
1295
|
+
const n = [], r = [], { duration: a, alternate: o } = s, c = (f, b, p, g) => {
|
|
1296
|
+
r.push([f, b]);
|
|
1297
1297
|
const y = [];
|
|
1298
1298
|
i.forEach((T, A) => {
|
|
1299
|
-
(p === "forward" ? (g ? T >=
|
|
1299
|
+
(p === "forward" ? (g ? T >= f : T > f) && T <= b : (g ? T <= f : T < f) && T >= b) && y.push(A);
|
|
1300
1300
|
}), y.sort((T, A) => (p === "forward" ? i[T] - i[A] : i[A] - i[T]) || T - A);
|
|
1301
1301
|
for (const T of y) n.push({ kind: "event", index: T, direction: p });
|
|
1302
1302
|
};
|
|
1303
1303
|
let h = t.time, u = t.direction, l = t.fresh === !0;
|
|
1304
|
-
const
|
|
1305
|
-
for (let
|
|
1304
|
+
const d = Math.min(hi, Math.max(0, e.iteration - t.iteration));
|
|
1305
|
+
for (let f = 0; f < d; f++) {
|
|
1306
1306
|
const b = u === "forward" ? a : 0;
|
|
1307
1307
|
c(h, b, u, l), n.push({ kind: "repeat" }), o ? (u = u === "forward" ? "reverse" : "forward", h = b, l = !1) : (h = u === "forward" ? 0 : a, l = !0);
|
|
1308
1308
|
}
|
|
1309
|
-
return
|
|
1309
|
+
return d > 0 && s.holding && !o ? { crossings: n, passes: r } : (c(h, e.time, u, l), { crossings: n, passes: r });
|
|
1310
1310
|
}
|
|
1311
1311
|
function ui(i) {
|
|
1312
1312
|
return { ...i, ...Array.isArray(i.end) && { end: [...i.end] } };
|
|
@@ -1320,7 +1320,7 @@ function W(i) {
|
|
|
1320
1320
|
...i.stagger !== void 0 && { stagger: { ...i.stagger } }
|
|
1321
1321
|
};
|
|
1322
1322
|
}
|
|
1323
|
-
function
|
|
1323
|
+
function di(i) {
|
|
1324
1324
|
if (ut(i)) {
|
|
1325
1325
|
const t = i;
|
|
1326
1326
|
return {
|
|
@@ -1332,7 +1332,7 @@ function fi(i) {
|
|
|
1332
1332
|
...W(t)
|
|
1333
1333
|
};
|
|
1334
1334
|
}
|
|
1335
|
-
if (
|
|
1335
|
+
if (dt(i)) {
|
|
1336
1336
|
const t = i;
|
|
1337
1337
|
return {
|
|
1338
1338
|
id: t.id,
|
|
@@ -1383,11 +1383,11 @@ function tt(i) {
|
|
|
1383
1383
|
id: i.id,
|
|
1384
1384
|
name: i.name,
|
|
1385
1385
|
config: i.config,
|
|
1386
|
-
tracks: i.tracks.map(
|
|
1386
|
+
tracks: i.tracks.map(di),
|
|
1387
1387
|
captions: i.captions
|
|
1388
1388
|
});
|
|
1389
1389
|
}
|
|
1390
|
-
const
|
|
1390
|
+
const fi = /* @__PURE__ */ new Set([
|
|
1391
1391
|
"blur",
|
|
1392
1392
|
"brightness",
|
|
1393
1393
|
"glow",
|
|
@@ -1419,7 +1419,7 @@ function Ti(i) {
|
|
|
1419
1419
|
const t = i.style;
|
|
1420
1420
|
!t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
|
|
1421
1421
|
}
|
|
1422
|
-
const
|
|
1422
|
+
const $t = /* @__PURE__ */ new Set([
|
|
1423
1423
|
"width",
|
|
1424
1424
|
"height",
|
|
1425
1425
|
"top",
|
|
@@ -1463,14 +1463,14 @@ const Ot = /* @__PURE__ */ new Set([
|
|
|
1463
1463
|
"motionPathX",
|
|
1464
1464
|
"motionPathY",
|
|
1465
1465
|
"motionPathRotate"
|
|
1466
|
-
]), Ai = /* @__PURE__ */ new Set(["originX", "originY"]), Si = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]),
|
|
1466
|
+
]), Ai = /* @__PURE__ */ new Set(["originX", "originY"]), Si = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Mi = {
|
|
1467
1467
|
fill: "backgroundColor",
|
|
1468
1468
|
stroke: "borderColor",
|
|
1469
1469
|
strokeWidth: "borderWidth",
|
|
1470
1470
|
color: "color",
|
|
1471
1471
|
backgroundColor: "backgroundColor",
|
|
1472
1472
|
borderColor: "borderColor"
|
|
1473
|
-
},
|
|
1473
|
+
}, Ot = {
|
|
1474
1474
|
fill: "fill",
|
|
1475
1475
|
stroke: "stroke",
|
|
1476
1476
|
strokeWidth: "strokeWidth",
|
|
@@ -1521,41 +1521,41 @@ class H {
|
|
|
1521
1521
|
const s = [];
|
|
1522
1522
|
let n = null, r = null, a = null;
|
|
1523
1523
|
const o = e.has("motionPathX"), c = e.has("motionPathY"), h = e.has("motionPathRotate");
|
|
1524
|
-
for (const [
|
|
1525
|
-
if (!(
|
|
1526
|
-
if (bi.has(
|
|
1527
|
-
const b = this.buildTransformPart(
|
|
1524
|
+
for (const [d, f] of e)
|
|
1525
|
+
if (!(d === "x" && o) && !(d === "y" && c) && !((d === "rotate" || d === "rotateZ") && h)) {
|
|
1526
|
+
if (bi.has(d)) {
|
|
1527
|
+
const b = this.buildTransformPart(d, f);
|
|
1528
1528
|
b && s.push(b);
|
|
1529
|
-
} else if (Ai.has(
|
|
1530
|
-
typeof
|
|
1531
|
-
else if (Si.has(
|
|
1532
|
-
typeof
|
|
1533
|
-
else if (
|
|
1534
|
-
(a ??= {})[
|
|
1535
|
-
else if (
|
|
1536
|
-
if (
|
|
1537
|
-
yi(t,
|
|
1538
|
-
else if (
|
|
1529
|
+
} else if (Ai.has(d))
|
|
1530
|
+
typeof f == "number" && ((n ??= {})[d] = f);
|
|
1531
|
+
else if (Si.has(d))
|
|
1532
|
+
typeof f == "number" && ((r ??= {})[d] = f);
|
|
1533
|
+
else if (fi.has(d))
|
|
1534
|
+
(a ??= {})[d] = f;
|
|
1535
|
+
else if (d !== "perspective") {
|
|
1536
|
+
if (d !== "shine") if (d === "text" && typeof f == "string")
|
|
1537
|
+
yi(t, f);
|
|
1538
|
+
else if (d === "d" && typeof f == "string") {
|
|
1539
1539
|
const b = t;
|
|
1540
|
-
(b.tagName?.toLowerCase() === "path" ? b : b.querySelector?.("path"))?.setAttribute?.("d",
|
|
1540
|
+
(b.tagName?.toLowerCase() === "path" ? b : b.querySelector?.("path"))?.setAttribute?.("d", f);
|
|
1541
1541
|
} else
|
|
1542
|
-
this.applyStyleProperty(t,
|
|
1542
|
+
this.applyStyleProperty(t, d, f);
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
const u = e.get("shine");
|
|
1546
1546
|
typeof u == "number" && this.applyShine(t, u);
|
|
1547
1547
|
const l = e.get("perspective");
|
|
1548
1548
|
if (typeof l == "number" && s.unshift(`perspective(${l}px)`), s.length > 0 && (t.style.transform = s.join(" "), Ti(t)), n) {
|
|
1549
|
-
const
|
|
1550
|
-
t.style.transformOrigin = `${
|
|
1549
|
+
const d = n.originX ?? 50, f = n.originY ?? 50;
|
|
1550
|
+
t.style.transformOrigin = `${d}% ${f}%`;
|
|
1551
1551
|
}
|
|
1552
1552
|
if (r) {
|
|
1553
|
-
const
|
|
1554
|
-
t.style.clipPath = `inset(${
|
|
1553
|
+
const d = r.clipTop ?? 0, f = r.clipRight ?? 0, b = r.clipBottom ?? 0, p = r.clipLeft ?? 0;
|
|
1554
|
+
t.style.clipPath = `inset(${d}% ${f}% ${b}% ${p}%)`;
|
|
1555
1555
|
}
|
|
1556
1556
|
if (a) {
|
|
1557
|
-
const
|
|
1558
|
-
|
|
1557
|
+
const d = gi(a);
|
|
1558
|
+
d && (t.style.filter = d);
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
1561
1561
|
/**
|
|
@@ -1614,13 +1614,13 @@ class H {
|
|
|
1614
1614
|
*/
|
|
1615
1615
|
applyStyleProperty(t, e, s) {
|
|
1616
1616
|
let n;
|
|
1617
|
-
if (t.namespaceURI === ki && e in
|
|
1617
|
+
if (t.namespaceURI === ki && e in Ot) {
|
|
1618
1618
|
const o = Array.isArray(s) ? s.join(", ") : String(s);
|
|
1619
|
-
t.style[
|
|
1619
|
+
t.style[Ot[e]] = o;
|
|
1620
1620
|
return;
|
|
1621
|
-
} else e === "fill" && t.dataset?.elementType === "text" ? n = "color" : n =
|
|
1621
|
+
} else e === "fill" && t.dataset?.elementType === "text" ? n = "color" : n = Mi[e] ?? e;
|
|
1622
1622
|
let a;
|
|
1623
|
-
typeof s == "number" ?
|
|
1623
|
+
typeof s == "number" ? $t.has(e) || $t.has(n) ? a = `${s}px` : a = String(s) : Array.isArray(s) ? a = s.join(", ") : a = s, t.style[n] = a;
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
class Ft {
|
|
@@ -1662,7 +1662,7 @@ class Ft {
|
|
|
1662
1662
|
});
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
-
function
|
|
1665
|
+
function _i(i, t, e, s, n) {
|
|
1666
1666
|
const r = e - n;
|
|
1667
1667
|
if (r < 0) {
|
|
1668
1668
|
t.paused || t.pause(), t.currentTime = 0;
|
|
@@ -1682,6 +1682,9 @@ class Gt {
|
|
|
1682
1682
|
mediaSync;
|
|
1683
1683
|
mediaTargets = [];
|
|
1684
1684
|
symbolInstances = [];
|
|
1685
|
+
scenarioList = [];
|
|
1686
|
+
scenarioId;
|
|
1687
|
+
authored = /* @__PURE__ */ new Map();
|
|
1685
1688
|
markerList = [];
|
|
1686
1689
|
listeners = /* @__PURE__ */ new Set();
|
|
1687
1690
|
/** Where the playhead was when marker crossings were last worked out */
|
|
@@ -1712,6 +1715,9 @@ class Gt {
|
|
|
1712
1715
|
* Load animation from a URL or JSON object.
|
|
1713
1716
|
*/
|
|
1714
1717
|
async load(t) {
|
|
1718
|
+
this.scenarioList = [], this.scenarioId = void 0, await this.loadSource(t);
|
|
1719
|
+
}
|
|
1720
|
+
async loadSource(t) {
|
|
1715
1721
|
let e;
|
|
1716
1722
|
if (typeof t == "string") {
|
|
1717
1723
|
const s = await fetch(t);
|
|
@@ -1720,7 +1726,73 @@ class Gt {
|
|
|
1720
1726
|
e = await s.json();
|
|
1721
1727
|
} else
|
|
1722
1728
|
e = t;
|
|
1723
|
-
this.
|
|
1729
|
+
this.useDefinition(e), this.showInitialFrame(), this.watchReducedMotion(), this.watchVisibility(), this.options.autoplay && !this.reducedMotion && (this.options.playWhenVisible && !this.onScreen ? this.autoplayWhenSeen = !0 : this.play());
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Make a definition the current timeline: targets, symbols and media bound, no
|
|
1733
|
+
* frame drawn and nothing played. The definition itself is not modified, so a
|
|
1734
|
+
* scenario's timeline can be used again.
|
|
1735
|
+
*/
|
|
1736
|
+
useDefinition(t) {
|
|
1737
|
+
const e = { ...t.config };
|
|
1738
|
+
this.options.speed !== void 0 && (e.speed = this.options.speed), this.options.loop !== void 0 && (e.loop = this.options.loop), this.options.alternate !== void 0 && (e.alternate = this.options.alternate), this.timeline = tt({ ...t, config: e }), this.markerList = this.timeline.markers, this.lastMarkerId = null, this.options.onComplete && (this.timeline.onComplete = this.options.onComplete), this.options.onUpdate && (this.timeline.onUpdate = this.options.onUpdate), this.autoRegisterTargets(), this.setupSymbolInstances(), this.scanMedia();
|
|
1739
|
+
}
|
|
1740
|
+
// --- scenarios: the reader chooses which timeline plays --------------------
|
|
1741
|
+
/**
|
|
1742
|
+
* Load several timelines for the same markup, and show one. The reader switches
|
|
1743
|
+
* with `setScenario`; the embed's controls and `data-tinyfly-choose` hotspots
|
|
1744
|
+
* call it.
|
|
1745
|
+
*/
|
|
1746
|
+
async loadScenarios(t, e = {}) {
|
|
1747
|
+
if (t.length === 0) throw new Error("tinyfly: loadScenarios needs at least one scenario");
|
|
1748
|
+
const s = /* @__PURE__ */ new Set();
|
|
1749
|
+
for (const r of t) {
|
|
1750
|
+
if (s.has(r.id)) throw new Error(`tinyfly: scenario id "${r.id}" is used more than once`);
|
|
1751
|
+
s.add(r.id);
|
|
1752
|
+
}
|
|
1753
|
+
const n = e.initial === void 0 ? t[0] : t.find((r) => r.id === e.initial);
|
|
1754
|
+
if (!n) throw new Error(`tinyfly: there is no scenario "${e.initial}"`);
|
|
1755
|
+
this.scenarioList = [...t], this.scenarioId = n.id, await this.loadSource(n.timeline);
|
|
1756
|
+
}
|
|
1757
|
+
/** The scenarios to choose from (empty for a single timeline). */
|
|
1758
|
+
get scenarios() {
|
|
1759
|
+
return this.scenarioList.map((t) => ({ id: t.id, label: t.label ?? t.id }));
|
|
1760
|
+
}
|
|
1761
|
+
/** The id of the scenario showing, if scenarios were loaded. */
|
|
1762
|
+
get scenario() {
|
|
1763
|
+
return this.scenarioId;
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Switch to another scenario. Whatever the previous one drew is undone first.
|
|
1767
|
+
* The reader stays at the same step when the new scenario has a marker with the
|
|
1768
|
+
* same id, stays at the end if they were at the end, and otherwise starts from
|
|
1769
|
+
* the beginning. Playback continues if it was playing. Under reduced motion the
|
|
1770
|
+
* new scenario's final frame shows. Returns false for an unknown id.
|
|
1771
|
+
*/
|
|
1772
|
+
setScenario(t) {
|
|
1773
|
+
const e = this.scenarioList.find((o) => o.id === t);
|
|
1774
|
+
if (!e || !this.timeline) return !1;
|
|
1775
|
+
if (t === this.scenarioId) return !0;
|
|
1776
|
+
const s = this.isPlaying, n = this.currentTime >= this.duration - 0.5, r = this.currentMarker?.id;
|
|
1777
|
+
this.stopAnimationLoop(), this.stepping = !1, this.pausedByVisibility = !1, this.restoreAuthored(), this.scenarioId = t, this.useDefinition(e.timeline), this.lastMarkerId = null;
|
|
1778
|
+
let a = 0;
|
|
1779
|
+
return this.reducedMotion || n ? a = this.duration : r !== void 0 && (a = this.markers.find((o) => o.id === r)?.time ?? 0), this.seek(a), s && !this.reducedMotion ? (this.stepping = this.options.stepMode === !0, this.startPlaying()) : this.notify(), !0;
|
|
1780
|
+
}
|
|
1781
|
+
/** Remember how an element was authored, the first time it becomes a target. */
|
|
1782
|
+
rememberAuthored(t) {
|
|
1783
|
+
if (this.authored.has(t)) return;
|
|
1784
|
+
const e = { style: t.getAttribute("style") };
|
|
1785
|
+
t.children.length === 0 && (e.text = t.textContent ?? "");
|
|
1786
|
+
const s = t.tagName.toLowerCase() === "path" ? t : t.querySelector("path");
|
|
1787
|
+
s && (e.path = { element: s, d: s.getAttribute("d") }), this.authored.set(t, e);
|
|
1788
|
+
}
|
|
1789
|
+
/** Put every target back the way it was authored. */
|
|
1790
|
+
restoreAuthored() {
|
|
1791
|
+
for (const [t, e] of this.authored) {
|
|
1792
|
+
e.style === null ? t.removeAttribute("style") : t.setAttribute("style", e.style), e.text !== void 0 && t.textContent !== e.text && (t.textContent = e.text), e.path && (e.path.d === null ? e.path.element.removeAttribute("d") : e.path.element.setAttribute("d", e.path.d));
|
|
1793
|
+
const s = t.dataset;
|
|
1794
|
+
s && delete s.shineBase;
|
|
1795
|
+
}
|
|
1724
1796
|
}
|
|
1725
1797
|
// --- teaching: frames, markers, reduced motion, visibility -----------------
|
|
1726
1798
|
/**
|
|
@@ -1802,7 +1874,7 @@ class Gt {
|
|
|
1802
1874
|
watchVisibility() {
|
|
1803
1875
|
if (!(!this.options.playWhenVisible || typeof window > "u")) {
|
|
1804
1876
|
if (typeof IntersectionObserver == "function") {
|
|
1805
|
-
this.visibilityObserver?.disconnect(), this.
|
|
1877
|
+
this.visibilityObserver?.disconnect(), this.visibilityObserver = new IntersectionObserver((e) => {
|
|
1806
1878
|
for (const s of e) this.onScreen = s.isIntersecting;
|
|
1807
1879
|
this.updateVisibility();
|
|
1808
1880
|
}), this.visibilityObserver.observe(this.container);
|
|
@@ -1836,7 +1908,7 @@ class Gt {
|
|
|
1836
1908
|
/** Sync all discovered media targets to a timeline time. */
|
|
1837
1909
|
syncAllMedia(t, e) {
|
|
1838
1910
|
for (const s of this.mediaTargets)
|
|
1839
|
-
|
|
1911
|
+
_i(s.sync, s.el, t, e, s.startTime);
|
|
1840
1912
|
}
|
|
1841
1913
|
/**
|
|
1842
1914
|
* Load animation from inline JSON string.
|
|
@@ -1851,9 +1923,9 @@ class Gt {
|
|
|
1851
1923
|
registerTarget(t, e) {
|
|
1852
1924
|
if (typeof e == "string") {
|
|
1853
1925
|
const s = this.container.querySelector(e);
|
|
1854
|
-
s && (this.targets[t] = s, this.adapter.registerTarget(t, s));
|
|
1926
|
+
s && (this.rememberAuthored(s), this.targets[t] = s, this.adapter.registerTarget(t, s));
|
|
1855
1927
|
} else
|
|
1856
|
-
this.targets[t] = e, this.adapter.registerTarget(t, e);
|
|
1928
|
+
this.rememberAuthored(e), this.targets[t] = e, this.adapter.registerTarget(t, e);
|
|
1857
1929
|
}
|
|
1858
1930
|
/**
|
|
1859
1931
|
* Auto-register targets using data-tinyfly attribute.
|
|
@@ -1974,7 +2046,7 @@ class Gt {
|
|
|
1974
2046
|
t.el.paused || t.el.pause();
|
|
1975
2047
|
this.mediaTargets = [], this.adapter.clearTargets();
|
|
1976
2048
|
for (const t of this.symbolInstances) t.adapter.clearTargets();
|
|
1977
|
-
this.symbolInstances = [], this.timeline = null;
|
|
2049
|
+
this.symbolInstances = [], this.authored.clear(), this.timeline = null;
|
|
1978
2050
|
}
|
|
1979
2051
|
startAnimationLoop() {
|
|
1980
2052
|
if (this.animationFrameId !== void 0) return;
|
|
@@ -2316,5 +2388,5 @@ export {
|
|
|
2316
2388
|
xi as create,
|
|
2317
2389
|
Pi as play,
|
|
2318
2390
|
vi as playSequence,
|
|
2319
|
-
|
|
2391
|
+
_i as syncMediaElement
|
|
2320
2392
|
};
|