Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cdn.min.js « dist « dist « collapse « packages « alpinejs - github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 097d3f0dd0ad29ecdca364fa49a08108c5631789 (plain)
1
(()=>{function f(e){e.directive("collapse",(t,{expression:o,modifiers:n},{effect:s,evaluateLater:x})=>{let g=l(n,"duration",250)/1e3,u=0;t.style.overflow="hidden",t._x_isShown||(t.style.height=`${u}px`),t._x_isShown||t.style.removeProperty("display");let c=(h,r)=>{let i=e.setStyles(h,r);return r.height?()=>{}:i},a={overflow:"hidden",transitionProperty:"height",transitionDuration:`${g}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};t._x_transition={in(h=()=>{},r=()=>{}){let i=t.getBoundingClientRect().height;e.setStyles(t,{height:"auto"});let d=t.getBoundingClientRect().height;i===d&&(i=u),e.transition(t,e.setStyles,{during:a,start:{height:i+"px"},end:{height:d+"px"}},()=>t._x_isShown=!0,()=>{})},out(h=()=>{},r=()=>{}){let i=t.getBoundingClientRect().height;e.transition(t,c,{during:a,start:{height:i+"px"},end:{height:u+"px"}},()=>{},()=>t._x_isShown=!1)}}})}function l(e,t,o){if(e.indexOf(t)===-1)return o;let n=e[e.indexOf(t)+1];if(!n)return o;if(t==="duration"){let s=n.match(/([0-9]+)ms/);if(s)return s[1]}return n}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(f)});})();