motion 10.3.0 → 10.5.0-alpha.1
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 +0 -19
- package/dist/main.cjs.js +11 -13
- package/dist/main.es.js +7 -6
- package/dist/motion.min.js +1 -1
- package/dist/motion.umd.js +8 -1264
- package/dist/size-index.js +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/package.json +5 -137
- package/types/index.d.ts +3 -7
- package/types/index.d.ts.map +1 -0
- package/CHANGELOG.md +0 -85
- package/LICENSE +0 -21
- package/dist/react.cjs.js +0 -9
- package/dist/react.es.js +0 -1
- package/dist/size-animate-dom.js +0 -1
- package/dist/size-animate-style.js +0 -1
- package/dist/size-react.js +0 -1
- package/dist/size-spring.js +0 -1
- package/dist/size-timeline-dom.js +0 -1
- package/dist/size-webpack-animate.js +0 -1
- package/dist/targets/dom/animate-style.cjs.js +0 -182
- package/dist/targets/dom/animate-style.es.js +0 -178
- package/dist/targets/dom/animate.cjs.js +0 -42
- package/dist/targets/dom/animate.es.js +0 -38
- package/dist/targets/dom/data.cjs.js +0 -18
- package/dist/targets/dom/data.es.js +0 -14
- package/dist/targets/dom/style.cjs.js +0 -22
- package/dist/targets/dom/style.es.js +0 -18
- package/dist/targets/dom/timeline/index.cjs.js +0 -174
- package/dist/targets/dom/timeline/index.es.js +0 -169
- package/dist/targets/dom/timeline/utils/calc-time.cjs.js +0 -23
- package/dist/targets/dom/timeline/utils/calc-time.es.js +0 -19
- package/dist/targets/dom/timeline/utils/edit.cjs.js +0 -36
- package/dist/targets/dom/timeline/utils/edit.es.js +0 -31
- package/dist/targets/dom/timeline/utils/sort.cjs.js +0 -14
- package/dist/targets/dom/timeline/utils/sort.es.js +0 -10
- package/dist/targets/dom/utils/apply.cjs.js +0 -9
- package/dist/targets/dom/utils/apply.es.js +0 -4
- package/dist/targets/dom/utils/controls.cjs.js +0 -59
- package/dist/targets/dom/utils/controls.es.js +0 -54
- package/dist/targets/dom/utils/css-var.cjs.js +0 -29
- package/dist/targets/dom/utils/css-var.es.js +0 -23
- package/dist/targets/dom/utils/defaults.cjs.js +0 -13
- package/dist/targets/dom/utils/defaults.es.js +0 -9
- package/dist/targets/dom/utils/easing.cjs.js +0 -18
- package/dist/targets/dom/utils/easing.es.js +0 -10
- package/dist/targets/dom/utils/feature-detection.cjs.js +0 -31
- package/dist/targets/dom/utils/feature-detection.es.js +0 -27
- package/dist/targets/dom/utils/get-style-name.cjs.js +0 -13
- package/dist/targets/dom/utils/get-style-name.es.js +0 -9
- package/dist/targets/dom/utils/keyframes.cjs.js +0 -16
- package/dist/targets/dom/utils/keyframes.es.js +0 -11
- package/dist/targets/dom/utils/options.cjs.js +0 -7
- package/dist/targets/dom/utils/options.es.js +0 -3
- package/dist/targets/dom/utils/resolve-elements.cjs.js +0 -22
- package/dist/targets/dom/utils/resolve-elements.es.js +0 -18
- package/dist/targets/dom/utils/stop-animation.cjs.js +0 -19
- package/dist/targets/dom/utils/stop-animation.es.js +0 -15
- package/dist/targets/dom/utils/time.cjs.js +0 -7
- package/dist/targets/dom/utils/time.es.js +0 -3
- package/dist/targets/dom/utils/transforms.cjs.js +0 -85
- package/dist/targets/dom/utils/transforms.es.js +0 -74
- package/dist/targets/js/NumberAnimation.cjs.js +0 -144
- package/dist/targets/js/NumberAnimation.es.js +0 -140
- package/dist/targets/js/easing/cubic-bezier.cjs.js +0 -57
- package/dist/targets/js/easing/cubic-bezier.es.js +0 -53
- package/dist/targets/js/easing/glide/generator.cjs.js +0 -99
- package/dist/targets/js/easing/glide/generator.es.js +0 -95
- package/dist/targets/js/easing/glide/index.cjs.js +0 -10
- package/dist/targets/js/easing/glide/index.es.js +0 -6
- package/dist/targets/js/easing/spring/generator.cjs.js +0 -64
- package/dist/targets/js/easing/spring/generator.es.js +0 -57
- package/dist/targets/js/easing/spring/index.cjs.js +0 -10
- package/dist/targets/js/easing/spring/index.es.js +0 -6
- package/dist/targets/js/easing/steps.cjs.js +0 -15
- package/dist/targets/js/easing/steps.es.js +0 -11
- package/dist/targets/js/easing/utils/create-generator-easing.cjs.js +0 -71
- package/dist/targets/js/easing/utils/create-generator-easing.es.js +0 -67
- package/dist/targets/js/easing/utils/get-function.cjs.js +0 -37
- package/dist/targets/js/easing/utils/get-function.es.js +0 -33
- package/dist/targets/js/easing/utils/has-reached-target.cjs.js +0 -10
- package/dist/targets/js/easing/utils/has-reached-target.es.js +0 -6
- package/dist/targets/js/easing/utils/pregenerate-keyframes.cjs.js +0 -34
- package/dist/targets/js/easing/utils/pregenerate-keyframes.es.js +0 -30
- package/dist/targets/js/utils/get-easing.cjs.js +0 -14
- package/dist/targets/js/utils/get-easing.es.js +0 -10
- package/dist/targets/js/utils/interpolate.cjs.js +0 -35
- package/dist/targets/js/utils/interpolate.es.js +0 -31
- package/dist/targets/js/utils/offset.cjs.js +0 -22
- package/dist/targets/js/utils/offset.es.js +0 -17
- package/dist/targets/react/animated.cjs.js +0 -126
- package/dist/targets/react/animated.es.js +0 -101
- package/dist/targets/react/context.cjs.js +0 -9
- package/dist/targets/react/context.es.js +0 -5
- package/dist/targets/react/hooks/use-animation.cjs.js +0 -47
- package/dist/targets/react/hooks/use-animation.es.js +0 -43
- package/dist/targets/react/hooks/use-exit.cjs.js +0 -27
- package/dist/targets/react/hooks/use-exit.es.js +0 -23
- package/dist/targets/react/hooks/use-gesture-state.cjs.js +0 -17
- package/dist/targets/react/hooks/use-gesture-state.es.js +0 -13
- package/dist/targets/react/hooks/use-hover.cjs.js +0 -24
- package/dist/targets/react/hooks/use-hover.es.js +0 -20
- package/dist/targets/react/hooks/use-press.cjs.js +0 -25
- package/dist/targets/react/hooks/use-press.es.js +0 -21
- package/dist/targets/react/hooks/use-viewport.cjs.js +0 -37
- package/dist/targets/react/hooks/use-viewport.es.js +0 -33
- package/dist/targets/react/index.cjs.js +0 -17
- package/dist/targets/react/index.es.js +0 -13
- package/dist/targets/react/utils/has-changed.cjs.js +0 -24
- package/dist/targets/react/utils/has-changed.es.js +0 -19
- package/dist/targets/react/utils/keyframes.cjs.js +0 -38
- package/dist/targets/react/utils/keyframes.es.js +0 -34
- package/dist/targets/react/utils/poses.cjs.js +0 -14
- package/dist/targets/react/utils/poses.es.js +0 -10
- package/dist/targets/react/utils/update-target.cjs.js +0 -20
- package/dist/targets/react/utils/update-target.es.js +0 -16
- package/dist/utils/array.cjs.js +0 -14
- package/dist/utils/array.es.js +0 -9
- package/dist/utils/clamp.cjs.js +0 -7
- package/dist/utils/clamp.es.js +0 -3
- package/dist/utils/is-number.cjs.js +0 -7
- package/dist/utils/is-number.es.js +0 -3
- package/dist/utils/mix.cjs.js +0 -28
- package/dist/utils/mix.es.js +0 -24
- package/dist/utils/noop.cjs.js +0 -9
- package/dist/utils/noop.es.js +0 -4
- package/dist/utils/progress.cjs.js +0 -20
- package/dist/utils/progress.es.js +0 -16
- package/dist/utils/stagger.cjs.js +0 -38
- package/dist/utils/stagger.es.js +0 -32
- package/dist/utils/velocity-per-second.cjs.js +0 -15
- package/dist/utils/velocity-per-second.es.js +0 -11
- package/dist/utils/wrap.cjs.js +0 -10
- package/dist/utils/wrap.es.js +0 -6
- package/react/package.json +0 -6
- package/types/react-entry.d.ts +0 -2
- package/types/targets/dom/animate-style.d.ts +0 -2
- package/types/targets/dom/animate.d.ts +0 -2
- package/types/targets/dom/data.d.ts +0 -2
- package/types/targets/dom/style.d.ts +0 -3
- package/types/targets/dom/timeline/index.d.ts +0 -15
- package/types/targets/dom/timeline/types.d.ts +0 -13
- package/types/targets/dom/timeline/utils/calc-time.d.ts +0 -2
- package/types/targets/dom/timeline/utils/edit.d.ts +0 -4
- package/types/targets/dom/timeline/utils/sort.d.ts +0 -2
- package/types/targets/dom/types.d.ts +0 -114
- package/types/targets/dom/utils/apply.d.ts +0 -3
- package/types/targets/dom/utils/controls.d.ts +0 -12
- package/types/targets/dom/utils/css-var.d.ts +0 -3
- package/types/targets/dom/utils/defaults.d.ts +0 -8
- package/types/targets/dom/utils/easing.d.ts +0 -6
- package/types/targets/dom/utils/feature-detection.d.ts +0 -8
- package/types/targets/dom/utils/get-style-name.d.ts +0 -1
- package/types/targets/dom/utils/keyframes.d.ts +0 -3
- package/types/targets/dom/utils/options.d.ts +0 -2
- package/types/targets/dom/utils/resolve-elements.d.ts +0 -4
- package/types/targets/dom/utils/stop-animation.d.ts +0 -6
- package/types/targets/dom/utils/time.d.ts +0 -1
- package/types/targets/dom/utils/transforms.d.ts +0 -20
- package/types/targets/js/NumberAnimation.d.ts +0 -24
- package/types/targets/js/easing/cubic-bezier.d.ts +0 -1
- package/types/targets/js/easing/glide/generator.d.ts +0 -5
- package/types/targets/js/easing/glide/index.d.ts +0 -2
- package/types/targets/js/easing/glide/types.d.ts +0 -14
- package/types/targets/js/easing/spring/generator.d.ts +0 -6
- package/types/targets/js/easing/spring/index.d.ts +0 -2
- package/types/targets/js/easing/spring/types.d.ts +0 -10
- package/types/targets/js/easing/steps.d.ts +0 -3
- package/types/targets/js/easing/utils/create-generator-easing.d.ts +0 -3
- package/types/targets/js/easing/utils/get-function.d.ts +0 -3
- package/types/targets/js/easing/utils/has-reached-target.d.ts +0 -1
- package/types/targets/js/easing/utils/pregenerate-keyframes.d.ts +0 -7
- package/types/targets/js/types.d.ts +0 -12
- package/types/targets/js/utils/get-easing.d.ts +0 -1
- package/types/targets/js/utils/interpolate.d.ts +0 -2
- package/types/targets/js/utils/offset.d.ts +0 -2
- package/types/targets/react/animated.d.ts +0 -3
- package/types/targets/react/context.d.ts +0 -3
- package/types/targets/react/hooks/use-animation.d.ts +0 -4
- package/types/targets/react/hooks/use-exit.d.ts +0 -3
- package/types/targets/react/hooks/use-gesture-state.d.ts +0 -4
- package/types/targets/react/hooks/use-hover.d.ts +0 -4
- package/types/targets/react/hooks/use-press.d.ts +0 -4
- package/types/targets/react/hooks/use-viewport.d.ts +0 -4
- package/types/targets/react/index.d.ts +0 -2
- package/types/targets/react/types.d.ts +0 -108
- package/types/targets/react/utils/has-changed.d.ts +0 -2
- package/types/targets/react/utils/keyframes.d.ts +0 -3
- package/types/targets/react/utils/poses.d.ts +0 -2
- package/types/targets/react/utils/supported-elements.d.ts +0 -8
- package/types/targets/react/utils/update-target.d.ts +0 -3
- package/types/utils/array.d.ts +0 -2
- package/types/utils/clamp.d.ts +0 -1
- package/types/utils/interpolate.d.ts +0 -0
- package/types/utils/is-number.d.ts +0 -1
- package/types/utils/mix.d.ts +0 -1
- package/types/utils/noop.d.ts +0 -2
- package/types/utils/progress.d.ts +0 -1
- package/types/utils/stagger.d.ts +0 -12
- package/types/utils/value-types.d.ts +0 -0
- package/types/utils/velocity-per-second.d.ts +0 -1
- package/types/utils/wrap.d.ts +0 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var isNumber = require('../../../../utils/is-number.cjs.js');
|
|
6
|
-
|
|
7
|
-
function calcNextTime(current, next, prev, labels) {
|
|
8
|
-
var _a;
|
|
9
|
-
if (isNumber.isNumber(next)) {
|
|
10
|
-
return next;
|
|
11
|
-
}
|
|
12
|
-
else if (next.startsWith("-") || next.startsWith("+")) {
|
|
13
|
-
return Math.max(0, current + parseFloat(next));
|
|
14
|
-
}
|
|
15
|
-
else if (next === "<") {
|
|
16
|
-
return prev;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return (_a = labels.get(next)) !== null && _a !== void 0 ? _a : current;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.calcNextTime = calcNextTime;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { isNumber } from '../../../../utils/is-number.es.js';
|
|
2
|
-
|
|
3
|
-
function calcNextTime(current, next, prev, labels) {
|
|
4
|
-
var _a;
|
|
5
|
-
if (isNumber(next)) {
|
|
6
|
-
return next;
|
|
7
|
-
}
|
|
8
|
-
else if (next.startsWith("-") || next.startsWith("+")) {
|
|
9
|
-
return Math.max(0, current + parseFloat(next));
|
|
10
|
-
}
|
|
11
|
-
else if (next === "<") {
|
|
12
|
-
return prev;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return (_a = labels.get(next)) !== null && _a !== void 0 ? _a : current;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { calcNextTime };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var mix = require('../../../../utils/mix.cjs.js');
|
|
6
|
-
var array = require('../../../../utils/array.cjs.js');
|
|
7
|
-
var getEasing = require('../../../js/utils/get-easing.cjs.js');
|
|
8
|
-
|
|
9
|
-
function eraseKeyframes(sequence, startTime, endTime) {
|
|
10
|
-
for (let i = 0; i < sequence.length; i++) {
|
|
11
|
-
const keyframe = sequence[i];
|
|
12
|
-
if (keyframe.at > startTime && keyframe.at < endTime) {
|
|
13
|
-
array.removeItem(sequence, keyframe);
|
|
14
|
-
// If we remove this item we have to push the pointer back one
|
|
15
|
-
i--;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function addKeyframes(sequence, keyframes, easing, offset, startTime, endTime) {
|
|
20
|
-
/**
|
|
21
|
-
* Erase every existing value between currentTime and targetTime,
|
|
22
|
-
* this will essentially splice this timeline into any currently
|
|
23
|
-
* defined ones.
|
|
24
|
-
*/
|
|
25
|
-
eraseKeyframes(sequence, startTime, endTime);
|
|
26
|
-
for (let i = 0; i < keyframes.length; i++) {
|
|
27
|
-
sequence.push({
|
|
28
|
-
value: keyframes[i],
|
|
29
|
-
at: mix.mix(startTime, endTime, offset[i]),
|
|
30
|
-
easing: getEasing.getEasingForSegment(easing, i),
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
exports.addKeyframes = addKeyframes;
|
|
36
|
-
exports.eraseKeyframes = eraseKeyframes;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { mix } from '../../../../utils/mix.es.js';
|
|
2
|
-
import { removeItem } from '../../../../utils/array.es.js';
|
|
3
|
-
import { getEasingForSegment } from '../../../js/utils/get-easing.es.js';
|
|
4
|
-
|
|
5
|
-
function eraseKeyframes(sequence, startTime, endTime) {
|
|
6
|
-
for (let i = 0; i < sequence.length; i++) {
|
|
7
|
-
const keyframe = sequence[i];
|
|
8
|
-
if (keyframe.at > startTime && keyframe.at < endTime) {
|
|
9
|
-
removeItem(sequence, keyframe);
|
|
10
|
-
// If we remove this item we have to push the pointer back one
|
|
11
|
-
i--;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function addKeyframes(sequence, keyframes, easing, offset, startTime, endTime) {
|
|
16
|
-
/**
|
|
17
|
-
* Erase every existing value between currentTime and targetTime,
|
|
18
|
-
* this will essentially splice this timeline into any currently
|
|
19
|
-
* defined ones.
|
|
20
|
-
*/
|
|
21
|
-
eraseKeyframes(sequence, startTime, endTime);
|
|
22
|
-
for (let i = 0; i < keyframes.length; i++) {
|
|
23
|
-
sequence.push({
|
|
24
|
-
value: keyframes[i],
|
|
25
|
-
at: mix(startTime, endTime, offset[i]),
|
|
26
|
-
easing: getEasingForSegment(easing, i),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { addKeyframes, eraseKeyframes };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function compareByTime(a, b) {
|
|
6
|
-
if (a.at === b.at) {
|
|
7
|
-
return a.value === null ? 1 : -1;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return a.at - b.at;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.compareByTime = compareByTime;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const cssVariableRenderer = (element, name) => (latest) => element.style.setProperty(name, latest);
|
|
6
|
-
const styleRenderer = (element, name) => (latest) => (element.style[name] = latest);
|
|
7
|
-
|
|
8
|
-
exports.cssVariableRenderer = cssVariableRenderer;
|
|
9
|
-
exports.styleRenderer = styleRenderer;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var noop = require('../../../utils/noop.cjs.js');
|
|
6
|
-
var stopAnimation = require('./stop-animation.cjs.js');
|
|
7
|
-
var time = require('./time.cjs.js');
|
|
8
|
-
|
|
9
|
-
const createAnimation = (factory) => factory();
|
|
10
|
-
const createAnimations = (animationFactory, duration) => new Proxy({
|
|
11
|
-
animations: animationFactory.map(createAnimation).filter(Boolean),
|
|
12
|
-
duration,
|
|
13
|
-
}, controls);
|
|
14
|
-
/**
|
|
15
|
-
* TODO:
|
|
16
|
-
* Currently this returns the first animation, ideally it would return
|
|
17
|
-
* the first active animation.
|
|
18
|
-
*/
|
|
19
|
-
const getActiveAnimation = (state) => state.animations[0];
|
|
20
|
-
const controls = {
|
|
21
|
-
get: (target, key) => {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
switch (key) {
|
|
24
|
-
case "duration":
|
|
25
|
-
return target.duration;
|
|
26
|
-
case "currentTime":
|
|
27
|
-
let time = ((_a = getActiveAnimation(target)) === null || _a === void 0 ? void 0 : _a[key]) || 0;
|
|
28
|
-
return time ? time / 1000 : 0;
|
|
29
|
-
case "playbackRate":
|
|
30
|
-
return (_b = getActiveAnimation(target)) === null || _b === void 0 ? void 0 : _b[key];
|
|
31
|
-
case "finished":
|
|
32
|
-
if (!target.finished) {
|
|
33
|
-
target.finished = Promise.all(target.animations.map(selectFinished)).catch(noop.noop);
|
|
34
|
-
}
|
|
35
|
-
return target.finished;
|
|
36
|
-
case "stop":
|
|
37
|
-
return () => target.animations.forEach(stopAnimation.stopAnimation);
|
|
38
|
-
default:
|
|
39
|
-
return () => target.animations.forEach((animation) => animation[key]());
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
set: (target, key, value) => {
|
|
43
|
-
switch (key) {
|
|
44
|
-
case "currentTime":
|
|
45
|
-
value = time.ms(value);
|
|
46
|
-
case "currentTime":
|
|
47
|
-
case "playbackRate":
|
|
48
|
-
for (let i = 0; i < target.animations.length; i++) {
|
|
49
|
-
target.animations[i][key] = value;
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
const selectFinished = (animation) => animation.finished;
|
|
57
|
-
|
|
58
|
-
exports.controls = controls;
|
|
59
|
-
exports.createAnimations = createAnimations;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { noop } from '../../../utils/noop.es.js';
|
|
2
|
-
import { stopAnimation } from './stop-animation.es.js';
|
|
3
|
-
import { ms } from './time.es.js';
|
|
4
|
-
|
|
5
|
-
const createAnimation = (factory) => factory();
|
|
6
|
-
const createAnimations = (animationFactory, duration) => new Proxy({
|
|
7
|
-
animations: animationFactory.map(createAnimation).filter(Boolean),
|
|
8
|
-
duration,
|
|
9
|
-
}, controls);
|
|
10
|
-
/**
|
|
11
|
-
* TODO:
|
|
12
|
-
* Currently this returns the first animation, ideally it would return
|
|
13
|
-
* the first active animation.
|
|
14
|
-
*/
|
|
15
|
-
const getActiveAnimation = (state) => state.animations[0];
|
|
16
|
-
const controls = {
|
|
17
|
-
get: (target, key) => {
|
|
18
|
-
var _a, _b;
|
|
19
|
-
switch (key) {
|
|
20
|
-
case "duration":
|
|
21
|
-
return target.duration;
|
|
22
|
-
case "currentTime":
|
|
23
|
-
let time = ((_a = getActiveAnimation(target)) === null || _a === void 0 ? void 0 : _a[key]) || 0;
|
|
24
|
-
return time ? time / 1000 : 0;
|
|
25
|
-
case "playbackRate":
|
|
26
|
-
return (_b = getActiveAnimation(target)) === null || _b === void 0 ? void 0 : _b[key];
|
|
27
|
-
case "finished":
|
|
28
|
-
if (!target.finished) {
|
|
29
|
-
target.finished = Promise.all(target.animations.map(selectFinished)).catch(noop);
|
|
30
|
-
}
|
|
31
|
-
return target.finished;
|
|
32
|
-
case "stop":
|
|
33
|
-
return () => target.animations.forEach(stopAnimation);
|
|
34
|
-
default:
|
|
35
|
-
return () => target.animations.forEach((animation) => animation[key]());
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
set: (target, key, value) => {
|
|
39
|
-
switch (key) {
|
|
40
|
-
case "currentTime":
|
|
41
|
-
value = ms(value);
|
|
42
|
-
case "currentTime":
|
|
43
|
-
case "playbackRate":
|
|
44
|
-
for (let i = 0; i < target.animations.length; i++) {
|
|
45
|
-
target.animations[i][key] = value;
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
const selectFinished = (animation) => animation.finished;
|
|
53
|
-
|
|
54
|
-
export { controls, createAnimations };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var transforms = require('./transforms.cjs.js');
|
|
6
|
-
|
|
7
|
-
const isCssVar = (name) => name.startsWith("--");
|
|
8
|
-
const registeredProperties = new Set();
|
|
9
|
-
function registerCssVariable(name) {
|
|
10
|
-
if (registeredProperties.has(name))
|
|
11
|
-
return;
|
|
12
|
-
registeredProperties.add(name);
|
|
13
|
-
try {
|
|
14
|
-
const { syntax, initialValue } = transforms.transformDefinitions.has(name)
|
|
15
|
-
? transforms.transformDefinitions.get(name)
|
|
16
|
-
: {};
|
|
17
|
-
CSS.registerProperty({
|
|
18
|
-
name,
|
|
19
|
-
inherits: false,
|
|
20
|
-
syntax,
|
|
21
|
-
initialValue,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
catch (e) { }
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.isCssVar = isCssVar;
|
|
28
|
-
exports.registerCssVariable = registerCssVariable;
|
|
29
|
-
exports.registeredProperties = registeredProperties;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { transformDefinitions } from './transforms.es.js';
|
|
2
|
-
|
|
3
|
-
const isCssVar = (name) => name.startsWith("--");
|
|
4
|
-
const registeredProperties = new Set();
|
|
5
|
-
function registerCssVariable(name) {
|
|
6
|
-
if (registeredProperties.has(name))
|
|
7
|
-
return;
|
|
8
|
-
registeredProperties.add(name);
|
|
9
|
-
try {
|
|
10
|
-
const { syntax, initialValue } = transformDefinitions.has(name)
|
|
11
|
-
? transformDefinitions.get(name)
|
|
12
|
-
: {};
|
|
13
|
-
CSS.registerProperty({
|
|
14
|
-
name,
|
|
15
|
-
inherits: false,
|
|
16
|
-
syntax,
|
|
17
|
-
initialValue,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
catch (e) { }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { isCssVar, registerCssVariable, registeredProperties };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var isNumber = require('../../../utils/is-number.cjs.js');
|
|
6
|
-
|
|
7
|
-
const isCubicBezier = (easing) => Array.isArray(easing) && isNumber.isNumber(easing[0]);
|
|
8
|
-
const isEasingList = (easing) => Array.isArray(easing) && !isNumber.isNumber(easing[0]);
|
|
9
|
-
const isCustomEasing = (easing) => typeof easing === "object" &&
|
|
10
|
-
Boolean(easing.createAnimation);
|
|
11
|
-
const convertEasing = (easing) => isCubicBezier(easing) ? cubicBezierAsString(easing) : easing;
|
|
12
|
-
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
13
|
-
|
|
14
|
-
exports.convertEasing = convertEasing;
|
|
15
|
-
exports.cubicBezierAsString = cubicBezierAsString;
|
|
16
|
-
exports.isCubicBezier = isCubicBezier;
|
|
17
|
-
exports.isCustomEasing = isCustomEasing;
|
|
18
|
-
exports.isEasingList = isEasingList;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { isNumber } from '../../../utils/is-number.es.js';
|
|
2
|
-
|
|
3
|
-
const isCubicBezier = (easing) => Array.isArray(easing) && isNumber(easing[0]);
|
|
4
|
-
const isEasingList = (easing) => Array.isArray(easing) && !isNumber(easing[0]);
|
|
5
|
-
const isCustomEasing = (easing) => typeof easing === "object" &&
|
|
6
|
-
Boolean(easing.createAnimation);
|
|
7
|
-
const convertEasing = (easing) => isCubicBezier(easing) ? cubicBezierAsString(easing) : easing;
|
|
8
|
-
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
9
|
-
|
|
10
|
-
export { convertEasing, cubicBezierAsString, isCubicBezier, isCustomEasing, isEasingList };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const testAnimation = (keyframes) => document.createElement("div").animate(keyframes, { duration: 0.001 });
|
|
6
|
-
const featureTests = {
|
|
7
|
-
cssRegisterProperty: () => typeof CSS !== "undefined" &&
|
|
8
|
-
Object.hasOwnProperty.call(CSS, "registerProperty"),
|
|
9
|
-
waapi: () => Object.hasOwnProperty.call(Element.prototype, "animate"),
|
|
10
|
-
partialKeyframes: () => {
|
|
11
|
-
try {
|
|
12
|
-
testAnimation({ opacity: [1] });
|
|
13
|
-
}
|
|
14
|
-
catch (e) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
18
|
-
},
|
|
19
|
-
finished: () => Boolean(testAnimation({ opacity: [0, 1] }).finished),
|
|
20
|
-
};
|
|
21
|
-
const results = {};
|
|
22
|
-
const supports = {};
|
|
23
|
-
for (const key in featureTests) {
|
|
24
|
-
supports[key] = () => {
|
|
25
|
-
if (results[key] === undefined)
|
|
26
|
-
results[key] = featureTests[key]();
|
|
27
|
-
return results[key];
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.supports = supports;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const testAnimation = (keyframes) => document.createElement("div").animate(keyframes, { duration: 0.001 });
|
|
2
|
-
const featureTests = {
|
|
3
|
-
cssRegisterProperty: () => typeof CSS !== "undefined" &&
|
|
4
|
-
Object.hasOwnProperty.call(CSS, "registerProperty"),
|
|
5
|
-
waapi: () => Object.hasOwnProperty.call(Element.prototype, "animate"),
|
|
6
|
-
partialKeyframes: () => {
|
|
7
|
-
try {
|
|
8
|
-
testAnimation({ opacity: [1] });
|
|
9
|
-
}
|
|
10
|
-
catch (e) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
return true;
|
|
14
|
-
},
|
|
15
|
-
finished: () => Boolean(testAnimation({ opacity: [0, 1] }).finished),
|
|
16
|
-
};
|
|
17
|
-
const results = {};
|
|
18
|
-
const supports = {};
|
|
19
|
-
for (const key in featureTests) {
|
|
20
|
-
supports[key] = () => {
|
|
21
|
-
if (results[key] === undefined)
|
|
22
|
-
results[key] = featureTests[key]();
|
|
23
|
-
return results[key];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { supports };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var transforms = require('./transforms.cjs.js');
|
|
6
|
-
|
|
7
|
-
function getStyleName(key) {
|
|
8
|
-
if (transforms.transformAlias[key])
|
|
9
|
-
key = transforms.transformAlias[key];
|
|
10
|
-
return transforms.isTransform(key) ? transforms.asTransformCssVar(key) : key;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
exports.getStyleName = getStyleName;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { isTransform, asTransformCssVar, transformAlias } from './transforms.es.js';
|
|
2
|
-
|
|
3
|
-
function getStyleName(key) {
|
|
4
|
-
if (transformAlias[key])
|
|
5
|
-
key = transformAlias[key];
|
|
6
|
-
return isTransform(key) ? asTransformCssVar(key) : key;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { getStyleName };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function hydrateKeyframes(keyframes, readInitialValue) {
|
|
6
|
-
for (let i = 0; i < keyframes.length; i++) {
|
|
7
|
-
if (keyframes[i] === null) {
|
|
8
|
-
keyframes[i] = i ? keyframes[i - 1] : readInitialValue();
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return keyframes;
|
|
12
|
-
}
|
|
13
|
-
const keyframesList = (keyframes) => Array.isArray(keyframes) ? keyframes : [keyframes];
|
|
14
|
-
|
|
15
|
-
exports.hydrateKeyframes = hydrateKeyframes;
|
|
16
|
-
exports.keyframesList = keyframesList;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function hydrateKeyframes(keyframes, readInitialValue) {
|
|
2
|
-
for (let i = 0; i < keyframes.length; i++) {
|
|
3
|
-
if (keyframes[i] === null) {
|
|
4
|
-
keyframes[i] = i ? keyframes[i - 1] : readInitialValue();
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
return keyframes;
|
|
8
|
-
}
|
|
9
|
-
const keyframesList = (keyframes) => Array.isArray(keyframes) ? keyframes : [keyframes];
|
|
10
|
-
|
|
11
|
-
export { hydrateKeyframes, keyframesList };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function resolveElements(elements, selectorCache) {
|
|
6
|
-
var _a;
|
|
7
|
-
if (typeof elements === "string") {
|
|
8
|
-
if (selectorCache) {
|
|
9
|
-
(_a = selectorCache[elements]) !== null && _a !== void 0 ? _a : (selectorCache[elements] = document.querySelectorAll(elements));
|
|
10
|
-
elements = selectorCache[elements];
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
elements = document.querySelectorAll(elements);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
else if (elements instanceof Element) {
|
|
17
|
-
elements = [elements];
|
|
18
|
-
}
|
|
19
|
-
return Array.from(elements);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.resolveElements = resolveElements;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function resolveElements(elements, selectorCache) {
|
|
2
|
-
var _a;
|
|
3
|
-
if (typeof elements === "string") {
|
|
4
|
-
if (selectorCache) {
|
|
5
|
-
(_a = selectorCache[elements]) !== null && _a !== void 0 ? _a : (selectorCache[elements] = document.querySelectorAll(elements));
|
|
6
|
-
elements = selectorCache[elements];
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
elements = document.querySelectorAll(elements);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
else if (elements instanceof Element) {
|
|
13
|
-
elements = [elements];
|
|
14
|
-
}
|
|
15
|
-
return Array.from(elements);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { resolveElements };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function stopAnimation(animation) {
|
|
6
|
-
if (!animation)
|
|
7
|
-
return;
|
|
8
|
-
// Suppress error thrown by WAAPI
|
|
9
|
-
try {
|
|
10
|
-
/**
|
|
11
|
-
* commitStyles has overhead so we only want to commit and cancel
|
|
12
|
-
*/
|
|
13
|
-
animation.playState !== "finished" && animation.commitStyles();
|
|
14
|
-
animation.cancel();
|
|
15
|
-
}
|
|
16
|
-
catch (e) { }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
exports.stopAnimation = stopAnimation;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
function stopAnimation(animation) {
|
|
2
|
-
if (!animation)
|
|
3
|
-
return;
|
|
4
|
-
// Suppress error thrown by WAAPI
|
|
5
|
-
try {
|
|
6
|
-
/**
|
|
7
|
-
* commitStyles has overhead so we only want to commit and cancel
|
|
8
|
-
*/
|
|
9
|
-
animation.playState !== "finished" && animation.commitStyles();
|
|
10
|
-
animation.cancel();
|
|
11
|
-
}
|
|
12
|
-
catch (e) { }
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { stopAnimation };
|