UNPKG

radh-ui

Version:

Stencil Component Starter

1 lines 12.7 kB
let e,t,n,l=!1,o=!1,s=!1,i=!1,r=!1;const c="undefined"!=typeof window?window:{},a=c.CSS,f=c.document||{head:{}},u={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l)},d=(()=>(f.head.attachShadow+"").indexOf("[native")>-1)(),p=e=>Promise.resolve(e),m=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),h=(e,t,n)=>{n&&n.map(([n,l,o])=>{const s=e,i=$(t,o),r=w(n);u.ael(s,l,i,r),(t.o=t.o||[]).push(()=>u.rel(s,l,i,r))})},$=(e,t)=>n=>{256&e.t?e.s[t](n):(e.u=e.u||[]).push([t,n])},w=e=>0!=(2&e),b=new WeakMap,y=e=>"sc-"+e.p,_={},g=e=>"object"==(e=typeof e)||"function"===e,v=(e,t,...n)=>{let l=null,o=null,s=null,i=!1,r=!1,c=[];const a=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?a(l):null!=l&&"boolean"!=typeof l&&((i="function"!=typeof e&&!g(l))&&(l+=""),i&&r?c[c.length-1].h+=l:c.push(i?j(null,l):l),r=i)};if(a(n),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(" "))}}const f=j(e,null);return f.$=t,c.length>0&&(f._=c),f.g=o,f.v=s,f},j=(e,t)=>({t:0,j:e,h:t,k:null,_:null,$:null,g:null,v:null}),k={},M=(e,t,n,l,o,s)=>{if(n!==l){let r=ie(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,o=R(n),s=R(l);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 n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if(r||"o"!==t[0]||"n"!==t[1]){const c=g(l);if((r||c&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let o=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(i){}null==l||!1===l?e.removeAttribute(t):(!r||4&s||o)&&!c&&e.setAttribute(t,l=!0===l?"":l)}else t="-"===t[2]?t.slice(3):ie(c,a)?a.slice(2):a[2]+t.slice(3),n&&u.rel(e,t,n,!1),l&&u.ael(e,t,l,!1)}},O=/\s/,R=e=>e?e.split(O):[],S=(e,t,n,l)=>{const o=11===t.k.nodeType&&t.k.host?t.k.host:t.k,s=e&&e.$||_,i=t.$||_;for(l in s)l in i||M(o,l,s[l],void 0,n,t.t);for(l in i)M(o,l,s[l],i[l],n,t.t)},U=(o,r,c,a)=>{let u,d,p,m=r._[c],h=0;if(l||(s=!0,"slot"===m.j&&(e&&a.classList.add(e+"-s"),m.t|=m._?2:1)),null!==m.h)u=m.k=f.createTextNode(m.h);else if(1&m.t)u=m.k=f.createTextNode("");else{if(i||(i="svg"===m.j),u=m.k=f.createElementNS(i?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&m.t?"slot-fb":m.j),i&&"foreignObject"===m.j&&(i=!1),S(null,m,i),null!=e&&u["s-si"]!==e&&u.classList.add(u["s-si"]=e),m._)for(h=0;h<m._.length;++h)d=U(o,m,h,u),d&&u.appendChild(d);"svg"===m.j?i=!1:"foreignObject"===u.tagName&&(i=!0)}return u["s-hn"]=n,3&m.t&&(u["s-sr"]=!0,u["s-cr"]=t,u["s-sn"]=m.v||"",p=o&&o._&&o._[c],p&&p.j===m.j&&o.k&&L(o.k,!1)),u},L=(e,t)=>{u.t|=1;const l=e.childNodes;for(let o=l.length-1;o>=0;o--){const e=l[o];e["s-hn"]!==n&&e["s-ol"]&&(W(e).insertBefore(e,x(e)),e["s-ol"].remove(),e["s-ol"]=void 0,s=!0),t&&L(e,t)}u.t&=-2},P=(e,t,l,o,s,i)=>{let r,c=e["s-cr"]&&e["s-cr"].parentNode||e;for(c.shadowRoot&&c.tagName===n&&(c=c.shadowRoot);s<=i;++s)o[s]&&(r=U(null,l,s,e),r&&(o[s].k=r,c.insertBefore(r,x(t))))},C=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(o=!0,(s=l.k)["s-ol"]?s["s-ol"].remove():L(s,!0),s.remove())},T=(e,t)=>e.j===t.j&&("slot"===e.j?e.v===t.v:e.g===t.g),x=e=>e&&e["s-ol"]||e,W=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,A=(e,t)=>{const n=t.k=e.k,l=e._,o=t._,s=t.j,r=t.h;let c;null===r?(i="svg"===s||"foreignObject"!==s&&i,"slot"===s||S(e,t,i),null!==l&&null!==o?((e,t,n,l)=>{let o,s,i=0,r=0,c=0,a=0,f=t.length-1,u=t[0],d=t[f],p=l.length-1,m=l[0],h=l[p];for(;i<=f&&r<=p;)if(null==u)u=t[++i];else if(null==d)d=t[--f];else if(null==m)m=l[++r];else if(null==h)h=l[--p];else if(T(u,m))A(u,m),u=t[++i],m=l[++r];else if(T(d,h))A(d,h),d=t[--f],h=l[--p];else if(T(u,h))"slot"!==u.j&&"slot"!==h.j||L(u.k.parentNode,!1),A(u,h),e.insertBefore(u.k,d.k.nextSibling),u=t[++i],h=l[--p];else if(T(d,m))"slot"!==u.j&&"slot"!==h.j||L(d.k.parentNode,!1),A(d,m),e.insertBefore(d.k,u.k),d=t[--f],m=l[++r];else{for(c=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].g&&t[a].g===m.g){c=a;break}c>=0?(s=t[c],s.j!==m.j?o=U(t&&t[r],n,c,e):(A(s,m),t[c]=void 0,o=s.k),m=l[++r]):(o=U(t&&t[r],n,r,e),m=l[++r]),o&&W(u.k).insertBefore(o,x(u.k))}i>f?P(e,null==l[p+1]?null:l[p+1].k,n,l,r,p):r>p&&C(t,i,f)})(n,l,t,o):null!==o?(null!==e.h&&(n.textContent=""),P(n,null,t,o,0,o.length-1)):null!==l&&C(l,0,l.length-1),i&&"svg"===s&&(i=!1)):(c=n["s-cr"])?c.parentNode.textContent=r:e.h!==r&&(n.data=r)},E=e=>{let t,n,l,o,s,i,r=e.childNodes;for(n=0,l=r.length;n<l;n++)if(t=r[n],1===t.nodeType){if(t["s-sr"])for(s=t["s-sn"],t.hidden=!1,o=0;o<l;o++)if(r[o]["s-hn"]!==t["s-hn"])if(i=r[o].nodeType,""!==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}E(t)}},F=[],D=e=>{let t,n,l,s,i,r,c=0,a=e.childNodes,f=a.length;for(;c<f;c++){if(t=a[c],t["s-sr"]&&(n=t["s-cr"]))for(l=n.parentNode.childNodes,s=t["s-sn"],r=l.length-1;r>=0;r--)n=l[r],n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||(H(n,s)?(i=F.find(e=>e.M===n),o=!0,n["s-sn"]=n["s-sn"]||s,i?i.O=t:F.push({O:t,M:n}),n["s-sr"]&&F.map(e=>{H(e.M,n["s-sn"])&&(i=F.find(e=>e.M===n),i&&!e.O&&(e.O=i.O))})):F.some(e=>e.M===n)||F.push({M:n}));1===t.nodeType&&D(t)}},H=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,N=e=>le(e).R,q=(e,t,n)=>{const l=N(e);return{emit:e=>B(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},B=(e,t,n)=>{const l=new CustomEvent(t,n);return e.dispatchEvent(l),l},V=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.S=t))},z=(e,t)=>{if(e.t|=16,!(4&e.t))return V(e,e.U),we(()=>G(e,t));e.t|=512},G=(e,t)=>{const n=e.s;let l;return t?(e.t|=256,e.u&&(e.u.map(([e,t])=>X(n,e,t)),e.u=null),l=X(n,"componentWillLoad")):l=X(n,"componentWillUpdate"),Y(l,()=>I(e,n,t))},I=(i,r,c)=>{const a=i.R,p=a["s-rc"];c&&(e=>{const t=e.L,n=e.R,l=t.t,o=((e,t)=>{let n=y(t),l=fe.get(n);if(e=11===e.nodeType?e:f,l)if("string"==typeof l){let t,o=b.get(e=e.head||e);o||b.set(e,o=new Set),o.has(n)||(t=f.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(d&&n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(i),((i,r)=>{const c=i.R,a=i.L,p=i.P||j(null,null),m=(e=>e&&e.j===k)(r)?r:v(null,null,r);if(n=c.tagName,a.C&&(m.$=m.$||{},a.C.map(([e,t])=>m.$[t]=c[e])),m.j=null,m.t|=4,i.P=m,m.k=p.k=c.shadowRoot||c,e=c["s-sc"],t=c["s-cr"],l=d&&0!=(1&a.t),o=!1,A(p,m),u.t|=1,s){let e,t,n,l,o,s;D(m.k);let i=0;for(;i<F.length;i++)e=F[i],t=e.M,t["s-ol"]||(n=f.createTextNode(""),n["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=n,t));for(i=0;i<F.length;i++)if(e=F[i],t=e.M,e.O){for(l=e.O.parentNode,o=e.O.nextSibling,n=t["s-ol"];n=n.previousSibling;)if(s=n["s-nr"],s&&s["s-sn"]===t["s-sn"]&&l===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&l!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),l.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}o&&E(m.k),u.t&=-2,F.length=0})(i,J(i,r)),p&&(p.map(e=>e()),a["s-rc"]=void 0);{const e=a["s-p"],t=()=>K(i);0===e.length?t():(Promise.all(e).then(t),i.t|=4,e.length=0)}},J=(e,t)=>{try{t=t.render(),e.t&=-17,e.t|=2}catch(n){re(n)}return t},K=e=>{const t=e.R,n=e.s,l=e.U;64&e.t||(e.t|=64,Z(t),X(n,"componentDidLoad"),e.T(t),l||Q()),e.W(t),e.S&&(e.S(),e.S=void 0),512&e.t&&$e(()=>z(e,!1)),e.t&=-517},Q=()=>{Z(f.documentElement),$e(()=>B(c,"appload",{detail:{namespace:"radh-ui"}}))},X=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(l){re(l)}},Y=(e,t)=>e&&e.then?e.then(t):t(),Z=e=>e.classList.add("hydrated"),ee=(e,t,n)=>{if(t.A){e.watchers&&(t.F=e.watchers);const l=Object.entries(t.A),o=e.prototype;if(l.map(([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(o,e,{get(){return((e,t)=>le(this).D.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=le(this),s=o.D.get(t),i=o.t,r=o.s;if(n=((e,t)=>null==e||g(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.A[t][0]),!(8&i&&void 0!==s||n===s)&&(o.D.set(t,n),r)){if(l.F&&128&i){const e=l.F[t];e&&e.map(e=>{try{r[e](n,s,t)}catch(l){re(l)}})}2==(18&i)&&z(o,!1)}})(0,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,e,{value(...t){const n=le(this);return n.H.then(()=>n.s[e](...t))}})}),1&n){const n=new Map;o.attributeChangedCallback=function(e,t,l){u.jmp(()=>{const t=n.get(e);this[t]=(null!==l||"boolean"!=typeof this[t])&&l})},e.observedAttributes=l.filter(([e,t])=>15&t[0]).map(([e,l])=>{const o=l[1]||e;return n.set(o,e),512&l[0]&&t.C.push([e,o]),o})}}return e},te=(e,t={})=>{const n=[],l=t.exclude||[],o=c.customElements,s=f.head,i=s.querySelector("meta[charset]"),r=f.createElement("style"),a=[];let p,$=!0;Object.assign(u,t),u.l=new URL(t.resourcesUrl||"./",f.baseURI).href,e.map(e=>e[1].map(t=>{const s={t:t[0],p:t[1],A:t[2],N:t[3]};s.A=t[2],s.N=t[3],s.C=[],s.F={},!d&&1&s.t&&(s.t|=8);const i=s.p,r=class extends HTMLElement{constructor(e){super(e),se(e=this,s),1&s.t&&(d?e.attachShadow({mode:"open"}):"shadowRoot"in e||(e.shadowRoot=e))}connectedCallback(){p&&(clearTimeout(p),p=null),$?a.push(this):u.jmp(()=>(e=>{if(0==(1&u.t)){const t=le(e),n=t.L,l=()=>{};if(1&t.t)h(e,t,n.N);else{t.t|=1,12&n.t&&(e=>{const t=e["s-cr"]=f.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){V(t,t.U=n);break}}n.A&&Object.entries(n.A).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),$e(()=>(async(e,t,n,l,o)=>{if(0==(32&t.t)){t.t|=32;{if((o=ae(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(n.F=o.watchers,ee(o,n,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(r){re(r)}t.t&=-9,t.t|=128,e()}const e=y(n);if(!fe.has(e)&&o.style){const t=()=>{};let l=o.style;8&n.t&&(l=await __sc_import_radh_ui("./p-8a8f7b57.js").then(t=>t.scopeCss(l,e,!1))),((e,t,n)=>{let l=fe.get(e);m&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,fe.set(e,l)})(e,l,!!(1&n.t)),t()}}const s=t.U,i=()=>z(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,n))}l()}})(this))}disconnectedCallback(){u.jmp(()=>(()=>{if(0==(1&u.t)){const e=le(this),t=e.s;e.o&&(e.o.map(e=>e()),e.o=void 0),X(t,"componentDidUnload")}})())}forceUpdate(){(()=>{{const e=le(this);e.R.isConnected&&2==(18&e.t)&&z(e,!1)}})()}componentOnReady(){return le(this).q}};s.B=e[0],l.includes(i)||o.get(i)||(n.push(i),o.define(i,ee(r,s,1)))})),r.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",r.setAttribute("data-styles",""),s.insertBefore(r,i?i.nextSibling:s.firstChild),$=!1,a.length?a.map(e=>e.connectedCallback()):u.jmp(()=>p=setTimeout(Q,30))},ne=new WeakMap,le=e=>ne.get(e),oe=(e,t)=>ne.set(t.s=e,t),se=(e,t)=>{const n={t:0,R:e,L:t,D:new Map};return n.H=new Promise(e=>n.W=e),n.q=new Promise(e=>n.T=e),e["s-p"]=[],e["s-rc"]=[],h(e,n,t.N),ne.set(e,n)},ie=(e,t)=>t in e,re=e=>console.error(e),ce=new Map,ae=e=>{const t=e.p.replace(/-/g,"_"),n=e.B,l=ce.get(n);return l?l[t]:__sc_import_radh_ui(`./${n}.entry.js`).then(e=>(ce.set(n,e),e[t]),re)},fe=new Map,ue=[],de=[],pe=(e,t)=>n=>{e.push(n),r||(r=!0,t&&4&u.t?$e(he):u.raf(he))},me=e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(t){re(t)}e.length=0},he=()=>{me(ue),me(de),(r=ue.length>0)&&u.raf(he)},$e=e=>p().then(e),we=pe(de,!0),be=()=>a&&a.supports&&a.supports("color","var(--c)")?p():__sc_import_radh_ui("./p-1b2d9a2e.js").then(()=>(u.V=c.__cssshim)?(!1).i():0),ye=()=>{u.V=c.__cssshim;const e=Array.from(f.querySelectorAll("script")).find(e=>/\/radh-ui(\.esm)?\.js($|\?|#)/.test(e.src)||"radh-ui"===e.getAttribute("data-stencil-namespace")),t=e["data-opts"]||{};return"onbeforeload"in e&&!history.scrollRestoration?{then(){}}:(t.resourcesUrl=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,c.location.href)).href,_e(t.resourcesUrl,e),c.customElements?p(t):__sc_import_radh_ui("./p-2e1bb10c.js").then(()=>t))},_e=(e,t)=>{try{c.__sc_import_radh_ui=Function("w","return import(w);//"+Math.random())}catch(n){const l=new Map;c.__sc_import_radh_ui=n=>{const o=new URL(n,e).href;let s=l.get(o);if(!s){const e=f.createElement("script");e.type="module",e.crossOrigin=t.crossOrigin,e.src=URL.createObjectURL(new Blob([`import * as m from '${o}'; window.__sc_import_radh_ui.m = m;`],{type:"application/javascript"})),s=new Promise(t=>{e.onload=()=>{t(c.__sc_import_radh_ui.m),e.remove()}}),l.set(o,s),f.head.appendChild(e)}return s}}};export{k as H,be as a,te as b,q as c,N as g,v as h,ye as p,oe as r}