Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flipping

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flipping - npm Package Compare versions

Comparing version 0.5.3 to 0.6.0

dist/flipping.gsap.js

2

dist/flipping.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Flipping=e():t.Flipping=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}({0:function(t,e,n){"use strict";function o(t){var e=s(t),n=e.width,o=e.height;return 0===n&&0===o}function i(t,e){return t?t.height?e.height?{top:t.top-e.top,left:t.left-e.left,width:t.width/e.width,height:t.height/e.height}:e:t:f}var r=this&&this.__assign||Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};e.__esModule=!0;var a=function(t){return t},u=function(){},s=function(t){var e=t.getBoundingClientRect();return{top:e.top,left:e.left,width:e.width,height:e.height,transform:getComputedStyle(t).transform}},f={top:0,left:0,width:1,height:1},c=function(t){var e=t.querySelectorAll("[data-flip-key]"),n={},i=[];return e.forEach(function(t){if(!o(t)){var e=t.getAttribute("data-flip-key");n[e]=t,i.push(t)}}),i},l=function(){return!0},p=function(t){return t.getAttribute("data-flip-key")},d=function(){function t(t){void 0===t&&(t={});var e=this;this.selector=t.selector||c,this.active=t.active||l,this.selectActive=function(t){return e.selector(t).filter(function(t){return e.active(t)})},this.getBounds=t.getBounds||s,this.getDelta=t.getDelta||i,this.getKey=t.getKey||p,this.onRead=t.onRead||a,this.onEnter=t.onEnter||u,this.onFlip=t.onFlip||u,this.onLeave=t.onLeave||u,this.states={}}return t.prototype.getRelativeBounds=function(t,e){return r({},e,{top:e.top-t.top,left:e.left-t.left})},t.prototype.read=function(t,e){void 0===t&&(t=document.documentElement),void 0===e&&(e={}),this.flip(t,r({},e,{readOnly:!0}))},t.prototype.flip=function(t,e){var n=this;void 0===t&&(t=document.documentElement),void 0===e&&(e={});var o=this.selectActive(t),i={},r=this.getBounds(t),a=!1;o.forEach(function(t){var o=n.getKey(t),u=n.states[o],s=u&&"LEAVE"!==u.type;a=!0;var f=n.getRelativeBounds(r,n.getBounds(t)),c={type:s?"MOVE":"ENTER",key:o,node:t,bounds:f,delta:s?n.getDelta(u.bounds,f):void 0,start:Date.now(),animation:s?u.animation:void 0,previous:u};n.states[o]=i[o]=c,e.readOnly&&n.onRead(c)}),e.readOnly||(Object.keys(this.states).forEach(function(t){i[t]||(n.states[t]=i[t]={type:"LEAVE",key:t,node:void 0,bounds:void 0,start:Date.now(),animation:void 0,previous:n.states[t]})}),Object.keys(i).forEach(function(t){var e=i[t],o=e.node||e.previous&&e.previous.node;if(o){var r=o.getAttribute("data-flip-follow");"ENTER"!==e.type&&"LEAVE"!==e.type||!r||(e.delta=i[r].delta)}var a={ENTER:n.onEnter,MOVE:n.onFlip,LEAVE:n.onLeave}[e.type].call(n,e,t,i);a&&n.animate(t,a)}))},t.prototype.animate=function(t,e){this.states[t].animation=e},t.prototype.wrap=function(t,e,n){var o=this;return void 0===n&&(n={}),function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];o.read(e);var a=t.apply(null,i);return o.flip(e,n),a}},t.rect=s,t}();e.default=d},8:function(t,e,n){"use strict";var o=n(0);t.exports=o.default}})});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Flipping=e():t.Flipping=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=5)}({0:function(t,e,n){"use strict";function o(t){var e=s(t),n=e.width,o=e.height;return 0===n&&0===o}function i(t,e){return t?t.height?e.height?{top:t.top-e.top,left:t.left-e.left,width:t.width/e.width,height:t.height/e.height}:e:t:f}var r=this&&this.__assign||Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t};e.__esModule=!0;var a=function(t){return t},u=function(){},s=function(t){var e=t.getBoundingClientRect();return{top:e.top,left:e.left,width:e.width,height:e.height,transform:getComputedStyle(t).transform}},f={top:0,left:0,width:1,height:1},p=function(t){var e=t.querySelectorAll("[data-flip-key]"),n={},i=[];return e.forEach(function(t){if(!o(t)){var e=t.getAttribute("data-flip-key");n[e]=t,i.push(t)}}),i},c=function(){return!0},l=function(t){return t.getAttribute("data-flip-key")},d=function(){function t(t){void 0===t&&(t={});var e=this;this.selector=t.selector||p,this.active=t.active||c,this.selectActive=function(t){return e.selector(t).filter(function(t){return e.active(t)})},this.getBounds=t.getBounds||s,this.getDelta=t.getDelta||i,this.getKey=t.getKey||l,this.onRead=t.onRead||a,this.onEnter=t.onEnter||u,this.onFlip=t.onFlip||u,this.onLeave=t.onLeave||u,this.parentElement=t.parent||document.documentElement,this.states={}}return t.prototype.getRelativeBounds=function(t,e){return r({},e,{top:e.top-t.top,left:e.left-t.left})},t.prototype.read=function(t){void 0===t&&(t={}),this.flip(r({},t,{readOnly:!0}))},t.prototype.flip=function(t){var e=this;void 0===t&&(t={});var n=t.parent||this.parentElement,o=this.selectActive(n),i={},r=this.getBounds(n),a=!1;o.forEach(function(n){var o=e.getKey(n),u=e.states[o],s=u&&"LEAVE"!==u.type;a=!0;var f=e.getRelativeBounds(r,e.getBounds(n)),p={type:s?"MOVE":"ENTER",key:o,node:n,bounds:f,delta:s?e.getDelta(u.bounds,f):void 0,start:Date.now(),animation:s?u.animation:void 0,previous:u};e.states[o]=i[o]=p,t.readOnly&&e.onRead(p)}),t.readOnly||(Object.keys(this.states).forEach(function(t){i[t]||(e.states[t]=i[t]={type:"LEAVE",key:t,node:void 0,bounds:void 0,start:Date.now(),animation:void 0,previous:e.states[t]})}),Object.keys(i).forEach(function(t){var n=i[t],o=n.node||n.previous&&n.previous.node;if(o){var r=o.getAttribute("data-flip-follow");"ENTER"!==n.type&&"LEAVE"!==n.type||!r||(n.delta=i[r].delta)}var a={ENTER:e.onEnter,MOVE:e.onFlip,LEAVE:e.onLeave}[n.type].call(e,n,t,i);a&&e.animate(t,a)}))},t.prototype.animate=function(t,e){this.states[t].animation=e},t.prototype.wrap=function(t,e){var n=this;return void 0===e&&(e={}),function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n.read(e);var r=t.apply(null,o);return n.flip(e),r}},t.rect=s,t}();e.default=d},5:function(t,e,n){"use strict";var o=n(0);t.exports=o.default}})});

