animejs 4.2.0 → 4.2.2

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 (127) hide show
  1. package/dist/bundles/anime.esm.js +103 -48
  2. package/dist/bundles/anime.esm.min.js +2 -2
  3. package/dist/bundles/anime.umd.js +103 -48
  4. package/dist/bundles/anime.umd.min.js +2 -2
  5. package/dist/modules/animatable/animatable.cjs +2 -2
  6. package/dist/modules/animatable/animatable.js +2 -2
  7. package/dist/modules/animatable/index.cjs +1 -1
  8. package/dist/modules/animatable/index.js +1 -1
  9. package/dist/modules/animation/additive.cjs +1 -1
  10. package/dist/modules/animation/additive.js +1 -1
  11. package/dist/modules/animation/animation.cjs +7 -3
  12. package/dist/modules/animation/animation.d.ts +8 -3
  13. package/dist/modules/animation/animation.js +7 -3
  14. package/dist/modules/animation/composition.cjs +1 -1
  15. package/dist/modules/animation/composition.js +1 -1
  16. package/dist/modules/animation/index.cjs +1 -1
  17. package/dist/modules/animation/index.js +1 -1
  18. package/dist/modules/core/clock.cjs +1 -1
  19. package/dist/modules/core/clock.js +1 -1
  20. package/dist/modules/core/colors.cjs +1 -1
  21. package/dist/modules/core/colors.js +1 -1
  22. package/dist/modules/core/consts.cjs +1 -1
  23. package/dist/modules/core/consts.js +1 -1
  24. package/dist/modules/core/globals.cjs +2 -2
  25. package/dist/modules/core/globals.js +2 -2
  26. package/dist/modules/core/helpers.cjs +1 -1
  27. package/dist/modules/core/helpers.js +1 -1
  28. package/dist/modules/core/render.cjs +1 -1
  29. package/dist/modules/core/render.js +1 -1
  30. package/dist/modules/core/styles.cjs +1 -1
  31. package/dist/modules/core/styles.js +1 -1
  32. package/dist/modules/core/targets.cjs +1 -1
  33. package/dist/modules/core/targets.js +1 -1
  34. package/dist/modules/core/transforms.cjs +1 -1
  35. package/dist/modules/core/transforms.js +1 -1
  36. package/dist/modules/core/units.cjs +1 -1
  37. package/dist/modules/core/units.js +1 -1
  38. package/dist/modules/core/values.cjs +1 -1
  39. package/dist/modules/core/values.js +1 -1
  40. package/dist/modules/draggable/draggable.cjs +17 -4
  41. package/dist/modules/draggable/draggable.d.ts +2 -0
  42. package/dist/modules/draggable/draggable.js +18 -5
  43. package/dist/modules/draggable/index.cjs +1 -1
  44. package/dist/modules/draggable/index.js +1 -1
  45. package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
  46. package/dist/modules/easings/cubic-bezier/index.js +1 -1
  47. package/dist/modules/easings/eases/index.cjs +1 -1
  48. package/dist/modules/easings/eases/index.js +1 -1
  49. package/dist/modules/easings/eases/parser.cjs +1 -1
  50. package/dist/modules/easings/eases/parser.js +1 -1
  51. package/dist/modules/easings/index.cjs +1 -1
  52. package/dist/modules/easings/index.js +1 -1
  53. package/dist/modules/easings/irregular/index.cjs +1 -1
  54. package/dist/modules/easings/irregular/index.js +1 -1
  55. package/dist/modules/easings/linear/index.cjs +1 -1
  56. package/dist/modules/easings/linear/index.js +1 -1
  57. package/dist/modules/easings/none.cjs +1 -1
  58. package/dist/modules/easings/none.js +1 -1
  59. package/dist/modules/easings/spring/index.cjs +1 -1
  60. package/dist/modules/easings/spring/index.js +1 -1
  61. package/dist/modules/easings/steps/index.cjs +1 -1
  62. package/dist/modules/easings/steps/index.js +1 -1
  63. package/dist/modules/engine/engine.cjs +1 -1
  64. package/dist/modules/engine/engine.js +1 -1
  65. package/dist/modules/engine/index.cjs +1 -1
  66. package/dist/modules/engine/index.js +1 -1
  67. package/dist/modules/events/index.cjs +1 -1
  68. package/dist/modules/events/index.js +1 -1
  69. package/dist/modules/events/scroll.cjs +7 -3
  70. package/dist/modules/events/scroll.d.ts +2 -0
  71. package/dist/modules/events/scroll.js +7 -3
  72. package/dist/modules/index.cjs +1 -1
  73. package/dist/modules/index.js +1 -1
  74. package/dist/modules/scope/index.cjs +1 -1
  75. package/dist/modules/scope/index.js +1 -1
  76. package/dist/modules/scope/scope.cjs +1 -1
  77. package/dist/modules/scope/scope.js +1 -1
  78. package/dist/modules/svg/drawable.cjs +1 -1
  79. package/dist/modules/svg/drawable.js +1 -1
  80. package/dist/modules/svg/helpers.cjs +1 -1
  81. package/dist/modules/svg/helpers.js +1 -1
  82. package/dist/modules/svg/index.cjs +1 -1
  83. package/dist/modules/svg/index.js +1 -1
  84. package/dist/modules/svg/morphto.cjs +12 -2
  85. package/dist/modules/svg/morphto.js +12 -2
  86. package/dist/modules/svg/motionpath.cjs +23 -12
  87. package/dist/modules/svg/motionpath.d.ts +1 -1
  88. package/dist/modules/svg/motionpath.js +23 -12
  89. package/dist/modules/text/index.cjs +1 -1
  90. package/dist/modules/text/index.js +1 -1
  91. package/dist/modules/text/split.cjs +1 -1
  92. package/dist/modules/text/split.js +1 -1
  93. package/dist/modules/timeline/index.cjs +1 -1
  94. package/dist/modules/timeline/index.js +1 -1
  95. package/dist/modules/timeline/position.cjs +1 -1
  96. package/dist/modules/timeline/position.js +1 -1
  97. package/dist/modules/timeline/timeline.cjs +9 -5
  98. package/dist/modules/timeline/timeline.d.ts +8 -3
  99. package/dist/modules/timeline/timeline.js +9 -5
  100. package/dist/modules/timer/index.cjs +1 -1
  101. package/dist/modules/timer/index.js +1 -1
  102. package/dist/modules/timer/timer.cjs +17 -14
  103. package/dist/modules/timer/timer.d.ts +12 -7
  104. package/dist/modules/timer/timer.js +17 -14
  105. package/dist/modules/types/index.d.ts +7 -3
  106. package/dist/modules/utils/chainable.cjs +1 -1
  107. package/dist/modules/utils/chainable.js +1 -1
  108. package/dist/modules/utils/index.cjs +1 -1
  109. package/dist/modules/utils/index.js +1 -1
  110. package/dist/modules/utils/number.cjs +1 -1
  111. package/dist/modules/utils/number.js +1 -1
  112. package/dist/modules/utils/random.cjs +1 -1
  113. package/dist/modules/utils/random.js +1 -1
  114. package/dist/modules/utils/stagger.cjs +1 -1
  115. package/dist/modules/utils/stagger.js +1 -1
  116. package/dist/modules/utils/target.cjs +1 -1
  117. package/dist/modules/utils/target.js +1 -1
  118. package/dist/modules/utils/time.cjs +1 -1
  119. package/dist/modules/utils/time.js +1 -1
  120. package/dist/modules/waapi/composition.cjs +1 -1
  121. package/dist/modules/waapi/composition.js +1 -1
  122. package/dist/modules/waapi/index.cjs +1 -1
  123. package/dist/modules/waapi/index.js +1 -1
  124. package/dist/modules/waapi/waapi.cjs +8 -5
  125. package/dist/modules/waapi/waapi.d.ts +8 -5
  126. package/dist/modules/waapi/waapi.js +8 -5
  127. package/package.json +3 -4
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timer - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -57,7 +57,7 @@ const reviveTimer = timer => {
57
57
  if (timer._hasChildren) {
58
58
  helpers.forEachChildren(timer, reviveTimer);
59
59
  } else {
60
- helpers.forEachChildren(timer, (/** @type {Tween} tween*/tween) => {
60
+ helpers.forEachChildren(timer, (/** @type {Tween} tween */tween) => {
61
61
  if (tween._composition !== consts.compositionTypes.none) {
62
62
  composition.composeTween(tween, composition.getTweenSiblings(tween.target, tween.property));
63
63
  }
@@ -114,7 +114,6 @@ class Timer extends clock.Clock {
114
114
  /** @type {Number} */(timerLoop) < 0 ? Infinity :
115
115
  /** @type {Number} */(timerLoop) + 1;
116
116
 
117
-
118
117
  let offsetPosition = 0;
119
118
 
120
119
  if (parent) {
@@ -204,7 +203,7 @@ class Timer extends clock.Clock {
204
203
  }
205
204
 
206
205
  set cancelled(cancelled) {
207
- cancelled ? this.cancel() : this.reset(1).play();
206
+ cancelled ? this.cancel() : this.reset(true).play();
208
207
  }
209
208
 
210
209
  get currentTime() {
@@ -269,10 +268,10 @@ class Timer extends clock.Clock {
269
268
  }
270
269
 
271
270
  /**
272
- * @param {Number} internalRender
271
+ * @param {Boolean} [softReset]
273
272
  * @return {this}
274
273
  */
275
- reset(internalRender = 0) {
274
+ reset(softReset = false) {
276
275
  // If cancelled, revive the timer before rendering in order to have propertly composed tweens siblings
277
276
  reviveTimer(this);
278
277
  if (this._reversed && !this._reverse) this.reversed = false;
@@ -281,7 +280,7 @@ class Timer extends clock.Clock {
281
280
  // NOTE: This is only required for Timelines and might be better to move to the Timeline class?
282
281
  this._iterationTime = this.iterationDuration;
283
282
  // Set tickMode to tickModes.FORCE to force rendering
284
- render.tick(this, 0, 1, internalRender, consts.tickModes.FORCE);
283
+ render.tick(this, 0, 1, ~~softReset, consts.tickModes.FORCE);
285
284
  // Reset timer properties after revive / render to make sure the props are not updated again
286
285
  resetTimerProperties(this);
287
286
  // Also reset children properties
@@ -292,16 +291,16 @@ class Timer extends clock.Clock {
292
291
  }
293
292
 
294
293
  /**
295
- * @param {Number} internalRender
294
+ * @param {Boolean} internalRender
296
295
  * @return {this}
297
296
  */
298
- init(internalRender = 0) {
297
+ init(internalRender = false) {
299
298
  this.fps = this._fps;
300
299
  this.speed = this._speed;
301
300
  // Manually calling .init() on timelines should render all children intial state
302
301
  // Forces all children to render once then render to 0 when reseted
303
302
  if (!internalRender && this._hasChildren) {
304
- render.tick(this, this.duration, 1, internalRender, consts.tickModes.FORCE);
303
+ render.tick(this, this.duration, 1, ~~internalRender, consts.tickModes.FORCE);
305
304
  }
306
305
  this.reset(internalRender);
307
306
  // Make sure to set autoplay to false to child timers so it doesn't attempt to autoplay / link
@@ -355,7 +354,7 @@ class Timer extends clock.Clock {
355
354
 
356
355
  /** @return {this} */
357
356
  restart() {
358
- return this.reset(0).resume();
357
+ return this.reset().resume();
359
358
  }
360
359
 
361
360
  /**
@@ -458,8 +457,12 @@ class Timer extends clock.Clock {
458
457
  }
459
458
 
460
459
  /**
461
- * @param {Callback<this>} [callback]
462
- * @return {Promise}
460
+ * @typedef {this & {then: null}} ResolvedTimer
461
+ */
462
+
463
+ /**
464
+ * @param {Callback<ResolvedTimer>} [callback]
465
+ * @return Promise<this>
463
466
  */
464
467
  then(callback = consts.noop) {
465
468
  const then = this.then;
@@ -467,7 +470,7 @@ class Timer extends clock.Clock {
467
470
  // this.then = null prevents infinite recursion if returned by an async function
468
471
  // https://github.com/juliangarnierorg/anime-beta/issues/26
469
472
  this.then = null;
470
- callback(this);
473
+ callback(/** @type {ResolvedTimer} */(this));
471
474
  this.then = then;
472
475
  this._resolve = consts.noop;
473
476
  };
@@ -79,15 +79,15 @@ export class Timer extends Clock {
79
79
  set reversed(reverse: boolean);
80
80
  get reversed(): boolean;
81
81
  /**
82
- * @param {Number} internalRender
82
+ * @param {Boolean} [softReset]
83
83
  * @return {this}
84
84
  */
85
- reset(internalRender?: number): this;
85
+ reset(softReset?: boolean): this;
86
86
  /**
87
- * @param {Number} internalRender
87
+ * @param {Boolean} internalRender
88
88
  * @return {this}
89
89
  */
90
- init(internalRender?: number): this;
90
+ init(internalRender?: boolean): this;
91
91
  /** @return {this} */
92
92
  resetTime(): this;
93
93
  /** @return {this} */
@@ -127,10 +127,15 @@ export class Timer extends Clock {
127
127
  */
128
128
  complete(): this;
129
129
  /**
130
- * @param {Callback<this>} [callback]
131
- * @return {Promise}
130
+ * @typedef {this & {then: null}} ResolvedTimer
132
131
  */
133
- then(callback?: Callback<this>): Promise<any>;
132
+ /**
133
+ * @param {Callback<ResolvedTimer>} [callback]
134
+ * @return Promise<this>
135
+ */
136
+ then(callback?: Callback<this & {
137
+ then: null;
138
+ }>): Promise<any>;
134
139
  }
135
140
  export function createTimer(parameters?: TimerParams): Timer;
136
141
  import { Clock } from '../core/clock.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - timer - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -55,7 +55,7 @@ const reviveTimer = timer => {
55
55
  if (timer._hasChildren) {
56
56
  forEachChildren(timer, reviveTimer);
57
57
  } else {
58
- forEachChildren(timer, (/** @type {Tween} tween*/tween) => {
58
+ forEachChildren(timer, (/** @type {Tween} tween */tween) => {
59
59
  if (tween._composition !== compositionTypes.none) {
60
60
  composeTween(tween, getTweenSiblings(tween.target, tween.property));
61
61
  }
@@ -112,7 +112,6 @@ class Timer extends Clock {
112
112
  /** @type {Number} */(timerLoop) < 0 ? Infinity :
113
113
  /** @type {Number} */(timerLoop) + 1;
114
114
 
115
-
116
115
  let offsetPosition = 0;
117
116
 
118
117
  if (parent) {
@@ -202,7 +201,7 @@ class Timer extends Clock {
202
201
  }
203
202
 
204
203
  set cancelled(cancelled) {
205
- cancelled ? this.cancel() : this.reset(1).play();
204
+ cancelled ? this.cancel() : this.reset(true).play();
206
205
  }
207
206
 
208
207
  get currentTime() {
@@ -267,10 +266,10 @@ class Timer extends Clock {
267
266
  }
268
267
 
269
268
  /**
270
- * @param {Number} internalRender
269
+ * @param {Boolean} [softReset]
271
270
  * @return {this}
272
271
  */
273
- reset(internalRender = 0) {
272
+ reset(softReset = false) {
274
273
  // If cancelled, revive the timer before rendering in order to have propertly composed tweens siblings
275
274
  reviveTimer(this);
276
275
  if (this._reversed && !this._reverse) this.reversed = false;
@@ -279,7 +278,7 @@ class Timer extends Clock {
279
278
  // NOTE: This is only required for Timelines and might be better to move to the Timeline class?
280
279
  this._iterationTime = this.iterationDuration;
281
280
  // Set tickMode to tickModes.FORCE to force rendering
282
- tick(this, 0, 1, internalRender, tickModes.FORCE);
281
+ tick(this, 0, 1, ~~softReset, tickModes.FORCE);
283
282
  // Reset timer properties after revive / render to make sure the props are not updated again
284
283
  resetTimerProperties(this);
285
284
  // Also reset children properties
@@ -290,16 +289,16 @@ class Timer extends Clock {
290
289
  }
291
290
 
292
291
  /**
293
- * @param {Number} internalRender
292
+ * @param {Boolean} internalRender
294
293
  * @return {this}
295
294
  */
296
- init(internalRender = 0) {
295
+ init(internalRender = false) {
297
296
  this.fps = this._fps;
298
297
  this.speed = this._speed;
299
298
  // Manually calling .init() on timelines should render all children intial state
300
299
  // Forces all children to render once then render to 0 when reseted
301
300
  if (!internalRender && this._hasChildren) {
302
- tick(this, this.duration, 1, internalRender, tickModes.FORCE);
301
+ tick(this, this.duration, 1, ~~internalRender, tickModes.FORCE);
303
302
  }
304
303
  this.reset(internalRender);
305
304
  // Make sure to set autoplay to false to child timers so it doesn't attempt to autoplay / link
@@ -353,7 +352,7 @@ class Timer extends Clock {
353
352
 
354
353
  /** @return {this} */
355
354
  restart() {
356
- return this.reset(0).resume();
355
+ return this.reset().resume();
357
356
  }
358
357
 
359
358
  /**
@@ -456,8 +455,12 @@ class Timer extends Clock {
456
455
  }
457
456
 
458
457
  /**
459
- * @param {Callback<this>} [callback]
460
- * @return {Promise}
458
+ * @typedef {this & {then: null}} ResolvedTimer
459
+ */
460
+
461
+ /**
462
+ * @param {Callback<ResolvedTimer>} [callback]
463
+ * @return Promise<this>
461
464
  */
462
465
  then(callback = noop) {
463
466
  const then = this.then;
@@ -465,7 +468,7 @@ class Timer extends Clock {
465
468
  // this.then = null prevents infinite recursion if returned by an async function
466
469
  // https://github.com/juliangarnierorg/anime-beta/issues/26
467
470
  this.then = null;
468
- callback(this);
471
+ callback(/** @type {ResolvedTimer} */(this));
469
472
  this.then = then;
470
473
  this._resolve = noop;
471
474
  };
@@ -254,7 +254,6 @@ export type TimelineParams = TimerOptions & TimelineOptions & TickableCallbacks<
254
254
  export type WAAPITweenValue = string | number | Array<string> | Array<number>;
255
255
  export type WAAPIFunctionValue = (target: DOMTarget, index: number, length: number) => WAAPITweenValue;
256
256
  export type WAAPIKeyframeValue = WAAPITweenValue | WAAPIFunctionValue | Array<string | number | WAAPIFunctionValue>;
257
- export type WAAPICallback = Callback<WAAPIAnimation>;
258
257
  export type WAAPITweenOptions = {
259
258
  to?: WAAPIKeyframeValue;
260
259
  from?: WAAPIKeyframeValue;
@@ -274,9 +273,9 @@ export type WAAPIAnimationOptions = {
274
273
  ease?: WAAPIEasingParam;
275
274
  composition?: CompositeOperation;
276
275
  persist?: boolean;
277
- onComplete?: WAAPICallback;
276
+ onComplete?: Callback<WAAPIAnimation>;
278
277
  };
279
- export type WAAPIAnimationParams = Record<string, WAAPIKeyframeValue | WAAPIAnimationOptions | boolean | ScrollObserver | WAAPICallback | WAAPIEasingParam | WAAPITweenOptions> & WAAPIAnimationOptions;
278
+ export type WAAPIAnimationParams = Record<string, WAAPIKeyframeValue | WAAPIAnimationOptions | boolean | ScrollObserver | Callback<WAAPIAnimation> | WAAPIEasingParam | WAAPITweenOptions> & WAAPIAnimationOptions;
280
279
  export type AnimatablePropertySetter = (to: number | Array<number>, duration?: number, ease?: EasingParam) => AnimatableObject;
281
280
  export type AnimatablePropertyGetter = () => number | Array<number>;
282
281
  export type AnimatableProperty = AnimatablePropertySetter & AnimatablePropertyGetter;
@@ -340,6 +339,10 @@ export type DraggableCursorParams = {
340
339
  onHover?: string;
341
340
  onGrab?: string;
342
341
  };
342
+ export type DraggableDragThresholdParams = {
343
+ mouse?: number;
344
+ touch?: number;
345
+ };
343
346
  export type DraggableParams = {
344
347
  trigger?: DOMTargetSelector;
345
348
  container?: DOMTargetSelector | Array<number> | ((draggable: Draggable) => DOMTargetSelector | Array<number>);
@@ -351,6 +354,7 @@ export type DraggableParams = {
351
354
  containerFriction?: number | ((draggable: Draggable) => number);
352
355
  releaseContainerFriction?: number | ((draggable: Draggable) => number);
353
356
  dragSpeed?: number | ((draggable: Draggable) => number);
357
+ dragThreshold?: number | DraggableDragThresholdParams | ((draggable: Draggable) => number | DraggableDragThresholdParams);
354
358
  scrollSpeed?: number | ((draggable: Draggable) => number);
355
359
  scrollThreshold?: number | ((draggable: Draggable) => number);
356
360
  minVelocity?: number | ((draggable: Draggable) => number);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - utils - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - CJS
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -27,7 +27,6 @@ var composition = require('./composition.cjs');
27
27
  * WAAPIAnimationParams,
28
28
  * WAAPITweenOptions,
29
29
  * WAAPIKeyframeValue,
30
- * WAAPICallback,
31
30
  * WAAPITweenValue
32
31
  * } from '../types/index.js'
33
32
  */
@@ -459,14 +458,18 @@ class WAAPIAnimation {
459
458
  }
460
459
 
461
460
  /**
462
- * @param {WAAPICallback} [callback]
463
- * @return {Promise}
461
+ * @typedef {this & {then: null}} ResolvedWAAPIAnimation
462
+ */
463
+
464
+ /**
465
+ * @param {Callback<ResolvedWAAPIAnimation>} [callback]
466
+ * @return Promise<this>
464
467
  */
465
468
  then(callback = consts.noop) {
466
469
  const then = this.then;
467
470
  const onResolve = () => {
468
471
  this.then = null;
469
- callback(this);
472
+ callback(/** @type {ResolvedWAAPIAnimation} */(this));
470
473
  this.then = then;
471
474
  this._resolve = consts.noop;
472
475
  };
@@ -65,10 +65,15 @@ export class WAAPIAnimation {
65
65
  cancel(): this;
66
66
  revert(): this;
67
67
  /**
68
- * @param {WAAPICallback} [callback]
69
- * @return {Promise}
68
+ * @typedef {this & {then: null}} ResolvedWAAPIAnimation
70
69
  */
71
- then(callback?: WAAPICallback): Promise<any>;
70
+ /**
71
+ * @param {Callback<ResolvedWAAPIAnimation>} [callback]
72
+ * @return Promise<this>
73
+ */
74
+ then(callback?: Callback<this & {
75
+ then: null;
76
+ }>): Promise<any>;
72
77
  }
73
78
  export namespace waapi {
74
79
  export function animate(targets: DOMTargetsParam, params: WAAPIAnimationParams): WAAPIAnimation;
@@ -77,7 +82,6 @@ export namespace waapi {
77
82
  import type { DOMTargetsArray } from '../types/index.js';
78
83
  import type { Callback } from '../types/index.js';
79
84
  import type { ScrollObserver } from '../events/scroll.js';
80
- import type { WAAPICallback } from '../types/index.js';
81
85
  import type { DOMTargetsParam } from '../types/index.js';
82
86
  import type { WAAPIAnimationParams } from '../types/index.js';
83
87
  /**
@@ -91,7 +95,6 @@ import type { WAAPIAnimationParams } from '../types/index.js';
91
95
  * WAAPIAnimationParams,
92
96
  * WAAPITweenOptions,
93
97
  * WAAPIKeyframeValue,
94
- * WAAPICallback,
95
98
  * WAAPITweenValue
96
99
  * } from '../types/index.js'
97
100
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Anime.js - waapi - ESM
3
- * @version v4.2.0
3
+ * @version v4.2.2
4
4
  * @license MIT
5
5
  * @copyright 2025 - Julian Garnier
6
6
  */
@@ -25,7 +25,6 @@ import { addWAAPIAnimation } from './composition.js';
25
25
  * WAAPIAnimationParams,
26
26
  * WAAPITweenOptions,
27
27
  * WAAPIKeyframeValue,
28
- * WAAPICallback,
29
28
  * WAAPITweenValue
30
29
  * } from '../types/index.js'
31
30
  */
@@ -457,14 +456,18 @@ class WAAPIAnimation {
457
456
  }
458
457
 
459
458
  /**
460
- * @param {WAAPICallback} [callback]
461
- * @return {Promise}
459
+ * @typedef {this & {then: null}} ResolvedWAAPIAnimation
460
+ */
461
+
462
+ /**
463
+ * @param {Callback<ResolvedWAAPIAnimation>} [callback]
464
+ * @return Promise<this>
462
465
  */
463
466
  then(callback = noop) {
464
467
  const then = this.then;
465
468
  const onResolve = () => {
466
469
  this.then = null;
467
- callback(this);
470
+ callback(/** @type {ResolvedWAAPIAnimation} */(this));
468
471
  this.then = then;
469
472
  this._resolve = noop;
470
473
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "animejs",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "homepage": "https://animejs.com",
5
5
  "description": "JavaScript animation engine",
6
6
  "author": "Julian Garnier <julian@animejs.com>",
@@ -31,8 +31,7 @@
31
31
  "easings",
32
32
  "cubic-bezier",
33
33
  "spring",
34
- "text",
35
- "JavaScript",
34
+ "splitText",
36
35
  "CSS",
37
36
  "SVG",
38
37
  "WAAPI",
@@ -176,7 +175,7 @@
176
175
  "@rollup/plugin-terser": "^0.4.4",
177
176
  "@types/mocha": "^10.0.10",
178
177
  "@types/node": "^24.3.0",
179
- "browser-sync": "^2.29.3",
178
+ "browser-sync": "^3.0.4",
180
179
  "chai": "^4.3.10",
181
180
  "mocha": "^10.2.0",
182
181
  "nodemon": "^3.1.10",