@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,32 @@
1
+ /**
2
+ * Shared composition of animatable CSS/Canvas filters.
3
+ *
4
+ * The engine animates plain numeric (and color) properties; adapters collect the
5
+ * filter-related ones and compose a single `filter` string. Keeping this in one
6
+ * place means DOM, SVG, and Canvas render filters identically.
7
+ */
8
+ /** Property names that feed the composed filter. */
9
+ export declare const FILTER_PROPERTIES: Set<string>;
10
+ export interface FilterValues {
11
+ /** Gaussian blur radius in px. */
12
+ blur?: number;
13
+ /** Brightness multiplier (1 = unchanged). */
14
+ brightness?: number;
15
+ /** Glow radius in px (rendered as a coloured drop-shadow with no offset). */
16
+ glow?: number;
17
+ /** Glow colour (defaults to white). */
18
+ glowColor?: string;
19
+ /** Drop-shadow horizontal offset in px. */
20
+ shadowX?: number;
21
+ /** Drop-shadow vertical offset in px. */
22
+ shadowY?: number;
23
+ /** Drop-shadow blur radius in px. */
24
+ shadowBlur?: number;
25
+ /** Drop-shadow colour (defaults to semi-transparent black). */
26
+ shadowColor?: string;
27
+ }
28
+ /**
29
+ * Compose a CSS `filter` value from animatable filter properties.
30
+ * Returns null when no filter properties are present.
31
+ */
32
+ export declare function composeFilter(v: FilterValues): string | null;
@@ -0,0 +1,5 @@
1
+ export * from './dom';
2
+ export * from './canvas';
3
+ export * from './svg';
4
+ export * from './webgl';
5
+ export { setTextContent } from './text-content';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared maths for the "shine sweep": a bright highlight band that travels
3
+ * across an element's fill, used by the Canvas and SVG adapters (the DOM adapter
4
+ * uses a CSS background-clip:text gradient instead).
5
+ *
6
+ * Given a sweep progress (0..1) and a base colour, it returns gradient stops
7
+ * (offset 0..1) describing a base fill with a moving highlight. When the band is
8
+ * off either edge, only the base colour remains, so the element renders normally.
9
+ */
10
+ export interface ShineStop {
11
+ offset: number;
12
+ color: string;
13
+ }
14
+ export interface ShineOptions {
15
+ /** Highlight colour at the centre of the band. Defaults to white. */
16
+ highlight?: string;
17
+ /** Half-width of the band as a fraction of the fill (0..1). Defaults to 0.12. */
18
+ halfWidth?: number;
19
+ }
20
+ /**
21
+ * Compute gradient stops for a shine sweep.
22
+ *
23
+ * `progress` runs 0..1; the band centre travels from -0.2 (off the left) to 1.2
24
+ * (off the right) so it fully enters and exits.
25
+ */
26
+ export declare function shineStops(progress: number, baseColor: string, options?: ShineOptions): ShineStop[];
@@ -0,0 +1 @@
1
+ export * from './svg-adapter';
@@ -0,0 +1,47 @@
1
+ import type { AnimationState } from '../../engine/types';
2
+ /**
3
+ * SVGAdapter applies animation state to SVG elements.
4
+ * It maps animation properties to SVG attributes and handles
5
+ * transform composition.
6
+ */
7
+ export declare class SVGAdapter {
8
+ private targets;
9
+ /**
10
+ * Register an SVG element as an animation target.
11
+ */
12
+ registerTarget(id: string, element: SVGElement): void;
13
+ /**
14
+ * Unregister a target by its ID.
15
+ */
16
+ unregisterTarget(id: string): void;
17
+ /**
18
+ * Get a registered target element.
19
+ */
20
+ getTarget(id: string): SVGElement | undefined;
21
+ /**
22
+ * Clear all registered targets.
23
+ */
24
+ clearTargets(): void;
25
+ /**
26
+ * Apply animation state to all registered targets.
27
+ */
28
+ applyState(state: AnimationState): void;
29
+ /**
30
+ * Apply properties to a single SVG element.
31
+ */
32
+ private applyProperties;
33
+ /**
34
+ * Build a CSS transform string (for use with transform-origin).
35
+ */
36
+ private buildCssTransformString;
37
+ /**
38
+ * Apply a single attribute to an SVG element.
39
+ */
40
+ /**
41
+ * Apply a shine sweep to an SVG (text) element by filling it with an injected
42
+ * linear gradient whose highlight band moves with `progress` (0..1). The
43
+ * gradient lives in the owner SVG's <defs> and is reused across frames.
44
+ */
45
+ private applyShine;
46
+ private applyAttribute;
47
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Make CSS transforms on an SVG element pivot around the element itself.
3
+ *
4
+ * SVG content transforms about its user-space origin (the SVG's top-left) by
5
+ * default, so `rotate: 90` on a rect swings it around the corner of the whole
6
+ * drawing, while the same animation on an HTML element or a canvas shape turns
7
+ * it in place. Setting `transform-box: fill-box` with a centre origin makes all
8
+ * three agree, which is also what GSAP does for SVG.
9
+ *
10
+ * Only applied when the author has not set a transform box: an explicit origin
11
+ * (inline style, or an origin track) always wins.
12
+ */
13
+ export declare function ensureSvgTransformBox(element: Element): void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Set an element's text for a text track.
3
+ *
4
+ * When the element holds exactly one text node, that node's `data` is updated
5
+ * in place rather than replacing the node. UI frameworks that rendered the text
6
+ * (the editor's Solid preview, a React app) keep a reference to that node; if it
7
+ * were swapped out, their later updates would land on a detached node and never
8
+ * show. Anything else gets its `textContent` replaced. Unchanged text is left
9
+ * alone, so a settled string does not touch the DOM every frame.
10
+ */
11
+ export declare function setTextContent(element: Element, value: string): void;
@@ -0,0 +1 @@
1
+ export * from './webgl-adapter';
@@ -0,0 +1,69 @@
1
+ import type { AnimationState } from '../../engine';
2
+ /**
3
+ * Minimal WebGL render target.
4
+ *
5
+ * CLAUDE.md lists WebGL as a supported target, and until now no adapter existed.
6
+ * This one is deliberately small: every target is a textured or solid-coloured
7
+ * quad with a transform, opacity and tint. That covers the same ground as the
8
+ * Canvas adapter for the common case — moving, scaling, rotating, fading
9
+ * rectangles and images — on the GPU.
10
+ *
11
+ * It is not a scene graph and not a sprite engine. Paths, text and gradients
12
+ * are out of scope; use the Canvas or SVG adapter for those.
13
+ *
14
+ * Like every adapter, it knows nothing about time. The engine hands it values;
15
+ * it draws them.
16
+ */
17
+ export interface WebGLTarget {
18
+ /** Centre position, in pixels from the top-left of the canvas */
19
+ x: number;
20
+ y: number;
21
+ width: number;
22
+ height: number;
23
+ /** 0..1 */
24
+ opacity?: number;
25
+ /** Degrees, clockwise */
26
+ rotate?: number;
27
+ scale?: number;
28
+ scaleX?: number;
29
+ scaleY?: number;
30
+ /** Transform pivot as a percentage of the quad (default 50/50) */
31
+ originX?: number;
32
+ originY?: number;
33
+ /** Solid colour as #rgb / #rrggbb, used when no texture is set */
34
+ fill?: string;
35
+ /** Optional texture image */
36
+ texture?: TexImageSource;
37
+ }
38
+ export declare class WebGLAdapter {
39
+ private gl;
40
+ private program;
41
+ private positionBuffer;
42
+ private texCoordBuffer;
43
+ private textures;
44
+ private targets;
45
+ /** Base positions, so x/y animate as offsets like the other adapters */
46
+ private basePositions;
47
+ private locations;
48
+ constructor(gl: WebGLRenderingContext);
49
+ registerTarget(id: string, target: WebGLTarget): void;
50
+ unregisterTarget(id: string): void;
51
+ getTarget(id: string): WebGLTarget | undefined;
52
+ clearTargets(): void;
53
+ /** Apply engine state to the registered targets. */
54
+ applyState(state: AnimationState): void;
55
+ private applyProperty;
56
+ /** Draw every registered target. */
57
+ render(): void;
58
+ private drawTarget;
59
+ private textureFor;
60
+ /** Release GL resources. */
61
+ destroy(): void;
62
+ }
63
+ /**
64
+ * Build the 3x3 matrix that maps the unit quad to the target's on-screen box,
65
+ * in clip space. Column-major, as WebGL expects.
66
+ */
67
+ export declare function quadMatrix(target: WebGLTarget, canvasWidth: number, canvasHeight: number): Float32Array;
68
+ /** Parse #rgb / #rrggbb into 0..1 components. Unknown input renders white. */
69
+ export declare function parseColor(color: string): [number, number, number];
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The all-in-one browser bundle: `<script src=".../tinyfly.iife.js">` exposes a
3
+ * single `tinyfly` global.
4
+ *
5
+ * tinyfly.to('.box', { x: 200, duration: 1 })
6
+ * tinyfly.timeline({ repeat: -1, yoyo: true })
7
+ * .to('.a', { y: -40, duration: 0.4 })
8
+ * .to('.b', { rotate: 90, duration: 0.4 }, '<')
9
+ *
10
+ * The top-level `to` / `from` / `fromTo` / `set` / `timeline` are the live
11
+ * facade (they play on real elements). The engine, the player, the compiling
12
+ * `tf` facade, drivers and interaction are all available on the same global.
13
+ *
14
+ * Bundler users should import the individual entry points instead
15
+ * (`tinyfly`, `tinyfly/player`, `tinyfly/gsap-compat`, …) so unused parts
16
+ * tree-shake away; this file exists for pages with no build step.
17
+ */
18
+ export declare const to: (target: import("../compat/gsap").TargetInput, vars: import("../compat/gsap").TweenVars) => import(".").LiveTimeline;
19
+ export declare const from: (target: import("../compat/gsap").TargetInput, vars: import("../compat/gsap").TweenVars) => import(".").LiveTimeline;
20
+ export declare const fromTo: (target: import("../compat/gsap").TargetInput, fromVars: import("../compat/gsap").TweenVars, toVars: import("../compat/gsap").TweenVars) => import(".").LiveTimeline;
21
+ export declare const set: (target: import("../compat/gsap").TargetInput, vars: import("../compat/gsap").TweenVars) => import(".").LiveTimeline;
22
+ export declare const timeline: (options?: import("../compat/gsap").LiveTimelineOptions) => import(".").LiveTimeline;
23
+ /** Per-frame callbacks, run after animations are applied (GSAP's `gsap.ticker`). */
24
+ export declare const ticker: import("../compat/gsap").Ticker;
25
+ /** Split text into char, word and line spans (GSAP's SplitText). */
26
+ export declare const splitText: (targets: string | Element | ArrayLike<Element>, options?: import("../compat/gsap").SplitTextOptions) => import("../compat/gsap").SplitTextResult;
27
+ /** Collect animations so they can be reverted together (GSAP's `gsap.context`). */
28
+ export declare const context: (fn?: (context: import("../compat/gsap").LiveContext) => unknown, scope?: ParentNode) => import("../compat/gsap").LiveContext;
29
+ /** Setups that apply while media queries match (GSAP's `gsap.matchMedia`). */
30
+ export declare const matchMedia: (scope?: ParentNode) => import("../compat/gsap").LiveMatchMedia;
31
+ /** A reusable setter that animates one property toward each value (GSAP's `gsap.quickTo`). */
32
+ export declare const quickTo: (target: import("../compat/gsap").TargetInput, property: string, vars?: import("../compat/gsap").QuickToVars) => import("../compat/gsap").QuickTo;
33
+ /** A canvas scrubbing through an image sequence (tween its `frame`). */
34
+ export declare const imageSequence: (canvas: string | HTMLCanvasElement, options: import("../compat/gsap").ImageSequenceOptions) => import("../compat/gsap").ImageSequence;
35
+ /** Animate a client-side page change (old view out, update, shared elements across, new view in). */
36
+ export declare const pageTransition: (options: import("../compat/gsap").PageTransitionOptions) => Promise<void>;
37
+ export * from '../engine';
38
+ export * from '../player';
39
+ export * from '../drivers';
40
+ export * from '../interaction';
41
+ export { tf, live, createLive, Stage, LiveTimeline, CompatTimeline, quickPlay, mapEase, CustomEase, CustomBounce, CustomWiggle, } from '../compat/gsap';
@@ -0,0 +1,28 @@
1
+ import { type CubicBezierPoints, type CustomBounceOptions, type CustomWiggleOptions } from '../../engine';
2
+ /**
3
+ * GSAP's CustomEase, CustomBounce and CustomWiggle: build a curve once, give it a
4
+ * name, and use the name as an ease anywhere.
5
+ *
6
+ * CustomEase.create('hop', 'M0,0 C0.2,0 0.3,1.4 0.5,1.1 0.7,0.8 0.8,1 1,1')
7
+ * CustomBounce.create('drop', { strength: 0.6 })
8
+ * CustomWiggle.create('shake', { wiggles: 8 })
9
+ *
10
+ * live.to('.ball', { y: 300, ease: 'drop' })
11
+ *
12
+ * Curves are built from the engine's pure generators (engine/authoring/custom-ease.ts).
13
+ * A single cubic-bezier stays an exact, serializable easing; anything else is
14
+ * sampled into keyframes by the tween that uses it, so the JSON needs no curve
15
+ * implementation to play.
16
+ */
17
+ export declare const CustomEase: {
18
+ /** Register a curve from SVG path data or bezier points. Returns the name. */
19
+ create: (name: string, definition: string | CubicBezierPoints) => string;
20
+ };
21
+ export declare const CustomBounce: {
22
+ /** Register a bouncing ease that lands and settles on the end value. Returns the name. */
23
+ create: (name: string, options?: CustomBounceOptions) => string;
24
+ };
25
+ export declare const CustomWiggle: {
26
+ /** Register a wiggle that swings around the start value and returns to it. Returns the name. */
27
+ create: (name: string, options?: CustomWiggleOptions) => string;
28
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Static starting values for animatable properties.
3
+ *
4
+ * GSAP reads the live DOM to find a `to()` tween's implicit start value. We
5
+ * cannot: `getComputedStyle` is exactly the implicit browser state that
6
+ * determinism rule 5 rules out, and it would make the same JSON play
7
+ * differently depending on the page's CSS.
8
+ *
9
+ * So the start value is resolved, in order:
10
+ * 1. an explicit `from` (fromTo) — always wins
11
+ * 2. the last value authored for that target+property on this timeline
12
+ * 3. a `defaults` map passed to `timeline({ defaults })`
13
+ * 4. the documented static default below
14
+ *
15
+ * Reaching (4) is the case that surprises GSAP users, so the facade warns.
16
+ */
17
+ export declare const PROPERTY_DEFAULTS: Record<string, number>;
18
+ /** The documented static default for a property, if it has one. */
19
+ export declare function defaultFor(property: string): number | undefined;
@@ -0,0 +1,36 @@
1
+ import type { TweenVars } from './vars';
2
+ /**
3
+ * GSAP's `drawSVG` option: animate how much of a stroke is drawn.
4
+ *
5
+ * live.from('.line', { drawSVG: 0, duration: 1 }) // draw in from nothing
6
+ * live.to('.line', { drawSVG: '40% 60%', duration: 1 }) // shrink to the middle fifth
7
+ *
8
+ * A visible segment [start, end] along a path of length L is one dash of
9
+ * `end - start` followed by a gap of L (so no second dash ever shows), shifted
10
+ * back by `start`:
11
+ *
12
+ * stroke-dasharray: <end - start> <L>; stroke-dashoffset: <-start>
13
+ *
14
+ * Both are plain numeric values, so a draw compiles to ordinary tracks on
15
+ * `strokeDasharray` (a two-number array) and `strokeDashoffset`. Only the length
16
+ * needs the page, so `live` measures it once per element.
17
+ */
18
+ export type DrawSvgValue = boolean | number | string;
19
+ /**
20
+ * The visible segment `[start, end]` in px for a `drawSVG` value on a path of
21
+ * `length`:
22
+ * - `true` → the whole stroke; `false` → none
23
+ * - a number → that many px from the start
24
+ * - `'60%'` → the first 60%; `'20% 80%'` → from 20% to 80%
25
+ * - `'10 50'` → px, and units may mix: `'10 50%'`
26
+ */
27
+ export declare function drawSegment(value: DrawSvgValue, length: number): [number, number];
28
+ /** The dash values that draw `[start, end]` of a stroke `length` long. */
29
+ export declare function drawSvgProperties(value: DrawSvgValue, length: number): {
30
+ strokeDasharray: number[];
31
+ strokeDashoffset: number;
32
+ };
33
+ /** Replace `drawSVG` with dash properties for a stroke of `length`. */
34
+ export declare function resolveDrawSvg(vars: TweenVars, length: number): TweenVars;
35
+ /** `drawSVG` needs a stroke's length, which only the page has. */
36
+ export declare function rejectUnresolvedDrawSvg(vars: TweenVars): TweenVars;
@@ -0,0 +1,51 @@
1
+ import type { EasingType, EasingFunction, CubicBezierPoints } from '../../engine';
2
+ /**
3
+ * GSAP ease names mapped onto tinyfly easings.
4
+ *
5
+ * Most of GSAP's eases are smooth curves that a cubic-bezier reproduces closely
6
+ * enough that nobody can tell. Four families are not beziers — `elastic`
7
+ * oscillates, `bounce` rebounds, `back` with an overshoot of its own, and `steps`
8
+ * jumps — and map to the engine's parametric eases (`{ type: 'elastic', … }`),
9
+ * which serialize as small JSON and are evaluated exactly when played.
10
+ *
11
+ * Registered curves (CustomEase, CustomBounce, CustomWiggle) have no closed form
12
+ * and are sampled into keyframes when a tween uses them.
13
+ */
14
+ /** Eases that must be sampled into keyframes: registered custom curves. */
15
+ export type NonBezierEase = 'custom';
16
+ export interface MappedEase {
17
+ /** A serializable easing, when one exists */
18
+ easing?: EasingType;
19
+ /** A raw function, when the ease must be baked into keyframes */
20
+ fn?: EasingFunction;
21
+ /** Which non-bezier family this came from, if any */
22
+ requiresBaking?: NonBezierEase;
23
+ }
24
+ /** Normalise "Power2.easeOut", "power2.out" and "power2" to one spelling. */
25
+ export declare function normaliseEaseName(name: string): string;
26
+ export { elasticOut, bounceOut, backOut, stepsEasing } from '../../engine';
27
+ /** GSAP elastic.in with the given parameters. */
28
+ export declare const elasticIn: (amplitude?: number, period?: number) => EasingFunction;
29
+ /** GSAP elastic.inOut with the given parameters. */
30
+ export declare const elasticInOut: (amplitude?: number, period?: number) => EasingFunction;
31
+ export declare const bounceIn: EasingFunction;
32
+ export declare const bounceInOut: EasingFunction;
33
+ /** GSAP's steps(n): n + 1 levels from 0 to 1. */
34
+ export declare const steps: (count: number) => EasingFunction;
35
+ /**
36
+ * Map a GSAP ease name to something tinyfly can use.
37
+ *
38
+ * Unknown names fall back to `ease-out` rather than throwing: an unrecognised
39
+ * ease should not stop an animation from being built.
40
+ */
41
+ export declare function mapEase(name: string): MappedEase;
42
+ /** Whether an ease name needs baking rather than a serializable easing. */
43
+ export declare function easeRequiresBaking(name: string): boolean;
44
+ /**
45
+ * Register an ease under a name, for use as `ease: name`. A cubic-bezier is kept
46
+ * exact; any other curve is sampled into keyframes when a tween uses it.
47
+ */
48
+ export declare function registerEase(name: string, ease: {
49
+ fn: EasingFunction;
50
+ bezier?: CubicBezierPoints;
51
+ }): string;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Image-sequence scrubbing: a canvas that shows frame N of a numbered image
3
+ * sequence, where N is a plain number you can tween or tie to scroll — the
4
+ * product that turns as you scroll.
5
+ *
6
+ * const sequence = live.imageSequence('canvas.phone', {
7
+ * frames: 120,
8
+ * url: (i) => `/frames/phone_${String(i + 1).padStart(4, '0')}.webp`,
9
+ * })
10
+ * live.to(sequence, { frame: sequence.frames - 1, ease: 'none', scrollTrigger: { scrub: true, pin: true } })
11
+ *
12
+ * `frame` is an ordinary property on a plain object, so tinyfly animates it like any
13
+ * other target. Setting it draws the nearest frame; nothing else redraws.
14
+ *
15
+ * Loading: the first frame loads straight away, then the rest load a few at a time,
16
+ * nearest to the frame on screen first. Until a frame has arrived, the nearest one
17
+ * that has is drawn, so scrubbing ahead of the network shows a close frame rather
18
+ * than a blank canvas.
19
+ */
20
+ export interface ImageSequenceOptions {
21
+ /** Number of frames */
22
+ frames: number;
23
+ /** The URL of frame `index` (0-based) */
24
+ url: (index: number) => string;
25
+ /** How images fill the canvas (default 'cover') */
26
+ fit?: 'cover' | 'contain';
27
+ /** Images loading at once (default 6) */
28
+ concurrency?: number;
29
+ /** Called as frames arrive */
30
+ onProgress?: (loaded: number, total: number) => void;
31
+ }
32
+ export declare class ImageSequence {
33
+ readonly frames: number;
34
+ private readonly canvas;
35
+ private readonly context;
36
+ private readonly options;
37
+ private readonly images;
38
+ private readonly ready;
39
+ private current;
40
+ private drawn;
41
+ private loadedCount;
42
+ private inFlight;
43
+ private destroyed;
44
+ private readonly onResize;
45
+ constructor(canvas: HTMLCanvasElement, options: ImageSequenceOptions);
46
+ /** The frame on screen (fractional values show the nearest frame) */
47
+ get frame(): number;
48
+ set frame(value: number);
49
+ /** How many frames have loaded */
50
+ get loaded(): number;
51
+ /** Stop loading, forget the images, and stop listening for resizes. */
52
+ destroy(): void;
53
+ /** Match the canvas's pixels to its size on screen, then redraw. */
54
+ resize(): void;
55
+ private draw;
56
+ /** The loaded frame closest to `index`, or -1. */
57
+ private nearestReady;
58
+ /** Start loads, nearest to the current frame first, up to the concurrency. */
59
+ private pump;
60
+ private load;
61
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @algorisys/tinyfly/gsap-compat — a GSAP-flavoured authoring surface.
3
+ *
4
+ * Familiar, not compatible. GSAP code will not run unchanged; this gives GSAP
5
+ * users a syntax they recognise that compiles to ordinary tinyfly JSON.
6
+ * See docs/gsap-compat.md for the mapping table and the deliberate gaps.
7
+ */
8
+ export * from './timeline';
9
+ export * from './ease-map';
10
+ export * from './position';
11
+ export * from './vars';
12
+ export * from './defaults';
13
+ export * from './quick-play';
14
+ export * from './motion-path-vars';
15
+ export * from './morph-vars';
16
+ export * from './draw-svg-vars';
17
+ export * from './spring-vars';
18
+ export * from './text-vars';
19
+ export * from './inertia-vars';
20
+ export { convertToPath, pathDataOf } from './live-morph';
21
+ export { splitText } from './split-text';
22
+ export { createScrollTrigger } from './live-scroll';
23
+ export { LiveContext, LiveMatchMedia } from './live-context';
24
+ export { ImageSequence } from './image-sequence';
25
+ export { CustomEase, CustomBounce, CustomWiggle } from './custom-eases';
26
+ export type { PageTransitionOptions } from './live-transition';
27
+ export type { ImageSequenceOptions } from './image-sequence';
28
+ export type { Revertible, ContextCollector, ContextHost } from './live-context';
29
+ export type { ScrollTriggerVars, ScrollTriggerSelf, LiveSnap, ContainerAnimation } from './live-scroll';
30
+ export type { SplitTextOptions, SplitTextResult, SplitType } from './split-text';
31
+ export { createLiveDraggable } from './live-draggable';
32
+ export { getFlipState, flipFrom } from './live-flip';
33
+ export type { FlipState as LiveFlipState, FlipVars } from './live-flip';
34
+ export type { LiveDraggable, LiveDraggableOptions, LiveThrowOptions } from './live-draggable';
35
+ export { resolveLiveMotionPath } from './live-motion-path';
36
+ export type { LiveMotionPathVars, LiveMotionPathContext } from './live-motion-path';
37
+ export type { RotationBounds } from './live-draggable';
38
+ export { createUtils, seededRandom, isRandomString } from './utils';
39
+ export type { LiveUtils, Snap } from './utils';
40
+ export { expandKeyframes } from './keyframes-vars';
41
+ export { gridOffsets } from './stagger-grid';
42
+ export type { GridStagger, GridFrom } from './stagger-grid';
43
+ export { playheadCrossings } from '../../engine';
44
+ export type { Playhead, Crossing, CrossingResult, LoopShape } from '../../engine';
45
+ export { scrollTo, scrollBatch } from './live-scroll-to';
46
+ export type { ScrollDestination, ScrollToVars, ScrollBatchVars } from './live-scroll-to';
47
+ import { CompatTimeline, timeline, type CompatTimelineOptions } from './timeline';
48
+ import type { TweenVars } from './vars';
49
+ import type { Position } from './position';
50
+ /**
51
+ * Create a one-tween timeline — the shorthand for when you do not need a
52
+ * sequence. Mirrors `gsap.to()` / `gsap.from()` / `gsap.fromTo()`.
53
+ */
54
+ export declare const tf: {
55
+ timeline: typeof timeline;
56
+ to(target: string | string[], vars: TweenVars, options?: CompatTimelineOptions): CompatTimeline;
57
+ from(target: string | string[], vars: TweenVars, options?: CompatTimelineOptions): CompatTimeline;
58
+ fromTo(target: string | string[], fromVars: TweenVars, toVars: TweenVars, options?: CompatTimelineOptions): CompatTimeline;
59
+ set(target: string | string[], vars: TweenVars, options?: CompatTimelineOptions): CompatTimeline;
60
+ };
61
+ export type { Position, TweenVars };
62
+ export { Stage } from './stage';
63
+ export type { TargetInput, ObjectTarget, Ticker, TickerCallback, FrameScheduler, StageOptions } from './stage';
64
+ export { LiveTimeline, live, createLive } from './live';
65
+ export type { LiveTimelineOptions, LiveApi, QuickTo, QuickToVars, TweenToVars, LiveSmoothScrollOptions } from './live';
@@ -0,0 +1,39 @@
1
+ import { type InertiaConfig } from '../../engine';
2
+ /**
3
+ * GSAP's InertiaPlugin tween option, desugared to inertia tracks.
4
+ *
5
+ * tl.to('card', { inertia: { x: { velocity: 900, end: [0, 200, 400] }, y: 300 } })
6
+ *
7
+ * Each property becomes one inertia track starting from the property's current
8
+ * value. A throw decides its own duration, so `duration` is ignored for it.
9
+ *
10
+ * `end` may be a function: it receives where a free throw would stop and returns
11
+ * where to rest. It is called once, when the tween is built, and the number it
12
+ * returns is what the track stores — the JSON never contains code.
13
+ */
14
+ export interface InertiaPropertyVars {
15
+ /** Release speed in units per second */
16
+ velocity: number;
17
+ min?: number;
18
+ max?: number;
19
+ /** Snap increment, candidate resting values, or a function choosing one */
20
+ end?: number | number[] | ((naturalEnd: number) => number);
21
+ /**
22
+ * GSAP-style resistance: higher stops sooner. 100 matches tinyfly's default
23
+ * friction; each 25 adds one unit of friction per second.
24
+ */
25
+ resistance?: number;
26
+ /** tinyfly's own friction (decay rate per second); overrides `resistance` */
27
+ friction?: number;
28
+ }
29
+ /** Per property: the full options, or just a release velocity. */
30
+ export type InertiaVars = Record<string, number | InertiaPropertyVars>;
31
+ /** Everything but `from`, which the timeline resolves from the property's current value. */
32
+ export type InertiaConfigWithoutFrom = Omit<InertiaConfig, 'from'>;
33
+ /** GSAP resistance → tinyfly friction. */
34
+ export declare function resistanceToFriction(resistance: number): number;
35
+ /**
36
+ * Compile one property's inertia options, given where it starts. `end`
37
+ * functions are resolved here.
38
+ */
39
+ export declare function compileInertiaProperty(from: number, value: number | InertiaPropertyVars): InertiaConfig;
@@ -0,0 +1,8 @@
1
+ import type { TweenVars } from './vars';
2
+ export type KeyframesVars = TweenVars[] | Record<`${number}%`, TweenVars> | ({
3
+ easeEach?: string;
4
+ } & Record<string, unknown[] | string | undefined>);
5
+ /** Whether vars use `keyframes`. */
6
+ export declare function hasKeyframes(vars: TweenVars): boolean;
7
+ /** The consecutive segment tweens a keyframed tween plays. */
8
+ export declare function expandKeyframes(vars: TweenVars): TweenVars[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Layout reads the live runtime makes when a tween or interaction is set up.
3
+ * Never called per frame.
4
+ */
5
+ /** An element's box as laid out, ignoring its own transform (which animation owns). */
6
+ export declare function layoutRect(element: Element): DOMRect;