@siemens/ix 1.1.0-beta.5 → 1.1.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/{base-button-eb1d47db.js → base-button-6ef79cb6.js} +3 -3
- package/dist/cjs/{index-1e4a348f.js → index-40761405.js} +467 -275
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/ix-animated-tab_2.cjs.entry.js +7 -12
- package/dist/cjs/ix-application-header.cjs.entry.js +2 -1
- package/dist/cjs/ix-basic-navigation.cjs.entry.js +2 -4
- package/dist/cjs/ix-blind.cjs.entry.js +2 -9
- package/dist/cjs/ix-breadcrumb_2.cjs.entry.js +6 -11
- package/dist/cjs/ix-button.cjs.entry.js +2 -25
- package/dist/cjs/ix-category-filter.cjs.entry.js +16 -27
- package/dist/cjs/ix-chip.cjs.entry.js +4 -13
- package/dist/cjs/ix-counter-pill.cjs.entry.js +3 -10
- package/dist/cjs/ix-date-picker_2.cjs.entry.js +23 -91
- package/dist/cjs/ix-date-time-card.cjs.entry.js +1 -7
- package/dist/cjs/ix-datetime-picker.cjs.entry.js +9 -53
- package/dist/cjs/ix-drawer.cjs.entry.js +2 -20
- package/dist/cjs/ix-dropdown_2.cjs.entry.js +7 -30
- package/dist/cjs/ix-event-list_2.cjs.entry.js +6 -19
- package/dist/cjs/ix-expanding-search.cjs.entry.js +1 -10
- package/dist/cjs/ix-filter-chip.cjs.entry.js +1 -4
- package/dist/cjs/ix-flip-tile_2.cjs.entry.js +4 -1
- package/dist/cjs/ix-group_3.cjs.entry.js +9 -26
- package/dist/cjs/ix-icon-button.cjs.entry.js +8 -17
- package/dist/cjs/ix-icon.cjs.entry.js +4 -1
- package/dist/cjs/ix-input-group.cjs.entry.js +1 -1
- package/dist/cjs/ix-kpi.cjs.entry.js +4 -7
- package/dist/cjs/ix-map-navigation_2.cjs.entry.js +44 -9
- package/dist/cjs/ix-menu_9.cjs.entry.js +26 -82
- package/dist/cjs/ix-message-bar.cjs.entry.js +3 -7
- package/dist/cjs/ix-modal-example.cjs.entry.js +1 -1
- package/dist/cjs/ix-modal_2.cjs.entry.js +2 -2
- package/dist/cjs/ix-pill.cjs.entry.js +4 -10
- package/dist/cjs/ix-select_2.cjs.entry.js +8 -34
- package/dist/cjs/ix-spinner.cjs.entry.js +1 -7
- package/dist/cjs/ix-split-button_2.cjs.entry.js +5 -28
- package/dist/cjs/ix-tab-item.cjs.entry.js +2 -22
- package/dist/cjs/ix-tabs.cjs.entry.js +5 -20
- package/dist/cjs/ix-tile.cjs.entry.js +1 -4
- package/dist/cjs/ix-toast_2.cjs.entry.js +4 -16
- package/dist/cjs/ix-toggle.cjs.entry.js +1 -26
- package/dist/cjs/ix-tree_2.cjs.entry.js +8 -5
- package/dist/cjs/ix-upload.cjs.entry.js +2 -46
- package/dist/cjs/ix-validation-tooltip.cjs.entry.js +4 -6
- package/dist/cjs/ix-workflow-step_2.cjs.entry.js +1 -31
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{modal-5be2b1a3.js → modal-42934387.js} +10 -27
- package/dist/cjs/my-component.cjs.entry.js +1 -1
- package/dist/cjs/siemens-ix.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/animated-tab/animated-tab.js +53 -44
- package/dist/collection/components/animated-tabs/animated-tabs.js +122 -123
- package/dist/collection/components/application-header/application-header.js +36 -31
- package/dist/collection/components/basic-navigation/basic-navigation.js +51 -52
- package/dist/collection/components/blind/blind.js +83 -83
- package/dist/collection/components/breadcrumb/breadcrumb.css +2 -7
- package/dist/collection/components/breadcrumb/breadcrumb.js +119 -129
- package/dist/collection/components/breadcrumb-item/breadcrumb-item.js +53 -44
- package/dist/collection/components/button/base-button.js +3 -3
- package/dist/collection/components/button/button.js +143 -161
- package/dist/collection/components/category-filter/category-filter.js +355 -372
- package/dist/collection/components/chip/chip.js +154 -160
- package/dist/collection/components/counter-pill/counter-pill.js +102 -105
- package/dist/collection/components/date-picker/date-picker.js +352 -406
- package/dist/collection/components/date-time-card/date-time-card.js +54 -60
- package/dist/collection/components/datetime-picker/datetime-picker.js +399 -442
- package/dist/collection/components/datetime-picker/event.js +0 -8
- package/dist/collection/components/drawer/drawer.js +185 -197
- package/dist/collection/components/dropdown/dropdown.css +2 -0
- package/dist/collection/components/dropdown/dropdown.js +240 -245
- package/dist/collection/components/dropdown-item/dropdown-item.js +147 -149
- package/dist/collection/components/event-list/event-list.js +85 -92
- package/dist/collection/components/event-list-item/event-list-item.js +136 -133
- package/dist/collection/components/expanding-search/expanding-search.js +112 -116
- package/dist/collection/components/filter-chip/filter-chip.js +51 -50
- package/dist/collection/components/flip-tile/flip-tile.js +74 -72
- package/dist/collection/components/flip-tile-content/flip-tile-content.js +12 -9
- package/dist/collection/components/group/group.js +201 -221
- package/dist/collection/components/group-dropdown-item/group-dropdown-item.js +53 -45
- package/dist/collection/components/group-item/group-item.js +165 -164
- package/dist/collection/components/icon/icon.js +77 -68
- package/dist/collection/components/icon-button/icon-button.js +207 -217
- package/dist/collection/components/input-group/input-group.js +12 -13
- package/dist/collection/components/kpi/kpi.js +106 -110
- package/dist/collection/components/map-navigation/map-navigation.css +3 -10
- package/dist/collection/components/map-navigation/map-navigation.js +186 -185
- package/dist/collection/components/map-navigation-overlay/map-navigation-overlay.css +1 -0
- package/dist/collection/components/map-navigation-overlay/map-navigation-overlay.js +124 -88
- package/dist/collection/components/menu/menu.css +2 -3
- package/dist/collection/components/menu/menu.js +483 -527
- package/dist/collection/components/menu-about/menu-about.js +99 -98
- package/dist/collection/components/menu-about-item/menu-about-item.js +36 -28
- package/dist/collection/components/menu-about-news/menu-about-news.js +160 -174
- package/dist/collection/components/menu-avatar/menu-avatar.js +102 -101
- package/dist/collection/components/menu-avatar-item/menu-avatar-item.js +72 -60
- package/dist/collection/components/menu-item/menu-item.js +128 -127
- package/dist/collection/components/menu-settings/menu-settings.js +94 -94
- package/dist/collection/components/menu-settings-item/menu-settings-item.js +36 -28
- package/dist/collection/components/message-bar/message-bar.js +78 -77
- package/dist/collection/components/modal/modal.js +404 -418
- package/dist/collection/components/modal-container/modal-container.js +51 -44
- package/dist/collection/components/my-component/example-modal.js +2 -10
- package/dist/collection/components/my-component/my-component.js +11 -7
- package/dist/collection/components/pill/pill.js +119 -122
- package/dist/collection/components/select/select.js +282 -303
- package/dist/collection/components/select-item/select-item.js +134 -129
- package/dist/collection/components/spinner/spinner.js +51 -115
- package/dist/collection/components/split-button/split-button.js +208 -231
- package/dist/collection/components/split-button-item/split-button-item.js +72 -60
- package/dist/collection/components/tab-item/tab-item.js +160 -177
- package/dist/collection/components/tabs/tabs.js +123 -137
- package/dist/collection/components/tile/tile.js +34 -39
- package/dist/collection/components/time-picker/time-picker.js +274 -323
- package/dist/collection/components/toast/toast-container.js +94 -96
- package/dist/collection/components/toast/toast.js +159 -164
- package/dist/collection/components/toggle/toggle.js +189 -209
- package/dist/collection/components/tree/tree-model.js +0 -8
- package/dist/collection/components/tree/tree.js +144 -135
- package/dist/collection/components/tree-item/tree-item.js +111 -102
- package/dist/collection/components/upload/upload.js +276 -319
- package/dist/collection/components/utils/button-variants.js +0 -8
- package/dist/collection/components/utils/notification-color.js +0 -8
- package/dist/collection/components/validation-tooltip/validation-tooltip.js +68 -65
- package/dist/collection/components/workflow-step/workflow-step.js +145 -163
- package/dist/collection/components/workflow-steps/workflow-steps.js +102 -108
- package/dist/components/application-header.js +1 -0
- package/dist/components/base-button.js +3 -3
- package/dist/components/button.js +0 -23
- package/dist/components/date-picker.js +15 -50
- package/dist/components/date-time-card.js +0 -6
- package/dist/components/dropdown-item.js +2 -9
- package/dist/components/dropdown.js +4 -20
- package/dist/components/filter-chip.js +0 -3
- package/dist/components/group-item.js +5 -7
- package/dist/components/icon-button.js +6 -15
- package/dist/components/icon.js +3 -0
- package/dist/components/index.d.ts +65 -5
- package/dist/components/index.js +65 -5
- package/dist/components/ix-animated-tab.js +2 -0
- package/dist/components/ix-animated-tabs.js +4 -11
- package/dist/components/ix-basic-navigation.js +1 -3
- package/dist/components/ix-blind.js +1 -9
- package/dist/components/ix-breadcrumb-item.js +2 -0
- package/dist/components/ix-breadcrumb.js +3 -10
- package/dist/components/ix-category-filter.js +48 -28
- package/dist/components/ix-chip.js +3 -12
- package/dist/components/ix-counter-pill.js +2 -9
- package/dist/components/ix-datetime-picker.js +8 -52
- package/dist/components/ix-drawer.js +1 -19
- package/dist/components/ix-event-list-item.js +4 -6
- package/dist/components/ix-event-list.js +1 -12
- package/dist/components/ix-expanding-search.js +0 -9
- package/dist/components/ix-flip-tile.js +21 -2
- package/dist/components/ix-group-dropdown-item.js +2 -0
- package/dist/components/ix-group.js +1 -19
- package/dist/components/ix-kpi.js +3 -6
- package/dist/components/ix-map-navigation.js +9 -6
- package/dist/components/ix-menu-about-item.js +1 -0
- package/dist/components/ix-menu-about-news.js +2 -12
- package/dist/components/ix-menu-about.js +1 -6
- package/dist/components/ix-menu-avatar.js +3 -3
- package/dist/components/ix-menu-settings-item.js +1 -0
- package/dist/components/ix-menu-settings.js +1 -6
- package/dist/components/ix-menu.js +10 -45
- package/dist/components/ix-message-bar.js +2 -6
- package/dist/components/ix-modal-example.js +38 -2
- package/dist/components/ix-pill.js +3 -9
- package/dist/components/ix-select.js +5 -27
- package/dist/components/ix-split-button-item.js +2 -0
- package/dist/components/ix-split-button.js +1 -26
- package/dist/components/ix-tile.js +0 -3
- package/dist/components/ix-toast-container.js +0 -6
- package/dist/components/ix-toggle.js +0 -25
- package/dist/components/ix-tree.js +24 -6
- package/dist/components/ix-upload.js +18 -48
- package/dist/components/ix-validation-tooltip.js +3 -5
- package/dist/components/ix-workflow-step.js +0 -18
- package/dist/components/ix-workflow-steps.js +0 -12
- package/dist/components/map-navigation-overlay.js +35 -2
- package/dist/components/menu-avatar-item.js +2 -0
- package/dist/components/menu-item.js +4 -9
- package/dist/components/modal.js +9 -26
- package/dist/components/select-item.js +2 -6
- package/dist/components/spinner.js +0 -6
- package/dist/components/tab-item.js +1 -21
- package/dist/components/tabs.js +4 -19
- package/dist/components/time-picker.js +7 -40
- package/dist/components/toast.js +3 -9
- package/dist/components/tree-item.js +3 -0
- package/dist/esm/{base-button-7bfb747f.js → base-button-0b6635df.js} +3 -3
- package/dist/esm/{index-55cfd20d.js → index-b22287de.js} +467 -275
- package/dist/esm/index.js +2 -2
- package/dist/esm/ix-animated-tab_2.entry.js +7 -12
- package/dist/esm/ix-application-header.entry.js +2 -1
- package/dist/esm/ix-basic-navigation.entry.js +2 -4
- package/dist/esm/ix-blind.entry.js +2 -9
- package/dist/esm/ix-breadcrumb_2.entry.js +6 -11
- package/dist/esm/ix-button.entry.js +2 -25
- package/dist/esm/ix-category-filter.entry.js +16 -27
- package/dist/esm/ix-chip.entry.js +4 -13
- package/dist/esm/ix-counter-pill.entry.js +3 -10
- package/dist/esm/ix-date-picker_2.entry.js +23 -91
- package/dist/esm/ix-date-time-card.entry.js +1 -7
- package/dist/esm/ix-datetime-picker.entry.js +9 -53
- package/dist/esm/ix-drawer.entry.js +2 -20
- package/dist/esm/ix-dropdown_2.entry.js +7 -30
- package/dist/esm/ix-event-list_2.entry.js +6 -19
- package/dist/esm/ix-expanding-search.entry.js +1 -10
- package/dist/esm/ix-filter-chip.entry.js +1 -4
- package/dist/esm/ix-flip-tile_2.entry.js +4 -1
- package/dist/esm/ix-group_3.entry.js +9 -26
- package/dist/esm/ix-icon-button.entry.js +8 -17
- package/dist/esm/ix-icon.entry.js +4 -1
- package/dist/esm/ix-input-group.entry.js +1 -1
- package/dist/esm/ix-kpi.entry.js +4 -7
- package/dist/esm/ix-map-navigation_2.entry.js +44 -9
- package/dist/esm/ix-menu_9.entry.js +26 -82
- package/dist/esm/ix-message-bar.entry.js +3 -7
- package/dist/esm/ix-modal-example.entry.js +1 -1
- package/dist/esm/ix-modal_2.entry.js +2 -2
- package/dist/esm/ix-pill.entry.js +4 -10
- package/dist/esm/ix-select_2.entry.js +8 -34
- package/dist/esm/ix-spinner.entry.js +1 -7
- package/dist/esm/ix-split-button_2.entry.js +5 -28
- package/dist/esm/ix-tab-item.entry.js +2 -22
- package/dist/esm/ix-tabs.entry.js +5 -20
- package/dist/esm/ix-tile.entry.js +1 -4
- package/dist/esm/ix-toast_2.entry.js +4 -16
- package/dist/esm/ix-toggle.entry.js +1 -26
- package/dist/esm/ix-tree_2.entry.js +8 -5
- package/dist/esm/ix-upload.entry.js +2 -46
- package/dist/esm/ix-validation-tooltip.entry.js +4 -6
- package/dist/esm/ix-workflow-step_2.entry.js +1 -31
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{modal-8ed87a6c.js → modal-f1e45879.js} +10 -27
- package/dist/esm/my-component.entry.js +1 -1
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/siemens-ix.js +2 -2
- package/dist/siemens-ix/index.esm.js +1 -1
- package/dist/siemens-ix/p-003b58b3.js +1 -0
- package/dist/siemens-ix/p-0419f23d.entry.js +1 -0
- package/dist/siemens-ix/p-0cdac3da.entry.js +1 -0
- package/dist/siemens-ix/p-161561ef.entry.js +1 -0
- package/dist/siemens-ix/p-1686ce8c.entry.js +1 -0
- package/dist/siemens-ix/{p-df43662b.entry.js → p-18652f43.entry.js} +1 -1
- package/dist/siemens-ix/p-1cd8f35f.entry.js +1 -0
- package/dist/siemens-ix/{p-a49005f3.entry.js → p-1d1eeeea.entry.js} +1 -1
- package/dist/siemens-ix/{p-2b7ed5d4.entry.js → p-38a598ed.entry.js} +1 -1
- package/dist/siemens-ix/p-44ab1dce.entry.js +1 -0
- package/dist/siemens-ix/{p-81e46337.entry.js → p-477681a5.entry.js} +1 -1
- package/dist/siemens-ix/{p-d2fc562a.entry.js → p-4f2fbbb5.entry.js} +1 -1
- package/dist/siemens-ix/{p-71de6498.entry.js → p-56bba5f9.entry.js} +1 -1
- package/dist/siemens-ix/p-5b4399b3.entry.js +1 -0
- package/dist/siemens-ix/p-5c038d1d.js +2 -0
- package/dist/siemens-ix/p-6d075808.entry.js +1 -0
- package/dist/siemens-ix/p-72b5c8d5.entry.js +1 -0
- package/dist/siemens-ix/p-746ebc92.entry.js +1 -0
- package/dist/siemens-ix/p-7fb73253.entry.js +1 -0
- package/dist/siemens-ix/p-87c46ff3.entry.js +1 -0
- package/dist/siemens-ix/p-8c5948e2.entry.js +1 -0
- package/dist/siemens-ix/{p-03ef9fe5.entry.js → p-8e60010d.entry.js} +1 -1
- package/dist/siemens-ix/p-9cc43bf2.entry.js +1 -0
- package/dist/siemens-ix/p-a2e33741.entry.js +1 -0
- package/dist/siemens-ix/p-a3760331.entry.js +1 -0
- package/dist/siemens-ix/p-a4ed41f9.entry.js +1 -0
- package/dist/siemens-ix/p-aa620cc7.entry.js +1 -0
- package/dist/siemens-ix/p-afefc17c.entry.js +1 -0
- package/dist/siemens-ix/{p-5a1dcc74.js → p-b12006c6.js} +0 -0
- package/dist/siemens-ix/p-b18d15c7.entry.js +1 -0
- package/dist/siemens-ix/{p-cbd0f8a7.entry.js → p-b49fbfc3.entry.js} +1 -1
- package/dist/siemens-ix/p-b7a46add.entry.js +1 -0
- package/dist/siemens-ix/p-b8849072.entry.js +1 -0
- package/dist/siemens-ix/p-c0a126c6.entry.js +1 -0
- package/dist/siemens-ix/p-c1674778.entry.js +1 -0
- package/dist/siemens-ix/p-ca8a41ea.entry.js +1 -0
- package/dist/siemens-ix/{p-77823732.entry.js → p-d1a17dd8.entry.js} +1 -1
- package/dist/siemens-ix/p-d5199425.entry.js +1 -0
- package/dist/siemens-ix/{p-fa44655a.entry.js → p-d62d2304.entry.js} +1 -1
- package/dist/siemens-ix/{p-b4003026.entry.js → p-dc8f82d5.entry.js} +1 -1
- package/dist/siemens-ix/{p-1d56d9b6.entry.js → p-e0c85889.entry.js} +1 -1
- package/dist/siemens-ix/p-e5da6672.entry.js +1 -0
- package/dist/siemens-ix/{p-4287bd7e.entry.js → p-eff31ef4.entry.js} +1 -1
- package/dist/siemens-ix/{p-bd15d8ca.entry.js → p-f34f7e30.entry.js} +1 -1
- package/dist/siemens-ix/p-fca4a226.entry.js +1 -0
- package/dist/siemens-ix/siemens-ix.css +3 -0
- package/dist/siemens-ix/siemens-ix.esm.js +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +4 -4
- package/dist/types/components/datetime-picker/datetime-picker.d.ts +4 -3
- package/dist/types/components/map-navigation/map-navigation.d.ts +2 -0
- package/dist/types/components/map-navigation-overlay/map-navigation-overlay.d.ts +4 -0
- package/dist/types/components/menu-item/menu-item.d.ts +4 -0
- package/dist/types/components/modal/modal.d.ts +1 -1
- package/dist/types/components/time-picker/time-picker.d.ts +1 -2
- package/dist/types/components/upload/upload.d.ts +1 -1
- package/dist/types/components.d.ts +221 -74
- package/dist/types/stencil-public-runtime.d.ts +20 -4
- package/loader/package.json +1 -0
- package/package.json +4 -6
- package/scss/components/_buttons.scss +1 -0
- package/scss/components/_dropdown.scss +3 -0
- package/src/components/date-picker/readme.md +3 -3
- package/src/components/datetime-picker/readme.md +3 -3
- package/src/components/map-navigation/readme.md +2 -2
- package/src/components/menu-item/readme.md +8 -8
- package/src/components/modal/readme.md +1 -1
- package/src/components/time-picker/readme.md +2 -2
- package/src/components/upload/readme.md +13 -13
- package/dist/components/default-tree-item.js +0 -20
- package/dist/components/flip-tile-state.js +0 -18
- package/dist/components/logical-filter-operator.js +0 -33
- package/dist/components/modal-utils.js +0 -38
- package/dist/components/upload-file-state.js +0 -17
- package/dist/siemens-ix/p-02501b64.entry.js +0 -1
- package/dist/siemens-ix/p-0e315bd7.entry.js +0 -1
- package/dist/siemens-ix/p-235606b2.entry.js +0 -1
- package/dist/siemens-ix/p-301ddeb7.js +0 -1
- package/dist/siemens-ix/p-334b7d5c.entry.js +0 -1
- package/dist/siemens-ix/p-3f809fb3.entry.js +0 -1
- package/dist/siemens-ix/p-47ea9884.js +0 -1
- package/dist/siemens-ix/p-52d99490.entry.js +0 -1
- package/dist/siemens-ix/p-5f9f25ef.entry.js +0 -1
- package/dist/siemens-ix/p-5fed62f8.entry.js +0 -1
- package/dist/siemens-ix/p-6726f740.entry.js +0 -1
- package/dist/siemens-ix/p-67c2bca6.entry.js +0 -1
- package/dist/siemens-ix/p-78df1e46.entry.js +0 -1
- package/dist/siemens-ix/p-7d667916.entry.js +0 -1
- package/dist/siemens-ix/p-7f5a2e3c.entry.js +0 -1
- package/dist/siemens-ix/p-8239c3a1.entry.js +0 -1
- package/dist/siemens-ix/p-893b7bf6.entry.js +0 -1
- package/dist/siemens-ix/p-94b86dec.entry.js +0 -1
- package/dist/siemens-ix/p-a8396077.entry.js +0 -1
- package/dist/siemens-ix/p-ab715295.entry.js +0 -1
- package/dist/siemens-ix/p-b93c2fab.entry.js +0 -1
- package/dist/siemens-ix/p-be1ec062.entry.js +0 -1
- package/dist/siemens-ix/p-bf5513a0.entry.js +0 -1
- package/dist/siemens-ix/p-c0c9fb81.entry.js +0 -1
- package/dist/siemens-ix/p-c3738ffc.entry.js +0 -1
- package/dist/siemens-ix/p-c792adb4.entry.js +0 -1
- package/dist/siemens-ix/p-c9a5d942.entry.js +0 -1
- package/dist/siemens-ix/p-cb6e62ff.entry.js +0 -1
- package/dist/siemens-ix/p-f2636faf.entry.js +0 -1
- package/dist/siemens-ix/p-fe5db4d1.entry.js +0 -1
- package/scripts/post-install/post-install.mjs +0 -111
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
const NAMESPACE = 'siemens-ix';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
5
|
+
* Simon Friis Vindum (@paldepind)
|
|
6
|
+
* Licensed under the MIT License
|
|
7
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
8
|
+
*
|
|
9
|
+
* Modified for Stencil's renderer and slot projection
|
|
10
|
+
*/
|
|
3
11
|
let scopeId;
|
|
4
12
|
let contentRef;
|
|
5
13
|
let hostTagName;
|
|
@@ -8,62 +16,6 @@ let checkSlotFallbackVisibility = false;
|
|
|
8
16
|
let checkSlotRelocate = false;
|
|
9
17
|
let isSvgMode = false;
|
|
10
18
|
let queuePending = false;
|
|
11
|
-
const win = typeof window !== 'undefined' ? window : {};
|
|
12
|
-
const doc = win.document || { head: {} };
|
|
13
|
-
const plt = {
|
|
14
|
-
$flags$: 0,
|
|
15
|
-
$resourcesUrl$: '',
|
|
16
|
-
jmp: (h) => h(),
|
|
17
|
-
raf: (h) => requestAnimationFrame(h),
|
|
18
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
19
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
20
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
21
|
-
};
|
|
22
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
23
|
-
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
24
|
-
try {
|
|
25
|
-
new CSSStyleSheet();
|
|
26
|
-
return typeof new CSSStyleSheet().replace === 'function';
|
|
27
|
-
}
|
|
28
|
-
catch (e) { }
|
|
29
|
-
return false;
|
|
30
|
-
})()
|
|
31
|
-
;
|
|
32
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
33
|
-
if (listeners) {
|
|
34
|
-
listeners.map(([flags, name, method]) => {
|
|
35
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
36
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
37
|
-
const opts = hostListenerOpts(flags);
|
|
38
|
-
plt.ael(target, name, handler, opts);
|
|
39
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
44
|
-
try {
|
|
45
|
-
{
|
|
46
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
47
|
-
// instance is ready, let's call it's member method for this event
|
|
48
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
consoleError(e);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
60
|
-
if (flags & 8 /* TargetWindow */)
|
|
61
|
-
return win;
|
|
62
|
-
return elm;
|
|
63
|
-
};
|
|
64
|
-
// prettier-ignore
|
|
65
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
66
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
67
19
|
const createTime = (fnName, tagName = '') => {
|
|
68
20
|
{
|
|
69
21
|
return () => {
|
|
@@ -78,74 +30,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
78
30
|
};
|
|
79
31
|
}
|
|
80
32
|
};
|
|
81
|
-
const
|
|
82
|
-
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
83
|
-
let style = styles.get(scopeId);
|
|
84
|
-
if (supportsConstructibleStylesheets && allowCS) {
|
|
85
|
-
style = (style || new CSSStyleSheet());
|
|
86
|
-
style.replace(cssText);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
style = cssText;
|
|
90
|
-
}
|
|
91
|
-
styles.set(scopeId, style);
|
|
92
|
-
};
|
|
93
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
94
|
-
let scopeId = getScopeId(cmpMeta);
|
|
95
|
-
let style = styles.get(scopeId);
|
|
96
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
97
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
98
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
99
|
-
if (style) {
|
|
100
|
-
if (typeof style === 'string') {
|
|
101
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
102
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
103
|
-
let styleElm;
|
|
104
|
-
if (!appliedStyles) {
|
|
105
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
106
|
-
}
|
|
107
|
-
if (!appliedStyles.has(scopeId)) {
|
|
108
|
-
{
|
|
109
|
-
{
|
|
110
|
-
styleElm = doc.createElement('style');
|
|
111
|
-
styleElm.innerHTML = style;
|
|
112
|
-
}
|
|
113
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
114
|
-
}
|
|
115
|
-
if (appliedStyles) {
|
|
116
|
-
appliedStyles.add(scopeId);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
121
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return scopeId;
|
|
125
|
-
};
|
|
126
|
-
const attachStyles = (hostRef) => {
|
|
127
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
128
|
-
const elm = hostRef.$hostElement$;
|
|
129
|
-
const flags = cmpMeta.$flags$;
|
|
130
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
131
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
132
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
133
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
134
|
-
// or this browser doesn't support native shadow dom
|
|
135
|
-
// and this host element was NOT created with SSR
|
|
136
|
-
// let's pick out the inner content for slot projection
|
|
137
|
-
// create a node to represent where the original
|
|
138
|
-
// content was first placed, which is useful later on
|
|
139
|
-
// DOM WRITE!!
|
|
140
|
-
elm['s-sc'] = scopeId;
|
|
141
|
-
elm.classList.add(scopeId + '-h');
|
|
142
|
-
if (flags & 2 /* scopedCssEncapsulation */) {
|
|
143
|
-
elm.classList.add(scopeId + '-s');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
endAttachStyles();
|
|
147
|
-
};
|
|
148
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
33
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
149
34
|
/**
|
|
150
35
|
* Default style mode id
|
|
151
36
|
*/
|
|
@@ -181,7 +66,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
181
66
|
let slotName = null;
|
|
182
67
|
let simple = false;
|
|
183
68
|
let lastSimple = false;
|
|
184
|
-
|
|
69
|
+
const vNodeChildren = [];
|
|
185
70
|
const walk = (c) => {
|
|
186
71
|
for (let i = 0; i < c.length; i++) {
|
|
187
72
|
child = c[i];
|
|
@@ -283,6 +168,152 @@ const convertToPrivate = (node) => {
|
|
|
283
168
|
vnode.$name$ = node.vname;
|
|
284
169
|
return vnode;
|
|
285
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* Parse a new property value for a given property type.
|
|
173
|
+
*
|
|
174
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
175
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
176
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
177
|
+
* 2. the type stored from `propType`.
|
|
178
|
+
*
|
|
179
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
180
|
+
*
|
|
181
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
182
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
183
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
184
|
+
* ```tsx
|
|
185
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* HTML prop values on the other hand, will always a string
|
|
189
|
+
*
|
|
190
|
+
* @param propValue the new value to coerce to some type
|
|
191
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
192
|
+
* @returns the parsed/coerced value
|
|
193
|
+
*/
|
|
194
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
195
|
+
// ensure this value is of the correct prop type
|
|
196
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
197
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
198
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
199
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
200
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
201
|
+
}
|
|
202
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
203
|
+
// force it to be a number
|
|
204
|
+
return parseFloat(propValue);
|
|
205
|
+
}
|
|
206
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
207
|
+
// could have been passed as a number or boolean
|
|
208
|
+
// but we still want it as a string
|
|
209
|
+
return String(propValue);
|
|
210
|
+
}
|
|
211
|
+
// redundant return here for better minification
|
|
212
|
+
return propValue;
|
|
213
|
+
}
|
|
214
|
+
// not sure exactly what type we want
|
|
215
|
+
// so no need to change to a different type
|
|
216
|
+
return propValue;
|
|
217
|
+
};
|
|
218
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
219
|
+
const createEvent = (ref, name, flags) => {
|
|
220
|
+
const elm = getElement(ref);
|
|
221
|
+
return {
|
|
222
|
+
emit: (detail) => {
|
|
223
|
+
return emitEvent(elm, name, {
|
|
224
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
225
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
226
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
227
|
+
detail,
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
234
|
+
* @param elm the target of the Event
|
|
235
|
+
* @param name the name to give the custom Event
|
|
236
|
+
* @param opts options for configuring a custom Event
|
|
237
|
+
* @returns the custom Event
|
|
238
|
+
*/
|
|
239
|
+
const emitEvent = (elm, name, opts) => {
|
|
240
|
+
const ev = plt.ce(name, opts);
|
|
241
|
+
elm.dispatchEvent(ev);
|
|
242
|
+
return ev;
|
|
243
|
+
};
|
|
244
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
245
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
246
|
+
let style = styles.get(scopeId);
|
|
247
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
248
|
+
style = (style || new CSSStyleSheet());
|
|
249
|
+
if (typeof style === 'string') {
|
|
250
|
+
style = cssText;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
style.replaceSync(cssText);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
style = cssText;
|
|
258
|
+
}
|
|
259
|
+
styles.set(scopeId, style);
|
|
260
|
+
};
|
|
261
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
262
|
+
let scopeId = getScopeId(cmpMeta);
|
|
263
|
+
const style = styles.get(scopeId);
|
|
264
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
265
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
266
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
267
|
+
if (style) {
|
|
268
|
+
if (typeof style === 'string') {
|
|
269
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
270
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
271
|
+
let styleElm;
|
|
272
|
+
if (!appliedStyles) {
|
|
273
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
274
|
+
}
|
|
275
|
+
if (!appliedStyles.has(scopeId)) {
|
|
276
|
+
{
|
|
277
|
+
{
|
|
278
|
+
styleElm = doc.createElement('style');
|
|
279
|
+
styleElm.innerHTML = style;
|
|
280
|
+
}
|
|
281
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
282
|
+
}
|
|
283
|
+
if (appliedStyles) {
|
|
284
|
+
appliedStyles.add(scopeId);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
289
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return scopeId;
|
|
293
|
+
};
|
|
294
|
+
const attachStyles = (hostRef) => {
|
|
295
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
296
|
+
const elm = hostRef.$hostElement$;
|
|
297
|
+
const flags = cmpMeta.$flags$;
|
|
298
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
299
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
300
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
301
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
302
|
+
// or this browser doesn't support native shadow dom
|
|
303
|
+
// and this host element was NOT created with SSR
|
|
304
|
+
// let's pick out the inner content for slot projection
|
|
305
|
+
// create a node to represent where the original
|
|
306
|
+
// content was first placed, which is useful later on
|
|
307
|
+
// DOM WRITE!!
|
|
308
|
+
elm['s-sc'] = scopeId;
|
|
309
|
+
elm.classList.add(scopeId + '-h');
|
|
310
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
311
|
+
elm.classList.add(scopeId + '-s');
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
endAttachStyles();
|
|
315
|
+
};
|
|
316
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
286
317
|
/**
|
|
287
318
|
* Production setAccessor() function based on Preact by
|
|
288
319
|
* Jason Miller (@developit)
|
|
@@ -378,7 +409,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
378
409
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
379
410
|
try {
|
|
380
411
|
if (!elm.tagName.includes('-')) {
|
|
381
|
-
|
|
412
|
+
const n = newValue == null ? '' : newValue;
|
|
382
413
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
383
414
|
if (memberName === 'list') {
|
|
384
415
|
isProp = false;
|
|
@@ -400,7 +431,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
400
431
|
}
|
|
401
432
|
}
|
|
402
433
|
}
|
|
403
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
434
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
404
435
|
newValue = newValue === true ? '' : newValue;
|
|
405
436
|
{
|
|
406
437
|
elm.setAttribute(memberName, newValue);
|
|
@@ -415,7 +446,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
415
446
|
// if the element passed in is a shadow root, which is a document fragment
|
|
416
447
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
417
448
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
418
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
449
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
419
450
|
? newVnode.$elm$.host
|
|
420
451
|
: newVnode.$elm$;
|
|
421
452
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -433,9 +464,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
433
464
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
434
465
|
}
|
|
435
466
|
};
|
|
467
|
+
/**
|
|
468
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
469
|
+
*
|
|
470
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
471
|
+
* @param newParentVNode the parent VNode from the current render
|
|
472
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
473
|
+
* children, for which we will create a new DOM node
|
|
474
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
475
|
+
* @returns the newly created node
|
|
476
|
+
*/
|
|
436
477
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
437
478
|
// tslint:disable-next-line: prefer-const
|
|
438
|
-
|
|
479
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
|
439
480
|
let i = 0;
|
|
440
481
|
let elm;
|
|
441
482
|
let childNode;
|
|
@@ -450,16 +491,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
450
491
|
}
|
|
451
492
|
newVNode.$flags$ |= newVNode.$children$
|
|
452
493
|
? // slot element has fallback content
|
|
453
|
-
2 /* isSlotFallback */
|
|
494
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
454
495
|
: // slot element does not have fallback content
|
|
455
|
-
1 /* isSlotReference */;
|
|
496
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
456
497
|
}
|
|
457
498
|
}
|
|
458
499
|
if (newVNode.$text$ !== null) {
|
|
459
500
|
// create text node
|
|
460
501
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
461
502
|
}
|
|
462
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
503
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
463
504
|
// create a slot reference node
|
|
464
505
|
elm = newVNode.$elm$ =
|
|
465
506
|
doc.createTextNode('');
|
|
@@ -469,7 +510,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
469
510
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
470
511
|
}
|
|
471
512
|
// create element
|
|
472
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
513
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
473
514
|
? 'slot-fb'
|
|
474
515
|
: newVNode.$tag$)
|
|
475
516
|
);
|
|
@@ -509,7 +550,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
509
550
|
}
|
|
510
551
|
{
|
|
511
552
|
elm['s-hn'] = hostTagName;
|
|
512
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
553
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
513
554
|
// remember the content reference comment
|
|
514
555
|
elm['s-sr'] = true;
|
|
515
556
|
// remember the content reference comment
|
|
@@ -528,7 +569,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
528
569
|
return elm;
|
|
529
570
|
};
|
|
530
571
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
531
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
572
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
532
573
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
533
574
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
534
575
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -549,7 +590,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
549
590
|
putBackInOriginalLocation(childNode, recursive);
|
|
550
591
|
}
|
|
551
592
|
}
|
|
552
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
593
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
553
594
|
};
|
|
554
595
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
555
596
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
@@ -591,6 +632,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
591
632
|
}
|
|
592
633
|
}
|
|
593
634
|
};
|
|
635
|
+
/**
|
|
636
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
637
|
+
* traversing the two collections of children, identifying nodes that are
|
|
638
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
639
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
640
|
+
*
|
|
641
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
642
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
643
|
+
* 'windows' by storing start and end indices and references to the
|
|
644
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
645
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
646
|
+
* no children left to update by doing the following:
|
|
647
|
+
*
|
|
648
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
649
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
650
|
+
* only with a window bounded by the highlighted elements:
|
|
651
|
+
*
|
|
652
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
653
|
+
* ^^^^^^ ^^^^^^
|
|
654
|
+
*
|
|
655
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
656
|
+
* across the windows. This will basically detect elements which haven't
|
|
657
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
658
|
+
* VNode elements (represented as HTML):
|
|
659
|
+
*
|
|
660
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
661
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
662
|
+
*
|
|
663
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
664
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
665
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
666
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
667
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
668
|
+
*
|
|
669
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
670
|
+
* window corresponds to the element at the end of the other window. This is
|
|
671
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
672
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
673
|
+
* children nodes themselves have not changed but merely moved in the
|
|
674
|
+
* following example:
|
|
675
|
+
*
|
|
676
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
677
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
678
|
+
*
|
|
679
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
680
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
681
|
+
* DOM.
|
|
682
|
+
*
|
|
683
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
684
|
+
* nodes in the old children which have the same key as the first element in
|
|
685
|
+
* our window on the new children. If we find such a node we handle calling
|
|
686
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
687
|
+
* what we find.
|
|
688
|
+
*
|
|
689
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
690
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
691
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
692
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
693
|
+
* children has collapsed we still have more nodes on the new children that
|
|
694
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
695
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
696
|
+
* sure the corresponding DOM nodes are removed.
|
|
697
|
+
*
|
|
698
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
699
|
+
* @param oldCh the old children of the parent node
|
|
700
|
+
* @param newVNode the new VNode which will replace the parent
|
|
701
|
+
* @param newCh the new children of the parent node
|
|
702
|
+
*/
|
|
594
703
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
595
704
|
let oldStartIdx = 0;
|
|
596
705
|
let newStartIdx = 0;
|
|
@@ -603,7 +712,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
603
712
|
let node;
|
|
604
713
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
605
714
|
if (oldStartVnode == null) {
|
|
606
|
-
//
|
|
715
|
+
// VNode might have been moved left
|
|
607
716
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
608
717
|
}
|
|
609
718
|
else if (oldEndVnode == null) {
|
|
@@ -616,42 +725,102 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
616
725
|
newEndVnode = newCh[--newEndIdx];
|
|
617
726
|
}
|
|
618
727
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
728
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
729
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
730
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
731
|
+
// since things are matched up in order.
|
|
619
732
|
patch(oldStartVnode, newStartVnode);
|
|
620
733
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
621
734
|
newStartVnode = newCh[++newStartIdx];
|
|
622
735
|
}
|
|
623
736
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
737
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
738
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
739
|
+
// need to move any DOM Nodes.
|
|
624
740
|
patch(oldEndVnode, newEndVnode);
|
|
625
741
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
626
742
|
newEndVnode = newCh[--newEndIdx];
|
|
627
743
|
}
|
|
628
744
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
629
|
-
// Vnode moved right
|
|
745
|
+
// case: "Vnode moved right"
|
|
746
|
+
//
|
|
747
|
+
// We've found that the last node in our window on the new children is
|
|
748
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
749
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
750
|
+
// nodes:
|
|
751
|
+
//
|
|
752
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
753
|
+
// ^^^^^^^^^^^
|
|
754
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
755
|
+
// ^^^^^^^^^^^^^
|
|
756
|
+
//
|
|
757
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
758
|
+
// and move the DOM element for `oldStartVnode`.
|
|
630
759
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
631
760
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
632
761
|
}
|
|
633
762
|
patch(oldStartVnode, newEndVnode);
|
|
763
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
764
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
765
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
766
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
767
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
768
|
+
//
|
|
769
|
+
// <old-start-node />
|
|
770
|
+
// <some-intervening-node />
|
|
771
|
+
// <old-end-node />
|
|
772
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
773
|
+
// <next-sibling />
|
|
774
|
+
//
|
|
775
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
776
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
777
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
778
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
779
|
+
// append it to the children of the parent element.
|
|
634
780
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
635
781
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
636
782
|
newEndVnode = newCh[--newEndIdx];
|
|
637
783
|
}
|
|
638
784
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
639
|
-
// Vnode moved left
|
|
785
|
+
// case: "Vnode moved left"
|
|
786
|
+
//
|
|
787
|
+
// We've found that the first node in our window on the new children is
|
|
788
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
789
|
+
// Visually, this is the layout of these two nodes:
|
|
790
|
+
//
|
|
791
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
792
|
+
// ^^^^^^^^^^^^^
|
|
793
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
794
|
+
// ^^^^^^^^^^^
|
|
795
|
+
//
|
|
796
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
797
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
798
|
+
// children etc) but we also need to move the DOM node to which
|
|
799
|
+
// `oldEndVnode` corresponds.
|
|
640
800
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
641
801
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
642
802
|
}
|
|
643
803
|
patch(oldEndVnode, newStartVnode);
|
|
804
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
805
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
806
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
807
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
808
|
+
// future.
|
|
644
809
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
645
810
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
646
811
|
newStartVnode = newCh[++newStartIdx];
|
|
647
812
|
}
|
|
648
813
|
else {
|
|
649
814
|
{
|
|
650
|
-
//
|
|
815
|
+
// We either didn't find an element in the old children that matches
|
|
816
|
+
// the key of the first new child OR the build is not using `key`
|
|
817
|
+
// attributes at all. In either case we need to create a new element
|
|
818
|
+
// for the new node.
|
|
651
819
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
652
820
|
newStartVnode = newCh[++newStartIdx];
|
|
653
821
|
}
|
|
654
822
|
if (node) {
|
|
823
|
+
// if we created a new node then handle inserting it to the DOM
|
|
655
824
|
{
|
|
656
825
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
657
826
|
}
|
|
@@ -659,18 +828,39 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
659
828
|
}
|
|
660
829
|
}
|
|
661
830
|
if (oldStartIdx > oldEndIdx) {
|
|
831
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
662
832
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
663
833
|
}
|
|
664
834
|
else if (newStartIdx > newEndIdx) {
|
|
835
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
836
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
837
|
+
// relevant DOM nodes)
|
|
665
838
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
666
839
|
}
|
|
667
840
|
};
|
|
668
|
-
|
|
841
|
+
/**
|
|
842
|
+
* Compare two VNodes to determine if they are the same
|
|
843
|
+
*
|
|
844
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
845
|
+
* information set on the two VNodes and can be misleading under certain
|
|
846
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
847
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
848
|
+
* checking that they have the same tag.
|
|
849
|
+
*
|
|
850
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
851
|
+
* changing order within a `children` array or something along those lines then
|
|
852
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
853
|
+
*
|
|
854
|
+
* @param leftVNode the first VNode to check
|
|
855
|
+
* @param rightVNode the second VNode to check
|
|
856
|
+
* @returns whether they're equal or not
|
|
857
|
+
*/
|
|
858
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
669
859
|
// compare if two vnode to see if they're "technically" the same
|
|
670
860
|
// need to have the same element tag, and same key to be the same
|
|
671
|
-
if (
|
|
672
|
-
if (
|
|
673
|
-
return
|
|
861
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
862
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
863
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
674
864
|
}
|
|
675
865
|
return true;
|
|
676
866
|
}
|
|
@@ -684,6 +874,14 @@ const referenceNode = (node) => {
|
|
|
684
874
|
return (node && node['s-ol']) || node;
|
|
685
875
|
};
|
|
686
876
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
877
|
+
/**
|
|
878
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
879
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
880
|
+
* children of the two nodes (if any).
|
|
881
|
+
*
|
|
882
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
883
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
884
|
+
*/
|
|
687
885
|
const patch = (oldVNode, newVNode) => {
|
|
688
886
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
689
887
|
const oldChildren = oldVNode.$children$;
|
|
@@ -697,7 +895,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
697
895
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
698
896
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
699
897
|
}
|
|
700
|
-
// element node
|
|
701
898
|
{
|
|
702
899
|
if (tag === 'slot')
|
|
703
900
|
;
|
|
@@ -710,6 +907,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
710
907
|
}
|
|
711
908
|
if (oldChildren !== null && newChildren !== null) {
|
|
712
909
|
// looks like there's child vnodes for both the old and new vnodes
|
|
910
|
+
// so we need to call `updateChildren` to reconcile them
|
|
713
911
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
714
912
|
}
|
|
715
913
|
else if (newChildren !== null) {
|
|
@@ -741,7 +939,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
741
939
|
};
|
|
742
940
|
const updateFallbackSlotVisibility = (elm) => {
|
|
743
941
|
// tslint:disable-next-line: prefer-const
|
|
744
|
-
|
|
942
|
+
const childNodes = elm.childNodes;
|
|
745
943
|
let childNode;
|
|
746
944
|
let i;
|
|
747
945
|
let ilen;
|
|
@@ -750,7 +948,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
750
948
|
let nodeType;
|
|
751
949
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
752
950
|
childNode = childNodes[i];
|
|
753
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
951
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
754
952
|
if (childNode['s-sr']) {
|
|
755
953
|
// this is a slot fallback node
|
|
756
954
|
// get the slot name for this slot reference node
|
|
@@ -762,7 +960,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
762
960
|
nodeType = childNodes[j].nodeType;
|
|
763
961
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
764
962
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
765
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
963
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
766
964
|
childNode.hidden = true;
|
|
767
965
|
break;
|
|
768
966
|
}
|
|
@@ -771,8 +969,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
771
969
|
// this is a default fallback slot node
|
|
772
970
|
// any element or text node (with content)
|
|
773
971
|
// should hide the default fallback slot node
|
|
774
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
775
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
972
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
973
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
776
974
|
childNode.hidden = true;
|
|
777
975
|
break;
|
|
778
976
|
}
|
|
@@ -794,8 +992,8 @@ const relocateSlotContent = (elm) => {
|
|
|
794
992
|
let relocateNodeData;
|
|
795
993
|
let j;
|
|
796
994
|
let i = 0;
|
|
797
|
-
|
|
798
|
-
|
|
995
|
+
const childNodes = elm.childNodes;
|
|
996
|
+
const ilen = childNodes.length;
|
|
799
997
|
for (; i < ilen; i++) {
|
|
800
998
|
childNode = childNodes[i];
|
|
801
999
|
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
@@ -850,13 +1048,13 @@ const relocateSlotContent = (elm) => {
|
|
|
850
1048
|
}
|
|
851
1049
|
}
|
|
852
1050
|
}
|
|
853
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1051
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
854
1052
|
relocateSlotContent(childNode);
|
|
855
1053
|
}
|
|
856
1054
|
}
|
|
857
1055
|
};
|
|
858
1056
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
859
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1057
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
860
1058
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
861
1059
|
return true;
|
|
862
1060
|
}
|
|
@@ -887,7 +1085,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
887
1085
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
888
1086
|
}
|
|
889
1087
|
rootVnode.$tag$ = null;
|
|
890
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1088
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
891
1089
|
hostRef.$vnode$ = rootVnode;
|
|
892
1090
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
893
1091
|
{
|
|
@@ -895,7 +1093,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
895
1093
|
}
|
|
896
1094
|
{
|
|
897
1095
|
contentRef = hostElm['s-cr'];
|
|
898
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1096
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
899
1097
|
// always reset
|
|
900
1098
|
checkSlotFallbackVisibility = false;
|
|
901
1099
|
}
|
|
@@ -904,7 +1102,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
904
1102
|
{
|
|
905
1103
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
906
1104
|
// the disconnectCallback from working
|
|
907
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1105
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
908
1106
|
if (checkSlotRelocate) {
|
|
909
1107
|
relocateSlotContent(rootVnode.$elm$);
|
|
910
1108
|
let relocateData;
|
|
@@ -962,7 +1160,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
962
1160
|
}
|
|
963
1161
|
else {
|
|
964
1162
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
965
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1163
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
966
1164
|
nodeToRelocate.hidden = true;
|
|
967
1165
|
}
|
|
968
1166
|
}
|
|
@@ -973,37 +1171,11 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
973
1171
|
}
|
|
974
1172
|
// done moving nodes around
|
|
975
1173
|
// allow the disconnect callback to work again
|
|
976
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1174
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
977
1175
|
// always reset
|
|
978
1176
|
relocateNodes.length = 0;
|
|
979
1177
|
}
|
|
980
1178
|
};
|
|
981
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
982
|
-
const createEvent = (ref, name, flags) => {
|
|
983
|
-
const elm = getElement(ref);
|
|
984
|
-
return {
|
|
985
|
-
emit: (detail) => {
|
|
986
|
-
return emitEvent(elm, name, {
|
|
987
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
988
|
-
composed: !!(flags & 2 /* Composed */),
|
|
989
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
990
|
-
detail,
|
|
991
|
-
});
|
|
992
|
-
},
|
|
993
|
-
};
|
|
994
|
-
};
|
|
995
|
-
/**
|
|
996
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
997
|
-
* @param elm the target of the Event
|
|
998
|
-
* @param name the name to give the custom Event
|
|
999
|
-
* @param opts options for configuring a custom Event
|
|
1000
|
-
* @returns the custom Event
|
|
1001
|
-
*/
|
|
1002
|
-
const emitEvent = (elm, name, opts) => {
|
|
1003
|
-
const ev = plt.ce(name, opts);
|
|
1004
|
-
elm.dispatchEvent(ev);
|
|
1005
|
-
return ev;
|
|
1006
|
-
};
|
|
1007
1179
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1008
1180
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1009
1181
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -1011,10 +1183,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
1011
1183
|
};
|
|
1012
1184
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1013
1185
|
{
|
|
1014
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1186
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1015
1187
|
}
|
|
1016
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1017
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1188
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1189
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1018
1190
|
return;
|
|
1019
1191
|
}
|
|
1020
1192
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -1030,7 +1202,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1030
1202
|
let promise;
|
|
1031
1203
|
if (isInitialLoad) {
|
|
1032
1204
|
{
|
|
1033
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1205
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1034
1206
|
if (hostRef.$queuedListeners$) {
|
|
1035
1207
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1036
1208
|
hostRef.$queuedListeners$ = null;
|
|
@@ -1076,7 +1248,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1076
1248
|
}
|
|
1077
1249
|
else {
|
|
1078
1250
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1079
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1251
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1080
1252
|
childrenPromises.length = 0;
|
|
1081
1253
|
}
|
|
1082
1254
|
}
|
|
@@ -1085,10 +1257,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1085
1257
|
try {
|
|
1086
1258
|
instance = instance.render() ;
|
|
1087
1259
|
{
|
|
1088
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1260
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1089
1261
|
}
|
|
1090
1262
|
{
|
|
1091
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1263
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1092
1264
|
}
|
|
1093
1265
|
{
|
|
1094
1266
|
{
|
|
@@ -1115,8 +1287,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1115
1287
|
{
|
|
1116
1288
|
safeCall(instance, 'componentDidRender');
|
|
1117
1289
|
}
|
|
1118
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1119
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1290
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1291
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1120
1292
|
{
|
|
1121
1293
|
// DOM WRITE!
|
|
1122
1294
|
addHydratedFlag(elm);
|
|
@@ -1145,10 +1317,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1145
1317
|
hostRef.$onRenderResolve$();
|
|
1146
1318
|
hostRef.$onRenderResolve$ = undefined;
|
|
1147
1319
|
}
|
|
1148
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1320
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1149
1321
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1150
1322
|
}
|
|
1151
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1323
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1152
1324
|
}
|
|
1153
1325
|
// ( •_•)
|
|
1154
1326
|
// ( •_•)>⌐■-■
|
|
@@ -1159,7 +1331,7 @@ const forceUpdate = (ref) => {
|
|
|
1159
1331
|
const hostRef = getHostRef(ref);
|
|
1160
1332
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1161
1333
|
if (isConnected &&
|
|
1162
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1334
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1163
1335
|
scheduleUpdate(hostRef, false);
|
|
1164
1336
|
}
|
|
1165
1337
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1190,53 +1362,6 @@ const then = (promise, thenFn) => {
|
|
|
1190
1362
|
};
|
|
1191
1363
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1192
1364
|
;
|
|
1193
|
-
/**
|
|
1194
|
-
* Parse a new property value for a given property type.
|
|
1195
|
-
*
|
|
1196
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
1197
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
1198
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
1199
|
-
* 2. the type stored from `propType`.
|
|
1200
|
-
*
|
|
1201
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
1202
|
-
*
|
|
1203
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
1204
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
1205
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
1206
|
-
* ```tsx
|
|
1207
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
1208
|
-
* ```
|
|
1209
|
-
*
|
|
1210
|
-
* HTML prop values on the other hand, will always a string
|
|
1211
|
-
*
|
|
1212
|
-
* @param propValue the new value to coerce to some type
|
|
1213
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
1214
|
-
* @returns the parsed/coerced value
|
|
1215
|
-
*/
|
|
1216
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1217
|
-
// ensure this value is of the correct prop type
|
|
1218
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1219
|
-
if (propType & 4 /* Boolean */) {
|
|
1220
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1221
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1222
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1223
|
-
}
|
|
1224
|
-
if (propType & 2 /* Number */) {
|
|
1225
|
-
// force it to be a number
|
|
1226
|
-
return parseFloat(propValue);
|
|
1227
|
-
}
|
|
1228
|
-
if (propType & 1 /* String */) {
|
|
1229
|
-
// could have been passed as a number or boolean
|
|
1230
|
-
// but we still want it as a string
|
|
1231
|
-
return String(propValue);
|
|
1232
|
-
}
|
|
1233
|
-
// redundant return here for better minification
|
|
1234
|
-
return propValue;
|
|
1235
|
-
}
|
|
1236
|
-
// not sure exactly what type we want
|
|
1237
|
-
// so no need to change to a different type
|
|
1238
|
-
return propValue;
|
|
1239
|
-
};
|
|
1240
1365
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1241
1366
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1242
1367
|
// check our new property value against our internal value
|
|
@@ -1249,13 +1374,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1249
1374
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1250
1375
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1251
1376
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1252
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1377
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1253
1378
|
// gadzooks! the property's value has changed!!
|
|
1254
1379
|
// set our new value!
|
|
1255
1380
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1256
1381
|
if (instance) {
|
|
1257
1382
|
// get an array of method names of watch functions to call
|
|
1258
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1383
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1259
1384
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1260
1385
|
if (watchMethods) {
|
|
1261
1386
|
// this instance is watching for when this property changed
|
|
@@ -1270,7 +1395,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1270
1395
|
});
|
|
1271
1396
|
}
|
|
1272
1397
|
}
|
|
1273
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1398
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1274
1399
|
// looks like this value actually changed, so we've got work to do!
|
|
1275
1400
|
// but only if we've already rendered, otherwise just chill out
|
|
1276
1401
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1280,6 +1405,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1280
1405
|
}
|
|
1281
1406
|
}
|
|
1282
1407
|
};
|
|
1408
|
+
/**
|
|
1409
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1410
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1411
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1412
|
+
*
|
|
1413
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1414
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1415
|
+
* @param flags a number used to store a series of bit flags
|
|
1416
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1417
|
+
*/
|
|
1283
1418
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1284
1419
|
if (cmpMeta.$members$) {
|
|
1285
1420
|
if (Cstr.watchers) {
|
|
@@ -1289,8 +1424,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1289
1424
|
const members = Object.entries(cmpMeta.$members$);
|
|
1290
1425
|
const prototype = Cstr.prototype;
|
|
1291
1426
|
members.map(([memberName, [memberFlags]]) => {
|
|
1292
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1293
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1427
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1428
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1294
1429
|
// proxyComponent - prop
|
|
1295
1430
|
Object.defineProperty(prototype, memberName, {
|
|
1296
1431
|
get() {
|
|
@@ -1305,8 +1440,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1305
1440
|
enumerable: true,
|
|
1306
1441
|
});
|
|
1307
1442
|
}
|
|
1308
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1309
|
-
memberFlags & 64 /* Method */) {
|
|
1443
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1444
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1310
1445
|
// proxyComponent - method
|
|
1311
1446
|
Object.defineProperty(prototype, memberName, {
|
|
1312
1447
|
value(...args) {
|
|
@@ -1316,7 +1451,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1316
1451
|
});
|
|
1317
1452
|
}
|
|
1318
1453
|
});
|
|
1319
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1454
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1320
1455
|
const attrNameToPropName = new Map();
|
|
1321
1456
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1322
1457
|
plt.jmp(() => {
|
|
@@ -1372,11 +1507,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1372
1507
|
// create an array of attributes to observe
|
|
1373
1508
|
// and also create a map of html attribute name to js property name
|
|
1374
1509
|
Cstr.observedAttributes = members
|
|
1375
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1510
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1376
1511
|
.map(([propName, m]) => {
|
|
1377
1512
|
const attrName = m[1] || propName;
|
|
1378
1513
|
attrNameToPropName.set(attrName, propName);
|
|
1379
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1514
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1380
1515
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1381
1516
|
}
|
|
1382
1517
|
return attrName;
|
|
@@ -1387,10 +1522,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1387
1522
|
};
|
|
1388
1523
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1389
1524
|
// initializeComponent
|
|
1390
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1525
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1391
1526
|
{
|
|
1392
1527
|
// we haven't initialized this element yet
|
|
1393
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1528
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1394
1529
|
// lazy loaded components
|
|
1395
1530
|
// request the component's implementation to be
|
|
1396
1531
|
// wired up with the host element
|
|
@@ -1408,7 +1543,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1408
1543
|
{
|
|
1409
1544
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1410
1545
|
}
|
|
1411
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1546
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1412
1547
|
Cstr.isProxied = true;
|
|
1413
1548
|
}
|
|
1414
1549
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1416,7 +1551,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1416
1551
|
// but let's keep track of when we start and stop
|
|
1417
1552
|
// so that the getters/setters don't incorrectly step on data
|
|
1418
1553
|
{
|
|
1419
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1554
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1420
1555
|
}
|
|
1421
1556
|
// construct the lazy-loaded component implementation
|
|
1422
1557
|
// passing the hostRef is very important during
|
|
@@ -1429,10 +1564,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1429
1564
|
consoleError(e);
|
|
1430
1565
|
}
|
|
1431
1566
|
{
|
|
1432
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1567
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1433
1568
|
}
|
|
1434
1569
|
{
|
|
1435
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1570
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1436
1571
|
}
|
|
1437
1572
|
endNewInstance();
|
|
1438
1573
|
}
|
|
@@ -1442,7 +1577,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1442
1577
|
const scopeId = getScopeId(cmpMeta);
|
|
1443
1578
|
if (!styles.has(scopeId)) {
|
|
1444
1579
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1445
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1580
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1446
1581
|
endRegisterStyles();
|
|
1447
1582
|
}
|
|
1448
1583
|
}
|
|
@@ -1464,19 +1599,19 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1464
1599
|
}
|
|
1465
1600
|
};
|
|
1466
1601
|
const connectedCallback = (elm) => {
|
|
1467
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1602
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1468
1603
|
const hostRef = getHostRef(elm);
|
|
1469
1604
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1470
1605
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1471
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1606
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1472
1607
|
// first time this component has connected
|
|
1473
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1608
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1474
1609
|
{
|
|
1475
1610
|
// initUpdate
|
|
1476
1611
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1477
1612
|
// in here to act as original content anchors as we move nodes around
|
|
1478
1613
|
// host element has been connected to the DOM
|
|
1479
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1614
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1480
1615
|
setContentReference(elm);
|
|
1481
1616
|
}
|
|
1482
1617
|
}
|
|
@@ -1499,7 +1634,7 @@ const connectedCallback = (elm) => {
|
|
|
1499
1634
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1500
1635
|
if (cmpMeta.$members$) {
|
|
1501
1636
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1502
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1637
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1503
1638
|
const value = elm[memberName];
|
|
1504
1639
|
delete elm[memberName];
|
|
1505
1640
|
elm[memberName] = value;
|
|
@@ -1531,7 +1666,7 @@ const setContentReference = (elm) => {
|
|
|
1531
1666
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1532
1667
|
};
|
|
1533
1668
|
const disconnectedCallback = (elm) => {
|
|
1534
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1669
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1535
1670
|
const hostRef = getHostRef(elm);
|
|
1536
1671
|
const instance = hostRef.$lazyInstance$ ;
|
|
1537
1672
|
{
|
|
@@ -1564,7 +1699,7 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1564
1699
|
return this[n];
|
|
1565
1700
|
}
|
|
1566
1701
|
}
|
|
1567
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1702
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1568
1703
|
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
1569
1704
|
Object.defineProperty(elm, 'children', {
|
|
1570
1705
|
get() {
|
|
@@ -1579,8 +1714,8 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1579
1714
|
Object.defineProperty(elm, 'childNodes', {
|
|
1580
1715
|
get() {
|
|
1581
1716
|
const childNodes = childNodesFn.call(this);
|
|
1582
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
1583
|
-
getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
1717
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
|
|
1718
|
+
getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
|
|
1584
1719
|
const result = new FakeNodeList();
|
|
1585
1720
|
for (let i = 0; i < childNodes.length; i++) {
|
|
1586
1721
|
const slot = childNodes[i]['s-nr'];
|
|
@@ -1665,7 +1800,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1665
1800
|
super(self);
|
|
1666
1801
|
self = this;
|
|
1667
1802
|
registerHost(self, cmpMeta);
|
|
1668
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1803
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1669
1804
|
// this component is using shadow dom
|
|
1670
1805
|
// and this browser supports shadow dom
|
|
1671
1806
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1706,7 +1841,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1706
1841
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1707
1842
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1708
1843
|
cmpTags.push(tagName);
|
|
1709
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1844
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1710
1845
|
}
|
|
1711
1846
|
});
|
|
1712
1847
|
});
|
|
@@ -1729,7 +1864,41 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1729
1864
|
endBootstrap();
|
|
1730
1865
|
};
|
|
1731
1866
|
const Fragment = (_, children) => children;
|
|
1732
|
-
const
|
|
1867
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1868
|
+
if (listeners) {
|
|
1869
|
+
listeners.map(([flags, name, method]) => {
|
|
1870
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1871
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1872
|
+
const opts = hostListenerOpts(flags);
|
|
1873
|
+
plt.ael(target, name, handler, opts);
|
|
1874
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1879
|
+
try {
|
|
1880
|
+
{
|
|
1881
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1882
|
+
// instance is ready, let's call it's member method for this event
|
|
1883
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1884
|
+
}
|
|
1885
|
+
else {
|
|
1886
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
catch (e) {
|
|
1891
|
+
consoleError(e);
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1895
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
1896
|
+
return win;
|
|
1897
|
+
return elm;
|
|
1898
|
+
};
|
|
1899
|
+
// prettier-ignore
|
|
1900
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1901
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1733
1902
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1734
1903
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1735
1904
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1761,7 +1930,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1761
1930
|
if (module) {
|
|
1762
1931
|
return module[exportName];
|
|
1763
1932
|
}
|
|
1933
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1764
1934
|
return import(
|
|
1935
|
+
/* @vite-ignore */
|
|
1765
1936
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1766
1937
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1767
1938
|
/* webpackMode: "lazy" */
|
|
@@ -1772,14 +1943,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1772
1943
|
return importedModule[exportName];
|
|
1773
1944
|
}, consoleError);
|
|
1774
1945
|
};
|
|
1775
|
-
const styles = new Map();
|
|
1946
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1947
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1948
|
+
const doc = win.document || { head: {} };
|
|
1949
|
+
const plt = {
|
|
1950
|
+
$flags$: 0,
|
|
1951
|
+
$resourcesUrl$: '',
|
|
1952
|
+
jmp: (h) => h(),
|
|
1953
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1954
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1955
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1956
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1957
|
+
};
|
|
1958
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1959
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1960
|
+
try {
|
|
1961
|
+
new CSSStyleSheet();
|
|
1962
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1963
|
+
}
|
|
1964
|
+
catch (e) { }
|
|
1965
|
+
return false;
|
|
1966
|
+
})()
|
|
1967
|
+
;
|
|
1776
1968
|
const queueDomReads = [];
|
|
1777
1969
|
const queueDomWrites = [];
|
|
1778
1970
|
const queueTask = (queue, write) => (cb) => {
|
|
1779
1971
|
queue.push(cb);
|
|
1780
1972
|
if (!queuePending) {
|
|
1781
1973
|
queuePending = true;
|
|
1782
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1974
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1783
1975
|
nextTick(flush);
|
|
1784
1976
|
}
|
|
1785
1977
|
else {
|