react-move
Advanced tools
Comparing version 6.1.0 to 6.2.0
@@ -22,3 +22,3 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -31,2 +31,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || 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; } return _assertThisInitialized(self); } | ||
@@ -36,8 +42,6 @@ | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var keyAccessor = function keyAccessor() { | ||
@@ -50,6 +54,8 @@ return '$$key$$'; | ||
var _super = _createSuper(Animate); | ||
function Animate() { | ||
_classCallCheck(this, Animate); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Animate).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -56,0 +62,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactMove={},t.React)}(this,(function(t,e){"use strict";var n="default"in e?e.default:e;var r,i,o=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},a=0,s=0,u=0,l=1e3,c=0,f=0,h=0,p="object"==typeof performance&&performance.now?performance:Date,y="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function v(){return f||(y(d),f=p.now()+h)}function d(){f=0}function m(){this._call=this._time=this._next=null}function g(t,e,n){var r=new m;return r.restart(t,e,n),r}function w(){f=(c=p.now())+h,a=s=0;try{!function(){v(),++a;for(var t,e=r;e;)(t=f-e._time)>=0&&e._call.call(null,t),e=e._next;--a}()}finally{a=0,function(){var t,e,n=r,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:r=e);i=t,_(o)}(),f=0}}function b(){var t=p.now(),e=t-c;e>l&&(h-=e,c=t)}function _(t){a||(s&&(s=clearTimeout(s)),t-f>24?(t<1/0&&(s=setTimeout(w,t-p.now()-h)),u&&(u=clearInterval(u))):(u||(c=p.now(),u=setInterval(b,l)),a=1,y(w)))}function k(t,e,n){var r=new m;return e=null==e?0:+e,r.restart((function(n){r.stop(),t(n+e)}),e,n),r}function S(t){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}m.prototype=g.prototype={constructor:m,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?v():+n)+(null==e?0:+e),this._next||i===this||(i?i._next=this:r=this,i=this),this._call=t,this._time=n,_()},stop:function(){this._call&&(this._call=null,this._time=1/0,_())}};var T=0;function D(t,e){for(var n in e)t[n]=e[n]}var E={delay:0,duration:250,ease:function(t){return+t}};var j=function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.start=null,this.interrupt=null,this.end=null,e.events&&Object.keys(e.events).forEach((function(t){if("function"!=typeof e.events[t])throw new Error("Event handlers must be a function");var r,i;n[t]=(r=e.events[t],i=!1,function(){i||(i=!0,r.call(this))})}))};function A(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){x(t,e,n[e])}))}return t}function x(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var P=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state=e||{}}var e,n,r;return e=t,(n=[{key:"transition",value:function(t){if(Array.isArray(t)){var e=!0,n=!1,r=void 0;try{for(var i,o=t[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var a=i.value;this.parse(a)}}catch(t){n=!0,r=t}finally{try{e||null==o.return||o.return()}finally{if(n)throw r}}}else this.parse(t)}},{key:"isTransitioning",value:function(){return!!this.transitionData}},{key:"stopTransitions",value:function(){var t=this.transitionData;t&&Object.keys(t).forEach((function(e){t[e].timer.stop()}))}},{key:"setState",value:function(t){D(this.state,"function"==typeof t?t(this.state):t)}},{key:"parse",value:function(t){var e=this,n=A({},t),r=new j(n);n.events&&delete n.events;var i=A({},E,n.timing||{},{time:v()});n.timing&&delete n.timing,Object.keys(n).forEach((function(t){var o,a,s=[],u=n[t];if("object"===S(a=u)&&!1===Array.isArray(a))Object.keys(u).forEach((function(n){var r=u[n];Array.isArray(r)?1===r.length?s.push(e.getTween(n,r[0],t)):(e.setState((function(e){var i,o;return(o={})[t]=A({},e[t],((i={})[n]=r[0],i)),o})),s.push(e.getTween(n,r[1],t))):"function"==typeof r?s.push((function(){return function(i){e.setState((function(e){var o,a;return(a={})[t]=A({},e[t],((o={})[n]=r(i),o)),a}))}})):(e.setState((function(e){var i,o;return(o={})[t]=A({},e[t],((i={})[n]=r,i)),o})),s.push(e.getTween(n,r,t)))}));else if(Array.isArray(u))1===u.length?s.push(e.getTween(t,u[0],null)):(e.setState(((o={})[t]=u[0],o)),s.push(e.getTween(t,u[1],null)));else if("function"==typeof u)s.push((function(){return function(n){var r;e.setState(((r={})[t]=u(n),r))}}));else{var l;e.setState(((l={})[t]=u,l)),s.push(e.getTween(t,u,null))}e.update({stateKey:t,timing:i,tweens:s,events:r,status:0})}))}},{key:"getTween",value:function(t,e,n){var r=this;return function(){var i=n?r.state[n][t]:r.state[t];if(i===e)return null;var o=r.getInterpolator(i,e,t,n);return null===n?function(e){var n;r.setState(((n={})[t]=o(e),n))}:function(e){r.setState((function(r){var i,a;return(a={})[n]=A({},r[n],((i={})[t]=o(e),i)),a}))}}}},{key:"update",value:function(t){this.transitionData||(this.transitionData={}),this.init(++T,t)}},{key:"init",value:function(t,e){var n=this,r=e.tweens.length,i=new Array(r);this.transitionData[t]=e,e.timer=g((function(t){e.status=1,e.timer.restart(o,e.timing.delay,e.timing.time),e.timing.delay<=t&&o(t-e.timing.delay)}),0,e.timing.time);var o=function o(u){if(1!==e.status)return s();for(var l in n.transitionData){var c=n.transitionData[l];if(c.stateKey===e.stateKey){if(3===c.status)return k(o);4===c.status?(c.status=6,c.timer.stop(),c.events.interrupt&&c.events.interrupt.call(n),delete n.transitionData[l]):+l<t&&(c.status=6,c.timer.stop(),delete n.transitionData[l])}}if(k((function(){3===e.status&&(e.status=4,e.timer.restart(a,e.timing.delay,e.timing.time),a(u))})),e.status=2,e.events.start&&e.events.start.call(n),2===e.status){e.status=3;for(var f=-1,h=0;h<r;++h){var p=e.tweens[h]();p&&(i[++f]=p)}i.length=f+1}},a=function(t){var r=1;t<e.timing.duration?r=e.timing.ease(t/e.timing.duration):(e.timer.restart(s),e.status=5);for(var o=-1;++o<i.length;)i[o](r);5===e.status&&(e.events.end&&e.events.end.call(n),s())},s=function(){for(var r in e.status=6,e.timer.stop(),delete n.transitionData[t],n.transitionData)return;delete n.transitionData}}}])&&O(e.prototype,n),r&&O(e,r),t}();const K="ENTER",I="UPDATE",C="LEAVE";function H(t,e){const n=+t,r=+e-n;return function(t){return n+r*t}}class N extends e.Component{constructor(t){super(t),o(this,"animate",()=>{const{nodeKeys:t,nodeHash:e}=this.state;if(this.unmounting)return;let n=!1;const r=[],i=t.length;for(let o=0;o<i;o++){const i=t[o],a=e[i],s=a.isTransitioning();s&&(n=!0),a.type!==C||s?r.push(i):delete e[i]}n||this.interval.stop(),this.setState(()=>({nodeKeys:r,nodes:r.map(t=>e[t])}))}),o(this,"interval",null),o(this,"unmounting",!1);const{interpolation:e}=t;this.state={Node:class extends P{constructor(t,n){super(),o(this,"getInterpolator",e),this.key=t,this.data=n,this.type=K}},nodeKeys:[],nodeHash:{},nodes:[],data:null}}static getDerivedStateFromProps(t,e){if(t.data!==e.data){const{data:n,keyAccessor:r,start:i,enter:o,update:a,leave:s}=t,{Node:u,nodeKeys:l,nodeHash:c}=e,f={};for(let t=0;t<l.length;t++)f[l[t]]=t;const h={},p=[];for(let t=0;t<n.length;t++){const e=n[t],i=r(e,t);if(h[i]=t,p.push(i),void 0===f[i]){const t=new u;t.key=i,t.data=e,t.type=K,c[i]=t}}for(let t=0;t<l.length;t++){const e=l[t],r=c[e];void 0!==h[e]?(r.data=n[h[e]],r.type=I):r.type=C}const y=function(t,e,n,r){const i=[];for(let t=0;t<n.length;t++)i[t]=n[t];for(let e=0;e<t.length;e++)void 0===r[t[e]]&&i.push(t[e]);return i.sort((t,i)=>{const o=r[t],a=r[i],s=e[t],u=e[i];if(null!=o&&null!=a)return r[t]-r[i];if(null!=s&&null!=u)return e[t]-e[i];if(null!=o){for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(o<r[i]&&u>e[i])return-1;if(o>r[i]&&u<e[i])return 1}}return 1}for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(a<r[i]&&s>e[i])return 1;if(a>r[i]&&s<e[i])return-1}}return-1})}(l,f,p,h);for(let t=0;t<y.length;t++){const e=y[t],n=c[e],r=n.data;n.type===K?(n.setState(i(r,h[e])),n.transition(o(r,h[e]))):n.type===C?n.transition(s(r,f[e])):n.transition(a(r,h[e]))}return{data:n,nodes:y.map(t=>c[t]),nodeHash:c,nodeKeys:y}}return null}componentDidMount(){this.startInterval()}componentDidUpdate(t){t.data===this.props.data||this.unmounting||this.startInterval()}startInterval(){var t,e,n,r,i;this.interval?this.interval.restart(this.animate):this.interval=(t=this.animate,r=new m,i=e,null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?v():+n,r.restart((function o(a){a+=i,r.restart(o,i+=e,n),t(a)}),e,n),r))}componentWillUnmount(){const{nodeKeys:t,nodeHash:e}=this.state;this.unmounting=!0,this.interval&&this.interval.stop(),t.forEach(t=>{e[t].stopTransitions()})}render(){const t=this.props.children(this.state.nodes);return t&&n.Children.only(t)}}N.defaultProps={enter:()=>{},update:()=>{},leave:()=>{},interpolation:H};const $=()=>"$$key$$";class q extends e.Component{render(){const{show:t,start:e,enter:r,update:i,leave:o,interpolation:a,children:s}=this.props,u="function"==typeof e?e():e;return n.createElement(N,{data:t?[u]:[],start:()=>u,keyAccessor:$,interpolation:a,enter:"function"==typeof r?r:()=>r,update:"function"==typeof i?i:()=>i,leave:"function"==typeof o?o:()=>o},t=>{if(!t[0])return null;const e=s(t[0].state);return e&&n.Children.only(e)})}}q.defaultProps={show:!0,interpolation:H},t.Animate=q,t.NodeGroup=N,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactMove={},t.React)}(this,(function(t,e){"use strict";var n="default"in e?e.default:e;var r,i,a=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},o=0,s=0,u=0,l=0,c=0,f=0,h="object"==typeof performance&&performance.now?performance:Date,p="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function y(){return c||(p(v),c=h.now()+f)}function v(){c=0}function d(){this._call=this._time=this._next=null}function m(t,e,n){var r=new d;return r.restart(t,e,n),r}function g(){c=(l=h.now())+f,o=s=0;try{!function(){y(),++o;for(var t,e=r;e;)(t=c-e._time)>=0&&e._call.call(null,t),e=e._next;--o}()}finally{o=0,function(){var t,e,n=r,a=1/0;for(;n;)n._call?(a>n._time&&(a=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:r=e);i=t,b(a)}(),c=0}}function w(){var t=h.now(),e=t-l;e>1e3&&(f-=e,l=t)}function b(t){o||(s&&(s=clearTimeout(s)),t-c>24?(t<1/0&&(s=setTimeout(g,t-h.now()-f)),u&&(u=clearInterval(u))):(u||(l=h.now(),u=setInterval(w,1e3)),o=1,p(g)))}function E(t,e,n){var r=new d;return e=null==e?0:+e,r.restart((function(n){r.stop(),t(n+e)}),e,n),r}function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}d.prototype=m.prototype={constructor:d,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?y():+n)+(null==e?0:+e),this._next||i===this||(i?i._next=this:r=this,i=this),this._call=t,this._time=n,b()},stop:function(){this._call&&(this._call=null,this._time=1/0,b())}};var T=0;function k(t,e){for(var n in e)t[n]=e[n]}var S={delay:0,duration:250,ease:function(t){return+t}};var A=function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.start=null,this.interrupt=null,this.end=null,e.events&&Object.keys(e.events).forEach((function(t){if("function"!=typeof e.events[t])throw new Error("Event handlers must be a function");var r,i;n[t]=(r=e.events[t],i=!1,function(){i||(i=!0,r.call(this))})}))};function D(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})))),r.forEach((function(e){j(t,e,n[e])}))}return t}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var O=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state=e||{}}var e,n,r;return e=t,(n=[{key:"transition",value:function(t){if(Array.isArray(t)){var e=!0,n=!1,r=void 0;try{for(var i,a=t[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value;this.parse(o)}}catch(t){n=!0,r=t}finally{try{e||null==a.return||a.return()}finally{if(n)throw r}}}else this.parse(t)}},{key:"isTransitioning",value:function(){return!!this.transitionData}},{key:"stopTransitions",value:function(){var t=this.transitionData;t&&Object.keys(t).forEach((function(e){t[e].timer.stop()}))}},{key:"setState",value:function(t){k(this.state,"function"==typeof t?t(this.state):t)}},{key:"parse",value:function(t){var e=this,n=D({},t),r=new A(n);n.events&&delete n.events;var i=D({},S,n.timing||{},{time:y()});n.timing&&delete n.timing,Object.keys(n).forEach((function(t){var a,o,s=[],u=n[t];if("object"===_(o=u)&&!1===Array.isArray(o))Object.keys(u).forEach((function(n){var r=u[n];Array.isArray(r)?1===r.length?s.push(e.getTween(n,r[0],t)):(e.setState((function(e){var i,a;return(a={})[t]=D({},e[t],((i={})[n]=r[0],i)),a})),s.push(e.getTween(n,r[1],t))):"function"==typeof r?s.push((function(){return function(i){e.setState((function(e){var a,o;return(o={})[t]=D({},e[t],((a={})[n]=r(i),a)),o}))}})):(e.setState((function(e){var i,a;return(a={})[t]=D({},e[t],((i={})[n]=r,i)),a})),s.push(e.getTween(n,r,t)))}));else if(Array.isArray(u))1===u.length?s.push(e.getTween(t,u[0],null)):(e.setState(((a={})[t]=u[0],a)),s.push(e.getTween(t,u[1],null)));else if("function"==typeof u)s.push((function(){return function(n){var r;e.setState(((r={})[t]=u(n),r))}}));else{var l;e.setState(((l={})[t]=u,l)),s.push(e.getTween(t,u,null))}e.update({stateKey:t,timing:i,tweens:s,events:r,status:0})}))}},{key:"getTween",value:function(t,e,n){var r=this;return function(){var i=n?r.state[n][t]:r.state[t];if(i===e)return null;var a=r.getInterpolator(i,e,t,n);return null===n?function(e){var n;r.setState(((n={})[t]=a(e),n))}:function(e){r.setState((function(r){var i,o;return(o={})[n]=D({},r[n],((i={})[t]=a(e),i)),o}))}}}},{key:"update",value:function(t){this.transitionData||(this.transitionData={}),this.init(++T,t)}},{key:"init",value:function(t,e){var n=this,r=e.tweens.length,i=new Array(r);this.transitionData[t]=e,e.timer=m((function(t){e.status=1,e.timer.restart(a,e.timing.delay,e.timing.time),e.timing.delay<=t&&a(t-e.timing.delay)}),0,e.timing.time);var a=function a(u){if(1!==e.status)return s();for(var l in n.transitionData){var c=n.transitionData[l];if(c.stateKey===e.stateKey){if(3===c.status)return E(a);4===c.status?(c.status=6,c.timer.stop(),c.events.interrupt&&c.events.interrupt.call(n),delete n.transitionData[l]):+l<t&&(c.status=6,c.timer.stop(),delete n.transitionData[l])}}if(E((function(){3===e.status&&(e.status=4,e.timer.restart(o,e.timing.delay,e.timing.time),o(u))})),e.status=2,e.events.start&&e.events.start.call(n),2===e.status){e.status=3;for(var f=-1,h=0;h<r;++h){var p=e.tweens[h]();p&&(i[++f]=p)}i.length=f+1}},o=function(t){var r=1;t<e.timing.duration?r=e.timing.ease(t/e.timing.duration):(e.timer.restart(s),e.status=5);for(var a=-1;++a<i.length;)i[a](r);5===e.status&&(e.events.end&&e.events.end.call(n),s())},s=function(){for(var r in e.status=6,e.timer.stop(),delete n.transitionData[t],n.transitionData)return;delete n.transitionData}}}])&&x(e.prototype,n),r&&x(e,r),t}();function P(t,e){const n=+t,r=+e-n;return function(t){return n+r*t}}class K extends e.Component{constructor(t){super(t),a(this,"animate",()=>{const{nodeKeys:t,nodeHash:e}=this.state;if(this.unmounting)return;let n=!1;const r=[],i=t.length;for(let a=0;a<i;a++){const i=t[a],o=e[i],s=o.isTransitioning();s&&(n=!0),"LEAVE"!==o.type||s?r.push(i):delete e[i]}n||this.interval.stop(),this.setState(()=>({nodeKeys:r,nodes:r.map(t=>e[t])}))}),a(this,"interval",null),a(this,"unmounting",!1);const{interpolation:e}=t;this.state={Node:class extends O{constructor(t,n){super(),a(this,"getInterpolator",e),this.key=t,this.data=n,this.type="ENTER"}},nodeKeys:[],nodeHash:{},nodes:[],data:null}}static getDerivedStateFromProps(t,e){if(t.data!==e.data){const{data:n,keyAccessor:r,start:i,enter:a,update:o,leave:s}=t,{Node:u,nodeKeys:l,nodeHash:c}=e,f={};for(let t=0;t<l.length;t++)f[l[t]]=t;const h={},p=[];for(let t=0;t<n.length;t++){const e=n[t],i=r(e,t);if(h[i]=t,p.push(i),void 0===f[i]){const t=new u;t.key=i,t.data=e,t.type="ENTER",c[i]=t}}for(let t=0;t<l.length;t++){const e=l[t],r=c[e];void 0!==h[e]?(r.data=n[h[e]],r.type="UPDATE"):r.type="LEAVE"}const y=function(t,e,n,r){const i=[];for(let t=0;t<n.length;t++)i[t]=n[t];for(let e=0;e<t.length;e++)void 0===r[t[e]]&&i.push(t[e]);return i.sort((t,i)=>{const a=r[t],o=r[i],s=e[t],u=e[i];if(null!=a&&null!=o)return r[t]-r[i];if(null!=s&&null!=u)return e[t]-e[i];if(null!=a){for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(a<r[i]&&u>e[i])return-1;if(a>r[i]&&u<e[i])return 1}}return 1}for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(o<r[i]&&s>e[i])return 1;if(o>r[i]&&s<e[i])return-1}}return-1})}(l,f,p,h);for(let t=0;t<y.length;t++){const e=y[t],n=c[e],r=n.data;"ENTER"===n.type?(n.setState(i(r,h[e])),n.transition(a(r,h[e]))):"LEAVE"===n.type?n.transition(s(r,f[e])):n.transition(o(r,h[e]))}return{data:n,nodes:y.map(t=>c[t]),nodeHash:c,nodeKeys:y}}return null}componentDidMount(){this.startInterval()}componentDidUpdate(t){t.data===this.props.data||this.unmounting||this.startInterval()}startInterval(){var t,e,n,r,i;this.interval?this.interval.restart(this.animate):this.interval=(t=this.animate,r=new d,i=e,null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?y():+n,r.restart((function a(o){o+=i,r.restart(a,i+=e,n),t(o)}),e,n),r))}componentWillUnmount(){const{nodeKeys:t,nodeHash:e}=this.state;this.unmounting=!0,this.interval&&this.interval.stop(),t.forEach(t=>{e[t].stopTransitions()})}render(){const t=this.props.children(this.state.nodes);return t&&n.Children.only(t)}}K.defaultProps={enter:()=>{},update:()=>{},leave:()=>{},interpolation:P};const I=()=>"$$key$$";class C extends e.Component{render(){const{show:t,start:e,enter:r,update:i,leave:a,interpolation:o,children:s}=this.props,u="function"==typeof e?e():e;return n.createElement(K,{data:t?[u]:[],start:()=>u,keyAccessor:I,interpolation:o,enter:"function"==typeof r?r:()=>r,update:"function"==typeof i?i:()=>i,leave:"function"==typeof a?a:()=>a},t=>{if(!t[0])return null;const e=s(t[0].state);return e&&n.Children.only(e)})}}C.defaultProps={show:!0,interpolation:P},t.Animate=C,t.NodeGroup=K,Object.defineProperty(t,"__esModule",{value:!0})})); |
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import _inherits from "@babel/runtime/helpers/esm/inherits"; | ||
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; | ||
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; | ||
import _inherits from "@babel/runtime/helpers/esm/inherits"; | ||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
import React, { Component } from 'react'; | ||
@@ -18,6 +23,8 @@ import PropTypes from 'prop-types'; | ||
var _super = _createSuper(Animate); | ||
function Animate() { | ||
_classCallCheck(this, Animate); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Animate).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -24,0 +31,0 @@ |
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized"; | ||
import _inherits from "@babel/runtime/helpers/esm/inherits"; | ||
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; | ||
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; | ||
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized"; | ||
import _inherits from "@babel/runtime/helpers/esm/inherits"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
import React, { Component } from 'react'; | ||
@@ -18,2 +23,4 @@ import PropTypes from 'prop-types'; | ||
var _super = _createSuper(NodeGroup); | ||
function NodeGroup(props) { | ||
@@ -24,3 +31,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(NodeGroup).call(this, props)); | ||
_this = _super.call(this, props); | ||
@@ -79,2 +86,4 @@ _defineProperty(_assertThisInitialized(_this), "animate", function () { | ||
var _super2 = _createSuper(Node); | ||
function Node(key, data) { | ||
@@ -85,3 +94,3 @@ var _this2; | ||
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(Node).call(this)); | ||
_this2 = _super2.call(this); | ||
@@ -88,0 +97,0 @@ _defineProperty(_assertThisInitialized(_this2), "getInterpolator", interpolation); |
@@ -26,3 +26,3 @@ "use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -35,11 +35,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || 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; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -51,2 +55,4 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var _super = _createSuper(NodeGroup); | ||
function NodeGroup(props) { | ||
@@ -57,3 +63,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(NodeGroup).call(this, props)); | ||
_this = _super.call(this, props); | ||
@@ -112,2 +118,4 @@ _defineProperty(_assertThisInitialized(_this), "animate", function () { | ||
var _super2 = _createSuper(Node); | ||
function Node(key, data) { | ||
@@ -118,3 +126,3 @@ var _this2; | ||
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(Node).call(this)); | ||
_this2 = _super2.call(this); | ||
@@ -121,0 +129,0 @@ _defineProperty(_assertThisInitialized(_this2), "getInterpolator", interpolation); |
{ | ||
"name": "react-move", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"contributors": [ | ||
{ | ||
"name": "Steven Hall", | ||
"email": "hall.steven.g@gmail.com", | ||
"url": "http://www.delimited.io" | ||
"email": "hall.steven.g@gmail.com" | ||
}, | ||
@@ -33,8 +32,8 @@ { | ||
], | ||
"repository": "git+https://github.com/react-tools/react-move.git", | ||
"repository": "git+https://github.com/sghall/react-move.git", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/react-tools/react-move/issues" | ||
"url": "https://github.com/sghall/react-move/issues" | ||
}, | ||
"homepage": "https://github.com/react-tools/react-move#readme", | ||
"homepage": "https://github.com/sghall/react-move#readme", | ||
"peerDependencies": { | ||
@@ -44,3 +43,3 @@ "react": "^16.3.0" | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.7", | ||
"@babel/runtime": "^7.10.3", | ||
"kapellmeister": "^3.0.1", | ||
@@ -47,0 +46,0 @@ "prop-types": "^15.7.2" |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
134499
2613
Updated@babel/runtime@^7.10.3