preline
Version:
Preline UI is an open-source set of prebuilt UI components based on the utility-first Tailwind CSS framework.
8 lines • 3.46 kB
JavaScript
var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{BF:()=>r,Fh:()=>p,IM:()=>I,JD:()=>f,Lc:()=>s,PK:()=>n,PR:()=>l,V6:()=>d,ar:()=>c,en:()=>E,fc:()=>P,fl:()=>a,gj:()=>o,ov:()=>h,sH:()=>g,sg:()=>y,un:()=>u,wC:()=>i,yd:()=>v,zG:()=>m});
/*
* @version: 4.2.0
* @author: Preline Labs Ltd.
* @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
* Copyright 2024 Preline Labs Ltd.
*/
const n=t=>"true"===t,o=(t,e,n="")=>(window.getComputedStyle(t).getPropertyValue(e)||n).replace(" ",""),r=(t,e,n="")=>{let o="";return t.classList.forEach(t=>{t.includes(e)&&(o=t)}),o.match(/:(.*)]/)?o.match(/:(.*)]/)[1]:n},a=t=>window.getComputedStyle(t).getPropertyValue("z-index"),s=t=>{let e=Number.NEGATIVE_INFINITY;return t.forEach(t=>{let n=a(t);"auto"!==n&&(n=parseInt(n,10),n>e&&(e=n))}),e},i=(t,e)=>{const n=t.children;for(let t=0;t<n.length;t++)if(n[t]===e)return!0;return!1},l=(t,e,n="auto",o=10,r=null)=>{const a=e.getBoundingClientRect(),s=r?r.getBoundingClientRect():null,i=window.innerHeight,l=s?a.top-s.top:a.top,c=(r?s.bottom:i)-a.bottom,d=t.clientHeight+o;return"bottom"===n?c>=d:"top"===n?l>=d:l>=d||c>=d},c=t=>document.activeElement===t,d=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,u=()=>!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),m=()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),p=t=>{if("string"!=typeof t)return!1;const e=t.trim()[0],n=t.trim().slice(-1);if("{"===e&&"}"===n||"["===e&&"]"===n)try{return JSON.parse(t),!0}catch(t){return!1}return!1},g=t=>{if(!t)return!1;return"none"===window.getComputedStyle(t).display||g(t.parentElement)},h=t=>{const e=window.getComputedStyle(t),n=e.overflowY,o=e.overflowX,r=("scroll"===n||"auto"===n)&&t.scrollHeight>t.clientHeight,a=("scroll"===o||"auto"===o)&&t.scrollWidth>t.clientWidth;return r||a},y=(t,e=200)=>{let n;return(...o)=>{clearTimeout(n),n=setTimeout(()=>{t.apply(void 0,o)},e)}},f=(t,e,n=null)=>{const o=new CustomEvent(t,{detail:{payload:n},bubbles:!0,cancelable:!0,composed:!1});e.dispatchEvent(o)},v=(t,e)=>{const n=()=>{e(),t.removeEventListener("transitionend",n,!0)},o=window.getComputedStyle(t),r=o.getPropertyValue("transition-duration");"none"!==o.getPropertyValue("transition-property")&&parseFloat(r)>0?t.addEventListener("transitionend",n,!0):e()},P=t=>{const e=document.createElement("template");return t=t.trim(),e.innerHTML=t,e.content.firstChild},E=(t,e,n=" ",o="add")=>{t.split(n).forEach(t=>{t.trim()&&("add"===o?e.classList.add(t):e.classList.remove(t))})},I={historyIndex:-1,addHistory(t){this.historyIndex=t},existsInHistory(t){return t>this.historyIndex},clearHistory(){this.historyIndex=-1}},w=e.yd,T=e.en,H=e.sg,C=e.JD,x=e.gj,b=e.BF,L=e.Lc,S=e.fl,F=e.fc,M=e.wC,O=e.PR,V=e.ar,B=e.V6,N=e.un,j=e.zG,J=e.Fh,R=e.sH,z=e.ov,A=e.IM,D=e.PK;export{w as afterTransition,T as classToClassList,H as debounce,C as dispatch,x as getClassProperty,b as getClassPropertyAlt,L as getHighestZIndex,S as getZIndex,F as htmlToElement,M as isDirectChild,O as isEnoughSpace,V as isFocused,B as isFormElement,N as isIOS,j as isIpadOS,J as isJson,R as isParentOrElementHidden,z as isScrollable,A as menuSearchHistory,D as stringToBoolean};