@gf-ui/components
Version:
1 lines • 10.8 kB
JavaScript
let e,t,l,n=!1,o=!1,s=!1,i=!1;const r="undefined"!=typeof window?window:{},c=r.document||{head:{}},f={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,l,n)=>e.addEventListener(t,l,n),rel:(e,t,l,n)=>e.removeEventListener(t,l,n),ce:(e,t)=>new CustomEvent(e,t)},u=e=>Promise.resolve(e),a="http://www.w3.org/1999/xlink",$={},d=e=>"object"==(e=typeof e)||"function"===e,m=(e,t,...l)=>{let n=null,o=null,s=null,i=!1,r=!1,c=[];const f=t=>{for(let l=0;l<t.length;l++)n=t[l],Array.isArray(n)?f(n):null!=n&&"boolean"!=typeof n&&((i="function"!=typeof e&&!d(n))&&(n+=""),i&&r?c[c.length-1].o+=n:c.push(i?b(null,n):n),r=i)};if(f(l),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,c,p);const u=b(e,null);return u.i=t,c.length>0&&(u.u=c),u.$=o,u.m=s,u},b=(e,t)=>({t:0,h:e,o:t,p:null,u:null,i:null,$:null,m:null}),h={},p={forEach:(e,t)=>e.map(y).forEach(t),map:(e,t)=>e.map(y).map(t).map(w)},y=e=>({vattrs:e.i,vchildren:e.u,vkey:e.$,vname:e.m,vtag:e.h,vtext:e.o}),w=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),m(e.vtag,t,...e.vchildren||[])}const t=b(e.vtag,e.vtext);return t.i=e.vattrs,t.u=e.vchildren,t.$=e.vkey,t.m=e.vname,t},v=(e,t,l,n,o,s)=>{if(l!==n){let i=le(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=g(l),s=g(n);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in l)n&&null!=n[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in n)l&&n[t]===l[t]||(t.includes("-")?e.style.setProperty(t,n[t]):e.style[t]=n[t])}else if("key"===t);else if("ref"===t)n&&n(e);else if(i||"o"!==t[0]||"n"!==t[1]){const r=d(n);if((i||r&&null!==n)&&!o)try{if(e.tagName.includes("-"))e[t]=n;else{let o=null==n?"":n;"list"===t?i=!1:null!=l&&e[t]==o||(e[t]=o)}}catch(e){}let f=!1;c!==(c=c.replace(/^xlink\:?/,""))&&(t=c,f=!0),null==n||!1===n?!1===n&&""!==e.getAttribute(t)||(f?e.removeAttributeNS(a,t):e.removeAttribute(t)):(!i||4&s||o)&&!r&&(n=!0===n?"":n,f?e.setAttributeNS(a,t,n):e.setAttribute(t,n))}else t="-"===t[2]?t.slice(3):le(r,c)?c.slice(2):c[2]+t.slice(3),l&&f.rel(e,t,l,!1),n&&f.ael(e,t,n,!1)}},k=/\s/,g=e=>e?e.split(k):[],j=(e,t,l,n)=>{const o=11===t.p.nodeType&&t.p.host?t.p.host:t.p,s=e&&e.i||$,i=t.i||$;for(n in s)n in i||v(o,n,s[n],void 0,l,t.t);for(n in i)v(o,n,s[n],i[n],l,t.t)},O=(o,i,r,f)=>{let u,a,$,d=i.u[r],m=0;if(n||(s=!0,"slot"===d.h&&(e&&f.classList.add(e+"-s"),d.t|=d.u?2:1)),null!==d.o)u=d.p=c.createTextNode(d.o);else if(1&d.t)u=d.p=c.createTextNode("");else if(u=d.p=c.createElement(2&d.t?"slot-fb":d.h),j(null,d,!1),null!=e&&u["s-si"]!==e&&u.classList.add(u["s-si"]=e),d.u)for(m=0;m<d.u.length;++m)a=O(o,d,m,u),a&&u.appendChild(a);return u["s-hn"]=l,3&d.t&&(u["s-sr"]=!0,u["s-cr"]=t,u["s-sn"]=d.m||"",$=o&&o.u&&o.u[r],$&&$.h===d.h&&o.p&&x(o.p,!1)),u},x=(e,t)=>{f.t|=1;const n=e.childNodes;for(let e=n.length-1;e>=0;e--){const o=n[e];o["s-hn"]!==l&&o["s-ol"]&&(C(o).insertBefore(o,T(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),t&&x(o,t)}f.t&=-2},M=(e,t,n,o,s,i)=>{let r,c=e["s-cr"]&&e["s-cr"].parentNode||e;for(c.shadowRoot&&c.tagName===l&&(c=c.shadowRoot);s<=i;++s)o[s]&&(r=O(null,n,s,e),r&&(o[s].p=r,c.insertBefore(r,T(t))))},P=(e,t,l,n,s)=>{for(;t<=l;++t)(n=e[t])&&(s=n.p,H(n),o=!0,s["s-ol"]?s["s-ol"].remove():x(s,!0),s.remove())},R=(e,t)=>e.h===t.h&&("slot"===e.h?e.m===t.m:e.$===t.$),T=e=>e&&e["s-ol"]||e,C=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,E=(e,t)=>{const l=t.p=e.p,n=e.u,o=t.u,s=t.o;let i;null===s?("slot"===t.h||j(e,t,!1),null!==n&&null!==o?((e,t,l,n)=>{let o,s,i=0,r=0,c=0,f=0,u=t.length-1,a=t[0],$=t[u],d=n.length-1,m=n[0],b=n[d];for(;i<=u&&r<=d;)if(null==a)a=t[++i];else if(null==$)$=t[--u];else if(null==m)m=n[++r];else if(null==b)b=n[--d];else if(R(a,m))E(a,m),a=t[++i],m=n[++r];else if(R($,b))E($,b),$=t[--u],b=n[--d];else if(R(a,b))"slot"!==a.h&&"slot"!==b.h||x(a.p.parentNode,!1),E(a,b),e.insertBefore(a.p,$.p.nextSibling),a=t[++i],b=n[--d];else if(R($,m))"slot"!==a.h&&"slot"!==b.h||x($.p.parentNode,!1),E($,m),e.insertBefore($.p,a.p),$=t[--u],m=n[++r];else{for(c=-1,f=i;f<=u;++f)if(t[f]&&null!==t[f].$&&t[f].$===m.$){c=f;break}c>=0?(s=t[c],s.h!==m.h?o=O(t&&t[r],l,c,e):(E(s,m),t[c]=void 0,o=s.p),m=n[++r]):(o=O(t&&t[r],l,r,e),m=n[++r]),o&&C(a.p).insertBefore(o,T(a.p))}i>u?M(e,null==n[d+1]?null:n[d+1].p,l,n,r,d):r>d&&P(t,i,u)})(l,n,t,o):null!==o?(null!==e.o&&(l.textContent=""),M(l,null,t,o,0,o.length-1)):null!==n&&P(n,0,n.length-1)):(i=l["s-cr"])?i.parentNode.textContent=s:e.o!==s&&(l.data=s)},L=e=>{let t,l,n,o,s,i,r=e.childNodes;for(l=0,n=r.length;l<n;l++)if(t=r[l],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<n;o++)if(i=r[o].nodeType,r[o]["s-hn"]!==t["s-hn"]||""!==s){if(1===i&&s===r[o].getAttribute("slot")){t.hidden=!0;break}}else if(1===i||3===i&&""!==r[o].textContent.trim()){t.hidden=!0;break}L(t)}},N=[],A=e=>{let t,l,n,s,i,r,c=0,f=e.childNodes,u=f.length;for(;c<u;c++){if(t=f[c],t["s-sr"]&&(l=t["s-cr"])&&l.parentNode)for(n=l.parentNode.childNodes,s=t["s-sn"],r=n.length-1;r>=0;r--)l=n[r],l["s-cn"]||l["s-nr"]||l["s-hn"]===t["s-hn"]||(F(l,s)?(i=N.find((e=>e.v===l)),o=!0,l["s-sn"]=l["s-sn"]||s,i?i.k=t:N.push({k:t,v:l}),l["s-sr"]&&N.map((e=>{F(e.v,l["s-sn"])&&(i=N.find((e=>e.v===l)),i&&!e.k&&(e.k=i.k))}))):N.some((e=>e.v===l))||N.push({v:l}));1===t.nodeType&&A(t)}},F=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,H=e=>{e.i&&e.i.ref&&e.i.ref(null),e.u&&e.u.map(H)},U=(e,t,l)=>{const n=(e=>Z(e).g)(e);return{emit:e=>W(n,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},W=(e,t,l)=>{const n=f.ce(t,l);return e.dispatchEvent(n),n},q=(e,t)=>{t&&!e.j&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.j=t)))},D=(e,t)=>{if(e.t|=16,!(4&e.t))return q(e,e.O),$e((()=>V(e,t)));e.t|=512},V=(e,t)=>{const l=e.M;let n;return t&&(n=I(l,"componentWillLoad")),J(n,(()=>_(e,l)))},_=async(e,t)=>{const l=e.g,n=l["s-rc"];z(e,t),n&&(n.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>B(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},z=(i,r)=>{try{r=r.render(),i.t&=-17,i.t|=2,((i,r)=>{const u=i.g,a=i.P,$=i.R||b(null,null),d=(e=>e&&e.h===h)(r)?r:m(null,null,r);if(l=u.tagName,d.h=null,d.t|=4,i.R=d,d.p=$.p=u.shadowRoot||u,e=u["s-sc"],t=u["s-cr"],n=0!=(1&a.t),o=!1,E($,d),f.t|=1,s){let e,t,l,n,o,s;A(d.p);let i=0;for(;i<N.length;i++)e=N[i],t=e.v,t["s-ol"]||(l=c.createTextNode(""),l["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=l,t));for(i=0;i<N.length;i++)if(e=N[i],t=e.v,e.k){for(n=e.k.parentNode,o=e.k.nextSibling,l=t["s-ol"];l=l.previousSibling;)if(s=l["s-nr"],s&&s["s-sn"]===t["s-sn"]&&n===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&n!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),n.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}o&&L(d.p),f.t&=-2,N.length=0})(i,r)}catch(e){ne(e,i.g)}return null},B=e=>{const t=e.g,l=e.M,n=e.O;64&e.t||(e.t|=64,K(t),I(l,"componentDidLoad"),e.T(t),n||G()),e.C(t),e.j&&(e.j(),e.j=void 0),512&e.t&&ae((()=>D(e,!1))),e.t&=-517},G=()=>{K(c.documentElement),ae((()=>W(r,"appload",{detail:{namespace:"sten-components"}})))},I=(e,t,l)=>{if(e&&e[t])try{return e[t](l)}catch(e){ne(e)}},J=(e,t)=>e&&e.then?e.then(t):t(),K=e=>e.classList.add("hydrated"),Q=(e,t,l)=>{if(t.L){e.watchers&&(t.N=e.watchers);const n=Object.entries(t.L),o=e.prototype;if(n.map((([e,[n]])=>{31&n||2&l&&32&n?Object.defineProperty(o,e,{get(){return((e,t)=>Z(this).A.get(t))(0,e)},set(l){((e,t,l,n)=>{const o=Z(e),s=o.g,i=o.A.get(t),r=o.t,c=o.M;if(l=((e,t)=>null==e||d(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(l,n.L[t][0]),(!(8&r)||void 0===i)&&l!==i&&(!Number.isNaN(i)||!Number.isNaN(l))&&(o.A.set(t,l),c)){if(n.N&&128&r){const e=n.N[t];e&&e.map((e=>{try{c[e](l,i,t)}catch(e){ne(e,s)}}))}2==(18&r)&&D(o,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0}):1&l&&64&n&&Object.defineProperty(o,e,{value(...t){const l=Z(this);return l.F.then((()=>l.M[e](...t)))}})})),1&l){const t=new Map;o.attributeChangedCallback=function(e,l,n){f.jmp((()=>{const l=t.get(e);if(this.hasOwnProperty(l))n=this[l],delete this[l];else if(o.hasOwnProperty(l)&&"number"==typeof this[l]&&this[l]==n)return;this[l]=(null!==n||"boolean"!=typeof this[l])&&n}))},e.observedAttributes=n.filter((([e,t])=>15&t[0])).map((([e,l])=>{const n=l[1]||e;return t.set(n,e),n}))}}return e},S=e=>{const t=e["s-cr"]=c.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},X=(e,t={})=>{const l=[],n=t.exclude||[],o=r.customElements,s=c.head,i=s.querySelector("meta[charset]"),u=c.createElement("style"),a=[];let $,d=!0;Object.assign(f,t),f.l=new URL(t.resourcesUrl||"./",c.baseURI).href,e.map((e=>{e[1].map((t=>{const s={t:t[0],H:t[1],L:t[2],U:t[3]};s.L=t[2],s.N={};const i=s.H,r=class extends HTMLElement{constructor(e){super(e),te(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){$&&(clearTimeout($),$=null),d?a.push(this):f.jmp((()=>(e=>{if(0==(1&f.t)){const t=Z(e),l=t.P,n=()=>{};if(!(1&t.t)){t.t|=1,12&l.t&&S(e);{let l=e;for(;l=l.parentNode||l.host;)if(l["s-p"]){q(t,t.O=l);break}}l.L&&Object.entries(l.L).map((([t,[l]])=>{if(31&l&&e.hasOwnProperty(t)){const l=e[t];delete e[t],e[t]=l}})),(async(e,t,l,n,o)=>{if(0==(32&t.t)){if(t.t|=32,(o=se(l)).then){const e=()=>{};o=await o,e()}o.isProxied||(l.N=o.watchers,Q(o,l,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(e){ne(e)}t.t&=-9,t.t|=128,e()}const s=t.O,i=()=>D(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,l)}n()}})(this)))}disconnectedCallback(){f.jmp((()=>(()=>{0==(1&f.t)&&I(Z(this).M,"disconnectedCallback")})()))}componentOnReady(){return Z(this).W}};s.q=e[0],n.includes(i)||o.get(i)||(l.push(i),o.define(i,Q(r,s,1)))}))})),u.innerHTML=l+"{visibility:hidden}.hydrated{visibility:inherit}",u.setAttribute("data-styles",""),s.insertBefore(u,i?i.nextSibling:s.firstChild),d=!1,a.length?a.map((e=>e.connectedCallback())):f.jmp((()=>$=setTimeout(G,30)))},Y=new WeakMap,Z=e=>Y.get(e),ee=(e,t)=>Y.set(t.M=e,t),te=(e,t)=>{const l={t:0,g:e,P:t,A:new Map};return l.F=new Promise((e=>l.C=e)),l.W=new Promise((e=>l.T=e)),e["s-p"]=[],e["s-rc"]=[],Y.set(e,l)},le=(e,t)=>t in e,ne=(e,t)=>(0,console.error)(e,t),oe=new Map,se=e=>{const t=e.H.replace(/-/g,"_"),l=e.q,n=oe.get(l);return n?n[t]:import(`./${l}.entry.js`).then((e=>(oe.set(l,e),e[t])),ne)},ie=[],re=[],ce=(e,t)=>l=>{e.push(l),i||(i=!0,t&&4&f.t?ae(ue):f.raf(ue))},fe=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ne(e)}e.length=0},ue=()=>{fe(ie),fe(re),(i=ie.length>0)&&f.raf(ue)},ae=e=>u().then(e),$e=ce(re,!0);export{h as H,X as b,U as c,m as h,u as p,ee as r}