@algorisys/tinyfly 0.64.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.
Files changed (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +672 -0
  3. package/bin/tinyfly.mjs +59 -0
  4. package/lib/addons/adapters.js +756 -0
  5. package/lib/addons/dom-adapter-ChrbtkLC.js +243 -0
  6. package/lib/addons/drivers.js +72 -0
  7. package/lib/addons/export.js +1169 -0
  8. package/lib/addons/gsap-compat.js +2576 -0
  9. package/lib/addons/interaction.js +225 -0
  10. package/lib/addons/smooth-scroll-DaSacemU.js +671 -0
  11. package/lib/addons/teach.js +215 -0
  12. package/lib/browser/tinyfly.iife.js +2 -0
  13. package/lib/browser/tinyfly.js +6372 -0
  14. package/lib/browser/tinyfly.umd.js +2 -0
  15. package/lib/cli/tools.js +2325 -0
  16. package/lib/embed/tinyfly-embed.iife.js +18 -0
  17. package/lib/embed/tinyfly-embed.js +2316 -0
  18. package/lib/engine/tinyfly-engine.js +1972 -0
  19. package/lib/engine/tinyfly-engine.umd.cjs +2 -0
  20. package/lib/frameworks/react.js +32 -0
  21. package/lib/frameworks/solid.js +27 -0
  22. package/lib/frameworks/svelte.js +15 -0
  23. package/lib/frameworks/vue.js +29 -0
  24. package/lib/player/tinyfly-player.es.js +2306 -0
  25. package/lib/player/tinyfly-player.iife.js +2 -0
  26. package/lib/player/tinyfly-player.umd.js +2 -0
  27. package/lib/types/adapters/canvas/canvas-adapter.d.ts +238 -0
  28. package/lib/types/adapters/canvas/index.d.ts +1 -0
  29. package/lib/types/adapters/dom/dom-adapter.d.ts +50 -0
  30. package/lib/types/adapters/dom/flip.d.ts +60 -0
  31. package/lib/types/adapters/dom/index.d.ts +2 -0
  32. package/lib/types/adapters/filter-utils.d.ts +32 -0
  33. package/lib/types/adapters/index.d.ts +5 -0
  34. package/lib/types/adapters/shine-utils.d.ts +26 -0
  35. package/lib/types/adapters/svg/index.d.ts +1 -0
  36. package/lib/types/adapters/svg/svg-adapter.d.ts +47 -0
  37. package/lib/types/adapters/svg-transform-box.d.ts +13 -0
  38. package/lib/types/adapters/text-content.d.ts +11 -0
  39. package/lib/types/adapters/webgl/index.d.ts +1 -0
  40. package/lib/types/adapters/webgl/webgl-adapter.d.ts +69 -0
  41. package/lib/types/browser/index.d.ts +41 -0
  42. package/lib/types/compat/gsap/custom-eases.d.ts +28 -0
  43. package/lib/types/compat/gsap/defaults.d.ts +19 -0
  44. package/lib/types/compat/gsap/draw-svg-vars.d.ts +36 -0
  45. package/lib/types/compat/gsap/ease-map.d.ts +51 -0
  46. package/lib/types/compat/gsap/image-sequence.d.ts +61 -0
  47. package/lib/types/compat/gsap/index.d.ts +65 -0
  48. package/lib/types/compat/gsap/inertia-vars.d.ts +39 -0
  49. package/lib/types/compat/gsap/keyframes-vars.d.ts +8 -0
  50. package/lib/types/compat/gsap/layout.d.ts +6 -0
  51. package/lib/types/compat/gsap/live-context.d.ts +87 -0
  52. package/lib/types/compat/gsap/live-draggable.d.ts +75 -0
  53. package/lib/types/compat/gsap/live-flip.d.ts +73 -0
  54. package/lib/types/compat/gsap/live-morph.d.ts +18 -0
  55. package/lib/types/compat/gsap/live-motion-path.d.ts +33 -0
  56. package/lib/types/compat/gsap/live-scroll-to.d.ts +52 -0
  57. package/lib/types/compat/gsap/live-scroll.d.ts +108 -0
  58. package/lib/types/compat/gsap/live-transition.d.ts +40 -0
  59. package/lib/types/compat/gsap/live.d.ts +341 -0
  60. package/lib/types/compat/gsap/morph-vars.d.ts +21 -0
  61. package/lib/types/compat/gsap/motion-path-vars.d.ts +38 -0
  62. package/lib/types/compat/gsap/playhead-crossings.d.ts +47 -0
  63. package/lib/types/compat/gsap/position.d.ts +37 -0
  64. package/lib/types/compat/gsap/quick-play.d.ts +38 -0
  65. package/lib/types/compat/gsap/split-text.d.ts +66 -0
  66. package/lib/types/compat/gsap/spring-vars.d.ts +34 -0
  67. package/lib/types/compat/gsap/stage.d.ts +182 -0
  68. package/lib/types/compat/gsap/stagger-grid.d.ts +30 -0
  69. package/lib/types/compat/gsap/text-vars.d.ts +39 -0
  70. package/lib/types/compat/gsap/timeline.d.ts +161 -0
  71. package/lib/types/compat/gsap/utils.d.ts +60 -0
  72. package/lib/types/compat/gsap/vars.d.ts +79 -0
  73. package/lib/types/drivers/index.d.ts +8 -0
  74. package/lib/types/drivers/scroll-driver.d.ts +218 -0
  75. package/lib/types/drivers/scroll-markers.d.ts +41 -0
  76. package/lib/types/drivers/scroll-math.d.ts +87 -0
  77. package/lib/types/drivers/scroll-pin.d.ts +45 -0
  78. package/lib/types/drivers/scroll-snap.d.ts +47 -0
  79. package/lib/types/drivers/smooth-scroll.d.ts +118 -0
  80. package/lib/types/drivers/types.d.ts +23 -0
  81. package/lib/types/drivers/visibility-driver.d.ts +56 -0
  82. package/lib/types/embed/controls.d.ts +46 -0
  83. package/lib/types/embed/index.d.ts +17 -0
  84. package/lib/types/embed/mount.d.ts +41 -0
  85. package/lib/types/embed/tools.d.ts +33 -0
  86. package/lib/types/engine/authoring/custom-ease.d.ts +49 -0
  87. package/lib/types/engine/authoring/index.d.ts +3 -0
  88. package/lib/types/engine/authoring/random.d.ts +38 -0
  89. package/lib/types/engine/authoring/resolve-values.d.ts +57 -0
  90. package/lib/types/engine/core/bake.d.ts +66 -0
  91. package/lib/types/engine/core/clock.d.ts +44 -0
  92. package/lib/types/engine/core/index.d.ts +8 -0
  93. package/lib/types/engine/core/inertia.d.ts +30 -0
  94. package/lib/types/engine/core/playhead-crossings.d.ts +47 -0
  95. package/lib/types/engine/core/spring.d.ts +132 -0
  96. package/lib/types/engine/core/stagger.d.ts +40 -0
  97. package/lib/types/engine/core/timeline.d.ts +203 -0
  98. package/lib/types/engine/core/track.d.ts +90 -0
  99. package/lib/types/engine/export/byte-writer.d.ts +36 -0
  100. package/lib/types/engine/export/css.d.ts +31 -0
  101. package/lib/types/engine/export/gif-decode.test-helper.d.ts +24 -0
  102. package/lib/types/engine/export/gif.d.ts +134 -0
  103. package/lib/types/engine/export/index.d.ts +9 -0
  104. package/lib/types/engine/export/lottie.d.ts +104 -0
  105. package/lib/types/engine/export/mp4.d.ts +64 -0
  106. package/lib/types/engine/export/quantize.d.ts +56 -0
  107. package/lib/types/engine/export/sprite-sheet.d.ts +46 -0
  108. package/lib/types/engine/export/video.d.ts +99 -0
  109. package/lib/types/engine/export/webp.d.ts +82 -0
  110. package/lib/types/engine/index.d.ts +7 -0
  111. package/lib/types/engine/interpolation/easing.d.ts +65 -0
  112. package/lib/types/engine/interpolation/index.d.ts +2 -0
  113. package/lib/types/engine/interpolation/interpolators.d.ts +25 -0
  114. package/lib/types/engine/path/index.d.ts +11 -0
  115. package/lib/types/engine/path/motion-path.d.ts +24 -0
  116. package/lib/types/engine/path/path-builders.d.ts +38 -0
  117. package/lib/types/engine/path/path-morph.d.ts +47 -0
  118. package/lib/types/engine/path/path-utils.d.ts +73 -0
  119. package/lib/types/engine/serialization/index.d.ts +1 -0
  120. package/lib/types/engine/serialization/json.d.ts +30 -0
  121. package/lib/types/engine/text/index.d.ts +2 -0
  122. package/lib/types/engine/text/text-value.d.ts +16 -0
  123. package/lib/types/engine/types.d.ts +401 -0
  124. package/lib/types/frameworks/react.d.ts +35 -0
  125. package/lib/types/frameworks/solid.d.ts +16 -0
  126. package/lib/types/frameworks/svelte.d.ts +19 -0
  127. package/lib/types/frameworks/vue.d.ts +27 -0
  128. package/lib/types/interaction/draggable.d.ts +133 -0
  129. package/lib/types/interaction/index.d.ts +3 -0
  130. package/lib/types/interaction/observer.d.ts +80 -0
  131. package/lib/types/interaction/snap.d.ts +30 -0
  132. package/lib/types/player/index.d.ts +7 -0
  133. package/lib/types/player/media-sync.d.ts +60 -0
  134. package/lib/types/player/player.d.ts +238 -0
  135. package/lib/types/player/sequence-types.d.ts +68 -0
  136. package/lib/types/player/sequencer.d.ts +91 -0
  137. package/lib/types/teach/diagrams.d.ts +137 -0
  138. package/lib/types/teach/index.d.ts +11 -0
  139. package/lib/types/teach/lesson.d.ts +55 -0
  140. package/package.json +170 -0
@@ -0,0 +1,243 @@
1
+ const w = /* @__PURE__ */ new Set([
2
+ "blur",
3
+ "brightness",
4
+ "glow",
5
+ "glowColor",
6
+ "shadowX",
7
+ "shadowY",
8
+ "shadowBlur",
9
+ "shadowColor"
10
+ ]), b = "#ffffff", x = "rgba(0, 0, 0, 0.5)";
11
+ function R(r) {
12
+ const t = [];
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})`);
16
+ }
17
+ return t.length > 0 ? t.join(" ") : null;
18
+ }
19
+ function $(r, t) {
20
+ const o = r.childNodes.length === 1 ? r.firstChild : null;
21
+ if (o && o.nodeType === 3) {
22
+ const s = o;
23
+ s.data !== t && (s.data = t);
24
+ return;
25
+ }
26
+ r.textContent !== t && (r.textContent = t);
27
+ }
28
+ function m(r) {
29
+ if (!("ownerSVGElement" in r)) return;
30
+ const t = r.style;
31
+ !t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
32
+ }
33
+ const d = /* @__PURE__ */ new Set([
34
+ "width",
35
+ "height",
36
+ "top",
37
+ "right",
38
+ "bottom",
39
+ "left",
40
+ "margin",
41
+ "marginTop",
42
+ "marginRight",
43
+ "marginBottom",
44
+ "marginLeft",
45
+ "padding",
46
+ "paddingTop",
47
+ "paddingRight",
48
+ "paddingBottom",
49
+ "paddingLeft",
50
+ "borderRadius",
51
+ "borderWidth",
52
+ "fontSize",
53
+ "lineHeight",
54
+ "letterSpacing",
55
+ "outlineWidth",
56
+ "gap",
57
+ "rowGap",
58
+ "columnGap"
59
+ ]), k = /* @__PURE__ */ new Set([
60
+ "x",
61
+ "y",
62
+ "z",
63
+ "rotate",
64
+ "rotateX",
65
+ "rotateY",
66
+ "rotateZ",
67
+ "scale",
68
+ "scaleX",
69
+ "scaleY",
70
+ "scaleZ",
71
+ "skewX",
72
+ "skewY",
73
+ // Motion path properties
74
+ "motionPathX",
75
+ "motionPathY",
76
+ "motionPathRotate"
77
+ ]), S = /* @__PURE__ */ new Set(["originX", "originY"]), T = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), O = {
78
+ fill: "backgroundColor",
79
+ stroke: "borderColor",
80
+ strokeWidth: "borderWidth",
81
+ color: "color",
82
+ backgroundColor: "backgroundColor",
83
+ borderColor: "borderColor"
84
+ }, u = {
85
+ fill: "fill",
86
+ stroke: "stroke",
87
+ strokeWidth: "strokeWidth",
88
+ strokeDasharray: "strokeDasharray",
89
+ strokeDashoffset: "strokeDashoffset",
90
+ fillOpacity: "fillOpacity",
91
+ strokeOpacity: "strokeOpacity"
92
+ }, C = "http://www.w3.org/2000/svg";
93
+ class Y {
94
+ targets = /* @__PURE__ */ new Map();
95
+ /**
96
+ * Register an HTML element as an animation target.
97
+ */
98
+ registerTarget(t, o) {
99
+ this.targets.set(t, o);
100
+ }
101
+ /**
102
+ * Unregister a target by its ID.
103
+ */
104
+ unregisterTarget(t) {
105
+ this.targets.delete(t);
106
+ }
107
+ /**
108
+ * Get a registered target element.
109
+ */
110
+ getTarget(t) {
111
+ return this.targets.get(t);
112
+ }
113
+ /**
114
+ * Clear all registered targets.
115
+ */
116
+ clearTargets() {
117
+ this.targets.clear();
118
+ }
119
+ /**
120
+ * Apply animation state to all registered targets.
121
+ */
122
+ applyState(t) {
123
+ for (const [o, s] of t.values) {
124
+ const a = this.targets.get(o);
125
+ a && this.applyProperties(a, s);
126
+ }
127
+ }
128
+ /**
129
+ * Apply properties to a single element.
130
+ */
131
+ applyProperties(t, o) {
132
+ const s = [];
133
+ let a = null, i = null, c = null;
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") {
150
+ const l = t;
151
+ (l.tagName?.toLowerCase() === "path" ? l : l.querySelector?.("path"))?.setAttribute?.("d", n);
152
+ } else
153
+ this.applyStyleProperty(t, e, n);
154
+ }
155
+ }
156
+ const f = o.get("shine");
157
+ typeof f == "number" && this.applyShine(t, f);
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}%`;
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}%)`;
166
+ }
167
+ if (c) {
168
+ const e = R(c);
169
+ e && (t.style.filter = e);
170
+ }
171
+ }
172
+ /**
173
+ * Build a transform function string for a property.
174
+ */
175
+ buildTransformPart(t, o) {
176
+ if (typeof o != "number") return null;
177
+ switch (t) {
178
+ case "x":
179
+ case "motionPathX":
180
+ return `translateX(${o}px)`;
181
+ case "y":
182
+ case "motionPathY":
183
+ return `translateY(${o}px)`;
184
+ case "z":
185
+ return `translateZ(${o}px)`;
186
+ case "rotate":
187
+ case "rotateZ":
188
+ case "motionPathRotate":
189
+ return `rotate(${o}deg)`;
190
+ case "rotateX":
191
+ return `rotateX(${o}deg)`;
192
+ case "rotateY":
193
+ return `rotateY(${o}deg)`;
194
+ case "scale":
195
+ return `scale(${o})`;
196
+ case "scaleX":
197
+ return `scaleX(${o})`;
198
+ case "scaleY":
199
+ return `scaleY(${o})`;
200
+ case "scaleZ":
201
+ return `scaleZ(${o})`;
202
+ case "skewX":
203
+ return `skewX(${o}deg)`;
204
+ case "skewY":
205
+ return `skewY(${o}deg)`;
206
+ default:
207
+ return null;
208
+ }
209
+ }
210
+ /**
211
+ * Apply a shine sweep to a (text) element.
212
+ *
213
+ * `progress` runs 0..1 as the highlight travels from just off the left edge to
214
+ * just off the right. Two layered, text-clipped gradients are used: a moving
215
+ * white highlight band on top of a solid layer of the element's base colour,
216
+ * so the text stays visible while the sheen passes over the glyphs.
217
+ */
218
+ applyShine(t, o) {
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";
222
+ }
223
+ /**
224
+ * Apply a single style property to an element.
225
+ */
226
+ applyStyleProperty(t, o, s) {
227
+ let a;
228
+ if (t.namespaceURI === C && o in u) {
229
+ const h = Array.isArray(s) ? s.join(", ") : String(s);
230
+ t.style[u[o]] = h;
231
+ return;
232
+ } else o === "fill" && t.dataset?.elementType === "text" ? a = "color" : a = O[o] ?? o;
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;
235
+ }
236
+ }
237
+ export {
238
+ Y as D,
239
+ w as F,
240
+ R as c,
241
+ m as e,
242
+ $ as s
243
+ };
@@ -0,0 +1,72 @@
1
+ import { S as a, a as h, b as l, c, d as g, e as u, f as p, p as v, g as b, s as f, h as d, i as m, j as y, k as P, l as S, t as D } from "./smooth-scroll-DaSacemU.js";
2
+ class t {
3
+ timeline;
4
+ trigger;
5
+ behaviour;
6
+ options;
7
+ observer = null;
8
+ hasPlayed = !1;
9
+ running = !1;
10
+ constructor(e) {
11
+ this.timeline = e.timeline, this.trigger = e.trigger, this.behaviour = e.behaviour ?? "once", this.options = e;
12
+ }
13
+ start() {
14
+ if (!this.running) {
15
+ if (this.running = !0, typeof IntersectionObserver > "u") {
16
+ this.enter();
17
+ return;
18
+ }
19
+ this.observer = new IntersectionObserver(
20
+ (e) => {
21
+ for (const r of e)
22
+ r.isIntersecting ? this.enter() : this.leave();
23
+ },
24
+ {
25
+ threshold: this.options.threshold ?? 0.15,
26
+ rootMargin: this.options.rootMargin,
27
+ root: this.options.root ?? null
28
+ }
29
+ ), this.observer.observe(this.trigger);
30
+ }
31
+ }
32
+ stop() {
33
+ this.running = !1, this.observer?.disconnect(), this.observer = null;
34
+ }
35
+ destroy() {
36
+ this.stop();
37
+ }
38
+ /** Forget that the animation has played, so 'once' can fire again. */
39
+ reset() {
40
+ this.hasPlayed = !1, this.timeline.stop();
41
+ }
42
+ enter() {
43
+ this.options.onEnter?.(), !(this.behaviour === "once" && this.hasPlayed) && (this.hasPlayed = !0, this.behaviour !== "once" && this.timeline.seek(0), this.timeline.play());
44
+ }
45
+ leave() {
46
+ this.options.onLeave?.(), this.behaviour === "reset" && this.timeline.stop();
47
+ }
48
+ }
49
+ function i(s) {
50
+ const e = new t(s);
51
+ return e.start(), e;
52
+ }
53
+ export {
54
+ a as ScrollAnimator,
55
+ h as ScrollDriver,
56
+ l as ScrollMarkers,
57
+ c as ScrollPin,
58
+ g as SmoothScroll,
59
+ t as VisibilityDriver,
60
+ u as clamp01,
61
+ p as containerProgressAt,
62
+ v as parseEdge,
63
+ b as parseTrigger,
64
+ i as playWhenVisible,
65
+ f as scrollProgress,
66
+ d as scrubOnScroll,
67
+ m as smoothToward,
68
+ y as snapConfig,
69
+ P as snapDuration,
70
+ S as snapProgress,
71
+ D as triggerDistance
72
+ };