first commit
This commit is contained in:
259
node_modules/react-smooth/CHANGELOG.md
generated
vendored
Normal file
259
node_modules/react-smooth/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
## 3.0.0 / 2023-10-18
|
||||
|
||||
### refactor / chore
|
||||
|
||||
- upgrade dependencies
|
||||
|
||||
# BREAKING CHANGE
|
||||
|
||||
Remove some unused/unneeded code which drops support for older browser versions. Results in slightly decreased bundle size.
|
||||
|
||||
- remove unneeded polyfill for translateStyle - [browser support since 2017](https://caniuse.com/?search=transforms)
|
||||
- remove unneeded polyfill for `Number.isFinite` - [browser support since 2015](https://caniuse.com/?search=Number.isFinite) AND polyfilled by babel/core-js
|
||||
|
||||
## 2.0.5 / 2023-10-10
|
||||
|
||||
### fix
|
||||
|
||||
- Check if `requestAnimationFrame` is defined in shouldUpdate
|
||||
|
||||
## 2.0.4 / 2023-09-12
|
||||
|
||||
### fix
|
||||
|
||||
- call `onAnimationEnd` on unmount
|
||||
|
||||
## 2.0.3 / 2023-05-08
|
||||
|
||||
### fix
|
||||
|
||||
- treat `duration={0}` as if animation is not active by doing a check and returning early. This fixes a bug where NaN can cause a crash in the browser.
|
||||
|
||||
## 2.0.2 / 2023-02-23
|
||||
|
||||
### chore
|
||||
|
||||
- upgrade `fast-equals` to latest. No breaking changes - see https://github.com/planttheidea/fast-equals/blob/master/CHANGELOG.md
|
||||
- don't upgrade `react-transition-group` in minor release as this requires dropping support for react <16.6
|
||||
- upgrade devDependencies
|
||||
- update babel config
|
||||
- update deprecated eslint parser
|
||||
|
||||
## 2.0.1 / 2022-06-27
|
||||
|
||||
### feat
|
||||
|
||||
- feat: allow React 18
|
||||
- Remove raf polyfill for IE9
|
||||
|
||||
## 2.0.0 / 2021-03-21
|
||||
|
||||
### chore (#48)
|
||||
|
||||
- Changed peerDeps to react 15,16,17
|
||||
- Removed karma,chai,enzyme blablabla... and used only Jest and Testing-Library.
|
||||
- Updated devDependencies and cleared some.
|
||||
|
||||
## 1.0.2 / 2018-10-02
|
||||
|
||||
### fix
|
||||
|
||||
- fix babelrc
|
||||
|
||||
## 1.0.1 / 2018-10-02
|
||||
|
||||
### fix
|
||||
|
||||
- update babel, webpack, karma, etc.
|
||||
- fix import error
|
||||
|
||||
## 1.0.0 / 2017-11-06
|
||||
|
||||
### feat
|
||||
|
||||
- Support React 16
|
||||
|
||||
## 0.1.17 / 2016-12-02
|
||||
|
||||
### fix
|
||||
|
||||
- change scripts
|
||||
|
||||
## 0.1.16 / 2016-11-25
|
||||
|
||||
### fix
|
||||
|
||||
- update lodash
|
||||
|
||||
## 0.1.15 / 2016-10-31
|
||||
|
||||
### fix
|
||||
|
||||
- fix isMounted to mounted
|
||||
|
||||
## 0.1.14 / 2016-10-28
|
||||
|
||||
### fix
|
||||
|
||||
- fix: judge isMounted
|
||||
|
||||
## 0.1.12-0.1.13 / 2016-10-27
|
||||
|
||||
### fix
|
||||
|
||||
- fix script
|
||||
|
||||
## 0.1.10 / 2016-07-07
|
||||
|
||||
### fix
|
||||
|
||||
- add onAnimationReStart validation
|
||||
|
||||
## 0.1.8-0.1.9 / 2016-05-05
|
||||
|
||||
### feat
|
||||
|
||||
- add onAniamtionStart prop
|
||||
|
||||
## 0.1.7 / 2016-04-21
|
||||
|
||||
### fix
|
||||
|
||||
- fix Animate trigger animate when isActive is false
|
||||
|
||||
## 0.1.6 / 2016-04-15
|
||||
|
||||
### fix
|
||||
|
||||
- fix Animate not pipe props when Animate not active
|
||||
|
||||
## 0.1.5 / 2016-04-13
|
||||
|
||||
### fix
|
||||
|
||||
- remove pure-render-decorator
|
||||
|
||||
## 0.1.4 / 2016-04-12
|
||||
|
||||
### fix
|
||||
|
||||
- change transition-group addons to dependencies
|
||||
|
||||
## 0.1.3 / 2016-04-12
|
||||
|
||||
### refactor
|
||||
|
||||
- refactor AnimateManager
|
||||
|
||||
## 0.1.2 / 2016-04-12
|
||||
|
||||
### feat
|
||||
|
||||
- use owe PureRender util
|
||||
|
||||
### fix
|
||||
|
||||
- update react to 15.0.0
|
||||
|
||||
## 0.1.1 / 2016-04-05
|
||||
|
||||
### feat
|
||||
|
||||
- add shouldReAnimate prop
|
||||
|
||||
## 0.1.0 / 2016-03-16
|
||||
|
||||
### feat
|
||||
|
||||
- use webpack 2
|
||||
|
||||
## 0.0.13-0.0.15 / 2016-03-15
|
||||
|
||||
### fix
|
||||
|
||||
- using isEqual in lodash and remove isEqual in utils
|
||||
|
||||
## 0.0.13-0.0.14 / 2016-03-15
|
||||
|
||||
### fix
|
||||
|
||||
- fix update animation judgement
|
||||
|
||||
## 0.0.12 / 2016-03-15
|
||||
|
||||
### fix
|
||||
|
||||
- fix compatable prefix in transition property
|
||||
|
||||
### refactor
|
||||
|
||||
- refactor some function in utils
|
||||
- using JSX instead of createElement
|
||||
|
||||
## 0.0.11 / 2016-03-01
|
||||
|
||||
### fix
|
||||
|
||||
- fix haven't unsubscribe handleStyleChange
|
||||
|
||||
## 0.0.10 / 2016-02-17
|
||||
|
||||
### refactor
|
||||
|
||||
- remove lodash compose method
|
||||
- refactor configUpdate.js
|
||||
|
||||
## 0.0.9 / 2016-02-05
|
||||
|
||||
### fix
|
||||
|
||||
- fix don't build on npm publish
|
||||
|
||||
## 0.0.8 / 2016-02-05
|
||||
|
||||
### fix
|
||||
|
||||
- fix lodash minify problem
|
||||
|
||||
## 0.0.7 / 2016-02-04
|
||||
|
||||
### fix
|
||||
|
||||
- optimize npm script commands
|
||||
|
||||
## 0.0.6 / 2016-02-04
|
||||
|
||||
### fix
|
||||
|
||||
- set min time longer
|
||||
|
||||
## 0.0.5 / 2016-02-04
|
||||
|
||||
### fix
|
||||
|
||||
- fix animation not valid for set css styles too quick.
|
||||
|
||||
## 0.0.4 / 2016-02-02
|
||||
|
||||
### fix
|
||||
|
||||
- support onAnimationEnd in js animation
|
||||
|
||||
## 0.0.3 / 2016-02-02
|
||||
|
||||
### refactor
|
||||
|
||||
- refactor the import path of lodash function
|
||||
- update webpack.config.js
|
||||
|
||||
## 0.0.2 / 2016-02-02
|
||||
|
||||
### feat
|
||||
|
||||
- support js animation
|
||||
- support bezier and spring timing function
|
||||
- support group animation
|
||||
|
||||
## 0.0.1 / 2016-01-21
|
||||
|
||||
- Init the project
|
||||
21
node_modules/react-smooth/LICENSE
generated
vendored
Normal file
21
node_modules/react-smooth/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 recharts
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
239
node_modules/react-smooth/README.md
generated
vendored
Normal file
239
node_modules/react-smooth/README.md
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
# react-smooth
|
||||
|
||||
react-smooth is a animation library work on React.
|
||||
|
||||
[](https://badge.fury.io/js/react-smooth)
|
||||
[](https://travis-ci.org/recharts/react-smooth)
|
||||
[](https://www.npmjs.com/package/react-smooth)
|
||||
[](https://gitter.im/recharts/react-smooth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
## install
|
||||
```
|
||||
npm install --save react-smooth
|
||||
```
|
||||
|
||||
## Usage
|
||||
simple animation
|
||||
|
||||
```jsx
|
||||
<Animate to="0" from="1" attributeName="opacity">
|
||||
<div />
|
||||
</Animate>
|
||||
```
|
||||
steps animation
|
||||
|
||||
```jsx
|
||||
const steps = [{
|
||||
style: {
|
||||
opacity: 0,
|
||||
},
|
||||
duration: 400,
|
||||
}, {
|
||||
style: {
|
||||
opacity: 1,
|
||||
transform: 'translate(0, 0)',
|
||||
},
|
||||
duration: 1000,
|
||||
}, {
|
||||
style: {
|
||||
transform: 'translate(100px, 100px)',
|
||||
},
|
||||
duration: 1200,
|
||||
}];
|
||||
|
||||
<Animate steps={steps}>
|
||||
<div />
|
||||
</Animate>
|
||||
```
|
||||
children can be a function
|
||||
|
||||
```jsx
|
||||
<Animate from={{ opacity: 0 }}
|
||||
to={{ opacity: 1 }}
|
||||
easing="ease-in"
|
||||
>
|
||||
{
|
||||
({ opacity }) => <div style={{ opacity }}></div>
|
||||
}
|
||||
</Animate>
|
||||
```
|
||||
|
||||
you can configure js timing function
|
||||
|
||||
```js
|
||||
const easing = configureBezier(0.1, 0.1, 0.5, 0.8);
|
||||
const easing = configureSpring({ stiff: 170, damping: 20 });
|
||||
```
|
||||
|
||||
group animation
|
||||
|
||||
```jsx
|
||||
const appear = {
|
||||
from: 0,
|
||||
to: 1,
|
||||
attributeName: 'opacity',
|
||||
};
|
||||
|
||||
const leave = {
|
||||
steps: [{
|
||||
style: {
|
||||
transform: 'translateX(0)',
|
||||
},
|
||||
}, {
|
||||
duration: 1000,
|
||||
style: {
|
||||
transform: 'translateX(300)',
|
||||
height: 50,
|
||||
},
|
||||
}, {
|
||||
duration: 2000,
|
||||
style: {
|
||||
height: 0,
|
||||
},
|
||||
}]
|
||||
}
|
||||
|
||||
<AnimateGroup appear={appear} leave={leave}>
|
||||
{ list }
|
||||
</AnimateGroup>
|
||||
|
||||
/*
|
||||
* @description: add compatible prefix in style
|
||||
*
|
||||
* style = { transform: xxx, ...others };
|
||||
*
|
||||
* translatedStyle = {
|
||||
* WebkitTransform: xxx,
|
||||
* MozTransform: xxx,
|
||||
* OTransform: xxx,
|
||||
* msTransform: xxx,
|
||||
* ...others,
|
||||
* };
|
||||
*/
|
||||
|
||||
const translatedStyle = translateStyle(style);
|
||||
|
||||
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Animate
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50px">name</th>
|
||||
<th style="width: 100px">type</th>
|
||||
<th style="width: 50px">default</th>
|
||||
<th style="width: 50px">description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>from</td>
|
||||
<td>string or object</td>
|
||||
<td>''</td>
|
||||
<td>set the initial style of the children</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>to</td>
|
||||
<td>string or object</td>
|
||||
<td>''</td>
|
||||
<td>set the final style of the children</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>canBegin</td>
|
||||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>whether the animation is start</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>begin</td>
|
||||
<td>number</td>
|
||||
<td>0</td>
|
||||
<td>animation delay time</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>duration</td>
|
||||
<td>number</td>
|
||||
<td>1000</td>
|
||||
<td>animation duration</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>steps</td>
|
||||
<td>array</td>
|
||||
<td>[]</td>
|
||||
<td>animation keyframes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onAnimationEnd</td>
|
||||
<td>function</td>
|
||||
<td>() => null</td>
|
||||
<td>called when animation finished</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>attributeName</td>
|
||||
<td>string</td>
|
||||
<td>''</td>
|
||||
<td>style property</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>easing</td>
|
||||
<td>string</td>
|
||||
<td>'ease'</td>
|
||||
<td>the animation timing function, support css timing function temporary</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>isActive</td>
|
||||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>whether the animation is active</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>children</td>
|
||||
<td>element</td>
|
||||
<td></td>
|
||||
<td>support only child temporary</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### AnimateGroup
|
||||
|
||||
<table class="table table-bordered table-striped animate-group">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40px">name</th>
|
||||
<th style="width: 40px">type</th>
|
||||
<th style="width: 40px">default</th>
|
||||
<th style="width: 100px">description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>appear</td>
|
||||
<td>object</td>
|
||||
<td>undefined</td>
|
||||
<td>configure element appear animation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>enter</td>
|
||||
<td>object</td>
|
||||
<td>undefined</td>
|
||||
<td>configure element appear animation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>leave</td>
|
||||
<td>object</td>
|
||||
<td>undefined</td>
|
||||
<td>configure element appear animation</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## License
|
||||
|
||||
[MIT](http://opensource.org/licenses/MIT)
|
||||
|
||||
Copyright (c) 2015-2021 Recharts Group
|
||||
354
node_modules/react-smooth/es6/Animate.js
generated
vendored
Normal file
354
node_modules/react-smooth/es6/Animate.js
generated
vendored
Normal file
@@ -0,0 +1,354 @@
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
var _excluded = ["children", "begin", "duration", "attributeName", "easing", "isActive", "steps", "from", "to", "canBegin", "onAnimationEnd", "shouldReAnimate", "onAnimationReStart"];
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
import React, { PureComponent, cloneElement, Children } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { deepEqual } from 'fast-equals';
|
||||
import createAnimateManager from './AnimateManager';
|
||||
import { configEasing } from './easing';
|
||||
import configUpdate from './configUpdate';
|
||||
import { getTransitionVal, identity } from './util';
|
||||
var Animate = /*#__PURE__*/function (_PureComponent) {
|
||||
_inherits(Animate, _PureComponent);
|
||||
var _super = _createSuper(Animate);
|
||||
function Animate(props, context) {
|
||||
var _this;
|
||||
_classCallCheck(this, Animate);
|
||||
_this = _super.call(this, props, context);
|
||||
var _this$props = _this.props,
|
||||
isActive = _this$props.isActive,
|
||||
attributeName = _this$props.attributeName,
|
||||
from = _this$props.from,
|
||||
to = _this$props.to,
|
||||
steps = _this$props.steps,
|
||||
children = _this$props.children,
|
||||
duration = _this$props.duration;
|
||||
_this.handleStyleChange = _this.handleStyleChange.bind(_assertThisInitialized(_this));
|
||||
_this.changeStyle = _this.changeStyle.bind(_assertThisInitialized(_this));
|
||||
if (!isActive || duration <= 0) {
|
||||
_this.state = {
|
||||
style: {}
|
||||
};
|
||||
|
||||
// if children is a function and animation is not active, set style to 'to'
|
||||
if (typeof children === 'function') {
|
||||
_this.state = {
|
||||
style: to
|
||||
};
|
||||
}
|
||||
return _possibleConstructorReturn(_this);
|
||||
}
|
||||
if (steps && steps.length) {
|
||||
_this.state = {
|
||||
style: steps[0].style
|
||||
};
|
||||
} else if (from) {
|
||||
if (typeof children === 'function') {
|
||||
_this.state = {
|
||||
style: from
|
||||
};
|
||||
return _possibleConstructorReturn(_this);
|
||||
}
|
||||
_this.state = {
|
||||
style: attributeName ? _defineProperty({}, attributeName, from) : from
|
||||
};
|
||||
} else {
|
||||
_this.state = {
|
||||
style: {}
|
||||
};
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
_createClass(Animate, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this$props2 = this.props,
|
||||
isActive = _this$props2.isActive,
|
||||
canBegin = _this$props2.canBegin;
|
||||
this.mounted = true;
|
||||
if (!isActive || !canBegin) {
|
||||
return;
|
||||
}
|
||||
this.runAnimation(this.props);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
var _this$props3 = this.props,
|
||||
isActive = _this$props3.isActive,
|
||||
canBegin = _this$props3.canBegin,
|
||||
attributeName = _this$props3.attributeName,
|
||||
shouldReAnimate = _this$props3.shouldReAnimate,
|
||||
to = _this$props3.to,
|
||||
currentFrom = _this$props3.from;
|
||||
var style = this.state.style;
|
||||
if (!canBegin) {
|
||||
return;
|
||||
}
|
||||
if (!isActive) {
|
||||
var newState = {
|
||||
style: attributeName ? _defineProperty({}, attributeName, to) : to
|
||||
};
|
||||
if (this.state && style) {
|
||||
if (attributeName && style[attributeName] !== to || !attributeName && style !== to) {
|
||||
// eslint-disable-next-line react/no-did-update-set-state
|
||||
this.setState(newState);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (deepEqual(prevProps.to, to) && prevProps.canBegin && prevProps.isActive) {
|
||||
return;
|
||||
}
|
||||
var isTriggered = !prevProps.canBegin || !prevProps.isActive;
|
||||
if (this.manager) {
|
||||
this.manager.stop();
|
||||
}
|
||||
if (this.stopJSAnimation) {
|
||||
this.stopJSAnimation();
|
||||
}
|
||||
var from = isTriggered || shouldReAnimate ? currentFrom : prevProps.to;
|
||||
if (this.state && style) {
|
||||
var _newState = {
|
||||
style: attributeName ? _defineProperty({}, attributeName, from) : from
|
||||
};
|
||||
if (attributeName && style[attributeName] !== from || !attributeName && style !== from) {
|
||||
// eslint-disable-next-line react/no-did-update-set-state
|
||||
this.setState(_newState);
|
||||
}
|
||||
}
|
||||
this.runAnimation(_objectSpread(_objectSpread({}, this.props), {}, {
|
||||
from: from,
|
||||
begin: 0
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
var onAnimationEnd = this.props.onAnimationEnd;
|
||||
if (this.unSubscribe) {
|
||||
this.unSubscribe();
|
||||
}
|
||||
if (this.manager) {
|
||||
this.manager.stop();
|
||||
this.manager = null;
|
||||
}
|
||||
if (this.stopJSAnimation) {
|
||||
this.stopJSAnimation();
|
||||
}
|
||||
if (onAnimationEnd) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "handleStyleChange",
|
||||
value: function handleStyleChange(style) {
|
||||
this.changeStyle(style);
|
||||
}
|
||||
}, {
|
||||
key: "changeStyle",
|
||||
value: function changeStyle(style) {
|
||||
if (this.mounted) {
|
||||
this.setState({
|
||||
style: style
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "runJSAnimation",
|
||||
value: function runJSAnimation(props) {
|
||||
var _this2 = this;
|
||||
var from = props.from,
|
||||
to = props.to,
|
||||
duration = props.duration,
|
||||
easing = props.easing,
|
||||
begin = props.begin,
|
||||
onAnimationEnd = props.onAnimationEnd,
|
||||
onAnimationStart = props.onAnimationStart;
|
||||
var startAnimation = configUpdate(from, to, configEasing(easing), duration, this.changeStyle);
|
||||
var finalStartAnimation = function finalStartAnimation() {
|
||||
_this2.stopJSAnimation = startAnimation();
|
||||
};
|
||||
this.manager.start([onAnimationStart, begin, finalStartAnimation, duration, onAnimationEnd]);
|
||||
}
|
||||
}, {
|
||||
key: "runStepAnimation",
|
||||
value: function runStepAnimation(props) {
|
||||
var _this3 = this;
|
||||
var steps = props.steps,
|
||||
begin = props.begin,
|
||||
onAnimationStart = props.onAnimationStart;
|
||||
var _steps$ = steps[0],
|
||||
initialStyle = _steps$.style,
|
||||
_steps$$duration = _steps$.duration,
|
||||
initialTime = _steps$$duration === void 0 ? 0 : _steps$$duration;
|
||||
var addStyle = function addStyle(sequence, nextItem, index) {
|
||||
if (index === 0) {
|
||||
return sequence;
|
||||
}
|
||||
var duration = nextItem.duration,
|
||||
_nextItem$easing = nextItem.easing,
|
||||
easing = _nextItem$easing === void 0 ? 'ease' : _nextItem$easing,
|
||||
style = nextItem.style,
|
||||
nextProperties = nextItem.properties,
|
||||
onAnimationEnd = nextItem.onAnimationEnd;
|
||||
var preItem = index > 0 ? steps[index - 1] : nextItem;
|
||||
var properties = nextProperties || Object.keys(style);
|
||||
if (typeof easing === 'function' || easing === 'spring') {
|
||||
return [].concat(_toConsumableArray(sequence), [_this3.runJSAnimation.bind(_this3, {
|
||||
from: preItem.style,
|
||||
to: style,
|
||||
duration: duration,
|
||||
easing: easing
|
||||
}), duration]);
|
||||
}
|
||||
var transition = getTransitionVal(properties, duration, easing);
|
||||
var newStyle = _objectSpread(_objectSpread(_objectSpread({}, preItem.style), style), {}, {
|
||||
transition: transition
|
||||
});
|
||||
return [].concat(_toConsumableArray(sequence), [newStyle, duration, onAnimationEnd]).filter(identity);
|
||||
};
|
||||
return this.manager.start([onAnimationStart].concat(_toConsumableArray(steps.reduce(addStyle, [initialStyle, Math.max(initialTime, begin)])), [props.onAnimationEnd]));
|
||||
}
|
||||
}, {
|
||||
key: "runAnimation",
|
||||
value: function runAnimation(props) {
|
||||
if (!this.manager) {
|
||||
this.manager = createAnimateManager();
|
||||
}
|
||||
var begin = props.begin,
|
||||
duration = props.duration,
|
||||
attributeName = props.attributeName,
|
||||
propsTo = props.to,
|
||||
easing = props.easing,
|
||||
onAnimationStart = props.onAnimationStart,
|
||||
onAnimationEnd = props.onAnimationEnd,
|
||||
steps = props.steps,
|
||||
children = props.children;
|
||||
var manager = this.manager;
|
||||
this.unSubscribe = manager.subscribe(this.handleStyleChange);
|
||||
if (typeof easing === 'function' || typeof children === 'function' || easing === 'spring') {
|
||||
this.runJSAnimation(props);
|
||||
return;
|
||||
}
|
||||
if (steps.length > 1) {
|
||||
this.runStepAnimation(props);
|
||||
return;
|
||||
}
|
||||
var to = attributeName ? _defineProperty({}, attributeName, propsTo) : propsTo;
|
||||
var transition = getTransitionVal(Object.keys(to), duration, easing);
|
||||
manager.start([onAnimationStart, begin, _objectSpread(_objectSpread({}, to), {}, {
|
||||
transition: transition
|
||||
}), duration, onAnimationEnd]);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props4 = this.props,
|
||||
children = _this$props4.children,
|
||||
begin = _this$props4.begin,
|
||||
duration = _this$props4.duration,
|
||||
attributeName = _this$props4.attributeName,
|
||||
easing = _this$props4.easing,
|
||||
isActive = _this$props4.isActive,
|
||||
steps = _this$props4.steps,
|
||||
from = _this$props4.from,
|
||||
to = _this$props4.to,
|
||||
canBegin = _this$props4.canBegin,
|
||||
onAnimationEnd = _this$props4.onAnimationEnd,
|
||||
shouldReAnimate = _this$props4.shouldReAnimate,
|
||||
onAnimationReStart = _this$props4.onAnimationReStart,
|
||||
others = _objectWithoutProperties(_this$props4, _excluded);
|
||||
var count = Children.count(children);
|
||||
// eslint-disable-next-line react/destructuring-assignment
|
||||
var stateStyle = this.state.style;
|
||||
if (typeof children === 'function') {
|
||||
return children(stateStyle);
|
||||
}
|
||||
if (!isActive || count === 0 || duration <= 0) {
|
||||
return children;
|
||||
}
|
||||
var cloneContainer = function cloneContainer(container) {
|
||||
var _container$props = container.props,
|
||||
_container$props$styl = _container$props.style,
|
||||
style = _container$props$styl === void 0 ? {} : _container$props$styl,
|
||||
className = _container$props.className;
|
||||
var res = /*#__PURE__*/cloneElement(container, _objectSpread(_objectSpread({}, others), {}, {
|
||||
style: _objectSpread(_objectSpread({}, style), stateStyle),
|
||||
className: className
|
||||
}));
|
||||
return res;
|
||||
};
|
||||
if (count === 1) {
|
||||
return cloneContainer(Children.only(children));
|
||||
}
|
||||
return /*#__PURE__*/React.createElement("div", null, Children.map(children, function (child) {
|
||||
return cloneContainer(child);
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
return Animate;
|
||||
}(PureComponent);
|
||||
Animate.displayName = 'Animate';
|
||||
Animate.defaultProps = {
|
||||
begin: 0,
|
||||
duration: 1000,
|
||||
from: '',
|
||||
to: '',
|
||||
attributeName: '',
|
||||
easing: 'ease',
|
||||
isActive: true,
|
||||
canBegin: true,
|
||||
steps: [],
|
||||
onAnimationEnd: function onAnimationEnd() {},
|
||||
onAnimationStart: function onAnimationStart() {}
|
||||
};
|
||||
Animate.propTypes = {
|
||||
from: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
||||
to: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
||||
attributeName: PropTypes.string,
|
||||
// animation duration
|
||||
duration: PropTypes.number,
|
||||
begin: PropTypes.number,
|
||||
easing: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
steps: PropTypes.arrayOf(PropTypes.shape({
|
||||
duration: PropTypes.number.isRequired,
|
||||
style: PropTypes.object.isRequired,
|
||||
easing: PropTypes.oneOfType([PropTypes.oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear']), PropTypes.func]),
|
||||
// transition css properties(dash case), optional
|
||||
properties: PropTypes.arrayOf('string'),
|
||||
onAnimationEnd: PropTypes.func
|
||||
})),
|
||||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
||||
isActive: PropTypes.bool,
|
||||
canBegin: PropTypes.bool,
|
||||
onAnimationEnd: PropTypes.func,
|
||||
// decide if it should reanimate with initial from style when props change
|
||||
shouldReAnimate: PropTypes.bool,
|
||||
onAnimationStart: PropTypes.func,
|
||||
onAnimationReStart: PropTypes.func
|
||||
};
|
||||
export default Animate;
|
||||
32
node_modules/react-smooth/es6/AnimateGroup.js
generated
vendored
Normal file
32
node_modules/react-smooth/es6/AnimateGroup.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import React, { Children } from 'react';
|
||||
import { TransitionGroup } from 'react-transition-group';
|
||||
import PropTypes from 'prop-types';
|
||||
import AnimateGroupChild from './AnimateGroupChild';
|
||||
function AnimateGroup(props) {
|
||||
var component = props.component,
|
||||
children = props.children,
|
||||
appear = props.appear,
|
||||
enter = props.enter,
|
||||
leave = props.leave;
|
||||
return /*#__PURE__*/React.createElement(TransitionGroup, {
|
||||
component: component
|
||||
}, Children.map(children, function (child, index) {
|
||||
return /*#__PURE__*/React.createElement(AnimateGroupChild, {
|
||||
appearOptions: appear,
|
||||
enterOptions: enter,
|
||||
leaveOptions: leave,
|
||||
key: "child-".concat(index) // eslint-disable-line
|
||||
}, child);
|
||||
}));
|
||||
}
|
||||
AnimateGroup.propTypes = {
|
||||
appear: PropTypes.object,
|
||||
enter: PropTypes.object,
|
||||
leave: PropTypes.object,
|
||||
children: PropTypes.oneOfType([PropTypes.array, PropTypes.element]),
|
||||
component: PropTypes.any
|
||||
};
|
||||
AnimateGroup.defaultProps = {
|
||||
component: 'span'
|
||||
};
|
||||
export default AnimateGroup;
|
||||
110
node_modules/react-smooth/es6/AnimateGroupChild.js
generated
vendored
Normal file
110
node_modules/react-smooth/es6/AnimateGroupChild.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
var _excluded = ["children", "appearOptions", "enterOptions", "leaveOptions"];
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
import React, { Component, Children } from 'react';
|
||||
import { Transition } from 'react-transition-group';
|
||||
import PropTypes from 'prop-types';
|
||||
import Animate from './Animate';
|
||||
var parseDurationOfSingleTransition = function parseDurationOfSingleTransition() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var steps = options.steps,
|
||||
duration = options.duration;
|
||||
if (steps && steps.length) {
|
||||
return steps.reduce(function (result, entry) {
|
||||
return result + (Number.isFinite(entry.duration) && entry.duration > 0 ? entry.duration : 0);
|
||||
}, 0);
|
||||
}
|
||||
if (Number.isFinite(duration)) {
|
||||
return duration;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
var AnimateGroupChild = /*#__PURE__*/function (_Component) {
|
||||
_inherits(AnimateGroupChild, _Component);
|
||||
var _super = _createSuper(AnimateGroupChild);
|
||||
function AnimateGroupChild() {
|
||||
var _this;
|
||||
_classCallCheck(this, AnimateGroupChild);
|
||||
_this = _super.call(this);
|
||||
_defineProperty(_assertThisInitialized(_this), "handleEnter", function (node, isAppearing) {
|
||||
var _this$props = _this.props,
|
||||
appearOptions = _this$props.appearOptions,
|
||||
enterOptions = _this$props.enterOptions;
|
||||
_this.handleStyleActive(isAppearing ? appearOptions : enterOptions);
|
||||
});
|
||||
_defineProperty(_assertThisInitialized(_this), "handleExit", function () {
|
||||
var leaveOptions = _this.props.leaveOptions;
|
||||
_this.handleStyleActive(leaveOptions);
|
||||
});
|
||||
_this.state = {
|
||||
isActive: false
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
_createClass(AnimateGroupChild, [{
|
||||
key: "handleStyleActive",
|
||||
value: function handleStyleActive(style) {
|
||||
if (style) {
|
||||
var onAnimationEnd = style.onAnimationEnd ? function () {
|
||||
style.onAnimationEnd();
|
||||
} : null;
|
||||
this.setState(_objectSpread(_objectSpread({}, style), {}, {
|
||||
onAnimationEnd: onAnimationEnd,
|
||||
isActive: true
|
||||
}));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "parseTimeout",
|
||||
value: function parseTimeout() {
|
||||
var _this$props2 = this.props,
|
||||
appearOptions = _this$props2.appearOptions,
|
||||
enterOptions = _this$props2.enterOptions,
|
||||
leaveOptions = _this$props2.leaveOptions;
|
||||
return parseDurationOfSingleTransition(appearOptions) + parseDurationOfSingleTransition(enterOptions) + parseDurationOfSingleTransition(leaveOptions);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
var _this$props3 = this.props,
|
||||
children = _this$props3.children,
|
||||
appearOptions = _this$props3.appearOptions,
|
||||
enterOptions = _this$props3.enterOptions,
|
||||
leaveOptions = _this$props3.leaveOptions,
|
||||
props = _objectWithoutProperties(_this$props3, _excluded);
|
||||
return /*#__PURE__*/React.createElement(Transition, _extends({}, props, {
|
||||
onEnter: this.handleEnter,
|
||||
onExit: this.handleExit,
|
||||
timeout: this.parseTimeout()
|
||||
}), function () {
|
||||
return /*#__PURE__*/React.createElement(Animate, _this2.state, Children.only(children));
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return AnimateGroupChild;
|
||||
}(Component);
|
||||
AnimateGroupChild.propTypes = {
|
||||
appearOptions: PropTypes.object,
|
||||
enterOptions: PropTypes.object,
|
||||
leaveOptions: PropTypes.object,
|
||||
children: PropTypes.element
|
||||
};
|
||||
export default AnimateGroupChild;
|
||||
60
node_modules/react-smooth/es6/AnimateManager.js
generated
vendored
Normal file
60
node_modules/react-smooth/es6/AnimateManager.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
import setRafTimeout from './setRafTimeout';
|
||||
export default function createAnimateManager() {
|
||||
var currStyle = {};
|
||||
var handleChange = function handleChange() {
|
||||
return null;
|
||||
};
|
||||
var shouldStop = false;
|
||||
var setStyle = function setStyle(_style) {
|
||||
if (shouldStop) {
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(_style)) {
|
||||
if (!_style.length) {
|
||||
return;
|
||||
}
|
||||
var styles = _style;
|
||||
var _styles = _toArray(styles),
|
||||
curr = _styles[0],
|
||||
restStyles = _styles.slice(1);
|
||||
if (typeof curr === 'number') {
|
||||
setRafTimeout(setStyle.bind(null, restStyles), curr);
|
||||
return;
|
||||
}
|
||||
setStyle(curr);
|
||||
setRafTimeout(setStyle.bind(null, restStyles));
|
||||
return;
|
||||
}
|
||||
if (_typeof(_style) === 'object') {
|
||||
currStyle = _style;
|
||||
handleChange(currStyle);
|
||||
}
|
||||
if (typeof _style === 'function') {
|
||||
_style();
|
||||
}
|
||||
};
|
||||
return {
|
||||
stop: function stop() {
|
||||
shouldStop = true;
|
||||
},
|
||||
start: function start(style) {
|
||||
shouldStop = false;
|
||||
setStyle(style);
|
||||
},
|
||||
subscribe: function subscribe(_handleChange) {
|
||||
handleChange = _handleChange;
|
||||
return function () {
|
||||
handleChange = function handleChange() {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
135
node_modules/react-smooth/es6/configUpdate.js
generated
vendored
Normal file
135
node_modules/react-smooth/es6/configUpdate.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
import { getIntersectionKeys, mapObject } from './util';
|
||||
var alpha = function alpha(begin, end, k) {
|
||||
return begin + (end - begin) * k;
|
||||
};
|
||||
var needContinue = function needContinue(_ref) {
|
||||
var from = _ref.from,
|
||||
to = _ref.to;
|
||||
return from !== to;
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: cal new from value and velocity in each stepper
|
||||
* @return: { [styleProperty]: { from, to, velocity } }
|
||||
*/
|
||||
var calStepperVals = function calStepperVals(easing, preVals, steps) {
|
||||
var nextStepVals = mapObject(function (key, val) {
|
||||
if (needContinue(val)) {
|
||||
var _easing = easing(val.from, val.to, val.velocity),
|
||||
_easing2 = _slicedToArray(_easing, 2),
|
||||
newX = _easing2[0],
|
||||
newV = _easing2[1];
|
||||
return _objectSpread(_objectSpread({}, val), {}, {
|
||||
from: newX,
|
||||
velocity: newV
|
||||
});
|
||||
}
|
||||
return val;
|
||||
}, preVals);
|
||||
if (steps < 1) {
|
||||
return mapObject(function (key, val) {
|
||||
if (needContinue(val)) {
|
||||
return _objectSpread(_objectSpread({}, val), {}, {
|
||||
velocity: alpha(val.velocity, nextStepVals[key].velocity, steps),
|
||||
from: alpha(val.from, nextStepVals[key].from, steps)
|
||||
});
|
||||
}
|
||||
return val;
|
||||
}, preVals);
|
||||
}
|
||||
return calStepperVals(easing, nextStepVals, steps - 1);
|
||||
};
|
||||
|
||||
// configure update function
|
||||
export default (function (from, to, easing, duration, render) {
|
||||
var interKeys = getIntersectionKeys(from, to);
|
||||
var timingStyle = interKeys.reduce(function (res, key) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, [from[key], to[key]]));
|
||||
}, {});
|
||||
var stepperStyle = interKeys.reduce(function (res, key) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, {
|
||||
from: from[key],
|
||||
velocity: 0,
|
||||
to: to[key]
|
||||
}));
|
||||
}, {});
|
||||
var cafId = -1;
|
||||
var preTime;
|
||||
var beginTime;
|
||||
var update = function update() {
|
||||
return null;
|
||||
};
|
||||
var getCurrStyle = function getCurrStyle() {
|
||||
return mapObject(function (key, val) {
|
||||
return val.from;
|
||||
}, stepperStyle);
|
||||
};
|
||||
var shouldStopAnimation = function shouldStopAnimation() {
|
||||
return !Object.values(stepperStyle).filter(needContinue).length;
|
||||
};
|
||||
|
||||
// stepper timing function like spring
|
||||
var stepperUpdate = function stepperUpdate(now) {
|
||||
if (!preTime) {
|
||||
preTime = now;
|
||||
}
|
||||
var deltaTime = now - preTime;
|
||||
var steps = deltaTime / easing.dt;
|
||||
stepperStyle = calStepperVals(easing, stepperStyle, steps);
|
||||
// get union set and add compatible prefix
|
||||
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), getCurrStyle(stepperStyle)));
|
||||
preTime = now;
|
||||
if (!shouldStopAnimation()) {
|
||||
cafId = requestAnimationFrame(update);
|
||||
}
|
||||
};
|
||||
|
||||
// t => val timing function like cubic-bezier
|
||||
var timingUpdate = function timingUpdate(now) {
|
||||
if (!beginTime) {
|
||||
beginTime = now;
|
||||
}
|
||||
var t = (now - beginTime) / duration;
|
||||
var currStyle = mapObject(function (key, val) {
|
||||
return alpha.apply(void 0, _toConsumableArray(val).concat([easing(t)]));
|
||||
}, timingStyle);
|
||||
|
||||
// get union set and add compatible prefix
|
||||
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), currStyle));
|
||||
if (t < 1) {
|
||||
cafId = requestAnimationFrame(update);
|
||||
} else {
|
||||
var finalStyle = mapObject(function (key, val) {
|
||||
return alpha.apply(void 0, _toConsumableArray(val).concat([easing(1)]));
|
||||
}, timingStyle);
|
||||
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), finalStyle));
|
||||
}
|
||||
};
|
||||
update = easing.isStepper ? stepperUpdate : timingUpdate;
|
||||
|
||||
// return start animation method
|
||||
return function () {
|
||||
requestAnimationFrame(update);
|
||||
|
||||
// return stop animation method
|
||||
return function () {
|
||||
cancelAnimationFrame(cafId);
|
||||
};
|
||||
};
|
||||
});
|
||||
178
node_modules/react-smooth/es6/easing.js
generated
vendored
Normal file
178
node_modules/react-smooth/es6/easing.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
import { warn } from './util';
|
||||
var ACCURACY = 1e-4;
|
||||
var cubicBezierFactor = function cubicBezierFactor(c1, c2) {
|
||||
return [0, 3 * c1, 3 * c2 - 6 * c1, 3 * c1 - 3 * c2 + 1];
|
||||
};
|
||||
var multyTime = function multyTime(params, t) {
|
||||
return params.map(function (param, i) {
|
||||
return param * Math.pow(t, i);
|
||||
}).reduce(function (pre, curr) {
|
||||
return pre + curr;
|
||||
});
|
||||
};
|
||||
var cubicBezier = function cubicBezier(c1, c2) {
|
||||
return function (t) {
|
||||
var params = cubicBezierFactor(c1, c2);
|
||||
return multyTime(params, t);
|
||||
};
|
||||
};
|
||||
var derivativeCubicBezier = function derivativeCubicBezier(c1, c2) {
|
||||
return function (t) {
|
||||
var params = cubicBezierFactor(c1, c2);
|
||||
var newParams = [].concat(_toConsumableArray(params.map(function (param, i) {
|
||||
return param * i;
|
||||
}).slice(1)), [0]);
|
||||
return multyTime(newParams, t);
|
||||
};
|
||||
};
|
||||
|
||||
// calculate cubic-bezier using Newton's method
|
||||
export var configBezier = function configBezier() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
var x1 = args[0],
|
||||
y1 = args[1],
|
||||
x2 = args[2],
|
||||
y2 = args[3];
|
||||
if (args.length === 1) {
|
||||
switch (args[0]) {
|
||||
case 'linear':
|
||||
x1 = 0.0;
|
||||
y1 = 0.0;
|
||||
x2 = 1.0;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease':
|
||||
x1 = 0.25;
|
||||
y1 = 0.1;
|
||||
x2 = 0.25;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease-in':
|
||||
x1 = 0.42;
|
||||
y1 = 0.0;
|
||||
x2 = 1.0;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease-out':
|
||||
x1 = 0.42;
|
||||
y1 = 0.0;
|
||||
x2 = 0.58;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease-in-out':
|
||||
x1 = 0.0;
|
||||
y1 = 0.0;
|
||||
x2 = 0.58;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
var easing = args[0].split('(');
|
||||
if (easing[0] === 'cubic-bezier' && easing[1].split(')')[0].split(',').length === 4) {
|
||||
var _easing$1$split$0$spl = easing[1].split(')')[0].split(',').map(function (x) {
|
||||
return parseFloat(x);
|
||||
});
|
||||
var _easing$1$split$0$spl2 = _slicedToArray(_easing$1$split$0$spl, 4);
|
||||
x1 = _easing$1$split$0$spl2[0];
|
||||
y1 = _easing$1$split$0$spl2[1];
|
||||
x2 = _easing$1$split$0$spl2[2];
|
||||
y2 = _easing$1$split$0$spl2[3];
|
||||
} else {
|
||||
warn(false, '[configBezier]: arguments should be one of ' + "oneOf 'linear', 'ease', 'ease-in', 'ease-out', " + "'ease-in-out','cubic-bezier(x1,y1,x2,y2)', instead received %s", args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
warn([x1, x2, y1, y2].every(function (num) {
|
||||
return typeof num === 'number' && num >= 0 && num <= 1;
|
||||
}), '[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s', args);
|
||||
var curveX = cubicBezier(x1, x2);
|
||||
var curveY = cubicBezier(y1, y2);
|
||||
var derCurveX = derivativeCubicBezier(x1, x2);
|
||||
var rangeValue = function rangeValue(value) {
|
||||
if (value > 1) {
|
||||
return 1;
|
||||
}
|
||||
if (value < 0) {
|
||||
return 0;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
var bezier = function bezier(_t) {
|
||||
var t = _t > 1 ? 1 : _t;
|
||||
var x = t;
|
||||
for (var i = 0; i < 8; ++i) {
|
||||
var evalT = curveX(x) - t;
|
||||
var derVal = derCurveX(x);
|
||||
if (Math.abs(evalT - t) < ACCURACY || derVal < ACCURACY) {
|
||||
return curveY(x);
|
||||
}
|
||||
x = rangeValue(x - evalT / derVal);
|
||||
}
|
||||
return curveY(x);
|
||||
};
|
||||
bezier.isStepper = false;
|
||||
return bezier;
|
||||
};
|
||||
export var configSpring = function configSpring() {
|
||||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var _config$stiff = config.stiff,
|
||||
stiff = _config$stiff === void 0 ? 100 : _config$stiff,
|
||||
_config$damping = config.damping,
|
||||
damping = _config$damping === void 0 ? 8 : _config$damping,
|
||||
_config$dt = config.dt,
|
||||
dt = _config$dt === void 0 ? 17 : _config$dt;
|
||||
var stepper = function stepper(currX, destX, currV) {
|
||||
var FSpring = -(currX - destX) * stiff;
|
||||
var FDamping = currV * damping;
|
||||
var newV = currV + (FSpring - FDamping) * dt / 1000;
|
||||
var newX = currV * dt / 1000 + currX;
|
||||
if (Math.abs(newX - destX) < ACCURACY && Math.abs(newV) < ACCURACY) {
|
||||
return [destX, 0];
|
||||
}
|
||||
return [newX, newV];
|
||||
};
|
||||
stepper.isStepper = true;
|
||||
stepper.dt = dt;
|
||||
return stepper;
|
||||
};
|
||||
export var configEasing = function configEasing() {
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
var easing = args[0];
|
||||
if (typeof easing === 'string') {
|
||||
switch (easing) {
|
||||
case 'ease':
|
||||
case 'ease-in-out':
|
||||
case 'ease-out':
|
||||
case 'ease-in':
|
||||
case 'linear':
|
||||
return configBezier(easing);
|
||||
case 'spring':
|
||||
return configSpring();
|
||||
default:
|
||||
if (easing.split('(')[0] === 'cubic-bezier') {
|
||||
return configBezier(easing);
|
||||
}
|
||||
warn(false, "[configEasing]: first argument should be one of 'ease', 'ease-in', " + "'ease-out', 'ease-in-out','cubic-bezier(x1,y1,x2,y2)', 'linear' and 'spring', instead received %s", args);
|
||||
}
|
||||
}
|
||||
if (typeof easing === 'function') {
|
||||
return easing;
|
||||
}
|
||||
warn(false, '[configEasing]: first argument type should be function or string, instead received %s', args);
|
||||
return null;
|
||||
};
|
||||
5
node_modules/react-smooth/es6/index.js
generated
vendored
Normal file
5
node_modules/react-smooth/es6/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import Animate from './Animate';
|
||||
import { configBezier, configSpring } from './easing';
|
||||
import AnimateGroup from './AnimateGroup';
|
||||
export { configSpring, configBezier, AnimateGroup };
|
||||
export default Animate;
|
||||
19
node_modules/react-smooth/es6/setRafTimeout.js
generated
vendored
Normal file
19
node_modules/react-smooth/es6/setRafTimeout.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
function safeRequestAnimationFrame(callback) {
|
||||
if (typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(callback);
|
||||
}
|
||||
export default function setRafTimeout(callback) {
|
||||
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
var currTime = -1;
|
||||
var shouldUpdate = function shouldUpdate(now) {
|
||||
if (currTime < 0) {
|
||||
currTime = now;
|
||||
}
|
||||
if (now - currTime > timeout) {
|
||||
callback(now);
|
||||
currTime = -1;
|
||||
} else {
|
||||
safeRequestAnimationFrame(shouldUpdate);
|
||||
}
|
||||
};
|
||||
requestAnimationFrame(shouldUpdate);
|
||||
}
|
||||
94
node_modules/react-smooth/es6/util.js
generated
vendored
Normal file
94
node_modules/react-smooth/es6/util.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
/* eslint no-console: 0 */
|
||||
|
||||
export var getIntersectionKeys = function getIntersectionKeys(preObj, nextObj) {
|
||||
return [Object.keys(preObj), Object.keys(nextObj)].reduce(function (a, b) {
|
||||
return a.filter(function (c) {
|
||||
return b.includes(c);
|
||||
});
|
||||
});
|
||||
};
|
||||
export var identity = function identity(param) {
|
||||
return param;
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: convert camel case to dash case
|
||||
* string => string
|
||||
*/
|
||||
export var getDashCase = function getDashCase(name) {
|
||||
return name.replace(/([A-Z])/g, function (v) {
|
||||
return "-".concat(v.toLowerCase());
|
||||
});
|
||||
};
|
||||
export var log = function log() {
|
||||
var _console;
|
||||
(_console = console).log.apply(_console, arguments);
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: log the value of a varible
|
||||
* string => any => any
|
||||
*/
|
||||
export var debug = function debug(name) {
|
||||
return function (item) {
|
||||
log(name, item);
|
||||
return item;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: log name, args, return value of a function
|
||||
* function => function
|
||||
*/
|
||||
export var debugf = function debugf(tag, f) {
|
||||
return function () {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
var res = f.apply(void 0, args);
|
||||
var name = tag || f.name || 'anonymous function';
|
||||
var argNames = "(".concat(args.map(JSON.stringify).join(', '), ")");
|
||||
log("".concat(name, ": ").concat(argNames, " => ").concat(JSON.stringify(res)));
|
||||
return res;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: map object on every element in this object.
|
||||
* (function, object) => object
|
||||
*/
|
||||
export var mapObject = function mapObject(fn, obj) {
|
||||
return Object.keys(obj).reduce(function (res, key) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, fn(key, obj[key])));
|
||||
}, {});
|
||||
};
|
||||
export var getTransitionVal = function getTransitionVal(props, duration, easing) {
|
||||
return props.map(function (prop) {
|
||||
return "".concat(getDashCase(prop), " ").concat(duration, "ms ").concat(easing);
|
||||
}).join(',');
|
||||
};
|
||||
var isDev = process.env.NODE_ENV !== 'production';
|
||||
export var warn = function warn(condition, format, a, b, c, d, e, f) {
|
||||
if (isDev && typeof console !== 'undefined' && console.warn) {
|
||||
if (format === undefined) {
|
||||
console.warn('LogUtils requires an error message argument');
|
||||
}
|
||||
if (!condition) {
|
||||
if (format === undefined) {
|
||||
console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var args = [a, b, c, d, e, f];
|
||||
var argIndex = 0;
|
||||
console.warn(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
363
node_modules/react-smooth/lib/Animate.js
generated
vendored
Normal file
363
node_modules/react-smooth/lib/Animate.js
generated
vendored
Normal file
@@ -0,0 +1,363 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _fastEquals = require("fast-equals");
|
||||
var _AnimateManager = _interopRequireDefault(require("./AnimateManager"));
|
||||
var _easing = require("./easing");
|
||||
var _configUpdate = _interopRequireDefault(require("./configUpdate"));
|
||||
var _util = require("./util");
|
||||
var _excluded = ["children", "begin", "duration", "attributeName", "easing", "isActive", "steps", "from", "to", "canBegin", "onAnimationEnd", "shouldReAnimate", "onAnimationReStart"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
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 && Object.prototype.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; }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
var Animate = /*#__PURE__*/function (_PureComponent) {
|
||||
_inherits(Animate, _PureComponent);
|
||||
var _super = _createSuper(Animate);
|
||||
function Animate(props, context) {
|
||||
var _this;
|
||||
_classCallCheck(this, Animate);
|
||||
_this = _super.call(this, props, context);
|
||||
var _this$props = _this.props,
|
||||
isActive = _this$props.isActive,
|
||||
attributeName = _this$props.attributeName,
|
||||
from = _this$props.from,
|
||||
to = _this$props.to,
|
||||
steps = _this$props.steps,
|
||||
children = _this$props.children,
|
||||
duration = _this$props.duration;
|
||||
_this.handleStyleChange = _this.handleStyleChange.bind(_assertThisInitialized(_this));
|
||||
_this.changeStyle = _this.changeStyle.bind(_assertThisInitialized(_this));
|
||||
if (!isActive || duration <= 0) {
|
||||
_this.state = {
|
||||
style: {}
|
||||
};
|
||||
|
||||
// if children is a function and animation is not active, set style to 'to'
|
||||
if (typeof children === 'function') {
|
||||
_this.state = {
|
||||
style: to
|
||||
};
|
||||
}
|
||||
return _possibleConstructorReturn(_this);
|
||||
}
|
||||
if (steps && steps.length) {
|
||||
_this.state = {
|
||||
style: steps[0].style
|
||||
};
|
||||
} else if (from) {
|
||||
if (typeof children === 'function') {
|
||||
_this.state = {
|
||||
style: from
|
||||
};
|
||||
return _possibleConstructorReturn(_this);
|
||||
}
|
||||
_this.state = {
|
||||
style: attributeName ? _defineProperty({}, attributeName, from) : from
|
||||
};
|
||||
} else {
|
||||
_this.state = {
|
||||
style: {}
|
||||
};
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
_createClass(Animate, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this$props2 = this.props,
|
||||
isActive = _this$props2.isActive,
|
||||
canBegin = _this$props2.canBegin;
|
||||
this.mounted = true;
|
||||
if (!isActive || !canBegin) {
|
||||
return;
|
||||
}
|
||||
this.runAnimation(this.props);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
var _this$props3 = this.props,
|
||||
isActive = _this$props3.isActive,
|
||||
canBegin = _this$props3.canBegin,
|
||||
attributeName = _this$props3.attributeName,
|
||||
shouldReAnimate = _this$props3.shouldReAnimate,
|
||||
to = _this$props3.to,
|
||||
currentFrom = _this$props3.from;
|
||||
var style = this.state.style;
|
||||
if (!canBegin) {
|
||||
return;
|
||||
}
|
||||
if (!isActive) {
|
||||
var newState = {
|
||||
style: attributeName ? _defineProperty({}, attributeName, to) : to
|
||||
};
|
||||
if (this.state && style) {
|
||||
if (attributeName && style[attributeName] !== to || !attributeName && style !== to) {
|
||||
// eslint-disable-next-line react/no-did-update-set-state
|
||||
this.setState(newState);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((0, _fastEquals.deepEqual)(prevProps.to, to) && prevProps.canBegin && prevProps.isActive) {
|
||||
return;
|
||||
}
|
||||
var isTriggered = !prevProps.canBegin || !prevProps.isActive;
|
||||
if (this.manager) {
|
||||
this.manager.stop();
|
||||
}
|
||||
if (this.stopJSAnimation) {
|
||||
this.stopJSAnimation();
|
||||
}
|
||||
var from = isTriggered || shouldReAnimate ? currentFrom : prevProps.to;
|
||||
if (this.state && style) {
|
||||
var _newState = {
|
||||
style: attributeName ? _defineProperty({}, attributeName, from) : from
|
||||
};
|
||||
if (attributeName && style[attributeName] !== from || !attributeName && style !== from) {
|
||||
// eslint-disable-next-line react/no-did-update-set-state
|
||||
this.setState(_newState);
|
||||
}
|
||||
}
|
||||
this.runAnimation(_objectSpread(_objectSpread({}, this.props), {}, {
|
||||
from: from,
|
||||
begin: 0
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
var onAnimationEnd = this.props.onAnimationEnd;
|
||||
if (this.unSubscribe) {
|
||||
this.unSubscribe();
|
||||
}
|
||||
if (this.manager) {
|
||||
this.manager.stop();
|
||||
this.manager = null;
|
||||
}
|
||||
if (this.stopJSAnimation) {
|
||||
this.stopJSAnimation();
|
||||
}
|
||||
if (onAnimationEnd) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "handleStyleChange",
|
||||
value: function handleStyleChange(style) {
|
||||
this.changeStyle(style);
|
||||
}
|
||||
}, {
|
||||
key: "changeStyle",
|
||||
value: function changeStyle(style) {
|
||||
if (this.mounted) {
|
||||
this.setState({
|
||||
style: style
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "runJSAnimation",
|
||||
value: function runJSAnimation(props) {
|
||||
var _this2 = this;
|
||||
var from = props.from,
|
||||
to = props.to,
|
||||
duration = props.duration,
|
||||
easing = props.easing,
|
||||
begin = props.begin,
|
||||
onAnimationEnd = props.onAnimationEnd,
|
||||
onAnimationStart = props.onAnimationStart;
|
||||
var startAnimation = (0, _configUpdate.default)(from, to, (0, _easing.configEasing)(easing), duration, this.changeStyle);
|
||||
var finalStartAnimation = function finalStartAnimation() {
|
||||
_this2.stopJSAnimation = startAnimation();
|
||||
};
|
||||
this.manager.start([onAnimationStart, begin, finalStartAnimation, duration, onAnimationEnd]);
|
||||
}
|
||||
}, {
|
||||
key: "runStepAnimation",
|
||||
value: function runStepAnimation(props) {
|
||||
var _this3 = this;
|
||||
var steps = props.steps,
|
||||
begin = props.begin,
|
||||
onAnimationStart = props.onAnimationStart;
|
||||
var _steps$ = steps[0],
|
||||
initialStyle = _steps$.style,
|
||||
_steps$$duration = _steps$.duration,
|
||||
initialTime = _steps$$duration === void 0 ? 0 : _steps$$duration;
|
||||
var addStyle = function addStyle(sequence, nextItem, index) {
|
||||
if (index === 0) {
|
||||
return sequence;
|
||||
}
|
||||
var duration = nextItem.duration,
|
||||
_nextItem$easing = nextItem.easing,
|
||||
easing = _nextItem$easing === void 0 ? 'ease' : _nextItem$easing,
|
||||
style = nextItem.style,
|
||||
nextProperties = nextItem.properties,
|
||||
onAnimationEnd = nextItem.onAnimationEnd;
|
||||
var preItem = index > 0 ? steps[index - 1] : nextItem;
|
||||
var properties = nextProperties || Object.keys(style);
|
||||
if (typeof easing === 'function' || easing === 'spring') {
|
||||
return [].concat(_toConsumableArray(sequence), [_this3.runJSAnimation.bind(_this3, {
|
||||
from: preItem.style,
|
||||
to: style,
|
||||
duration: duration,
|
||||
easing: easing
|
||||
}), duration]);
|
||||
}
|
||||
var transition = (0, _util.getTransitionVal)(properties, duration, easing);
|
||||
var newStyle = _objectSpread(_objectSpread(_objectSpread({}, preItem.style), style), {}, {
|
||||
transition: transition
|
||||
});
|
||||
return [].concat(_toConsumableArray(sequence), [newStyle, duration, onAnimationEnd]).filter(_util.identity);
|
||||
};
|
||||
return this.manager.start([onAnimationStart].concat(_toConsumableArray(steps.reduce(addStyle, [initialStyle, Math.max(initialTime, begin)])), [props.onAnimationEnd]));
|
||||
}
|
||||
}, {
|
||||
key: "runAnimation",
|
||||
value: function runAnimation(props) {
|
||||
if (!this.manager) {
|
||||
this.manager = (0, _AnimateManager.default)();
|
||||
}
|
||||
var begin = props.begin,
|
||||
duration = props.duration,
|
||||
attributeName = props.attributeName,
|
||||
propsTo = props.to,
|
||||
easing = props.easing,
|
||||
onAnimationStart = props.onAnimationStart,
|
||||
onAnimationEnd = props.onAnimationEnd,
|
||||
steps = props.steps,
|
||||
children = props.children;
|
||||
var manager = this.manager;
|
||||
this.unSubscribe = manager.subscribe(this.handleStyleChange);
|
||||
if (typeof easing === 'function' || typeof children === 'function' || easing === 'spring') {
|
||||
this.runJSAnimation(props);
|
||||
return;
|
||||
}
|
||||
if (steps.length > 1) {
|
||||
this.runStepAnimation(props);
|
||||
return;
|
||||
}
|
||||
var to = attributeName ? _defineProperty({}, attributeName, propsTo) : propsTo;
|
||||
var transition = (0, _util.getTransitionVal)(Object.keys(to), duration, easing);
|
||||
manager.start([onAnimationStart, begin, _objectSpread(_objectSpread({}, to), {}, {
|
||||
transition: transition
|
||||
}), duration, onAnimationEnd]);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props4 = this.props,
|
||||
children = _this$props4.children,
|
||||
begin = _this$props4.begin,
|
||||
duration = _this$props4.duration,
|
||||
attributeName = _this$props4.attributeName,
|
||||
easing = _this$props4.easing,
|
||||
isActive = _this$props4.isActive,
|
||||
steps = _this$props4.steps,
|
||||
from = _this$props4.from,
|
||||
to = _this$props4.to,
|
||||
canBegin = _this$props4.canBegin,
|
||||
onAnimationEnd = _this$props4.onAnimationEnd,
|
||||
shouldReAnimate = _this$props4.shouldReAnimate,
|
||||
onAnimationReStart = _this$props4.onAnimationReStart,
|
||||
others = _objectWithoutProperties(_this$props4, _excluded);
|
||||
var count = _react.Children.count(children);
|
||||
// eslint-disable-next-line react/destructuring-assignment
|
||||
var stateStyle = this.state.style;
|
||||
if (typeof children === 'function') {
|
||||
return children(stateStyle);
|
||||
}
|
||||
if (!isActive || count === 0 || duration <= 0) {
|
||||
return children;
|
||||
}
|
||||
var cloneContainer = function cloneContainer(container) {
|
||||
var _container$props = container.props,
|
||||
_container$props$styl = _container$props.style,
|
||||
style = _container$props$styl === void 0 ? {} : _container$props$styl,
|
||||
className = _container$props.className;
|
||||
var res = /*#__PURE__*/(0, _react.cloneElement)(container, _objectSpread(_objectSpread({}, others), {}, {
|
||||
style: _objectSpread(_objectSpread({}, style), stateStyle),
|
||||
className: className
|
||||
}));
|
||||
return res;
|
||||
};
|
||||
if (count === 1) {
|
||||
return cloneContainer(_react.Children.only(children));
|
||||
}
|
||||
return /*#__PURE__*/_react.default.createElement("div", null, _react.Children.map(children, function (child) {
|
||||
return cloneContainer(child);
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
return Animate;
|
||||
}(_react.PureComponent);
|
||||
Animate.displayName = 'Animate';
|
||||
Animate.defaultProps = {
|
||||
begin: 0,
|
||||
duration: 1000,
|
||||
from: '',
|
||||
to: '',
|
||||
attributeName: '',
|
||||
easing: 'ease',
|
||||
isActive: true,
|
||||
canBegin: true,
|
||||
steps: [],
|
||||
onAnimationEnd: function onAnimationEnd() {},
|
||||
onAnimationStart: function onAnimationStart() {}
|
||||
};
|
||||
Animate.propTypes = {
|
||||
from: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
||||
to: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
||||
attributeName: _propTypes.default.string,
|
||||
// animation duration
|
||||
duration: _propTypes.default.number,
|
||||
begin: _propTypes.default.number,
|
||||
easing: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]),
|
||||
steps: _propTypes.default.arrayOf(_propTypes.default.shape({
|
||||
duration: _propTypes.default.number.isRequired,
|
||||
style: _propTypes.default.object.isRequired,
|
||||
easing: _propTypes.default.oneOfType([_propTypes.default.oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear']), _propTypes.default.func]),
|
||||
// transition css properties(dash case), optional
|
||||
properties: _propTypes.default.arrayOf('string'),
|
||||
onAnimationEnd: _propTypes.default.func
|
||||
})),
|
||||
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
||||
isActive: _propTypes.default.bool,
|
||||
canBegin: _propTypes.default.bool,
|
||||
onAnimationEnd: _propTypes.default.func,
|
||||
// decide if it should reanimate with initial from style when props change
|
||||
shouldReAnimate: _propTypes.default.bool,
|
||||
onAnimationStart: _propTypes.default.func,
|
||||
onAnimationReStart: _propTypes.default.func
|
||||
};
|
||||
var _default = exports.default = Animate;
|
||||
42
node_modules/react-smooth/lib/AnimateGroup.js
generated
vendored
Normal file
42
node_modules/react-smooth/lib/AnimateGroup.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactTransitionGroup = require("react-transition-group");
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _AnimateGroupChild = _interopRequireDefault(require("./AnimateGroupChild"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
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 && Object.prototype.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; }
|
||||
function AnimateGroup(props) {
|
||||
var component = props.component,
|
||||
children = props.children,
|
||||
appear = props.appear,
|
||||
enter = props.enter,
|
||||
leave = props.leave;
|
||||
return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, {
|
||||
component: component
|
||||
}, _react.Children.map(children, function (child, index) {
|
||||
return /*#__PURE__*/_react.default.createElement(_AnimateGroupChild.default, {
|
||||
appearOptions: appear,
|
||||
enterOptions: enter,
|
||||
leaveOptions: leave,
|
||||
key: "child-".concat(index) // eslint-disable-line
|
||||
}, child);
|
||||
}));
|
||||
}
|
||||
AnimateGroup.propTypes = {
|
||||
appear: _propTypes.default.object,
|
||||
enter: _propTypes.default.object,
|
||||
leave: _propTypes.default.object,
|
||||
children: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.element]),
|
||||
component: _propTypes.default.any
|
||||
};
|
||||
AnimateGroup.defaultProps = {
|
||||
component: 'span'
|
||||
};
|
||||
var _default = exports.default = AnimateGroup;
|
||||
119
node_modules/react-smooth/lib/AnimateGroupChild.js
generated
vendored
Normal file
119
node_modules/react-smooth/lib/AnimateGroupChild.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactTransitionGroup = require("react-transition-group");
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _Animate = _interopRequireDefault(require("./Animate"));
|
||||
var _excluded = ["children", "appearOptions", "enterOptions", "leaveOptions"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
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 && Object.prototype.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; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
var parseDurationOfSingleTransition = function parseDurationOfSingleTransition() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var steps = options.steps,
|
||||
duration = options.duration;
|
||||
if (steps && steps.length) {
|
||||
return steps.reduce(function (result, entry) {
|
||||
return result + (Number.isFinite(entry.duration) && entry.duration > 0 ? entry.duration : 0);
|
||||
}, 0);
|
||||
}
|
||||
if (Number.isFinite(duration)) {
|
||||
return duration;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
var AnimateGroupChild = /*#__PURE__*/function (_Component) {
|
||||
_inherits(AnimateGroupChild, _Component);
|
||||
var _super = _createSuper(AnimateGroupChild);
|
||||
function AnimateGroupChild() {
|
||||
var _this;
|
||||
_classCallCheck(this, AnimateGroupChild);
|
||||
_this = _super.call(this);
|
||||
_defineProperty(_assertThisInitialized(_this), "handleEnter", function (node, isAppearing) {
|
||||
var _this$props = _this.props,
|
||||
appearOptions = _this$props.appearOptions,
|
||||
enterOptions = _this$props.enterOptions;
|
||||
_this.handleStyleActive(isAppearing ? appearOptions : enterOptions);
|
||||
});
|
||||
_defineProperty(_assertThisInitialized(_this), "handleExit", function () {
|
||||
var leaveOptions = _this.props.leaveOptions;
|
||||
_this.handleStyleActive(leaveOptions);
|
||||
});
|
||||
_this.state = {
|
||||
isActive: false
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
_createClass(AnimateGroupChild, [{
|
||||
key: "handleStyleActive",
|
||||
value: function handleStyleActive(style) {
|
||||
if (style) {
|
||||
var onAnimationEnd = style.onAnimationEnd ? function () {
|
||||
style.onAnimationEnd();
|
||||
} : null;
|
||||
this.setState(_objectSpread(_objectSpread({}, style), {}, {
|
||||
onAnimationEnd: onAnimationEnd,
|
||||
isActive: true
|
||||
}));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "parseTimeout",
|
||||
value: function parseTimeout() {
|
||||
var _this$props2 = this.props,
|
||||
appearOptions = _this$props2.appearOptions,
|
||||
enterOptions = _this$props2.enterOptions,
|
||||
leaveOptions = _this$props2.leaveOptions;
|
||||
return parseDurationOfSingleTransition(appearOptions) + parseDurationOfSingleTransition(enterOptions) + parseDurationOfSingleTransition(leaveOptions);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
var _this$props3 = this.props,
|
||||
children = _this$props3.children,
|
||||
appearOptions = _this$props3.appearOptions,
|
||||
enterOptions = _this$props3.enterOptions,
|
||||
leaveOptions = _this$props3.leaveOptions,
|
||||
props = _objectWithoutProperties(_this$props3, _excluded);
|
||||
return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.Transition, _extends({}, props, {
|
||||
onEnter: this.handleEnter,
|
||||
onExit: this.handleExit,
|
||||
timeout: this.parseTimeout()
|
||||
}), function () {
|
||||
return /*#__PURE__*/_react.default.createElement(_Animate.default, _this2.state, _react.Children.only(children));
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return AnimateGroupChild;
|
||||
}(_react.Component);
|
||||
AnimateGroupChild.propTypes = {
|
||||
appearOptions: _propTypes.default.object,
|
||||
enterOptions: _propTypes.default.object,
|
||||
leaveOptions: _propTypes.default.object,
|
||||
children: _propTypes.default.element
|
||||
};
|
||||
var _default = exports.default = AnimateGroupChild;
|
||||
67
node_modules/react-smooth/lib/AnimateManager.js
generated
vendored
Normal file
67
node_modules/react-smooth/lib/AnimateManager.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = createAnimateManager;
|
||||
var _setRafTimeout = _interopRequireDefault(require("./setRafTimeout"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function createAnimateManager() {
|
||||
var currStyle = {};
|
||||
var handleChange = function handleChange() {
|
||||
return null;
|
||||
};
|
||||
var shouldStop = false;
|
||||
var setStyle = function setStyle(_style) {
|
||||
if (shouldStop) {
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(_style)) {
|
||||
if (!_style.length) {
|
||||
return;
|
||||
}
|
||||
var styles = _style;
|
||||
var _styles = _toArray(styles),
|
||||
curr = _styles[0],
|
||||
restStyles = _styles.slice(1);
|
||||
if (typeof curr === 'number') {
|
||||
(0, _setRafTimeout.default)(setStyle.bind(null, restStyles), curr);
|
||||
return;
|
||||
}
|
||||
setStyle(curr);
|
||||
(0, _setRafTimeout.default)(setStyle.bind(null, restStyles));
|
||||
return;
|
||||
}
|
||||
if (_typeof(_style) === 'object') {
|
||||
currStyle = _style;
|
||||
handleChange(currStyle);
|
||||
}
|
||||
if (typeof _style === 'function') {
|
||||
_style();
|
||||
}
|
||||
};
|
||||
return {
|
||||
stop: function stop() {
|
||||
shouldStop = true;
|
||||
},
|
||||
start: function start(style) {
|
||||
shouldStop = false;
|
||||
setStyle(style);
|
||||
},
|
||||
subscribe: function subscribe(_handleChange) {
|
||||
handleChange = _handleChange;
|
||||
return function () {
|
||||
handleChange = function handleChange() {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
141
node_modules/react-smooth/lib/configUpdate.js
generated
vendored
Normal file
141
node_modules/react-smooth/lib/configUpdate.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _util = require("./util");
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
var alpha = function alpha(begin, end, k) {
|
||||
return begin + (end - begin) * k;
|
||||
};
|
||||
var needContinue = function needContinue(_ref) {
|
||||
var from = _ref.from,
|
||||
to = _ref.to;
|
||||
return from !== to;
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: cal new from value and velocity in each stepper
|
||||
* @return: { [styleProperty]: { from, to, velocity } }
|
||||
*/
|
||||
var calStepperVals = function calStepperVals(easing, preVals, steps) {
|
||||
var nextStepVals = (0, _util.mapObject)(function (key, val) {
|
||||
if (needContinue(val)) {
|
||||
var _easing = easing(val.from, val.to, val.velocity),
|
||||
_easing2 = _slicedToArray(_easing, 2),
|
||||
newX = _easing2[0],
|
||||
newV = _easing2[1];
|
||||
return _objectSpread(_objectSpread({}, val), {}, {
|
||||
from: newX,
|
||||
velocity: newV
|
||||
});
|
||||
}
|
||||
return val;
|
||||
}, preVals);
|
||||
if (steps < 1) {
|
||||
return (0, _util.mapObject)(function (key, val) {
|
||||
if (needContinue(val)) {
|
||||
return _objectSpread(_objectSpread({}, val), {}, {
|
||||
velocity: alpha(val.velocity, nextStepVals[key].velocity, steps),
|
||||
from: alpha(val.from, nextStepVals[key].from, steps)
|
||||
});
|
||||
}
|
||||
return val;
|
||||
}, preVals);
|
||||
}
|
||||
return calStepperVals(easing, nextStepVals, steps - 1);
|
||||
};
|
||||
|
||||
// configure update function
|
||||
var _default = exports.default = function _default(from, to, easing, duration, render) {
|
||||
var interKeys = (0, _util.getIntersectionKeys)(from, to);
|
||||
var timingStyle = interKeys.reduce(function (res, key) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, [from[key], to[key]]));
|
||||
}, {});
|
||||
var stepperStyle = interKeys.reduce(function (res, key) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, {
|
||||
from: from[key],
|
||||
velocity: 0,
|
||||
to: to[key]
|
||||
}));
|
||||
}, {});
|
||||
var cafId = -1;
|
||||
var preTime;
|
||||
var beginTime;
|
||||
var update = function update() {
|
||||
return null;
|
||||
};
|
||||
var getCurrStyle = function getCurrStyle() {
|
||||
return (0, _util.mapObject)(function (key, val) {
|
||||
return val.from;
|
||||
}, stepperStyle);
|
||||
};
|
||||
var shouldStopAnimation = function shouldStopAnimation() {
|
||||
return !Object.values(stepperStyle).filter(needContinue).length;
|
||||
};
|
||||
|
||||
// stepper timing function like spring
|
||||
var stepperUpdate = function stepperUpdate(now) {
|
||||
if (!preTime) {
|
||||
preTime = now;
|
||||
}
|
||||
var deltaTime = now - preTime;
|
||||
var steps = deltaTime / easing.dt;
|
||||
stepperStyle = calStepperVals(easing, stepperStyle, steps);
|
||||
// get union set and add compatible prefix
|
||||
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), getCurrStyle(stepperStyle)));
|
||||
preTime = now;
|
||||
if (!shouldStopAnimation()) {
|
||||
cafId = requestAnimationFrame(update);
|
||||
}
|
||||
};
|
||||
|
||||
// t => val timing function like cubic-bezier
|
||||
var timingUpdate = function timingUpdate(now) {
|
||||
if (!beginTime) {
|
||||
beginTime = now;
|
||||
}
|
||||
var t = (now - beginTime) / duration;
|
||||
var currStyle = (0, _util.mapObject)(function (key, val) {
|
||||
return alpha.apply(void 0, _toConsumableArray(val).concat([easing(t)]));
|
||||
}, timingStyle);
|
||||
|
||||
// get union set and add compatible prefix
|
||||
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), currStyle));
|
||||
if (t < 1) {
|
||||
cafId = requestAnimationFrame(update);
|
||||
} else {
|
||||
var finalStyle = (0, _util.mapObject)(function (key, val) {
|
||||
return alpha.apply(void 0, _toConsumableArray(val).concat([easing(1)]));
|
||||
}, timingStyle);
|
||||
render(_objectSpread(_objectSpread(_objectSpread({}, from), to), finalStyle));
|
||||
}
|
||||
};
|
||||
update = easing.isStepper ? stepperUpdate : timingUpdate;
|
||||
|
||||
// return start animation method
|
||||
return function () {
|
||||
requestAnimationFrame(update);
|
||||
|
||||
// return stop animation method
|
||||
return function () {
|
||||
cancelAnimationFrame(cafId);
|
||||
};
|
||||
};
|
||||
};
|
||||
184
node_modules/react-smooth/lib/easing.js
generated
vendored
Normal file
184
node_modules/react-smooth/lib/easing.js
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.configSpring = exports.configEasing = exports.configBezier = void 0;
|
||||
var _util = require("./util");
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
var ACCURACY = 1e-4;
|
||||
var cubicBezierFactor = function cubicBezierFactor(c1, c2) {
|
||||
return [0, 3 * c1, 3 * c2 - 6 * c1, 3 * c1 - 3 * c2 + 1];
|
||||
};
|
||||
var multyTime = function multyTime(params, t) {
|
||||
return params.map(function (param, i) {
|
||||
return param * Math.pow(t, i);
|
||||
}).reduce(function (pre, curr) {
|
||||
return pre + curr;
|
||||
});
|
||||
};
|
||||
var cubicBezier = function cubicBezier(c1, c2) {
|
||||
return function (t) {
|
||||
var params = cubicBezierFactor(c1, c2);
|
||||
return multyTime(params, t);
|
||||
};
|
||||
};
|
||||
var derivativeCubicBezier = function derivativeCubicBezier(c1, c2) {
|
||||
return function (t) {
|
||||
var params = cubicBezierFactor(c1, c2);
|
||||
var newParams = [].concat(_toConsumableArray(params.map(function (param, i) {
|
||||
return param * i;
|
||||
}).slice(1)), [0]);
|
||||
return multyTime(newParams, t);
|
||||
};
|
||||
};
|
||||
|
||||
// calculate cubic-bezier using Newton's method
|
||||
var configBezier = exports.configBezier = function configBezier() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
var x1 = args[0],
|
||||
y1 = args[1],
|
||||
x2 = args[2],
|
||||
y2 = args[3];
|
||||
if (args.length === 1) {
|
||||
switch (args[0]) {
|
||||
case 'linear':
|
||||
x1 = 0.0;
|
||||
y1 = 0.0;
|
||||
x2 = 1.0;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease':
|
||||
x1 = 0.25;
|
||||
y1 = 0.1;
|
||||
x2 = 0.25;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease-in':
|
||||
x1 = 0.42;
|
||||
y1 = 0.0;
|
||||
x2 = 1.0;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease-out':
|
||||
x1 = 0.42;
|
||||
y1 = 0.0;
|
||||
x2 = 0.58;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
case 'ease-in-out':
|
||||
x1 = 0.0;
|
||||
y1 = 0.0;
|
||||
x2 = 0.58;
|
||||
y2 = 1.0;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
var easing = args[0].split('(');
|
||||
if (easing[0] === 'cubic-bezier' && easing[1].split(')')[0].split(',').length === 4) {
|
||||
var _easing$1$split$0$spl = easing[1].split(')')[0].split(',').map(function (x) {
|
||||
return parseFloat(x);
|
||||
});
|
||||
var _easing$1$split$0$spl2 = _slicedToArray(_easing$1$split$0$spl, 4);
|
||||
x1 = _easing$1$split$0$spl2[0];
|
||||
y1 = _easing$1$split$0$spl2[1];
|
||||
x2 = _easing$1$split$0$spl2[2];
|
||||
y2 = _easing$1$split$0$spl2[3];
|
||||
} else {
|
||||
(0, _util.warn)(false, '[configBezier]: arguments should be one of ' + "oneOf 'linear', 'ease', 'ease-in', 'ease-out', " + "'ease-in-out','cubic-bezier(x1,y1,x2,y2)', instead received %s", args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(0, _util.warn)([x1, x2, y1, y2].every(function (num) {
|
||||
return typeof num === 'number' && num >= 0 && num <= 1;
|
||||
}), '[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s', args);
|
||||
var curveX = cubicBezier(x1, x2);
|
||||
var curveY = cubicBezier(y1, y2);
|
||||
var derCurveX = derivativeCubicBezier(x1, x2);
|
||||
var rangeValue = function rangeValue(value) {
|
||||
if (value > 1) {
|
||||
return 1;
|
||||
}
|
||||
if (value < 0) {
|
||||
return 0;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
var bezier = function bezier(_t) {
|
||||
var t = _t > 1 ? 1 : _t;
|
||||
var x = t;
|
||||
for (var i = 0; i < 8; ++i) {
|
||||
var evalT = curveX(x) - t;
|
||||
var derVal = derCurveX(x);
|
||||
if (Math.abs(evalT - t) < ACCURACY || derVal < ACCURACY) {
|
||||
return curveY(x);
|
||||
}
|
||||
x = rangeValue(x - evalT / derVal);
|
||||
}
|
||||
return curveY(x);
|
||||
};
|
||||
bezier.isStepper = false;
|
||||
return bezier;
|
||||
};
|
||||
var configSpring = exports.configSpring = function configSpring() {
|
||||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var _config$stiff = config.stiff,
|
||||
stiff = _config$stiff === void 0 ? 100 : _config$stiff,
|
||||
_config$damping = config.damping,
|
||||
damping = _config$damping === void 0 ? 8 : _config$damping,
|
||||
_config$dt = config.dt,
|
||||
dt = _config$dt === void 0 ? 17 : _config$dt;
|
||||
var stepper = function stepper(currX, destX, currV) {
|
||||
var FSpring = -(currX - destX) * stiff;
|
||||
var FDamping = currV * damping;
|
||||
var newV = currV + (FSpring - FDamping) * dt / 1000;
|
||||
var newX = currV * dt / 1000 + currX;
|
||||
if (Math.abs(newX - destX) < ACCURACY && Math.abs(newV) < ACCURACY) {
|
||||
return [destX, 0];
|
||||
}
|
||||
return [newX, newV];
|
||||
};
|
||||
stepper.isStepper = true;
|
||||
stepper.dt = dt;
|
||||
return stepper;
|
||||
};
|
||||
var configEasing = exports.configEasing = function configEasing() {
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
var easing = args[0];
|
||||
if (typeof easing === 'string') {
|
||||
switch (easing) {
|
||||
case 'ease':
|
||||
case 'ease-in-out':
|
||||
case 'ease-out':
|
||||
case 'ease-in':
|
||||
case 'linear':
|
||||
return configBezier(easing);
|
||||
case 'spring':
|
||||
return configSpring();
|
||||
default:
|
||||
if (easing.split('(')[0] === 'cubic-bezier') {
|
||||
return configBezier(easing);
|
||||
}
|
||||
(0, _util.warn)(false, "[configEasing]: first argument should be one of 'ease', 'ease-in', " + "'ease-out', 'ease-in-out','cubic-bezier(x1,y1,x2,y2)', 'linear' and 'spring', instead received %s", args);
|
||||
}
|
||||
}
|
||||
if (typeof easing === 'function') {
|
||||
return easing;
|
||||
}
|
||||
(0, _util.warn)(false, '[configEasing]: first argument type should be function or string, instead received %s', args);
|
||||
return null;
|
||||
};
|
||||
29
node_modules/react-smooth/lib/index.js
generated
vendored
Normal file
29
node_modules/react-smooth/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "AnimateGroup", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _AnimateGroup.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "configBezier", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _easing.configBezier;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "configSpring", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _easing.configSpring;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _Animate = _interopRequireDefault(require("./Animate"));
|
||||
var _easing = require("./easing");
|
||||
var _AnimateGroup = _interopRequireDefault(require("./AnimateGroup"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _default = exports.default = _Animate.default;
|
||||
25
node_modules/react-smooth/lib/setRafTimeout.js
generated
vendored
Normal file
25
node_modules/react-smooth/lib/setRafTimeout.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = setRafTimeout;
|
||||
function safeRequestAnimationFrame(callback) {
|
||||
if (typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(callback);
|
||||
}
|
||||
function setRafTimeout(callback) {
|
||||
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
var currTime = -1;
|
||||
var shouldUpdate = function shouldUpdate(now) {
|
||||
if (currTime < 0) {
|
||||
currTime = now;
|
||||
}
|
||||
if (now - currTime > timeout) {
|
||||
callback(now);
|
||||
currTime = -1;
|
||||
} else {
|
||||
safeRequestAnimationFrame(shouldUpdate);
|
||||
}
|
||||
};
|
||||
requestAnimationFrame(shouldUpdate);
|
||||
}
|
||||
100
node_modules/react-smooth/lib/util.js
generated
vendored
Normal file
100
node_modules/react-smooth/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.warn = exports.mapObject = exports.log = exports.identity = exports.getTransitionVal = exports.getIntersectionKeys = exports.getDashCase = exports.debugf = exports.debug = void 0;
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
/* eslint no-console: 0 */
|
||||
|
||||
var getIntersectionKeys = exports.getIntersectionKeys = function getIntersectionKeys(preObj, nextObj) {
|
||||
return [Object.keys(preObj), Object.keys(nextObj)].reduce(function (a, b) {
|
||||
return a.filter(function (c) {
|
||||
return b.includes(c);
|
||||
});
|
||||
});
|
||||
};
|
||||
var identity = exports.identity = function identity(param) {
|
||||
return param;
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: convert camel case to dash case
|
||||
* string => string
|
||||
*/
|
||||
var getDashCase = exports.getDashCase = function getDashCase(name) {
|
||||
return name.replace(/([A-Z])/g, function (v) {
|
||||
return "-".concat(v.toLowerCase());
|
||||
});
|
||||
};
|
||||
var log = exports.log = function log() {
|
||||
var _console;
|
||||
(_console = console).log.apply(_console, arguments);
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: log the value of a varible
|
||||
* string => any => any
|
||||
*/
|
||||
var debug = exports.debug = function debug(name) {
|
||||
return function (item) {
|
||||
log(name, item);
|
||||
return item;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: log name, args, return value of a function
|
||||
* function => function
|
||||
*/
|
||||
var debugf = exports.debugf = function debugf(tag, f) {
|
||||
return function () {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
var res = f.apply(void 0, args);
|
||||
var name = tag || f.name || 'anonymous function';
|
||||
var argNames = "(".concat(args.map(JSON.stringify).join(', '), ")");
|
||||
log("".concat(name, ": ").concat(argNames, " => ").concat(JSON.stringify(res)));
|
||||
return res;
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: map object on every element in this object.
|
||||
* (function, object) => object
|
||||
*/
|
||||
var mapObject = exports.mapObject = function mapObject(fn, obj) {
|
||||
return Object.keys(obj).reduce(function (res, key) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, fn(key, obj[key])));
|
||||
}, {});
|
||||
};
|
||||
var getTransitionVal = exports.getTransitionVal = function getTransitionVal(props, duration, easing) {
|
||||
return props.map(function (prop) {
|
||||
return "".concat(getDashCase(prop), " ").concat(duration, "ms ").concat(easing);
|
||||
}).join(',');
|
||||
};
|
||||
var isDev = process.env.NODE_ENV !== 'production';
|
||||
var warn = exports.warn = function warn(condition, format, a, b, c, d, e, f) {
|
||||
if (isDev && typeof console !== 'undefined' && console.warn) {
|
||||
if (format === undefined) {
|
||||
console.warn('LogUtils requires an error message argument');
|
||||
}
|
||||
if (!condition) {
|
||||
if (format === undefined) {
|
||||
console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var args = [a, b, c, d, e, f];
|
||||
var argIndex = 0;
|
||||
console.warn(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
93
node_modules/react-smooth/package.json
generated
vendored
Normal file
93
node_modules/react-smooth/package.json
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"name": "react-smooth",
|
||||
"version": "4.0.4",
|
||||
"description": "react animation library",
|
||||
"main": "lib/index",
|
||||
"module": "es6/index",
|
||||
"files": [
|
||||
"*.md",
|
||||
"es6",
|
||||
"lib",
|
||||
"umd",
|
||||
"src"
|
||||
],
|
||||
"keywords": [
|
||||
"react",
|
||||
"reactjs",
|
||||
"animation",
|
||||
"react-component"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run build-cjs && npm run build-es6 && rimraf umd && npm run build-umd && npm run build-min",
|
||||
"build-cjs": "rimraf lib && cross-env BABEL_ENV=commonjs babel ./src -d lib",
|
||||
"build-es6": "rimraf es6 && babel ./src -d es6",
|
||||
"build-umd": "cross-env NODE_ENV=development BABEL_ENV=commonjs webpack --entry ./src/index.js -o umd",
|
||||
"build-min": "cross-env NODE_ENV=production BABEL_ENV=commonjs webpack --entry ./src/index.js -o umd",
|
||||
"test": "cross-env BABEL_ENV=test jest",
|
||||
"demo": "webpack serve --config demo/webpack.config.js --port 4000 --host 127.0.0.1 --progress --profile --content-base demo/",
|
||||
"autofix": "eslint src --fix",
|
||||
"lint": "eslint src"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/recharts/react-smooth.git"
|
||||
},
|
||||
"author": "JasonHzq",
|
||||
"bugs": {
|
||||
"url": "https://github.com/recharts/react-smooth/issues"
|
||||
},
|
||||
"homepage": "https://github.com/recharts/react-smooth#readme",
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"fast-equals": "^5.0.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-transition-group": "^4.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.23.0",
|
||||
"@babel/core": "^7.23.2",
|
||||
"@babel/eslint-parser": "^7.22.15",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-proposal-decorators": "^7.23.2",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.22.17",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
||||
"@babel/plugin-proposal-function-bind": "^7.22.5",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
||||
"@babel/plugin-transform-runtime": "^7.23.2",
|
||||
"@babel/preset-env": "^7.23.2",
|
||||
"@babel/preset-react": "^7.22.15",
|
||||
"@babel/runtime": "^7.23.2",
|
||||
"@testing-library/dom": "^9.3.3",
|
||||
"@testing-library/jest-dom": "^5.17.0",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
"core-js": "^3.33.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-prettier": "^7.2.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"pre-commit": "^1.2.2",
|
||||
"prettier": "^2.8.8",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"webpack": "^5.89.0",
|
||||
"webpack-bundle-analyzer": "^4.9.1",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-dev-server": "^4.15.1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"license": "MIT"
|
||||
}
|
||||
336
node_modules/react-smooth/src/Animate.js
generated
vendored
Normal file
336
node_modules/react-smooth/src/Animate.js
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
import React, { PureComponent, cloneElement, Children } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { deepEqual } from 'fast-equals';
|
||||
import createAnimateManager from './AnimateManager';
|
||||
import { configEasing } from './easing';
|
||||
import configUpdate from './configUpdate';
|
||||
import { getTransitionVal, identity } from './util';
|
||||
|
||||
class Animate extends PureComponent {
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
const { isActive, attributeName, from, to, steps, children, duration } = this.props;
|
||||
|
||||
this.handleStyleChange = this.handleStyleChange.bind(this);
|
||||
this.changeStyle = this.changeStyle.bind(this);
|
||||
|
||||
if (!isActive || duration <= 0) {
|
||||
this.state = { style: {} };
|
||||
|
||||
// if children is a function and animation is not active, set style to 'to'
|
||||
if (typeof children === 'function') {
|
||||
this.state = { style: to };
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (steps && steps.length) {
|
||||
this.state = { style: steps[0].style };
|
||||
} else if (from) {
|
||||
if (typeof children === 'function') {
|
||||
this.state = {
|
||||
style: from,
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
this.state = {
|
||||
style: attributeName ? { [attributeName]: from } : from,
|
||||
};
|
||||
} else {
|
||||
this.state = { style: {} };
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { isActive, canBegin } = this.props;
|
||||
|
||||
this.mounted = true;
|
||||
|
||||
if (!isActive || !canBegin) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.runAnimation(this.props);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { isActive, canBegin, attributeName, shouldReAnimate, to, from: currentFrom } = this.props;
|
||||
const { style } = this.state;
|
||||
|
||||
if (!canBegin) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isActive) {
|
||||
const newState = {
|
||||
style: attributeName ? { [attributeName]: to } : to,
|
||||
};
|
||||
if (this.state && style) {
|
||||
if ((attributeName && style[attributeName] !== to) || (!attributeName && style !== to)) {
|
||||
// eslint-disable-next-line react/no-did-update-set-state
|
||||
this.setState(newState);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (deepEqual(prevProps.to, to) && prevProps.canBegin && prevProps.isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isTriggered = !prevProps.canBegin || !prevProps.isActive;
|
||||
|
||||
if (this.manager) {
|
||||
this.manager.stop();
|
||||
}
|
||||
|
||||
if (this.stopJSAnimation) {
|
||||
this.stopJSAnimation();
|
||||
}
|
||||
|
||||
const from = isTriggered || shouldReAnimate ? currentFrom : prevProps.to;
|
||||
|
||||
if (this.state && style) {
|
||||
const newState = {
|
||||
style: attributeName ? { [attributeName]: from } : from,
|
||||
};
|
||||
if ((attributeName && style[attributeName] !== from) || (!attributeName && style !== from)) {
|
||||
// eslint-disable-next-line react/no-did-update-set-state
|
||||
this.setState(newState);
|
||||
}
|
||||
}
|
||||
|
||||
this.runAnimation({
|
||||
...this.props,
|
||||
from,
|
||||
begin: 0,
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
const { onAnimationEnd } = this.props;
|
||||
|
||||
if (this.unSubscribe) {
|
||||
this.unSubscribe();
|
||||
}
|
||||
|
||||
if (this.manager) {
|
||||
this.manager.stop();
|
||||
this.manager = null;
|
||||
}
|
||||
|
||||
if (this.stopJSAnimation) {
|
||||
this.stopJSAnimation();
|
||||
}
|
||||
|
||||
if (onAnimationEnd) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
}
|
||||
|
||||
handleStyleChange(style) {
|
||||
this.changeStyle(style);
|
||||
}
|
||||
|
||||
changeStyle(style) {
|
||||
if (this.mounted) {
|
||||
this.setState({
|
||||
style,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
runJSAnimation(props) {
|
||||
const { from, to, duration, easing, begin, onAnimationEnd, onAnimationStart } = props;
|
||||
const startAnimation = configUpdate(from, to, configEasing(easing), duration, this.changeStyle);
|
||||
|
||||
const finalStartAnimation = () => {
|
||||
this.stopJSAnimation = startAnimation();
|
||||
};
|
||||
|
||||
this.manager.start([onAnimationStart, begin, finalStartAnimation, duration, onAnimationEnd]);
|
||||
}
|
||||
|
||||
runStepAnimation(props) {
|
||||
const { steps, begin, onAnimationStart } = props;
|
||||
const { style: initialStyle, duration: initialTime = 0 } = steps[0];
|
||||
|
||||
const addStyle = (sequence, nextItem, index) => {
|
||||
if (index === 0) {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
const { duration, easing = 'ease', style, properties: nextProperties, onAnimationEnd } = nextItem;
|
||||
|
||||
const preItem = index > 0 ? steps[index - 1] : nextItem;
|
||||
const properties = nextProperties || Object.keys(style);
|
||||
|
||||
if (typeof easing === 'function' || easing === 'spring') {
|
||||
return [
|
||||
...sequence,
|
||||
this.runJSAnimation.bind(this, {
|
||||
from: preItem.style,
|
||||
to: style,
|
||||
duration,
|
||||
easing,
|
||||
}),
|
||||
duration,
|
||||
];
|
||||
}
|
||||
|
||||
const transition = getTransitionVal(properties, duration, easing);
|
||||
const newStyle = {
|
||||
...preItem.style,
|
||||
...style,
|
||||
transition,
|
||||
};
|
||||
|
||||
return [...sequence, newStyle, duration, onAnimationEnd].filter(identity);
|
||||
};
|
||||
|
||||
return this.manager.start([
|
||||
onAnimationStart,
|
||||
...steps.reduce(addStyle, [initialStyle, Math.max(initialTime, begin)]),
|
||||
props.onAnimationEnd,
|
||||
]);
|
||||
}
|
||||
|
||||
runAnimation(props) {
|
||||
if (!this.manager) {
|
||||
this.manager = createAnimateManager();
|
||||
}
|
||||
const {
|
||||
begin,
|
||||
duration,
|
||||
attributeName,
|
||||
to: propsTo,
|
||||
easing,
|
||||
onAnimationStart,
|
||||
onAnimationEnd,
|
||||
steps,
|
||||
children,
|
||||
} = props;
|
||||
|
||||
const manager = this.manager;
|
||||
|
||||
this.unSubscribe = manager.subscribe(this.handleStyleChange);
|
||||
|
||||
if (typeof easing === 'function' || typeof children === 'function' || easing === 'spring') {
|
||||
this.runJSAnimation(props);
|
||||
return;
|
||||
}
|
||||
|
||||
if (steps.length > 1) {
|
||||
this.runStepAnimation(props);
|
||||
return;
|
||||
}
|
||||
|
||||
const to = attributeName ? { [attributeName]: propsTo } : propsTo;
|
||||
const transition = getTransitionVal(Object.keys(to), duration, easing);
|
||||
|
||||
manager.start([onAnimationStart, begin, { ...to, transition }, duration, onAnimationEnd]);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
children,
|
||||
begin,
|
||||
duration,
|
||||
attributeName,
|
||||
easing,
|
||||
isActive,
|
||||
steps,
|
||||
from,
|
||||
to,
|
||||
canBegin,
|
||||
onAnimationEnd,
|
||||
shouldReAnimate,
|
||||
onAnimationReStart,
|
||||
...others
|
||||
} = this.props;
|
||||
const count = Children.count(children);
|
||||
// eslint-disable-next-line react/destructuring-assignment
|
||||
const stateStyle = this.state.style;
|
||||
|
||||
if (typeof children === 'function') {
|
||||
return children(stateStyle);
|
||||
}
|
||||
|
||||
if (!isActive || count === 0 || duration <= 0) {
|
||||
return children;
|
||||
}
|
||||
|
||||
const cloneContainer = container => {
|
||||
const { style = {}, className } = container.props;
|
||||
|
||||
const res = cloneElement(container, {
|
||||
...others,
|
||||
style: {
|
||||
...style,
|
||||
...stateStyle,
|
||||
},
|
||||
className,
|
||||
});
|
||||
return res;
|
||||
};
|
||||
|
||||
if (count === 1) {
|
||||
return cloneContainer(Children.only(children));
|
||||
}
|
||||
|
||||
return <div>{Children.map(children, child => cloneContainer(child))}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
Animate.displayName = 'Animate';
|
||||
|
||||
Animate.defaultProps = {
|
||||
begin: 0,
|
||||
duration: 1000,
|
||||
from: '',
|
||||
to: '',
|
||||
attributeName: '',
|
||||
easing: 'ease',
|
||||
isActive: true,
|
||||
canBegin: true,
|
||||
steps: [],
|
||||
onAnimationEnd: () => {},
|
||||
onAnimationStart: () => {},
|
||||
};
|
||||
|
||||
Animate.propTypes = {
|
||||
from: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
||||
to: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
||||
attributeName: PropTypes.string,
|
||||
// animation duration
|
||||
duration: PropTypes.number,
|
||||
begin: PropTypes.number,
|
||||
easing: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
steps: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
duration: PropTypes.number.isRequired,
|
||||
style: PropTypes.object.isRequired,
|
||||
easing: PropTypes.oneOfType([
|
||||
PropTypes.oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear']),
|
||||
PropTypes.func,
|
||||
]),
|
||||
// transition css properties(dash case), optional
|
||||
properties: PropTypes.arrayOf('string'),
|
||||
onAnimationEnd: PropTypes.func,
|
||||
}),
|
||||
),
|
||||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
||||
isActive: PropTypes.bool,
|
||||
canBegin: PropTypes.bool,
|
||||
onAnimationEnd: PropTypes.func,
|
||||
// decide if it should reanimate with initial from style when props change
|
||||
shouldReAnimate: PropTypes.bool,
|
||||
onAnimationStart: PropTypes.func,
|
||||
onAnimationReStart: PropTypes.func,
|
||||
};
|
||||
|
||||
export default Animate;
|
||||
37
node_modules/react-smooth/src/AnimateGroup.js
generated
vendored
Normal file
37
node_modules/react-smooth/src/AnimateGroup.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import React, { Children } from 'react';
|
||||
import { TransitionGroup } from 'react-transition-group';
|
||||
import PropTypes from 'prop-types';
|
||||
import AnimateGroupChild from './AnimateGroupChild';
|
||||
|
||||
function AnimateGroup(props) {
|
||||
const { component, children, appear, enter, leave } = props;
|
||||
|
||||
return (
|
||||
<TransitionGroup component={component}>
|
||||
{Children.map(children, (child, index) => (
|
||||
<AnimateGroupChild
|
||||
appearOptions={appear}
|
||||
enterOptions={enter}
|
||||
leaveOptions={leave}
|
||||
key={`child-${index}`} // eslint-disable-line
|
||||
>
|
||||
{child}
|
||||
</AnimateGroupChild>
|
||||
))}
|
||||
</TransitionGroup>
|
||||
);
|
||||
}
|
||||
|
||||
AnimateGroup.propTypes = {
|
||||
appear: PropTypes.object,
|
||||
enter: PropTypes.object,
|
||||
leave: PropTypes.object,
|
||||
children: PropTypes.oneOfType([PropTypes.array, PropTypes.element]),
|
||||
component: PropTypes.any,
|
||||
};
|
||||
|
||||
AnimateGroup.defaultProps = {
|
||||
component: 'span',
|
||||
};
|
||||
|
||||
export default AnimateGroup;
|
||||
86
node_modules/react-smooth/src/AnimateGroupChild.js
generated
vendored
Normal file
86
node_modules/react-smooth/src/AnimateGroupChild.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
import React, { Component, Children } from 'react';
|
||||
import { Transition } from 'react-transition-group';
|
||||
import PropTypes from 'prop-types';
|
||||
import Animate from './Animate';
|
||||
|
||||
const parseDurationOfSingleTransition = (options = {}) => {
|
||||
const { steps, duration } = options;
|
||||
|
||||
if (steps && steps.length) {
|
||||
return steps.reduce(
|
||||
(result, entry) => result + (Number.isFinite(entry.duration) && entry.duration > 0 ? entry.duration : 0),
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
if (Number.isFinite(duration)) {
|
||||
return duration;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
class AnimateGroupChild extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
isActive: false,
|
||||
};
|
||||
}
|
||||
|
||||
handleStyleActive(style) {
|
||||
if (style) {
|
||||
const onAnimationEnd = style.onAnimationEnd
|
||||
? () => {
|
||||
style.onAnimationEnd();
|
||||
}
|
||||
: null;
|
||||
|
||||
this.setState({
|
||||
...style,
|
||||
onAnimationEnd,
|
||||
isActive: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
handleEnter = (node, isAppearing) => {
|
||||
const { appearOptions, enterOptions } = this.props;
|
||||
|
||||
this.handleStyleActive(isAppearing ? appearOptions : enterOptions);
|
||||
};
|
||||
|
||||
handleExit = () => {
|
||||
const { leaveOptions } = this.props;
|
||||
this.handleStyleActive(leaveOptions);
|
||||
};
|
||||
|
||||
parseTimeout() {
|
||||
const { appearOptions, enterOptions, leaveOptions } = this.props;
|
||||
|
||||
return (
|
||||
parseDurationOfSingleTransition(appearOptions) +
|
||||
parseDurationOfSingleTransition(enterOptions) +
|
||||
parseDurationOfSingleTransition(leaveOptions)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, appearOptions, enterOptions, leaveOptions, ...props } = this.props;
|
||||
|
||||
return (
|
||||
<Transition {...props} onEnter={this.handleEnter} onExit={this.handleExit} timeout={this.parseTimeout()}>
|
||||
{() => <Animate {...this.state}>{Children.only(children)}</Animate>}
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
AnimateGroupChild.propTypes = {
|
||||
appearOptions: PropTypes.object,
|
||||
enterOptions: PropTypes.object,
|
||||
leaveOptions: PropTypes.object,
|
||||
children: PropTypes.element,
|
||||
};
|
||||
|
||||
export default AnimateGroupChild;
|
||||
58
node_modules/react-smooth/src/AnimateManager.js
generated
vendored
Normal file
58
node_modules/react-smooth/src/AnimateManager.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import setRafTimeout from './setRafTimeout';
|
||||
|
||||
export default function createAnimateManager() {
|
||||
let currStyle = {};
|
||||
let handleChange = () => null;
|
||||
let shouldStop = false;
|
||||
|
||||
const setStyle = _style => {
|
||||
if (shouldStop) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Array.isArray(_style)) {
|
||||
if (!_style.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const styles = _style;
|
||||
const [curr, ...restStyles] = styles;
|
||||
|
||||
if (typeof curr === 'number') {
|
||||
setRafTimeout(setStyle.bind(null, restStyles), curr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
setStyle(curr);
|
||||
setRafTimeout(setStyle.bind(null, restStyles));
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof _style === 'object') {
|
||||
currStyle = _style;
|
||||
handleChange(currStyle);
|
||||
}
|
||||
|
||||
if (typeof _style === 'function') {
|
||||
_style();
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
stop: () => {
|
||||
shouldStop = true;
|
||||
},
|
||||
start: style => {
|
||||
shouldStop = false;
|
||||
setStyle(style);
|
||||
},
|
||||
subscribe: _handleChange => {
|
||||
handleChange = _handleChange;
|
||||
|
||||
return () => {
|
||||
handleChange = () => null;
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
134
node_modules/react-smooth/src/configUpdate.js
generated
vendored
Normal file
134
node_modules/react-smooth/src/configUpdate.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
import { getIntersectionKeys, mapObject } from './util';
|
||||
|
||||
const alpha = (begin, end, k) => begin + (end - begin) * k;
|
||||
const needContinue = ({ from, to }) => from !== to;
|
||||
|
||||
/*
|
||||
* @description: cal new from value and velocity in each stepper
|
||||
* @return: { [styleProperty]: { from, to, velocity } }
|
||||
*/
|
||||
const calStepperVals = (easing, preVals, steps) => {
|
||||
const nextStepVals = mapObject((key, val) => {
|
||||
if (needContinue(val)) {
|
||||
const [newX, newV] = easing(val.from, val.to, val.velocity);
|
||||
return {
|
||||
...val,
|
||||
from: newX,
|
||||
velocity: newV,
|
||||
};
|
||||
}
|
||||
|
||||
return val;
|
||||
}, preVals);
|
||||
|
||||
if (steps < 1) {
|
||||
return mapObject((key, val) => {
|
||||
if (needContinue(val)) {
|
||||
return {
|
||||
...val,
|
||||
velocity: alpha(val.velocity, nextStepVals[key].velocity, steps),
|
||||
from: alpha(val.from, nextStepVals[key].from, steps),
|
||||
};
|
||||
}
|
||||
|
||||
return val;
|
||||
}, preVals);
|
||||
}
|
||||
|
||||
return calStepperVals(easing, nextStepVals, steps - 1);
|
||||
};
|
||||
|
||||
// configure update function
|
||||
export default (from, to, easing, duration, render) => {
|
||||
const interKeys = getIntersectionKeys(from, to);
|
||||
const timingStyle = interKeys.reduce(
|
||||
(res, key) => ({
|
||||
...res,
|
||||
[key]: [from[key], to[key]],
|
||||
}),
|
||||
{},
|
||||
);
|
||||
|
||||
let stepperStyle = interKeys.reduce(
|
||||
(res, key) => ({
|
||||
...res,
|
||||
[key]: {
|
||||
from: from[key],
|
||||
velocity: 0,
|
||||
to: to[key],
|
||||
},
|
||||
}),
|
||||
{},
|
||||
);
|
||||
let cafId = -1;
|
||||
let preTime;
|
||||
let beginTime;
|
||||
let update = () => null;
|
||||
|
||||
const getCurrStyle = () => mapObject((key, val) => val.from, stepperStyle);
|
||||
const shouldStopAnimation = () => !Object.values(stepperStyle).filter(needContinue).length;
|
||||
|
||||
// stepper timing function like spring
|
||||
const stepperUpdate = now => {
|
||||
if (!preTime) {
|
||||
preTime = now;
|
||||
}
|
||||
const deltaTime = now - preTime;
|
||||
const steps = deltaTime / easing.dt;
|
||||
|
||||
stepperStyle = calStepperVals(easing, stepperStyle, steps);
|
||||
// get union set and add compatible prefix
|
||||
render({
|
||||
...from,
|
||||
...to,
|
||||
...getCurrStyle(stepperStyle),
|
||||
});
|
||||
|
||||
preTime = now;
|
||||
|
||||
if (!shouldStopAnimation()) {
|
||||
cafId = requestAnimationFrame(update);
|
||||
}
|
||||
};
|
||||
|
||||
// t => val timing function like cubic-bezier
|
||||
const timingUpdate = now => {
|
||||
if (!beginTime) {
|
||||
beginTime = now;
|
||||
}
|
||||
|
||||
const t = (now - beginTime) / duration;
|
||||
const currStyle = mapObject((key, val) => alpha(...val, easing(t)), timingStyle);
|
||||
|
||||
// get union set and add compatible prefix
|
||||
render({
|
||||
...from,
|
||||
...to,
|
||||
...currStyle,
|
||||
});
|
||||
|
||||
if (t < 1) {
|
||||
cafId = requestAnimationFrame(update);
|
||||
} else {
|
||||
const finalStyle = mapObject((key, val) => alpha(...val, easing(1)), timingStyle);
|
||||
|
||||
render({
|
||||
...from,
|
||||
...to,
|
||||
...finalStyle,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
update = easing.isStepper ? stepperUpdate : timingUpdate;
|
||||
|
||||
// return start animation method
|
||||
return () => {
|
||||
requestAnimationFrame(update);
|
||||
|
||||
// return stop animation method
|
||||
return () => {
|
||||
cancelAnimationFrame(cafId);
|
||||
};
|
||||
};
|
||||
};
|
||||
159
node_modules/react-smooth/src/easing.js
generated
vendored
Normal file
159
node_modules/react-smooth/src/easing.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
import { warn } from './util';
|
||||
|
||||
const ACCURACY = 1e-4;
|
||||
|
||||
const cubicBezierFactor = (c1, c2) => [0, 3 * c1, 3 * c2 - 6 * c1, 3 * c1 - 3 * c2 + 1];
|
||||
|
||||
const multyTime = (params, t) => params.map((param, i) => param * t ** i).reduce((pre, curr) => pre + curr);
|
||||
|
||||
const cubicBezier = (c1, c2) => t => {
|
||||
const params = cubicBezierFactor(c1, c2);
|
||||
|
||||
return multyTime(params, t);
|
||||
};
|
||||
|
||||
const derivativeCubicBezier = (c1, c2) => t => {
|
||||
const params = cubicBezierFactor(c1, c2);
|
||||
const newParams = [...params.map((param, i) => param * i).slice(1), 0];
|
||||
|
||||
return multyTime(newParams, t);
|
||||
};
|
||||
|
||||
// calculate cubic-bezier using Newton's method
|
||||
export const configBezier = (...args) => {
|
||||
let [x1, y1, x2, y2] = args;
|
||||
|
||||
if (args.length === 1) {
|
||||
switch (args[0]) {
|
||||
case 'linear':
|
||||
[x1, y1, x2, y2] = [0.0, 0.0, 1.0, 1.0];
|
||||
break;
|
||||
case 'ease':
|
||||
[x1, y1, x2, y2] = [0.25, 0.1, 0.25, 1.0];
|
||||
break;
|
||||
case 'ease-in':
|
||||
[x1, y1, x2, y2] = [0.42, 0.0, 1.0, 1.0];
|
||||
break;
|
||||
case 'ease-out':
|
||||
[x1, y1, x2, y2] = [0.42, 0.0, 0.58, 1.0];
|
||||
break;
|
||||
case 'ease-in-out':
|
||||
[x1, y1, x2, y2] = [0.0, 0.0, 0.58, 1.0];
|
||||
break;
|
||||
default: {
|
||||
const easing = args[0].split('(');
|
||||
if (easing[0] === 'cubic-bezier' && easing[1].split(')')[0].split(',').length === 4) {
|
||||
[x1, y1, x2, y2] = easing[1]
|
||||
.split(')')[0]
|
||||
.split(',')
|
||||
.map(x => parseFloat(x));
|
||||
} else {
|
||||
warn(
|
||||
false,
|
||||
'[configBezier]: arguments should be one of ' +
|
||||
"oneOf 'linear', 'ease', 'ease-in', 'ease-out', " +
|
||||
"'ease-in-out','cubic-bezier(x1,y1,x2,y2)', instead received %s",
|
||||
args,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
warn(
|
||||
[x1, x2, y1, y2].every(num => typeof num === 'number' && num >= 0 && num <= 1),
|
||||
'[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s',
|
||||
args,
|
||||
);
|
||||
|
||||
const curveX = cubicBezier(x1, x2);
|
||||
const curveY = cubicBezier(y1, y2);
|
||||
const derCurveX = derivativeCubicBezier(x1, x2);
|
||||
const rangeValue = value => {
|
||||
if (value > 1) {
|
||||
return 1;
|
||||
}
|
||||
if (value < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
const bezier = _t => {
|
||||
const t = _t > 1 ? 1 : _t;
|
||||
let x = t;
|
||||
|
||||
for (let i = 0; i < 8; ++i) {
|
||||
const evalT = curveX(x) - t;
|
||||
const derVal = derCurveX(x);
|
||||
|
||||
if (Math.abs(evalT - t) < ACCURACY || derVal < ACCURACY) {
|
||||
return curveY(x);
|
||||
}
|
||||
|
||||
x = rangeValue(x - evalT / derVal);
|
||||
}
|
||||
|
||||
return curveY(x);
|
||||
};
|
||||
|
||||
bezier.isStepper = false;
|
||||
|
||||
return bezier;
|
||||
};
|
||||
|
||||
export const configSpring = (config = {}) => {
|
||||
const { stiff = 100, damping = 8, dt = 17 } = config;
|
||||
const stepper = (currX, destX, currV) => {
|
||||
const FSpring = -(currX - destX) * stiff;
|
||||
const FDamping = currV * damping;
|
||||
const newV = currV + ((FSpring - FDamping) * dt) / 1000;
|
||||
const newX = (currV * dt) / 1000 + currX;
|
||||
|
||||
if (Math.abs(newX - destX) < ACCURACY && Math.abs(newV) < ACCURACY) {
|
||||
return [destX, 0];
|
||||
}
|
||||
return [newX, newV];
|
||||
};
|
||||
|
||||
stepper.isStepper = true;
|
||||
stepper.dt = dt;
|
||||
|
||||
return stepper;
|
||||
};
|
||||
|
||||
export const configEasing = (...args) => {
|
||||
const [easing] = args;
|
||||
|
||||
if (typeof easing === 'string') {
|
||||
switch (easing) {
|
||||
case 'ease':
|
||||
case 'ease-in-out':
|
||||
case 'ease-out':
|
||||
case 'ease-in':
|
||||
case 'linear':
|
||||
return configBezier(easing);
|
||||
case 'spring':
|
||||
return configSpring();
|
||||
default:
|
||||
if (easing.split('(')[0] === 'cubic-bezier') {
|
||||
return configBezier(easing);
|
||||
}
|
||||
warn(
|
||||
false,
|
||||
"[configEasing]: first argument should be one of 'ease', 'ease-in', " +
|
||||
"'ease-out', 'ease-in-out','cubic-bezier(x1,y1,x2,y2)', 'linear' and 'spring', instead received %s",
|
||||
args,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof easing === 'function') {
|
||||
return easing;
|
||||
}
|
||||
|
||||
warn(false, '[configEasing]: first argument type should be function or string, instead received %s', args);
|
||||
|
||||
return null;
|
||||
};
|
||||
7
node_modules/react-smooth/src/index.js
generated
vendored
Normal file
7
node_modules/react-smooth/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import Animate from './Animate';
|
||||
import { configBezier, configSpring } from './easing';
|
||||
import AnimateGroup from './AnimateGroup';
|
||||
|
||||
export { configSpring, configBezier, AnimateGroup };
|
||||
|
||||
export default Animate;
|
||||
22
node_modules/react-smooth/src/setRafTimeout.js
generated
vendored
Normal file
22
node_modules/react-smooth/src/setRafTimeout.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
function safeRequestAnimationFrame(callback) {
|
||||
if (typeof requestAnimationFrame !== 'undefined') requestAnimationFrame(callback);
|
||||
}
|
||||
|
||||
export default function setRafTimeout(callback, timeout = 0) {
|
||||
let currTime = -1;
|
||||
|
||||
const shouldUpdate = now => {
|
||||
if (currTime < 0) {
|
||||
currTime = now;
|
||||
}
|
||||
|
||||
if (now - currTime > timeout) {
|
||||
callback(now);
|
||||
currTime = -1;
|
||||
} else {
|
||||
safeRequestAnimationFrame(shouldUpdate);
|
||||
}
|
||||
};
|
||||
|
||||
requestAnimationFrame(shouldUpdate);
|
||||
}
|
||||
82
node_modules/react-smooth/src/util.js
generated
vendored
Normal file
82
node_modules/react-smooth/src/util.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/* eslint no-console: 0 */
|
||||
|
||||
export const getIntersectionKeys = (preObj, nextObj) =>
|
||||
[Object.keys(preObj), Object.keys(nextObj)].reduce((a, b) => a.filter(c => b.includes(c)));
|
||||
|
||||
export const identity = param => param;
|
||||
|
||||
/*
|
||||
* @description: convert camel case to dash case
|
||||
* string => string
|
||||
*/
|
||||
export const getDashCase = name => name.replace(/([A-Z])/g, v => `-${v.toLowerCase()}`);
|
||||
|
||||
export const log = (...args) => {
|
||||
console.log(...args);
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: log the value of a varible
|
||||
* string => any => any
|
||||
*/
|
||||
export const debug = name => item => {
|
||||
log(name, item);
|
||||
|
||||
return item;
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: log name, args, return value of a function
|
||||
* function => function
|
||||
*/
|
||||
export const debugf =
|
||||
(tag, f) =>
|
||||
(...args) => {
|
||||
const res = f(...args);
|
||||
const name = tag || f.name || 'anonymous function';
|
||||
const argNames = `(${args.map(JSON.stringify).join(', ')})`;
|
||||
|
||||
log(`${name}: ${argNames} => ${JSON.stringify(res)}`);
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
/*
|
||||
* @description: map object on every element in this object.
|
||||
* (function, object) => object
|
||||
*/
|
||||
export const mapObject = (fn, obj) =>
|
||||
Object.keys(obj).reduce(
|
||||
(res, key) => ({
|
||||
...res,
|
||||
[key]: fn(key, obj[key]),
|
||||
}),
|
||||
{},
|
||||
);
|
||||
|
||||
export const getTransitionVal = (props, duration, easing) =>
|
||||
props.map(prop => `${getDashCase(prop)} ${duration}ms ${easing}`).join(',');
|
||||
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
export const warn = (condition, format, a, b, c, d, e, f) => {
|
||||
if (isDev && typeof console !== 'undefined' && console.warn) {
|
||||
if (format === undefined) {
|
||||
console.warn('LogUtils requires an error message argument');
|
||||
}
|
||||
|
||||
if (!condition) {
|
||||
if (format === undefined) {
|
||||
console.warn(
|
||||
'Minified exception occurred; use the non-minified dev environment ' +
|
||||
'for the full error message and additional helpful warnings.',
|
||||
);
|
||||
} else {
|
||||
const args = [a, b, c, d, e, f];
|
||||
let argIndex = 0;
|
||||
|
||||
console.warn(format.replace(/%s/g, () => args[argIndex++]));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
264
node_modules/react-smooth/umd/ReactSmooth.js
generated
vendored
Normal file
264
node_modules/react-smooth/umd/ReactSmooth.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/react-smooth/umd/ReactSmooth.min.js
generated
vendored
Normal file
1
node_modules/react-smooth/umd/ReactSmooth.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user