@douyinfe/semi-animation-react 2.0.7 → 2.1.0-alpha.2
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/lib/es/src/Animation.js
CHANGED
|
@@ -11,8 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import { Animation as SemiAnimation, events } from '@douyinfe/semi-animation';
|
|
12
12
|
import noop from './utils/noop';
|
|
13
13
|
export default class Animation extends PureComponent {
|
|
14
|
-
constructor() {
|
|
15
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
14
|
+
constructor(props = {}) {
|
|
16
15
|
super(props);
|
|
17
16
|
|
|
18
17
|
this.initAnimation = props => {
|
|
@@ -144,9 +143,7 @@ export default class Animation extends PureComponent {
|
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
145
|
|
|
147
|
-
componentDidUpdate() {
|
|
148
|
-
let prevProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
149
|
-
|
|
146
|
+
componentDidUpdate(prevProps = {}) {
|
|
150
147
|
if (this.props.reset) {
|
|
151
148
|
if (this.props.from !== prevProps.from || this.props.to !== prevProps.to) {
|
|
152
149
|
this.destroy();
|
package/lib/es/src/KeyFrames.js
CHANGED
|
@@ -6,21 +6,14 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import noop from './utils/noop';
|
|
7
7
|
import Animation from './Animation';
|
|
8
8
|
export default class KeyFrames extends Component {
|
|
9
|
-
constructor() {
|
|
10
|
-
var _this;
|
|
11
|
-
|
|
12
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
+
constructor(props = {}) {
|
|
13
10
|
super(props);
|
|
14
|
-
_this = this;
|
|
15
|
-
|
|
16
|
-
this.onFrame = function () {
|
|
17
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
11
|
|
|
12
|
+
this.onFrame = (props = {}) => {
|
|
19
13
|
const currentStyle = _Object$assign({}, props);
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_this.setState({
|
|
15
|
+
this.props.onFrame(currentStyle);
|
|
16
|
+
this.setState({
|
|
24
17
|
currentStyle
|
|
25
18
|
});
|
|
26
19
|
};
|
|
@@ -28,59 +28,22 @@ import invokeFns from './utils/invokeFns';
|
|
|
28
28
|
const types = _reduceInstanceProperty(_context = _Object$values(styledTypes)).call(_context, (arr, cur) => [...arr, ...cur], []);
|
|
29
29
|
|
|
30
30
|
export default class StyledAnimation extends PureComponent {
|
|
31
|
-
constructor() {
|
|
32
|
-
var _this;
|
|
33
|
-
|
|
34
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
31
|
+
constructor(props = {}) {
|
|
35
32
|
super(props);
|
|
36
|
-
_this = this;
|
|
37
|
-
|
|
38
|
-
this._generateAnimateEvents = function (child) {
|
|
39
|
-
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
40
|
-
return {
|
|
41
|
-
onAnimationIteration: function () {
|
|
42
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
-
args[_key] = arguments[_key];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return invokeFns([child && child.props && child.props.onAnimationIteration, props.onFrame], args);
|
|
47
|
-
},
|
|
48
|
-
onAnimationStart: function () {
|
|
49
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
50
|
-
args[_key2] = arguments[_key2];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return invokeFns([child && child.props && child.props.onAnimationStart, props.onStart], args);
|
|
54
|
-
},
|
|
55
|
-
onAnimationEnd: function () {
|
|
56
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
57
|
-
args[_key3] = arguments[_key3];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return invokeFns([child && child.props && child.props.onAnimationEnd, props.onRest], args);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
33
|
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
34
|
+
this._generateAnimateEvents = (child, props = {}) => ({
|
|
35
|
+
onAnimationIteration: (...args) => invokeFns([child && child.props && child.props.onAnimationIteration, props.onFrame], args),
|
|
36
|
+
onAnimationStart: (...args) => invokeFns([child && child.props && child.props.onAnimationStart, props.onStart], args),
|
|
37
|
+
onAnimationEnd: (...args) => invokeFns([child && child.props && child.props.onAnimationEnd, props.onRest], args)
|
|
38
|
+
});
|
|
69
39
|
|
|
70
|
-
this.
|
|
71
|
-
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.type;
|
|
72
|
-
return type != null && _includesInstanceProperty(types).call(types, type);
|
|
73
|
-
};
|
|
40
|
+
this._hasSpeedClass = (speed = this.props.speed) => speed != null && _includesInstanceProperty(speeds).call(speeds, speed);
|
|
74
41
|
|
|
75
|
-
this.
|
|
76
|
-
let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.delay;
|
|
77
|
-
return delay != null && _includesInstanceProperty(delays).call(delays, delay);
|
|
78
|
-
};
|
|
42
|
+
this._hasTypeClass = (type = this.props.type) => type != null && _includesInstanceProperty(types).call(types, type);
|
|
79
43
|
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
44
|
+
this._hasDelayClass = (delay = this.props.delay) => delay != null && _includesInstanceProperty(delays).call(delays, delay);
|
|
45
|
+
|
|
46
|
+
this._hasLoopClass = (loop = this.props.loop) => loop != null && _includesInstanceProperty(loops).call(loops, loop);
|
|
84
47
|
}
|
|
85
48
|
|
|
86
49
|
render() {
|
|
@@ -21,8 +21,7 @@ import PropTypes from 'prop-types';
|
|
|
21
21
|
import StyledAnimation from './StyledAnimation';
|
|
22
22
|
import noop from './utils/noop';
|
|
23
23
|
export default class StyledTransition extends Component {
|
|
24
|
-
constructor() {
|
|
25
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
24
|
+
constructor(props = {}) {
|
|
26
25
|
super(props);
|
|
27
26
|
|
|
28
27
|
this._isControlled = () => {
|
package/lib/es/src/Transition.js
CHANGED
|
@@ -21,8 +21,7 @@ import PropTypes from 'prop-types';
|
|
|
21
21
|
import React, { Component, isValidElement } from 'react';
|
|
22
22
|
import noop from './utils/noop';
|
|
23
23
|
export default class Transition extends Component {
|
|
24
|
-
constructor() {
|
|
25
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
24
|
+
constructor(props = {}) {
|
|
26
25
|
super(props);
|
|
27
26
|
|
|
28
27
|
this._isControlled = () => {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
2
2
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
|
-
export default function invokeFns(fns) {
|
|
4
|
-
let args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
5
|
-
|
|
3
|
+
export default function invokeFns(fns, args = []) {
|
|
6
4
|
if (_Array$isArray(fns) && fns.length) {
|
|
7
5
|
_forEachInstanceProperty(fns).call(fns, fn => {
|
|
8
6
|
if (typeof fn === 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-animation-react",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-alpha.2",
|
|
4
4
|
"description": "motion library for semi-ui-react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"motion",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
29
|
-
"@douyinfe/semi-animation": "2.0.
|
|
30
|
-
"@douyinfe/semi-animation-styled": "2.0.
|
|
29
|
+
"@douyinfe/semi-animation": "2.1.0-alpha.2",
|
|
30
|
+
"@douyinfe/semi-animation-styled": "2.1.0-alpha.2",
|
|
31
31
|
"classnames": "^2.2.6"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"prop-types": "15.7.2",
|
|
52
52
|
"react-storybook-addon-props-combinations": "^1.1.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "50381484f8df8aaa00285cf0a2ee01edf0083115"
|
|
55
55
|
}
|