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.
- package/README.md +17 -8
- package/{lib → dist/bundles}/anime.esm.js +6476 -6106
- package/dist/bundles/anime.esm.min.js +7 -0
- package/dist/bundles/anime.umd.js +8809 -0
- package/dist/bundles/anime.umd.min.js +7 -0
- package/dist/modules/animatable/animatable.cjs +150 -0
- package/dist/modules/animatable/animatable.d.ts +28 -0
- package/dist/modules/animatable/animatable.js +147 -0
- package/dist/modules/animatable/index.cjs +15 -0
- package/dist/modules/animatable/index.d.ts +1 -0
- package/dist/modules/animatable/index.js +8 -0
- package/dist/modules/animation/additive.cjs +82 -0
- package/dist/modules/animation/additive.d.ts +15 -0
- package/dist/modules/animation/additive.js +79 -0
- package/dist/modules/animation/animation.cjs +667 -0
- package/dist/modules/animation/animation.d.ts +45 -0
- package/dist/modules/animation/animation.js +664 -0
- package/dist/modules/animation/composition.cjs +383 -0
- package/dist/modules/animation/composition.d.ts +10 -0
- package/dist/modules/animation/composition.js +377 -0
- package/dist/modules/animation/index.cjs +15 -0
- package/dist/modules/animation/index.d.ts +1 -0
- package/dist/modules/animation/index.js +8 -0
- package/dist/modules/core/clock.cjs +110 -0
- package/dist/modules/core/clock.d.ts +51 -0
- package/dist/modules/core/clock.js +108 -0
- package/dist/modules/core/colors.cjs +102 -0
- package/dist/modules/core/colors.d.ts +2 -0
- package/dist/modules/core/colors.js +100 -0
- package/dist/modules/core/consts.cjs +159 -0
- package/dist/modules/core/consts.d.ts +61 -0
- package/dist/modules/core/consts.js +124 -0
- package/dist/modules/core/globals.cjs +78 -0
- package/dist/modules/core/globals.d.ts +29 -0
- package/dist/modules/core/globals.js +73 -0
- package/dist/modules/core/helpers.cjs +304 -0
- package/dist/modules/core/helpers.d.ts +43 -0
- package/dist/modules/core/helpers.js +261 -0
- package/dist/modules/core/render.cjs +391 -0
- package/dist/modules/core/render.d.ts +4 -0
- package/dist/modules/core/render.js +388 -0
- package/dist/modules/core/styles.cjs +116 -0
- package/dist/modules/core/styles.d.ts +5 -0
- package/dist/modules/core/styles.js +113 -0
- package/dist/modules/core/targets.cjs +136 -0
- package/dist/modules/core/targets.d.ts +118 -0
- package/dist/modules/core/targets.js +132 -0
- package/dist/modules/core/transforms.cjs +49 -0
- package/dist/modules/core/transforms.d.ts +2 -0
- package/dist/modules/core/transforms.js +47 -0
- package/dist/modules/core/units.cjs +67 -0
- package/dist/modules/core/units.d.ts +3 -0
- package/dist/modules/core/units.js +65 -0
- package/dist/modules/core/values.cjs +226 -0
- package/dist/modules/core/values.d.ts +14 -0
- package/dist/modules/core/values.js +216 -0
- package/dist/modules/draggable/draggable.cjs +1226 -0
- package/dist/modules/draggable/draggable.d.ts +272 -0
- package/dist/modules/draggable/draggable.js +1223 -0
- package/dist/modules/draggable/index.cjs +15 -0
- package/dist/modules/draggable/index.d.ts +1 -0
- package/dist/modules/draggable/index.js +8 -0
- package/dist/modules/easings/cubic-bezier/index.cjs +64 -0
- package/dist/modules/easings/cubic-bezier/index.d.ts +2 -0
- package/dist/modules/easings/cubic-bezier/index.js +62 -0
- package/dist/modules/easings/eases/index.cjs +14 -0
- package/dist/modules/easings/eases/index.d.ts +1 -0
- package/dist/modules/easings/eases/index.js +8 -0
- package/dist/modules/easings/eases/parser.cjs +191 -0
- package/dist/modules/easings/eases/parser.d.ts +125 -0
- package/dist/modules/easings/eases/parser.js +185 -0
- package/dist/modules/easings/index.cjs +26 -0
- package/dist/modules/easings/index.d.ts +6 -0
- package/dist/modules/easings/index.js +13 -0
- package/dist/modules/easings/irregular/index.cjs +41 -0
- package/dist/modules/easings/irregular/index.d.ts +2 -0
- package/dist/modules/easings/irregular/index.js +39 -0
- package/dist/modules/easings/linear/index.cjs +59 -0
- package/dist/modules/easings/linear/index.d.ts +2 -0
- package/dist/modules/easings/linear/index.js +57 -0
- package/dist/modules/easings/none.cjs +19 -0
- package/dist/modules/easings/none.d.ts +8 -0
- package/dist/modules/easings/none.js +17 -0
- package/dist/modules/easings/spring/index.cjs +255 -0
- package/dist/modules/easings/spring/index.d.ts +53 -0
- package/dist/modules/easings/spring/index.js +251 -0
- package/dist/modules/easings/steps/index.cjs +30 -0
- package/dist/modules/easings/steps/index.d.ts +2 -0
- package/dist/modules/easings/steps/index.js +28 -0
- package/dist/modules/engine/engine.cjs +168 -0
- package/dist/modules/engine/engine.d.ts +21 -0
- package/dist/modules/engine/engine.js +166 -0
- package/dist/modules/engine/index.cjs +14 -0
- package/dist/modules/engine/index.d.ts +1 -0
- package/dist/modules/engine/index.js +8 -0
- package/dist/modules/events/index.cjs +16 -0
- package/dist/modules/events/index.d.ts +1 -0
- package/dist/modules/events/index.js +8 -0
- package/dist/modules/events/scroll.cjs +940 -0
- package/dist/modules/events/scroll.d.ts +191 -0
- package/dist/modules/events/scroll.js +936 -0
- package/dist/modules/index.cjs +102 -0
- package/dist/modules/index.d.ts +18 -0
- package/dist/modules/index.js +41 -0
- package/dist/modules/scope/index.cjs +15 -0
- package/dist/modules/scope/index.d.ts +1 -0
- package/dist/modules/scope/index.js +8 -0
- package/dist/modules/scope/scope.cjs +254 -0
- package/dist/modules/scope/scope.d.ts +115 -0
- package/dist/modules/scope/scope.js +251 -0
- package/dist/modules/svg/drawable.cjs +119 -0
- package/dist/modules/svg/drawable.d.ts +3 -0
- package/dist/modules/svg/drawable.js +117 -0
- package/dist/modules/svg/helpers.cjs +30 -0
- package/dist/modules/svg/helpers.d.ts +2 -0
- package/dist/modules/svg/helpers.js +28 -0
- package/dist/modules/svg/index.cjs +18 -0
- package/dist/modules/svg/index.d.ts +3 -0
- package/dist/modules/svg/index.js +10 -0
- package/dist/modules/svg/morphto.cjs +58 -0
- package/dist/modules/svg/morphto.d.ts +3 -0
- package/dist/modules/svg/morphto.js +56 -0
- package/dist/modules/svg/motionpath.cjs +79 -0
- package/dist/modules/svg/motionpath.d.ts +7 -0
- package/dist/modules/svg/motionpath.js +77 -0
- package/dist/modules/text/index.cjs +16 -0
- package/dist/modules/text/index.d.ts +1 -0
- package/dist/modules/text/index.js +8 -0
- package/dist/modules/text/split.cjs +488 -0
- package/dist/modules/text/split.d.ts +62 -0
- package/dist/modules/text/split.js +484 -0
- package/dist/modules/timeline/index.cjs +15 -0
- package/dist/modules/timeline/index.d.ts +1 -0
- package/dist/modules/timeline/index.js +8 -0
- package/dist/modules/timeline/position.cjs +72 -0
- package/dist/modules/timeline/position.d.ts +3 -0
- package/dist/modules/timeline/position.js +70 -0
- package/dist/modules/timeline/timeline.cjs +312 -0
- package/dist/modules/timeline/timeline.d.ts +163 -0
- package/dist/modules/timeline/timeline.js +309 -0
- package/dist/modules/timer/index.cjs +15 -0
- package/dist/modules/timer/index.d.ts +1 -0
- package/dist/modules/timer/index.js +8 -0
- package/dist/modules/timer/timer.cjs +491 -0
- package/dist/modules/timer/timer.d.ts +141 -0
- package/dist/modules/timer/timer.js +488 -0
- package/dist/modules/types/index.d.ts +404 -0
- package/dist/modules/utils/chainable.cjs +190 -0
- package/dist/modules/utils/chainable.d.ts +135 -0
- package/dist/modules/utils/chainable.js +177 -0
- package/dist/modules/utils/index.cjs +43 -0
- package/dist/modules/utils/index.d.ts +5 -0
- package/dist/modules/utils/index.js +14 -0
- package/dist/modules/utils/number.cjs +97 -0
- package/dist/modules/utils/number.d.ts +9 -0
- package/dist/modules/utils/number.js +85 -0
- package/dist/modules/utils/random.cjs +77 -0
- package/dist/modules/utils/random.d.ts +22 -0
- package/dist/modules/utils/random.js +72 -0
- package/dist/modules/utils/stagger.cjs +122 -0
- package/dist/modules/utils/stagger.d.ts +30 -0
- package/dist/modules/utils/stagger.js +120 -0
- package/dist/modules/utils/target.cjs +130 -0
- package/dist/modules/utils/target.d.ts +126 -0
- package/dist/modules/utils/target.js +125 -0
- package/dist/modules/utils/time.cjs +57 -0
- package/dist/modules/utils/time.d.ts +5 -0
- package/dist/modules/utils/time.js +54 -0
- package/dist/modules/waapi/composition.cjs +95 -0
- package/dist/modules/waapi/composition.d.ts +4 -0
- package/dist/modules/waapi/composition.js +92 -0
- package/dist/modules/waapi/index.cjs +15 -0
- package/dist/modules/waapi/index.d.ts +1 -0
- package/dist/modules/waapi/index.js +8 -0
- package/dist/modules/waapi/waapi.cjs +492 -0
- package/dist/modules/waapi/waapi.d.ts +116 -0
- package/dist/modules/waapi/waapi.js +489 -0
- package/package.json +166 -33
- package/lib/anime.cjs +0 -9
- package/lib/anime.esm.min.js +0 -9
- package/lib/anime.iife.js +0 -9
- package/lib/anime.iife.min.js +0 -9
- package/lib/anime.min.cjs +0 -9
- package/lib/anime.umd.js +0 -9
- package/lib/anime.umd.min.js +0 -9
- package/lib/gui/index.js +0 -6341
- package/types/index.d.ts +0 -1127
- package/types/index.js +0 -7395
|
@@ -0,0 +1,136 @@
|
|
|
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 globals = require('./globals.cjs');
|
|
11
|
+
var consts = require('./consts.cjs');
|
|
12
|
+
var helpers = require('./helpers.cjs');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @import {
|
|
16
|
+
* DOMTarget,
|
|
17
|
+
* DOMTargetsParam,
|
|
18
|
+
* JSTargetsArray,
|
|
19
|
+
* TargetsParam,
|
|
20
|
+
* JSTargetsParam,
|
|
21
|
+
* TargetsArray,
|
|
22
|
+
* DOMTargetsArray,
|
|
23
|
+
* } from '../types/index.js'
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {DOMTargetsParam|TargetsParam} v
|
|
28
|
+
* @return {NodeList|HTMLCollection}
|
|
29
|
+
*/
|
|
30
|
+
function getNodeList(v) {
|
|
31
|
+
const n = helpers.isStr(v) ? globals.scope.root.querySelectorAll(v) : v;
|
|
32
|
+
if (n instanceof NodeList || n instanceof HTMLCollection) return n;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @overload
|
|
37
|
+
* @param {DOMTargetsParam} targets
|
|
38
|
+
* @return {DOMTargetsArray}
|
|
39
|
+
*
|
|
40
|
+
* @overload
|
|
41
|
+
* @param {JSTargetsParam} targets
|
|
42
|
+
* @return {JSTargetsArray}
|
|
43
|
+
*
|
|
44
|
+
* @overload
|
|
45
|
+
* @param {TargetsParam} targets
|
|
46
|
+
* @return {TargetsArray}
|
|
47
|
+
*
|
|
48
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
49
|
+
*/
|
|
50
|
+
function parseTargets(targets) {
|
|
51
|
+
if (helpers.isNil(targets)) return /** @type {TargetsArray} */([]);
|
|
52
|
+
if (!consts.isBrowser) return /** @type {JSTargetsArray} */(helpers.isArr(targets) && targets.flat(Infinity) || [targets]);
|
|
53
|
+
if (helpers.isArr(targets)) {
|
|
54
|
+
const flattened = targets.flat(Infinity);
|
|
55
|
+
/** @type {TargetsArray} */
|
|
56
|
+
const parsed = [];
|
|
57
|
+
for (let i = 0, l = flattened.length; i < l; i++) {
|
|
58
|
+
const item = flattened[i];
|
|
59
|
+
if (!helpers.isNil(item)) {
|
|
60
|
+
const nodeList = getNodeList(item);
|
|
61
|
+
if (nodeList) {
|
|
62
|
+
for (let j = 0, jl = nodeList.length; j < jl; j++) {
|
|
63
|
+
const subItem = nodeList[j];
|
|
64
|
+
if (!helpers.isNil(subItem)) {
|
|
65
|
+
let isDuplicate = false;
|
|
66
|
+
for (let k = 0, kl = parsed.length; k < kl; k++) {
|
|
67
|
+
if (parsed[k] === subItem) {
|
|
68
|
+
isDuplicate = true;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!isDuplicate) {
|
|
73
|
+
parsed.push(subItem);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
let isDuplicate = false;
|
|
79
|
+
for (let j = 0, jl = parsed.length; j < jl; j++) {
|
|
80
|
+
if (parsed[j] === item) {
|
|
81
|
+
isDuplicate = true;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!isDuplicate) {
|
|
86
|
+
parsed.push(item);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return parsed;
|
|
92
|
+
}
|
|
93
|
+
const nodeList = getNodeList(targets);
|
|
94
|
+
if (nodeList) return /** @type {DOMTargetsArray} */(Array.from(nodeList));
|
|
95
|
+
return /** @type {TargetsArray} */([targets]);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @overload
|
|
100
|
+
* @param {DOMTargetsParam} targets
|
|
101
|
+
* @return {DOMTargetsArray}
|
|
102
|
+
*
|
|
103
|
+
* @overload
|
|
104
|
+
* @param {JSTargetsParam} targets
|
|
105
|
+
* @return {JSTargetsArray}
|
|
106
|
+
*
|
|
107
|
+
* @overload
|
|
108
|
+
* @param {TargetsParam} targets
|
|
109
|
+
* @return {TargetsArray}
|
|
110
|
+
*
|
|
111
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
112
|
+
*/
|
|
113
|
+
function registerTargets(targets) {
|
|
114
|
+
const parsedTargetsArray = parseTargets(targets);
|
|
115
|
+
const parsedTargetsLength = parsedTargetsArray.length;
|
|
116
|
+
if (parsedTargetsLength) {
|
|
117
|
+
for (let i = 0; i < parsedTargetsLength; i++) {
|
|
118
|
+
const target = parsedTargetsArray[i];
|
|
119
|
+
if (!target[consts.isRegisteredTargetSymbol]) {
|
|
120
|
+
target[consts.isRegisteredTargetSymbol] = true;
|
|
121
|
+
const isSvgType = helpers.isSvg(target);
|
|
122
|
+
const isDom = /** @type {DOMTarget} */(target).nodeType || isSvgType;
|
|
123
|
+
if (isDom) {
|
|
124
|
+
target[consts.isDomSymbol] = true;
|
|
125
|
+
target[consts.isSvgSymbol] = isSvgType;
|
|
126
|
+
target[consts.transformsSymbol] = {};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return parsedTargetsArray;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
exports.getNodeList = getNodeList;
|
|
135
|
+
exports.parseTargets = parseTargets;
|
|
136
|
+
exports.registerTargets = registerTargets;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {
|
|
3
|
+
* DOMTarget,
|
|
4
|
+
* DOMTargetsParam,
|
|
5
|
+
* JSTargetsArray,
|
|
6
|
+
* TargetsParam,
|
|
7
|
+
* JSTargetsParam,
|
|
8
|
+
* TargetsArray,
|
|
9
|
+
* DOMTargetsArray,
|
|
10
|
+
* } from '../types/index.js'
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @param {DOMTargetsParam|TargetsParam} v
|
|
14
|
+
* @return {NodeList|HTMLCollection}
|
|
15
|
+
*/
|
|
16
|
+
export function getNodeList(v: DOMTargetsParam | TargetsParam): NodeList | HTMLCollection;
|
|
17
|
+
/**
|
|
18
|
+
* @overload
|
|
19
|
+
* @param {DOMTargetsParam} targets
|
|
20
|
+
* @return {DOMTargetsArray}
|
|
21
|
+
*
|
|
22
|
+
* @overload
|
|
23
|
+
* @param {JSTargetsParam} targets
|
|
24
|
+
* @return {JSTargetsArray}
|
|
25
|
+
*
|
|
26
|
+
* @overload
|
|
27
|
+
* @param {TargetsParam} targets
|
|
28
|
+
* @return {TargetsArray}
|
|
29
|
+
*
|
|
30
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
31
|
+
*/
|
|
32
|
+
export function parseTargets(targets: DOMTargetsParam): DOMTargetsArray;
|
|
33
|
+
/**
|
|
34
|
+
* @overload
|
|
35
|
+
* @param {DOMTargetsParam} targets
|
|
36
|
+
* @return {DOMTargetsArray}
|
|
37
|
+
*
|
|
38
|
+
* @overload
|
|
39
|
+
* @param {JSTargetsParam} targets
|
|
40
|
+
* @return {JSTargetsArray}
|
|
41
|
+
*
|
|
42
|
+
* @overload
|
|
43
|
+
* @param {TargetsParam} targets
|
|
44
|
+
* @return {TargetsArray}
|
|
45
|
+
*
|
|
46
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
47
|
+
*/
|
|
48
|
+
export function parseTargets(targets: JSTargetsParam): JSTargetsArray;
|
|
49
|
+
/**
|
|
50
|
+
* @overload
|
|
51
|
+
* @param {DOMTargetsParam} targets
|
|
52
|
+
* @return {DOMTargetsArray}
|
|
53
|
+
*
|
|
54
|
+
* @overload
|
|
55
|
+
* @param {JSTargetsParam} targets
|
|
56
|
+
* @return {JSTargetsArray}
|
|
57
|
+
*
|
|
58
|
+
* @overload
|
|
59
|
+
* @param {TargetsParam} targets
|
|
60
|
+
* @return {TargetsArray}
|
|
61
|
+
*
|
|
62
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
63
|
+
*/
|
|
64
|
+
export function parseTargets(targets: TargetsParam): TargetsArray;
|
|
65
|
+
/**
|
|
66
|
+
* @overload
|
|
67
|
+
* @param {DOMTargetsParam} targets
|
|
68
|
+
* @return {DOMTargetsArray}
|
|
69
|
+
*
|
|
70
|
+
* @overload
|
|
71
|
+
* @param {JSTargetsParam} targets
|
|
72
|
+
* @return {JSTargetsArray}
|
|
73
|
+
*
|
|
74
|
+
* @overload
|
|
75
|
+
* @param {TargetsParam} targets
|
|
76
|
+
* @return {TargetsArray}
|
|
77
|
+
*
|
|
78
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
79
|
+
*/
|
|
80
|
+
export function registerTargets(targets: DOMTargetsParam): DOMTargetsArray;
|
|
81
|
+
/**
|
|
82
|
+
* @overload
|
|
83
|
+
* @param {DOMTargetsParam} targets
|
|
84
|
+
* @return {DOMTargetsArray}
|
|
85
|
+
*
|
|
86
|
+
* @overload
|
|
87
|
+
* @param {JSTargetsParam} targets
|
|
88
|
+
* @return {JSTargetsArray}
|
|
89
|
+
*
|
|
90
|
+
* @overload
|
|
91
|
+
* @param {TargetsParam} targets
|
|
92
|
+
* @return {TargetsArray}
|
|
93
|
+
*
|
|
94
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
95
|
+
*/
|
|
96
|
+
export function registerTargets(targets: JSTargetsParam): JSTargetsArray;
|
|
97
|
+
/**
|
|
98
|
+
* @overload
|
|
99
|
+
* @param {DOMTargetsParam} targets
|
|
100
|
+
* @return {DOMTargetsArray}
|
|
101
|
+
*
|
|
102
|
+
* @overload
|
|
103
|
+
* @param {JSTargetsParam} targets
|
|
104
|
+
* @return {JSTargetsArray}
|
|
105
|
+
*
|
|
106
|
+
* @overload
|
|
107
|
+
* @param {TargetsParam} targets
|
|
108
|
+
* @return {TargetsArray}
|
|
109
|
+
*
|
|
110
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
111
|
+
*/
|
|
112
|
+
export function registerTargets(targets: TargetsParam): TargetsArray;
|
|
113
|
+
import type { DOMTargetsParam } from '../types/index.js';
|
|
114
|
+
import type { TargetsParam } from '../types/index.js';
|
|
115
|
+
import type { DOMTargetsArray } from '../types/index.js';
|
|
116
|
+
import type { JSTargetsParam } from '../types/index.js';
|
|
117
|
+
import type { JSTargetsArray } from '../types/index.js';
|
|
118
|
+
import type { TargetsArray } from '../types/index.js';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { scope } from './globals.js';
|
|
9
|
+
import { isRegisteredTargetSymbol, isDomSymbol, isSvgSymbol, transformsSymbol, isBrowser } from './consts.js';
|
|
10
|
+
import { isSvg, isNil, isArr, isStr } from './helpers.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @import {
|
|
14
|
+
* DOMTarget,
|
|
15
|
+
* DOMTargetsParam,
|
|
16
|
+
* JSTargetsArray,
|
|
17
|
+
* TargetsParam,
|
|
18
|
+
* JSTargetsParam,
|
|
19
|
+
* TargetsArray,
|
|
20
|
+
* DOMTargetsArray,
|
|
21
|
+
* } from '../types/index.js'
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {DOMTargetsParam|TargetsParam} v
|
|
26
|
+
* @return {NodeList|HTMLCollection}
|
|
27
|
+
*/
|
|
28
|
+
function getNodeList(v) {
|
|
29
|
+
const n = isStr(v) ? scope.root.querySelectorAll(v) : v;
|
|
30
|
+
if (n instanceof NodeList || n instanceof HTMLCollection) return n;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @overload
|
|
35
|
+
* @param {DOMTargetsParam} targets
|
|
36
|
+
* @return {DOMTargetsArray}
|
|
37
|
+
*
|
|
38
|
+
* @overload
|
|
39
|
+
* @param {JSTargetsParam} targets
|
|
40
|
+
* @return {JSTargetsArray}
|
|
41
|
+
*
|
|
42
|
+
* @overload
|
|
43
|
+
* @param {TargetsParam} targets
|
|
44
|
+
* @return {TargetsArray}
|
|
45
|
+
*
|
|
46
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
47
|
+
*/
|
|
48
|
+
function parseTargets(targets) {
|
|
49
|
+
if (isNil(targets)) return /** @type {TargetsArray} */([]);
|
|
50
|
+
if (!isBrowser) return /** @type {JSTargetsArray} */(isArr(targets) && targets.flat(Infinity) || [targets]);
|
|
51
|
+
if (isArr(targets)) {
|
|
52
|
+
const flattened = targets.flat(Infinity);
|
|
53
|
+
/** @type {TargetsArray} */
|
|
54
|
+
const parsed = [];
|
|
55
|
+
for (let i = 0, l = flattened.length; i < l; i++) {
|
|
56
|
+
const item = flattened[i];
|
|
57
|
+
if (!isNil(item)) {
|
|
58
|
+
const nodeList = getNodeList(item);
|
|
59
|
+
if (nodeList) {
|
|
60
|
+
for (let j = 0, jl = nodeList.length; j < jl; j++) {
|
|
61
|
+
const subItem = nodeList[j];
|
|
62
|
+
if (!isNil(subItem)) {
|
|
63
|
+
let isDuplicate = false;
|
|
64
|
+
for (let k = 0, kl = parsed.length; k < kl; k++) {
|
|
65
|
+
if (parsed[k] === subItem) {
|
|
66
|
+
isDuplicate = true;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!isDuplicate) {
|
|
71
|
+
parsed.push(subItem);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
let isDuplicate = false;
|
|
77
|
+
for (let j = 0, jl = parsed.length; j < jl; j++) {
|
|
78
|
+
if (parsed[j] === item) {
|
|
79
|
+
isDuplicate = true;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!isDuplicate) {
|
|
84
|
+
parsed.push(item);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return parsed;
|
|
90
|
+
}
|
|
91
|
+
const nodeList = getNodeList(targets);
|
|
92
|
+
if (nodeList) return /** @type {DOMTargetsArray} */(Array.from(nodeList));
|
|
93
|
+
return /** @type {TargetsArray} */([targets]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @overload
|
|
98
|
+
* @param {DOMTargetsParam} targets
|
|
99
|
+
* @return {DOMTargetsArray}
|
|
100
|
+
*
|
|
101
|
+
* @overload
|
|
102
|
+
* @param {JSTargetsParam} targets
|
|
103
|
+
* @return {JSTargetsArray}
|
|
104
|
+
*
|
|
105
|
+
* @overload
|
|
106
|
+
* @param {TargetsParam} targets
|
|
107
|
+
* @return {TargetsArray}
|
|
108
|
+
*
|
|
109
|
+
* @param {DOMTargetsParam|JSTargetsParam|TargetsParam} targets
|
|
110
|
+
*/
|
|
111
|
+
function registerTargets(targets) {
|
|
112
|
+
const parsedTargetsArray = parseTargets(targets);
|
|
113
|
+
const parsedTargetsLength = parsedTargetsArray.length;
|
|
114
|
+
if (parsedTargetsLength) {
|
|
115
|
+
for (let i = 0; i < parsedTargetsLength; i++) {
|
|
116
|
+
const target = parsedTargetsArray[i];
|
|
117
|
+
if (!target[isRegisteredTargetSymbol]) {
|
|
118
|
+
target[isRegisteredTargetSymbol] = true;
|
|
119
|
+
const isSvgType = isSvg(target);
|
|
120
|
+
const isDom = /** @type {DOMTarget} */(target).nodeType || isSvgType;
|
|
121
|
+
if (isDom) {
|
|
122
|
+
target[isDomSymbol] = true;
|
|
123
|
+
target[isSvgSymbol] = isSvgType;
|
|
124
|
+
target[transformsSymbol] = {};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return parsedTargetsArray;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { getNodeList, parseTargets, registerTargets };
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @import {
|
|
15
|
+
* DOMTarget,
|
|
16
|
+
* } from '../types/index.js'
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {DOMTarget} target
|
|
21
|
+
* @param {String} propName
|
|
22
|
+
* @param {Object} animationInlineStyles
|
|
23
|
+
* @return {String}
|
|
24
|
+
*/
|
|
25
|
+
const parseInlineTransforms = (target, propName, animationInlineStyles) => {
|
|
26
|
+
const inlineTransforms = target.style.transform;
|
|
27
|
+
let inlinedStylesPropertyValue;
|
|
28
|
+
if (inlineTransforms) {
|
|
29
|
+
const cachedTransforms = target[consts.transformsSymbol];
|
|
30
|
+
let t; while (t = consts.transformsExecRgx.exec(inlineTransforms)) {
|
|
31
|
+
const inlinePropertyName = t[1];
|
|
32
|
+
// const inlinePropertyValue = t[2];
|
|
33
|
+
const inlinePropertyValue = t[2].slice(1, -1);
|
|
34
|
+
cachedTransforms[inlinePropertyName] = inlinePropertyValue;
|
|
35
|
+
if (inlinePropertyName === propName) {
|
|
36
|
+
inlinedStylesPropertyValue = inlinePropertyValue;
|
|
37
|
+
// Store the new parsed inline styles if animationInlineStyles is provided
|
|
38
|
+
if (animationInlineStyles) {
|
|
39
|
+
animationInlineStyles[propName] = inlinePropertyValue;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return inlineTransforms && !helpers.isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :
|
|
45
|
+
helpers.stringStartsWith(propName, 'scale') ? '1' :
|
|
46
|
+
helpers.stringStartsWith(propName, 'rotate') || helpers.stringStartsWith(propName, 'skew') ? '0deg' : '0px';
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.parseInlineTransforms = parseInlineTransforms;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { transformsSymbol, transformsExecRgx } from './consts.js';
|
|
9
|
+
import { isUnd, stringStartsWith } from './helpers.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @import {
|
|
13
|
+
* DOMTarget,
|
|
14
|
+
* } from '../types/index.js'
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {DOMTarget} target
|
|
19
|
+
* @param {String} propName
|
|
20
|
+
* @param {Object} animationInlineStyles
|
|
21
|
+
* @return {String}
|
|
22
|
+
*/
|
|
23
|
+
const parseInlineTransforms = (target, propName, animationInlineStyles) => {
|
|
24
|
+
const inlineTransforms = target.style.transform;
|
|
25
|
+
let inlinedStylesPropertyValue;
|
|
26
|
+
if (inlineTransforms) {
|
|
27
|
+
const cachedTransforms = target[transformsSymbol];
|
|
28
|
+
let t; while (t = transformsExecRgx.exec(inlineTransforms)) {
|
|
29
|
+
const inlinePropertyName = t[1];
|
|
30
|
+
// const inlinePropertyValue = t[2];
|
|
31
|
+
const inlinePropertyValue = t[2].slice(1, -1);
|
|
32
|
+
cachedTransforms[inlinePropertyName] = inlinePropertyValue;
|
|
33
|
+
if (inlinePropertyName === propName) {
|
|
34
|
+
inlinedStylesPropertyValue = inlinePropertyValue;
|
|
35
|
+
// Store the new parsed inline styles if animationInlineStyles is provided
|
|
36
|
+
if (animationInlineStyles) {
|
|
37
|
+
animationInlineStyles[propName] = inlinePropertyValue;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return inlineTransforms && !isUnd(inlinedStylesPropertyValue) ? inlinedStylesPropertyValue :
|
|
43
|
+
stringStartsWith(propName, 'scale') ? '1' :
|
|
44
|
+
stringStartsWith(propName, 'rotate') || stringStartsWith(propName, 'skew') ? '0deg' : '0px';
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { parseInlineTransforms };
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
|
|
13
|
+
const angleUnitsMap = { 'deg': 1, 'rad': 180 / helpers.PI, 'turn': 360 };
|
|
14
|
+
const convertedValuesCache = {};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @import {
|
|
18
|
+
* DOMTarget,
|
|
19
|
+
* TweenDecomposedValue,
|
|
20
|
+
* } from '../types/index.js'
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {DOMTarget} el
|
|
25
|
+
* @param {TweenDecomposedValue} decomposedValue
|
|
26
|
+
* @param {String} unit
|
|
27
|
+
* @param {Boolean} [force]
|
|
28
|
+
* @return {TweenDecomposedValue}
|
|
29
|
+
*/
|
|
30
|
+
const convertValueUnit = (el, decomposedValue, unit, force = false) => {
|
|
31
|
+
const currentUnit = decomposedValue.u;
|
|
32
|
+
const currentNumber = decomposedValue.n;
|
|
33
|
+
if (decomposedValue.t === consts.valueTypes.UNIT && currentUnit === unit) { // TODO: Check if checking against the same unit string is necessary
|
|
34
|
+
return decomposedValue;
|
|
35
|
+
}
|
|
36
|
+
const cachedKey = currentNumber + currentUnit + unit;
|
|
37
|
+
const cached = convertedValuesCache[cachedKey];
|
|
38
|
+
if (!helpers.isUnd(cached) && !force) {
|
|
39
|
+
decomposedValue.n = cached;
|
|
40
|
+
} else {
|
|
41
|
+
let convertedValue;
|
|
42
|
+
if (currentUnit in angleUnitsMap) {
|
|
43
|
+
convertedValue = currentNumber * angleUnitsMap[currentUnit] / angleUnitsMap[unit];
|
|
44
|
+
} else {
|
|
45
|
+
const baseline = 100;
|
|
46
|
+
const tempEl = /** @type {DOMTarget} */(el.cloneNode());
|
|
47
|
+
const parentNode = el.parentNode;
|
|
48
|
+
const parentEl = (parentNode && (parentNode !== consts.doc)) ? parentNode : consts.doc.body;
|
|
49
|
+
parentEl.appendChild(tempEl);
|
|
50
|
+
const elStyle = tempEl.style;
|
|
51
|
+
elStyle.width = baseline + currentUnit;
|
|
52
|
+
const currentUnitWidth = /** @type {HTMLElement} */(tempEl).offsetWidth || baseline;
|
|
53
|
+
elStyle.width = baseline + unit;
|
|
54
|
+
const newUnitWidth = /** @type {HTMLElement} */(tempEl).offsetWidth || baseline;
|
|
55
|
+
const factor = currentUnitWidth / newUnitWidth;
|
|
56
|
+
parentEl.removeChild(tempEl);
|
|
57
|
+
convertedValue = factor * currentNumber;
|
|
58
|
+
}
|
|
59
|
+
decomposedValue.n = convertedValue;
|
|
60
|
+
convertedValuesCache[cachedKey] = convertedValue;
|
|
61
|
+
}
|
|
62
|
+
decomposedValue.t === consts.valueTypes.UNIT;
|
|
63
|
+
decomposedValue.u = unit;
|
|
64
|
+
return decomposedValue;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
exports.convertValueUnit = convertValueUnit;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anime.js - core - ESM
|
|
3
|
+
* @version v4.2.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 - Julian Garnier
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { valueTypes, doc } from './consts.js';
|
|
9
|
+
import { isUnd, PI } from './helpers.js';
|
|
10
|
+
|
|
11
|
+
const angleUnitsMap = { 'deg': 1, 'rad': 180 / PI, 'turn': 360 };
|
|
12
|
+
const convertedValuesCache = {};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @import {
|
|
16
|
+
* DOMTarget,
|
|
17
|
+
* TweenDecomposedValue,
|
|
18
|
+
* } from '../types/index.js'
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {DOMTarget} el
|
|
23
|
+
* @param {TweenDecomposedValue} decomposedValue
|
|
24
|
+
* @param {String} unit
|
|
25
|
+
* @param {Boolean} [force]
|
|
26
|
+
* @return {TweenDecomposedValue}
|
|
27
|
+
*/
|
|
28
|
+
const convertValueUnit = (el, decomposedValue, unit, force = false) => {
|
|
29
|
+
const currentUnit = decomposedValue.u;
|
|
30
|
+
const currentNumber = decomposedValue.n;
|
|
31
|
+
if (decomposedValue.t === valueTypes.UNIT && currentUnit === unit) { // TODO: Check if checking against the same unit string is necessary
|
|
32
|
+
return decomposedValue;
|
|
33
|
+
}
|
|
34
|
+
const cachedKey = currentNumber + currentUnit + unit;
|
|
35
|
+
const cached = convertedValuesCache[cachedKey];
|
|
36
|
+
if (!isUnd(cached) && !force) {
|
|
37
|
+
decomposedValue.n = cached;
|
|
38
|
+
} else {
|
|
39
|
+
let convertedValue;
|
|
40
|
+
if (currentUnit in angleUnitsMap) {
|
|
41
|
+
convertedValue = currentNumber * angleUnitsMap[currentUnit] / angleUnitsMap[unit];
|
|
42
|
+
} else {
|
|
43
|
+
const baseline = 100;
|
|
44
|
+
const tempEl = /** @type {DOMTarget} */(el.cloneNode());
|
|
45
|
+
const parentNode = el.parentNode;
|
|
46
|
+
const parentEl = (parentNode && (parentNode !== doc)) ? parentNode : doc.body;
|
|
47
|
+
parentEl.appendChild(tempEl);
|
|
48
|
+
const elStyle = tempEl.style;
|
|
49
|
+
elStyle.width = baseline + currentUnit;
|
|
50
|
+
const currentUnitWidth = /** @type {HTMLElement} */(tempEl).offsetWidth || baseline;
|
|
51
|
+
elStyle.width = baseline + unit;
|
|
52
|
+
const newUnitWidth = /** @type {HTMLElement} */(tempEl).offsetWidth || baseline;
|
|
53
|
+
const factor = currentUnitWidth / newUnitWidth;
|
|
54
|
+
parentEl.removeChild(tempEl);
|
|
55
|
+
convertedValue = factor * currentNumber;
|
|
56
|
+
}
|
|
57
|
+
decomposedValue.n = convertedValue;
|
|
58
|
+
convertedValuesCache[cachedKey] = convertedValue;
|
|
59
|
+
}
|
|
60
|
+
decomposedValue.t === valueTypes.UNIT;
|
|
61
|
+
decomposedValue.u = unit;
|
|
62
|
+
return decomposedValue;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { convertValueUnit };
|