react-flip-toolkit
Advanced tools
Comparing version 7.1.0 to 7.2.0
import { ReactElement, ReactNode } from 'react'; | ||
declare const ExitContainer: ({ children }: { | ||
children: ReactNode; | ||
}) => ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>; | ||
}) => ReactElement<any, string | import("react").JSXElementConstructor<any>>; | ||
export default ExitContainer; |
@@ -0,0 +0,0 @@ import { FunctionComponent } from 'react'; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { FlipCallbacks } from 'flip-toolkit/lib/types'; | ||
export declare const FlipContext: import("react").Context<FlipCallbacks>; | ||
export declare const PortalContext: import("react").Context<string>; |
@@ -0,0 +0,0 @@ import React, { Component } from 'react'; |
@@ -0,1 +1,2 @@ | ||
export { disableFlip, enableFlip, isFlipEnabled } from 'flip-toolkit'; | ||
export { default as Flipper } from './Flipper'; | ||
@@ -2,0 +3,0 @@ export { default as Flipped } from './Flipped'; |
@@ -1,2 +0,2 @@ | ||
import e,{createContext as t,Component as r,Children as n,cloneElement as i}from"react";import"prop-types";import{getFlippedElementPositionsBeforeUpdate as o,onFlipKeyUpdate as p,utilities as l,constants as s,spring as a}from"flip-toolkit";function c(e,t){return(c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}var f=t({}),u=t("portal"),h=function(t){var r,n;function i(){var e;return(e=t.apply(this,arguments)||this).inProgressAnimations={},e.flipCallbacks={},e.el=void 0,e}n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,c(r,n);var l=i.prototype;return l.getSnapshotBeforeUpdate=function(e){return e.flipKey!==this.props.flipKey&&this.el?o({element:this.el,flipCallbacks:this.flipCallbacks,inProgressAnimations:this.inProgressAnimations,portalKey:this.props.portalKey}):null},l.componentDidUpdate=function(e,t,r){this.props.flipKey!==e.flipKey&&this.el&&p({flippedElementPositionsBeforeUpdate:r.flippedElementPositions,cachedOrderedFlipIds:r.cachedOrderedFlipIds,containerEl:this.el,inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks,applyTransformOrigin:this.props.applyTransformOrigin,spring:this.props.spring,debug:this.props.debug,portalKey:this.props.portalKey,staggerConfig:this.props.staggerConfig,handleEnterUpdateDelete:this.props.handleEnterUpdateDelete,decisionData:{previous:e.decisionData,current:this.props.decisionData},onComplete:this.props.onComplete,onStart:this.props.onStart})},l.render=function(){var t=this,r=this.props,n=r.portalKey,i=e.createElement(f.Provider,{value:this.flipCallbacks},e.createElement(r.element,{className:r.className,ref:function(e){return t.el=e}},this.props.children));return n&&(i=e.createElement(u.Provider,{value:n},i)),i},i}(r);h.defaultProps={applyTransformOrigin:!0,element:"div"};var m=function(e){var t,r=e.children,o=e.flipId,p=e.inverseFlipId,a=e.portalKey,c=d(e,["children","flipId","inverseFlipId","portalKey"]),f=r,u=function(e){return"function"==typeof e}(f);if(!u)try{f=n.only(r)}catch(e){throw new Error("Each Flipped component must wrap a single child")}c.scale||c.translate||c.opacity||l.assign(c,{translate:!0,scale:!0,opacity:!0});var h=((t={})[s.DATA_FLIP_CONFIG]=JSON.stringify(c),t);return void 0!==o?h[s.DATA_FLIP_ID]=String(o):p&&(h[s.DATA_INVERSE_FLIP_ID]=String(p)),void 0!==a&&(h[s.DATA_PORTAL_KEY]=a),u?f(h):i(f,h)},y=function(t){var r=t.children,n=t.flipId,i=t.shouldFlip,o=t.shouldInvert,p=t.onAppear,s=t.onStart,a=t.onStartImmediate,c=t.onComplete,h=t.onExit,y=t.onSpringUpdate,g=d(t,["children","flipId","shouldFlip","shouldInvert","onAppear","onStart","onStartImmediate","onComplete","onExit","onSpringUpdate"]);return r?g.inverseFlipId?e.createElement(m,Object.assign({},g),r):e.createElement(u.Consumer,null,function(t){return e.createElement(f.Consumer,null,function(d){return l.isObject(d)&&n&&(d[n]={shouldFlip:i,shouldInvert:o,onAppear:p,onStart:s,onStartImmediate:a,onComplete:c,onExit:h,onSpringUpdate:y}),e.createElement(m,Object.assign({flipId:n},g,{portalKey:t}),r)})}):null};y.displayName="Flipped";var g=function(e){var t;return i(e.children,((t={})[s.DATA_EXIT_CONTAINER]=!0,t))};export{g as ExitContainer,y as Flipped,h as Flipper,a as spring}; | ||
import{getFlippedElementPositionsBeforeUpdate as e,onFlipKeyUpdate as t,utilities as r,constants as n}from"flip-toolkit";export{disableFlip,enableFlip,isFlipEnabled,spring}from"flip-toolkit";import i,{createContext as o,Component as p,Children as l,cloneElement as a}from"react";import"prop-types";function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(this,arguments)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function d(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}var f=/*#__PURE__*/o({}),u=/*#__PURE__*/o("portal"),h=/*#__PURE__*/function(r){var n,o;function p(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=r.call.apply(r,[this].concat(n))||this).inProgressAnimations={},e.flipCallbacks={},e.el=void 0,e}o=r,(n=p).prototype=Object.create(o.prototype),n.prototype.constructor=n,c(n,o);var l=p.prototype;return l.getSnapshotBeforeUpdate=function(t){return t.flipKey!==this.props.flipKey&&this.el?e({element:this.el,flipCallbacks:this.flipCallbacks,inProgressAnimations:this.inProgressAnimations,portalKey:this.props.portalKey}):null},l.componentDidUpdate=function(e,r,n){this.props.flipKey!==e.flipKey&&this.el&&t({flippedElementPositionsBeforeUpdate:n.flippedElementPositions,cachedOrderedFlipIds:n.cachedOrderedFlipIds,containerEl:this.el,inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks,applyTransformOrigin:this.props.applyTransformOrigin,spring:this.props.spring,debug:this.props.debug,portalKey:this.props.portalKey,staggerConfig:this.props.staggerConfig,handleEnterUpdateDelete:this.props.handleEnterUpdateDelete,decisionData:{previous:e.decisionData,current:this.props.decisionData},onComplete:this.props.onComplete,onStart:this.props.onStart})},l.render=function(){var e=this,t=this.props,r=t.portalKey,n=/*#__PURE__*/i.createElement(f.Provider,{value:this.flipCallbacks},/*#__PURE__*/i.createElement(t.element,{className:t.className,ref:function(t){return e.el=t}},this.props.children));return r&&(n=/*#__PURE__*/i.createElement(u.Provider,{value:r},n)),n},p}(p);h.defaultProps={applyTransformOrigin:!0,element:"div"};var m=["children","flipId","inverseFlipId","portalKey"],y=["children","flipId","shouldFlip","shouldInvert","onAppear","onStart","onStartImmediate","onComplete","onExit","onSpringUpdate"],g=function(e){var t,i=e.children,o=e.flipId,p=e.inverseFlipId,s=e.portalKey,c=d(e,m),f=i,u=function(e){return"function"==typeof e}(f);if(!u)try{f=l.only(i)}catch(e){throw new Error("Each Flipped component must wrap a single child")}c.scale||c.translate||c.opacity||r.assign(c,{translate:!0,scale:!0,opacity:!0});var h=((t={})[n.DATA_FLIP_CONFIG]=JSON.stringify(c),t);return void 0!==o?h[n.DATA_FLIP_ID]=String(o):p&&(h[n.DATA_INVERSE_FLIP_ID]=String(p)),void 0!==s&&(h[n.DATA_PORTAL_KEY]=s),u?f(h):/*#__PURE__*/a(f,h)},v=function(e){var t=e.children,n=e.flipId,o=e.shouldFlip,p=e.shouldInvert,l=e.onAppear,a=e.onStart,c=e.onStartImmediate,h=e.onComplete,m=e.onExit,v=e.onSpringUpdate,I=d(e,y);return t?I.inverseFlipId?/*#__PURE__*/i.createElement(g,s({},I),t):/*#__PURE__*/i.createElement(u.Consumer,null,function(e){/*#__PURE__*/return i.createElement(f.Consumer,null,function(d){return r.isObject(d)&&n&&(d[n]={shouldFlip:o,shouldInvert:p,onAppear:l,onStart:a,onStartImmediate:c,onComplete:h,onExit:m,onSpringUpdate:v}),/*#__PURE__*/i.createElement(g,s({flipId:n},I,{portalKey:e}),t)})}):null};v.displayName="Flipped";var I=function(e){var t;/*#__PURE__*/return a(e.children,((t={})[n.DATA_EXIT_CONTAINER]=!0,t))};export{I as ExitContainer,v as Flipped,h as Flipper}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;require("prop-types");var r=require("flip-toolkit");function i(e,t){return(i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}var p=t.createContext({}),s=t.createContext("portal"),l=function(e){var t,o;function l(){var t;return(t=e.apply(this,arguments)||this).inProgressAnimations={},t.flipCallbacks={},t.el=void 0,t}o=e,(t=l).prototype=Object.create(o.prototype),t.prototype.constructor=t,i(t,o);var a=l.prototype;return a.getSnapshotBeforeUpdate=function(e){return e.flipKey!==this.props.flipKey&&this.el?r.getFlippedElementPositionsBeforeUpdate({element:this.el,flipCallbacks:this.flipCallbacks,inProgressAnimations:this.inProgressAnimations,portalKey:this.props.portalKey}):null},a.componentDidUpdate=function(e,t,n){this.props.flipKey!==e.flipKey&&this.el&&r.onFlipKeyUpdate({flippedElementPositionsBeforeUpdate:n.flippedElementPositions,cachedOrderedFlipIds:n.cachedOrderedFlipIds,containerEl:this.el,inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks,applyTransformOrigin:this.props.applyTransformOrigin,spring:this.props.spring,debug:this.props.debug,portalKey:this.props.portalKey,staggerConfig:this.props.staggerConfig,handleEnterUpdateDelete:this.props.handleEnterUpdateDelete,decisionData:{previous:e.decisionData,current:this.props.decisionData},onComplete:this.props.onComplete,onStart:this.props.onStart})},a.render=function(){var e=this,t=this.props,r=t.portalKey,i=n.createElement(p.Provider,{value:this.flipCallbacks},n.createElement(t.element,{className:t.className,ref:function(t){return e.el=t}},this.props.children));return r&&(i=n.createElement(s.Provider,{value:r},i)),i},l}(t.Component);l.defaultProps={applyTransformOrigin:!0,element:"div"};var a=function(e){var n,i=e.children,p=e.flipId,s=e.inverseFlipId,l=e.portalKey,a=o(e,["children","flipId","inverseFlipId","portalKey"]),c=i,d=function(e){return"function"==typeof e}(c);if(!d)try{c=t.Children.only(i)}catch(e){throw new Error("Each Flipped component must wrap a single child")}a.scale||a.translate||a.opacity||r.utilities.assign(a,{translate:!0,scale:!0,opacity:!0});var u=((n={})[r.constants.DATA_FLIP_CONFIG]=JSON.stringify(a),n);return void 0!==p?u[r.constants.DATA_FLIP_ID]=String(p):s&&(u[r.constants.DATA_INVERSE_FLIP_ID]=String(s)),void 0!==l&&(u[r.constants.DATA_PORTAL_KEY]=l),d?c(u):t.cloneElement(c,u)},c=function(e){var t=e.children,i=e.flipId,l=e.shouldFlip,c=e.shouldInvert,d=e.onAppear,u=e.onStart,f=e.onStartImmediate,h=e.onComplete,m=e.onExit,g=e.onSpringUpdate,y=o(e,["children","flipId","shouldFlip","shouldInvert","onAppear","onStart","onStartImmediate","onComplete","onExit","onSpringUpdate"]);return t?y.inverseFlipId?n.createElement(a,Object.assign({},y),t):n.createElement(s.Consumer,null,function(e){return n.createElement(p.Consumer,null,function(o){return r.utilities.isObject(o)&&i&&(o[i]={shouldFlip:l,shouldInvert:c,onAppear:d,onStart:u,onStartImmediate:f,onComplete:h,onExit:m,onSpringUpdate:g}),n.createElement(a,Object.assign({flipId:i},y,{portalKey:e}),t)})}):null};c.displayName="Flipped",exports.ExitContainer=function(e){var n;return t.cloneElement(e.children,((n={})[r.constants.DATA_EXIT_CONTAINER]=!0,n))},exports.Flipped=c,exports.Flipper=l,exports.spring=r.spring; | ||
var e=require("flip-toolkit"),t=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("prop-types");var r=/*#__PURE__*/n(t);function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function l(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}var p=/*#__PURE__*/t.createContext({}),a=/*#__PURE__*/t.createContext("portal"),s=/*#__PURE__*/function(t){var n,i;function l(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).inProgressAnimations={},e.flipCallbacks={},e.el=void 0,e}i=t,(n=l).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var s=l.prototype;return s.getSnapshotBeforeUpdate=function(t){return t.flipKey!==this.props.flipKey&&this.el?e.getFlippedElementPositionsBeforeUpdate({element:this.el,flipCallbacks:this.flipCallbacks,inProgressAnimations:this.inProgressAnimations,portalKey:this.props.portalKey}):null},s.componentDidUpdate=function(t,n,r){this.props.flipKey!==t.flipKey&&this.el&&e.onFlipKeyUpdate({flippedElementPositionsBeforeUpdate:r.flippedElementPositions,cachedOrderedFlipIds:r.cachedOrderedFlipIds,containerEl:this.el,inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks,applyTransformOrigin:this.props.applyTransformOrigin,spring:this.props.spring,debug:this.props.debug,portalKey:this.props.portalKey,staggerConfig:this.props.staggerConfig,handleEnterUpdateDelete:this.props.handleEnterUpdateDelete,decisionData:{previous:t.decisionData,current:this.props.decisionData},onComplete:this.props.onComplete,onStart:this.props.onStart})},s.render=function(){var e=this,t=this.props,n=t.portalKey,i=/*#__PURE__*/r.default.createElement(p.Provider,{value:this.flipCallbacks},/*#__PURE__*/r.default.createElement(t.element,{className:t.className,ref:function(t){return e.el=t}},this.props.children));return n&&(i=/*#__PURE__*/r.default.createElement(a.Provider,{value:n},i)),i},l}(t.Component);s.defaultProps={applyTransformOrigin:!0,element:"div"};var c=["children","flipId","inverseFlipId","portalKey"],d=["children","flipId","shouldFlip","shouldInvert","onAppear","onStart","onStartImmediate","onComplete","onExit","onSpringUpdate"],u=function(n){var r,i=n.children,o=n.flipId,p=n.inverseFlipId,a=n.portalKey,s=l(n,c),d=i,u=function(e){return"function"==typeof e}(d);if(!u)try{d=t.Children.only(i)}catch(e){throw new Error("Each Flipped component must wrap a single child")}s.scale||s.translate||s.opacity||e.utilities.assign(s,{translate:!0,scale:!0,opacity:!0});var f=((r={})[e.constants.DATA_FLIP_CONFIG]=JSON.stringify(s),r);return void 0!==o?f[e.constants.DATA_FLIP_ID]=String(o):p&&(f[e.constants.DATA_INVERSE_FLIP_ID]=String(p)),void 0!==a&&(f[e.constants.DATA_PORTAL_KEY]=a),u?d(f):/*#__PURE__*/t.cloneElement(d,f)},f=function(t){var n=t.children,o=t.flipId,s=t.shouldFlip,c=t.shouldInvert,f=t.onAppear,h=t.onStart,m=t.onStartImmediate,y=t.onComplete,g=t.onExit,b=t.onSpringUpdate,v=l(t,d);return n?v.inverseFlipId?/*#__PURE__*/r.default.createElement(u,i({},v),n):/*#__PURE__*/r.default.createElement(a.Consumer,null,function(t){/*#__PURE__*/return r.default.createElement(p.Consumer,null,function(l){return e.utilities.isObject(l)&&o&&(l[o]={shouldFlip:s,shouldInvert:c,onAppear:f,onStart:h,onStartImmediate:m,onComplete:y,onExit:g,onSpringUpdate:b}),/*#__PURE__*/r.default.createElement(u,i({flipId:o},v,{portalKey:t}),n)})}):null};f.displayName="Flipped",Object.defineProperty(exports,"disableFlip",{enumerable:!0,get:function(){return e.disableFlip}}),Object.defineProperty(exports,"enableFlip",{enumerable:!0,get:function(){return e.enableFlip}}),Object.defineProperty(exports,"isFlipEnabled",{enumerable:!0,get:function(){return e.isFlipEnabled}}),Object.defineProperty(exports,"spring",{enumerable:!0,get:function(){return e.spring}}),exports.ExitContainer=function(n){var r;/*#__PURE__*/return t.cloneElement(n.children,((r={})[e.constants.DATA_EXIT_CONTAINER]=!0,r))},exports.Flipped=f,exports.Flipper=s; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("flip-toolkit")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","flip-toolkit"],t):t((e=e||self).ReactFlipToolkit={},e.React,e.PropTypes,e.FlipToolkit)}(this,function(e,t,n,r){var i="default"in t?t.default:t;function o(e,t){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;var l=t.createContext({}),s=t.createContext("portal"),a=function(e){var t,n;function p(){var t;return(t=e.apply(this,arguments)||this).inProgressAnimations={},t.flipCallbacks={},t.el=void 0,t}n=e,(t=p).prototype=Object.create(n.prototype),t.prototype.constructor=t,o(t,n);var a=p.prototype;return a.getSnapshotBeforeUpdate=function(e){return e.flipKey!==this.props.flipKey&&this.el?r.getFlippedElementPositionsBeforeUpdate({element:this.el,flipCallbacks:this.flipCallbacks,inProgressAnimations:this.inProgressAnimations,portalKey:this.props.portalKey}):null},a.componentDidUpdate=function(e,t,n){this.props.flipKey!==e.flipKey&&this.el&&r.onFlipKeyUpdate({flippedElementPositionsBeforeUpdate:n.flippedElementPositions,cachedOrderedFlipIds:n.cachedOrderedFlipIds,containerEl:this.el,inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks,applyTransformOrigin:this.props.applyTransformOrigin,spring:this.props.spring,debug:this.props.debug,portalKey:this.props.portalKey,staggerConfig:this.props.staggerConfig,handleEnterUpdateDelete:this.props.handleEnterUpdateDelete,decisionData:{previous:e.decisionData,current:this.props.decisionData},onComplete:this.props.onComplete,onStart:this.props.onStart})},a.render=function(){var e=this,t=this.props,n=t.portalKey,r=i.createElement(l.Provider,{value:this.flipCallbacks},i.createElement(t.element,{className:t.className,ref:function(t){return e.el=t}},this.props.children));return n&&(r=i.createElement(s.Provider,{value:n},r)),r},p}(t.Component);a.defaultProps={applyTransformOrigin:!0,element:"div"};var c=function(e){var n,i=e.children,o=e.flipId,l=e.inverseFlipId,s=e.portalKey,a=p(e,["children","flipId","inverseFlipId","portalKey"]),c=i,d=function(e){return"function"==typeof e}(c);if(!d)try{c=t.Children.only(i)}catch(e){throw new Error("Each Flipped component must wrap a single child")}a.scale||a.translate||a.opacity||r.utilities.assign(a,{translate:!0,scale:!0,opacity:!0});var f=((n={})[r.constants.DATA_FLIP_CONFIG]=JSON.stringify(a),n);return void 0!==o?f[r.constants.DATA_FLIP_ID]=String(o):l&&(f[r.constants.DATA_INVERSE_FLIP_ID]=String(l)),void 0!==s&&(f[r.constants.DATA_PORTAL_KEY]=s),d?c(f):t.cloneElement(c,f)},d=function(e){var t=e.children,n=e.flipId,o=e.shouldFlip,a=e.shouldInvert,d=e.onAppear,f=e.onStart,u=e.onStartImmediate,h=e.onComplete,m=e.onExit,y=e.onSpringUpdate,g=p(e,["children","flipId","shouldFlip","shouldInvert","onAppear","onStart","onStartImmediate","onComplete","onExit","onSpringUpdate"]);return t?g.inverseFlipId?i.createElement(c,Object.assign({},g),t):i.createElement(s.Consumer,null,function(e){return i.createElement(l.Consumer,null,function(p){return r.utilities.isObject(p)&&n&&(p[n]={shouldFlip:o,shouldInvert:a,onAppear:d,onStart:f,onStartImmediate:u,onComplete:h,onExit:m,onSpringUpdate:y}),i.createElement(c,Object.assign({flipId:n},g,{portalKey:e}),t)})}):null};d.displayName="Flipped",e.ExitContainer=function(e){var n;return t.cloneElement(e.children,((n={})[r.constants.DATA_EXIT_CONTAINER]=!0,n))},e.Flipped=d,e.Flipper=a,e.spring=r.spring}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("flip-toolkit"),require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","flip-toolkit","react","prop-types"],t):t((e||self).ReactFlipToolkit={},e.FlipToolkit,e.React)}(this,function(e,t,n){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/r(n);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function p(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}var a=/*#__PURE__*/n.createContext({}),s=/*#__PURE__*/n.createContext("portal"),c=/*#__PURE__*/function(e){var n,r;function o(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).inProgressAnimations={},t.flipCallbacks={},t.el=void 0,t}r=e,(n=o).prototype=Object.create(r.prototype),n.prototype.constructor=n,l(n,r);var p=o.prototype;return p.getSnapshotBeforeUpdate=function(e){return e.flipKey!==this.props.flipKey&&this.el?t.getFlippedElementPositionsBeforeUpdate({element:this.el,flipCallbacks:this.flipCallbacks,inProgressAnimations:this.inProgressAnimations,portalKey:this.props.portalKey}):null},p.componentDidUpdate=function(e,n,r){this.props.flipKey!==e.flipKey&&this.el&&t.onFlipKeyUpdate({flippedElementPositionsBeforeUpdate:r.flippedElementPositions,cachedOrderedFlipIds:r.cachedOrderedFlipIds,containerEl:this.el,inProgressAnimations:this.inProgressAnimations,flipCallbacks:this.flipCallbacks,applyTransformOrigin:this.props.applyTransformOrigin,spring:this.props.spring,debug:this.props.debug,portalKey:this.props.portalKey,staggerConfig:this.props.staggerConfig,handleEnterUpdateDelete:this.props.handleEnterUpdateDelete,decisionData:{previous:e.decisionData,current:this.props.decisionData},onComplete:this.props.onComplete,onStart:this.props.onStart})},p.render=function(){var e=this,t=this.props,n=t.portalKey,r=/*#__PURE__*/i.default.createElement(a.Provider,{value:this.flipCallbacks},/*#__PURE__*/i.default.createElement(t.element,{className:t.className,ref:function(t){return e.el=t}},this.props.children));return n&&(r=/*#__PURE__*/i.default.createElement(s.Provider,{value:n},r)),r},o}(n.Component);c.defaultProps={applyTransformOrigin:!0,element:"div"};var d=["children","flipId","inverseFlipId","portalKey"],u=["children","flipId","shouldFlip","shouldInvert","onAppear","onStart","onStartImmediate","onComplete","onExit","onSpringUpdate"],f=function(e){var r,i=e.children,o=e.flipId,l=e.inverseFlipId,a=e.portalKey,s=p(e,d),c=i,u=function(e){return"function"==typeof e}(c);if(!u)try{c=n.Children.only(i)}catch(e){throw new Error("Each Flipped component must wrap a single child")}s.scale||s.translate||s.opacity||t.utilities.assign(s,{translate:!0,scale:!0,opacity:!0});var f=((r={})[t.constants.DATA_FLIP_CONFIG]=JSON.stringify(s),r);return void 0!==o?f[t.constants.DATA_FLIP_ID]=String(o):l&&(f[t.constants.DATA_INVERSE_FLIP_ID]=String(l)),void 0!==a&&(f[t.constants.DATA_PORTAL_KEY]=a),u?c(f):/*#__PURE__*/n.cloneElement(c,f)},h=function(e){var n=e.children,r=e.flipId,l=e.shouldFlip,c=e.shouldInvert,d=e.onAppear,h=e.onStart,m=e.onStartImmediate,y=e.onComplete,g=e.onExit,b=e.onSpringUpdate,v=p(e,u);return n?v.inverseFlipId?/*#__PURE__*/i.default.createElement(f,o({},v),n):/*#__PURE__*/i.default.createElement(s.Consumer,null,function(e){/*#__PURE__*/return i.default.createElement(a.Consumer,null,function(p){return t.utilities.isObject(p)&&r&&(p[r]={shouldFlip:l,shouldInvert:c,onAppear:d,onStart:h,onStartImmediate:m,onComplete:y,onExit:g,onSpringUpdate:b}),/*#__PURE__*/i.default.createElement(f,o({flipId:r},v,{portalKey:e}),n)})}):null};h.displayName="Flipped",Object.defineProperty(e,"disableFlip",{enumerable:!0,get:function(){return t.disableFlip}}),Object.defineProperty(e,"enableFlip",{enumerable:!0,get:function(){return t.enableFlip}}),Object.defineProperty(e,"isFlipEnabled",{enumerable:!0,get:function(){return t.isFlipEnabled}}),Object.defineProperty(e,"spring",{enumerable:!0,get:function(){return t.spring}}),e.ExitContainer=function(e){var r;/*#__PURE__*/return n.cloneElement(e.children,((r={})[t.constants.DATA_EXIT_CONTAINER]=!0,r))},e.Flipped=h,e.Flipper=c}); | ||
//# sourceMappingURL=index.umd.js.map |
import { spring } from 'flip-toolkit'; | ||
export default spring; |
{ | ||
"name": "react-flip-toolkit", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"description": "Configurable FLIP animation helpers for React", | ||
@@ -10,2 +10,3 @@ "license": "MIT", | ||
"types": "lib/index.d.ts", | ||
"exports": "./lib/index.modern.mjs", | ||
"amdName": "ReactFlipToolkit", | ||
@@ -51,3 +52,3 @@ "repository": { | ||
"dependencies": { | ||
"flip-toolkit": "7.1.0", | ||
"flip-toolkit": "7.2.0", | ||
"prop-types": "^15.8.1" | ||
@@ -60,36 +61,36 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "^7.21.8", | ||
"@babel/preset-env": "^7.21.5", | ||
"@babel/preset-react": "^7.18.6", | ||
"@babel/preset-typescript": "^7.21.5", | ||
"@babel/runtime": "^7.21.5", | ||
"@emotion/core": "^10.1.1", | ||
"@types/jest": "^29.5.1", | ||
"@types/react": "^18.2.6", | ||
"@types/react-dom": "^18.2.4", | ||
"@types/react-test-renderer": "^18.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.59.5", | ||
"@typescript-eslint/parser": "^5.59.5", | ||
"@babel/core": "^7.24.7", | ||
"@babel/preset-env": "^7.24.7", | ||
"@babel/preset-react": "^7.24.7", | ||
"@babel/preset-typescript": "^7.24.7", | ||
"@babel/runtime": "^7.24.7", | ||
"@emotion/core": "^10.3.1", | ||
"@types/jest": "^29.5.12", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"@types/react-test-renderer": "^18.3.0", | ||
"@typescript-eslint/eslint-plugin": "^5.62.0", | ||
"@typescript-eslint/parser": "^5.62.0", | ||
"babel-jest": "^29.5.0", | ||
"babel-polyfill": "^6.26.0", | ||
"eslint": "^8.40.0", | ||
"eslint-plugin-react": "^7.32.2", | ||
"jest": "^26.6.2", | ||
"eslint": "^8.57.0", | ||
"eslint-plugin-react": "^7.34.3", | ||
"jest": "^26.6.3", | ||
"lodash.shuffle": "^4.2.0", | ||
"microbundle": "0.12.4", | ||
"microbundle": "0.15.1", | ||
"normalize.css": "^8.0.1", | ||
"npm": "^9.6.6", | ||
"npm": "^10.8.1", | ||
"npm-run-all": "^4.1.5", | ||
"npm-watch": "^0.11.0", | ||
"npm-watch": "^0.13.0", | ||
"parcel": "^1.12.4", | ||
"prettier": "2.1.2", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"prettier": "^2.8.8", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"react-icons": "^3.11.0", | ||
"react-scripts": "^5.0.1", | ||
"react-test-renderer": "^18.2.0", | ||
"sinon": "^9.2.1", | ||
"react-test-renderer": "^18.3.1", | ||
"sinon": "^9.2.4", | ||
"styled-components": "^4.4.1", | ||
"ts-jest": "^26.4.3", | ||
"typescript": "^5.0.4", | ||
"ts-jest": "^26.5.6", | ||
"typescript": "^5.5.3", | ||
"watch": "^1.0.2" | ||
@@ -102,5 +103,4 @@ }, | ||
"> 1%", | ||
"last 2 versions", | ||
"IE 11" | ||
"last 2 versions" | ||
] | ||
} |
@@ -470,2 +470,20 @@ <p align="center"> | ||
## Global configuration functions | ||
You can programmatically call the following functions if you need to disable (or re-enable) FLIP animations everywhere. | ||
#### `disableFlip()` | ||
Global switch to disable all animations in all `Flipper` containers. | ||
#### `enableFlip()` | ||
Global switch to (re-)enable all animations in all `Flipper` containers. Animations are enabled by default. Calling this function is needed only if animations were previously disabled with `disableFlip()`. | ||
#### `isFlipEnabled()` | ||
Returns a boolean indicating whether animations are globally enabled or disabled. | ||
## Library details | ||
@@ -477,4 +495,3 @@ | ||
- Tested in latest Chrome, Firefox, Safari, Edge, and IE 11 with [Browserstack](https://www.browserstack.com/). | ||
- For IE11 compatability, make sure you're polyfilling the `window.Promise` object. | ||
- Tested in latest Chrome, Firefox, Safari, and Edge with [Browserstack](https://www.browserstack.com/). | ||
- Requires React 16+ | ||
@@ -491,2 +508,3 @@ - Uses [Rematrix](https://github.com/jlmakes/rematrix) for matrix calculations and a simplified fork of [Rebound](https://github.com/facebook/rebound-js) for spring animations | ||
- `display:inline` elements cannot be animated. If you want an `inline` element to animate, set `display:inline-block`. | ||
- Do you have the [prefers-reduced-motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion) setting turned on? As of v7.1.0 that setting will disable all animations. | ||
@@ -522,2 +540,2 @@ ### Problem #2: Things look weird / animations aren't behaving | ||
This [CSS property](https://dev.opera.com/articles/css-will-change-property/) tells the browser to anticipate changes to an element. It should be used with caution, because it can increase browser resource usage. If you notice rendering issues in your animation, I would recommend trying it out and seeing if it increases the performance of the animation. | ||
This [CSS property](https://dev.opera.com/articles/css-will-change-property/) tells the browser to anticipate changes to an element. It should be used with caution, because it can increase browser resource usage. If you notice rendering issues in your animation, try seeing if it increases the performance of the animation. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
128635
18
116
538
+ Addedflip-toolkit@7.2.0(transitive)
- Removedflip-toolkit@7.1.0(transitive)
Updatedflip-toolkit@7.2.0