@algorisys/tinyfly 0.74.1 → 0.75.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 +9 -6
- package/lib/addons/adapters.js +236 -121
- package/lib/addons/characters.js +316 -144
- package/lib/addons/{dom-adapter-ChrbtkLC.js → dom-adapter-CrNwoomd.js} +52 -52
- package/lib/addons/gsap-compat.js +1 -1
- package/lib/addons/sketch-CB6VNfnR.js +128 -0
- package/lib/browser/tinyfly.iife.js +4 -4
- package/lib/browser/tinyfly.js +3110 -2819
- package/lib/browser/tinyfly.umd.js +4 -4
- package/lib/cli/tools.js +2 -0
- package/lib/embed/tinyfly-embed.iife.js +4 -4
- package/lib/embed/tinyfly-embed.js +70 -70
- package/lib/headless/headless.js +300 -1
- package/lib/player/tinyfly-player.es.js +73 -73
- package/lib/player/tinyfly-player.iife.js +2 -2
- package/lib/player/tinyfly-player.umd.js +2 -2
- package/lib/types/adapters/canvas/canvas-adapter.d.ts +18 -0
- package/lib/types/adapters/canvas/index.d.ts +3 -0
- package/lib/types/adapters/canvas/outline.d.ts +26 -0
- package/lib/types/adapters/canvas/polyline.d.ts +12 -0
- package/lib/types/adapters/canvas/sketch.d.ts +54 -0
- package/lib/types/characters/erase.d.ts +31 -0
- package/lib/types/characters/hand.d.ts +81 -0
- package/lib/types/characters/index.d.ts +7 -1
- package/lib/types/characters/polyline.d.ts +12 -0
- package/lib/types/characters/sketch.d.ts +54 -0
- package/lib/types/characters/stick-figure.d.ts +29 -4
- package/package.json +1 -1
|
@@ -1463,7 +1463,7 @@ const Yt = /* @__PURE__ */ new Set([
|
|
|
1463
1463
|
"motionPathX",
|
|
1464
1464
|
"motionPathY",
|
|
1465
1465
|
"motionPathRotate"
|
|
1466
|
-
]), Cn = /* @__PURE__ */ new Set(["originX", "originY"]), In = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Rn = {
|
|
1466
|
+
]), Cn = /* @__PURE__ */ new Set(["originX", "originY"]), In = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Rn = /* @__PURE__ */ new Set(["drawOn"]), $n = {
|
|
1467
1467
|
fill: "backgroundColor",
|
|
1468
1468
|
stroke: "borderColor",
|
|
1469
1469
|
strokeWidth: "borderWidth",
|
|
@@ -1478,7 +1478,7 @@ const Yt = /* @__PURE__ */ new Set([
|
|
|
1478
1478
|
strokeDashoffset: "strokeDashoffset",
|
|
1479
1479
|
fillOpacity: "fillOpacity",
|
|
1480
1480
|
strokeOpacity: "strokeOpacity"
|
|
1481
|
-
},
|
|
1481
|
+
}, Dn = "http://www.w3.org/2000/svg";
|
|
1482
1482
|
class vt {
|
|
1483
1483
|
targets = /* @__PURE__ */ new Map();
|
|
1484
1484
|
/**
|
|
@@ -1522,7 +1522,7 @@ class vt {
|
|
|
1522
1522
|
let i = null, r = null, a = null;
|
|
1523
1523
|
const o = n.has("motionPathX"), c = n.has("motionPathY"), l = n.has("motionPathRotate");
|
|
1524
1524
|
for (const [d, f] of n)
|
|
1525
|
-
if (!(d === "x" && o) && !(d === "y" && c) && !((d === "rotate" || d === "rotateZ") && l)) {
|
|
1525
|
+
if (!(d === "x" && o) && !(d === "y" && c) && !((d === "rotate" || d === "rotateZ") && l) && !Rn.has(d)) {
|
|
1526
1526
|
if (Pn.has(d)) {
|
|
1527
1527
|
const g = this.buildTransformPart(d, f);
|
|
1528
1528
|
g && s.push(g);
|
|
@@ -1614,11 +1614,11 @@ class vt {
|
|
|
1614
1614
|
*/
|
|
1615
1615
|
applyStyleProperty(t, n, s) {
|
|
1616
1616
|
let i;
|
|
1617
|
-
if (t.namespaceURI ===
|
|
1617
|
+
if (t.namespaceURI === Dn && n in qt) {
|
|
1618
1618
|
const o = Array.isArray(s) ? s.join(", ") : String(s);
|
|
1619
1619
|
t.style[qt[n]] = o;
|
|
1620
1620
|
return;
|
|
1621
|
-
} else n === "fill" && t.dataset?.elementType === "text" ? i = "color" : i =
|
|
1621
|
+
} else n === "fill" && t.dataset?.elementType === "text" ? i = "color" : i = $n[n] ?? n;
|
|
1622
1622
|
let a;
|
|
1623
1623
|
typeof s == "number" ? Yt.has(n) || Yt.has(i) ? a = `${s}px` : a = String(s) : Array.isArray(s) ? a = s.join(", ") : a = s, t.style[i] = a;
|
|
1624
1624
|
}
|
|
@@ -1662,7 +1662,7 @@ class Vt {
|
|
|
1662
1662
|
});
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
|
-
function
|
|
1665
|
+
function Ln(e, t, n, s, i) {
|
|
1666
1666
|
const r = n - i;
|
|
1667
1667
|
if (r < 0) {
|
|
1668
1668
|
t.paused || t.pause(), t.currentTime = 0;
|
|
@@ -1908,7 +1908,7 @@ class Mt {
|
|
|
1908
1908
|
/** Sync all discovered media targets to a timeline time. */
|
|
1909
1909
|
syncAllMedia(t, n) {
|
|
1910
1910
|
for (const s of this.mediaTargets)
|
|
1911
|
-
|
|
1911
|
+
Ln(s.sync, s.el, t, n, s.startTime);
|
|
1912
1912
|
}
|
|
1913
1913
|
/**
|
|
1914
1914
|
* Load animation from inline JSON string.
|
|
@@ -2099,14 +2099,14 @@ class Mt {
|
|
|
2099
2099
|
}
|
|
2100
2100
|
}
|
|
2101
2101
|
}
|
|
2102
|
-
async function
|
|
2102
|
+
async function os(e, t, n = {}) {
|
|
2103
2103
|
const s = new Mt(e, { ...n, autoplay: !0 });
|
|
2104
2104
|
return await s.load(t), s;
|
|
2105
2105
|
}
|
|
2106
|
-
function
|
|
2106
|
+
function cs(e, t = {}) {
|
|
2107
2107
|
return new Mt(e, t);
|
|
2108
2108
|
}
|
|
2109
|
-
const
|
|
2109
|
+
const On = {
|
|
2110
2110
|
play: "Play",
|
|
2111
2111
|
pause: "Pause",
|
|
2112
2112
|
prev: "Previous step",
|
|
@@ -2121,7 +2121,7 @@ const Ln = {
|
|
|
2121
2121
|
scenario: "Scenario",
|
|
2122
2122
|
fullscreen: "Full screen",
|
|
2123
2123
|
exitFullscreen: "Exit full screen"
|
|
2124
|
-
}, Wt = "tinyfly-controls-style",
|
|
2124
|
+
}, Wt = "tinyfly-controls-style", Nn = `
|
|
2125
2125
|
.tf-ctl { --tf-ctl-fg: #1d1d1f; --tf-ctl-bg: #f4f2ee; --tf-ctl-accent: #c2410c; --tf-ctl-radius: 8px;
|
|
2126
2126
|
font: 14px/1.4 var(--tf-ctl-font, system-ui, sans-serif); color: var(--tf-ctl-fg); margin-top: 8px; }
|
|
2127
2127
|
.tf-ctl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border-radius: var(--tf-ctl-radius); background: var(--tf-ctl-bg); }
|
|
@@ -2170,16 +2170,16 @@ const Ln = {
|
|
|
2170
2170
|
.tf-fullscreen > :not(svg):not(canvas) { grid-column: 2; }
|
|
2171
2171
|
}
|
|
2172
2172
|
`;
|
|
2173
|
-
let
|
|
2174
|
-
function
|
|
2173
|
+
let Fn = 0;
|
|
2174
|
+
function Xn(e) {
|
|
2175
2175
|
if (e.getElementById(Wt)) return;
|
|
2176
2176
|
const t = e.createElement("style");
|
|
2177
|
-
t.id = Wt, t.textContent =
|
|
2177
|
+
t.id = Wt, t.textContent = Nn, e.head.appendChild(t);
|
|
2178
2178
|
}
|
|
2179
|
-
function
|
|
2179
|
+
function Yn(e, t, n = {}) {
|
|
2180
2180
|
const s = t.ownerDocument;
|
|
2181
|
-
|
|
2182
|
-
const i = { ...
|
|
2181
|
+
Xn(s);
|
|
2182
|
+
const i = { ...On, ...n.labels }, r = n.speeds ?? [0.5, 1, 2], a = () => e.markers.length > 0, o = () => e.markers.some((w) => w.label !== void 0 || e.caption(w.id) !== void 0), c = s.createElement("div");
|
|
2183
2183
|
c.className = "tf-ctl";
|
|
2184
2184
|
const l = s.createElement("div");
|
|
2185
2185
|
l.className = "tf-ctl-bar", l.setAttribute("role", "group");
|
|
@@ -2203,7 +2203,7 @@ function Xn(e, t, n = {}) {
|
|
|
2203
2203
|
E.value = String(w), E.textContent = `${w}×`, w === 1 && (E.selected = !0), v.appendChild(E);
|
|
2204
2204
|
}
|
|
2205
2205
|
v.addEventListener("change", () => e.setSpeed(Number(v.value))), l.append(h, d, f, g, m, b), r.length > 0 && l.append(v), c.append(l);
|
|
2206
|
-
const k = n.fullscreen ?
|
|
2206
|
+
const k = n.fullscreen ? Bn(t, s, i) : void 0;
|
|
2207
2207
|
k && l.append(k.button);
|
|
2208
2208
|
const M = s.createElement("p");
|
|
2209
2209
|
M.className = "tf-ctl-caption", M.setAttribute("aria-live", "polite"), n.captions !== !1 && c.append(M);
|
|
@@ -2211,7 +2211,7 @@ function Xn(e, t, n = {}) {
|
|
|
2211
2211
|
y.className = "tf-ctl-question", y.hidden = !0;
|
|
2212
2212
|
const S = s.createElement("span"), x = u(i.reveal, i.reveal, () => e.play(), "tf-ctl-primary");
|
|
2213
2213
|
y.append(S, x), c.append(y);
|
|
2214
|
-
const P =
|
|
2214
|
+
const P = qn(e, s, i.scenario, n.scenarioControl ?? "buttons");
|
|
2215
2215
|
P && c.append(P.element);
|
|
2216
2216
|
const Y = n.mount;
|
|
2217
2217
|
Y ? Y.appendChild(c) : t.insertAdjacentElement("afterend", c);
|
|
@@ -2275,7 +2275,7 @@ function Xn(e, t, n = {}) {
|
|
|
2275
2275
|
}
|
|
2276
2276
|
};
|
|
2277
2277
|
}
|
|
2278
|
-
function
|
|
2278
|
+
function qn(e, t, n, s) {
|
|
2279
2279
|
const i = e.scenarios;
|
|
2280
2280
|
if (i.length < 2) return;
|
|
2281
2281
|
if (s === "slider") {
|
|
@@ -2300,7 +2300,7 @@ function Yn(e, t, n, s) {
|
|
|
2300
2300
|
r.className = "tf-ctl-choices";
|
|
2301
2301
|
const a = t.createElement("legend");
|
|
2302
2302
|
a.textContent = n, r.append(a);
|
|
2303
|
-
const o = `tf-ctl-scenario-${++
|
|
2303
|
+
const o = `tf-ctl-scenario-${++Fn}`, c = i.map((u) => {
|
|
2304
2304
|
const h = t.createElement("label");
|
|
2305
2305
|
h.className = "tf-ctl-choice";
|
|
2306
2306
|
const d = t.createElement("input");
|
|
@@ -2317,14 +2317,14 @@ function Yn(e, t, n, s) {
|
|
|
2317
2317
|
}
|
|
2318
2318
|
} };
|
|
2319
2319
|
}
|
|
2320
|
-
const
|
|
2321
|
-
function
|
|
2320
|
+
const Vn = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>', Wn = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>';
|
|
2321
|
+
function Bn(e, t, n) {
|
|
2322
2322
|
const s = t, i = e, r = t.createElement("button");
|
|
2323
2323
|
r.type = "button", r.className = "tf-ctl-btn tf-ctl-fullscreen";
|
|
2324
2324
|
let a, o = "";
|
|
2325
2325
|
const c = () => {
|
|
2326
2326
|
const p = a !== void 0;
|
|
2327
|
-
r.innerHTML = p ?
|
|
2327
|
+
r.innerHTML = p ? Wn : Vn;
|
|
2328
2328
|
const m = p ? n.exitFullscreen : n.fullscreen;
|
|
2329
2329
|
r.setAttribute("aria-label", m), r.title = m, r.setAttribute("aria-pressed", String(p)), e.classList.toggle("tf-fullscreen", p), e.classList.toggle("tf-fullscreen-overlay", a === "overlay");
|
|
2330
2330
|
}, l = () => s.fullscreenElement ?? s.webkitFullscreenElement ?? null, u = () => {
|
|
@@ -2370,20 +2370,20 @@ function Wn(e, t, n) {
|
|
|
2370
2370
|
}
|
|
2371
2371
|
};
|
|
2372
2372
|
}
|
|
2373
|
-
const Bt = "tinyfly-choices-style",
|
|
2373
|
+
const Bt = "tinyfly-choices-style", Un = `
|
|
2374
2374
|
[data-tinyfly-choose] { cursor: pointer; }
|
|
2375
2375
|
[data-tinyfly-choose]:focus-visible { outline: 2px solid var(--tf-ctl-accent, #c2410c); outline-offset: 2px; }
|
|
2376
2376
|
`;
|
|
2377
|
-
function
|
|
2377
|
+
function jn(e) {
|
|
2378
2378
|
if (e.getElementById(Bt)) return;
|
|
2379
2379
|
const t = e.createElement("style");
|
|
2380
|
-
t.id = Bt, t.textContent =
|
|
2380
|
+
t.id = Bt, t.textContent = Un, e.head.appendChild(t);
|
|
2381
2381
|
}
|
|
2382
|
-
function
|
|
2382
|
+
function Hn(e, t) {
|
|
2383
2383
|
const n = Array.from(t.querySelectorAll("[data-tinyfly-choose]"));
|
|
2384
2384
|
if (n.length === 0) return () => {
|
|
2385
2385
|
};
|
|
2386
|
-
|
|
2386
|
+
jn(t.ownerDocument);
|
|
2387
2387
|
const s = [], i = [];
|
|
2388
2388
|
for (const o of n) {
|
|
2389
2389
|
const c = o.getAttribute("data-tinyfly-choose") ?? "", l = [], u = (g, p) => {
|
|
@@ -2411,7 +2411,7 @@ function jn(e, t) {
|
|
|
2411
2411
|
};
|
|
2412
2412
|
}
|
|
2413
2413
|
const at = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap();
|
|
2414
|
-
let
|
|
2414
|
+
let zn = 0;
|
|
2415
2415
|
function K(e, t, n) {
|
|
2416
2416
|
if (e)
|
|
2417
2417
|
try {
|
|
@@ -2421,10 +2421,10 @@ function K(e, t, n) {
|
|
|
2421
2421
|
return;
|
|
2422
2422
|
}
|
|
2423
2423
|
}
|
|
2424
|
-
async function
|
|
2424
|
+
async function Gn(e, t = {}) {
|
|
2425
2425
|
const n = at.get(e);
|
|
2426
2426
|
if (n) return n;
|
|
2427
|
-
const s = Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")), i = s[0], r = e.getAttribute("data-src"), a =
|
|
2427
|
+
const s = Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")), i = s[0], r = e.getAttribute("data-src"), a = Zn(e.getAttribute("data-markers")), o = s.length > 1 || i?.hasAttribute("data-scenario") ? Qn(s, a, e) : void 0;
|
|
2428
2428
|
if (o && o.length === 0) return;
|
|
2429
2429
|
let c = i && !o ? K(i.textContent, "timeline", e) : void 0;
|
|
2430
2430
|
if (!c && r && a) {
|
|
@@ -2441,16 +2441,16 @@ async function zn(e, t = {}) {
|
|
|
2441
2441
|
...l && { captions: l },
|
|
2442
2442
|
...K(e.getAttribute("data-options"), "data-options", e)
|
|
2443
2443
|
};
|
|
2444
|
-
|
|
2444
|
+
Jn(e);
|
|
2445
2445
|
const h = new Mt(e, u), d = { element: e, player: h };
|
|
2446
2446
|
if (at.set(e, d), e.setAttribute("data-tinyfly-mounted", ""), o) {
|
|
2447
2447
|
const f = e.getAttribute("data-scenario") ?? void 0;
|
|
2448
|
-
await h.loadScenarios(o, { initial: o.some((g) => g.id === f) ? f : void 0 }), kt.set(e,
|
|
2448
|
+
await h.loadScenarios(o, { initial: o.some((g) => g.id === f) ? f : void 0 }), kt.set(e, Hn(h, e));
|
|
2449
2449
|
} else
|
|
2450
2450
|
await h.load(c ?? r);
|
|
2451
2451
|
if (e.getAttribute("data-controls") !== "false") {
|
|
2452
2452
|
const f = K(e.getAttribute("data-labels"), "data-labels", e), g = e.querySelector("figcaption"), p = e.getAttribute("data-scenario-legend"), m = e.getAttribute("data-scenario-control");
|
|
2453
|
-
d.controls =
|
|
2453
|
+
d.controls = Yn(h, e, {
|
|
2454
2454
|
...t.controls,
|
|
2455
2455
|
...e.getAttribute("data-fullscreen") === "true" ? { fullscreen: !0 } : {},
|
|
2456
2456
|
...m === "slider" || m === "buttons" ? { scenarioControl: m } : {},
|
|
@@ -2461,7 +2461,7 @@ async function zn(e, t = {}) {
|
|
|
2461
2461
|
}
|
|
2462
2462
|
return d;
|
|
2463
2463
|
}
|
|
2464
|
-
function
|
|
2464
|
+
function Qn(e, t, n) {
|
|
2465
2465
|
const s = [];
|
|
2466
2466
|
return e.forEach((i, r) => {
|
|
2467
2467
|
const a = K(i.textContent, "timeline", n);
|
|
@@ -2478,29 +2478,29 @@ function Gn(e, t, n) {
|
|
|
2478
2478
|
function ie(e, t) {
|
|
2479
2479
|
return e.config.markers?.length ? e : { ...e, config: { ...e.config, markers: t.map((n, s) => ({ id: `step-${s + 1}`, time: n })) } };
|
|
2480
2480
|
}
|
|
2481
|
-
function
|
|
2481
|
+
function Zn(e) {
|
|
2482
2482
|
if (!e) return;
|
|
2483
2483
|
const t = e.split(/[\s,]+/).filter(Boolean).map(Number).filter((n) => Number.isFinite(n) && n >= 0).sort((n, s) => n - s);
|
|
2484
2484
|
return t.length > 0 ? t : void 0;
|
|
2485
2485
|
}
|
|
2486
|
-
async function
|
|
2486
|
+
async function Kn(e = document, t = {}) {
|
|
2487
2487
|
const n = Array.from(e.querySelectorAll("[data-tinyfly-embed]"));
|
|
2488
|
-
return (await Promise.all(n.map((i) =>
|
|
2488
|
+
return (await Promise.all(n.map((i) => Gn(i, t)))).filter((i) => i !== void 0);
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function ls(e) {
|
|
2491
2491
|
const t = at.get(e);
|
|
2492
2492
|
t && (kt.get(e)?.(), kt.delete(e), t.controls?.destroy(), t.player.destroy(), at.delete(e), e.removeAttribute("data-tinyfly-mounted"));
|
|
2493
2493
|
}
|
|
2494
|
-
function
|
|
2494
|
+
function Jn(e) {
|
|
2495
2495
|
const t = e.querySelector("svg");
|
|
2496
2496
|
if (!t || t.hasAttribute("role") || t.hasAttribute("aria-hidden")) return;
|
|
2497
2497
|
const n = e.getAttribute("data-alt"), s = e.querySelector("figcaption");
|
|
2498
|
-
t.setAttribute("role", "img"), n ? t.setAttribute("aria-label", n) : s && (s.id ||= `tinyfly-caption-${++
|
|
2498
|
+
t.setAttribute("role", "img"), n ? t.setAttribute("aria-label", n) : s && (s.id ||= `tinyfly-caption-${++zn}`, t.setAttribute("aria-labelledby", s.id));
|
|
2499
2499
|
}
|
|
2500
|
-
function
|
|
2500
|
+
function ts() {
|
|
2501
2501
|
if (!(typeof document < "u" ? document.currentScript : null)?.hasAttribute("data-tinyfly-auto")) return;
|
|
2502
2502
|
const t = () => {
|
|
2503
|
-
|
|
2503
|
+
Kn();
|
|
2504
2504
|
};
|
|
2505
2505
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t, { once: !0 }) : t();
|
|
2506
2506
|
}
|
|
@@ -2509,7 +2509,7 @@ function re(e) {
|
|
|
2509
2509
|
for (const n of e.matchAll(/data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/g)) t.add(n[2] ?? n[3]);
|
|
2510
2510
|
return [...t];
|
|
2511
2511
|
}
|
|
2512
|
-
function
|
|
2512
|
+
function es(e, t = {}) {
|
|
2513
2513
|
const n = [], s = (l) => n.push({ level: "error", message: l }), i = (l) => n.push({ level: "warning", message: l });
|
|
2514
2514
|
if ((e.formatVersion ?? 1) > J)
|
|
2515
2515
|
return s(`format version ${e.formatVersion} is newer than this tinyfly reads (${J})`), n;
|
|
@@ -2545,12 +2545,12 @@ function ts(e, t = {}) {
|
|
|
2545
2545
|
}
|
|
2546
2546
|
return n;
|
|
2547
2547
|
}
|
|
2548
|
-
function
|
|
2548
|
+
function ns(e) {
|
|
2549
2549
|
const t = /* @__PURE__ */ new Set();
|
|
2550
2550
|
for (const n of e.matchAll(/data-tinyfly-choose\s*=\s*("([^"]*)"|'([^']*)')/g)) t.add(n[2] ?? n[3]);
|
|
2551
2551
|
return [...t];
|
|
2552
2552
|
}
|
|
2553
|
-
function
|
|
2553
|
+
function hs(e, t = {}) {
|
|
2554
2554
|
const n = [];
|
|
2555
2555
|
e.length === 1 && n.push({ level: "warning", message: "only one scenario, so the reader has nothing to choose" });
|
|
2556
2556
|
const s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
@@ -2560,26 +2560,26 @@ function ls(e, t = {}) {
|
|
|
2560
2560
|
continue;
|
|
2561
2561
|
}
|
|
2562
2562
|
s.add(r.id);
|
|
2563
|
-
for (const a of
|
|
2563
|
+
for (const a of es(r.timeline, t))
|
|
2564
2564
|
/is never animated$/.test(a.message) || n.push({ level: a.level, message: `scenario "${r.id}": ${a.message}` });
|
|
2565
2565
|
for (const a of r.timeline.tracks) for (const o of [a.target, ...a.targets ?? []]) i.add(o);
|
|
2566
2566
|
}
|
|
2567
2567
|
if (t.markup !== void 0) {
|
|
2568
|
-
for (const r of
|
|
2568
|
+
for (const r of ns(t.markup))
|
|
2569
2569
|
s.has(r) || n.push({ level: "error", message: `data-tinyfly-choose="${r}" names no scenario` });
|
|
2570
2570
|
for (const r of re(t.markup))
|
|
2571
2571
|
i.has(r) || n.push({ level: "warning", message: `data-tinyfly="${r}" is never animated in any scenario` });
|
|
2572
2572
|
}
|
|
2573
2573
|
return n;
|
|
2574
2574
|
}
|
|
2575
|
-
function
|
|
2576
|
-
const s = rt(t), i = t.config?.markers ?? [], r = n === "start" ? 0 : n === "end" ? s.duration : typeof n == "number" ? n : i.find((d) => d.id === n)?.time ?? s.duration, a = s.getStateAtTime(Math.max(0, Math.min(s.duration, r))), o = new vt(), c = /* @__PURE__ */ new Map(), l =
|
|
2575
|
+
function us(e, t, n = "end") {
|
|
2576
|
+
const s = rt(t), i = t.config?.markers ?? [], r = n === "start" ? 0 : n === "end" ? s.duration : typeof n == "number" ? n : i.find((d) => d.id === n)?.time ?? s.duration, a = s.getStateAtTime(Math.max(0, Math.min(s.duration, r))), o = new vt(), c = /* @__PURE__ */ new Map(), l = is(e);
|
|
2577
2577
|
for (const d of e.matchAll(Ut)) {
|
|
2578
2578
|
const f = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(d[2] ?? "");
|
|
2579
2579
|
if (!f) continue;
|
|
2580
2580
|
const g = f[2] ?? f[3];
|
|
2581
2581
|
if (c.has(g)) continue;
|
|
2582
|
-
const p =
|
|
2582
|
+
const p = ss(l(d.index ?? 0));
|
|
2583
2583
|
c.set(g, p), o.registerTarget(g, p);
|
|
2584
2584
|
}
|
|
2585
2585
|
o.applyState(a);
|
|
@@ -2588,7 +2588,7 @@ function hs(e, t, n = "end") {
|
|
|
2588
2588
|
const [f, g, p = "", m] = d, b = d.index ?? 0, v = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(p), k = v ? c.get(v[2] ?? v[3]) : void 0;
|
|
2589
2589
|
if (!k || Object.keys(k.style).length === 0 && k.text === void 0) continue;
|
|
2590
2590
|
u += e.slice(h, b);
|
|
2591
|
-
const M = Object.entries(k.style).map(([x, P]) => `${
|
|
2591
|
+
const M = Object.entries(k.style).map(([x, P]) => `${rs(x)}: ${P}`).join("; "), y = /\sstyle\s*=\s*("([^"]*)"|'([^']*)')/.exec(p);
|
|
2592
2592
|
let S = p;
|
|
2593
2593
|
if (M)
|
|
2594
2594
|
if (y) {
|
|
@@ -2598,13 +2598,13 @@ function hs(e, t, n = "end") {
|
|
|
2598
2598
|
S = `${p} style="${jt(M)}"`;
|
|
2599
2599
|
if (u += `<${g}${S}${m ? " /" : ""}>`, h = b + f.length, k.text !== void 0 && !m) {
|
|
2600
2600
|
const x = e.indexOf(`</${g}`, h), P = x === -1 ? "" : e.slice(h, x);
|
|
2601
|
-
x !== -1 && !P.includes("<") && (u +=
|
|
2601
|
+
x !== -1 && !P.includes("<") && (u += as(k.text), h = x);
|
|
2602
2602
|
}
|
|
2603
2603
|
}
|
|
2604
2604
|
return u + e.slice(h);
|
|
2605
2605
|
}
|
|
2606
2606
|
const Ut = /<([a-zA-Z][\w:-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*(\/?)>/g;
|
|
2607
|
-
function
|
|
2607
|
+
function ss(e) {
|
|
2608
2608
|
const t = {
|
|
2609
2609
|
style: {},
|
|
2610
2610
|
dataset: {},
|
|
@@ -2619,7 +2619,7 @@ function ns(e) {
|
|
|
2619
2619
|
};
|
|
2620
2620
|
return e && (t.ownerSVGElement = null), t;
|
|
2621
2621
|
}
|
|
2622
|
-
function
|
|
2622
|
+
function is(e) {
|
|
2623
2623
|
const t = [], n = /<svg[\s>]/gi;
|
|
2624
2624
|
let s;
|
|
2625
2625
|
for (; s = n.exec(e); ) {
|
|
@@ -2628,29 +2628,29 @@ function ss(e) {
|
|
|
2628
2628
|
}
|
|
2629
2629
|
return (i) => t.some(([r, a]) => i > r && i < a);
|
|
2630
2630
|
}
|
|
2631
|
-
function
|
|
2631
|
+
function rs(e) {
|
|
2632
2632
|
const t = e.replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`);
|
|
2633
2633
|
return /^(webkit|moz|ms)-/.test(t) ? `-${t}` : t;
|
|
2634
2634
|
}
|
|
2635
2635
|
function jt(e) {
|
|
2636
2636
|
return e.replace(/&/g, "&").replace(/"/g, """);
|
|
2637
2637
|
}
|
|
2638
|
-
function
|
|
2638
|
+
function as(e) {
|
|
2639
2639
|
return e.replace(/&/g, "&").replace(/</g, "<");
|
|
2640
2640
|
}
|
|
2641
|
-
|
|
2641
|
+
ts();
|
|
2642
2642
|
export {
|
|
2643
|
-
|
|
2643
|
+
On as DEFAULT_LABELS,
|
|
2644
2644
|
Mt as TinyflyPlayer,
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2645
|
+
Hn as bindChoiceHotspots,
|
|
2646
|
+
cs as create,
|
|
2647
|
+
Yn as createControls,
|
|
2648
|
+
Gn as mount,
|
|
2649
|
+
Kn as mountAll,
|
|
2650
|
+
os as play,
|
|
2651
|
+
us as renderFrame,
|
|
2652
2652
|
re as targetNamesIn,
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2653
|
+
ls as unmount,
|
|
2654
|
+
es as validateEmbed,
|
|
2655
|
+
hs as validateScenarios
|
|
2656
2656
|
};
|