First code
This commit is contained in:
commit
cfb830b3f1
10 files changed
+499
No files matched your search
Vendored
+1
@@ -0,0 +1 @@
|
||||
const Z=[],H=new WeakSet,M=navigator.userAgent.includes("Chrome");navigator.userAgent.includes("Firefox");navigator.userAgent.includes("Safari");navigator.userAgent.includes("Windows");const Q=navigator.userAgent.includes("Macintosh");navigator.userAgent.includes("Linux");navigator.userAgent.includes("Android");const J=/iPad|iPhone|iPod/.test(navigator.userAgent);function kt(){return window==null?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches}async function tt(t){await new Promise(n=>setTimeout(n,t))}function xt(){return"fxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function v(t,n){try{return typeof t=="string"?(n??document).querySelector(t):t}catch{return null}}function c(t,n){try{return typeof t=="string"?(n??document).querySelectorAll(t):t??Z}catch{return Z}}function u(t,n){return(t==null?void 0:t.classList.contains(n))??!1}function g(t,n){var e;return((e=t==null?void 0:t.tagName)==null?void 0:e.toLowerCase())===n}function C(t,n){var e;return((e=t==null?void 0:t.type)==null?void 0:e.toLowerCase())===n}function h(t,n){if(t instanceof NodeList)for(let e=0;e<t.length;e++)t[e].classList.add(n);else t==null||t.classList.add(n)}function p(t,n){if(t instanceof NodeList)for(let e=0;e<t.length;e++)t[e].classList.remove(n);else t==null||t.classList.remove(n)}function T(t,n,e,i=!0){t!=null&&t.addEventListener&&t.addEventListener(n,e,i)}function a(t,n,e,i=!0){Et(t),T(t,n,e,i)}function D(t,n,e,i=!0){t!=null&&t.removeEventListener&&t.removeEventListener(n,e,i)}function mt(t,n){var e;(e=n==null?void 0:n.parentNode)==null||e.insertBefore(t,n)}function q(t){return t==null?void 0:t.previousElementSibling}function O(t){return t==null?void 0:t.nextElementSibling}function E(t){return t==null?void 0:t.parentElement}function At(t){const n=document.createElement("div");for(let e=0,i=Object.keys(t),s=i.length;e<s;e++){const r=i[e],o=t[r];n.setAttribute(r,o)}return n}function $(){var t;(t=document.activeElement)==null||t.blur()}function wt(t){return c('[data-ui="#'+t+'"]')}function Ct(t){return v('[data-ui="#'+t+'"]')}function Tt(t){t.id&&u(t,"page")&&(t=Ct(t.id)??t);const n=E(t);if(!u(n,"tabs")&&!u(n,"tabbed")&&!g(n,"nav"))return;const e=c("a",n);for(let i=0;i<e.length;i++)p(e[i],"active");!g(t,"button")&&!u(t,"button")&&!u(t,"chip")&&h(t,"active")}function Et(t){H.has(t)||H.add(t)}function nt(){const t=getComputedStyle(document.documentElement).getPropertyValue("--size")||"16px";return t.includes("%")?parseInt(t)*16/100:t.includes("em")?parseInt(t)*16:parseInt(t)}function z(t){t.placeholder||(t.placeholder=" ")}function Lt(t){const n=t.currentTarget,e=E(n),i=v("input:not([type=file], [type=checkbox], [type=radio]), select, textarea",e);i&&i.focus()}function N(t){const n=t.currentTarget;L(n)}function R(t){const n=t.currentTarget;L(n)}function St(t){const n=t.currentTarget;K(n)}function It(t){const n=t.currentTarget;W(n)}function Mt(t){const n=t.currentTarget;K(n,t)}function Dt(t){const n=t.currentTarget;W(n,t)}function _t(t){var i;const n=t.currentTarget,e=v("input",E(n));e&&((i=n.textContent)!=null&&i.includes("visibility"))&&(e.type==="password"?(e.type="text",n.textContent="visibility_off"):(e.type="password",n.textContent="visibility"))}function Ft(t){const n=t.currentTarget;et(n)}function Pt(){const t=c(".field > label");for(let n=0;n<t.length;n++)a(t[n],"click",Lt)}function qt(){const t=c(".field > input:not([type=file], [type=color], [type=range])");for(let n=0;n<t.length;n++)a(t[n],"focus",N),a(t[n],"blur",R),L(t[n])}function Ot(){const t=c(".field > select");for(let n=0;n<t.length;n++)a(t[n],"focus",N),a(t[n],"blur",R)}function $t(){const t=c(".field > input[type=file]");for(let n=0;n<t.length;n++)a(t[n],"change",St),K(t[n])}function zt(){const t=c(".field > input[type=color]");for(let n=0;n<t.length;n++)a(t[n],"change",It),W(t[n])}function Nt(){const t=c(".field > textarea");for(let n=0;n<t.length;n++)a(t[n],"focus",N),a(t[n],"blur",R),z(t[n]),!(M&&!Q&&!J)&&(a(t[n],"input",Ft),et(t[n]))}function Rt(){const t=c(".field:has(> input[type=password]) > i, a");for(let n=0;n<t.length;n++)a(t[n],"click",_t)}function L(t){C(t,"number")&&!t.value&&(t.value=""),z(t)}function K(t,n){if((n==null?void 0:n.key)==="Enter"){const i=q(t);if(!C(i,"file"))return;i.click();return}const e=O(t);C(e,"text")&&(e.value=t.files?Array.from(t.files).map(i=>i.name).join(", "):"",e.readOnly=!0,a(e,"keydown",Mt,!1),L(e))}function W(t,n){if((n==null?void 0:n.key)==="Enter"){const i=q(t);if(!C(i,"color"))return;i.click();return}const e=O(t);C(e,"text")&&(e.readOnly=!0,e.value=t.value,a(e,"keydown",Dt,!1),L(e))}function et(t){if(z(t),t.hasAttribute("rows"))return;const n=nt();t.style.blockSize="auto",t.style.blockSize=`${t.scrollHeight-n}px`}function Kt(){Pt(),qt(),Ot(),$t(),zt(),Nt(),Rt()}function X(t){const n=t.target;!g(n,"input")&&!g(n,"select")||(n.type==="range"?(n.focus(),ot(n)):it())}function Wt(t){if(!window.matchMedia("(pointer: coarse)").matches)rLine truncated
|
||||
Reference in new issue
Block a user