@dso-toolkit/core 45.1.0 → 46.0.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/clsx.m-b81c6b86.js +5 -0
- package/dist/cjs/{create-identifier-fa070b11.js → create-identifier-6ee2a08b.js} +1 -3
- package/dist/cjs/dso-accordion-section.cjs.entry.js +37 -33
- package/dist/cjs/dso-accordion.cjs.entry.js +17 -19
- package/dist/cjs/dso-alert.cjs.entry.js +11 -9
- package/dist/cjs/dso-attachments-counter.cjs.entry.js +4 -3
- package/dist/cjs/dso-autosuggest.cjs.entry.js +36 -61
- package/dist/cjs/dso-badge.cjs.entry.js +5 -4
- package/dist/cjs/dso-banner.cjs.entry.js +5 -4
- package/dist/cjs/dso-date-picker.cjs.entry.js +89 -129
- package/dist/cjs/dso-dropdown-menu.cjs.entry.js +9 -21
- package/dist/cjs/dso-header.cjs.entry.js +24 -30
- package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +23 -22
- package/dist/cjs/dso-highlight-box.cjs.entry.js +17 -12
- package/dist/cjs/dso-icon.cjs.entry.js +389 -385
- package/dist/cjs/dso-image-overlay.cjs.entry.js +13 -13
- package/dist/cjs/dso-info-button.cjs.entry.js +7 -5
- package/dist/cjs/dso-info_2.cjs.entry.js +22 -9
- package/dist/cjs/dso-label.cjs.entry.js +30 -18
- package/dist/cjs/dso-map-base-layers.cjs.entry.js +7 -8
- package/dist/cjs/dso-map-controls.cjs.entry.js +10 -8
- package/dist/cjs/dso-map-overlays.cjs.entry.js +7 -8
- package/dist/cjs/dso-modal.cjs.entry.js +62 -0
- package/dist/cjs/dso-ozon-content.cjs.entry.js +135 -145
- package/dist/cjs/dso-pagination.cjs.entry.js +23 -29
- package/dist/cjs/dso-progress-bar.cjs.entry.js +4 -3
- package/dist/cjs/dso-progress-indicator.cjs.entry.js +11 -8
- package/dist/cjs/dso-responsive-element.cjs.entry.js +13 -10
- package/dist/cjs/dso-table.cjs.entry.js +89 -0
- package/dist/cjs/dso-toggletip.cjs.entry.js +9 -7
- package/dist/cjs/dso-toolkit.cjs.js +3 -3
- package/dist/cjs/dso-tooltip.cjs.entry.js +103 -104
- package/dist/cjs/dso-tree-view.cjs.entry.js +39 -44
- package/dist/cjs/dso-viewer-grid.cjs.entry.js +31 -32
- package/dist/cjs/{focus-trap.esm-e2addb10.js → focus-trap.esm-d83fd673.js} +1 -1
- package/dist/cjs/{index-4066351a.js → index-ecec64a0.js} +486 -500
- package/dist/cjs/{index.esm-50325ea2.js → index.esm-03a9e0b4.js} +50 -112
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/v4-abb5dc0c.js +68 -0
- package/dist/collection/collection-manifest.json +4 -2
- package/dist/collection/components/accordion/accordion.js +183 -174
- package/dist/collection/components/accordion/components/accordion-section.css +19 -11
- package/dist/collection/components/accordion/components/accordion-section.js +211 -211
- package/dist/collection/components/alert/alert.css +10 -10
- package/dist/collection/components/alert/alert.js +58 -53
- package/dist/collection/components/attachments-counter/attachments-counter.js +36 -33
- package/dist/collection/components/autosuggest/autosuggest.js +223 -240
- package/dist/collection/components/badge/badge.js +37 -29
- package/dist/collection/components/banner/banner.js +37 -29
- package/dist/collection/components/date-picker/date-localization.js +24 -45
- package/dist/collection/components/date-picker/date-picker-day.js +3 -5
- package/dist/collection/components/date-picker/date-picker-month.js +2 -10
- package/dist/collection/components/date-picker/date-picker.css +2 -2
- package/dist/collection/components/date-picker/date-picker.js +386 -436
- package/dist/collection/components/date-picker/date-utils.js +15 -15
- package/dist/collection/components/dropdown-menu/dropdown-menu.js +73 -82
- package/dist/collection/components/header/header.css +24 -17
- package/dist/collection/components/header/header.js +210 -246
- package/dist/collection/components/helpcenter-panel/helpcenter-panel.css +18 -2
- package/dist/collection/components/helpcenter-panel/helpcenter-panel.js +94 -90
- package/dist/collection/components/highlight-box/highlight-box.css +1 -1
- package/dist/collection/components/highlight-box/highlight-box.js +112 -101
- package/dist/collection/components/icon/icon.js +220 -209
- package/dist/collection/components/image-overlay/image-overlay.js +38 -44
- package/dist/collection/components/info/info.js +73 -65
- package/dist/collection/components/info-button/info-button.js +113 -102
- package/dist/collection/components/label/label.js +151 -140
- package/dist/collection/components/map-base-layers/map-base-layers.js +75 -74
- package/dist/collection/components/map-controls/map-controls.js +115 -116
- package/dist/collection/components/map-overlays/map-overlays.js +75 -74
- package/dist/collection/components/modal/modal.css +155 -0
- package/dist/collection/components/modal/modal.js +133 -0
- package/dist/collection/components/ozon-content/get-node-name.function.js +2 -2
- package/dist/collection/components/ozon-content/nodes/al.node.js +6 -8
- package/dist/collection/components/ozon-content/nodes/document.node.js +2 -2
- package/dist/collection/components/ozon-content/nodes/ext-ref.node.js +4 -9
- package/dist/collection/components/ozon-content/nodes/fallback.node.js +4 -4
- package/dist/collection/components/ozon-content/nodes/figuur.node.js +20 -32
- package/dist/collection/components/ozon-content/nodes/inhoud.node.js +2 -6
- package/dist/collection/components/ozon-content/nodes/inline-tekst-afbeelding.node.js +3 -6
- package/dist/collection/components/ozon-content/nodes/inline.nodes.js +3 -11
- package/dist/collection/components/ozon-content/nodes/int-io-ref.node.js +4 -4
- package/dist/collection/components/ozon-content/nodes/int-ref.node.js +4 -4
- package/dist/collection/components/ozon-content/nodes/lijst.node.js +20 -0
- package/dist/collection/components/ozon-content/nodes/noot.node.js +9 -13
- package/dist/collection/components/ozon-content/nodes/opschrift.node.js +2 -2
- package/dist/collection/components/ozon-content/nodes/table.node/colspec/colspec-mapper.js +11 -11
- package/dist/collection/components/ozon-content/nodes/table.node/colspec/colspec.interface.js +0 -1
- package/dist/collection/components/ozon-content/nodes/table.node/index.js +1 -1
- package/dist/collection/components/ozon-content/nodes/table.node/table-cell.js +8 -8
- package/dist/collection/components/ozon-content/nodes/table.node/table-colgroup.js +2 -4
- package/dist/collection/components/ozon-content/nodes/table.node/table-rows.js +3 -3
- package/dist/collection/components/ozon-content/nodes/table.node/table.node.js +13 -19
- package/dist/collection/components/ozon-content/nodes/text.node.js +2 -2
- package/dist/collection/components/ozon-content/ozon-content-mapper.js +28 -24
- package/dist/collection/components/ozon-content/ozon-content.css +18 -9
- package/dist/collection/components/ozon-content/ozon-content.interfaces.js +0 -1
- package/dist/collection/components/ozon-content/ozon-content.js +138 -151
- package/dist/collection/components/pagination/pagination.js +119 -126
- package/dist/collection/components/progress-bar/progress-bar.css +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +68 -65
- package/dist/collection/components/progress-indicator/progress-indicator.js +76 -70
- package/dist/collection/components/responsive-element/responsive-element.js +70 -58
- package/dist/collection/components/selectable/selectable.js +260 -243
- package/dist/collection/components/table/table.css +283 -0
- package/dist/collection/components/table/table.interfaces.js +1 -0
- package/dist/collection/components/table/table.js +135 -0
- package/dist/collection/components/toggletip/toggletip.js +94 -87
- package/dist/collection/components/tooltip/tooltip.js +252 -254
- package/dist/collection/components/tree-view/tree-item.js +5 -19
- package/dist/collection/components/tree-view/tree-view.js +151 -139
- package/dist/collection/components/viewer-grid/viewer-grid-filterpanel-buttons.js +2 -7
- package/dist/collection/components/viewer-grid/viewer-grid.css +4 -84
- package/dist/collection/components/viewer-grid/viewer-grid.js +181 -198
- package/dist/collection/index.js +2 -2
- package/dist/collection/utils/create-identifier.js +1 -3
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +1301 -1328
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/p-0917f18a.entry.js +1 -0
- package/dist/dso-toolkit/p-0c8cd0d8.entry.js +1 -0
- package/dist/dso-toolkit/p-19323600.entry.js +1 -0
- package/dist/dso-toolkit/p-2b83a825.entry.js +1 -0
- package/dist/dso-toolkit/p-2fa96ac0.entry.js +1 -0
- package/dist/dso-toolkit/p-3635427a.js +5 -0
- package/dist/dso-toolkit/p-39a33b89.entry.js +1 -0
- package/dist/dso-toolkit/p-3ab4441a.entry.js +1 -0
- package/dist/dso-toolkit/p-3bd6cf49.entry.js +1 -0
- package/dist/dso-toolkit/p-3ebba0dc.entry.js +1 -0
- package/dist/dso-toolkit/p-427f6d90.entry.js +1 -0
- package/dist/dso-toolkit/p-44c0bb3e.entry.js +1 -0
- package/dist/dso-toolkit/p-4b994946.entry.js +1 -0
- package/dist/dso-toolkit/p-5d7f4ff2.js +1 -0
- package/dist/dso-toolkit/{p-4070c1e5.js → p-6a1980b4.js} +0 -0
- package/dist/dso-toolkit/{p-7b37bd52.js → p-6c543986.js} +0 -0
- package/dist/dso-toolkit/p-746dc38a.entry.js +1 -0
- package/dist/dso-toolkit/p-76a1428a.entry.js +1 -0
- package/dist/dso-toolkit/p-800e1267.entry.js +1 -0
- package/dist/dso-toolkit/p-85d516c5.entry.js +1 -0
- package/dist/dso-toolkit/{p-22c35db5.js → p-89d262b7.js} +2 -2
- package/dist/dso-toolkit/p-8c8286e6.entry.js +1 -0
- package/dist/dso-toolkit/p-8f35c8f8.js +2 -0
- package/dist/dso-toolkit/p-a4086aa3.entry.js +1 -0
- package/dist/dso-toolkit/p-a9baa631.entry.js +1 -0
- package/dist/dso-toolkit/p-c4cf2359.entry.js +1 -0
- package/dist/dso-toolkit/p-c7ec6e6e.entry.js +1 -0
- package/dist/dso-toolkit/p-c9ad94a6.entry.js +1 -0
- package/dist/dso-toolkit/p-daba2d98.entry.js +1 -0
- package/dist/dso-toolkit/p-dad32839.entry.js +1 -0
- package/dist/dso-toolkit/p-dcc74039.entry.js +1 -0
- package/dist/dso-toolkit/p-e0a37d82.entry.js +1 -0
- package/dist/dso-toolkit/p-e43e39cf.entry.js +1 -0
- package/dist/dso-toolkit/p-e8b22546.entry.js +1 -0
- package/dist/dso-toolkit/p-ec25868b.entry.js +1 -0
- package/dist/dso-toolkit/p-f93b7c7a.entry.js +1 -0
- package/dist/dso-toolkit/p-ff72ee4c.entry.js +1 -0
- package/dist/esm/clsx.m-25174a58.js +3 -0
- package/dist/esm/{create-identifier-22acd3a3.js → create-identifier-51ee50c4.js} +1 -3
- package/dist/esm/dso-accordion-section.entry.js +37 -33
- package/dist/esm/dso-accordion.entry.js +17 -19
- package/dist/esm/dso-alert.entry.js +11 -9
- package/dist/esm/dso-attachments-counter.entry.js +4 -3
- package/dist/esm/dso-autosuggest.entry.js +36 -61
- package/dist/esm/dso-badge.entry.js +5 -4
- package/dist/esm/dso-banner.entry.js +5 -4
- package/dist/esm/dso-date-picker.entry.js +89 -129
- package/dist/esm/dso-dropdown-menu.entry.js +9 -21
- package/dist/esm/dso-header.entry.js +24 -30
- package/dist/esm/dso-helpcenter-panel.entry.js +23 -22
- package/dist/esm/dso-highlight-box.entry.js +17 -12
- package/dist/esm/dso-icon.entry.js +389 -385
- package/dist/esm/dso-image-overlay.entry.js +13 -13
- package/dist/esm/dso-info-button.entry.js +7 -5
- package/dist/esm/dso-info_2.entry.js +22 -9
- package/dist/esm/dso-label.entry.js +30 -18
- package/dist/esm/dso-map-base-layers.entry.js +7 -8
- package/dist/esm/dso-map-controls.entry.js +10 -8
- package/dist/esm/dso-map-overlays.entry.js +7 -8
- package/dist/esm/dso-modal.entry.js +58 -0
- package/dist/esm/dso-ozon-content.entry.js +135 -145
- package/dist/esm/dso-pagination.entry.js +23 -29
- package/dist/esm/dso-progress-bar.entry.js +4 -3
- package/dist/esm/dso-progress-indicator.entry.js +11 -8
- package/dist/esm/dso-responsive-element.entry.js +13 -10
- package/dist/esm/dso-table.entry.js +85 -0
- package/dist/esm/dso-toggletip.entry.js +9 -7
- package/dist/esm/dso-toolkit.js +3 -3
- package/dist/esm/dso-tooltip.entry.js +103 -104
- package/dist/esm/dso-tree-view.entry.js +39 -44
- package/dist/esm/dso-viewer-grid.entry.js +31 -32
- package/dist/esm/{focus-trap.esm-e3b5bde3.js → focus-trap.esm-33203b60.js} +1 -1
- package/dist/esm/{index-771c1291.js → index-1a4dda48.js} +486 -500
- package/dist/esm/{index.esm-4510c39e.js → index.esm-8fc07ad8.js} +50 -112
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/v4-d398bde5.js +66 -0
- package/dist/types/components/accordion/accordion.d.ts +2 -2
- package/dist/types/components/accordion/accordion.interfaces.d.ts +3 -3
- package/dist/types/components/accordion/components/accordion-section.d.ts +2 -2
- package/dist/types/components/alert/alert.d.ts +1 -1
- package/dist/types/components/autosuggest/autosuggest.d.ts +3 -3
- package/dist/types/components/badge/badge.d.ts +1 -1
- package/dist/types/components/banner/banner.d.ts +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +1 -1
- package/dist/types/components/header/header.d.ts +2 -2
- package/dist/types/components/header/header.interfaces.d.ts +1 -1
- package/dist/types/components/helpcenter-panel/helpcenter-panel.d.ts +1 -1
- package/dist/types/components/image-overlay/image-overlay.d.ts +1 -1
- package/dist/types/components/info/info.d.ts +1 -1
- package/dist/types/components/info-button/info-button.d.ts +1 -1
- package/dist/types/components/label/label.d.ts +2 -2
- package/dist/types/components/map-base-layers/map-base-layers.d.ts +2 -2
- package/dist/types/components/map-controls/map-controls.d.ts +2 -2
- package/dist/types/components/map-overlays/map-overlays.d.ts +3 -3
- package/dist/types/components/modal/modal.d.ts +22 -0
- package/dist/types/components/ozon-content/nodes/al.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/document.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/ext-ref.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/fallback.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/figuur.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/inhoud.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/inline-tekst-afbeelding.node.d.ts +1 -1
- package/dist/types/components/ozon-content/nodes/inline.nodes.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/int-io-ref.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/int-ref.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/lijst.node.d.ts +6 -0
- package/dist/types/components/ozon-content/nodes/noot.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/opschrift.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/table.node/colspec/colspec-mapper.d.ts +1 -1
- package/dist/types/components/ozon-content/nodes/table.node/index.d.ts +1 -1
- package/dist/types/components/ozon-content/nodes/table.node/table-cell.d.ts +3 -3
- package/dist/types/components/ozon-content/nodes/table.node/table-colgroup.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/table.node/table-rows.d.ts +3 -3
- package/dist/types/components/ozon-content/nodes/table.node/table.node.d.ts +2 -2
- package/dist/types/components/ozon-content/nodes/text.node.d.ts +1 -1
- package/dist/types/components/ozon-content/ozon-content-context.interface.d.ts +4 -4
- package/dist/types/components/ozon-content/ozon-content-mapper.d.ts +2 -1
- package/dist/types/components/ozon-content/ozon-content-node-context.interface.d.ts +2 -1
- package/dist/types/components/ozon-content/ozon-content-node.interface.d.ts +2 -1
- package/dist/types/components/ozon-content/ozon-content.d.ts +5 -4
- package/dist/types/components/pagination/pagination.d.ts +3 -3
- package/dist/types/components/progress-indicator/progress-indicator.d.ts +1 -1
- package/dist/types/components/responsive-element/responsive-element.d.ts +2 -2
- package/dist/types/components/responsive-element/responsive-element.interfaces.d.ts +1 -1
- package/dist/types/components/selectable/selectable.d.ts +2 -2
- package/dist/types/components/table/table.d.ts +26 -0
- package/dist/types/components/table/table.interfaces.d.ts +3 -0
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree-view/tree-item.d.ts +3 -3
- package/dist/types/components/tree-view/tree-view.d.ts +5 -5
- package/dist/types/components/viewer-grid/viewer-grid-filterpanel-buttons.d.ts +1 -1
- package/dist/types/components/viewer-grid/viewer-grid.d.ts +2 -1
- package/dist/types/components.d.ts +181 -58
- package/dist/types/globals.d.ts +16 -16
- package/dist/types/index.d.ts +3 -3
- package/dist/types/stencil-public-runtime.d.ts +26 -8
- package/loader/package.json +1 -0
- package/package.json +15 -16
- package/readme.md +3 -3
- package/dist/cjs/clsx.m-b00fa5e1.js +0 -44
- package/dist/cjs/v4-8e8d6fbc.js +0 -77
- package/dist/collection/components/accordion/accordion.template.js +0 -26
- package/dist/collection/components/alert/alert.template.js +0 -20
- package/dist/collection/components/attachments-counter/attachments-counter.template.js +0 -6
- package/dist/collection/components/autosuggest/autosuggest.template.js +0 -19
- package/dist/collection/components/badge/badge.template.js +0 -7
- package/dist/collection/components/banner/banner.template.js +0 -19
- package/dist/collection/components/date-picker/date-picker.template.js +0 -16
- package/dist/collection/components/dropdown-menu/dropdown-menu.template.js +0 -36
- package/dist/collection/components/header/header.template.js +0 -18
- package/dist/collection/components/helpcenter-panel/helpcenter-panel.template.js +0 -13
- package/dist/collection/components/highlight-box/highlight-box.template.js +0 -20
- package/dist/collection/components/icon/icon.template.js +0 -10
- package/dist/collection/components/image-overlay/image-overlay.template.js +0 -15
- package/dist/collection/components/info/info.template.js +0 -12
- package/dist/collection/components/info-button/info-button.template.js +0 -11
- package/dist/collection/components/label/label.template.js +0 -23
- package/dist/collection/components/map-controls/map-controls.template.js +0 -23
- package/dist/collection/components/ozon-content/ozon-content.template.js +0 -14
- package/dist/collection/components/pagination/pagination.template.js +0 -11
- package/dist/collection/components/progress-bar/progress-bar.template.js +0 -11
- package/dist/collection/components/progress-indicator/progress-indicator.template.js +0 -11
- package/dist/collection/components/responsive-element/responsive-element.template.js +0 -10
- package/dist/collection/components/selectable/selectable.template.js +0 -24
- package/dist/collection/components/toggletip/toggletip.template.js +0 -12
- package/dist/collection/components/tooltip/tooltip.template.js +0 -7
- package/dist/collection/components/tree-view/tree-view.template.js +0 -11
- package/dist/collection/components/viewer-grid/viewer-grid.template.js +0 -20
- package/dist/dso-toolkit/p-02b2e01c.entry.js +0 -1
- package/dist/dso-toolkit/p-05a9e206.entry.js +0 -1
- package/dist/dso-toolkit/p-19b890a3.js +0 -1
- package/dist/dso-toolkit/p-2e74485e.entry.js +0 -1
- package/dist/dso-toolkit/p-2f6b1092.entry.js +0 -1
- package/dist/dso-toolkit/p-3381c859.entry.js +0 -1
- package/dist/dso-toolkit/p-37a34037.entry.js +0 -1
- package/dist/dso-toolkit/p-42450cfe.js +0 -1
- package/dist/dso-toolkit/p-4c44d27c.entry.js +0 -1
- package/dist/dso-toolkit/p-4fd140e9.entry.js +0 -1
- package/dist/dso-toolkit/p-53c7bf4f.entry.js +0 -1
- package/dist/dso-toolkit/p-67b11174.entry.js +0 -1
- package/dist/dso-toolkit/p-6cac0292.entry.js +0 -1
- package/dist/dso-toolkit/p-7213783b.entry.js +0 -1
- package/dist/dso-toolkit/p-73bbb9a6.entry.js +0 -1
- package/dist/dso-toolkit/p-8515d157.entry.js +0 -1
- package/dist/dso-toolkit/p-93b53eb7.entry.js +0 -1
- package/dist/dso-toolkit/p-ac0c0eee.entry.js +0 -1
- package/dist/dso-toolkit/p-b1a75b67.entry.js +0 -1
- package/dist/dso-toolkit/p-b6afe104.entry.js +0 -1
- package/dist/dso-toolkit/p-b9531adb.entry.js +0 -1
- package/dist/dso-toolkit/p-c339891f.entry.js +0 -1
- package/dist/dso-toolkit/p-d2255268.entry.js +0 -1
- package/dist/dso-toolkit/p-d6192ab8.entry.js +0 -1
- package/dist/dso-toolkit/p-de50f5f1.entry.js +0 -1
- package/dist/dso-toolkit/p-e16b5d71.entry.js +0 -1
- package/dist/dso-toolkit/p-e2e2106e.entry.js +0 -1
- package/dist/dso-toolkit/p-ea1d4c81.entry.js +0 -1
- package/dist/dso-toolkit/p-ec3b8800.entry.js +0 -1
- package/dist/dso-toolkit/p-efd815dc.entry.js +0 -1
- package/dist/dso-toolkit/p-f42d8240.entry.js +0 -1
- package/dist/dso-toolkit/p-f8b023c4.js +0 -5
- package/dist/esm/clsx.m-071989db.js +0 -42
- package/dist/esm/v4-fa4bb814.js +0 -75
- package/dist/types/components/accordion/accordion.template.d.ts +0 -2
- package/dist/types/components/alert/alert.template.d.ts +0 -3
- package/dist/types/components/attachments-counter/attachments-counter.template.d.ts +0 -2
- package/dist/types/components/autosuggest/autosuggest.template.d.ts +0 -3
- package/dist/types/components/badge/badge.template.d.ts +0 -2
- package/dist/types/components/banner/banner.template.d.ts +0 -3
- package/dist/types/components/date-picker/date-picker.template.d.ts +0 -2
- package/dist/types/components/dropdown-menu/dropdown-menu.template.d.ts +0 -2
- package/dist/types/components/header/header.template.d.ts +0 -2
- package/dist/types/components/helpcenter-panel/helpcenter-panel.template.d.ts +0 -2
- package/dist/types/components/highlight-box/highlight-box.template.d.ts +0 -3
- package/dist/types/components/icon/icon.template.d.ts +0 -2
- package/dist/types/components/image-overlay/image-overlay.template.d.ts +0 -2
- package/dist/types/components/info/info.template.d.ts +0 -3
- package/dist/types/components/info-button/info-button.template.d.ts +0 -2
- package/dist/types/components/label/label.template.d.ts +0 -2
- package/dist/types/components/map-controls/map-controls.template.d.ts +0 -2
- package/dist/types/components/ozon-content/ozon-content.template.d.ts +0 -2
- package/dist/types/components/pagination/pagination.template.d.ts +0 -2
- package/dist/types/components/progress-bar/progress-bar.template.d.ts +0 -2
- package/dist/types/components/progress-indicator/progress-indicator.template.d.ts +0 -2
- package/dist/types/components/responsive-element/responsive-element.template.d.ts +0 -3
- package/dist/types/components/selectable/selectable.template.d.ts +0 -3
- package/dist/types/components/toggletip/toggletip.template.d.ts +0 -2
- package/dist/types/components/tooltip/tooltip.template.d.ts +0 -2
- package/dist/types/components/tree-view/tree-view.template.d.ts +0 -2
- package/dist/types/components/viewer-grid/viewer-grid.template.d.ts +0 -3
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
const NAMESPACE = 'dso-toolkit';
|
|
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;
|
|
@@ -9,73 +17,6 @@ let checkSlotRelocate = false;
|
|
|
9
17
|
let isSvgMode = false;
|
|
10
18
|
let renderingRef = null;
|
|
11
19
|
let queuePending = false;
|
|
12
|
-
const win = typeof window !== 'undefined' ? window : {};
|
|
13
|
-
const doc = win.document || { head: {} };
|
|
14
|
-
const plt = {
|
|
15
|
-
$flags$: 0,
|
|
16
|
-
$resourcesUrl$: '',
|
|
17
|
-
jmp: (h) => h(),
|
|
18
|
-
raf: (h) => requestAnimationFrame(h),
|
|
19
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
20
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
21
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
22
|
-
};
|
|
23
|
-
const supportsShadow = true;
|
|
24
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
25
|
-
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
26
|
-
try {
|
|
27
|
-
new CSSStyleSheet();
|
|
28
|
-
return typeof new CSSStyleSheet().replace === 'function';
|
|
29
|
-
}
|
|
30
|
-
catch (e) { }
|
|
31
|
-
return false;
|
|
32
|
-
})()
|
|
33
|
-
;
|
|
34
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
35
|
-
if (listeners) {
|
|
36
|
-
listeners.map(([flags, name, method]) => {
|
|
37
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
38
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
39
|
-
const opts = hostListenerOpts(flags);
|
|
40
|
-
plt.ael(target, name, handler, opts);
|
|
41
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
46
|
-
try {
|
|
47
|
-
{
|
|
48
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
49
|
-
// instance is ready, let's call it's member method for this event
|
|
50
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
consoleError(e);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
62
|
-
if (flags & 4 /* TargetDocument */)
|
|
63
|
-
return doc;
|
|
64
|
-
if (flags & 8 /* TargetWindow */)
|
|
65
|
-
return win;
|
|
66
|
-
return elm;
|
|
67
|
-
};
|
|
68
|
-
// prettier-ignore
|
|
69
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
70
|
-
const CONTENT_REF_ID = 'r';
|
|
71
|
-
const ORG_LOCATION_ID = 'o';
|
|
72
|
-
const SLOT_NODE_ID = 's';
|
|
73
|
-
const TEXT_NODE_ID = 't';
|
|
74
|
-
const HYDRATE_ID = 's-id';
|
|
75
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
76
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
77
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
78
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
79
20
|
const createTime = (fnName, tagName = '') => {
|
|
80
21
|
{
|
|
81
22
|
return () => {
|
|
@@ -90,80 +31,8 @@ const uniqueTime = (key, measureText) => {
|
|
|
90
31
|
};
|
|
91
32
|
}
|
|
92
33
|
};
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
let style = styles.get(scopeId);
|
|
96
|
-
if (supportsConstructibleStylesheets && allowCS) {
|
|
97
|
-
style = (style || new CSSStyleSheet());
|
|
98
|
-
style.replace(cssText);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
style = cssText;
|
|
102
|
-
}
|
|
103
|
-
styles.set(scopeId, style);
|
|
104
|
-
};
|
|
105
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
106
|
-
let scopeId = getScopeId(cmpMeta);
|
|
107
|
-
let style = styles.get(scopeId);
|
|
108
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
109
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
110
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
111
|
-
if (style) {
|
|
112
|
-
if (typeof style === 'string') {
|
|
113
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
114
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
115
|
-
let styleElm;
|
|
116
|
-
if (!appliedStyles) {
|
|
117
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
118
|
-
}
|
|
119
|
-
if (!appliedStyles.has(scopeId)) {
|
|
120
|
-
if (styleContainerNode.host &&
|
|
121
|
-
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
122
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
123
|
-
styleElm.innerHTML = style;
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
{
|
|
127
|
-
styleElm = doc.createElement('style');
|
|
128
|
-
styleElm.innerHTML = style;
|
|
129
|
-
}
|
|
130
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
131
|
-
}
|
|
132
|
-
if (appliedStyles) {
|
|
133
|
-
appliedStyles.add(scopeId);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
138
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return scopeId;
|
|
142
|
-
};
|
|
143
|
-
const attachStyles = (hostRef) => {
|
|
144
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
145
|
-
const elm = hostRef.$hostElement$;
|
|
146
|
-
const flags = cmpMeta.$flags$;
|
|
147
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
148
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
149
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
150
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
151
|
-
// or this browser doesn't support native shadow dom
|
|
152
|
-
// and this host element was NOT created with SSR
|
|
153
|
-
// let's pick out the inner content for slot projection
|
|
154
|
-
// create a node to represent where the original
|
|
155
|
-
// content was first placed, which is useful later on
|
|
156
|
-
// DOM WRITE!!
|
|
157
|
-
elm['s-sc'] = scopeId;
|
|
158
|
-
elm.classList.add(scopeId + '-h');
|
|
159
|
-
if (flags & 2 /* scopedCssEncapsulation */) {
|
|
160
|
-
elm.classList.add(scopeId + '-s');
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
endAttachStyles();
|
|
164
|
-
};
|
|
165
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
166
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
34
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
35
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
167
36
|
/**
|
|
168
37
|
* Default style mode id
|
|
169
38
|
*/
|
|
@@ -200,7 +69,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
200
69
|
let slotName = null;
|
|
201
70
|
let simple = false;
|
|
202
71
|
let lastSimple = false;
|
|
203
|
-
|
|
72
|
+
const vNodeChildren = [];
|
|
204
73
|
const walk = (c) => {
|
|
205
74
|
for (let i = 0; i < c.length; i++) {
|
|
206
75
|
child = c[i];
|
|
@@ -312,6 +181,152 @@ const convertToPrivate = (node) => {
|
|
|
312
181
|
vnode.$name$ = node.vname;
|
|
313
182
|
return vnode;
|
|
314
183
|
};
|
|
184
|
+
/**
|
|
185
|
+
* Parse a new property value for a given property type.
|
|
186
|
+
*
|
|
187
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
188
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
189
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
190
|
+
* 2. the type stored from `propType`.
|
|
191
|
+
*
|
|
192
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
193
|
+
*
|
|
194
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
195
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
196
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
197
|
+
* ```tsx
|
|
198
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* HTML prop values on the other hand, will always a string
|
|
202
|
+
*
|
|
203
|
+
* @param propValue the new value to coerce to some type
|
|
204
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
205
|
+
* @returns the parsed/coerced value
|
|
206
|
+
*/
|
|
207
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
208
|
+
// ensure this value is of the correct prop type
|
|
209
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
210
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
211
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
212
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
213
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
214
|
+
}
|
|
215
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
216
|
+
// force it to be a number
|
|
217
|
+
return parseFloat(propValue);
|
|
218
|
+
}
|
|
219
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
220
|
+
// could have been passed as a number or boolean
|
|
221
|
+
// but we still want it as a string
|
|
222
|
+
return String(propValue);
|
|
223
|
+
}
|
|
224
|
+
// redundant return here for better minification
|
|
225
|
+
return propValue;
|
|
226
|
+
}
|
|
227
|
+
// not sure exactly what type we want
|
|
228
|
+
// so no need to change to a different type
|
|
229
|
+
return propValue;
|
|
230
|
+
};
|
|
231
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
232
|
+
const createEvent = (ref, name, flags) => {
|
|
233
|
+
const elm = getElement(ref);
|
|
234
|
+
return {
|
|
235
|
+
emit: (detail) => {
|
|
236
|
+
return emitEvent(elm, name, {
|
|
237
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
238
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
239
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
240
|
+
detail,
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
247
|
+
* @param elm the target of the Event
|
|
248
|
+
* @param name the name to give the custom Event
|
|
249
|
+
* @param opts options for configuring a custom Event
|
|
250
|
+
* @returns the custom Event
|
|
251
|
+
*/
|
|
252
|
+
const emitEvent = (elm, name, opts) => {
|
|
253
|
+
const ev = plt.ce(name, opts);
|
|
254
|
+
elm.dispatchEvent(ev);
|
|
255
|
+
return ev;
|
|
256
|
+
};
|
|
257
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
258
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
259
|
+
let style = styles.get(scopeId);
|
|
260
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
261
|
+
style = (style || new CSSStyleSheet());
|
|
262
|
+
if (typeof style === 'string') {
|
|
263
|
+
style = cssText;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
style.replaceSync(cssText);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
style = cssText;
|
|
271
|
+
}
|
|
272
|
+
styles.set(scopeId, style);
|
|
273
|
+
};
|
|
274
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
275
|
+
let scopeId = getScopeId(cmpMeta);
|
|
276
|
+
const style = styles.get(scopeId);
|
|
277
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
278
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
279
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
280
|
+
if (style) {
|
|
281
|
+
if (typeof style === 'string') {
|
|
282
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
283
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
284
|
+
let styleElm;
|
|
285
|
+
if (!appliedStyles) {
|
|
286
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
287
|
+
}
|
|
288
|
+
if (!appliedStyles.has(scopeId)) {
|
|
289
|
+
{
|
|
290
|
+
{
|
|
291
|
+
styleElm = doc.createElement('style');
|
|
292
|
+
styleElm.innerHTML = style;
|
|
293
|
+
}
|
|
294
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
295
|
+
}
|
|
296
|
+
if (appliedStyles) {
|
|
297
|
+
appliedStyles.add(scopeId);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
302
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return scopeId;
|
|
306
|
+
};
|
|
307
|
+
const attachStyles = (hostRef) => {
|
|
308
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
309
|
+
const elm = hostRef.$hostElement$;
|
|
310
|
+
const flags = cmpMeta.$flags$;
|
|
311
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
312
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
313
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
314
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
315
|
+
// or this browser doesn't support native shadow dom
|
|
316
|
+
// and this host element was NOT created with SSR
|
|
317
|
+
// let's pick out the inner content for slot projection
|
|
318
|
+
// create a node to represent where the original
|
|
319
|
+
// content was first placed, which is useful later on
|
|
320
|
+
// DOM WRITE!!
|
|
321
|
+
elm['s-sc'] = scopeId;
|
|
322
|
+
elm.classList.add(scopeId + '-h');
|
|
323
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
324
|
+
elm.classList.add(scopeId + '-s');
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
endAttachStyles();
|
|
328
|
+
};
|
|
329
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
315
330
|
/**
|
|
316
331
|
* Production setAccessor() function based on Preact by
|
|
317
332
|
* Jason Miller (@developit)
|
|
@@ -409,7 +424,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
409
424
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
410
425
|
try {
|
|
411
426
|
if (!elm.tagName.includes('-')) {
|
|
412
|
-
|
|
427
|
+
const n = newValue == null ? '' : newValue;
|
|
413
428
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
414
429
|
if (memberName === 'list') {
|
|
415
430
|
isProp = false;
|
|
@@ -448,7 +463,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
448
463
|
}
|
|
449
464
|
}
|
|
450
465
|
}
|
|
451
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
466
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
452
467
|
newValue = newValue === true ? '' : newValue;
|
|
453
468
|
if (xlink) {
|
|
454
469
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
@@ -466,7 +481,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
466
481
|
// if the element passed in is a shadow root, which is a document fragment
|
|
467
482
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
468
483
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
469
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
484
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
470
485
|
? newVnode.$elm$.host
|
|
471
486
|
: newVnode.$elm$;
|
|
472
487
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -484,9 +499,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
484
499
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
485
500
|
}
|
|
486
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
504
|
+
*
|
|
505
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
506
|
+
* @param newParentVNode the parent VNode from the current render
|
|
507
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
508
|
+
* children, for which we will create a new DOM node
|
|
509
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
510
|
+
* @returns the newly created node
|
|
511
|
+
*/
|
|
487
512
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
488
513
|
// tslint:disable-next-line: prefer-const
|
|
489
|
-
|
|
514
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
|
490
515
|
let i = 0;
|
|
491
516
|
let elm;
|
|
492
517
|
let childNode;
|
|
@@ -501,16 +526,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
501
526
|
}
|
|
502
527
|
newVNode.$flags$ |= newVNode.$children$
|
|
503
528
|
? // slot element has fallback content
|
|
504
|
-
2 /* isSlotFallback */
|
|
529
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
505
530
|
: // slot element does not have fallback content
|
|
506
|
-
1 /* isSlotReference */;
|
|
531
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
507
532
|
}
|
|
508
533
|
}
|
|
509
534
|
if (newVNode.$text$ !== null) {
|
|
510
535
|
// create text node
|
|
511
536
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
512
537
|
}
|
|
513
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
538
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
514
539
|
// create a slot reference node
|
|
515
540
|
elm = newVNode.$elm$ =
|
|
516
541
|
doc.createTextNode('');
|
|
@@ -520,7 +545,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
520
545
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
521
546
|
}
|
|
522
547
|
// create element
|
|
523
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
548
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
524
549
|
? 'slot-fb'
|
|
525
550
|
: newVNode.$tag$)
|
|
526
551
|
);
|
|
@@ -560,7 +585,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
560
585
|
}
|
|
561
586
|
{
|
|
562
587
|
elm['s-hn'] = hostTagName;
|
|
563
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
588
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
564
589
|
// remember the content reference comment
|
|
565
590
|
elm['s-sr'] = true;
|
|
566
591
|
// remember the content reference comment
|
|
@@ -579,7 +604,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
579
604
|
return elm;
|
|
580
605
|
};
|
|
581
606
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
582
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
607
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
583
608
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
584
609
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
585
610
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -600,7 +625,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
600
625
|
putBackInOriginalLocation(childNode, recursive);
|
|
601
626
|
}
|
|
602
627
|
}
|
|
603
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
628
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
604
629
|
};
|
|
605
630
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
606
631
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
@@ -642,6 +667,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
642
667
|
}
|
|
643
668
|
}
|
|
644
669
|
};
|
|
670
|
+
/**
|
|
671
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
672
|
+
* traversing the two collections of children, identifying nodes that are
|
|
673
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
674
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
675
|
+
*
|
|
676
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
677
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
678
|
+
* 'windows' by storing start and end indices and references to the
|
|
679
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
680
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
681
|
+
* no children left to update by doing the following:
|
|
682
|
+
*
|
|
683
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
684
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
685
|
+
* only with a window bounded by the highlighted elements:
|
|
686
|
+
*
|
|
687
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
688
|
+
* ^^^^^^ ^^^^^^
|
|
689
|
+
*
|
|
690
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
691
|
+
* across the windows. This will basically detect elements which haven't
|
|
692
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
693
|
+
* VNode elements (represented as HTML):
|
|
694
|
+
*
|
|
695
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
696
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
697
|
+
*
|
|
698
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
699
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
700
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
701
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
702
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
703
|
+
*
|
|
704
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
705
|
+
* window corresponds to the element at the end of the other window. This is
|
|
706
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
707
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
708
|
+
* children nodes themselves have not changed but merely moved in the
|
|
709
|
+
* following example:
|
|
710
|
+
*
|
|
711
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
712
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
713
|
+
*
|
|
714
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
715
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
716
|
+
* DOM.
|
|
717
|
+
*
|
|
718
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
719
|
+
* nodes in the old children which have the same key as the first element in
|
|
720
|
+
* our window on the new children. If we find such a node we handle calling
|
|
721
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
722
|
+
* what we find.
|
|
723
|
+
*
|
|
724
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
725
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
726
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
727
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
728
|
+
* children has collapsed we still have more nodes on the new children that
|
|
729
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
730
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
731
|
+
* sure the corresponding DOM nodes are removed.
|
|
732
|
+
*
|
|
733
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
734
|
+
* @param oldCh the old children of the parent node
|
|
735
|
+
* @param newVNode the new VNode which will replace the parent
|
|
736
|
+
* @param newCh the new children of the parent node
|
|
737
|
+
*/
|
|
645
738
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
646
739
|
let oldStartIdx = 0;
|
|
647
740
|
let newStartIdx = 0;
|
|
@@ -657,7 +750,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
657
750
|
let elmToMove;
|
|
658
751
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
659
752
|
if (oldStartVnode == null) {
|
|
660
|
-
//
|
|
753
|
+
// VNode might have been moved left
|
|
661
754
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
662
755
|
}
|
|
663
756
|
else if (oldEndVnode == null) {
|
|
@@ -670,37 +763,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
670
763
|
newEndVnode = newCh[--newEndIdx];
|
|
671
764
|
}
|
|
672
765
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
766
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
767
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
768
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
769
|
+
// since things are matched up in order.
|
|
673
770
|
patch(oldStartVnode, newStartVnode);
|
|
674
771
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
675
772
|
newStartVnode = newCh[++newStartIdx];
|
|
676
773
|
}
|
|
677
774
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
775
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
776
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
777
|
+
// need to move any DOM Nodes.
|
|
678
778
|
patch(oldEndVnode, newEndVnode);
|
|
679
779
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
680
780
|
newEndVnode = newCh[--newEndIdx];
|
|
681
781
|
}
|
|
682
782
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
683
|
-
// Vnode moved right
|
|
783
|
+
// case: "Vnode moved right"
|
|
784
|
+
//
|
|
785
|
+
// We've found that the last node in our window on the new children is
|
|
786
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
787
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
788
|
+
// nodes:
|
|
789
|
+
//
|
|
790
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
791
|
+
// ^^^^^^^^^^^
|
|
792
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
793
|
+
// ^^^^^^^^^^^^^
|
|
794
|
+
//
|
|
795
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
796
|
+
// and move the DOM element for `oldStartVnode`.
|
|
684
797
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
685
798
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
686
799
|
}
|
|
687
800
|
patch(oldStartVnode, newEndVnode);
|
|
801
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
802
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
803
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
804
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
805
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
806
|
+
//
|
|
807
|
+
// <old-start-node />
|
|
808
|
+
// <some-intervening-node />
|
|
809
|
+
// <old-end-node />
|
|
810
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
811
|
+
// <next-sibling />
|
|
812
|
+
//
|
|
813
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
814
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
815
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
816
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
817
|
+
// append it to the children of the parent element.
|
|
688
818
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
689
819
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
690
820
|
newEndVnode = newCh[--newEndIdx];
|
|
691
821
|
}
|
|
692
822
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
693
|
-
// Vnode moved left
|
|
823
|
+
// case: "Vnode moved left"
|
|
824
|
+
//
|
|
825
|
+
// We've found that the first node in our window on the new children is
|
|
826
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
827
|
+
// Visually, this is the layout of these two nodes:
|
|
828
|
+
//
|
|
829
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
830
|
+
// ^^^^^^^^^^^^^
|
|
831
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
832
|
+
// ^^^^^^^^^^^
|
|
833
|
+
//
|
|
834
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
835
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
836
|
+
// children etc) but we also need to move the DOM node to which
|
|
837
|
+
// `oldEndVnode` corresponds.
|
|
694
838
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
695
839
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
696
840
|
}
|
|
697
841
|
patch(oldEndVnode, newStartVnode);
|
|
842
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
843
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
844
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
845
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
846
|
+
// future.
|
|
698
847
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
699
848
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
700
849
|
newStartVnode = newCh[++newStartIdx];
|
|
701
850
|
}
|
|
702
851
|
else {
|
|
703
|
-
//
|
|
852
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
853
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
854
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
855
|
+
// component.
|
|
856
|
+
//
|
|
857
|
+
// First we check to see if there are any nodes in the array of old
|
|
858
|
+
// children which have the same key as the first node in the new
|
|
859
|
+
// children.
|
|
704
860
|
idxInOld = -1;
|
|
705
861
|
{
|
|
706
862
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
@@ -711,23 +867,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
711
867
|
}
|
|
712
868
|
}
|
|
713
869
|
if (idxInOld >= 0) {
|
|
870
|
+
// We found a node in the old children which matches up with the first
|
|
871
|
+
// node in the new children! So let's deal with that
|
|
714
872
|
elmToMove = oldCh[idxInOld];
|
|
715
873
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
874
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
716
875
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
717
876
|
}
|
|
718
877
|
else {
|
|
719
878
|
patch(elmToMove, newStartVnode);
|
|
879
|
+
// invalidate the matching old node so that we won't try to update it
|
|
880
|
+
// again later on
|
|
720
881
|
oldCh[idxInOld] = undefined;
|
|
721
882
|
node = elmToMove.$elm$;
|
|
722
883
|
}
|
|
723
884
|
newStartVnode = newCh[++newStartIdx];
|
|
724
885
|
}
|
|
725
886
|
else {
|
|
726
|
-
//
|
|
887
|
+
// We either didn't find an element in the old children that matches
|
|
888
|
+
// the key of the first new child OR the build is not using `key`
|
|
889
|
+
// attributes at all. In either case we need to create a new element
|
|
890
|
+
// for the new node.
|
|
727
891
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
728
892
|
newStartVnode = newCh[++newStartIdx];
|
|
729
893
|
}
|
|
730
894
|
if (node) {
|
|
895
|
+
// if we created a new node then handle inserting it to the DOM
|
|
731
896
|
{
|
|
732
897
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
733
898
|
}
|
|
@@ -735,21 +900,43 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
735
900
|
}
|
|
736
901
|
}
|
|
737
902
|
if (oldStartIdx > oldEndIdx) {
|
|
903
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
738
904
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
739
905
|
}
|
|
740
906
|
else if (newStartIdx > newEndIdx) {
|
|
907
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
908
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
909
|
+
// relevant DOM nodes)
|
|
741
910
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
742
911
|
}
|
|
743
912
|
};
|
|
744
|
-
|
|
913
|
+
/**
|
|
914
|
+
* Compare two VNodes to determine if they are the same
|
|
915
|
+
*
|
|
916
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
917
|
+
* information set on the two VNodes and can be misleading under certain
|
|
918
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
919
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
920
|
+
* checking that they have the same tag.
|
|
921
|
+
*
|
|
922
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
923
|
+
* changing order within a `children` array or something along those lines then
|
|
924
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
925
|
+
*
|
|
926
|
+
* @param leftVNode the first VNode to check
|
|
927
|
+
* @param rightVNode the second VNode to check
|
|
928
|
+
* @returns whether they're equal or not
|
|
929
|
+
*/
|
|
930
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
745
931
|
// compare if two vnode to see if they're "technically" the same
|
|
746
932
|
// need to have the same element tag, and same key to be the same
|
|
747
|
-
if (
|
|
748
|
-
if (
|
|
749
|
-
return
|
|
933
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
934
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
935
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
750
936
|
}
|
|
937
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
751
938
|
{
|
|
752
|
-
return
|
|
939
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
753
940
|
}
|
|
754
941
|
}
|
|
755
942
|
return false;
|
|
@@ -762,6 +949,14 @@ const referenceNode = (node) => {
|
|
|
762
949
|
return (node && node['s-ol']) || node;
|
|
763
950
|
};
|
|
764
951
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
952
|
+
/**
|
|
953
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
954
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
955
|
+
* children of the two nodes (if any).
|
|
956
|
+
*
|
|
957
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
958
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
959
|
+
*/
|
|
765
960
|
const patch = (oldVNode, newVNode) => {
|
|
766
961
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
767
962
|
const oldChildren = oldVNode.$children$;
|
|
@@ -775,7 +970,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
775
970
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
776
971
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
777
972
|
}
|
|
778
|
-
// element node
|
|
779
973
|
{
|
|
780
974
|
if (tag === 'slot')
|
|
781
975
|
;
|
|
@@ -788,6 +982,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
788
982
|
}
|
|
789
983
|
if (oldChildren !== null && newChildren !== null) {
|
|
790
984
|
// looks like there's child vnodes for both the old and new vnodes
|
|
985
|
+
// so we need to call `updateChildren` to reconcile them
|
|
791
986
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
792
987
|
}
|
|
793
988
|
else if (newChildren !== null) {
|
|
@@ -819,7 +1014,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
819
1014
|
};
|
|
820
1015
|
const updateFallbackSlotVisibility = (elm) => {
|
|
821
1016
|
// tslint:disable-next-line: prefer-const
|
|
822
|
-
|
|
1017
|
+
const childNodes = elm.childNodes;
|
|
823
1018
|
let childNode;
|
|
824
1019
|
let i;
|
|
825
1020
|
let ilen;
|
|
@@ -828,7 +1023,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
828
1023
|
let nodeType;
|
|
829
1024
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
830
1025
|
childNode = childNodes[i];
|
|
831
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1026
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
832
1027
|
if (childNode['s-sr']) {
|
|
833
1028
|
// this is a slot fallback node
|
|
834
1029
|
// get the slot name for this slot reference node
|
|
@@ -840,7 +1035,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
840
1035
|
nodeType = childNodes[j].nodeType;
|
|
841
1036
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
842
1037
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
843
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1038
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
844
1039
|
childNode.hidden = true;
|
|
845
1040
|
break;
|
|
846
1041
|
}
|
|
@@ -849,8 +1044,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
849
1044
|
// this is a default fallback slot node
|
|
850
1045
|
// any element or text node (with content)
|
|
851
1046
|
// should hide the default fallback slot node
|
|
852
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
853
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1047
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1048
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
854
1049
|
childNode.hidden = true;
|
|
855
1050
|
break;
|
|
856
1051
|
}
|
|
@@ -872,8 +1067,8 @@ const relocateSlotContent = (elm) => {
|
|
|
872
1067
|
let relocateNodeData;
|
|
873
1068
|
let j;
|
|
874
1069
|
let i = 0;
|
|
875
|
-
|
|
876
|
-
|
|
1070
|
+
const childNodes = elm.childNodes;
|
|
1071
|
+
const ilen = childNodes.length;
|
|
877
1072
|
for (; i < ilen; i++) {
|
|
878
1073
|
childNode = childNodes[i];
|
|
879
1074
|
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
@@ -928,13 +1123,13 @@ const relocateSlotContent = (elm) => {
|
|
|
928
1123
|
}
|
|
929
1124
|
}
|
|
930
1125
|
}
|
|
931
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1126
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
932
1127
|
relocateSlotContent(childNode);
|
|
933
1128
|
}
|
|
934
1129
|
}
|
|
935
1130
|
};
|
|
936
1131
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
937
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1132
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
938
1133
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
939
1134
|
return true;
|
|
940
1135
|
}
|
|
@@ -965,7 +1160,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
965
1160
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
966
1161
|
}
|
|
967
1162
|
rootVnode.$tag$ = null;
|
|
968
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1163
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
969
1164
|
hostRef.$vnode$ = rootVnode;
|
|
970
1165
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
971
1166
|
{
|
|
@@ -973,7 +1168,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
973
1168
|
}
|
|
974
1169
|
{
|
|
975
1170
|
contentRef = hostElm['s-cr'];
|
|
976
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1171
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
977
1172
|
// always reset
|
|
978
1173
|
checkSlotFallbackVisibility = false;
|
|
979
1174
|
}
|
|
@@ -982,7 +1177,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
982
1177
|
{
|
|
983
1178
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
984
1179
|
// the disconnectCallback from working
|
|
985
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1180
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
986
1181
|
if (checkSlotRelocate) {
|
|
987
1182
|
relocateSlotContent(rootVnode.$elm$);
|
|
988
1183
|
let relocateData;
|
|
@@ -1040,7 +1235,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1040
1235
|
}
|
|
1041
1236
|
else {
|
|
1042
1237
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
1043
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1238
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1044
1239
|
nodeToRelocate.hidden = true;
|
|
1045
1240
|
}
|
|
1046
1241
|
}
|
|
@@ -1051,37 +1246,11 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1051
1246
|
}
|
|
1052
1247
|
// done moving nodes around
|
|
1053
1248
|
// allow the disconnect callback to work again
|
|
1054
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1249
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1055
1250
|
// always reset
|
|
1056
1251
|
relocateNodes.length = 0;
|
|
1057
1252
|
}
|
|
1058
1253
|
};
|
|
1059
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1060
|
-
const createEvent = (ref, name, flags) => {
|
|
1061
|
-
const elm = getElement(ref);
|
|
1062
|
-
return {
|
|
1063
|
-
emit: (detail) => {
|
|
1064
|
-
return emitEvent(elm, name, {
|
|
1065
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1066
|
-
composed: !!(flags & 2 /* Composed */),
|
|
1067
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1068
|
-
detail,
|
|
1069
|
-
});
|
|
1070
|
-
},
|
|
1071
|
-
};
|
|
1072
|
-
};
|
|
1073
|
-
/**
|
|
1074
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
1075
|
-
* @param elm the target of the Event
|
|
1076
|
-
* @param name the name to give the custom Event
|
|
1077
|
-
* @param opts options for configuring a custom Event
|
|
1078
|
-
* @returns the custom Event
|
|
1079
|
-
*/
|
|
1080
|
-
const emitEvent = (elm, name, opts) => {
|
|
1081
|
-
const ev = plt.ce(name, opts);
|
|
1082
|
-
elm.dispatchEvent(ev);
|
|
1083
|
-
return ev;
|
|
1084
|
-
};
|
|
1085
1254
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1086
1255
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1087
1256
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -1089,10 +1258,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
1089
1258
|
};
|
|
1090
1259
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1091
1260
|
{
|
|
1092
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1261
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1093
1262
|
}
|
|
1094
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1095
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1263
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1264
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1096
1265
|
return;
|
|
1097
1266
|
}
|
|
1098
1267
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -1108,7 +1277,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1108
1277
|
let promise;
|
|
1109
1278
|
if (isInitialLoad) {
|
|
1110
1279
|
{
|
|
1111
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1280
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1112
1281
|
if (hostRef.$queuedListeners$) {
|
|
1113
1282
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1114
1283
|
hostRef.$queuedListeners$ = null;
|
|
@@ -1151,7 +1320,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1151
1320
|
}
|
|
1152
1321
|
else {
|
|
1153
1322
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1154
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1323
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1155
1324
|
childrenPromises.length = 0;
|
|
1156
1325
|
}
|
|
1157
1326
|
}
|
|
@@ -1161,10 +1330,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1161
1330
|
renderingRef = instance;
|
|
1162
1331
|
instance = instance.render() ;
|
|
1163
1332
|
{
|
|
1164
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1333
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1165
1334
|
}
|
|
1166
1335
|
{
|
|
1167
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1336
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1168
1337
|
}
|
|
1169
1338
|
{
|
|
1170
1339
|
{
|
|
@@ -1193,8 +1362,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1193
1362
|
{
|
|
1194
1363
|
safeCall(instance, 'componentDidRender');
|
|
1195
1364
|
}
|
|
1196
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1197
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1365
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1366
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1198
1367
|
{
|
|
1199
1368
|
// DOM WRITE!
|
|
1200
1369
|
addHydratedFlag(elm);
|
|
@@ -1226,10 +1395,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1226
1395
|
hostRef.$onRenderResolve$();
|
|
1227
1396
|
hostRef.$onRenderResolve$ = undefined;
|
|
1228
1397
|
}
|
|
1229
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1398
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1230
1399
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1231
1400
|
}
|
|
1232
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1401
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1233
1402
|
}
|
|
1234
1403
|
// ( •_•)
|
|
1235
1404
|
// ( •_•)>⌐■-■
|
|
@@ -1240,7 +1409,7 @@ const forceUpdate = (ref) => {
|
|
|
1240
1409
|
const hostRef = getHostRef(ref);
|
|
1241
1410
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1242
1411
|
if (isConnected &&
|
|
1243
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1412
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1244
1413
|
scheduleUpdate(hostRef, false);
|
|
1245
1414
|
}
|
|
1246
1415
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1271,235 +1440,6 @@ const then = (promise, thenFn) => {
|
|
|
1271
1440
|
};
|
|
1272
1441
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1273
1442
|
;
|
|
1274
|
-
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1275
|
-
const endHydrate = createTime('hydrateClient', tagName);
|
|
1276
|
-
const shadowRoot = hostElm.shadowRoot;
|
|
1277
|
-
const childRenderNodes = [];
|
|
1278
|
-
const slotNodes = [];
|
|
1279
|
-
const shadowRootNodes = shadowRoot ? [] : null;
|
|
1280
|
-
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
1281
|
-
if (!plt.$orgLocNodes$) {
|
|
1282
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
1283
|
-
}
|
|
1284
|
-
hostElm[HYDRATE_ID] = hostId;
|
|
1285
|
-
hostElm.removeAttribute(HYDRATE_ID);
|
|
1286
|
-
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
1287
|
-
childRenderNodes.map((c) => {
|
|
1288
|
-
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
1289
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
1290
|
-
const node = c.$elm$;
|
|
1291
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
1292
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
1293
|
-
}
|
|
1294
|
-
if (!shadowRoot) {
|
|
1295
|
-
node['s-hn'] = tagName;
|
|
1296
|
-
if (orgLocationNode) {
|
|
1297
|
-
node['s-ol'] = orgLocationNode;
|
|
1298
|
-
node['s-ol']['s-nr'] = node;
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1302
|
-
});
|
|
1303
|
-
if (shadowRoot) {
|
|
1304
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
1305
|
-
if (shadowRootNode) {
|
|
1306
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
1307
|
-
}
|
|
1308
|
-
});
|
|
1309
|
-
}
|
|
1310
|
-
endHydrate();
|
|
1311
|
-
};
|
|
1312
|
-
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
1313
|
-
let childNodeType;
|
|
1314
|
-
let childIdSplt;
|
|
1315
|
-
let childVNode;
|
|
1316
|
-
let i;
|
|
1317
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
1318
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
1319
|
-
if (childNodeType) {
|
|
1320
|
-
// got the node data from the element's attribute
|
|
1321
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
1322
|
-
childIdSplt = childNodeType.split('.');
|
|
1323
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
1324
|
-
childVNode = {
|
|
1325
|
-
$flags$: 0,
|
|
1326
|
-
$hostId$: childIdSplt[0],
|
|
1327
|
-
$nodeId$: childIdSplt[1],
|
|
1328
|
-
$depth$: childIdSplt[2],
|
|
1329
|
-
$index$: childIdSplt[3],
|
|
1330
|
-
$tag$: node.tagName.toLowerCase(),
|
|
1331
|
-
$elm$: node,
|
|
1332
|
-
$attrs$: null,
|
|
1333
|
-
$children$: null,
|
|
1334
|
-
$key$: null,
|
|
1335
|
-
$name$: null,
|
|
1336
|
-
$text$: null,
|
|
1337
|
-
};
|
|
1338
|
-
childRenderNodes.push(childVNode);
|
|
1339
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
1340
|
-
// this is a new child vnode
|
|
1341
|
-
// so ensure its parent vnode has the vchildren array
|
|
1342
|
-
if (!parentVNode.$children$) {
|
|
1343
|
-
parentVNode.$children$ = [];
|
|
1344
|
-
}
|
|
1345
|
-
// add our child vnode to a specific index of the vnode's children
|
|
1346
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1347
|
-
// this is now the new parent vnode for all the next child checks
|
|
1348
|
-
parentVNode = childVNode;
|
|
1349
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1350
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
// recursively drill down, end to start so we can remove nodes
|
|
1355
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
1356
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
1357
|
-
}
|
|
1358
|
-
if (node.shadowRoot) {
|
|
1359
|
-
// keep drilling down through the shadow root nodes
|
|
1360
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
1361
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
else if (node.nodeType === 8 /* CommentNode */) {
|
|
1366
|
-
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
1367
|
-
childIdSplt = node.nodeValue.split('.');
|
|
1368
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
1369
|
-
// comment node for either the host id or a 0 host id
|
|
1370
|
-
childNodeType = childIdSplt[0];
|
|
1371
|
-
childVNode = {
|
|
1372
|
-
$flags$: 0,
|
|
1373
|
-
$hostId$: childIdSplt[1],
|
|
1374
|
-
$nodeId$: childIdSplt[2],
|
|
1375
|
-
$depth$: childIdSplt[3],
|
|
1376
|
-
$index$: childIdSplt[4],
|
|
1377
|
-
$elm$: node,
|
|
1378
|
-
$attrs$: null,
|
|
1379
|
-
$children$: null,
|
|
1380
|
-
$key$: null,
|
|
1381
|
-
$name$: null,
|
|
1382
|
-
$tag$: null,
|
|
1383
|
-
$text$: null,
|
|
1384
|
-
};
|
|
1385
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
1386
|
-
childVNode.$elm$ = node.nextSibling;
|
|
1387
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1388
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1389
|
-
childRenderNodes.push(childVNode);
|
|
1390
|
-
// remove the text comment since it's no longer needed
|
|
1391
|
-
node.remove();
|
|
1392
|
-
if (!parentVNode.$children$) {
|
|
1393
|
-
parentVNode.$children$ = [];
|
|
1394
|
-
}
|
|
1395
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1396
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1397
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
else if (childVNode.$hostId$ === hostId) {
|
|
1402
|
-
// this comment node is specifcally for this host id
|
|
1403
|
-
if (childNodeType === SLOT_NODE_ID) {
|
|
1404
|
-
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
1405
|
-
childVNode.$tag$ = 'slot';
|
|
1406
|
-
if (childIdSplt[5]) {
|
|
1407
|
-
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
1408
|
-
}
|
|
1409
|
-
else {
|
|
1410
|
-
node['s-sn'] = '';
|
|
1411
|
-
}
|
|
1412
|
-
node['s-sr'] = true;
|
|
1413
|
-
if (shadowRootNodes) {
|
|
1414
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
1415
|
-
// create an actual slot element
|
|
1416
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
1417
|
-
if (childVNode.$name$) {
|
|
1418
|
-
// add the slot name attribute
|
|
1419
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
1420
|
-
}
|
|
1421
|
-
// insert the new slot element before the slot comment
|
|
1422
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
1423
|
-
// remove the slot comment since it's not needed for shadow
|
|
1424
|
-
node.remove();
|
|
1425
|
-
if (childVNode.$depth$ === '0') {
|
|
1426
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
slotNodes.push(childVNode);
|
|
1430
|
-
if (!parentVNode.$children$) {
|
|
1431
|
-
parentVNode.$children$ = [];
|
|
1432
|
-
}
|
|
1433
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1434
|
-
}
|
|
1435
|
-
else if (childNodeType === CONTENT_REF_ID) {
|
|
1436
|
-
// `${CONTENT_REF_ID}.${hostId}`;
|
|
1437
|
-
if (shadowRootNodes) {
|
|
1438
|
-
// remove the content ref comment since it's not needed for shadow
|
|
1439
|
-
node.remove();
|
|
1440
|
-
}
|
|
1441
|
-
else {
|
|
1442
|
-
hostElm['s-cr'] = node;
|
|
1443
|
-
node['s-cn'] = true;
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
1450
|
-
const vnode = newVNode(null, node.textContent);
|
|
1451
|
-
vnode.$elm$ = node;
|
|
1452
|
-
vnode.$index$ = '0';
|
|
1453
|
-
parentVNode.$children$ = [vnode];
|
|
1454
|
-
}
|
|
1455
|
-
};
|
|
1456
|
-
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
1457
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
1458
|
-
let i = 0;
|
|
1459
|
-
for (; i < node.childNodes.length; i++) {
|
|
1460
|
-
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
1461
|
-
}
|
|
1462
|
-
if (node.shadowRoot) {
|
|
1463
|
-
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
1464
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
else if (node.nodeType === 8 /* CommentNode */) {
|
|
1469
|
-
const childIdSplt = node.nodeValue.split('.');
|
|
1470
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
1471
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
1472
|
-
node.nodeValue = '';
|
|
1473
|
-
// useful to know if the original location is
|
|
1474
|
-
// the root light-dom of a shadow dom component
|
|
1475
|
-
node['s-en'] = childIdSplt[3];
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
};
|
|
1479
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1480
|
-
// ensure this value is of the correct prop type
|
|
1481
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1482
|
-
if (propType & 4 /* Boolean */) {
|
|
1483
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1484
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1485
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1486
|
-
}
|
|
1487
|
-
if (propType & 2 /* Number */) {
|
|
1488
|
-
// force it to be a number
|
|
1489
|
-
return parseFloat(propValue);
|
|
1490
|
-
}
|
|
1491
|
-
if (propType & 1 /* String */) {
|
|
1492
|
-
// could have been passed as a number or boolean
|
|
1493
|
-
// but we still want it as a string
|
|
1494
|
-
return String(propValue);
|
|
1495
|
-
}
|
|
1496
|
-
// redundant return here for better minification
|
|
1497
|
-
return propValue;
|
|
1498
|
-
}
|
|
1499
|
-
// not sure exactly what type we want
|
|
1500
|
-
// so no need to change to a different type
|
|
1501
|
-
return propValue;
|
|
1502
|
-
};
|
|
1503
1443
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1504
1444
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1505
1445
|
// check our new property value against our internal value
|
|
@@ -1509,13 +1449,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1509
1449
|
const flags = hostRef.$flags$;
|
|
1510
1450
|
const instance = hostRef.$lazyInstance$ ;
|
|
1511
1451
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1512
|
-
|
|
1452
|
+
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1453
|
+
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1454
|
+
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1455
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1513
1456
|
// gadzooks! the property's value has changed!!
|
|
1514
1457
|
// set our new value!
|
|
1515
1458
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1516
1459
|
if (instance) {
|
|
1517
1460
|
// get an array of method names of watch functions to call
|
|
1518
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1461
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1519
1462
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1520
1463
|
if (watchMethods) {
|
|
1521
1464
|
// this instance is watching for when this property changed
|
|
@@ -1530,7 +1473,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1530
1473
|
});
|
|
1531
1474
|
}
|
|
1532
1475
|
}
|
|
1533
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1476
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1534
1477
|
// looks like this value actually changed, so we've got work to do!
|
|
1535
1478
|
// but only if we've already rendered, otherwise just chill out
|
|
1536
1479
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1540,6 +1483,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1540
1483
|
}
|
|
1541
1484
|
}
|
|
1542
1485
|
};
|
|
1486
|
+
/**
|
|
1487
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1488
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1489
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1490
|
+
*
|
|
1491
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1492
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1493
|
+
* @param flags a number used to store a series of bit flags
|
|
1494
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1495
|
+
*/
|
|
1543
1496
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1544
1497
|
if (cmpMeta.$members$) {
|
|
1545
1498
|
if (Cstr.watchers) {
|
|
@@ -1549,8 +1502,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1549
1502
|
const members = Object.entries(cmpMeta.$members$);
|
|
1550
1503
|
const prototype = Cstr.prototype;
|
|
1551
1504
|
members.map(([memberName, [memberFlags]]) => {
|
|
1552
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1553
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1505
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1506
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1554
1507
|
// proxyComponent - prop
|
|
1555
1508
|
Object.defineProperty(prototype, memberName, {
|
|
1556
1509
|
get() {
|
|
@@ -1565,8 +1518,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1565
1518
|
enumerable: true,
|
|
1566
1519
|
});
|
|
1567
1520
|
}
|
|
1568
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1569
|
-
memberFlags & 64 /* Method */) {
|
|
1521
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1522
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1570
1523
|
// proxyComponent - method
|
|
1571
1524
|
Object.defineProperty(prototype, memberName, {
|
|
1572
1525
|
value(...args) {
|
|
@@ -1576,7 +1529,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1576
1529
|
});
|
|
1577
1530
|
}
|
|
1578
1531
|
});
|
|
1579
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1532
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1580
1533
|
const attrNameToPropName = new Map();
|
|
1581
1534
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1582
1535
|
plt.jmp(() => {
|
|
@@ -1632,11 +1585,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1632
1585
|
// create an array of attributes to observe
|
|
1633
1586
|
// and also create a map of html attribute name to js property name
|
|
1634
1587
|
Cstr.observedAttributes = members
|
|
1635
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1588
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1636
1589
|
.map(([propName, m]) => {
|
|
1637
1590
|
const attrName = m[1] || propName;
|
|
1638
1591
|
attrNameToPropName.set(attrName, propName);
|
|
1639
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1592
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1640
1593
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1641
1594
|
}
|
|
1642
1595
|
return attrName;
|
|
@@ -1647,10 +1600,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1647
1600
|
};
|
|
1648
1601
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1649
1602
|
// initializeComponent
|
|
1650
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1603
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1651
1604
|
{
|
|
1652
1605
|
// we haven't initialized this element yet
|
|
1653
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1606
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1654
1607
|
// lazy loaded components
|
|
1655
1608
|
// request the component's implementation to be
|
|
1656
1609
|
// wired up with the host element
|
|
@@ -1668,7 +1621,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1668
1621
|
{
|
|
1669
1622
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1670
1623
|
}
|
|
1671
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1624
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1672
1625
|
Cstr.isProxied = true;
|
|
1673
1626
|
}
|
|
1674
1627
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1676,7 +1629,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1676
1629
|
// but let's keep track of when we start and stop
|
|
1677
1630
|
// so that the getters/setters don't incorrectly step on data
|
|
1678
1631
|
{
|
|
1679
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1632
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1680
1633
|
}
|
|
1681
1634
|
// construct the lazy-loaded component implementation
|
|
1682
1635
|
// passing the hostRef is very important during
|
|
@@ -1689,10 +1642,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1689
1642
|
consoleError(e);
|
|
1690
1643
|
}
|
|
1691
1644
|
{
|
|
1692
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1645
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1693
1646
|
}
|
|
1694
1647
|
{
|
|
1695
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1648
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1696
1649
|
}
|
|
1697
1650
|
endNewInstance();
|
|
1698
1651
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1703,7 +1656,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1703
1656
|
const scopeId = getScopeId(cmpMeta);
|
|
1704
1657
|
if (!styles.has(scopeId)) {
|
|
1705
1658
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1706
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1659
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1707
1660
|
endRegisterStyles();
|
|
1708
1661
|
}
|
|
1709
1662
|
}
|
|
@@ -1730,30 +1683,19 @@ const fireConnectedCallback = (instance) => {
|
|
|
1730
1683
|
}
|
|
1731
1684
|
};
|
|
1732
1685
|
const connectedCallback = (elm) => {
|
|
1733
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1686
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1734
1687
|
const hostRef = getHostRef(elm);
|
|
1735
1688
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1736
1689
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1737
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1690
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1738
1691
|
// first time this component has connected
|
|
1739
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1740
|
-
let hostId;
|
|
1692
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1741
1693
|
{
|
|
1742
|
-
hostId = elm.getAttribute(HYDRATE_ID);
|
|
1743
|
-
if (hostId) {
|
|
1744
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1745
|
-
const scopeId = addStyle(elm.shadowRoot, cmpMeta);
|
|
1746
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
1747
|
-
}
|
|
1748
|
-
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
if (!hostId) {
|
|
1752
1694
|
// initUpdate
|
|
1753
1695
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1754
1696
|
// in here to act as original content anchors as we move nodes around
|
|
1755
1697
|
// host element has been connected to the DOM
|
|
1756
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1698
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1757
1699
|
setContentReference(elm);
|
|
1758
1700
|
}
|
|
1759
1701
|
}
|
|
@@ -1764,10 +1706,7 @@ const connectedCallback = (elm) => {
|
|
|
1764
1706
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1765
1707
|
// climb up the ancestors looking for the first
|
|
1766
1708
|
// component that hasn't finished its lifecycle update yet
|
|
1767
|
-
if (
|
|
1768
|
-
ancestorComponent.hasAttribute('s-id') &&
|
|
1769
|
-
ancestorComponent['s-p']) ||
|
|
1770
|
-
ancestorComponent['s-p']) {
|
|
1709
|
+
if (ancestorComponent['s-p']) {
|
|
1771
1710
|
// we found this components first ancestor component
|
|
1772
1711
|
// keep a reference to this component's ancestor component
|
|
1773
1712
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1779,7 +1718,7 @@ const connectedCallback = (elm) => {
|
|
|
1779
1718
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1780
1719
|
if (cmpMeta.$members$) {
|
|
1781
1720
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1782
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1721
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1783
1722
|
const value = elm[memberName];
|
|
1784
1723
|
delete elm[memberName];
|
|
1785
1724
|
elm[memberName] = value;
|
|
@@ -1813,7 +1752,7 @@ const setContentReference = (elm) => {
|
|
|
1813
1752
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1814
1753
|
};
|
|
1815
1754
|
const disconnectedCallback = (elm) => {
|
|
1816
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1755
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1817
1756
|
const hostRef = getHostRef(elm);
|
|
1818
1757
|
const instance = hostRef.$lazyInstance$ ;
|
|
1819
1758
|
{
|
|
@@ -1836,22 +1775,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1836
1775
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
1837
1776
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
1838
1777
|
const deferredConnectedCallbacks = [];
|
|
1839
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
1840
1778
|
let appLoadFallback;
|
|
1841
1779
|
let isBootstrapping = true;
|
|
1842
|
-
let i = 0;
|
|
1843
1780
|
Object.assign(plt, options);
|
|
1844
1781
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1845
|
-
{
|
|
1846
|
-
// If the app is already hydrated there is not point to disable the
|
|
1847
|
-
// async queue. This will improve the first input delay
|
|
1848
|
-
plt.$flags$ |= 2 /* appLoaded */;
|
|
1849
|
-
}
|
|
1850
|
-
{
|
|
1851
|
-
for (; i < styles.length; i++) {
|
|
1852
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
1782
|
lazyBundles.map((lazyBundle) => {
|
|
1856
1783
|
lazyBundle[1].map((compactMeta) => {
|
|
1857
1784
|
const cmpMeta = {
|
|
@@ -1880,7 +1807,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1880
1807
|
super(self);
|
|
1881
1808
|
self = this;
|
|
1882
1809
|
registerHost(self, cmpMeta);
|
|
1883
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1810
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1884
1811
|
// this component is using shadow dom
|
|
1885
1812
|
// and this browser supports shadow dom
|
|
1886
1813
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1915,7 +1842,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1915
1842
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1916
1843
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1917
1844
|
cmpTags.push(tagName);
|
|
1918
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1845
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1919
1846
|
}
|
|
1920
1847
|
});
|
|
1921
1848
|
});
|
|
@@ -1938,7 +1865,43 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1938
1865
|
endBootstrap();
|
|
1939
1866
|
};
|
|
1940
1867
|
const Fragment = (_, children) => children;
|
|
1941
|
-
const
|
|
1868
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1869
|
+
if (listeners) {
|
|
1870
|
+
listeners.map(([flags, name, method]) => {
|
|
1871
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1872
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1873
|
+
const opts = hostListenerOpts(flags);
|
|
1874
|
+
plt.ael(target, name, handler, opts);
|
|
1875
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
};
|
|
1879
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1880
|
+
try {
|
|
1881
|
+
{
|
|
1882
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1883
|
+
// instance is ready, let's call it's member method for this event
|
|
1884
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1885
|
+
}
|
|
1886
|
+
else {
|
|
1887
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
catch (e) {
|
|
1892
|
+
consoleError(e);
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1896
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
1897
|
+
return doc;
|
|
1898
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
1899
|
+
return win;
|
|
1900
|
+
return elm;
|
|
1901
|
+
};
|
|
1902
|
+
// prettier-ignore
|
|
1903
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1904
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1942
1905
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1943
1906
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1944
1907
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1970,7 +1933,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1970
1933
|
if (module) {
|
|
1971
1934
|
return module[exportName];
|
|
1972
1935
|
}
|
|
1936
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1973
1937
|
return import(
|
|
1938
|
+
/* @vite-ignore */
|
|
1974
1939
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1975
1940
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1976
1941
|
/* webpackMode: "lazy" */
|
|
@@ -1981,14 +1946,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1981
1946
|
return importedModule[exportName];
|
|
1982
1947
|
}, consoleError);
|
|
1983
1948
|
};
|
|
1984
|
-
const styles = new Map();
|
|
1949
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1950
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1951
|
+
const doc = win.document || { head: {} };
|
|
1952
|
+
const plt = {
|
|
1953
|
+
$flags$: 0,
|
|
1954
|
+
$resourcesUrl$: '',
|
|
1955
|
+
jmp: (h) => h(),
|
|
1956
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1957
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1958
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1959
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1960
|
+
};
|
|
1961
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1962
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1963
|
+
try {
|
|
1964
|
+
new CSSStyleSheet();
|
|
1965
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1966
|
+
}
|
|
1967
|
+
catch (e) { }
|
|
1968
|
+
return false;
|
|
1969
|
+
})()
|
|
1970
|
+
;
|
|
1985
1971
|
const queueDomReads = [];
|
|
1986
1972
|
const queueDomWrites = [];
|
|
1987
1973
|
const queueTask = (queue, write) => (cb) => {
|
|
1988
1974
|
queue.push(cb);
|
|
1989
1975
|
if (!queuePending) {
|
|
1990
1976
|
queuePending = true;
|
|
1991
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1977
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1992
1978
|
nextTick(flush);
|
|
1993
1979
|
}
|
|
1994
1980
|
else {
|