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

@formkit/auto-animate

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formkit/auto-animate - npm Package Compare versions

Comparing version 1.0.0-alpha.3 to 1.0.0-beta.1

2

index.min.js

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

const e=new Set,t=new WeakMap,n=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,s=new WeakMap;let d;const l="__aa_tgt",c="__aa_del",f=e=>{const a=function(e){return e.reduce(((e,t)=>{if(!1===e)return!1;if(t.target instanceof Element){if(w(t.target),!e.has(t.target)){e.add(t.target);for(let n=0;n<t.target.children.length;n++){const o=t.target.children.item(n);if(o){if(c in o)return!1;w(t.target,o),e.add(o)}}}if(t.removedNodes.length)for(let o=0;o<t.removedNodes.length;o++){const i=t.removedNodes[o];if(c in i)return!1;i instanceof Element&&(e.add(i),w(t.target,i),n.set(i,[t.previousSibling,t.nextSibling]))}}return e}),new Set)}(e);a&&a.forEach((e=>function(e){var a;const r=d.contains(e),s=t.has(e);r&&n.has(e)&&n.delete(e);o.has(e)&&(null===(a=o.get(e))||void 0===a||a.cancel());s&&r?function(e){const n=t.get(e),i=y(e);let a;if(!n)return;const r=E(e);if("function"!=typeof r){const t=n.left-i.left,o=n.top-i.top,[s,d,l,c]=x(e,n,i),f={transform:`translate(${t}px, ${o}px)`},u={transform:"translate(0, 0)"};s!==d&&(f.width=`${s}px`,u.width=`${d}px`),l!==c&&(f.height=`${l}px`,u.height=`${c}px`),a=e.animate([f,u],r)}else a=new Animation(r(e,"remain",n,i)),a.play();o.set(e,a),t.set(e,i),a.addEventListener("finish",p.bind(null,e))}(e):s&&!r?function(e){if(!n.has(e)||!t.has(e))return;const[a,r]=n.get(e);Object.defineProperty(e,c,{value:!0}),r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(e,r):a&&a.parentNode&&a.parentNode.appendChild(e);const[s,d,l,f]=function(e){const n=t.get(e),[o,,i]=x(e,n,y(e));let a=e.parentElement;for(;a&&("static"===getComputedStyle(a).position||a instanceof HTMLBodyElement);)a=a.parentElement;a||(a=document.body);const r=getComputedStyle(a),s=t.get(a)||y(a),d=Math.round(n.top-s.top)-v(r.borderTopWidth),l=Math.round(n.left-s.left)-v(r.borderLeftWidth);return[d,l,o,i]}(e),u=E(e),p=t.get(e);let h;Object.assign(e.style,{position:"absolute",top:`${s}px`,left:`${d}px`,width:`${l}px`,height:`${f}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),"function"!=typeof u?h=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:u.duration,easing:"ease-out"}):(h=new Animation(u(e,"remove",p)),h.play());o.set(e,h),h.addEventListener("finish",(()=>{var a;e.remove(),t.delete(e),n.delete(e),o.delete(e),null===(a=i.get(e))||void 0===a||a.disconnect()}))}(e):function(e){const n=y(e);t.set(e,n);const i=E(e);let a;"function"!=typeof i?a=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:1.5*i.duration,easing:"ease-in"}):(a=new Animation(i(e,"add",n)),a.play());o.set(e,a),a.addEventListener("finish",p.bind(null,e))}(e)}(e)))},u=n=>{n.forEach((n=>{n.target===d&&(clearTimeout(s.get(d)),s.set(d,setTimeout((()=>{e.forEach((e=>M(e,(e=>g((()=>p(e)))))))}),100))),t.has(n.target)&&p(n.target)}))};function p(e){clearTimeout(s.get(e));const n=E(e),a="function"==typeof n?500:n.duration;s.set(e,setTimeout((()=>{const n=o.get(e);n&&!n.finished||(t.set(e,y(e)),function(e){const n=i.get(e);null==n||n.disconnect();let o=t.get(e),a=0;o||(o=y(e),t.set(e,o));const{offsetWidth:r,offsetHeight:s}=d,l=[o.top-5,r-(o.left+5+o.width),s-(o.top+5+o.height),o.left-5].map((e=>-1*Math.floor(e)+"px")).join(" "),c=new IntersectionObserver((()=>{++a>1&&p(e)}),{root:d,threshold:1,rootMargin:l});c.observe(e),i.set(e,c)}(e))}),a))}function h(e){setTimeout((()=>{a.set(e,setInterval((()=>g(p.bind(null,e))),2e3))}),Math.round(2e3*Math.random()))}function g(e){"function"==typeof requestIdleCallback?requestIdleCallback((()=>e())):requestAnimationFrame((()=>e()))}let m,b;function w(e,t){t||l in e?t&&!(l in t)&&Object.defineProperty(t,l,{value:e}):Object.defineProperty(e,l,{value:e})}function v(e){return Number(e.replace(/[^0-9.\-]/g,""))}function y(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function x(e,t,n){let o=t.width,i=t.height,a=n.width,r=n.height;const s=getComputedStyle(e);if("content-box"===s.getPropertyValue("box-sizing")){const e=v(s.paddingTop)+v(s.paddingBottom)+v(s.borderTopWidth)+v(s.borderBottomWidth),t=v(s.paddingLeft)+v(s.paddingRight)+v(s.borderRightWidth)+v(s.borderLeftWidth);o-=t,a-=t,i-=e,r-=e}return[o,a,i,r].map(Math.round)}function E(e){return l in e&&r.has(e[l])?r.get(e[l]):{duration:250,easing:"ease-in-out"}}function M(e,...t){t.forEach((t=>t(e,r.has(e))));for(let n=0;n<e.children.length;n++){const o=e.children.item(n);o&&t.forEach((e=>e(o,r.has(o))))}}function W(t,n={}){m&&b&&("static"===getComputedStyle(t).position&&Object.assign(t.style,{position:"relative"}),M(t,p,h,(e=>null==b?void 0:b.observe(e))),"function"==typeof n?r.set(t,n):r.set(t,{duration:250,easing:"ease-in-out",...n}),m.observe(t,{childList:!0}),e.add(t))}"undefined"!=typeof window&&(d=document.documentElement,m=new MutationObserver(f),b=new ResizeObserver(u),b.observe(d));const $={mounted:(e,t)=>{W(e,t.value||{})}};export{W as default,x as getTransitionSizes,$ as vAutoAnimate};
const e=new Set,t=new WeakMap,n=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,s=new WeakMap;let d;const c="__aa_tgt",l="__aa_del",f=e=>{const a=function(e){return e.reduce(((e,t)=>{if(!1===e)return!1;if(t.target instanceof Element){if(b(t.target),!e.has(t.target)){e.add(t.target);for(let n=0;n<t.target.children.length;n++){const o=t.target.children.item(n);if(o){if(l in o)return!1;b(t.target,o),e.add(o)}}}if(t.removedNodes.length)for(let o=0;o<t.removedNodes.length;o++){const i=t.removedNodes[o];if(l in i)return!1;i instanceof Element&&(e.add(i),b(t.target,i),n.set(i,[t.previousSibling,t.nextSibling]))}}return e}),new Set)}(e);a&&a.forEach((e=>function(e){var a;const r=d.contains(e),s=t.has(e);r&&n.has(e)&&n.delete(e);o.has(e)&&(null===(a=o.get(e))||void 0===a||a.cancel());s&&r?function(e){const n=t.get(e),i=y(e);let a;if(!n)return;const r=x(e);if("function"!=typeof r){const t=n.left-i.left,o=n.top-i.top,[s,d,c,l]=M(e,n,i),f={transform:`translate(${t}px, ${o}px)`},u={transform:"translate(0, 0)"};s!==d&&(f.width=`${s}px`,u.width=`${d}px`),c!==l&&(f.height=`${c}px`,u.height=`${l}px`),a=e.animate([f,u],r)}else a=new Animation(r(e,"remain",n,i)),a.play();o.set(e,a),t.set(e,i),a.addEventListener("finish",p.bind(null,e))}(e):s&&!r?function(e){if(!n.has(e)||!t.has(e))return;const[a,r]=n.get(e);Object.defineProperty(e,l,{value:!0}),r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(e,r):a&&a.parentNode&&a.parentNode.appendChild(e);const[s,d,c,f]=function(e){const n=t.get(e),[o,,i]=M(e,n,y(e));let a=e.parentElement;for(;a&&("static"===getComputedStyle(a).position||a instanceof HTMLBodyElement);)a=a.parentElement;a||(a=document.body);const r=getComputedStyle(a),s=t.get(a)||y(a),d=Math.round(n.top-s.top)-v(r.borderTopWidth),c=Math.round(n.left-s.left)-v(r.borderLeftWidth);return[d,c,o,i]}(e),u=x(e),p=t.get(e);let h;Object.assign(e.style,{position:"absolute",top:`${s}px`,left:`${d}px`,width:`${c}px`,height:`${f}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),"function"!=typeof u?h=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:u.duration,easing:"ease-out"}):(h=new Animation(u(e,"remove",p)),h.play());o.set(e,h),h.addEventListener("finish",(()=>{var a;e.remove(),t.delete(e),n.delete(e),o.delete(e),null===(a=i.get(e))||void 0===a||a.disconnect()}))}(e):function(e){const n=y(e);t.set(e,n);const i=x(e);let a;"function"!=typeof i?a=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:1.5*i.duration,easing:"ease-in"}):(a=new Animation(i(e,"add",n)),a.play());o.set(e,a),a.addEventListener("finish",p.bind(null,e))}(e)}(e)))},u=n=>{n.forEach((n=>{n.target===d&&(clearTimeout(s.get(d)),s.set(d,setTimeout((()=>{e.forEach((e=>E(e,(e=>g((()=>p(e)))))))}),100))),t.has(n.target)&&p(n.target)}))};function p(e){clearTimeout(s.get(e));const n=x(e),a="function"==typeof n?500:n.duration;s.set(e,setTimeout((()=>{const n=o.get(e);n&&!n.finished||(t.set(e,y(e)),function(e){const n=i.get(e);null==n||n.disconnect();let o=t.get(e),a=0;o||(o=y(e),t.set(e,o));const{offsetWidth:r,offsetHeight:s}=d,c=[o.top-5,r-(o.left+5+o.width),s-(o.top+5+o.height),o.left-5].map((e=>-1*Math.floor(e)+"px")).join(" "),l=new IntersectionObserver((()=>{++a>1&&p(e)}),{root:d,threshold:1,rootMargin:c});l.observe(e),i.set(e,l)}(e))}),a))}function h(e){setTimeout((()=>{a.set(e,setInterval((()=>g(p.bind(null,e))),2e3))}),Math.round(2e3*Math.random()))}function g(e){"function"==typeof requestIdleCallback?requestIdleCallback((()=>e())):requestAnimationFrame((()=>e()))}let m,w;function b(e,t){t||c in e?t&&!(c in t)&&Object.defineProperty(t,c,{value:e}):Object.defineProperty(e,c,{value:e})}function v(e){return Number(e.replace(/[^0-9.\-]/g,""))}function y(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function M(e,t,n){let o=t.width,i=t.height,a=n.width,r=n.height;const s=getComputedStyle(e);if("content-box"===s.getPropertyValue("box-sizing")){const e=v(s.paddingTop)+v(s.paddingBottom)+v(s.borderTopWidth)+v(s.borderBottomWidth),t=v(s.paddingLeft)+v(s.paddingRight)+v(s.borderRightWidth)+v(s.borderLeftWidth);o-=t,a-=t,i-=e,r-=e}return[o,a,i,r].map(Math.round)}function x(e){return c in e&&r.has(e[c])?r.get(e[c]):{duration:250,easing:"ease-in-out"}}function E(e,...t){t.forEach((t=>t(e,r.has(e))));for(let n=0;n<e.children.length;n++){const o=e.children.item(n);o&&t.forEach((e=>e(o,r.has(o))))}}function W(t,n={}){if(m&&w){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;"static"===getComputedStyle(t).position&&Object.assign(t.style,{position:"relative"}),E(t,p,h,(e=>null==w?void 0:w.observe(e))),"function"==typeof n?r.set(t,n):r.set(t,{duration:250,easing:"ease-in-out",...n}),m.observe(t,{childList:!0}),e.add(t)}}"undefined"!=typeof window&&(d=document.documentElement,m=new MutationObserver(f),w=new ResizeObserver(u),w.observe(d));const $={mounted:(e,t)=>{W(e,t.value||{})}};export{W as default,M as getTransitionSizes,$ as vAutoAnimate};
{
"name": "@formkit/auto-animate",
"version": "1.0.0-alpha.3",
"version": "1.0.0-beta.1",
"description": "Add motion to your apps with a single line of code.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

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