animejs 4.1.4 → 4.2.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 (188) hide show
  1. package/README.md +17 -8
  2. package/{lib → dist/bundles}/anime.esm.js +6476 -6106
  3. package/dist/bundles/anime.esm.min.js +7 -0
  4. package/dist/bundles/anime.umd.js +8809 -0
  5. package/dist/bundles/anime.umd.min.js +7 -0
  6. package/dist/modules/animatable/animatable.cjs +150 -0
  7. package/dist/modules/animatable/animatable.d.ts +28 -0
  8. package/dist/modules/animatable/animatable.js +147 -0
  9. package/dist/modules/animatable/index.cjs +15 -0
  10. package/dist/modules/animatable/index.d.ts +1 -0
  11. package/dist/modules/animatable/index.js +8 -0
  12. package/dist/modules/animation/additive.cjs +82 -0
  13. package/dist/modules/animation/additive.d.ts +15 -0
  14. package/dist/modules/animation/additive.js +79 -0
  15. package/dist/modules/animation/animation.cjs +667 -0
  16. package/dist/modules/animation/animation.d.ts +45 -0
  17. package/dist/modules/animation/animation.js +664 -0
  18. package/dist/modules/animation/composition.cjs +383 -0
  19. package/dist/modules/animation/composition.d.ts +10 -0
  20. package/dist/modules/animation/composition.js +377 -0
  21. package/dist/modules/animation/index.cjs +15 -0
  22. package/dist/modules/animation/index.d.ts +1 -0
  23. package/dist/modules/animation/index.js +8 -0
  24. package/dist/modules/core/clock.cjs +110 -0
  25. package/dist/modules/core/clock.d.ts +51 -0
  26. package/dist/modules/core/clock.js +108 -0
  27. package/dist/modules/core/colors.cjs +102 -0
  28. package/dist/modules/core/colors.d.ts +2 -0
  29. package/dist/modules/core/colors.js +100 -0
  30. package/dist/modules/core/consts.cjs +159 -0
  31. package/dist/modules/core/consts.d.ts +61 -0
  32. package/dist/modules/core/consts.js +124 -0
  33. package/dist/modules/core/globals.cjs +78 -0
  34. package/dist/modules/core/globals.d.ts +29 -0
  35. package/dist/modules/core/globals.js +73 -0
  36. package/dist/modules/core/helpers.cjs +304 -0
  37. package/dist/modules/core/helpers.d.ts +43 -0
  38. package/dist/modules/core/helpers.js +261 -0
  39. package/dist/modules/core/render.cjs +391 -0
  40. package/dist/modules/core/render.d.ts +4 -0
  41. package/dist/modules/core/render.js +388 -0
  42. package/dist/modules/core/styles.cjs +116 -0
  43. package/dist/modules/core/styles.d.ts +5 -0
  44. package/dist/modules/core/styles.js +113 -0
  45. package/dist/modules/core/targets.cjs +136 -0
  46. package/dist/modules/core/targets.d.ts +118 -0
  47. package/dist/modules/core/targets.js +132 -0
  48. package/dist/modules/core/transforms.cjs +49 -0
  49. package/dist/modules/core/transforms.d.ts +2 -0
  50. package/dist/modules/core/transforms.js +47 -0
  51. package/dist/modules/core/units.cjs +67 -0
  52. package/dist/modules/core/units.d.ts +3 -0
  53. package/dist/modules/core/units.js +65 -0
  54. package/dist/modules/core/values.cjs +226 -0
  55. package/dist/modules/core/values.d.ts +14 -0
  56. package/dist/modules/core/values.js +216 -0
  57. package/dist/modules/draggable/draggable.cjs +1226 -0
  58. package/dist/modules/draggable/draggable.d.ts +272 -0
  59. package/dist/modules/draggable/draggable.js +1223 -0
  60. package/dist/modules/draggable/index.cjs +15 -0
  61. package/dist/modules/draggable/index.d.ts +1 -0
  62. package/dist/modules/draggable/index.js +8 -0
  63. package/dist/modules/easings/cubic-bezier/index.cjs +64 -0
  64. package/dist/modules/easings/cubic-bezier/index.d.ts +2 -0
  65. package/dist/modules/easings/cubic-bezier/index.js +62 -0
  66. package/dist/modules/easings/eases/index.cjs +14 -0
  67. package/dist/modules/easings/eases/index.d.ts +1 -0
  68. package/dist/modules/easings/eases/index.js +8 -0
  69. package/dist/modules/easings/eases/parser.cjs +191 -0
  70. package/dist/modules/easings/eases/parser.d.ts +125 -0
  71. package/dist/modules/easings/eases/parser.js +185 -0
  72. package/dist/modules/easings/index.cjs +26 -0
  73. package/dist/modules/easings/index.d.ts +6 -0
  74. package/dist/modules/easings/index.js +13 -0
  75. package/dist/modules/easings/irregular/index.cjs +41 -0
  76. package/dist/modules/easings/irregular/index.d.ts +2 -0
  77. package/dist/modules/easings/irregular/index.js +39 -0
  78. package/dist/modules/easings/linear/index.cjs +59 -0
  79. package/dist/modules/easings/linear/index.d.ts +2 -0
  80. package/dist/modules/easings/linear/index.js +57 -0
  81. package/dist/modules/easings/none.cjs +19 -0
  82. package/dist/modules/easings/none.d.ts +8 -0
  83. package/dist/modules/easings/none.js +17 -0
  84. package/dist/modules/easings/spring/index.cjs +255 -0
  85. package/dist/modules/easings/spring/index.d.ts +53 -0
  86. package/dist/modules/easings/spring/index.js +251 -0
  87. package/dist/modules/easings/steps/index.cjs +30 -0
  88. package/dist/modules/easings/steps/index.d.ts +2 -0
  89. package/dist/modules/easings/steps/index.js +28 -0
  90. package/dist/modules/engine/engine.cjs +168 -0
  91. package/dist/modules/engine/engine.d.ts +21 -0
  92. package/dist/modules/engine/engine.js +166 -0
  93. package/dist/modules/engine/index.cjs +14 -0
  94. package/dist/modules/engine/index.d.ts +1 -0
  95. package/dist/modules/engine/index.js +8 -0
  96. package/dist/modules/events/index.cjs +16 -0
  97. package/dist/modules/events/index.d.ts +1 -0
  98. package/dist/modules/events/index.js +8 -0
  99. package/dist/modules/events/scroll.cjs +940 -0
  100. package/dist/modules/events/scroll.d.ts +191 -0
  101. package/dist/modules/events/scroll.js +936 -0
  102. package/dist/modules/index.cjs +102 -0
  103. package/dist/modules/index.d.ts +18 -0
  104. package/dist/modules/index.js +41 -0
  105. package/dist/modules/scope/index.cjs +15 -0
  106. package/dist/modules/scope/index.d.ts +1 -0
  107. package/dist/modules/scope/index.js +8 -0
  108. package/dist/modules/scope/scope.cjs +254 -0
  109. package/dist/modules/scope/scope.d.ts +115 -0
  110. package/dist/modules/scope/scope.js +251 -0
  111. package/dist/modules/svg/drawable.cjs +119 -0
  112. package/dist/modules/svg/drawable.d.ts +3 -0
  113. package/dist/modules/svg/drawable.js +117 -0
  114. package/dist/modules/svg/helpers.cjs +30 -0
  115. package/dist/modules/svg/helpers.d.ts +2 -0
  116. package/dist/modules/svg/helpers.js +28 -0
  117. package/dist/modules/svg/index.cjs +18 -0
  118. package/dist/modules/svg/index.d.ts +3 -0
  119. package/dist/modules/svg/index.js +10 -0
  120. package/dist/modules/svg/morphto.cjs +58 -0
  121. package/dist/modules/svg/morphto.d.ts +3 -0
  122. package/dist/modules/svg/morphto.js +56 -0
  123. package/dist/modules/svg/motionpath.cjs +79 -0
  124. package/dist/modules/svg/motionpath.d.ts +7 -0
  125. package/dist/modules/svg/motionpath.js +77 -0
  126. package/dist/modules/text/index.cjs +16 -0
  127. package/dist/modules/text/index.d.ts +1 -0
  128. package/dist/modules/text/index.js +8 -0
  129. package/dist/modules/text/split.cjs +488 -0
  130. package/dist/modules/text/split.d.ts +62 -0
  131. package/dist/modules/text/split.js +484 -0
  132. package/dist/modules/timeline/index.cjs +15 -0
  133. package/dist/modules/timeline/index.d.ts +1 -0
  134. package/dist/modules/timeline/index.js +8 -0
  135. package/dist/modules/timeline/position.cjs +72 -0
  136. package/dist/modules/timeline/position.d.ts +3 -0
  137. package/dist/modules/timeline/position.js +70 -0
  138. package/dist/modules/timeline/timeline.cjs +312 -0
  139. package/dist/modules/timeline/timeline.d.ts +163 -0
  140. package/dist/modules/timeline/timeline.js +309 -0
  141. package/dist/modules/timer/index.cjs +15 -0
  142. package/dist/modules/timer/index.d.ts +1 -0
  143. package/dist/modules/timer/index.js +8 -0
  144. package/dist/modules/timer/timer.cjs +491 -0
  145. package/dist/modules/timer/timer.d.ts +141 -0
  146. package/dist/modules/timer/timer.js +488 -0
  147. package/dist/modules/types/index.d.ts +404 -0
  148. package/dist/modules/utils/chainable.cjs +190 -0
  149. package/dist/modules/utils/chainable.d.ts +135 -0
  150. package/dist/modules/utils/chainable.js +177 -0
  151. package/dist/modules/utils/index.cjs +43 -0
  152. package/dist/modules/utils/index.d.ts +5 -0
  153. package/dist/modules/utils/index.js +14 -0
  154. package/dist/modules/utils/number.cjs +97 -0
  155. package/dist/modules/utils/number.d.ts +9 -0
  156. package/dist/modules/utils/number.js +85 -0
  157. package/dist/modules/utils/random.cjs +77 -0
  158. package/dist/modules/utils/random.d.ts +22 -0
  159. package/dist/modules/utils/random.js +72 -0
  160. package/dist/modules/utils/stagger.cjs +122 -0
  161. package/dist/modules/utils/stagger.d.ts +30 -0
  162. package/dist/modules/utils/stagger.js +120 -0
  163. package/dist/modules/utils/target.cjs +130 -0
  164. package/dist/modules/utils/target.d.ts +126 -0
  165. package/dist/modules/utils/target.js +125 -0
  166. package/dist/modules/utils/time.cjs +57 -0
  167. package/dist/modules/utils/time.d.ts +5 -0
  168. package/dist/modules/utils/time.js +54 -0
  169. package/dist/modules/waapi/composition.cjs +95 -0
  170. package/dist/modules/waapi/composition.d.ts +4 -0
  171. package/dist/modules/waapi/composition.js +92 -0
  172. package/dist/modules/waapi/index.cjs +15 -0
  173. package/dist/modules/waapi/index.d.ts +1 -0
  174. package/dist/modules/waapi/index.js +8 -0
  175. package/dist/modules/waapi/waapi.cjs +492 -0
  176. package/dist/modules/waapi/waapi.d.ts +116 -0
  177. package/dist/modules/waapi/waapi.js +489 -0
  178. package/package.json +166 -33
  179. package/lib/anime.cjs +0 -9
  180. package/lib/anime.esm.min.js +0 -9
  181. package/lib/anime.iife.js +0 -9
  182. package/lib/anime.iife.min.js +0 -9
  183. package/lib/anime.min.cjs +0 -9
  184. package/lib/anime.umd.js +0 -9
  185. package/lib/anime.umd.min.js +0 -9
  186. package/lib/gui/index.js +0 -6341
  187. package/types/index.d.ts +0 -1127
  188. package/types/index.js +0 -7395
