animejs 4.3.4 → 4.3.5
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/dist/bundles/anime.esm.js +62 -52
- package/dist/bundles/anime.esm.min.js +2 -2
- package/dist/bundles/anime.umd.js +62 -52
- package/dist/bundles/anime.umd.min.js +2 -2
- package/dist/modules/animatable/animatable.cjs +1 -1
- package/dist/modules/animatable/animatable.js +1 -1
- package/dist/modules/animatable/index.cjs +1 -1
- package/dist/modules/animatable/index.js +1 -1
- package/dist/modules/animation/additive.cjs +1 -1
- package/dist/modules/animation/additive.js +1 -1
- package/dist/modules/animation/animation.cjs +1 -1
- package/dist/modules/animation/animation.js +1 -1
- package/dist/modules/animation/composition.cjs +1 -1
- package/dist/modules/animation/composition.js +1 -1
- package/dist/modules/animation/index.cjs +1 -1
- package/dist/modules/animation/index.js +1 -1
- package/dist/modules/core/clock.cjs +1 -1
- package/dist/modules/core/clock.js +1 -1
- package/dist/modules/core/colors.cjs +1 -1
- package/dist/modules/core/colors.js +1 -1
- package/dist/modules/core/consts.cjs +3 -1
- package/dist/modules/core/consts.d.ts +1 -0
- package/dist/modules/core/consts.js +3 -2
- package/dist/modules/core/globals.cjs +2 -2
- package/dist/modules/core/globals.js +2 -2
- package/dist/modules/core/helpers.cjs +5 -5
- package/dist/modules/core/helpers.js +6 -6
- package/dist/modules/core/render.cjs +1 -1
- package/dist/modules/core/render.js +1 -1
- package/dist/modules/core/styles.cjs +1 -1
- package/dist/modules/core/styles.js +1 -1
- package/dist/modules/core/targets.cjs +1 -1
- package/dist/modules/core/targets.js +1 -1
- package/dist/modules/core/transforms.cjs +1 -1
- package/dist/modules/core/transforms.js +1 -1
- package/dist/modules/core/units.cjs +1 -1
- package/dist/modules/core/units.js +1 -1
- package/dist/modules/core/values.cjs +1 -1
- package/dist/modules/core/values.js +1 -1
- package/dist/modules/draggable/draggable.cjs +1 -1
- package/dist/modules/draggable/draggable.js +1 -1
- package/dist/modules/draggable/index.cjs +1 -1
- package/dist/modules/draggable/index.js +1 -1
- package/dist/modules/easings/cubic-bezier/index.cjs +1 -1
- package/dist/modules/easings/cubic-bezier/index.js +1 -1
- package/dist/modules/easings/eases/index.cjs +1 -1
- package/dist/modules/easings/eases/index.js +1 -1
- package/dist/modules/easings/eases/parser.cjs +1 -1
- package/dist/modules/easings/eases/parser.js +1 -1
- package/dist/modules/easings/index.cjs +1 -1
- package/dist/modules/easings/index.js +1 -1
- package/dist/modules/easings/irregular/index.cjs +1 -1
- package/dist/modules/easings/irregular/index.js +1 -1
- package/dist/modules/easings/linear/index.cjs +1 -1
- package/dist/modules/easings/linear/index.js +1 -1
- package/dist/modules/easings/none.cjs +1 -1
- package/dist/modules/easings/none.js +1 -1
- package/dist/modules/easings/spring/index.cjs +1 -1
- package/dist/modules/easings/spring/index.js +1 -1
- package/dist/modules/easings/steps/index.cjs +1 -1
- package/dist/modules/easings/steps/index.js +1 -1
- package/dist/modules/engine/engine.cjs +1 -1
- package/dist/modules/engine/engine.js +1 -1
- package/dist/modules/engine/index.cjs +1 -1
- package/dist/modules/engine/index.js +1 -1
- package/dist/modules/events/index.cjs +1 -1
- package/dist/modules/events/index.js +1 -1
- package/dist/modules/events/scroll.cjs +1 -1
- package/dist/modules/events/scroll.js +1 -1
- package/dist/modules/index.cjs +1 -1
- package/dist/modules/index.js +1 -1
- package/dist/modules/layout/index.cjs +1 -1
- package/dist/modules/layout/index.js +1 -1
- package/dist/modules/layout/layout.cjs +55 -46
- package/dist/modules/layout/layout.js +55 -46
- package/dist/modules/scope/index.cjs +1 -1
- package/dist/modules/scope/index.js +1 -1
- package/dist/modules/scope/scope.cjs +1 -1
- package/dist/modules/scope/scope.js +1 -1
- package/dist/modules/svg/drawable.cjs +1 -1
- package/dist/modules/svg/drawable.js +1 -1
- package/dist/modules/svg/helpers.cjs +1 -1
- package/dist/modules/svg/helpers.js +1 -1
- package/dist/modules/svg/index.cjs +1 -1
- package/dist/modules/svg/index.js +1 -1
- package/dist/modules/svg/morphto.cjs +1 -1
- package/dist/modules/svg/morphto.js +1 -1
- package/dist/modules/svg/motionpath.cjs +1 -1
- package/dist/modules/svg/motionpath.js +1 -1
- package/dist/modules/text/index.cjs +1 -1
- package/dist/modules/text/index.js +1 -1
- package/dist/modules/text/split.cjs +1 -1
- package/dist/modules/text/split.js +1 -1
- package/dist/modules/timeline/index.cjs +1 -1
- package/dist/modules/timeline/index.js +1 -1
- package/dist/modules/timeline/position.cjs +1 -1
- package/dist/modules/timeline/position.js +1 -1
- package/dist/modules/timeline/timeline.cjs +1 -1
- package/dist/modules/timeline/timeline.js +1 -1
- package/dist/modules/timer/index.cjs +1 -1
- package/dist/modules/timer/index.js +1 -1
- package/dist/modules/timer/timer.cjs +1 -1
- package/dist/modules/timer/timer.js +1 -1
- package/dist/modules/utils/chainable.cjs +1 -1
- package/dist/modules/utils/chainable.js +1 -1
- package/dist/modules/utils/index.cjs +1 -1
- package/dist/modules/utils/index.js +1 -1
- package/dist/modules/utils/number.cjs +1 -1
- package/dist/modules/utils/number.js +1 -1
- package/dist/modules/utils/random.cjs +1 -1
- package/dist/modules/utils/random.js +1 -1
- package/dist/modules/utils/stagger.cjs +1 -1
- package/dist/modules/utils/stagger.js +1 -1
- package/dist/modules/utils/target.cjs +1 -1
- package/dist/modules/utils/target.js +1 -1
- package/dist/modules/utils/time.cjs +1 -1
- package/dist/modules/utils/time.js +1 -1
- package/dist/modules/waapi/composition.cjs +2 -2
- package/dist/modules/waapi/composition.js +2 -2
- package/dist/modules/waapi/index.cjs +1 -1
- package/dist/modules/waapi/index.js +1 -1
- package/dist/modules/waapi/waapi.cjs +1 -1
- package/dist/modules/waapi/waapi.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Anime.js - ESM bundle
|
|
3
|
-
* @version v4.3.
|
|
3
|
+
* @version v4.3.5
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - Julian Garnier
|
|
6
6
|
*/
|
|
@@ -740,6 +740,7 @@ const noop = () => {};
|
|
|
740
740
|
|
|
741
741
|
// Regex
|
|
742
742
|
|
|
743
|
+
const validRgbHslRgx = /\)\s*[-.\d]/;
|
|
743
744
|
const hexTestRgx = /(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i;
|
|
744
745
|
const rgbExecRgx = /rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i;
|
|
745
746
|
const rgbaExecRgx = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i;
|
|
@@ -803,7 +804,7 @@ const globals = {
|
|
|
803
804
|
|
|
804
805
|
const devTools = isBrowser && win.AnimeJSDevTools;
|
|
805
806
|
|
|
806
|
-
const globalVersions = { version: '4.3.
|
|
807
|
+
const globalVersions = { version: '4.3.5', engine: null };
|
|
807
808
|
|
|
808
809
|
if (isBrowser) {
|
|
809
810
|
if (!win.AnimeJS) win.AnimeJS = [];
|
|
@@ -851,11 +852,11 @@ const isSvg = a => isBrowser && a instanceof SVGElement;
|
|
|
851
852
|
/**@param {any} a @return {Boolean} */
|
|
852
853
|
const isHex = a => hexTestRgx.test(a);
|
|
853
854
|
/**@param {any} a @return {Boolean} */
|
|
854
|
-
const isRgb = a => stringStartsWith(a, 'rgb')
|
|
855
|
+
const isRgb = a => stringStartsWith(a, 'rgb');
|
|
855
856
|
/**@param {any} a @return {Boolean} */
|
|
856
|
-
const isHsl = a => stringStartsWith(a, 'hsl')
|
|
857
|
-
/**@param {any} a @return {Boolean} */
|
|
858
|
-
const isCol = a => isHex(a) || isRgb(a) || isHsl(a);
|
|
857
|
+
const isHsl = a => stringStartsWith(a, 'hsl');
|
|
858
|
+
/**@param {any} a @return {Boolean} */ // Make sure boxShadow syntax like 'rgb(255, 0, 0) 0px 0px 6px 0px' is not a valid color type
|
|
859
|
+
const isCol = a => isHex(a) || ((isRgb(a) || isHsl(a)) && (a[a.length - 1] === ')' || !validRgbHslRgx.test(a)));
|
|
859
860
|
/**@param {any} a @return {Boolean} */
|
|
860
861
|
const isKey = a => !globals.defaults.hasOwnProperty(a);
|
|
861
862
|
|
|
@@ -3977,7 +3978,7 @@ const addWAAPIAnimation = (parent, $el, property, keyframes, params) => {
|
|
|
3977
3978
|
parent.animations.push(animation);
|
|
3978
3979
|
removeWAAPIAnimation($el, property);
|
|
3979
3980
|
addChild(WAAPIAnimationsLookups, { parent, animation, $el, property, _next: null, _prev: null });
|
|
3980
|
-
const handleRemove = () =>
|
|
3981
|
+
const handleRemove = () => removeWAAPIAnimation($el, property, parent);
|
|
3981
3982
|
animation.oncancel = handleRemove;
|
|
3982
3983
|
animation.onremove = handleRemove;
|
|
3983
3984
|
if (!parent.persist) {
|
|
@@ -9078,7 +9079,7 @@ class AutoLayout {
|
|
|
9078
9079
|
// const hiddenStateChanged = (topLevelAdded || newlyRemoved) && wasRemovedBefore !== isRemovedNow;
|
|
9079
9080
|
|
|
9080
9081
|
if (node.isTarget && (!node.measuredIsRemoved && oldStateNode.measuredIsVisible || node.measuredIsRemoved && node.measuredIsVisible)) {
|
|
9081
|
-
if (
|
|
9082
|
+
if (nodeProperties.transform !== 'none' || oldStateNodeProperties.transform !== 'none') {
|
|
9082
9083
|
node.hasTransform = true;
|
|
9083
9084
|
transformed.push($el);
|
|
9084
9085
|
}
|
|
@@ -9094,7 +9095,7 @@ class AutoLayout {
|
|
|
9094
9095
|
if (!node.isTarget) {
|
|
9095
9096
|
swapping.push($el);
|
|
9096
9097
|
if (node.sizeChanged && parent && parent.isTarget && parent.sizeChanged) {
|
|
9097
|
-
if (
|
|
9098
|
+
if (swapAtProps.transform) {
|
|
9098
9099
|
node.hasTransform = true;
|
|
9099
9100
|
transformed.push($el);
|
|
9100
9101
|
}
|
|
@@ -9134,7 +9135,7 @@ class AutoLayout {
|
|
|
9134
9135
|
|
|
9135
9136
|
// muteNodeTransition(newNode);
|
|
9136
9137
|
|
|
9137
|
-
// Don't animate
|
|
9138
|
+
// Don't animate positions of inlined elements (to avoid text reflow)
|
|
9138
9139
|
if (!newNode.isInlined) {
|
|
9139
9140
|
// Display grid can mess with the absolute positioning, so set it to block during transition
|
|
9140
9141
|
if (oldNode.measuredDisplay === 'grid' || newNode.measuredDisplay === 'grid') $el.style.setProperty('display', 'block', 'important');
|
|
@@ -9153,14 +9154,15 @@ class AutoLayout {
|
|
|
9153
9154
|
$el.style.left = '0px';
|
|
9154
9155
|
$el.style.top = '0px';
|
|
9155
9156
|
}
|
|
9156
|
-
$el.style.width = `${oldNodeState.width}px`;
|
|
9157
|
-
$el.style.height = `${oldNodeState.height}px`;
|
|
9158
|
-
// Overrides user defined min and max to prevents width and height clamping
|
|
9159
|
-
$el.style.minWidth = `auto`;
|
|
9160
|
-
$el.style.minHeight = `auto`;
|
|
9161
|
-
$el.style.maxWidth = `none`;
|
|
9162
|
-
$el.style.maxHeight = `none`;
|
|
9163
9157
|
}
|
|
9158
|
+
// Animate dimensions for all elements (including inlined)
|
|
9159
|
+
$el.style.width = `${oldNodeState.width}px`;
|
|
9160
|
+
$el.style.height = `${oldNodeState.height}px`;
|
|
9161
|
+
// Overrides user defined min and max to prevents width and height clamping
|
|
9162
|
+
$el.style.minWidth = `auto`;
|
|
9163
|
+
$el.style.minHeight = `auto`;
|
|
9164
|
+
$el.style.maxWidth = `none`;
|
|
9165
|
+
$el.style.maxHeight = `none`;
|
|
9164
9166
|
}
|
|
9165
9167
|
|
|
9166
9168
|
// Restore the scroll position if the oldState differs from the current state
|
|
@@ -9181,21 +9183,19 @@ class AutoLayout {
|
|
|
9181
9183
|
const animatedProps = {
|
|
9182
9184
|
composition: 'none',
|
|
9183
9185
|
};
|
|
9184
|
-
if (
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
nodeHasChanged = true;
|
|
9198
|
-
}
|
|
9186
|
+
if (oldNodeState.width !== newNodeState.width) {
|
|
9187
|
+
animatedProps.width = [oldNodeState.width, newNodeState.width];
|
|
9188
|
+
nodeHasChanged = true;
|
|
9189
|
+
}
|
|
9190
|
+
if (oldNodeState.height !== newNodeState.height) {
|
|
9191
|
+
animatedProps.height = [oldNodeState.height, newNodeState.height];
|
|
9192
|
+
nodeHasChanged = true;
|
|
9193
|
+
}
|
|
9194
|
+
// If the node has transforms we handle the translate animation in waapi otherwise translate and other transforms can be out of sync
|
|
9195
|
+
// And we don't animate the position of inlined elements
|
|
9196
|
+
if (!newNode.hasTransform && !newNode.isInlined) {
|
|
9197
|
+
animatedProps.translate = [`${oldNodeState.x}px ${oldNodeState.y}px`, `${newNodeState.x}px ${newNodeState.y}px`];
|
|
9198
|
+
nodeHasChanged = true;
|
|
9199
9199
|
}
|
|
9200
9200
|
this.properties.forEach(prop => {
|
|
9201
9201
|
const oldVal = oldNodeState[prop];
|
|
@@ -9217,15 +9217,16 @@ class AutoLayout {
|
|
|
9217
9217
|
for (let i = 0, l = swapping.length; i < l; i++) {
|
|
9218
9218
|
const $el = swapping[i];
|
|
9219
9219
|
const oldNode = oldState.getNode($el);
|
|
9220
|
+
const oldNodeProps = oldNode.properties;
|
|
9221
|
+
$el.style.width = `${oldNodeProps.width}px`;
|
|
9222
|
+
$el.style.height = `${oldNodeProps.height}px`;
|
|
9223
|
+
// Overrides user defined min and max to prevents width and height clamping
|
|
9224
|
+
$el.style.minWidth = `auto`;
|
|
9225
|
+
$el.style.minHeight = `auto`;
|
|
9226
|
+
$el.style.maxWidth = `none`;
|
|
9227
|
+
$el.style.maxHeight = `none`;
|
|
9228
|
+
// We don't animate the position of inlined elements
|
|
9220
9229
|
if (!oldNode.isInlined) {
|
|
9221
|
-
const oldNodeProps = oldNode.properties;
|
|
9222
|
-
$el.style.width = `${oldNodeProps.width}px`;
|
|
9223
|
-
$el.style.height = `${oldNodeProps.height}px`;
|
|
9224
|
-
// Overrides user defined min and max to prevents width and height clamping
|
|
9225
|
-
$el.style.minWidth = `auto`;
|
|
9226
|
-
$el.style.minHeight = `auto`;
|
|
9227
|
-
$el.style.maxWidth = `none`;
|
|
9228
|
-
$el.style.maxHeight = `none`;
|
|
9229
9230
|
$el.style.translate = `${oldNodeProps.x}px ${oldNodeProps.y}px`;
|
|
9230
9231
|
}
|
|
9231
9232
|
this.properties.forEach(prop => {
|
|
@@ -9240,14 +9241,15 @@ class AutoLayout {
|
|
|
9240
9241
|
const newNode = newState.getNode($el);
|
|
9241
9242
|
const newNodeProps = newNode.properties;
|
|
9242
9243
|
this.timeline.call(() => {
|
|
9244
|
+
$el.style.width = `${newNodeProps.width}px`;
|
|
9245
|
+
$el.style.height = `${newNodeProps.height}px`;
|
|
9246
|
+
// Overrides user defined min and max to prevents width and height clamping
|
|
9247
|
+
$el.style.minWidth = `auto`;
|
|
9248
|
+
$el.style.minHeight = `auto`;
|
|
9249
|
+
$el.style.maxWidth = `none`;
|
|
9250
|
+
$el.style.maxHeight = `none`;
|
|
9251
|
+
// Don't set translate for inlined elements (to avoid text reflow)
|
|
9243
9252
|
if (!newNode.isInlined) {
|
|
9244
|
-
$el.style.width = `${newNodeProps.width}px`;
|
|
9245
|
-
$el.style.height = `${newNodeProps.height}px`;
|
|
9246
|
-
// Overrides user defined min and max to prevents width and height clamping
|
|
9247
|
-
$el.style.minWidth = `auto`;
|
|
9248
|
-
$el.style.minHeight = `auto`;
|
|
9249
|
-
$el.style.maxWidth = `none`;
|
|
9250
|
-
$el.style.maxHeight = `none`;
|
|
9251
9253
|
$el.style.translate = `${newNodeProps.x}px ${newNodeProps.y}px`;
|
|
9252
9254
|
}
|
|
9253
9255
|
this.properties.forEach(prop => {
|
|
@@ -9280,19 +9282,27 @@ class AutoLayout {
|
|
|
9280
9282
|
const transformedLength = transformed.length;
|
|
9281
9283
|
|
|
9282
9284
|
if (transformedLength) {
|
|
9283
|
-
// We only need to set the transform property here since translate is
|
|
9285
|
+
// We only need to set the transform property here since translate is already defined in the targets loop
|
|
9284
9286
|
for (let i = 0; i < transformedLength; i++) {
|
|
9285
9287
|
const $el = transformed[i];
|
|
9286
|
-
|
|
9288
|
+
const node = newState.getNode($el);
|
|
9289
|
+
// Don't set translate for inlined elements (to avoid text reflow)
|
|
9290
|
+
if (!node.isInlined) {
|
|
9291
|
+
$el.style.translate = `${oldState.getComputedValue($el, 'x')}px ${oldState.getComputedValue($el, 'y')}px`;
|
|
9292
|
+
}
|
|
9287
9293
|
$el.style.transform = oldState.getComputedValue($el, 'transform');
|
|
9288
9294
|
if (animatedSwap.includes($el)) {
|
|
9289
|
-
const node = newState.getNode($el);
|
|
9290
9295
|
node.ease = getFunctionValue(swapAtParams.ease, $el, node.index, node.total);
|
|
9291
9296
|
node.duration = getFunctionValue(swapAtParams.duration, $el, node.index, node.total);
|
|
9292
9297
|
}
|
|
9293
9298
|
}
|
|
9294
9299
|
this.transformAnimation = waapi.animate(transformed, {
|
|
9295
|
-
translate: (/** @type {HTMLElement} */$el) =>
|
|
9300
|
+
translate: (/** @type {HTMLElement} */$el) => {
|
|
9301
|
+
const node = newState.getNode($el);
|
|
9302
|
+
// Don't animate translate for inlined elements (to avoid text reflow)
|
|
9303
|
+
if (node.isInlined) return '0px 0px';
|
|
9304
|
+
return `${newState.getComputedValue($el, 'x')}px ${newState.getComputedValue($el, 'y')}px`;
|
|
9305
|
+
},
|
|
9296
9306
|
transform: (/** @type {HTMLElement} */$el) => {
|
|
9297
9307
|
const newValue = newState.getComputedValue($el, 'transform');
|
|
9298
9308
|
if (!animatedSwap.includes($el)) return newValue;
|
|
@@ -9301,7 +9311,7 @@ class AutoLayout {
|
|
|
9301
9311
|
return [oldValue, getFunctionValue(swapAtProps.transform, $el, node.index, node.total), newValue]
|
|
9302
9312
|
},
|
|
9303
9313
|
autoplay: false,
|
|
9304
|
-
persist: true,
|
|
9314
|
+
// persist: true,
|
|
9305
9315
|
...timingParams,
|
|
9306
9316
|
});
|
|
9307
9317
|
this.timeline.sync(this.transformAnimation, 0);
|