@@ -1,1 +0,1 @@

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.Flipping=n():t.Flipping=n()}(this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.i=function(t){return t},n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=9)}([function(t,n,r){"use strict";function e(t){var n=u(t),r=n.width,e=n.height;return 0===r&&0===e}function o(t,n){return t?t.height?n.height?{top:t.top-n.top,left:t.left-n.left,width:t.width/n.width,height:t.height/n.height}:n:t:s}var i=this&&this.__assign||Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t};n.__esModule=!0;var a=function(t){return t},f=function(){},u=function(t){var n=t.getBoundingClientRect();return{top:n.top,left:n.left,width:n.width,height:n.height,transform:getComputedStyle(t).transform}},s={top:0,left:0,width:1,height:1},c=function(t){var n=t.querySelectorAll("[data-flip-key]"),r={},o=[];return n.forEach(function(t){if(!e(t)){var n=t.getAttribute("data-flip-key");r[n]=t,o.push(t)}}),o},h=function(){return!0},d=function(t){return t.getAttribute("data-flip-key")},l=function(){function t(t){void 0===t&&(t={});var n=this;this.selector=t.selector||c,this.active=t.active||h,this.selectActive=function(t){return n.selector(t).filter(function(t){return n.active(t)})},this.getBounds=t.getBounds||u,this.getDelta=t.getDelta||o,this.getKey=t.getKey||d,this.onRead=t.onRead||a,this.onEnter=t.onEnter||f,this.onFlip=t.onFlip||f,this.onLeave=t.onLeave||f,this.states={}}return t.prototype.getRelativeBounds=function(t,n){return i({},n,{top:n.top-t.top,left:n.left-t.left})},t.prototype.read=function(t,n){void 0===t&&(t=document.documentElement),void 0===n&&(n={}),this.flip(t,i({},n,{readOnly:!0}))},t.prototype.flip=function(t,n){var r=this;void 0===t&&(t=document.documentElement),void 0===n&&(n={});var e=this.selectActive(t),o={},i=this.getBounds(t),a=!1;e.forEach(function(t){var e=r.getKey(t),f=r.states[e],u=f&&"LEAVE"!==f.type;a=!0;var s=r.getRelativeBounds(i,r.getBounds(t)),c={type:u?"MOVE":"ENTER",key:e,node:t,bounds:s,delta:u?r.getDelta(f.bounds,s):void 0,start:Date.now(),animation:u?f.animation:void 0,previous:f};r.states[e]=o[e]=c,n.readOnly&&r.onRead(c)}),n.readOnly||(Object.keys(this.states).forEach(function(t){o[t]||(r.states[t]=o[t]={type:"LEAVE",key:t,node:void 0,bounds:void 0,start:Date.now(),animation:void 0,previous:r.states[t]})}),Object.keys(o).forEach(function(t){var n=o[t],e=n.node||n.previous&&n.previous.node;if(e){var i=e.getAttribute("data-flip-follow");"ENTER"!==n.type&&"LEAVE"!==n.type||!i||(n.delta=o[i].delta)}var a={ENTER:r.onEnter,MOVE:r.onFlip,LEAVE:r.onLeave}[n.type].call(r,n,t,o);a&&r.animate(t,a)}))},t.prototype.animate=function(t,n){this.states[t].animation=n},t.prototype.wrap=function(t,n,r){var e=this;return void 0===r&&(r={}),function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];e.read(n);var a=t.apply(null,o);return e.flip(n,r),a}},t.rect=u,t}();n.default=l},function(t,n,r){"use strict";function e(t){if(t.constructor!==Array)throw new TypeError("Expected array.");if(16===t.length)return t;if(6===t.length){var n=o();return n[0]=t[0],n[1]=t[1],n[4]=t[2],n[5]=t[3],n[12]=t[4],n[13]=t[5],n}throw new RangeError("Expected array with either 6 or 16 values.")}function o(){for(var t=[],n=0;n<16;n++)n%5==0?t.push(1):t.push(0);return t}function i(t){var n=e(t),r=n[0]*n[5]-n[4]*n[1],o=n[0]*n[6]-n[4]*n[2],i=n[0]*n[7]-n[4]*n[3],a=n[1]*n[6]-n[5]*n[2],f=n[1]*n[7]-n[5]*n[3],u=n[2]*n[7]-n[6]*n[3],s=n[10]*n[15]-n[14]*n[11],c=n[9]*n[15]-n[13]*n[11],h=n[9]*n[14]-n[13]*n[10],d=n[8]*n[15]-n[12]*n[11],l=n[8]*n[14]-n[12]*n[10],p=n[8]*n[13]-n[12]*n[9],m=1/(r*s-o*c+i*h+a*d-f*l+u*p);if(isNaN(m)||m===1/0)throw new Error("Inverse determinant attempted to divide by zero.");return[(n[5]*s-n[6]*c+n[7]*h)*m,(-n[1]*s+n[2]*c-n[3]*h)*m,(n[13]*u-n[14]*f+n[15]*a)*m,(-n[9]*u+n[10]*f-n[11]*a)*m,(-n[4]*s+n[6]*d-n[7]*l)*m,(n[0]*s-n[2]*d+n[3]*l)*m,(-n[12]*u+n[14]*i-n[15]*o)*m,(n[8]*u-n[10]*i+n[11]*o)*m,(n[4]*c-n[5]*d+n[7]*p)*m,(-n[0]*c+n[1]*d-n[3]*p)*m,(n[12]*f-n[13]*i+n[15]*r)*m,(-n[8]*f+n[9]*i-n[11]*r)*m,(-n[4]*h+n[5]*l-n[6]*p)*m,(n[0]*h-n[1]*l+n[2]*p)*m,(-n[12]*a+n[13]*o-n[14]*r)*m,(n[8]*a-n[9]*o+n[10]*r)*m]}function a(t,n){for(var r=e(t),o=e(n),i=[],a=0;a<4;a++)for(var f=[r[a],r[a+4],r[a+8],r[a+12]],u=0;u<4;u++){var s=4*u,c=[o[s],o[s+1],o[s+2],o[s+3]],h=f[0]*c[0]+f[1]*c[1]+f[2]*c[2]+f[3]*c[3];i[a+s]=h}return i}function f(t){if("string"==typeof t){var n=t.match(/matrix(3d)?\(([^)]+)\)/);if(n){return e(n[2].split(", ").map(function(t){return parseFloat(t)}))}}return o()}function u(t){var n=Math.PI/180*t,r=o();return r[5]=r[10]=Math.cos(n),r[6]=r[9]=Math.sin(n),r[9]*=-1,r}function s(t){var n=Math.PI/180*t,r=o();return r[0]=r[10]=Math.cos(n),r[2]=r[8]=Math.sin(n),r[2]*=-1,r}function c(t){var n=Math.PI/180*t,r=o();return r[0]=r[5]=Math.cos(n),r[1]=r[4]=Math.sin(n),r[4]*=-1,r}function h(t,n){var r=o();return r[0]=t,r[5]=n||t,r}function d(t){var n=o();return n[0]=t,n}function l(t){var n=o();return n[5]=t,n}function p(t){var n=o();return n[10]=t,n}function m(t,n){var r=Math.PI/180*t,e=o();if(e[4]=Math.tan(r),n){var i=Math.PI/180*n;e[1]=Math.tan(i)}return e}function v(t){var n=Math.PI/180*t,r=o();return r[4]=Math.tan(n),r}function g(t){var n=Math.PI/180*t,r=o();return r[1]=Math.tan(n),r}function y(t,n){var r=o();return r[12]=t,n&&(r[13]=n),r}function x(t){var n=o();return n[12]=t,n}function w(t){var n=o();return n[13]=t,n}function O(t){var n=o();return n[14]=t,n}Object.defineProperty(n,"__esModule",{value:!0}),r.d(n,"format",function(){return e}),r.d(n,"identity",function(){return o}),r.d(n,"inverse",function(){return i}),r.d(n,"multiply",function(){return a}),r.d(n,"parse",function(){return f}),r.d(n,"rotateX",function(){return u}),r.d(n,"rotateY",function(){return s}),r.d(n,"rotateZ",function(){return c}),r.d(n,"scale",function(){return h}),r.d(n,"scaleX",function(){return d}),r.d(n,"scaleY",function(){return l}),r.d(n,"scaleZ",function(){return p}),r.d(n,"skew",function(){return m}),r.d(n,"skewX",function(){return v}),r.d(n,"skewY",function(){return g}),r.d(n,"translate",function(){return y}),r.d(n,"translateX",function(){return x}),r.d(n,"translateY",function(){return w}),r.d(n,"translateZ",function(){return O})},function(t,n,r){"use strict";function e(t,n){var r={};return Object.keys(t||{}).forEach(function(e){r[e]=n(t[e],e,t)}),r}function o(t,n,r){var e={};return Object.keys(t||{}).forEach(function(o){e[o]=r(t[o],n[o],o)}),e}function i(t,n){return u.translate(t,n).join(",")}function a(t,n){return u.scale(t,n).join(",")}function f(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.filter(function(t){return!!t}).reduce(u.multiply).join(",")}n.__esModule=!0;var u=r(1);n.mapValues=e,n.mapTwoValues=o,n.matrixTranslate=i,n.matrixScale=a,n.matrixMultiply=f},function(t,n,r){"use strict";n.__esModule=!0;var e=r(2),o=r(1);n.scale=function(t){var n=t.bounds,r=t.delta,i=1!==r.width||1!==r.height,a=o.translate(r.left,r.top),f=i?o.scale(r.width,r.height):void 0,u=i?"top left":void 0,s=e.matrixMultiply(a,f);return{node:{from:{x:r.left,y:r.top,transformOrigin:u,transform:"matrix3d("+s+")"},to:{x:n.left,y:n.top,transformOrigin:u,transform:n.transform}}}},n.slide=function(t){var n=t.delta,r=t.previous,o=t.bounds;if(r){var i=Math.max(r.bounds.height,o.height),a=Math.max(r.bounds.width,o.width),f={from:{height:i,width:a,transformOrigin:"top left"},to:{height:i,width:a,transformOrigin:"top left"}},u={from:{height:i,width:a,transformOrigin:"top left"},to:{height:i,width:a,transformOrigin:"top left"}},s=o.width-r.bounds.width,c=o.height-r.bounds.height;s>0?(u.from.x=-s+n.left,u.to.x=0,f.from.x=s,f.to.x=0):(u.from.x=0,u.to.x=s-n.left,f.from.x=0,f.to.x=-s),c>0?(u.from.y=-c+n.top,u.to.y=0,f.from.y=c,f.to.y=0):(u.from.y=0,u.to.y=c-n.top,f.from.y=0,f.to.y=-c);var h=e.matrixTranslate(f.from.x,f.from.y),d=e.matrixTranslate(f.to.x,f.to.y),l=e.matrixTranslate(u.from.x,u.from.y),p=e.matrixTranslate(u.to.x,u.to.y);return f.from.transform="matrix3d("+h+")",f.to.transform="matrix3d("+d+")",u.from.transform="matrix3d("+l+")",u.to.transform="matrix3d("+p+")",{node:f,container:u}}}},,,,,,function(t,n,r){"use strict";var e=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),o=this&&this.__assign||Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},i=r(0),a=r(3),f=function(t,n){var r=t.node,e=a.slide(t),o=r.animate([{height:e.node.from.height+"px",width:e.node.from.width+"px",transformOrigin:e.node.from.transformOrigin,transform:e.node.from.transform},{height:e.node.to.height+"px",width:e.node.to.width+"px",transformOrigin:e.node.to.transformOrigin,transform:e.node.to.transform}],n),i=r.parentElement.animate([{willChange:"transform",height:e.container.from.height+"px",width:e.container.from.width+"px",transformOrigin:e.container.from.transformOrigin,transform:e.container.from.transform},{willChange:"transform",height:e.container.to.height+"px",width:e.container.to.width+"px",transformOrigin:e.container.to.transformOrigin,transform:e.container.to.transform}],n);return{finish:function(){o.finish(),i.finish()}}},u=function(t,n){void 0===n&&(n={});var r=t.node,e=a.scale(t);return r.animate([{transformOrigin:e.node.from.transformOrigin||"inherit",transform:e.node.from.transform},{transformOrigin:e.node.to.transformOrigin||"inherit",transform:e.node.to.transform}],n)},s=function(t,n){var r=t.node;if(r)return r&&r.parentElement&&r.parentElement.hasAttribute("data-flip-wrap")?f(t,n):u(t,n)},c=function(t){var n=t.animation;n&&n.finish&&n.finish()},h={duration:300,easing:"ease",fill:"none",getBounds:function(t){var n=i.default.rect(t);if(t&&t.parentElement&&t.parentElement.hasAttribute("data-flip-wrap")){var r=i.default.rect(t.parentElement);n.width-=Math.abs(n.left-r.left),n.height-=Math.abs(n.top-r.top)}return n}},d=function(t){function n(r){void 0===r&&(r={});var e=o({},h,r);return t.call(this,o({onRead:c,onEnter:function(t){return n.animate.auto(t,e)},onFlip:function(t){return n.animate.auto(t,e)}},e))||this}return e(n,t),n.animate={auto:s,transform:u,slidingLayers:f},n}(i.default);t.exports=d}])});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.Flipping=n():t.Flipping=n()}(this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.i=function(t){return t},n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=7)}([function(t,n,r){"use strict";function e(t){var n=f(t),r=n.width,e=n.height;return 0===r&&0===e}function o(t,n){return t?t.height?n.height?{top:t.top-n.top,left:t.left-n.left,width:t.width/n.width,height:t.height/n.height}:n:t:s}var i=this&&this.__assign||Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t};n.__esModule=!0;var a=function(t){return t},u=function(){},f=function(t){var n=t.getBoundingClientRect();return{top:n.top,left:n.left,width:n.width,height:n.height,transform:getComputedStyle(t).transform}},s={top:0,left:0,width:1,height:1},c=function(t){var n=t.querySelectorAll("[data-flip-key]"),r={},o=[];return n.forEach(function(t){if(!e(t)){var n=t.getAttribute("data-flip-key");r[n]=t,o.push(t)}}),o},l=function(){return!0},h=function(t){return t.getAttribute("data-flip-key")},d=function(){function t(t){void 0===t&&(t={});var n=this;this.selector=t.selector||c,this.active=t.active||l,this.selectActive=function(t){return n.selector(t).filter(function(t){return n.active(t)})},this.getBounds=t.getBounds||f,this.getDelta=t.getDelta||o,this.getKey=t.getKey||h,this.onRead=t.onRead||a,this.onEnter=t.onEnter||u,this.onFlip=t.onFlip||u,this.onLeave=t.onLeave||u,this.parentElement=t.parent||document.documentElement,this.states={}}return t.prototype.getRelativeBounds=function(t,n){return i({},n,{top:n.top-t.top,left:n.left-t.left})},t.prototype.read=function(t){void 0===t&&(t={}),this.flip(i({},t,{readOnly:!0}))},t.prototype.flip=function(t){var n=this;void 0===t&&(t={});var r=t.parent||this.parentElement,e=this.selectActive(r),o={},i=this.getBounds(r),a=!1;e.forEach(function(r){var e=n.getKey(r),u=n.states[e],f=u&&"LEAVE"!==u.type;a=!0;var s=n.getRelativeBounds(i,n.getBounds(r)),c={type:f?"MOVE":"ENTER",key:e,node:r,bounds:s,delta:f?n.getDelta(u.bounds,s):void 0,start:Date.now(),animation:f?u.animation:void 0,previous:u};n.states[e]=o[e]=c,t.readOnly&&n.onRead(c)}),t.readOnly||(Object.keys(this.states).forEach(function(t){o[t]||(n.states[t]=o[t]={type:"LEAVE",key:t,node:void 0,bounds:void 0,start:Date.now(),animation:void 0,previous:n.states[t]})}),Object.keys(o).forEach(function(t){var r=o[t],e=r.node||r.previous&&r.previous.node;if(e){var i=e.getAttribute("data-flip-follow");"ENTER"!==r.type&&"LEAVE"!==r.type||!i||(r.delta=o[i].delta)}var a={ENTER:n.onEnter,MOVE:n.onFlip,LEAVE:n.onLeave}[r.type].call(n,r,t,o);a&&n.animate(t,a)}))},t.prototype.animate=function(t,n){this.states[t].animation=n},t.prototype.wrap=function(t,n){var r=this;return void 0===n&&(n={}),function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];r.read(n);var i=t.apply(null,e);return r.flip(n),i}},t.rect=f,t}();n.default=d},function(t,n,r){"use strict";function e(t,n){var r={};return Object.keys(t||{}).forEach(function(e){r[e]=n(t[e],e,t)}),r}function o(t,n,r){var e={};return Object.keys(t||{}).forEach(function(o){e[o]=r(t[o],n[o],o)}),e}function i(t,n){return s.translate(t,n).join(",")}function a(t,n){return s.scale(t,n).join(",")}function u(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.filter(function(t){return!!t}).reduce(s.multiply).join(",")}function f(t,n){return-1!==["height","width"].indexOf(t)&&"number"==typeof n?n+"px":n}n.__esModule=!0;var s=r(2);n.mapValues=e,n.mapTwoValues=o,n.matrixTranslate=i,n.matrixScale=a,n.matrixMultiply=u,n.styleValue=f},function(t,n,r){"use strict";function e(t){if(t.constructor!==Array)throw new TypeError("Expected array.");if(16===t.length)return t;if(6===t.length){var n=o();return n[0]=t[0],n[1]=t[1],n[4]=t[2],n[5]=t[3],n[12]=t[4],n[13]=t[5],n}throw new RangeError("Expected array with either 6 or 16 values.")}function o(){for(var t=[],n=0;n<16;n++)n%5==0?t.push(1):t.push(0);return t}function i(t){var n=e(t),r=n[0]*n[5]-n[4]*n[1],o=n[0]*n[6]-n[4]*n[2],i=n[0]*n[7]-n[4]*n[3],a=n[1]*n[6]-n[5]*n[2],u=n[1]*n[7]-n[5]*n[3],f=n[2]*n[7]-n[6]*n[3],s=n[10]*n[15]-n[14]*n[11],c=n[9]*n[15]-n[13]*n[11],l=n[9]*n[14]-n[13]*n[10],h=n[8]*n[15]-n[12]*n[11],d=n[8]*n[14]-n[12]*n[10],p=n[8]*n[13]-n[12]*n[9],v=1/(r*s-o*c+i*l+a*h-u*d+f*p);if(isNaN(v)||v===1/0)throw new Error("Inverse determinant attempted to divide by zero.");return[(n[5]*s-n[6]*c+n[7]*l)*v,(-n[1]*s+n[2]*c-n[3]*l)*v,(n[13]*f-n[14]*u+n[15]*a)*v,(-n[9]*f+n[10]*u-n[11]*a)*v,(-n[4]*s+n[6]*h-n[7]*d)*v,(n[0]*s-n[2]*h+n[3]*d)*v,(-n[12]*f+n[14]*i-n[15]*o)*v,(n[8]*f-n[10]*i+n[11]*o)*v,(n[4]*c-n[5]*h+n[7]*p)*v,(-n[0]*c+n[1]*h-n[3]*p)*v,(n[12]*u-n[13]*i+n[15]*r)*v,(-n[8]*u+n[9]*i-n[11]*r)*v,(-n[4]*l+n[5]*d-n[6]*p)*v,(n[0]*l-n[1]*d+n[2]*p)*v,(-n[12]*a+n[13]*o-n[14]*r)*v,(n[8]*a-n[9]*o+n[10]*r)*v]}function a(t,n){for(var r=e(t),o=e(n),i=[],a=0;a<4;a++)for(var u=[r[a],r[a+4],r[a+8],r[a+12]],f=0;f<4;f++){var s=4*f,c=[o[s],o[s+1],o[s+2],o[s+3]],l=u[0]*c[0]+u[1]*c[1]+u[2]*c[2]+u[3]*c[3];i[a+s]=l}return i}function u(t){if("string"==typeof t){var n=t.match(/matrix(3d)?\(([^)]+)\)/);if(n){return e(n[2].split(", ").map(function(t){return parseFloat(t)}))}}return o()}function f(t){var n=Math.PI/180*t,r=o();return r[5]=r[10]=Math.cos(n),r[6]=r[9]=Math.sin(n),r[9]*=-1,r}function s(t){var n=Math.PI/180*t,r=o();return r[0]=r[10]=Math.cos(n),r[2]=r[8]=Math.sin(n),r[2]*=-1,r}function c(t){var n=Math.PI/180*t,r=o();return r[0]=r[5]=Math.cos(n),r[1]=r[4]=Math.sin(n),r[4]*=-1,r}function l(t,n){var r=o();return r[0]=t,r[5]=n||t,r}function h(t){var n=o();return n[0]=t,n}function d(t){var n=o();return n[5]=t,n}function p(t){var n=o();return n[10]=t,n}function v(t,n){var r=Math.PI/180*t,e=o();if(e[4]=Math.tan(r),n){var i=Math.PI/180*n;e[1]=Math.tan(i)}return e}function m(t){var n=Math.PI/180*t,r=o();return r[4]=Math.tan(n),r}function y(t){var n=Math.PI/180*t,r=o();return r[1]=Math.tan(n),r}function g(t,n){var r=o();return r[12]=t,n&&(r[13]=n),r}function x(t){var n=o();return n[12]=t,n}function w(t){var n=o();return n[13]=t,n}function E(t){var n=o();return n[14]=t,n}Object.defineProperty(n,"__esModule",{value:!0}),r.d(n,"format",function(){return e}),r.d(n,"identity",function(){return o}),r.d(n,"inverse",function(){return i}),r.d(n,"multiply",function(){return a}),r.d(n,"parse",function(){return u}),r.d(n,"rotateX",function(){return f}),r.d(n,"rotateY",function(){return s}),r.d(n,"rotateZ",function(){return c}),r.d(n,"scale",function(){return l}),r.d(n,"scaleX",function(){return h}),r.d(n,"scaleY",function(){return d}),r.d(n,"scaleZ",function(){return p}),r.d(n,"skew",function(){return v}),r.d(n,"skewX",function(){return m}),r.d(n,"skewY",function(){return y}),r.d(n,"translate",function(){return g}),r.d(n,"translateX",function(){return x}),r.d(n,"translateY",function(){return w}),r.d(n,"translateZ",function(){return E})},function(t,n,r){"use strict";n.__esModule=!0;var e=r(1),o=r(2);n.scale=function(t){var n=t.bounds,r=t.delta,i=1!==r.width||1!==r.height,a=o.translate(r.left,r.top),u=i?o.scale(r.width,r.height):void 0,f=i?"top left":void 0,s=e.matrixMultiply(a,u);return{node:{from:{x:r.left,y:r.top,transformOrigin:f,transform:"matrix3d("+s+")"},to:{x:n.left,y:n.top,transformOrigin:f,transform:n.transform}}}},n.slide=function(t){var n=t.delta,r=t.previous,o=t.bounds;if(r){var i=Math.max(r.bounds.height,o.height),a=Math.max(r.bounds.width,o.width),u={from:{height:i,width:a,transformOrigin:"top left"},to:{height:i,width:a,transformOrigin:"top left"}},f={from:{height:i,width:a,transformOrigin:"top left"},to:{height:i,width:a,transformOrigin:"top left"}},s=o.width-r.bounds.width,c=o.height-r.bounds.height;s>0?(f.from.x=-s+n.left,f.to.x=0,u.from.x=s,u.to.x=0):(f.from.x=0,f.to.x=s-n.left,u.from.x=0,u.to.x=-s),c>0?(f.from.y=-c+n.top,f.to.y=0,u.from.y=c,u.to.y=0):(f.from.y=0,f.to.y=c-n.top,u.from.y=0,u.to.y=-c);var l=e.matrixTranslate(u.from.x,u.from.y),h=e.matrixTranslate(u.to.x,u.to.y),d=e.matrixTranslate(f.from.x,f.from.y),p=e.matrixTranslate(f.to.x,f.to.y);return u.from.transform="matrix3d("+l+")",u.to.transform="matrix3d("+h+")",f.from.transform="matrix3d("+d+")",f.to.transform="matrix3d("+p+")",{node:u,container:f}}}},,,,function(t,n,r){"use strict";function e(t,n,r){var e=f.mapValues(n,function(n,e){return n.animate([f.mapValues(t[e].from,function(t,n){return f.styleValue(n,t)}),f.mapValues(t[e].to,function(t,n){return f.styleValue(n,t)})],r)});return{finish:function(){Object.keys(e).forEach(function(t){return e[t].finish()})}}}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),i=this&&this.__assign||Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},a=r(0),u=r(3),f=r(1),s=function(t,n){var r=t.node;return e(u.slide(t),{node:r,container:r.parentElement},n)},c=function(t,n){void 0===n&&(n={});var r=t.node;return e(u.scale(t),{node:r},n)},l=function(t,n){var r=t.node;if(r)return r&&r.parentElement&&r.parentElement.hasAttribute("data-flip-wrap")?s(t,n):c(t,n)},h=function(t){var n=t.animation;n&&n.finish&&n.finish()},d={duration:300,easing:"ease",fill:"none",getBounds:function(t){var n=a.default.rect(t);if(t&&t.parentElement&&t.parentElement.hasAttribute("data-flip-wrap")){var r=a.default.rect(t.parentElement);n.width-=Math.abs(n.left-r.left),n.height-=Math.abs(n.top-r.top)}return n}},p=function(t){function n(r){void 0===r&&(r={});var e=i({},d,r);return t.call(this,i({onRead:h,onEnter:function(t){return n.animate.auto(t,e)},onFlip:function(t){return n.animate.auto(t,e)}},e))||this}return o(n,t),n.animate={auto:l,transform:c,slidingLayers:s},n}(a.default);t.exports=p}])});
{
"name": "flipping",
"version": "0.5.3",
"version": "0.6.0",
"description": "Flipping awesome animations.",

@@ -28,6 +28,8 @@ "main": "index.js",

"devDependencies": {
"@types/gsap": "^1.19.1",
"@types/web-animations-js": "^2.2.4",
"awesome-typescript-loader": "^3.1.2",
"babel-core": "^6.25.0",
"chai": "^3.5.0",
"gsap": "^1.19.1",
"gsap": "^1.20.3",
"mocha": "^3.2.0",

@@ -42,7 +44,4 @@ "prettier": "^1.4.4",

"dependencies": {
"@types/web-animations-js": "^2.2.4",
"eases": "^1.0.8",
"rematrix": "^0.1.0",
"zen-observable": "^0.5.1"
"rematrix": "^0.1.0"
}
}

@@ -5,3 +5,3 @@ import * as Rematrix from 'rematrix';

object: object,
iteratee: (value: any, key: string, object: object) => object
iteratee: (value: any, key: string, object: object) => any
): object {

@@ -39,2 +39,10 @@ const result = {};

export function styleValue(prop: string, value: string | number): string | number {
if (['height', 'width'].indexOf(prop) !== -1 && typeof value === 'number') {
return `${value}px`;
}
return value;
}
// (window as any).persistLayout = (node: Element): any[] => {

@@ -41,0 +49,0 @@ // const result = [];

@@ -9,4 +9,4 @@ /* eslint strict:0 */

'flipping': './src/index',
'flipping.web': './src/web',
'flipping.animationFrame': './src/animationFrame',
'flipping.web': './src/strategies/web',
'flipping.gsap': './src/strategies/gsap',
},

@@ -13,0 +13,0 @@ output: {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc