UNPKG

@digix-ui/dialog

Version:

Stencil Component Starter

1 lines 10.4 kB
let t,e,n=!1,l=!1,o=!1,s=!1;const r="undefined"!=typeof window?window:{},i=r.CSS,c=r.document||{head:{}},a={t:0,l:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,l)=>t.addEventListener(e,n,l),rel:(t,e,n,l)=>t.removeEventListener(e,n,l)},u=t=>Promise.resolve(t),f=(()=>{try{return new CSSStyleSheet,!0}catch(t){}return!1})(),d=new WeakMap,$=t=>"sc-"+t,p={},m=t=>"object"==(t=typeof t)||"function"===t,w=(t,e,...n)=>{let l=null,o=null,s=!1,r=!1,i=[];const c=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof t&&!m(l))&&(l+=""),s&&r?i[i.length-1].o+=l:i.push(s?h(null,l):l),r=s)};if(c(n),e){e.name&&(o=e.name);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter(e=>t[e]).join(" "))}}const a=h(t,null);return a.s=e,i.length>0&&(a.u=i),a.$=o,a},h=(t,e)=>({t:0,p:t,o:e,h:null,u:null,s:null,$:null}),y={},b=(t,e,n,l,o,s)=>{if(n!==l){let c=K(t,e),u=e.toLowerCase();if("class"===e){const e=t.classList,o=_(n),s=_(l);e.remove(...o.filter(t=>t&&!s.includes(t))),e.add(...s.filter(t=>t&&!o.includes(t)))}else if(c||"o"!==e[0]||"n"!==e[1]){const r=m(l);if((c||r&&null!==l)&&!o)try{if(t.tagName.includes("-"))t[e]=l;else{let o=null==l?"":l;"list"===e?c=!1:null!=n&&t[e]==o||(t[e]=o)}}catch(i){}null==l||!1===l?t.removeAttribute(e):(!c||4&s||o)&&!r&&t.setAttribute(e,l=!0===l?"":l)}else e="-"===e[2]?e.slice(3):K(r,u)?u.slice(2):u[2]+e.slice(3),n&&a.rel(t,e,n,!1),l&&a.ael(t,e,l,!1)}},g=/\s/,_=t=>t?t.split(g):[],j=(t,e,n,l)=>{const o=11===e.h.nodeType&&e.h.host?e.h.host:e.h,s=t&&t.s||p,r=e.s||p;for(l in s)l in r||b(o,l,s[l],void 0,n,e.t);for(l in r)b(o,l,s[l],r[l],n,e.t)},v=(l,s,r)=>{let i,a,u,f=s.u[r],d=0;if(n||(o=!0,"slot"===f.p&&(f.t|=f.u?2:1)),null!==f.o)i=f.h=c.createTextNode(f.o);else if(1&f.t)i=f.h=c.createTextNode("");else if(i=f.h=c.createElement(2&f.t?"slot-fb":f.p),j(null,f,!1),f.u)for(d=0;d<f.u.length;++d)a=v(l,f,d),a&&i.appendChild(a);return i["s-hn"]=e,3&f.t&&(i["s-sr"]=!0,i["s-cr"]=t,i["s-sn"]=f.$||"",u=l&&l.u&&l.u[r],u&&u.p===f.p&&l.h&&M(l.h,!1)),i},M=(t,n)=>{a.t|=1;const l=t.childNodes;for(let s=l.length-1;s>=0;s--){const t=l[s];t["s-hn"]!==e&&t["s-ol"]&&(U(t).insertBefore(t,O(t)),t["s-ol"].remove(),t["s-ol"]=void 0,o=!0),n&&M(t,n)}a.t&=-2},k=(t,e,n,l,o,s)=>{let r,i=t["s-cr"]&&t["s-cr"].parentNode||t;for(;o<=s;++o)l[o]&&(r=v(null,n,o),r&&(l[o].h=r,i.insertBefore(r,O(e))))},R=(t,e,n,o,s)=>{for(;e<=n;++e)(o=t[e])&&(l=!0,(s=o.h)["s-ol"]?s["s-ol"].remove():M(s,!0),s.remove())},S=(t,e)=>t.p===e.p&&("slot"!==t.p||t.$===e.$),O=t=>t&&t["s-ol"]||t,U=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,L=(t,e)=>{const n=e.h=t.h,l=t.u,o=e.u,s=e.o;let r;null===s?("slot"===e.p||j(t,e,!1),null!==l&&null!==o?((t,e,n,l)=>{let o,s=0,r=0,i=e.length-1,c=e[0],a=e[i],u=l.length-1,f=l[0],d=l[u];for(;s<=i&&r<=u;)null==c?c=e[++s]:null==a?a=e[--i]:null==f?f=l[++r]:null==d?d=l[--u]:S(c,f)?(L(c,f),c=e[++s],f=l[++r]):S(a,d)?(L(a,d),a=e[--i],d=l[--u]):S(c,d)?("slot"!==c.p&&"slot"!==d.p||M(c.h.parentNode,!1),L(c,d),t.insertBefore(c.h,a.h.nextSibling),c=e[++s],d=l[--u]):S(a,f)?("slot"!==c.p&&"slot"!==d.p||M(a.h.parentNode,!1),L(a,f),t.insertBefore(a.h,c.h),a=e[--i],f=l[++r]):(o=v(e&&e[r],n,r),f=l[++r],o&&U(c.h).insertBefore(o,O(c.h)));s>i?k(t,null==l[u+1]?null:l[u+1].h,n,l,r,u):r>u&&R(e,s,i)})(n,l,e,o):null!==o?(null!==t.o&&(n.textContent=""),k(n,null,e,o,0,o.length-1)):null!==l&&R(l,0,l.length-1)):(r=n["s-cr"])?r.parentNode.textContent=s:t.o!==s&&(n.data=s)},P=t=>{let e,n,l,o,s,r,i=t.childNodes;for(n=0,l=i.length;n<l;n++)if(e=i[n],1===e.nodeType){if(e["s-sr"])for(s=e["s-sn"],e.hidden=!1,o=0;o<l;o++)if(i[o]["s-hn"]!==e["s-hn"])if(r=i[o].nodeType,""!==s){if(1===r&&s===i[o].getAttribute("slot")){e.hidden=!0;break}}else if(1===r||3===r&&""!==i[o].textContent.trim()){e.hidden=!0;break}P(e)}},C=[],T=t=>{let e,n,o,s,r,i,c=0,a=t.childNodes,u=a.length;for(;c<u;c++){if(e=a[c],e["s-sr"]&&(n=e["s-cr"]))for(o=n.parentNode.childNodes,s=e["s-sn"],i=o.length-1;i>=0;i--)n=o[i],n["s-cn"]||n["s-nr"]||n["s-hn"]===e["s-hn"]||(x(n,s)?(r=C.find(t=>t.g===n),l=!0,n["s-sn"]=n["s-sn"]||s,r?r._=e:C.push({_:e,g:n}),n["s-sr"]&&C.map(t=>{x(t.g,n["s-sn"])&&(r=C.find(t=>t.g===n),r&&!t._&&(t._=r._))})):C.some(t=>t.g===n)||C.push({g:n}));1===e.nodeType&&T(e)}},x=(t,e)=>1===t.nodeType?null===t.getAttribute("slot")&&""===e||t.getAttribute("slot")===e:t["s-sn"]===e||""===e,A=(t,e)=>{e&&!t.j&&e["s-p"].push(new Promise(e=>t.j=e))},E=(t,e)=>{if(t.t|=16,4&t.t)return void(t.t|=512);const n=t.v,l=()=>F(t,n,e);return A(t,t.M),B(void 0,()=>rt(l))},F=(s,r,i)=>{const u=s.k,f=u["s-rc"];i&&(t=>{const e=t.R;((t,e)=>{let n=$(e.S),l=Z.get(n);if(t=11===t.nodeType?t:c,l)if("string"==typeof l){let e,o=d.get(t=t.head||t);o||d.set(t,o=new Set),o.has(n)||(e=c.createElement("style"),e.innerHTML=l,t.insertBefore(e,t.querySelector("link")),o&&o.add(n))}else t.adoptedStyleSheets.includes(l)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,l])})(t.k.getRootNode(),e)})(s),((s,r)=>{const i=s.k,u=s.R,f=s.O||h(null,null),d=(t=>t&&t.p===y)(r)?r:w(null,null,r);if(e=i.tagName,d.p=null,d.t|=4,s.O=d,d.h=f.h=i,t=i["s-cr"],n=0!=(1&u.t),l=!1,L(f,d),a.t|=1,o){let t,e,n,l,o,s;T(d.h);let r=0;for(;r<C.length;r++)t=C[r],e=t.g,e["s-ol"]||(n=c.createTextNode(""),n["s-nr"]=e,e.parentNode.insertBefore(e["s-ol"]=n,e));for(r=0;r<C.length;r++)if(t=C[r],e=t.g,t._){for(l=t._.parentNode,o=t._.nextSibling,n=e["s-ol"];n=n.previousSibling;)if(s=n["s-nr"],s&&s["s-sn"]===e["s-sn"]&&l===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&l!==e.parentNode||e.nextSibling!==o)&&e!==o&&(!e["s-hn"]&&e["s-ol"]&&(e["s-hn"]=e["s-ol"].parentNode.nodeName),l.insertBefore(e,o))}else 1===e.nodeType&&(e.hidden=!0)}l&&P(d.h),a.t&=-2,C.length=0})(s,N(r)),s.t&=-17,s.t|=2,f&&(f.map(t=>t()),u["s-rc"]=void 0);{const t=u["s-p"],e=()=>W(s);0===t.length?e():(Promise.all(t).then(e),s.t|=4,t.length=0)}},N=t=>{try{t=t.render()}catch(e){Q(e)}return t},W=t=>{const e=t.k,n=t.M;64&t.t||(t.t|=64,H(e),t.U(e),n||q()),t.L(e),t.j&&(t.j(),t.j=void 0),512&t.t&&st(()=>E(t,!1)),t.t&=-517},q=()=>{H(c.documentElement),st(()=>(t=>{const e=new CustomEvent("appload",{detail:{namespace:"dialog"}});return t.dispatchEvent(e),e})(r))},B=(t,e)=>t&&t.then?t.then(e):e(),H=t=>t.classList.add("hydrated"),V=(t,e,n)=>{if(e.P){const l=Object.entries(e.P),o=t.prototype;if(l.map(([t,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(o,t,{get(){return((t,e)=>G(this).C.get(e))(0,t)},set(n){((t,e,n,l)=>{const o=G(this),s=o.C.get(e),r=o.t,i=o.v;n=((t,e)=>null==t||m(t)?t:1&e?t+"":t)(n,l.P[e][0]),8&r&&void 0!==s||n===s||(o.C.set(e,n),i&&2==(18&r)&&E(o,!1))})(0,t,n,e)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,t,{value(...e){const n=G(this);return n.T.then(()=>n.v[t](...e))}})}),1&n){const e=new Map;o.attributeChangedCallback=function(t,n,l){a.jmp(()=>{const n=e.get(t);this[n]=(null!==l||"boolean"!=typeof this[n])&&l})},t.observedAttributes=l.filter(([t,e])=>15&e[0]).map(([t,n])=>{const l=n[1]||t;return e.set(l,t),l})}}return t},z=(t,e={})=>{const n=[],l=e.exclude||[],o=r.customElements,s=c.head,i=s.querySelector("meta[charset]"),u=c.createElement("style"),d=[];let p,m=!0;Object.assign(a,e),a.l=new URL(e.resourcesUrl||"./",c.baseURI).href,t.map(t=>t[1].map(e=>{const s={t:e[0],S:e[1],P:e[2],A:e[3]};s.P=e[2];const r=s.S,i=class extends HTMLElement{constructor(t){super(t),J(t=this,s)}connectedCallback(){p&&(clearTimeout(p),p=null),m?d.push(this):a.jmp(()=>(t=>{if(0==(1&a.t)){const e=G(t),n=e.R,l=()=>{};if(!(1&e.t)){e.t|=1,12&n.t&&(t=>{const e=t["s-cr"]=c.createComment("");e["s-cn"]=!0,t.insertBefore(e,t.firstChild)})(t);{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){A(e,e.M=n);break}}n.P&&Object.entries(n.P).map(([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}}),(async(t,e,n,l,o)=>{if(0==(32&e.t)){e.t|=32;{if((o=Y(n)).then){const t=()=>{};o=await o,t()}o.isProxied||(V(o,n,2),o.isProxied=!0);const t=()=>{};e.t|=8;try{new o(e)}catch(i){Q(i)}e.t&=-9,t()}const t=$(n.S);if(!Z.has(t)&&o.style){const e=()=>{};((t,e,n)=>{let l=Z.get(t);f&&n?(l=l||new CSSStyleSheet,l.replace(e)):l=e,Z.set(t,l)})(t,o.style,!!(1&n.t)),e()}}const s=e.M,r=()=>E(e,!0);s&&s["s-rc"]?s["s-rc"].push(r):r()})(0,e,n)}l()}})(this))}disconnectedCallback(){a.jmp(()=>{})}forceUpdate(){(()=>{{const t=G(this);t.k.isConnected&&2==(18&t.t)&&E(t,!1)}})()}componentOnReady(){return G(this).F}};s.N=t[0],l.includes(r)||o.get(r)||(n.push(r),o.define(r,V(i,s,1)))})),u.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",u.setAttribute("data-styles",""),s.insertBefore(u,i?i.nextSibling:s.firstChild),m=!1,d.length?d.map(t=>t.connectedCallback()):a.jmp(()=>p=setTimeout(q,30))},D=new WeakMap,G=t=>D.get(t),I=(t,e)=>D.set(e.v=t,e),J=(t,e)=>{const n={t:0,k:t,R:e,C:new Map};return n.T=new Promise(t=>n.L=t),n.F=new Promise(t=>n.U=t),t["s-p"]=[],t["s-rc"]=[],D.set(t,n)},K=(t,e)=>e in t,Q=t=>console.error(t),X=new Map,Y=t=>{const e=t.S.replace(/-/g,"_"),n=t.N,l=X.get(n);return l?l[e]:__sc_import_dialog(`./${n}.entry.js`).then(t=>(X.set(n,t),t[e]),Q)},Z=new Map,tt=[],et=[],nt=(t,e)=>n=>{t.push(n),s||(s=!0,e&&4&a.t?st(ot):a.raf(ot))},lt=t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(e){Q(e)}t.length=0},ot=()=>{lt(tt),lt(et),(s=tt.length>0)&&a.raf(ot)},st=t=>u().then(t),rt=nt(et,!0),it=()=>i&&i.supports&&i.supports("color","var(--c)")?u():__sc_import_dialog("./p-69b85284.js").then(()=>(a.W=r.__cssshim)?(!1).i():0),ct=()=>{a.W=r.__cssshim;const t=Array.from(c.querySelectorAll("script")).find(t=>/\/dialog(\.esm)?\.js($|\?|#)/.test(t.src)||"dialog"===t.getAttribute("data-stencil-namespace")),e=t["data-opts"]||{};return"onbeforeload"in t&&!history.scrollRestoration?{then(){}}:(e.resourcesUrl=new URL(".",new URL(t.getAttribute("data-resources-url")||t.src,r.location.href)).href,at(e.resourcesUrl,t),r.customElements?u(e):__sc_import_dialog("./p-2347dcb6.js").then(()=>e))},at=(t,e)=>{try{r.__sc_import_dialog=Function("w",`return import(w);//${Math.random()}`)}catch(n){const l=new Map;r.__sc_import_dialog=n=>{const o=new URL(n,t).href;let s=l.get(o);if(!s){const t=c.createElement("script");t.type="module",t.crossOrigin=e.crossOrigin,t.src=URL.createObjectURL(new Blob([`import * as m from '${o}'; window.__sc_import_dialog.m = m;`],{type:"application/javascript"})),s=new Promise(e=>{t.onload=()=>{e(r.__sc_import_dialog.m),t.remove()}}),l.set(o,s),c.head.appendChild(t)}return s}}};export{it as a,z as b,w as h,ct as p,I as r}