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,226 @@
1
+ /**
2
+ * Anime.js - core - CJS
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var consts = require('./consts.cjs');
11
+ var helpers = require('./helpers.cjs');
12
+ var transforms = require('./transforms.cjs');
13
+ var colors = require('./colors.cjs');
14
+
15
+ /**
16
+ * @import {
17
+ * Target,
18
+ * DOMTarget,
19
+ * Tween,
20
+ * TweenPropValue,
21
+ * TweenDecomposedValue,
22
+ * } from '../types/index.js'
23
+ */
24
+
25
+ /**
26
+ * @template T, D
27
+ * @param {T|undefined} targetValue
28
+ * @param {D} defaultValue
29
+ * @return {T|D}
30
+ */
31
+ const setValue = (targetValue, defaultValue) => {
32
+ return helpers.isUnd(targetValue) ? defaultValue : targetValue;
33
+ };
34
+
35
+ /**
36
+ * @param {TweenPropValue} value
37
+ * @param {Target} target
38
+ * @param {Number} index
39
+ * @param {Number} total
40
+ * @param {Object} [store]
41
+ * @return {any}
42
+ */
43
+ const getFunctionValue = (value, target, index, total, store) => {
44
+ let func;
45
+ if (helpers.isFnc(value)) {
46
+ func = () => {
47
+ const computed = /** @type {Function} */(value)(target, index, total);
48
+ // Fallback to 0 if the function returns undefined / NaN / null / false / 0
49
+ return !isNaN(+computed) ? +computed : computed || 0;
50
+ };
51
+ } else if (helpers.isStr(value) && helpers.stringStartsWith(value, consts.cssVarPrefix)) {
52
+ func = () => {
53
+ const match = value.match(consts.cssVariableMatchRgx);
54
+ const cssVarName = match[1];
55
+ const fallbackValue = match[2];
56
+ let computed = getComputedStyle(/** @type {HTMLElement} */(target))?.getPropertyValue(cssVarName);
57
+ // Use fallback if CSS variable is not set or empty
58
+ if ((!computed || computed.trim() === consts.emptyString) && fallbackValue) {
59
+ computed = fallbackValue.trim();
60
+ }
61
+ return computed || 0;
62
+ };
63
+ } else {
64
+ return value;
65
+ }
66
+ if (store) store.func = func;
67
+ return func();
68
+ };
69
+
70
+ /**
71
+ * @param {Target} target
72
+ * @param {String} prop
73
+ * @return {tweenTypes}
74
+ */
75
+ const getTweenType = (target, prop) => {
76
+ return !target[consts.isDomSymbol] ? consts.tweenTypes.OBJECT :
77
+ // Handle SVG attributes
78
+ target[consts.isSvgSymbol] && helpers.isValidSVGAttribute(target, prop) ? consts.tweenTypes.ATTRIBUTE :
79
+ // Handle CSS Transform properties differently than CSS to allow individual animations
80
+ consts.validTransforms.includes(prop) || consts.shortTransforms.get(prop) ? consts.tweenTypes.TRANSFORM :
81
+ // CSS variables
82
+ helpers.stringStartsWith(prop, '--') ? consts.tweenTypes.CSS_VAR :
83
+ // All other CSS properties
84
+ prop in /** @type {DOMTarget} */(target).style ? consts.tweenTypes.CSS :
85
+ // Handle other DOM Attributes
86
+ prop in target ? consts.tweenTypes.OBJECT :
87
+ consts.tweenTypes.ATTRIBUTE;
88
+ };
89
+
90
+ /**
91
+ * @param {DOMTarget} target
92
+ * @param {String} propName
93
+ * @param {Object} animationInlineStyles
94
+ * @return {String}
95
+ */
96
+ const getCSSValue = (target, propName, animationInlineStyles) => {
97
+ const inlineStyles = target.style[propName];
98
+ if (inlineStyles && animationInlineStyles) {
99
+ animationInlineStyles[propName] = inlineStyles;
100
+ }
101
+ const value = inlineStyles || getComputedStyle(target[consts.proxyTargetSymbol] || target).getPropertyValue(propName);
102
+ return value === 'auto' ? '0' : value;
103
+ };
104
+
105
+ /**
106
+ * @param {Target} target
107
+ * @param {String} propName
108
+ * @param {tweenTypes} [tweenType]
109
+ * @param {Object|void} [animationInlineStyles]
110
+ * @return {String|Number}
111
+ */
112
+ const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {
113
+ const type = !helpers.isUnd(tweenType) ? tweenType : getTweenType(target, propName);
114
+ return type === consts.tweenTypes.OBJECT ? target[propName] || 0 :
115
+ type === consts.tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :
116
+ type === consts.tweenTypes.TRANSFORM ? transforms.parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :
117
+ type === consts.tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :
118
+ getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);
119
+ };
120
+
121
+ /**
122
+ * @param {Number} x
123
+ * @param {Number} y
124
+ * @param {String} operator
125
+ * @return {Number}
126
+ */
127
+ const getRelativeValue = (x, y, operator) => {
128
+ return operator === '-' ? x - y :
129
+ operator === '+' ? x + y :
130
+ x * y;
131
+ };
132
+
133
+ /** @return {TweenDecomposedValue} */
134
+ const createDecomposedValueTargetObject = () => {
135
+ return {
136
+ /** @type {valueTypes} */
137
+ t: consts.valueTypes.NUMBER,
138
+ n: 0,
139
+ u: null,
140
+ o: null,
141
+ d: null,
142
+ s: null,
143
+ }
144
+ };
145
+
146
+ /**
147
+ * @param {String|Number} rawValue
148
+ * @param {TweenDecomposedValue} targetObject
149
+ * @return {TweenDecomposedValue}
150
+ */
151
+ const decomposeRawValue = (rawValue, targetObject) => {
152
+ /** @type {valueTypes} */
153
+ targetObject.t = consts.valueTypes.NUMBER;
154
+ targetObject.n = 0;
155
+ targetObject.u = null;
156
+ targetObject.o = null;
157
+ targetObject.d = null;
158
+ targetObject.s = null;
159
+ if (!rawValue) return targetObject;
160
+ const num = +rawValue;
161
+ if (!isNaN(num)) {
162
+ // It's a number
163
+ targetObject.n = num;
164
+ return targetObject;
165
+ } else {
166
+ // let str = /** @type {String} */(rawValue).trim();
167
+ let str = /** @type {String} */(rawValue);
168
+ // Parsing operators (+=, -=, *=) manually is much faster than using regex here
169
+ if (str[1] === '=') {
170
+ targetObject.o = str[0];
171
+ str = str.slice(2);
172
+ }
173
+ // Skip exec regex if the value type is complex or color to avoid long regex backtracking
174
+ const unitMatch = str.includes(' ') ? false : consts.unitsExecRgx.exec(str);
175
+ if (unitMatch) {
176
+ // Has a number and a unit
177
+ targetObject.t = consts.valueTypes.UNIT;
178
+ targetObject.n = +unitMatch[1];
179
+ targetObject.u = unitMatch[2];
180
+ return targetObject;
181
+ } else if (targetObject.o) {
182
+ // Has an operator (+=, -=, *=)
183
+ targetObject.n = +str;
184
+ return targetObject;
185
+ } else if (helpers.isCol(str)) {
186
+ // Is a color
187
+ targetObject.t = consts.valueTypes.COLOR;
188
+ targetObject.d = colors.convertColorStringValuesToRgbaArray(str);
189
+ return targetObject;
190
+ } else {
191
+ // Is a more complex string (generally svg coords, calc() or filters CSS values)
192
+ const matchedNumbers = str.match(consts.digitWithExponentRgx);
193
+ targetObject.t = consts.valueTypes.COMPLEX;
194
+ targetObject.d = matchedNumbers ? matchedNumbers.map(Number) : [];
195
+ targetObject.s = str.split(consts.digitWithExponentRgx) || [];
196
+ return targetObject;
197
+ }
198
+ }
199
+ };
200
+
201
+ /**
202
+ * @param {Tween} tween
203
+ * @param {TweenDecomposedValue} targetObject
204
+ * @return {TweenDecomposedValue}
205
+ */
206
+ const decomposeTweenValue = (tween, targetObject) => {
207
+ targetObject.t = tween._valueType;
208
+ targetObject.n = tween._toNumber;
209
+ targetObject.u = tween._unit;
210
+ targetObject.o = null;
211
+ targetObject.d = helpers.cloneArray(tween._toNumbers);
212
+ targetObject.s = helpers.cloneArray(tween._strings);
213
+ return targetObject;
214
+ };
215
+
216
+ const decomposedOriginalValue = createDecomposedValueTargetObject();
217
+
218
+ exports.createDecomposedValueTargetObject = createDecomposedValueTargetObject;
219
+ exports.decomposeRawValue = decomposeRawValue;
220
+ exports.decomposeTweenValue = decomposeTweenValue;
221
+ exports.decomposedOriginalValue = decomposedOriginalValue;
222
+ exports.getFunctionValue = getFunctionValue;
223
+ exports.getOriginalAnimatableValue = getOriginalAnimatableValue;
224
+ exports.getRelativeValue = getRelativeValue;
225
+ exports.getTweenType = getTweenType;
226
+ exports.setValue = setValue;
@@ -0,0 +1,14 @@
1
+ export function setValue<T, D>(targetValue: T | undefined, defaultValue: D): T | D;
2
+ export function getFunctionValue(value: TweenPropValue, target: Target, index: number, total: number, store?: any): any;
3
+ export function getTweenType(target: Target, prop: string): tweenTypes;
4
+ export function getOriginalAnimatableValue(target: Target, propName: string, tweenType?: tweenTypes, animationInlineStyles?: any | void): string | number;
5
+ export function getRelativeValue(x: number, y: number, operator: string): number;
6
+ export function createDecomposedValueTargetObject(): TweenDecomposedValue;
7
+ export function decomposeRawValue(rawValue: string | number, targetObject: TweenDecomposedValue): TweenDecomposedValue;
8
+ export function decomposeTweenValue(tween: Tween, targetObject: TweenDecomposedValue): TweenDecomposedValue;
9
+ export const decomposedOriginalValue: TweenDecomposedValue;
10
+ import type { TweenPropValue } from '../types/index.js';
11
+ import type { Target } from '../types/index.js';
12
+ import { tweenTypes } from './consts.js';
13
+ import type { TweenDecomposedValue } from '../types/index.js';
14
+ import type { Tween } from '../types/index.js';
@@ -0,0 +1,216 @@
1
+ /**
2
+ * Anime.js - core - ESM
3
+ * @version v4.2.0
4
+ * @license MIT
5
+ * @copyright 2025 - Julian Garnier
6
+ */
7
+
8
+ import { tweenTypes, isDomSymbol, isSvgSymbol, validTransforms, shortTransforms, valueTypes, unitsExecRgx, digitWithExponentRgx, proxyTargetSymbol, cssVarPrefix, cssVariableMatchRgx, emptyString } from './consts.js';
9
+ import { isUnd, isValidSVGAttribute, stringStartsWith, isCol, isFnc, isStr, cloneArray } from './helpers.js';
10
+ import { parseInlineTransforms } from './transforms.js';
11
+ import { convertColorStringValuesToRgbaArray } from './colors.js';
12
+
13
+ /**
14
+ * @import {
15
+ * Target,
16
+ * DOMTarget,
17
+ * Tween,
18
+ * TweenPropValue,
19
+ * TweenDecomposedValue,
20
+ * } from '../types/index.js'
21
+ */
22
+
23
+ /**
24
+ * @template T, D
25
+ * @param {T|undefined} targetValue
26
+ * @param {D} defaultValue
27
+ * @return {T|D}
28
+ */
29
+ const setValue = (targetValue, defaultValue) => {
30
+ return isUnd(targetValue) ? defaultValue : targetValue;
31
+ };
32
+
33
+ /**
34
+ * @param {TweenPropValue} value
35
+ * @param {Target} target
36
+ * @param {Number} index
37
+ * @param {Number} total
38
+ * @param {Object} [store]
39
+ * @return {any}
40
+ */
41
+ const getFunctionValue = (value, target, index, total, store) => {
42
+ let func;
43
+ if (isFnc(value)) {
44
+ func = () => {
45
+ const computed = /** @type {Function} */(value)(target, index, total);
46
+ // Fallback to 0 if the function returns undefined / NaN / null / false / 0
47
+ return !isNaN(+computed) ? +computed : computed || 0;
48
+ };
49
+ } else if (isStr(value) && stringStartsWith(value, cssVarPrefix)) {
50
+ func = () => {
51
+ const match = value.match(cssVariableMatchRgx);
52
+ const cssVarName = match[1];
53
+ const fallbackValue = match[2];
54
+ let computed = getComputedStyle(/** @type {HTMLElement} */(target))?.getPropertyValue(cssVarName);
55
+ // Use fallback if CSS variable is not set or empty
56
+ if ((!computed || computed.trim() === emptyString) && fallbackValue) {
57
+ computed = fallbackValue.trim();
58
+ }
59
+ return computed || 0;
60
+ };
61
+ } else {
62
+ return value;
63
+ }
64
+ if (store) store.func = func;
65
+ return func();
66
+ };
67
+
68
+ /**
69
+ * @param {Target} target
70
+ * @param {String} prop
71
+ * @return {tweenTypes}
72
+ */
73
+ const getTweenType = (target, prop) => {
74
+ return !target[isDomSymbol] ? tweenTypes.OBJECT :
75
+ // Handle SVG attributes
76
+ target[isSvgSymbol] && isValidSVGAttribute(target, prop) ? tweenTypes.ATTRIBUTE :
77
+ // Handle CSS Transform properties differently than CSS to allow individual animations
78
+ validTransforms.includes(prop) || shortTransforms.get(prop) ? tweenTypes.TRANSFORM :
79
+ // CSS variables
80
+ stringStartsWith(prop, '--') ? tweenTypes.CSS_VAR :
81
+ // All other CSS properties
82
+ prop in /** @type {DOMTarget} */(target).style ? tweenTypes.CSS :
83
+ // Handle other DOM Attributes
84
+ prop in target ? tweenTypes.OBJECT :
85
+ tweenTypes.ATTRIBUTE;
86
+ };
87
+
88
+ /**
89
+ * @param {DOMTarget} target
90
+ * @param {String} propName
91
+ * @param {Object} animationInlineStyles
92
+ * @return {String}
93
+ */
94
+ const getCSSValue = (target, propName, animationInlineStyles) => {
95
+ const inlineStyles = target.style[propName];
96
+ if (inlineStyles && animationInlineStyles) {
97
+ animationInlineStyles[propName] = inlineStyles;
98
+ }
99
+ const value = inlineStyles || getComputedStyle(target[proxyTargetSymbol] || target).getPropertyValue(propName);
100
+ return value === 'auto' ? '0' : value;
101
+ };
102
+
103
+ /**
104
+ * @param {Target} target
105
+ * @param {String} propName
106
+ * @param {tweenTypes} [tweenType]
107
+ * @param {Object|void} [animationInlineStyles]
108
+ * @return {String|Number}
109
+ */
110
+ const getOriginalAnimatableValue = (target, propName, tweenType, animationInlineStyles) => {
111
+ const type = !isUnd(tweenType) ? tweenType : getTweenType(target, propName);
112
+ return type === tweenTypes.OBJECT ? target[propName] || 0 :
113
+ type === tweenTypes.ATTRIBUTE ? /** @type {DOMTarget} */(target).getAttribute(propName) :
114
+ type === tweenTypes.TRANSFORM ? parseInlineTransforms(/** @type {DOMTarget} */(target), propName, animationInlineStyles) :
115
+ type === tweenTypes.CSS_VAR ? getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles).trimStart() :
116
+ getCSSValue(/** @type {DOMTarget} */(target), propName, animationInlineStyles);
117
+ };
118
+
119
+ /**
120
+ * @param {Number} x
121
+ * @param {Number} y
122
+ * @param {String} operator
123
+ * @return {Number}
124
+ */
125
+ const getRelativeValue = (x, y, operator) => {
126
+ return operator === '-' ? x - y :
127
+ operator === '+' ? x + y :
128
+ x * y;
129
+ };
130
+
131
+ /** @return {TweenDecomposedValue} */
132
+ const createDecomposedValueTargetObject = () => {
133
+ return {
134
+ /** @type {valueTypes} */
135
+ t: valueTypes.NUMBER,
136
+ n: 0,
137
+ u: null,
138
+ o: null,
139
+ d: null,
140
+ s: null,
141
+ }
142
+ };
143
+
144
+ /**
145
+ * @param {String|Number} rawValue
146
+ * @param {TweenDecomposedValue} targetObject
147
+ * @return {TweenDecomposedValue}
148
+ */
149
+ const decomposeRawValue = (rawValue, targetObject) => {
150
+ /** @type {valueTypes} */
151
+ targetObject.t = valueTypes.NUMBER;
152
+ targetObject.n = 0;
153
+ targetObject.u = null;
154
+ targetObject.o = null;
155
+ targetObject.d = null;
156
+ targetObject.s = null;
157
+ if (!rawValue) return targetObject;
158
+ const num = +rawValue;
159
+ if (!isNaN(num)) {
160
+ // It's a number
161
+ targetObject.n = num;
162
+ return targetObject;
163
+ } else {
164
+ // let str = /** @type {String} */(rawValue).trim();
165
+ let str = /** @type {String} */(rawValue);
166
+ // Parsing operators (+=, -=, *=) manually is much faster than using regex here
167
+ if (str[1] === '=') {
168
+ targetObject.o = str[0];
169
+ str = str.slice(2);
170
+ }
171
+ // Skip exec regex if the value type is complex or color to avoid long regex backtracking
172
+ const unitMatch = str.includes(' ') ? false : unitsExecRgx.exec(str);
173
+ if (unitMatch) {
174
+ // Has a number and a unit
175
+ targetObject.t = valueTypes.UNIT;
176
+ targetObject.n = +unitMatch[1];
177
+ targetObject.u = unitMatch[2];
178
+ return targetObject;
179
+ } else if (targetObject.o) {
180
+ // Has an operator (+=, -=, *=)
181
+ targetObject.n = +str;
182
+ return targetObject;
183
+ } else if (isCol(str)) {
184
+ // Is a color
185
+ targetObject.t = valueTypes.COLOR;
186
+ targetObject.d = convertColorStringValuesToRgbaArray(str);
187
+ return targetObject;
188
+ } else {
189
+ // Is a more complex string (generally svg coords, calc() or filters CSS values)
190
+ const matchedNumbers = str.match(digitWithExponentRgx);
191
+ targetObject.t = valueTypes.COMPLEX;
192
+ targetObject.d = matchedNumbers ? matchedNumbers.map(Number) : [];
193
+ targetObject.s = str.split(digitWithExponentRgx) || [];
194
+ return targetObject;
195
+ }
196
+ }
197
+ };
198
+
199
+ /**
200
+ * @param {Tween} tween
201
+ * @param {TweenDecomposedValue} targetObject
202
+ * @return {TweenDecomposedValue}
203
+ */
204
+ const decomposeTweenValue = (tween, targetObject) => {
205
+ targetObject.t = tween._valueType;
206
+ targetObject.n = tween._toNumber;
207
+ targetObject.u = tween._unit;
208
+ targetObject.o = null;
209
+ targetObject.d = cloneArray(tween._toNumbers);
210
+ targetObject.s = cloneArray(tween._strings);
211
+ return targetObject;
212
+ };
213
+
214
+ const decomposedOriginalValue = createDecomposedValueTargetObject();
215
+
216
+ export { createDecomposedValueTargetObject, decomposeRawValue, decomposeTweenValue, decomposedOriginalValue, getFunctionValue, getOriginalAnimatableValue, getRelativeValue, getTweenType, setValue };