@douyinfe/semi-animation-react 2.86.0 → 2.87.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.
@@ -12,8 +12,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
12
12
  /* eslint-disable @typescript-eslint/ban-types */
13
13
 
14
14
  class Animation extends _react.PureComponent {
15
- constructor() {
16
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
+ constructor(props = {}) {
17
16
  super(props);
18
17
  this.initAnimation = props => {
19
18
  props = props == null ? this.props : props;
@@ -122,8 +121,7 @@ class Animation extends _react.PureComponent {
122
121
  this.animation = null;
123
122
  }
124
123
  }
125
- componentDidUpdate() {
126
- let prevProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
124
+ componentDidUpdate(prevProps = {}) {
127
125
  if (this.props.reset) {
128
126
  if (this.props.from !== prevProps.from || this.props.to !== prevProps.to) {
129
127
  this.destroy();
@@ -9,19 +9,14 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _noop = _interopRequireDefault(require("./utils/noop"));
10
10
  var _Animation = _interopRequireDefault(require("./Animation"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
13
  class KeyFrames extends _react.Component {
15
- constructor() {
16
- var _this;
17
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+ constructor(props = {}) {
18
15
  super(props);
19
- _this = this;
20
- this.onFrame = function () {
21
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
+ this.onFrame = (props = {}) => {
22
17
  const currentStyle = Object.assign({}, props);
23
- _this.props.onFrame(currentStyle);
24
- _this.setState({
18
+ this.props.onFrame(currentStyle);
19
+ this.setState({
25
20
  currentStyle
26
21
  });
27
22
  };
@@ -13,50 +13,17 @@ var _invokeFns = _interopRequireDefault(require("./utils/invokeFns"));
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  const types = Object.values(_semiAnimationStyled.types).reduce((arr, cur) => [...arr, ...cur], []);
15
15
  class StyledAnimation extends _react.PureComponent {
16
- constructor() {
17
- var _this;
18
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
+ constructor(props = {}) {
19
17
  super(props);
20
- _this = this;
21
- this._generateAnimateEvents = function (child) {
22
- let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23
- return {
24
- onAnimationIteration: function () {
25
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
- args[_key] = arguments[_key];
27
- }
28
- return (0, _invokeFns.default)([child && child.props && child.props.onAnimationIteration, props.onFrame], args);
29
- },
30
- onAnimationStart: function () {
31
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
32
- args[_key2] = arguments[_key2];
33
- }
34
- return (0, _invokeFns.default)([child && child.props && child.props.onAnimationStart, props.onStart], args);
35
- },
36
- onAnimationEnd: function () {
37
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
38
- args[_key3] = arguments[_key3];
39
- }
40
- return (0, _invokeFns.default)([child && child.props && child.props.onAnimationEnd, props.onRest], args);
41
- }
42
- };
43
- };
44
- this._hasSpeedClass = function () {
45
- let speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.speed;
46
- return speed != null && _semiAnimationStyled.speeds.includes(speed);
47
- };
48
- this._hasTypeClass = function () {
49
- let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.type;
50
- return type != null && types.includes(type);
51
- };
52
- this._hasDelayClass = function () {
53
- let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.delay;
54
- return delay != null && _semiAnimationStyled.delays.includes(delay);
55
- };
56
- this._hasLoopClass = function () {
57
- let loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.loop;
58
- return loop != null && _semiAnimationStyled.loops.includes(loop);
59
- };
18
+ this._generateAnimateEvents = (child, props = {}) => ({
19
+ onAnimationIteration: (...args) => (0, _invokeFns.default)([child && child.props && child.props.onAnimationIteration, props.onFrame], args),
20
+ onAnimationStart: (...args) => (0, _invokeFns.default)([child && child.props && child.props.onAnimationStart, props.onStart], args),
21
+ onAnimationEnd: (...args) => (0, _invokeFns.default)([child && child.props && child.props.onAnimationEnd, props.onRest], args)
22
+ });
23
+ this._hasSpeedClass = (speed = this.props.speed) => speed != null && _semiAnimationStyled.speeds.includes(speed);
24
+ this._hasTypeClass = (type = this.props.type) => type != null && types.includes(type);
25
+ this._hasDelayClass = (delay = this.props.delay) => delay != null && _semiAnimationStyled.delays.includes(delay);
26
+ this._hasLoopClass = (loop = this.props.loop) => loop != null && _semiAnimationStyled.loops.includes(loop);
60
27
  }
61
28
  render() {
62
29
  let {
@@ -9,8 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _StyledAnimation = _interopRequireDefault(require("./StyledAnimation"));
10
10
  var _noop = _interopRequireDefault(require("./utils/noop"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
13
  var __rest = void 0 && (void 0).__rest || function (s, e) {
15
14
  var t = {};
16
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -20,8 +19,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
20
19
  return t;
21
20
  };
22
21
  class StyledTransition extends _react.Component {
23
- constructor() {
24
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
+ constructor(props = {}) {
25
23
  super(props);
26
24
  this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
27
25
  this.onRest = props => {
@@ -8,8 +8,7 @@ var _Animation = _interopRequireDefault(require("./Animation"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _noop = _interopRequireDefault(require("./utils/noop"));
11
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
13
  var __rest = void 0 && (void 0).__rest || function (s, e) {
15
14
  var t = {};
@@ -20,8 +19,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
20
19
  return t;
21
20
  };
22
21
  class Transition extends _react.Component {
23
- constructor() {
24
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
+ constructor(props = {}) {
25
23
  super(props);
26
24
  this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
27
25
  this.forwardInstance = instance => {
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = invokeFns;
7
- function invokeFns(fns) {
8
- let args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
7
+ function invokeFns(fns, args = []) {
9
8
  if (Array.isArray(fns) && fns.length) {
10
9
  fns.forEach(fn => {
11
10
  if (typeof fn === 'function') {
@@ -4,8 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { Animation as SemiAnimation, events } from '@douyinfe/semi-animation';
5
5
  import noop from './utils/noop';
6
6
  export default class Animation extends PureComponent {
7
- constructor() {
8
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ constructor(props = {}) {
9
8
  super(props);
10
9
  this.initAnimation = props => {
11
10
  props = props == null ? this.props : props;
@@ -114,8 +113,7 @@ export default class Animation extends PureComponent {
114
113
  this.animation = null;
115
114
  }
116
115
  }
117
- componentDidUpdate() {
118
- let prevProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
116
+ componentDidUpdate(prevProps = {}) {
119
117
  if (this.props.reset) {
120
118
  if (this.props.from !== prevProps.from || this.props.to !== prevProps.to) {
121
119
  this.destroy();
@@ -3,16 +3,12 @@ import PropTypes from 'prop-types';
3
3
  import noop from './utils/noop';
4
4
  import Animation from './Animation';
5
5
  export default class KeyFrames extends Component {
6
- constructor() {
7
- var _this;
8
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
+ constructor(props = {}) {
9
7
  super(props);
10
- _this = this;
11
- this.onFrame = function () {
12
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
+ this.onFrame = (props = {}) => {
13
9
  const currentStyle = Object.assign({}, props);
14
- _this.props.onFrame(currentStyle);
15
- _this.setState({
10
+ this.props.onFrame(currentStyle);
11
+ this.setState({
16
12
  currentStyle
17
13
  });
18
14
  };
@@ -6,50 +6,17 @@ import noop from './utils/noop';
6
6
  import invokeFns from './utils/invokeFns';
7
7
  const types = Object.values(styledTypes).reduce((arr, cur) => [...arr, ...cur], []);
8
8
  export default class StyledAnimation extends PureComponent {
9
- constructor() {
10
- var _this;
11
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
+ constructor(props = {}) {
12
10
  super(props);
13
- _this = this;
14
- this._generateAnimateEvents = function (child) {
15
- let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16
- return {
17
- onAnimationIteration: function () {
18
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
- args[_key] = arguments[_key];
20
- }
21
- return invokeFns([child && child.props && child.props.onAnimationIteration, props.onFrame], args);
22
- },
23
- onAnimationStart: function () {
24
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
25
- args[_key2] = arguments[_key2];
26
- }
27
- return invokeFns([child && child.props && child.props.onAnimationStart, props.onStart], args);
28
- },
29
- onAnimationEnd: function () {
30
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
31
- args[_key3] = arguments[_key3];
32
- }
33
- return invokeFns([child && child.props && child.props.onAnimationEnd, props.onRest], args);
34
- }
35
- };
36
- };
37
- this._hasSpeedClass = function () {
38
- let speed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.speed;
39
- return speed != null && speeds.includes(speed);
40
- };
41
- this._hasTypeClass = function () {
42
- let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.type;
43
- return type != null && types.includes(type);
44
- };
45
- this._hasDelayClass = function () {
46
- let delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.delay;
47
- return delay != null && delays.includes(delay);
48
- };
49
- this._hasLoopClass = function () {
50
- let loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.loop;
51
- return loop != null && loops.includes(loop);
52
- };
11
+ this._generateAnimateEvents = (child, props = {}) => ({
12
+ onAnimationIteration: (...args) => invokeFns([child && child.props && child.props.onAnimationIteration, props.onFrame], args),
13
+ onAnimationStart: (...args) => invokeFns([child && child.props && child.props.onAnimationStart, props.onStart], args),
14
+ onAnimationEnd: (...args) => invokeFns([child && child.props && child.props.onAnimationEnd, props.onRest], args)
15
+ });
16
+ this._hasSpeedClass = (speed = this.props.speed) => speed != null && speeds.includes(speed);
17
+ this._hasTypeClass = (type = this.props.type) => type != null && types.includes(type);
18
+ this._hasDelayClass = (delay = this.props.delay) => delay != null && delays.includes(delay);
19
+ this._hasLoopClass = (loop = this.props.loop) => loop != null && loops.includes(loop);
53
20
  }
54
21
  render() {
55
22
  let {
@@ -11,8 +11,7 @@ import PropTypes from 'prop-types';
11
11
  import StyledAnimation from './StyledAnimation';
12
12
  import noop from './utils/noop';
13
13
  export default class StyledTransition extends Component {
14
- constructor() {
15
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+ constructor(props = {}) {
16
15
  super(props);
17
16
  this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
18
17
  this.onRest = props => {
@@ -11,8 +11,7 @@ import PropTypes from 'prop-types';
11
11
  import React, { Component, isValidElement } from 'react';
12
12
  import noop from './utils/noop';
13
13
  export default class Transition extends Component {
14
- constructor() {
15
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
+ constructor(props = {}) {
16
15
  super(props);
17
16
  this._isControlled = () => [true, false, 'enter', 'leave'].includes(this.props.state);
18
17
  this.forwardInstance = instance => {
@@ -1,5 +1,4 @@
1
- export default function invokeFns(fns) {
2
- let args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1
+ export default function invokeFns(fns, args = []) {
3
2
  if (Array.isArray(fns) && fns.length) {
4
3
  fns.forEach(fn => {
5
4
  if (typeof fn === 'function') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-animation-react",
3
- "version": "2.86.0",
3
+ "version": "2.87.0-alpha.1",
4
4
  "description": "motion library for semi-ui-react",
5
5
  "keywords": [
6
6
  "motion",
@@ -25,8 +25,8 @@
25
25
  "prepublishOnly": "npm run build:lib"
26
26
  },
27
27
  "dependencies": {
28
- "@douyinfe/semi-animation": "2.86.0",
29
- "@douyinfe/semi-animation-styled": "2.86.0",
28
+ "@douyinfe/semi-animation": "2.87.0-alpha.1",
29
+ "@douyinfe/semi-animation-styled": "2.87.0-alpha.1",
30
30
  "classnames": "^2.2.6"
31
31
  },
32
32
  "devDependencies": {
@@ -42,5 +42,5 @@
42
42
  "prop-types": "^15.7.2",
43
43
  "react-storybook-addon-props-combinations": "^1.1.0"
44
44
  },
45
- "gitHead": "772a43ea321ffc267e322f9c14d1b65eec9ea834"
45
+ "gitHead": "a79f41ec82da286cf7fee91938342ad1a750d42a"
46
46
  }