@algorisys/tinyfly 0.74.1 → 0.76.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.
@@ -7,25 +7,25 @@ const w = /* @__PURE__ */ new Set([
7
7
  "shadowY",
8
8
  "shadowBlur",
9
9
  "shadowColor"
10
- ]), b = "#ffffff", x = "rgba(0, 0, 0, 0.5)";
11
- function R(r) {
10
+ ]), b = "#ffffff", R = "rgba(0, 0, 0, 0.5)";
11
+ function x(r) {
12
12
  const t = [];
13
13
  if (r.blur !== void 0 && t.push(`blur(${Math.max(0, r.blur)}px)`), r.brightness !== void 0 && t.push(`brightness(${Math.max(0, r.brightness)})`), r.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, r.glow)}px ${r.glowColor ?? b})`), r.shadowX !== void 0 || r.shadowY !== void 0 || r.shadowBlur !== void 0) {
14
- const o = r.shadowX ?? 0, s = r.shadowY ?? 0, a = Math.max(0, r.shadowBlur ?? 0);
15
- t.push(`drop-shadow(${o}px ${s}px ${a}px ${r.shadowColor ?? x})`);
14
+ const o = r.shadowX ?? 0, e = r.shadowY ?? 0, a = Math.max(0, r.shadowBlur ?? 0);
15
+ t.push(`drop-shadow(${o}px ${e}px ${a}px ${r.shadowColor ?? R})`);
16
16
  }
17
17
  return t.length > 0 ? t.join(" ") : null;
18
18
  }
19
- function $(r, t) {
19
+ function S(r, t) {
20
20
  const o = r.childNodes.length === 1 ? r.firstChild : null;
21
21
  if (o && o.nodeType === 3) {
22
- const s = o;
23
- s.data !== t && (s.data = t);
22
+ const e = o;
23
+ e.data !== t && (e.data = t);
24
24
  return;
25
25
  }
26
26
  r.textContent !== t && (r.textContent = t);
27
27
  }
28
- function m(r) {
28
+ function $(r) {
29
29
  if (!("ownerSVGElement" in r)) return;
30
30
  const t = r.style;
31
31
  !t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
@@ -56,7 +56,7 @@ const d = /* @__PURE__ */ new Set([
56
56
  "gap",
57
57
  "rowGap",
58
58
  "columnGap"
59
- ]), k = /* @__PURE__ */ new Set([
59
+ ]), m = /* @__PURE__ */ new Set([
60
60
  "x",
61
61
  "y",
62
62
  "z",
@@ -74,7 +74,7 @@ const d = /* @__PURE__ */ new Set([
74
74
  "motionPathX",
75
75
  "motionPathY",
76
76
  "motionPathRotate"
77
- ]), S = /* @__PURE__ */ new Set(["originX", "originY"]), T = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), O = {
77
+ ]), k = /* @__PURE__ */ new Set(["originX", "originY"]), O = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), T = /* @__PURE__ */ new Set(["drawOn"]), C = {
78
78
  fill: "backgroundColor",
79
79
  stroke: "borderColor",
80
80
  strokeWidth: "borderWidth",
@@ -89,8 +89,8 @@ const d = /* @__PURE__ */ new Set([
89
89
  strokeDashoffset: "strokeDashoffset",
90
90
  fillOpacity: "fillOpacity",
91
91
  strokeOpacity: "strokeOpacity"
92
- }, C = "http://www.w3.org/2000/svg";
93
- class Y {
92
+ }, Y = "http://www.w3.org/2000/svg";
93
+ class E {
94
94
  targets = /* @__PURE__ */ new Map();
95
95
  /**
96
96
  * Register an HTML element as an animation target.
@@ -120,53 +120,53 @@ class Y {
120
120
  * Apply animation state to all registered targets.
121
121
  */
122
122
  applyState(t) {
123
- for (const [o, s] of t.values) {
123
+ for (const [o, e] of t.values) {
124
124
  const a = this.targets.get(o);
125
- a && this.applyProperties(a, s);
125
+ a && this.applyProperties(a, e);
126
126
  }
127
127
  }
128
128
  /**
129
129
  * Apply properties to a single element.
130
130
  */
131
131
  applyProperties(t, o) {
132
- const s = [];
133
- let a = null, i = null, c = null;
132
+ const e = [];
133
+ let a = null, n = null, c = null;
134
134
  const h = o.has("motionPathX"), y = o.has("motionPathY"), P = o.has("motionPathRotate");
135
- for (const [e, n] of o)
136
- if (!(e === "x" && h) && !(e === "y" && y) && !((e === "rotate" || e === "rotateZ") && P)) {
137
- if (k.has(e)) {
138
- const l = this.buildTransformPart(e, n);
139
- l && s.push(l);
140
- } else if (S.has(e))
141
- typeof n == "number" && ((a ??= {})[e] = n);
142
- else if (T.has(e))
143
- typeof n == "number" && ((i ??= {})[e] = n);
144
- else if (w.has(e))
145
- (c ??= {})[e] = n;
146
- else if (e !== "perspective") {
147
- if (e !== "shine") if (e === "text" && typeof n == "string")
148
- $(t, n);
149
- else if (e === "d" && typeof n == "string") {
135
+ for (const [s, i] of o)
136
+ if (!(s === "x" && h) && !(s === "y" && y) && !((s === "rotate" || s === "rotateZ") && P) && !T.has(s)) {
137
+ if (m.has(s)) {
138
+ const l = this.buildTransformPart(s, i);
139
+ l && e.push(l);
140
+ } else if (k.has(s))
141
+ typeof i == "number" && ((a ??= {})[s] = i);
142
+ else if (O.has(s))
143
+ typeof i == "number" && ((n ??= {})[s] = i);
144
+ else if (w.has(s))
145
+ (c ??= {})[s] = i;
146
+ else if (s !== "perspective") {
147
+ if (s !== "shine") if (s === "text" && typeof i == "string")
148
+ S(t, i);
149
+ else if (s === "d" && typeof i == "string") {
150
150
  const l = t;
151
- (l.tagName?.toLowerCase() === "path" ? l : l.querySelector?.("path"))?.setAttribute?.("d", n);
151
+ (l.tagName?.toLowerCase() === "path" ? l : l.querySelector?.("path"))?.setAttribute?.("d", i);
152
152
  } else
153
- this.applyStyleProperty(t, e, n);
153
+ this.applyStyleProperty(t, s, i);
154
154
  }
155
155
  }
156
156
  const f = o.get("shine");
157
157
  typeof f == "number" && this.applyShine(t, f);
158
158
  const g = o.get("perspective");
159
- if (typeof g == "number" && s.unshift(`perspective(${g}px)`), s.length > 0 && (t.style.transform = s.join(" "), m(t)), a) {
160
- const e = a.originX ?? 50, n = a.originY ?? 50;
161
- t.style.transformOrigin = `${e}% ${n}%`;
159
+ if (typeof g == "number" && e.unshift(`perspective(${g}px)`), e.length > 0 && (t.style.transform = e.join(" "), $(t)), a) {
160
+ const s = a.originX ?? 50, i = a.originY ?? 50;
161
+ t.style.transformOrigin = `${s}% ${i}%`;
162
162
  }
163
- if (i) {
164
- const e = i.clipTop ?? 0, n = i.clipRight ?? 0, l = i.clipBottom ?? 0, p = i.clipLeft ?? 0;
165
- t.style.clipPath = `inset(${e}% ${n}% ${l}% ${p}%)`;
163
+ if (n) {
164
+ const s = n.clipTop ?? 0, i = n.clipRight ?? 0, l = n.clipBottom ?? 0, p = n.clipLeft ?? 0;
165
+ t.style.clipPath = `inset(${s}% ${i}% ${l}% ${p}%)`;
166
166
  }
167
167
  if (c) {
168
- const e = R(c);
169
- e && (t.style.filter = e);
168
+ const s = x(c);
169
+ s && (t.style.filter = s);
170
170
  }
171
171
  }
172
172
  /**
@@ -217,27 +217,27 @@ class Y {
217
217
  */
218
218
  applyShine(t, o) {
219
219
  t.dataset.shineBase || (t.dataset.shineBase = t.style.color || "currentColor");
220
- const s = t.dataset.shineBase, a = -20 + o * 140, i = t.style;
221
- i.color = "transparent", i.backgroundImage = `linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${s}, ${s})`, i.backgroundSize = "250% 100%, 100% 100%", i.backgroundPosition = `${a}% 0, 0 0`, i.backgroundRepeat = "no-repeat", i.webkitBackgroundClip = "text", i.backgroundClip = "text";
220
+ const e = t.dataset.shineBase, a = -20 + o * 140, n = t.style;
221
+ n.color = "transparent", n.backgroundImage = `linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${e}, ${e})`, n.backgroundSize = "250% 100%, 100% 100%", n.backgroundPosition = `${a}% 0, 0 0`, n.backgroundRepeat = "no-repeat", n.webkitBackgroundClip = "text", n.backgroundClip = "text";
222
222
  }
223
223
  /**
224
224
  * Apply a single style property to an element.
225
225
  */
226
- applyStyleProperty(t, o, s) {
226
+ applyStyleProperty(t, o, e) {
227
227
  let a;
228
- if (t.namespaceURI === C && o in u) {
229
- const h = Array.isArray(s) ? s.join(", ") : String(s);
228
+ if (t.namespaceURI === Y && o in u) {
229
+ const h = Array.isArray(e) ? e.join(", ") : String(e);
230
230
  t.style[u[o]] = h;
231
231
  return;
232
- } else o === "fill" && t.dataset?.elementType === "text" ? a = "color" : a = O[o] ?? o;
232
+ } else o === "fill" && t.dataset?.elementType === "text" ? a = "color" : a = C[o] ?? o;
233
233
  let c;
234
- typeof s == "number" ? d.has(o) || d.has(a) ? c = `${s}px` : c = String(s) : Array.isArray(s) ? c = s.join(", ") : c = s, t.style[a] = c;
234
+ typeof e == "number" ? d.has(o) || d.has(a) ? c = `${e}px` : c = String(e) : Array.isArray(e) ? c = e.join(", ") : c = e, t.style[a] = c;
235
235
  }
236
236
  }
237
237
  export {
238
- Y as D,
238
+ E as D,
239
239
  w as F,
240
- R as c,
241
- m as e,
242
- $ as s
240
+ x as c,
241
+ $ as e,
242
+ S as s
243
243
  };
@@ -1,6 +1,6 @@
1
1
  import { getEasingFunction as F, staggerOffset as qt, maxStaggerDistance as Bt, getInterpolator as at, pointsToPath as Ut, isPathData as z, naturalRest as H, SPRING_PRESETS as _, Timeline as Wt, createTrack as ct, springDuration as zt, inertiaDuration as _t, inertiaRest as Gt, staggerSpan as Yt, isParametricEasing as Xt, bakeEasing as Ht, shapeToPathData as et, customBounce as Kt, customEase as Zt, customWiggle as Jt, playheadCrossings as Qt, staggerOffsets as lt } from "@algorisys/tinyfly";
2
2
  import { backOut as Er, bounceOut as Ar, elasticOut as Cr, playheadCrossings as Rr, stepsEasing as Fr } from "@algorisys/tinyfly";
3
- import { D as St } from "./dom-adapter-ChrbtkLC.js";
3
+ import { D as St } from "./dom-adapter-CrNwoomd.js";
4
4
  import { a as Mt, d as ht } from "./smooth-scroll-DaSacemU.js";
5
5
  import { Draggable as te } from "./interaction.js";
6
6
  const q = {
@@ -0,0 +1,128 @@
1
+ import { createRandom as S, hashSeed as q } from "@algorisys/tinyfly";
2
+ function E(t) {
3
+ let n = 0;
4
+ for (let s = 1; s < t.length; s++) n += Math.hypot(t[s].x - t[s - 1].x, t[s].y - t[s - 1].y);
5
+ return n;
6
+ }
7
+ function $(t, n) {
8
+ const s = Math.min(1, Math.max(0, n));
9
+ if (t.length < 2 || s === 1) return t.slice();
10
+ if (s === 0) return t.slice(0, 1);
11
+ let e = E(t) * s;
12
+ const a = [t[0]];
13
+ for (let c = 1; c < t.length; c++) {
14
+ const f = t[c - 1], y = t[c], h = Math.hypot(y.x - f.x, y.y - f.y);
15
+ if (h >= e) {
16
+ const b = h === 0 ? 0 : e / h;
17
+ return a.push({ x: f.x + (y.x - f.x) * b, y: f.y + (y.y - f.y) * b }), a;
18
+ }
19
+ a.push(y), e -= h;
20
+ }
21
+ return a;
22
+ }
23
+ function p(t, n) {
24
+ const s = $(t, n);
25
+ return s[s.length - 1];
26
+ }
27
+ function F(t, n) {
28
+ return n > 0 ? Math.floor(Math.max(0, t) * n / 1e3) : 0;
29
+ }
30
+ function B(t, n, s) {
31
+ const e = n.roughness ?? 2, a = Math.max(1, Math.round(n.passes ?? 2)), c = F(s, n.boil ?? 8);
32
+ let f = 0;
33
+ const y = () => {
34
+ const o = f++;
35
+ return (x) => S(q(`${n.seed ?? 1}:${c}:${o}:${x}`));
36
+ }, h = (o, x) => (o.next() * 2 - 1) * x, b = (o) => {
37
+ const x = y(), u = t.lineWidth, i = t.globalAlpha;
38
+ for (let r = 0; r < a; r++)
39
+ t.lineWidth = r === 0 ? u : u * 0.55, t.globalAlpha = r === 0 ? i : i * 0.6, o(x(r));
40
+ t.lineWidth = u, t.globalAlpha = i;
41
+ }, C = (o, x = 1) => {
42
+ if (o.length < 2) return;
43
+ const u = o.slice(1).map((r, l) => Math.hypot(r.x - o[l].x, r.y - o[l].y)), i = u.reduce((r, l) => r + l, 0) * Math.min(1, Math.max(0, x));
44
+ b((r) => {
45
+ const l = [], k = [];
46
+ if (o.forEach((g, M) => {
47
+ l.push({ x: g.x + h(r, e * 0.5), y: g.y + h(r, e * 0.5) }), M > 0 && k.push([r.next() * 2 - 1, r.next() * 2 - 1]);
48
+ }), i <= 0) return;
49
+ t.beginPath(), t.moveTo(l[0].x, l[0].y);
50
+ let m = 0;
51
+ for (let g = 1; g < l.length; g++) {
52
+ const M = L(l[g - 1], l[g], e, k[g - 1]), w = u[g - 1];
53
+ if (m + w <= i) {
54
+ t.bezierCurveTo(M[1].x, M[1].y, M[2].x, M[2].y, M[3].x, M[3].y), m += w;
55
+ continue;
56
+ }
57
+ const d = R(M, w === 0 ? 1 : (i - m) / w);
58
+ t.bezierCurveTo(d[1].x, d[1].y, d[2].x, d[2].y, d[3].x, d[3].y);
59
+ break;
60
+ }
61
+ t.stroke();
62
+ });
63
+ }, P = (o, x, u, i, r = 1) => {
64
+ b((l) => {
65
+ const m = l.next() * Math.PI * 2, g = Math.PI * 2 + 0.15 + l.next() * 0.3, M = [];
66
+ for (let d = 0; d <= 14; d++) {
67
+ const v = m + g * d / 14, T = h(l, e * 0.6);
68
+ M.push({ x: o + Math.cos(v) * (u + T), y: x + Math.sin(v) * (i + T) });
69
+ }
70
+ const w = $(M, r);
71
+ w.length < 2 || (W(t, w), t.stroke());
72
+ });
73
+ };
74
+ return {
75
+ line: C,
76
+ curve(o, x = 1) {
77
+ if (o.length < 2) return;
78
+ const u = o[0], i = o[o.length - 1], r = Math.hypot(i.x - u.x, i.y - u.y) || 1, l = -(i.y - u.y) / r, k = (i.x - u.x) / r;
79
+ b((m) => {
80
+ const g = { x: h(m, e * 0.5), y: h(m, e * 0.5) }, M = { x: h(m, e * 0.5), y: h(m, e * 0.5) }, w = h(m, e * Math.min(1.5, Math.max(0.3, r / 80))), d = o.map((T, z) => {
81
+ const A = z / (o.length - 1), I = Math.sin(Math.PI * A) * w;
82
+ return {
83
+ x: T.x + g.x + (M.x - g.x) * A + l * I,
84
+ y: T.y + g.y + (M.y - g.y) * A + k * I
85
+ };
86
+ }), v = $(d, x);
87
+ v.length < 2 || (W(t, v), t.stroke());
88
+ });
89
+ },
90
+ circle(o, x, u, i = 1) {
91
+ P(o, x, u, u, i);
92
+ },
93
+ ellipse: P,
94
+ nudge(o = 0.5) {
95
+ const x = y()(0);
96
+ return { x: h(x, e * o), y: h(x, e * o) };
97
+ }
98
+ };
99
+ }
100
+ function L(t, n, s, e) {
101
+ const a = n.x - t.x, c = n.y - t.y, f = Math.hypot(a, c) || 1, y = s * Math.min(1.5, Math.max(0.3, f / 80)), h = -c / f, b = a / f;
102
+ return [
103
+ t,
104
+ { x: t.x + a / 3 + h * e[0] * y, y: t.y + c / 3 + b * e[0] * y },
105
+ { x: t.x + 2 * a / 3 + h * e[1] * y, y: t.y + 2 * c / 3 + b * e[1] * y },
106
+ n
107
+ ];
108
+ }
109
+ function R([t, n, s, e], a) {
110
+ const c = (P, o) => ({ x: P.x + (o.x - P.x) * a, y: P.y + (o.y - P.y) * a }), f = c(t, n), y = c(n, s), h = c(s, e), b = c(f, y), C = c(y, h);
111
+ return [t, f, b, c(b, C)];
112
+ }
113
+ function W(t, n) {
114
+ t.beginPath(), t.moveTo(n[0].x, n[0].y);
115
+ for (let e = 1; e < n.length - 1; e++) {
116
+ const a = { x: (n[e].x + n[e + 1].x) / 2, y: (n[e].y + n[e + 1].y) / 2 };
117
+ t.quadraticCurveTo(n[e].x, n[e].y, a.x, a.y);
118
+ }
119
+ const s = n[n.length - 1];
120
+ t.lineTo(s.x, s.y);
121
+ }
122
+ export {
123
+ p as a,
124
+ F as b,
125
+ E as c,
126
+ $ as p,
127
+ B as s
128
+ };