UNPKG

@paraboly/pwc-sliding-panel

Version:

A panel that slides open from the sides of the page when you click a handle.

1 lines 10.2 kB
let t,e,n=0,l=!1,o=!1,s=!1,r=!1;const c="undefined"!=typeof window?window:{},i=c.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)},f=(()=>{try{return new CSSStyleSheet,!0}catch(t){}return!1})(),u=new WeakMap,p=t=>u.get(t),d=(t,e)=>u.set(e.o=t,e),m=t=>console.error(t),$=new Map,w=new Map,h=[],y=[],b=[],_=(t,e)=>n=>{t.push(n),l||(l=!0,e&&4&a.t?j(v):a.raf(v))},g=(t,e)=>{let n=0,l=0;for(;n<t.length&&(l=performance.now())<e;)try{t[n++](l)}catch(o){m(o)}n===t.length?t.length=0:0!==n&&t.splice(0,n)},v=()=>{n++,(t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(e){m(e)}t.length=0})(h);const t=2==(6&a.t)?performance.now()+10*Math.ceil(n*(1/22)):1/0;g(y,t),g(b,t),y.length>0&&(b.push(...y),y.length=0),(l=h.length+y.length+b.length>0)?a.raf(v):n=0},j=t=>Promise.resolve().then(t),S=_(y,!0),M=t=>"object"==(t=typeof t)||"function"===t,k=()=>c.CSS&&c.CSS.supports&&c.CSS.supports("color","var(--c)")?Promise.resolve():__sc_import_pwc_sliding_panel("./p-73bc5e11.js").then(()=>{a.s=c.__stencil_cssshim}),R=()=>{a.s=c.__stencil_cssshim;const t=Array.from(i.querySelectorAll("script")).find(t=>new RegExp("/pwc-sliding-panel(\\.esm)?\\.js($|\\?|#)").test(t.src)||"pwc-sliding-panel"===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,c.location.href)).href,P(e.resourcesUrl,t),window.customElements?Promise.resolve(e):__sc_import_pwc_sliding_panel("./p-3b66a627.js").then(()=>e))},P=(t,e)=>{const n=`__sc_import_${"pwc-sliding-panel".replace(/\s|-/g,"_")}`;try{c[n]=new Function("w",`return import(w);//${Math.random()}`)}catch(l){const o=new Map;c[n]=l=>{const s=new URL(l,t).href;let r=o.get(s);if(!r){const t=i.createElement("script");t.type="module",t.crossOrigin=e.crossOrigin,t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${n}.m = m;`],{type:"application/javascript"})),r=new Promise(e=>{t.onload=()=>{e(c[n].m),t.remove()}}),o.set(s,r),i.head.appendChild(t)}return r}}},U=new WeakMap,L=t=>"sc-"+t,C=(t,e,...n)=>{let l=null,o=null,s=!1,r=!1,c=[];const i=e=>{for(let n=0;n<e.length;n++)l=e[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof t&&!M(l))&&(l=String(l)),s&&r?c[c.length-1].i+=l:c.push(s?O(null,l):l),r=s)};i(n),e&&e.name&&(o=e.name);const a=O(t,null);return a.u=e,c.length>0&&(a.p=c),a.$=o,a},O=(t,e)=>({t:0,h:t,i:e,_:null,p:null,$:null}),x={},E=(n,l,s)=>{let c,a,f,u=l.p[s],p=0;if(o||(r=!0,"slot"===u.h&&(u.t|=u.p?2:1)),1&u.t)c=u._=i.createTextNode("");else if(c=u._=i.createElement(2&u.t?"slot-fb":u.h),u.p)for(p=0;p<u.p.length;++p)a=E(n,u,p),a&&c.appendChild(a);return c["s-hn"]=e,3&u.t&&(c["s-sr"]=!0,c["s-cr"]=t,c["s-sn"]=u.$||"",f=n&&n.p&&n.p[s],f&&f.h===u.h&&n._&&T(n._,!1)),c},T=(t,n)=>{a.t|=1;const l=t.childNodes;for(let o=l.length-1;o>=0;o--){const t=l[o];t["s-hn"]!==e&&t["s-ol"]&&(q(t).insertBefore(t,W(t)),t["s-ol"].remove(),t["s-ol"]=void 0,r=!0),n&&T(t,n)}a.t&=-2},A=(t,e,n,l,o,s)=>{let r,c=t["s-cr"]&&t["s-cr"].parentNode||t;for(;o<=s;++o)l[o]&&(r=E(null,n,o),r&&(l[o]._=r,c.insertBefore(r,W(e))))},F=(t,e,n,l,o)=>{for(;e<=n;++e)(l=t[e])&&(s=!0,(o=l._)["s-ol"]?o["s-ol"].remove():T(o,!0),o.remove())},N=(t,e)=>t.h===e.h&&("slot"!==t.h||t.$===e.$),W=t=>t&&t["s-ol"]||t,q=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,B=(t,e)=>{const n=e._=t._,l=t.p,o=e.p;null!==l&&null!==o?((t,e,n,l)=>{let o,s=0,r=0,c=e.length-1,i=e[0],a=e[c],f=l.length-1,u=l[0],p=l[f];for(;s<=c&&r<=f;)null==i?i=e[++s]:null==a?a=e[--c]:null==u?u=l[++r]:null==p?p=l[--f]:N(i,u)?(B(i,u),i=e[++s],u=l[++r]):N(a,p)?(B(a,p),a=e[--c],p=l[--f]):N(i,p)?("slot"!==i.h&&"slot"!==p.h||T(i._.parentNode,!1),B(i,p),t.insertBefore(i._,a._.nextSibling),i=e[++s],p=l[--f]):N(a,u)?("slot"!==i.h&&"slot"!==p.h||T(a._.parentNode,!1),B(a,u),t.insertBefore(a._,i._),a=e[--c],u=l[++r]):(o=E(e&&e[r],n,r),u=l[++r],o&&q(i._).insertBefore(o,W(i._)));s>c?A(t,null==l[f+1]?null:l[f+1]._,n,l,r,f):r>f&&F(e,s,c)})(n,l,e,o):null!==o?A(n,null,e,o,0,o.length-1):null!==l&&F(l,0,l.length-1)},H=t=>{let e,n,l,o,s,r,c=t.childNodes;for(n=0,l=c.length;n<l;n++)if(e=c[n],1===e.nodeType){if(e["s-sr"])for(s=e["s-sn"],e.hidden=!1,o=0;o<l;o++)if(c[o]["s-hn"]!==e["s-hn"])if(r=c[o].nodeType,""!==s){if(1===r&&s===c[o].getAttribute("slot")){e.hidden=!0;break}}else if(1===r||3===r&&""!==c[o].textContent.trim()){e.hidden=!0;break}H(e)}},V=[],z=t=>{let e,n,l,o,r=t.childNodes,c=r.length,i=0,a=0,f=0;for(c=r.length;i<c;i++){if(e=r[i],e["s-sr"]&&(n=e["s-cr"]))for(l=n.parentNode.childNodes,o=e["s-sn"],a=l.length-1;a>=0;a--)n=l[a],n["s-cn"]||n["s-nr"]||n["s-hn"]===e["s-hn"]||(f=n.nodeType,((3===f||8===f)&&""===o||1===f&&null===n.getAttribute("slot")&&""===o||1===f&&n.getAttribute("slot")===o)&&(V.some(t=>t.g===n)||(s=!0,n["s-sn"]=o,V.push({v:e,g:n}))));1===e.nodeType&&z(e)}},D=(t,e)=>{e&&!t.j&&e["s-p"].push(new Promise(e=>t.j=e))},G=(t,e,n,l)=>{if(e.t|=16,4&e.t)return void(e.t|=512);const o=e.o,s=()=>I(t,e,n,o,l);return D(e,e.S),l&&(e.t|=256,e.M&&(e.M.forEach(([t,e])=>X(o,t,e)),e.M=null)),Y(void 0,()=>S(s))},I=(n,l,c,f,u)=>{const p=n["s-rc"];u&&((t,e)=>{((t,e)=>{let n=L(e.k),l=w.get(n);if(t=11===t.nodeType?t:i,l)if("string"==typeof l){let e,o=U.get(t=t.head||t);o||U.set(t,o=new Set),o.has(n)||(e=i.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.getRootNode(),e)})(n,c),((n,l,c,f)=>{e=n.tagName;const u=l.R||O(null,null),p=(d=f)&&d.h===x?f:C(null,null,f);var d;if(c.P&&(p.u=p.u||{},c.P.forEach(([t,e])=>p.u[e]=n[t])),p.h=null,p.t|=4,l.R=p,p._=u._=n,t=n["s-cr"],o=!1,s=!1,B(u,p),r){z(p._);for(let t=0;t<V.length;t++){const e=V[t];if(!e.g["s-ol"]){const t=i.createTextNode("");t["s-nr"]=e.g,e.g.parentNode.insertBefore(e.g["s-ol"]=t,e.g)}}a.t|=1;for(let t=0;t<V.length;t++){const e=V[t],n=e.v.parentNode;let l=e.v.nextSibling,o=e.g["s-ol"];for(;o=o.previousSibling;){let t=o["s-nr"];if(t&&t["s-sn"]===e.g["s-sn"]&&n===t.parentNode&&(t=t.nextSibling,!t||!t["s-nr"])){l=t;break}}(!l&&n!==e.g.parentNode||e.g.nextSibling!==l)&&e.g!==l&&n.insertBefore(e.g,l)}a.t&=-2}s&&H(p._),V.length=0})(n,l,c,J(f)),l.t&=-17,l.t|=2,p&&(p.forEach(t=>t()),n["s-rc"]=void 0);{const t=n["s-p"],e=()=>K(n,l,c);0===t.length?e():(Promise.all(t).then(e),l.t|=4,t.length=0)}},J=t=>{try{t=t.render()}catch(e){m(e)}return t},K=(t,e,n)=>{const l=e.S;64&e.t||(e.t|=64,t.classList.add("hydrated"),e.U(t),l||Q()),e.j&&(e.j(),e.j=void 0),512&e.t&&j(()=>G(t,e,n,!1)),e.t&=-517},Q=()=>{i.documentElement.classList.add("hydrated"),a.t|=2},X=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(l){m(l)}},Y=(t,e)=>t&&t.then?t.then(e):e(),Z=(t,e,n)=>{if(e.L){t.watchers&&(e.C=t.watchers);const l=Object.entries(e.L),o=t.prototype;if(l.forEach(([t,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(o,t,{get(){return e=t,p(this).O.get(e);var e},set(n){((t,e,n,l)=>{const o=p(this),s=o.T,r=o.O.get(e),c=o.t,i=o.o;var a,f;if(f=l.L[e][0],!((n=null==(a=n)||M(a)?a:4&f?"false"!==a&&(""===a||!!a):1&f?String(a):a)===r||8&c&&void 0!==r)&&(o.O.set(e,n),i)){if(l.C&&128&c){const t=l.C[e];t&&t.forEach(t=>{try{i[t](n,r,e)}catch(l){m(l)}})}2==(18&c)&&G(s,o,l,!1)}})(0,t,n,e)},configurable:!0,enumerable:!0})}),1&n){const n=new Map;o.attributeChangedCallback=function(t,e,l){a.jmp(()=>{const e=n.get(t);this[e]=(null!==l||"boolean"!=typeof this[e])&&l})},t.observedAttributes=l.filter(([t,e])=>15&e[0]).map(([t,l])=>{const o=l[1]||t;return n.set(o,t),512&l[0]&&e.P.push([t,o]),o})}}return t},tt=t=>{const e=t["s-cr"]=i.createComment("");e["s-cn"]=!0,t.insertBefore(e,t.firstChild)},et=(t,e={})=>{const n=[],l=e.exclude||[],o=i.head,s=c.customElements,r=o.querySelector("meta[charset]"),d=i.createElement("style"),h=[];let y,b=!0;Object.assign(a,e),a.l=new URL(e.resourcesUrl||"./",i.baseURI).href,e.syncQueue&&(a.t|=4),t.forEach(t=>t[1].forEach(e=>{const o={t:e[0],k:e[1],L:e[2],A:e[3]};o.L=e[2],o.A=e[3],o.P=[],o.C={};const r=o.k,c=class extends HTMLElement{constructor(t){super(t),(t=>{const e={t:0,T:t,O:new Map};e.F=new Promise(t=>e.U=t),t["s-p"]=[],t["s-rc"]=[],u.set(t,e)})(t=this)}connectedCallback(){y&&(clearTimeout(y),y=null),b?h.push(this):a.jmp(()=>((t,e)=>{if(0==(1&a.t)){const n=()=>{},l=p(t);if(e.A&&(l.N=((t,e,n)=>{e.M=e.M||[];const l=n.map(([n,l,o])=>{const s=t,r=((t,e)=>n=>{256&t.t?t.o[e](n):t.M.push([e,n])})(e,o),c=(t=>0!=(2&t))(n);return a.ael(s,l,r,c),()=>a.rel(s,l,r,c)});return()=>l.forEach(t=>t())})(t,l,e.A)),!(1&l.t)){l.t|=1,4&e.t&&tt(t);{let e=t;for(;e=e.parentNode||e.host;)if(e["s-p"]){D(l,l.S=e);break}}e.L&&Object.entries(e.L).forEach(([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}}),j(()=>(async(t,e,n,l,o)=>{if(0==(32&e.t)){e.t|=32;{if((o=(t=>{const e=t.k.replace(/-/g,"_"),n=t.W,l=$.get(n);return l?l[e]:__sc_import_pwc_sliding_panel(`./${n}.entry.js`).then(t=>($.set(n,t),t[e]),m)})(n)).then){const t=()=>{};o=await o,t()}o.isProxied||(n.C=o.watchers,Z(o,n,2),o.isProxied=!0);const t=()=>{};e.t|=8;try{new o(e)}catch(c){m(c)}e.t&=-9,e.t|=128,t()}const t=L(n.k);if(!w.has(t)&&o.style){const e=()=>{};((t,e,n)=>{let l=w.get(t);f&&n?(l=l||new CSSStyleSheet,l.replace(e)):l=e,w.set(t,l)})(t,o.style,!!(1&n.t)),e()}}const s=e.S,r=()=>G(t,e,n,!0);s&&s["s-rc"]?s["s-rc"].push(r):r()})(t,l,e))}n()}})(this,o))}disconnectedCallback(){a.jmp(()=>(()=>{if(0==(1&a.t)){const t=p(this);t.N&&(t.N(),t.N=void 0)}})())}forceUpdate(){((t,e)=>{{const n=p(t);n.T.isConnected&&2==(18&n.t)&&G(t,n,e,!1)}})(this,o)}componentOnReady(){return p(this).F}};o.W=t[0],l.includes(r)||s.get(r)||(n.push(r),s.define(r,Z(c,o,1)))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),o.insertBefore(d,r?r.nextSibling:o.firstChild),b=!1,h.length>0?h.forEach(t=>t.connectedCallback()):a.jmp(()=>y=setTimeout(Q,30,"timeout"))},nt=(t,e,n)=>{const l=lt(t);return{emit:t=>{const o=new CustomEvent(e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:t});return l.dispatchEvent(o),o}}},lt=t=>p(t).T;export{k as a,et as b,nt as c,lt as g,C as h,R as p,d as r};