@duetds/components 6.2.4 → 6.2.5
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/hydrate/index.d.ts +1 -1
- package/hydrate/index.js +2257 -4172
- package/lib/cjs/{dom-96576bce.js → dom-bcfa684c.js} +1 -1
- package/lib/cjs/duet-action-button.cjs.entry.js +14 -77
- package/lib/cjs/duet-alert.cjs.entry.js +10 -42
- package/lib/cjs/duet-badge.cjs.entry.js +1 -10
- package/lib/cjs/duet-breadcrumb.cjs.entry.js +2 -10
- package/lib/cjs/duet-breadcrumbs.cjs.entry.js +2 -4
- package/lib/cjs/duet-button_2.cjs.entry.js +30 -119
- package/lib/cjs/duet-caption_4.cjs.entry.js +4 -78
- package/lib/cjs/duet-card.cjs.entry.js +16 -55
- package/lib/cjs/duet-checkbox.cjs.entry.js +21 -49
- package/lib/cjs/duet-choice_2.cjs.entry.js +51 -152
- package/lib/cjs/duet-collapsible.cjs.entry.js +8 -41
- package/lib/cjs/duet-combobox.cjs.entry.js +26 -50
- package/lib/cjs/duet-cookie-consent.cjs.entry.js +3 -9
- package/lib/cjs/duet-date-picker.cjs.entry.js +37 -108
- package/lib/cjs/duet-divider_2.cjs.entry.js +1 -17
- package/lib/cjs/duet-editable-table_3.cjs.entry.js +163 -404
- package/lib/cjs/duet-empty-state.cjs.entry.js +1 -10
- package/lib/cjs/duet-fieldset.cjs.entry.js +7 -13
- package/lib/cjs/duet-footer.cjs.entry.js +13 -42
- package/lib/cjs/duet-grid_2.cjs.entry.js +3 -43
- package/lib/cjs/duet-header_2.cjs.entry.js +56 -163
- package/lib/cjs/duet-hero.cjs.entry.js +15 -90
- package/lib/cjs/duet-icon.cjs.entry.js +4 -35
- package/lib/cjs/duet-input_2.cjs.entry.js +41 -115
- package/lib/cjs/duet-layout.cjs.entry.js +1 -24
- package/lib/cjs/duet-list_2.cjs.entry.js +1 -23
- package/lib/cjs/duet-menu-bar-dropdown-link.cjs.entry.js +1 -10
- package/lib/cjs/duet-menu-bar-dropdown.cjs.entry.js +4 -13
- package/lib/cjs/duet-menu-bar-link.cjs.entry.js +1 -10
- package/lib/cjs/duet-menu-bar-menu-dropdown-link.cjs.entry.js +1 -16
- package/lib/cjs/duet-menu-bar-menu-dropdown.cjs.entry.js +4 -13
- package/lib/cjs/duet-menu-bar-menu-link.cjs.entry.js +1 -13
- package/lib/cjs/duet-menu-bar-menu.cjs.entry.js +4 -13
- package/lib/cjs/duet-menu-bar.cjs.entry.js +3 -6
- package/lib/cjs/duet-modal.cjs.entry.js +4 -59
- package/lib/cjs/duet-multiselect.cjs.entry.js +18 -59
- package/lib/cjs/duet-nav.cjs.entry.js +2 -5
- package/lib/cjs/duet-notification_2.cjs.entry.js +15 -74
- package/lib/cjs/duet-number-input.cjs.entry.js +53 -142
- package/lib/cjs/duet-pagination_2.cjs.entry.js +51 -125
- package/lib/cjs/duet-progress.cjs.entry.js +4 -26
- package/lib/cjs/duet-radio_2.cjs.entry.js +36 -84
- package/lib/cjs/duet-range-slider.cjs.entry.js +21 -62
- package/lib/cjs/duet-scrollable_3.cjs.entry.js +25 -88
- package/lib/cjs/duet-section-layout.cjs.entry.js +1 -7
- package/lib/cjs/duet-select.cjs.entry.js +25 -65
- package/lib/cjs/duet-step_2.cjs.entry.js +8 -34
- package/lib/cjs/duet-textarea.cjs.entry.js +31 -79
- package/lib/cjs/duet-toggle.cjs.entry.js +15 -38
- package/lib/cjs/duet-toolbar-dropdown-link.cjs.entry.js +1 -13
- package/lib/cjs/duet-toolbar-dropdown.cjs.entry.js +5 -17
- package/lib/cjs/duet-toolbar-link.cjs.entry.js +1 -13
- package/lib/cjs/duet-toolbar.cjs.entry.js +1 -4
- package/lib/cjs/duet-tooltip.cjs.entry.js +25 -77
- package/lib/cjs/duet-tray.cjs.entry.js +11 -53
- package/lib/cjs/duet-upload-aria-status.cjs.entry.js +8 -29
- package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +4 -4
- package/lib/cjs/{focus-utils-25247ce1.js → focus-utils-18ea61a6.js} +1 -1
- package/lib/cjs/{index-e009343b.js → index-d2f05eb8.js} +1438 -1235
- package/lib/cjs/loader.cjs.js +3 -3
- package/lib/cjs/{shadow-css-38b9e725.js → shadow-css-1ea48714.js} +1 -1
- package/lib/collection/collection-manifest.json +2 -2
- package/lib/collection/common/a11y-component.js +0 -3
- package/lib/collection/common/form-components.js +0 -3
- package/lib/collection/components/duet-action-button/duet-action-button.js +403 -461
- package/lib/collection/components/duet-alert/duet-alert.js +259 -289
- package/lib/collection/components/duet-badge/duet-badge.js +84 -89
- package/lib/collection/components/duet-breadcrumbs/duet-breadcrumb.js +96 -101
- package/lib/collection/components/duet-breadcrumbs/duet-breadcrumbs.js +47 -48
- package/lib/collection/components/duet-button/duet-button.js +838 -912
- package/lib/collection/components/duet-caption/duet-caption.js +96 -103
- package/lib/collection/components/duet-card/duet-card.js +381 -431
- package/lib/collection/components/duet-checkbox/duet-checkbox.js +476 -498
- package/lib/collection/components/duet-choice/duet-choice.js +731 -819
- package/lib/collection/components/duet-choice-group/duet-choice-group.js +282 -308
- package/lib/collection/components/duet-collapsible/duet-collapsible.js +208 -237
- package/lib/collection/components/duet-combobox/duet-combobox-select-single.js +1 -5
- package/lib/collection/components/duet-combobox/duet-combobox-select.js +1 -3
- package/lib/collection/components/duet-combobox/duet-combobox.css +47 -14
- package/lib/collection/components/duet-combobox/duet-combobox.js +257 -269
- package/lib/collection/components/duet-cookie-consent/duet-cookie-consent.js +77 -82
- package/lib/collection/components/duet-date-picker/date-picker-day.js +1 -3
- package/lib/collection/components/duet-date-picker/date-picker-input.js +1 -12
- package/lib/collection/components/duet-date-picker/date-picker-month.js +6 -12
- package/lib/collection/components/duet-date-picker/duet-date-picker.js +703 -795
- package/lib/collection/components/duet-divider/duet-divider.js +57 -57
- package/lib/collection/components/duet-editable-table/duet-editable-table.js +316 -381
- package/lib/collection/components/duet-empty-state/duet-empty-state.js +83 -90
- package/lib/collection/components/duet-fieldset/duet-fieldset.js +143 -153
- package/lib/collection/components/duet-footer/duet-footer.js +337 -378
- package/lib/collection/components/duet-grid/duet-grid.js +149 -162
- package/lib/collection/components/duet-grid-item/duet-grid-item.js +153 -164
- package/lib/collection/components/duet-header/duet-header-dropdown.js +11 -19
- package/lib/collection/components/duet-header/duet-header-hamburger.js +1 -5
- package/lib/collection/components/duet-header/duet-header-icon.js +1 -2
- package/lib/collection/components/duet-header/duet-header.js +872 -1023
- package/lib/collection/components/duet-heading/duet-heading.js +183 -200
- package/lib/collection/components/duet-hero/duet-hero.js +568 -660
- package/lib/collection/components/duet-icon/duet-icon.js +240 -263
- package/lib/collection/components/duet-input/duet-input.js +937 -1009
- package/lib/collection/components/duet-label/duet-label.js +95 -100
- package/lib/collection/components/duet-layout/duet-layout.js +163 -189
- package/lib/collection/components/duet-link/duet-link.js +204 -223
- package/lib/collection/components/duet-list/duet-list.js +181 -196
- package/lib/collection/components/duet-list-item/duet-list-item.js +12 -12
- package/lib/collection/components/duet-logo/duet-logo.js +171 -190
- package/lib/collection/components/duet-menu-bar/duet-menu-bar.js +45 -44
- package/lib/collection/components/duet-menu-bar-dropdown/duet-menu-bar-dropdown.js +100 -109
- package/lib/collection/components/duet-menu-bar-dropdown-link/duet-menu-bar-dropdown-link.js +75 -81
- package/lib/collection/components/duet-menu-bar-link/duet-menu-bar-link.js +72 -78
- package/lib/collection/components/duet-menu-bar-menu/duet-menu-bar-menu.js +100 -106
- package/lib/collection/components/duet-menu-bar-menu-dropdown/duet-menu-bar-menu-dropdown.js +100 -109
- package/lib/collection/components/duet-menu-bar-menu-dropdown-link/duet-menu-bar-menu-dropdown-link.js +110 -123
- package/lib/collection/components/duet-menu-bar-menu-link/duet-menu-bar-menu-link.js +89 -98
- package/lib/collection/components/duet-modal/duet-modal.js +466 -520
- package/lib/collection/components/duet-multiselect/duet-multiselect.js +411 -454
- package/lib/collection/components/duet-nav/duet-nav.js +78 -75
- package/lib/collection/components/duet-notification/duet-notification.js +201 -231
- package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.js +284 -312
- package/lib/collection/components/duet-number-input/duet-number-input.js +851 -944
- package/lib/collection/components/duet-pagination/duet-pagination.js +374 -439
- package/lib/collection/components/duet-paragraph/duet-paragraph.js +140 -154
- package/lib/collection/components/duet-progress/duet-progress.js +223 -253
- package/lib/collection/components/duet-radio/duet-radio.js +519 -531
- package/lib/collection/components/duet-radio-group/duet-radio-group.js +282 -308
- package/lib/collection/components/duet-range-slider/duet-range-slider.js +468 -505
- package/lib/collection/components/duet-range-stepper/duet-range-stepper.js +187 -204
- package/lib/collection/components/duet-scrollable/duet-scrollable.js +98 -106
- package/lib/collection/components/duet-section-layout/duet-section-layout.js +58 -61
- package/lib/collection/components/duet-select/duet-select.js +565 -606
- package/lib/collection/components/duet-spacer/duet-spacer.js +77 -81
- package/lib/collection/components/duet-spinner/duet-spinner.js +99 -107
- package/lib/collection/components/duet-step/duet-step.js +206 -219
- package/lib/collection/components/duet-stepper/duet-stepper.js +148 -156
- package/lib/collection/components/duet-tab/duet-tab.js +95 -96
- package/lib/collection/components/duet-tab-group/duet-tab-group.js +367 -405
- package/lib/collection/components/duet-table/duet-table.js +144 -160
- package/lib/collection/components/duet-textarea/duet-textarea.js +694 -747
- package/lib/collection/components/duet-toggle/duet-toggle.js +388 -404
- package/lib/collection/components/duet-toolbar/duet-toolbar.js +38 -38
- package/lib/collection/components/duet-toolbar-dropdown/duet-toolbar-dropdown.js +123 -135
- package/lib/collection/components/duet-toolbar-dropdown-link/duet-toolbar-dropdown-link.js +93 -102
- package/lib/collection/components/duet-toolbar-link/duet-toolbar-link.js +89 -98
- package/lib/collection/components/duet-tooltip/duet-tooltip.js +349 -401
- package/lib/collection/components/duet-tray/duet-tray.js +235 -276
- package/lib/collection/components/duet-upload/duet-upload.js +1371 -1549
- package/lib/collection/components/duet-upload/upload-editable-item-error.js +1 -6
- package/lib/collection/components/duet-upload/upload-editable-item-inprogres.js +1 -6
- package/lib/collection/components/duet-upload/upload-editable-item-pending.js +1 -4
- package/lib/collection/components/duet-upload/upload-editable-item-success.js +5 -21
- package/lib/collection/components/duet-upload-aria-status/duet-upload-aria-status.js +137 -153
- package/lib/collection/components/duet-visually-hidden/duet-visually-hidden.js +12 -9
- package/lib/dist-custom-elements/duet-action-button.js +1 -1
- package/lib/dist-custom-elements/duet-alert.js +1 -1
- package/lib/dist-custom-elements/duet-badge.js +1 -1
- package/lib/dist-custom-elements/duet-breadcrumb.js +3 -11
- package/lib/dist-custom-elements/duet-breadcrumbs.js +3 -5
- package/lib/dist-custom-elements/duet-button.js +1 -1
- package/lib/dist-custom-elements/duet-caption.js +1 -1
- package/lib/dist-custom-elements/duet-card.js +19 -58
- package/lib/dist-custom-elements/duet-checkbox.js +1 -1
- package/lib/dist-custom-elements/duet-choice-group.js +19 -49
- package/lib/dist-custom-elements/duet-choice.js +42 -113
- package/lib/dist-custom-elements/duet-collapsible.js +10 -43
- package/lib/dist-custom-elements/duet-combobox.js +29 -59
- package/lib/dist-custom-elements/duet-cookie-consent.js +8 -14
- package/lib/dist-custom-elements/duet-date-picker.js +45 -116
- package/lib/dist-custom-elements/duet-divider.js +1 -1
- package/lib/dist-custom-elements/duet-editable-table.js +1 -1
- package/lib/dist-custom-elements/duet-empty-state.js +1 -1
- package/lib/dist-custom-elements/duet-fieldset.js +1 -1
- package/lib/dist-custom-elements/duet-footer.js +16 -45
- package/lib/dist-custom-elements/duet-grid-item.js +1 -1
- package/lib/dist-custom-elements/duet-grid.js +1 -1
- package/lib/dist-custom-elements/duet-header.js +65 -152
- package/lib/dist-custom-elements/duet-heading.js +1 -1
- package/lib/dist-custom-elements/duet-hero.js +23 -98
- package/lib/dist-custom-elements/duet-icon.js +1 -1
- package/lib/dist-custom-elements/duet-input.js +1 -1
- package/lib/dist-custom-elements/duet-label.js +1 -1
- package/lib/dist-custom-elements/duet-layout.js +1 -24
- package/lib/dist-custom-elements/duet-link.js +1 -1
- package/lib/dist-custom-elements/duet-list-item.js +1 -1
- package/lib/dist-custom-elements/duet-list.js +1 -1
- package/lib/dist-custom-elements/duet-logo.js +1 -1
- package/lib/dist-custom-elements/duet-menu-bar-dropdown-link.js +2 -11
- package/lib/dist-custom-elements/duet-menu-bar-dropdown.js +5 -14
- package/lib/dist-custom-elements/duet-menu-bar-link.js +2 -11
- package/lib/dist-custom-elements/duet-menu-bar-menu-dropdown-link.js +2 -17
- package/lib/dist-custom-elements/duet-menu-bar-menu-dropdown.js +5 -14
- package/lib/dist-custom-elements/duet-menu-bar-menu-link.js +2 -14
- package/lib/dist-custom-elements/duet-menu-bar-menu.js +4 -13
- package/lib/dist-custom-elements/duet-menu-bar.js +5 -8
- package/lib/dist-custom-elements/duet-modal.js +10 -65
- package/lib/dist-custom-elements/duet-multiselect.js +25 -66
- package/lib/dist-custom-elements/duet-nav.js +2 -5
- package/lib/dist-custom-elements/duet-notification-drawer.js +18 -48
- package/lib/dist-custom-elements/duet-notification.js +2 -31
- package/lib/dist-custom-elements/duet-number-input.js +59 -148
- package/lib/dist-custom-elements/duet-pagination.js +51 -101
- package/lib/dist-custom-elements/duet-paragraph.js +1 -1
- package/lib/dist-custom-elements/duet-progress.js +1 -1
- package/lib/dist-custom-elements/duet-radio-group.js +19 -49
- package/lib/dist-custom-elements/duet-radio.js +23 -41
- package/lib/dist-custom-elements/duet-range-slider.js +23 -64
- package/lib/dist-custom-elements/duet-range-stepper.js +10 -34
- package/lib/dist-custom-elements/duet-scrollable.js +1 -1
- package/lib/dist-custom-elements/duet-section-layout.js +1 -7
- package/lib/dist-custom-elements/duet-select.js +1 -1
- package/lib/dist-custom-elements/duet-spacer.js +1 -1
- package/lib/dist-custom-elements/duet-spinner.js +1 -1
- package/lib/dist-custom-elements/duet-step.js +11 -20
- package/lib/dist-custom-elements/duet-stepper.js +2 -19
- package/lib/dist-custom-elements/duet-tab-group.js +26 -72
- package/lib/dist-custom-elements/duet-tab.js +3 -9
- package/lib/dist-custom-elements/duet-table.js +1 -1
- package/lib/dist-custom-elements/duet-textarea.js +38 -86
- package/lib/dist-custom-elements/duet-toggle.js +16 -39
- package/lib/dist-custom-elements/duet-toolbar-dropdown-link.js +2 -14
- package/lib/dist-custom-elements/duet-toolbar-dropdown.js +6 -18
- package/lib/dist-custom-elements/duet-toolbar-link.js +2 -14
- package/lib/dist-custom-elements/duet-toolbar.js +1 -4
- package/lib/dist-custom-elements/duet-tooltip.js +1 -1
- package/lib/dist-custom-elements/duet-tray.js +14 -56
- package/lib/dist-custom-elements/duet-upload-aria-status.js +1 -1
- package/lib/dist-custom-elements/duet-upload.js +165 -332
- package/lib/dist-custom-elements/duet-visually-hidden.js +1 -1
- package/lib/dist-custom-elements/index.d.ts +75 -5
- package/lib/dist-custom-elements/index.js +76 -1
- package/lib/dist-custom-elements/{p-ca2b02bc.js → p-0cc49790.js} +3 -25
- package/lib/dist-custom-elements/{p-1f03397c.js → p-0ef384ca.js} +7 -30
- package/lib/dist-custom-elements/{p-70d1ca9f.js → p-10feffd3.js} +1 -1
- package/lib/dist-custom-elements/{p-4367369a.js → p-14a163e6.js} +475 -272
- package/lib/dist-custom-elements/{p-e987e04b.js → p-25d4fffb.js} +1 -11
- package/lib/dist-custom-elements/{p-862c60cc.js → p-354f8a94.js} +3 -16
- package/lib/dist-custom-elements/{p-c5d74817.js → p-37dd7faf.js} +2 -22
- package/lib/dist-custom-elements/{p-e57df145.js → p-4115062c.js} +2 -25
- package/lib/dist-custom-elements/{p-ed503468.js → p-4447816d.js} +3 -20
- package/lib/dist-custom-elements/{p-9ed347f9.js → p-535ce3ec.js} +1 -1
- package/lib/dist-custom-elements/{p-33e00967.js → p-55325c49.js} +1 -1
- package/lib/dist-custom-elements/{p-1fef1f90.js → p-65ee8608.js} +8 -14
- package/lib/dist-custom-elements/{p-3fa8edce.js → p-737dd784.js} +45 -111
- package/lib/dist-custom-elements/{p-c4d8cad0.js → p-738bd3c5.js} +1 -1
- package/lib/dist-custom-elements/{p-6e81048c.js → p-7958dc0c.js} +30 -70
- package/lib/dist-custom-elements/{p-2a509b17.js → p-82fec063.js} +2 -21
- package/lib/dist-custom-elements/{p-279dedcd.js → p-88d217a7.js} +2 -11
- package/lib/dist-custom-elements/{p-f51d88cc.js → p-9245c901.js} +2 -10
- package/lib/dist-custom-elements/{p-dcffd5be.js → p-94eae3e6.js} +1 -7
- package/lib/dist-custom-elements/{p-0b8f16f1.js → p-9986919d.js} +1 -1
- package/lib/dist-custom-elements/{p-bd4ab88c.js → p-9fef7d37.js} +21 -49
- package/lib/dist-custom-elements/{p-0347f9ec.js → p-a1212d29.js} +1 -1
- package/lib/dist-custom-elements/{p-29b4f008.js → p-ad7292b3.js} +5 -26
- package/lib/dist-custom-elements/{p-9cfc3bee.js → p-af2e8de4.js} +14 -46
- package/lib/dist-custom-elements/{p-396cb7a5.js → p-b5ea480c.js} +9 -30
- package/lib/dist-custom-elements/{p-4bb2e37b.js → p-bd64a84d.js} +6 -17
- package/lib/dist-custom-elements/{p-0938933e.js → p-cab1e8a0.js} +20 -71
- package/lib/dist-custom-elements/{p-8c0cf877.js → p-d2402b45.js} +27 -79
- package/lib/dist-custom-elements/{p-b89983b2.js → p-d34c42bc.js} +1 -10
- package/lib/dist-custom-elements/{p-f674e164.js → p-d628dd87.js} +17 -80
- package/lib/dist-custom-elements/{p-c4165359.js → p-db135ec9.js} +1 -13
- package/lib/dist-custom-elements/{p-d4c234ed.js → p-e2cd1c98.js} +1 -1
- package/lib/dist-custom-elements/{p-b9058029.js → p-e4a60f42.js} +8 -0
- package/lib/dist-custom-elements/{p-b4b809ff.js → p-eb6fc032.js} +33 -109
- package/lib/dist-custom-elements/{p-464a80f2.js → p-f7c0e5bf.js} +1 -23
- package/lib/dist-custom-elements/{p-908c1151.js → p-fddad5df.js} +5 -36
- package/lib/dist-custom-elements/{p-1302f6e8.js → p-fed8d27a.js} +5 -27
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +2 -1
- package/lib/duet/{p-fe87f458.system.entry.js → p-00ee31e2.system.entry.js} +1 -1
- package/lib/duet/{p-5d9ec5ef.entry.js → p-0169eb09.entry.js} +1 -1
- package/lib/duet/{p-a585455c.system.entry.js → p-0236fc28.system.entry.js} +1 -1
- package/lib/duet/p-0285e5d3.entry.js +4 -0
- package/lib/duet/{p-fc2cda87.system.entry.js → p-028da443.system.entry.js} +2 -2
- package/lib/duet/{p-b09e3f47.system.entry.js → p-0426e86f.system.entry.js} +1 -1
- package/lib/duet/{p-7ea15c5c.system.entry.js → p-06c01b8a.system.entry.js} +1 -1
- package/lib/duet/{p-3b31184e.js → p-07970d29.js} +0 -0
- package/lib/duet/{p-ad0cf0f5.system.entry.js → p-09e9e6e0.system.entry.js} +2 -2
- package/lib/duet/p-0aae8ebf.entry.js +4 -0
- package/lib/duet/{p-526c88d9.system.entry.js → p-0c519c1f.system.entry.js} +1 -1
- package/lib/duet/p-0d218007.entry.js +4 -0
- package/lib/duet/p-0d6723f5.entry.js +4 -0
- package/lib/duet/p-0e1a3c6d.entry.js +4 -0
- package/lib/duet/{p-e60b3dc2.entry.js → p-0f8e4b6a.entry.js} +1 -1
- package/lib/duet/p-0fc0e90e.entry.js +4 -0
- package/lib/duet/{p-a5f977bc.system.entry.js → p-10b1ea3e.system.entry.js} +2 -2
- package/lib/duet/{p-32c587da.entry.js → p-1184c37e.entry.js} +1 -1
- package/lib/duet/{p-ce3fc2bd.entry.js → p-11c58a6b.entry.js} +1 -1
- package/lib/duet/p-14cca806.entry.js +4 -0
- package/lib/duet/{p-a2d89ed8.system.entry.js → p-14e93ad6.system.entry.js} +1 -1
- package/lib/duet/{p-2cf9ce9f.system.entry.js → p-16b61523.system.entry.js} +2 -2
- package/lib/duet/p-16cbd476.entry.js +4 -0
- package/lib/duet/{p-f5149c67.entry.js → p-1833941e.entry.js} +1 -1
- package/lib/duet/{p-15743dbe.system.entry.js → p-1a45eddb.system.entry.js} +1 -1
- package/lib/duet/{p-37b5759b.entry.js → p-1b63c3bf.entry.js} +1 -1
- package/lib/duet/p-1e442975.entry.js +4 -0
- package/lib/duet/{p-22793750.entry.js → p-27a1c897.entry.js} +1 -1
- package/lib/duet/{p-a4575910.entry.js → p-2c5b761d.entry.js} +1 -1
- package/lib/duet/{p-1b4da2a6.entry.js → p-2cbe5fe4.entry.js} +1 -1
- package/lib/duet/{p-ace82109.system.entry.js → p-2f0f8b9e.system.entry.js} +2 -2
- package/lib/duet/{p-b0fa24ea.system.entry.js → p-326d3440.system.entry.js} +1 -1
- package/lib/duet/{p-74edab4b.system.entry.js → p-394efc25.system.entry.js} +1 -1
- package/lib/duet/{p-bb2dab53.system.entry.js → p-400f8e9d.system.entry.js} +2 -2
- package/lib/duet/{p-21e8b3cb.system.entry.js → p-43750071.system.entry.js} +1 -1
- package/lib/duet/{p-995fe7b5.entry.js → p-45b0469f.entry.js} +1 -1
- package/lib/duet/p-4644616b.entry.js +4 -0
- package/lib/duet/{p-48d5c614.entry.js → p-4c96e54d.entry.js} +1 -1
- package/lib/duet/{p-f084d355.system.entry.js → p-4d1a5b9e.system.entry.js} +1 -1
- package/lib/duet/{p-fc34b8a0.system.entry.js → p-4e2db855.system.entry.js} +1 -1
- package/lib/duet/{p-e7196c1b.system.entry.js → p-5214682e.system.entry.js} +1 -1
- package/lib/duet/{p-c8ba8ed5.system.entry.js → p-575e4d53.system.entry.js} +1 -1
- package/lib/duet/{p-e1dc6e7f.system.entry.js → p-58de4753.system.entry.js} +1 -1
- package/lib/duet/p-592bcdd4.entry.js +4 -0
- package/lib/duet/{p-1b3fc470.system.entry.js → p-5b00d0cf.system.entry.js} +1 -1
- package/lib/duet/p-5bffb89f.entry.js +4 -0
- package/lib/duet/{p-93138df9.entry.js → p-5e134670.entry.js} +1 -1
- package/lib/duet/p-60c70efa.entry.js +4 -0
- package/lib/duet/p-61f8dd7f.system.entry.js +4 -0
- package/lib/duet/{p-7ac15184.system.entry.js → p-63cb7308.system.entry.js} +1 -1
- package/lib/duet/p-696d99ff.system.entry.js +4 -0
- package/lib/duet/p-6999702a.js +5 -0
- package/lib/duet/p-6db0f8c0.entry.js +4 -0
- package/lib/duet/{p-caf8cc5f.system.entry.js → p-6f2e72e2.system.entry.js} +2 -2
- package/lib/duet/{p-b668b67c.system.js → p-73900354.system.js} +0 -0
- package/lib/duet/{p-fc200674.system.entry.js → p-758c0528.system.entry.js} +2 -2
- package/lib/duet/{p-436b415a.system.entry.js → p-79c8d35c.system.entry.js} +1 -1
- package/lib/duet/{p-6226ebc9.entry.js → p-7ccf8ef9.entry.js} +1 -1
- package/lib/duet/{p-5a61c374.system.entry.js → p-7e67fedc.system.entry.js} +1 -1
- package/lib/duet/{p-aa10446f.system.entry.js → p-7fcbf80a.system.entry.js} +1 -1
- package/lib/duet/{p-a57f8242.entry.js → p-81313736.entry.js} +1 -1
- package/lib/duet/{p-a5dcf047.entry.js → p-81e66ef1.entry.js} +1 -1
- package/lib/duet/p-8512b463.js +4 -0
- package/lib/duet/p-855f9e2a.system.entry.js +4 -0
- package/lib/duet/{p-c4f57811.entry.js → p-8681c6e0.entry.js} +1 -1
- package/lib/duet/p-89bf7be7.entry.js +4 -0
- package/lib/duet/{p-1c2bc99b.system.entry.js → p-8a47d599.system.entry.js} +1 -1
- package/lib/duet/{p-ebbe496d.entry.js → p-8f6cf5d1.entry.js} +1 -1
- package/lib/duet/{p-0734bdd5.system.entry.js → p-90ea4509.system.entry.js} +1 -1
- package/lib/duet/p-9101f9ed.entry.js +4 -0
- package/lib/duet/{p-14e5b2e7.system.entry.js → p-914c3280.system.entry.js} +1 -1
- package/lib/duet/{p-9ea3b585.system.entry.js → p-948d492d.system.entry.js} +2 -2
- package/lib/duet/{p-daa920e3.system.entry.js → p-9a14ca19.system.entry.js} +1 -1
- package/lib/duet/{p-41110e9b.system.entry.js → p-9f60735a.system.entry.js} +1 -1
- package/lib/duet/p-a8d942ea.entry.js +4 -0
- package/lib/duet/{p-fe0cb2a5.entry.js → p-ac4c233b.entry.js} +1 -1
- package/lib/duet/p-acea52f5.entry.js +4 -0
- package/lib/duet/{p-bf4e00b1.system.entry.js → p-b180a4e2.system.entry.js} +1 -1
- package/lib/duet/{p-c0732300.system.entry.js → p-b2688afc.system.entry.js} +1 -1
- package/lib/duet/p-b293c2ff.entry.js +4 -0
- package/lib/duet/{p-2bcf54bb.entry.js → p-b2c913ea.entry.js} +1 -1
- package/lib/duet/p-b3046425.entry.js +4 -0
- package/lib/duet/p-b5dc8a8f.system.entry.js +4 -0
- package/lib/duet/{p-d448c7fc.system.entry.js → p-b821b721.system.entry.js} +1 -1
- package/lib/duet/p-bc2c1014.entry.js +4 -0
- package/lib/duet/{p-4c7ae11f.system.entry.js → p-bcd4a927.system.entry.js} +1 -1
- package/lib/duet/p-c12ecca9.entry.js +4 -0
- package/lib/duet/p-c17cae49.entry.js +4 -0
- package/lib/duet/p-c2c48bb2.entry.js +4 -0
- package/lib/duet/{p-870e88b7.system.entry.js → p-c3a0505e.system.entry.js} +1 -1
- package/lib/duet/{p-15b79ed1.entry.js → p-c41bfab0.entry.js} +1 -1
- package/lib/duet/{p-9e5192fd.entry.js → p-c4932f05.entry.js} +1 -1
- package/lib/duet/{p-8755500b.entry.js → p-c5e54be9.entry.js} +1 -1
- package/lib/duet/p-cf11b05b.entry.js +4 -0
- package/lib/duet/{p-d1da9fe1.system.entry.js → p-d0f1d25f.system.entry.js} +1 -1
- package/lib/duet/p-d16434dc.entry.js +4 -0
- package/lib/duet/{p-ed024bd6.entry.js → p-d2ef832d.entry.js} +1 -1
- package/lib/duet/{p-eb168145.system.js → p-d58991bc.system.js} +1 -1
- package/lib/duet/p-d971be46.entry.js +4 -0
- package/lib/duet/{p-ff46ec81.system.js → p-da0d4ee3.system.js} +0 -0
- package/lib/duet/p-da803459.entry.js +4 -0
- package/lib/duet/{p-eb94a92c.system.entry.js → p-daa20c36.system.entry.js} +1 -1
- package/lib/duet/{p-7e0d3659.entry.js → p-dbddb719.entry.js} +1 -1
- package/lib/duet/{p-5bbac6e9.system.entry.js → p-dc18b76c.system.entry.js} +1 -1
- package/lib/duet/p-dc51f077.entry.js +4 -0
- package/lib/duet/{p-db64d031.system.entry.js → p-dd676f12.system.entry.js} +1 -1
- package/lib/duet/{p-176c64c4.system.entry.js → p-dfcbf758.system.entry.js} +1 -1
- package/lib/duet/{p-d4c234ed.js → p-e2cd1c98.js} +0 -0
- package/lib/duet/{p-71e54f66.system.entry.js → p-e621c31c.system.entry.js} +1 -1
- package/lib/duet/p-e71a6257.system.js +5 -0
- package/lib/duet/{p-f8133fe1.system.entry.js → p-ea8e5649.system.entry.js} +1 -1
- package/lib/duet/{p-617872b5.system.entry.js → p-ebc09697.system.entry.js} +1 -1
- package/lib/duet/{p-66f1bdce.entry.js → p-ec635593.entry.js} +1 -1
- package/lib/duet/p-ef3f4213.entry.js +4 -0
- package/lib/duet/{p-61baccc6.system.entry.js → p-f01d234f.system.entry.js} +1 -1
- package/lib/duet/p-f150740b.entry.js +4 -0
- package/lib/duet/{p-71f1a210.system.entry.js → p-f2bcb922.system.entry.js} +1 -1
- package/lib/duet/{p-67a7ac4f.entry.js → p-f3d0d889.entry.js} +1 -1
- package/lib/duet/{p-a629e72a.system.entry.js → p-f6712ec8.system.entry.js} +1 -1
- package/lib/duet/{p-d164cdeb.system.entry.js → p-f678edf7.system.entry.js} +1 -1
- package/lib/duet/p-f7453c05.system.entry.js +4 -0
- package/lib/duet/{p-2e71b284.system.js → p-f9133dc5.system.js} +1 -1
- package/lib/duet/{p-465c7f64.system.entry.js → p-f9afad76.system.entry.js} +1 -1
- package/lib/esm/{dom-3dbcb0d8.js → dom-4d9c03f4.js} +1 -1
- package/lib/esm/duet-action-button.entry.js +14 -77
- package/lib/esm/duet-alert.entry.js +10 -42
- package/lib/esm/duet-badge.entry.js +1 -10
- package/lib/esm/duet-breadcrumb.entry.js +2 -10
- package/lib/esm/duet-breadcrumbs.entry.js +2 -4
- package/lib/esm/duet-button_2.entry.js +30 -119
- package/lib/esm/duet-caption_4.entry.js +4 -78
- package/lib/esm/duet-card.entry.js +16 -55
- package/lib/esm/duet-checkbox.entry.js +21 -49
- package/lib/esm/duet-choice_2.entry.js +51 -152
- package/lib/esm/duet-collapsible.entry.js +8 -41
- package/lib/esm/duet-combobox.entry.js +26 -50
- package/lib/esm/duet-cookie-consent.entry.js +3 -9
- package/lib/esm/duet-date-picker.entry.js +37 -108
- package/lib/esm/duet-divider_2.entry.js +1 -17
- package/lib/esm/duet-editable-table_3.entry.js +163 -404
- package/lib/esm/duet-empty-state.entry.js +1 -10
- package/lib/esm/duet-fieldset.entry.js +7 -13
- package/lib/esm/duet-footer.entry.js +13 -42
- package/lib/esm/duet-grid_2.entry.js +3 -43
- package/lib/esm/duet-header_2.entry.js +56 -163
- package/lib/esm/duet-hero.entry.js +15 -90
- package/lib/esm/duet-icon.entry.js +4 -35
- package/lib/esm/duet-input_2.entry.js +41 -115
- package/lib/esm/duet-layout.entry.js +1 -24
- package/lib/esm/duet-list_2.entry.js +1 -23
- package/lib/esm/duet-menu-bar-dropdown-link.entry.js +1 -10
- package/lib/esm/duet-menu-bar-dropdown.entry.js +4 -13
- package/lib/esm/duet-menu-bar-link.entry.js +1 -10
- package/lib/esm/duet-menu-bar-menu-dropdown-link.entry.js +1 -16
- package/lib/esm/duet-menu-bar-menu-dropdown.entry.js +4 -13
- package/lib/esm/duet-menu-bar-menu-link.entry.js +1 -13
- package/lib/esm/duet-menu-bar-menu.entry.js +4 -13
- package/lib/esm/duet-menu-bar.entry.js +3 -6
- package/lib/esm/duet-modal.entry.js +4 -59
- package/lib/esm/duet-multiselect.entry.js +18 -59
- package/lib/esm/duet-nav.entry.js +2 -5
- package/lib/esm/duet-notification_2.entry.js +15 -74
- package/lib/esm/duet-number-input.entry.js +53 -142
- package/lib/esm/duet-pagination_2.entry.js +51 -125
- package/lib/esm/duet-progress.entry.js +4 -26
- package/lib/esm/duet-radio_2.entry.js +36 -84
- package/lib/esm/duet-range-slider.entry.js +21 -62
- package/lib/esm/duet-scrollable_3.entry.js +25 -88
- package/lib/esm/duet-section-layout.entry.js +1 -7
- package/lib/esm/duet-select.entry.js +25 -65
- package/lib/esm/duet-step_2.entry.js +8 -34
- package/lib/esm/duet-textarea.entry.js +31 -79
- package/lib/esm/duet-toggle.entry.js +15 -38
- package/lib/esm/duet-toolbar-dropdown-link.entry.js +1 -13
- package/lib/esm/duet-toolbar-dropdown.entry.js +5 -17
- package/lib/esm/duet-toolbar-link.entry.js +1 -13
- package/lib/esm/duet-toolbar.entry.js +1 -4
- package/lib/esm/duet-tooltip.entry.js +25 -77
- package/lib/esm/duet-tray.entry.js +11 -53
- package/lib/esm/duet-upload-aria-status.entry.js +8 -29
- package/lib/esm/duet-visually-hidden.entry.js +1 -1
- package/lib/esm/duet.js +4 -4
- package/lib/esm/{focus-utils-c6e25a2b.js → focus-utils-abaea1e6.js} +1 -1
- package/lib/esm/{index-adbabdb3.js → index-4df60498.js} +1438 -1235
- package/lib/esm/loader.js +3 -3
- package/lib/esm/polyfills/css-shim.js +1 -1
- package/lib/esm/{shadow-css-501eda9a.js → shadow-css-a011f1fe.js} +1 -1
- package/lib/esm-es5/{dom-3dbcb0d8.js → dom-4d9c03f4.js} +0 -0
- package/lib/esm-es5/duet-action-button.entry.js +1 -1
- package/lib/esm-es5/duet-alert.entry.js +1 -1
- package/lib/esm-es5/duet-badge.entry.js +1 -1
- package/lib/esm-es5/duet-breadcrumb.entry.js +1 -1
- package/lib/esm-es5/duet-breadcrumbs.entry.js +2 -2
- package/lib/esm-es5/duet-button_2.entry.js +2 -2
- package/lib/esm-es5/duet-caption_4.entry.js +1 -1
- package/lib/esm-es5/duet-card.entry.js +1 -1
- package/lib/esm-es5/duet-checkbox.entry.js +2 -2
- package/lib/esm-es5/duet-choice_2.entry.js +2 -2
- package/lib/esm-es5/duet-collapsible.entry.js +2 -2
- package/lib/esm-es5/duet-combobox.entry.js +2 -2
- package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
- package/lib/esm-es5/duet-date-picker.entry.js +1 -1
- package/lib/esm-es5/duet-divider_2.entry.js +1 -1
- package/lib/esm-es5/duet-editable-table_3.entry.js +2 -2
- package/lib/esm-es5/duet-empty-state.entry.js +1 -1
- package/lib/esm-es5/duet-fieldset.entry.js +1 -1
- package/lib/esm-es5/duet-footer.entry.js +2 -2
- package/lib/esm-es5/duet-grid_2.entry.js +2 -2
- package/lib/esm-es5/duet-header_2.entry.js +2 -2
- package/lib/esm-es5/duet-hero.entry.js +1 -1
- package/lib/esm-es5/duet-icon.entry.js +2 -2
- package/lib/esm-es5/duet-input_2.entry.js +1 -1
- package/lib/esm-es5/duet-layout.entry.js +1 -1
- package/lib/esm-es5/duet-list_2.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar-dropdown-link.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar-dropdown.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar-link.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar-menu-dropdown-link.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar-menu-dropdown.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar-menu-link.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar-menu.entry.js +1 -1
- package/lib/esm-es5/duet-menu-bar.entry.js +1 -1
- package/lib/esm-es5/duet-modal.entry.js +2 -2
- package/lib/esm-es5/duet-multiselect.entry.js +1 -1
- package/lib/esm-es5/duet-nav.entry.js +1 -1
- package/lib/esm-es5/duet-notification_2.entry.js +1 -1
- package/lib/esm-es5/duet-number-input.entry.js +2 -2
- package/lib/esm-es5/duet-pagination_2.entry.js +1 -1
- package/lib/esm-es5/duet-progress.entry.js +1 -1
- package/lib/esm-es5/duet-radio_2.entry.js +1 -1
- package/lib/esm-es5/duet-range-slider.entry.js +1 -1
- package/lib/esm-es5/duet-scrollable_3.entry.js +2 -2
- package/lib/esm-es5/duet-section-layout.entry.js +1 -1
- package/lib/esm-es5/duet-select.entry.js +2 -2
- package/lib/esm-es5/duet-step_2.entry.js +1 -1
- package/lib/esm-es5/duet-textarea.entry.js +1 -1
- package/lib/esm-es5/duet-toggle.entry.js +2 -2
- package/lib/esm-es5/duet-toolbar-dropdown-link.entry.js +1 -1
- package/lib/esm-es5/duet-toolbar-dropdown.entry.js +1 -1
- package/lib/esm-es5/duet-toolbar-link.entry.js +1 -1
- package/lib/esm-es5/duet-toolbar.entry.js +1 -1
- package/lib/esm-es5/duet-tooltip.entry.js +2 -2
- package/lib/esm-es5/duet-tray.entry.js +1 -1
- package/lib/esm-es5/duet-upload-aria-status.entry.js +1 -1
- package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
- package/lib/esm-es5/duet.js +1 -1
- package/lib/esm-es5/{focus-utils-c6e25a2b.js → focus-utils-abaea1e6.js} +1 -1
- package/lib/esm-es5/index-4df60498.js +5 -0
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/{shadow-css-501eda9a.js → shadow-css-a011f1fe.js} +0 -0
- package/lib/loader/package.json +1 -0
- package/lib/types/components/duet-combobox/duet-combobox.d.ts +1 -2
- package/lib/types/stencil-public-runtime.d.ts +20 -4
- package/package.json +8 -10
- package/lib/duet/p-03ac8c12.entry.js +0 -4
- package/lib/duet/p-0b0b1a31.js +0 -4
- package/lib/duet/p-2482298d.entry.js +0 -4
- package/lib/duet/p-2be7affe.system.entry.js +0 -4
- package/lib/duet/p-2e2eca0e.entry.js +0 -4
- package/lib/duet/p-3198246d.system.entry.js +0 -4
- package/lib/duet/p-31a8380d.entry.js +0 -4
- package/lib/duet/p-3d96bd35.entry.js +0 -4
- package/lib/duet/p-4fd9fab5.entry.js +0 -4
- package/lib/duet/p-570786a7.system.entry.js +0 -4
- package/lib/duet/p-5be11a3f.entry.js +0 -4
- package/lib/duet/p-6198dd87.entry.js +0 -4
- package/lib/duet/p-6ef4c26f.system.entry.js +0 -4
- package/lib/duet/p-73b1bfff.system.js +0 -5
- package/lib/duet/p-74a85e06.entry.js +0 -4
- package/lib/duet/p-8e12f166.entry.js +0 -4
- package/lib/duet/p-8e83ab80.entry.js +0 -4
- package/lib/duet/p-925f5739.entry.js +0 -4
- package/lib/duet/p-aeee20b5.system.entry.js +0 -4
- package/lib/duet/p-b252c6c7.entry.js +0 -4
- package/lib/duet/p-b28b7458.entry.js +0 -4
- package/lib/duet/p-bbc7c22c.js +0 -5
- package/lib/duet/p-bce4669c.entry.js +0 -4
- package/lib/duet/p-bf165746.entry.js +0 -4
- package/lib/duet/p-c4375ca3.entry.js +0 -4
- package/lib/duet/p-cd5358ce.entry.js +0 -4
- package/lib/duet/p-d770b87e.entry.js +0 -4
- package/lib/duet/p-d7d944f5.entry.js +0 -4
- package/lib/duet/p-d7fa0c7c.entry.js +0 -4
- package/lib/duet/p-d83f8247.entry.js +0 -4
- package/lib/duet/p-dc9b21ad.entry.js +0 -4
- package/lib/duet/p-dcf2df11.entry.js +0 -4
- package/lib/duet/p-de024983.entry.js +0 -4
- package/lib/duet/p-e01e9f71.entry.js +0 -4
- package/lib/duet/p-e7808045.entry.js +0 -4
- package/lib/duet/p-e9cf0568.entry.js +0 -4
- package/lib/duet/p-f015180c.entry.js +0 -4
- package/lib/duet/p-f0e4ccb6.entry.js +0 -4
- package/lib/duet/p-f0f8a1fd.entry.js +0 -4
- package/lib/esm-es5/index-adbabdb3.js +0 -5
|
@@ -24,8 +24,16 @@ function _interopNamespace(e) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const NAMESPACE = 'duet';
|
|
27
|
-
const Env = /* duet */ {"cdnURILocal":"http://0.0.0.0:3334","cdnURIProd":"https://cdn.duetds.com/api","duetIconVersion":"3.0.
|
|
27
|
+
const Env = /* duet */ {"cdnURILocal":"http://0.0.0.0:3334","cdnURIProd":"https://cdn.duetds.com/api","duetIconVersion":"3.0.13"};
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
31
|
+
* Simon Friis Vindum (@paldepind)
|
|
32
|
+
* Licensed under the MIT License
|
|
33
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
34
|
+
*
|
|
35
|
+
* Modified for Stencil's renderer and slot projection
|
|
36
|
+
*/
|
|
29
37
|
let scopeId;
|
|
30
38
|
let contentRef;
|
|
31
39
|
let hostTagName;
|
|
@@ -34,76 +42,12 @@ let checkSlotFallbackVisibility = false;
|
|
|
34
42
|
let checkSlotRelocate = false;
|
|
35
43
|
let isSvgMode = false;
|
|
36
44
|
let queuePending = false;
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
jmp: (h) => h(),
|
|
43
|
-
raf: (h) => requestAnimationFrame(h),
|
|
44
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
45
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
46
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
47
|
-
};
|
|
48
|
-
const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
49
|
-
;
|
|
50
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
51
|
-
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
52
|
-
try {
|
|
53
|
-
new CSSStyleSheet();
|
|
54
|
-
return typeof new CSSStyleSheet().replace === 'function';
|
|
55
|
-
}
|
|
56
|
-
catch (e) { }
|
|
57
|
-
return false;
|
|
58
|
-
})()
|
|
59
|
-
;
|
|
60
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
61
|
-
if (listeners) {
|
|
62
|
-
listeners.map(([flags, name, method]) => {
|
|
63
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
64
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
65
|
-
const opts = hostListenerOpts(flags);
|
|
66
|
-
plt.ael(target, name, handler, opts);
|
|
67
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
72
|
-
try {
|
|
73
|
-
{
|
|
74
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
75
|
-
// instance is ready, let's call it's member method for this event
|
|
76
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch (e) {
|
|
84
|
-
consoleError(e);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
88
|
-
if (flags & 4 /* TargetDocument */)
|
|
89
|
-
return doc;
|
|
90
|
-
if (flags & 8 /* TargetWindow */)
|
|
91
|
-
return win;
|
|
92
|
-
if (flags & 16 /* TargetBody */)
|
|
93
|
-
return doc.body;
|
|
94
|
-
return elm;
|
|
45
|
+
const Build = {
|
|
46
|
+
isDev: false,
|
|
47
|
+
isBrowser: true,
|
|
48
|
+
isServer: false,
|
|
49
|
+
isTesting: false,
|
|
95
50
|
};
|
|
96
|
-
// prettier-ignore
|
|
97
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
98
|
-
const CONTENT_REF_ID = 'r';
|
|
99
|
-
const ORG_LOCATION_ID = 'o';
|
|
100
|
-
const SLOT_NODE_ID = 's';
|
|
101
|
-
const TEXT_NODE_ID = 't';
|
|
102
|
-
const HYDRATE_ID = 's-id';
|
|
103
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
104
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
105
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
106
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
107
51
|
const createTime = (fnName, tagName = '') => {
|
|
108
52
|
{
|
|
109
53
|
return () => {
|
|
@@ -118,80 +62,15 @@ const uniqueTime = (key, measureText) => {
|
|
|
118
62
|
};
|
|
119
63
|
}
|
|
120
64
|
};
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
styles.set(scopeId, style);
|
|
132
|
-
};
|
|
133
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
134
|
-
let scopeId = getScopeId(cmpMeta);
|
|
135
|
-
const style = styles.get(scopeId);
|
|
136
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
137
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
138
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
139
|
-
if (style) {
|
|
140
|
-
if (typeof style === 'string') {
|
|
141
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
142
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
143
|
-
let styleElm;
|
|
144
|
-
if (!appliedStyles) {
|
|
145
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
146
|
-
}
|
|
147
|
-
if (!appliedStyles.has(scopeId)) {
|
|
148
|
-
if (styleContainerNode.host &&
|
|
149
|
-
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
150
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
151
|
-
styleElm.innerHTML = style;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
{
|
|
155
|
-
styleElm = doc.createElement('style');
|
|
156
|
-
styleElm.innerHTML = style;
|
|
157
|
-
}
|
|
158
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
159
|
-
}
|
|
160
|
-
if (appliedStyles) {
|
|
161
|
-
appliedStyles.add(scopeId);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
166
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return scopeId;
|
|
170
|
-
};
|
|
171
|
-
const attachStyles = (hostRef) => {
|
|
172
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
173
|
-
const elm = hostRef.$hostElement$;
|
|
174
|
-
const flags = cmpMeta.$flags$;
|
|
175
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
176
|
-
const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
177
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
178
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
179
|
-
// or this browser doesn't support native shadow dom
|
|
180
|
-
// and this host element was NOT created with SSR
|
|
181
|
-
// let's pick out the inner content for slot projection
|
|
182
|
-
// create a node to represent where the original
|
|
183
|
-
// content was first placed, which is useful later on
|
|
184
|
-
// DOM WRITE!!
|
|
185
|
-
elm['s-sc'] = scopeId;
|
|
186
|
-
elm.classList.add(scopeId + '-h');
|
|
187
|
-
if (flags & 2 /* scopedCssEncapsulation */) {
|
|
188
|
-
elm.classList.add(scopeId + '-s');
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
endAttachStyles();
|
|
192
|
-
};
|
|
193
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
194
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
65
|
+
const CONTENT_REF_ID = 'r';
|
|
66
|
+
const ORG_LOCATION_ID = 'o';
|
|
67
|
+
const SLOT_NODE_ID = 's';
|
|
68
|
+
const TEXT_NODE_ID = 't';
|
|
69
|
+
const HYDRATE_ID = 's-id';
|
|
70
|
+
const HYDRATED_STYLE_ID = 'sty-id';
|
|
71
|
+
const HYDRATE_CHILD_ID = 'c-id';
|
|
72
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
73
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
195
74
|
/**
|
|
196
75
|
* Default style mode id
|
|
197
76
|
*/
|
|
@@ -340,1205 +219,1464 @@ const convertToPrivate = (node) => {
|
|
|
340
219
|
vnode.$name$ = node.vname;
|
|
341
220
|
return vnode;
|
|
342
221
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
else if (memberName === 'style') {
|
|
363
|
-
// update style attribute, css properties and values
|
|
364
|
-
{
|
|
365
|
-
for (const prop in oldValue) {
|
|
366
|
-
if (!newValue || newValue[prop] == null) {
|
|
367
|
-
if (prop.includes('-')) {
|
|
368
|
-
elm.style.removeProperty(prop);
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
elm.style[prop] = '';
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
for (const prop in newValue) {
|
|
377
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
378
|
-
if (prop.includes('-')) {
|
|
379
|
-
elm.style.setProperty(prop, newValue[prop]);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
elm.style[prop] = newValue[prop];
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
222
|
+
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
223
|
+
const endHydrate = createTime('hydrateClient', tagName);
|
|
224
|
+
const shadowRoot = hostElm.shadowRoot;
|
|
225
|
+
const childRenderNodes = [];
|
|
226
|
+
const slotNodes = [];
|
|
227
|
+
const shadowRootNodes = shadowRoot ? [] : null;
|
|
228
|
+
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
229
|
+
if (!plt.$orgLocNodes$) {
|
|
230
|
+
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
231
|
+
}
|
|
232
|
+
hostElm[HYDRATE_ID] = hostId;
|
|
233
|
+
hostElm.removeAttribute(HYDRATE_ID);
|
|
234
|
+
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
235
|
+
childRenderNodes.map((c) => {
|
|
236
|
+
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
237
|
+
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
238
|
+
const node = c.$elm$;
|
|
239
|
+
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
240
|
+
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
386
241
|
}
|
|
387
|
-
|
|
388
|
-
;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
newValue(elm);
|
|
242
|
+
if (!shadowRoot) {
|
|
243
|
+
node['s-hn'] = tagName;
|
|
244
|
+
if (orgLocationNode) {
|
|
245
|
+
node['s-ol'] = orgLocationNode;
|
|
246
|
+
node['s-ol']['s-nr'] = node;
|
|
393
247
|
}
|
|
394
248
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
// then we're assuming it's an event listener
|
|
402
|
-
if (memberName[2] === '-') {
|
|
403
|
-
// on- prefixed events
|
|
404
|
-
// allows to be explicit about the dom event to listen without any magic
|
|
405
|
-
// under the hood:
|
|
406
|
-
// <my-cmp on-click> // listens for "click"
|
|
407
|
-
// <my-cmp on-Click> // listens for "Click"
|
|
408
|
-
// <my-cmp on-ionChange> // listens for "ionChange"
|
|
409
|
-
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
|
410
|
-
memberName = memberName.slice(3);
|
|
411
|
-
}
|
|
412
|
-
else if (isMemberInElement(win, ln)) {
|
|
413
|
-
// standard event
|
|
414
|
-
// the JSX attribute could have been "onMouseOver" and the
|
|
415
|
-
// member name "onmouseover" is on the window's prototype
|
|
416
|
-
// so let's add the listener "mouseover", which is all lowercased
|
|
417
|
-
memberName = ln.slice(2);
|
|
249
|
+
plt.$orgLocNodes$.delete(orgLocationId);
|
|
250
|
+
});
|
|
251
|
+
if (shadowRoot) {
|
|
252
|
+
shadowRootNodes.map((shadowRootNode) => {
|
|
253
|
+
if (shadowRootNode) {
|
|
254
|
+
shadowRoot.appendChild(shadowRootNode);
|
|
418
255
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
endHydrate();
|
|
259
|
+
};
|
|
260
|
+
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
261
|
+
let childNodeType;
|
|
262
|
+
let childIdSplt;
|
|
263
|
+
let childVNode;
|
|
264
|
+
let i;
|
|
265
|
+
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
266
|
+
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
267
|
+
if (childNodeType) {
|
|
268
|
+
// got the node data from the element's attribute
|
|
269
|
+
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
270
|
+
childIdSplt = childNodeType.split('.');
|
|
271
|
+
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
272
|
+
childVNode = {
|
|
273
|
+
$flags$: 0,
|
|
274
|
+
$hostId$: childIdSplt[0],
|
|
275
|
+
$nodeId$: childIdSplt[1],
|
|
276
|
+
$depth$: childIdSplt[2],
|
|
277
|
+
$index$: childIdSplt[3],
|
|
278
|
+
$tag$: node.tagName.toLowerCase(),
|
|
279
|
+
$elm$: node,
|
|
280
|
+
$attrs$: null,
|
|
281
|
+
$children$: null,
|
|
282
|
+
$key$: null,
|
|
283
|
+
$name$: null,
|
|
284
|
+
$text$: null,
|
|
285
|
+
};
|
|
286
|
+
childRenderNodes.push(childVNode);
|
|
287
|
+
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
288
|
+
// this is a new child vnode
|
|
289
|
+
// so ensure its parent vnode has the vchildren array
|
|
290
|
+
if (!parentVNode.$children$) {
|
|
291
|
+
parentVNode.$children$ = [];
|
|
292
|
+
}
|
|
293
|
+
// add our child vnode to a specific index of the vnode's children
|
|
294
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
295
|
+
// this is now the new parent vnode for all the next child checks
|
|
296
|
+
parentVNode = childVNode;
|
|
297
|
+
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
298
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
299
|
+
}
|
|
429
300
|
}
|
|
430
|
-
|
|
431
|
-
|
|
301
|
+
}
|
|
302
|
+
// recursively drill down, end to start so we can remove nodes
|
|
303
|
+
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
304
|
+
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
305
|
+
}
|
|
306
|
+
if (node.shadowRoot) {
|
|
307
|
+
// keep drilling down through the shadow root nodes
|
|
308
|
+
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
309
|
+
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
432
310
|
}
|
|
433
311
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
312
|
+
}
|
|
313
|
+
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
314
|
+
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
315
|
+
childIdSplt = node.nodeValue.split('.');
|
|
316
|
+
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
317
|
+
// comment node for either the host id or a 0 host id
|
|
318
|
+
childNodeType = childIdSplt[0];
|
|
319
|
+
childVNode = {
|
|
320
|
+
$flags$: 0,
|
|
321
|
+
$hostId$: childIdSplt[1],
|
|
322
|
+
$nodeId$: childIdSplt[2],
|
|
323
|
+
$depth$: childIdSplt[3],
|
|
324
|
+
$index$: childIdSplt[4],
|
|
325
|
+
$elm$: node,
|
|
326
|
+
$attrs$: null,
|
|
327
|
+
$children$: null,
|
|
328
|
+
$key$: null,
|
|
329
|
+
$name$: null,
|
|
330
|
+
$tag$: null,
|
|
331
|
+
$text$: null,
|
|
332
|
+
};
|
|
333
|
+
if (childNodeType === TEXT_NODE_ID) {
|
|
334
|
+
childVNode.$elm$ = node.nextSibling;
|
|
335
|
+
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
336
|
+
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
337
|
+
childRenderNodes.push(childVNode);
|
|
338
|
+
// remove the text comment since it's no longer needed
|
|
339
|
+
node.remove();
|
|
340
|
+
if (!parentVNode.$children$) {
|
|
341
|
+
parentVNode.$children$ = [];
|
|
448
342
|
}
|
|
449
|
-
|
|
450
|
-
|
|
343
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
344
|
+
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
345
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
451
346
|
}
|
|
452
347
|
}
|
|
453
|
-
catch (e) { }
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Need to manually update attribute if:
|
|
457
|
-
* - memberName is not an attribute
|
|
458
|
-
* - if we are rendering the host element in order to reflect attribute
|
|
459
|
-
* - if it's a SVG, since properties might not work in <svg>
|
|
460
|
-
* - if the newValue is null/undefined or 'false'.
|
|
461
|
-
*/
|
|
462
|
-
let xlink = false;
|
|
463
|
-
{
|
|
464
|
-
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
|
465
|
-
memberName = ln;
|
|
466
|
-
xlink = true;
|
|
467
|
-
}
|
|
468
348
|
}
|
|
469
|
-
if (
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
349
|
+
else if (childVNode.$hostId$ === hostId) {
|
|
350
|
+
// this comment node is specifcally for this host id
|
|
351
|
+
if (childNodeType === SLOT_NODE_ID) {
|
|
352
|
+
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
353
|
+
childVNode.$tag$ = 'slot';
|
|
354
|
+
if (childIdSplt[5]) {
|
|
355
|
+
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
473
356
|
}
|
|
474
357
|
else {
|
|
475
|
-
|
|
358
|
+
node['s-sn'] = '';
|
|
476
359
|
}
|
|
360
|
+
node['s-sr'] = true;
|
|
361
|
+
if (shadowRootNodes) {
|
|
362
|
+
// browser support shadowRoot and this is a shadow dom component
|
|
363
|
+
// create an actual slot element
|
|
364
|
+
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
365
|
+
if (childVNode.$name$) {
|
|
366
|
+
// add the slot name attribute
|
|
367
|
+
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
368
|
+
}
|
|
369
|
+
// insert the new slot element before the slot comment
|
|
370
|
+
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
371
|
+
// remove the slot comment since it's not needed for shadow
|
|
372
|
+
node.remove();
|
|
373
|
+
if (childVNode.$depth$ === '0') {
|
|
374
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
slotNodes.push(childVNode);
|
|
378
|
+
if (!parentVNode.$children$) {
|
|
379
|
+
parentVNode.$children$ = [];
|
|
380
|
+
}
|
|
381
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
477
382
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
383
|
+
else if (childNodeType === CONTENT_REF_ID) {
|
|
384
|
+
// `${CONTENT_REF_ID}.${hostId}`;
|
|
385
|
+
if (shadowRootNodes) {
|
|
386
|
+
// remove the content ref comment since it's not needed for shadow
|
|
387
|
+
node.remove();
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
hostElm['s-cr'] = node;
|
|
391
|
+
node['s-cn'] = true;
|
|
392
|
+
}
|
|
486
393
|
}
|
|
487
394
|
}
|
|
488
395
|
}
|
|
489
396
|
}
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
496
|
-
// if it's not a shadow root, then we add attrs/props to the same element
|
|
497
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
498
|
-
? newVnode.$elm$.host
|
|
499
|
-
: newVnode.$elm$;
|
|
500
|
-
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
501
|
-
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
502
|
-
{
|
|
503
|
-
// remove attributes no longer present on the vnode by setting them to undefined
|
|
504
|
-
for (memberName in oldVnodeAttrs) {
|
|
505
|
-
if (!(memberName in newVnodeAttrs)) {
|
|
506
|
-
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
// add new & update changed attributes
|
|
511
|
-
for (memberName in newVnodeAttrs) {
|
|
512
|
-
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
397
|
+
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
398
|
+
const vnode = newVNode(null, node.textContent);
|
|
399
|
+
vnode.$elm$ = node;
|
|
400
|
+
vnode.$index$ = '0';
|
|
401
|
+
parentVNode.$children$ = [vnode];
|
|
513
402
|
}
|
|
514
403
|
};
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
checkSlotRelocate = true;
|
|
525
|
-
if (newVNode.$tag$ === 'slot') {
|
|
526
|
-
if (scopeId) {
|
|
527
|
-
// scoped css needs to add its scoped id to the parent element
|
|
528
|
-
parentElm.classList.add(scopeId + '-s');
|
|
404
|
+
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
405
|
+
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
406
|
+
let i = 0;
|
|
407
|
+
for (; i < node.childNodes.length; i++) {
|
|
408
|
+
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
409
|
+
}
|
|
410
|
+
if (node.shadowRoot) {
|
|
411
|
+
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
412
|
+
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
529
413
|
}
|
|
530
|
-
newVNode.$flags$ |= newVNode.$children$
|
|
531
|
-
? // slot element has fallback content
|
|
532
|
-
2 /* isSlotFallback */
|
|
533
|
-
: // slot element does not have fallback content
|
|
534
|
-
1 /* isSlotReference */;
|
|
535
414
|
}
|
|
536
415
|
}
|
|
537
|
-
if (
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
else {
|
|
547
|
-
if (!isSvgMode) {
|
|
548
|
-
isSvgMode = newVNode.$tag$ === 'svg';
|
|
549
|
-
}
|
|
550
|
-
// create element
|
|
551
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
552
|
-
? 'slot-fb'
|
|
553
|
-
: newVNode.$tag$)
|
|
554
|
-
);
|
|
555
|
-
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
556
|
-
isSvgMode = false;
|
|
557
|
-
}
|
|
558
|
-
// add css classes, attrs, props, listeners, etc.
|
|
559
|
-
{
|
|
560
|
-
updateElement(null, newVNode, isSvgMode);
|
|
416
|
+
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
417
|
+
const childIdSplt = node.nodeValue.split('.');
|
|
418
|
+
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
419
|
+
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
420
|
+
node.nodeValue = '';
|
|
421
|
+
// useful to know if the original location is
|
|
422
|
+
// the root light-dom of a shadow dom component
|
|
423
|
+
node['s-en'] = childIdSplt[3];
|
|
561
424
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Parse a new property value for a given property type.
|
|
429
|
+
*
|
|
430
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
431
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
432
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
433
|
+
* 2. the type stored from `propType`.
|
|
434
|
+
*
|
|
435
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
436
|
+
*
|
|
437
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
438
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
439
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
440
|
+
* ```tsx
|
|
441
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
442
|
+
* ```
|
|
443
|
+
*
|
|
444
|
+
* HTML prop values on the other hand, will always a string
|
|
445
|
+
*
|
|
446
|
+
* @param propValue the new value to coerce to some type
|
|
447
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
448
|
+
* @returns the parsed/coerced value
|
|
449
|
+
*/
|
|
450
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
451
|
+
// ensure this value is of the correct prop type
|
|
452
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
453
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
454
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
455
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
456
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
577
457
|
}
|
|
578
|
-
{
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
isSvgMode = false;
|
|
582
|
-
}
|
|
583
|
-
else if (elm.tagName === 'foreignObject') {
|
|
584
|
-
// Reenter SVG context when we're exiting <foreignObject> element
|
|
585
|
-
isSvgMode = true;
|
|
586
|
-
}
|
|
458
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
459
|
+
// force it to be a number
|
|
460
|
+
return parseFloat(propValue);
|
|
587
461
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
// remember the content reference comment
|
|
593
|
-
elm['s-sr'] = true;
|
|
594
|
-
// remember the content reference comment
|
|
595
|
-
elm['s-cr'] = contentRef;
|
|
596
|
-
// remember the slot name, or empty string for default slot
|
|
597
|
-
elm['s-sn'] = newVNode.$name$ || '';
|
|
598
|
-
// check if we've got an old vnode for this slot
|
|
599
|
-
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
600
|
-
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
601
|
-
// we've got an old slot vnode and the wrapper is being replaced
|
|
602
|
-
// so let's move the old slot content back to it's original location
|
|
603
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
604
|
-
}
|
|
462
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
463
|
+
// could have been passed as a number or boolean
|
|
464
|
+
// but we still want it as a string
|
|
465
|
+
return String(propValue);
|
|
605
466
|
}
|
|
467
|
+
// redundant return here for better minification
|
|
468
|
+
return propValue;
|
|
606
469
|
}
|
|
607
|
-
|
|
470
|
+
// not sure exactly what type we want
|
|
471
|
+
// so no need to change to a different type
|
|
472
|
+
return propValue;
|
|
608
473
|
};
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
474
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
475
|
+
const createEvent = (ref, name, flags) => {
|
|
476
|
+
const elm = getElement(ref);
|
|
477
|
+
return {
|
|
478
|
+
emit: (detail) => {
|
|
479
|
+
return emitEvent(elm, name, {
|
|
480
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
481
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
482
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
483
|
+
detail,
|
|
484
|
+
});
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
490
|
+
* @param elm the target of the Event
|
|
491
|
+
* @param name the name to give the custom Event
|
|
492
|
+
* @param opts options for configuring a custom Event
|
|
493
|
+
* @returns the custom Event
|
|
494
|
+
*/
|
|
495
|
+
const emitEvent = (elm, name, opts) => {
|
|
496
|
+
const ev = plt.ce(name, opts);
|
|
497
|
+
elm.dispatchEvent(ev);
|
|
498
|
+
return ev;
|
|
499
|
+
};
|
|
500
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
501
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
502
|
+
let style = styles.get(scopeId);
|
|
503
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
504
|
+
style = (style || new CSSStyleSheet());
|
|
505
|
+
if (typeof style === 'string') {
|
|
506
|
+
style = cssText;
|
|
626
507
|
}
|
|
627
|
-
|
|
628
|
-
|
|
508
|
+
else {
|
|
509
|
+
style.replaceSync(cssText);
|
|
629
510
|
}
|
|
630
511
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
634
|
-
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
635
|
-
let childNode;
|
|
636
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
637
|
-
containerElm = containerElm.shadowRoot;
|
|
638
|
-
}
|
|
639
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
640
|
-
if (vnodes[startIdx]) {
|
|
641
|
-
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
642
|
-
if (childNode) {
|
|
643
|
-
vnodes[startIdx].$elm$ = childNode;
|
|
644
|
-
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
645
|
-
}
|
|
646
|
-
}
|
|
512
|
+
else {
|
|
513
|
+
style = cssText;
|
|
647
514
|
}
|
|
515
|
+
styles.set(scopeId, style);
|
|
648
516
|
};
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
517
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
518
|
+
let scopeId = getScopeId(cmpMeta);
|
|
519
|
+
const style = styles.get(scopeId);
|
|
520
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
521
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
522
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
523
|
+
if (style) {
|
|
524
|
+
if (typeof style === 'string') {
|
|
525
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
526
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
527
|
+
let styleElm;
|
|
528
|
+
if (!appliedStyles) {
|
|
529
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
530
|
+
}
|
|
531
|
+
if (!appliedStyles.has(scopeId)) {
|
|
532
|
+
if (styleContainerNode.host &&
|
|
533
|
+
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
534
|
+
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
535
|
+
styleElm.innerHTML = style;
|
|
661
536
|
}
|
|
662
537
|
else {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
538
|
+
{
|
|
539
|
+
styleElm = doc.createElement('style');
|
|
540
|
+
styleElm.innerHTML = style;
|
|
541
|
+
}
|
|
542
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
543
|
+
}
|
|
544
|
+
if (appliedStyles) {
|
|
545
|
+
appliedStyles.add(scopeId);
|
|
666
546
|
}
|
|
667
547
|
}
|
|
668
|
-
|
|
669
|
-
|
|
548
|
+
}
|
|
549
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
550
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
670
551
|
}
|
|
671
552
|
}
|
|
553
|
+
return scopeId;
|
|
672
554
|
};
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
else if (oldEndVnode == null) {
|
|
692
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
693
|
-
}
|
|
694
|
-
else if (newStartVnode == null) {
|
|
695
|
-
newStartVnode = newCh[++newStartIdx];
|
|
555
|
+
const attachStyles = (hostRef) => {
|
|
556
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
557
|
+
const elm = hostRef.$hostElement$;
|
|
558
|
+
const flags = cmpMeta.$flags$;
|
|
559
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
560
|
+
const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
561
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
562
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
563
|
+
// or this browser doesn't support native shadow dom
|
|
564
|
+
// and this host element was NOT created with SSR
|
|
565
|
+
// let's pick out the inner content for slot projection
|
|
566
|
+
// create a node to represent where the original
|
|
567
|
+
// content was first placed, which is useful later on
|
|
568
|
+
// DOM WRITE!!
|
|
569
|
+
elm['s-sc'] = scopeId;
|
|
570
|
+
elm.classList.add(scopeId + '-h');
|
|
571
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
572
|
+
elm.classList.add(scopeId + '-s');
|
|
696
573
|
}
|
|
697
|
-
|
|
698
|
-
|
|
574
|
+
}
|
|
575
|
+
endAttachStyles();
|
|
576
|
+
};
|
|
577
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
578
|
+
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
579
|
+
/**
|
|
580
|
+
* Production setAccessor() function based on Preact by
|
|
581
|
+
* Jason Miller (@developit)
|
|
582
|
+
* Licensed under the MIT License
|
|
583
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
|
584
|
+
*
|
|
585
|
+
* Modified for Stencil's compiler and vdom
|
|
586
|
+
*/
|
|
587
|
+
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
588
|
+
if (oldValue !== newValue) {
|
|
589
|
+
let isProp = isMemberInElement(elm, memberName);
|
|
590
|
+
let ln = memberName.toLowerCase();
|
|
591
|
+
if (memberName === 'class') {
|
|
592
|
+
const classList = elm.classList;
|
|
593
|
+
const oldClasses = parseClassList(oldValue);
|
|
594
|
+
const newClasses = parseClassList(newValue);
|
|
595
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
596
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
699
597
|
}
|
|
700
|
-
else if (
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
598
|
+
else if (memberName === 'style') {
|
|
599
|
+
// update style attribute, css properties and values
|
|
600
|
+
{
|
|
601
|
+
for (const prop in oldValue) {
|
|
602
|
+
if (!newValue || newValue[prop] == null) {
|
|
603
|
+
if (prop.includes('-')) {
|
|
604
|
+
elm.style.removeProperty(prop);
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
elm.style[prop] = '';
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
for (const prop in newValue) {
|
|
613
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
614
|
+
if (prop.includes('-')) {
|
|
615
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
elm.style[prop] = newValue[prop];
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
709
622
|
}
|
|
710
|
-
else if (
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
623
|
+
else if (memberName === 'key')
|
|
624
|
+
;
|
|
625
|
+
else if (memberName === 'ref') {
|
|
626
|
+
// minifier will clean this up
|
|
627
|
+
if (newValue) {
|
|
628
|
+
newValue(elm);
|
|
714
629
|
}
|
|
715
|
-
patch(oldStartVnode, newEndVnode);
|
|
716
|
-
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
717
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
718
|
-
newEndVnode = newCh[--newEndIdx];
|
|
719
630
|
}
|
|
720
|
-
else if (
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
631
|
+
else if ((!isProp ) &&
|
|
632
|
+
memberName[0] === 'o' &&
|
|
633
|
+
memberName[1] === 'n') {
|
|
634
|
+
// Event Handlers
|
|
635
|
+
// so if the member name starts with "on" and the 3rd characters is
|
|
636
|
+
// a capital letter, and it's not already a member on the element,
|
|
637
|
+
// then we're assuming it's an event listener
|
|
638
|
+
if (memberName[2] === '-') {
|
|
639
|
+
// on- prefixed events
|
|
640
|
+
// allows to be explicit about the dom event to listen without any magic
|
|
641
|
+
// under the hood:
|
|
642
|
+
// <my-cmp on-click> // listens for "click"
|
|
643
|
+
// <my-cmp on-Click> // listens for "Click"
|
|
644
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
|
645
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
|
646
|
+
memberName = memberName.slice(3);
|
|
647
|
+
}
|
|
648
|
+
else if (isMemberInElement(win, ln)) {
|
|
649
|
+
// standard event
|
|
650
|
+
// the JSX attribute could have been "onMouseOver" and the
|
|
651
|
+
// member name "onmouseover" is on the window's prototype
|
|
652
|
+
// so let's add the listener "mouseover", which is all lowercased
|
|
653
|
+
memberName = ln.slice(2);
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
// custom event
|
|
657
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
|
658
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
|
659
|
+
// and add the listener "myCustomEvent"
|
|
660
|
+
// except for the first character, we keep the event name case
|
|
661
|
+
memberName = ln[2] + memberName.slice(3);
|
|
662
|
+
}
|
|
663
|
+
if (oldValue) {
|
|
664
|
+
plt.rel(elm, memberName, oldValue, false);
|
|
665
|
+
}
|
|
666
|
+
if (newValue) {
|
|
667
|
+
plt.ael(elm, memberName, newValue, false);
|
|
724
668
|
}
|
|
725
|
-
patch(oldEndVnode, newStartVnode);
|
|
726
|
-
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
727
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
728
|
-
newStartVnode = newCh[++newStartIdx];
|
|
729
669
|
}
|
|
730
670
|
else {
|
|
731
|
-
//
|
|
732
|
-
|
|
671
|
+
// Set property if it exists and it's not a SVG
|
|
672
|
+
const isComplex = isComplexType(newValue);
|
|
673
|
+
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
674
|
+
try {
|
|
675
|
+
if (!elm.tagName.includes('-')) {
|
|
676
|
+
const n = newValue == null ? '' : newValue;
|
|
677
|
+
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
678
|
+
if (memberName === 'list') {
|
|
679
|
+
isProp = false;
|
|
680
|
+
}
|
|
681
|
+
else if (oldValue == null || elm[memberName] != n) {
|
|
682
|
+
elm[memberName] = n;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
elm[memberName] = newValue;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
catch (e) { }
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Need to manually update attribute if:
|
|
693
|
+
* - memberName is not an attribute
|
|
694
|
+
* - if we are rendering the host element in order to reflect attribute
|
|
695
|
+
* - if it's a SVG, since properties might not work in <svg>
|
|
696
|
+
* - if the newValue is null/undefined or 'false'.
|
|
697
|
+
*/
|
|
698
|
+
let xlink = false;
|
|
733
699
|
{
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
700
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
|
701
|
+
memberName = ln;
|
|
702
|
+
xlink = true;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (newValue == null || newValue === false) {
|
|
706
|
+
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
707
|
+
if (xlink) {
|
|
708
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
elm.removeAttribute(memberName);
|
|
738
712
|
}
|
|
739
713
|
}
|
|
740
714
|
}
|
|
741
|
-
if (
|
|
742
|
-
|
|
743
|
-
if (
|
|
744
|
-
|
|
715
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
716
|
+
newValue = newValue === true ? '' : newValue;
|
|
717
|
+
if (xlink) {
|
|
718
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
745
719
|
}
|
|
746
720
|
else {
|
|
747
|
-
|
|
748
|
-
oldCh[idxInOld] = undefined;
|
|
749
|
-
node = elmToMove.$elm$;
|
|
721
|
+
elm.setAttribute(memberName, newValue);
|
|
750
722
|
}
|
|
751
|
-
newStartVnode = newCh[++newStartIdx];
|
|
752
723
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
const parseClassListRegex = /\s/;
|
|
728
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
|
729
|
+
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
730
|
+
// if the element passed in is a shadow root, which is a document fragment
|
|
731
|
+
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
732
|
+
// if it's not a shadow root, then we add attrs/props to the same element
|
|
733
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
734
|
+
? newVnode.$elm$.host
|
|
735
|
+
: newVnode.$elm$;
|
|
736
|
+
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
737
|
+
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
738
|
+
{
|
|
739
|
+
// remove attributes no longer present on the vnode by setting them to undefined
|
|
740
|
+
for (memberName in oldVnodeAttrs) {
|
|
741
|
+
if (!(memberName in newVnodeAttrs)) {
|
|
742
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
|
757
743
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
// add new & update changed attributes
|
|
747
|
+
for (memberName in newVnodeAttrs) {
|
|
748
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
753
|
+
*
|
|
754
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
755
|
+
* @param newParentVNode the parent VNode from the current render
|
|
756
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
757
|
+
* children, for which we will create a new DOM node
|
|
758
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
759
|
+
* @returns the newly created node
|
|
760
|
+
*/
|
|
761
|
+
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
762
|
+
// tslint:disable-next-line: prefer-const
|
|
763
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
|
764
|
+
let i = 0;
|
|
765
|
+
let elm;
|
|
766
|
+
let childNode;
|
|
767
|
+
let oldVNode;
|
|
768
|
+
if (!useNativeShadowDom) {
|
|
769
|
+
// remember for later we need to check to relocate nodes
|
|
770
|
+
checkSlotRelocate = true;
|
|
771
|
+
if (newVNode.$tag$ === 'slot') {
|
|
772
|
+
if (scopeId) {
|
|
773
|
+
// scoped css needs to add its scoped id to the parent element
|
|
774
|
+
parentElm.classList.add(scopeId + '-s');
|
|
762
775
|
}
|
|
776
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
777
|
+
? // slot element has fallback content
|
|
778
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
779
|
+
: // slot element does not have fallback content
|
|
780
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
763
781
|
}
|
|
764
782
|
}
|
|
765
|
-
if (
|
|
766
|
-
|
|
783
|
+
if (newVNode.$text$ !== null) {
|
|
784
|
+
// create text node
|
|
785
|
+
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
767
786
|
}
|
|
768
|
-
else if (
|
|
769
|
-
|
|
787
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
788
|
+
// create a slot reference node
|
|
789
|
+
elm = newVNode.$elm$ =
|
|
790
|
+
doc.createTextNode('');
|
|
770
791
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
// need to have the same element tag, and same key to be the same
|
|
775
|
-
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
776
|
-
if (vnode1.$tag$ === 'slot') {
|
|
777
|
-
return vnode1.$name$ === vnode2.$name$;
|
|
792
|
+
else {
|
|
793
|
+
if (!isSvgMode) {
|
|
794
|
+
isSvgMode = newVNode.$tag$ === 'svg';
|
|
778
795
|
}
|
|
779
|
-
|
|
780
|
-
|
|
796
|
+
// create element
|
|
797
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
798
|
+
? 'slot-fb'
|
|
799
|
+
: newVNode.$tag$)
|
|
800
|
+
);
|
|
801
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
802
|
+
isSvgMode = false;
|
|
781
803
|
}
|
|
782
|
-
|
|
783
|
-
return false;
|
|
784
|
-
};
|
|
785
|
-
const referenceNode = (node) => {
|
|
786
|
-
// this node was relocated to a new location in the dom
|
|
787
|
-
// because of some other component's slot
|
|
788
|
-
// but we still have an html comment in place of where
|
|
789
|
-
// it's original location was according to it's original vdom
|
|
790
|
-
return (node && node['s-ol']) || node;
|
|
791
|
-
};
|
|
792
|
-
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
793
|
-
const patch = (oldVNode, newVNode) => {
|
|
794
|
-
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
795
|
-
const oldChildren = oldVNode.$children$;
|
|
796
|
-
const newChildren = newVNode.$children$;
|
|
797
|
-
const tag = newVNode.$tag$;
|
|
798
|
-
const text = newVNode.$text$;
|
|
799
|
-
let defaultHolder;
|
|
800
|
-
if (text === null) {
|
|
804
|
+
// add css classes, attrs, props, listeners, etc.
|
|
801
805
|
{
|
|
802
|
-
|
|
803
|
-
// only add this to the when the compiler sees we're using an svg somewhere
|
|
804
|
-
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
806
|
+
updateElement(null, newVNode, isSvgMode);
|
|
805
807
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
else {
|
|
811
|
-
// either this is the first render of an element OR it's an update
|
|
812
|
-
// AND we already know it's possible it could have changed
|
|
813
|
-
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
814
|
-
updateElement(oldVNode, newVNode, isSvgMode);
|
|
815
|
-
}
|
|
808
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
809
|
+
// if there is a scopeId and this is the initial render
|
|
810
|
+
// then let's add the scopeId as a css class
|
|
811
|
+
elm.classList.add((elm['s-si'] = scopeId));
|
|
816
812
|
}
|
|
817
|
-
if (
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
813
|
+
if (newVNode.$children$) {
|
|
814
|
+
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
815
|
+
// create the node
|
|
816
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
817
|
+
// return node could have been null
|
|
818
|
+
if (childNode) {
|
|
819
|
+
// append our new node
|
|
820
|
+
elm.appendChild(childNode);
|
|
821
|
+
}
|
|
826
822
|
}
|
|
827
|
-
// add the new vnode children
|
|
828
|
-
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
829
|
-
}
|
|
830
|
-
else if (oldChildren !== null) {
|
|
831
|
-
// no new child vnodes, but there are old child vnodes to remove
|
|
832
|
-
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
833
823
|
}
|
|
834
|
-
|
|
835
|
-
|
|
824
|
+
{
|
|
825
|
+
if (newVNode.$tag$ === 'svg') {
|
|
826
|
+
// Only reset the SVG context when we're exiting <svg> element
|
|
827
|
+
isSvgMode = false;
|
|
828
|
+
}
|
|
829
|
+
else if (elm.tagName === 'foreignObject') {
|
|
830
|
+
// Reenter SVG context when we're exiting <foreignObject> element
|
|
831
|
+
isSvgMode = true;
|
|
832
|
+
}
|
|
836
833
|
}
|
|
837
834
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
835
|
+
{
|
|
836
|
+
elm['s-hn'] = hostTagName;
|
|
837
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
838
|
+
// remember the content reference comment
|
|
839
|
+
elm['s-sr'] = true;
|
|
840
|
+
// remember the content reference comment
|
|
841
|
+
elm['s-cr'] = contentRef;
|
|
842
|
+
// remember the slot name, or empty string for default slot
|
|
843
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
844
|
+
// check if we've got an old vnode for this slot
|
|
845
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
846
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
847
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
848
|
+
// so let's move the old slot content back to it's original location
|
|
849
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
841
852
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
853
|
+
return elm;
|
|
854
|
+
};
|
|
855
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
856
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
857
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
858
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
859
|
+
const childNode = oldSlotChildNodes[i];
|
|
860
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
861
|
+
// // this child node in the old element is from another component
|
|
862
|
+
// // remove this node from the old slot's parent
|
|
863
|
+
// childNode.remove();
|
|
864
|
+
// and relocate it back to it's original location
|
|
865
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
866
|
+
// remove the old original location comment entirely
|
|
867
|
+
// later on the patch function will know what to do
|
|
868
|
+
// and move this to the correct spot in need be
|
|
869
|
+
childNode['s-ol'].remove();
|
|
870
|
+
childNode['s-ol'] = undefined;
|
|
871
|
+
checkSlotRelocate = true;
|
|
872
|
+
}
|
|
873
|
+
if (recursive) {
|
|
874
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
875
|
+
}
|
|
846
876
|
}
|
|
877
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
847
878
|
};
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
const childNodes = elm.childNodes;
|
|
879
|
+
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
880
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
851
881
|
let childNode;
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
// this is a slot fallback node
|
|
862
|
-
// get the slot name for this slot reference node
|
|
863
|
-
slotNameAttr = childNode['s-sn'];
|
|
864
|
-
// by default always show a fallback slot node
|
|
865
|
-
// then hide it if there are other slots in the light dom
|
|
866
|
-
childNode.hidden = false;
|
|
867
|
-
for (j = 0; j < ilen; j++) {
|
|
868
|
-
nodeType = childNodes[j].nodeType;
|
|
869
|
-
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
870
|
-
// this sibling node is from a different component OR is a named fallback slot node
|
|
871
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
872
|
-
childNode.hidden = true;
|
|
873
|
-
break;
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
else {
|
|
877
|
-
// this is a default fallback slot node
|
|
878
|
-
// any element or text node (with content)
|
|
879
|
-
// should hide the default fallback slot node
|
|
880
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
881
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
882
|
-
childNode.hidden = true;
|
|
883
|
-
break;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
}
|
|
882
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
883
|
+
containerElm = containerElm.shadowRoot;
|
|
884
|
+
}
|
|
885
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
886
|
+
if (vnodes[startIdx]) {
|
|
887
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
888
|
+
if (childNode) {
|
|
889
|
+
vnodes[startIdx].$elm$ = childNode;
|
|
890
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
887
891
|
}
|
|
888
|
-
// keep drilling down
|
|
889
|
-
updateFallbackSlotVisibility(childNode);
|
|
890
892
|
}
|
|
891
893
|
}
|
|
892
894
|
};
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
hostContentNodes = node.parentNode.childNodes;
|
|
911
|
-
slotNameAttr = childNode['s-sn'];
|
|
912
|
-
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
913
|
-
node = hostContentNodes[j];
|
|
914
|
-
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
915
|
-
// let's do some relocating to its new home
|
|
916
|
-
// but never relocate a content reference node
|
|
917
|
-
// that is suppose to always represent the original content location
|
|
918
|
-
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
919
|
-
// it's possible we've already decided to relocate this node
|
|
920
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
921
|
-
// made some changes to slots
|
|
922
|
-
// let's make sure we also double check
|
|
923
|
-
// fallbacks are correctly hidden or shown
|
|
924
|
-
checkSlotFallbackVisibility = true;
|
|
925
|
-
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
926
|
-
if (relocateNodeData) {
|
|
927
|
-
// previously we never found a slot home for this node
|
|
928
|
-
// but turns out we did, so let's remember it now
|
|
929
|
-
relocateNodeData.$slotRefNode$ = childNode;
|
|
930
|
-
}
|
|
931
|
-
else {
|
|
932
|
-
// add to our list of nodes to relocate
|
|
933
|
-
relocateNodes.push({
|
|
934
|
-
$slotRefNode$: childNode,
|
|
935
|
-
$nodeToRelocate$: node,
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
if (node['s-sr']) {
|
|
939
|
-
relocateNodes.map((relocateNode) => {
|
|
940
|
-
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
941
|
-
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
942
|
-
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
943
|
-
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
950
|
-
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
951
|
-
// if we never find a home for this element then we'll need to hide it
|
|
952
|
-
relocateNodes.push({
|
|
953
|
-
$nodeToRelocate$: node,
|
|
954
|
-
});
|
|
955
|
-
}
|
|
895
|
+
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
896
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
897
|
+
if ((vnode = vnodes[startIdx])) {
|
|
898
|
+
elm = vnode.$elm$;
|
|
899
|
+
callNodeRefs(vnode);
|
|
900
|
+
{
|
|
901
|
+
// we're removing this element
|
|
902
|
+
// so it's possible we need to show slot fallback content now
|
|
903
|
+
checkSlotFallbackVisibility = true;
|
|
904
|
+
if (elm['s-ol']) {
|
|
905
|
+
// remove the original location comment
|
|
906
|
+
elm['s-ol'].remove();
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
// it's possible that child nodes of the node
|
|
910
|
+
// that's being removed are slot nodes
|
|
911
|
+
putBackInOriginalLocation(elm, true);
|
|
956
912
|
}
|
|
957
913
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
relocateSlotContent(childNode);
|
|
914
|
+
// remove the vnode's element from the dom
|
|
915
|
+
elm.remove();
|
|
961
916
|
}
|
|
962
917
|
}
|
|
963
918
|
};
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
919
|
+
/**
|
|
920
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
921
|
+
* traversing the two collections of children, identifying nodes that are
|
|
922
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
923
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
924
|
+
*
|
|
925
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
926
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
927
|
+
* 'windows' by storing start and end indices and references to the
|
|
928
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
929
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
930
|
+
* no children left to update by doing the following:
|
|
931
|
+
*
|
|
932
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
933
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
934
|
+
* only with a window bounded by the highlighted elements:
|
|
935
|
+
*
|
|
936
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
937
|
+
* ^^^^^^ ^^^^^^
|
|
938
|
+
*
|
|
939
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
940
|
+
* across the windows. This will basically detect elements which haven't
|
|
941
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
942
|
+
* VNode elements (represented as HTML):
|
|
943
|
+
*
|
|
944
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
945
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
946
|
+
*
|
|
947
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
948
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
949
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
950
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
951
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
952
|
+
*
|
|
953
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
954
|
+
* window corresponds to the element at the end of the other window. This is
|
|
955
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
956
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
957
|
+
* children nodes themselves have not changed but merely moved in the
|
|
958
|
+
* following example:
|
|
959
|
+
*
|
|
960
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
961
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
962
|
+
*
|
|
963
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
964
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
965
|
+
* DOM.
|
|
966
|
+
*
|
|
967
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
968
|
+
* nodes in the old children which have the same key as the first element in
|
|
969
|
+
* our window on the new children. If we find such a node we handle calling
|
|
970
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
971
|
+
* what we find.
|
|
972
|
+
*
|
|
973
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
974
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
975
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
976
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
977
|
+
* children has collapsed we still have more nodes on the new children that
|
|
978
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
979
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
980
|
+
* sure the corresponding DOM nodes are removed.
|
|
981
|
+
*
|
|
982
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
983
|
+
* @param oldCh the old children of the parent node
|
|
984
|
+
* @param newVNode the new VNode which will replace the parent
|
|
985
|
+
* @param newCh the new children of the parent node
|
|
986
|
+
*/
|
|
987
|
+
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
988
|
+
let oldStartIdx = 0;
|
|
989
|
+
let newStartIdx = 0;
|
|
990
|
+
let idxInOld = 0;
|
|
991
|
+
let i = 0;
|
|
992
|
+
let oldEndIdx = oldCh.length - 1;
|
|
993
|
+
let oldStartVnode = oldCh[0];
|
|
994
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
995
|
+
let newEndIdx = newCh.length - 1;
|
|
996
|
+
let newStartVnode = newCh[0];
|
|
997
|
+
let newEndVnode = newCh[newEndIdx];
|
|
998
|
+
let node;
|
|
999
|
+
let elmToMove;
|
|
1000
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
1001
|
+
if (oldStartVnode == null) {
|
|
1002
|
+
// VNode might have been moved left
|
|
1003
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
968
1004
|
}
|
|
969
|
-
if (
|
|
970
|
-
|
|
1005
|
+
else if (oldEndVnode == null) {
|
|
1006
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
971
1007
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
// the disconnectCallback from working
|
|
1013
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1014
|
-
if (checkSlotRelocate) {
|
|
1015
|
-
relocateSlotContent(rootVnode.$elm$);
|
|
1016
|
-
let relocateData;
|
|
1017
|
-
let nodeToRelocate;
|
|
1018
|
-
let orgLocationNode;
|
|
1019
|
-
let parentNodeRef;
|
|
1020
|
-
let insertBeforeNode;
|
|
1021
|
-
let refNode;
|
|
1022
|
-
let i = 0;
|
|
1023
|
-
for (; i < relocateNodes.length; i++) {
|
|
1024
|
-
relocateData = relocateNodes[i];
|
|
1025
|
-
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1026
|
-
if (!nodeToRelocate['s-ol']) {
|
|
1027
|
-
// add a reference node marking this node's original location
|
|
1028
|
-
// keep a reference to this node for later lookups
|
|
1029
|
-
orgLocationNode =
|
|
1030
|
-
doc.createTextNode('');
|
|
1031
|
-
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1032
|
-
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1033
|
-
}
|
|
1008
|
+
else if (newStartVnode == null) {
|
|
1009
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1010
|
+
}
|
|
1011
|
+
else if (newEndVnode == null) {
|
|
1012
|
+
newEndVnode = newCh[--newEndIdx];
|
|
1013
|
+
}
|
|
1014
|
+
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
1015
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
1016
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
1017
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
1018
|
+
// since things are matched up in order.
|
|
1019
|
+
patch(oldStartVnode, newStartVnode);
|
|
1020
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
1021
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1022
|
+
}
|
|
1023
|
+
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
1024
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
1025
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
1026
|
+
// need to move any DOM Nodes.
|
|
1027
|
+
patch(oldEndVnode, newEndVnode);
|
|
1028
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
1029
|
+
newEndVnode = newCh[--newEndIdx];
|
|
1030
|
+
}
|
|
1031
|
+
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
1032
|
+
// case: "Vnode moved right"
|
|
1033
|
+
//
|
|
1034
|
+
// We've found that the last node in our window on the new children is
|
|
1035
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
1036
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
1037
|
+
// nodes:
|
|
1038
|
+
//
|
|
1039
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
1040
|
+
// ^^^^^^^^^^^
|
|
1041
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
1042
|
+
// ^^^^^^^^^^^^^
|
|
1043
|
+
//
|
|
1044
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
1045
|
+
// and move the DOM element for `oldStartVnode`.
|
|
1046
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
1047
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
1034
1048
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1049
|
+
patch(oldStartVnode, newEndVnode);
|
|
1050
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
1051
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
1052
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
1053
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
1054
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
1055
|
+
//
|
|
1056
|
+
// <old-start-node />
|
|
1057
|
+
// <some-intervening-node />
|
|
1058
|
+
// <old-end-node />
|
|
1059
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
1060
|
+
// <next-sibling />
|
|
1061
|
+
//
|
|
1062
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
1063
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
1064
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
1065
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
1066
|
+
// append it to the children of the parent element.
|
|
1067
|
+
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
1068
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
1069
|
+
newEndVnode = newCh[--newEndIdx];
|
|
1070
|
+
}
|
|
1071
|
+
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
1072
|
+
// case: "Vnode moved left"
|
|
1073
|
+
//
|
|
1074
|
+
// We've found that the first node in our window on the new children is
|
|
1075
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
1076
|
+
// Visually, this is the layout of these two nodes:
|
|
1077
|
+
//
|
|
1078
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
1079
|
+
// ^^^^^^^^^^^^^
|
|
1080
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
1081
|
+
// ^^^^^^^^^^^
|
|
1082
|
+
//
|
|
1083
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
1084
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
1085
|
+
// children etc) but we also need to move the DOM node to which
|
|
1086
|
+
// `oldEndVnode` corresponds.
|
|
1087
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
1088
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
1089
|
+
}
|
|
1090
|
+
patch(oldEndVnode, newStartVnode);
|
|
1091
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
1092
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
1093
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
1094
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
1095
|
+
// future.
|
|
1096
|
+
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
1097
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
1098
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1099
|
+
}
|
|
1100
|
+
else {
|
|
1101
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
1102
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
1103
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
1104
|
+
// component.
|
|
1105
|
+
//
|
|
1106
|
+
// First we check to see if there are any nodes in the array of old
|
|
1107
|
+
// children which have the same key as the first node in the new
|
|
1108
|
+
// children.
|
|
1109
|
+
idxInOld = -1;
|
|
1110
|
+
{
|
|
1111
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
1112
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
1113
|
+
idxInOld = i;
|
|
1114
|
+
break;
|
|
1067
1115
|
}
|
|
1068
1116
|
}
|
|
1117
|
+
}
|
|
1118
|
+
if (idxInOld >= 0) {
|
|
1119
|
+
// We found a node in the old children which matches up with the first
|
|
1120
|
+
// node in the new children! So let's deal with that
|
|
1121
|
+
elmToMove = oldCh[idxInOld];
|
|
1122
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
1123
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
1124
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
|
1125
|
+
}
|
|
1069
1126
|
else {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1127
|
+
patch(elmToMove, newStartVnode);
|
|
1128
|
+
// invalidate the matching old node so that we won't try to update it
|
|
1129
|
+
// again later on
|
|
1130
|
+
oldCh[idxInOld] = undefined;
|
|
1131
|
+
node = elmToMove.$elm$;
|
|
1132
|
+
}
|
|
1133
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
// We either didn't find an element in the old children that matches
|
|
1137
|
+
// the key of the first new child OR the build is not using `key`
|
|
1138
|
+
// attributes at all. In either case we need to create a new element
|
|
1139
|
+
// for the new node.
|
|
1140
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
1141
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1142
|
+
}
|
|
1143
|
+
if (node) {
|
|
1144
|
+
// if we created a new node then handle inserting it to the DOM
|
|
1145
|
+
{
|
|
1146
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
1074
1147
|
}
|
|
1075
1148
|
}
|
|
1076
1149
|
}
|
|
1077
|
-
if (checkSlotFallbackVisibility) {
|
|
1078
|
-
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1079
|
-
}
|
|
1080
|
-
// done moving nodes around
|
|
1081
|
-
// allow the disconnect callback to work again
|
|
1082
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1083
|
-
// always reset
|
|
1084
|
-
relocateNodes.length = 0;
|
|
1085
1150
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
detail,
|
|
1097
|
-
});
|
|
1098
|
-
},
|
|
1099
|
-
};
|
|
1151
|
+
if (oldStartIdx > oldEndIdx) {
|
|
1152
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
1153
|
+
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
1154
|
+
}
|
|
1155
|
+
else if (newStartIdx > newEndIdx) {
|
|
1156
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
1157
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
1158
|
+
// relevant DOM nodes)
|
|
1159
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
1160
|
+
}
|
|
1100
1161
|
};
|
|
1101
1162
|
/**
|
|
1102
|
-
*
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1163
|
+
* Compare two VNodes to determine if they are the same
|
|
1164
|
+
*
|
|
1165
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
1166
|
+
* information set on the two VNodes and can be misleading under certain
|
|
1167
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
1168
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
1169
|
+
* checking that they have the same tag.
|
|
1170
|
+
*
|
|
1171
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
1172
|
+
* changing order within a `children` array or something along those lines then
|
|
1173
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
1174
|
+
*
|
|
1175
|
+
* @param leftVNode the first VNode to check
|
|
1176
|
+
* @param rightVNode the second VNode to check
|
|
1177
|
+
* @returns whether they're equal or not
|
|
1107
1178
|
*/
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1179
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
1180
|
+
// compare if two vnode to see if they're "technically" the same
|
|
1181
|
+
// need to have the same element tag, and same key to be the same
|
|
1182
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
1183
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
1184
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
1185
|
+
}
|
|
1186
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
1187
|
+
{
|
|
1188
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
1189
|
+
}
|
|
1116
1190
|
}
|
|
1191
|
+
return false;
|
|
1117
1192
|
};
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
return;
|
|
1125
|
-
}
|
|
1126
|
-
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
1127
|
-
// there is no ancestor component or the ancestor component
|
|
1128
|
-
// has already fired off its lifecycle update then
|
|
1129
|
-
// fire off the initial update
|
|
1130
|
-
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1131
|
-
return writeTask(dispatch) ;
|
|
1193
|
+
const referenceNode = (node) => {
|
|
1194
|
+
// this node was relocated to a new location in the dom
|
|
1195
|
+
// because of some other component's slot
|
|
1196
|
+
// but we still have an html comment in place of where
|
|
1197
|
+
// it's original location was according to it's original vdom
|
|
1198
|
+
return (node && node['s-ol']) || node;
|
|
1132
1199
|
};
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1200
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
1201
|
+
/**
|
|
1202
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
1203
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
1204
|
+
* children of the two nodes (if any).
|
|
1205
|
+
*
|
|
1206
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
1207
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
1208
|
+
*/
|
|
1209
|
+
const patch = (oldVNode, newVNode) => {
|
|
1210
|
+
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
1211
|
+
const oldChildren = oldVNode.$children$;
|
|
1212
|
+
const newChildren = newVNode.$children$;
|
|
1213
|
+
const tag = newVNode.$tag$;
|
|
1214
|
+
const text = newVNode.$text$;
|
|
1215
|
+
let defaultHolder;
|
|
1216
|
+
if (text === null) {
|
|
1138
1217
|
{
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
hostRef.$queuedListeners$ = null;
|
|
1143
|
-
}
|
|
1218
|
+
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
1219
|
+
// only add this to the when the compiler sees we're using an svg somewhere
|
|
1220
|
+
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
1144
1221
|
}
|
|
1145
1222
|
{
|
|
1146
|
-
|
|
1223
|
+
if (tag === 'slot')
|
|
1224
|
+
;
|
|
1225
|
+
else {
|
|
1226
|
+
// either this is the first render of an element OR it's an update
|
|
1227
|
+
// AND we already know it's possible it could have changed
|
|
1228
|
+
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
1229
|
+
updateElement(oldVNode, newVNode, isSvgMode);
|
|
1230
|
+
}
|
|
1147
1231
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
endSchedule();
|
|
1153
|
-
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1154
|
-
};
|
|
1155
|
-
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1156
|
-
// updateComponent
|
|
1157
|
-
const elm = hostRef.$hostElement$;
|
|
1158
|
-
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1159
|
-
const rc = elm['s-rc'];
|
|
1160
|
-
if (isInitialLoad) {
|
|
1161
|
-
// DOM WRITE!
|
|
1162
|
-
attachStyles(hostRef);
|
|
1163
|
-
}
|
|
1164
|
-
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1165
|
-
{
|
|
1166
|
-
callRender(hostRef, instance);
|
|
1167
|
-
}
|
|
1168
|
-
if (rc) {
|
|
1169
|
-
// ok, so turns out there are some child host elements
|
|
1170
|
-
// waiting on this parent element to load
|
|
1171
|
-
// let's fire off all update callbacks waiting
|
|
1172
|
-
rc.map((cb) => cb());
|
|
1173
|
-
elm['s-rc'] = undefined;
|
|
1174
|
-
}
|
|
1175
|
-
endRender();
|
|
1176
|
-
endUpdate();
|
|
1177
|
-
{
|
|
1178
|
-
const childrenPromises = elm['s-p'];
|
|
1179
|
-
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1180
|
-
if (childrenPromises.length === 0) {
|
|
1181
|
-
postUpdate();
|
|
1232
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
1233
|
+
// looks like there's child vnodes for both the old and new vnodes
|
|
1234
|
+
// so we need to call `updateChildren` to reconcile them
|
|
1235
|
+
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
1182
1236
|
}
|
|
1183
|
-
else {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1237
|
+
else if (newChildren !== null) {
|
|
1238
|
+
// no old child vnodes, but there are new child vnodes to add
|
|
1239
|
+
if (oldVNode.$text$ !== null) {
|
|
1240
|
+
// the old vnode was text, so be sure to clear it out
|
|
1241
|
+
elm.textContent = '';
|
|
1242
|
+
}
|
|
1243
|
+
// add the new vnode children
|
|
1244
|
+
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
1187
1245
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
try {
|
|
1192
|
-
instance = instance.render() ;
|
|
1193
|
-
{
|
|
1194
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1246
|
+
else if (oldChildren !== null) {
|
|
1247
|
+
// no new child vnodes, but there are old child vnodes to remove
|
|
1248
|
+
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
1195
1249
|
}
|
|
1196
|
-
{
|
|
1197
|
-
|
|
1250
|
+
if (isSvgMode && tag === 'svg') {
|
|
1251
|
+
isSvgMode = false;
|
|
1198
1252
|
}
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1253
|
+
}
|
|
1254
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1255
|
+
// this element has slotted content
|
|
1256
|
+
defaultHolder.parentNode.textContent = text;
|
|
1257
|
+
}
|
|
1258
|
+
else if (oldVNode.$text$ !== text) {
|
|
1259
|
+
// update the text content for the text only vnode
|
|
1260
|
+
// and also only if the text is different than before
|
|
1261
|
+
elm.data = text;
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
1265
|
+
// tslint:disable-next-line: prefer-const
|
|
1266
|
+
const childNodes = elm.childNodes;
|
|
1267
|
+
let childNode;
|
|
1268
|
+
let i;
|
|
1269
|
+
let ilen;
|
|
1270
|
+
let j;
|
|
1271
|
+
let slotNameAttr;
|
|
1272
|
+
let nodeType;
|
|
1273
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
1274
|
+
childNode = childNodes[i];
|
|
1275
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1276
|
+
if (childNode['s-sr']) {
|
|
1277
|
+
// this is a slot fallback node
|
|
1278
|
+
// get the slot name for this slot reference node
|
|
1279
|
+
slotNameAttr = childNode['s-sn'];
|
|
1280
|
+
// by default always show a fallback slot node
|
|
1281
|
+
// then hide it if there are other slots in the light dom
|
|
1282
|
+
childNode.hidden = false;
|
|
1283
|
+
for (j = 0; j < ilen; j++) {
|
|
1284
|
+
nodeType = childNodes[j].nodeType;
|
|
1285
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
1286
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
|
1287
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1288
|
+
childNode.hidden = true;
|
|
1289
|
+
break;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
else {
|
|
1293
|
+
// this is a default fallback slot node
|
|
1294
|
+
// any element or text node (with content)
|
|
1295
|
+
// should hide the default fallback slot node
|
|
1296
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1297
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1298
|
+
childNode.hidden = true;
|
|
1299
|
+
break;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1206
1302
|
}
|
|
1207
1303
|
}
|
|
1304
|
+
// keep drilling down
|
|
1305
|
+
updateFallbackSlotVisibility(childNode);
|
|
1208
1306
|
}
|
|
1209
1307
|
}
|
|
1210
|
-
catch (e) {
|
|
1211
|
-
consoleError(e, hostRef.$hostElement$);
|
|
1212
|
-
}
|
|
1213
|
-
return null;
|
|
1214
1308
|
};
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1309
|
+
const relocateNodes = [];
|
|
1310
|
+
const relocateSlotContent = (elm) => {
|
|
1311
|
+
// tslint:disable-next-line: prefer-const
|
|
1312
|
+
let childNode;
|
|
1313
|
+
let node;
|
|
1314
|
+
let hostContentNodes;
|
|
1315
|
+
let slotNameAttr;
|
|
1316
|
+
let relocateNodeData;
|
|
1317
|
+
let j;
|
|
1318
|
+
let i = 0;
|
|
1319
|
+
const childNodes = elm.childNodes;
|
|
1320
|
+
const ilen = childNodes.length;
|
|
1321
|
+
for (; i < ilen; i++) {
|
|
1322
|
+
childNode = childNodes[i];
|
|
1323
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
1324
|
+
// first got the content reference comment node
|
|
1325
|
+
// then we got it's parent, which is where all the host content is in now
|
|
1326
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
1327
|
+
slotNameAttr = childNode['s-sn'];
|
|
1328
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
1329
|
+
node = hostContentNodes[j];
|
|
1330
|
+
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
1331
|
+
// let's do some relocating to its new home
|
|
1332
|
+
// but never relocate a content reference node
|
|
1333
|
+
// that is suppose to always represent the original content location
|
|
1334
|
+
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
1335
|
+
// it's possible we've already decided to relocate this node
|
|
1336
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1337
|
+
// made some changes to slots
|
|
1338
|
+
// let's make sure we also double check
|
|
1339
|
+
// fallbacks are correctly hidden or shown
|
|
1340
|
+
checkSlotFallbackVisibility = true;
|
|
1341
|
+
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
1342
|
+
if (relocateNodeData) {
|
|
1343
|
+
// previously we never found a slot home for this node
|
|
1344
|
+
// but turns out we did, so let's remember it now
|
|
1345
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
1346
|
+
}
|
|
1347
|
+
else {
|
|
1348
|
+
// add to our list of nodes to relocate
|
|
1349
|
+
relocateNodes.push({
|
|
1350
|
+
$slotRefNode$: childNode,
|
|
1351
|
+
$nodeToRelocate$: node,
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
if (node['s-sr']) {
|
|
1355
|
+
relocateNodes.map((relocateNode) => {
|
|
1356
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
1357
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
1358
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
1359
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
1366
|
+
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
1367
|
+
// if we never find a home for this element then we'll need to hide it
|
|
1368
|
+
relocateNodes.push({
|
|
1369
|
+
$nodeToRelocate$: node,
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1238
1373
|
}
|
|
1239
1374
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
{
|
|
1243
|
-
safeCall(instance, 'componentDidUpdate');
|
|
1375
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1376
|
+
relocateSlotContent(childNode);
|
|
1244
1377
|
}
|
|
1245
|
-
endPostUpdate();
|
|
1246
|
-
}
|
|
1247
|
-
{
|
|
1248
|
-
hostRef.$onInstanceResolve$(elm);
|
|
1249
1378
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
{
|
|
1253
|
-
if (
|
|
1254
|
-
|
|
1255
|
-
hostRef.$onRenderResolve$ = undefined;
|
|
1379
|
+
};
|
|
1380
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
1381
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1382
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
1383
|
+
return true;
|
|
1256
1384
|
}
|
|
1257
|
-
if (
|
|
1258
|
-
|
|
1385
|
+
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
1386
|
+
return true;
|
|
1259
1387
|
}
|
|
1260
|
-
|
|
1388
|
+
return false;
|
|
1261
1389
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
// (⌐■_■)
|
|
1265
|
-
};
|
|
1266
|
-
const appDidLoad = (who) => {
|
|
1267
|
-
// on appload
|
|
1268
|
-
// we have finish the first big initial render
|
|
1269
|
-
{
|
|
1270
|
-
addHydratedFlag(doc.documentElement);
|
|
1390
|
+
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
1391
|
+
return true;
|
|
1271
1392
|
}
|
|
1272
|
-
|
|
1393
|
+
return slotNameAttr === '';
|
|
1273
1394
|
};
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
}
|
|
1279
|
-
catch (e) {
|
|
1280
|
-
consoleError(e);
|
|
1281
|
-
}
|
|
1395
|
+
const callNodeRefs = (vNode) => {
|
|
1396
|
+
{
|
|
1397
|
+
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
1398
|
+
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
1282
1399
|
}
|
|
1283
|
-
return undefined;
|
|
1284
|
-
};
|
|
1285
|
-
const then = (promise, thenFn) => {
|
|
1286
|
-
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1287
1400
|
};
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1290
|
-
const
|
|
1291
|
-
const
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
if (!plt.$orgLocNodes$) {
|
|
1298
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
1401
|
+
const renderVdom = (hostRef, renderFnResults) => {
|
|
1402
|
+
const hostElm = hostRef.$hostElement$;
|
|
1403
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
1404
|
+
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1405
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1406
|
+
hostTagName = hostElm.tagName;
|
|
1407
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
1408
|
+
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
1409
|
+
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
1299
1410
|
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
const node = c.$elm$;
|
|
1307
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
1308
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
1309
|
-
}
|
|
1310
|
-
if (!shadowRoot) {
|
|
1311
|
-
node['s-hn'] = tagName;
|
|
1312
|
-
if (orgLocationNode) {
|
|
1313
|
-
node['s-ol'] = orgLocationNode;
|
|
1314
|
-
node['s-ol']['s-nr'] = node;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1318
|
-
});
|
|
1319
|
-
if (shadowRoot) {
|
|
1320
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
1321
|
-
if (shadowRootNode) {
|
|
1322
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
1323
|
-
}
|
|
1324
|
-
});
|
|
1411
|
+
rootVnode.$tag$ = null;
|
|
1412
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
1413
|
+
hostRef.$vnode$ = rootVnode;
|
|
1414
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
1415
|
+
{
|
|
1416
|
+
scopeId = hostElm['s-sc'];
|
|
1325
1417
|
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
let childVNode;
|
|
1332
|
-
let i;
|
|
1333
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
1334
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
1335
|
-
if (childNodeType) {
|
|
1336
|
-
// got the node data from the element's attribute
|
|
1337
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
1338
|
-
childIdSplt = childNodeType.split('.');
|
|
1339
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
1340
|
-
childVNode = {
|
|
1341
|
-
$flags$: 0,
|
|
1342
|
-
$hostId$: childIdSplt[0],
|
|
1343
|
-
$nodeId$: childIdSplt[1],
|
|
1344
|
-
$depth$: childIdSplt[2],
|
|
1345
|
-
$index$: childIdSplt[3],
|
|
1346
|
-
$tag$: node.tagName.toLowerCase(),
|
|
1347
|
-
$elm$: node,
|
|
1348
|
-
$attrs$: null,
|
|
1349
|
-
$children$: null,
|
|
1350
|
-
$key$: null,
|
|
1351
|
-
$name$: null,
|
|
1352
|
-
$text$: null,
|
|
1353
|
-
};
|
|
1354
|
-
childRenderNodes.push(childVNode);
|
|
1355
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
1356
|
-
// this is a new child vnode
|
|
1357
|
-
// so ensure its parent vnode has the vchildren array
|
|
1358
|
-
if (!parentVNode.$children$) {
|
|
1359
|
-
parentVNode.$children$ = [];
|
|
1360
|
-
}
|
|
1361
|
-
// add our child vnode to a specific index of the vnode's children
|
|
1362
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1363
|
-
// this is now the new parent vnode for all the next child checks
|
|
1364
|
-
parentVNode = childVNode;
|
|
1365
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1366
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
// recursively drill down, end to start so we can remove nodes
|
|
1371
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
1372
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
1373
|
-
}
|
|
1374
|
-
if (node.shadowRoot) {
|
|
1375
|
-
// keep drilling down through the shadow root nodes
|
|
1376
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
1377
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1418
|
+
{
|
|
1419
|
+
contentRef = hostElm['s-cr'];
|
|
1420
|
+
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1421
|
+
// always reset
|
|
1422
|
+
checkSlotFallbackVisibility = false;
|
|
1380
1423
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
// remove the text comment since it's no longer needed
|
|
1407
|
-
node.remove();
|
|
1408
|
-
if (!parentVNode.$children$) {
|
|
1409
|
-
parentVNode.$children$ = [];
|
|
1410
|
-
}
|
|
1411
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1412
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1413
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1414
|
-
}
|
|
1424
|
+
// synchronous patch
|
|
1425
|
+
patch(oldVNode, rootVnode);
|
|
1426
|
+
{
|
|
1427
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
1428
|
+
// the disconnectCallback from working
|
|
1429
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1430
|
+
if (checkSlotRelocate) {
|
|
1431
|
+
relocateSlotContent(rootVnode.$elm$);
|
|
1432
|
+
let relocateData;
|
|
1433
|
+
let nodeToRelocate;
|
|
1434
|
+
let orgLocationNode;
|
|
1435
|
+
let parentNodeRef;
|
|
1436
|
+
let insertBeforeNode;
|
|
1437
|
+
let refNode;
|
|
1438
|
+
let i = 0;
|
|
1439
|
+
for (; i < relocateNodes.length; i++) {
|
|
1440
|
+
relocateData = relocateNodes[i];
|
|
1441
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1442
|
+
if (!nodeToRelocate['s-ol']) {
|
|
1443
|
+
// add a reference node marking this node's original location
|
|
1444
|
+
// keep a reference to this node for later lookups
|
|
1445
|
+
orgLocationNode =
|
|
1446
|
+
doc.createTextNode('');
|
|
1447
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1448
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1415
1449
|
}
|
|
1416
1450
|
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
// add the slot name attribute
|
|
1435
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
1436
|
-
}
|
|
1437
|
-
// insert the new slot element before the slot comment
|
|
1438
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
1439
|
-
// remove the slot comment since it's not needed for shadow
|
|
1440
|
-
node.remove();
|
|
1441
|
-
if (childVNode.$depth$ === '0') {
|
|
1442
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1451
|
+
for (i = 0; i < relocateNodes.length; i++) {
|
|
1452
|
+
relocateData = relocateNodes[i];
|
|
1453
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
1454
|
+
if (relocateData.$slotRefNode$) {
|
|
1455
|
+
// by default we're just going to insert it directly
|
|
1456
|
+
// after the slot reference node
|
|
1457
|
+
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
1458
|
+
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
1459
|
+
orgLocationNode = nodeToRelocate['s-ol'];
|
|
1460
|
+
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
1461
|
+
refNode = orgLocationNode['s-nr'];
|
|
1462
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
1463
|
+
refNode = refNode.nextSibling;
|
|
1464
|
+
if (!refNode || !refNode['s-nr']) {
|
|
1465
|
+
insertBeforeNode = refNode;
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1443
1468
|
}
|
|
1444
1469
|
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1470
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
1471
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
1472
|
+
// we've checked that it's worth while to relocate
|
|
1473
|
+
// since that the node to relocate
|
|
1474
|
+
// has a different next sibling or parent relocated
|
|
1475
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
1476
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
1477
|
+
// probably a component in the index.html that doesn't have it's hostname set
|
|
1478
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
1479
|
+
}
|
|
1480
|
+
// add it back to the dom but in its new home
|
|
1481
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
1482
|
+
}
|
|
1448
1483
|
}
|
|
1449
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1450
1484
|
}
|
|
1451
|
-
else
|
|
1452
|
-
//
|
|
1453
|
-
if (
|
|
1454
|
-
|
|
1455
|
-
node.remove();
|
|
1456
|
-
}
|
|
1457
|
-
else {
|
|
1458
|
-
hostElm['s-cr'] = node;
|
|
1459
|
-
node['s-cn'] = true;
|
|
1485
|
+
else {
|
|
1486
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
1487
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1488
|
+
nodeToRelocate.hidden = true;
|
|
1460
1489
|
}
|
|
1461
1490
|
}
|
|
1462
1491
|
}
|
|
1463
1492
|
}
|
|
1493
|
+
if (checkSlotFallbackVisibility) {
|
|
1494
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
1495
|
+
}
|
|
1496
|
+
// done moving nodes around
|
|
1497
|
+
// allow the disconnect callback to work again
|
|
1498
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1499
|
+
// always reset
|
|
1500
|
+
relocateNodes.length = 0;
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1504
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1505
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1509
|
+
{
|
|
1510
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1511
|
+
}
|
|
1512
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1513
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
1517
|
+
// there is no ancestor component or the ancestor component
|
|
1518
|
+
// has already fired off its lifecycle update then
|
|
1519
|
+
// fire off the initial update
|
|
1520
|
+
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1521
|
+
return writeTask(dispatch) ;
|
|
1522
|
+
};
|
|
1523
|
+
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1524
|
+
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1525
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1526
|
+
let promise;
|
|
1527
|
+
if (isInitialLoad) {
|
|
1528
|
+
{
|
|
1529
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1530
|
+
if (hostRef.$queuedListeners$) {
|
|
1531
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1532
|
+
hostRef.$queuedListeners$ = null;
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
{
|
|
1536
|
+
promise = safeCall(instance, 'componentWillLoad');
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
{
|
|
1540
|
+
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
|
|
1541
|
+
}
|
|
1542
|
+
endSchedule();
|
|
1543
|
+
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1544
|
+
};
|
|
1545
|
+
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1546
|
+
// updateComponent
|
|
1547
|
+
const elm = hostRef.$hostElement$;
|
|
1548
|
+
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1549
|
+
const rc = elm['s-rc'];
|
|
1550
|
+
if (isInitialLoad) {
|
|
1551
|
+
// DOM WRITE!
|
|
1552
|
+
attachStyles(hostRef);
|
|
1553
|
+
}
|
|
1554
|
+
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1555
|
+
{
|
|
1556
|
+
callRender(hostRef, instance);
|
|
1557
|
+
}
|
|
1558
|
+
if (rc) {
|
|
1559
|
+
// ok, so turns out there are some child host elements
|
|
1560
|
+
// waiting on this parent element to load
|
|
1561
|
+
// let's fire off all update callbacks waiting
|
|
1562
|
+
rc.map((cb) => cb());
|
|
1563
|
+
elm['s-rc'] = undefined;
|
|
1564
|
+
}
|
|
1565
|
+
endRender();
|
|
1566
|
+
endUpdate();
|
|
1567
|
+
{
|
|
1568
|
+
const childrenPromises = elm['s-p'];
|
|
1569
|
+
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1570
|
+
if (childrenPromises.length === 0) {
|
|
1571
|
+
postUpdate();
|
|
1572
|
+
}
|
|
1573
|
+
else {
|
|
1574
|
+
Promise.all(childrenPromises).then(postUpdate);
|
|
1575
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1576
|
+
childrenPromises.length = 0;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
const callRender = (hostRef, instance, elm) => {
|
|
1581
|
+
try {
|
|
1582
|
+
instance = instance.render() ;
|
|
1583
|
+
{
|
|
1584
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1585
|
+
}
|
|
1586
|
+
{
|
|
1587
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1588
|
+
}
|
|
1589
|
+
{
|
|
1590
|
+
{
|
|
1591
|
+
// looks like we've got child nodes to render into this host element
|
|
1592
|
+
// or we need to update the css class/attrs on the host element
|
|
1593
|
+
// DOM WRITE!
|
|
1594
|
+
{
|
|
1595
|
+
renderVdom(hostRef, instance);
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1464
1599
|
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
vnode.$elm$ = node;
|
|
1468
|
-
vnode.$index$ = '0';
|
|
1469
|
-
parentVNode.$children$ = [vnode];
|
|
1600
|
+
catch (e) {
|
|
1601
|
+
consoleError(e, hostRef.$hostElement$);
|
|
1470
1602
|
}
|
|
1603
|
+
return null;
|
|
1471
1604
|
};
|
|
1472
|
-
const
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1605
|
+
const postUpdateComponent = (hostRef) => {
|
|
1606
|
+
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1607
|
+
const elm = hostRef.$hostElement$;
|
|
1608
|
+
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1609
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1610
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1611
|
+
{
|
|
1612
|
+
safeCall(instance, 'componentDidRender');
|
|
1613
|
+
}
|
|
1614
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1615
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1616
|
+
{
|
|
1617
|
+
// DOM WRITE!
|
|
1618
|
+
addHydratedFlag(elm);
|
|
1477
1619
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1620
|
+
{
|
|
1621
|
+
safeCall(instance, 'componentDidLoad');
|
|
1622
|
+
}
|
|
1623
|
+
endPostUpdate();
|
|
1624
|
+
{
|
|
1625
|
+
hostRef.$onReadyResolve$(elm);
|
|
1626
|
+
if (!ancestorComponent) {
|
|
1627
|
+
appDidLoad();
|
|
1481
1628
|
}
|
|
1482
1629
|
}
|
|
1483
1630
|
}
|
|
1484
|
-
else
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
1488
|
-
node.nodeValue = '';
|
|
1489
|
-
// useful to know if the original location is
|
|
1490
|
-
// the root light-dom of a shadow dom component
|
|
1491
|
-
node['s-en'] = childIdSplt[3];
|
|
1631
|
+
else {
|
|
1632
|
+
{
|
|
1633
|
+
safeCall(instance, 'componentDidUpdate');
|
|
1492
1634
|
}
|
|
1635
|
+
endPostUpdate();
|
|
1493
1636
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
1504
|
-
*
|
|
1505
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
1506
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
1507
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
1508
|
-
* ```tsx
|
|
1509
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
1510
|
-
* ```
|
|
1511
|
-
*
|
|
1512
|
-
* HTML prop values on the other hand, will always a string
|
|
1513
|
-
*
|
|
1514
|
-
* @param propValue the new value to coerce to some type
|
|
1515
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
1516
|
-
* @returns the parsed/coerced value
|
|
1517
|
-
*/
|
|
1518
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1519
|
-
// ensure this value is of the correct prop type
|
|
1520
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1521
|
-
if (propType & 4 /* Boolean */) {
|
|
1522
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1523
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1524
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1637
|
+
{
|
|
1638
|
+
hostRef.$onInstanceResolve$(elm);
|
|
1639
|
+
}
|
|
1640
|
+
// load events fire from bottom to top
|
|
1641
|
+
// the deepest elements load first then bubbles up
|
|
1642
|
+
{
|
|
1643
|
+
if (hostRef.$onRenderResolve$) {
|
|
1644
|
+
hostRef.$onRenderResolve$();
|
|
1645
|
+
hostRef.$onRenderResolve$ = undefined;
|
|
1525
1646
|
}
|
|
1526
|
-
if (
|
|
1527
|
-
|
|
1528
|
-
return parseFloat(propValue);
|
|
1647
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1648
|
+
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1529
1649
|
}
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1650
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1651
|
+
}
|
|
1652
|
+
// ( •_•)
|
|
1653
|
+
// ( •_•)>⌐■-■
|
|
1654
|
+
// (⌐■_■)
|
|
1655
|
+
};
|
|
1656
|
+
const appDidLoad = (who) => {
|
|
1657
|
+
// on appload
|
|
1658
|
+
// we have finish the first big initial render
|
|
1659
|
+
{
|
|
1660
|
+
addHydratedFlag(doc.documentElement);
|
|
1661
|
+
}
|
|
1662
|
+
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1663
|
+
};
|
|
1664
|
+
const safeCall = (instance, method, arg) => {
|
|
1665
|
+
if (instance && instance[method]) {
|
|
1666
|
+
try {
|
|
1667
|
+
return instance[method](arg);
|
|
1668
|
+
}
|
|
1669
|
+
catch (e) {
|
|
1670
|
+
consoleError(e);
|
|
1534
1671
|
}
|
|
1535
|
-
// redundant return here for better minification
|
|
1536
|
-
return propValue;
|
|
1537
1672
|
}
|
|
1538
|
-
|
|
1539
|
-
// so no need to change to a different type
|
|
1540
|
-
return propValue;
|
|
1673
|
+
return undefined;
|
|
1541
1674
|
};
|
|
1675
|
+
const then = (promise, thenFn) => {
|
|
1676
|
+
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1677
|
+
};
|
|
1678
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1679
|
+
;
|
|
1542
1680
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1543
1681
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1544
1682
|
// check our new property value against our internal value
|
|
@@ -1551,13 +1689,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1551
1689
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1552
1690
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1553
1691
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1554
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1692
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1555
1693
|
// gadzooks! the property's value has changed!!
|
|
1556
1694
|
// set our new value!
|
|
1557
1695
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1558
1696
|
if (instance) {
|
|
1559
1697
|
// get an array of method names of watch functions to call
|
|
1560
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1698
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1561
1699
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1562
1700
|
if (watchMethods) {
|
|
1563
1701
|
// this instance is watching for when this property changed
|
|
@@ -1572,7 +1710,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1572
1710
|
});
|
|
1573
1711
|
}
|
|
1574
1712
|
}
|
|
1575
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1713
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1576
1714
|
// looks like this value actually changed, so we've got work to do!
|
|
1577
1715
|
// but only if we've already rendered, otherwise just chill out
|
|
1578
1716
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1582,6 +1720,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1582
1720
|
}
|
|
1583
1721
|
}
|
|
1584
1722
|
};
|
|
1723
|
+
/**
|
|
1724
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1725
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1726
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1727
|
+
*
|
|
1728
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1729
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1730
|
+
* @param flags a number used to store a series of bit flags
|
|
1731
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1732
|
+
*/
|
|
1585
1733
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1586
1734
|
if (cmpMeta.$members$) {
|
|
1587
1735
|
if (Cstr.watchers) {
|
|
@@ -1591,8 +1739,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1591
1739
|
const members = Object.entries(cmpMeta.$members$);
|
|
1592
1740
|
const prototype = Cstr.prototype;
|
|
1593
1741
|
members.map(([memberName, [memberFlags]]) => {
|
|
1594
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1595
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1742
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1743
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1596
1744
|
// proxyComponent - prop
|
|
1597
1745
|
Object.defineProperty(prototype, memberName, {
|
|
1598
1746
|
get() {
|
|
@@ -1607,8 +1755,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1607
1755
|
enumerable: true,
|
|
1608
1756
|
});
|
|
1609
1757
|
}
|
|
1610
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1611
|
-
memberFlags & 64 /* Method */) {
|
|
1758
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1759
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1612
1760
|
// proxyComponent - method
|
|
1613
1761
|
Object.defineProperty(prototype, memberName, {
|
|
1614
1762
|
value(...args) {
|
|
@@ -1618,7 +1766,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1618
1766
|
});
|
|
1619
1767
|
}
|
|
1620
1768
|
});
|
|
1621
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1769
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1622
1770
|
const attrNameToPropName = new Map();
|
|
1623
1771
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1624
1772
|
plt.jmp(() => {
|
|
@@ -1674,11 +1822,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1674
1822
|
// create an array of attributes to observe
|
|
1675
1823
|
// and also create a map of html attribute name to js property name
|
|
1676
1824
|
Cstr.observedAttributes = members
|
|
1677
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1825
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1678
1826
|
.map(([propName, m]) => {
|
|
1679
1827
|
const attrName = m[1] || propName;
|
|
1680
1828
|
attrNameToPropName.set(attrName, propName);
|
|
1681
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1829
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1682
1830
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1683
1831
|
}
|
|
1684
1832
|
return attrName;
|
|
@@ -1689,10 +1837,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1689
1837
|
};
|
|
1690
1838
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1691
1839
|
// initializeComponent
|
|
1692
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1840
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1693
1841
|
{
|
|
1694
1842
|
// we haven't initialized this element yet
|
|
1695
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1843
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1696
1844
|
// lazy loaded components
|
|
1697
1845
|
// request the component's implementation to be
|
|
1698
1846
|
// wired up with the host element
|
|
@@ -1710,7 +1858,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1710
1858
|
{
|
|
1711
1859
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1712
1860
|
}
|
|
1713
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1861
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1714
1862
|
Cstr.isProxied = true;
|
|
1715
1863
|
}
|
|
1716
1864
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1718,7 +1866,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1718
1866
|
// but let's keep track of when we start and stop
|
|
1719
1867
|
// so that the getters/setters don't incorrectly step on data
|
|
1720
1868
|
{
|
|
1721
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1869
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1722
1870
|
}
|
|
1723
1871
|
// construct the lazy-loaded component implementation
|
|
1724
1872
|
// passing the hostRef is very important during
|
|
@@ -1731,10 +1879,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1731
1879
|
consoleError(e);
|
|
1732
1880
|
}
|
|
1733
1881
|
{
|
|
1734
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1882
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1735
1883
|
}
|
|
1736
1884
|
{
|
|
1737
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1885
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1738
1886
|
}
|
|
1739
1887
|
endNewInstance();
|
|
1740
1888
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1745,10 +1893,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1745
1893
|
const scopeId = getScopeId(cmpMeta);
|
|
1746
1894
|
if (!styles.has(scopeId)) {
|
|
1747
1895
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1748
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1749
|
-
style = await Promise.resolve().then(function () { return require('./shadow-css-
|
|
1896
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1897
|
+
style = await Promise.resolve().then(function () { return require('./shadow-css-1ea48714.js'); }).then((m) => m.scopeCss(style, scopeId, false));
|
|
1750
1898
|
}
|
|
1751
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1899
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1752
1900
|
endRegisterStyles();
|
|
1753
1901
|
}
|
|
1754
1902
|
}
|
|
@@ -1775,18 +1923,18 @@ const fireConnectedCallback = (instance) => {
|
|
|
1775
1923
|
}
|
|
1776
1924
|
};
|
|
1777
1925
|
const connectedCallback = (elm) => {
|
|
1778
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1926
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1779
1927
|
const hostRef = getHostRef(elm);
|
|
1780
1928
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1781
1929
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1782
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1930
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1783
1931
|
// first time this component has connected
|
|
1784
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1932
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1785
1933
|
let hostId;
|
|
1786
1934
|
{
|
|
1787
1935
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
1788
1936
|
if (hostId) {
|
|
1789
|
-
if (supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1937
|
+
if (supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1790
1938
|
const scopeId = addStyle(elm.shadowRoot, cmpMeta);
|
|
1791
1939
|
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
1792
1940
|
}
|
|
@@ -1798,7 +1946,7 @@ const connectedCallback = (elm) => {
|
|
|
1798
1946
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1799
1947
|
// in here to act as original content anchors as we move nodes around
|
|
1800
1948
|
// host element has been connected to the DOM
|
|
1801
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1949
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1802
1950
|
setContentReference(elm);
|
|
1803
1951
|
}
|
|
1804
1952
|
}
|
|
@@ -1809,7 +1957,7 @@ const connectedCallback = (elm) => {
|
|
|
1809
1957
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1810
1958
|
// climb up the ancestors looking for the first
|
|
1811
1959
|
// component that hasn't finished its lifecycle update yet
|
|
1812
|
-
if ((ancestorComponent.nodeType === 1 /* ElementNode */ &&
|
|
1960
|
+
if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
|
1813
1961
|
ancestorComponent.hasAttribute('s-id') &&
|
|
1814
1962
|
ancestorComponent['s-p']) ||
|
|
1815
1963
|
ancestorComponent['s-p']) {
|
|
@@ -1824,7 +1972,7 @@ const connectedCallback = (elm) => {
|
|
|
1824
1972
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1825
1973
|
if (cmpMeta.$members$) {
|
|
1826
1974
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1827
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1975
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1828
1976
|
const value = elm[memberName];
|
|
1829
1977
|
delete elm[memberName];
|
|
1830
1978
|
elm[memberName] = value;
|
|
@@ -1862,7 +2010,7 @@ const setContentReference = (elm) => {
|
|
|
1862
2010
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1863
2011
|
};
|
|
1864
2012
|
const disconnectedCallback = (elm) => {
|
|
1865
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
2013
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1866
2014
|
const hostRef = getHostRef(elm);
|
|
1867
2015
|
const instance = hostRef.$lazyInstance$ ;
|
|
1868
2016
|
{
|
|
@@ -1882,7 +2030,7 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1882
2030
|
return this[n];
|
|
1883
2031
|
}
|
|
1884
2032
|
}
|
|
1885
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
2033
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1886
2034
|
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
1887
2035
|
Object.defineProperty(elm, 'children', {
|
|
1888
2036
|
get() {
|
|
@@ -1897,8 +2045,8 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1897
2045
|
Object.defineProperty(elm, 'childNodes', {
|
|
1898
2046
|
get() {
|
|
1899
2047
|
const childNodes = childNodesFn.call(this);
|
|
1900
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
1901
|
-
getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
2048
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
|
|
2049
|
+
getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
|
|
1902
2050
|
const result = new FakeNodeList();
|
|
1903
2051
|
for (let i = 0; i < childNodes.length; i++) {
|
|
1904
2052
|
const slot = childNodes[i]['s-nr'];
|
|
@@ -1931,7 +2079,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1931
2079
|
{
|
|
1932
2080
|
// If the app is already hydrated there is not point to disable the
|
|
1933
2081
|
// async queue. This will improve the first input delay
|
|
1934
|
-
plt.$flags$ |= 2 /* appLoaded */;
|
|
2082
|
+
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
|
1935
2083
|
}
|
|
1936
2084
|
{
|
|
1937
2085
|
for (; i < styles.length; i++) {
|
|
@@ -1958,8 +2106,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1958
2106
|
{
|
|
1959
2107
|
cmpMeta.$watchers$ = {};
|
|
1960
2108
|
}
|
|
1961
|
-
if (!supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1962
|
-
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
2109
|
+
if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2110
|
+
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
1963
2111
|
}
|
|
1964
2112
|
const tagName = cmpMeta.$tagName$;
|
|
1965
2113
|
const HostElement = class extends HTMLElement {
|
|
@@ -1969,7 +2117,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1969
2117
|
super(self);
|
|
1970
2118
|
self = this;
|
|
1971
2119
|
registerHost(self, cmpMeta);
|
|
1972
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2120
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1973
2121
|
// this component is using shadow dom
|
|
1974
2122
|
// and this browser supports shadow dom
|
|
1975
2123
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1978,7 +2126,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1978
2126
|
{
|
|
1979
2127
|
self.attachShadow({
|
|
1980
2128
|
mode: 'open',
|
|
1981
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */),
|
|
2129
|
+
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
|
1982
2130
|
});
|
|
1983
2131
|
}
|
|
1984
2132
|
}
|
|
@@ -2013,7 +2161,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2013
2161
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
2014
2162
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
2015
2163
|
cmpTags.push(tagName);
|
|
2016
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
2164
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
2017
2165
|
}
|
|
2018
2166
|
});
|
|
2019
2167
|
});
|
|
@@ -2036,7 +2184,45 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2036
2184
|
endBootstrap();
|
|
2037
2185
|
};
|
|
2038
2186
|
const Fragment = (_, children) => children;
|
|
2039
|
-
const
|
|
2187
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
2188
|
+
if (listeners) {
|
|
2189
|
+
listeners.map(([flags, name, method]) => {
|
|
2190
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
2191
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
2192
|
+
const opts = hostListenerOpts(flags);
|
|
2193
|
+
plt.ael(target, name, handler, opts);
|
|
2194
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
2195
|
+
});
|
|
2196
|
+
}
|
|
2197
|
+
};
|
|
2198
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
2199
|
+
try {
|
|
2200
|
+
{
|
|
2201
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
2202
|
+
// instance is ready, let's call it's member method for this event
|
|
2203
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
2204
|
+
}
|
|
2205
|
+
else {
|
|
2206
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
catch (e) {
|
|
2211
|
+
consoleError(e);
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
2214
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
2215
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
2216
|
+
return doc;
|
|
2217
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
2218
|
+
return win;
|
|
2219
|
+
if (flags & 16 /* LISTENER_FLAGS.TargetBody */)
|
|
2220
|
+
return doc.body;
|
|
2221
|
+
return elm;
|
|
2222
|
+
};
|
|
2223
|
+
// prettier-ignore
|
|
2224
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
2225
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
2040
2226
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
2041
2227
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
2042
2228
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -2081,14 +2267,37 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2081
2267
|
return importedModule[exportName];
|
|
2082
2268
|
}, consoleError);
|
|
2083
2269
|
};
|
|
2084
|
-
const styles = new Map();
|
|
2270
|
+
const styles = /*@__PURE__*/ new Map();
|
|
2271
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
2272
|
+
const doc = win.document || { head: {} };
|
|
2273
|
+
const plt = {
|
|
2274
|
+
$flags$: 0,
|
|
2275
|
+
$resourcesUrl$: '',
|
|
2276
|
+
jmp: (h) => h(),
|
|
2277
|
+
raf: (h) => requestAnimationFrame(h),
|
|
2278
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
2279
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
2280
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
2281
|
+
};
|
|
2282
|
+
const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
2283
|
+
;
|
|
2284
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
2285
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
2286
|
+
try {
|
|
2287
|
+
new CSSStyleSheet();
|
|
2288
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
2289
|
+
}
|
|
2290
|
+
catch (e) { }
|
|
2291
|
+
return false;
|
|
2292
|
+
})()
|
|
2293
|
+
;
|
|
2085
2294
|
const queueDomReads = [];
|
|
2086
2295
|
const queueDomWrites = [];
|
|
2087
2296
|
const queueTask = (queue, write) => (cb) => {
|
|
2088
2297
|
queue.push(cb);
|
|
2089
2298
|
if (!queuePending) {
|
|
2090
2299
|
queuePending = true;
|
|
2091
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
2300
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
2092
2301
|
nextTick(flush);
|
|
2093
2302
|
}
|
|
2094
2303
|
else {
|
|
@@ -2124,12 +2333,6 @@ const flush = () => {
|
|
|
2124
2333
|
};
|
|
2125
2334
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
2126
2335
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
2127
|
-
const Build = {
|
|
2128
|
-
isDev: false,
|
|
2129
|
-
isBrowser: true,
|
|
2130
|
-
isServer: false,
|
|
2131
|
-
isTesting: false,
|
|
2132
|
-
};
|
|
2133
2336
|
|
|
2134
2337
|
exports.Build = Build;
|
|
2135
2338
|
exports.Env = Env;
|