@@ -0,0 +1,404 @@
1
+ export type DefaultsParams = {
2
+ id?: number | string;
3
+ keyframes?: PercentageKeyframes | DurationKeyframes;
4
+ playbackEase?: EasingParam;
5
+ playbackRate?: number;
6
+ frameRate?: number;
7
+ loop?: number | boolean;
8
+ reversed?: boolean;
9
+ alternate?: boolean;
10
+ persist?: boolean;
11
+ autoplay?: boolean | ScrollObserver;
12
+ duration?: number | FunctionValue;
13
+ delay?: number | FunctionValue;
14
+ loopDelay?: number;
15
+ ease?: EasingParam;
16
+ composition?: "none" | "replace" | "blend" | compositionTypes;
17
+ modifier?: (v: any) => any;
18
+ onBegin?: Callback<Tickable>;
19
+ onBeforeUpdate?: Callback<Tickable>;
20
+ onUpdate?: Callback<Tickable>;
21
+ onLoop?: Callback<Tickable>;
22
+ onPause?: Callback<Tickable>;
23
+ onComplete?: Callback<Tickable>;
24
+ onRender?: Callback<Renderable>;
25
+ };
26
+ export type Renderable = JSAnimation | Timeline;
27
+ export type Tickable = Timer | Renderable;
28
+ export type CallbackArgument = Timer & JSAnimation & Timeline;
29
+ export type Revertible = Animatable | Tickable | WAAPIAnimation | Draggable | ScrollObserver | TextSplitter | Scope;
30
+ export type StaggerFunction<T> = (target?: Target, index?: number, length?: number, tl?: Timeline) => T;
31
+ export type StaggerParams = {
32
+ start?: number | string;
33
+ from?: number | "first" | "center" | "last" | "random";
34
+ reversed?: boolean;
35
+ grid?: Array<number>;
36
+ axis?: ("x" | "y");
37
+ use?: string | ((target: Target, i: number, length: number) => number);
38
+ total?: number;
39
+ ease?: EasingParam;
40
+ modifier?: TweenModifier;
41
+ };
42
+ export type DOMTarget = HTMLElement | SVGElement;
43
+ export type JSTarget = Record<string, any>;
44
+ export type Target = DOMTarget | JSTarget;
45
+ export type TargetSelector = Target | NodeList | string;
46
+ export type DOMTargetSelector = DOMTarget | NodeList | string;
47
+ export type DOMTargetsParam = Array<DOMTargetSelector> | DOMTargetSelector;
48
+ export type DOMTargetsArray = Array<DOMTarget>;
49
+ export type JSTargetsParam = Array<JSTarget> | JSTarget;
50
+ export type JSTargetsArray = Array<JSTarget>;
51
+ export type TargetsParam = Array<TargetSelector> | TargetSelector;
52
+ export type TargetsArray = Array<Target>;
53
+ export type EasingFunction = (time: number) => number;
54
+ export type EaseStringParamNames = ("linear" | "none" | "in" | "out" | "inOut" | "inQuad" | "outQuad" | "inOutQuad" | "inCubic" | "outCubic" | "inOutCubic" | "inQuart" | "outQuart" | "inOutQuart" | "inQuint" | "outQuint" | "inOutQuint" | "inSine" | "outSine" | "inOutSine" | "inCirc" | "outCirc" | "inOutCirc" | "inExpo" | "outExpo" | "inOutExpo" | "inBounce" | "outBounce" | "inOutBounce" | "inBack" | "outBack" | "inOutBack" | "inElastic" | "outElastic" | "inOutElastic" | "out(p = 1.675)" | "inOut(p = 1.675)" | "inBack(overshoot = 1.7)" | "outBack(overshoot = 1.7)" | "inOutBack(overshoot = 1.7)" | "inElastic(amplitude = 1, period = .3)" | "outElastic(amplitude = 1, period = .3)" | "inOutElastic(amplitude = 1, period = .3)");
55
+ export type WAAPIEaseStringParamNames = ("ease" | "ease-in" | "ease-out" | "ease-in-out" | "linear(0, 0.25, 1)" | "steps" | "steps(6, start)" | "step-start" | "step-end" | "cubic-bezier(0.42, 0, 1, 1)");
56
+ export type PowerEasing = (power?: number | string) => EasingFunction;
57
+ export type BackEasing = (overshoot?: number | string) => EasingFunction;
58
+ export type ElasticEasing = (amplitude?: number | string, period?: number | string) => EasingFunction;
59
+ export type EasingFunctionWithParams = PowerEasing | BackEasing | ElasticEasing;
60
+ export type EasingParam = (string & {}) | EaseStringParamNames | EasingFunction | Spring;
61
+ export type WAAPIEasingParam = (string & {}) | EaseStringParamNames | WAAPIEaseStringParamNames | EasingFunction | Spring;
62
+ export type SpringParams = {
63
+ /**
64
+ * - Mass, default 1
65
+ */
66
+ mass?: number;
67
+ /**
68
+ * - Stiffness, default 100
69
+ */
70
+ stiffness?: number;
71
+ /**
72
+ * - Damping, default 10
73
+ */
74
+ damping?: number;
75
+ /**
76
+ * - Initial velocity, default 0
77
+ */
78
+ velocity?: number;
79
+ /**
80
+ * - Initial bounce, default 0
81
+ */
82
+ bounce?: number;
83
+ /**
84
+ * - The perceived duration, default 0
85
+ */
86
+ duration?: number;
87
+ /**
88
+ * - Callback function called when the spring currentTime hits the perceived duration
89
+ */
90
+ onComplete?: Callback<JSAnimation>;
91
+ };
92
+ export type Callback<T> = (self: T, e?: PointerEvent) => any;
93
+ export type TickableCallbacks<T extends unknown> = {
94
+ onBegin?: Callback<T>;
95
+ onBeforeUpdate?: Callback<T>;
96
+ onUpdate?: Callback<T>;
97
+ onLoop?: Callback<T>;
98
+ onPause?: Callback<T>;
99
+ onComplete?: Callback<T>;
100
+ };
101
+ export type RenderableCallbacks<T extends unknown> = {
102
+ onRender?: Callback<T>;
103
+ };
104
+ export type TimerOptions = {
105
+ id?: number | string;
106
+ duration?: TweenParamValue;
107
+ delay?: TweenParamValue;
108
+ loopDelay?: number;
109
+ reversed?: boolean;
110
+ alternate?: boolean;
111
+ loop?: boolean | number;
112
+ autoplay?: boolean | ScrollObserver;
113
+ frameRate?: number;
114
+ playbackRate?: number;
115
+ };
116
+ export type TimerParams = TimerOptions & TickableCallbacks<Timer>;
117
+ export type FunctionValue = (target: Target, index: number, length: number) => number | string | TweenObjectValue | Array<number | string | TweenObjectValue>;
118
+ export type TweenModifier = (value: number) => number | string;
119
+ export type ColorArray = [number, number, number, number];
120
+ export type Tween = {
121
+ id: number;
122
+ parent: JSAnimation;
123
+ property: string;
124
+ target: Target;
125
+ _value: string | number;
126
+ _func: Function | null;
127
+ _ease: EasingFunction;
128
+ _fromNumbers: Array<number>;
129
+ _toNumbers: Array<number>;
130
+ _strings: Array<string>;
131
+ _fromNumber: number;
132
+ _toNumber: number;
133
+ _numbers: Array<number>;
134
+ _number: number;
135
+ _unit: string;
136
+ _modifier: TweenModifier;
137
+ _currentTime: number;
138
+ _delay: number;
139
+ _updateDuration: number;
140
+ _startTime: number;
141
+ _changeDuration: number;
142
+ _absoluteStartTime: number;
143
+ _tweenType: tweenTypes;
144
+ _valueType: valueTypes;
145
+ _composition: number;
146
+ _isOverlapped: number;
147
+ _isOverridden: number;
148
+ _renderTransforms: number;
149
+ _inlineValue: string;
150
+ _prevRep: Tween;
151
+ _nextRep: Tween;
152
+ _prevAdd: Tween;
153
+ _nextAdd: Tween;
154
+ _prev: Tween;
155
+ _next: Tween;
156
+ };
157
+ export type TweenDecomposedValue = {
158
+ /**
159
+ * - Type
160
+ */
161
+ t: number;
162
+ /**
163
+ * - Single number value
164
+ */
165
+ n: number;
166
+ /**
167
+ * - Value unit
168
+ */
169
+ u: string;
170
+ /**
171
+ * - Value operator
172
+ */
173
+ o: string;
174
+ /**
175
+ * - Array of Numbers (in case of complex value type)
176
+ */
177
+ d: Array<number>;
178
+ /**
179
+ * - Strings (in case of complex value type)
180
+ */
181
+ s: Array<string>;
182
+ };
183
+ export type TweenPropertySiblings = {
184
+ _head: null | Tween;
185
+ _tail: null | Tween;
186
+ };
187
+ export type TweenLookups = Record<string, TweenPropertySiblings>;
188
+ export type TweenReplaceLookups = WeakMap<Target, TweenLookups>;
189
+ export type TweenAdditiveLookups = Map<Target, TweenLookups>;
190
+ export type TweenParamValue = number | string | FunctionValue;
191
+ export type TweenPropValue = TweenParamValue | [TweenParamValue, TweenParamValue];
192
+ export type TweenComposition = (string & {}) | "none" | "replace" | "blend" | compositionTypes;
193
+ export type TweenParamsOptions = {
194
+ duration?: TweenParamValue;
195
+ delay?: TweenParamValue;
196
+ ease?: EasingParam;
197
+ modifier?: TweenModifier;
198
+ composition?: TweenComposition;
199
+ };
200
+ export type TweenValues = {
201
+ from?: TweenParamValue;
202
+ to?: TweenPropValue;
203
+ fromTo?: TweenPropValue;
204
+ };
205
+ export type TweenKeyValue = TweenParamsOptions & TweenValues;
206
+ export type ArraySyntaxValue = Array<TweenKeyValue | TweenPropValue>;
207
+ export type TweenOptions = TweenParamValue | ArraySyntaxValue | TweenKeyValue;
208
+ export type TweenObjectValue = Partial<{
209
+ to: TweenParamValue | Array<TweenParamValue>;
210
+ from: TweenParamValue | Array<TweenParamValue>;
211
+ fromTo: TweenParamValue | Array<TweenParamValue>;
212
+ }>;
213
+ export type PercentageKeyframeOptions = {
214
+ ease?: EasingParam;
215
+ };
216
+ export type PercentageKeyframeParams = Record<string, TweenParamValue>;
217
+ export type PercentageKeyframes = Record<string, PercentageKeyframeParams & PercentageKeyframeOptions>;
218
+ export type DurationKeyframes = Array<Record<string, TweenOptions | TweenModifier | boolean> & TweenParamsOptions>;
219
+ export type AnimationOptions = {
220
+ keyframes?: PercentageKeyframes | DurationKeyframes;
221
+ playbackEase?: EasingParam;
222
+ };
223
+ export type AnimationParams = Record<string, TweenOptions | Callback<JSAnimation> | TweenModifier | boolean | PercentageKeyframes | DurationKeyframes | ScrollObserver> & TimerOptions & AnimationOptions & TweenParamsOptions & TickableCallbacks<JSAnimation> & RenderableCallbacks<JSAnimation>;
224
+ /**
225
+ * Accepts:<br>
226
+ * - `Number` - Absolute position in milliseconds (e.g., `500` places element at exactly 500ms)<br>
227
+ * - `'+=Number'` - Addition: Position element X ms after the last element (e.g., `'+=100'`)<br>
228
+ * - `'-=Number'` - Subtraction: Position element X ms before the last element's end (e.g., `'-=100'`)<br>
229
+ * - `'*=Number'` - Multiplier: Position element at a fraction of the total duration (e.g., `'*=.5'` for halfway)<br>
230
+ * - `'<'` - Previous end: Position element at the end position of the previous element<br>
231
+ * - `'<<'` - Previous start: Position element at the start position of the previous element<br>
232
+ * - `'<<+=Number'` - Combined: Position element relative to previous element's start (e.g., `'<<+=250'`)<br>
233
+ * - `'label'` - Label: Position element at a named label position (e.g., `'My Label'`)
234
+ */
235
+ export type TimelinePosition = number | `+=${number}` | `-=${number}` | `*=${number}` | "<" | "<<" | `<<+=${number}` | `<<-=${number}` | string;
236
+ /**
237
+ * Accepts:<br>
238
+ * - `Number` - Absolute position in milliseconds (e.g., `500` places animation at exactly 500ms)<br>
239
+ * - `'+=Number'` - Addition: Position animation X ms after the last animation (e.g., `'+=100'`)<br>
240
+ * - `'-=Number'` - Subtraction: Position animation X ms before the last animation's end (e.g., `'-=100'`)<br>
241
+ * - `'*=Number'` - Multiplier: Position animation at a fraction of the total duration (e.g., `'*=.5'` for halfway)<br>
242
+ * - `'<'` - Previous end: Position animation at the end position of the previous animation<br>
243
+ * - `'<<'` - Previous start: Position animation at the start position of the previous animation<br>
244
+ * - `'<<+=Number'` - Combined: Position animation relative to previous animation's start (e.g., `'<<+=250'`)<br>
245
+ * - `'label'` - Label: Position animation at a named label position (e.g., `'My Label'`)<br>
246
+ * - `stagger(String|Nummber)` - Stagger multi-elements animation positions (e.g., 10, 20, 30...)
247
+ */
248
+ export type TimelineAnimationPosition = TimelinePosition | StaggerFunction<number | string>;
249
+ export type TimelineOptions = {
250
+ defaults?: DefaultsParams;
251
+ playbackEase?: EasingParam;
252
+ };
253
+ export type TimelineParams = TimerOptions & TimelineOptions & TickableCallbacks<Timeline> & RenderableCallbacks<Timeline>;
254
+ export type WAAPITweenValue = string | number | Array<string> | Array<number>;
255
+ export type WAAPIFunctionValue = (target: DOMTarget, index: number, length: number) => WAAPITweenValue;
256
+ export type WAAPIKeyframeValue = WAAPITweenValue | WAAPIFunctionValue | Array<string | number | WAAPIFunctionValue>;
257
+ export type WAAPICallback = Callback<WAAPIAnimation>;
258
+ export type WAAPITweenOptions = {
259
+ to?: WAAPIKeyframeValue;
260
+ from?: WAAPIKeyframeValue;
261
+ duration?: number | WAAPIFunctionValue;
262
+ delay?: number | WAAPIFunctionValue;
263
+ ease?: WAAPIEasingParam;
264
+ composition?: CompositeOperation;
265
+ };
266
+ export type WAAPIAnimationOptions = {
267
+ loop?: number | boolean;
268
+ Reversed?: boolean;
269
+ Alternate?: boolean;
270
+ autoplay?: boolean | ScrollObserver;
271
+ playbackRate?: number;
272
+ duration?: number | WAAPIFunctionValue;
273
+ delay?: number | WAAPIFunctionValue;
274
+ ease?: WAAPIEasingParam;
275
+ composition?: CompositeOperation;
276
+ persist?: boolean;
277
+ onComplete?: WAAPICallback;
278
+ };
279
+ export type WAAPIAnimationParams = Record<string, WAAPIKeyframeValue | WAAPIAnimationOptions | boolean | ScrollObserver | WAAPICallback | WAAPIEasingParam | WAAPITweenOptions> & WAAPIAnimationOptions;
280
+ export type AnimatablePropertySetter = (to: number | Array<number>, duration?: number, ease?: EasingParam) => AnimatableObject;
281
+ export type AnimatablePropertyGetter = () => number | Array<number>;
282
+ export type AnimatableProperty = AnimatablePropertySetter & AnimatablePropertyGetter;
283
+ export type AnimatableObject = Animatable & Record<string, AnimatableProperty>;
284
+ export type AnimatablePropertyParamsOptions = {
285
+ unit?: string;
286
+ duration?: TweenParamValue;
287
+ ease?: EasingParam;
288
+ modifier?: TweenModifier;
289
+ composition?: TweenComposition;
290
+ };
291
+ export type AnimatableParams = Record<string, TweenParamValue | EasingParam | TweenModifier | TweenComposition | AnimatablePropertyParamsOptions> & AnimatablePropertyParamsOptions;
292
+ export type ReactRef = {
293
+ current?: HTMLElement | SVGElement | null;
294
+ };
295
+ export type AngularRef = {
296
+ nativeElement?: HTMLElement | SVGElement;
297
+ };
298
+ export type ScopeParams = {
299
+ root?: DOMTargetSelector | ReactRef | AngularRef;
300
+ defaults?: DefaultsParams;
301
+ mediaQueries?: Record<string, string>;
302
+ };
303
+ export type ScopedCallback<T> = (scope: Scope) => T;
304
+ export type ScopeCleanupCallback = (scope?: Scope) => any;
305
+ export type ScopeConstructorCallback = (scope?: Scope) => ScopeCleanupCallback | void;
306
+ export type ScopeMethod = (...args: any[]) => ScopeCleanupCallback | void;
307
+ export type ScrollThresholdValue = string | number;
308
+ export type ScrollThresholdParam = {
309
+ target?: ScrollThresholdValue;
310
+ container?: ScrollThresholdValue;
311
+ };
312
+ export type ScrollObserverAxisCallback = (self: ScrollObserver) => "x" | "y";
313
+ export type ScrollThresholdCallback = (self: ScrollObserver) => ScrollThresholdValue | ScrollThresholdParam;
314
+ export type ScrollObserverParams = {
315
+ id?: number | string;
316
+ sync?: boolean | number | string | EasingParam;
317
+ container?: TargetsParam;
318
+ target?: TargetsParam;
319
+ axis?: "x" | "y" | ScrollObserverAxisCallback | ((observer: ScrollObserver) => "x" | "y" | ScrollObserverAxisCallback);
320
+ enter?: ScrollThresholdValue | ScrollThresholdParam | ScrollThresholdCallback | ((observer: ScrollObserver) => ScrollThresholdValue | ScrollThresholdParam | ScrollThresholdCallback);
321
+ leave?: ScrollThresholdValue | ScrollThresholdParam | ScrollThresholdCallback | ((observer: ScrollObserver) => ScrollThresholdValue | ScrollThresholdParam | ScrollThresholdCallback);
322
+ repeat?: boolean | ((observer: ScrollObserver) => boolean);
323
+ debug?: boolean;
324
+ onEnter?: Callback<ScrollObserver>;
325
+ onLeave?: Callback<ScrollObserver>;
326
+ onEnterForward?: Callback<ScrollObserver>;
327
+ onLeaveForward?: Callback<ScrollObserver>;
328
+ onEnterBackward?: Callback<ScrollObserver>;
329
+ onLeaveBackward?: Callback<ScrollObserver>;
330
+ onUpdate?: Callback<ScrollObserver>;
331
+ onSyncComplete?: Callback<ScrollObserver>;
332
+ };
333
+ export type DraggableAxisParam = {
334
+ mapTo?: string;
335
+ modifier?: TweenModifier;
336
+ composition?: TweenComposition;
337
+ snap?: number | Array<number> | ((draggable: Draggable) => number | Array<number>);
338
+ };
339
+ export type DraggableCursorParams = {
340
+ onHover?: string;
341
+ onGrab?: string;
342
+ };
343
+ export type DraggableParams = {
344
+ trigger?: DOMTargetSelector;
345
+ container?: DOMTargetSelector | Array<number> | ((draggable: Draggable) => DOMTargetSelector | Array<number>);
346
+ x?: boolean | DraggableAxisParam;
347
+ y?: boolean | DraggableAxisParam;
348
+ modifier?: TweenModifier;
349
+ snap?: number | Array<number> | ((draggable: Draggable) => number | Array<number>);
350
+ containerPadding?: number | Array<number> | ((draggable: Draggable) => number | Array<number>);
351
+ containerFriction?: number | ((draggable: Draggable) => number);
352
+ releaseContainerFriction?: number | ((draggable: Draggable) => number);
353
+ dragSpeed?: number | ((draggable: Draggable) => number);
354
+ scrollSpeed?: number | ((draggable: Draggable) => number);
355
+ scrollThreshold?: number | ((draggable: Draggable) => number);
356
+ minVelocity?: number | ((draggable: Draggable) => number);
357
+ maxVelocity?: number | ((draggable: Draggable) => number);
358
+ velocityMultiplier?: number | ((draggable: Draggable) => number);
359
+ releaseMass?: number;
360
+ releaseStiffness?: number;
361
+ releaseDamping?: number;
362
+ releaseEase?: EasingParam;
363
+ cursor?: boolean | DraggableCursorParams | ((draggable: Draggable) => boolean | DraggableCursorParams);
364
+ onGrab?: Callback<Draggable>;
365
+ onDrag?: Callback<Draggable>;
366
+ onRelease?: Callback<Draggable>;
367
+ onUpdate?: Callback<Draggable>;
368
+ onSettle?: Callback<Draggable>;
369
+ onSnap?: Callback<Draggable>;
370
+ onResize?: Callback<Draggable>;
371
+ onAfterResize?: Callback<Draggable>;
372
+ };
373
+ export type SplitTemplateParams = {
374
+ class?: false | string;
375
+ wrap?: boolean | "hidden" | "clip" | "visible" | "scroll" | "auto";
376
+ clone?: boolean | "top" | "right" | "bottom" | "left" | "center";
377
+ };
378
+ export type SplitValue = boolean | string;
379
+ export type SplitFunctionValue = (value?: Node | HTMLElement) => any;
380
+ export type TextSplitterParams = {
381
+ lines?: SplitValue | SplitTemplateParams | SplitFunctionValue;
382
+ words?: SplitValue | SplitTemplateParams | SplitFunctionValue;
383
+ chars?: SplitValue | SplitTemplateParams | SplitFunctionValue;
384
+ accessible?: boolean;
385
+ includeSpaces?: boolean;
386
+ debug?: boolean;
387
+ };
388
+ export type DrawableSVGGeometry = SVGGeometryElement & {
389
+ setAttribute(name: "draw", value: `${number} ${number}`): void;
390
+ draw: `${number} ${number}`;
391
+ };
392
+ import type { ScrollObserver } from '../events/scroll.js';
393
+ import type { compositionTypes } from '../core/consts.js';
394
+ import type { JSAnimation } from '../animation/animation.js';
395
+ import type { Timeline } from '../timeline/timeline.js';
396
+ import type { Timer } from '../timer/timer.js';
397
+ import type { Animatable } from '../animatable/animatable.js';
398
+ import type { WAAPIAnimation } from '../waapi/waapi.js';
399
+ import type { Draggable } from '../draggable/draggable.js';
400
+ import type { TextSplitter } from '../text/split.js';
401
+ import type { Scope } from '../scope/scope.js';
402
+ import type { Spring } from '../easings/spring/index.js';
403
+ import type { tweenTypes } from '../core/consts.js';
404
+ import type { valueTypes } from '../core/consts.js';
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Anime.js - utils - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var consts = require('../core/consts.cjs');
11
+ var number = require('./number.cjs');
12
+
13
+ // Chain-able utilities
14
+
15
+ const numberUtils = number; // Needed to keep the import when bundling
16
+
17
+ const chainables = {};
18
+
19
+ /**
20
+ * @callback UtilityFunction
21
+ * @param {...*} args
22
+ * @return {Number|String}
23
+ *
24
+ * @param {UtilityFunction} fn
25
+ * @param {Number} [last=0]
26
+ * @return {function(...(Number|String)): function(Number|String): (Number|String)}
27
+ */
28
+ const curry = (fn, last = 0) => (...args) => last ? v => fn(...args, v) : v => fn(v, ...args);
29
+
30
+ /**
31
+ * @param {Function} fn
32
+ * @return {function(...(Number|String))}
33
+ */
34
+ const chain = fn => {
35
+ return (...args) => {
36
+ const result = fn(...args);
37
+ return new Proxy(consts.noop, {
38
+ apply: (_, __, [v]) => result(v),
39
+ get: (_, prop) => chain(/**@param {...Number|String} nextArgs */(...nextArgs) => {
40
+ const nextResult = chainables[prop](...nextArgs);
41
+ return (/**@type {Number|String} */v) => nextResult(result(v));
42
+ })
43
+ });
44
+ }
45
+ };
46
+
47
+ /**
48
+ * @param {UtilityFunction} fn
49
+ * @param {String} name
50
+ * @param {Number} [right]
51
+ * @return {function(...(Number|String)): UtilityFunction}
52
+ */
53
+ const makeChainable = (name, fn, right = 0) => {
54
+ const chained = (...args) => (args.length < fn.length ? chain(curry(fn, right)) : fn)(...args);
55
+ if (!chainables[name]) chainables[name] = chained;
56
+ return chained;
57
+ };
58
+
59
+ /**
60
+ * @typedef {Object} ChainablesMap
61
+ * @property {ChainedClamp} clamp
62
+ * @property {ChainedRound} round
63
+ * @property {ChainedSnap} snap
64
+ * @property {ChainedWrap} wrap
65
+ * @property {ChainedLerp} lerp
66
+ * @property {ChainedDamp} damp
67
+ * @property {ChainedMapRange} mapRange
68
+ * @property {ChainedRoundPad} roundPad
69
+ * @property {ChainedPadStart} padStart
70
+ * @property {ChainedPadEnd} padEnd
71
+ * @property {ChainedDegToRad} degToRad
72
+ * @property {ChainedRadToDeg} radToDeg
73
+ */
74
+
75
+ /**
76
+ * @callback ChainedUtilsResult
77
+ * @param {Number} value - The value to process through the chained operations
78
+ * @return {Number} The processed result
79
+ */
80
+
81
+ /**
82
+ * @typedef {ChainablesMap & ChainedUtilsResult} ChainableUtil
83
+ */
84
+
85
+ // Chainable
86
+
87
+ /**
88
+ * @callback ChainedRoundPad
89
+ * @param {Number} decimalLength - Number of decimal places
90
+ * @return {ChainableUtil}
91
+ */
92
+ const roundPad = /** @type {typeof numberUtils.roundPad & ChainedRoundPad} */(makeChainable('roundPad', numberUtils.roundPad));
93
+
94
+ /**
95
+ * @callback ChainedPadStart
96
+ * @param {Number} totalLength - Target length
97
+ * @param {String} padString - String to pad with
98
+ * @return {ChainableUtil}
99
+ */
100
+ const padStart = /** @type {typeof numberUtils.padStart & ChainedPadStart} */(makeChainable('padStart', numberUtils.padStart));
101
+
102
+ /**
103
+ * @callback ChainedPadEnd
104
+ * @param {Number} totalLength - Target length
105
+ * @param {String} padString - String to pad with
106
+ * @return {ChainableUtil}
107
+ */
108
+ const padEnd = /** @type {typeof numberUtils.padEnd & ChainedPadEnd} */(makeChainable('padEnd', numberUtils.padEnd));
109
+
110
+ /**
111
+ * @callback ChainedWrap
112
+ * @param {Number} min - Minimum boundary
113
+ * @param {Number} max - Maximum boundary
114
+ * @return {ChainableUtil}
115
+ */
116
+ const wrap = /** @type {typeof numberUtils.wrap & ChainedWrap} */(makeChainable('wrap', numberUtils.wrap));
117
+
118
+ /**
119
+ * @callback ChainedMapRange
120
+ * @param {Number} inLow - Input range minimum
121
+ * @param {Number} inHigh - Input range maximum
122
+ * @param {Number} outLow - Output range minimum
123
+ * @param {Number} outHigh - Output range maximum
124
+ * @return {ChainableUtil}
125
+ */
126
+ const mapRange = /** @type {typeof numberUtils.mapRange & ChainedMapRange} */(makeChainable('mapRange', numberUtils.mapRange));
127
+
128
+ /**
129
+ * @callback ChainedDegToRad
130
+ * @return {ChainableUtil}
131
+ */
132
+ const degToRad = /** @type {typeof numberUtils.degToRad & ChainedDegToRad} */(makeChainable('degToRad', numberUtils.degToRad));
133
+
134
+ /**
135
+ * @callback ChainedRadToDeg
136
+ * @return {ChainableUtil}
137
+ */
138
+ const radToDeg = /** @type {typeof numberUtils.radToDeg & ChainedRadToDeg} */(makeChainable('radToDeg', numberUtils.radToDeg));
139
+
140
+ /**
141
+ * @callback ChainedSnap
142
+ * @param {Number|Array<Number>} increment - Step size or array of snap points
143
+ * @return {ChainableUtil}
144
+ */
145
+ const snap = /** @type {typeof numberUtils.snap & ChainedSnap} */(makeChainable('snap', numberUtils.snap));
146
+
147
+ /**
148
+ * @callback ChainedClamp
149
+ * @param {Number} min - Minimum boundary
150
+ * @param {Number} max - Maximum boundary
151
+ * @return {ChainableUtil}
152
+ */
153
+ const clamp = /** @type {typeof numberUtils.clamp & ChainedClamp} */(makeChainable('clamp', numberUtils.clamp));
154
+
155
+ /**
156
+ * @callback ChainedRound
157
+ * @param {Number} decimalLength - Number of decimal places
158
+ * @return {ChainableUtil}
159
+ */
160
+ const round = /** @type {typeof numberUtils.round & ChainedRound} */(makeChainable('round', numberUtils.round));
161
+
162
+ /**
163
+ * @callback ChainedLerp
164
+ * @param {Number} start - Starting value
165
+ * @param {Number} end - Ending value
166
+ * @return {ChainableUtil}
167
+ */
168
+ const lerp = /** @type {typeof numberUtils.lerp & ChainedLerp} */(makeChainable('lerp', numberUtils.lerp, 1));
169
+
170
+ /**
171
+ * @callback ChainedDamp
172
+ * @param {Number} start - Starting value
173
+ * @param {Number} end - Target value
174
+ * @param {Number} deltaTime - Delta time in ms
175
+ * @return {ChainableUtil}
176
+ */
177
+ const damp = /** @type {typeof numberUtils.damp & ChainedDamp} */(makeChainable('damp', numberUtils.damp, 1));
178
+
179
+ exports.clamp = clamp;
180
+ exports.damp = damp;
181
+ exports.degToRad = degToRad;
182
+ exports.lerp = lerp;
183
+ exports.mapRange = mapRange;
184
+ exports.padEnd = padEnd;
185
+ exports.padStart = padStart;
186
+ exports.radToDeg = radToDeg;
187
+ exports.round = round;
188
+ exports.roundPad = roundPad;
189
+ exports.snap = snap;
190
+ exports.wrap = wrap;