@pod-os/elements 0.2.1-e5ac107.0 → 0.3.1-ecc3b86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-8793f3b5.js → app-globals-1aedd05c.js} +1 -1
- package/dist/cjs/{button-active-dc62e864.js → button-active-c14dab31.js} +1 -1
- package/dist/cjs/elements.cjs.js +5 -5
- package/dist/cjs/{index-fdf96391.js → index-2067b305.js} +3 -3
- package/dist/cjs/{index-b8164b0b.js → index-68ae43d2.js} +1 -1
- package/dist/cjs/{index-0aae2825.js → index-b4a9ece2.js} +489 -291
- package/dist/cjs/ion-action-sheet.cjs.entry.js +4 -4
- package/dist/cjs/ion-alert.cjs.entry.js +4 -4
- package/dist/cjs/ion-app_37.cjs.entry.js +139 -67
- package/dist/cjs/ion-avatar.cjs.entry.js +2 -2
- package/dist/cjs/ion-back-button.cjs.entry.js +2 -2
- package/dist/cjs/ion-backdrop.cjs.entry.js +2 -2
- package/dist/cjs/ion-badge.cjs.entry.js +2 -2
- package/dist/cjs/ion-buttons.cjs.entry.js +2 -2
- package/dist/cjs/ion-card-subtitle.cjs.entry.js +2 -2
- package/dist/cjs/ion-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/ion-chip.cjs.entry.js +2 -2
- package/dist/cjs/ion-datetime.cjs.entry.js +3 -3
- package/dist/cjs/ion-fab-button.cjs.entry.js +2 -2
- package/dist/cjs/ion-fab-list.cjs.entry.js +2 -2
- package/dist/cjs/ion-fab.cjs.entry.js +2 -2
- package/dist/cjs/ion-img.cjs.entry.js +2 -2
- package/dist/cjs/ion-infinite-scroll-content.cjs.entry.js +2 -2
- package/dist/cjs/ion-infinite-scroll.cjs.entry.js +2 -2
- package/dist/cjs/ion-input.cjs.entry.js +2 -2
- package/dist/cjs/ion-item-option.cjs.entry.js +2 -2
- package/dist/cjs/ion-item-options.cjs.entry.js +2 -2
- package/dist/cjs/ion-item-sliding.cjs.entry.js +2 -2
- package/dist/cjs/ion-list-header_3.cjs.entry.js +2 -2
- package/dist/cjs/ion-loading.cjs.entry.js +3 -3
- package/dist/cjs/ion-menu-button.cjs.entry.js +4 -4
- package/dist/cjs/ion-menu-toggle.cjs.entry.js +4 -4
- package/dist/cjs/ion-menu.cjs.entry.js +3 -3
- package/dist/cjs/ion-modal.cjs.entry.js +4 -4
- package/dist/cjs/ion-nav-link.cjs.entry.js +1 -1
- package/dist/cjs/ion-nav.cjs.entry.js +3 -3
- package/dist/cjs/ion-note.cjs.entry.js +2 -2
- package/dist/cjs/ion-picker-column.cjs.entry.js +2 -2
- package/dist/cjs/ion-picker.cjs.entry.js +3 -3
- package/dist/cjs/ion-popover.cjs.entry.js +4 -4
- package/dist/cjs/ion-range.cjs.entry.js +2 -2
- package/dist/cjs/ion-refresher-content.cjs.entry.js +2 -2
- package/dist/cjs/ion-refresher.cjs.entry.js +2 -2
- package/dist/cjs/ion-reorder-group.cjs.entry.js +2 -2
- package/dist/cjs/ion-reorder.cjs.entry.js +2 -2
- package/dist/cjs/ion-route-redirect.cjs.entry.js +1 -1
- package/dist/cjs/ion-route.cjs.entry.js +1 -1
- package/dist/cjs/ion-router-link.cjs.entry.js +2 -2
- package/dist/cjs/ion-router-outlet.cjs.entry.js +3 -3
- package/dist/cjs/ion-router.cjs.entry.js +1 -1
- package/dist/cjs/ion-searchbar.cjs.entry.js +2 -2
- package/dist/cjs/ion-segment-button.cjs.entry.js +2 -2
- package/dist/cjs/ion-segment.cjs.entry.js +2 -2
- package/dist/cjs/ion-select-option.cjs.entry.js +2 -2
- package/dist/cjs/ion-select-popover.cjs.entry.js +3 -3
- package/dist/cjs/ion-select.cjs.entry.js +3 -3
- package/dist/cjs/ion-slide.cjs.entry.js +2 -2
- package/dist/cjs/ion-slides.cjs.entry.js +2 -2
- package/dist/cjs/ion-spinner.cjs.entry.js +2 -2
- package/dist/cjs/ion-split-pane.cjs.entry.js +2 -2
- package/dist/cjs/ion-tab-bar.cjs.entry.js +2 -2
- package/dist/cjs/ion-tab-button.cjs.entry.js +2 -2
- package/dist/cjs/ion-tab.cjs.entry.js +1 -1
- package/dist/cjs/ion-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ion-text.cjs.entry.js +2 -2
- package/dist/cjs/ion-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ion-thumbnail.cjs.entry.js +2 -2
- package/dist/cjs/ion-toast.cjs.entry.js +3 -3
- package/dist/cjs/ion-toggle.cjs.entry.js +2 -2
- package/dist/cjs/ion-virtual-scroll.cjs.entry.js +1 -1
- package/dist/cjs/{ionic-global-a6599940.js → ionic-global-56e10eb5.js} +1 -1
- package/dist/cjs/{ios.transition-b6fe660c.js → ios.transition-32e4623d.js} +2 -2
- package/dist/cjs/loader.cjs.js +5 -5
- package/dist/cjs/{md.transition-af65cb42.js → md.transition-169c54f0.js} +2 -2
- package/dist/cjs/{menu-toggle-util-e66c2545.js → menu-toggle-util-087678e0.js} +1 -1
- package/dist/cjs/{overlays-7d879e64.js → overlays-49fe9ba7.js} +1 -1
- package/dist/cjs/{status-tap-869e1b97.js → status-tap-ada894ff.js} +1 -1
- package/dist/cjs/test-component.cjs.entry.js +1 -1
- package/dist/collection/apps/pos-app-generic/pos-app-generic.js +2 -16
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/pos-app/pos-app.js +19 -13
- package/dist/collection/components/pos-demo-app/pos-demo-app.js +2 -11
- package/dist/collection/components/pos-description/pos-description.component.js +24 -20
- package/dist/collection/components/pos-image/BrokenImage.js +1 -6
- package/dist/collection/components/pos-image/pos-image.css +6 -3
- package/dist/collection/components/pos-image/pos-image.js +73 -56
- package/dist/collection/components/pos-label/pos-label.js +24 -20
- package/dist/collection/components/pos-literals/pos-literals.js +26 -27
- package/dist/collection/components/pos-login/pos-login.css +14 -0
- package/dist/collection/components/pos-login/pos-login.js +37 -25
- package/dist/collection/components/pos-picture/pos-picture.css +10 -0
- package/dist/collection/components/pos-picture/pos-picture.js +35 -20
- package/dist/collection/components/pos-relations/pos-relations.js +26 -25
- package/dist/collection/components/pos-resource/pos-resource.js +108 -92
- package/dist/collection/components/pos-reverse-relations/pos-reverse-relations.js +26 -28
- package/dist/collection/components/pos-rich-link/pos-rich-link.js +46 -48
- package/dist/collection/components/pos-router/pos-router.js +19 -15
- package/dist/collection/test/TestComponent.js +0 -1
- package/dist/collection/test/mockPodOS.js +4 -0
- package/dist/custom-elements/index.js +138 -65
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/{p-17758df3.entry.js → p-06675ac7.entry.js} +1 -1
- package/dist/elements/{p-99837f0d.entry.js → p-0908233c.entry.js} +1 -1
- package/dist/elements/{p-c6dbdd06.entry.js → p-0dbeacc4.entry.js} +1 -1
- package/dist/elements/{p-387aff19.entry.js → p-1dafa1ce.entry.js} +1 -1
- package/dist/elements/{p-2145cf89.entry.js → p-203cbbcc.entry.js} +1 -1
- package/dist/elements/{p-bf5cd642.entry.js → p-24605c2e.entry.js} +1 -1
- package/dist/elements/{p-b84ab0eb.js → p-263a0343.js} +1 -1
- package/dist/elements/{p-1f6a9d65.entry.js → p-2c747ed4.entry.js} +1 -1
- package/dist/elements/{p-d6012b74.entry.js → p-2f2718d4.entry.js} +1 -1
- package/dist/elements/{p-3a26e7e5.entry.js → p-305e246c.entry.js} +1 -1
- package/dist/elements/{p-12094a99.entry.js → p-36f660e0.entry.js} +1 -1
- package/dist/elements/{p-10e4ca40.entry.js → p-3dabcacb.entry.js} +1 -1
- package/dist/elements/{p-aa225dce.entry.js → p-3f51d4ff.entry.js} +8 -2
- package/dist/elements/{p-e8b8da88.entry.js → p-4250dc8d.entry.js} +1 -1
- package/dist/elements/{p-30ceacb9.entry.js → p-4809c08b.entry.js} +1 -1
- package/dist/elements/{p-856e2a7d.entry.js → p-4a732500.entry.js} +1 -1
- package/dist/elements/{p-66bbe62d.entry.js → p-4cb27b48.entry.js} +1 -1
- package/dist/elements/{p-3e6db2fa.entry.js → p-4cca7b5e.entry.js} +1 -1
- package/dist/elements/{p-9b2ff01b.entry.js → p-4d7de1f8.entry.js} +1 -1
- package/dist/elements/{p-8d8e018a.entry.js → p-519d6a53.entry.js} +1 -1
- package/dist/elements/p-53166138.js +1 -0
- package/dist/elements/{p-671b4546.entry.js → p-54211c52.entry.js} +1 -1
- package/dist/elements/{p-22fc3a24.entry.js → p-5617a76d.entry.js} +1 -1
- package/dist/elements/{p-a08b2157.entry.js → p-599bb53f.entry.js} +1 -1
- package/dist/elements/{p-0452fb27.entry.js → p-5d1dc8fb.entry.js} +1 -1
- package/dist/elements/p-65133e33.js +1 -0
- package/dist/elements/p-689bdcc1.entry.js +1 -0
- package/dist/elements/{p-675e436c.js → p-6e247b63.js} +1 -1
- package/dist/elements/{p-58625104.entry.js → p-70713b3d.entry.js} +1 -1
- package/dist/elements/{p-0931b188.entry.js → p-74ba1e42.entry.js} +1 -1
- package/dist/elements/{p-80adc18b.entry.js → p-77d68651.entry.js} +1 -1
- package/dist/elements/{p-4b8b50f2.entry.js → p-78511267.entry.js} +1 -1
- package/dist/elements/{p-d9570980.entry.js → p-792c1e0f.entry.js} +1 -1
- package/dist/elements/p-7e5300af.js +2 -0
- package/dist/elements/{p-da1d4d15.entry.js → p-8068987c.entry.js} +1 -1
- package/dist/elements/{p-f35bc63b.entry.js → p-83d45051.entry.js} +1 -1
- package/dist/elements/{p-a0ee39e8.entry.js → p-84fa4ed5.entry.js} +1 -1
- package/dist/elements/{p-8544ef1b.entry.js → p-86635d06.entry.js} +1 -1
- package/dist/elements/{p-b7cd6fef.entry.js → p-8bcba3f7.entry.js} +1 -1
- package/dist/elements/{p-78cd25d1.entry.js → p-9038f68e.entry.js} +1 -1
- package/dist/elements/{p-b4ab884c.entry.js → p-93cacd51.entry.js} +1 -1
- package/dist/elements/p-9408d0b4.entry.js +1 -0
- package/dist/elements/{p-ca395368.entry.js → p-971d348c.entry.js} +1 -1
- package/dist/elements/{p-f91f59f9.entry.js → p-9813457e.entry.js} +1 -1
- package/dist/elements/{p-5628f80d.entry.js → p-9c1dbe52.entry.js} +1 -1
- package/dist/elements/{p-57f7c0c2.entry.js → p-9dad7470.entry.js} +1 -1
- package/dist/elements/{p-c3e16816.entry.js → p-9fb98135.entry.js} +1 -1
- package/dist/elements/p-a15e4603.js +1 -0
- package/dist/elements/{p-38bde1d3.js → p-a68c3324.js} +1 -1
- package/dist/elements/{p-c7feb66f.entry.js → p-aaa8393e.entry.js} +1 -1
- package/dist/elements/{p-0addb25c.entry.js → p-ab1b1b03.entry.js} +1 -1
- package/dist/elements/{p-b04936a5.entry.js → p-afb8f7d5.entry.js} +1 -1
- package/dist/elements/{p-2c2ae808.js → p-b055ec44.js} +1 -1
- package/dist/elements/{p-d4ac974f.entry.js → p-b3460325.entry.js} +1 -1
- package/dist/elements/{p-8aaf51be.entry.js → p-b46d3ab6.entry.js} +1 -1
- package/dist/elements/{p-03cde843.entry.js → p-b9926d8b.entry.js} +1 -1
- package/dist/elements/{p-70f5d1c1.entry.js → p-bab1fbc4.entry.js} +1 -1
- package/dist/elements/{p-51c7cb3f.entry.js → p-c08dd7d0.entry.js} +1 -1
- package/dist/elements/{p-16427279.js → p-c11279fc.js} +1 -1
- package/dist/elements/{p-ec47a369.js → p-c3c81ed2.js} +1 -1
- package/dist/elements/{p-8b372444.entry.js → p-c4fb313e.entry.js} +1 -1
- package/dist/elements/{p-025c9a9b.entry.js → p-cc4cb1ac.entry.js} +1 -1
- package/dist/elements/{p-8d1d6062.js → p-cff82b6f.js} +1 -1
- package/dist/elements/{p-9a05c749.entry.js → p-d2d84b3a.entry.js} +1 -1
- package/dist/elements/{p-90ab8eff.entry.js → p-d7dfabd5.entry.js} +1 -1
- package/dist/elements/{p-bcc3c37c.entry.js → p-d9462b66.entry.js} +1 -1
- package/dist/elements/{p-1d8e7db1.entry.js → p-db7feea8.entry.js} +1 -1
- package/dist/elements/p-e2e0fee9.entry.js +1 -0
- package/dist/elements/{p-f4120adc.entry.js → p-e5e5d3fe.entry.js} +1 -1
- package/dist/elements/{p-c94f01cf.entry.js → p-e860be6a.entry.js} +1 -1
- package/dist/elements/{p-c96b5885.entry.js → p-e89acad8.entry.js} +1 -1
- package/dist/elements/{p-d82c8102.entry.js → p-e953934f.entry.js} +1 -1
- package/dist/elements/{p-6e905d35.entry.js → p-f2426182.entry.js} +1 -1
- package/dist/elements/p-f8a3367d.entry.js +1 -0
- package/dist/elements/{p-cf79afd2.entry.js → p-f8be6f3e.entry.js} +1 -1
- package/dist/elements/{p-c8663562.entry.js → p-feda4431.entry.js} +1 -1
- package/dist/esm/{app-globals-6c3cceb6.js → app-globals-27d92837.js} +1 -1
- package/dist/esm/{button-active-1cd0f291.js → button-active-fd9d6d91.js} +1 -1
- package/dist/esm/elements.js +5 -5
- package/dist/esm/{index-178a7a06.js → index-6f52f626.js} +1 -1
- package/dist/esm/{index-edb45c26.js → index-8b5d780d.js} +3 -3
- package/dist/esm/{index-082b47ce.js → index-e4deec27.js} +489 -291
- package/dist/esm/ion-action-sheet.entry.js +4 -4
- package/dist/esm/ion-alert.entry.js +4 -4
- package/dist/esm/ion-app_37.entry.js +139 -67
- package/dist/esm/ion-avatar.entry.js +2 -2
- package/dist/esm/ion-back-button.entry.js +2 -2
- package/dist/esm/ion-backdrop.entry.js +2 -2
- package/dist/esm/ion-badge.entry.js +2 -2
- package/dist/esm/ion-buttons.entry.js +2 -2
- package/dist/esm/ion-card-subtitle.entry.js +2 -2
- package/dist/esm/ion-checkbox.entry.js +2 -2
- package/dist/esm/ion-chip.entry.js +2 -2
- package/dist/esm/ion-datetime.entry.js +3 -3
- package/dist/esm/ion-fab-button.entry.js +2 -2
- package/dist/esm/ion-fab-list.entry.js +2 -2
- package/dist/esm/ion-fab.entry.js +2 -2
- package/dist/esm/ion-img.entry.js +2 -2
- package/dist/esm/ion-infinite-scroll-content.entry.js +2 -2
- package/dist/esm/ion-infinite-scroll.entry.js +2 -2
- package/dist/esm/ion-input.entry.js +2 -2
- package/dist/esm/ion-item-option.entry.js +2 -2
- package/dist/esm/ion-item-options.entry.js +2 -2
- package/dist/esm/ion-item-sliding.entry.js +2 -2
- package/dist/esm/ion-list-header_3.entry.js +2 -2
- package/dist/esm/ion-loading.entry.js +3 -3
- package/dist/esm/ion-menu-button.entry.js +4 -4
- package/dist/esm/ion-menu-toggle.entry.js +4 -4
- package/dist/esm/ion-menu.entry.js +3 -3
- package/dist/esm/ion-modal.entry.js +4 -4
- package/dist/esm/ion-nav-link.entry.js +1 -1
- package/dist/esm/ion-nav.entry.js +3 -3
- package/dist/esm/ion-note.entry.js +2 -2
- package/dist/esm/ion-picker-column.entry.js +2 -2
- package/dist/esm/ion-picker.entry.js +3 -3
- package/dist/esm/ion-popover.entry.js +4 -4
- package/dist/esm/ion-range.entry.js +2 -2
- package/dist/esm/ion-refresher-content.entry.js +2 -2
- package/dist/esm/ion-refresher.entry.js +2 -2
- package/dist/esm/ion-reorder-group.entry.js +2 -2
- package/dist/esm/ion-reorder.entry.js +2 -2
- package/dist/esm/ion-route-redirect.entry.js +1 -1
- package/dist/esm/ion-route.entry.js +1 -1
- package/dist/esm/ion-router-link.entry.js +2 -2
- package/dist/esm/ion-router-outlet.entry.js +3 -3
- package/dist/esm/ion-router.entry.js +1 -1
- package/dist/esm/ion-searchbar.entry.js +2 -2
- package/dist/esm/ion-segment-button.entry.js +2 -2
- package/dist/esm/ion-segment.entry.js +2 -2
- package/dist/esm/ion-select-option.entry.js +2 -2
- package/dist/esm/ion-select-popover.entry.js +3 -3
- package/dist/esm/ion-select.entry.js +3 -3
- package/dist/esm/ion-slide.entry.js +2 -2
- package/dist/esm/ion-slides.entry.js +2 -2
- package/dist/esm/ion-spinner.entry.js +2 -2
- package/dist/esm/ion-split-pane.entry.js +2 -2
- package/dist/esm/ion-tab-bar.entry.js +2 -2
- package/dist/esm/ion-tab-button.entry.js +2 -2
- package/dist/esm/ion-tab.entry.js +1 -1
- package/dist/esm/ion-tabs.entry.js +1 -1
- package/dist/esm/ion-text.entry.js +2 -2
- package/dist/esm/ion-textarea.entry.js +2 -2
- package/dist/esm/ion-thumbnail.entry.js +2 -2
- package/dist/esm/ion-toast.entry.js +3 -3
- package/dist/esm/ion-toggle.entry.js +2 -2
- package/dist/esm/ion-virtual-scroll.entry.js +1 -1
- package/dist/esm/{ionic-global-b8056dd2.js → ionic-global-2e28f7c7.js} +1 -1
- package/dist/esm/{ios.transition-ab339f2c.js → ios.transition-b01e6585.js} +2 -2
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{md.transition-1ed7c8eb.js → md.transition-8b14ce53.js} +2 -2
- package/dist/esm/{menu-toggle-util-d2db3453.js → menu-toggle-util-e1b8b1b3.js} +1 -1
- package/dist/esm/{overlays-423fcd0a.js → overlays-a2145347.js} +1 -1
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{status-tap-3e0a5551.js → status-tap-b8a70b06.js} +1 -1
- package/dist/esm/test-component.entry.js +1 -1
- package/dist/types/stencil-public-runtime.d.ts +20 -4
- package/loader/package.json +1 -0
- package/package.json +5 -5
- package/dist/elements/p-46221508.entry.js +0 -1
- package/dist/elements/p-611d40b2.entry.js +0 -1
- package/dist/elements/p-7010f947.entry.js +0 -1
- package/dist/elements/p-854dbdf1.js +0 -1
- package/dist/elements/p-92a0735b.js +0 -1
- package/dist/elements/p-a5b00718.entry.js +0 -1
- package/dist/elements/p-a712c2f6.js +0 -2
- package/dist/elements/p-c67ec320.js +0 -1
|
@@ -22,6 +22,14 @@ function _interopNamespace(e) {
|
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'elements';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
27
|
+
* Simon Friis Vindum (@paldepind)
|
|
28
|
+
* Licensed under the MIT License
|
|
29
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
30
|
+
*
|
|
31
|
+
* Modified for Stencil's renderer and slot projection
|
|
32
|
+
*/
|
|
25
33
|
let scopeId;
|
|
26
34
|
let contentRef;
|
|
27
35
|
let hostTagName;
|
|
@@ -31,67 +39,16 @@ let checkSlotRelocate = false;
|
|
|
31
39
|
let isSvgMode = false;
|
|
32
40
|
let renderingRef = null;
|
|
33
41
|
let queuePending = false;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
jmp: (h) => h(),
|
|
40
|
-
raf: (h) => requestAnimationFrame(h),
|
|
41
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
42
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
43
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
44
|
-
};
|
|
45
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
46
|
-
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
47
|
-
try {
|
|
48
|
-
new CSSStyleSheet();
|
|
49
|
-
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
50
|
-
}
|
|
51
|
-
catch (e) { }
|
|
52
|
-
return false;
|
|
53
|
-
})()
|
|
54
|
-
;
|
|
55
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
56
|
-
if (listeners) {
|
|
57
|
-
listeners.map(([flags, name, method]) => {
|
|
58
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
59
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
60
|
-
const opts = hostListenerOpts(flags);
|
|
61
|
-
plt.ael(target, name, handler, opts);
|
|
62
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
67
|
-
try {
|
|
68
|
-
{
|
|
69
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
70
|
-
// instance is ready, let's call it's member method for this event
|
|
71
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
consoleError(e);
|
|
80
|
-
}
|
|
42
|
+
const Build = {
|
|
43
|
+
isDev: false,
|
|
44
|
+
isBrowser: true,
|
|
45
|
+
isServer: false,
|
|
46
|
+
isTesting: false,
|
|
81
47
|
};
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (flags & 8 /* TargetWindow */)
|
|
86
|
-
return win;
|
|
87
|
-
if (flags & 16 /* TargetBody */)
|
|
88
|
-
return doc.body;
|
|
89
|
-
return elm;
|
|
48
|
+
const getAssetPath = (path) => {
|
|
49
|
+
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
|
50
|
+
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
90
51
|
};
|
|
91
|
-
// prettier-ignore
|
|
92
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
93
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
94
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
95
52
|
const createTime = (fnName, tagName = '') => {
|
|
96
53
|
{
|
|
97
54
|
return () => {
|
|
@@ -106,84 +63,8 @@ const uniqueTime = (key, measureText) => {
|
|
|
106
63
|
};
|
|
107
64
|
}
|
|
108
65
|
};
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
let style = styles.get(scopeId);
|
|
112
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
113
|
-
style = (style || new CSSStyleSheet());
|
|
114
|
-
if (typeof style === 'string') {
|
|
115
|
-
style = cssText;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
style.replaceSync(cssText);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
style = cssText;
|
|
123
|
-
}
|
|
124
|
-
styles.set(scopeId, style);
|
|
125
|
-
};
|
|
126
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
127
|
-
let scopeId = getScopeId(cmpMeta, mode);
|
|
128
|
-
const style = styles.get(scopeId);
|
|
129
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
130
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
131
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
132
|
-
if (style) {
|
|
133
|
-
if (typeof style === 'string') {
|
|
134
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
135
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
136
|
-
let styleElm;
|
|
137
|
-
if (!appliedStyles) {
|
|
138
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
139
|
-
}
|
|
140
|
-
if (!appliedStyles.has(scopeId)) {
|
|
141
|
-
{
|
|
142
|
-
{
|
|
143
|
-
styleElm = doc.createElement('style');
|
|
144
|
-
styleElm.innerHTML = style;
|
|
145
|
-
}
|
|
146
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
147
|
-
}
|
|
148
|
-
if (appliedStyles) {
|
|
149
|
-
appliedStyles.add(scopeId);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
154
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return scopeId;
|
|
158
|
-
};
|
|
159
|
-
const attachStyles = (hostRef) => {
|
|
160
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
161
|
-
const elm = hostRef.$hostElement$;
|
|
162
|
-
const flags = cmpMeta.$flags$;
|
|
163
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
164
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$);
|
|
165
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
166
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
167
|
-
// or this browser doesn't support native shadow dom
|
|
168
|
-
// and this host element was NOT created with SSR
|
|
169
|
-
// let's pick out the inner content for slot projection
|
|
170
|
-
// create a node to represent where the original
|
|
171
|
-
// content was first placed, which is useful later on
|
|
172
|
-
// DOM WRITE!!
|
|
173
|
-
elm['s-sc'] = scopeId;
|
|
174
|
-
elm.classList.add(scopeId + '-h');
|
|
175
|
-
if (flags & 2 /* scopedCssEncapsulation */) {
|
|
176
|
-
elm.classList.add(scopeId + '-s');
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
endAttachStyles();
|
|
180
|
-
};
|
|
181
|
-
const getScopeId = (cmp, mode) => 'sc-' + (mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
|
|
182
|
-
// Private
|
|
183
|
-
const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
|
|
184
|
-
// Public
|
|
185
|
-
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
186
|
-
const getMode = (ref) => getHostRef(ref).$modeName$;
|
|
66
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
67
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
187
68
|
/**
|
|
188
69
|
* Default style mode id
|
|
189
70
|
*/
|
|
@@ -332,6 +213,157 @@ const convertToPrivate = (node) => {
|
|
|
332
213
|
vnode.$name$ = node.vname;
|
|
333
214
|
return vnode;
|
|
334
215
|
};
|
|
216
|
+
// Private
|
|
217
|
+
const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
|
|
218
|
+
// Public
|
|
219
|
+
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
220
|
+
const getMode = (ref) => getHostRef(ref).$modeName$;
|
|
221
|
+
/**
|
|
222
|
+
* Parse a new property value for a given property type.
|
|
223
|
+
*
|
|
224
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
225
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
226
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
227
|
+
* 2. the type stored from `propType`.
|
|
228
|
+
*
|
|
229
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
230
|
+
*
|
|
231
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
232
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
233
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
234
|
+
* ```tsx
|
|
235
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* HTML prop values on the other hand, will always a string
|
|
239
|
+
*
|
|
240
|
+
* @param propValue the new value to coerce to some type
|
|
241
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
242
|
+
* @returns the parsed/coerced value
|
|
243
|
+
*/
|
|
244
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
245
|
+
// ensure this value is of the correct prop type
|
|
246
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
247
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
248
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
249
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
250
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
251
|
+
}
|
|
252
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
253
|
+
// force it to be a number
|
|
254
|
+
return parseFloat(propValue);
|
|
255
|
+
}
|
|
256
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
257
|
+
// could have been passed as a number or boolean
|
|
258
|
+
// but we still want it as a string
|
|
259
|
+
return String(propValue);
|
|
260
|
+
}
|
|
261
|
+
// redundant return here for better minification
|
|
262
|
+
return propValue;
|
|
263
|
+
}
|
|
264
|
+
// not sure exactly what type we want
|
|
265
|
+
// so no need to change to a different type
|
|
266
|
+
return propValue;
|
|
267
|
+
};
|
|
268
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
269
|
+
const createEvent = (ref, name, flags) => {
|
|
270
|
+
const elm = getElement(ref);
|
|
271
|
+
return {
|
|
272
|
+
emit: (detail) => {
|
|
273
|
+
return emitEvent(elm, name, {
|
|
274
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
275
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
276
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
277
|
+
detail,
|
|
278
|
+
});
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
284
|
+
* @param elm the target of the Event
|
|
285
|
+
* @param name the name to give the custom Event
|
|
286
|
+
* @param opts options for configuring a custom Event
|
|
287
|
+
* @returns the custom Event
|
|
288
|
+
*/
|
|
289
|
+
const emitEvent = (elm, name, opts) => {
|
|
290
|
+
const ev = plt.ce(name, opts);
|
|
291
|
+
elm.dispatchEvent(ev);
|
|
292
|
+
return ev;
|
|
293
|
+
};
|
|
294
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
295
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
296
|
+
let style = styles.get(scopeId);
|
|
297
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
298
|
+
style = (style || new CSSStyleSheet());
|
|
299
|
+
if (typeof style === 'string') {
|
|
300
|
+
style = cssText;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
style.replaceSync(cssText);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
style = cssText;
|
|
308
|
+
}
|
|
309
|
+
styles.set(scopeId, style);
|
|
310
|
+
};
|
|
311
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
312
|
+
let scopeId = getScopeId(cmpMeta, mode);
|
|
313
|
+
const style = styles.get(scopeId);
|
|
314
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
315
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
316
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
317
|
+
if (style) {
|
|
318
|
+
if (typeof style === 'string') {
|
|
319
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
320
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
321
|
+
let styleElm;
|
|
322
|
+
if (!appliedStyles) {
|
|
323
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
324
|
+
}
|
|
325
|
+
if (!appliedStyles.has(scopeId)) {
|
|
326
|
+
{
|
|
327
|
+
{
|
|
328
|
+
styleElm = doc.createElement('style');
|
|
329
|
+
styleElm.innerHTML = style;
|
|
330
|
+
}
|
|
331
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
332
|
+
}
|
|
333
|
+
if (appliedStyles) {
|
|
334
|
+
appliedStyles.add(scopeId);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
339
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return scopeId;
|
|
343
|
+
};
|
|
344
|
+
const attachStyles = (hostRef) => {
|
|
345
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
346
|
+
const elm = hostRef.$hostElement$;
|
|
347
|
+
const flags = cmpMeta.$flags$;
|
|
348
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
349
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$);
|
|
350
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
351
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
352
|
+
// or this browser doesn't support native shadow dom
|
|
353
|
+
// and this host element was NOT created with SSR
|
|
354
|
+
// let's pick out the inner content for slot projection
|
|
355
|
+
// create a node to represent where the original
|
|
356
|
+
// content was first placed, which is useful later on
|
|
357
|
+
// DOM WRITE!!
|
|
358
|
+
elm['s-sc'] = scopeId;
|
|
359
|
+
elm.classList.add(scopeId + '-h');
|
|
360
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
361
|
+
elm.classList.add(scopeId + '-s');
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
endAttachStyles();
|
|
365
|
+
};
|
|
366
|
+
const getScopeId = (cmp, mode) => 'sc-' + (mode && cmp.$flags$ & 32 /* CMP_FLAGS.hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
|
|
335
367
|
/**
|
|
336
368
|
* Production setAccessor() function based on Preact by
|
|
337
369
|
* Jason Miller (@developit)
|
|
@@ -468,7 +500,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
468
500
|
}
|
|
469
501
|
}
|
|
470
502
|
}
|
|
471
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
503
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
472
504
|
newValue = newValue === true ? '' : newValue;
|
|
473
505
|
if (xlink) {
|
|
474
506
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
@@ -486,7 +518,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
486
518
|
// if the element passed in is a shadow root, which is a document fragment
|
|
487
519
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
488
520
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
489
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
521
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
490
522
|
? newVnode.$elm$.host
|
|
491
523
|
: newVnode.$elm$;
|
|
492
524
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -504,6 +536,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
504
536
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
505
537
|
}
|
|
506
538
|
};
|
|
539
|
+
/**
|
|
540
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
541
|
+
*
|
|
542
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
543
|
+
* @param newParentVNode the parent VNode from the current render
|
|
544
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
545
|
+
* children, for which we will create a new DOM node
|
|
546
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
547
|
+
* @returns the newly created node
|
|
548
|
+
*/
|
|
507
549
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
508
550
|
// tslint:disable-next-line: prefer-const
|
|
509
551
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -521,16 +563,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
521
563
|
}
|
|
522
564
|
newVNode.$flags$ |= newVNode.$children$
|
|
523
565
|
? // slot element has fallback content
|
|
524
|
-
2 /* isSlotFallback */
|
|
566
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
525
567
|
: // slot element does not have fallback content
|
|
526
|
-
1 /* isSlotReference */;
|
|
568
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
527
569
|
}
|
|
528
570
|
}
|
|
529
571
|
if (newVNode.$text$ !== null) {
|
|
530
572
|
// create text node
|
|
531
573
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
532
574
|
}
|
|
533
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
575
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
534
576
|
// create a slot reference node
|
|
535
577
|
elm = newVNode.$elm$ =
|
|
536
578
|
doc.createTextNode('');
|
|
@@ -540,7 +582,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
540
582
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
541
583
|
}
|
|
542
584
|
// create element
|
|
543
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
585
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
544
586
|
? 'slot-fb'
|
|
545
587
|
: newVNode.$tag$)
|
|
546
588
|
);
|
|
@@ -580,7 +622,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
580
622
|
}
|
|
581
623
|
{
|
|
582
624
|
elm['s-hn'] = hostTagName;
|
|
583
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
625
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
584
626
|
// remember the content reference comment
|
|
585
627
|
elm['s-sr'] = true;
|
|
586
628
|
// remember the content reference comment
|
|
@@ -599,7 +641,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
599
641
|
return elm;
|
|
600
642
|
};
|
|
601
643
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
602
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
644
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
603
645
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
604
646
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
605
647
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -620,7 +662,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
620
662
|
putBackInOriginalLocation(childNode, recursive);
|
|
621
663
|
}
|
|
622
664
|
}
|
|
623
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
665
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
624
666
|
};
|
|
625
667
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
626
668
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
@@ -662,6 +704,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
662
704
|
}
|
|
663
705
|
}
|
|
664
706
|
};
|
|
707
|
+
/**
|
|
708
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
709
|
+
* traversing the two collections of children, identifying nodes that are
|
|
710
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
711
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
712
|
+
*
|
|
713
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
714
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
715
|
+
* 'windows' by storing start and end indices and references to the
|
|
716
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
717
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
718
|
+
* no children left to update by doing the following:
|
|
719
|
+
*
|
|
720
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
721
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
722
|
+
* only with a window bounded by the highlighted elements:
|
|
723
|
+
*
|
|
724
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
725
|
+
* ^^^^^^ ^^^^^^
|
|
726
|
+
*
|
|
727
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
728
|
+
* across the windows. This will basically detect elements which haven't
|
|
729
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
730
|
+
* VNode elements (represented as HTML):
|
|
731
|
+
*
|
|
732
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
733
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
734
|
+
*
|
|
735
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
736
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
737
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
738
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
739
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
740
|
+
*
|
|
741
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
742
|
+
* window corresponds to the element at the end of the other window. This is
|
|
743
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
744
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
745
|
+
* children nodes themselves have not changed but merely moved in the
|
|
746
|
+
* following example:
|
|
747
|
+
*
|
|
748
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
749
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
750
|
+
*
|
|
751
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
752
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
753
|
+
* DOM.
|
|
754
|
+
*
|
|
755
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
756
|
+
* nodes in the old children which have the same key as the first element in
|
|
757
|
+
* our window on the new children. If we find such a node we handle calling
|
|
758
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
759
|
+
* what we find.
|
|
760
|
+
*
|
|
761
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
762
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
763
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
764
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
765
|
+
* children has collapsed we still have more nodes on the new children that
|
|
766
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
767
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
768
|
+
* sure the corresponding DOM nodes are removed.
|
|
769
|
+
*
|
|
770
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
771
|
+
* @param oldCh the old children of the parent node
|
|
772
|
+
* @param newVNode the new VNode which will replace the parent
|
|
773
|
+
* @param newCh the new children of the parent node
|
|
774
|
+
*/
|
|
665
775
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
666
776
|
let oldStartIdx = 0;
|
|
667
777
|
let newStartIdx = 0;
|
|
@@ -677,7 +787,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
677
787
|
let elmToMove;
|
|
678
788
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
679
789
|
if (oldStartVnode == null) {
|
|
680
|
-
//
|
|
790
|
+
// VNode might have been moved left
|
|
681
791
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
682
792
|
}
|
|
683
793
|
else if (oldEndVnode == null) {
|
|
@@ -690,37 +800,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
690
800
|
newEndVnode = newCh[--newEndIdx];
|
|
691
801
|
}
|
|
692
802
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
803
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
804
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
805
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
806
|
+
// since things are matched up in order.
|
|
693
807
|
patch(oldStartVnode, newStartVnode);
|
|
694
808
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
695
809
|
newStartVnode = newCh[++newStartIdx];
|
|
696
810
|
}
|
|
697
811
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
812
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
813
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
814
|
+
// need to move any DOM Nodes.
|
|
698
815
|
patch(oldEndVnode, newEndVnode);
|
|
699
816
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
700
817
|
newEndVnode = newCh[--newEndIdx];
|
|
701
818
|
}
|
|
702
819
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
703
|
-
// Vnode moved right
|
|
820
|
+
// case: "Vnode moved right"
|
|
821
|
+
//
|
|
822
|
+
// We've found that the last node in our window on the new children is
|
|
823
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
824
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
825
|
+
// nodes:
|
|
826
|
+
//
|
|
827
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
828
|
+
// ^^^^^^^^^^^
|
|
829
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
830
|
+
// ^^^^^^^^^^^^^
|
|
831
|
+
//
|
|
832
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
833
|
+
// and move the DOM element for `oldStartVnode`.
|
|
704
834
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
705
835
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
706
836
|
}
|
|
707
837
|
patch(oldStartVnode, newEndVnode);
|
|
838
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
839
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
840
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
841
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
842
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
843
|
+
//
|
|
844
|
+
// <old-start-node />
|
|
845
|
+
// <some-intervening-node />
|
|
846
|
+
// <old-end-node />
|
|
847
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
848
|
+
// <next-sibling />
|
|
849
|
+
//
|
|
850
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
851
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
852
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
853
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
854
|
+
// append it to the children of the parent element.
|
|
708
855
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
709
856
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
710
857
|
newEndVnode = newCh[--newEndIdx];
|
|
711
858
|
}
|
|
712
859
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
713
|
-
// Vnode moved left
|
|
860
|
+
// case: "Vnode moved left"
|
|
861
|
+
//
|
|
862
|
+
// We've found that the first node in our window on the new children is
|
|
863
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
864
|
+
// Visually, this is the layout of these two nodes:
|
|
865
|
+
//
|
|
866
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
867
|
+
// ^^^^^^^^^^^^^
|
|
868
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
869
|
+
// ^^^^^^^^^^^
|
|
870
|
+
//
|
|
871
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
872
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
873
|
+
// children etc) but we also need to move the DOM node to which
|
|
874
|
+
// `oldEndVnode` corresponds.
|
|
714
875
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
715
876
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
716
877
|
}
|
|
717
878
|
patch(oldEndVnode, newStartVnode);
|
|
879
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
880
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
881
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
882
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
883
|
+
// future.
|
|
718
884
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
719
885
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
720
886
|
newStartVnode = newCh[++newStartIdx];
|
|
721
887
|
}
|
|
722
888
|
else {
|
|
723
|
-
//
|
|
889
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
890
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
891
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
892
|
+
// component.
|
|
893
|
+
//
|
|
894
|
+
// First we check to see if there are any nodes in the array of old
|
|
895
|
+
// children which have the same key as the first node in the new
|
|
896
|
+
// children.
|
|
724
897
|
idxInOld = -1;
|
|
725
898
|
{
|
|
726
899
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
@@ -731,23 +904,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
731
904
|
}
|
|
732
905
|
}
|
|
733
906
|
if (idxInOld >= 0) {
|
|
907
|
+
// We found a node in the old children which matches up with the first
|
|
908
|
+
// node in the new children! So let's deal with that
|
|
734
909
|
elmToMove = oldCh[idxInOld];
|
|
735
910
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
911
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
736
912
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
737
913
|
}
|
|
738
914
|
else {
|
|
739
915
|
patch(elmToMove, newStartVnode);
|
|
916
|
+
// invalidate the matching old node so that we won't try to update it
|
|
917
|
+
// again later on
|
|
740
918
|
oldCh[idxInOld] = undefined;
|
|
741
919
|
node = elmToMove.$elm$;
|
|
742
920
|
}
|
|
743
921
|
newStartVnode = newCh[++newStartIdx];
|
|
744
922
|
}
|
|
745
923
|
else {
|
|
746
|
-
//
|
|
924
|
+
// We either didn't find an element in the old children that matches
|
|
925
|
+
// the key of the first new child OR the build is not using `key`
|
|
926
|
+
// attributes at all. In either case we need to create a new element
|
|
927
|
+
// for the new node.
|
|
747
928
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
748
929
|
newStartVnode = newCh[++newStartIdx];
|
|
749
930
|
}
|
|
750
931
|
if (node) {
|
|
932
|
+
// if we created a new node then handle inserting it to the DOM
|
|
751
933
|
{
|
|
752
934
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
753
935
|
}
|
|
@@ -755,21 +937,43 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
755
937
|
}
|
|
756
938
|
}
|
|
757
939
|
if (oldStartIdx > oldEndIdx) {
|
|
940
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
758
941
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
759
942
|
}
|
|
760
943
|
else if (newStartIdx > newEndIdx) {
|
|
944
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
945
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
946
|
+
// relevant DOM nodes)
|
|
761
947
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
762
948
|
}
|
|
763
949
|
};
|
|
764
|
-
|
|
950
|
+
/**
|
|
951
|
+
* Compare two VNodes to determine if they are the same
|
|
952
|
+
*
|
|
953
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
954
|
+
* information set on the two VNodes and can be misleading under certain
|
|
955
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
956
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
957
|
+
* checking that they have the same tag.
|
|
958
|
+
*
|
|
959
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
960
|
+
* changing order within a `children` array or something along those lines then
|
|
961
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
962
|
+
*
|
|
963
|
+
* @param leftVNode the first VNode to check
|
|
964
|
+
* @param rightVNode the second VNode to check
|
|
965
|
+
* @returns whether they're equal or not
|
|
966
|
+
*/
|
|
967
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
765
968
|
// compare if two vnode to see if they're "technically" the same
|
|
766
969
|
// need to have the same element tag, and same key to be the same
|
|
767
|
-
if (
|
|
768
|
-
if (
|
|
769
|
-
return
|
|
970
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
971
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
972
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
770
973
|
}
|
|
974
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
771
975
|
{
|
|
772
|
-
return
|
|
976
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
773
977
|
}
|
|
774
978
|
}
|
|
775
979
|
return false;
|
|
@@ -782,6 +986,14 @@ const referenceNode = (node) => {
|
|
|
782
986
|
return (node && node['s-ol']) || node;
|
|
783
987
|
};
|
|
784
988
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
989
|
+
/**
|
|
990
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
991
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
992
|
+
* children of the two nodes (if any).
|
|
993
|
+
*
|
|
994
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
995
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
996
|
+
*/
|
|
785
997
|
const patch = (oldVNode, newVNode) => {
|
|
786
998
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
787
999
|
const oldChildren = oldVNode.$children$;
|
|
@@ -795,7 +1007,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
795
1007
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
796
1008
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
797
1009
|
}
|
|
798
|
-
// element node
|
|
799
1010
|
{
|
|
800
1011
|
if (tag === 'slot')
|
|
801
1012
|
;
|
|
@@ -808,6 +1019,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
808
1019
|
}
|
|
809
1020
|
if (oldChildren !== null && newChildren !== null) {
|
|
810
1021
|
// looks like there's child vnodes for both the old and new vnodes
|
|
1022
|
+
// so we need to call `updateChildren` to reconcile them
|
|
811
1023
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
812
1024
|
}
|
|
813
1025
|
else if (newChildren !== null) {
|
|
@@ -848,7 +1060,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
848
1060
|
let nodeType;
|
|
849
1061
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
850
1062
|
childNode = childNodes[i];
|
|
851
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1063
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
852
1064
|
if (childNode['s-sr']) {
|
|
853
1065
|
// this is a slot fallback node
|
|
854
1066
|
// get the slot name for this slot reference node
|
|
@@ -860,7 +1072,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
860
1072
|
nodeType = childNodes[j].nodeType;
|
|
861
1073
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
862
1074
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
863
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1075
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
864
1076
|
childNode.hidden = true;
|
|
865
1077
|
break;
|
|
866
1078
|
}
|
|
@@ -869,8 +1081,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
869
1081
|
// this is a default fallback slot node
|
|
870
1082
|
// any element or text node (with content)
|
|
871
1083
|
// should hide the default fallback slot node
|
|
872
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
873
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1084
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1085
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
874
1086
|
childNode.hidden = true;
|
|
875
1087
|
break;
|
|
876
1088
|
}
|
|
@@ -948,13 +1160,13 @@ const relocateSlotContent = (elm) => {
|
|
|
948
1160
|
}
|
|
949
1161
|
}
|
|
950
1162
|
}
|
|
951
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1163
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
952
1164
|
relocateSlotContent(childNode);
|
|
953
1165
|
}
|
|
954
1166
|
}
|
|
955
1167
|
};
|
|
956
1168
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
957
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1169
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
958
1170
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
959
1171
|
return true;
|
|
960
1172
|
}
|
|
@@ -985,7 +1197,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
985
1197
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
986
1198
|
}
|
|
987
1199
|
rootVnode.$tag$ = null;
|
|
988
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1200
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
989
1201
|
hostRef.$vnode$ = rootVnode;
|
|
990
1202
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
991
1203
|
{
|
|
@@ -993,7 +1205,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
993
1205
|
}
|
|
994
1206
|
{
|
|
995
1207
|
contentRef = hostElm['s-cr'];
|
|
996
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1208
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
997
1209
|
// always reset
|
|
998
1210
|
checkSlotFallbackVisibility = false;
|
|
999
1211
|
}
|
|
@@ -1002,7 +1214,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1002
1214
|
{
|
|
1003
1215
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
1004
1216
|
// the disconnectCallback from working
|
|
1005
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1217
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1006
1218
|
if (checkSlotRelocate) {
|
|
1007
1219
|
relocateSlotContent(rootVnode.$elm$);
|
|
1008
1220
|
let relocateData;
|
|
@@ -1060,7 +1272,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1060
1272
|
}
|
|
1061
1273
|
else {
|
|
1062
1274
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
1063
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1275
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1064
1276
|
nodeToRelocate.hidden = true;
|
|
1065
1277
|
}
|
|
1066
1278
|
}
|
|
@@ -1071,37 +1283,11 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1071
1283
|
}
|
|
1072
1284
|
// done moving nodes around
|
|
1073
1285
|
// allow the disconnect callback to work again
|
|
1074
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1286
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1075
1287
|
// always reset
|
|
1076
1288
|
relocateNodes.length = 0;
|
|
1077
1289
|
}
|
|
1078
1290
|
};
|
|
1079
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1080
|
-
const createEvent = (ref, name, flags) => {
|
|
1081
|
-
const elm = getElement(ref);
|
|
1082
|
-
return {
|
|
1083
|
-
emit: (detail) => {
|
|
1084
|
-
return emitEvent(elm, name, {
|
|
1085
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1086
|
-
composed: !!(flags & 2 /* Composed */),
|
|
1087
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1088
|
-
detail,
|
|
1089
|
-
});
|
|
1090
|
-
},
|
|
1091
|
-
};
|
|
1092
|
-
};
|
|
1093
|
-
/**
|
|
1094
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
1095
|
-
* @param elm the target of the Event
|
|
1096
|
-
* @param name the name to give the custom Event
|
|
1097
|
-
* @param opts options for configuring a custom Event
|
|
1098
|
-
* @returns the custom Event
|
|
1099
|
-
*/
|
|
1100
|
-
const emitEvent = (elm, name, opts) => {
|
|
1101
|
-
const ev = plt.ce(name, opts);
|
|
1102
|
-
elm.dispatchEvent(ev);
|
|
1103
|
-
return ev;
|
|
1104
|
-
};
|
|
1105
1291
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1106
1292
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1107
1293
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -1109,10 +1295,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
1109
1295
|
};
|
|
1110
1296
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1111
1297
|
{
|
|
1112
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1298
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1113
1299
|
}
|
|
1114
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1115
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1300
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1301
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1116
1302
|
return;
|
|
1117
1303
|
}
|
|
1118
1304
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -1128,7 +1314,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1128
1314
|
let promise;
|
|
1129
1315
|
if (isInitialLoad) {
|
|
1130
1316
|
{
|
|
1131
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1317
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1132
1318
|
if (hostRef.$queuedListeners$) {
|
|
1133
1319
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1134
1320
|
hostRef.$queuedListeners$ = null;
|
|
@@ -1174,7 +1360,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1174
1360
|
}
|
|
1175
1361
|
else {
|
|
1176
1362
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1177
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1363
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1178
1364
|
childrenPromises.length = 0;
|
|
1179
1365
|
}
|
|
1180
1366
|
}
|
|
@@ -1184,10 +1370,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1184
1370
|
renderingRef = instance;
|
|
1185
1371
|
instance = instance.render && instance.render();
|
|
1186
1372
|
{
|
|
1187
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1373
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1188
1374
|
}
|
|
1189
1375
|
{
|
|
1190
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1376
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1191
1377
|
}
|
|
1192
1378
|
{
|
|
1193
1379
|
{
|
|
@@ -1213,8 +1399,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1213
1399
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1214
1400
|
const instance = hostRef.$lazyInstance$ ;
|
|
1215
1401
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1216
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1217
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1402
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1403
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1218
1404
|
{
|
|
1219
1405
|
// DOM WRITE!
|
|
1220
1406
|
addHydratedFlag(elm);
|
|
@@ -1246,10 +1432,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1246
1432
|
hostRef.$onRenderResolve$();
|
|
1247
1433
|
hostRef.$onRenderResolve$ = undefined;
|
|
1248
1434
|
}
|
|
1249
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1435
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1250
1436
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1251
1437
|
}
|
|
1252
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1438
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1253
1439
|
}
|
|
1254
1440
|
// ( •_•)
|
|
1255
1441
|
// ( •_•)>⌐■-■
|
|
@@ -1260,7 +1446,7 @@ const forceUpdate = (ref) => {
|
|
|
1260
1446
|
const hostRef = getHostRef(ref);
|
|
1261
1447
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1262
1448
|
if (isConnected &&
|
|
1263
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1449
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1264
1450
|
scheduleUpdate(hostRef, false);
|
|
1265
1451
|
}
|
|
1266
1452
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1291,53 +1477,6 @@ const then = (promise, thenFn) => {
|
|
|
1291
1477
|
};
|
|
1292
1478
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1293
1479
|
;
|
|
1294
|
-
/**
|
|
1295
|
-
* Parse a new property value for a given property type.
|
|
1296
|
-
*
|
|
1297
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
1298
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
1299
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
1300
|
-
* 2. the type stored from `propType`.
|
|
1301
|
-
*
|
|
1302
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
1303
|
-
*
|
|
1304
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
1305
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
1306
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
1307
|
-
* ```tsx
|
|
1308
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
1309
|
-
* ```
|
|
1310
|
-
*
|
|
1311
|
-
* HTML prop values on the other hand, will always a string
|
|
1312
|
-
*
|
|
1313
|
-
* @param propValue the new value to coerce to some type
|
|
1314
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
1315
|
-
* @returns the parsed/coerced value
|
|
1316
|
-
*/
|
|
1317
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1318
|
-
// ensure this value is of the correct prop type
|
|
1319
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1320
|
-
if (propType & 4 /* Boolean */) {
|
|
1321
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1322
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1323
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1324
|
-
}
|
|
1325
|
-
if (propType & 2 /* Number */) {
|
|
1326
|
-
// force it to be a number
|
|
1327
|
-
return parseFloat(propValue);
|
|
1328
|
-
}
|
|
1329
|
-
if (propType & 1 /* String */) {
|
|
1330
|
-
// could have been passed as a number or boolean
|
|
1331
|
-
// but we still want it as a string
|
|
1332
|
-
return String(propValue);
|
|
1333
|
-
}
|
|
1334
|
-
// redundant return here for better minification
|
|
1335
|
-
return propValue;
|
|
1336
|
-
}
|
|
1337
|
-
// not sure exactly what type we want
|
|
1338
|
-
// so no need to change to a different type
|
|
1339
|
-
return propValue;
|
|
1340
|
-
};
|
|
1341
1480
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1342
1481
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1343
1482
|
// check our new property value against our internal value
|
|
@@ -1350,13 +1489,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1350
1489
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1351
1490
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1352
1491
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1353
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1492
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1354
1493
|
// gadzooks! the property's value has changed!!
|
|
1355
1494
|
// set our new value!
|
|
1356
1495
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1357
1496
|
if (instance) {
|
|
1358
1497
|
// get an array of method names of watch functions to call
|
|
1359
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1498
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1360
1499
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1361
1500
|
if (watchMethods) {
|
|
1362
1501
|
// this instance is watching for when this property changed
|
|
@@ -1371,7 +1510,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1371
1510
|
});
|
|
1372
1511
|
}
|
|
1373
1512
|
}
|
|
1374
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1513
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1375
1514
|
// looks like this value actually changed, so we've got work to do!
|
|
1376
1515
|
// but only if we've already rendered, otherwise just chill out
|
|
1377
1516
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1381,6 +1520,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1381
1520
|
}
|
|
1382
1521
|
}
|
|
1383
1522
|
};
|
|
1523
|
+
/**
|
|
1524
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1525
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1526
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1527
|
+
*
|
|
1528
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1529
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1530
|
+
* @param flags a number used to store a series of bit flags
|
|
1531
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1532
|
+
*/
|
|
1384
1533
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1385
1534
|
if (cmpMeta.$members$) {
|
|
1386
1535
|
if (Cstr.watchers) {
|
|
@@ -1390,8 +1539,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1390
1539
|
const members = Object.entries(cmpMeta.$members$);
|
|
1391
1540
|
const prototype = Cstr.prototype;
|
|
1392
1541
|
members.map(([memberName, [memberFlags]]) => {
|
|
1393
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1394
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1542
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1543
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1395
1544
|
// proxyComponent - prop
|
|
1396
1545
|
Object.defineProperty(prototype, memberName, {
|
|
1397
1546
|
get() {
|
|
@@ -1406,8 +1555,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1406
1555
|
enumerable: true,
|
|
1407
1556
|
});
|
|
1408
1557
|
}
|
|
1409
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1410
|
-
memberFlags & 64 /* Method */) {
|
|
1558
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1559
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1411
1560
|
// proxyComponent - method
|
|
1412
1561
|
Object.defineProperty(prototype, memberName, {
|
|
1413
1562
|
value(...args) {
|
|
@@ -1417,7 +1566,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1417
1566
|
});
|
|
1418
1567
|
}
|
|
1419
1568
|
});
|
|
1420
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1569
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1421
1570
|
const attrNameToPropName = new Map();
|
|
1422
1571
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1423
1572
|
plt.jmp(() => {
|
|
@@ -1473,11 +1622,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1473
1622
|
// create an array of attributes to observe
|
|
1474
1623
|
// and also create a map of html attribute name to js property name
|
|
1475
1624
|
Cstr.observedAttributes = members
|
|
1476
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1625
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1477
1626
|
.map(([propName, m]) => {
|
|
1478
1627
|
const attrName = m[1] || propName;
|
|
1479
1628
|
attrNameToPropName.set(attrName, propName);
|
|
1480
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1629
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1481
1630
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1482
1631
|
}
|
|
1483
1632
|
return attrName;
|
|
@@ -1488,10 +1637,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1488
1637
|
};
|
|
1489
1638
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1490
1639
|
// initializeComponent
|
|
1491
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1640
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1492
1641
|
{
|
|
1493
1642
|
// we haven't initialized this element yet
|
|
1494
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1643
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1495
1644
|
// lazy loaded components
|
|
1496
1645
|
// request the component's implementation to be
|
|
1497
1646
|
// wired up with the host element
|
|
@@ -1509,7 +1658,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1509
1658
|
{
|
|
1510
1659
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1511
1660
|
}
|
|
1512
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1661
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1513
1662
|
Cstr.isProxied = true;
|
|
1514
1663
|
}
|
|
1515
1664
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1517,7 +1666,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1517
1666
|
// but let's keep track of when we start and stop
|
|
1518
1667
|
// so that the getters/setters don't incorrectly step on data
|
|
1519
1668
|
{
|
|
1520
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1669
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1521
1670
|
}
|
|
1522
1671
|
// construct the lazy-loaded component implementation
|
|
1523
1672
|
// passing the hostRef is very important during
|
|
@@ -1530,10 +1679,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1530
1679
|
consoleError(e);
|
|
1531
1680
|
}
|
|
1532
1681
|
{
|
|
1533
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1682
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1534
1683
|
}
|
|
1535
1684
|
{
|
|
1536
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1685
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1537
1686
|
}
|
|
1538
1687
|
endNewInstance();
|
|
1539
1688
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1547,7 +1696,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1547
1696
|
const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
1548
1697
|
if (!styles.has(scopeId)) {
|
|
1549
1698
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1550
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1699
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1551
1700
|
endRegisterStyles();
|
|
1552
1701
|
}
|
|
1553
1702
|
}
|
|
@@ -1574,19 +1723,19 @@ const fireConnectedCallback = (instance) => {
|
|
|
1574
1723
|
}
|
|
1575
1724
|
};
|
|
1576
1725
|
const connectedCallback = (elm) => {
|
|
1577
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1726
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1578
1727
|
const hostRef = getHostRef(elm);
|
|
1579
1728
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1580
1729
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1581
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1730
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1582
1731
|
// first time this component has connected
|
|
1583
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1732
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1584
1733
|
{
|
|
1585
1734
|
// initUpdate
|
|
1586
1735
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1587
1736
|
// in here to act as original content anchors as we move nodes around
|
|
1588
1737
|
// host element has been connected to the DOM
|
|
1589
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1738
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1590
1739
|
setContentReference(elm);
|
|
1591
1740
|
}
|
|
1592
1741
|
}
|
|
@@ -1609,7 +1758,7 @@ const connectedCallback = (elm) => {
|
|
|
1609
1758
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1610
1759
|
if (cmpMeta.$members$) {
|
|
1611
1760
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1612
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1761
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1613
1762
|
const value = elm[memberName];
|
|
1614
1763
|
delete elm[memberName];
|
|
1615
1764
|
elm[memberName] = value;
|
|
@@ -1643,7 +1792,7 @@ const setContentReference = (elm) => {
|
|
|
1643
1792
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1644
1793
|
};
|
|
1645
1794
|
const disconnectedCallback = (elm) => {
|
|
1646
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1795
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1647
1796
|
const hostRef = getHostRef(elm);
|
|
1648
1797
|
const instance = hostRef.$lazyInstance$ ;
|
|
1649
1798
|
{
|
|
@@ -1698,7 +1847,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1698
1847
|
super(self);
|
|
1699
1848
|
self = this;
|
|
1700
1849
|
registerHost(self, cmpMeta);
|
|
1701
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1850
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1702
1851
|
// this component is using shadow dom
|
|
1703
1852
|
// and this browser supports shadow dom
|
|
1704
1853
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1707,7 +1856,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1707
1856
|
{
|
|
1708
1857
|
self.attachShadow({
|
|
1709
1858
|
mode: 'open',
|
|
1710
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */),
|
|
1859
|
+
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
|
1711
1860
|
});
|
|
1712
1861
|
}
|
|
1713
1862
|
}
|
|
@@ -1736,7 +1885,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1736
1885
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1737
1886
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1738
1887
|
cmpTags.push(tagName);
|
|
1739
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1888
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1740
1889
|
}
|
|
1741
1890
|
});
|
|
1742
1891
|
});
|
|
@@ -1758,11 +1907,45 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1758
1907
|
// Fallback appLoad event
|
|
1759
1908
|
endBootstrap();
|
|
1760
1909
|
};
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
|
|
1910
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1911
|
+
if (listeners) {
|
|
1912
|
+
listeners.map(([flags, name, method]) => {
|
|
1913
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1914
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1915
|
+
const opts = hostListenerOpts(flags);
|
|
1916
|
+
plt.ael(target, name, handler, opts);
|
|
1917
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1764
1920
|
};
|
|
1765
|
-
const
|
|
1921
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1922
|
+
try {
|
|
1923
|
+
{
|
|
1924
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1925
|
+
// instance is ready, let's call it's member method for this event
|
|
1926
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1927
|
+
}
|
|
1928
|
+
else {
|
|
1929
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
catch (e) {
|
|
1934
|
+
consoleError(e);
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1938
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
1939
|
+
return doc;
|
|
1940
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
1941
|
+
return win;
|
|
1942
|
+
if (flags & 16 /* LISTENER_FLAGS.TargetBody */)
|
|
1943
|
+
return doc.body;
|
|
1944
|
+
return elm;
|
|
1945
|
+
};
|
|
1946
|
+
// prettier-ignore
|
|
1947
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1948
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1766
1949
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1767
1950
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1768
1951
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1807,15 +1990,36 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1807
1990
|
return importedModule[exportName];
|
|
1808
1991
|
}, consoleError);
|
|
1809
1992
|
};
|
|
1810
|
-
const styles = new Map();
|
|
1993
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1811
1994
|
const modeResolutionChain = [];
|
|
1995
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1996
|
+
const doc = win.document || { head: {} };
|
|
1997
|
+
const plt = {
|
|
1998
|
+
$flags$: 0,
|
|
1999
|
+
$resourcesUrl$: '',
|
|
2000
|
+
jmp: (h) => h(),
|
|
2001
|
+
raf: (h) => requestAnimationFrame(h),
|
|
2002
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
2003
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
2004
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
2005
|
+
};
|
|
2006
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
2007
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
2008
|
+
try {
|
|
2009
|
+
new CSSStyleSheet();
|
|
2010
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
2011
|
+
}
|
|
2012
|
+
catch (e) { }
|
|
2013
|
+
return false;
|
|
2014
|
+
})()
|
|
2015
|
+
;
|
|
1812
2016
|
const queueDomReads = [];
|
|
1813
2017
|
const queueDomWrites = [];
|
|
1814
2018
|
const queueTask = (queue, write) => (cb) => {
|
|
1815
2019
|
queue.push(cb);
|
|
1816
2020
|
if (!queuePending) {
|
|
1817
2021
|
queuePending = true;
|
|
1818
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
2022
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1819
2023
|
nextTick(flush);
|
|
1820
2024
|
}
|
|
1821
2025
|
else {
|
|
@@ -1852,12 +2056,6 @@ const flush = () => {
|
|
|
1852
2056
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1853
2057
|
const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
|
|
1854
2058
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1855
|
-
const Build = {
|
|
1856
|
-
isDev: false,
|
|
1857
|
-
isBrowser: true,
|
|
1858
|
-
isServer: false,
|
|
1859
|
-
isTesting: false,
|
|
1860
|
-
};
|
|
1861
2059
|
|
|
1862
2060
|
exports.Build = Build;
|
|
1863
2061
|
exports.Host = Host;
|