@paperless/core 0.1.0-alpha.2 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/{paperless/p-bbd1d3df.entry.js → build/p-4144f8a0.entry.js} +1 -1
- package/dist/build/p-8538576c.entry.js +1 -0
- package/dist/build/{p-feec8ec1.entry.js → p-f04c4de0.entry.js} +1 -1
- package/dist/build/p-f33e1285.js +2 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/{index-5b30cb95.js → index-a2da05ae.js} +406 -7
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{p-icon.cjs.entry.js → p-button_3.cjs.entry.js} +108 -1
- package/dist/cjs/p-illustration.cjs.entry.js +1 -1
- package/dist/cjs/p-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/paperless.cjs.js +2 -2
- package/dist/collection/components/atoms/button/button.component.css +44 -3
- package/dist/collection/components/atoms/button/button.component.js +241 -7
- package/dist/{esm/p-icon.entry.js → components/icon.component.js} +26 -7
- package/dist/{esm/p-loader.entry.js → components/loader.component.js} +29 -8
- package/dist/components/p-button.js +67 -8
- package/dist/components/p-icon.js +1 -815
- package/dist/components/p-loader.js +1 -72
- package/dist/esm/{index-111a6307.js → index-d08bfe75.js} +406 -8
- package/dist/esm/loader.js +2 -2
- package/dist/esm/p-button_3.entry.js +903 -0
- package/dist/esm/p-illustration.entry.js +1 -1
- package/dist/esm/p-tooltip.entry.js +1 -1
- package/dist/esm/paperless.js +2 -2
- package/dist/index.html +1 -1
- package/dist/{build/p-bbd1d3df.entry.js → paperless/p-4144f8a0.entry.js} +1 -1
- package/dist/paperless/p-8538576c.entry.js +1 -0
- package/dist/paperless/{p-feec8ec1.entry.js → p-f04c4de0.entry.js} +1 -1
- package/dist/paperless/p-f33e1285.js +2 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +33 -55
- package/dist/types/components/atoms/button/button.component.d.ts +45 -1
- package/dist/types/components.d.ts +83 -2
- package/package.json +1 -1
- package/dist/build/p-1d13a9d2.entry.js +0 -1
- package/dist/build/p-208c1f28.entry.js +0 -1
- package/dist/build/p-98d07776.js +0 -2
- package/dist/build/p-cd525dcc.entry.js +0 -1
- package/dist/cjs/p-button.cjs.entry.js +0 -23
- package/dist/cjs/p-loader.cjs.entry.js +0 -57
- package/dist/esm/p-button.entry.js +0 -19
- package/dist/paperless/p-1d13a9d2.entry.js +0 -1
- package/dist/paperless/p-208c1f28.entry.js +0 -1
- package/dist/paperless/p-98d07776.js +0 -2
- package/dist/paperless/p-cd525dcc.entry.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e,t,n,l=!1,o=!1,s=!1,r=!1;const c="undefined"!=typeof window?window:{},i=c.document||{head:{}},f={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),ce:(e,t)=>new CustomEvent(e,t)},u=e=>Promise.resolve(e),a=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),$=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=e,r=d(t,o),c=h(n);f.ael(s,l,r,c),(t.o=t.o||[]).push((()=>f.rel(s,l,r,c)))}))},d=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){ie(e)}},h=e=>0!=(2&e),p=new WeakMap,y=e=>"sc-"+e.$,m={},b=e=>"object"==(e=typeof e)||"function"===e,w=(e,t,...n)=>{let l=null,o=null,s=!1,r=!1;const c=[],i=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!b(l))&&(l+=""),s&&r?c[c.length-1].h+=l:c.push(s?v(null,l):l),r=s)};if(i(n),t){t.name&&(o=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,g);const f=v(e,null);return f.p=t,c.length>0&&(f.m=c),f.v=o,f},v=(e,t)=>({t:0,S:e,h:t,g:null,m:null,p:null,v:null}),S={},g={forEach:(e,t)=>e.map(j).forEach(t),map:(e,t)=>e.map(j).map(t).map(k)},j=e=>({vattrs:e.p,vchildren:e.m,vkey:e.j,vname:e.v,vtag:e.S,vtext:e.h}),k=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),w(e.vtag,t,...e.vchildren||[])}const t=v(e.vtag,e.vtext);return t.p=e.vattrs,t.m=e.vchildren,t.j=e.vkey,t.v=e.vname,t},M=(e,t,n,l,o,s)=>{if(n!==l){let r=ce(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,o=C(n),s=C(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("ref"===t)l&&l(e);else{const c=b(l);if((r||c&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&s||o)&&!c&&e.setAttribute(t,l=!0===l?"":l)}}},O=/\s/,C=e=>e?e.split(O):[],R=(e,t,n,l)=>{const o=11===t.g.nodeType&&t.g.host?t.g.host:t.g,s=e&&e.p||m,r=t.p||m;for(l in s)l in r||M(o,l,s[l],void 0,n,t.t);for(l in r)M(o,l,s[l],r[l],n,t.t)},T=(o,r,c,f)=>{const u=r.m[c];let a,$,d,h=0;if(l||(s=!0,"slot"===u.S&&(e&&f.classList.add(e+"-s"),u.t|=u.m?2:1)),null!==u.h)a=u.g=i.createTextNode(u.h);else if(1&u.t)a=u.g=i.createTextNode("");else if(a=u.g=i.createElement(2&u.t?"slot-fb":u.S),R(null,u,!1),null!=e&&a["s-si"]!==e&&a.classList.add(a["s-si"]=e),u.m)for(h=0;h<u.m.length;++h)$=T(o,u,h,a),$&&a.appendChild($);return a["s-hn"]=n,3&u.t&&(a["s-sr"]=!0,a["s-cr"]=t,a["s-sn"]=u.v||"",d=o&&o.m&&o.m[c],d&&d.S===u.S&&o.g&&x(o.g,!1)),a},x=(e,t)=>{f.t|=1;const l=e.childNodes;for(let e=l.length-1;e>=0;e--){const o=l[e];o["s-hn"]!==n&&o["s-ol"]&&(A(o).insertBefore(o,W(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),t&&x(o,t)}f.t&=-2},E=(e,t,l,o,s,r)=>{let c,i=e["s-cr"]&&e["s-cr"].parentNode||e;for(i.shadowRoot&&i.tagName===n&&(i=i.shadowRoot);s<=r;++s)o[s]&&(c=T(null,l,s,e),c&&(o[s].g=c,i.insertBefore(c,W(t))))},N=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.g,V(l),o=!0,s["s-ol"]?s["s-ol"].remove():x(s,!0),s.remove())},P=(e,t)=>e.S===t.S&&("slot"!==e.S||e.v===t.v),W=e=>e&&e["s-ol"]||e,A=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,F=(e,t)=>{const n=t.g=e.g,l=e.m,o=t.m,s=t.h;let r;null===s?("slot"===t.S||R(e,t,!1),null!==l&&null!==o?((e,t,n,l)=>{let o,s=0,r=0,c=t.length-1,i=t[0],f=t[c],u=l.length-1,a=l[0],$=l[u];for(;s<=c&&r<=u;)null==i?i=t[++s]:null==f?f=t[--c]:null==a?a=l[++r]:null==$?$=l[--u]:P(i,a)?(F(i,a),i=t[++s],a=l[++r]):P(f,$)?(F(f,$),f=t[--c],$=l[--u]):P(i,$)?("slot"!==i.S&&"slot"!==$.S||x(i.g.parentNode,!1),F(i,$),e.insertBefore(i.g,f.g.nextSibling),i=t[++s],$=l[--u]):P(f,a)?("slot"!==i.S&&"slot"!==$.S||x(f.g.parentNode,!1),F(f,a),e.insertBefore(f.g,i.g),f=t[--c],a=l[++r]):(o=T(t&&t[r],n,r,e),a=l[++r],o&&A(i.g).insertBefore(o,W(i.g)));s>c?E(e,null==l[u+1]?null:l[u+1].g,n,l,r,u):r>u&&N(t,s,c)})(n,l,t,o):null!==o?(null!==e.h&&(n.textContent=""),E(n,null,t,o,0,o.length-1)):null!==l&&N(l,0,l.length-1)):(r=n["s-cr"])?r.parentNode.textContent=s:e.h!==s&&(n.data=s)},H=e=>{const t=e.childNodes;let n,l,o,s,r,c;for(l=0,o=t.length;l<o;l++)if(n=t[l],1===n.nodeType){if(n["s-sr"])for(r=n["s-sn"],n.hidden=!1,s=0;s<o;s++)if(c=t[s].nodeType,t[s]["s-hn"]!==n["s-hn"]||""!==r){if(1===c&&r===t[s].getAttribute("slot")){n.hidden=!0;break}}else if(1===c||3===c&&""!==t[s].textContent.trim()){n.hidden=!0;break}H(n)}},L=[],U=e=>{let t,n,l,s,r,c,i=0;const f=e.childNodes,u=f.length;for(;i<u;i++){if(t=f[i],t["s-sr"]&&(n=t["s-cr"])&&n.parentNode)for(l=n.parentNode.childNodes,s=t["s-sn"],c=l.length-1;c>=0;c--)n=l[c],n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||(q(n,s)?(r=L.find((e=>e.k===n)),o=!0,n["s-sn"]=n["s-sn"]||s,r?r.M=t:L.push({M:t,k:n}),n["s-sr"]&&L.map((e=>{q(e.k,n["s-sn"])&&(r=L.find((e=>e.k===n)),r&&!e.M&&(e.M=r.M))}))):L.some((e=>e.k===n))||L.push({k:n}));1===t.nodeType&&U(t)}},q=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,V=e=>{e.p&&e.p.ref&&e.p.ref(null),e.m&&e.m.map(V)},_=e=>oe(e).O,z=(e,t,n)=>{const l=_(e);return{emit:e=>B(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},B=(e,t,n)=>{const l=f.ce(t,n);return e.dispatchEvent(l),l},D=(e,t)=>{t&&!e.C&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.C=t)))},G=(e,t)=>{if(e.t|=16,!(4&e.t))return D(e,e.R),be((()=>I(e,t)));e.t|=512},I=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>Y(n,e,t))),e.u=null)),l=Z(l,(()=>Y(n,"componentWillRender"))),Z(l,(()=>J(e,n,t)))},J=async(e,t,n)=>{const l=e.O,o=l["s-rc"];n&&(e=>{const t=e.T,n=e.O,l=t.t,o=((e,t)=>{let n=y(t);const l=ae.get(n);if(e=11===e.nodeType?e:i,l)if("string"==typeof l){let t,o=p.get(e=e.head||e);o||p.set(e,o=new Set),o.has(n)||(t=i.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})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);K(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>Q(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},K=(r,c)=>{try{c=c.render(),r.t&=-17,r.t|=2,((r,c)=>{const u=r.O,a=r.T,$=r.N||v(null,null),d=(e=>e&&e.S===S)(c)?c:w(null,null,c);if(n=u.tagName,d.S=null,d.t|=4,r.N=d,d.g=$.g=u.shadowRoot||u,e=u["s-sc"],t=u["s-cr"],l=0!=(1&a.t),o=!1,F($,d),f.t|=1,s){let e,t,n,l,o,s;U(d.g);let r=0;for(;r<L.length;r++)e=L[r],t=e.k,t["s-ol"]||(n=i.createTextNode(""),n["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=n,t));for(r=0;r<L.length;r++)if(e=L[r],t=e.k,e.M){for(l=e.M.parentNode,o=e.M.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&&H(d.g),f.t&=-2,L.length=0})(r,c)}catch(e){ie(e,r.O)}return null},Q=e=>{const t=e.O,n=e.R;64&e.t||(e.t|=64,ee(t),e.P(t),n||X()),e.C&&(e.C(),e.C=void 0),512&e.t&&me((()=>G(e,!1))),e.t&=-517},X=()=>{ee(i.documentElement),me((()=>B(c,"appload",{detail:{namespace:"paperless"}})))},Y=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){ie(e)}},Z=(e,t)=>e&&e.then?e.then(t):t(),ee=e=>e.classList.add("hydrated"),te=(e,t,n)=>{if(t.W){const l=Object.entries(t.W),o=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(o,e,{get(){return((e,t)=>oe(this).A.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=oe(e),s=o.A.get(t),r=o.t,c=o.i;if(n=((e,t)=>null==e||b(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.W[t][0]),(!(8&r)||void 0===s)&&n!==s&&(!Number.isNaN(s)||!Number.isNaN(n))&&(o.A.set(t,n),c&&2==(18&r))){if(c.componentShouldUpdate&&!1===c.componentShouldUpdate(n,s,t))return;G(o,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;o.attributeChangedCallback=function(e,n,l){f.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(o.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},ne=(e,t={})=>{const n=[],l=t.exclude||[],o=c.customElements,s=i.head,r=s.querySelector("meta[charset]"),u=i.createElement("style"),d=[];let h,p=!0;Object.assign(f,t),f.l=new URL(t.resourcesUrl||"./",i.baseURI).href,e.map((e=>{e[1].map((t=>{const s={t:t[0],$:t[1],W:t[2],F:t[3]};s.W=t[2],s.F=t[3];const r=s.$,c=class extends HTMLElement{constructor(e){super(e),re(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),p?d.push(this):f.jmp((()=>(e=>{if(0==(1&f.t)){const t=oe(e),n=t.T,l=()=>{};if(1&t.t)$(e,t,n.F);else{t.t|=1,12&n.t&&(e=>{const t=e["s-cr"]=i.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){D(t,t.R=n);break}}n.W&&Object.entries(n.W).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=ue(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(te(o,n,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(e){ie(e)}t.t&=-9,e()}if(o.style){let e=o.style;const t=y(n);if(!ae.has(t)){const l=()=>{};((e,t,n)=>{let l=ae.get(e);a&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,ae.set(e,l)})(t,e,!!(1&n.t)),l()}}}const s=t.R,r=()=>G(t,!0);s&&s["s-rc"]?s["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){f.jmp((()=>(()=>{if(0==(1&f.t)){const e=oe(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return oe(this).H}};s.L=e[0],l.includes(r)||o.get(r)||(n.push(r),o.define(r,te(c,s,1)))}))})),u.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",u.setAttribute("data-styles",""),s.insertBefore(u,r?r.nextSibling:s.firstChild),p=!1,d.length?d.map((e=>e.connectedCallback())):f.jmp((()=>h=setTimeout(X,30)))},le=new WeakMap,oe=e=>le.get(e),se=(e,t)=>le.set(t.i=e,t),re=(e,t)=>{const n={t:0,O:e,T:t,A:new Map};return n.H=new Promise((e=>n.P=e)),e["s-p"]=[],e["s-rc"]=[],$(e,n,t.F),le.set(e,n)},ce=(e,t)=>t in e,ie=(e,t)=>(0,console.error)(e,t),fe=new Map,ue=e=>{const t=e.$.replace(/-/g,"_"),n=e.L,l=fe.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(fe.set(n,e),e[t])),ie)
|
|
2
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/},ae=new Map,$e=[],de=[],he=(e,t)=>n=>{e.push(n),r||(r=!0,t&&4&f.t?me(ye):f.raf(ye))},pe=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ie(e)}e.length=0},ye=()=>{pe($e),pe(de),(r=$e.length>0)&&f.raf(ye)},me=e=>u().then(e),be=he(de,!0);export{S as H,ne as b,z as c,_ as g,w as h,u as p,se as r}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as o,b as
|
|
1
|
+
import{p as o,b as i}from"./p-f33e1285.js";(()=>{const i=import.meta.url,t={};return""!==i&&(t.resourcesUrl=new URL(".",i).href),o(t)})().then((o=>i([["p-f04c4de0",[[0,"p-illustration",{variant:[1]}]]],["p-4144f8a0",[[1,"p-tooltip",{content:[8],placement:[1],forceShow:[4,"force-show"]},[[1,"mouseenter","_show"],[0,"focus","_show"],[1,"mouseleave","_hide"],[0,"blur","_hide"]]]]],["p-8538576c",[[4,"p-button",{variant:[1],href:[1],target:[1],size:[1],loading:[4],disabled:[4],icon:[1],iconPosition:[1,"icon-position"],iconFlip:[1,"icon-flip"],iconRotate:[2,"icon-rotate"]},[[2,"click","handleClick"]]],[0,"p-icon",{variant:[1],size:[1],rotate:[2],flip:[1]}],[1,"p-loader",{show:[4],variant:[1],color:[1],modalTitle:[1,"modal-title"],modalDescription:[1,"modal-description"]}]]]],o)));
|
|
@@ -23,7 +23,11 @@ function _interopNamespace(e) {
|
|
|
23
23
|
const NAMESPACE = 'paperless';
|
|
24
24
|
|
|
25
25
|
let scopeId;
|
|
26
|
+
let contentRef;
|
|
26
27
|
let hostTagName;
|
|
28
|
+
let useNativeShadowDom = false;
|
|
29
|
+
let checkSlotFallbackVisibility = false;
|
|
30
|
+
let checkSlotRelocate = false;
|
|
27
31
|
let isSvgMode = false;
|
|
28
32
|
let queuePending = false;
|
|
29
33
|
const win = typeof window !== 'undefined' ? window : {};
|
|
@@ -183,6 +187,7 @@ const isComplexType = (o) => {
|
|
|
183
187
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
184
188
|
const h = (nodeName, vnodeData, ...children) => {
|
|
185
189
|
let child = null;
|
|
190
|
+
let slotName = null;
|
|
186
191
|
let simple = false;
|
|
187
192
|
let lastSimple = false;
|
|
188
193
|
const vNodeChildren = [];
|
|
@@ -210,6 +215,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
210
215
|
};
|
|
211
216
|
walk(children);
|
|
212
217
|
if (vnodeData) {
|
|
218
|
+
if (vnodeData.name) {
|
|
219
|
+
slotName = vnodeData.name;
|
|
220
|
+
}
|
|
213
221
|
{
|
|
214
222
|
const classData = vnodeData.className || vnodeData.class;
|
|
215
223
|
if (classData) {
|
|
@@ -222,11 +230,18 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
222
230
|
}
|
|
223
231
|
}
|
|
224
232
|
}
|
|
233
|
+
if (typeof nodeName === 'function') {
|
|
234
|
+
// nodeName is a functional component
|
|
235
|
+
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
236
|
+
}
|
|
225
237
|
const vnode = newVNode(nodeName, null);
|
|
226
238
|
vnode.$attrs$ = vnodeData;
|
|
227
239
|
if (vNodeChildren.length > 0) {
|
|
228
240
|
vnode.$children$ = vNodeChildren;
|
|
229
241
|
}
|
|
242
|
+
{
|
|
243
|
+
vnode.$name$ = slotName;
|
|
244
|
+
}
|
|
230
245
|
return vnode;
|
|
231
246
|
};
|
|
232
247
|
const newVNode = (tag, text) => {
|
|
@@ -240,10 +255,43 @@ const newVNode = (tag, text) => {
|
|
|
240
255
|
{
|
|
241
256
|
vnode.$attrs$ = null;
|
|
242
257
|
}
|
|
258
|
+
{
|
|
259
|
+
vnode.$name$ = null;
|
|
260
|
+
}
|
|
243
261
|
return vnode;
|
|
244
262
|
};
|
|
245
263
|
const Host = {};
|
|
246
264
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
265
|
+
const vdomFnUtils = {
|
|
266
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
267
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
268
|
+
};
|
|
269
|
+
const convertToPublic = (node) => ({
|
|
270
|
+
vattrs: node.$attrs$,
|
|
271
|
+
vchildren: node.$children$,
|
|
272
|
+
vkey: node.$key$,
|
|
273
|
+
vname: node.$name$,
|
|
274
|
+
vtag: node.$tag$,
|
|
275
|
+
vtext: node.$text$,
|
|
276
|
+
});
|
|
277
|
+
const convertToPrivate = (node) => {
|
|
278
|
+
if (typeof node.vtag === 'function') {
|
|
279
|
+
const vnodeData = Object.assign({}, node.vattrs);
|
|
280
|
+
if (node.vkey) {
|
|
281
|
+
vnodeData.key = node.vkey;
|
|
282
|
+
}
|
|
283
|
+
if (node.vname) {
|
|
284
|
+
vnodeData.name = node.vname;
|
|
285
|
+
}
|
|
286
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
287
|
+
}
|
|
288
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
|
289
|
+
vnode.$attrs$ = node.vattrs;
|
|
290
|
+
vnode.$children$ = node.vchildren;
|
|
291
|
+
vnode.$key$ = node.vkey;
|
|
292
|
+
vnode.$name$ = node.vname;
|
|
293
|
+
return vnode;
|
|
294
|
+
};
|
|
247
295
|
/**
|
|
248
296
|
* Production setAccessor() function based on Preact by
|
|
249
297
|
* Jason Miller (@developit)
|
|
@@ -336,13 +384,36 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
336
384
|
let i = 0;
|
|
337
385
|
let elm;
|
|
338
386
|
let childNode;
|
|
387
|
+
let oldVNode;
|
|
388
|
+
if (!useNativeShadowDom) {
|
|
389
|
+
// remember for later we need to check to relocate nodes
|
|
390
|
+
checkSlotRelocate = true;
|
|
391
|
+
if (newVNode.$tag$ === 'slot') {
|
|
392
|
+
if (scopeId) {
|
|
393
|
+
// scoped css needs to add its scoped id to the parent element
|
|
394
|
+
parentElm.classList.add(scopeId + '-s');
|
|
395
|
+
}
|
|
396
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
397
|
+
? // slot element has fallback content
|
|
398
|
+
2 /* isSlotFallback */
|
|
399
|
+
: // slot element does not have fallback content
|
|
400
|
+
1 /* isSlotReference */;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
339
403
|
if (newVNode.$text$ !== null) {
|
|
340
404
|
// create text node
|
|
341
405
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
342
406
|
}
|
|
407
|
+
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
408
|
+
// create a slot reference node
|
|
409
|
+
elm = newVNode.$elm$ =
|
|
410
|
+
doc.createTextNode('');
|
|
411
|
+
}
|
|
343
412
|
else {
|
|
344
413
|
// create element
|
|
345
|
-
elm = newVNode.$elm$ = (doc.createElement(newVNode.$
|
|
414
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
|
|
415
|
+
? 'slot-fb'
|
|
416
|
+
: newVNode.$tag$));
|
|
346
417
|
// add css classes, attrs, props, listeners, etc.
|
|
347
418
|
{
|
|
348
419
|
updateElement(null, newVNode, isSvgMode);
|
|
@@ -355,7 +426,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
355
426
|
if (newVNode.$children$) {
|
|
356
427
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
357
428
|
// create the node
|
|
358
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
|
429
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
359
430
|
// return node could have been null
|
|
360
431
|
if (childNode) {
|
|
361
432
|
// append our new node
|
|
@@ -364,20 +435,62 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
364
435
|
}
|
|
365
436
|
}
|
|
366
437
|
}
|
|
438
|
+
{
|
|
439
|
+
elm['s-hn'] = hostTagName;
|
|
440
|
+
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
441
|
+
// remember the content reference comment
|
|
442
|
+
elm['s-sr'] = true;
|
|
443
|
+
// remember the content reference comment
|
|
444
|
+
elm['s-cr'] = contentRef;
|
|
445
|
+
// remember the slot name, or empty string for default slot
|
|
446
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
447
|
+
// check if we've got an old vnode for this slot
|
|
448
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
449
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
450
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
451
|
+
// so let's move the old slot content back to it's original location
|
|
452
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
367
456
|
return elm;
|
|
368
457
|
};
|
|
458
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
459
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
460
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
461
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
462
|
+
const childNode = oldSlotChildNodes[i];
|
|
463
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
464
|
+
// // this child node in the old element is from another component
|
|
465
|
+
// // remove this node from the old slot's parent
|
|
466
|
+
// childNode.remove();
|
|
467
|
+
// and relocate it back to it's original location
|
|
468
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
469
|
+
// remove the old original location comment entirely
|
|
470
|
+
// later on the patch function will know what to do
|
|
471
|
+
// and move this to the correct spot in need be
|
|
472
|
+
childNode['s-ol'].remove();
|
|
473
|
+
childNode['s-ol'] = undefined;
|
|
474
|
+
checkSlotRelocate = true;
|
|
475
|
+
}
|
|
476
|
+
if (recursive) {
|
|
477
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
481
|
+
};
|
|
369
482
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
370
|
-
let containerElm = (parentElm);
|
|
483
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
371
484
|
let childNode;
|
|
372
485
|
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
373
486
|
containerElm = containerElm.shadowRoot;
|
|
374
487
|
}
|
|
375
488
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
376
489
|
if (vnodes[startIdx]) {
|
|
377
|
-
childNode = createElm(null, parentVNode, startIdx);
|
|
490
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
378
491
|
if (childNode) {
|
|
379
492
|
vnodes[startIdx].$elm$ = childNode;
|
|
380
|
-
containerElm.insertBefore(childNode, before);
|
|
493
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
381
494
|
}
|
|
382
495
|
}
|
|
383
496
|
}
|
|
@@ -387,6 +500,20 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
387
500
|
if ((vnode = vnodes[startIdx])) {
|
|
388
501
|
elm = vnode.$elm$;
|
|
389
502
|
callNodeRefs(vnode);
|
|
503
|
+
{
|
|
504
|
+
// we're removing this element
|
|
505
|
+
// so it's possible we need to show slot fallback content now
|
|
506
|
+
checkSlotFallbackVisibility = true;
|
|
507
|
+
if (elm['s-ol']) {
|
|
508
|
+
// remove the original location comment
|
|
509
|
+
elm['s-ol'].remove();
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
// it's possible that child nodes of the node
|
|
513
|
+
// that's being removed are slot nodes
|
|
514
|
+
putBackInOriginalLocation(elm, true);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
390
517
|
// remove the vnode's element from the dom
|
|
391
518
|
elm.remove();
|
|
392
519
|
}
|
|
@@ -427,12 +554,20 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
427
554
|
newEndVnode = newCh[--newEndIdx];
|
|
428
555
|
}
|
|
429
556
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
557
|
+
// Vnode moved right
|
|
558
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
559
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
560
|
+
}
|
|
430
561
|
patch(oldStartVnode, newEndVnode);
|
|
431
562
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
432
563
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
433
564
|
newEndVnode = newCh[--newEndIdx];
|
|
434
565
|
}
|
|
435
566
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
567
|
+
// Vnode moved left
|
|
568
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
569
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
570
|
+
}
|
|
436
571
|
patch(oldEndVnode, newStartVnode);
|
|
437
572
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
438
573
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
@@ -441,12 +576,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
441
576
|
else {
|
|
442
577
|
{
|
|
443
578
|
// new element
|
|
444
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
579
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
445
580
|
newStartVnode = newCh[++newStartIdx];
|
|
446
581
|
}
|
|
447
582
|
if (node) {
|
|
448
583
|
{
|
|
449
|
-
oldStartVnode.$elm
|
|
584
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
450
585
|
}
|
|
451
586
|
}
|
|
452
587
|
}
|
|
@@ -462,16 +597,28 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
462
597
|
// compare if two vnode to see if they're "technically" the same
|
|
463
598
|
// need to have the same element tag, and same key to be the same
|
|
464
599
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
600
|
+
if (vnode1.$tag$ === 'slot') {
|
|
601
|
+
return vnode1.$name$ === vnode2.$name$;
|
|
602
|
+
}
|
|
465
603
|
return true;
|
|
466
604
|
}
|
|
467
605
|
return false;
|
|
468
606
|
};
|
|
607
|
+
const referenceNode = (node) => {
|
|
608
|
+
// this node was relocated to a new location in the dom
|
|
609
|
+
// because of some other component's slot
|
|
610
|
+
// but we still have an html comment in place of where
|
|
611
|
+
// it's original location was according to it's original vdom
|
|
612
|
+
return (node && node['s-ol']) || node;
|
|
613
|
+
};
|
|
614
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
469
615
|
const patch = (oldVNode, newVNode) => {
|
|
470
616
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
471
617
|
const oldChildren = oldVNode.$children$;
|
|
472
618
|
const newChildren = newVNode.$children$;
|
|
473
619
|
const tag = newVNode.$tag$;
|
|
474
620
|
const text = newVNode.$text$;
|
|
621
|
+
let defaultHolder;
|
|
475
622
|
if (text === null) {
|
|
476
623
|
// element node
|
|
477
624
|
{
|
|
@@ -502,12 +649,147 @@ const patch = (oldVNode, newVNode) => {
|
|
|
502
649
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
503
650
|
}
|
|
504
651
|
}
|
|
652
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
653
|
+
// this element has slotted content
|
|
654
|
+
defaultHolder.parentNode.textContent = text;
|
|
655
|
+
}
|
|
505
656
|
else if (oldVNode.$text$ !== text) {
|
|
506
657
|
// update the text content for the text only vnode
|
|
507
658
|
// and also only if the text is different than before
|
|
508
659
|
elm.data = text;
|
|
509
660
|
}
|
|
510
661
|
};
|
|
662
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
663
|
+
// tslint:disable-next-line: prefer-const
|
|
664
|
+
const childNodes = elm.childNodes;
|
|
665
|
+
let childNode;
|
|
666
|
+
let i;
|
|
667
|
+
let ilen;
|
|
668
|
+
let j;
|
|
669
|
+
let slotNameAttr;
|
|
670
|
+
let nodeType;
|
|
671
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
672
|
+
childNode = childNodes[i];
|
|
673
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
674
|
+
if (childNode['s-sr']) {
|
|
675
|
+
// this is a slot fallback node
|
|
676
|
+
// get the slot name for this slot reference node
|
|
677
|
+
slotNameAttr = childNode['s-sn'];
|
|
678
|
+
// by default always show a fallback slot node
|
|
679
|
+
// then hide it if there are other slots in the light dom
|
|
680
|
+
childNode.hidden = false;
|
|
681
|
+
for (j = 0; j < ilen; j++) {
|
|
682
|
+
nodeType = childNodes[j].nodeType;
|
|
683
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
684
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
|
685
|
+
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
686
|
+
childNode.hidden = true;
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
// this is a default fallback slot node
|
|
692
|
+
// any element or text node (with content)
|
|
693
|
+
// should hide the default fallback slot node
|
|
694
|
+
if (nodeType === 1 /* ElementNode */ ||
|
|
695
|
+
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
696
|
+
childNode.hidden = true;
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
// keep drilling down
|
|
703
|
+
updateFallbackSlotVisibility(childNode);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
const relocateNodes = [];
|
|
708
|
+
const relocateSlotContent = (elm) => {
|
|
709
|
+
// tslint:disable-next-line: prefer-const
|
|
710
|
+
let childNode;
|
|
711
|
+
let node;
|
|
712
|
+
let hostContentNodes;
|
|
713
|
+
let slotNameAttr;
|
|
714
|
+
let relocateNodeData;
|
|
715
|
+
let j;
|
|
716
|
+
let i = 0;
|
|
717
|
+
const childNodes = elm.childNodes;
|
|
718
|
+
const ilen = childNodes.length;
|
|
719
|
+
for (; i < ilen; i++) {
|
|
720
|
+
childNode = childNodes[i];
|
|
721
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
722
|
+
// first got the content reference comment node
|
|
723
|
+
// then we got it's parent, which is where all the host content is in now
|
|
724
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
725
|
+
slotNameAttr = childNode['s-sn'];
|
|
726
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
727
|
+
node = hostContentNodes[j];
|
|
728
|
+
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
729
|
+
// let's do some relocating to its new home
|
|
730
|
+
// but never relocate a content reference node
|
|
731
|
+
// that is suppose to always represent the original content location
|
|
732
|
+
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
733
|
+
// it's possible we've already decided to relocate this node
|
|
734
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
735
|
+
// made some changes to slots
|
|
736
|
+
// let's make sure we also double check
|
|
737
|
+
// fallbacks are correctly hidden or shown
|
|
738
|
+
checkSlotFallbackVisibility = true;
|
|
739
|
+
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
740
|
+
if (relocateNodeData) {
|
|
741
|
+
// previously we never found a slot home for this node
|
|
742
|
+
// but turns out we did, so let's remember it now
|
|
743
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
// add to our list of nodes to relocate
|
|
747
|
+
relocateNodes.push({
|
|
748
|
+
$slotRefNode$: childNode,
|
|
749
|
+
$nodeToRelocate$: node,
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
if (node['s-sr']) {
|
|
753
|
+
relocateNodes.map((relocateNode) => {
|
|
754
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
755
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
756
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
757
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
764
|
+
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
765
|
+
// if we never find a home for this element then we'll need to hide it
|
|
766
|
+
relocateNodes.push({
|
|
767
|
+
$nodeToRelocate$: node,
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
774
|
+
relocateSlotContent(childNode);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
779
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
780
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
781
|
+
return true;
|
|
782
|
+
}
|
|
783
|
+
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
784
|
+
return true;
|
|
785
|
+
}
|
|
786
|
+
return false;
|
|
787
|
+
}
|
|
788
|
+
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
return slotNameAttr === '';
|
|
792
|
+
};
|
|
511
793
|
const callNodeRefs = (vNode) => {
|
|
512
794
|
{
|
|
513
795
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
@@ -516,6 +798,7 @@ const callNodeRefs = (vNode) => {
|
|
|
516
798
|
};
|
|
517
799
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
518
800
|
const hostElm = hostRef.$hostElement$;
|
|
801
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
519
802
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
520
803
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
521
804
|
hostTagName = hostElm.tagName;
|
|
@@ -526,10 +809,105 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
526
809
|
{
|
|
527
810
|
scopeId = hostElm['s-sc'];
|
|
528
811
|
}
|
|
812
|
+
{
|
|
813
|
+
contentRef = hostElm['s-cr'];
|
|
814
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
815
|
+
// always reset
|
|
816
|
+
checkSlotFallbackVisibility = false;
|
|
817
|
+
}
|
|
529
818
|
// synchronous patch
|
|
530
819
|
patch(oldVNode, rootVnode);
|
|
820
|
+
{
|
|
821
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
822
|
+
// the disconnectCallback from working
|
|
823
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
824
|
+
if (checkSlotRelocate) {
|
|
825
|
+
relocateSlotContent(rootVnode.$elm$);
|
|
826
|
+
let relocateData;
|
|
827
|
+
let nodeToRelocate;
|
|
828
|
+
let orgLocationNode;
|
|
829
|
+
let parentNodeRef;
|
|
830
|
+
let insertBeforeNode;
|
|
831
|
+
let refNode;
|
|
832
|
+
let i = 0;
|
|
833
|
+
for (; i < relocateNodes.length; i++) {
|
|
834
|
+
relocateData = relocateNodes[i];
|
|
835
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
836
|
+
if (!nodeToRelocate['s-ol']) {
|
|
837
|
+
// add a reference node marking this node's original location
|
|
838
|
+
// keep a reference to this node for later lookups
|
|
839
|
+
orgLocationNode =
|
|
840
|
+
doc.createTextNode('');
|
|
841
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
842
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
for (i = 0; i < relocateNodes.length; i++) {
|
|
846
|
+
relocateData = relocateNodes[i];
|
|
847
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
848
|
+
if (relocateData.$slotRefNode$) {
|
|
849
|
+
// by default we're just going to insert it directly
|
|
850
|
+
// after the slot reference node
|
|
851
|
+
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
852
|
+
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
853
|
+
orgLocationNode = nodeToRelocate['s-ol'];
|
|
854
|
+
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
855
|
+
refNode = orgLocationNode['s-nr'];
|
|
856
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
857
|
+
refNode = refNode.nextSibling;
|
|
858
|
+
if (!refNode || !refNode['s-nr']) {
|
|
859
|
+
insertBeforeNode = refNode;
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
865
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
866
|
+
// we've checked that it's worth while to relocate
|
|
867
|
+
// since that the node to relocate
|
|
868
|
+
// has a different next sibling or parent relocated
|
|
869
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
870
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
871
|
+
// probably a component in the index.html that doesn't have it's hostname set
|
|
872
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
873
|
+
}
|
|
874
|
+
// add it back to the dom but in its new home
|
|
875
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
881
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
882
|
+
nodeToRelocate.hidden = true;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
if (checkSlotFallbackVisibility) {
|
|
888
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
889
|
+
}
|
|
890
|
+
// done moving nodes around
|
|
891
|
+
// allow the disconnect callback to work again
|
|
892
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
893
|
+
// always reset
|
|
894
|
+
relocateNodes.length = 0;
|
|
895
|
+
}
|
|
531
896
|
};
|
|
532
897
|
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
898
|
+
const createEvent = (ref, name, flags) => {
|
|
899
|
+
const elm = getElement(ref);
|
|
900
|
+
return {
|
|
901
|
+
emit: (detail) => {
|
|
902
|
+
return emitEvent(elm, name, {
|
|
903
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
904
|
+
composed: !!(flags & 2 /* Composed */),
|
|
905
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
906
|
+
detail,
|
|
907
|
+
});
|
|
908
|
+
},
|
|
909
|
+
};
|
|
910
|
+
};
|
|
533
911
|
/**
|
|
534
912
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
535
913
|
* @param elm the target of the Event
|
|
@@ -947,6 +1325,15 @@ const connectedCallback = (elm) => {
|
|
|
947
1325
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
948
1326
|
// first time this component has connected
|
|
949
1327
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1328
|
+
{
|
|
1329
|
+
// initUpdate
|
|
1330
|
+
// if the slot polyfill is required we'll need to put some nodes
|
|
1331
|
+
// in here to act as original content anchors as we move nodes around
|
|
1332
|
+
// host element has been connected to the DOM
|
|
1333
|
+
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1334
|
+
setContentReference(elm);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
950
1337
|
{
|
|
951
1338
|
// find the first ancestor component (if there is one) and register
|
|
952
1339
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -986,6 +1373,17 @@ const connectedCallback = (elm) => {
|
|
|
986
1373
|
endConnected();
|
|
987
1374
|
}
|
|
988
1375
|
};
|
|
1376
|
+
const setContentReference = (elm) => {
|
|
1377
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
1378
|
+
// or this browser doesn't support native shadow dom
|
|
1379
|
+
// and this host element was NOT created with SSR
|
|
1380
|
+
// let's pick out the inner content for slot projection
|
|
1381
|
+
// create a node to represent where the original
|
|
1382
|
+
// content was first placed, which is useful later on
|
|
1383
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1384
|
+
contentRefElm['s-cn'] = true;
|
|
1385
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1386
|
+
};
|
|
989
1387
|
const disconnectedCallback = (elm) => {
|
|
990
1388
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
991
1389
|
const hostRef = getHostRef(elm);
|
|
@@ -1177,6 +1575,7 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
|
1177
1575
|
|
|
1178
1576
|
exports.Host = Host;
|
|
1179
1577
|
exports.bootstrapLazy = bootstrapLazy;
|
|
1578
|
+
exports.createEvent = createEvent;
|
|
1180
1579
|
exports.getElement = getElement;
|
|
1181
1580
|
exports.h = h;
|
|
1182
1581
|
exports.promiseResolve = promiseResolve;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-a2da05ae.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.17.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["p-
|
|
17
|
+
return index.bootstrapLazy([["p-illustration.cjs",[[0,"p-illustration",{"variant":[1]}]]],["p-tooltip.cjs",[[1,"p-tooltip",{"content":[8],"placement":[1],"forceShow":[4,"force-show"]},[[1,"mouseenter","_show"],[0,"focus","_show"],[1,"mouseleave","_hide"],[0,"blur","_hide"]]]]],["p-button_3.cjs",[[4,"p-button",{"variant":[1],"href":[1],"target":[1],"size":[1],"loading":[4],"disabled":[4],"icon":[1],"iconPosition":[1,"icon-position"],"iconFlip":[1,"icon-flip"],"iconRotate":[2,"icon-rotate"]},[[2,"click","handleClick"]]],[0,"p-icon",{"variant":[1],"size":[1],"rotate":[2],"flip":[1]}],[1,"p-loader",{"show":[4],"variant":[1],"color":[1],"modalTitle":[1,"modal-title"],"modalDescription":[1,"modal-description"]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|