Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.lib.components.transitions.expand-transition.mjs.map Maven / Gradle / Ivy
{"version":3,"file":"expand-transition.mjs","names":["camelize","expandedParentClass","arguments","length","undefined","x","sizeProperty","offsetProperty","onBeforeEnter","el","_parent","parentNode","_initialStyle","transition","style","overflow","onEnter","initialStyle","setProperty","offset","offsetHeight","classList","add","requestAnimationFrame","onAfterEnter","resetStyles","onEnterCancelled","onLeave","onAfterLeave","onLeaveCancelled","remove","size"],"sources":["../../../src/components/transitions/expand-transition.ts"],"sourcesContent":["// Utilities\nimport { camelize } from 'vue'\n\ninterface HTMLExpandElement extends HTMLElement {\n _parent?: (Node & ParentNode & HTMLElement) | null\n _initialStyle?: {\n transition: string\n overflow: string\n height?: string | null\n width?: string | null\n }\n}\n\nexport default function (expandedParentClass = '', x = false) {\n const sizeProperty = x ? 'width' : 'height' as 'width' | 'height'\n const offsetProperty = camelize(`offset-${sizeProperty}`) as 'offsetHeight' | 'offsetWidth'\n\n return {\n onBeforeEnter (el: HTMLExpandElement) {\n el._parent = el.parentNode as (Node & ParentNode & HTMLElement) | null\n el._initialStyle = {\n transition: el.style.transition,\n overflow: el.style.overflow,\n [sizeProperty]: el.style[sizeProperty],\n }\n },\n\n onEnter (el: HTMLExpandElement) {\n const initialStyle = el._initialStyle!\n\n el.style.setProperty('transition', 'none', 'important')\n // Hide overflow to account for collapsed margins in the calculated height\n el.style.overflow = 'hidden'\n const offset = `${el[offsetProperty]}px`\n\n el.style[sizeProperty] = '0'\n\n void el.offsetHeight // force reflow\n\n el.style.transition = initialStyle.transition\n\n if (expandedParentClass && el._parent) {\n el._parent.classList.add(expandedParentClass)\n }\n\n requestAnimationFrame(() => {\n el.style[sizeProperty] = offset\n })\n },\n\n onAfterEnter: resetStyles,\n onEnterCancelled: resetStyles,\n\n onLeave (el: HTMLExpandElement) {\n el._initialStyle = {\n transition: '',\n overflow: el.style.overflow,\n [sizeProperty]: el.style[sizeProperty],\n }\n\n el.style.overflow = 'hidden'\n el.style[sizeProperty] = `${el[offsetProperty]}px`\n void el.offsetHeight // force reflow\n\n requestAnimationFrame(() => (el.style[sizeProperty] = '0'))\n },\n\n onAfterLeave,\n onLeaveCancelled: onAfterLeave,\n }\n\n function onAfterLeave (el: HTMLExpandElement) {\n if (expandedParentClass && el._parent) {\n el._parent.classList.remove(expandedParentClass)\n }\n resetStyles(el)\n }\n\n function resetStyles (el: HTMLExpandElement) {\n const size = el._initialStyle![sizeProperty]\n el.style.overflow = el._initialStyle!.overflow\n if (size != null) el.style[sizeProperty] = size\n delete el._initialStyle\n }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,KAAK;AAY9B,eAAe,YAA+C;EAAA,IAArCC,mBAAmB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IAAEG,CAAC,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAC1D,MAAMI,YAAY,GAAGD,CAAC,GAAG,OAAO,GAAG,QAA8B;EACjE,MAAME,cAAc,GAAGP,QAAQ,CAAE,UAASM,YAAa,EAAC,CAAmC;EAE3F,OAAO;IACLE,aAAaA,CAAEC,EAAqB,EAAE;MACpCA,EAAE,CAACC,OAAO,GAAGD,EAAE,CAACE,UAAsD;MACtEF,EAAE,CAACG,aAAa,GAAG;QACjBC,UAAU,EAAEJ,EAAE,CAACK,KAAK,CAACD,UAAU;QAC/BE,QAAQ,EAAEN,EAAE,CAACK,KAAK,CAACC,QAAQ;QAC3B,CAACT,YAAY,GAAGG,EAAE,CAACK,KAAK,CAACR,YAAY;MACvC,CAAC;IACH,CAAC;IAEDU,OAAOA,CAAEP,EAAqB,EAAE;MAC9B,MAAMQ,YAAY,GAAGR,EAAE,CAACG,aAAc;MAEtCH,EAAE,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