@douyinfe/semi-animation-react 2.60.0 → 2.61.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/lib/cjs/index.js +1 -1
- package/lib/cjs/src/Animation.js +1 -1
- package/lib/cjs/src/KeyFrames.d.ts +1 -1
- package/lib/cjs/src/KeyFrames.js +3 -3
- package/lib/cjs/src/StyledAnimation.js +1 -1
- package/lib/cjs/src/StyledTransition.d.ts +1 -1
- package/lib/cjs/src/StyledTransition.js +3 -3
- package/lib/cjs/src/Transition.d.ts +1 -1
- package/lib/cjs/src/Transition.js +3 -3
- package/lib/es/src/KeyFrames.d.ts +1 -1
- package/lib/es/src/StyledTransition.d.ts +1 -1
- package/lib/es/src/Transition.d.ts +1 -1
- package/package.json +4 -4
- package/README.md +0 -70
package/lib/cjs/index.js
CHANGED
|
@@ -51,4 +51,4 @@ var _Animation = _interopRequireDefault(require("./src/Animation"));
|
|
|
51
51
|
var _KeyFrames = _interopRequireDefault(require("./src/KeyFrames"));
|
|
52
52
|
var _Transition = _interopRequireDefault(require("./src/Transition"));
|
|
53
53
|
var _semiAnimation = require("@douyinfe/semi-animation");
|
|
54
|
-
function _interopRequireDefault(
|
|
54
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/lib/cjs/src/Animation.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _semiAnimation = require("@douyinfe/semi-animation");
|
|
10
10
|
var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
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 {
|
package/lib/cjs/src/KeyFrames.js
CHANGED
|
@@ -8,9 +8,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
10
10
|
var _Animation = _interopRequireDefault(require("./Animation"));
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
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; }
|
|
14
14
|
class KeyFrames extends _react.Component {
|
|
15
15
|
constructor() {
|
|
16
16
|
var _this;
|
|
@@ -10,7 +10,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _semiAnimationStyled = require("@douyinfe/semi-animation-styled");
|
|
11
11
|
var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
12
12
|
var _invokeFns = _interopRequireDefault(require("./utils/invokeFns"));
|
|
13
|
-
function _interopRequireDefault(
|
|
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
16
|
constructor() {
|
|
@@ -8,9 +8,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _StyledAnimation = _interopRequireDefault(require("./StyledAnimation"));
|
|
10
10
|
var _noop = _interopRequireDefault(require("./utils/noop"));
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
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; }
|
|
14
14
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
15
15
|
var t = {};
|
|
16
16
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -8,9 +8,9 @@ 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(
|
|
12
|
-
function _interopRequireWildcard(
|
|
13
|
-
function _interopRequireDefault(
|
|
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; }
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
15
15
|
var t = {};
|
|
16
16
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-animation-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.61.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.
|
|
29
|
-
"@douyinfe/semi-animation-styled": "2.
|
|
28
|
+
"@douyinfe/semi-animation": "2.61.0-alpha.1",
|
|
29
|
+
"@douyinfe/semi-animation-styled": "2.61.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": "
|
|
45
|
+
"gitHead": "ba06de12d059c24363f1ef151dbf4076ea3969a5"
|
|
46
46
|
}
|
package/README.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
> React animation library based on `@douyinfe/semi-animation`.
|
|
2
|
-
|
|
3
|
-
The transition animation effects of all components in `@douyinfe/semi-ui` are implemented based on this animation library, such as: Modal, Tooltip, Collapse and other component content display and exit effects.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm install @douyinfe/semi-animation-react
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Transition Component
|
|
14
|
-
|
|
15
|
-
It is used to realize the animation effect of the component [show and exit]. Examples are as follows:
|
|
16
|
-
|
|
17
|
-
```jsx
|
|
18
|
-
import { Transition } from "@douyinfe/semi-animation-react";
|
|
19
|
-
import { useState } from "react";
|
|
20
|
-
|
|
21
|
-
export default function App() {
|
|
22
|
-
const [visible, setVisible] = useState(false);
|
|
23
|
-
return (
|
|
24
|
-
<div className="App">
|
|
25
|
-
<Transition
|
|
26
|
-
state={visible ? "enter" : "leave"}
|
|
27
|
-
from={{ opacity: 0, scale: 0}}
|
|
28
|
-
enter={{ opacity: 1, scale: 1 }}
|
|
29
|
-
leave={{ opacity: 0, scale: 0 }}
|
|
30
|
-
>
|
|
31
|
-
{({ scale, opacity }: any) => (
|
|
32
|
-
<h2 style={{transform: `scale(${scale})`, opacity}}>
|
|
33
|
-
Toggle to see some animation happen!
|
|
34
|
-
</h2>
|
|
35
|
-
)}
|
|
36
|
-
</Transition>
|
|
37
|
-
|
|
38
|
-
<button onClick={() => {
|
|
39
|
-
setVisible((state) => !state)
|
|
40
|
-
}}>toggle</button>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Props
|
|
47
|
-
|
|
48
|
-
|Name|Type|Required|Default|Description|
|
|
49
|
-
|--|--|--|--|--|
|
|
50
|
-
|from|Object|Y||Initial state|
|
|
51
|
-
|enter|Object|Y||Show the end state of the animation, but also the initial state of the exit animation|
|
|
52
|
-
|leave|Object|Y||Exit the termination state of the animation|
|
|
53
|
-
|state|Enum 'enter', 'leave'|N|''|Current state|
|
|
54
|
-
|willEnter|Function|N|()=> {}|The callback function before the enter animation starts|
|
|
55
|
-
|didEnter|Function|N|()=> {}|The callback function before the animation ends|
|
|
56
|
-
|willLeave|Function|N|()=> {}|The callback function before the exit animation starts |
|
|
57
|
-
|didLeave|Function|N|()=> {}|The callback function before the exit animation ends|
|
|
58
|
-
|onStart|Function|N|()=> {}|The callback function before animation starts,including enter and exit|
|
|
59
|
-
|onRest|Function|N|()=> {}|The callback function before animation ends,including enter and exit|
|
|
60
|
-
|config|ConfigType|N|{}|Additional animation parameters|
|
|
61
|
-
|
|
62
|
-
### config
|
|
63
|
-
|
|
64
|
-
|Name|Type|Default|Description|
|
|
65
|
-
|--|--|--|--|
|
|
66
|
-
|duration|Number|1000|Animation duration.If this parameter is passed in, the easing function of the animation will use easing or linear function,unit: ms|
|
|
67
|
-
| easing | Function\|String | | Easing function for animation. If duration is not passed, the spring easing function is used by default. If the duration parameter is passed in, the linear easing function will be used by default.For example, incoming `"cubic-bezier(.17,.67,.83,.67)"` will cause the animation frame update performed according to this easing function |
|
|
68
|
-
| tension | Number | 170 | Tension, used for spring easing function |
|
|
69
|
-
| friction | Number | 14 | Friction, used for spring easing function |
|
|
70
|
-
|