@esri/solutions-components 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/buffer-tools_6.cjs.entry.js +8 -5
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +2 -2
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +6 -4
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{csvUtils-83af7ae1.js → csvUtils-34666909.js} +1 -1
- package/dist/cjs/{interfaces-772edf61.js → interfaces-17c631bf.js} +1 -1
- package/dist/cjs/layer-table.cjs.entry.js +3 -3
- package/dist/cjs/map-card.cjs.entry.js +1 -1
- package/dist/cjs/{mapViewUtils-55ac76cb.js → mapViewUtils-24d1d859.js} +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +16 -10
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-39726b81.js → solution-store-2dbab624.js} +1 -1
- package/dist/collection/components/buffer-tools/buffer-tools.js +2 -2
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +2 -1
- package/dist/collection/components/public-notification/public-notification.js +14 -8
- package/dist/collection/components/refine-selection/refine-selection.js +4 -2
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.css +1 -0
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +3 -1
- package/dist/collection/demos/new-public-notification.html +2 -1
- package/dist/collection/utils/interfaces.js +1 -1
- package/dist/collection/utils/interfaces.ts +2 -2
- package/dist/components/interfaces3.js +1 -1
- package/dist/components/map-draw-tools2.js +2 -1
- package/dist/components/public-notification.js +14 -8
- package/dist/components/refine-selection-tools2.js +4 -2
- package/dist/components/refine-selection2.js +4 -2
- package/dist/esm/buffer-tools_6.entry.js +8 -5
- package/dist/esm/calcite-combobox_3.entry.js +2 -2
- package/dist/esm/calcite-input-message_5.entry.js +6 -4
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{csvUtils-eb231cfb.js → csvUtils-ae3004b9.js} +1 -1
- package/dist/esm/{interfaces-3b23a5f9.js → interfaces-d0d83efa.js} +1 -1
- package/dist/esm/layer-table.entry.js +3 -3
- package/dist/esm/map-card.entry.js +1 -1
- package/dist/esm/{mapViewUtils-e5d8a1e1.js → mapViewUtils-541e7a3c.js} +1 -1
- package/dist/esm/public-notification.entry.js +16 -10
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-c0bf9200.js → solution-store-41e15f1c.js} +1 -1
- package/dist/solutions-components/demos/new-public-notification.html +2 -1
- package/dist/solutions-components/p-05e64bd1.js +498 -2
- package/dist/solutions-components/p-08a95b33.entry.js +138 -0
- package/dist/solutions-components/p-0da5bbdf.entry.js +91 -0
- package/dist/solutions-components/p-0ef91144.entry.js +913 -0
- package/dist/solutions-components/p-0f523243.entry.js +1916 -0
- package/dist/solutions-components/p-11b9510e.entry.js +173 -0
- package/dist/solutions-components/p-1b875d94.entry.js +58 -0
- package/dist/solutions-components/p-1c567f3a.js +23 -16
- package/dist/solutions-components/p-1c883db9.entry.js +43 -0
- package/dist/solutions-components/p-1f225056.js +322 -0
- package/dist/solutions-components/p-1f499e67.entry.js +72 -0
- package/dist/solutions-components/p-20d3d758.entry.js +881 -0
- package/dist/solutions-components/p-2274ac9e.entry.js +160 -0
- package/dist/solutions-components/p-23ec5ac5.entry.js +93 -0
- package/dist/solutions-components/p-2447798c.entry.js +155 -0
- package/dist/solutions-components/p-2525e691.entry.js +432 -0
- package/dist/solutions-components/p-2561f5b5.js +4092 -0
- package/dist/solutions-components/p-29f887c0.entry.js +234 -0
- package/dist/solutions-components/p-2a0d8047.entry.js +345 -0
- package/dist/solutions-components/p-2c177e6a.entry.js +101 -0
- package/dist/solutions-components/p-2e9ed892.js +46 -1
- package/dist/solutions-components/p-316f56db.js +219 -2
- package/dist/solutions-components/p-327f3ebf.entry.js +98 -0
- package/dist/solutions-components/p-356f8b54.entry.js +138 -0
- package/dist/solutions-components/p-359c58de.entry.js +172 -0
- package/dist/solutions-components/p-37336c0d.entry.js +116 -0
- package/dist/solutions-components/p-374a5031.js +105 -2
- package/dist/solutions-components/p-39ea6ef4.entry.js +71 -0
- package/dist/solutions-components/p-3b010ce1.js +17 -1
- package/dist/solutions-components/p-4307dacd.js +194 -1
- package/dist/solutions-components/p-44da2507.js +405 -14
- package/dist/solutions-components/p-46bdffe8.entry.js +54 -0
- package/dist/solutions-components/p-4894bbeb.js +53 -2
- package/dist/solutions-components/p-4cd569f1.entry.js +1298 -0
- package/dist/solutions-components/p-4d4160f9.entry.js +121 -0
- package/dist/solutions-components/p-4e32bf8c.js +482 -1
- package/dist/solutions-components/p-4e9cbd32.entry.js +184 -0
- package/dist/solutions-components/p-508317b3.js +13 -2
- package/dist/solutions-components/p-54697d58.entry.js +198 -0
- package/dist/solutions-components/p-55c79103.entry.js +311 -0
- package/dist/solutions-components/p-57fd19c0.entry.js +706 -0
- package/dist/solutions-components/p-59b48fde.entry.js +443 -0
- package/dist/solutions-components/p-60e0e6a0.entry.js +214 -0
- package/dist/solutions-components/p-621d0534.entry.js +123 -0
- package/dist/solutions-components/p-63f6e8f1.js +14 -1
- package/dist/solutions-components/p-66aeec57.entry.js +61 -0
- package/dist/solutions-components/p-69834f46.entry.js +618 -0
- package/dist/solutions-components/p-6d9da8e5.entry.js +21530 -0
- package/dist/solutions-components/p-6e0da576.js +13 -1
- package/dist/solutions-components/p-6ec3f294.entry.js +106 -0
- package/dist/solutions-components/p-6fe17794.js +9 -1
- package/dist/solutions-components/p-7024cb16.entry.js +72 -0
- package/dist/solutions-components/p-70535506.entry.js +226 -0
- package/dist/solutions-components/p-708a63a8.js +12 -1
- package/dist/solutions-components/p-729708a3.js +14 -1
- package/dist/solutions-components/p-73e23995.js +6 -1
- package/dist/solutions-components/p-74b29d75.entry.js +231 -0
- package/dist/solutions-components/p-74b7ee25.entry.js +711 -0
- package/dist/solutions-components/p-77182c3a.js +3015 -1
- package/dist/solutions-components/p-78b3ef80.entry.js +456 -0
- package/dist/solutions-components/p-79709c19.js +60 -3
- package/dist/solutions-components/p-7a46ef97.js +181 -2
- package/dist/solutions-components/p-7be159e6.entry.js +175 -0
- package/dist/solutions-components/p-7d4451c2.entry.js +71 -0
- package/dist/solutions-components/p-7daea1df.js +41 -1
- package/dist/solutions-components/p-7e39e5ad.entry.js +102 -0
- package/dist/solutions-components/p-7fb45059.entry.js +43 -0
- package/dist/solutions-components/p-815533de.js +306 -3
- package/dist/solutions-components/p-816622ca.entry.js +248 -0
- package/dist/solutions-components/p-83166522.js +205 -2
- package/dist/solutions-components/p-83bd1991.entry.js +36 -0
- package/dist/solutions-components/p-856464d7.entry.js +572 -0
- package/dist/solutions-components/p-8c349bad.entry.js +347 -0
- package/dist/solutions-components/p-8dccb390.entry.js +1986 -0
- package/dist/solutions-components/p-904c185a.entry.js +228 -0
- package/dist/solutions-components/p-9092f8b3.entry.js +156 -0
- package/dist/solutions-components/p-9371145a.entry.js +477 -0
- package/dist/solutions-components/p-93d3119d.js +1948 -1
- package/dist/solutions-components/p-95ec8062.entry.js +173 -0
- package/dist/solutions-components/p-991ee695.js +109 -1
- package/dist/solutions-components/p-9a57dab7.entry.js +213 -0
- package/dist/solutions-components/p-9a9955db.js +41 -1
- package/dist/solutions-components/p-9c1ebc90.js +35 -16
- package/dist/solutions-components/p-9eba5c66.js +399 -3
- package/dist/solutions-components/p-a033a507.entry.js +252 -0
- package/dist/solutions-components/p-a3773415.entry.js +1132 -0
- package/dist/solutions-components/p-a44fe40f.entry.js +94 -0
- package/dist/solutions-components/p-a5b1ab03.js +33 -3
- package/dist/solutions-components/p-a5b2c13d.entry.js +723 -0
- package/dist/solutions-components/p-a6d729b7.entry.js +85 -0
- package/dist/solutions-components/p-a8005026.entry.js +565 -0
- package/dist/solutions-components/p-a80b3880.js +14 -1
- package/dist/solutions-components/p-a89198a3.entry.js +2620 -0
- package/dist/solutions-components/p-aa04bd1f.entry.js +95 -0
- package/dist/solutions-components/p-aa0a0922.entry.js +80 -0
- package/dist/solutions-components/p-ae1fd76b.js +11 -1
- package/dist/solutions-components/p-b2cf435e.entry.js +87 -0
- package/dist/solutions-components/p-b359dc78.js +41 -1
- package/dist/solutions-components/p-b57bc4eb.entry.js +71 -0
- package/dist/solutions-components/p-b75cc407.entry.js +145 -0
- package/dist/solutions-components/p-b911cb75.entry.js +71 -0
- package/dist/solutions-components/p-b965e177.entry.js +335 -0
- package/dist/solutions-components/p-b978636e.js +14 -1
- package/dist/solutions-components/p-ba10a5c8.entry.js +42 -0
- package/dist/solutions-components/p-bd67334c.js +122 -2
- package/dist/solutions-components/p-bde20dba.entry.js +212 -0
- package/dist/solutions-components/p-be0b5a94.entry.js +248 -0
- package/dist/solutions-components/p-c023e6a1.js +2028 -2
- package/dist/solutions-components/p-c27b0c2d.entry.js +150 -0
- package/dist/solutions-components/p-c579ed60.entry.js +447 -0
- package/dist/solutions-components/p-c92bc231.js +101 -2
- package/dist/solutions-components/p-cc815aca.js +839 -16
- package/dist/solutions-components/p-cc8beabb.entry.js +695 -0
- package/dist/solutions-components/p-cdc46c0c.js +1751 -2
- package/dist/solutions-components/p-d12e6992.entry.js +118 -0
- package/dist/solutions-components/p-d1dfed6b.entry.js +179 -0
- package/dist/solutions-components/p-d48a24e6.js +754 -2
- package/dist/solutions-components/p-d96ee3ef.entry.js +579 -0
- package/dist/solutions-components/p-dbc9a5a8.js +80 -0
- package/dist/solutions-components/p-dcdbe712.entry.js +278 -0
- package/dist/solutions-components/p-de39206f.entry.js +113 -0
- package/dist/solutions-components/p-de5416e8.js +28 -1
- package/dist/solutions-components/p-df420d54.entry.js +213 -0
- package/dist/solutions-components/p-e3138cf0.entry.js +20 -0
- package/dist/solutions-components/p-e4845fec.entry.js +152 -0
- package/dist/solutions-components/p-e611d8c8.js +28 -1
- package/dist/solutions-components/p-e947d3b0.js +5 -1
- package/dist/solutions-components/p-ea534300.js +41 -2
- package/dist/solutions-components/p-ec84ee85.entry.js +55 -0
- package/dist/solutions-components/p-ed36c637.entry.js +85 -0
- package/dist/solutions-components/p-f0add71c.js +74 -0
- package/dist/solutions-components/p-f42e014b.js +171 -2
- package/dist/solutions-components/p-fc02e7de.entry.js +308 -0
- package/dist/solutions-components/p-fc884dd6.js +28 -16
- package/dist/solutions-components/p-fcbfa59c.entry.js +181 -0
- package/dist/solutions-components/p-fdc5cf5f.entry.js +138 -0
- package/dist/solutions-components/solutions-components.esm.js +20 -1
- package/dist/solutions-components/utils/interfaces.ts +2 -2
- package/dist/types/components/buffer-tools/buffer-tools.d.ts +2 -2
- package/dist/types/components/public-notification/public-notification.d.ts +9 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/solutions-components/p-021432b8.entry.js +0 -12
- package/dist/solutions-components/p-03440b1e.entry.js +0 -11
- package/dist/solutions-components/p-0512635b.entry.js +0 -6
- package/dist/solutions-components/p-086ef115.entry.js +0 -29
- package/dist/solutions-components/p-0b4bf57f.entry.js +0 -6
- package/dist/solutions-components/p-0c088725.entry.js +0 -6
- package/dist/solutions-components/p-0f820c08.entry.js +0 -6
- package/dist/solutions-components/p-164780a0.entry.js +0 -6
- package/dist/solutions-components/p-179a68a0.entry.js +0 -6
- package/dist/solutions-components/p-184b5005.entry.js +0 -11
- package/dist/solutions-components/p-1d082fee.entry.js +0 -11
- package/dist/solutions-components/p-1e6c02a2.entry.js +0 -11
- package/dist/solutions-components/p-20a58e62.entry.js +0 -17
- package/dist/solutions-components/p-20b2458c.entry.js +0 -11
- package/dist/solutions-components/p-245d47c1.entry.js +0 -6
- package/dist/solutions-components/p-2cb057a9.entry.js +0 -11
- package/dist/solutions-components/p-2cc72806.entry.js +0 -23
- package/dist/solutions-components/p-2de1db9c.entry.js +0 -11
- package/dist/solutions-components/p-2e9c7055.entry.js +0 -11
- package/dist/solutions-components/p-2ed5e6c8.entry.js +0 -11
- package/dist/solutions-components/p-3109d940.entry.js +0 -6
- package/dist/solutions-components/p-31a8bcfa.entry.js +0 -6
- package/dist/solutions-components/p-3649acb3.entry.js +0 -18
- package/dist/solutions-components/p-3f88ba73.entry.js +0 -6
- package/dist/solutions-components/p-3fa9b3c8.js +0 -36
- package/dist/solutions-components/p-40c41709.entry.js +0 -6
- package/dist/solutions-components/p-40e963c7.entry.js +0 -11
- package/dist/solutions-components/p-40f480da.entry.js +0 -11
- package/dist/solutions-components/p-49d5d2d3.entry.js +0 -11
- package/dist/solutions-components/p-4f7049a4.entry.js +0 -11
- package/dist/solutions-components/p-506e4d78.entry.js +0 -6
- package/dist/solutions-components/p-576fdcab.entry.js +0 -6
- package/dist/solutions-components/p-5bd0cf34.entry.js +0 -23
- package/dist/solutions-components/p-65e177f1.entry.js +0 -6
- package/dist/solutions-components/p-67d710c2.entry.js +0 -6
- package/dist/solutions-components/p-7268b445.entry.js +0 -11
- package/dist/solutions-components/p-75ea4667.entry.js +0 -6
- package/dist/solutions-components/p-778c0a36.entry.js +0 -17
- package/dist/solutions-components/p-7a22509b.entry.js +0 -12
- package/dist/solutions-components/p-7bff51db.entry.js +0 -6
- package/dist/solutions-components/p-7d2d0d5d.entry.js +0 -6
- package/dist/solutions-components/p-7f0036f1.entry.js +0 -11
- package/dist/solutions-components/p-8060fb94.entry.js +0 -6
- package/dist/solutions-components/p-80a1b305.entry.js +0 -6
- package/dist/solutions-components/p-81eae877.entry.js +0 -12
- package/dist/solutions-components/p-84e86b8b.entry.js +0 -6
- package/dist/solutions-components/p-851e04ae.entry.js +0 -6
- package/dist/solutions-components/p-9106950a.entry.js +0 -11
- package/dist/solutions-components/p-979804a4.entry.js +0 -11
- package/dist/solutions-components/p-9862baa8.entry.js +0 -11
- package/dist/solutions-components/p-9b5a9117.entry.js +0 -12
- package/dist/solutions-components/p-9deff0c2.entry.js +0 -6
- package/dist/solutions-components/p-9f400eeb.entry.js +0 -6
- package/dist/solutions-components/p-a0639ad1.entry.js +0 -11
- package/dist/solutions-components/p-a33c044e.entry.js +0 -6
- package/dist/solutions-components/p-a516c658.entry.js +0 -6
- package/dist/solutions-components/p-aa0ef36d.entry.js +0 -11
- package/dist/solutions-components/p-aaccbdf3.entry.js +0 -18
- package/dist/solutions-components/p-ab03a5c9.entry.js +0 -11
- package/dist/solutions-components/p-ad469b92.entry.js +0 -11
- package/dist/solutions-components/p-adc86ac3.entry.js +0 -6
- package/dist/solutions-components/p-addc1156.entry.js +0 -11
- package/dist/solutions-components/p-ae846934.entry.js +0 -11
- package/dist/solutions-components/p-b0572fc4.entry.js +0 -37
- package/dist/solutions-components/p-b4e476b7.js +0 -257
- package/dist/solutions-components/p-b668daf8.js +0 -21
- package/dist/solutions-components/p-b6e6eae1.entry.js +0 -6
- package/dist/solutions-components/p-bc317a7f.entry.js +0 -6
- package/dist/solutions-components/p-be41429f.js +0 -21
- package/dist/solutions-components/p-bf6b6353.entry.js +0 -11
- package/dist/solutions-components/p-c2e3dfbb.entry.js +0 -11
- package/dist/solutions-components/p-c4afae53.entry.js +0 -12
- package/dist/solutions-components/p-c9da1c26.entry.js +0 -6
- package/dist/solutions-components/p-cbf8cd49.entry.js +0 -6
- package/dist/solutions-components/p-cc1a064a.entry.js +0 -11
- package/dist/solutions-components/p-d09a168c.entry.js +0 -6
- package/dist/solutions-components/p-d377f913.entry.js +0 -11
- package/dist/solutions-components/p-d4cefead.entry.js +0 -37
- package/dist/solutions-components/p-d7bc0baf.entry.js +0 -16
- package/dist/solutions-components/p-d8968487.entry.js +0 -11
- package/dist/solutions-components/p-e00a0b86.entry.js +0 -11
- package/dist/solutions-components/p-e9a7ed49.entry.js +0 -11
- package/dist/solutions-components/p-ec27e493.entry.js +0 -11
- package/dist/solutions-components/p-ed6404eb.entry.js +0 -6
- package/dist/solutions-components/p-ef21e195.entry.js +0 -23
- package/dist/solutions-components/p-f6068a2d.entry.js +0 -11
- package/dist/solutions-components/p-f6c4cff3.entry.js +0 -11
- package/dist/solutions-components/p-f847291f.entry.js +0 -6
- package/dist/solutions-components/p-f90fd262.entry.js +0 -11
- package/dist/solutions-components/p-fc973005.entry.js +0 -6
- package/dist/solutions-components/p-ff9fb6bc.entry.js +0 -11
@@ -3,5 +3,2031 @@
|
|
3
3
|
* Licensed under the Apache License, Version 2.0
|
4
4
|
* http://www.apache.org/licenses/LICENSE-2.0
|
5
5
|
*/
|
6
|
-
let e,t,n,l=!1,o=!1,s=!1,i=!1,r=null,c=!1;const f=e=>{const t=new URL(e,be.t);return t.origin!==me.location.origin?t.href:t.pathname},a="http://www.w3.org/1999/xlink",u={},d=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,o=null,s=null,i=!1,r=!1;const c=[],f=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?f(l):null!=l&&"boolean"!=typeof l&&((i="function"!=typeof e&&!d(l))&&(l+=""),i&&r?c[c.length-1].l+=l:c.push(i?h(null,l):l),r=i)};if(f(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(" "))}}if("function"==typeof e)return e(null===t?{}:t,c,m);const a=h(e,null);return a.o=t,c.length>0&&(a.i=c),a.u=o,a.$=s,a},h=(e,t)=>({h:0,p:e,l:t,m:null,i:null,o:null,u:null,$:null}),p={},m={forEach:(e,t)=>e.map(y).forEach(t),map:(e,t)=>e.map(y).map(t).map(b)},y=e=>({vattrs:e.o,vchildren:e.i,vkey:e.u,vname:e.$,vtag:e.p,vtext:e.l}),b=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),$(e.vtag,t,...e.vchildren||[])}const t=h(e.vtag,e.vtext);return t.o=e.vattrs,t.i=e.vchildren,t.u=e.vkey,t.$=e.vname,t},w=e=>ce(e).g,g=(e,t,n)=>{const l=w(e);return{emit:e=>v(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},v=(e,t,n)=>{const l=be.ce(t,n);return e.dispatchEvent(l),l},k=new WeakMap,j=e=>"sc-"+e.v,S=(e,t,n,l,o,s)=>{if(n!==l){let i=ue(e,t),r=t.toLowerCase();if("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("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("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const c=d(l);if((i||c&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}let f=!1;r!==(r=r.replace(/^xlink\:?/,""))&&(t=r,f=!0),null==l||!1===l?!1===l&&""!==e.getAttribute(t)||(f?e.removeAttributeNS(a,t):e.removeAttribute(t)):(!i||4&s||o)&&!c&&(l=!0===l?"":l,f?e.setAttributeNS(a,t,l):e.setAttribute(t,l))}else t="-"===t[2]?t.slice(3):ue(me,r)?r.slice(2):r[2]+t.slice(3),n&&be.rel(e,t,n,!1),l&&be.ael(e,t,l,!1)}},O=/\s/,C=e=>e?e.split(O):[],M=(e,t,n,l)=>{const o=11===t.m.nodeType&&t.m.host?t.m.host:t.m,s=e&&e.o||u,i=t.o||u;for(l in s)l in i||S(o,l,s[l],void 0,n,t.h);for(l in i)S(o,l,s[l],i[l],n,t.h)},R=(o,r,c,f)=>{const a=r.i[c];let u,d,$,h=0;if(l||(s=!0,"slot"===a.p&&(e&&f.classList.add(e+"-s"),a.h|=a.i?2:1)),null!==a.l)u=a.m=ye.createTextNode(a.l);else if(1&a.h)u=a.m=ye.createTextNode("");else{if(i||(i="svg"===a.p),u=a.m=ye.createElementNS(i?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&a.h?"slot-fb":a.p),i&&"foreignObject"===a.p&&(i=!1),M(null,a,i),null!=e&&u["s-si"]!==e&&u.classList.add(u["s-si"]=e),a.i)for(h=0;h<a.i.length;++h)d=R(o,a,h,u),d&&u.appendChild(d);"svg"===a.p?i=!1:"foreignObject"===u.tagName&&(i=!0)}return u["s-hn"]=n,3&a.h&&(u["s-sr"]=!0,u["s-cr"]=t,u["s-sn"]=a.$||"",$=o&&o.i&&o.i[c],$&&$.p===a.p&&o.m&&x(o.m,!1)),u},x=(e,t)=>{be.h|=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"]&&(N(o).insertBefore(o,E(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),t&&x(o,t)}be.h&=-2},L=(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=R(null,l,s,e),r&&(o[s].m=r,c.insertBefore(r,E(t))))},P=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.m,H(l),o=!0,s["s-ol"]?s["s-ol"].remove():x(s,!0),s.remove())},T=(e,t)=>e.p===t.p&&("slot"===e.p?e.$===t.$:e.u===t.u),E=e=>e&&e["s-ol"]||e,N=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,W=(e,t)=>{const n=t.m=e.m,l=e.i,o=t.i,s=t.p,r=t.l;let c;null===r?(i="svg"===s||"foreignObject"!==s&&i,"slot"===s||M(e,t,i),null!==l&&null!==o?((e,t,n,l)=>{let o,s,i=0,r=0,c=0,f=0,a=t.length-1,u=t[0],d=t[a],$=l.length-1,h=l[0],p=l[$];for(;i<=a&&r<=$;)if(null==u)u=t[++i];else if(null==d)d=t[--a];else if(null==h)h=l[++r];else if(null==p)p=l[--$];else if(T(u,h))W(u,h),u=t[++i],h=l[++r];else if(T(d,p))W(d,p),d=t[--a],p=l[--$];else if(T(u,p))"slot"!==u.p&&"slot"!==p.p||x(u.m.parentNode,!1),W(u,p),e.insertBefore(u.m,d.m.nextSibling),u=t[++i],p=l[--$];else if(T(d,h))"slot"!==u.p&&"slot"!==p.p||x(d.m.parentNode,!1),W(d,h),e.insertBefore(d.m,u.m),d=t[--a],h=l[++r];else{for(c=-1,f=i;f<=a;++f)if(t[f]&&null!==t[f].u&&t[f].u===h.u){c=f;break}c>=0?(s=t[c],s.p!==h.p?o=R(t&&t[r],n,c,e):(W(s,h),t[c]=void 0,o=s.m),h=l[++r]):(o=R(t&&t[r],n,r,e),h=l[++r]),o&&N(u.m).insertBefore(o,E(u.m))}i>a?L(e,null==l[$+1]?null:l[$+1].m,n,l,r,$):r>$&&P(t,i,a)})(n,l,t,o):null!==o?(null!==e.l&&(n.textContent=""),L(n,null,t,o,0,o.length-1)):null!==l&&P(l,0,l.length-1),i&&"svg"===s&&(i=!1)):(c=n["s-cr"])?c.parentNode.textContent=r:e.l!==r&&(n.data=r)},F=e=>{const t=e.childNodes;let n,l,o,s,i,r;for(l=0,o=t.length;l<o;l++)if(n=t[l],1===n.nodeType){if(n["s-sr"])for(i=n["s-sn"],n.hidden=!1,s=0;s<o;s++)if(r=t[s].nodeType,t[s]["s-hn"]!==n["s-hn"]||""!==i){if(1===r&&i===t[s].getAttribute("slot")){n.hidden=!0;break}}else if(1===r||3===r&&""!==t[s].textContent.trim()){n.hidden=!0;break}F(n)}},U=[],A=e=>{let t,n,l,s,i,r,c=0;const f=e.childNodes,a=f.length;for(;c<a;c++){if(t=f[c],t["s-sr"]&&(n=t["s-cr"])&&n.parentNode)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"]||(D(n,s)?(i=U.find((e=>e.k===n)),o=!0,n["s-sn"]=n["s-sn"]||s,i?i.j=t:U.push({j:t,k:n}),n["s-sr"]&&U.map((e=>{D(e.k,n["s-sn"])&&(i=U.find((e=>e.k===n)),i&&!e.j&&(e.j=i.j))}))):U.some((e=>e.k===n))||U.push({k:n}));1===t.nodeType&&A(t)}},D=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,H=e=>{e.o&&e.o.ref&&e.o.ref(null),e.i&&e.i.map(H)},q=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},V=(e,t)=>{if(e.h|=16,!(4&e.h))return q(e,e.O),Me((()=>_(e,t)));e.h|=512},_=(e,t)=>{const n=e.C;let l;return t&&(e.h|=256,e.M&&(e.M.map((([e,t])=>Q(n,e,t))),e.M=null),l=Q(n,"componentWillLoad")),l=X(l,(()=>Q(n,"componentWillRender"))),X(l,(()=>z(e,n,t)))},z=async(e,t,n)=>{const l=e.g,o=l["s-rc"];n&&(e=>{const t=e.R,n=e.g,l=t.h,o=((e,t)=>{let n=j(t);const l=pe.get(n);if(e=11===e.nodeType?e:ye,l)if("string"==typeof l){let t,o=k.get(e=e.head||e);o||k.set(e,o=new Set),o.has(n)||(t=ye.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);B(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>I(e);0===t.length?n():(Promise.all(t).then(n),e.h|=4,t.length=0)}},B=(i,c)=>{try{r=c,c=c.render(),i.h&=-17,i.h|=2,((i,r)=>{const c=i.g,f=i.R,a=i.L||h(null,null),u=(e=>e&&e.p===p)(r)?r:$(null,null,r);if(n=c.tagName,f.P&&(u.o=u.o||{},f.P.map((([e,t])=>u.o[t]=c[e]))),u.p=null,u.h|=4,i.L=u,u.m=a.m=c.shadowRoot||c,e=c["s-sc"],t=c["s-cr"],l=0!=(1&f.h),o=!1,W(a,u),be.h|=1,s){let e,t,n,l,o,s;A(u.m);let i=0;for(;i<U.length;i++)e=U[i],t=e.k,t["s-ol"]||(n=ye.createTextNode(""),n["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=n,t));for(i=0;i<U.length;i++)if(e=U[i],t=e.k,e.j){for(l=e.j.parentNode,o=e.j.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&&F(u.m),be.h&=-2,U.length=0})(i,c)}catch(e){de(e,i.g)}return r=null,null},G=()=>r,I=e=>{const t=e.g,n=e.C,l=e.O;Q(n,"componentDidRender"),64&e.h||(e.h|=64,Y(t),Q(n,"componentDidLoad"),e.T(t),l||K()),e.N(t),e.S&&(e.S(),e.S=void 0),512&e.h&&Ce((()=>V(e,!1))),e.h&=-517},J=e=>{{const t=ce(e),n=t.g.isConnected;return n&&2==(18&t.h)&&V(t,!1),n}},K=()=>{Y(ye.documentElement),Ce((()=>v(me,"appload",{detail:{namespace:"solutions-components"}})))},Q=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){de(e)}},X=(e,t)=>e&&e.then?e.then(t):t(),Y=e=>e.classList.add("hydrated"),Z=(e,t,n)=>{if(t.W){e.watchers&&(t.F=e.watchers);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)=>ce(this).U.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=ce(e),s=o.g,i=o.U.get(t),r=o.h,c=o.C;if(n=((e,t)=>null==e||d(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===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(o.U.set(t,n),c)){if(l.F&&128&r){const e=l.F[t];e&&e.map((e=>{try{c[e](n,i,t)}catch(e){de(e,s)}}))}if(2==(18&r)){if(c.componentShouldUpdate&&!1===c.componentShouldUpdate(n,i,t))return;V(o,!1)}}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,e,{value(...t){const n=ce(this);return n.A.then((()=>n.C[e](...t)))}})})),1&n){const n=new Map;o.attributeChangedCallback=function(e,t,l){be.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(o.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;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.P.push([e,o]),o}))}}return e},ee=e=>{Q(e,"connectedCallback")},te=(e,t={})=>{const n=[],l=t.exclude||[],o=me.customElements,s=ye.head,i=s.querySelector("meta[charset]"),r=ye.createElement("style"),c=[];let f,a=!0;Object.assign(be,t),be.t=new URL(t.resourcesUrl||"./",ye.baseURI).href,e.map((e=>{e[1].map((t=>{const s={h:t[0],v:t[1],W:t[2],D:t[3]};s.W=t[2],s.D=t[3],s.P=[],s.F={};const i=s.v,r=class extends HTMLElement{constructor(e){super(e),ae(e=this,s),1&s.h&&e.attachShadow({mode:"open"})}connectedCallback(){f&&(clearTimeout(f),f=null),a?c.push(this):be.jmp((()=>(e=>{if(0==(1&be.h)){const t=ce(e),n=t.R,l=()=>{};if(1&t.h)le(e,t,n.D),ee(t.C);else{t.h|=1,12&n.h&&(e=>{const t=e["s-cr"]=ye.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){q(t,t.O=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.h)){{if(t.h|=32,(o=he(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(n.F=o.watchers,Z(o,n,2),o.isProxied=!0);const e=()=>{};t.h|=8;try{new o(t)}catch(e){de(e)}t.h&=-9,t.h|=128,e(),ee(t.C)}if(o.style){let e=o.style;const t=j(n);if(!pe.has(t)){const l=()=>{};((e,t,n)=>{let l=pe.get(e);ge&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,pe.set(e,l)})(t,e,!!(1&n.h)),l()}}}const s=t.O,i=()=>V(t,!0);s&&s["s-rc"]?s["s-rc"].push(i):i()})(0,t,n)}l()}})(this)))}disconnectedCallback(){be.jmp((()=>(()=>{if(0==(1&be.h)){const e=ce(this),t=e.C;e.H&&(e.H.map((e=>e())),e.H=void 0),Q(t,"disconnectedCallback")}})()))}componentOnReady(){return ce(this).q}};s.V=e[0],l.includes(i)||o.get(i)||(n.push(i),o.define(i,Z(r,s,1)))}))})),r.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",r.setAttribute("data-styles",""),s.insertBefore(r,i?i.nextSibling:s.firstChild),a=!1,c.length?c.map((e=>e.connectedCallback())):be.jmp((()=>f=setTimeout(K,30)))},ne=(e,t)=>t,le=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=se(e,n),i=oe(t,o),r=ie(n);be.ael(s,l,i,r),(t.H=t.H||[]).push((()=>be.rel(s,l,i,r)))}))},oe=(e,t)=>n=>{try{256&e.h?e.C[t](n):(e.M=e.M||[]).push([t,n])}catch(e){de(e)}},se=(e,t)=>4&t?ye:8&t?me:16&t?ye.body:e,ie=e=>0!=(2&e),re=new WeakMap,ce=e=>re.get(e),fe=(e,t)=>re.set(t.C=e,t),ae=(e,t)=>{const n={h:0,g:e,R:t,U:new Map};return n.A=new Promise((e=>n.N=e)),n.q=new Promise((e=>n.T=e)),e["s-p"]=[],e["s-rc"]=[],le(e,n,t.D),re.set(e,n)},ue=(e,t)=>t in e,de=(e,t)=>(0,console.error)(e,t),$e=new Map,he=e=>{const t=e.v.replace(/-/g,"_"),n=e.V,l=$e.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>($e.set(n,e),e[t])),de)
|
7
|
-
|
6
|
+
const NAMESPACE = 'solutions-components';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
10
|
+
* Simon Friis Vindum (@paldepind)
|
11
|
+
* Licensed under the MIT License
|
12
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
13
|
+
*
|
14
|
+
* Modified for Stencil's renderer and slot projection
|
15
|
+
*/
|
16
|
+
let scopeId;
|
17
|
+
let contentRef;
|
18
|
+
let hostTagName;
|
19
|
+
let useNativeShadowDom = false;
|
20
|
+
let checkSlotFallbackVisibility = false;
|
21
|
+
let checkSlotRelocate = false;
|
22
|
+
let isSvgMode = false;
|
23
|
+
let renderingRef = null;
|
24
|
+
let queuePending = false;
|
25
|
+
const getAssetPath = (path) => {
|
26
|
+
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
27
|
+
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
28
|
+
};
|
29
|
+
const createTime = (fnName, tagName = '') => {
|
30
|
+
{
|
31
|
+
return () => {
|
32
|
+
return;
|
33
|
+
};
|
34
|
+
}
|
35
|
+
};
|
36
|
+
const uniqueTime = (key, measureText) => {
|
37
|
+
{
|
38
|
+
return () => {
|
39
|
+
return;
|
40
|
+
};
|
41
|
+
}
|
42
|
+
};
|
43
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
44
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
45
|
+
/**
|
46
|
+
* Default style mode id
|
47
|
+
*/
|
48
|
+
/**
|
49
|
+
* Reusable empty obj/array
|
50
|
+
* Don't add values to these!!
|
51
|
+
*/
|
52
|
+
const EMPTY_OBJ = {};
|
53
|
+
/**
|
54
|
+
* Namespaces
|
55
|
+
*/
|
56
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
57
|
+
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
58
|
+
const isDef = (v) => v != null;
|
59
|
+
const isComplexType = (o) => {
|
60
|
+
// https://jsperf.com/typeof-fn-object/5
|
61
|
+
o = typeof o;
|
62
|
+
return o === 'object' || o === 'function';
|
63
|
+
};
|
64
|
+
/**
|
65
|
+
* Production h() function based on Preact by
|
66
|
+
* Jason Miller (@developit)
|
67
|
+
* Licensed under the MIT License
|
68
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
69
|
+
*
|
70
|
+
* Modified for Stencil's compiler and vdom
|
71
|
+
*/
|
72
|
+
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
73
|
+
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
74
|
+
const h = (nodeName, vnodeData, ...children) => {
|
75
|
+
let child = null;
|
76
|
+
let key = null;
|
77
|
+
let slotName = null;
|
78
|
+
let simple = false;
|
79
|
+
let lastSimple = false;
|
80
|
+
const vNodeChildren = [];
|
81
|
+
const walk = (c) => {
|
82
|
+
for (let i = 0; i < c.length; i++) {
|
83
|
+
child = c[i];
|
84
|
+
if (Array.isArray(child)) {
|
85
|
+
walk(child);
|
86
|
+
}
|
87
|
+
else if (child != null && typeof child !== 'boolean') {
|
88
|
+
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
|
89
|
+
child = String(child);
|
90
|
+
}
|
91
|
+
if (simple && lastSimple) {
|
92
|
+
// If the previous child was simple (string), we merge both
|
93
|
+
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
94
|
+
}
|
95
|
+
else {
|
96
|
+
// Append a new vNode, if it's text, we create a text vNode
|
97
|
+
vNodeChildren.push(simple ? newVNode(null, child) : child);
|
98
|
+
}
|
99
|
+
lastSimple = simple;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
};
|
103
|
+
walk(children);
|
104
|
+
if (vnodeData) {
|
105
|
+
// normalize class / classname attributes
|
106
|
+
if (vnodeData.key) {
|
107
|
+
key = vnodeData.key;
|
108
|
+
}
|
109
|
+
if (vnodeData.name) {
|
110
|
+
slotName = vnodeData.name;
|
111
|
+
}
|
112
|
+
{
|
113
|
+
const classData = vnodeData.className || vnodeData.class;
|
114
|
+
if (classData) {
|
115
|
+
vnodeData.class =
|
116
|
+
typeof classData !== 'object'
|
117
|
+
? classData
|
118
|
+
: Object.keys(classData)
|
119
|
+
.filter((k) => classData[k])
|
120
|
+
.join(' ');
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
if (typeof nodeName === 'function') {
|
125
|
+
// nodeName is a functional component
|
126
|
+
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
127
|
+
}
|
128
|
+
const vnode = newVNode(nodeName, null);
|
129
|
+
vnode.$attrs$ = vnodeData;
|
130
|
+
if (vNodeChildren.length > 0) {
|
131
|
+
vnode.$children$ = vNodeChildren;
|
132
|
+
}
|
133
|
+
{
|
134
|
+
vnode.$key$ = key;
|
135
|
+
}
|
136
|
+
{
|
137
|
+
vnode.$name$ = slotName;
|
138
|
+
}
|
139
|
+
return vnode;
|
140
|
+
};
|
141
|
+
const newVNode = (tag, text) => {
|
142
|
+
const vnode = {
|
143
|
+
$flags$: 0,
|
144
|
+
$tag$: tag,
|
145
|
+
$text$: text,
|
146
|
+
$elm$: null,
|
147
|
+
$children$: null,
|
148
|
+
};
|
149
|
+
{
|
150
|
+
vnode.$attrs$ = null;
|
151
|
+
}
|
152
|
+
{
|
153
|
+
vnode.$key$ = null;
|
154
|
+
}
|
155
|
+
{
|
156
|
+
vnode.$name$ = null;
|
157
|
+
}
|
158
|
+
return vnode;
|
159
|
+
};
|
160
|
+
const Host = {};
|
161
|
+
const isHost = (node) => node && node.$tag$ === Host;
|
162
|
+
/**
|
163
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
164
|
+
*
|
165
|
+
* Note that these functions convert from {@link d.VNode} to
|
166
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
167
|
+
* interface.
|
168
|
+
*/
|
169
|
+
const vdomFnUtils = {
|
170
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
171
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
172
|
+
};
|
173
|
+
const convertToPublic = (node) => ({
|
174
|
+
vattrs: node.$attrs$,
|
175
|
+
vchildren: node.$children$,
|
176
|
+
vkey: node.$key$,
|
177
|
+
vname: node.$name$,
|
178
|
+
vtag: node.$tag$,
|
179
|
+
vtext: node.$text$,
|
180
|
+
});
|
181
|
+
const convertToPrivate = (node) => {
|
182
|
+
if (typeof node.vtag === 'function') {
|
183
|
+
const vnodeData = Object.assign({}, node.vattrs);
|
184
|
+
if (node.vkey) {
|
185
|
+
vnodeData.key = node.vkey;
|
186
|
+
}
|
187
|
+
if (node.vname) {
|
188
|
+
vnodeData.name = node.vname;
|
189
|
+
}
|
190
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
191
|
+
}
|
192
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
193
|
+
vnode.$attrs$ = node.vattrs;
|
194
|
+
vnode.$children$ = node.vchildren;
|
195
|
+
vnode.$key$ = node.vkey;
|
196
|
+
vnode.$name$ = node.vname;
|
197
|
+
return vnode;
|
198
|
+
};
|
199
|
+
/**
|
200
|
+
* Parse a new property value for a given property type.
|
201
|
+
*
|
202
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
203
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
204
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
205
|
+
* 2. the type stored from `propType`.
|
206
|
+
*
|
207
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
208
|
+
*
|
209
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
210
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
211
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
212
|
+
* ```tsx
|
213
|
+
* <my-cmp prop-val={0}></my-cmp>
|
214
|
+
* ```
|
215
|
+
*
|
216
|
+
* HTML prop values on the other hand, will always a string
|
217
|
+
*
|
218
|
+
* @param propValue the new value to coerce to some type
|
219
|
+
* @param propType the type of the prop, expressed as a binary number
|
220
|
+
* @returns the parsed/coerced value
|
221
|
+
*/
|
222
|
+
const parsePropertyValue = (propValue, propType) => {
|
223
|
+
// ensure this value is of the correct prop type
|
224
|
+
if (propValue != null && !isComplexType(propValue)) {
|
225
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
226
|
+
// per the HTML spec, any string value means it is a boolean true value
|
227
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
228
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
229
|
+
}
|
230
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
231
|
+
// force it to be a number
|
232
|
+
return parseFloat(propValue);
|
233
|
+
}
|
234
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
235
|
+
// could have been passed as a number or boolean
|
236
|
+
// but we still want it as a string
|
237
|
+
return String(propValue);
|
238
|
+
}
|
239
|
+
// redundant return here for better minification
|
240
|
+
return propValue;
|
241
|
+
}
|
242
|
+
// not sure exactly what type we want
|
243
|
+
// so no need to change to a different type
|
244
|
+
return propValue;
|
245
|
+
};
|
246
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
247
|
+
const createEvent = (ref, name, flags) => {
|
248
|
+
const elm = getElement(ref);
|
249
|
+
return {
|
250
|
+
emit: (detail) => {
|
251
|
+
return emitEvent(elm, name, {
|
252
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
253
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
254
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
255
|
+
detail,
|
256
|
+
});
|
257
|
+
},
|
258
|
+
};
|
259
|
+
};
|
260
|
+
/**
|
261
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
262
|
+
* @param elm the target of the Event
|
263
|
+
* @param name the name to give the custom Event
|
264
|
+
* @param opts options for configuring a custom Event
|
265
|
+
* @returns the custom Event
|
266
|
+
*/
|
267
|
+
const emitEvent = (elm, name, opts) => {
|
268
|
+
const ev = plt.ce(name, opts);
|
269
|
+
elm.dispatchEvent(ev);
|
270
|
+
return ev;
|
271
|
+
};
|
272
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
273
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
274
|
+
let style = styles.get(scopeId);
|
275
|
+
if (supportsConstructableStylesheets && allowCS) {
|
276
|
+
style = (style || new CSSStyleSheet());
|
277
|
+
if (typeof style === 'string') {
|
278
|
+
style = cssText;
|
279
|
+
}
|
280
|
+
else {
|
281
|
+
style.replaceSync(cssText);
|
282
|
+
}
|
283
|
+
}
|
284
|
+
else {
|
285
|
+
style = cssText;
|
286
|
+
}
|
287
|
+
styles.set(scopeId, style);
|
288
|
+
};
|
289
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
290
|
+
let scopeId = getScopeId(cmpMeta);
|
291
|
+
const style = styles.get(scopeId);
|
292
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
293
|
+
// so the fallback is to always use the document for the root node in those cases
|
294
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
295
|
+
if (style) {
|
296
|
+
if (typeof style === 'string') {
|
297
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
298
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
299
|
+
let styleElm;
|
300
|
+
if (!appliedStyles) {
|
301
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
302
|
+
}
|
303
|
+
if (!appliedStyles.has(scopeId)) {
|
304
|
+
{
|
305
|
+
{
|
306
|
+
styleElm = doc.createElement('style');
|
307
|
+
styleElm.innerHTML = style;
|
308
|
+
}
|
309
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
310
|
+
}
|
311
|
+
if (appliedStyles) {
|
312
|
+
appliedStyles.add(scopeId);
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}
|
316
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
317
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
318
|
+
}
|
319
|
+
}
|
320
|
+
return scopeId;
|
321
|
+
};
|
322
|
+
const attachStyles = (hostRef) => {
|
323
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
324
|
+
const elm = hostRef.$hostElement$;
|
325
|
+
const flags = cmpMeta.$flags$;
|
326
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
327
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
328
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
329
|
+
// only required when we're NOT using native shadow dom (slot)
|
330
|
+
// or this browser doesn't support native shadow dom
|
331
|
+
// and this host element was NOT created with SSR
|
332
|
+
// let's pick out the inner content for slot projection
|
333
|
+
// create a node to represent where the original
|
334
|
+
// content was first placed, which is useful later on
|
335
|
+
// DOM WRITE!!
|
336
|
+
elm['s-sc'] = scopeId;
|
337
|
+
elm.classList.add(scopeId + '-h');
|
338
|
+
}
|
339
|
+
endAttachStyles();
|
340
|
+
};
|
341
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
342
|
+
/**
|
343
|
+
* Production setAccessor() function based on Preact by
|
344
|
+
* Jason Miller (@developit)
|
345
|
+
* Licensed under the MIT License
|
346
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
347
|
+
*
|
348
|
+
* Modified for Stencil's compiler and vdom
|
349
|
+
*/
|
350
|
+
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
351
|
+
if (oldValue !== newValue) {
|
352
|
+
let isProp = isMemberInElement(elm, memberName);
|
353
|
+
let ln = memberName.toLowerCase();
|
354
|
+
if (memberName === 'class') {
|
355
|
+
const classList = elm.classList;
|
356
|
+
const oldClasses = parseClassList(oldValue);
|
357
|
+
const newClasses = parseClassList(newValue);
|
358
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
359
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
360
|
+
}
|
361
|
+
else if (memberName === 'style') {
|
362
|
+
// update style attribute, css properties and values
|
363
|
+
{
|
364
|
+
for (const prop in oldValue) {
|
365
|
+
if (!newValue || newValue[prop] == null) {
|
366
|
+
if (prop.includes('-')) {
|
367
|
+
elm.style.removeProperty(prop);
|
368
|
+
}
|
369
|
+
else {
|
370
|
+
elm.style[prop] = '';
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
for (const prop in newValue) {
|
376
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
377
|
+
if (prop.includes('-')) {
|
378
|
+
elm.style.setProperty(prop, newValue[prop]);
|
379
|
+
}
|
380
|
+
else {
|
381
|
+
elm.style[prop] = newValue[prop];
|
382
|
+
}
|
383
|
+
}
|
384
|
+
}
|
385
|
+
}
|
386
|
+
else if (memberName === 'key')
|
387
|
+
;
|
388
|
+
else if (memberName === 'ref') {
|
389
|
+
// minifier will clean this up
|
390
|
+
if (newValue) {
|
391
|
+
newValue(elm);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
else if ((!isProp ) &&
|
395
|
+
memberName[0] === 'o' &&
|
396
|
+
memberName[1] === 'n') {
|
397
|
+
// Event Handlers
|
398
|
+
// so if the member name starts with "on" and the 3rd characters is
|
399
|
+
// a capital letter, and it's not already a member on the element,
|
400
|
+
// then we're assuming it's an event listener
|
401
|
+
if (memberName[2] === '-') {
|
402
|
+
// on- prefixed events
|
403
|
+
// allows to be explicit about the dom event to listen without any magic
|
404
|
+
// under the hood:
|
405
|
+
// <my-cmp on-click> // listens for "click"
|
406
|
+
// <my-cmp on-Click> // listens for "Click"
|
407
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
408
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
409
|
+
memberName = memberName.slice(3);
|
410
|
+
}
|
411
|
+
else if (isMemberInElement(win, ln)) {
|
412
|
+
// standard event
|
413
|
+
// the JSX attribute could have been "onMouseOver" and the
|
414
|
+
// member name "onmouseover" is on the window's prototype
|
415
|
+
// so let's add the listener "mouseover", which is all lowercased
|
416
|
+
memberName = ln.slice(2);
|
417
|
+
}
|
418
|
+
else {
|
419
|
+
// custom event
|
420
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
421
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
422
|
+
// and add the listener "myCustomEvent"
|
423
|
+
// except for the first character, we keep the event name case
|
424
|
+
memberName = ln[2] + memberName.slice(3);
|
425
|
+
}
|
426
|
+
if (oldValue) {
|
427
|
+
plt.rel(elm, memberName, oldValue, false);
|
428
|
+
}
|
429
|
+
if (newValue) {
|
430
|
+
plt.ael(elm, memberName, newValue, false);
|
431
|
+
}
|
432
|
+
}
|
433
|
+
else {
|
434
|
+
// Set property if it exists and it's not a SVG
|
435
|
+
const isComplex = isComplexType(newValue);
|
436
|
+
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
437
|
+
try {
|
438
|
+
if (!elm.tagName.includes('-')) {
|
439
|
+
const n = newValue == null ? '' : newValue;
|
440
|
+
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
441
|
+
if (memberName === 'list') {
|
442
|
+
isProp = false;
|
443
|
+
}
|
444
|
+
else if (oldValue == null || elm[memberName] != n) {
|
445
|
+
elm[memberName] = n;
|
446
|
+
}
|
447
|
+
}
|
448
|
+
else {
|
449
|
+
elm[memberName] = newValue;
|
450
|
+
}
|
451
|
+
}
|
452
|
+
catch (e) { }
|
453
|
+
}
|
454
|
+
/**
|
455
|
+
* Need to manually update attribute if:
|
456
|
+
* - memberName is not an attribute
|
457
|
+
* - if we are rendering the host element in order to reflect attribute
|
458
|
+
* - if it's a SVG, since properties might not work in <svg>
|
459
|
+
* - if the newValue is null/undefined or 'false'.
|
460
|
+
*/
|
461
|
+
let xlink = false;
|
462
|
+
{
|
463
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
464
|
+
memberName = ln;
|
465
|
+
xlink = true;
|
466
|
+
}
|
467
|
+
}
|
468
|
+
if (newValue == null || newValue === false) {
|
469
|
+
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
470
|
+
if (xlink) {
|
471
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
472
|
+
}
|
473
|
+
else {
|
474
|
+
elm.removeAttribute(memberName);
|
475
|
+
}
|
476
|
+
}
|
477
|
+
}
|
478
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
479
|
+
newValue = newValue === true ? '' : newValue;
|
480
|
+
if (xlink) {
|
481
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
482
|
+
}
|
483
|
+
else {
|
484
|
+
elm.setAttribute(memberName, newValue);
|
485
|
+
}
|
486
|
+
}
|
487
|
+
}
|
488
|
+
}
|
489
|
+
};
|
490
|
+
const parseClassListRegex = /\s/;
|
491
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
492
|
+
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
493
|
+
// if the element passed in is a shadow root, which is a document fragment
|
494
|
+
// then we want to be adding attrs/props to the shadow root's "host" element
|
495
|
+
// if it's not a shadow root, then we add attrs/props to the same element
|
496
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
497
|
+
? newVnode.$elm$.host
|
498
|
+
: newVnode.$elm$;
|
499
|
+
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
500
|
+
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
501
|
+
{
|
502
|
+
// remove attributes no longer present on the vnode by setting them to undefined
|
503
|
+
for (memberName in oldVnodeAttrs) {
|
504
|
+
if (!(memberName in newVnodeAttrs)) {
|
505
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
506
|
+
}
|
507
|
+
}
|
508
|
+
}
|
509
|
+
// add new & update changed attributes
|
510
|
+
for (memberName in newVnodeAttrs) {
|
511
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
512
|
+
}
|
513
|
+
};
|
514
|
+
/**
|
515
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
516
|
+
*
|
517
|
+
* @param oldParentVNode the parent VNode from the previous render
|
518
|
+
* @param newParentVNode the parent VNode from the current render
|
519
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
520
|
+
* children, for which we will create a new DOM node
|
521
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
522
|
+
* @returns the newly created node
|
523
|
+
*/
|
524
|
+
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
525
|
+
// tslint:disable-next-line: prefer-const
|
526
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
527
|
+
let i = 0;
|
528
|
+
let elm;
|
529
|
+
let childNode;
|
530
|
+
let oldVNode;
|
531
|
+
if (!useNativeShadowDom) {
|
532
|
+
// remember for later we need to check to relocate nodes
|
533
|
+
checkSlotRelocate = true;
|
534
|
+
if (newVNode.$tag$ === 'slot') {
|
535
|
+
if (scopeId) {
|
536
|
+
// scoped css needs to add its scoped id to the parent element
|
537
|
+
parentElm.classList.add(scopeId + '-s');
|
538
|
+
}
|
539
|
+
newVNode.$flags$ |= newVNode.$children$
|
540
|
+
? // slot element has fallback content
|
541
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
542
|
+
: // slot element does not have fallback content
|
543
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
544
|
+
}
|
545
|
+
}
|
546
|
+
if (newVNode.$text$ !== null) {
|
547
|
+
// create text node
|
548
|
+
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
549
|
+
}
|
550
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
551
|
+
// create a slot reference node
|
552
|
+
elm = newVNode.$elm$ =
|
553
|
+
doc.createTextNode('');
|
554
|
+
}
|
555
|
+
else {
|
556
|
+
if (!isSvgMode) {
|
557
|
+
isSvgMode = newVNode.$tag$ === 'svg';
|
558
|
+
}
|
559
|
+
// create element
|
560
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
561
|
+
? 'slot-fb'
|
562
|
+
: newVNode.$tag$)
|
563
|
+
);
|
564
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
565
|
+
isSvgMode = false;
|
566
|
+
}
|
567
|
+
// add css classes, attrs, props, listeners, etc.
|
568
|
+
{
|
569
|
+
updateElement(null, newVNode, isSvgMode);
|
570
|
+
}
|
571
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
572
|
+
// if there is a scopeId and this is the initial render
|
573
|
+
// then let's add the scopeId as a css class
|
574
|
+
elm.classList.add((elm['s-si'] = scopeId));
|
575
|
+
}
|
576
|
+
if (newVNode.$children$) {
|
577
|
+
for (i = 0; i < newVNode.$children$.length; ++i) {
|
578
|
+
// create the node
|
579
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
580
|
+
// return node could have been null
|
581
|
+
if (childNode) {
|
582
|
+
// append our new node
|
583
|
+
elm.appendChild(childNode);
|
584
|
+
}
|
585
|
+
}
|
586
|
+
}
|
587
|
+
{
|
588
|
+
if (newVNode.$tag$ === 'svg') {
|
589
|
+
// Only reset the SVG context when we're exiting <svg> element
|
590
|
+
isSvgMode = false;
|
591
|
+
}
|
592
|
+
else if (elm.tagName === 'foreignObject') {
|
593
|
+
// Reenter SVG context when we're exiting <foreignObject> element
|
594
|
+
isSvgMode = true;
|
595
|
+
}
|
596
|
+
}
|
597
|
+
}
|
598
|
+
{
|
599
|
+
elm['s-hn'] = hostTagName;
|
600
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
601
|
+
// remember the content reference comment
|
602
|
+
elm['s-sr'] = true;
|
603
|
+
// remember the content reference comment
|
604
|
+
elm['s-cr'] = contentRef;
|
605
|
+
// remember the slot name, or empty string for default slot
|
606
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
607
|
+
// check if we've got an old vnode for this slot
|
608
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
609
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
610
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
611
|
+
// so let's move the old slot content back to it's original location
|
612
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
613
|
+
}
|
614
|
+
}
|
615
|
+
}
|
616
|
+
return elm;
|
617
|
+
};
|
618
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
619
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
620
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
621
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
622
|
+
const childNode = oldSlotChildNodes[i];
|
623
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
624
|
+
// // this child node in the old element is from another component
|
625
|
+
// // remove this node from the old slot's parent
|
626
|
+
// childNode.remove();
|
627
|
+
// and relocate it back to it's original location
|
628
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
629
|
+
// remove the old original location comment entirely
|
630
|
+
// later on the patch function will know what to do
|
631
|
+
// and move this to the correct spot in need be
|
632
|
+
childNode['s-ol'].remove();
|
633
|
+
childNode['s-ol'] = undefined;
|
634
|
+
checkSlotRelocate = true;
|
635
|
+
}
|
636
|
+
if (recursive) {
|
637
|
+
putBackInOriginalLocation(childNode, recursive);
|
638
|
+
}
|
639
|
+
}
|
640
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
641
|
+
};
|
642
|
+
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
643
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
644
|
+
let childNode;
|
645
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
646
|
+
containerElm = containerElm.shadowRoot;
|
647
|
+
}
|
648
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
649
|
+
if (vnodes[startIdx]) {
|
650
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
651
|
+
if (childNode) {
|
652
|
+
vnodes[startIdx].$elm$ = childNode;
|
653
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
654
|
+
}
|
655
|
+
}
|
656
|
+
}
|
657
|
+
};
|
658
|
+
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
659
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
660
|
+
if ((vnode = vnodes[startIdx])) {
|
661
|
+
elm = vnode.$elm$;
|
662
|
+
callNodeRefs(vnode);
|
663
|
+
{
|
664
|
+
// we're removing this element
|
665
|
+
// so it's possible we need to show slot fallback content now
|
666
|
+
checkSlotFallbackVisibility = true;
|
667
|
+
if (elm['s-ol']) {
|
668
|
+
// remove the original location comment
|
669
|
+
elm['s-ol'].remove();
|
670
|
+
}
|
671
|
+
else {
|
672
|
+
// it's possible that child nodes of the node
|
673
|
+
// that's being removed are slot nodes
|
674
|
+
putBackInOriginalLocation(elm, true);
|
675
|
+
}
|
676
|
+
}
|
677
|
+
// remove the vnode's element from the dom
|
678
|
+
elm.remove();
|
679
|
+
}
|
680
|
+
}
|
681
|
+
};
|
682
|
+
/**
|
683
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
684
|
+
* traversing the two collections of children, identifying nodes that are
|
685
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
686
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
687
|
+
*
|
688
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
689
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
690
|
+
* 'windows' by storing start and end indices and references to the
|
691
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
692
|
+
* to the entire array, but we progressively narrow the windows until there are
|
693
|
+
* no children left to update by doing the following:
|
694
|
+
*
|
695
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
696
|
+
* that if we have an initial array like the following we'll end up dealing
|
697
|
+
* only with a window bounded by the highlighted elements:
|
698
|
+
*
|
699
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
700
|
+
* ^^^^^^ ^^^^^^
|
701
|
+
*
|
702
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
703
|
+
* across the windows. This will basically detect elements which haven't
|
704
|
+
* been added, removed, or changed position, i.e. if you had the following
|
705
|
+
* VNode elements (represented as HTML):
|
706
|
+
*
|
707
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
708
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
709
|
+
*
|
710
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
711
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
712
|
+
* same tag in the same position, we'd be able to avoid completely
|
713
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
714
|
+
* call out to `patch` to handle reconciling their children and so on.
|
715
|
+
*
|
716
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
717
|
+
* window corresponds to the element at the end of the other window. This is
|
718
|
+
* a heuristic which will let us identify _some_ situations in which
|
719
|
+
* elements have changed position, for instance it _should_ detect that the
|
720
|
+
* children nodes themselves have not changed but merely moved in the
|
721
|
+
* following example:
|
722
|
+
*
|
723
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
724
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
725
|
+
*
|
726
|
+
* If we find cases like this then we also need to move the concrete DOM
|
727
|
+
* elements corresponding to the moved children to write the re-order to the
|
728
|
+
* DOM.
|
729
|
+
*
|
730
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
731
|
+
* nodes in the old children which have the same key as the first element in
|
732
|
+
* our window on the new children. If we find such a node we handle calling
|
733
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
734
|
+
* what we find.
|
735
|
+
*
|
736
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
737
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
738
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
739
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
740
|
+
* children has collapsed we still have more nodes on the new children that
|
741
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
742
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
743
|
+
* sure the corresponding DOM nodes are removed.
|
744
|
+
*
|
745
|
+
* @param parentElm the node into which the parent VNode is rendered
|
746
|
+
* @param oldCh the old children of the parent node
|
747
|
+
* @param newVNode the new VNode which will replace the parent
|
748
|
+
* @param newCh the new children of the parent node
|
749
|
+
*/
|
750
|
+
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
751
|
+
let oldStartIdx = 0;
|
752
|
+
let newStartIdx = 0;
|
753
|
+
let idxInOld = 0;
|
754
|
+
let i = 0;
|
755
|
+
let oldEndIdx = oldCh.length - 1;
|
756
|
+
let oldStartVnode = oldCh[0];
|
757
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
758
|
+
let newEndIdx = newCh.length - 1;
|
759
|
+
let newStartVnode = newCh[0];
|
760
|
+
let newEndVnode = newCh[newEndIdx];
|
761
|
+
let node;
|
762
|
+
let elmToMove;
|
763
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
764
|
+
if (oldStartVnode == null) {
|
765
|
+
// VNode might have been moved left
|
766
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
767
|
+
}
|
768
|
+
else if (oldEndVnode == null) {
|
769
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
770
|
+
}
|
771
|
+
else if (newStartVnode == null) {
|
772
|
+
newStartVnode = newCh[++newStartIdx];
|
773
|
+
}
|
774
|
+
else if (newEndVnode == null) {
|
775
|
+
newEndVnode = newCh[--newEndIdx];
|
776
|
+
}
|
777
|
+
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
778
|
+
// if the start nodes are the same then we should patch the new VNode
|
779
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
780
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
781
|
+
// since things are matched up in order.
|
782
|
+
patch(oldStartVnode, newStartVnode);
|
783
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
784
|
+
newStartVnode = newCh[++newStartIdx];
|
785
|
+
}
|
786
|
+
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
787
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
788
|
+
// decrement our end indices, and also likewise in this case we don't
|
789
|
+
// need to move any DOM Nodes.
|
790
|
+
patch(oldEndVnode, newEndVnode);
|
791
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
792
|
+
newEndVnode = newCh[--newEndIdx];
|
793
|
+
}
|
794
|
+
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
795
|
+
// case: "Vnode moved right"
|
796
|
+
//
|
797
|
+
// We've found that the last node in our window on the new children is
|
798
|
+
// the same VNode as the _first_ node in our window on the old children
|
799
|
+
// we're dealing with now. Visually, this is the layout of these two
|
800
|
+
// nodes:
|
801
|
+
//
|
802
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
803
|
+
// ^^^^^^^^^^^
|
804
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
805
|
+
// ^^^^^^^^^^^^^
|
806
|
+
//
|
807
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
808
|
+
// and move the DOM element for `oldStartVnode`.
|
809
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
810
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
811
|
+
}
|
812
|
+
patch(oldStartVnode, newEndVnode);
|
813
|
+
// We need to move the element for `oldStartVnode` into a position which
|
814
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
815
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
816
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
817
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
818
|
+
//
|
819
|
+
// <old-start-node />
|
820
|
+
// <some-intervening-node />
|
821
|
+
// <old-end-node />
|
822
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
823
|
+
// <next-sibling />
|
824
|
+
//
|
825
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
826
|
+
// the node for `oldStartVnode` at the end of the children of
|
827
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
828
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
829
|
+
// append it to the children of the parent element.
|
830
|
+
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
831
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
832
|
+
newEndVnode = newCh[--newEndIdx];
|
833
|
+
}
|
834
|
+
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
835
|
+
// case: "Vnode moved left"
|
836
|
+
//
|
837
|
+
// We've found that the first node in our window on the new children is
|
838
|
+
// the same VNode as the _last_ node in our window on the old children.
|
839
|
+
// Visually, this is the layout of these two nodes:
|
840
|
+
//
|
841
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
842
|
+
// ^^^^^^^^^^^^^
|
843
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
844
|
+
// ^^^^^^^^^^^
|
845
|
+
//
|
846
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
847
|
+
// (which will handle updating any changed attributes, reconciling their
|
848
|
+
// children etc) but we also need to move the DOM node to which
|
849
|
+
// `oldEndVnode` corresponds.
|
850
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
851
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
852
|
+
}
|
853
|
+
patch(oldEndVnode, newStartVnode);
|
854
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
855
|
+
// the same node, so since we're here we know that they are not. Thus we
|
856
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
857
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
858
|
+
// future.
|
859
|
+
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
860
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
861
|
+
newStartVnode = newCh[++newStartIdx];
|
862
|
+
}
|
863
|
+
else {
|
864
|
+
// Here we do some checks to match up old and new nodes based on the
|
865
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
866
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
867
|
+
// component.
|
868
|
+
//
|
869
|
+
// First we check to see if there are any nodes in the array of old
|
870
|
+
// children which have the same key as the first node in the new
|
871
|
+
// children.
|
872
|
+
idxInOld = -1;
|
873
|
+
{
|
874
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
875
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
876
|
+
idxInOld = i;
|
877
|
+
break;
|
878
|
+
}
|
879
|
+
}
|
880
|
+
}
|
881
|
+
if (idxInOld >= 0) {
|
882
|
+
// We found a node in the old children which matches up with the first
|
883
|
+
// node in the new children! So let's deal with that
|
884
|
+
elmToMove = oldCh[idxInOld];
|
885
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
886
|
+
// the tag doesn't match so we'll need a new DOM element
|
887
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
888
|
+
}
|
889
|
+
else {
|
890
|
+
patch(elmToMove, newStartVnode);
|
891
|
+
// invalidate the matching old node so that we won't try to update it
|
892
|
+
// again later on
|
893
|
+
oldCh[idxInOld] = undefined;
|
894
|
+
node = elmToMove.$elm$;
|
895
|
+
}
|
896
|
+
newStartVnode = newCh[++newStartIdx];
|
897
|
+
}
|
898
|
+
else {
|
899
|
+
// We either didn't find an element in the old children that matches
|
900
|
+
// the key of the first new child OR the build is not using `key`
|
901
|
+
// attributes at all. In either case we need to create a new element
|
902
|
+
// for the new node.
|
903
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
904
|
+
newStartVnode = newCh[++newStartIdx];
|
905
|
+
}
|
906
|
+
if (node) {
|
907
|
+
// if we created a new node then handle inserting it to the DOM
|
908
|
+
{
|
909
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
910
|
+
}
|
911
|
+
}
|
912
|
+
}
|
913
|
+
}
|
914
|
+
if (oldStartIdx > oldEndIdx) {
|
915
|
+
// we have some more new nodes to add which don't match up with old nodes
|
916
|
+
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
917
|
+
}
|
918
|
+
else if (newStartIdx > newEndIdx) {
|
919
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
920
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
921
|
+
// relevant DOM nodes)
|
922
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
923
|
+
}
|
924
|
+
};
|
925
|
+
/**
|
926
|
+
* Compare two VNodes to determine if they are the same
|
927
|
+
*
|
928
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
929
|
+
* information set on the two VNodes and can be misleading under certain
|
930
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
931
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
932
|
+
* checking that they have the same tag.
|
933
|
+
*
|
934
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
935
|
+
* changing order within a `children` array or something along those lines then
|
936
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
937
|
+
*
|
938
|
+
* @param leftVNode the first VNode to check
|
939
|
+
* @param rightVNode the second VNode to check
|
940
|
+
* @returns whether they're equal or not
|
941
|
+
*/
|
942
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
943
|
+
// compare if two vnode to see if they're "technically" the same
|
944
|
+
// need to have the same element tag, and same key to be the same
|
945
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
946
|
+
if (leftVNode.$tag$ === 'slot') {
|
947
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
948
|
+
}
|
949
|
+
// this will be set if components in the build have `key` attrs set on them
|
950
|
+
{
|
951
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
952
|
+
}
|
953
|
+
}
|
954
|
+
return false;
|
955
|
+
};
|
956
|
+
const referenceNode = (node) => {
|
957
|
+
// this node was relocated to a new location in the dom
|
958
|
+
// because of some other component's slot
|
959
|
+
// but we still have an html comment in place of where
|
960
|
+
// it's original location was according to it's original vdom
|
961
|
+
return (node && node['s-ol']) || node;
|
962
|
+
};
|
963
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
964
|
+
/**
|
965
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
966
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
967
|
+
* children of the two nodes (if any).
|
968
|
+
*
|
969
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
970
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
971
|
+
*/
|
972
|
+
const patch = (oldVNode, newVNode) => {
|
973
|
+
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
974
|
+
const oldChildren = oldVNode.$children$;
|
975
|
+
const newChildren = newVNode.$children$;
|
976
|
+
const tag = newVNode.$tag$;
|
977
|
+
const text = newVNode.$text$;
|
978
|
+
let defaultHolder;
|
979
|
+
if (text === null) {
|
980
|
+
{
|
981
|
+
// test if we're rendering an svg element, or still rendering nodes inside of one
|
982
|
+
// only add this to the when the compiler sees we're using an svg somewhere
|
983
|
+
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
984
|
+
}
|
985
|
+
{
|
986
|
+
if (tag === 'slot')
|
987
|
+
;
|
988
|
+
else {
|
989
|
+
// either this is the first render of an element OR it's an update
|
990
|
+
// AND we already know it's possible it could have changed
|
991
|
+
// this updates the element's css classes, attrs, props, listeners, etc.
|
992
|
+
updateElement(oldVNode, newVNode, isSvgMode);
|
993
|
+
}
|
994
|
+
}
|
995
|
+
if (oldChildren !== null && newChildren !== null) {
|
996
|
+
// looks like there's child vnodes for both the old and new vnodes
|
997
|
+
// so we need to call `updateChildren` to reconcile them
|
998
|
+
updateChildren(elm, oldChildren, newVNode, newChildren);
|
999
|
+
}
|
1000
|
+
else if (newChildren !== null) {
|
1001
|
+
// no old child vnodes, but there are new child vnodes to add
|
1002
|
+
if (oldVNode.$text$ !== null) {
|
1003
|
+
// the old vnode was text, so be sure to clear it out
|
1004
|
+
elm.textContent = '';
|
1005
|
+
}
|
1006
|
+
// add the new vnode children
|
1007
|
+
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
1008
|
+
}
|
1009
|
+
else if (oldChildren !== null) {
|
1010
|
+
// no new child vnodes, but there are old child vnodes to remove
|
1011
|
+
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
1012
|
+
}
|
1013
|
+
if (isSvgMode && tag === 'svg') {
|
1014
|
+
isSvgMode = false;
|
1015
|
+
}
|
1016
|
+
}
|
1017
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
1018
|
+
// this element has slotted content
|
1019
|
+
defaultHolder.parentNode.textContent = text;
|
1020
|
+
}
|
1021
|
+
else if (oldVNode.$text$ !== text) {
|
1022
|
+
// update the text content for the text only vnode
|
1023
|
+
// and also only if the text is different than before
|
1024
|
+
elm.data = text;
|
1025
|
+
}
|
1026
|
+
};
|
1027
|
+
const updateFallbackSlotVisibility = (elm) => {
|
1028
|
+
// tslint:disable-next-line: prefer-const
|
1029
|
+
const childNodes = elm.childNodes;
|
1030
|
+
let childNode;
|
1031
|
+
let i;
|
1032
|
+
let ilen;
|
1033
|
+
let j;
|
1034
|
+
let slotNameAttr;
|
1035
|
+
let nodeType;
|
1036
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
1037
|
+
childNode = childNodes[i];
|
1038
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1039
|
+
if (childNode['s-sr']) {
|
1040
|
+
// this is a slot fallback node
|
1041
|
+
// get the slot name for this slot reference node
|
1042
|
+
slotNameAttr = childNode['s-sn'];
|
1043
|
+
// by default always show a fallback slot node
|
1044
|
+
// then hide it if there are other slots in the light dom
|
1045
|
+
childNode.hidden = false;
|
1046
|
+
for (j = 0; j < ilen; j++) {
|
1047
|
+
nodeType = childNodes[j].nodeType;
|
1048
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
1049
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
1050
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
1051
|
+
childNode.hidden = true;
|
1052
|
+
break;
|
1053
|
+
}
|
1054
|
+
}
|
1055
|
+
else {
|
1056
|
+
// this is a default fallback slot node
|
1057
|
+
// any element or text node (with content)
|
1058
|
+
// should hide the default fallback slot node
|
1059
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
1060
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
1061
|
+
childNode.hidden = true;
|
1062
|
+
break;
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
// keep drilling down
|
1068
|
+
updateFallbackSlotVisibility(childNode);
|
1069
|
+
}
|
1070
|
+
}
|
1071
|
+
};
|
1072
|
+
const relocateNodes = [];
|
1073
|
+
const relocateSlotContent = (elm) => {
|
1074
|
+
// tslint:disable-next-line: prefer-const
|
1075
|
+
let childNode;
|
1076
|
+
let node;
|
1077
|
+
let hostContentNodes;
|
1078
|
+
let slotNameAttr;
|
1079
|
+
let relocateNodeData;
|
1080
|
+
let j;
|
1081
|
+
let i = 0;
|
1082
|
+
const childNodes = elm.childNodes;
|
1083
|
+
const ilen = childNodes.length;
|
1084
|
+
for (; i < ilen; i++) {
|
1085
|
+
childNode = childNodes[i];
|
1086
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
1087
|
+
// first got the content reference comment node
|
1088
|
+
// then we got it's parent, which is where all the host content is in now
|
1089
|
+
hostContentNodes = node.parentNode.childNodes;
|
1090
|
+
slotNameAttr = childNode['s-sn'];
|
1091
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
1092
|
+
node = hostContentNodes[j];
|
1093
|
+
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
1094
|
+
// let's do some relocating to its new home
|
1095
|
+
// but never relocate a content reference node
|
1096
|
+
// that is suppose to always represent the original content location
|
1097
|
+
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
1098
|
+
// it's possible we've already decided to relocate this node
|
1099
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
1100
|
+
// made some changes to slots
|
1101
|
+
// let's make sure we also double check
|
1102
|
+
// fallbacks are correctly hidden or shown
|
1103
|
+
checkSlotFallbackVisibility = true;
|
1104
|
+
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
1105
|
+
if (relocateNodeData) {
|
1106
|
+
// previously we never found a slot home for this node
|
1107
|
+
// but turns out we did, so let's remember it now
|
1108
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
1109
|
+
}
|
1110
|
+
else {
|
1111
|
+
// add to our list of nodes to relocate
|
1112
|
+
relocateNodes.push({
|
1113
|
+
$slotRefNode$: childNode,
|
1114
|
+
$nodeToRelocate$: node,
|
1115
|
+
});
|
1116
|
+
}
|
1117
|
+
if (node['s-sr']) {
|
1118
|
+
relocateNodes.map((relocateNode) => {
|
1119
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
1120
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
1121
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
1122
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
1123
|
+
}
|
1124
|
+
}
|
1125
|
+
});
|
1126
|
+
}
|
1127
|
+
}
|
1128
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
1129
|
+
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
1130
|
+
// if we never find a home for this element then we'll need to hide it
|
1131
|
+
relocateNodes.push({
|
1132
|
+
$nodeToRelocate$: node,
|
1133
|
+
});
|
1134
|
+
}
|
1135
|
+
}
|
1136
|
+
}
|
1137
|
+
}
|
1138
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1139
|
+
relocateSlotContent(childNode);
|
1140
|
+
}
|
1141
|
+
}
|
1142
|
+
};
|
1143
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
1144
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1145
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
1146
|
+
return true;
|
1147
|
+
}
|
1148
|
+
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
1149
|
+
return true;
|
1150
|
+
}
|
1151
|
+
return false;
|
1152
|
+
}
|
1153
|
+
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
1154
|
+
return true;
|
1155
|
+
}
|
1156
|
+
return slotNameAttr === '';
|
1157
|
+
};
|
1158
|
+
const callNodeRefs = (vNode) => {
|
1159
|
+
{
|
1160
|
+
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
1161
|
+
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
1162
|
+
}
|
1163
|
+
};
|
1164
|
+
const renderVdom = (hostRef, renderFnResults) => {
|
1165
|
+
const hostElm = hostRef.$hostElement$;
|
1166
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
1167
|
+
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
1168
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
1169
|
+
hostTagName = hostElm.tagName;
|
1170
|
+
if (cmpMeta.$attrsToReflect$) {
|
1171
|
+
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
1172
|
+
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
1173
|
+
}
|
1174
|
+
rootVnode.$tag$ = null;
|
1175
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
1176
|
+
hostRef.$vnode$ = rootVnode;
|
1177
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
1178
|
+
{
|
1179
|
+
scopeId = hostElm['s-sc'];
|
1180
|
+
}
|
1181
|
+
{
|
1182
|
+
contentRef = hostElm['s-cr'];
|
1183
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
1184
|
+
// always reset
|
1185
|
+
checkSlotFallbackVisibility = false;
|
1186
|
+
}
|
1187
|
+
// synchronous patch
|
1188
|
+
patch(oldVNode, rootVnode);
|
1189
|
+
{
|
1190
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
1191
|
+
// the disconnectCallback from working
|
1192
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
1193
|
+
if (checkSlotRelocate) {
|
1194
|
+
relocateSlotContent(rootVnode.$elm$);
|
1195
|
+
let relocateData;
|
1196
|
+
let nodeToRelocate;
|
1197
|
+
let orgLocationNode;
|
1198
|
+
let parentNodeRef;
|
1199
|
+
let insertBeforeNode;
|
1200
|
+
let refNode;
|
1201
|
+
let i = 0;
|
1202
|
+
for (; i < relocateNodes.length; i++) {
|
1203
|
+
relocateData = relocateNodes[i];
|
1204
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
1205
|
+
if (!nodeToRelocate['s-ol']) {
|
1206
|
+
// add a reference node marking this node's original location
|
1207
|
+
// keep a reference to this node for later lookups
|
1208
|
+
orgLocationNode =
|
1209
|
+
doc.createTextNode('');
|
1210
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
1211
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
for (i = 0; i < relocateNodes.length; i++) {
|
1215
|
+
relocateData = relocateNodes[i];
|
1216
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
1217
|
+
if (relocateData.$slotRefNode$) {
|
1218
|
+
// by default we're just going to insert it directly
|
1219
|
+
// after the slot reference node
|
1220
|
+
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
1221
|
+
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
1222
|
+
orgLocationNode = nodeToRelocate['s-ol'];
|
1223
|
+
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
1224
|
+
refNode = orgLocationNode['s-nr'];
|
1225
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
1226
|
+
refNode = refNode.nextSibling;
|
1227
|
+
if (!refNode || !refNode['s-nr']) {
|
1228
|
+
insertBeforeNode = refNode;
|
1229
|
+
break;
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
}
|
1233
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
1234
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
1235
|
+
// we've checked that it's worth while to relocate
|
1236
|
+
// since that the node to relocate
|
1237
|
+
// has a different next sibling or parent relocated
|
1238
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
1239
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
1240
|
+
// probably a component in the index.html that doesn't have it's hostname set
|
1241
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
1242
|
+
}
|
1243
|
+
// add it back to the dom but in its new home
|
1244
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
1245
|
+
}
|
1246
|
+
}
|
1247
|
+
}
|
1248
|
+
else {
|
1249
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
1250
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1251
|
+
nodeToRelocate.hidden = true;
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
}
|
1255
|
+
}
|
1256
|
+
if (checkSlotFallbackVisibility) {
|
1257
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
1258
|
+
}
|
1259
|
+
// done moving nodes around
|
1260
|
+
// allow the disconnect callback to work again
|
1261
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
1262
|
+
// always reset
|
1263
|
+
relocateNodes.length = 0;
|
1264
|
+
}
|
1265
|
+
};
|
1266
|
+
const attachToAncestor = (hostRef, ancestorComponent) => {
|
1267
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
1268
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
1269
|
+
}
|
1270
|
+
};
|
1271
|
+
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
1272
|
+
{
|
1273
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
1274
|
+
}
|
1275
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
1276
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
1277
|
+
return;
|
1278
|
+
}
|
1279
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
1280
|
+
// there is no ancestor component or the ancestor component
|
1281
|
+
// has already fired off its lifecycle update then
|
1282
|
+
// fire off the initial update
|
1283
|
+
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
1284
|
+
return writeTask(dispatch) ;
|
1285
|
+
};
|
1286
|
+
const dispatchHooks = (hostRef, isInitialLoad) => {
|
1287
|
+
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
1288
|
+
const instance = hostRef.$lazyInstance$ ;
|
1289
|
+
let promise;
|
1290
|
+
if (isInitialLoad) {
|
1291
|
+
{
|
1292
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
1293
|
+
if (hostRef.$queuedListeners$) {
|
1294
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
1295
|
+
hostRef.$queuedListeners$ = null;
|
1296
|
+
}
|
1297
|
+
}
|
1298
|
+
{
|
1299
|
+
promise = safeCall(instance, 'componentWillLoad');
|
1300
|
+
}
|
1301
|
+
}
|
1302
|
+
{
|
1303
|
+
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
|
1304
|
+
}
|
1305
|
+
endSchedule();
|
1306
|
+
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
1307
|
+
};
|
1308
|
+
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
1309
|
+
// updateComponent
|
1310
|
+
const elm = hostRef.$hostElement$;
|
1311
|
+
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
1312
|
+
const rc = elm['s-rc'];
|
1313
|
+
if (isInitialLoad) {
|
1314
|
+
// DOM WRITE!
|
1315
|
+
attachStyles(hostRef);
|
1316
|
+
}
|
1317
|
+
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
1318
|
+
{
|
1319
|
+
callRender(hostRef, instance);
|
1320
|
+
}
|
1321
|
+
if (rc) {
|
1322
|
+
// ok, so turns out there are some child host elements
|
1323
|
+
// waiting on this parent element to load
|
1324
|
+
// let's fire off all update callbacks waiting
|
1325
|
+
rc.map((cb) => cb());
|
1326
|
+
elm['s-rc'] = undefined;
|
1327
|
+
}
|
1328
|
+
endRender();
|
1329
|
+
endUpdate();
|
1330
|
+
{
|
1331
|
+
const childrenPromises = elm['s-p'];
|
1332
|
+
const postUpdate = () => postUpdateComponent(hostRef);
|
1333
|
+
if (childrenPromises.length === 0) {
|
1334
|
+
postUpdate();
|
1335
|
+
}
|
1336
|
+
else {
|
1337
|
+
Promise.all(childrenPromises).then(postUpdate);
|
1338
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
1339
|
+
childrenPromises.length = 0;
|
1340
|
+
}
|
1341
|
+
}
|
1342
|
+
};
|
1343
|
+
const callRender = (hostRef, instance, elm) => {
|
1344
|
+
try {
|
1345
|
+
renderingRef = instance;
|
1346
|
+
instance = instance.render() ;
|
1347
|
+
{
|
1348
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
1349
|
+
}
|
1350
|
+
{
|
1351
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
1352
|
+
}
|
1353
|
+
{
|
1354
|
+
{
|
1355
|
+
// looks like we've got child nodes to render into this host element
|
1356
|
+
// or we need to update the css class/attrs on the host element
|
1357
|
+
// DOM WRITE!
|
1358
|
+
{
|
1359
|
+
renderVdom(hostRef, instance);
|
1360
|
+
}
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
catch (e) {
|
1365
|
+
consoleError(e, hostRef.$hostElement$);
|
1366
|
+
}
|
1367
|
+
renderingRef = null;
|
1368
|
+
return null;
|
1369
|
+
};
|
1370
|
+
const getRenderingRef = () => renderingRef;
|
1371
|
+
const postUpdateComponent = (hostRef) => {
|
1372
|
+
const tagName = hostRef.$cmpMeta$.$tagName$;
|
1373
|
+
const elm = hostRef.$hostElement$;
|
1374
|
+
const endPostUpdate = createTime('postUpdate', tagName);
|
1375
|
+
const instance = hostRef.$lazyInstance$ ;
|
1376
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
1377
|
+
{
|
1378
|
+
safeCall(instance, 'componentDidRender');
|
1379
|
+
}
|
1380
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
1381
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
1382
|
+
{
|
1383
|
+
// DOM WRITE!
|
1384
|
+
addHydratedFlag(elm);
|
1385
|
+
}
|
1386
|
+
{
|
1387
|
+
safeCall(instance, 'componentDidLoad');
|
1388
|
+
}
|
1389
|
+
endPostUpdate();
|
1390
|
+
{
|
1391
|
+
hostRef.$onReadyResolve$(elm);
|
1392
|
+
if (!ancestorComponent) {
|
1393
|
+
appDidLoad();
|
1394
|
+
}
|
1395
|
+
}
|
1396
|
+
}
|
1397
|
+
else {
|
1398
|
+
endPostUpdate();
|
1399
|
+
}
|
1400
|
+
{
|
1401
|
+
hostRef.$onInstanceResolve$(elm);
|
1402
|
+
}
|
1403
|
+
// load events fire from bottom to top
|
1404
|
+
// the deepest elements load first then bubbles up
|
1405
|
+
{
|
1406
|
+
if (hostRef.$onRenderResolve$) {
|
1407
|
+
hostRef.$onRenderResolve$();
|
1408
|
+
hostRef.$onRenderResolve$ = undefined;
|
1409
|
+
}
|
1410
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
1411
|
+
nextTick(() => scheduleUpdate(hostRef, false));
|
1412
|
+
}
|
1413
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
1414
|
+
}
|
1415
|
+
// ( •_•)
|
1416
|
+
// ( •_•)>⌐■-■
|
1417
|
+
// (⌐■_■)
|
1418
|
+
};
|
1419
|
+
const forceUpdate = (ref) => {
|
1420
|
+
{
|
1421
|
+
const hostRef = getHostRef(ref);
|
1422
|
+
const isConnected = hostRef.$hostElement$.isConnected;
|
1423
|
+
if (isConnected &&
|
1424
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
1425
|
+
scheduleUpdate(hostRef, false);
|
1426
|
+
}
|
1427
|
+
// Returns "true" when the forced update was successfully scheduled
|
1428
|
+
return isConnected;
|
1429
|
+
}
|
1430
|
+
};
|
1431
|
+
const appDidLoad = (who) => {
|
1432
|
+
// on appload
|
1433
|
+
// we have finish the first big initial render
|
1434
|
+
{
|
1435
|
+
addHydratedFlag(doc.documentElement);
|
1436
|
+
}
|
1437
|
+
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
1438
|
+
};
|
1439
|
+
const safeCall = (instance, method, arg) => {
|
1440
|
+
if (instance && instance[method]) {
|
1441
|
+
try {
|
1442
|
+
return instance[method](arg);
|
1443
|
+
}
|
1444
|
+
catch (e) {
|
1445
|
+
consoleError(e);
|
1446
|
+
}
|
1447
|
+
}
|
1448
|
+
return undefined;
|
1449
|
+
};
|
1450
|
+
const then = (promise, thenFn) => {
|
1451
|
+
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
1452
|
+
};
|
1453
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
1454
|
+
;
|
1455
|
+
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
1456
|
+
const setValue = (ref, propName, newVal, cmpMeta) => {
|
1457
|
+
// check our new property value against our internal value
|
1458
|
+
const hostRef = getHostRef(ref);
|
1459
|
+
const elm = hostRef.$hostElement$ ;
|
1460
|
+
const oldVal = hostRef.$instanceValues$.get(propName);
|
1461
|
+
const flags = hostRef.$flags$;
|
1462
|
+
const instance = hostRef.$lazyInstance$ ;
|
1463
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
1464
|
+
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
1465
|
+
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
1466
|
+
const didValueChange = newVal !== oldVal && !areBothNaN;
|
1467
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
1468
|
+
// gadzooks! the property's value has changed!!
|
1469
|
+
// set our new value!
|
1470
|
+
hostRef.$instanceValues$.set(propName, newVal);
|
1471
|
+
if (instance) {
|
1472
|
+
// get an array of method names of watch functions to call
|
1473
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
1474
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
1475
|
+
if (watchMethods) {
|
1476
|
+
// this instance is watching for when this property changed
|
1477
|
+
watchMethods.map((watchMethodName) => {
|
1478
|
+
try {
|
1479
|
+
// fire off each of the watch methods that are watching this property
|
1480
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
1481
|
+
}
|
1482
|
+
catch (e) {
|
1483
|
+
consoleError(e, elm);
|
1484
|
+
}
|
1485
|
+
});
|
1486
|
+
}
|
1487
|
+
}
|
1488
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
1489
|
+
if (instance.componentShouldUpdate) {
|
1490
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
1491
|
+
return;
|
1492
|
+
}
|
1493
|
+
}
|
1494
|
+
// looks like this value actually changed, so we've got work to do!
|
1495
|
+
// but only if we've already rendered, otherwise just chill out
|
1496
|
+
// queue that we need to do an update, but don't worry about queuing
|
1497
|
+
// up millions cuz this function ensures it only runs once
|
1498
|
+
scheduleUpdate(hostRef, false);
|
1499
|
+
}
|
1500
|
+
}
|
1501
|
+
}
|
1502
|
+
};
|
1503
|
+
/**
|
1504
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
1505
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
1506
|
+
* decorators, callbacks for when attributes change, and so on.
|
1507
|
+
*
|
1508
|
+
* @param Cstr the constructor for a component that we need to process
|
1509
|
+
* @param cmpMeta metadata collected previously about the component
|
1510
|
+
* @param flags a number used to store a series of bit flags
|
1511
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
1512
|
+
*/
|
1513
|
+
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
1514
|
+
if (cmpMeta.$members$) {
|
1515
|
+
if (Cstr.watchers) {
|
1516
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
1517
|
+
}
|
1518
|
+
// It's better to have a const than two Object.entries()
|
1519
|
+
const members = Object.entries(cmpMeta.$members$);
|
1520
|
+
const prototype = Cstr.prototype;
|
1521
|
+
members.map(([memberName, [memberFlags]]) => {
|
1522
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
1523
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
1524
|
+
// proxyComponent - prop
|
1525
|
+
Object.defineProperty(prototype, memberName, {
|
1526
|
+
get() {
|
1527
|
+
// proxyComponent, get value
|
1528
|
+
return getValue(this, memberName);
|
1529
|
+
},
|
1530
|
+
set(newValue) {
|
1531
|
+
// proxyComponent, set value
|
1532
|
+
setValue(this, memberName, newValue, cmpMeta);
|
1533
|
+
},
|
1534
|
+
configurable: true,
|
1535
|
+
enumerable: true,
|
1536
|
+
});
|
1537
|
+
}
|
1538
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
1539
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
1540
|
+
// proxyComponent - method
|
1541
|
+
Object.defineProperty(prototype, memberName, {
|
1542
|
+
value(...args) {
|
1543
|
+
const ref = getHostRef(this);
|
1544
|
+
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
|
1545
|
+
},
|
1546
|
+
});
|
1547
|
+
}
|
1548
|
+
});
|
1549
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
1550
|
+
const attrNameToPropName = new Map();
|
1551
|
+
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
1552
|
+
plt.jmp(() => {
|
1553
|
+
const propName = attrNameToPropName.get(attrName);
|
1554
|
+
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
1555
|
+
// in the case where an attribute was set inline.
|
1556
|
+
// ```html
|
1557
|
+
// <my-component some-attribute="some-value"></my-component>
|
1558
|
+
// ```
|
1559
|
+
//
|
1560
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
1561
|
+
// programmatically changes it before it has been upgraded as shown below:
|
1562
|
+
//
|
1563
|
+
// ```html
|
1564
|
+
// <!-- this component has _not_ been upgraded yet -->
|
1565
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
1566
|
+
// <script>
|
1567
|
+
// // grab non-upgraded component
|
1568
|
+
// el = document.querySelector("#test");
|
1569
|
+
// el.someAttribute = "another-value";
|
1570
|
+
// // upgrade component
|
1571
|
+
// customElements.define('my-component', MyComponent);
|
1572
|
+
// </script>
|
1573
|
+
// ```
|
1574
|
+
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
1575
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
1576
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
1577
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
|
1578
|
+
//
|
1579
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
1580
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
1581
|
+
//
|
1582
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
1583
|
+
//
|
1584
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
1585
|
+
// properties here given that this goes against best practices outlined here
|
1586
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
1587
|
+
if (this.hasOwnProperty(propName)) {
|
1588
|
+
newValue = this[propName];
|
1589
|
+
delete this[propName];
|
1590
|
+
}
|
1591
|
+
else if (prototype.hasOwnProperty(propName) &&
|
1592
|
+
typeof this[propName] === 'number' &&
|
1593
|
+
this[propName] == newValue) {
|
1594
|
+
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
1595
|
+
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
1596
|
+
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
1597
|
+
return;
|
1598
|
+
}
|
1599
|
+
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
1600
|
+
});
|
1601
|
+
};
|
1602
|
+
// create an array of attributes to observe
|
1603
|
+
// and also create a map of html attribute name to js property name
|
1604
|
+
Cstr.observedAttributes = members
|
1605
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
1606
|
+
.map(([propName, m]) => {
|
1607
|
+
const attrName = m[1] || propName;
|
1608
|
+
attrNameToPropName.set(attrName, propName);
|
1609
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
1610
|
+
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
1611
|
+
}
|
1612
|
+
return attrName;
|
1613
|
+
});
|
1614
|
+
}
|
1615
|
+
}
|
1616
|
+
return Cstr;
|
1617
|
+
};
|
1618
|
+
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
1619
|
+
// initializeComponent
|
1620
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
1621
|
+
{
|
1622
|
+
// we haven't initialized this element yet
|
1623
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
1624
|
+
// lazy loaded components
|
1625
|
+
// request the component's implementation to be
|
1626
|
+
// wired up with the host element
|
1627
|
+
Cstr = loadModule(cmpMeta);
|
1628
|
+
if (Cstr.then) {
|
1629
|
+
// Await creates a micro-task avoid if possible
|
1630
|
+
const endLoad = uniqueTime();
|
1631
|
+
Cstr = await Cstr;
|
1632
|
+
endLoad();
|
1633
|
+
}
|
1634
|
+
if (!Cstr.isProxied) {
|
1635
|
+
// we've never proxied this Constructor before
|
1636
|
+
// let's add the getters/setters to its prototype before
|
1637
|
+
// the first time we create an instance of the implementation
|
1638
|
+
{
|
1639
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
1640
|
+
}
|
1641
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
1642
|
+
Cstr.isProxied = true;
|
1643
|
+
}
|
1644
|
+
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
1645
|
+
// ok, time to construct the instance
|
1646
|
+
// but let's keep track of when we start and stop
|
1647
|
+
// so that the getters/setters don't incorrectly step on data
|
1648
|
+
{
|
1649
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
1650
|
+
}
|
1651
|
+
// construct the lazy-loaded component implementation
|
1652
|
+
// passing the hostRef is very important during
|
1653
|
+
// construction in order to directly wire together the
|
1654
|
+
// host element and the lazy-loaded instance
|
1655
|
+
try {
|
1656
|
+
new Cstr(hostRef);
|
1657
|
+
}
|
1658
|
+
catch (e) {
|
1659
|
+
consoleError(e);
|
1660
|
+
}
|
1661
|
+
{
|
1662
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
1663
|
+
}
|
1664
|
+
{
|
1665
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
1666
|
+
}
|
1667
|
+
endNewInstance();
|
1668
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
1669
|
+
}
|
1670
|
+
if (Cstr.style) {
|
1671
|
+
// this component has styles but we haven't registered them yet
|
1672
|
+
let style = Cstr.style;
|
1673
|
+
const scopeId = getScopeId(cmpMeta);
|
1674
|
+
if (!styles.has(scopeId)) {
|
1675
|
+
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
1676
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
1677
|
+
endRegisterStyles();
|
1678
|
+
}
|
1679
|
+
}
|
1680
|
+
}
|
1681
|
+
// we've successfully created a lazy instance
|
1682
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
1683
|
+
const schedule = () => scheduleUpdate(hostRef, true);
|
1684
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
1685
|
+
// this is the initial load and this component it has an ancestor component
|
1686
|
+
// but the ancestor component has NOT fired its will update lifecycle yet
|
1687
|
+
// so let's just cool our jets and wait for the ancestor to continue first
|
1688
|
+
// this will get fired off when the ancestor component
|
1689
|
+
// finally gets around to rendering its lazy self
|
1690
|
+
// fire off the initial update
|
1691
|
+
ancestorComponent['s-rc'].push(schedule);
|
1692
|
+
}
|
1693
|
+
else {
|
1694
|
+
schedule();
|
1695
|
+
}
|
1696
|
+
};
|
1697
|
+
const fireConnectedCallback = (instance) => {
|
1698
|
+
{
|
1699
|
+
safeCall(instance, 'connectedCallback');
|
1700
|
+
}
|
1701
|
+
};
|
1702
|
+
const connectedCallback = (elm) => {
|
1703
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1704
|
+
const hostRef = getHostRef(elm);
|
1705
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
1706
|
+
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
1707
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
1708
|
+
// first time this component has connected
|
1709
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
1710
|
+
{
|
1711
|
+
// initUpdate
|
1712
|
+
// if the slot polyfill is required we'll need to put some nodes
|
1713
|
+
// in here to act as original content anchors as we move nodes around
|
1714
|
+
// host element has been connected to the DOM
|
1715
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
1716
|
+
setContentReference(elm);
|
1717
|
+
}
|
1718
|
+
}
|
1719
|
+
{
|
1720
|
+
// find the first ancestor component (if there is one) and register
|
1721
|
+
// this component as one of the actively loading child components for its ancestor
|
1722
|
+
let ancestorComponent = elm;
|
1723
|
+
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
1724
|
+
// climb up the ancestors looking for the first
|
1725
|
+
// component that hasn't finished its lifecycle update yet
|
1726
|
+
if (ancestorComponent['s-p']) {
|
1727
|
+
// we found this components first ancestor component
|
1728
|
+
// keep a reference to this component's ancestor component
|
1729
|
+
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
1730
|
+
break;
|
1731
|
+
}
|
1732
|
+
}
|
1733
|
+
}
|
1734
|
+
// Lazy properties
|
1735
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
1736
|
+
if (cmpMeta.$members$) {
|
1737
|
+
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
1738
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
1739
|
+
const value = elm[memberName];
|
1740
|
+
delete elm[memberName];
|
1741
|
+
elm[memberName] = value;
|
1742
|
+
}
|
1743
|
+
});
|
1744
|
+
}
|
1745
|
+
{
|
1746
|
+
initializeComponent(elm, hostRef, cmpMeta);
|
1747
|
+
}
|
1748
|
+
}
|
1749
|
+
else {
|
1750
|
+
// not the first time this has connected
|
1751
|
+
// reattach any event listeners to the host
|
1752
|
+
// since they would have been removed when disconnected
|
1753
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
1754
|
+
// fire off connectedCallback() on component instance
|
1755
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
1756
|
+
}
|
1757
|
+
endConnected();
|
1758
|
+
}
|
1759
|
+
};
|
1760
|
+
const setContentReference = (elm) => {
|
1761
|
+
// only required when we're NOT using native shadow dom (slot)
|
1762
|
+
// or this browser doesn't support native shadow dom
|
1763
|
+
// and this host element was NOT created with SSR
|
1764
|
+
// let's pick out the inner content for slot projection
|
1765
|
+
// create a node to represent where the original
|
1766
|
+
// content was first placed, which is useful later on
|
1767
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
1768
|
+
contentRefElm['s-cn'] = true;
|
1769
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
1770
|
+
};
|
1771
|
+
const disconnectedCallback = (elm) => {
|
1772
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1773
|
+
const hostRef = getHostRef(elm);
|
1774
|
+
const instance = hostRef.$lazyInstance$ ;
|
1775
|
+
{
|
1776
|
+
if (hostRef.$rmListeners$) {
|
1777
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
1778
|
+
hostRef.$rmListeners$ = undefined;
|
1779
|
+
}
|
1780
|
+
}
|
1781
|
+
{
|
1782
|
+
safeCall(instance, 'disconnectedCallback');
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
};
|
1786
|
+
const bootstrapLazy = (lazyBundles, options = {}) => {
|
1787
|
+
const endBootstrap = createTime();
|
1788
|
+
const cmpTags = [];
|
1789
|
+
const exclude = options.exclude || [];
|
1790
|
+
const customElements = win.customElements;
|
1791
|
+
const head = doc.head;
|
1792
|
+
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
1793
|
+
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
1794
|
+
const deferredConnectedCallbacks = [];
|
1795
|
+
let appLoadFallback;
|
1796
|
+
let isBootstrapping = true;
|
1797
|
+
Object.assign(plt, options);
|
1798
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
1799
|
+
lazyBundles.map((lazyBundle) => {
|
1800
|
+
lazyBundle[1].map((compactMeta) => {
|
1801
|
+
const cmpMeta = {
|
1802
|
+
$flags$: compactMeta[0],
|
1803
|
+
$tagName$: compactMeta[1],
|
1804
|
+
$members$: compactMeta[2],
|
1805
|
+
$listeners$: compactMeta[3],
|
1806
|
+
};
|
1807
|
+
{
|
1808
|
+
cmpMeta.$members$ = compactMeta[2];
|
1809
|
+
}
|
1810
|
+
{
|
1811
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
1812
|
+
}
|
1813
|
+
{
|
1814
|
+
cmpMeta.$attrsToReflect$ = [];
|
1815
|
+
}
|
1816
|
+
{
|
1817
|
+
cmpMeta.$watchers$ = {};
|
1818
|
+
}
|
1819
|
+
const tagName = cmpMeta.$tagName$;
|
1820
|
+
const HostElement = class extends HTMLElement {
|
1821
|
+
// StencilLazyHost
|
1822
|
+
constructor(self) {
|
1823
|
+
// @ts-ignore
|
1824
|
+
super(self);
|
1825
|
+
self = this;
|
1826
|
+
registerHost(self, cmpMeta);
|
1827
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
1828
|
+
// this component is using shadow dom
|
1829
|
+
// and this browser supports shadow dom
|
1830
|
+
// add the read-only property "shadowRoot" to the host element
|
1831
|
+
// adding the shadow root build conditionals to minimize runtime
|
1832
|
+
{
|
1833
|
+
{
|
1834
|
+
self.attachShadow({ mode: 'open' });
|
1835
|
+
}
|
1836
|
+
}
|
1837
|
+
}
|
1838
|
+
}
|
1839
|
+
connectedCallback() {
|
1840
|
+
if (appLoadFallback) {
|
1841
|
+
clearTimeout(appLoadFallback);
|
1842
|
+
appLoadFallback = null;
|
1843
|
+
}
|
1844
|
+
if (isBootstrapping) {
|
1845
|
+
// connectedCallback will be processed once all components have been registered
|
1846
|
+
deferredConnectedCallbacks.push(this);
|
1847
|
+
}
|
1848
|
+
else {
|
1849
|
+
plt.jmp(() => connectedCallback(this));
|
1850
|
+
}
|
1851
|
+
}
|
1852
|
+
disconnectedCallback() {
|
1853
|
+
plt.jmp(() => disconnectedCallback(this));
|
1854
|
+
}
|
1855
|
+
componentOnReady() {
|
1856
|
+
return getHostRef(this).$onReadyPromise$;
|
1857
|
+
}
|
1858
|
+
};
|
1859
|
+
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
1860
|
+
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
1861
|
+
cmpTags.push(tagName);
|
1862
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
1863
|
+
}
|
1864
|
+
});
|
1865
|
+
});
|
1866
|
+
{
|
1867
|
+
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
1868
|
+
visibilityStyle.setAttribute('data-styles', '');
|
1869
|
+
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
1870
|
+
}
|
1871
|
+
// Process deferred connectedCallbacks now all components have been registered
|
1872
|
+
isBootstrapping = false;
|
1873
|
+
if (deferredConnectedCallbacks.length) {
|
1874
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
1875
|
+
}
|
1876
|
+
else {
|
1877
|
+
{
|
1878
|
+
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
// Fallback appLoad event
|
1882
|
+
endBootstrap();
|
1883
|
+
};
|
1884
|
+
const Fragment = (_, children) => children;
|
1885
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
1886
|
+
if (listeners) {
|
1887
|
+
listeners.map(([flags, name, method]) => {
|
1888
|
+
const target = getHostListenerTarget(elm, flags) ;
|
1889
|
+
const handler = hostListenerProxy(hostRef, method);
|
1890
|
+
const opts = hostListenerOpts(flags);
|
1891
|
+
plt.ael(target, name, handler, opts);
|
1892
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
1893
|
+
});
|
1894
|
+
}
|
1895
|
+
};
|
1896
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
1897
|
+
try {
|
1898
|
+
{
|
1899
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
1900
|
+
// instance is ready, let's call it's member method for this event
|
1901
|
+
hostRef.$lazyInstance$[methodName](ev);
|
1902
|
+
}
|
1903
|
+
else {
|
1904
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
1905
|
+
}
|
1906
|
+
}
|
1907
|
+
}
|
1908
|
+
catch (e) {
|
1909
|
+
consoleError(e);
|
1910
|
+
}
|
1911
|
+
};
|
1912
|
+
const getHostListenerTarget = (elm, flags) => {
|
1913
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
1914
|
+
return doc;
|
1915
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
1916
|
+
return win;
|
1917
|
+
if (flags & 16 /* LISTENER_FLAGS.TargetBody */)
|
1918
|
+
return doc.body;
|
1919
|
+
return elm;
|
1920
|
+
};
|
1921
|
+
// prettier-ignore
|
1922
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
1923
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
1924
|
+
const getHostRef = (ref) => hostRefs.get(ref);
|
1925
|
+
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
1926
|
+
const registerHost = (elm, cmpMeta) => {
|
1927
|
+
const hostRef = {
|
1928
|
+
$flags$: 0,
|
1929
|
+
$hostElement$: elm,
|
1930
|
+
$cmpMeta$: cmpMeta,
|
1931
|
+
$instanceValues$: new Map(),
|
1932
|
+
};
|
1933
|
+
{
|
1934
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
1935
|
+
}
|
1936
|
+
{
|
1937
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
1938
|
+
elm['s-p'] = [];
|
1939
|
+
elm['s-rc'] = [];
|
1940
|
+
}
|
1941
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
1942
|
+
return hostRefs.set(elm, hostRef);
|
1943
|
+
};
|
1944
|
+
const isMemberInElement = (elm, memberName) => memberName in elm;
|
1945
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
1946
|
+
const cmpModules = /*@__PURE__*/ new Map();
|
1947
|
+
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
1948
|
+
// loadModuleImport
|
1949
|
+
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
1950
|
+
const bundleId = cmpMeta.$lazyBundleId$;
|
1951
|
+
const module = cmpModules.get(bundleId) ;
|
1952
|
+
if (module) {
|
1953
|
+
return module[exportName];
|
1954
|
+
}
|
1955
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
1956
|
+
return import(
|
1957
|
+
/* @vite-ignore */
|
1958
|
+
/* webpackInclude: /\.entry\.js$/ */
|
1959
|
+
/* webpackExclude: /\.system\.entry\.js$/ */
|
1960
|
+
/* webpackMode: "lazy" */
|
1961
|
+
`./${bundleId}.entry.js${''}`).then((importedModule) => {
|
1962
|
+
{
|
1963
|
+
cmpModules.set(bundleId, importedModule);
|
1964
|
+
}
|
1965
|
+
return importedModule[exportName];
|
1966
|
+
}, consoleError);
|
1967
|
+
};
|
1968
|
+
const styles = /*@__PURE__*/ new Map();
|
1969
|
+
const win = typeof window !== 'undefined' ? window : {};
|
1970
|
+
const doc = win.document || { head: {} };
|
1971
|
+
const plt = {
|
1972
|
+
$flags$: 0,
|
1973
|
+
$resourcesUrl$: '',
|
1974
|
+
jmp: (h) => h(),
|
1975
|
+
raf: (h) => requestAnimationFrame(h),
|
1976
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
1977
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
1978
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
1979
|
+
};
|
1980
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
1981
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
1982
|
+
try {
|
1983
|
+
new CSSStyleSheet();
|
1984
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
1985
|
+
}
|
1986
|
+
catch (e) { }
|
1987
|
+
return false;
|
1988
|
+
})()
|
1989
|
+
;
|
1990
|
+
const queueDomReads = [];
|
1991
|
+
const queueDomWrites = [];
|
1992
|
+
const queueTask = (queue, write) => (cb) => {
|
1993
|
+
queue.push(cb);
|
1994
|
+
if (!queuePending) {
|
1995
|
+
queuePending = true;
|
1996
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
1997
|
+
nextTick(flush);
|
1998
|
+
}
|
1999
|
+
else {
|
2000
|
+
plt.raf(flush);
|
2001
|
+
}
|
2002
|
+
}
|
2003
|
+
};
|
2004
|
+
const consume = (queue) => {
|
2005
|
+
for (let i = 0; i < queue.length; i++) {
|
2006
|
+
try {
|
2007
|
+
queue[i](performance.now());
|
2008
|
+
}
|
2009
|
+
catch (e) {
|
2010
|
+
consoleError(e);
|
2011
|
+
}
|
2012
|
+
}
|
2013
|
+
queue.length = 0;
|
2014
|
+
};
|
2015
|
+
const flush = () => {
|
2016
|
+
// always force a bunch of medium callbacks to run, but still have
|
2017
|
+
// a throttle on how many can run in a certain time
|
2018
|
+
// DOM READS!!!
|
2019
|
+
consume(queueDomReads);
|
2020
|
+
// DOM WRITES!!!
|
2021
|
+
{
|
2022
|
+
consume(queueDomWrites);
|
2023
|
+
if ((queuePending = queueDomReads.length > 0)) {
|
2024
|
+
// still more to do yet, but we've run out of time
|
2025
|
+
// let's let this thing cool off and try again in the next tick
|
2026
|
+
plt.raf(flush);
|
2027
|
+
}
|
2028
|
+
}
|
2029
|
+
};
|
2030
|
+
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
2031
|
+
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
2032
|
+
|
2033
|
+
export { Fragment as F, Host as H, getAssetPath as a, bootstrapLazy as b, createEvent as c, getRenderingRef as d, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r };
|