@douyinfe/semi-animation-react 2.19.0-beta.0 → 2.19.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/lib/cjs/index.js +11 -20
- package/lib/cjs/src/Animation.js +13 -24
- package/lib/cjs/src/KeyFrames.js +7 -16
- package/lib/cjs/src/StyledAnimation.js +23 -33
- package/lib/cjs/src/StyledTransition.js +10 -29
- package/lib/cjs/src/Transition.js +10 -29
- package/lib/cjs/src/utils/invokeFns.js +3 -12
- package/lib/cjs/src/utils/noop.js +1 -4
- package/lib/cjs/src/utils/string.js +5 -16
- package/lib/es/src/Animation.js +8 -18
- package/lib/es/src/KeyFrames.js +2 -5
- package/lib/es/src/StyledAnimation.js +12 -25
- package/lib/es/src/StyledTransition.js +5 -14
- package/lib/es/src/Transition.js +5 -14
- package/lib/es/src/utils/invokeFns.js +2 -4
- package/lib/es/src/utils/string.js +4 -10
- package/package.json +3 -6
package/lib/cjs/index.js
CHANGED
|
@@ -1,56 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
|
-
_Object$defineProperty(exports, "Animation", {
|
|
6
|
+
Object.defineProperty(exports, "Animation", {
|
|
12
7
|
enumerable: true,
|
|
13
8
|
get: function () {
|
|
14
9
|
return _Animation.default;
|
|
15
10
|
}
|
|
16
11
|
});
|
|
17
|
-
|
|
18
|
-
_Object$defineProperty(exports, "KeyFrames", {
|
|
12
|
+
Object.defineProperty(exports, "KeyFrames", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
21
15
|
return _KeyFrames.default;
|
|
22
16
|
}
|
|
23
17
|
});
|
|
24
|
-
|
|
25
|
-
_Object$defineProperty(exports, "StyledAnimation", {
|
|
18
|
+
Object.defineProperty(exports, "StyledAnimation", {
|
|
26
19
|
enumerable: true,
|
|
27
20
|
get: function () {
|
|
28
21
|
return _StyledAnimation.default;
|
|
29
22
|
}
|
|
30
23
|
});
|
|
31
|
-
|
|
32
|
-
_Object$defineProperty(exports, "StyledTransition", {
|
|
24
|
+
Object.defineProperty(exports, "StyledTransition", {
|
|
33
25
|
enumerable: true,
|
|
34
26
|
get: function () {
|
|
35
27
|
return _StyledTransition.default;
|
|
36
28
|
}
|
|
37
29
|
});
|
|
38
|
-
|
|
39
|
-
_Object$defineProperty(exports, "Transition", {
|
|
30
|
+
Object.defineProperty(exports, "Transition", {
|
|
40
31
|
enumerable: true,
|
|
41
32
|
get: function () {
|
|
42
33
|
return _Transition.default;
|
|
43
34
|
}
|
|
44
35
|
});
|
|
45
|
-
|
|
46
|
-
_Object$defineProperty(exports, "interpolate", {
|
|
36
|
+
Object.defineProperty(exports, "interpolate", {
|
|
47
37
|
enumerable: true,
|
|
48
38
|
get: function () {
|
|
49
39
|
return _semiAnimation.interpolate;
|
|
50
40
|
}
|
|
51
41
|
});
|
|
52
|
-
|
|
53
|
-
_Object$defineProperty(exports, "presets", {
|
|
42
|
+
Object.defineProperty(exports, "presets", {
|
|
54
43
|
enumerable: true,
|
|
55
44
|
get: function () {
|
|
56
45
|
return _semiAnimation.presets;
|
|
@@ -67,4 +56,6 @@ var _KeyFrames = _interopRequireDefault(require("./src/KeyFrames"));
|
|
|
67
56
|
|
|
68
57
|
var _Transition = _interopRequireDefault(require("./src/Transition"));
|
|
69
58
|
|
|
70
|
-
var _semiAnimation = require("@douyinfe/semi-animation");
|
|
59
|
+
var _semiAnimation = require("@douyinfe/semi-animation");
|
|
60
|
+
|
|
61
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/cjs/src/Animation.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
|
-
|
|
15
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
16
|
-
|
|
17
|
-
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
18
|
-
|
|
19
|
-
var _reverse = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reverse"));
|
|
20
|
-
|
|
21
8
|
var _react = require("react");
|
|
22
9
|
|
|
23
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -26,6 +13,8 @@ var _semiAnimation = require("@douyinfe/semi-animation");
|
|
|
26
13
|
|
|
27
14
|
var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
28
15
|
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
29
18
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
30
19
|
|
|
31
20
|
/* eslint-disable react/destructuring-assignment */
|
|
@@ -50,22 +39,24 @@ class Animation extends _react.PureComponent {
|
|
|
50
39
|
}
|
|
51
40
|
|
|
52
41
|
this.animation = new _semiAnimation.Animation({
|
|
53
|
-
from:
|
|
54
|
-
to:
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
from: Object.assign({}, from),
|
|
43
|
+
to: Object.assign({}, to)
|
|
44
|
+
}, Object.assign({}, config));
|
|
45
|
+
|
|
46
|
+
_semiAnimation.events.forEach(event => {
|
|
47
|
+
const propName = "on".concat(event[0].toUpperCase() + event.slice(1)); // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
58
48
|
|
|
59
49
|
this.animation.on(event, props => {
|
|
60
50
|
// avoid memory leak
|
|
61
51
|
if (this._mounted && !this._destroyed) {
|
|
62
52
|
this.setState({
|
|
63
|
-
currentStyle:
|
|
53
|
+
currentStyle: Object.assign({}, props)
|
|
64
54
|
});
|
|
65
55
|
this.props[propName](props);
|
|
66
56
|
}
|
|
67
57
|
});
|
|
68
58
|
});
|
|
59
|
+
|
|
69
60
|
this._destroyed = false;
|
|
70
61
|
};
|
|
71
62
|
|
|
@@ -112,9 +103,7 @@ class Animation extends _react.PureComponent {
|
|
|
112
103
|
|
|
113
104
|
this.reverse = () => {
|
|
114
105
|
if (this.animation) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
(0, _reverse.default)(_context = this.animation).call(_context);
|
|
106
|
+
this.animation.reverse();
|
|
118
107
|
this.startOrNot();
|
|
119
108
|
}
|
|
120
109
|
};
|
|
@@ -179,7 +168,7 @@ class Animation extends _react.PureComponent {
|
|
|
179
168
|
|
|
180
169
|
if (this.props.force) {
|
|
181
170
|
if (this.props.to !== prevProps.to) {
|
|
182
|
-
this.initAnimation(
|
|
171
|
+
this.initAnimation(Object.assign(Object.assign({}, this.props), {
|
|
183
172
|
from: prevProps.to
|
|
184
173
|
}));
|
|
185
174
|
this.startOrNot();
|
package/lib/cjs/src/KeyFrames.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
10
|
-
|
|
11
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
4
|
value: true
|
|
13
5
|
});
|
|
14
|
-
|
|
15
6
|
exports.default = void 0;
|
|
16
7
|
|
|
17
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
18
|
-
|
|
19
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
20
9
|
|
|
21
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -24,9 +13,11 @@ var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
|
24
13
|
|
|
25
14
|
var _Animation = _interopRequireDefault(require("./Animation"));
|
|
26
15
|
|
|
27
|
-
function
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
19
|
|
|
29
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor =
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
21
|
|
|
31
22
|
/* eslint-disable react/destructuring-assignment */
|
|
32
23
|
class KeyFrames extends _react.Component {
|
|
@@ -39,7 +30,7 @@ class KeyFrames extends _react.Component {
|
|
|
39
30
|
|
|
40
31
|
this.onFrame = function () {
|
|
41
32
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
42
|
-
const currentStyle =
|
|
33
|
+
const currentStyle = Object.assign({}, props);
|
|
43
34
|
|
|
44
35
|
_this.props.onFrame(currentStyle);
|
|
45
36
|
|
|
@@ -108,7 +99,7 @@ class KeyFrames extends _react.Component {
|
|
|
108
99
|
} = this.state;
|
|
109
100
|
const from = frames[frameIndex];
|
|
110
101
|
const to = frames[frameIndex + 1];
|
|
111
|
-
return /*#__PURE__*/_react.default.createElement(_Animation.default,
|
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_Animation.default, Object.assign({}, this.props, {
|
|
112
103
|
forwardInstance: this.forwardInstance,
|
|
113
104
|
from: from,
|
|
114
105
|
to: to,
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
14
|
-
|
|
15
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
|
16
|
-
|
|
17
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
18
|
-
|
|
19
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
20
|
-
|
|
21
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
22
|
-
|
|
23
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
24
|
-
|
|
25
8
|
var _react = require("react");
|
|
26
9
|
|
|
27
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -34,9 +17,18 @@ var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
|
34
17
|
|
|
35
18
|
var _invokeFns = _interopRequireDefault(require("./utils/invokeFns"));
|
|
36
19
|
|
|
37
|
-
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
/* eslint-disable react/destructuring-assignment */
|
|
23
|
+
|
|
24
|
+
/* eslint-disable prefer-const */
|
|
38
25
|
|
|
39
|
-
|
|
26
|
+
/* eslint-disable eqeqeq */
|
|
27
|
+
|
|
28
|
+
/* eslint-disable import/no-duplicates */
|
|
29
|
+
|
|
30
|
+
/* eslint-disable no-duplicate-imports */
|
|
31
|
+
const types = Object.values(_semiAnimationStyled.types).reduce((arr, cur) => [...arr, ...cur], []);
|
|
40
32
|
|
|
41
33
|
class StyledAnimation extends _react.PureComponent {
|
|
42
34
|
constructor() {
|
|
@@ -75,28 +67,26 @@ class StyledAnimation extends _react.PureComponent {
|
|
|
75
67
|
|
|
76
68
|
this._hasSpeedClass = function () {
|
|
77
69
|
let speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.speed;
|
|
78
|
-
return speed != null &&
|
|
70
|
+
return speed != null && _semiAnimationStyled.speeds.includes(speed);
|
|
79
71
|
};
|
|
80
72
|
|
|
81
73
|
this._hasTypeClass = function () {
|
|
82
74
|
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.type;
|
|
83
|
-
return type != null &&
|
|
75
|
+
return type != null && types.includes(type);
|
|
84
76
|
};
|
|
85
77
|
|
|
86
78
|
this._hasDelayClass = function () {
|
|
87
79
|
let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.delay;
|
|
88
|
-
return delay != null &&
|
|
80
|
+
return delay != null && _semiAnimationStyled.delays.includes(delay);
|
|
89
81
|
};
|
|
90
82
|
|
|
91
83
|
this._hasLoopClass = function () {
|
|
92
84
|
let loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.loop;
|
|
93
|
-
return loop != null &&
|
|
85
|
+
return loop != null && _semiAnimationStyled.loops.includes(loop);
|
|
94
86
|
};
|
|
95
87
|
}
|
|
96
88
|
|
|
97
89
|
render() {
|
|
98
|
-
var _context2, _context3, _context4, _context5;
|
|
99
|
-
|
|
100
90
|
let {
|
|
101
91
|
type,
|
|
102
92
|
speed,
|
|
@@ -120,10 +110,10 @@ class StyledAnimation extends _react.PureComponent {
|
|
|
120
110
|
const hasLoopClass = this._hasLoopClass();
|
|
121
111
|
|
|
122
112
|
const animateCls = className || (0, _classnames.default)("".concat(prefixCls, "-animated"), {
|
|
123
|
-
[
|
|
124
|
-
[
|
|
125
|
-
[
|
|
126
|
-
[
|
|
113
|
+
["".concat(prefixCls, "-").concat(type)]: Boolean(type),
|
|
114
|
+
["".concat(prefixCls, "-speed-").concat(speed)]: hasSpeedClass,
|
|
115
|
+
["".concat(prefixCls, "-delay-").concat(delay)]: hasDelayClass,
|
|
116
|
+
["".concat(prefixCls, "-loop-").concat(loop)]: hasLoopClass
|
|
127
117
|
});
|
|
128
118
|
const animateStyle = {
|
|
129
119
|
animationTimingFunction: timing,
|
|
@@ -136,12 +126,12 @@ class StyledAnimation extends _react.PureComponent {
|
|
|
136
126
|
};
|
|
137
127
|
|
|
138
128
|
if ( /*#__PURE__*/(0, _react.isValidElement)(children)) {
|
|
139
|
-
children =
|
|
129
|
+
children = _react.Children.map(children, child => {
|
|
140
130
|
const animateEvents = this._generateAnimateEvents(child, this.props);
|
|
141
131
|
|
|
142
|
-
return /*#__PURE__*/(0, _react.cloneElement)(child,
|
|
132
|
+
return /*#__PURE__*/(0, _react.cloneElement)(child, Object.assign({
|
|
143
133
|
className: (0, _classnames.default)(child.props.className, animateCls),
|
|
144
|
-
style:
|
|
134
|
+
style: Object.assign(Object.assign({}, child.props.style), this.props.style)
|
|
145
135
|
}, animateEvents));
|
|
146
136
|
});
|
|
147
137
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
10
|
-
|
|
11
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
4
|
value: true
|
|
13
5
|
});
|
|
14
|
-
|
|
15
6
|
exports.default = void 0;
|
|
16
7
|
|
|
17
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
18
|
-
|
|
19
|
-
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
20
|
-
|
|
21
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
22
|
-
|
|
23
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
24
|
-
|
|
25
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
26
9
|
|
|
27
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -30,17 +13,19 @@ var _StyledAnimation = _interopRequireDefault(require("./StyledAnimation"));
|
|
|
30
13
|
|
|
31
14
|
var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
32
15
|
|
|
33
|
-
function
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
17
|
|
|
35
|
-
function
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
36
21
|
|
|
37
22
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
38
23
|
var t = {};
|
|
39
24
|
|
|
40
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
41
26
|
|
|
42
|
-
if (s != null && typeof
|
|
43
|
-
if (
|
|
27
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
44
29
|
}
|
|
45
30
|
return t;
|
|
46
31
|
};
|
|
@@ -52,11 +37,7 @@ class StyledTransition extends _react.Component {
|
|
|
52
37
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
53
38
|
super(props);
|
|
54
39
|
|
|
55
|
-
this._isControlled = () =>
|
|
56
|
-
var _context;
|
|
57
|
-
|
|
58
|
-
return (0, _includes.default)(_context = [true, false, 'enter', 'leave']).call(_context, this.props.state);
|
|
59
|
-
};
|
|
40
|
+
this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
|
|
60
41
|
|
|
61
42
|
this.onRest = props => {
|
|
62
43
|
const {
|
|
@@ -159,7 +140,7 @@ class StyledTransition extends _react.Component {
|
|
|
159
140
|
}
|
|
160
141
|
}
|
|
161
142
|
|
|
162
|
-
return /*#__PURE__*/_react.default.createElement(_StyledAnimation.default,
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement(_StyledAnimation.default, Object.assign({}, restProps, {
|
|
163
144
|
type: type,
|
|
164
145
|
onStart: this.onStart,
|
|
165
146
|
onRest: this.onRest
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
10
|
-
|
|
11
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
4
|
value: true
|
|
13
5
|
});
|
|
14
|
-
|
|
15
6
|
exports.default = void 0;
|
|
16
7
|
|
|
17
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
18
|
-
|
|
19
|
-
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
20
|
-
|
|
21
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
22
|
-
|
|
23
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
24
|
-
|
|
25
8
|
var _Animation = _interopRequireDefault(require("./Animation"));
|
|
26
9
|
|
|
27
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -30,17 +13,19 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
30
13
|
|
|
31
14
|
var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
32
15
|
|
|
33
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
34
17
|
|
|
35
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor =
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
21
|
|
|
37
22
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
38
23
|
var t = {};
|
|
39
24
|
|
|
40
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
41
26
|
|
|
42
|
-
if (s != null && typeof
|
|
43
|
-
if (
|
|
27
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
44
29
|
}
|
|
45
30
|
return t;
|
|
46
31
|
};
|
|
@@ -52,11 +37,7 @@ class Transition extends _react.Component {
|
|
|
52
37
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
53
38
|
super(props);
|
|
54
39
|
|
|
55
|
-
this._isControlled = () =>
|
|
56
|
-
var _context;
|
|
57
|
-
|
|
58
|
-
return (0, _includes.default)(_context = [true, false, 'enter', 'leave']).call(_context, this.props.state);
|
|
59
|
-
};
|
|
40
|
+
this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
|
|
60
41
|
|
|
61
42
|
this.forwardInstance = instance => {
|
|
62
43
|
this.instance = instance;
|
|
@@ -174,7 +155,7 @@ class Transition extends _react.Component {
|
|
|
174
155
|
}
|
|
175
156
|
}
|
|
176
157
|
|
|
177
|
-
return /*#__PURE__*/_react.default.createElement(_Animation.default,
|
|
158
|
+
return /*#__PURE__*/_react.default.createElement(_Animation.default, Object.assign({}, restProps, {
|
|
178
159
|
force: true,
|
|
179
160
|
from: from,
|
|
180
161
|
to: to,
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = invokeFns;
|
|
12
7
|
|
|
13
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
14
|
-
|
|
15
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
16
|
-
|
|
17
8
|
function invokeFns(fns) {
|
|
18
9
|
let args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
19
10
|
|
|
20
|
-
if (
|
|
21
|
-
|
|
11
|
+
if (Array.isArray(fns) && fns.length) {
|
|
12
|
+
fns.forEach(fn => {
|
|
22
13
|
if (typeof fn === 'function') {
|
|
23
14
|
fn(...args);
|
|
24
15
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.default = noop;
|
|
10
7
|
|
|
11
8
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.lowerCase = lowerCase;
|
|
12
7
|
exports.upperCase = upperCase;
|
|
13
8
|
|
|
14
|
-
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
15
|
-
|
|
16
9
|
/* eslint-disable eqeqeq */
|
|
17
10
|
function upperCase(str, pos) {
|
|
18
11
|
if (typeof str === 'string') {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (0, _reduce.default)(_context = str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
+
return str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
13
|
// @ts-ignore
|
|
23
|
-
.split()
|
|
14
|
+
.split().reduce((total, cur, index) => pos == null || pos === index ? total + cur.toUpperCase() : total + cur, '');
|
|
24
15
|
}
|
|
25
16
|
|
|
26
17
|
return str;
|
|
@@ -28,11 +19,9 @@ function upperCase(str, pos) {
|
|
|
28
19
|
|
|
29
20
|
function lowerCase(str, pos) {
|
|
30
21
|
if (typeof str === 'string') {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return (0, _reduce.default)(_context2 = str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
return str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
34
23
|
// @ts-ignore
|
|
35
|
-
.split()
|
|
24
|
+
.split().reduce((total, cur, index) => pos == null || pos === index ? total + cur.toLowerCase() : total + cur, '');
|
|
36
25
|
}
|
|
37
26
|
|
|
38
27
|
return str;
|
package/lib/es/src/Animation.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
4
|
-
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
|
5
|
-
|
|
6
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
7
2
|
|
|
8
3
|
/* eslint-disable react/destructuring-assignment */
|
|
@@ -31,24 +26,22 @@ export default class Animation extends PureComponent {
|
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
this.animation = new SemiAnimation({
|
|
34
|
-
from:
|
|
35
|
-
to:
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const propName = "on".concat(event[0].toUpperCase() + _sliceInstanceProperty(event).call(event, 1)); // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
29
|
+
from: Object.assign({}, from),
|
|
30
|
+
to: Object.assign({}, to)
|
|
31
|
+
}, Object.assign({}, config));
|
|
32
|
+
events.forEach(event => {
|
|
33
|
+
const propName = "on".concat(event[0].toUpperCase() + event.slice(1)); // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
40
34
|
|
|
41
35
|
this.animation.on(event, props => {
|
|
42
36
|
// avoid memory leak
|
|
43
37
|
if (this._mounted && !this._destroyed) {
|
|
44
38
|
this.setState({
|
|
45
|
-
currentStyle:
|
|
39
|
+
currentStyle: Object.assign({}, props)
|
|
46
40
|
});
|
|
47
41
|
this.props[propName](props);
|
|
48
42
|
}
|
|
49
43
|
});
|
|
50
44
|
});
|
|
51
|
-
|
|
52
45
|
this._destroyed = false;
|
|
53
46
|
};
|
|
54
47
|
|
|
@@ -95,10 +88,7 @@ export default class Animation extends PureComponent {
|
|
|
95
88
|
|
|
96
89
|
this.reverse = () => {
|
|
97
90
|
if (this.animation) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
_reverseInstanceProperty(_context = this.animation).call(_context);
|
|
101
|
-
|
|
91
|
+
this.animation.reverse();
|
|
102
92
|
this.startOrNot();
|
|
103
93
|
}
|
|
104
94
|
};
|
|
@@ -163,7 +153,7 @@ export default class Animation extends PureComponent {
|
|
|
163
153
|
|
|
164
154
|
if (this.props.force) {
|
|
165
155
|
if (this.props.to !== prevProps.to) {
|
|
166
|
-
this.initAnimation(
|
|
156
|
+
this.initAnimation(Object.assign(Object.assign({}, this.props), {
|
|
167
157
|
from: prevProps.to
|
|
168
158
|
}));
|
|
169
159
|
this.startOrNot();
|
package/lib/es/src/KeyFrames.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
|
|
3
1
|
/* eslint-disable react/destructuring-assignment */
|
|
4
2
|
import React, { Component } from 'react';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
@@ -15,8 +13,7 @@ export default class KeyFrames extends Component {
|
|
|
15
13
|
|
|
16
14
|
this.onFrame = function () {
|
|
17
15
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
|
-
|
|
19
|
-
const currentStyle = _Object$assign({}, props);
|
|
16
|
+
const currentStyle = Object.assign({}, props);
|
|
20
17
|
|
|
21
18
|
_this.props.onFrame(currentStyle);
|
|
22
19
|
|
|
@@ -85,7 +82,7 @@ export default class KeyFrames extends Component {
|
|
|
85
82
|
} = this.state;
|
|
86
83
|
const from = frames[frameIndex];
|
|
87
84
|
const to = frames[frameIndex + 1];
|
|
88
|
-
return /*#__PURE__*/React.createElement(Animation,
|
|
85
|
+
return /*#__PURE__*/React.createElement(Animation, Object.assign({}, this.props, {
|
|
89
86
|
forwardInstance: this.forwardInstance,
|
|
90
87
|
from: from,
|
|
91
88
|
to: to,
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var _context;
|
|
2
|
-
|
|
3
|
-
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
4
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
5
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
6
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
7
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
8
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
9
|
-
|
|
10
1
|
/* eslint-disable react/destructuring-assignment */
|
|
11
2
|
|
|
12
3
|
/* eslint-disable prefer-const */
|
|
@@ -22,9 +13,7 @@ import classnames from 'classnames';
|
|
|
22
13
|
import { types as styledTypes, loops, delays, speeds } from '@douyinfe/semi-animation-styled';
|
|
23
14
|
import noop from './utils/noop';
|
|
24
15
|
import invokeFns from './utils/invokeFns';
|
|
25
|
-
|
|
26
|
-
const types = _reduceInstanceProperty(_context = _Object$values(styledTypes)).call(_context, (arr, cur) => [...arr, ...cur], []);
|
|
27
|
-
|
|
16
|
+
const types = Object.values(styledTypes).reduce((arr, cur) => [...arr, ...cur], []);
|
|
28
17
|
export default class StyledAnimation extends PureComponent {
|
|
29
18
|
constructor() {
|
|
30
19
|
var _this;
|
|
@@ -62,28 +51,26 @@ export default class StyledAnimation extends PureComponent {
|
|
|
62
51
|
|
|
63
52
|
this._hasSpeedClass = function () {
|
|
64
53
|
let speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.speed;
|
|
65
|
-
return speed != null &&
|
|
54
|
+
return speed != null && speeds.includes(speed);
|
|
66
55
|
};
|
|
67
56
|
|
|
68
57
|
this._hasTypeClass = function () {
|
|
69
58
|
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.type;
|
|
70
|
-
return type != null &&
|
|
59
|
+
return type != null && types.includes(type);
|
|
71
60
|
};
|
|
72
61
|
|
|
73
62
|
this._hasDelayClass = function () {
|
|
74
63
|
let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.delay;
|
|
75
|
-
return delay != null &&
|
|
64
|
+
return delay != null && delays.includes(delay);
|
|
76
65
|
};
|
|
77
66
|
|
|
78
67
|
this._hasLoopClass = function () {
|
|
79
68
|
let loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.loop;
|
|
80
|
-
return loop != null &&
|
|
69
|
+
return loop != null && loops.includes(loop);
|
|
81
70
|
};
|
|
82
71
|
}
|
|
83
72
|
|
|
84
73
|
render() {
|
|
85
|
-
var _context2, _context3, _context4, _context5;
|
|
86
|
-
|
|
87
74
|
let {
|
|
88
75
|
type,
|
|
89
76
|
speed,
|
|
@@ -107,10 +94,10 @@ export default class StyledAnimation extends PureComponent {
|
|
|
107
94
|
const hasLoopClass = this._hasLoopClass();
|
|
108
95
|
|
|
109
96
|
const animateCls = className || classnames("".concat(prefixCls, "-animated"), {
|
|
110
|
-
[
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
-
[
|
|
97
|
+
["".concat(prefixCls, "-").concat(type)]: Boolean(type),
|
|
98
|
+
["".concat(prefixCls, "-speed-").concat(speed)]: hasSpeedClass,
|
|
99
|
+
["".concat(prefixCls, "-delay-").concat(delay)]: hasDelayClass,
|
|
100
|
+
["".concat(prefixCls, "-loop-").concat(loop)]: hasLoopClass
|
|
114
101
|
});
|
|
115
102
|
const animateStyle = {
|
|
116
103
|
animationTimingFunction: timing,
|
|
@@ -123,12 +110,12 @@ export default class StyledAnimation extends PureComponent {
|
|
|
123
110
|
};
|
|
124
111
|
|
|
125
112
|
if ( /*#__PURE__*/isValidElement(children)) {
|
|
126
|
-
children =
|
|
113
|
+
children = Children.map(children, child => {
|
|
127
114
|
const animateEvents = this._generateAnimateEvents(child, this.props);
|
|
128
115
|
|
|
129
|
-
return /*#__PURE__*/cloneElement(child,
|
|
116
|
+
return /*#__PURE__*/cloneElement(child, Object.assign({
|
|
130
117
|
className: classnames(child.props.className, animateCls),
|
|
131
|
-
style:
|
|
118
|
+
style: Object.assign(Object.assign({}, child.props.style), this.props.style)
|
|
132
119
|
}, animateEvents));
|
|
133
120
|
});
|
|
134
121
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
|
-
|
|
6
1
|
var __rest = this && this.__rest || function (s, e) {
|
|
7
2
|
var t = {};
|
|
8
3
|
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
10
5
|
|
|
11
|
-
if (s != null && typeof
|
|
12
|
-
if (
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
8
|
}
|
|
14
9
|
return t;
|
|
15
10
|
};
|
|
@@ -25,11 +20,7 @@ export default class StyledTransition extends Component {
|
|
|
25
20
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
21
|
super(props);
|
|
27
22
|
|
|
28
|
-
this._isControlled = () =>
|
|
29
|
-
var _context;
|
|
30
|
-
|
|
31
|
-
return _includesInstanceProperty(_context = [true, false, 'enter', 'leave']).call(_context, this.props.state);
|
|
32
|
-
};
|
|
23
|
+
this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
|
|
33
24
|
|
|
34
25
|
this.onRest = props => {
|
|
35
26
|
const {
|
|
@@ -132,7 +123,7 @@ export default class StyledTransition extends Component {
|
|
|
132
123
|
}
|
|
133
124
|
}
|
|
134
125
|
|
|
135
|
-
return /*#__PURE__*/React.createElement(StyledAnimation,
|
|
126
|
+
return /*#__PURE__*/React.createElement(StyledAnimation, Object.assign({}, restProps, {
|
|
136
127
|
type: type,
|
|
137
128
|
onStart: this.onStart,
|
|
138
129
|
onRest: this.onRest
|
package/lib/es/src/Transition.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
|
-
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
|
-
|
|
6
1
|
var __rest = this && this.__rest || function (s, e) {
|
|
7
2
|
var t = {};
|
|
8
3
|
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
10
5
|
|
|
11
|
-
if (s != null && typeof
|
|
12
|
-
if (
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
8
|
}
|
|
14
9
|
return t;
|
|
15
10
|
};
|
|
@@ -25,11 +20,7 @@ export default class Transition extends Component {
|
|
|
25
20
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
21
|
super(props);
|
|
27
22
|
|
|
28
|
-
this._isControlled = () =>
|
|
29
|
-
var _context;
|
|
30
|
-
|
|
31
|
-
return _includesInstanceProperty(_context = [true, false, 'enter', 'leave']).call(_context, this.props.state);
|
|
32
|
-
};
|
|
23
|
+
this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
|
|
33
24
|
|
|
34
25
|
this.forwardInstance = instance => {
|
|
35
26
|
this.instance = instance;
|
|
@@ -147,7 +138,7 @@ export default class Transition extends Component {
|
|
|
147
138
|
}
|
|
148
139
|
}
|
|
149
140
|
|
|
150
|
-
return /*#__PURE__*/React.createElement(Animation,
|
|
141
|
+
return /*#__PURE__*/React.createElement(Animation, Object.assign({}, restProps, {
|
|
151
142
|
force: true,
|
|
152
143
|
from: from,
|
|
153
144
|
to: to,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
2
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
1
|
export default function invokeFns(fns) {
|
|
4
2
|
let args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
5
3
|
|
|
6
|
-
if (
|
|
7
|
-
|
|
4
|
+
if (Array.isArray(fns) && fns.length) {
|
|
5
|
+
fns.forEach(fn => {
|
|
8
6
|
if (typeof fn === 'function') {
|
|
9
7
|
fn(...args);
|
|
10
8
|
}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
2
|
-
|
|
3
1
|
/* eslint-disable eqeqeq */
|
|
4
2
|
export function upperCase(str, pos) {
|
|
5
3
|
if (typeof str === 'string') {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return _reduceInstanceProperty(_context = str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
return str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9
5
|
// @ts-ignore
|
|
10
|
-
.split()
|
|
6
|
+
.split().reduce((total, cur, index) => pos == null || pos === index ? total + cur.toUpperCase() : total + cur, '');
|
|
11
7
|
}
|
|
12
8
|
|
|
13
9
|
return str;
|
|
14
10
|
}
|
|
15
11
|
export function lowerCase(str, pos) {
|
|
16
12
|
if (typeof str === 'string') {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return _reduceInstanceProperty(_context2 = str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
|
+
return str // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
14
|
// @ts-ignore
|
|
21
|
-
.split()
|
|
15
|
+
.split().reduce((total, cur, index) => pos == null || pos === index ? total + cur.toLowerCase() : total + cur, '');
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
return str;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-animation-react",
|
|
3
|
-
"version": "2.19.0
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "motion library for semi-ui-react",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"motion",
|
|
@@ -25,14 +25,11 @@
|
|
|
25
25
|
"prepublishOnly": "npm run build:lib"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@babel/runtime-corejs3": "^7.15.4",
|
|
29
28
|
"@douyinfe/semi-animation": "2.12.0",
|
|
30
|
-
"@douyinfe/semi-animation-styled": "2.19.0
|
|
29
|
+
"@douyinfe/semi-animation-styled": "2.19.0",
|
|
31
30
|
"classnames": "^2.2.6"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
35
|
-
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
36
33
|
"@babel/preset-env": "^7.15.8",
|
|
37
34
|
"@babel/preset-react": "^7.14.5",
|
|
38
35
|
"@storybook/addon-knobs": "^6.3.1",
|
|
@@ -46,5 +43,5 @@
|
|
|
46
43
|
"prop-types": "15.7.2",
|
|
47
44
|
"react-storybook-addon-props-combinations": "^1.1.0"
|
|
48
45
|
},
|
|
49
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "c0ef56c31a5c13adb050fbdb611e51da881f0cb8"
|
|
50
47
|
}
|