animejs 4.1.3 → 4.2.0-beta.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 (191) hide show
  1. package/README.md +12 -8
  2. package/{lib → dist/bundles}/anime.esm.js +5237 -5049
  3. package/dist/bundles/anime.esm.min.js +7 -0
  4. package/dist/bundles/anime.umd.js +8621 -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 +660 -0
  16. package/dist/modules/animation/animation.d.ts +47 -0
  17. package/dist/modules/animation/animation.js +657 -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 +154 -0
  31. package/dist/modules/core/consts.d.ts +59 -0
  32. package/dist/modules/core/consts.js +121 -0
  33. package/dist/modules/core/globals.cjs +77 -0
  34. package/dist/modules/core/globals.d.ts +29 -0
  35. package/dist/modules/core/globals.js +72 -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 +389 -0
  40. package/dist/modules/core/render.d.ts +4 -0
  41. package/dist/modules/core/render.js +386 -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 +215 -0
  55. package/dist/modules/core/values.d.ts +14 -0
  56. package/dist/modules/core/values.js +205 -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.cjs +64 -0
  64. package/dist/modules/easings/cubic-bezier.d.ts +2 -0
  65. package/dist/modules/easings/cubic-bezier.js +62 -0
  66. package/dist/modules/easings/eases.cjs +149 -0
  67. package/dist/modules/easings/eases.d.ts +111 -0
  68. package/dist/modules/easings/eases.js +146 -0
  69. package/dist/modules/easings/index.cjs +24 -0
  70. package/dist/modules/easings/index.d.ts +6 -0
  71. package/dist/modules/easings/index.js +13 -0
  72. package/dist/modules/easings/irregular.cjs +41 -0
  73. package/dist/modules/easings/irregular.d.ts +2 -0
  74. package/dist/modules/easings/irregular.js +39 -0
  75. package/dist/modules/easings/linear.cjs +59 -0
  76. package/dist/modules/easings/linear.d.ts +2 -0
  77. package/dist/modules/easings/linear.js +57 -0
  78. package/dist/modules/easings/none.cjs +19 -0
  79. package/dist/modules/easings/none.d.ts +8 -0
  80. package/dist/modules/easings/none.js +17 -0
  81. package/dist/modules/easings/parser.cjs +59 -0
  82. package/dist/modules/easings/parser.d.ts +21 -0
  83. package/dist/modules/easings/parser.js +55 -0
  84. package/dist/modules/easings/steps.cjs +30 -0
  85. package/dist/modules/easings/steps.d.ts +2 -0
  86. package/dist/modules/easings/steps.js +28 -0
  87. package/dist/modules/engine/engine.cjs +168 -0
  88. package/dist/modules/engine/engine.d.ts +21 -0
  89. package/dist/modules/engine/engine.js +166 -0
  90. package/dist/modules/engine/index.cjs +14 -0
  91. package/dist/modules/engine/index.d.ts +1 -0
  92. package/dist/modules/engine/index.js +8 -0
  93. package/dist/modules/events/index.cjs +16 -0
  94. package/dist/modules/events/index.d.ts +1 -0
  95. package/dist/modules/events/index.js +8 -0
  96. package/dist/modules/events/scroll.cjs +936 -0
  97. package/dist/modules/events/scroll.d.ts +189 -0
  98. package/dist/modules/events/scroll.js +932 -0
  99. package/dist/modules/index.cjs +103 -0
  100. package/dist/modules/index.d.ts +19 -0
  101. package/dist/modules/index.js +42 -0
  102. package/dist/modules/scope/index.cjs +15 -0
  103. package/dist/modules/scope/index.d.ts +1 -0
  104. package/dist/modules/scope/index.js +8 -0
  105. package/dist/modules/scope/scope.cjs +254 -0
  106. package/dist/modules/scope/scope.d.ts +115 -0
  107. package/dist/modules/scope/scope.js +251 -0
  108. package/dist/modules/spring/index.cjs +15 -0
  109. package/dist/modules/spring/index.d.ts +1 -0
  110. package/dist/modules/spring/index.js +8 -0
  111. package/dist/modules/spring/spring.cjs +133 -0
  112. package/dist/modules/spring/spring.d.ts +37 -0
  113. package/dist/modules/spring/spring.js +130 -0
  114. package/dist/modules/svg/drawable.cjs +119 -0
  115. package/dist/modules/svg/drawable.d.ts +3 -0
  116. package/dist/modules/svg/drawable.js +117 -0
  117. package/dist/modules/svg/helpers.cjs +30 -0
  118. package/dist/modules/svg/helpers.d.ts +2 -0
  119. package/dist/modules/svg/helpers.js +28 -0
  120. package/dist/modules/svg/index.cjs +18 -0
  121. package/dist/modules/svg/index.d.ts +3 -0
  122. package/dist/modules/svg/index.js +10 -0
  123. package/dist/modules/svg/morphto.cjs +58 -0
  124. package/dist/modules/svg/morphto.d.ts +3 -0
  125. package/dist/modules/svg/morphto.js +56 -0
  126. package/dist/modules/svg/motionpath.cjs +79 -0
  127. package/dist/modules/svg/motionpath.d.ts +7 -0
  128. package/dist/modules/svg/motionpath.js +77 -0
  129. package/dist/modules/text/index.cjs +16 -0
  130. package/dist/modules/text/index.d.ts +1 -0
  131. package/dist/modules/text/index.js +8 -0
  132. package/dist/modules/text/split.cjs +488 -0
  133. package/dist/modules/text/split.d.ts +62 -0
  134. package/dist/modules/text/split.js +484 -0
  135. package/dist/modules/timeline/index.cjs +15 -0
  136. package/dist/modules/timeline/index.d.ts +1 -0
  137. package/dist/modules/timeline/index.js +8 -0
  138. package/dist/modules/timeline/position.cjs +72 -0
  139. package/dist/modules/timeline/position.d.ts +3 -0
  140. package/dist/modules/timeline/position.js +70 -0
  141. package/dist/modules/timeline/timeline.cjs +312 -0
  142. package/dist/modules/timeline/timeline.d.ts +163 -0
  143. package/dist/modules/timeline/timeline.js +309 -0
  144. package/dist/modules/timer/index.cjs +15 -0
  145. package/dist/modules/timer/index.d.ts +1 -0
  146. package/dist/modules/timer/index.js +8 -0
  147. package/dist/modules/timer/timer.cjs +491 -0
  148. package/dist/modules/timer/timer.d.ts +141 -0
  149. package/dist/modules/timer/timer.js +488 -0
  150. package/dist/modules/types/index.d.ts +387 -0
  151. package/dist/modules/utils/chainable.cjs +190 -0
  152. package/dist/modules/utils/chainable.d.ts +135 -0
  153. package/dist/modules/utils/chainable.js +177 -0
  154. package/dist/modules/utils/index.cjs +43 -0
  155. package/dist/modules/utils/index.d.ts +5 -0
  156. package/dist/modules/utils/index.js +14 -0
  157. package/dist/modules/utils/number.cjs +97 -0
  158. package/dist/modules/utils/number.d.ts +9 -0
  159. package/dist/modules/utils/number.js +85 -0
  160. package/dist/modules/utils/random.cjs +77 -0
  161. package/dist/modules/utils/random.d.ts +22 -0
  162. package/dist/modules/utils/random.js +72 -0
  163. package/dist/modules/utils/stagger.cjs +122 -0
  164. package/dist/modules/utils/stagger.d.ts +30 -0
  165. package/dist/modules/utils/stagger.js +120 -0
  166. package/dist/modules/utils/target.cjs +130 -0
  167. package/dist/modules/utils/target.d.ts +126 -0
  168. package/dist/modules/utils/target.js +125 -0
  169. package/dist/modules/utils/time.cjs +57 -0
  170. package/dist/modules/utils/time.d.ts +5 -0
  171. package/dist/modules/utils/time.js +54 -0
  172. package/dist/modules/waapi/composition.cjs +89 -0
  173. package/dist/modules/waapi/composition.d.ts +4 -0
  174. package/dist/modules/waapi/composition.js +86 -0
  175. package/dist/modules/waapi/index.cjs +15 -0
  176. package/dist/modules/waapi/index.d.ts +1 -0
  177. package/dist/modules/waapi/index.js +8 -0
  178. package/dist/modules/waapi/waapi.cjs +473 -0
  179. package/dist/modules/waapi/waapi.d.ts +114 -0
  180. package/dist/modules/waapi/waapi.js +470 -0
  181. package/package.json +130 -33
  182. package/lib/anime.cjs +0 -9
  183. package/lib/anime.esm.min.js +0 -9
  184. package/lib/anime.iife.js +0 -9
  185. package/lib/anime.iife.min.js +0 -9
  186. package/lib/anime.min.cjs +0 -9
  187. package/lib/anime.umd.js +0 -9
  188. package/lib/anime.umd.min.js +0 -9
  189. package/lib/gui/index.js +0 -6341
  190. package/types/index.d.ts +0 -1126
  191. package/types/index.js +0 -7388
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Anime.js - utils - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ import { globals } from '../core/globals.js';
9
+ import { valueTypes, minValue, compositionTypes } from '../core/consts.js';
10
+ import { isUnd, round } from '../core/helpers.js';
11
+ import { registerTargets, parseTargets } from '../core/targets.js';
12
+ import { sanitizePropertyName } from '../core/styles.js';
13
+ export { cleanInlineStyles } from '../core/styles.js';
14
+ import { getTweenType, getOriginalAnimatableValue, decomposeRawValue, decomposedOriginalValue, setValue } from '../core/values.js';
15
+ import { convertValueUnit } from '../core/units.js';
16
+ import { removeWAAPIAnimation } from '../waapi/composition.js';
17
+ import { removeTargetsFromRenderable } from '../animation/composition.js';
18
+ import { JSAnimation } from '../animation/animation.js';
19
+
20
+ /**
21
+ * @import {
22
+ * Renderable,
23
+ * DOMTargetSelector,
24
+ * JSTargetsParam,
25
+ * DOMTargetsParam,
26
+ * TargetsParam,
27
+ * DOMTarget,
28
+ * AnimationParams,
29
+ * TargetsArray,
30
+ * } from '../types/index.js'
31
+ */
32
+
33
+ /**
34
+ * @import {
35
+ * WAAPIAnimation
36
+ * } from '../waapi/waapi.js'
37
+ */
38
+
39
+ /**
40
+ * @overload
41
+ * @param {DOMTargetSelector} targetSelector
42
+ * @param {String} propName
43
+ * @return {String}
44
+ *
45
+ * @overload
46
+ * @param {JSTargetsParam} targetSelector
47
+ * @param {String} propName
48
+ * @return {Number|String}
49
+ *
50
+ * @overload
51
+ * @param {DOMTargetsParam} targetSelector
52
+ * @param {String} propName
53
+ * @param {String} unit
54
+ * @return {String}
55
+ *
56
+ * @overload
57
+ * @param {TargetsParam} targetSelector
58
+ * @param {String} propName
59
+ * @param {Boolean} unit
60
+ * @return {Number}
61
+ *
62
+ * @param {TargetsParam} targetSelector
63
+ * @param {String} propName
64
+ * @param {String|Boolean} [unit]
65
+ */
66
+ function get(targetSelector, propName, unit) {
67
+ const targets = registerTargets(targetSelector);
68
+ if (!targets.length) return;
69
+ const [ target ] = targets;
70
+ const tweenType = getTweenType(target, propName);
71
+ const normalizePropName = sanitizePropertyName(propName, target, tweenType);
72
+ let originalValue = getOriginalAnimatableValue(target, normalizePropName);
73
+ if (isUnd(unit)) {
74
+ return originalValue;
75
+ } else {
76
+ decomposeRawValue(originalValue, decomposedOriginalValue);
77
+ if (decomposedOriginalValue.t === valueTypes.NUMBER || decomposedOriginalValue.t === valueTypes.UNIT) {
78
+ if (unit === false) {
79
+ return decomposedOriginalValue.n;
80
+ } else {
81
+ const convertedValue = convertValueUnit(/** @type {DOMTarget} */(target), decomposedOriginalValue, /** @type {String} */(unit), false);
82
+ return `${round(convertedValue.n, globals.precision)}${convertedValue.u}`;
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ /**
89
+ * @param {TargetsParam} targets
90
+ * @param {AnimationParams} parameters
91
+ * @return {JSAnimation}
92
+ */
93
+ const set = (targets, parameters) => {
94
+ if (isUnd(parameters)) return;
95
+ parameters.duration = minValue;
96
+ // Do not overrides currently active tweens by default
97
+ parameters.composition = setValue(parameters.composition, compositionTypes.none);
98
+ // Skip init() and force rendering by playing the animation
99
+ return new JSAnimation(targets, parameters, null, 0, true).resume();
100
+ };
101
+
102
+ /**
103
+ * @param {TargetsParam} targets
104
+ * @param {Renderable|WAAPIAnimation} [renderable]
105
+ * @param {String} [propertyName]
106
+ * @return {TargetsArray}
107
+ */
108
+ const remove = (targets, renderable, propertyName) => {
109
+ const targetsArray = parseTargets(targets);
110
+ for (let i = 0, l = targetsArray.length; i < l; i++) {
111
+ removeWAAPIAnimation(
112
+ /** @type {DOMTarget} */(targetsArray[i]),
113
+ propertyName,
114
+ renderable && /** @type {WAAPIAnimation} */(renderable).controlAnimation && /** @type {WAAPIAnimation} */(renderable),
115
+ );
116
+ }
117
+ removeTargetsFromRenderable(
118
+ targetsArray,
119
+ /** @type {Renderable} */(renderable),
120
+ propertyName
121
+ );
122
+ return targetsArray;
123
+ };
124
+
125
+ export { registerTargets as $, get, remove, set };
@@ -0,0 +1,57 @@
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 globals = require('../core/globals.cjs');
12
+ var helpers = require('../core/helpers.cjs');
13
+ var timer = require('../timer/timer.cjs');
14
+
15
+ /**
16
+ * @import {
17
+ * Callback,
18
+ * Tickable,
19
+ * } from '../types/index.js'
20
+ */
21
+
22
+ /**
23
+ * @param {Callback<Timer>} [callback]
24
+ * @return {Timer}
25
+ */
26
+ const sync = (callback = consts.noop) => {
27
+ return new timer.Timer({ duration: 1 * globals.globals.timeScale, onComplete: callback }, null, 0).resume();
28
+ };
29
+
30
+ /**
31
+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor
32
+ * @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}
33
+ */
34
+ const keepTime = constructor => {
35
+ /** @type {Tickable} */
36
+ let tracked;
37
+ return (...args) => {
38
+ let currentIteration, currentIterationProgress, reversed, alternate;
39
+ if (tracked) {
40
+ currentIteration = tracked.currentIteration;
41
+ currentIterationProgress = tracked.iterationProgress;
42
+ reversed = tracked.reversed;
43
+ alternate = tracked._alternate;
44
+ tracked.revert();
45
+ }
46
+ const cleanup = constructor(...args);
47
+ if (cleanup && !helpers.isFnc(cleanup) && cleanup.revert) tracked = cleanup;
48
+ if (!helpers.isUnd(currentIterationProgress)) {
49
+ /** @type {Tickable} */(tracked).currentIteration = currentIteration;
50
+ /** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;
51
+ }
52
+ return cleanup || consts.noop;
53
+ }
54
+ };
55
+
56
+ exports.keepTime = keepTime;
57
+ exports.sync = sync;
@@ -0,0 +1,5 @@
1
+ export function sync(callback?: Callback<Timer>): Timer;
2
+ export function keepTime(constructor: (...args: any[]) => Tickable | ((...args: any[]) => void)): (...args: any[]) => Tickable | ((...args: any[]) => void);
3
+ import { Timer } from '../timer/timer.js';
4
+ import type { Callback } from '../types/index.js';
5
+ import type { Tickable } from '../types/index.js';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Anime.js - utils - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ import { noop } from '../core/consts.js';
9
+ import { globals } from '../core/globals.js';
10
+ import { isFnc, isUnd } from '../core/helpers.js';
11
+ import { Timer } from '../timer/timer.js';
12
+
13
+ /**
14
+ * @import {
15
+ * Callback,
16
+ * Tickable,
17
+ * } from '../types/index.js'
18
+ */
19
+
20
+ /**
21
+ * @param {Callback<Timer>} [callback]
22
+ * @return {Timer}
23
+ */
24
+ const sync = (callback = noop) => {
25
+ return new Timer({ duration: 1 * globals.timeScale, onComplete: callback }, null, 0).resume();
26
+ };
27
+
28
+ /**
29
+ * @param {(...args: any[]) => Tickable | ((...args: any[]) => void)} constructor
30
+ * @return {(...args: any[]) => Tickable | ((...args: any[]) => void)}
31
+ */
32
+ const keepTime = constructor => {
33
+ /** @type {Tickable} */
34
+ let tracked;
35
+ return (...args) => {
36
+ let currentIteration, currentIterationProgress, reversed, alternate;
37
+ if (tracked) {
38
+ currentIteration = tracked.currentIteration;
39
+ currentIterationProgress = tracked.iterationProgress;
40
+ reversed = tracked.reversed;
41
+ alternate = tracked._alternate;
42
+ tracked.revert();
43
+ }
44
+ const cleanup = constructor(...args);
45
+ if (cleanup && !isFnc(cleanup) && cleanup.revert) tracked = cleanup;
46
+ if (!isUnd(currentIterationProgress)) {
47
+ /** @type {Tickable} */(tracked).currentIteration = currentIteration;
48
+ /** @type {Tickable} */(tracked).iterationProgress = (alternate ? !(currentIteration % 2) ? reversed : !reversed : reversed) ? 1 - currentIterationProgress : currentIterationProgress;
49
+ }
50
+ return cleanup || noop;
51
+ }
52
+ };
53
+
54
+ export { keepTime, sync };
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Anime.js - waapi - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var helpers = require('../core/helpers.cjs');
11
+
12
+ /**
13
+ * @import {
14
+ * DOMTarget,
15
+ * } from '../types/index.js'
16
+ */
17
+
18
+ /**
19
+ * @import {
20
+ * WAAPIAnimation,
21
+ * } from '../waapi/waapi.js'
22
+ */
23
+
24
+ const WAAPIAnimationsLookups = {
25
+ _head: null,
26
+ _tail: null,
27
+ };
28
+
29
+ /**
30
+ * @param {DOMTarget} $el
31
+ * @param {String} [property]
32
+ * @param {WAAPIAnimation} [parent]
33
+ */
34
+ const removeWAAPIAnimation = ($el, property, parent) => {
35
+ let nextLookup = WAAPIAnimationsLookups._head;
36
+ while (nextLookup) {
37
+ const next = nextLookup._next;
38
+ const matchTarget = nextLookup.$el === $el;
39
+ const matchProperty = !property || nextLookup.property === property;
40
+ const matchParent = !parent || nextLookup.parent === parent;
41
+ if (matchTarget && matchProperty && matchParent) {
42
+ const anim = nextLookup.animation;
43
+ try { anim.commitStyles(); } catch {} anim.cancel();
44
+ helpers.removeChild(WAAPIAnimationsLookups, nextLookup);
45
+ const lookupParent = nextLookup.parent;
46
+ if (lookupParent) {
47
+ lookupParent._completed++;
48
+ if (lookupParent.animations.length === lookupParent._completed) {
49
+ lookupParent.completed = true;
50
+ if (!lookupParent.muteCallbacks) {
51
+ lookupParent.paused = true;
52
+ lookupParent.onComplete(lookupParent);
53
+ lookupParent._resolve(lookupParent);
54
+ }
55
+ }
56
+ }
57
+ }
58
+ nextLookup = next;
59
+ }
60
+ };
61
+
62
+ /**
63
+ * @param {WAAPIAnimation} parent
64
+ * @param {DOMTarget} $el
65
+ * @param {String} property
66
+ * @param {PropertyIndexedKeyframes} keyframes
67
+ * @param {KeyframeAnimationOptions} params
68
+ * @retun {Animation}
69
+ */
70
+ const addWAAPIAnimation = (parent, $el, property, keyframes, params) => {
71
+ const animation = $el.animate(keyframes, params);
72
+ const animTotalDuration = params.delay + (+params.duration * params.iterations);
73
+ animation.playbackRate = parent._speed;
74
+ if (parent.paused) animation.pause();
75
+ if (parent.duration < animTotalDuration) {
76
+ parent.duration = animTotalDuration;
77
+ parent.controlAnimation = animation;
78
+ }
79
+ parent.animations.push(animation);
80
+ removeWAAPIAnimation($el, property);
81
+ helpers.addChild(WAAPIAnimationsLookups, { parent, animation, $el, property, _next: null, _prev: null });
82
+ const handleRemove = () => { removeWAAPIAnimation($el, property, parent); };
83
+ animation.onremove = handleRemove;
84
+ animation.onfinish = handleRemove;
85
+ return animation;
86
+ };
87
+
88
+ exports.addWAAPIAnimation = addWAAPIAnimation;
89
+ exports.removeWAAPIAnimation = removeWAAPIAnimation;
@@ -0,0 +1,4 @@
1
+ export function removeWAAPIAnimation($el: DOMTarget, property?: string, parent?: WAAPIAnimation): void;
2
+ export function addWAAPIAnimation(parent: WAAPIAnimation, $el: DOMTarget, property: string, keyframes: PropertyIndexedKeyframes, params: KeyframeAnimationOptions): Animation;
3
+ import type { DOMTarget } from '../types/index.js';
4
+ import type { WAAPIAnimation } from '../waapi/waapi.js';
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Anime.js - waapi - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ import { removeChild, addChild } from '../core/helpers.js';
9
+
10
+ /**
11
+ * @import {
12
+ * DOMTarget,
13
+ * } from '../types/index.js'
14
+ */
15
+
16
+ /**
17
+ * @import {
18
+ * WAAPIAnimation,
19
+ * } from '../waapi/waapi.js'
20
+ */
21
+
22
+ const WAAPIAnimationsLookups = {
23
+ _head: null,
24
+ _tail: null,
25
+ };
26
+
27
+ /**
28
+ * @param {DOMTarget} $el
29
+ * @param {String} [property]
30
+ * @param {WAAPIAnimation} [parent]
31
+ */
32
+ const removeWAAPIAnimation = ($el, property, parent) => {
33
+ let nextLookup = WAAPIAnimationsLookups._head;
34
+ while (nextLookup) {
35
+ const next = nextLookup._next;
36
+ const matchTarget = nextLookup.$el === $el;
37
+ const matchProperty = !property || nextLookup.property === property;
38
+ const matchParent = !parent || nextLookup.parent === parent;
39
+ if (matchTarget && matchProperty && matchParent) {
40
+ const anim = nextLookup.animation;
41
+ try { anim.commitStyles(); } catch {} anim.cancel();
42
+ removeChild(WAAPIAnimationsLookups, nextLookup);
43
+ const lookupParent = nextLookup.parent;
44
+ if (lookupParent) {
45
+ lookupParent._completed++;
46
+ if (lookupParent.animations.length === lookupParent._completed) {
47
+ lookupParent.completed = true;
48
+ if (!lookupParent.muteCallbacks) {
49
+ lookupParent.paused = true;
50
+ lookupParent.onComplete(lookupParent);
51
+ lookupParent._resolve(lookupParent);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ nextLookup = next;
57
+ }
58
+ };
59
+
60
+ /**
61
+ * @param {WAAPIAnimation} parent
62
+ * @param {DOMTarget} $el
63
+ * @param {String} property
64
+ * @param {PropertyIndexedKeyframes} keyframes
65
+ * @param {KeyframeAnimationOptions} params
66
+ * @retun {Animation}
67
+ */
68
+ const addWAAPIAnimation = (parent, $el, property, keyframes, params) => {
69
+ const animation = $el.animate(keyframes, params);
70
+ const animTotalDuration = params.delay + (+params.duration * params.iterations);
71
+ animation.playbackRate = parent._speed;
72
+ if (parent.paused) animation.pause();
73
+ if (parent.duration < animTotalDuration) {
74
+ parent.duration = animTotalDuration;
75
+ parent.controlAnimation = animation;
76
+ }
77
+ parent.animations.push(animation);
78
+ removeWAAPIAnimation($el, property);
79
+ addChild(WAAPIAnimationsLookups, { parent, animation, $el, property, _next: null, _prev: null });
80
+ const handleRemove = () => { removeWAAPIAnimation($el, property, parent); };
81
+ animation.onremove = handleRemove;
82
+ animation.onfinish = handleRemove;
83
+ return animation;
84
+ };
85
+
86
+ export { addWAAPIAnimation, removeWAAPIAnimation };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Anime.js - waapi - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var waapi = require('./waapi.cjs');
11
+
12
+
13
+
14
+ exports.WAAPIAnimation = waapi.WAAPIAnimation;
15
+ exports.waapi = waapi.waapi;
@@ -0,0 +1 @@
1
+ export * from "./waapi.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Anime.js - waapi - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ export { WAAPIAnimation, waapi } from './waapi.js';