@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
|
@@ -22,6 +22,14 @@ function _interopNamespace(e) {
|
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'siemens-ix';
|
|
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;
|
|
@@ -30,62 +38,6 @@ let checkSlotFallbackVisibility = false;
|
|
|
30
38
|
let checkSlotRelocate = false;
|
|
31
39
|
let isSvgMode = false;
|
|
32
40
|
let queuePending = false;
|
|
33
|
-
const win = typeof window !== 'undefined' ? window : {};
|
|
34
|
-
const doc = win.document || { head: {} };
|
|
35
|
-
const plt = {
|
|
36
|
-
$flags$: 0,
|
|
37
|
-
$resourcesUrl$: '',
|
|
38
|
-
jmp: (h) => h(),
|
|
39
|
-
raf: (h) => requestAnimationFrame(h),
|
|
40
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
41
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
42
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
43
|
-
};
|
|
44
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
45
|
-
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
46
|
-
try {
|
|
47
|
-
new CSSStyleSheet();
|
|
48
|
-
return typeof new CSSStyleSheet().replace === 'function';
|
|
49
|
-
}
|
|
50
|
-
catch (e) { }
|
|
51
|
-
return false;
|
|
52
|
-
})()
|
|
53
|
-
;
|
|
54
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
55
|
-
if (listeners) {
|
|
56
|
-
listeners.map(([flags, name, method]) => {
|
|
57
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
58
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
59
|
-
const opts = hostListenerOpts(flags);
|
|
60
|
-
plt.ael(target, name, handler, opts);
|
|
61
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
66
|
-
try {
|
|
67
|
-
{
|
|
68
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
69
|
-
// instance is ready, let's call it's member method for this event
|
|
70
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
consoleError(e);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
82
|
-
if (flags & 8 /* TargetWindow */)
|
|
83
|
-
return win;
|
|
84
|
-
return elm;
|
|
85
|
-
};
|
|
86
|
-
// prettier-ignore
|
|
87
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
88
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
89
41
|
const createTime = (fnName, tagName = '') => {
|
|
90
42
|
{
|
|
91
43
|
return () => {
|
|
@@ -100,74 +52,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
100
52
|
};
|
|
101
53
|
}
|
|
102
54
|
};
|
|
103
|
-
const
|
|
104
|
-
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
105
|
-
let style = styles.get(scopeId);
|
|
106
|
-
if (supportsConstructibleStylesheets && allowCS) {
|
|
107
|
-
style = (style || new CSSStyleSheet());
|
|
108
|
-
style.replace(cssText);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
style = cssText;
|
|
112
|
-
}
|
|
113
|
-
styles.set(scopeId, style);
|
|
114
|
-
};
|
|
115
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
116
|
-
let scopeId = getScopeId(cmpMeta);
|
|
117
|
-
let style = styles.get(scopeId);
|
|
118
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
119
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
120
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
121
|
-
if (style) {
|
|
122
|
-
if (typeof style === 'string') {
|
|
123
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
124
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
125
|
-
let styleElm;
|
|
126
|
-
if (!appliedStyles) {
|
|
127
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
128
|
-
}
|
|
129
|
-
if (!appliedStyles.has(scopeId)) {
|
|
130
|
-
{
|
|
131
|
-
{
|
|
132
|
-
styleElm = doc.createElement('style');
|
|
133
|
-
styleElm.innerHTML = style;
|
|
134
|
-
}
|
|
135
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
136
|
-
}
|
|
137
|
-
if (appliedStyles) {
|
|
138
|
-
appliedStyles.add(scopeId);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
143
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return scopeId;
|
|
147
|
-
};
|
|
148
|
-
const attachStyles = (hostRef) => {
|
|
149
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
150
|
-
const elm = hostRef.$hostElement$;
|
|
151
|
-
const flags = cmpMeta.$flags$;
|
|
152
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
153
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
154
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
155
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
156
|
-
// or this browser doesn't support native shadow dom
|
|
157
|
-
// and this host element was NOT created with SSR
|
|
158
|
-
// let's pick out the inner content for slot projection
|
|
159
|
-
// create a node to represent where the original
|
|
160
|
-
// content was first placed, which is useful later on
|
|
161
|
-
// DOM WRITE!!
|
|
162
|
-
elm['s-sc'] = scopeId;
|
|
163
|
-
elm.classList.add(scopeId + '-h');
|
|
164
|
-
if (flags & 2 /* scopedCssEncapsulation */) {
|
|
165
|
-
elm.classList.add(scopeId + '-s');
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
endAttachStyles();
|
|
169
|
-
};
|
|
170
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
55
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
171
56
|
/**
|
|
172
57
|
* Default style mode id
|
|
173
58
|
*/
|
|
@@ -203,7 +88,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
203
88
|
let slotName = null;
|
|
204
89
|
let simple = false;
|
|
205
90
|
let lastSimple = false;
|
|
206
|
-
|
|
91
|
+
const vNodeChildren = [];
|
|
207
92
|
const walk = (c) => {
|
|
208
93
|
for (let i = 0; i < c.length; i++) {
|
|
209
94
|
child = c[i];
|
|
@@ -305,6 +190,152 @@ const convertToPrivate = (node) => {
|
|
|
305
190
|
vnode.$name$ = node.vname;
|
|
306
191
|
return vnode;
|
|
307
192
|
};
|
|
193
|
+
/**
|
|
194
|
+
* Parse a new property value for a given property type.
|
|
195
|
+
*
|
|
196
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
197
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
198
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
199
|
+
* 2. the type stored from `propType`.
|
|
200
|
+
*
|
|
201
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
202
|
+
*
|
|
203
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
204
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
205
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
206
|
+
* ```tsx
|
|
207
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* HTML prop values on the other hand, will always a string
|
|
211
|
+
*
|
|
212
|
+
* @param propValue the new value to coerce to some type
|
|
213
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
214
|
+
* @returns the parsed/coerced value
|
|
215
|
+
*/
|
|
216
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
217
|
+
// ensure this value is of the correct prop type
|
|
218
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
219
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
220
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
221
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
222
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
223
|
+
}
|
|
224
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
225
|
+
// force it to be a number
|
|
226
|
+
return parseFloat(propValue);
|
|
227
|
+
}
|
|
228
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
229
|
+
// could have been passed as a number or boolean
|
|
230
|
+
// but we still want it as a string
|
|
231
|
+
return String(propValue);
|
|
232
|
+
}
|
|
233
|
+
// redundant return here for better minification
|
|
234
|
+
return propValue;
|
|
235
|
+
}
|
|
236
|
+
// not sure exactly what type we want
|
|
237
|
+
// so no need to change to a different type
|
|
238
|
+
return propValue;
|
|
239
|
+
};
|
|
240
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
241
|
+
const createEvent = (ref, name, flags) => {
|
|
242
|
+
const elm = getElement(ref);
|
|
243
|
+
return {
|
|
244
|
+
emit: (detail) => {
|
|
245
|
+
return emitEvent(elm, name, {
|
|
246
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
247
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
248
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
249
|
+
detail,
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
256
|
+
* @param elm the target of the Event
|
|
257
|
+
* @param name the name to give the custom Event
|
|
258
|
+
* @param opts options for configuring a custom Event
|
|
259
|
+
* @returns the custom Event
|
|
260
|
+
*/
|
|
261
|
+
const emitEvent = (elm, name, opts) => {
|
|
262
|
+
const ev = plt.ce(name, opts);
|
|
263
|
+
elm.dispatchEvent(ev);
|
|
264
|
+
return ev;
|
|
265
|
+
};
|
|
266
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
267
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
268
|
+
let style = styles.get(scopeId);
|
|
269
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
270
|
+
style = (style || new CSSStyleSheet());
|
|
271
|
+
if (typeof style === 'string') {
|
|
272
|
+
style = cssText;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
style.replaceSync(cssText);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
style = cssText;
|
|
280
|
+
}
|
|
281
|
+
styles.set(scopeId, style);
|
|
282
|
+
};
|
|
283
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
284
|
+
let scopeId = getScopeId(cmpMeta);
|
|
285
|
+
const style = styles.get(scopeId);
|
|
286
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
287
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
288
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
289
|
+
if (style) {
|
|
290
|
+
if (typeof style === 'string') {
|
|
291
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
292
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
293
|
+
let styleElm;
|
|
294
|
+
if (!appliedStyles) {
|
|
295
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
296
|
+
}
|
|
297
|
+
if (!appliedStyles.has(scopeId)) {
|
|
298
|
+
{
|
|
299
|
+
{
|
|
300
|
+
styleElm = doc.createElement('style');
|
|
301
|
+
styleElm.innerHTML = style;
|
|
302
|
+
}
|
|
303
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
304
|
+
}
|
|
305
|
+
if (appliedStyles) {
|
|
306
|
+
appliedStyles.add(scopeId);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
311
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return scopeId;
|
|
315
|
+
};
|
|
316
|
+
const attachStyles = (hostRef) => {
|
|
317
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
318
|
+
const elm = hostRef.$hostElement$;
|
|
319
|
+
const flags = cmpMeta.$flags$;
|
|
320
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
321
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
322
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
323
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
324
|
+
// or this browser doesn't support native shadow dom
|
|
325
|
+
// and this host element was NOT created with SSR
|
|
326
|
+
// let's pick out the inner content for slot projection
|
|
327
|
+
// create a node to represent where the original
|
|
328
|
+
// content was first placed, which is useful later on
|
|
329
|
+
// DOM WRITE!!
|
|
330
|
+
elm['s-sc'] = scopeId;
|
|
331
|
+
elm.classList.add(scopeId + '-h');
|
|
332
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
333
|
+
elm.classList.add(scopeId + '-s');
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
endAttachStyles();
|
|
337
|
+
};
|
|
338
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
308
339
|
/**
|
|
309
340
|
* Production setAccessor() function based on Preact by
|
|
310
341
|
* Jason Miller (@developit)
|
|
@@ -400,7 +431,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
400
431
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
401
432
|
try {
|
|
402
433
|
if (!elm.tagName.includes('-')) {
|
|
403
|
-
|
|
434
|
+
const n = newValue == null ? '' : newValue;
|
|
404
435
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
405
436
|
if (memberName === 'list') {
|
|
406
437
|
isProp = false;
|
|
@@ -422,7 +453,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
422
453
|
}
|
|
423
454
|
}
|
|
424
455
|
}
|
|
425
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
456
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
426
457
|
newValue = newValue === true ? '' : newValue;
|
|
427
458
|
{
|
|
428
459
|
elm.setAttribute(memberName, newValue);
|
|
@@ -437,7 +468,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
437
468
|
// if the element passed in is a shadow root, which is a document fragment
|
|
438
469
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
439
470
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
440
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
471
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
441
472
|
? newVnode.$elm$.host
|
|
442
473
|
: newVnode.$elm$;
|
|
443
474
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -455,9 +486,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
455
486
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
456
487
|
}
|
|
457
488
|
};
|
|
489
|
+
/**
|
|
490
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
491
|
+
*
|
|
492
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
493
|
+
* @param newParentVNode the parent VNode from the current render
|
|
494
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
495
|
+
* children, for which we will create a new DOM node
|
|
496
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
497
|
+
* @returns the newly created node
|
|
498
|
+
*/
|
|
458
499
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
459
500
|
// tslint:disable-next-line: prefer-const
|
|
460
|
-
|
|
501
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
|
461
502
|
let i = 0;
|
|
462
503
|
let elm;
|
|
463
504
|
let childNode;
|
|
@@ -472,16 +513,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
472
513
|
}
|
|
473
514
|
newVNode.$flags$ |= newVNode.$children$
|
|
474
515
|
? // slot element has fallback content
|
|
475
|
-
2 /* isSlotFallback */
|
|
516
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
476
517
|
: // slot element does not have fallback content
|
|
477
|
-
1 /* isSlotReference */;
|
|
518
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
478
519
|
}
|
|
479
520
|
}
|
|
480
521
|
if (newVNode.$text$ !== null) {
|
|
481
522
|
// create text node
|
|
482
523
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
483
524
|
}
|
|
484
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
525
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
485
526
|
// create a slot reference node
|
|
486
527
|
elm = newVNode.$elm$ =
|
|
487
528
|
doc.createTextNode('');
|
|
@@ -491,7 +532,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
491
532
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
492
533
|
}
|
|
493
534
|
// create element
|
|
494
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
535
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
495
536
|
? 'slot-fb'
|
|
496
537
|
: newVNode.$tag$)
|
|
497
538
|
);
|
|
@@ -531,7 +572,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
531
572
|
}
|
|
532
573
|
{
|
|
533
574
|
elm['s-hn'] = hostTagName;
|
|
534
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
575
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
535
576
|
// remember the content reference comment
|
|
536
577
|
elm['s-sr'] = true;
|
|
537
578
|
// remember the content reference comment
|
|
@@ -550,7 +591,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
550
591
|
return elm;
|
|
551
592
|
};
|
|
552
593
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
553
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
594
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
554
595
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
555
596
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
556
597
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -571,7 +612,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
571
612
|
putBackInOriginalLocation(childNode, recursive);
|
|
572
613
|
}
|
|
573
614
|
}
|
|
574
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
615
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
575
616
|
};
|
|
576
617
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
577
618
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
@@ -613,6 +654,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
613
654
|
}
|
|
614
655
|
}
|
|
615
656
|
};
|
|
657
|
+
/**
|
|
658
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
659
|
+
* traversing the two collections of children, identifying nodes that are
|
|
660
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
661
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
662
|
+
*
|
|
663
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
664
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
665
|
+
* 'windows' by storing start and end indices and references to the
|
|
666
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
667
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
668
|
+
* no children left to update by doing the following:
|
|
669
|
+
*
|
|
670
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
671
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
672
|
+
* only with a window bounded by the highlighted elements:
|
|
673
|
+
*
|
|
674
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
675
|
+
* ^^^^^^ ^^^^^^
|
|
676
|
+
*
|
|
677
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
678
|
+
* across the windows. This will basically detect elements which haven't
|
|
679
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
680
|
+
* VNode elements (represented as HTML):
|
|
681
|
+
*
|
|
682
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
683
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
684
|
+
*
|
|
685
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
686
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
687
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
688
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
689
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
690
|
+
*
|
|
691
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
692
|
+
* window corresponds to the element at the end of the other window. This is
|
|
693
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
694
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
695
|
+
* children nodes themselves have not changed but merely moved in the
|
|
696
|
+
* following example:
|
|
697
|
+
*
|
|
698
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
699
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
700
|
+
*
|
|
701
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
702
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
703
|
+
* DOM.
|
|
704
|
+
*
|
|
705
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
706
|
+
* nodes in the old children which have the same key as the first element in
|
|
707
|
+
* our window on the new children. If we find such a node we handle calling
|
|
708
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
709
|
+
* what we find.
|
|
710
|
+
*
|
|
711
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
712
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
713
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
714
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
715
|
+
* children has collapsed we still have more nodes on the new children that
|
|
716
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
717
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
718
|
+
* sure the corresponding DOM nodes are removed.
|
|
719
|
+
*
|
|
720
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
721
|
+
* @param oldCh the old children of the parent node
|
|
722
|
+
* @param newVNode the new VNode which will replace the parent
|
|
723
|
+
* @param newCh the new children of the parent node
|
|
724
|
+
*/
|
|
616
725
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
617
726
|
let oldStartIdx = 0;
|
|
618
727
|
let newStartIdx = 0;
|
|
@@ -625,7 +734,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
625
734
|
let node;
|
|
626
735
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
627
736
|
if (oldStartVnode == null) {
|
|
628
|
-
//
|
|
737
|
+
// VNode might have been moved left
|
|
629
738
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
630
739
|
}
|
|
631
740
|
else if (oldEndVnode == null) {
|
|
@@ -638,42 +747,102 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
638
747
|
newEndVnode = newCh[--newEndIdx];
|
|
639
748
|
}
|
|
640
749
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
750
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
751
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
752
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
753
|
+
// since things are matched up in order.
|
|
641
754
|
patch(oldStartVnode, newStartVnode);
|
|
642
755
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
643
756
|
newStartVnode = newCh[++newStartIdx];
|
|
644
757
|
}
|
|
645
758
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
759
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
760
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
761
|
+
// need to move any DOM Nodes.
|
|
646
762
|
patch(oldEndVnode, newEndVnode);
|
|
647
763
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
648
764
|
newEndVnode = newCh[--newEndIdx];
|
|
649
765
|
}
|
|
650
766
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
651
|
-
// Vnode moved right
|
|
767
|
+
// case: "Vnode moved right"
|
|
768
|
+
//
|
|
769
|
+
// We've found that the last node in our window on the new children is
|
|
770
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
771
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
772
|
+
// nodes:
|
|
773
|
+
//
|
|
774
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
775
|
+
// ^^^^^^^^^^^
|
|
776
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
777
|
+
// ^^^^^^^^^^^^^
|
|
778
|
+
//
|
|
779
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
780
|
+
// and move the DOM element for `oldStartVnode`.
|
|
652
781
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
653
782
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
654
783
|
}
|
|
655
784
|
patch(oldStartVnode, newEndVnode);
|
|
785
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
786
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
787
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
788
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
789
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
790
|
+
//
|
|
791
|
+
// <old-start-node />
|
|
792
|
+
// <some-intervening-node />
|
|
793
|
+
// <old-end-node />
|
|
794
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
795
|
+
// <next-sibling />
|
|
796
|
+
//
|
|
797
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
798
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
799
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
800
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
801
|
+
// append it to the children of the parent element.
|
|
656
802
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
657
803
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
658
804
|
newEndVnode = newCh[--newEndIdx];
|
|
659
805
|
}
|
|
660
806
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
661
|
-
// Vnode moved left
|
|
807
|
+
// case: "Vnode moved left"
|
|
808
|
+
//
|
|
809
|
+
// We've found that the first node in our window on the new children is
|
|
810
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
811
|
+
// Visually, this is the layout of these two nodes:
|
|
812
|
+
//
|
|
813
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
814
|
+
// ^^^^^^^^^^^^^
|
|
815
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
816
|
+
// ^^^^^^^^^^^
|
|
817
|
+
//
|
|
818
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
819
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
820
|
+
// children etc) but we also need to move the DOM node to which
|
|
821
|
+
// `oldEndVnode` corresponds.
|
|
662
822
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
663
823
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
664
824
|
}
|
|
665
825
|
patch(oldEndVnode, newStartVnode);
|
|
826
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
827
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
828
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
829
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
830
|
+
// future.
|
|
666
831
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
667
832
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
668
833
|
newStartVnode = newCh[++newStartIdx];
|
|
669
834
|
}
|
|
670
835
|
else {
|
|
671
836
|
{
|
|
672
|
-
//
|
|
837
|
+
// We either didn't find an element in the old children that matches
|
|
838
|
+
// the key of the first new child OR the build is not using `key`
|
|
839
|
+
// attributes at all. In either case we need to create a new element
|
|
840
|
+
// for the new node.
|
|
673
841
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
674
842
|
newStartVnode = newCh[++newStartIdx];
|
|
675
843
|
}
|
|
676
844
|
if (node) {
|
|
845
|
+
// if we created a new node then handle inserting it to the DOM
|
|
677
846
|
{
|
|
678
847
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
679
848
|
}
|
|
@@ -681,18 +850,39 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
681
850
|
}
|
|
682
851
|
}
|
|
683
852
|
if (oldStartIdx > oldEndIdx) {
|
|
853
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
684
854
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
685
855
|
}
|
|
686
856
|
else if (newStartIdx > newEndIdx) {
|
|
857
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
858
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
859
|
+
// relevant DOM nodes)
|
|
687
860
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
688
861
|
}
|
|
689
862
|
};
|
|
690
|
-
|
|
863
|
+
/**
|
|
864
|
+
* Compare two VNodes to determine if they are the same
|
|
865
|
+
*
|
|
866
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
867
|
+
* information set on the two VNodes and can be misleading under certain
|
|
868
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
869
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
870
|
+
* checking that they have the same tag.
|
|
871
|
+
*
|
|
872
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
873
|
+
* changing order within a `children` array or something along those lines then
|
|
874
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
875
|
+
*
|
|
876
|
+
* @param leftVNode the first VNode to check
|
|
877
|
+
* @param rightVNode the second VNode to check
|
|
878
|
+
* @returns whether they're equal or not
|
|
879
|
+
*/
|
|
880
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
691
881
|
// compare if two vnode to see if they're "technically" the same
|
|
692
882
|
// need to have the same element tag, and same key to be the same
|
|
693
|
-
if (
|
|
694
|
-
if (
|
|
695
|
-
return
|
|
883
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
884
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
885
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
696
886
|
}
|
|
697
887
|
return true;
|
|
698
888
|
}
|
|
@@ -706,6 +896,14 @@ const referenceNode = (node) => {
|
|
|
706
896
|
return (node && node['s-ol']) || node;
|
|
707
897
|
};
|
|
708
898
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
899
|
+
/**
|
|
900
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
901
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
902
|
+
* children of the two nodes (if any).
|
|
903
|
+
*
|
|
904
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
905
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
906
|
+
*/
|
|
709
907
|
const patch = (oldVNode, newVNode) => {
|
|
710
908
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
711
909
|
const oldChildren = oldVNode.$children$;
|
|
@@ -719,7 +917,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
719
917
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
720
918
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
721
919
|
}
|
|
722
|
-
// element node
|
|
723
920
|
{
|
|
724
921
|
if (tag === 'slot')
|
|
725
922
|
;
|
|
@@ -732,6 +929,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
732
929
|
}
|
|
733
930
|
if (oldChildren !== null && newChildren !== null) {
|
|
734
931
|
// looks like there's child vnodes for both the old and new vnodes
|
|
932
|
+
// so we need to call `updateChildren` to reconcile them
|
|
735
933
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
736
934
|
}
|
|
737
935
|
else if (newChildren !== null) {
|
|
@@ -763,7 +961,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
763
961
|
};
|
|
764
962
|
const updateFallbackSlotVisibility = (elm) => {
|
|
765
963
|
// tslint:disable-next-line: prefer-const
|
|
766
|
-
|
|
964
|
+
const childNodes = elm.childNodes;
|
|
767
965
|
let childNode;
|
|
768
966
|
let i;
|
|
769
967
|
let ilen;
|
|
@@ -772,7 +970,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
772
970
|
let nodeType;
|
|
773
971
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
774
972
|
childNode = childNodes[i];
|
|
775
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
973
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
776
974
|
if (childNode['s-sr']) {
|
|
777
975
|
// this is a slot fallback node
|
|
778
976
|
// get the slot name for this slot reference node
|
|
@@ -784,7 +982,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
784
982
|
nodeType = childNodes[j].nodeType;
|
|
785
983
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
786
984
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
787
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
985
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
788
986
|
childNode.hidden = true;
|
|
789
987
|
break;
|
|
790
988
|
}
|
|
@@ -793,8 +991,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
793
991
|
// this is a default fallback slot node
|
|
794
992
|
// any element or text node (with content)
|
|
795
993
|
// should hide the default fallback slot node
|
|
796
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
797
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
994
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
995
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
798
996
|
childNode.hidden = true;
|
|
799
997
|
break;
|
|
800
998
|
}
|
|
@@ -816,8 +1014,8 @@ const relocateSlotContent = (elm) => {
|
|
|
816
1014
|
let relocateNodeData;
|
|
817
1015
|
let j;
|
|
818
1016
|
let i = 0;
|
|
819
|
-
|
|
820
|
-
|
|
1017
|
+
const childNodes = elm.childNodes;
|
|
1018
|
+
const ilen = childNodes.length;
|
|
821
1019
|
for (; i < ilen; i++) {
|
|
822
1020
|
childNode = childNodes[i];
|
|
823
1021
|
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
@@ -872,13 +1070,13 @@ const relocateSlotContent = (elm) => {
|
|
|
872
1070
|
}
|
|
873
1071
|
}
|
|
874
1072
|
}
|
|
875
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1073
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
876
1074
|
relocateSlotContent(childNode);
|
|
877
1075
|
}
|
|
878
1076
|
}
|
|
879
1077
|
};
|
|
880
1078
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
881
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1079
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
882
1080
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
883
1081
|
return true;
|
|
884
1082
|
}
|
|
@@ -909,7 +1107,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
909
1107
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
910
1108
|
}
|
|
911
1109
|
rootVnode.$tag$ = null;
|
|
912
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1110
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
913
1111
|
hostRef.$vnode$ = rootVnode;
|
|
914
1112
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
915
1113
|
{
|
|
@@ -917,7 +1115,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
917
1115
|
}
|
|
918
1116
|
{
|
|
919
1117
|
contentRef = hostElm['s-cr'];
|
|
920
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1118
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
921
1119
|
// always reset
|
|
922
1120
|
checkSlotFallbackVisibility = false;
|
|
923
1121
|
}
|
|
@@ -926,7 +1124,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
926
1124
|
{
|
|
927
1125
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
928
1126
|
// the disconnectCallback from working
|
|
929
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1127
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
930
1128
|
if (checkSlotRelocate) {
|
|
931
1129
|
relocateSlotContent(rootVnode.$elm$);
|
|
932
1130
|
let relocateData;
|
|
@@ -984,7 +1182,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
984
1182
|
}
|
|
985
1183
|
else {
|
|
986
1184
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
987
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1185
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
988
1186
|
nodeToRelocate.hidden = true;
|
|
989
1187
|
}
|
|
990
1188
|
}
|
|
@@ -995,37 +1193,11 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
995
1193
|
}
|
|
996
1194
|
// done moving nodes around
|
|
997
1195
|
// allow the disconnect callback to work again
|
|
998
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1196
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
999
1197
|
// always reset
|
|
1000
1198
|
relocateNodes.length = 0;
|
|
1001
1199
|
}
|
|
1002
1200
|
};
|
|
1003
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1004
|
-
const createEvent = (ref, name, flags) => {
|
|
1005
|
-
const elm = getElement(ref);
|
|
1006
|
-
return {
|
|
1007
|
-
emit: (detail) => {
|
|
1008
|
-
return emitEvent(elm, name, {
|
|
1009
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1010
|
-
composed: !!(flags & 2 /* Composed */),
|
|
1011
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1012
|
-
detail,
|
|
1013
|
-
});
|
|
1014
|
-
},
|
|
1015
|
-
};
|
|
1016
|
-
};
|
|
1017
|
-
/**
|
|
1018
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
1019
|
-
* @param elm the target of the Event
|
|
1020
|
-
* @param name the name to give the custom Event
|
|
1021
|
-
* @param opts options for configuring a custom Event
|
|
1022
|
-
* @returns the custom Event
|
|
1023
|
-
*/
|
|
1024
|
-
const emitEvent = (elm, name, opts) => {
|
|
1025
|
-
const ev = plt.ce(name, opts);
|
|
1026
|
-
elm.dispatchEvent(ev);
|
|
1027
|
-
return ev;
|
|
1028
|
-
};
|
|
1029
1201
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1030
1202
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1031
1203
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -1033,10 +1205,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
1033
1205
|
};
|
|
1034
1206
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1035
1207
|
{
|
|
1036
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1208
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1037
1209
|
}
|
|
1038
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1039
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1210
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1211
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1040
1212
|
return;
|
|
1041
1213
|
}
|
|
1042
1214
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -1052,7 +1224,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1052
1224
|
let promise;
|
|
1053
1225
|
if (isInitialLoad) {
|
|
1054
1226
|
{
|
|
1055
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1227
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1056
1228
|
if (hostRef.$queuedListeners$) {
|
|
1057
1229
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1058
1230
|
hostRef.$queuedListeners$ = null;
|
|
@@ -1098,7 +1270,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1098
1270
|
}
|
|
1099
1271
|
else {
|
|
1100
1272
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1101
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1273
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1102
1274
|
childrenPromises.length = 0;
|
|
1103
1275
|
}
|
|
1104
1276
|
}
|
|
@@ -1107,10 +1279,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1107
1279
|
try {
|
|
1108
1280
|
instance = instance.render() ;
|
|
1109
1281
|
{
|
|
1110
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1282
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1111
1283
|
}
|
|
1112
1284
|
{
|
|
1113
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1285
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1114
1286
|
}
|
|
1115
1287
|
{
|
|
1116
1288
|
{
|
|
@@ -1137,8 +1309,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1137
1309
|
{
|
|
1138
1310
|
safeCall(instance, 'componentDidRender');
|
|
1139
1311
|
}
|
|
1140
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1141
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1312
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1313
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1142
1314
|
{
|
|
1143
1315
|
// DOM WRITE!
|
|
1144
1316
|
addHydratedFlag(elm);
|
|
@@ -1167,10 +1339,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1167
1339
|
hostRef.$onRenderResolve$();
|
|
1168
1340
|
hostRef.$onRenderResolve$ = undefined;
|
|
1169
1341
|
}
|
|
1170
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1342
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1171
1343
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1172
1344
|
}
|
|
1173
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1345
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1174
1346
|
}
|
|
1175
1347
|
// ( •_•)
|
|
1176
1348
|
// ( •_•)>⌐■-■
|
|
@@ -1181,7 +1353,7 @@ const forceUpdate = (ref) => {
|
|
|
1181
1353
|
const hostRef = getHostRef(ref);
|
|
1182
1354
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1183
1355
|
if (isConnected &&
|
|
1184
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1356
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1185
1357
|
scheduleUpdate(hostRef, false);
|
|
1186
1358
|
}
|
|
1187
1359
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1212,53 +1384,6 @@ const then = (promise, thenFn) => {
|
|
|
1212
1384
|
};
|
|
1213
1385
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1214
1386
|
;
|
|
1215
|
-
/**
|
|
1216
|
-
* Parse a new property value for a given property type.
|
|
1217
|
-
*
|
|
1218
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
1219
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
1220
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
1221
|
-
* 2. the type stored from `propType`.
|
|
1222
|
-
*
|
|
1223
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
1224
|
-
*
|
|
1225
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
1226
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
1227
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
1228
|
-
* ```tsx
|
|
1229
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
1230
|
-
* ```
|
|
1231
|
-
*
|
|
1232
|
-
* HTML prop values on the other hand, will always a string
|
|
1233
|
-
*
|
|
1234
|
-
* @param propValue the new value to coerce to some type
|
|
1235
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
1236
|
-
* @returns the parsed/coerced value
|
|
1237
|
-
*/
|
|
1238
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1239
|
-
// ensure this value is of the correct prop type
|
|
1240
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1241
|
-
if (propType & 4 /* Boolean */) {
|
|
1242
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1243
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1244
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1245
|
-
}
|
|
1246
|
-
if (propType & 2 /* Number */) {
|
|
1247
|
-
// force it to be a number
|
|
1248
|
-
return parseFloat(propValue);
|
|
1249
|
-
}
|
|
1250
|
-
if (propType & 1 /* String */) {
|
|
1251
|
-
// could have been passed as a number or boolean
|
|
1252
|
-
// but we still want it as a string
|
|
1253
|
-
return String(propValue);
|
|
1254
|
-
}
|
|
1255
|
-
// redundant return here for better minification
|
|
1256
|
-
return propValue;
|
|
1257
|
-
}
|
|
1258
|
-
// not sure exactly what type we want
|
|
1259
|
-
// so no need to change to a different type
|
|
1260
|
-
return propValue;
|
|
1261
|
-
};
|
|
1262
1387
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1263
1388
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1264
1389
|
// check our new property value against our internal value
|
|
@@ -1271,13 +1396,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1271
1396
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1272
1397
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1273
1398
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1274
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1399
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1275
1400
|
// gadzooks! the property's value has changed!!
|
|
1276
1401
|
// set our new value!
|
|
1277
1402
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1278
1403
|
if (instance) {
|
|
1279
1404
|
// get an array of method names of watch functions to call
|
|
1280
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1405
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1281
1406
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1282
1407
|
if (watchMethods) {
|
|
1283
1408
|
// this instance is watching for when this property changed
|
|
@@ -1292,7 +1417,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1292
1417
|
});
|
|
1293
1418
|
}
|
|
1294
1419
|
}
|
|
1295
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1420
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1296
1421
|
// looks like this value actually changed, so we've got work to do!
|
|
1297
1422
|
// but only if we've already rendered, otherwise just chill out
|
|
1298
1423
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1302,6 +1427,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1302
1427
|
}
|
|
1303
1428
|
}
|
|
1304
1429
|
};
|
|
1430
|
+
/**
|
|
1431
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1432
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1433
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1434
|
+
*
|
|
1435
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1436
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1437
|
+
* @param flags a number used to store a series of bit flags
|
|
1438
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1439
|
+
*/
|
|
1305
1440
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1306
1441
|
if (cmpMeta.$members$) {
|
|
1307
1442
|
if (Cstr.watchers) {
|
|
@@ -1311,8 +1446,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1311
1446
|
const members = Object.entries(cmpMeta.$members$);
|
|
1312
1447
|
const prototype = Cstr.prototype;
|
|
1313
1448
|
members.map(([memberName, [memberFlags]]) => {
|
|
1314
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1315
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1449
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1450
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1316
1451
|
// proxyComponent - prop
|
|
1317
1452
|
Object.defineProperty(prototype, memberName, {
|
|
1318
1453
|
get() {
|
|
@@ -1327,8 +1462,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1327
1462
|
enumerable: true,
|
|
1328
1463
|
});
|
|
1329
1464
|
}
|
|
1330
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1331
|
-
memberFlags & 64 /* Method */) {
|
|
1465
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1466
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1332
1467
|
// proxyComponent - method
|
|
1333
1468
|
Object.defineProperty(prototype, memberName, {
|
|
1334
1469
|
value(...args) {
|
|
@@ -1338,7 +1473,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1338
1473
|
});
|
|
1339
1474
|
}
|
|
1340
1475
|
});
|
|
1341
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1476
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1342
1477
|
const attrNameToPropName = new Map();
|
|
1343
1478
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1344
1479
|
plt.jmp(() => {
|
|
@@ -1394,11 +1529,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1394
1529
|
// create an array of attributes to observe
|
|
1395
1530
|
// and also create a map of html attribute name to js property name
|
|
1396
1531
|
Cstr.observedAttributes = members
|
|
1397
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1532
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1398
1533
|
.map(([propName, m]) => {
|
|
1399
1534
|
const attrName = m[1] || propName;
|
|
1400
1535
|
attrNameToPropName.set(attrName, propName);
|
|
1401
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1536
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1402
1537
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1403
1538
|
}
|
|
1404
1539
|
return attrName;
|
|
@@ -1409,10 +1544,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1409
1544
|
};
|
|
1410
1545
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1411
1546
|
// initializeComponent
|
|
1412
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1547
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1413
1548
|
{
|
|
1414
1549
|
// we haven't initialized this element yet
|
|
1415
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1550
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1416
1551
|
// lazy loaded components
|
|
1417
1552
|
// request the component's implementation to be
|
|
1418
1553
|
// wired up with the host element
|
|
@@ -1430,7 +1565,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1430
1565
|
{
|
|
1431
1566
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1432
1567
|
}
|
|
1433
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1568
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1434
1569
|
Cstr.isProxied = true;
|
|
1435
1570
|
}
|
|
1436
1571
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1438,7 +1573,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1438
1573
|
// but let's keep track of when we start and stop
|
|
1439
1574
|
// so that the getters/setters don't incorrectly step on data
|
|
1440
1575
|
{
|
|
1441
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1576
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1442
1577
|
}
|
|
1443
1578
|
// construct the lazy-loaded component implementation
|
|
1444
1579
|
// passing the hostRef is very important during
|
|
@@ -1451,10 +1586,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1451
1586
|
consoleError(e);
|
|
1452
1587
|
}
|
|
1453
1588
|
{
|
|
1454
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1589
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1455
1590
|
}
|
|
1456
1591
|
{
|
|
1457
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1592
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1458
1593
|
}
|
|
1459
1594
|
endNewInstance();
|
|
1460
1595
|
}
|
|
@@ -1464,7 +1599,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1464
1599
|
const scopeId = getScopeId(cmpMeta);
|
|
1465
1600
|
if (!styles.has(scopeId)) {
|
|
1466
1601
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1467
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1602
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1468
1603
|
endRegisterStyles();
|
|
1469
1604
|
}
|
|
1470
1605
|
}
|
|
@@ -1486,19 +1621,19 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1486
1621
|
}
|
|
1487
1622
|
};
|
|
1488
1623
|
const connectedCallback = (elm) => {
|
|
1489
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1624
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1490
1625
|
const hostRef = getHostRef(elm);
|
|
1491
1626
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1492
1627
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1493
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1628
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1494
1629
|
// first time this component has connected
|
|
1495
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1630
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1496
1631
|
{
|
|
1497
1632
|
// initUpdate
|
|
1498
1633
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1499
1634
|
// in here to act as original content anchors as we move nodes around
|
|
1500
1635
|
// host element has been connected to the DOM
|
|
1501
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1636
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1502
1637
|
setContentReference(elm);
|
|
1503
1638
|
}
|
|
1504
1639
|
}
|
|
@@ -1521,7 +1656,7 @@ const connectedCallback = (elm) => {
|
|
|
1521
1656
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1522
1657
|
if (cmpMeta.$members$) {
|
|
1523
1658
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1524
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1659
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1525
1660
|
const value = elm[memberName];
|
|
1526
1661
|
delete elm[memberName];
|
|
1527
1662
|
elm[memberName] = value;
|
|
@@ -1553,7 +1688,7 @@ const setContentReference = (elm) => {
|
|
|
1553
1688
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1554
1689
|
};
|
|
1555
1690
|
const disconnectedCallback = (elm) => {
|
|
1556
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1691
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1557
1692
|
const hostRef = getHostRef(elm);
|
|
1558
1693
|
const instance = hostRef.$lazyInstance$ ;
|
|
1559
1694
|
{
|
|
@@ -1586,7 +1721,7 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1586
1721
|
return this[n];
|
|
1587
1722
|
}
|
|
1588
1723
|
}
|
|
1589
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1724
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1590
1725
|
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
1591
1726
|
Object.defineProperty(elm, 'children', {
|
|
1592
1727
|
get() {
|
|
@@ -1601,8 +1736,8 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1601
1736
|
Object.defineProperty(elm, 'childNodes', {
|
|
1602
1737
|
get() {
|
|
1603
1738
|
const childNodes = childNodesFn.call(this);
|
|
1604
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
1605
|
-
getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
1739
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
|
|
1740
|
+
getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
|
|
1606
1741
|
const result = new FakeNodeList();
|
|
1607
1742
|
for (let i = 0; i < childNodes.length; i++) {
|
|
1608
1743
|
const slot = childNodes[i]['s-nr'];
|
|
@@ -1687,7 +1822,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1687
1822
|
super(self);
|
|
1688
1823
|
self = this;
|
|
1689
1824
|
registerHost(self, cmpMeta);
|
|
1690
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1825
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1691
1826
|
// this component is using shadow dom
|
|
1692
1827
|
// and this browser supports shadow dom
|
|
1693
1828
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1728,7 +1863,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1728
1863
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1729
1864
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1730
1865
|
cmpTags.push(tagName);
|
|
1731
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1866
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1732
1867
|
}
|
|
1733
1868
|
});
|
|
1734
1869
|
});
|
|
@@ -1751,7 +1886,41 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1751
1886
|
endBootstrap();
|
|
1752
1887
|
};
|
|
1753
1888
|
const Fragment = (_, children) => children;
|
|
1754
|
-
const
|
|
1889
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1890
|
+
if (listeners) {
|
|
1891
|
+
listeners.map(([flags, name, method]) => {
|
|
1892
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1893
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1894
|
+
const opts = hostListenerOpts(flags);
|
|
1895
|
+
plt.ael(target, name, handler, opts);
|
|
1896
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1900
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1901
|
+
try {
|
|
1902
|
+
{
|
|
1903
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1904
|
+
// instance is ready, let's call it's member method for this event
|
|
1905
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1906
|
+
}
|
|
1907
|
+
else {
|
|
1908
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
catch (e) {
|
|
1913
|
+
consoleError(e);
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1917
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
1918
|
+
return win;
|
|
1919
|
+
return elm;
|
|
1920
|
+
};
|
|
1921
|
+
// prettier-ignore
|
|
1922
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1923
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1755
1924
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1756
1925
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1757
1926
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1783,7 +1952,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1783
1952
|
if (module) {
|
|
1784
1953
|
return module[exportName];
|
|
1785
1954
|
}
|
|
1955
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1786
1956
|
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1957
|
+
/* @vite-ignore */
|
|
1787
1958
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1788
1959
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1789
1960
|
/* webpackMode: "lazy" */
|
|
@@ -1794,14 +1965,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1794
1965
|
return importedModule[exportName];
|
|
1795
1966
|
}, consoleError);
|
|
1796
1967
|
};
|
|
1797
|
-
const styles = new Map();
|
|
1968
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1969
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1970
|
+
const doc = win.document || { head: {} };
|
|
1971
|
+
const plt = {
|
|
1972
|
+
$flags$: 0,
|
|
1973
|
+
$resourcesUrl$: '',
|
|
1974
|
+
jmp: (h) => h(),
|
|
1975
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1976
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1977
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1978
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1979
|
+
};
|
|
1980
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1981
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1982
|
+
try {
|
|
1983
|
+
new CSSStyleSheet();
|
|
1984
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1985
|
+
}
|
|
1986
|
+
catch (e) { }
|
|
1987
|
+
return false;
|
|
1988
|
+
})()
|
|
1989
|
+
;
|
|
1798
1990
|
const queueDomReads = [];
|
|
1799
1991
|
const queueDomWrites = [];
|
|
1800
1992
|
const queueTask = (queue, write) => (cb) => {
|
|
1801
1993
|
queue.push(cb);
|
|
1802
1994
|
if (!queuePending) {
|
|
1803
1995
|
queuePending = true;
|
|
1804
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1996
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1805
1997
|
nextTick(flush);
|
|
1806
1998
|
}
|
|
1807
1999
|
else {
|