@dso-toolkit/core 45.2.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 +10 -8
- 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 +88 -128
- package/dist/cjs/dso-dropdown-menu.cjs.entry.js +9 -21
- package/dist/cjs/dso-header.cjs.entry.js +23 -29
- package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +22 -21
- package/dist/cjs/dso-highlight-box.cjs.entry.js +16 -11
- 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 +110 -146
- package/dist/cjs/dso-pagination.cjs.entry.js +22 -28
- package/dist/cjs/dso-progress-bar.cjs.entry.js +3 -2
- 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 +17 -17
- 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 +3 -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.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.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.js +210 -246
- package/dist/collection/components/helpcenter-panel/helpcenter-panel.js +94 -90
- 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 +12 -17
- 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 -20
- package/dist/collection/components/ozon-content/nodes/text.node.js +2 -2
- package/dist/collection/components/ozon-content/ozon-content-mapper.js +27 -25
- 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 +118 -125
- 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 +48 -61
- package/dist/collection/components/table/table.js +70 -81
- 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 -4
- 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 +6 -0
- package/dist/custom-elements/index.js +1200 -1335
- 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 +10 -8
- 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 +88 -128
- package/dist/esm/dso-dropdown-menu.entry.js +9 -21
- package/dist/esm/dso-header.entry.js +23 -29
- package/dist/esm/dso-helpcenter-panel.entry.js +22 -21
- package/dist/esm/dso-highlight-box.entry.js +16 -11
- 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 +110 -146
- package/dist/esm/dso-pagination.entry.js +22 -28
- package/dist/esm/dso-progress-bar.entry.js +3 -2
- 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 +17 -17
- 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 +2 -2
- 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 +2 -2
- 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 +152 -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/table/table.template.js +0 -26
- 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-1a19ce42.entry.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-383227b9.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-662b7663.entry.js +0 -1
- package/dist/dso-toolkit/p-67b11174.entry.js +0 -1
- package/dist/dso-toolkit/p-6a414479.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-83de460b.entry.js +0 -1
- package/dist/dso-toolkit/p-9aaadf4f.entry.js +0 -1
- package/dist/dso-toolkit/p-a5a5b24b.entry.js +0 -1
- package/dist/dso-toolkit/p-a9b0a83e.entry.js +0 -1
- package/dist/dso-toolkit/p-ac0c0eee.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-d2255268.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-ea1d4c81.entry.js +0 -1
- package/dist/dso-toolkit/p-eb326df8.entry.js +0 -1
- package/dist/dso-toolkit/p-ec3b8800.entry.js +0 -1
- package/dist/dso-toolkit/p-f1b5baf9.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/table/table.template.d.ts +0 -2
- 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
|
@@ -22,6 +22,14 @@ function _interopNamespace(e) {
|
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'dso-toolkit';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
27
|
+
* Simon Friis Vindum (@paldepind)
|
|
28
|
+
* Licensed under the MIT License
|
|
29
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
30
|
+
*
|
|
31
|
+
* Modified for Stencil's renderer and slot projection
|
|
32
|
+
*/
|
|
25
33
|
let scopeId;
|
|
26
34
|
let contentRef;
|
|
27
35
|
let hostTagName;
|
|
@@ -31,73 +39,6 @@ let checkSlotRelocate = false;
|
|
|
31
39
|
let isSvgMode = false;
|
|
32
40
|
let renderingRef = null;
|
|
33
41
|
let queuePending = false;
|
|
34
|
-
const win = typeof window !== 'undefined' ? window : {};
|
|
35
|
-
const doc = win.document || { head: {} };
|
|
36
|
-
const plt = {
|
|
37
|
-
$flags$: 0,
|
|
38
|
-
$resourcesUrl$: '',
|
|
39
|
-
jmp: (h) => h(),
|
|
40
|
-
raf: (h) => requestAnimationFrame(h),
|
|
41
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
42
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
43
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
44
|
-
};
|
|
45
|
-
const supportsShadow = true;
|
|
46
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
47
|
-
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
48
|
-
try {
|
|
49
|
-
new CSSStyleSheet();
|
|
50
|
-
return typeof new CSSStyleSheet().replace === 'function';
|
|
51
|
-
}
|
|
52
|
-
catch (e) { }
|
|
53
|
-
return false;
|
|
54
|
-
})()
|
|
55
|
-
;
|
|
56
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
57
|
-
if (listeners) {
|
|
58
|
-
listeners.map(([flags, name, method]) => {
|
|
59
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
60
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
61
|
-
const opts = hostListenerOpts(flags);
|
|
62
|
-
plt.ael(target, name, handler, opts);
|
|
63
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
68
|
-
try {
|
|
69
|
-
{
|
|
70
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
71
|
-
// instance is ready, let's call it's member method for this event
|
|
72
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
consoleError(e);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
84
|
-
if (flags & 4 /* TargetDocument */)
|
|
85
|
-
return doc;
|
|
86
|
-
if (flags & 8 /* TargetWindow */)
|
|
87
|
-
return win;
|
|
88
|
-
return elm;
|
|
89
|
-
};
|
|
90
|
-
// prettier-ignore
|
|
91
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
92
|
-
const CONTENT_REF_ID = 'r';
|
|
93
|
-
const ORG_LOCATION_ID = 'o';
|
|
94
|
-
const SLOT_NODE_ID = 's';
|
|
95
|
-
const TEXT_NODE_ID = 't';
|
|
96
|
-
const HYDRATE_ID = 's-id';
|
|
97
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
98
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
99
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
100
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
101
42
|
const createTime = (fnName, tagName = '') => {
|
|
102
43
|
{
|
|
103
44
|
return () => {
|
|
@@ -112,80 +53,8 @@ const uniqueTime = (key, measureText) => {
|
|
|
112
53
|
};
|
|
113
54
|
}
|
|
114
55
|
};
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
let style = styles.get(scopeId);
|
|
118
|
-
if (supportsConstructibleStylesheets && allowCS) {
|
|
119
|
-
style = (style || new CSSStyleSheet());
|
|
120
|
-
style.replace(cssText);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
style = cssText;
|
|
124
|
-
}
|
|
125
|
-
styles.set(scopeId, style);
|
|
126
|
-
};
|
|
127
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
128
|
-
let scopeId = getScopeId(cmpMeta);
|
|
129
|
-
let style = styles.get(scopeId);
|
|
130
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
131
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
132
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
133
|
-
if (style) {
|
|
134
|
-
if (typeof style === 'string') {
|
|
135
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
136
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
137
|
-
let styleElm;
|
|
138
|
-
if (!appliedStyles) {
|
|
139
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
140
|
-
}
|
|
141
|
-
if (!appliedStyles.has(scopeId)) {
|
|
142
|
-
if (styleContainerNode.host &&
|
|
143
|
-
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
144
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
145
|
-
styleElm.innerHTML = style;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
{
|
|
149
|
-
styleElm = doc.createElement('style');
|
|
150
|
-
styleElm.innerHTML = style;
|
|
151
|
-
}
|
|
152
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
153
|
-
}
|
|
154
|
-
if (appliedStyles) {
|
|
155
|
-
appliedStyles.add(scopeId);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
160
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return scopeId;
|
|
164
|
-
};
|
|
165
|
-
const attachStyles = (hostRef) => {
|
|
166
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
167
|
-
const elm = hostRef.$hostElement$;
|
|
168
|
-
const flags = cmpMeta.$flags$;
|
|
169
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
170
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
171
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
172
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
173
|
-
// or this browser doesn't support native shadow dom
|
|
174
|
-
// and this host element was NOT created with SSR
|
|
175
|
-
// let's pick out the inner content for slot projection
|
|
176
|
-
// create a node to represent where the original
|
|
177
|
-
// content was first placed, which is useful later on
|
|
178
|
-
// DOM WRITE!!
|
|
179
|
-
elm['s-sc'] = scopeId;
|
|
180
|
-
elm.classList.add(scopeId + '-h');
|
|
181
|
-
if (flags & 2 /* scopedCssEncapsulation */) {
|
|
182
|
-
elm.classList.add(scopeId + '-s');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
endAttachStyles();
|
|
186
|
-
};
|
|
187
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
188
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
56
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
57
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
189
58
|
/**
|
|
190
59
|
* Default style mode id
|
|
191
60
|
*/
|
|
@@ -222,7 +91,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
222
91
|
let slotName = null;
|
|
223
92
|
let simple = false;
|
|
224
93
|
let lastSimple = false;
|
|
225
|
-
|
|
94
|
+
const vNodeChildren = [];
|
|
226
95
|
const walk = (c) => {
|
|
227
96
|
for (let i = 0; i < c.length; i++) {
|
|
228
97
|
child = c[i];
|
|
@@ -334,6 +203,152 @@ const convertToPrivate = (node) => {
|
|
|
334
203
|
vnode.$name$ = node.vname;
|
|
335
204
|
return vnode;
|
|
336
205
|
};
|
|
206
|
+
/**
|
|
207
|
+
* Parse a new property value for a given property type.
|
|
208
|
+
*
|
|
209
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
210
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
211
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
212
|
+
* 2. the type stored from `propType`.
|
|
213
|
+
*
|
|
214
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
215
|
+
*
|
|
216
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
217
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
218
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
219
|
+
* ```tsx
|
|
220
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* HTML prop values on the other hand, will always a string
|
|
224
|
+
*
|
|
225
|
+
* @param propValue the new value to coerce to some type
|
|
226
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
227
|
+
* @returns the parsed/coerced value
|
|
228
|
+
*/
|
|
229
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
230
|
+
// ensure this value is of the correct prop type
|
|
231
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
232
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
233
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
234
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
235
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
236
|
+
}
|
|
237
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
238
|
+
// force it to be a number
|
|
239
|
+
return parseFloat(propValue);
|
|
240
|
+
}
|
|
241
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
242
|
+
// could have been passed as a number or boolean
|
|
243
|
+
// but we still want it as a string
|
|
244
|
+
return String(propValue);
|
|
245
|
+
}
|
|
246
|
+
// redundant return here for better minification
|
|
247
|
+
return propValue;
|
|
248
|
+
}
|
|
249
|
+
// not sure exactly what type we want
|
|
250
|
+
// so no need to change to a different type
|
|
251
|
+
return propValue;
|
|
252
|
+
};
|
|
253
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
254
|
+
const createEvent = (ref, name, flags) => {
|
|
255
|
+
const elm = getElement(ref);
|
|
256
|
+
return {
|
|
257
|
+
emit: (detail) => {
|
|
258
|
+
return emitEvent(elm, name, {
|
|
259
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
260
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
261
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
262
|
+
detail,
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
269
|
+
* @param elm the target of the Event
|
|
270
|
+
* @param name the name to give the custom Event
|
|
271
|
+
* @param opts options for configuring a custom Event
|
|
272
|
+
* @returns the custom Event
|
|
273
|
+
*/
|
|
274
|
+
const emitEvent = (elm, name, opts) => {
|
|
275
|
+
const ev = plt.ce(name, opts);
|
|
276
|
+
elm.dispatchEvent(ev);
|
|
277
|
+
return ev;
|
|
278
|
+
};
|
|
279
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
280
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
281
|
+
let style = styles.get(scopeId);
|
|
282
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
283
|
+
style = (style || new CSSStyleSheet());
|
|
284
|
+
if (typeof style === 'string') {
|
|
285
|
+
style = cssText;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
style.replaceSync(cssText);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
style = cssText;
|
|
293
|
+
}
|
|
294
|
+
styles.set(scopeId, style);
|
|
295
|
+
};
|
|
296
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
297
|
+
let scopeId = getScopeId(cmpMeta);
|
|
298
|
+
const style = styles.get(scopeId);
|
|
299
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
300
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
301
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
302
|
+
if (style) {
|
|
303
|
+
if (typeof style === 'string') {
|
|
304
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
305
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
306
|
+
let styleElm;
|
|
307
|
+
if (!appliedStyles) {
|
|
308
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
309
|
+
}
|
|
310
|
+
if (!appliedStyles.has(scopeId)) {
|
|
311
|
+
{
|
|
312
|
+
{
|
|
313
|
+
styleElm = doc.createElement('style');
|
|
314
|
+
styleElm.innerHTML = style;
|
|
315
|
+
}
|
|
316
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
317
|
+
}
|
|
318
|
+
if (appliedStyles) {
|
|
319
|
+
appliedStyles.add(scopeId);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
324
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return scopeId;
|
|
328
|
+
};
|
|
329
|
+
const attachStyles = (hostRef) => {
|
|
330
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
331
|
+
const elm = hostRef.$hostElement$;
|
|
332
|
+
const flags = cmpMeta.$flags$;
|
|
333
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
334
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
335
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
336
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
337
|
+
// or this browser doesn't support native shadow dom
|
|
338
|
+
// and this host element was NOT created with SSR
|
|
339
|
+
// let's pick out the inner content for slot projection
|
|
340
|
+
// create a node to represent where the original
|
|
341
|
+
// content was first placed, which is useful later on
|
|
342
|
+
// DOM WRITE!!
|
|
343
|
+
elm['s-sc'] = scopeId;
|
|
344
|
+
elm.classList.add(scopeId + '-h');
|
|
345
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
346
|
+
elm.classList.add(scopeId + '-s');
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
endAttachStyles();
|
|
350
|
+
};
|
|
351
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
337
352
|
/**
|
|
338
353
|
* Production setAccessor() function based on Preact by
|
|
339
354
|
* Jason Miller (@developit)
|
|
@@ -431,7 +446,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
431
446
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
432
447
|
try {
|
|
433
448
|
if (!elm.tagName.includes('-')) {
|
|
434
|
-
|
|
449
|
+
const n = newValue == null ? '' : newValue;
|
|
435
450
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
436
451
|
if (memberName === 'list') {
|
|
437
452
|
isProp = false;
|
|
@@ -470,7 +485,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
470
485
|
}
|
|
471
486
|
}
|
|
472
487
|
}
|
|
473
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
488
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
474
489
|
newValue = newValue === true ? '' : newValue;
|
|
475
490
|
if (xlink) {
|
|
476
491
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
@@ -488,7 +503,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
488
503
|
// if the element passed in is a shadow root, which is a document fragment
|
|
489
504
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
490
505
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
491
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
506
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
492
507
|
? newVnode.$elm$.host
|
|
493
508
|
: newVnode.$elm$;
|
|
494
509
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -506,9 +521,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
506
521
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
507
522
|
}
|
|
508
523
|
};
|
|
524
|
+
/**
|
|
525
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
526
|
+
*
|
|
527
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
528
|
+
* @param newParentVNode the parent VNode from the current render
|
|
529
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
530
|
+
* children, for which we will create a new DOM node
|
|
531
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
532
|
+
* @returns the newly created node
|
|
533
|
+
*/
|
|
509
534
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
510
535
|
// tslint:disable-next-line: prefer-const
|
|
511
|
-
|
|
536
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
|
512
537
|
let i = 0;
|
|
513
538
|
let elm;
|
|
514
539
|
let childNode;
|
|
@@ -523,16 +548,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
523
548
|
}
|
|
524
549
|
newVNode.$flags$ |= newVNode.$children$
|
|
525
550
|
? // slot element has fallback content
|
|
526
|
-
2 /* isSlotFallback */
|
|
551
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
527
552
|
: // slot element does not have fallback content
|
|
528
|
-
1 /* isSlotReference */;
|
|
553
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
529
554
|
}
|
|
530
555
|
}
|
|
531
556
|
if (newVNode.$text$ !== null) {
|
|
532
557
|
// create text node
|
|
533
558
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
534
559
|
}
|
|
535
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
560
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
536
561
|
// create a slot reference node
|
|
537
562
|
elm = newVNode.$elm$ =
|
|
538
563
|
doc.createTextNode('');
|
|
@@ -542,7 +567,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
542
567
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
543
568
|
}
|
|
544
569
|
// create element
|
|
545
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
570
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
546
571
|
? 'slot-fb'
|
|
547
572
|
: newVNode.$tag$)
|
|
548
573
|
);
|
|
@@ -582,7 +607,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
582
607
|
}
|
|
583
608
|
{
|
|
584
609
|
elm['s-hn'] = hostTagName;
|
|
585
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
610
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
586
611
|
// remember the content reference comment
|
|
587
612
|
elm['s-sr'] = true;
|
|
588
613
|
// remember the content reference comment
|
|
@@ -601,7 +626,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
601
626
|
return elm;
|
|
602
627
|
};
|
|
603
628
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
604
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
629
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
605
630
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
606
631
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
607
632
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -622,7 +647,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
622
647
|
putBackInOriginalLocation(childNode, recursive);
|
|
623
648
|
}
|
|
624
649
|
}
|
|
625
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
650
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
626
651
|
};
|
|
627
652
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
628
653
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
@@ -664,6 +689,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
664
689
|
}
|
|
665
690
|
}
|
|
666
691
|
};
|
|
692
|
+
/**
|
|
693
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
694
|
+
* traversing the two collections of children, identifying nodes that are
|
|
695
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
696
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
697
|
+
*
|
|
698
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
699
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
700
|
+
* 'windows' by storing start and end indices and references to the
|
|
701
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
702
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
703
|
+
* no children left to update by doing the following:
|
|
704
|
+
*
|
|
705
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
706
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
707
|
+
* only with a window bounded by the highlighted elements:
|
|
708
|
+
*
|
|
709
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
710
|
+
* ^^^^^^ ^^^^^^
|
|
711
|
+
*
|
|
712
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
713
|
+
* across the windows. This will basically detect elements which haven't
|
|
714
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
715
|
+
* VNode elements (represented as HTML):
|
|
716
|
+
*
|
|
717
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
718
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
719
|
+
*
|
|
720
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
721
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
722
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
723
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
724
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
725
|
+
*
|
|
726
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
727
|
+
* window corresponds to the element at the end of the other window. This is
|
|
728
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
729
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
730
|
+
* children nodes themselves have not changed but merely moved in the
|
|
731
|
+
* following example:
|
|
732
|
+
*
|
|
733
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
734
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
735
|
+
*
|
|
736
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
737
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
738
|
+
* DOM.
|
|
739
|
+
*
|
|
740
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
741
|
+
* nodes in the old children which have the same key as the first element in
|
|
742
|
+
* our window on the new children. If we find such a node we handle calling
|
|
743
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
744
|
+
* what we find.
|
|
745
|
+
*
|
|
746
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
747
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
748
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
749
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
750
|
+
* children has collapsed we still have more nodes on the new children that
|
|
751
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
752
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
753
|
+
* sure the corresponding DOM nodes are removed.
|
|
754
|
+
*
|
|
755
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
756
|
+
* @param oldCh the old children of the parent node
|
|
757
|
+
* @param newVNode the new VNode which will replace the parent
|
|
758
|
+
* @param newCh the new children of the parent node
|
|
759
|
+
*/
|
|
667
760
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
668
761
|
let oldStartIdx = 0;
|
|
669
762
|
let newStartIdx = 0;
|
|
@@ -679,7 +772,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
679
772
|
let elmToMove;
|
|
680
773
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
681
774
|
if (oldStartVnode == null) {
|
|
682
|
-
//
|
|
775
|
+
// VNode might have been moved left
|
|
683
776
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
684
777
|
}
|
|
685
778
|
else if (oldEndVnode == null) {
|
|
@@ -692,37 +785,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
692
785
|
newEndVnode = newCh[--newEndIdx];
|
|
693
786
|
}
|
|
694
787
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
788
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
789
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
790
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
791
|
+
// since things are matched up in order.
|
|
695
792
|
patch(oldStartVnode, newStartVnode);
|
|
696
793
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
697
794
|
newStartVnode = newCh[++newStartIdx];
|
|
698
795
|
}
|
|
699
796
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
797
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
798
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
799
|
+
// need to move any DOM Nodes.
|
|
700
800
|
patch(oldEndVnode, newEndVnode);
|
|
701
801
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
702
802
|
newEndVnode = newCh[--newEndIdx];
|
|
703
803
|
}
|
|
704
804
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
705
|
-
// Vnode moved right
|
|
805
|
+
// case: "Vnode moved right"
|
|
806
|
+
//
|
|
807
|
+
// We've found that the last node in our window on the new children is
|
|
808
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
809
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
810
|
+
// nodes:
|
|
811
|
+
//
|
|
812
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
813
|
+
// ^^^^^^^^^^^
|
|
814
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
815
|
+
// ^^^^^^^^^^^^^
|
|
816
|
+
//
|
|
817
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
818
|
+
// and move the DOM element for `oldStartVnode`.
|
|
706
819
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
707
820
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
708
821
|
}
|
|
709
822
|
patch(oldStartVnode, newEndVnode);
|
|
823
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
824
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
825
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
826
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
827
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
828
|
+
//
|
|
829
|
+
// <old-start-node />
|
|
830
|
+
// <some-intervening-node />
|
|
831
|
+
// <old-end-node />
|
|
832
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
833
|
+
// <next-sibling />
|
|
834
|
+
//
|
|
835
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
836
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
837
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
838
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
839
|
+
// append it to the children of the parent element.
|
|
710
840
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
711
841
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
712
842
|
newEndVnode = newCh[--newEndIdx];
|
|
713
843
|
}
|
|
714
844
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
715
|
-
// Vnode moved left
|
|
845
|
+
// case: "Vnode moved left"
|
|
846
|
+
//
|
|
847
|
+
// We've found that the first node in our window on the new children is
|
|
848
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
849
|
+
// Visually, this is the layout of these two nodes:
|
|
850
|
+
//
|
|
851
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
852
|
+
// ^^^^^^^^^^^^^
|
|
853
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
854
|
+
// ^^^^^^^^^^^
|
|
855
|
+
//
|
|
856
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
857
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
858
|
+
// children etc) but we also need to move the DOM node to which
|
|
859
|
+
// `oldEndVnode` corresponds.
|
|
716
860
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
717
861
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
718
862
|
}
|
|
719
863
|
patch(oldEndVnode, newStartVnode);
|
|
864
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
865
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
866
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
867
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
868
|
+
// future.
|
|
720
869
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
721
870
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
722
871
|
newStartVnode = newCh[++newStartIdx];
|
|
723
872
|
}
|
|
724
873
|
else {
|
|
725
|
-
//
|
|
874
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
875
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
876
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
877
|
+
// component.
|
|
878
|
+
//
|
|
879
|
+
// First we check to see if there are any nodes in the array of old
|
|
880
|
+
// children which have the same key as the first node in the new
|
|
881
|
+
// children.
|
|
726
882
|
idxInOld = -1;
|
|
727
883
|
{
|
|
728
884
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
@@ -733,23 +889,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
733
889
|
}
|
|
734
890
|
}
|
|
735
891
|
if (idxInOld >= 0) {
|
|
892
|
+
// We found a node in the old children which matches up with the first
|
|
893
|
+
// node in the new children! So let's deal with that
|
|
736
894
|
elmToMove = oldCh[idxInOld];
|
|
737
895
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
896
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
738
897
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
739
898
|
}
|
|
740
899
|
else {
|
|
741
900
|
patch(elmToMove, newStartVnode);
|
|
901
|
+
// invalidate the matching old node so that we won't try to update it
|
|
902
|
+
// again later on
|
|
742
903
|
oldCh[idxInOld] = undefined;
|
|
743
904
|
node = elmToMove.$elm$;
|
|
744
905
|
}
|
|
745
906
|
newStartVnode = newCh[++newStartIdx];
|
|
746
907
|
}
|
|
747
908
|
else {
|
|
748
|
-
//
|
|
909
|
+
// We either didn't find an element in the old children that matches
|
|
910
|
+
// the key of the first new child OR the build is not using `key`
|
|
911
|
+
// attributes at all. In either case we need to create a new element
|
|
912
|
+
// for the new node.
|
|
749
913
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
750
914
|
newStartVnode = newCh[++newStartIdx];
|
|
751
915
|
}
|
|
752
916
|
if (node) {
|
|
917
|
+
// if we created a new node then handle inserting it to the DOM
|
|
753
918
|
{
|
|
754
919
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
755
920
|
}
|
|
@@ -757,21 +922,43 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
757
922
|
}
|
|
758
923
|
}
|
|
759
924
|
if (oldStartIdx > oldEndIdx) {
|
|
925
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
760
926
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
761
927
|
}
|
|
762
928
|
else if (newStartIdx > newEndIdx) {
|
|
929
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
930
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
931
|
+
// relevant DOM nodes)
|
|
763
932
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
764
933
|
}
|
|
765
934
|
};
|
|
766
|
-
|
|
935
|
+
/**
|
|
936
|
+
* Compare two VNodes to determine if they are the same
|
|
937
|
+
*
|
|
938
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
939
|
+
* information set on the two VNodes and can be misleading under certain
|
|
940
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
941
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
942
|
+
* checking that they have the same tag.
|
|
943
|
+
*
|
|
944
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
945
|
+
* changing order within a `children` array or something along those lines then
|
|
946
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
947
|
+
*
|
|
948
|
+
* @param leftVNode the first VNode to check
|
|
949
|
+
* @param rightVNode the second VNode to check
|
|
950
|
+
* @returns whether they're equal or not
|
|
951
|
+
*/
|
|
952
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
767
953
|
// compare if two vnode to see if they're "technically" the same
|
|
768
954
|
// need to have the same element tag, and same key to be the same
|
|
769
|
-
if (
|
|
770
|
-
if (
|
|
771
|
-
return
|
|
955
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
956
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
957
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
772
958
|
}
|
|
959
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
773
960
|
{
|
|
774
|
-
return
|
|
961
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
775
962
|
}
|
|
776
963
|
}
|
|
777
964
|
return false;
|
|
@@ -784,6 +971,14 @@ const referenceNode = (node) => {
|
|
|
784
971
|
return (node && node['s-ol']) || node;
|
|
785
972
|
};
|
|
786
973
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
974
|
+
/**
|
|
975
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
976
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
977
|
+
* children of the two nodes (if any).
|
|
978
|
+
*
|
|
979
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
980
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
981
|
+
*/
|
|
787
982
|
const patch = (oldVNode, newVNode) => {
|
|
788
983
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
789
984
|
const oldChildren = oldVNode.$children$;
|
|
@@ -797,7 +992,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
797
992
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
798
993
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
799
994
|
}
|
|
800
|
-
// element node
|
|
801
995
|
{
|
|
802
996
|
if (tag === 'slot')
|
|
803
997
|
;
|
|
@@ -810,6 +1004,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
810
1004
|
}
|
|
811
1005
|
if (oldChildren !== null && newChildren !== null) {
|
|
812
1006
|
// looks like there's child vnodes for both the old and new vnodes
|
|
1007
|
+
// so we need to call `updateChildren` to reconcile them
|
|
813
1008
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
814
1009
|
}
|
|
815
1010
|
else if (newChildren !== null) {
|
|
@@ -841,7 +1036,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
841
1036
|
};
|
|
842
1037
|
const updateFallbackSlotVisibility = (elm) => {
|
|
843
1038
|
// tslint:disable-next-line: prefer-const
|
|
844
|
-
|
|
1039
|
+
const childNodes = elm.childNodes;
|
|
845
1040
|
let childNode;
|
|
846
1041
|
let i;
|
|
847
1042
|
let ilen;
|
|
@@ -850,7 +1045,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
850
1045
|
let nodeType;
|
|
851
1046
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
852
1047
|
childNode = childNodes[i];
|
|
853
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1048
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
854
1049
|
if (childNode['s-sr']) {
|
|
855
1050
|
// this is a slot fallback node
|
|
856
1051
|
// get the slot name for this slot reference node
|
|
@@ -862,7 +1057,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
862
1057
|
nodeType = childNodes[j].nodeType;
|
|
863
1058
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
864
1059
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
865
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1060
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
866
1061
|
childNode.hidden = true;
|
|
867
1062
|
break;
|
|
868
1063
|
}
|
|
@@ -871,8 +1066,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
871
1066
|
// this is a default fallback slot node
|
|
872
1067
|
// any element or text node (with content)
|
|
873
1068
|
// should hide the default fallback slot node
|
|
874
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
875
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1069
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1070
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
876
1071
|
childNode.hidden = true;
|
|
877
1072
|
break;
|
|
878
1073
|
}
|
|
@@ -894,8 +1089,8 @@ const relocateSlotContent = (elm) => {
|
|
|
894
1089
|
let relocateNodeData;
|
|
895
1090
|
let j;
|
|
896
1091
|
let i = 0;
|
|
897
|
-
|
|
898
|
-
|
|
1092
|
+
const childNodes = elm.childNodes;
|
|
1093
|
+
const ilen = childNodes.length;
|
|
899
1094
|
for (; i < ilen; i++) {
|
|
900
1095
|
childNode = childNodes[i];
|
|
901
1096
|
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
@@ -950,13 +1145,13 @@ const relocateSlotContent = (elm) => {
|
|
|
950
1145
|
}
|
|
951
1146
|
}
|
|
952
1147
|
}
|
|
953
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1148
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
954
1149
|
relocateSlotContent(childNode);
|
|
955
1150
|
}
|
|
956
1151
|
}
|
|
957
1152
|
};
|
|
958
1153
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
959
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1154
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
960
1155
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
961
1156
|
return true;
|
|
962
1157
|
}
|
|
@@ -987,7 +1182,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
987
1182
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
988
1183
|
}
|
|
989
1184
|
rootVnode.$tag$ = null;
|
|
990
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1185
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
991
1186
|
hostRef.$vnode$ = rootVnode;
|
|
992
1187
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
993
1188
|
{
|
|
@@ -995,7 +1190,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
995
1190
|
}
|
|
996
1191
|
{
|
|
997
1192
|
contentRef = hostElm['s-cr'];
|
|
998
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1193
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
999
1194
|
// always reset
|
|
1000
1195
|
checkSlotFallbackVisibility = false;
|
|
1001
1196
|
}
|
|
@@ -1004,7 +1199,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1004
1199
|
{
|
|
1005
1200
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
1006
1201
|
// the disconnectCallback from working
|
|
1007
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1202
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1008
1203
|
if (checkSlotRelocate) {
|
|
1009
1204
|
relocateSlotContent(rootVnode.$elm$);
|
|
1010
1205
|
let relocateData;
|
|
@@ -1062,7 +1257,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1062
1257
|
}
|
|
1063
1258
|
else {
|
|
1064
1259
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
1065
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1260
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1066
1261
|
nodeToRelocate.hidden = true;
|
|
1067
1262
|
}
|
|
1068
1263
|
}
|
|
@@ -1073,37 +1268,11 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1073
1268
|
}
|
|
1074
1269
|
// done moving nodes around
|
|
1075
1270
|
// allow the disconnect callback to work again
|
|
1076
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1271
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1077
1272
|
// always reset
|
|
1078
1273
|
relocateNodes.length = 0;
|
|
1079
1274
|
}
|
|
1080
1275
|
};
|
|
1081
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1082
|
-
const createEvent = (ref, name, flags) => {
|
|
1083
|
-
const elm = getElement(ref);
|
|
1084
|
-
return {
|
|
1085
|
-
emit: (detail) => {
|
|
1086
|
-
return emitEvent(elm, name, {
|
|
1087
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1088
|
-
composed: !!(flags & 2 /* Composed */),
|
|
1089
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1090
|
-
detail,
|
|
1091
|
-
});
|
|
1092
|
-
},
|
|
1093
|
-
};
|
|
1094
|
-
};
|
|
1095
|
-
/**
|
|
1096
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
1097
|
-
* @param elm the target of the Event
|
|
1098
|
-
* @param name the name to give the custom Event
|
|
1099
|
-
* @param opts options for configuring a custom Event
|
|
1100
|
-
* @returns the custom Event
|
|
1101
|
-
*/
|
|
1102
|
-
const emitEvent = (elm, name, opts) => {
|
|
1103
|
-
const ev = plt.ce(name, opts);
|
|
1104
|
-
elm.dispatchEvent(ev);
|
|
1105
|
-
return ev;
|
|
1106
|
-
};
|
|
1107
1276
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1108
1277
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1109
1278
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -1111,10 +1280,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
1111
1280
|
};
|
|
1112
1281
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1113
1282
|
{
|
|
1114
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1283
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1115
1284
|
}
|
|
1116
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1117
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1285
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1286
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1118
1287
|
return;
|
|
1119
1288
|
}
|
|
1120
1289
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -1130,7 +1299,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1130
1299
|
let promise;
|
|
1131
1300
|
if (isInitialLoad) {
|
|
1132
1301
|
{
|
|
1133
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1302
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1134
1303
|
if (hostRef.$queuedListeners$) {
|
|
1135
1304
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1136
1305
|
hostRef.$queuedListeners$ = null;
|
|
@@ -1173,7 +1342,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1173
1342
|
}
|
|
1174
1343
|
else {
|
|
1175
1344
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1176
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1345
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1177
1346
|
childrenPromises.length = 0;
|
|
1178
1347
|
}
|
|
1179
1348
|
}
|
|
@@ -1183,10 +1352,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1183
1352
|
renderingRef = instance;
|
|
1184
1353
|
instance = instance.render() ;
|
|
1185
1354
|
{
|
|
1186
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1355
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1187
1356
|
}
|
|
1188
1357
|
{
|
|
1189
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1358
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1190
1359
|
}
|
|
1191
1360
|
{
|
|
1192
1361
|
{
|
|
@@ -1215,8 +1384,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1215
1384
|
{
|
|
1216
1385
|
safeCall(instance, 'componentDidRender');
|
|
1217
1386
|
}
|
|
1218
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1219
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1387
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1388
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1220
1389
|
{
|
|
1221
1390
|
// DOM WRITE!
|
|
1222
1391
|
addHydratedFlag(elm);
|
|
@@ -1248,10 +1417,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1248
1417
|
hostRef.$onRenderResolve$();
|
|
1249
1418
|
hostRef.$onRenderResolve$ = undefined;
|
|
1250
1419
|
}
|
|
1251
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1420
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1252
1421
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1253
1422
|
}
|
|
1254
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1423
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1255
1424
|
}
|
|
1256
1425
|
// ( •_•)
|
|
1257
1426
|
// ( •_•)>⌐■-■
|
|
@@ -1262,7 +1431,7 @@ const forceUpdate = (ref) => {
|
|
|
1262
1431
|
const hostRef = getHostRef(ref);
|
|
1263
1432
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1264
1433
|
if (isConnected &&
|
|
1265
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1434
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1266
1435
|
scheduleUpdate(hostRef, false);
|
|
1267
1436
|
}
|
|
1268
1437
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1293,235 +1462,6 @@ const then = (promise, thenFn) => {
|
|
|
1293
1462
|
};
|
|
1294
1463
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1295
1464
|
;
|
|
1296
|
-
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1297
|
-
const endHydrate = createTime('hydrateClient', tagName);
|
|
1298
|
-
const shadowRoot = hostElm.shadowRoot;
|
|
1299
|
-
const childRenderNodes = [];
|
|
1300
|
-
const slotNodes = [];
|
|
1301
|
-
const shadowRootNodes = shadowRoot ? [] : null;
|
|
1302
|
-
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
1303
|
-
if (!plt.$orgLocNodes$) {
|
|
1304
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
1305
|
-
}
|
|
1306
|
-
hostElm[HYDRATE_ID] = hostId;
|
|
1307
|
-
hostElm.removeAttribute(HYDRATE_ID);
|
|
1308
|
-
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
1309
|
-
childRenderNodes.map((c) => {
|
|
1310
|
-
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
1311
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
1312
|
-
const node = c.$elm$;
|
|
1313
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
1314
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
1315
|
-
}
|
|
1316
|
-
if (!shadowRoot) {
|
|
1317
|
-
node['s-hn'] = tagName;
|
|
1318
|
-
if (orgLocationNode) {
|
|
1319
|
-
node['s-ol'] = orgLocationNode;
|
|
1320
|
-
node['s-ol']['s-nr'] = node;
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1324
|
-
});
|
|
1325
|
-
if (shadowRoot) {
|
|
1326
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
1327
|
-
if (shadowRootNode) {
|
|
1328
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
1329
|
-
}
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
endHydrate();
|
|
1333
|
-
};
|
|
1334
|
-
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
1335
|
-
let childNodeType;
|
|
1336
|
-
let childIdSplt;
|
|
1337
|
-
let childVNode;
|
|
1338
|
-
let i;
|
|
1339
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
1340
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
1341
|
-
if (childNodeType) {
|
|
1342
|
-
// got the node data from the element's attribute
|
|
1343
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
1344
|
-
childIdSplt = childNodeType.split('.');
|
|
1345
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
1346
|
-
childVNode = {
|
|
1347
|
-
$flags$: 0,
|
|
1348
|
-
$hostId$: childIdSplt[0],
|
|
1349
|
-
$nodeId$: childIdSplt[1],
|
|
1350
|
-
$depth$: childIdSplt[2],
|
|
1351
|
-
$index$: childIdSplt[3],
|
|
1352
|
-
$tag$: node.tagName.toLowerCase(),
|
|
1353
|
-
$elm$: node,
|
|
1354
|
-
$attrs$: null,
|
|
1355
|
-
$children$: null,
|
|
1356
|
-
$key$: null,
|
|
1357
|
-
$name$: null,
|
|
1358
|
-
$text$: null,
|
|
1359
|
-
};
|
|
1360
|
-
childRenderNodes.push(childVNode);
|
|
1361
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
1362
|
-
// this is a new child vnode
|
|
1363
|
-
// so ensure its parent vnode has the vchildren array
|
|
1364
|
-
if (!parentVNode.$children$) {
|
|
1365
|
-
parentVNode.$children$ = [];
|
|
1366
|
-
}
|
|
1367
|
-
// add our child vnode to a specific index of the vnode's children
|
|
1368
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1369
|
-
// this is now the new parent vnode for all the next child checks
|
|
1370
|
-
parentVNode = childVNode;
|
|
1371
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1372
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
}
|
|
1376
|
-
// recursively drill down, end to start so we can remove nodes
|
|
1377
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
1378
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
1379
|
-
}
|
|
1380
|
-
if (node.shadowRoot) {
|
|
1381
|
-
// keep drilling down through the shadow root nodes
|
|
1382
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
1383
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
else if (node.nodeType === 8 /* CommentNode */) {
|
|
1388
|
-
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
1389
|
-
childIdSplt = node.nodeValue.split('.');
|
|
1390
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
1391
|
-
// comment node for either the host id or a 0 host id
|
|
1392
|
-
childNodeType = childIdSplt[0];
|
|
1393
|
-
childVNode = {
|
|
1394
|
-
$flags$: 0,
|
|
1395
|
-
$hostId$: childIdSplt[1],
|
|
1396
|
-
$nodeId$: childIdSplt[2],
|
|
1397
|
-
$depth$: childIdSplt[3],
|
|
1398
|
-
$index$: childIdSplt[4],
|
|
1399
|
-
$elm$: node,
|
|
1400
|
-
$attrs$: null,
|
|
1401
|
-
$children$: null,
|
|
1402
|
-
$key$: null,
|
|
1403
|
-
$name$: null,
|
|
1404
|
-
$tag$: null,
|
|
1405
|
-
$text$: null,
|
|
1406
|
-
};
|
|
1407
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
1408
|
-
childVNode.$elm$ = node.nextSibling;
|
|
1409
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1410
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1411
|
-
childRenderNodes.push(childVNode);
|
|
1412
|
-
// remove the text comment since it's no longer needed
|
|
1413
|
-
node.remove();
|
|
1414
|
-
if (!parentVNode.$children$) {
|
|
1415
|
-
parentVNode.$children$ = [];
|
|
1416
|
-
}
|
|
1417
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1418
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1419
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
else if (childVNode.$hostId$ === hostId) {
|
|
1424
|
-
// this comment node is specifcally for this host id
|
|
1425
|
-
if (childNodeType === SLOT_NODE_ID) {
|
|
1426
|
-
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
1427
|
-
childVNode.$tag$ = 'slot';
|
|
1428
|
-
if (childIdSplt[5]) {
|
|
1429
|
-
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
1430
|
-
}
|
|
1431
|
-
else {
|
|
1432
|
-
node['s-sn'] = '';
|
|
1433
|
-
}
|
|
1434
|
-
node['s-sr'] = true;
|
|
1435
|
-
if (shadowRootNodes) {
|
|
1436
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
1437
|
-
// create an actual slot element
|
|
1438
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
1439
|
-
if (childVNode.$name$) {
|
|
1440
|
-
// add the slot name attribute
|
|
1441
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
1442
|
-
}
|
|
1443
|
-
// insert the new slot element before the slot comment
|
|
1444
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
1445
|
-
// remove the slot comment since it's not needed for shadow
|
|
1446
|
-
node.remove();
|
|
1447
|
-
if (childVNode.$depth$ === '0') {
|
|
1448
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
slotNodes.push(childVNode);
|
|
1452
|
-
if (!parentVNode.$children$) {
|
|
1453
|
-
parentVNode.$children$ = [];
|
|
1454
|
-
}
|
|
1455
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1456
|
-
}
|
|
1457
|
-
else if (childNodeType === CONTENT_REF_ID) {
|
|
1458
|
-
// `${CONTENT_REF_ID}.${hostId}`;
|
|
1459
|
-
if (shadowRootNodes) {
|
|
1460
|
-
// remove the content ref comment since it's not needed for shadow
|
|
1461
|
-
node.remove();
|
|
1462
|
-
}
|
|
1463
|
-
else {
|
|
1464
|
-
hostElm['s-cr'] = node;
|
|
1465
|
-
node['s-cn'] = true;
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
1472
|
-
const vnode = newVNode(null, node.textContent);
|
|
1473
|
-
vnode.$elm$ = node;
|
|
1474
|
-
vnode.$index$ = '0';
|
|
1475
|
-
parentVNode.$children$ = [vnode];
|
|
1476
|
-
}
|
|
1477
|
-
};
|
|
1478
|
-
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
1479
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
1480
|
-
let i = 0;
|
|
1481
|
-
for (; i < node.childNodes.length; i++) {
|
|
1482
|
-
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
1483
|
-
}
|
|
1484
|
-
if (node.shadowRoot) {
|
|
1485
|
-
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
1486
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
else if (node.nodeType === 8 /* CommentNode */) {
|
|
1491
|
-
const childIdSplt = node.nodeValue.split('.');
|
|
1492
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
1493
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
1494
|
-
node.nodeValue = '';
|
|
1495
|
-
// useful to know if the original location is
|
|
1496
|
-
// the root light-dom of a shadow dom component
|
|
1497
|
-
node['s-en'] = childIdSplt[3];
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1502
|
-
// ensure this value is of the correct prop type
|
|
1503
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1504
|
-
if (propType & 4 /* Boolean */) {
|
|
1505
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1506
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1507
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1508
|
-
}
|
|
1509
|
-
if (propType & 2 /* Number */) {
|
|
1510
|
-
// force it to be a number
|
|
1511
|
-
return parseFloat(propValue);
|
|
1512
|
-
}
|
|
1513
|
-
if (propType & 1 /* String */) {
|
|
1514
|
-
// could have been passed as a number or boolean
|
|
1515
|
-
// but we still want it as a string
|
|
1516
|
-
return String(propValue);
|
|
1517
|
-
}
|
|
1518
|
-
// redundant return here for better minification
|
|
1519
|
-
return propValue;
|
|
1520
|
-
}
|
|
1521
|
-
// not sure exactly what type we want
|
|
1522
|
-
// so no need to change to a different type
|
|
1523
|
-
return propValue;
|
|
1524
|
-
};
|
|
1525
1465
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1526
1466
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1527
1467
|
// check our new property value against our internal value
|
|
@@ -1531,13 +1471,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1531
1471
|
const flags = hostRef.$flags$;
|
|
1532
1472
|
const instance = hostRef.$lazyInstance$ ;
|
|
1533
1473
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1534
|
-
|
|
1474
|
+
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1475
|
+
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1476
|
+
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1477
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1535
1478
|
// gadzooks! the property's value has changed!!
|
|
1536
1479
|
// set our new value!
|
|
1537
1480
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1538
1481
|
if (instance) {
|
|
1539
1482
|
// get an array of method names of watch functions to call
|
|
1540
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1483
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1541
1484
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1542
1485
|
if (watchMethods) {
|
|
1543
1486
|
// this instance is watching for when this property changed
|
|
@@ -1552,7 +1495,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1552
1495
|
});
|
|
1553
1496
|
}
|
|
1554
1497
|
}
|
|
1555
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1498
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1556
1499
|
// looks like this value actually changed, so we've got work to do!
|
|
1557
1500
|
// but only if we've already rendered, otherwise just chill out
|
|
1558
1501
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1562,6 +1505,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1562
1505
|
}
|
|
1563
1506
|
}
|
|
1564
1507
|
};
|
|
1508
|
+
/**
|
|
1509
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1510
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1511
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1512
|
+
*
|
|
1513
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1514
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1515
|
+
* @param flags a number used to store a series of bit flags
|
|
1516
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1517
|
+
*/
|
|
1565
1518
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1566
1519
|
if (cmpMeta.$members$) {
|
|
1567
1520
|
if (Cstr.watchers) {
|
|
@@ -1571,8 +1524,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1571
1524
|
const members = Object.entries(cmpMeta.$members$);
|
|
1572
1525
|
const prototype = Cstr.prototype;
|
|
1573
1526
|
members.map(([memberName, [memberFlags]]) => {
|
|
1574
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1575
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1527
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1528
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1576
1529
|
// proxyComponent - prop
|
|
1577
1530
|
Object.defineProperty(prototype, memberName, {
|
|
1578
1531
|
get() {
|
|
@@ -1587,8 +1540,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1587
1540
|
enumerable: true,
|
|
1588
1541
|
});
|
|
1589
1542
|
}
|
|
1590
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1591
|
-
memberFlags & 64 /* Method */) {
|
|
1543
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1544
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1592
1545
|
// proxyComponent - method
|
|
1593
1546
|
Object.defineProperty(prototype, memberName, {
|
|
1594
1547
|
value(...args) {
|
|
@@ -1598,7 +1551,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1598
1551
|
});
|
|
1599
1552
|
}
|
|
1600
1553
|
});
|
|
1601
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1554
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1602
1555
|
const attrNameToPropName = new Map();
|
|
1603
1556
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1604
1557
|
plt.jmp(() => {
|
|
@@ -1654,11 +1607,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1654
1607
|
// create an array of attributes to observe
|
|
1655
1608
|
// and also create a map of html attribute name to js property name
|
|
1656
1609
|
Cstr.observedAttributes = members
|
|
1657
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1610
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1658
1611
|
.map(([propName, m]) => {
|
|
1659
1612
|
const attrName = m[1] || propName;
|
|
1660
1613
|
attrNameToPropName.set(attrName, propName);
|
|
1661
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1614
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1662
1615
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1663
1616
|
}
|
|
1664
1617
|
return attrName;
|
|
@@ -1669,10 +1622,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1669
1622
|
};
|
|
1670
1623
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1671
1624
|
// initializeComponent
|
|
1672
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1625
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1673
1626
|
{
|
|
1674
1627
|
// we haven't initialized this element yet
|
|
1675
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1628
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1676
1629
|
// lazy loaded components
|
|
1677
1630
|
// request the component's implementation to be
|
|
1678
1631
|
// wired up with the host element
|
|
@@ -1690,7 +1643,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1690
1643
|
{
|
|
1691
1644
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1692
1645
|
}
|
|
1693
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1646
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1694
1647
|
Cstr.isProxied = true;
|
|
1695
1648
|
}
|
|
1696
1649
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1698,7 +1651,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1698
1651
|
// but let's keep track of when we start and stop
|
|
1699
1652
|
// so that the getters/setters don't incorrectly step on data
|
|
1700
1653
|
{
|
|
1701
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1654
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1702
1655
|
}
|
|
1703
1656
|
// construct the lazy-loaded component implementation
|
|
1704
1657
|
// passing the hostRef is very important during
|
|
@@ -1711,10 +1664,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1711
1664
|
consoleError(e);
|
|
1712
1665
|
}
|
|
1713
1666
|
{
|
|
1714
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1667
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1715
1668
|
}
|
|
1716
1669
|
{
|
|
1717
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1670
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1718
1671
|
}
|
|
1719
1672
|
endNewInstance();
|
|
1720
1673
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1725,7 +1678,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1725
1678
|
const scopeId = getScopeId(cmpMeta);
|
|
1726
1679
|
if (!styles.has(scopeId)) {
|
|
1727
1680
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1728
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1681
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1729
1682
|
endRegisterStyles();
|
|
1730
1683
|
}
|
|
1731
1684
|
}
|
|
@@ -1752,30 +1705,19 @@ const fireConnectedCallback = (instance) => {
|
|
|
1752
1705
|
}
|
|
1753
1706
|
};
|
|
1754
1707
|
const connectedCallback = (elm) => {
|
|
1755
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1708
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1756
1709
|
const hostRef = getHostRef(elm);
|
|
1757
1710
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1758
1711
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1759
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1712
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1760
1713
|
// first time this component has connected
|
|
1761
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1762
|
-
let hostId;
|
|
1714
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1763
1715
|
{
|
|
1764
|
-
hostId = elm.getAttribute(HYDRATE_ID);
|
|
1765
|
-
if (hostId) {
|
|
1766
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1767
|
-
const scopeId = addStyle(elm.shadowRoot, cmpMeta);
|
|
1768
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
1769
|
-
}
|
|
1770
|
-
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
if (!hostId) {
|
|
1774
1716
|
// initUpdate
|
|
1775
1717
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1776
1718
|
// in here to act as original content anchors as we move nodes around
|
|
1777
1719
|
// host element has been connected to the DOM
|
|
1778
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1720
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1779
1721
|
setContentReference(elm);
|
|
1780
1722
|
}
|
|
1781
1723
|
}
|
|
@@ -1786,10 +1728,7 @@ const connectedCallback = (elm) => {
|
|
|
1786
1728
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1787
1729
|
// climb up the ancestors looking for the first
|
|
1788
1730
|
// component that hasn't finished its lifecycle update yet
|
|
1789
|
-
if (
|
|
1790
|
-
ancestorComponent.hasAttribute('s-id') &&
|
|
1791
|
-
ancestorComponent['s-p']) ||
|
|
1792
|
-
ancestorComponent['s-p']) {
|
|
1731
|
+
if (ancestorComponent['s-p']) {
|
|
1793
1732
|
// we found this components first ancestor component
|
|
1794
1733
|
// keep a reference to this component's ancestor component
|
|
1795
1734
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1801,7 +1740,7 @@ const connectedCallback = (elm) => {
|
|
|
1801
1740
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1802
1741
|
if (cmpMeta.$members$) {
|
|
1803
1742
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1804
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1743
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1805
1744
|
const value = elm[memberName];
|
|
1806
1745
|
delete elm[memberName];
|
|
1807
1746
|
elm[memberName] = value;
|
|
@@ -1835,7 +1774,7 @@ const setContentReference = (elm) => {
|
|
|
1835
1774
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1836
1775
|
};
|
|
1837
1776
|
const disconnectedCallback = (elm) => {
|
|
1838
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1777
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1839
1778
|
const hostRef = getHostRef(elm);
|
|
1840
1779
|
const instance = hostRef.$lazyInstance$ ;
|
|
1841
1780
|
{
|
|
@@ -1858,22 +1797,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1858
1797
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
1859
1798
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
1860
1799
|
const deferredConnectedCallbacks = [];
|
|
1861
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
1862
1800
|
let appLoadFallback;
|
|
1863
1801
|
let isBootstrapping = true;
|
|
1864
|
-
let i = 0;
|
|
1865
1802
|
Object.assign(plt, options);
|
|
1866
1803
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1867
|
-
{
|
|
1868
|
-
// If the app is already hydrated there is not point to disable the
|
|
1869
|
-
// async queue. This will improve the first input delay
|
|
1870
|
-
plt.$flags$ |= 2 /* appLoaded */;
|
|
1871
|
-
}
|
|
1872
|
-
{
|
|
1873
|
-
for (; i < styles.length; i++) {
|
|
1874
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
1804
|
lazyBundles.map((lazyBundle) => {
|
|
1878
1805
|
lazyBundle[1].map((compactMeta) => {
|
|
1879
1806
|
const cmpMeta = {
|
|
@@ -1902,7 +1829,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1902
1829
|
super(self);
|
|
1903
1830
|
self = this;
|
|
1904
1831
|
registerHost(self, cmpMeta);
|
|
1905
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1832
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1906
1833
|
// this component is using shadow dom
|
|
1907
1834
|
// and this browser supports shadow dom
|
|
1908
1835
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1937,7 +1864,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1937
1864
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1938
1865
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1939
1866
|
cmpTags.push(tagName);
|
|
1940
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1867
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1941
1868
|
}
|
|
1942
1869
|
});
|
|
1943
1870
|
});
|
|
@@ -1960,7 +1887,43 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1960
1887
|
endBootstrap();
|
|
1961
1888
|
};
|
|
1962
1889
|
const Fragment = (_, children) => children;
|
|
1963
|
-
const
|
|
1890
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1891
|
+
if (listeners) {
|
|
1892
|
+
listeners.map(([flags, name, method]) => {
|
|
1893
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1894
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1895
|
+
const opts = hostListenerOpts(flags);
|
|
1896
|
+
plt.ael(target, name, handler, opts);
|
|
1897
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1902
|
+
try {
|
|
1903
|
+
{
|
|
1904
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1905
|
+
// instance is ready, let's call it's member method for this event
|
|
1906
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1907
|
+
}
|
|
1908
|
+
else {
|
|
1909
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
catch (e) {
|
|
1914
|
+
consoleError(e);
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1918
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
1919
|
+
return doc;
|
|
1920
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
1921
|
+
return win;
|
|
1922
|
+
return elm;
|
|
1923
|
+
};
|
|
1924
|
+
// prettier-ignore
|
|
1925
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1926
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1964
1927
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1965
1928
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1966
1929
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1992,7 +1955,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1992
1955
|
if (module) {
|
|
1993
1956
|
return module[exportName];
|
|
1994
1957
|
}
|
|
1958
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
1995
1959
|
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1960
|
+
/* @vite-ignore */
|
|
1996
1961
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1997
1962
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1998
1963
|
/* webpackMode: "lazy" */
|
|
@@ -2003,14 +1968,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2003
1968
|
return importedModule[exportName];
|
|
2004
1969
|
}, consoleError);
|
|
2005
1970
|
};
|
|
2006
|
-
const styles = new Map();
|
|
1971
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1972
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1973
|
+
const doc = win.document || { head: {} };
|
|
1974
|
+
const plt = {
|
|
1975
|
+
$flags$: 0,
|
|
1976
|
+
$resourcesUrl$: '',
|
|
1977
|
+
jmp: (h) => h(),
|
|
1978
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1979
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1980
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1981
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1982
|
+
};
|
|
1983
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1984
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1985
|
+
try {
|
|
1986
|
+
new CSSStyleSheet();
|
|
1987
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1988
|
+
}
|
|
1989
|
+
catch (e) { }
|
|
1990
|
+
return false;
|
|
1991
|
+
})()
|
|
1992
|
+
;
|
|
2007
1993
|
const queueDomReads = [];
|
|
2008
1994
|
const queueDomWrites = [];
|
|
2009
1995
|
const queueTask = (queue, write) => (cb) => {
|
|
2010
1996
|
queue.push(cb);
|
|
2011
1997
|
if (!queuePending) {
|
|
2012
1998
|
queuePending = true;
|
|
2013
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1999
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
2014
2000
|
nextTick(flush);
|
|
2015
2001
|
}
|
|
2016
2002
|
else {
|