@nanoporetech-digital/components 3.7.0 → 3.8.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/CHANGELOG.md +34 -0
- package/dist/cjs/{algolia-data-9152d0ef.js → algolia-data-f495daf4.js} +2 -2
- package/dist/cjs/{algolia-data-9152d0ef.js.map → algolia-data-f495daf4.js.map} +1 -1
- package/dist/cjs/{algoliasearch.umd-7ee60729.js → algoliasearch.umd-689c1560.js} +3 -3
- package/dist/cjs/{algoliasearch.umd-7ee60729.js.map → algoliasearch.umd-689c1560.js.map} +1 -1
- package/dist/cjs/{component-store-d7c8c326.js → component-store-d2fdaecf.js} +25 -12
- package/dist/cjs/component-store-d2fdaecf.js.map +1 -0
- package/dist/cjs/{dom-d7c33f11.js → dom-7acf7afd.js} +15 -15
- package/dist/cjs/dom-7acf7afd.js.map +1 -0
- package/dist/cjs/{form-control-57c71246.js → form-control-c24fbff3.js} +4 -4
- package/dist/cjs/form-control-c24fbff3.js.map +1 -0
- package/dist/{esm/global-8047b4ff.js → cjs/global-3a6a7873.js} +5 -14
- package/dist/cjs/global-3a6a7873.js.map +1 -0
- package/dist/cjs/{index-bb2a6ab8.js → index-361e5114.js} +2 -2
- package/dist/cjs/{index-bb2a6ab8.js.map → index-361e5114.js.map} +1 -1
- package/dist/cjs/{index-41582c2a.js → index-5c437a69.js} +1436 -516
- package/dist/cjs/index-5c437a69.js.map +1 -0
- package/dist/cjs/{index-ece1cb9e.js → index-72ee0363.js} +2 -10
- package/dist/cjs/index-72ee0363.js.map +1 -0
- package/dist/cjs/index.cjs.js +18 -35
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +5 -4
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/{modal-e4defcc3.js → modal-5884a6de.js} +3 -2
- package/dist/cjs/modal-5884a6de.js.map +1 -0
- package/dist/cjs/nano-accordion.cjs.entry.js +4 -7
- package/dist/cjs/nano-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-alert.cjs.entry.js +25 -19
- package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-algolia-filter.cjs.entry.js +5 -5
- package/dist/cjs/nano-algolia-filter.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-algolia-input.cjs.entry.js +4 -4
- package/dist/cjs/nano-algolia-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-algolia-pagination.cjs.entry.js +2 -2
- package/dist/cjs/nano-algolia-results.cjs.entry.js +2 -2
- package/dist/cjs/nano-algolia.cjs.entry.js +8 -8
- package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-aspect-ratio.cjs.entry.js +1 -1
- package/dist/cjs/nano-checkbox-group.cjs.entry.js +52 -9
- package/dist/cjs/nano-checkbox-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-checkbox.cjs.entry.js +8 -8
- package/dist/cjs/nano-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-components.cjs.js +8 -4
- package/dist/cjs/nano-components.cjs.js.map +1 -1
- package/dist/cjs/nano-datalist_3.cjs.entry.js +46 -36
- package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-date-input.cjs.entry.js +6 -6
- package/dist/cjs/nano-date-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-date-picker.cjs.entry.js +4 -4
- package/dist/cjs/nano-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-demo.cjs.entry.js +13 -9
- package/dist/cjs/nano-demo.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-details.cjs.entry.js +4 -4
- package/dist/cjs/nano-details.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dialog.cjs.entry.js +6 -6
- package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-drawer.cjs.entry.js +5 -5
- package/dist/cjs/nano-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dropdown.cjs.entry.js +9 -4
- package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-field-validator.cjs.entry.js +4 -3
- package/dist/cjs/nano-field-validator.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-file-upload.cjs.entry.js +5 -5
- package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +54 -67
- package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js +55 -42
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +6 -4
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-grid_3.cjs.entry.js +8 -7
- package/dist/cjs/nano-grid_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js +4 -2
- package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon-button.cjs.entry.js +2 -2
- package/dist/cjs/nano-icon-button.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon.cjs.entry.js +7 -14
- package/dist/cjs/nano-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-input.cjs.entry.js +19 -33
- package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-menu-drawer.cjs.entry.js +3 -3
- package/dist/cjs/nano-menu-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-progress-bar_2.cjs.entry.js +4 -4
- package/dist/cjs/nano-progress-bar_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-range.cjs.entry.js +4 -4
- package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-rating.cjs.entry.js +2 -2
- package/dist/cjs/nano-rating.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js +18 -10
- package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-slide.cjs.entry.js +1 -1
- package/dist/cjs/nano-slides.cjs.entry.js +11 -21
- package/dist/cjs/nano-slides.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-spinner.cjs.entry.js +3 -3
- package/dist/cjs/nano-spinner.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-split-pane.cjs.entry.js +15 -13
- package/dist/cjs/nano-split-pane.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-sticker.cjs.entry.js +6 -4
- package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-content.cjs.entry.js +9 -3
- package/dist/cjs/nano-tab-content.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab-group.cjs.entry.js +18 -12
- package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js +2 -2
- package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-56eb29c1.js → nano-table-860b9714.js} +115 -150
- package/dist/cjs/nano-table-860b9714.js.map +1 -0
- package/dist/cjs/nano-table.cjs.entry.js +3 -3
- package/dist/cjs/{popover-508bcedb.js → popover-088646b2.js} +61 -50
- package/dist/cjs/popover-088646b2.js.map +1 -0
- package/dist/cjs/{scroll-9bb5e060.js → scroll-a197d9c4.js} +2 -2
- package/dist/cjs/{scroll-9bb5e060.js.map → scroll-a197d9c4.js.map} +1 -1
- package/dist/cjs/{table.worker-b1c53001.js → table.worker-88f2cb15.js} +4 -4
- package/dist/cjs/table.worker-88f2cb15.js.map +1 -0
- package/dist/cjs/{theme-50275e1a.js → theme-9cbe28c5.js} +2 -7
- package/dist/cjs/theme-9cbe28c5.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/accordion/accordion.js +1 -4
- package/dist/collection/components/accordion/accordion.js.map +1 -1
- package/dist/collection/components/alert/alert.css +4 -3
- package/dist/collection/components/alert/alert.helpers.js +6 -24
- package/dist/collection/components/alert/alert.helpers.js.map +1 -1
- package/dist/collection/components/alert/alert.js +19 -13
- package/dist/collection/components/alert/alert.js.map +1 -1
- package/dist/collection/components/algolia/algolia-filter.js +2 -2
- package/dist/collection/components/algolia/algolia-filter.js.map +1 -1
- package/dist/collection/components/algolia/algolia-input.js.map +1 -1
- package/dist/collection/components/algolia/algolia.css +2 -1
- package/dist/collection/components/algolia/algolia.js +3 -3
- package/dist/collection/components/algolia/algolia.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox-group.css +16 -10
- package/dist/collection/components/checkbox/checkbox-group.js +91 -7
- package/dist/collection/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.css +14 -12
- package/dist/collection/components/checkbox/checkbox.js +5 -5
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/datalist/datalist.js +39 -31
- package/dist/collection/components/datalist/datalist.js.map +1 -1
- package/dist/collection/components/date-input/date-input.css +3 -3
- package/dist/collection/components/date-input/date-input.js +3 -3
- package/dist/collection/components/date-input/date-input.js.map +1 -1
- package/dist/collection/components/date-picker/date-picker.css +15 -11
- package/dist/collection/components/date-picker/date-picker.js +1 -1
- package/dist/collection/components/date-picker/date-picker.js.map +1 -1
- package/dist/collection/components/demo/demo.js +12 -8
- package/dist/collection/components/demo/demo.js.map +1 -1
- package/dist/collection/components/details/details.css +2 -1
- package/dist/collection/components/details/details.js +1 -1
- package/dist/collection/components/details/details.js.map +1 -1
- package/dist/collection/components/dialog/dialog.css +8 -5
- package/dist/collection/components/dialog/dialog.helpers.js +3 -11
- package/dist/collection/components/dialog/dialog.helpers.js.map +1 -1
- package/dist/collection/components/drawer/drawer.css +2 -2
- package/dist/collection/components/dropdown/dropdown.css +1 -1
- package/dist/collection/components/dropdown/dropdown.js +6 -1
- package/dist/collection/components/dropdown/dropdown.js.map +1 -1
- package/dist/collection/components/field-validator/field-validator.js +2 -1
- package/dist/collection/components/field-validator/field-validator.js.map +1 -1
- package/dist/collection/components/file-upload/file-upload.css +35 -25
- package/dist/collection/components/file-upload/file-upload.js +4 -4
- package/dist/collection/components/file-upload/file-upload.js.map +1 -1
- package/dist/collection/components/form-control/form-control.js +2 -2
- package/dist/collection/components/form-control/form-control.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav-user-profile.js +6 -7
- package/dist/collection/components/global-nav/global-nav-user-profile.js.map +1 -1
- package/dist/collection/components/global-nav/global-nav.js +62 -27
- package/dist/collection/components/global-nav/global-nav.js.map +1 -1
- package/dist/collection/components/global-nav/style/global-nav.css +92 -48
- package/dist/collection/components/global-search-results/global-search-results.css +83 -44
- package/dist/collection/components/global-search-results/global-search-results.js +4 -2
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/components/grid/grid-item.css +1 -1
- package/dist/collection/components/grid/grid.css +1 -0
- package/dist/collection/components/grid/grid.js +2 -0
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/hero/hero.css +110 -18
- package/dist/collection/components/hero/hero.js +2 -0
- package/dist/collection/components/hero/hero.js.map +1 -1
- package/dist/collection/components/icon/icon.css +2 -2
- package/dist/collection/components/icon/icon.js +3 -10
- package/dist/collection/components/icon/icon.js.map +1 -1
- package/dist/collection/components/icon-button/icon-button.css +1 -1
- package/dist/collection/components/img/img.css +0 -1
- package/dist/collection/components/img/img.js +3 -4
- package/dist/collection/components/img/img.js.map +1 -1
- package/dist/collection/components/input/input.css +54 -32
- package/dist/collection/components/input/input.js +14 -28
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/menu/menu.js +4 -2
- package/dist/collection/components/menu/menu.js.map +1 -1
- package/dist/collection/components/menu-drawer/menu-drawer.css +20 -13
- package/dist/collection/components/menu-drawer/menu-drawer.js +1 -1
- package/dist/collection/components/menu-drawer/menu-drawer.js.map +1 -1
- package/dist/collection/components/nav-item/nav-item.css +31 -16
- package/dist/collection/components/nav-item/nav-item.js +4 -4
- package/dist/collection/components/nav-item/nav-item.js.map +1 -1
- package/dist/collection/components/option/option.css +4 -2
- package/dist/collection/components/progress-bar/progress-bar.css +4 -4
- package/dist/collection/components/range/range.css +11 -9
- package/dist/collection/components/rating/rating.css +9 -5
- package/dist/collection/components/resize-observe/resize-observe.js +17 -6
- package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
- package/dist/collection/components/select/select.css +59 -34
- package/dist/collection/components/select/select.js +42 -55
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/skeleton/skeleton.css +5 -5
- package/dist/collection/components/slides/slides.css +4 -2
- package/dist/collection/components/slides/slides.js +9 -19
- package/dist/collection/components/slides/slides.js.map +1 -1
- package/dist/collection/components/spinner/spinner.css +13 -8
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/spinner/spinner.js.map +1 -1
- package/dist/collection/components/split-pane/split-pane.css +1 -1
- package/dist/collection/components/split-pane/split-pane.js +13 -11
- package/dist/collection/components/split-pane/split-pane.js.map +1 -1
- package/dist/collection/components/sticker/sticker.js +4 -2
- package/dist/collection/components/sticker/sticker.js.map +1 -1
- package/dist/collection/components/table/table.cell.js +8 -8
- package/dist/collection/components/table/table.cell.js.map +1 -1
- package/dist/collection/components/table/table.css +46 -25
- package/dist/collection/components/table/table.header.js +6 -19
- package/dist/collection/components/table/table.header.js.map +1 -1
- package/dist/collection/components/table/table.js +85 -93
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/table/table.row.js +8 -8
- package/dist/collection/components/table/table.row.js.map +1 -1
- package/dist/collection/components/table/table.store.js +2 -1
- package/dist/collection/components/table/table.store.js.map +1 -1
- package/dist/collection/components/table/table.utils.js +8 -7
- package/dist/collection/components/table/table.utils.js.map +1 -1
- package/dist/collection/components/tabs/tab-content.css +7 -2
- package/dist/collection/components/tabs/tab-content.js +12 -1
- package/dist/collection/components/tabs/tab-content.js.map +1 -1
- package/dist/collection/components/tabs/tab-group.css +13 -10
- package/dist/collection/components/tabs/tab-group.js +17 -7
- package/dist/collection/components/tabs/tab-group.js.map +1 -1
- package/dist/collection/components/tabs/tab.css +21 -12
- package/dist/collection/components/tooltip/tooltip.css +25 -16
- package/dist/collection/global/script/global.js +2 -13
- package/dist/collection/global/script/global.js.map +1 -1
- package/dist/collection/index.js +17 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utils/dom.js +16 -15
- package/dist/collection/utils/dom.js.map +1 -1
- package/dist/collection/utils/fetch.js +15 -12
- package/dist/collection/utils/fetch.js.map +1 -1
- package/dist/collection/utils/gesture/index.js +1 -9
- package/dist/collection/utils/gesture/index.js.map +1 -1
- package/dist/collection/utils/modal.js +2 -1
- package/dist/collection/utils/modal.js.map +1 -1
- package/dist/collection/utils/store/get-set.js +1 -1
- package/dist/collection/utils/store/get-set.js.map +1 -1
- package/dist/collection/utils/testing/index.js +1 -0
- package/dist/collection/utils/testing/index.js.map +1 -1
- package/dist/collection/utils/theme.js +1 -6
- package/dist/collection/utils/theme.js.map +1 -1
- package/dist/components/algolia.js +3 -3
- package/dist/components/algolia.js.map +1 -1
- package/dist/components/algoliasearch.umd.js +2 -2
- package/dist/components/algoliasearch.umd.js.map +1 -1
- package/dist/components/component-store.js +23 -10
- package/dist/components/component-store.js.map +1 -1
- package/dist/components/datalist.js +39 -31
- package/dist/components/datalist.js.map +1 -1
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/dom.js +17 -15
- package/dist/components/dom.js.map +1 -1
- package/dist/components/dropdown.js +7 -2
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/form-control.js +2 -2
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/global-nav-user-profile.js +4 -3
- package/dist/components/global-nav-user-profile.js.map +1 -1
- package/dist/components/grid-item.js +1 -1
- package/dist/components/grid-item.js.map +1 -1
- package/dist/components/grid.js +3 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/icon-button.js +1 -1
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/icon.js +4 -11
- package/dist/components/icon.js.map +1 -1
- package/dist/components/img.js +4 -5
- package/dist/components/img.js.map +1 -1
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +23 -52
- package/dist/components/index.js.map +1 -1
- package/dist/components/index3.js +635 -1069
- package/dist/components/index3.js.map +1 -1
- package/dist/components/input.js +15 -29
- package/dist/components/input.js.map +1 -1
- package/dist/components/menu.js +4 -2
- package/dist/components/menu.js.map +1 -1
- package/dist/components/modal.js +2 -1
- package/dist/components/modal.js.map +1 -1
- package/dist/components/nano-accordion.js +1 -4
- package/dist/components/nano-accordion.js.map +1 -1
- package/dist/components/nano-alert.js +20 -14
- package/dist/components/nano-alert.js.map +1 -1
- package/dist/components/nano-algolia-filter.js +2 -2
- package/dist/components/nano-algolia-filter.js.map +1 -1
- package/dist/components/nano-algolia-input.js.map +1 -1
- package/dist/components/nano-checkbox-group.js +53 -9
- package/dist/components/nano-checkbox-group.js.map +1 -1
- package/dist/components/nano-checkbox.js +6 -6
- package/dist/components/nano-checkbox.js.map +1 -1
- package/dist/components/nano-date-input.js +4 -4
- package/dist/components/nano-date-input.js.map +1 -1
- package/dist/components/nano-demo.js +12 -8
- package/dist/components/nano-demo.js.map +1 -1
- package/dist/components/nano-details.js +2 -2
- package/dist/components/nano-details.js.map +1 -1
- package/dist/components/nano-dialog.js +1 -1
- package/dist/components/nano-dialog.js.map +1 -1
- package/dist/components/nano-drawer.js +1 -1
- package/dist/components/nano-drawer.js.map +1 -1
- package/dist/components/nano-field-validator.js +2 -1
- package/dist/components/nano-field-validator.js.map +1 -1
- package/dist/components/nano-file-upload.js +4 -4
- package/dist/components/nano-file-upload.js.map +1 -1
- package/dist/components/nano-global-nav.js +52 -38
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +5 -3
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/nano-hero.js +3 -1
- package/dist/components/nano-hero.js.map +1 -1
- package/dist/components/nano-menu-drawer.js +2 -2
- package/dist/components/nano-menu-drawer.js.map +1 -1
- package/dist/components/nano-range.js +2 -2
- package/dist/components/nano-range.js.map +1 -1
- package/dist/components/nano-rating.js +1 -1
- package/dist/components/nano-rating.js.map +1 -1
- package/dist/components/nano-slides.js +10 -20
- package/dist/components/nano-slides.js.map +1 -1
- package/dist/components/nano-split-pane.js +14 -12
- package/dist/components/nano-split-pane.js.map +1 -1
- package/dist/components/nano-tab-content.js +10 -3
- package/dist/components/nano-tab-content.js.map +1 -1
- package/dist/components/nano-tab-group.js +18 -8
- package/dist/components/nano-tab-group.js.map +1 -1
- package/dist/components/nano-tab.js +1 -1
- package/dist/components/nano-tab.js.map +1 -1
- package/dist/components/nav-item.js +5 -5
- package/dist/components/nav-item.js.map +1 -1
- package/dist/components/option.js +1 -1
- package/dist/components/option.js.map +1 -1
- package/dist/components/popover.js +60 -49
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar.js +1 -1
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/resize-observe.js +16 -8
- package/dist/components/resize-observe.js.map +1 -1
- package/dist/components/select.js +43 -56
- package/dist/components/select.js.map +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/spinner.js +2 -2
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/sticker.js +4 -2
- package/dist/components/sticker.js.map +1 -1
- package/dist/components/table.js +117 -152
- package/dist/components/table.js.map +1 -1
- package/dist/components/theme.js +1 -6
- package/dist/components/theme.js.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/esm/{algolia-data-b5cd0c58.js → algolia-data-213ed40c.js} +2 -2
- package/dist/esm/{algolia-data-b5cd0c58.js.map → algolia-data-213ed40c.js.map} +1 -1
- package/dist/esm/{algoliasearch.umd-86359963.js → algoliasearch.umd-4f7efa84.js} +3 -3
- package/dist/esm/{algoliasearch.umd-86359963.js.map → algoliasearch.umd-4f7efa84.js.map} +1 -1
- package/dist/esm/{component-store-ec512820.js → component-store-df8af0e6.js} +25 -12
- package/dist/esm/component-store-df8af0e6.js.map +1 -0
- package/dist/esm/{dom-d3ad49e2.js → dom-311c9e1e.js} +15 -15
- package/dist/esm/dom-311c9e1e.js.map +1 -0
- package/dist/esm/{form-control-84bac7a2.js → form-control-445de741.js} +4 -4
- package/dist/esm/form-control-445de741.js.map +1 -0
- package/dist/{cjs/global-989678ec.js → esm/global-f6e05656.js} +3 -16
- package/dist/esm/global-f6e05656.js.map +1 -0
- package/dist/esm/{index-3c280603.js → index-44c85cc8.js} +1436 -517
- package/dist/esm/index-44c85cc8.js.map +1 -0
- package/dist/esm/{index-c752dae1.js → index-d1b02919.js} +2 -2
- package/dist/esm/{index-c752dae1.js.map → index-d1b02919.js.map} +1 -1
- package/dist/{components/index4.js → esm/index-f626f476.js} +2 -10
- package/dist/esm/index-f626f476.js.map +1 -0
- package/dist/esm/index.js +18 -36
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +5 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/{modal-5c9ce466.js → modal-1f3223cd.js} +3 -2
- package/dist/esm/modal-1f3223cd.js.map +1 -0
- package/dist/esm/nano-accordion.entry.js +4 -7
- package/dist/esm/nano-accordion.entry.js.map +1 -1
- package/dist/esm/nano-alert.entry.js +25 -19
- package/dist/esm/nano-alert.entry.js.map +1 -1
- package/dist/esm/nano-algolia-filter.entry.js +5 -5
- package/dist/esm/nano-algolia-filter.entry.js.map +1 -1
- package/dist/esm/nano-algolia-input.entry.js +4 -4
- package/dist/esm/nano-algolia-input.entry.js.map +1 -1
- package/dist/esm/nano-algolia-pagination.entry.js +2 -2
- package/dist/esm/nano-algolia-results.entry.js +2 -2
- package/dist/esm/nano-algolia.entry.js +8 -8
- package/dist/esm/nano-algolia.entry.js.map +1 -1
- package/dist/esm/nano-aspect-ratio.entry.js +1 -1
- package/dist/esm/nano-checkbox-group.entry.js +52 -9
- package/dist/esm/nano-checkbox-group.entry.js.map +1 -1
- package/dist/esm/nano-checkbox.entry.js +8 -8
- package/dist/esm/nano-checkbox.entry.js.map +1 -1
- package/dist/esm/nano-components.js +5 -4
- package/dist/esm/nano-components.js.map +1 -1
- package/dist/esm/nano-datalist_3.entry.js +46 -36
- package/dist/esm/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm/nano-date-input.entry.js +6 -6
- package/dist/esm/nano-date-input.entry.js.map +1 -1
- package/dist/esm/nano-date-picker.entry.js +4 -4
- package/dist/esm/nano-date-picker.entry.js.map +1 -1
- package/dist/esm/nano-demo.entry.js +13 -9
- package/dist/esm/nano-demo.entry.js.map +1 -1
- package/dist/esm/nano-details.entry.js +4 -4
- package/dist/esm/nano-details.entry.js.map +1 -1
- package/dist/esm/nano-dialog.entry.js +6 -6
- package/dist/esm/nano-dialog.entry.js.map +1 -1
- package/dist/esm/nano-drawer.entry.js +5 -5
- package/dist/esm/nano-drawer.entry.js.map +1 -1
- package/dist/esm/nano-dropdown.entry.js +9 -4
- package/dist/esm/nano-dropdown.entry.js.map +1 -1
- package/dist/esm/nano-field-validator.entry.js +4 -3
- package/dist/esm/nano-field-validator.entry.js.map +1 -1
- package/dist/esm/nano-file-upload.entry.js +5 -5
- package/dist/esm/nano-file-upload.entry.js.map +1 -1
- package/dist/esm/nano-global-nav-user-profile_3.entry.js +54 -67
- package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js +55 -42
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +6 -4
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-grid_3.entry.js +8 -7
- package/dist/esm/nano-grid_3.entry.js.map +1 -1
- package/dist/esm/nano-hero.entry.js +4 -2
- package/dist/esm/nano-hero.entry.js.map +1 -1
- package/dist/esm/nano-icon-button.entry.js +2 -2
- package/dist/esm/nano-icon-button.entry.js.map +1 -1
- package/dist/esm/nano-icon.entry.js +7 -14
- package/dist/esm/nano-icon.entry.js.map +1 -1
- package/dist/esm/nano-input.entry.js +19 -33
- package/dist/esm/nano-input.entry.js.map +1 -1
- package/dist/esm/nano-menu-drawer.entry.js +3 -3
- package/dist/esm/nano-menu-drawer.entry.js.map +1 -1
- package/dist/esm/nano-progress-bar_2.entry.js +4 -4
- package/dist/esm/nano-progress-bar_2.entry.js.map +1 -1
- package/dist/esm/nano-range.entry.js +4 -4
- package/dist/esm/nano-range.entry.js.map +1 -1
- package/dist/esm/nano-rating.entry.js +2 -2
- package/dist/esm/nano-rating.entry.js.map +1 -1
- package/dist/esm/nano-resize-observe_2.entry.js +18 -10
- package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
- package/dist/esm/nano-slide.entry.js +1 -1
- package/dist/esm/nano-slides.entry.js +11 -21
- package/dist/esm/nano-slides.entry.js.map +1 -1
- package/dist/esm/nano-spinner.entry.js +3 -3
- package/dist/esm/nano-spinner.entry.js.map +1 -1
- package/dist/esm/nano-split-pane.entry.js +15 -13
- package/dist/esm/nano-split-pane.entry.js.map +1 -1
- package/dist/esm/nano-sticker.entry.js +6 -4
- package/dist/esm/nano-sticker.entry.js.map +1 -1
- package/dist/esm/nano-tab-content.entry.js +9 -3
- package/dist/esm/nano-tab-content.entry.js.map +1 -1
- package/dist/esm/nano-tab-group.entry.js +18 -12
- package/dist/esm/nano-tab-group.entry.js.map +1 -1
- package/dist/esm/nano-tab.entry.js +2 -2
- package/dist/esm/nano-tab.entry.js.map +1 -1
- package/dist/esm/{nano-table-38f3c797.js → nano-table-331a0cad.js} +115 -150
- package/dist/esm/nano-table-331a0cad.js.map +1 -0
- package/dist/esm/nano-table.entry.js +3 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{popover-e748bb61.js → popover-02e6714d.js} +61 -50
- package/dist/esm/popover-02e6714d.js.map +1 -0
- package/dist/esm/{scroll-a1e59d8c.js → scroll-e5825d8d.js} +2 -2
- package/dist/esm/{scroll-a1e59d8c.js.map → scroll-e5825d8d.js.map} +1 -1
- package/dist/esm/{table.worker-e57fffd8.js → table.worker-682e581f.js} +4 -4
- package/dist/esm/table.worker-682e581f.js.map +1 -0
- package/dist/esm/{theme-931bd452.js → theme-82feb8cf.js} +2 -7
- package/dist/esm/theme-82feb8cf.js.map +1 -0
- package/dist/nano-components/index.esm.js +1 -1
- package/dist/nano-components/index.esm.js.map +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/p-014872f7.entry.js +5 -0
- package/dist/nano-components/p-014872f7.entry.js.map +1 -0
- package/dist/nano-components/{p-bd05b3aa.entry.js → p-01c1f47a.entry.js} +2 -2
- package/dist/nano-components/{p-bd05b3aa.entry.js.map → p-01c1f47a.entry.js.map} +1 -1
- package/dist/nano-components/{p-69e5a37d.entry.js → p-08c3ffaf.entry.js} +2 -2
- package/dist/nano-components/p-08c3ffaf.entry.js.map +1 -0
- package/dist/nano-components/p-0c3a5c44.entry.js +5 -0
- package/dist/nano-components/p-0c3a5c44.entry.js.map +1 -0
- package/dist/nano-components/p-0eaa9a08.entry.js +5 -0
- package/dist/nano-components/p-0eaa9a08.entry.js.map +1 -0
- package/dist/nano-components/p-0f7c19fc.entry.js +5 -0
- package/dist/nano-components/p-0f7c19fc.entry.js.map +1 -0
- package/dist/nano-components/p-12beee2b.entry.js +5 -0
- package/dist/nano-components/p-12beee2b.entry.js.map +1 -0
- package/dist/nano-components/p-1416c06b.entry.js +5 -0
- package/dist/nano-components/p-1416c06b.entry.js.map +1 -0
- package/dist/nano-components/p-14b7f2c7.entry.js +5 -0
- package/dist/nano-components/p-14b7f2c7.entry.js.map +1 -0
- package/dist/nano-components/p-167b9165.js.map +1 -1
- package/dist/nano-components/p-1d0194af.entry.js +5 -0
- package/dist/nano-components/p-1d0194af.entry.js.map +1 -0
- package/dist/nano-components/{p-1e709f87.entry.js → p-2113cc09.entry.js} +2 -2
- package/dist/nano-components/p-2113cc09.entry.js.map +1 -0
- package/dist/nano-components/p-2155fc2c.js.map +1 -1
- package/dist/nano-components/p-257432ff.js +5 -0
- package/dist/nano-components/p-257432ff.js.map +1 -0
- package/dist/nano-components/p-28874fdc.entry.js +5 -0
- package/dist/nano-components/p-28874fdc.entry.js.map +1 -0
- package/dist/nano-components/{p-b40eedcb.entry.js → p-34df2f17.entry.js} +2 -2
- package/dist/nano-components/p-34df2f17.entry.js.map +1 -0
- package/dist/nano-components/{p-1a8e60c4.entry.js → p-362d6a04.entry.js} +2 -2
- package/dist/nano-components/p-362d6a04.entry.js.map +1 -0
- package/dist/nano-components/p-38268f3c.entry.js +5 -0
- package/dist/nano-components/p-38268f3c.entry.js.map +1 -0
- package/dist/nano-components/p-411bb8f1.js +5 -0
- package/dist/nano-components/p-411bb8f1.js.map +1 -0
- package/dist/nano-components/p-41f33a56.entry.js +5 -0
- package/dist/nano-components/p-41f33a56.entry.js.map +1 -0
- package/dist/nano-components/p-45abbbdd.js.map +1 -1
- package/dist/nano-components/{p-885b6950.js → p-45b7682a.js} +2 -2
- package/dist/nano-components/p-45b7682a.js.map +1 -0
- package/dist/nano-components/{p-a2d0d7b9.entry.js → p-4971a1f1.entry.js} +2 -2
- package/dist/nano-components/p-4971a1f1.entry.js.map +1 -0
- package/dist/nano-components/p-4b12ba50.entry.js +5 -0
- package/dist/nano-components/p-4b12ba50.entry.js.map +1 -0
- package/dist/nano-components/p-4db34382.entry.js +5 -0
- package/dist/nano-components/p-4db34382.entry.js.map +1 -0
- package/dist/nano-components/p-51bc8b59.js +5 -0
- package/dist/nano-components/p-51bc8b59.js.map +1 -0
- package/dist/nano-components/p-533db8ad.entry.js +5 -0
- package/dist/nano-components/p-533db8ad.entry.js.map +1 -0
- package/dist/nano-components/p-578cc92e.entry.js +5 -0
- package/dist/nano-components/p-578cc92e.entry.js.map +1 -0
- package/dist/nano-components/p-5ec7263c.js +5 -0
- package/dist/nano-components/p-5ec7263c.js.map +1 -0
- package/dist/nano-components/p-61e22cad.entry.js +5 -0
- package/dist/nano-components/p-61e22cad.entry.js.map +1 -0
- package/dist/nano-components/{p-447a5910.entry.js → p-63811de1.entry.js} +2 -2
- package/dist/nano-components/p-63811de1.entry.js.map +1 -0
- package/dist/nano-components/p-67195231.js +5 -0
- package/dist/nano-components/p-67195231.js.map +1 -0
- package/dist/nano-components/p-69a3e911.js.map +1 -1
- package/dist/nano-components/p-6a2c2a7c.entry.js +5 -0
- package/dist/nano-components/p-6a2c2a7c.entry.js.map +1 -0
- package/dist/nano-components/p-70e718fe.entry.js +5 -0
- package/dist/nano-components/p-70e718fe.entry.js.map +1 -0
- package/dist/nano-components/{p-dba8a88d.entry.js → p-71e545fe.entry.js} +2 -2
- package/dist/nano-components/p-71e545fe.entry.js.map +1 -0
- package/dist/nano-components/p-73fc0adc.entry.js +5 -0
- package/dist/nano-components/p-73fc0adc.entry.js.map +1 -0
- package/dist/nano-components/p-74a7fc4f.js.map +1 -1
- package/dist/nano-components/p-7c23e950.js +5 -0
- package/dist/nano-components/p-7c23e950.js.map +1 -0
- package/dist/nano-components/p-80e42c89.entry.js +5 -0
- package/dist/nano-components/p-80e42c89.entry.js.map +1 -0
- package/dist/nano-components/p-8a4f6a46.js +5 -0
- package/dist/nano-components/p-8a4f6a46.js.map +1 -0
- package/dist/nano-components/{p-651b3264.js → p-8e39d4ee.js} +2 -2
- package/dist/nano-components/p-8e39d4ee.js.map +1 -0
- package/dist/nano-components/p-91f23170.entry.js +5 -0
- package/dist/nano-components/p-91f23170.entry.js.map +1 -0
- package/dist/nano-components/p-9746b0a5.js.map +1 -1
- package/dist/nano-components/p-9c57b61b.entry.js +5 -0
- package/dist/nano-components/p-9c57b61b.entry.js.map +1 -0
- package/dist/nano-components/p-a8db13db.entry.js +5 -0
- package/dist/nano-components/p-a8db13db.entry.js.map +1 -0
- package/dist/nano-components/p-ae2ce39b.entry.js +5 -0
- package/dist/nano-components/p-ae2ce39b.entry.js.map +1 -0
- package/dist/nano-components/p-b11c89f6.entry.js +5 -0
- package/dist/nano-components/p-b11c89f6.entry.js.map +1 -0
- package/dist/nano-components/p-b8abd6a1.js +5 -0
- package/dist/nano-components/p-b8abd6a1.js.map +1 -0
- package/dist/nano-components/p-b933f3c8.js.map +1 -1
- package/dist/nano-components/{p-2828788c.js → p-bb07c3d0.js} +2 -2
- package/dist/nano-components/p-bb07c3d0.js.map +1 -0
- package/dist/nano-components/{p-3f25fc76.entry.js → p-bd1ff3a4.entry.js} +2 -2
- package/dist/nano-components/p-bd1ff3a4.entry.js.map +1 -0
- package/dist/nano-components/{p-151aad1e.entry.js → p-c12042c7.entry.js} +4 -4
- package/dist/nano-components/p-c12042c7.entry.js.map +1 -0
- package/dist/nano-components/p-cecb9af1.js.map +1 -1
- package/dist/nano-components/p-cf0ce679.entry.js +5 -0
- package/dist/nano-components/p-cf0ce679.entry.js.map +1 -0
- package/dist/nano-components/p-d49c5b2b.entry.js +5 -0
- package/dist/nano-components/p-d49c5b2b.entry.js.map +1 -0
- package/dist/nano-components/p-d4f6ec9f.js +5 -0
- package/dist/nano-components/p-d4f6ec9f.js.map +1 -0
- package/dist/nano-components/p-dc785fb7.entry.js +5 -0
- package/dist/nano-components/p-dc785fb7.entry.js.map +1 -0
- package/dist/nano-components/p-de72a35c.entry.js +5 -0
- package/dist/nano-components/p-de72a35c.entry.js.map +1 -0
- package/dist/nano-components/{p-c9a7c7ea.js → p-e04f2333.js} +2 -2
- package/dist/nano-components/p-e04f2333.js.map +1 -0
- package/dist/nano-components/p-e460753c.entry.js +5 -0
- package/dist/nano-components/{p-41addb3a.entry.js.map → p-e460753c.entry.js.map} +1 -1
- package/dist/nano-components/{p-a0b93616.js → p-ed6adde2.js} +3 -3
- package/dist/nano-components/p-ed6adde2.js.map +1 -0
- package/dist/nano-components/p-ee045579.js.map +1 -1
- package/dist/nano-components/p-f6d105c2.entry.js +5 -0
- package/dist/nano-components/p-f6d105c2.entry.js.map +1 -0
- package/dist/nano-components/p-f84612d4.js +6 -0
- package/dist/nano-components/p-f84612d4.js.map +1 -0
- package/dist/nano-components/p-f8f89998.js.map +1 -1
- package/dist/nano-components/p-f9d45db1.entry.js +5 -0
- package/dist/nano-components/p-f9d45db1.entry.js.map +1 -0
- package/dist/themes/london-calling.css +1 -1
- package/dist/themes/london-calling.css.map +1 -1
- package/dist/themes/nanopore.css +1 -1
- package/dist/themes/nanopore.css.map +1 -1
- package/dist/types/components/alert/alert-interface.d.ts +1 -1
- package/dist/types/components/algolia/algolia-input.d.ts +1 -1
- package/dist/types/components/algolia/algolia.d.ts +2 -2
- package/dist/types/components/checkbox/checkbox-group.d.ts +11 -0
- package/dist/types/components/date-picker/date-picker-interface.d.ts +2 -2
- package/dist/types/components/date-picker/duet-date-picker/date-adapter.d.ts +3 -3
- package/dist/types/components/date-picker/duet-date-picker/date-localization.d.ts +3 -3
- package/dist/types/components/date-picker/duet-date-picker/date-picker-day.d.ts +1 -1
- package/dist/types/components/date-picker/duet-date-picker/date-picker-month.d.ts +1 -1
- package/dist/types/components/field-validator/field-validator-interface.d.ts +4 -4
- package/dist/types/components/file-upload/file-upload.d.ts +1 -1
- package/dist/types/components/global-nav/global-nav.d.ts +12 -6
- package/dist/types/components/icon/icon.d.ts +3 -3
- package/dist/types/components/menu/menu.d.ts +1 -1
- package/dist/types/components/nav-item/nav-item.d.ts +1 -1
- package/dist/types/components/range/range-interface.d.ts +2 -2
- package/dist/types/components/resize-observe/resize-observe.d.ts +1 -0
- package/dist/types/components/slides/slides-interface.d.ts +2 -2
- package/dist/types/components/slides/slides.d.ts +0 -2
- package/dist/types/components/table/table.cell.d.ts +1 -1
- package/dist/types/components/table/table.d.ts +9 -14
- package/dist/types/components/table/table.header.d.ts +1 -1
- package/dist/types/components/table/table.row.d.ts +2 -2
- package/dist/types/components/table/table.utils.d.ts +2 -1
- package/dist/types/components/tabs/tab-content.d.ts +2 -0
- package/dist/types/components.d.ts +829 -9
- package/dist/types/index.d.ts +5 -0
- package/dist/types/stencil-public-runtime.d.ts +48 -3
- package/dist/types/utils/dom.d.ts +9 -0
- package/dist/types/utils/gesture/index.d.ts +1 -1
- package/dist/types/utils/popover.d.ts +1 -1
- package/dist/types/utils/store/component-store.d.ts +2 -2
- package/dist/types/utils/testing/index.d.ts +1 -1
- package/docs-json.json +89 -50
- package/docs-vscode.json +8 -4
- package/hydrate/index.d.ts +853 -0
- package/{dist/custom-elements → hydrate}/index.js +11477 -7967
- package/hydrate/package.json +6 -0
- package/loader/index.d.ts +9 -0
- package/package.json +23 -15
- package/dist/cjs/component-store-d7c8c326.js.map +0 -1
- package/dist/cjs/dom-d7c33f11.js.map +0 -1
- package/dist/cjs/form-control-57c71246.js.map +0 -1
- package/dist/cjs/global-989678ec.js.map +0 -1
- package/dist/cjs/index-41582c2a.js.map +0 -1
- package/dist/cjs/index-75b61776.js +0 -1077
- package/dist/cjs/index-75b61776.js.map +0 -1
- package/dist/cjs/index-ece1cb9e.js.map +0 -1
- package/dist/cjs/modal-e4defcc3.js.map +0 -1
- package/dist/cjs/nano-table-56eb29c1.js.map +0 -1
- package/dist/cjs/popover-508bcedb.js.map +0 -1
- package/dist/cjs/table.worker-b1c53001.js.map +0 -1
- package/dist/cjs/theme-50275e1a.js.map +0 -1
- package/dist/components/index4.js.map +0 -1
- package/dist/custom-elements/index.d.ts +0 -339
- package/dist/custom-elements/index.js.map +0 -1
- package/dist/esm/component-store-ec512820.js.map +0 -1
- package/dist/esm/dom-d3ad49e2.js.map +0 -1
- package/dist/esm/form-control-84bac7a2.js.map +0 -1
- package/dist/esm/global-8047b4ff.js.map +0 -1
- package/dist/esm/index-3bbaffe4.js +0 -1075
- package/dist/esm/index-3bbaffe4.js.map +0 -1
- package/dist/esm/index-3c280603.js.map +0 -1
- package/dist/esm/index-dc076ea6.js +0 -649
- package/dist/esm/index-dc076ea6.js.map +0 -1
- package/dist/esm/modal-5c9ce466.js.map +0 -1
- package/dist/esm/nano-table-38f3c797.js.map +0 -1
- package/dist/esm/popover-e748bb61.js.map +0 -1
- package/dist/esm/table.worker-e57fffd8.js.map +0 -1
- package/dist/esm/theme-931bd452.js.map +0 -1
- package/dist/nano-components/p-0b29b22c.js +0 -5
- package/dist/nano-components/p-0b29b22c.js.map +0 -1
- package/dist/nano-components/p-135fed16.entry.js +0 -5
- package/dist/nano-components/p-135fed16.entry.js.map +0 -1
- package/dist/nano-components/p-151aad1e.entry.js.map +0 -1
- package/dist/nano-components/p-15543295.entry.js +0 -5
- package/dist/nano-components/p-15543295.entry.js.map +0 -1
- package/dist/nano-components/p-1a8e60c4.entry.js.map +0 -1
- package/dist/nano-components/p-1e709f87.entry.js.map +0 -1
- package/dist/nano-components/p-1f347342.entry.js +0 -5
- package/dist/nano-components/p-1f347342.entry.js.map +0 -1
- package/dist/nano-components/p-1fe12320.js +0 -6
- package/dist/nano-components/p-1fe12320.js.map +0 -1
- package/dist/nano-components/p-23575705.entry.js +0 -5
- package/dist/nano-components/p-23575705.entry.js.map +0 -1
- package/dist/nano-components/p-2828788c.js.map +0 -1
- package/dist/nano-components/p-284dd9a2.entry.js +0 -5
- package/dist/nano-components/p-284dd9a2.entry.js.map +0 -1
- package/dist/nano-components/p-2a97ef51.entry.js +0 -5
- package/dist/nano-components/p-2a97ef51.entry.js.map +0 -1
- package/dist/nano-components/p-36842a50.entry.js +0 -5
- package/dist/nano-components/p-36842a50.entry.js.map +0 -1
- package/dist/nano-components/p-3a1026d1.entry.js +0 -5
- package/dist/nano-components/p-3a1026d1.entry.js.map +0 -1
- package/dist/nano-components/p-3f25fc76.entry.js.map +0 -1
- package/dist/nano-components/p-41addb3a.entry.js +0 -5
- package/dist/nano-components/p-447a5910.entry.js.map +0 -1
- package/dist/nano-components/p-4b69178e.entry.js +0 -5
- package/dist/nano-components/p-4b69178e.entry.js.map +0 -1
- package/dist/nano-components/p-559a6492.entry.js +0 -5
- package/dist/nano-components/p-559a6492.entry.js.map +0 -1
- package/dist/nano-components/p-5d149792.entry.js +0 -5
- package/dist/nano-components/p-5d149792.entry.js.map +0 -1
- package/dist/nano-components/p-63834d50.js +0 -5
- package/dist/nano-components/p-63834d50.js.map +0 -1
- package/dist/nano-components/p-651b3264.js.map +0 -1
- package/dist/nano-components/p-69e5a37d.entry.js.map +0 -1
- package/dist/nano-components/p-6ad194e4.entry.js +0 -5
- package/dist/nano-components/p-6ad194e4.entry.js.map +0 -1
- package/dist/nano-components/p-6cb77d5c.entry.js +0 -5
- package/dist/nano-components/p-6cb77d5c.entry.js.map +0 -1
- package/dist/nano-components/p-77cad8d1.js +0 -5
- package/dist/nano-components/p-77cad8d1.js.map +0 -1
- package/dist/nano-components/p-793588d1.js +0 -5
- package/dist/nano-components/p-793588d1.js.map +0 -1
- package/dist/nano-components/p-7b3638b7.js +0 -5
- package/dist/nano-components/p-7b3638b7.js.map +0 -1
- package/dist/nano-components/p-807c2e92.entry.js +0 -5
- package/dist/nano-components/p-807c2e92.entry.js.map +0 -1
- package/dist/nano-components/p-845ae77e.js +0 -5
- package/dist/nano-components/p-845ae77e.js.map +0 -1
- package/dist/nano-components/p-885b6950.js.map +0 -1
- package/dist/nano-components/p-8d747891.js +0 -5
- package/dist/nano-components/p-8d747891.js.map +0 -1
- package/dist/nano-components/p-9059c8c1.entry.js +0 -5
- package/dist/nano-components/p-9059c8c1.entry.js.map +0 -1
- package/dist/nano-components/p-92504f7f.entry.js +0 -5
- package/dist/nano-components/p-92504f7f.entry.js.map +0 -1
- package/dist/nano-components/p-99fbae74.entry.js +0 -5
- package/dist/nano-components/p-99fbae74.entry.js.map +0 -1
- package/dist/nano-components/p-9a4297e1.entry.js +0 -5
- package/dist/nano-components/p-9a4297e1.entry.js.map +0 -1
- package/dist/nano-components/p-9eeed8f5.entry.js +0 -5
- package/dist/nano-components/p-9eeed8f5.entry.js.map +0 -1
- package/dist/nano-components/p-a0b93616.js.map +0 -1
- package/dist/nano-components/p-a183e3c7.entry.js +0 -5
- package/dist/nano-components/p-a183e3c7.entry.js.map +0 -1
- package/dist/nano-components/p-a2d0d7b9.entry.js.map +0 -1
- package/dist/nano-components/p-b25e79b8.entry.js +0 -5
- package/dist/nano-components/p-b25e79b8.entry.js.map +0 -1
- package/dist/nano-components/p-b40eedcb.entry.js.map +0 -1
- package/dist/nano-components/p-b55ffa92.entry.js +0 -5
- package/dist/nano-components/p-b55ffa92.entry.js.map +0 -1
- package/dist/nano-components/p-b87539f0.entry.js +0 -5
- package/dist/nano-components/p-b87539f0.entry.js.map +0 -1
- package/dist/nano-components/p-ba9cd047.entry.js +0 -5
- package/dist/nano-components/p-ba9cd047.entry.js.map +0 -1
- package/dist/nano-components/p-c9a7c7ea.js.map +0 -1
- package/dist/nano-components/p-cc5e7acb.entry.js +0 -5
- package/dist/nano-components/p-cc5e7acb.entry.js.map +0 -1
- package/dist/nano-components/p-d26b97d1.js +0 -5
- package/dist/nano-components/p-d26b97d1.js.map +0 -1
- package/dist/nano-components/p-d5303933.entry.js +0 -5
- package/dist/nano-components/p-d5303933.entry.js.map +0 -1
- package/dist/nano-components/p-d565991d.entry.js +0 -5
- package/dist/nano-components/p-d565991d.entry.js.map +0 -1
- package/dist/nano-components/p-dba8a88d.entry.js.map +0 -1
- package/dist/nano-components/p-dc50b93c.entry.js +0 -5
- package/dist/nano-components/p-dc50b93c.entry.js.map +0 -1
- package/dist/nano-components/p-e3860f00.js +0 -5
- package/dist/nano-components/p-e3860f00.js.map +0 -1
- package/dist/nano-components/p-e5408bc8.entry.js +0 -5
- package/dist/nano-components/p-e5408bc8.entry.js.map +0 -1
- package/dist/nano-components/p-ea2de992.js +0 -19
- package/dist/nano-components/p-ea2de992.js.map +0 -1
- package/dist/nano-components/p-f7471cca.entry.js +0 -5
- package/dist/nano-components/p-f7471cca.entry.js.map +0 -1
- package/dist/nano-components/p-fe94eeff.entry.js +0 -5
- package/dist/nano-components/p-fe94eeff.entry.js.map +0 -1
@@ -66,7 +66,15 @@ const uniqueTime = (key, measureText) => {
|
|
66
66
|
};
|
67
67
|
}
|
68
68
|
};
|
69
|
+
const CONTENT_REF_ID = 'r';
|
70
|
+
const ORG_LOCATION_ID = 'o';
|
71
|
+
const SLOT_NODE_ID = 's';
|
72
|
+
const TEXT_NODE_ID = 't';
|
73
|
+
const HYDRATE_ID = 's-id';
|
74
|
+
const HYDRATED_STYLE_ID = 'sty-id';
|
75
|
+
const HYDRATE_CHILD_ID = 'c-id';
|
69
76
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
77
|
+
const HYDRATED_SLOT_FALLBACK_ID = 'sf-id';
|
70
78
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
71
79
|
/**
|
72
80
|
* Default style mode id
|
@@ -82,6 +90,18 @@ const isComplexType = (o) => {
|
|
82
90
|
o = typeof o;
|
83
91
|
return o === 'object' || o === 'function';
|
84
92
|
};
|
93
|
+
/**
|
94
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
95
|
+
* out of a DOM's head.
|
96
|
+
*
|
97
|
+
* @param doc The DOM containing the `head` to query against
|
98
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
99
|
+
* exists or the tag has no content.
|
100
|
+
*/
|
101
|
+
function queryNonceMetaTagContent(doc) {
|
102
|
+
var _a, _b, _c;
|
103
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
104
|
+
}
|
85
105
|
/**
|
86
106
|
* Production h() function based on Preact by
|
87
107
|
* Jason Miller (@developit)
|
@@ -90,7 +110,6 @@ const isComplexType = (o) => {
|
|
90
110
|
*
|
91
111
|
* Modified for Stencil's compiler and vdom
|
92
112
|
*/
|
93
|
-
// const stack: any[] = [];
|
94
113
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
95
114
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
96
115
|
const h = (nodeName, vnodeData, ...children) => {
|
@@ -181,6 +200,13 @@ const newVNode = (tag, text) => {
|
|
181
200
|
};
|
182
201
|
const Host = {};
|
183
202
|
const isHost = (node) => node && node.$tag$ === Host;
|
203
|
+
/**
|
204
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
205
|
+
*
|
206
|
+
* Note that these functions convert from {@link d.VNode} to
|
207
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
208
|
+
* interface.
|
209
|
+
*/
|
184
210
|
const vdomFnUtils = {
|
185
211
|
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
186
212
|
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
@@ -212,394 +238,202 @@ const convertToPrivate = (node) => {
|
|
212
238
|
return vnode;
|
213
239
|
};
|
214
240
|
/**
|
215
|
-
*
|
216
|
-
*
|
217
|
-
*
|
218
|
-
*
|
219
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
220
|
-
* 2. the type stored from `propType`.
|
221
|
-
*
|
222
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
223
|
-
*
|
224
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
225
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
226
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
227
|
-
* ```tsx
|
228
|
-
* <my-cmp prop-val={0}></my-cmp>
|
229
|
-
* ```
|
230
|
-
*
|
231
|
-
* HTML prop values on the other hand, will always a string
|
232
|
-
*
|
233
|
-
* @param propValue the new value to coerce to some type
|
234
|
-
* @param propType the type of the prop, expressed as a binary number
|
235
|
-
* @returns the parsed/coerced value
|
241
|
+
* Show or hide a slot nodes children
|
242
|
+
* @param slotNode a slot node, the 'children' of which should be shown or hidden
|
243
|
+
* @param hide whether to hide the slot node 'children'
|
244
|
+
* @returns
|
236
245
|
*/
|
237
|
-
const
|
238
|
-
//
|
239
|
-
if (
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
246
|
+
const renderSlotFallbackContent = (slotNode, hide) => {
|
247
|
+
// if this slot doesn't have fallback content, return
|
248
|
+
if (!slotNode['s-hsf'])
|
249
|
+
return;
|
250
|
+
// in non-shadow component, slot nodes are just empty text nodes or comment nodes
|
251
|
+
// the 'children' nodes are therefore placed next to it.
|
252
|
+
// let's loop through those now
|
253
|
+
let childNodes = (slotNode.parentNode.__childNodes ||
|
254
|
+
slotNode.parentNode.childNodes);
|
255
|
+
let childNode;
|
256
|
+
const childNodesLen = childNodes.length;
|
257
|
+
let i = 0;
|
258
|
+
for (i; i < childNodesLen; i++) {
|
259
|
+
childNode = childNodes[i];
|
260
|
+
if (childNode['s-sr'] && hide && childNode['s-psn'] === slotNode['s-sn']) {
|
261
|
+
// if this child node is a nested slot
|
262
|
+
// drill into it's children to hide them in-turn
|
263
|
+
renderSlotFallbackContent(childNode, true);
|
264
|
+
continue;
|
244
265
|
}
|
245
|
-
|
246
|
-
|
247
|
-
|
266
|
+
// this child node doesn't relate to this slot?
|
267
|
+
if (childNode['s-sn'] !== slotNode['s-sn'])
|
268
|
+
continue;
|
269
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */ && childNode['s-sf']) {
|
270
|
+
// we found an fallback element. Hide or show
|
271
|
+
childNode.hidden = hide;
|
272
|
+
childNode.style.display = hide ? 'none' : '';
|
248
273
|
}
|
249
|
-
if (
|
250
|
-
//
|
251
|
-
|
252
|
-
|
274
|
+
else if (!!childNode['s-sfc']) {
|
275
|
+
// this child has fallback text. Add or remove it
|
276
|
+
if (hide) {
|
277
|
+
childNode['s-sfc'] = childNode.textContent || undefined;
|
278
|
+
childNode.textContent = '';
|
279
|
+
}
|
280
|
+
else if (!childNode.textContent || childNode.textContent.trim() === '') {
|
281
|
+
childNode.textContent = childNode['s-sfc'];
|
282
|
+
}
|
253
283
|
}
|
254
|
-
// redundant return here for better minification
|
255
|
-
return propValue;
|
256
284
|
}
|
257
|
-
// not sure exactly what type we want
|
258
|
-
// so no need to change to a different type
|
259
|
-
return propValue;
|
260
|
-
};
|
261
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
262
|
-
const createEvent = (ref, name, flags) => {
|
263
|
-
const elm = getElement(ref);
|
264
|
-
return {
|
265
|
-
emit: (detail) => {
|
266
|
-
return emitEvent(elm, name, {
|
267
|
-
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
268
|
-
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
269
|
-
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
270
|
-
detail,
|
271
|
-
});
|
272
|
-
},
|
273
|
-
};
|
274
285
|
};
|
275
286
|
/**
|
276
|
-
*
|
277
|
-
*
|
278
|
-
*
|
279
|
-
* @param
|
280
|
-
* @returns the custom Event
|
287
|
+
* Function applied to non-shadow component nodes to mimic native shadowDom behaviour:
|
288
|
+
* - When slotted node/s are not present, show `<slot>` node children
|
289
|
+
* - When slotted node/s *are* present, hide `<slot>` node children
|
290
|
+
* @param node an entry whose children to iterate over
|
281
291
|
*/
|
282
|
-
const
|
283
|
-
const
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
let
|
290
|
-
|
291
|
-
|
292
|
-
if (
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
styleElm = doc.createElement('style');
|
322
|
-
styleElm.innerHTML = style;
|
292
|
+
const updateFallbackSlotVisibility = (node) => {
|
293
|
+
const childNodes = node.__childNodes || node.childNodes;
|
294
|
+
let slotNode;
|
295
|
+
let i;
|
296
|
+
let ilen;
|
297
|
+
let j;
|
298
|
+
let slotNameAttr;
|
299
|
+
let nodeType;
|
300
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
301
|
+
// slot reference node?
|
302
|
+
if (childNodes[i]['s-sr']) {
|
303
|
+
// this component uses slots and we're on a slot node
|
304
|
+
// let's find all it's slotted children or lack thereof
|
305
|
+
// and show or hide fallback nodes (`<slot />` children)
|
306
|
+
// get the slot name for this slot reference node
|
307
|
+
slotNameAttr = childNodes[i]['s-sn'];
|
308
|
+
slotNode = childNodes[i];
|
309
|
+
// by default always show a fallback slot node
|
310
|
+
// then hide it if there are other slotted nodes in the light dom
|
311
|
+
renderSlotFallbackContent(slotNode, false);
|
312
|
+
// because we found a slot fallback node let's loop over all
|
313
|
+
// the children again to
|
314
|
+
for (j = 0; j < ilen; j++) {
|
315
|
+
nodeType = childNodes[j].nodeType;
|
316
|
+
// ignore slot fallback nodes
|
317
|
+
if (childNodes[j]['s-sf'])
|
318
|
+
continue;
|
319
|
+
// is sibling node is from a different component OR is a named fallback slot node?
|
320
|
+
if (childNodes[j]['s-hn'] !== slotNode['s-hn'] || slotNameAttr !== '') {
|
321
|
+
// you can't slot a textNode in a named slot
|
322
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j]['s-sn']) {
|
323
|
+
// we found a slotted element!
|
324
|
+
// let's hide all the fallback nodes
|
325
|
+
renderSlotFallbackContent(slotNode, true);
|
326
|
+
// patches this node's removal methods
|
327
|
+
// so if it gets removed in the future
|
328
|
+
// re-asses the fallback node status
|
329
|
+
patchRemove(childNodes[j]);
|
330
|
+
break;
|
323
331
|
}
|
324
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
325
332
|
}
|
326
|
-
if (
|
327
|
-
|
333
|
+
else if (childNodes[j]['s-sn'] === slotNameAttr) {
|
334
|
+
// this is a default fallback slot node
|
335
|
+
// any element or text node (with content)
|
336
|
+
// should hide the default fallback slot node
|
337
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
338
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ &&
|
339
|
+
childNodes[j] &&
|
340
|
+
childNodes[j].textContent &&
|
341
|
+
childNodes[j].textContent.trim() !== '')) {
|
342
|
+
// we found a slotted something
|
343
|
+
// let's hide all the fallback nodes
|
344
|
+
renderSlotFallbackContent(slotNode, true);
|
345
|
+
// patches this node's removal methods
|
346
|
+
// so if it gets removed in the future
|
347
|
+
// re-asses the fallback node status
|
348
|
+
patchRemove(childNodes[j]);
|
349
|
+
break;
|
350
|
+
}
|
328
351
|
}
|
329
352
|
}
|
330
353
|
}
|
331
|
-
|
332
|
-
|
333
|
-
}
|
354
|
+
// keep drilling down
|
355
|
+
updateFallbackSlotVisibility(childNodes[i]);
|
334
356
|
}
|
335
|
-
return scopeId;
|
336
357
|
};
|
337
|
-
const
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
// DOM WRITE!!
|
351
|
-
elm['s-sc'] = scopeId;
|
352
|
-
elm.classList.add(scopeId + '-h');
|
353
|
-
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
354
|
-
elm.classList.add(scopeId + '-s');
|
355
|
-
}
|
356
|
-
}
|
357
|
-
endAttachStyles();
|
358
|
+
const patchPseudoShadowDom = (HostElementPrototype) => {
|
359
|
+
patchChildNodes(HostElementPrototype);
|
360
|
+
patchInsertBefore(HostElementPrototype);
|
361
|
+
patchAppendChild(HostElementPrototype);
|
362
|
+
patchAppend(HostElementPrototype);
|
363
|
+
patchPrepend(HostElementPrototype);
|
364
|
+
patchInsertAdjacentHTML(HostElementPrototype);
|
365
|
+
patchInsertAdjacentText(HostElementPrototype);
|
366
|
+
patchInsertAdjacentElement(HostElementPrototype);
|
367
|
+
patchReplaceChildren(HostElementPrototype);
|
368
|
+
patchInnerHTML(HostElementPrototype);
|
369
|
+
patchInnerText(HostElementPrototype);
|
370
|
+
patchTextContent(HostElementPrototype);
|
358
371
|
};
|
359
|
-
|
372
|
+
////// non-shadow host component patches
|
360
373
|
/**
|
361
|
-
*
|
362
|
-
*
|
363
|
-
* Licensed under the MIT License
|
364
|
-
* https://github.com/developit/preact/blob/master/LICENSE
|
365
|
-
*
|
366
|
-
* Modified for Stencil's compiler and vdom
|
374
|
+
* Patch `cloneNode()` for non-shadow components ()
|
375
|
+
* @param HostElementPrototype the host prototype to polyfill
|
367
376
|
*/
|
368
|
-
const
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
377
|
+
const patchCloneNode = (HostElementPrototype) => {
|
378
|
+
HostElementPrototype.__cloneNode = HostElementPrototype.cloneNode;
|
379
|
+
HostElementPrototype.cloneNode = function (deep) {
|
380
|
+
const srcNode = this;
|
381
|
+
const clonedNode = HostElementPrototype.__cloneNode.call(srcNode, false);
|
382
|
+
if (deep) {
|
383
|
+
let i = 0;
|
384
|
+
let slotted, nonStencilNode;
|
385
|
+
const stencilPrivates = [
|
386
|
+
's-id',
|
387
|
+
's-cr',
|
388
|
+
's-lr',
|
389
|
+
's-rc',
|
390
|
+
's-sc',
|
391
|
+
's-p',
|
392
|
+
's-cn',
|
393
|
+
's-sr',
|
394
|
+
's-sn',
|
395
|
+
's-hn',
|
396
|
+
's-ol',
|
397
|
+
's-nr',
|
398
|
+
's-si',
|
399
|
+
's-sf',
|
400
|
+
's-sfc',
|
401
|
+
's-hsf',
|
402
|
+
];
|
403
|
+
for (; i < srcNode.__childNodes.length; i++) {
|
404
|
+
slotted = srcNode.__childNodes[i]['s-nr'];
|
405
|
+
nonStencilNode = stencilPrivates.every((privateField) => !srcNode.__childNodes[i][privateField]);
|
406
|
+
if (slotted) {
|
407
|
+
clonedNode.__appendChild(slotted.cloneNode(true));
|
391
408
|
}
|
392
|
-
|
393
|
-
|
394
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
395
|
-
if (prop.includes('-')) {
|
396
|
-
elm.style.setProperty(prop, newValue[prop]);
|
397
|
-
}
|
398
|
-
else {
|
399
|
-
elm.style[prop] = newValue[prop];
|
400
|
-
}
|
401
|
-
}
|
402
|
-
}
|
403
|
-
}
|
404
|
-
else if (memberName === 'key')
|
405
|
-
;
|
406
|
-
else if (memberName === 'ref') {
|
407
|
-
// minifier will clean this up
|
408
|
-
if (newValue) {
|
409
|
-
newValue(elm);
|
410
|
-
}
|
411
|
-
}
|
412
|
-
else if ((!isProp ) &&
|
413
|
-
memberName[0] === 'o' &&
|
414
|
-
memberName[1] === 'n') {
|
415
|
-
// Event Handlers
|
416
|
-
// so if the member name starts with "on" and the 3rd characters is
|
417
|
-
// a capital letter, and it's not already a member on the element,
|
418
|
-
// then we're assuming it's an event listener
|
419
|
-
if (memberName[2] === '-') {
|
420
|
-
// on- prefixed events
|
421
|
-
// allows to be explicit about the dom event to listen without any magic
|
422
|
-
// under the hood:
|
423
|
-
// <my-cmp on-click> // listens for "click"
|
424
|
-
// <my-cmp on-Click> // listens for "Click"
|
425
|
-
// <my-cmp on-ionChange> // listens for "ionChange"
|
426
|
-
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
427
|
-
memberName = memberName.slice(3);
|
428
|
-
}
|
429
|
-
else if (isMemberInElement(win, ln)) {
|
430
|
-
// standard event
|
431
|
-
// the JSX attribute could have been "onMouseOver" and the
|
432
|
-
// member name "onmouseover" is on the window's prototype
|
433
|
-
// so let's add the listener "mouseover", which is all lowercased
|
434
|
-
memberName = ln.slice(2);
|
435
|
-
}
|
436
|
-
else {
|
437
|
-
// custom event
|
438
|
-
// the JSX attribute could have been "onMyCustomEvent"
|
439
|
-
// so let's trim off the "on" prefix and lowercase the first character
|
440
|
-
// and add the listener "myCustomEvent"
|
441
|
-
// except for the first character, we keep the event name case
|
442
|
-
memberName = ln[2] + memberName.slice(3);
|
443
|
-
}
|
444
|
-
if (oldValue) {
|
445
|
-
plt.rel(elm, memberName, oldValue, false);
|
446
|
-
}
|
447
|
-
if (newValue) {
|
448
|
-
plt.ael(elm, memberName, newValue, false);
|
449
|
-
}
|
450
|
-
}
|
451
|
-
else {
|
452
|
-
// Set property if it exists and it's not a SVG
|
453
|
-
const isComplex = isComplexType(newValue);
|
454
|
-
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
455
|
-
try {
|
456
|
-
if (!elm.tagName.includes('-')) {
|
457
|
-
const n = newValue == null ? '' : newValue;
|
458
|
-
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
459
|
-
if (memberName === 'list') {
|
460
|
-
isProp = false;
|
461
|
-
}
|
462
|
-
else if (oldValue == null || elm[memberName] != n) {
|
463
|
-
elm[memberName] = n;
|
464
|
-
}
|
465
|
-
}
|
466
|
-
else {
|
467
|
-
elm[memberName] = newValue;
|
468
|
-
}
|
469
|
-
}
|
470
|
-
catch (e) { }
|
471
|
-
}
|
472
|
-
/**
|
473
|
-
* Need to manually update attribute if:
|
474
|
-
* - memberName is not an attribute
|
475
|
-
* - if we are rendering the host element in order to reflect attribute
|
476
|
-
* - if it's a SVG, since properties might not work in <svg>
|
477
|
-
* - if the newValue is null/undefined or 'false'.
|
478
|
-
*/
|
479
|
-
let xlink = false;
|
480
|
-
{
|
481
|
-
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
482
|
-
memberName = ln;
|
483
|
-
xlink = true;
|
484
|
-
}
|
485
|
-
}
|
486
|
-
if (newValue == null || newValue === false) {
|
487
|
-
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
488
|
-
if (xlink) {
|
489
|
-
elm.removeAttributeNS(XLINK_NS, memberName);
|
490
|
-
}
|
491
|
-
else {
|
492
|
-
elm.removeAttribute(memberName);
|
493
|
-
}
|
494
|
-
}
|
495
|
-
}
|
496
|
-
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
497
|
-
newValue = newValue === true ? '' : newValue;
|
498
|
-
if (xlink) {
|
499
|
-
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
500
|
-
}
|
501
|
-
else {
|
502
|
-
elm.setAttribute(memberName, newValue);
|
503
|
-
}
|
504
|
-
}
|
505
|
-
}
|
506
|
-
}
|
507
|
-
};
|
508
|
-
const parseClassListRegex = /\s/;
|
509
|
-
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
510
|
-
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
511
|
-
// if the element passed in is a shadow root, which is a document fragment
|
512
|
-
// then we want to be adding attrs/props to the shadow root's "host" element
|
513
|
-
// if it's not a shadow root, then we add attrs/props to the same element
|
514
|
-
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
515
|
-
? newVnode.$elm$.host
|
516
|
-
: newVnode.$elm$;
|
517
|
-
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
518
|
-
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
519
|
-
{
|
520
|
-
// remove attributes no longer present on the vnode by setting them to undefined
|
521
|
-
for (memberName in oldVnodeAttrs) {
|
522
|
-
if (!(memberName in newVnodeAttrs)) {
|
523
|
-
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
524
|
-
}
|
525
|
-
}
|
526
|
-
}
|
527
|
-
// add new & update changed attributes
|
528
|
-
for (memberName in newVnodeAttrs) {
|
529
|
-
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
530
|
-
}
|
531
|
-
};
|
532
|
-
/**
|
533
|
-
* Polyfills `cloneNode()` for slot polyfilled components ()
|
534
|
-
* @param HostElementPrototype the host prototype to polyfill
|
535
|
-
*/
|
536
|
-
const patchCloneNode = (HostElementPrototype) => {
|
537
|
-
const orgCloneNode = HostElementPrototype.cloneNode;
|
538
|
-
HostElementPrototype.cloneNode = function (deep) {
|
539
|
-
const srcNode = this;
|
540
|
-
const clonedNode = orgCloneNode.call(srcNode, false);
|
541
|
-
if (deep) {
|
542
|
-
let i = 0;
|
543
|
-
let slotted, nonStencilNode;
|
544
|
-
const stencilPrivates = [
|
545
|
-
's-id',
|
546
|
-
's-cr',
|
547
|
-
's-lr',
|
548
|
-
's-rc',
|
549
|
-
's-sc',
|
550
|
-
's-p',
|
551
|
-
's-cn',
|
552
|
-
's-sr',
|
553
|
-
's-sn',
|
554
|
-
's-hn',
|
555
|
-
's-ol',
|
556
|
-
's-nr',
|
557
|
-
's-si',
|
558
|
-
's-sf',
|
559
|
-
's-sfc',
|
560
|
-
's-hsf',
|
561
|
-
];
|
562
|
-
for (; i < srcNode.__childNodes.length; i++) {
|
563
|
-
slotted = srcNode.__childNodes[i]['s-nr'];
|
564
|
-
nonStencilNode = stencilPrivates.every((privateField) => !srcNode.__childNodes[i][privateField]);
|
565
|
-
if (slotted) {
|
566
|
-
clonedNode.__appendChild(slotted.cloneNode(true));
|
567
|
-
}
|
568
|
-
if (nonStencilNode) {
|
569
|
-
clonedNode.__appendChild(srcNode.__childNodes[i].cloneNode(true));
|
409
|
+
if (nonStencilNode) {
|
410
|
+
clonedNode.__appendChild(srcNode.__childNodes[i].cloneNode(true));
|
570
411
|
}
|
571
412
|
}
|
572
413
|
}
|
573
414
|
return clonedNode;
|
574
415
|
};
|
575
416
|
};
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
patchSlotReplaceChildren(HostElementPrototype);
|
585
|
-
patchSlotInnerHTML(HostElementPrototype);
|
586
|
-
patchSlotInnerText(HostElementPrototype);
|
587
|
-
patchTextContent(HostElementPrototype);
|
588
|
-
patchNodeRemoveChild(HostElementPrototype);
|
589
|
-
};
|
590
|
-
const patchChildSlotNodes = (HostElementPrototype) => {
|
417
|
+
/**
|
418
|
+
* Patches children accessors of a non-shadow component.
|
419
|
+
* (`childNodes`, `children`, `firstChild`, `lastChild` and `childElementCount`)
|
420
|
+
* @param HostElementPrototype
|
421
|
+
*/
|
422
|
+
const patchChildNodes = (HostElementPrototype) => {
|
423
|
+
if (!globalThis.Node)
|
424
|
+
return;
|
591
425
|
class FakeNodeList extends Array {
|
592
426
|
item(n) {
|
593
427
|
return this[n];
|
594
428
|
}
|
595
429
|
}
|
596
|
-
|
430
|
+
let childNodesDesc = Object.getOwnPropertyDescriptor(Node.prototype, 'childNodes');
|
431
|
+
if (!childNodesDesc) {
|
432
|
+
childNodesDesc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Node.prototype), 'childNodes');
|
433
|
+
}
|
597
434
|
if (childNodesDesc)
|
598
435
|
Object.defineProperty(HostElementPrototype, '__childNodes', childNodesDesc);
|
599
436
|
let childrenDesc = Object.getOwnPropertyDescriptor(Element.prototype, 'children');
|
600
|
-
// on IE it's on HTMLElement.prototype
|
601
|
-
if (!childrenDesc)
|
602
|
-
childrenDesc = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'children');
|
603
437
|
// MockNode won't have these
|
604
438
|
if (childrenDesc)
|
605
439
|
Object.defineProperty(HostElementPrototype, '__children', childrenDesc);
|
@@ -610,7 +444,7 @@ const patchChildSlotNodes = (HostElementPrototype) => {
|
|
610
444
|
get() {
|
611
445
|
return this.childNodes
|
612
446
|
.map((n) => {
|
613
|
-
if (n.nodeType === 1)
|
447
|
+
if (n.nodeType === 1 /* NODE_TYPE.ElementNode */)
|
614
448
|
return n;
|
615
449
|
else
|
616
450
|
return null;
|
@@ -618,6 +452,16 @@ const patchChildSlotNodes = (HostElementPrototype) => {
|
|
618
452
|
.filter((n) => !!n);
|
619
453
|
},
|
620
454
|
});
|
455
|
+
Object.defineProperty(HostElementPrototype, 'firstChild', {
|
456
|
+
get() {
|
457
|
+
return this.childNodes[0];
|
458
|
+
},
|
459
|
+
});
|
460
|
+
Object.defineProperty(HostElementPrototype, 'lastChild', {
|
461
|
+
get() {
|
462
|
+
return this.childNodes[this.childNodes.length - 1];
|
463
|
+
},
|
464
|
+
});
|
621
465
|
Object.defineProperty(HostElementPrototype, 'childElementCount', {
|
622
466
|
get() {
|
623
467
|
return HostElementPrototype.children.length;
|
@@ -630,16 +474,23 @@ const patchChildSlotNodes = (HostElementPrototype) => {
|
|
630
474
|
const childNodes = this.__childNodes;
|
631
475
|
const result = new FakeNodeList();
|
632
476
|
for (let i = 0; i < childNodes.length; i++) {
|
633
|
-
const
|
634
|
-
if (
|
635
|
-
|
477
|
+
const slottedNode = childNodes[i]['s-nr'];
|
478
|
+
if (slottedNode &&
|
479
|
+
(slottedNode.nodeType !== 8 /* NODE_TYPE.CommentNode */ || slottedNode.nodeValue.indexOf(ORG_LOCATION_ID + '.') !== 0)) {
|
480
|
+
result.push(slottedNode);
|
636
481
|
}
|
637
482
|
}
|
638
483
|
return result;
|
639
484
|
},
|
640
485
|
});
|
641
486
|
};
|
642
|
-
|
487
|
+
/**
|
488
|
+
* Patches the inner html accessors of a non-shadow component
|
489
|
+
* @param HostElementPrototype the host `Element` to be patched
|
490
|
+
*/
|
491
|
+
const patchInnerHTML = (HostElementPrototype) => {
|
492
|
+
if (!globalThis.Element)
|
493
|
+
return;
|
643
494
|
let descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML');
|
644
495
|
// on IE it's on HTMLElement.prototype
|
645
496
|
if (!descriptor)
|
@@ -663,7 +514,13 @@ const patchSlotInnerHTML = (HostElementPrototype) => {
|
|
663
514
|
},
|
664
515
|
});
|
665
516
|
};
|
666
|
-
|
517
|
+
/**
|
518
|
+
* Patches the inner text accessors of a non-shadow component
|
519
|
+
* @param HostElementPrototype the host `Element` to be patched
|
520
|
+
*/
|
521
|
+
const patchInnerText = (HostElementPrototype) => {
|
522
|
+
if (!globalThis.Element)
|
523
|
+
return;
|
667
524
|
let descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'innerText');
|
668
525
|
// on IE it's on HTMLElement.prototype
|
669
526
|
if (!descriptor)
|
@@ -693,10 +550,12 @@ const patchSlotInnerText = (HostElementPrototype) => {
|
|
693
550
|
});
|
694
551
|
};
|
695
552
|
/**
|
696
|
-
* Patches the text content accessors of a
|
553
|
+
* Patches the text content accessors of a non-shadow component
|
697
554
|
* @param HostElementPrototype the host `Element` to be patched
|
698
555
|
*/
|
699
556
|
const patchTextContent = (HostElementPrototype) => {
|
557
|
+
if (!globalThis.Node)
|
558
|
+
return;
|
700
559
|
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
|
701
560
|
// MockNode won't have these
|
702
561
|
if (descriptor)
|
@@ -717,66 +576,88 @@ const patchTextContent = (HostElementPrototype) => {
|
|
717
576
|
},
|
718
577
|
});
|
719
578
|
};
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
}
|
729
|
-
return this.__remove();
|
730
|
-
};
|
731
|
-
};
|
732
|
-
const patchNodeRemoveChild = (ElementPrototype) => {
|
733
|
-
if (!ElementPrototype || ElementPrototype.__removeChild)
|
579
|
+
/**
|
580
|
+
* Patches the `insertBefore` of a non-shadow component.
|
581
|
+
* The problem solved being that the 'current' node to insert before may not be in the root of our component.
|
582
|
+
* This tries to find where the 'current' node lives within the component and insert the new node before it
|
583
|
+
* @param HostElementPrototype the host `Element` to be patched
|
584
|
+
*/
|
585
|
+
const patchInsertBefore = (HostElementPrototype) => {
|
586
|
+
if (HostElementPrototype.__insertBefore)
|
734
587
|
return;
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
588
|
+
HostElementPrototype.__insertBefore = HostElementPrototype.insertBefore;
|
589
|
+
HostElementPrototype.insertBefore = function (newChild, curChild) {
|
590
|
+
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
591
|
+
const slotNode = getHostSlotNode(this.__childNodes, slotName);
|
592
|
+
if (slotNode) {
|
593
|
+
let found = false;
|
594
|
+
this.childNodes.forEach((childNode) => {
|
595
|
+
// we found the node in our list of other 'lightDOM' / slotted nodes
|
596
|
+
if (childNode === curChild || curChild === null) {
|
597
|
+
found = true;
|
598
|
+
addSlotRelocateNode(newChild, slotNode);
|
599
|
+
if (curChild === null) {
|
600
|
+
this.__append(newChild);
|
601
|
+
return;
|
602
|
+
}
|
603
|
+
if (slotName === curChild['s-sn']) {
|
604
|
+
// current child ('slot before' node) is 'in' the same slot
|
605
|
+
const insertBefore = curChild.parentNode.__insertBefore || curChild.parentNode.insertBefore;
|
606
|
+
insertBefore.call(curChild.parentNode, newChild, curChild);
|
607
|
+
patchRemove(newChild);
|
608
|
+
}
|
609
|
+
else {
|
610
|
+
// current child is not in the same slot as 'slot before' node
|
611
|
+
// so just toss the node in wherever
|
612
|
+
this.__append(newChild);
|
613
|
+
}
|
614
|
+
return;
|
615
|
+
}
|
616
|
+
});
|
617
|
+
if (found) {
|
618
|
+
return newChild;
|
742
619
|
}
|
743
|
-
return;
|
744
620
|
}
|
745
|
-
return this.
|
621
|
+
return this.__insertBefore(newChild, curChild);
|
746
622
|
};
|
747
623
|
};
|
748
|
-
|
624
|
+
/**
|
625
|
+
* Patches the `appendChild` method of a non-shadow component
|
626
|
+
* @param HostElementPrototype the host `Element` to be patched
|
627
|
+
*/
|
628
|
+
const patchAppendChild = (HostElementPrototype) => {
|
749
629
|
if (HostElementPrototype.__appendChild)
|
750
630
|
return;
|
751
631
|
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
752
632
|
HostElementPrototype.appendChild = function (newChild) {
|
753
633
|
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
754
|
-
const slotNode = getHostSlotNode(this.__childNodes, slotName);
|
634
|
+
const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, slotName);
|
755
635
|
if (slotNode) {
|
756
|
-
|
757
|
-
|
758
|
-
if (slotNode['s-cr'] && slotNode['s-cr'].parentNode) {
|
759
|
-
slotNode['s-cr'].parentNode.__appendChild(slotPlaceholder);
|
760
|
-
}
|
761
|
-
newChild['s-ol'] = slotPlaceholder;
|
762
|
-
patchNodeRemove(newChild);
|
763
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
636
|
+
addSlotRelocateNode(newChild, slotNode);
|
637
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode);
|
764
638
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
765
639
|
if (appendAfter.parentNode) {
|
766
|
-
appendAfter.parentNode
|
640
|
+
const parent = appendAfter.parentNode;
|
641
|
+
parent.__insertBefore
|
642
|
+
? parent.__insertBefore(newChild, appendAfter.nextSibling)
|
643
|
+
: parent.insertBefore(newChild, appendAfter.nextSibling);
|
644
|
+
patchRemove(newChild);
|
767
645
|
}
|
768
|
-
patchNodeRemoveChild(newChild.parentNode);
|
769
646
|
if (slotNode['s-hsf']) {
|
770
647
|
updateFallbackSlotVisibility(slotNode.parentNode);
|
771
648
|
}
|
772
|
-
return;
|
649
|
+
return newChild;
|
773
650
|
}
|
774
|
-
if (newChild.nodeType === 1 && !!newChild.getAttribute('slot') && this.__childNodes)
|
651
|
+
if (newChild.nodeType === 1 /* NODE_TYPE.ElementNode */ && !!newChild.getAttribute('slot') && this.__childNodes)
|
775
652
|
newChild.hidden = true;
|
776
653
|
return this.__appendChild(newChild);
|
777
654
|
};
|
778
655
|
};
|
779
|
-
|
656
|
+
/**
|
657
|
+
* Patches the `prepend` method of a non-shadow component
|
658
|
+
* @param HostElementPrototype the host `Element` to be patched
|
659
|
+
*/
|
660
|
+
const patchPrepend = (HostElementPrototype) => {
|
780
661
|
if (HostElementPrototype.__prepend)
|
781
662
|
return;
|
782
663
|
HostElementPrototype.__prepend = HostElementPrototype.prepend;
|
@@ -788,31 +669,29 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
788
669
|
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
789
670
|
const slotNode = getHostSlotNode(this.__childNodes, slotName);
|
790
671
|
if (slotNode) {
|
791
|
-
|
792
|
-
|
793
|
-
if (slotNode['s-cr'] && slotNode['s-cr'].parentNode) {
|
794
|
-
slotNode['s-cr'].parentNode.__appendChild(slotPlaceholder);
|
795
|
-
}
|
796
|
-
newChild['s-ol'] = slotPlaceholder;
|
797
|
-
patchNodeRemove(newChild);
|
798
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
672
|
+
addSlotRelocateNode(newChild, slotNode);
|
673
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode);
|
799
674
|
const appendAfter = slotChildNodes[0];
|
800
675
|
if (appendAfter.parentNode) {
|
801
676
|
appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
|
677
|
+
patchRemove(newChild);
|
802
678
|
}
|
803
|
-
patchNodeRemoveChild(newChild.parentNode);
|
804
679
|
if (slotNode['s-hsf']) {
|
805
680
|
updateFallbackSlotVisibility(slotNode.parentNode);
|
806
681
|
}
|
807
682
|
return;
|
808
683
|
}
|
809
|
-
if (newChild.nodeType === 1 && !!newChild.getAttribute('slot') && this.__childNodes)
|
684
|
+
if (newChild.nodeType === 1 /* NODE_TYPE.ElementNode */ && !!newChild.getAttribute('slot') && this.__childNodes)
|
810
685
|
newChild.hidden = true;
|
811
686
|
return this.__prepend(newChild);
|
812
687
|
});
|
813
688
|
};
|
814
689
|
};
|
815
|
-
|
690
|
+
/**
|
691
|
+
* Patches the `append` method of a non-shadow component
|
692
|
+
* @param HostElementPrototype the host `Element` to be patched
|
693
|
+
*/
|
694
|
+
const patchAppend = (HostElementPrototype) => {
|
816
695
|
if (HostElementPrototype.__append)
|
817
696
|
return;
|
818
697
|
HostElementPrototype.__append = HostElementPrototype.append;
|
@@ -825,14 +704,18 @@ const patchSlotAppend = (HostElementPrototype) => {
|
|
825
704
|
});
|
826
705
|
};
|
827
706
|
};
|
828
|
-
|
707
|
+
/**
|
708
|
+
* Patches the `replaceChildren` method of a non-shadow component
|
709
|
+
* @param HostElementPrototype the host `Element` to be patched
|
710
|
+
*/
|
711
|
+
const patchReplaceChildren = (HostElementPrototype) => {
|
829
712
|
if (HostElementPrototype.__replaceChildren)
|
830
713
|
return;
|
831
714
|
HostElementPrototype.__replaceChildren = HostElementPrototype.replaceChildren;
|
832
715
|
HostElementPrototype.replaceChildren = function (...newChildren) {
|
833
716
|
const slotNode = getHostSlotNode(this.__childNodes, '');
|
834
717
|
if (slotNode) {
|
835
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode
|
718
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode);
|
836
719
|
slotChildNodes.forEach((node) => {
|
837
720
|
if (!node['s-sr']) {
|
838
721
|
node.remove();
|
@@ -842,7 +725,11 @@ const patchSlotReplaceChildren = (HostElementPrototype) => {
|
|
842
725
|
}
|
843
726
|
};
|
844
727
|
};
|
845
|
-
|
728
|
+
/**
|
729
|
+
* Patches the `insertAdjacentHTML` method of a non-shadow component
|
730
|
+
* @param HostElementPrototype the host `Element` to be patched
|
731
|
+
*/
|
732
|
+
const patchInsertAdjacentHTML = (HostElementPrototype) => {
|
846
733
|
if (HostElementPrototype.__insertAdjacentHTML)
|
847
734
|
return;
|
848
735
|
HostElementPrototype.__insertAdjacentHTML = HostElementPrototype.insertAdjacentHTML;
|
@@ -865,7 +752,11 @@ const patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
|
|
865
752
|
}
|
866
753
|
};
|
867
754
|
};
|
868
|
-
|
755
|
+
/**
|
756
|
+
* Patches the `insertAdjacentText` method of a non-shadow component
|
757
|
+
* @param HostElementPrototype the host `Element` to be patched
|
758
|
+
*/
|
759
|
+
const patchInsertAdjacentText = (HostElementPrototype) => {
|
869
760
|
if (HostElementPrototype.__insertAdjacentText)
|
870
761
|
return;
|
871
762
|
HostElementPrototype.__insertAdjacentText = HostElementPrototype.insertAdjacentText;
|
@@ -873,7 +764,11 @@ const patchSlotInsertAdjacentText = (HostElementPrototype) => {
|
|
873
764
|
this.insertAdjacentHTML(position, text);
|
874
765
|
};
|
875
766
|
};
|
876
|
-
|
767
|
+
/**
|
768
|
+
* Patches the `insertAdjacentElement` method of a non-shadow component
|
769
|
+
* @param HostElementPrototype the host `Element` to be patched
|
770
|
+
*/
|
771
|
+
const patchInsertAdjacentElement = (HostElementPrototype) => {
|
877
772
|
if (HostElementPrototype.__insertAdjacentElement)
|
878
773
|
return;
|
879
774
|
HostElementPrototype.__insertAdjacentElement = HostElementPrototype.insertAdjacentElement;
|
@@ -889,110 +784,1072 @@ const patchSlotInsertAdjacentElement = (HostElementPrototype) => {
|
|
889
784
|
}
|
890
785
|
};
|
891
786
|
};
|
892
|
-
|
787
|
+
////// Slotted node patches
|
893
788
|
/**
|
894
|
-
*
|
895
|
-
*
|
896
|
-
* @param
|
897
|
-
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
789
|
+
* Patches sibling accessors (`nextSibling`, `nextSiblingElement`, `previousSibling`, `previousSiblingElement`)
|
790
|
+
* of a 'slotted' node within a non-shadow component.
|
791
|
+
* @param NodePrototype the slotted node to be patched
|
898
792
|
*/
|
899
|
-
const
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
793
|
+
const patchNextPrev = (NodePrototype) => {
|
794
|
+
// Especially relevant when rendering components via SSR.
|
795
|
+
// Frameworks will often try to reconcile their VDOM with the real DOM
|
796
|
+
// by stepping through nodes with 'nextSibling' (and similar).
|
797
|
+
// This works with a shadowDOM; the lightDOM matches the framework's VDOM.
|
798
|
+
// This doesn't work without shadowDOM
|
799
|
+
if (!NodePrototype || NodePrototype.__nextSibling || !globalThis.Node)
|
800
|
+
return;
|
801
|
+
patchNextSibling(NodePrototype);
|
802
|
+
patchPreviousSibling(NodePrototype);
|
803
|
+
patchNextElementSibling(NodePrototype);
|
804
|
+
patchPreviousElementSibling(NodePrototype);
|
805
|
+
};
|
806
|
+
/**
|
807
|
+
* Patches the `nextSibling` accessor of a non-shadow slotted node
|
808
|
+
* @param NodePrototype the slotted node to be patched
|
809
|
+
*/
|
810
|
+
const patchNextSibling = (NodePrototype) => {
|
811
|
+
if (!NodePrototype || NodePrototype.__nextSibling)
|
812
|
+
return;
|
813
|
+
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'nextSibling');
|
814
|
+
// MockNode might not have these
|
815
|
+
if (descriptor)
|
816
|
+
Object.defineProperty(NodePrototype, '__nextSibling', descriptor);
|
817
|
+
else {
|
818
|
+
NodePrototype.__nextSibling = NodePrototype.nextSibling || true;
|
819
|
+
}
|
820
|
+
Object.defineProperty(NodePrototype, 'nextSibling', {
|
821
|
+
get: function () {
|
822
|
+
var _a;
|
823
|
+
const parentNodes = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.childNodes;
|
824
|
+
const index = parentNodes === null || parentNodes === void 0 ? void 0 : parentNodes.indexOf(this);
|
825
|
+
if (parentNodes && index > -1) {
|
826
|
+
return parentNodes[index + 1];
|
827
|
+
}
|
828
|
+
return this.__nextSibling;
|
829
|
+
},
|
830
|
+
});
|
831
|
+
};
|
832
|
+
/**
|
833
|
+
* Patches the `nextElementSibling` accessor of a non-shadow slotted node
|
834
|
+
* @param NodePrototype the slotted node to be patched
|
835
|
+
*/
|
836
|
+
const patchNextElementSibling = (ElementPrototype) => {
|
837
|
+
if (!ElementPrototype || ElementPrototype.__nextElementSibling || !ElementPrototype.nextSiblingElement)
|
838
|
+
return;
|
839
|
+
const descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'nextElementSibling');
|
840
|
+
// MockNode won't have these
|
841
|
+
if (descriptor)
|
842
|
+
Object.defineProperty(ElementPrototype, '__nextElementSibling', descriptor);
|
843
|
+
else {
|
844
|
+
ElementPrototype.__nextElementSibling = ElementPrototype.nextSiblingElement || true;
|
845
|
+
}
|
846
|
+
Object.defineProperty(ElementPrototype, 'nextElementSibling', {
|
847
|
+
get: function () {
|
848
|
+
var _a;
|
849
|
+
const parentEles = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.children;
|
850
|
+
const index = parentEles === null || parentEles === void 0 ? void 0 : parentEles.indexOf(this);
|
851
|
+
if (parentEles && index > -1) {
|
852
|
+
return parentEles[index + 1];
|
853
|
+
}
|
854
|
+
return this.__nextElementSibling;
|
855
|
+
},
|
856
|
+
});
|
857
|
+
};
|
858
|
+
/**
|
859
|
+
* Patches the `previousSibling` accessor of a non-shadow slotted node
|
860
|
+
* @param NodePrototype the slotted node to be patched
|
861
|
+
*/
|
862
|
+
const patchPreviousSibling = (NodePrototype) => {
|
863
|
+
if (!NodePrototype || NodePrototype.__previousSibling)
|
864
|
+
return;
|
865
|
+
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'previousSibling');
|
866
|
+
// MockNode won't have these
|
867
|
+
if (descriptor)
|
868
|
+
Object.defineProperty(NodePrototype, '__previousSibling', descriptor);
|
869
|
+
else {
|
870
|
+
NodePrototype.__previousSibling = NodePrototype.previousSibling || true;
|
871
|
+
}
|
872
|
+
Object.defineProperty(NodePrototype, 'previousSibling', {
|
873
|
+
get: function () {
|
874
|
+
var _a;
|
875
|
+
const parentNodes = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.childNodes;
|
876
|
+
const index = parentNodes === null || parentNodes === void 0 ? void 0 : parentNodes.indexOf(this);
|
877
|
+
if (parentNodes && index > -1) {
|
878
|
+
return parentNodes[index - 1];
|
879
|
+
}
|
880
|
+
return this.__previousSibling;
|
881
|
+
},
|
882
|
+
});
|
883
|
+
};
|
884
|
+
/**
|
885
|
+
* Patches the `previousElementSibling` accessor of a non-shadow slotted node
|
886
|
+
* @param ElementPrototype the slotted node to be patched
|
887
|
+
*/
|
888
|
+
const patchPreviousElementSibling = (ElementPrototype) => {
|
889
|
+
if (!ElementPrototype || ElementPrototype.__previousElementSibling || !ElementPrototype.previousElementSibling)
|
890
|
+
return;
|
891
|
+
const descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'previousElementSibling');
|
892
|
+
// MockNode won't have these
|
893
|
+
if (descriptor)
|
894
|
+
Object.defineProperty(ElementPrototype, '__previousElementSibling', descriptor);
|
895
|
+
else {
|
896
|
+
ElementPrototype.__previousElementSibling = ElementPrototype.previousSiblingElement || true;
|
897
|
+
}
|
898
|
+
Object.defineProperty(ElementPrototype, 'previousElementSibling', {
|
899
|
+
get: function () {
|
900
|
+
var _a;
|
901
|
+
const parentNodes = (_a = this['s-ol']) === null || _a === void 0 ? void 0 : _a.parentNode.children;
|
902
|
+
const index = parentNodes === null || parentNodes === void 0 ? void 0 : parentNodes.indexOf(this);
|
903
|
+
if (parentNodes && index > -1) {
|
904
|
+
return parentNodes[index - 1];
|
905
|
+
}
|
906
|
+
return this.__previousElementSibling;
|
907
|
+
},
|
908
|
+
});
|
909
|
+
};
|
910
|
+
/**
|
911
|
+
* Patches the `remove` method of a non-shadow slotted node
|
912
|
+
* @param NodePrototype the slotted node to be patched
|
913
|
+
*/
|
914
|
+
const patchRemove = (NodePrototype) => {
|
915
|
+
if (!NodePrototype || NodePrototype.__remove)
|
916
|
+
return;
|
917
|
+
NodePrototype.__remove = NodePrototype.remove || true;
|
918
|
+
patchRemoveChild(NodePrototype.parentNode);
|
919
|
+
NodePrototype.remove = function () {
|
920
|
+
if (this.parentNode) {
|
921
|
+
return this.parentNode.removeChild(this);
|
922
|
+
}
|
923
|
+
return this.__remove();
|
924
|
+
};
|
925
|
+
};
|
926
|
+
/**
|
927
|
+
* Patches the `removeChild` method of a non-shadow slotted node
|
928
|
+
* @param NodePrototype the slotted node to be patched
|
929
|
+
*/
|
930
|
+
const patchRemoveChild = (ElementPrototype) => {
|
931
|
+
if (!ElementPrototype || ElementPrototype.__removeChild)
|
932
|
+
return;
|
933
|
+
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
934
|
+
ElementPrototype.removeChild = function (toRemove) {
|
935
|
+
if (toRemove && typeof toRemove['s-sn'] !== 'undefined') {
|
936
|
+
const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, toRemove['s-sn']);
|
937
|
+
toRemove.parentElement.__removeChild(toRemove);
|
938
|
+
if (slotNode && slotNode['s-hsf']) {
|
939
|
+
updateFallbackSlotVisibility(slotNode.parentElement);
|
940
|
+
}
|
941
|
+
return;
|
942
|
+
}
|
943
|
+
return this.__removeChild(toRemove);
|
944
|
+
};
|
945
|
+
};
|
946
|
+
////// Utils
|
947
|
+
/**
|
948
|
+
* When non-shadow component VDom re-renders,
|
949
|
+
* they sometimes need a place to temporarily put their 'lightDOM' elements.
|
950
|
+
* This function creates that node.
|
951
|
+
* @param newChild - A node that's going to be added to the component
|
952
|
+
* @param slotNode - The slot node that the node will be added to
|
953
|
+
*/
|
954
|
+
const addSlotRelocateNode = (newChild, slotNode) => {
|
955
|
+
if (newChild['s-ol'] && newChild['s-ol'].isConnected)
|
956
|
+
return;
|
957
|
+
const slotPlaceholder = document.createTextNode('');
|
958
|
+
slotPlaceholder['s-nr'] = newChild;
|
959
|
+
if (slotNode['s-cr'] && slotNode['s-cr'].parentNode) {
|
960
|
+
const appendChild = slotNode['s-cr'].parentNode.__appendChild || slotNode['s-cr'].parentNode.appendChild;
|
961
|
+
appendChild.call(slotNode['s-cr'].parentNode, slotPlaceholder);
|
962
|
+
}
|
963
|
+
newChild['s-ol'] = slotPlaceholder;
|
964
|
+
};
|
965
|
+
/**
|
966
|
+
* Find the slot name of a given node
|
967
|
+
* @param node
|
968
|
+
* @returns the node's slot name
|
969
|
+
*/
|
970
|
+
const getSlotName = (node) => node['s-sn'] ||
|
971
|
+
(node.nodeType === 1 /* NODE_TYPE.ElementNode */ && node.getAttribute('slot')) ||
|
972
|
+
node.slot ||
|
973
|
+
'';
|
974
|
+
/**
|
975
|
+
* Recursively searches a series of child nodes for a slot with the provided name.
|
976
|
+
* @param childNodes the nodes to search for a slot with a specific name.
|
977
|
+
* @param slotName the name of the slot to match on.
|
978
|
+
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
979
|
+
*/
|
980
|
+
const getHostSlotNode = (childNodes, slotName) => {
|
981
|
+
let i = 0;
|
982
|
+
let childNode;
|
983
|
+
if (!childNodes)
|
984
|
+
return null;
|
985
|
+
for (; i < childNodes.length; i++) {
|
986
|
+
childNode = childNodes[i];
|
987
|
+
if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
|
988
|
+
return childNode;
|
989
|
+
}
|
990
|
+
childNode = getHostSlotNode(childNode.childNodes, slotName);
|
991
|
+
if (childNode) {
|
992
|
+
return childNode;
|
993
|
+
}
|
994
|
+
}
|
995
|
+
return null;
|
996
|
+
};
|
997
|
+
/**
|
998
|
+
* Get all nodes currently assigned to any given slot node
|
999
|
+
* @param slotNode - the slot node to check
|
1000
|
+
* @returns - all child node 'within' the checked slot node
|
1001
|
+
*/
|
1002
|
+
const getHostSlotChildNodes = (slotNode) => {
|
1003
|
+
const childNodes = [slotNode];
|
1004
|
+
const slotName = slotNode['s-sn'] || '';
|
1005
|
+
while ((slotNode = slotNode.nextSibling) && slotNode['s-sn'] === slotName) {
|
1006
|
+
childNodes.push(slotNode);
|
1007
|
+
}
|
1008
|
+
return childNodes;
|
1009
|
+
};
|
1010
|
+
/**
|
1011
|
+
* Takes an SSR rendered document, as annotated by 'vdom-annotations.ts' and:
|
1012
|
+
* 1) Recreate an accurate VDOM tree to reconcile with during 'vdom-render.ts'
|
1013
|
+
* (a failure to do so will result in DOM nodes being duplicated when rendering)
|
1014
|
+
* 2) Add `shadow: true` DOM trees to their document-fragment
|
1015
|
+
* 3) Move slotted nodes out of shadowDOMs
|
1016
|
+
* 4) Add meta nodes to non-shadow DOMs and their 'slotted' nodes
|
1017
|
+
*
|
1018
|
+
* @param hostElm - the current custom element being hydrated
|
1019
|
+
* @param tagName - the custom element's tag
|
1020
|
+
* @param hostId - a unique custom element id
|
1021
|
+
* @param hostRef - the VNode representing this custom element
|
1022
|
+
*/
|
1023
|
+
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
1024
|
+
const endHydrate = createTime('hydrateClient', tagName);
|
1025
|
+
const shadowRoot = hostElm.shadowRoot;
|
1026
|
+
const childRenderNodes = [];
|
1027
|
+
const slotNodes = [];
|
1028
|
+
const slottedNodes = [];
|
1029
|
+
const shadowRootNodes = shadowRoot ? [] : null;
|
1030
|
+
let vnode = newVNode(tagName, null);
|
1031
|
+
vnode.$elm$ = hostElm;
|
1032
|
+
if (!plt.$orgLocNodes$) {
|
1033
|
+
// this is the first pass over of this whole document
|
1034
|
+
// does a quick scrape to construct a 'bare-bones' tree of
|
1035
|
+
// what elements we have and where content has been moved from
|
1036
|
+
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
1037
|
+
}
|
1038
|
+
hostElm[HYDRATE_ID] = hostId;
|
1039
|
+
hostElm.removeAttribute(HYDRATE_ID);
|
1040
|
+
hostRef.$vnode$ = clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId, slottedNodes);
|
1041
|
+
let crIndex = 0;
|
1042
|
+
const crLength = childRenderNodes.length;
|
1043
|
+
let childRenderNode;
|
1044
|
+
// Steps through childNodes we found.
|
1045
|
+
// If moved from an original location (by nature of being rendered in SSR markup)
|
1046
|
+
// we might be able to move it back there now,
|
1047
|
+
// so slotted nodes don't get added to internal shadowDOMs
|
1048
|
+
for (crIndex; crIndex < crLength; crIndex++) {
|
1049
|
+
childRenderNode = childRenderNodes[crIndex];
|
1050
|
+
const orgLocationId = childRenderNode.$hostId$ + '.' + childRenderNode.$nodeId$;
|
1051
|
+
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
1052
|
+
const node = childRenderNode.$elm$;
|
1053
|
+
if (!shadowRoot) {
|
1054
|
+
node['s-hn'] = tagName.toUpperCase();
|
1055
|
+
if (childRenderNode.$tag$ === 'slot') {
|
1056
|
+
// if this is a 'mock slot'
|
1057
|
+
// add it's content position reference now.
|
1058
|
+
// otherwise vdom-render will try to add nodes to it
|
1059
|
+
// (it's a comment node so will error)
|
1060
|
+
node['s-cr'] = hostElm['s-cr'];
|
1061
|
+
}
|
1062
|
+
}
|
1063
|
+
if (orgLocationNode && orgLocationNode.isConnected) {
|
1064
|
+
if (shadowRoot && orgLocationNode['s-en'] === '') {
|
1065
|
+
// if this node is within a shadowDOM, with an original location home
|
1066
|
+
// we're safe to move it now
|
1067
|
+
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
1068
|
+
}
|
1069
|
+
// Remove original location comment now regardless:
|
1070
|
+
// 1) Stops SSR frameworks complaining about mismatches
|
1071
|
+
// 2) is un-required for non-shadow, slotted nodes as
|
1072
|
+
// we'll add all the meta nodes we need when we deal with *all* slotted nodes ↓↓↓
|
1073
|
+
orgLocationNode.parentNode.removeChild(orgLocationNode);
|
1074
|
+
}
|
1075
|
+
// remove the original location from the map
|
1076
|
+
plt.$orgLocNodes$.delete(orgLocationId);
|
1077
|
+
}
|
1078
|
+
const hosts = [];
|
1079
|
+
let snIndex = 0;
|
1080
|
+
const snLen = slottedNodes.length;
|
1081
|
+
let slotGroup;
|
1082
|
+
let snGroupIdx;
|
1083
|
+
let snGroupLen;
|
1084
|
+
let slottedItem;
|
1085
|
+
// Loops through all the slotted nodes we found while
|
1086
|
+
// stepping through this component
|
1087
|
+
for (snIndex; snIndex < snLen; snIndex++) {
|
1088
|
+
slotGroup = slottedNodes[snIndex];
|
1089
|
+
if (!slotGroup || !slotGroup.length)
|
1090
|
+
continue;
|
1091
|
+
snGroupLen = slotGroup.length;
|
1092
|
+
snGroupIdx = 0;
|
1093
|
+
for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
|
1094
|
+
slottedItem = slotGroup[snGroupIdx];
|
1095
|
+
if (!hosts[slottedItem.hostId]) {
|
1096
|
+
// cache this host for other grouped slotted nodes
|
1097
|
+
hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
|
1098
|
+
}
|
1099
|
+
// this shouldn't happen
|
1100
|
+
// as we collect all the custom elements first in `initializeDocumentHydrate`
|
1101
|
+
if (!hosts[slottedItem.hostId])
|
1102
|
+
continue;
|
1103
|
+
const hostEle = hosts[slottedItem.hostId];
|
1104
|
+
// this node is either slotted in a non-shadow host, OR
|
1105
|
+
// *that* host is nested in a non-shadow host
|
1106
|
+
if (!hostEle.shadowRoot || !shadowRoot) {
|
1107
|
+
// try to set an appropriate content position reference
|
1108
|
+
// (CR) node for this host element
|
1109
|
+
// a CR already set on the host?
|
1110
|
+
slottedItem.slot['s-cr'] = hostEle['s-cr'];
|
1111
|
+
if (!slottedItem.slot['s-cr'] && hostEle.shadowRoot) {
|
1112
|
+
// host is shadowDOM - just use the host itself as the CR for native slotting
|
1113
|
+
slottedItem.slot['s-cr'] = hostEle;
|
1114
|
+
}
|
1115
|
+
else {
|
1116
|
+
// if all else fails - just set the CR as the first child
|
1117
|
+
// (9/10 if node['s-cr'] hasn't been set, the node will be at the element root)
|
1118
|
+
const hostChildren = hostEle.__childNodes || hostEle.childNodes;
|
1119
|
+
slottedItem.slot['s-cr'] = hostChildren[0];
|
1120
|
+
}
|
1121
|
+
// create our original location node
|
1122
|
+
addSlotRelocateNode(slottedItem.node, slottedItem.slot);
|
1123
|
+
// patch this node for accessors like `nextSibling` (et al)
|
1124
|
+
patchNextPrev(slottedItem.node);
|
1125
|
+
}
|
1126
|
+
if (hostEle.shadowRoot) {
|
1127
|
+
// shadowDOM - move the item to the element root for
|
1128
|
+
// native slotting
|
1129
|
+
hostEle.appendChild(slottedItem.node);
|
1130
|
+
}
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
if (shadowRoot) {
|
1134
|
+
// add all the root nodes in the shadowDOM
|
1135
|
+
// (a root node can have a whole nested DOM tree)
|
1136
|
+
let rnIdex = 0;
|
1137
|
+
const rnLen = shadowRootNodes.length;
|
1138
|
+
for (rnIdex; rnIdex < rnLen; rnIdex++) {
|
1139
|
+
shadowRoot.appendChild(shadowRootNodes[rnIdex]);
|
1140
|
+
}
|
1141
|
+
// tidy up left-over / unnecessary comments to stop
|
1142
|
+
// frameworks complaining about DOM mismatches
|
1143
|
+
Array.from(hostElm.childNodes).forEach((node) => {
|
1144
|
+
if (node.nodeType === 8 /* NODE_TYPE.CommentNode */ && typeof node['s-sn'] !== 'string') {
|
1145
|
+
node.parentNode.removeChild(node);
|
1146
|
+
}
|
1147
|
+
});
|
1148
|
+
}
|
1149
|
+
hostRef.$hostElement$ = hostElm;
|
1150
|
+
endHydrate();
|
1151
|
+
};
|
1152
|
+
/**
|
1153
|
+
* Recursively step through a nodes' SSR DOM.
|
1154
|
+
* Constructs a VDOM. Finds and adds nodes to master arrays
|
1155
|
+
* (`childRenderNodes`, `shadowRootNodes` and `slottedNodes`)
|
1156
|
+
* these are used later for special consideration:
|
1157
|
+
* - Add `shadow: true` DOM trees to their document-fragment
|
1158
|
+
* - Move slotted nodes out of shadowDOMs
|
1159
|
+
* - Add meta nodes to non-shadow DOMs and their 'slotted' nodes
|
1160
|
+
* @param parentVNode - this nodes current parent vnode
|
1161
|
+
* @param childRenderNodes - flat array of all child vnodes
|
1162
|
+
* @param slotNodes - nodes that represent an element's `<slot />`s
|
1163
|
+
* @param shadowRootNodes - nodes that are at the root of this hydrating element
|
1164
|
+
* @param hostElm - the root, hydrating element
|
1165
|
+
* @param node - the node currently being iterated over
|
1166
|
+
* @param hostId - the root, hydrating element id
|
1167
|
+
* @param slottedNodes - nodes that have been slotted
|
1168
|
+
* @returns - the constructed VNode
|
1169
|
+
*/
|
1170
|
+
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
|
1171
|
+
let childNodeType;
|
1172
|
+
let childIdSplt;
|
1173
|
+
let childVNode;
|
1174
|
+
let i;
|
1175
|
+
const scopeId = hostElm['s-sc'];
|
1176
|
+
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1177
|
+
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
1178
|
+
if (childNodeType) {
|
1179
|
+
// got the node data from the element's attribute
|
1180
|
+
// `${hostId}.${nodeId}.${depth}.${index}`
|
1181
|
+
childIdSplt = childNodeType.split('.');
|
1182
|
+
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
1183
|
+
childVNode = createSimpleVNode({
|
1184
|
+
$hostId$: childIdSplt[0],
|
1185
|
+
$nodeId$: childIdSplt[1],
|
1186
|
+
$depth$: childIdSplt[2],
|
1187
|
+
$index$: childIdSplt[3],
|
1188
|
+
$tag$: node.tagName.toLowerCase(),
|
1189
|
+
$elm$: node,
|
1190
|
+
// if we don't add the initial classes to the VNode,
|
1191
|
+
// the first vdom-render patch / reconciliation will fail;
|
1192
|
+
// any client side change before componentDidLoad will be ignored,
|
1193
|
+
// `setAccessor` will just take the element's initial classes
|
1194
|
+
$attrs$: { class: node.className },
|
1195
|
+
});
|
1196
|
+
childRenderNodes.push(childVNode);
|
1197
|
+
node.removeAttribute(HYDRATE_CHILD_ID);
|
1198
|
+
// this is a new child vnode
|
1199
|
+
// so ensure it's parent vnode has the vchildren array
|
1200
|
+
if (!parentVNode.$children$) {
|
1201
|
+
parentVNode.$children$ = [];
|
1202
|
+
}
|
1203
|
+
// test if this element was 'slotted'
|
1204
|
+
// recreate node attributes
|
1205
|
+
const slotName = childVNode.$elm$.getAttribute('s-sn');
|
1206
|
+
if (typeof slotName === 'string') {
|
1207
|
+
childVNode.$elm$['s-sn'] = slotName;
|
1208
|
+
childVNode.$elm$.removeAttribute('s-sn');
|
1209
|
+
}
|
1210
|
+
// test if this node is the child (a slot fallback node) of a slot
|
1211
|
+
const slotFbId = childVNode.$elm$.getAttribute(HYDRATED_SLOT_FALLBACK_ID);
|
1212
|
+
if (slotFbId) {
|
1213
|
+
childVNode.$elm$.removeAttribute(HYDRATED_SLOT_FALLBACK_ID);
|
1214
|
+
// find the relevant slot node
|
1215
|
+
const slotNode = slotNodes.find((slot) => (slot.$elm$['s-sn'] === childVNode.$elm$['s-sn'] || slot.$name$ === childVNode.$elm$['s-sn']));
|
1216
|
+
// add the relationship to the VDOM to stop re-renders
|
1217
|
+
if (slotNode) {
|
1218
|
+
childVNode.$elm$['s-sf'] = true;
|
1219
|
+
childVNode.$elm$['s-hn'] = hostElm.tagName;
|
1220
|
+
slotNode.$children$ = slotNode.$children$ || [];
|
1221
|
+
slotNode.$children$[childVNode.$index$] = childVNode;
|
1222
|
+
// if the slot is an actual `<slot>`
|
1223
|
+
// that's a newly created node (↓↓↓)
|
1224
|
+
// move this element there now
|
1225
|
+
if (slotNode.$elm$.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1226
|
+
slotNode.$elm$.appendChild(childVNode.$elm$);
|
1227
|
+
}
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
else if (childVNode.$index$ !== undefined) {
|
1231
|
+
// add our child vnode to a specific index of the vnode's children
|
1232
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
1233
|
+
}
|
1234
|
+
// host is `scoped: true` - add that flag to child.
|
1235
|
+
// used in 'setAccessor' to make sure our scoped class is present
|
1236
|
+
if (scopeId)
|
1237
|
+
node['s-si'] = scopeId;
|
1238
|
+
// this is now the new parent vnode for all the next child checks
|
1239
|
+
parentVNode = childVNode;
|
1240
|
+
if (shadowRootNodes &&
|
1241
|
+
childVNode.$depth$ === '0' &&
|
1242
|
+
// don't move slot fallback node into the root nodes array
|
1243
|
+
// they'll be moved into a new slot element ↓↓↓
|
1244
|
+
!slotFbId) {
|
1245
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
1246
|
+
}
|
1247
|
+
}
|
1248
|
+
}
|
1249
|
+
// recursively drill down, end to start so we can
|
1250
|
+
// construct a VDOM and add meta to nodes
|
1251
|
+
const nonShadowChildNodes = node.__childNodes || node.childNodes;
|
1252
|
+
for (i = nonShadowChildNodes.length - 1; i >= 0; i--) {
|
1253
|
+
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, nonShadowChildNodes[i], hostId, slottedNodes);
|
1254
|
+
}
|
1255
|
+
if (node.shadowRoot) {
|
1256
|
+
// keep drilling down through the shadow root nodes
|
1257
|
+
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
1258
|
+
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId, slottedNodes);
|
1259
|
+
}
|
1260
|
+
}
|
1261
|
+
}
|
1262
|
+
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
1263
|
+
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}.${isSlotFallbackText}.${slotName}`
|
1264
|
+
childIdSplt = node.nodeValue.split('.');
|
1265
|
+
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
1266
|
+
// comment node for either the host id or a 0 host id
|
1267
|
+
childNodeType = childIdSplt[0];
|
1268
|
+
childVNode = createSimpleVNode({
|
1269
|
+
$hostId$: childIdSplt[1],
|
1270
|
+
$nodeId$: childIdSplt[2],
|
1271
|
+
$depth$: childIdSplt[3],
|
1272
|
+
$index$: childIdSplt[4] || '0',
|
1273
|
+
$elm$: node,
|
1274
|
+
});
|
1275
|
+
if (childNodeType === TEXT_NODE_ID) {
|
1276
|
+
let textNode = childVNode.$elm$ = node.nextSibling;
|
1277
|
+
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
1278
|
+
childVNode.$text$ = childVNode.$elm$.textContent;
|
1279
|
+
childRenderNodes.push(childVNode);
|
1280
|
+
// remove the text comment since it's no longer needed
|
1281
|
+
node.remove();
|
1282
|
+
// test to see if this is slot fallback text
|
1283
|
+
if (childIdSplt[5] === '1') {
|
1284
|
+
textNode['s-sf'] = true;
|
1285
|
+
textNode['s-sn'] = childIdSplt[6] || '';
|
1286
|
+
textNode['s-sfc'] = textNode.textContent;
|
1287
|
+
textNode['s-hn'] = hostElm.tagName;
|
1288
|
+
// find the relevant slot node
|
1289
|
+
const slotNode = slotNodes.find((slot) => (slot.$elm$['s-sn'] === textNode['s-sn'] || slot.$name$ === textNode['s-sn']));
|
1290
|
+
// add the relationship to the VDOM to stop re-renders
|
1291
|
+
if (slotNode) {
|
1292
|
+
slotNode.$children$ = slotNode.$children$ || [];
|
1293
|
+
slotNode.$children$[childVNode.$index$] = childVNode;
|
1294
|
+
// if the slot is an actual `<slot>`
|
1295
|
+
// that's a newly created node (↓↓↓)
|
1296
|
+
// move this text node there now
|
1297
|
+
if (slotNode.$elm$.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1298
|
+
slotNode.$elm$.appendChild(textNode);
|
1299
|
+
}
|
1300
|
+
}
|
1301
|
+
}
|
1302
|
+
else {
|
1303
|
+
// check to make sure this node actually belongs to this host.
|
1304
|
+
// If it was slotted from another component, we don't want to add it
|
1305
|
+
// to this host's vdom; it can be removed on render reconciliation.
|
1306
|
+
// We want slotting logic to take care of it
|
1307
|
+
if (hostId === childVNode.$hostId$) {
|
1308
|
+
if (!parentVNode.$children$) {
|
1309
|
+
parentVNode.$children$ = [];
|
1310
|
+
}
|
1311
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
1312
|
+
}
|
1313
|
+
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
1314
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
1315
|
+
}
|
1316
|
+
}
|
1317
|
+
}
|
1318
|
+
}
|
1319
|
+
else if (childVNode.$hostId$ === hostId) {
|
1320
|
+
// this comment node is specifically for this host id
|
1321
|
+
if (childNodeType === SLOT_NODE_ID) {
|
1322
|
+
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}.${hasSlotFallback}.${slotFallbackText}`;
|
1323
|
+
childVNode.$tag$ = 'slot';
|
1324
|
+
// TODO: this is clunky.
|
1325
|
+
// Clear out parent VNode attrs so the initial element state is used as a reference.
|
1326
|
+
// The reason: this is a slot container element and requires special scope classes
|
1327
|
+
// This does mean any class changes client-side before 'componentDidLoad',
|
1328
|
+
// will not be respected.
|
1329
|
+
parentVNode.$attrs$ = undefined;
|
1330
|
+
// add slot name
|
1331
|
+
const slotName = (node['s-sn'] = childVNode.$name$ = childIdSplt[5] || '');
|
1332
|
+
node['s-sr'] = true;
|
1333
|
+
// this slot node has fallback nodes?
|
1334
|
+
if (childIdSplt[6] === '1') {
|
1335
|
+
node['s-hsf'] = true;
|
1336
|
+
}
|
1337
|
+
if (childIdSplt[7] === '1') {
|
1338
|
+
// this slot has fallback text
|
1339
|
+
// it should be held in the previous comment node
|
1340
|
+
// (white-space depending)
|
1341
|
+
let foundFallbackText = node.previousSibling;
|
1342
|
+
while (!!foundFallbackText && foundFallbackText.nodeType !== 8 /* NODE_TYPE.CommentNode */) {
|
1343
|
+
foundFallbackText = foundFallbackText.previousSibling;
|
1344
|
+
}
|
1345
|
+
// this slot node has fallback text?
|
1346
|
+
// (if so, the previous node comment will have that text)
|
1347
|
+
node['s-sfc'] = foundFallbackText.nodeValue;
|
1348
|
+
}
|
1349
|
+
// find this slots' current host parent as dictated by the vdom tree.
|
1350
|
+
// this is important because where it is now in the constructed SSR markup
|
1351
|
+
// might be different to where to should be
|
1352
|
+
const parentNodeId = (parentVNode === null || parentVNode === void 0 ? void 0 : parentVNode.$elm$)
|
1353
|
+
? parentVNode.$elm$['s-id'] || parentVNode.$elm$.getAttribute('s-id')
|
1354
|
+
: '';
|
1355
|
+
if (shadowRootNodes) {
|
1356
|
+
/* SHADOW */
|
1357
|
+
// browser supports shadowRoot and this is a shadow dom component
|
1358
|
+
// create an actual slot element
|
1359
|
+
const slot = (childVNode.$elm$ = doc.createElement(childVNode.$tag$));
|
1360
|
+
if (childVNode.$name$) {
|
1361
|
+
// add the slot name attribute
|
1362
|
+
childVNode.$elm$.setAttribute('name', slotName);
|
1363
|
+
}
|
1364
|
+
if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
|
1365
|
+
// shadow component's slot is placed inside a nested component's shadowDOM;
|
1366
|
+
// it doesn't belong to this host - it was forwarded by the SSR markup.
|
1367
|
+
// Insert it in the root of this host; it's lightDOM.
|
1368
|
+
// It doesn't really matter where in the host root; the component will take care of it.
|
1369
|
+
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
1370
|
+
}
|
1371
|
+
else {
|
1372
|
+
// insert the new slot element before the slot comment
|
1373
|
+
node.parentNode.insertBefore(childVNode.$elm$, node);
|
1374
|
+
}
|
1375
|
+
addSlottedNodes(slottedNodes, childIdSplt[2], slotName, node, childVNode.$hostId$);
|
1376
|
+
// remove the slot comment since it's not needed for shadow
|
1377
|
+
node.remove();
|
1378
|
+
if (childVNode.$depth$ === '0') {
|
1379
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
1380
|
+
}
|
1381
|
+
}
|
1382
|
+
else {
|
1383
|
+
/* NON-SHADOW */
|
1384
|
+
const slot = childVNode.$elm$;
|
1385
|
+
// test to see if this non-shadow component's mock 'slot' is placed
|
1386
|
+
// inside a nested component's shadowDOM. If so, it doesn't belong here;
|
1387
|
+
// it was forwarded by the SSR markup. So we'll insert it into the root of this host;
|
1388
|
+
// it's lightDOM with accompanying 'slotted' nodes
|
1389
|
+
const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
|
1390
|
+
// attempt to find any mock slotted nodes which we'll move later
|
1391
|
+
addSlottedNodes(slottedNodes, childIdSplt[2], slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
|
1392
|
+
if (shouldMove) {
|
1393
|
+
// move slot comment node (to after any other comment nodes)
|
1394
|
+
parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
|
1395
|
+
}
|
1396
|
+
childRenderNodes.push(childVNode);
|
1397
|
+
}
|
1398
|
+
slotNodes.push(childVNode);
|
1399
|
+
if (!parentVNode.$children$) {
|
1400
|
+
parentVNode.$children$ = [];
|
1401
|
+
}
|
1402
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
1403
|
+
}
|
1404
|
+
else if (childNodeType === CONTENT_REF_ID) {
|
1405
|
+
// `${CONTENT_REF_ID}.${hostId}`;
|
1406
|
+
if (shadowRootNodes) {
|
1407
|
+
// remove the content ref comment since it's not needed for shadow
|
1408
|
+
node.remove();
|
1409
|
+
}
|
1410
|
+
else {
|
1411
|
+
hostElm['s-cr'] = node;
|
1412
|
+
node['s-cn'] = true;
|
1413
|
+
}
|
1414
|
+
}
|
1415
|
+
}
|
1416
|
+
}
|
1417
|
+
}
|
1418
|
+
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
1419
|
+
const vnode = newVNode(null, node.textContent);
|
1420
|
+
vnode.$elm$ = node;
|
1421
|
+
vnode.$index$ = '0';
|
1422
|
+
parentVNode.$children$ = [vnode];
|
1423
|
+
}
|
1424
|
+
return parentVNode;
|
1425
|
+
};
|
1426
|
+
/**
|
1427
|
+
* Skims whole SSR document to create
|
1428
|
+
* a map of component IDs and 'original location ID's.
|
1429
|
+
* original location ID's are derived from comment nodes placed by 'vdom-annotations.ts'.
|
1430
|
+
* They relate to lightDOM nodes that were moved deeper into the SSR markup.
|
1431
|
+
* e.g. `<!--o.1-->` maps to `<div c-id="0.1">`
|
1432
|
+
*
|
1433
|
+
* @param node - a node in the document. If an element, will recursively drill down
|
1434
|
+
* @param orgLocNodes - a master map to add component ids and original location ids to
|
1435
|
+
*/
|
1436
|
+
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
1437
|
+
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1438
|
+
// add all the loaded component IDs in this document
|
1439
|
+
// they're required to find nodes later
|
1440
|
+
// when deciding where slotted nodes should live
|
1441
|
+
const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
|
1442
|
+
if (componentId) {
|
1443
|
+
orgLocNodes.set(componentId, node);
|
1444
|
+
}
|
1445
|
+
let i = 0;
|
1446
|
+
const nonShadowChildNodes = node.__childNodes || node.childNodes;
|
1447
|
+
for (; i < nonShadowChildNodes.length; i++) {
|
1448
|
+
initializeDocumentHydrate(nonShadowChildNodes[i], orgLocNodes);
|
1449
|
+
}
|
1450
|
+
if (node.shadowRoot) {
|
1451
|
+
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
1452
|
+
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
1453
|
+
}
|
1454
|
+
}
|
1455
|
+
}
|
1456
|
+
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
1457
|
+
const childIdSplt = node.nodeValue.split('.');
|
1458
|
+
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
1459
|
+
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
1460
|
+
// useful to know if the original location is
|
1461
|
+
// the root light-dom of a shadow dom component
|
1462
|
+
node['s-en'] = childIdSplt[3];
|
1463
|
+
}
|
1464
|
+
}
|
1465
|
+
};
|
1466
|
+
/**
|
1467
|
+
* Creates a vnode to add to a hydrated component vdom
|
1468
|
+
* @param vnode - a vnode partial which will be augmented
|
1469
|
+
* @returns an complete vnode
|
1470
|
+
*/
|
1471
|
+
const createSimpleVNode = (vnode) => {
|
1472
|
+
const defaultVNode = {
|
1473
|
+
$flags$: 0,
|
1474
|
+
$hostId$: null,
|
1475
|
+
$nodeId$: null,
|
1476
|
+
$depth$: null,
|
1477
|
+
$index$: '0',
|
1478
|
+
$elm$: null,
|
1479
|
+
$attrs$: null,
|
1480
|
+
$children$: null,
|
1481
|
+
$key$: null,
|
1482
|
+
$name$: null,
|
1483
|
+
$tag$: null,
|
1484
|
+
$text$: null,
|
1485
|
+
};
|
1486
|
+
return Object.assign(Object.assign({}, defaultVNode), vnode);
|
1487
|
+
};
|
1488
|
+
/**
|
1489
|
+
* Adds groups of slotted nodes (grouped by slot ID)
|
1490
|
+
* to this host element's 'master' array. We'll use this after
|
1491
|
+
* the host element's VDOM is completely constructed to
|
1492
|
+
* finally position or / and add meta information required by non-shadow slotted nodes
|
1493
|
+
* @param slottedNodes - the main host element 'master' array to add to
|
1494
|
+
* @param slotNodeId - the slot node unique ID
|
1495
|
+
* @param slotName - the slot node name (can be '')
|
1496
|
+
* @param slotNode - the slot node
|
1497
|
+
* @param hostId - the host element id where this node should be slotted
|
1498
|
+
*/
|
1499
|
+
const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
|
1500
|
+
let slottedNode = slotNode.nextSibling;
|
1501
|
+
slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
|
1502
|
+
// looking for nodes that match this slot's name,
|
1503
|
+
// OR are text / comment nodes and the slot is a default slot (no name)
|
1504
|
+
// (text / comments cannot be direct descendants of named slots)
|
1505
|
+
// also ignore slot fallback nodes
|
1506
|
+
while (slottedNode &&
|
1507
|
+
(slottedNode['s-sn'] === slotName ||
|
1508
|
+
(slotName === '' &&
|
1509
|
+
!slottedNode['s-sn'] &&
|
1510
|
+
((slottedNode.nodeType === 8 /* NODE_TYPE.CommentNode */ && slottedNode.nodeValue.indexOf('.') !== 1) ||
|
1511
|
+
slottedNode.nodeType === 3 /* NODE_TYPE.TextNode */))) &&
|
1512
|
+
!slottedNode['s-sf']) {
|
1513
|
+
slottedNode['s-sn'] = slotName;
|
1514
|
+
slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
|
1515
|
+
slottedNode = slottedNode.nextSibling;
|
1516
|
+
}
|
1517
|
+
};
|
1518
|
+
// Private
|
1519
|
+
const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
|
1520
|
+
/**
|
1521
|
+
* Parse a new property value for a given property type.
|
1522
|
+
*
|
1523
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
1524
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
1525
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
1526
|
+
* 2. the type stored from `propType`.
|
1527
|
+
*
|
1528
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
1529
|
+
*
|
1530
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
1531
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
1532
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
1533
|
+
* ```tsx
|
1534
|
+
* <my-cmp prop-val={0}></my-cmp>
|
1535
|
+
* ```
|
1536
|
+
*
|
1537
|
+
* HTML prop values on the other hand, will always a string
|
1538
|
+
*
|
1539
|
+
* @param propValue the new value to coerce to some type
|
1540
|
+
* @param propType the type of the prop, expressed as a binary number
|
1541
|
+
* @returns the parsed/coerced value
|
1542
|
+
*/
|
1543
|
+
const parsePropertyValue = (propValue, propType) => {
|
1544
|
+
// ensure this value is of the correct prop type
|
1545
|
+
if (propValue != null && !isComplexType(propValue)) {
|
1546
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
1547
|
+
// per the HTML spec, any string value means it is a boolean true value
|
1548
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
1549
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
1550
|
+
}
|
1551
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
1552
|
+
// force it to be a number
|
1553
|
+
return parseFloat(propValue);
|
1554
|
+
}
|
1555
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
1556
|
+
// could have been passed as a number or boolean
|
1557
|
+
// but we still want it as a string
|
1558
|
+
return String(propValue);
|
1559
|
+
}
|
1560
|
+
// redundant return here for better minification
|
1561
|
+
return propValue;
|
1562
|
+
}
|
1563
|
+
// not sure exactly what type we want
|
1564
|
+
// so no need to change to a different type
|
1565
|
+
return propValue;
|
1566
|
+
};
|
1567
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
1568
|
+
const createEvent = (ref, name, flags) => {
|
1569
|
+
const elm = getElement(ref);
|
1570
|
+
return {
|
1571
|
+
emit: (detail) => {
|
1572
|
+
return emitEvent(elm, name, {
|
1573
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
1574
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
1575
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
1576
|
+
detail,
|
1577
|
+
});
|
1578
|
+
},
|
1579
|
+
};
|
1580
|
+
};
|
1581
|
+
/**
|
1582
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
1583
|
+
* @param elm the target of the Event
|
1584
|
+
* @param name the name to give the custom Event
|
1585
|
+
* @param opts options for configuring a custom Event
|
1586
|
+
* @returns the custom Event
|
1587
|
+
*/
|
1588
|
+
const emitEvent = (elm, name, opts) => {
|
1589
|
+
const ev = plt.ce(name, opts);
|
1590
|
+
elm.dispatchEvent(ev);
|
1591
|
+
return ev;
|
1592
|
+
};
|
1593
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
1594
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
1595
|
+
let style = styles.get(scopeId);
|
1596
|
+
if (supportsConstructableStylesheets && allowCS) {
|
1597
|
+
style = (style || new CSSStyleSheet());
|
1598
|
+
if (typeof style === 'string') {
|
1599
|
+
style = cssText;
|
1600
|
+
}
|
1601
|
+
else {
|
1602
|
+
style.replaceSync(cssText);
|
1603
|
+
}
|
1604
|
+
}
|
1605
|
+
else {
|
1606
|
+
style = cssText;
|
1607
|
+
}
|
1608
|
+
styles.set(scopeId, style);
|
1609
|
+
};
|
1610
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
1611
|
+
var _a;
|
1612
|
+
let scopeId = getScopeId(cmpMeta);
|
1613
|
+
const style = styles.get(scopeId);
|
1614
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
1615
|
+
// so the fallback is to always use the document for the root node in those cases
|
1616
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
1617
|
+
if (style) {
|
1618
|
+
if (typeof style === 'string') {
|
1619
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
1620
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
1621
|
+
let styleElm;
|
1622
|
+
if (!appliedStyles) {
|
1623
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
1624
|
+
}
|
1625
|
+
if (!appliedStyles.has(scopeId)) {
|
1626
|
+
if (styleContainerNode.host &&
|
1627
|
+
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
1628
|
+
// This is only happening on native shadow-dom, do not needs CSS var shim
|
1629
|
+
styleElm.innerHTML = style;
|
1630
|
+
}
|
1631
|
+
else {
|
1632
|
+
{
|
1633
|
+
styleElm = doc.createElement('style');
|
1634
|
+
styleElm.innerHTML = style;
|
1635
|
+
}
|
1636
|
+
// Apply CSP nonce to the style tag if it exists
|
1637
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
1638
|
+
if (nonce != null) {
|
1639
|
+
styleElm.setAttribute('nonce', nonce);
|
1640
|
+
}
|
1641
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
1642
|
+
}
|
1643
|
+
if (appliedStyles) {
|
1644
|
+
appliedStyles.add(scopeId);
|
1645
|
+
}
|
1646
|
+
}
|
908
1647
|
}
|
909
|
-
|
910
|
-
|
911
|
-
return childNode;
|
1648
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
1649
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
912
1650
|
}
|
913
1651
|
}
|
914
|
-
return
|
1652
|
+
return scopeId;
|
915
1653
|
};
|
916
|
-
const
|
917
|
-
const
|
918
|
-
|
919
|
-
|
1654
|
+
const attachStyles = (hostRef) => {
|
1655
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
1656
|
+
const elm = hostRef.$hostElement$;
|
1657
|
+
const flags = cmpMeta.$flags$;
|
1658
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
1659
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
1660
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
1661
|
+
// only required when we're NOT using native shadow dom (slot)
|
1662
|
+
// or this browser doesn't support native shadow dom
|
1663
|
+
// and this host element was NOT created with SSR
|
1664
|
+
// let's pick out the inner content for slot projection
|
1665
|
+
// create a node to represent where the original
|
1666
|
+
// content was first placed, which is useful later on
|
1667
|
+
// DOM WRITE!!
|
1668
|
+
elm['s-sc'] = scopeId;
|
1669
|
+
elm.classList.add(scopeId + '-h');
|
1670
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
1671
|
+
elm.classList.add(scopeId + '-s');
|
1672
|
+
}
|
920
1673
|
}
|
921
|
-
|
1674
|
+
endAttachStyles();
|
922
1675
|
};
|
923
|
-
const
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
1676
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
1677
|
+
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
1678
|
+
/**
|
1679
|
+
* Production setAccessor() function based on Preact by
|
1680
|
+
* Jason Miller (@developit)
|
1681
|
+
* Licensed under the MIT License
|
1682
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
1683
|
+
*
|
1684
|
+
* Modified for Stencil's compiler and vdom
|
1685
|
+
*/
|
1686
|
+
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
1687
|
+
if (oldValue !== newValue) {
|
1688
|
+
let isProp = isMemberInElement(elm, memberName);
|
1689
|
+
let ln = memberName.toLowerCase();
|
1690
|
+
if (memberName === 'class') {
|
1691
|
+
const classList = elm.classList;
|
1692
|
+
const oldClasses = parseClassList(oldValue);
|
1693
|
+
const newClasses = parseClassList(newValue);
|
1694
|
+
// for `scoped: true` components, new nodes after initial hydration
|
1695
|
+
// from SSR don't have the slotted class added. Let's add that now
|
1696
|
+
if (elm['s-si'] && newClasses.indexOf(elm['s-si']) < 0) {
|
1697
|
+
newClasses.push(elm['s-si']);
|
1698
|
+
}
|
1699
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
1700
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
931
1701
|
}
|
932
|
-
if (
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
1702
|
+
else if (memberName === 'style') {
|
1703
|
+
// update style attribute, css properties and values
|
1704
|
+
{
|
1705
|
+
for (const prop in oldValue) {
|
1706
|
+
if (!newValue || newValue[prop] == null) {
|
1707
|
+
if (prop.includes('-')) {
|
1708
|
+
elm.style.removeProperty(prop);
|
1709
|
+
}
|
1710
|
+
else {
|
1711
|
+
elm.style[prop] = '';
|
1712
|
+
}
|
1713
|
+
}
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
for (const prop in newValue) {
|
1717
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
1718
|
+
if (prop.includes('-')) {
|
1719
|
+
elm.style.setProperty(prop, newValue[prop]);
|
1720
|
+
}
|
1721
|
+
else {
|
1722
|
+
elm.style[prop] = newValue[prop];
|
1723
|
+
}
|
1724
|
+
}
|
1725
|
+
}
|
937
1726
|
}
|
938
|
-
else if (
|
939
|
-
|
940
|
-
|
941
|
-
|
1727
|
+
else if (memberName === 'key')
|
1728
|
+
;
|
1729
|
+
else if (memberName === 'ref') {
|
1730
|
+
// minifier will clean this up
|
1731
|
+
if (newValue) {
|
1732
|
+
newValue(elm);
|
1733
|
+
}
|
1734
|
+
}
|
1735
|
+
else if ((!isProp ) &&
|
1736
|
+
memberName[0] === 'o' &&
|
1737
|
+
memberName[1] === 'n') {
|
1738
|
+
// Event Handlers
|
1739
|
+
// so if the member name starts with "on" and the 3rd characters is
|
1740
|
+
// a capital letter, and it's not already a member on the element,
|
1741
|
+
// then we're assuming it's an event listener
|
1742
|
+
if (memberName[2] === '-') {
|
1743
|
+
// on- prefixed events
|
1744
|
+
// allows to be explicit about the dom event to listen without any magic
|
1745
|
+
// under the hood:
|
1746
|
+
// <my-cmp on-click> // listens for "click"
|
1747
|
+
// <my-cmp on-Click> // listens for "Click"
|
1748
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
1749
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
1750
|
+
memberName = memberName.slice(3);
|
1751
|
+
}
|
1752
|
+
else if (isMemberInElement(win, ln)) {
|
1753
|
+
// standard event
|
1754
|
+
// the JSX attribute could have been "onMouseOver" and the
|
1755
|
+
// member name "onmouseover" is on the window's prototype
|
1756
|
+
// so let's add the listener "mouseover", which is all lowercased
|
1757
|
+
memberName = ln.slice(2);
|
1758
|
+
}
|
1759
|
+
else {
|
1760
|
+
// custom event
|
1761
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
1762
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
1763
|
+
// and add the listener "myCustomEvent"
|
1764
|
+
// except for the first character, we keep the event name case
|
1765
|
+
memberName = ln[2] + memberName.slice(3);
|
1766
|
+
}
|
1767
|
+
if (oldValue) {
|
1768
|
+
plt.rel(elm, memberName, oldValue, false);
|
942
1769
|
}
|
943
|
-
|
944
|
-
|
1770
|
+
if (newValue) {
|
1771
|
+
plt.ael(elm, memberName, newValue, false);
|
945
1772
|
}
|
946
1773
|
}
|
947
|
-
|
948
|
-
|
949
|
-
const
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
// then hide it if there are other slots in the light dom
|
965
|
-
renderSlotFallbackContent(childNode, false);
|
966
|
-
for (j = 0; j < ilen; j++) {
|
967
|
-
nodeType = childNodes[j].nodeType;
|
968
|
-
if (childNodes[j]['s-sf'])
|
969
|
-
continue;
|
970
|
-
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
971
|
-
// this sibling node is from a different component OR is a named fallback slot node
|
972
|
-
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j]['s-sn']) {
|
973
|
-
renderSlotFallbackContent(childNode, true);
|
974
|
-
patchNodeRemove(childNodes[j]);
|
975
|
-
break;
|
1774
|
+
else {
|
1775
|
+
// Set property if it exists and it's not a SVG
|
1776
|
+
const isComplex = isComplexType(newValue);
|
1777
|
+
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
1778
|
+
try {
|
1779
|
+
if (!elm.tagName.includes('-')) {
|
1780
|
+
const n = newValue == null ? '' : newValue;
|
1781
|
+
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
1782
|
+
if (memberName === 'list') {
|
1783
|
+
isProp = false;
|
1784
|
+
}
|
1785
|
+
else if (oldValue == null || elm[memberName] != n) {
|
1786
|
+
elm[memberName] = n;
|
1787
|
+
}
|
1788
|
+
}
|
1789
|
+
else {
|
1790
|
+
elm[memberName] = newValue;
|
976
1791
|
}
|
977
1792
|
}
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
1793
|
+
catch (e) { }
|
1794
|
+
}
|
1795
|
+
/**
|
1796
|
+
* Need to manually update attribute if:
|
1797
|
+
* - memberName is not an attribute
|
1798
|
+
* - if we are rendering the host element in order to reflect attribute
|
1799
|
+
* - if it's a SVG, since properties might not work in <svg>
|
1800
|
+
* - if the newValue is null/undefined or 'false'.
|
1801
|
+
*/
|
1802
|
+
let xlink = false;
|
1803
|
+
{
|
1804
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
1805
|
+
memberName = ln;
|
1806
|
+
xlink = true;
|
1807
|
+
}
|
1808
|
+
}
|
1809
|
+
if (newValue == null || newValue === false) {
|
1810
|
+
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
1811
|
+
if (xlink) {
|
1812
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
1813
|
+
}
|
1814
|
+
else {
|
1815
|
+
elm.removeAttribute(memberName);
|
990
1816
|
}
|
991
1817
|
}
|
992
1818
|
}
|
1819
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
1820
|
+
newValue = newValue === true ? '' : newValue;
|
1821
|
+
if (xlink) {
|
1822
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
1823
|
+
}
|
1824
|
+
else {
|
1825
|
+
elm.setAttribute(memberName, newValue);
|
1826
|
+
}
|
1827
|
+
}
|
993
1828
|
}
|
994
|
-
|
995
|
-
|
1829
|
+
}
|
1830
|
+
};
|
1831
|
+
const parseClassListRegex = /\s/;
|
1832
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
1833
|
+
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
1834
|
+
// if the element passed in is a shadow root, which is a document fragment
|
1835
|
+
// then we want to be adding attrs/props to the shadow root's "host" element
|
1836
|
+
// if it's not a shadow root, then we add attrs/props to the same element
|
1837
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
1838
|
+
? newVnode.$elm$.host
|
1839
|
+
: newVnode.$elm$;
|
1840
|
+
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
1841
|
+
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
1842
|
+
{
|
1843
|
+
// remove attributes no longer present on the vnode by setting them to undefined
|
1844
|
+
for (memberName in oldVnodeAttrs) {
|
1845
|
+
if (!(memberName in newVnodeAttrs)) {
|
1846
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
1847
|
+
}
|
1848
|
+
}
|
1849
|
+
}
|
1850
|
+
// add new & update changed attributes
|
1851
|
+
for (memberName in newVnodeAttrs) {
|
1852
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
996
1853
|
}
|
997
1854
|
};
|
998
1855
|
/**
|
@@ -1069,30 +1926,41 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
1069
1926
|
elm['s-cr'] = contentRef;
|
1070
1927
|
// remember the slot name, or empty string for default slot
|
1071
1928
|
elm['s-sn'] = newVNode.$name$ || '';
|
1072
|
-
if
|
1929
|
+
// if this slot is nested within another parent slot, add that slot's name.
|
1930
|
+
// (used in 'renderSlotFallbackContent')
|
1931
|
+
if (newParentVNode.$name$) {
|
1073
1932
|
elm['s-psn'] = newParentVNode.$name$;
|
1933
|
+
}
|
1074
1934
|
if (newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */) {
|
1075
1935
|
if (newVNode.$children$) {
|
1936
|
+
// this slot has fallback nodes
|
1076
1937
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
1077
1938
|
// create the node
|
1078
|
-
let containerElm = elm.nodeType === 1 ? elm : parentElm;
|
1079
|
-
while (containerElm.nodeType !== 1) {
|
1939
|
+
let containerElm = elm.nodeType === 1 /* NODE_TYPE.ElementNode */ ? elm : parentElm;
|
1940
|
+
while (containerElm.nodeType !== 1 /* NODE_TYPE.ElementNode */) {
|
1080
1941
|
containerElm = containerElm.parentNode;
|
1081
1942
|
}
|
1082
1943
|
childNode = createElm(oldParentVNode, newVNode, i, containerElm);
|
1944
|
+
// add new node meta.
|
1945
|
+
// slot has fallback and childnode is slot fallback
|
1083
1946
|
childNode['s-sf'] = elm['s-hsf'] = true;
|
1084
|
-
if (typeof childNode['s-sn'] === 'undefined')
|
1947
|
+
if (typeof childNode['s-sn'] === 'undefined') {
|
1085
1948
|
childNode['s-sn'] = newVNode.$name$ || '';
|
1949
|
+
}
|
1086
1950
|
if (childNode.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
1087
1951
|
childNode['s-sfc'] = childNode.textContent;
|
1088
1952
|
}
|
1089
|
-
//
|
1090
|
-
|
1953
|
+
// make sure a node was created
|
1954
|
+
// and we don't have a node already present
|
1955
|
+
// (if a node is already attached, we'll just patch it)
|
1956
|
+
if (childNode && (!oldParentVNode || !oldParentVNode.$children$[i])) {
|
1091
1957
|
// append our new node
|
1092
|
-
containerElm.
|
1958
|
+
containerElm.appendChild(childNode);
|
1093
1959
|
}
|
1094
1960
|
}
|
1095
1961
|
}
|
1962
|
+
if (oldParentVNode)
|
1963
|
+
patch(oldParentVNode, newVNode);
|
1096
1964
|
}
|
1097
1965
|
// check if we've got an old vnode for this slot
|
1098
1966
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
@@ -1459,7 +2327,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
1459
2327
|
fbSlotsIdx = fbSlots.length - 1;
|
1460
2328
|
for (i = 0; i <= fbSlotsIdx; ++i) {
|
1461
2329
|
fbSlot = fbSlots[i];
|
1462
|
-
if (
|
2330
|
+
if (typeof fbNodes[fbSlot['s-sn']] === 'undefined')
|
1463
2331
|
continue;
|
1464
2332
|
fbNodesIdx = fbNodes[fbSlot['s-sn']].length - 1;
|
1465
2333
|
for (j = 0; j <= fbNodesIdx; ++j) {
|
@@ -1720,13 +2588,14 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
1720
2588
|
// by default we're just going to insert it directly
|
1721
2589
|
// after the slot reference node
|
1722
2590
|
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
1723
|
-
insertBeforeNode =
|
2591
|
+
insertBeforeNode =
|
2592
|
+
relocateData.$slotRefNode$.__nextSibling || relocateData.$slotRefNode$.nextSibling;
|
1724
2593
|
orgLocationNode = nodeToRelocate['s-ol'];
|
1725
2594
|
ogInsertBeforeNode = insertBeforeNode;
|
1726
|
-
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
2595
|
+
while ((orgLocationNode = (orgLocationNode.__previousSibling || orgLocationNode.previousSibling))) {
|
1727
2596
|
refNode = orgLocationNode['s-nr'];
|
1728
2597
|
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
1729
|
-
refNode = refNode.nextSibling;
|
2598
|
+
refNode = refNode.__nextSibling || refNode.nextSibling;
|
1730
2599
|
if (!refNode || !refNode['s-nr']) {
|
1731
2600
|
insertBeforeNode = refNode;
|
1732
2601
|
break;
|
@@ -1734,7 +2603,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
1734
2603
|
}
|
1735
2604
|
}
|
1736
2605
|
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
1737
|
-
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
2606
|
+
(nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling) !== insertBeforeNode) {
|
1738
2607
|
// we've checked that it's worth while to relocate
|
1739
2608
|
// since that the node to relocate
|
1740
2609
|
// has a different next sibling or parent relocated
|
@@ -2272,7 +3141,22 @@ const connectedCallback = (elm) => {
|
|
2272
3141
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
2273
3142
|
// first time this component has connected
|
2274
3143
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
3144
|
+
let hostId;
|
2275
3145
|
{
|
3146
|
+
hostId = elm.getAttribute(HYDRATE_ID);
|
3147
|
+
if (hostId) {
|
3148
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
3149
|
+
const scopeId = addStyle(elm.shadowRoot, cmpMeta);
|
3150
|
+
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
3151
|
+
}
|
3152
|
+
else if (cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
3153
|
+
let scopeId = getScopeId(cmpMeta);
|
3154
|
+
elm['s-sc'] = scopeId;
|
3155
|
+
}
|
3156
|
+
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
3157
|
+
}
|
3158
|
+
}
|
3159
|
+
if (!hostId) {
|
2276
3160
|
// initUpdate
|
2277
3161
|
// if the slot polyfill is required we'll need to put some nodes
|
2278
3162
|
// in here to act as original content anchors as we move nodes around
|
@@ -2288,7 +3172,10 @@ const connectedCallback = (elm) => {
|
|
2288
3172
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
2289
3173
|
// climb up the ancestors looking for the first
|
2290
3174
|
// component that hasn't finished its lifecycle update yet
|
2291
|
-
if (ancestorComponent
|
3175
|
+
if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
3176
|
+
ancestorComponent.hasAttribute('s-id') &&
|
3177
|
+
ancestorComponent['s-p']) ||
|
3178
|
+
ancestorComponent['s-p']) {
|
2292
3179
|
// we found this components first ancestor component
|
2293
3180
|
// keep a reference to this component's ancestor component
|
2294
3181
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
@@ -2352,6 +3239,7 @@ const disconnectedCallback = (elm) => {
|
|
2352
3239
|
}
|
2353
3240
|
};
|
2354
3241
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
3242
|
+
var _a;
|
2355
3243
|
const endBootstrap = createTime();
|
2356
3244
|
const cmpTags = [];
|
2357
3245
|
const exclude = options.exclude || [];
|
@@ -2360,10 +3248,16 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
2360
3248
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
2361
3249
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
2362
3250
|
const deferredConnectedCallbacks = [];
|
3251
|
+
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
2363
3252
|
let appLoadFallback;
|
2364
3253
|
let isBootstrapping = true;
|
2365
3254
|
Object.assign(plt, options);
|
2366
3255
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
3256
|
+
{
|
3257
|
+
// If the app is already hydrated there is not point to disable the
|
3258
|
+
// async queue. This will improve the first input delay
|
3259
|
+
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
3260
|
+
}
|
2367
3261
|
lazyBundles.map((lazyBundle) => {
|
2368
3262
|
lazyBundle[1].map((compactMeta) => {
|
2369
3263
|
const cmpMeta = {
|
@@ -2393,6 +3287,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
2393
3287
|
// @ts-ignore
|
2394
3288
|
super(self);
|
2395
3289
|
self = this;
|
3290
|
+
{
|
3291
|
+
const scopeId = getScopeId(cmpMeta, computeMode(self));
|
3292
|
+
const style = Array.from(styles).find((style) => style.getAttribute(HYDRATED_STYLE_ID) === scopeId);
|
3293
|
+
if (style) {
|
3294
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
3295
|
+
registerStyle(scopeId, convertScopedToShadow(style.innerHTML), true);
|
3296
|
+
}
|
3297
|
+
else {
|
3298
|
+
registerStyle(scopeId, style.innerHTML, false);
|
3299
|
+
}
|
3300
|
+
}
|
3301
|
+
}
|
2396
3302
|
registerHost(self, cmpMeta);
|
2397
3303
|
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
2398
3304
|
// this component is using shadow dom
|
@@ -2443,6 +3349,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
2443
3349
|
{
|
2444
3350
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
2445
3351
|
visibilityStyle.setAttribute('data-styles', '');
|
3352
|
+
// Apply CSP nonce to the style tag if it exists
|
3353
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
3354
|
+
if (nonce != null) {
|
3355
|
+
visibilityStyle.setAttribute('nonce', nonce);
|
3356
|
+
}
|
2446
3357
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
2447
3358
|
}
|
2448
3359
|
// Process deferred connectedCallbacks now all components have been registered
|
@@ -2495,6 +3406,13 @@ const getHostListenerTarget = (elm, flags) => {
|
|
2495
3406
|
};
|
2496
3407
|
// prettier-ignore
|
2497
3408
|
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
3409
|
+
/**
|
3410
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
3411
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
3412
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
3413
|
+
* @returns void
|
3414
|
+
*/
|
3415
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
2498
3416
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
2499
3417
|
const getHostRef = (ref) => hostRefs.get(ref);
|
2500
3418
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
@@ -2720,6 +3638,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
2720
3638
|
});
|
2721
3639
|
};
|
2722
3640
|
const styles = /*@__PURE__*/ new Map();
|
3641
|
+
const modeResolutionChain = [];
|
2723
3642
|
const win = typeof window !== 'undefined' ? window : {};
|
2724
3643
|
const doc = win.document || { head: {} };
|
2725
3644
|
const H = (win.HTMLElement || class {
|
@@ -2802,6 +3721,7 @@ exports.h = h;
|
|
2802
3721
|
exports.promiseResolve = promiseResolve;
|
2803
3722
|
exports.readTask = readTask;
|
2804
3723
|
exports.registerInstance = registerInstance;
|
3724
|
+
exports.setNonce = setNonce;
|
2805
3725
|
exports.writeTask = writeTask;
|
2806
3726
|
|
2807
|
-
//# sourceMappingURL=index-
|
3727
|
+
//# sourceMappingURL=index-5c437a69.js.map
|