@usecapsule/core-components 3.2.0-dev.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/capsule/capsule.esm.js +1 -1
- package/dist/capsule/capsule.esm.js.map +1 -1
- package/dist/capsule/index.esm.js.map +1 -1
- package/dist/capsule/p-0462f723.js.map +1 -1
- package/dist/capsule/p-05cb769b.entry.js +10 -0
- package/dist/capsule/p-05cb769b.entry.js.map +1 -0
- package/dist/capsule/p-0eea90f8.entry.js +2 -0
- package/dist/capsule/{p-6793ef7a.entry.js.map → p-0eea90f8.entry.js.map} +1 -1
- package/dist/capsule/{p-b976b6f0.entry.js → p-41bc3c58.entry.js} +2 -2
- package/dist/capsule/{p-b976b6f0.entry.js.map → p-41bc3c58.entry.js.map} +1 -1
- package/dist/capsule/p-7233228e.entry.js +29 -0
- package/dist/capsule/p-7233228e.entry.js.map +1 -0
- package/dist/capsule/{p-447d49b9.entry.js → p-742bda0b.entry.js} +2 -2
- package/dist/capsule/{p-447d49b9.entry.js.map → p-742bda0b.entry.js.map} +1 -1
- package/dist/capsule/{p-f6c74d69.entry.js → p-c1aa1ffb.entry.js} +2 -2
- package/dist/capsule/{p-f6c74d69.entry.js.map → p-c1aa1ffb.entry.js.map} +1 -1
- package/dist/capsule/p-d351f076.entry.js +2 -0
- package/dist/capsule/p-d351f076.entry.js.map +1 -0
- package/dist/capsule/{p-452b9998.entry.js → p-dc4591d5.entry.js} +2 -2
- package/dist/capsule/{p-452b9998.entry.js.map → p-dc4591d5.entry.js.map} +1 -1
- package/dist/capsule/{p-6dcaee48.entry.js → p-de2a16e4.entry.js} +2 -2
- package/dist/capsule/{p-6dcaee48.entry.js.map → p-de2a16e4.entry.js.map} +1 -1
- package/dist/capsule/p-e1255160.js.map +1 -1
- package/dist/capsule/p-f2393be6.js.map +1 -1
- package/dist/capsule/p-fa6b7678.js +3 -0
- package/dist/capsule/p-fa6b7678.js.map +1 -0
- package/dist/cjs/capsule.cjs.js +10 -10
- package/dist/cjs/capsule.cjs.js.map +1 -1
- package/dist/cjs/{cpsl-alert_34.cjs.entry.js → cpsl-alert_33.cjs.entry.js} +136 -95
- package/dist/cjs/cpsl-alert_33.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-animation.cjs.entry.js +5 -2
- package/dist/cjs/cpsl-animation.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-col.cjs.entry.js +25 -6
- package/dist/cjs/cpsl-col.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-grid.cjs.entry.js +3 -3
- package/dist/cjs/cpsl-hero.cjs.entry.js +35 -0
- package/dist/cjs/cpsl-hero.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-identicon.cjs.entry.js +2 -2
- package/dist/cjs/cpsl-info-box.cjs.entry.js +2 -2
- package/dist/cjs/cpsl-modal-v2.cjs.entry.js +3 -2
- package/dist/cjs/cpsl-modal-v2.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-row.cjs.entry.js +2 -2
- package/dist/cjs/index-65f57499.js +1439 -0
- package/dist/cjs/index-65f57499.js.map +1 -0
- package/dist/cjs/index.cjs.js +10 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/assets/icons/index.js +1 -3
- package/dist/collection/assets/icons/index.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/cpsl-alert/cpsl-alert.js +2 -2
- package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -1
- package/dist/collection/components/cpsl-animation/cpsl-animation.js +4 -1
- package/dist/collection/components/cpsl-animation/cpsl-animation.js.map +1 -1
- package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +5 -2
- package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js.map +1 -1
- package/dist/collection/components/cpsl-avatar/cpsl-avatar.js +1 -1
- package/dist/collection/components/cpsl-button/cpsl-button.js +5 -2
- package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -1
- package/dist/collection/components/cpsl-button/cpsl-button.stories.js.map +1 -1
- package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +1 -1
- package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
- package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.js +1 -1
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +5 -3
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -1
- package/dist/collection/components/cpsl-col/cpsl-col.js +21 -5
- package/dist/collection/components/cpsl-col/cpsl-col.js.map +1 -1
- package/dist/collection/components/cpsl-divider/cpsl-divider.js +1 -1
- package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +3 -2
- package/dist/collection/components/cpsl-drawer/cpsl-drawer.js.map +1 -1
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +2 -2
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
- package/dist/collection/components/cpsl-dropdown/dropdown-interface.js.map +1 -1
- package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +6 -1
- package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -1
- package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
- package/dist/collection/components/cpsl-hero/cpsl-hero.js +3 -2
- package/dist/collection/components/cpsl-hero/cpsl-hero.js.map +1 -1
- package/dist/collection/components/cpsl-hero/cpsl-hero.stories.js.map +1 -1
- package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
- package/dist/collection/components/cpsl-identicon/cpsl-identicon.js +1 -1
- package/dist/collection/components/cpsl-identicon/cpsl-identicon.stories.js.map +1 -1
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
- package/dist/collection/components/cpsl-input/cpsl-input.js +36 -2
- package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
- package/dist/collection/components/cpsl-modal/cpsl-modal.js +1 -1
- package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -1
- package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +2 -1
- package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js.map +1 -1
- package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +1 -1
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +2 -1
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js.map +1 -1
- package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
- package/dist/collection/components/cpsl-pagination/cpsl-pagination.js.map +1 -1
- package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
- package/dist/collection/components/cpsl-popover/cpsl-popover.js +18 -6
- package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -1
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +1 -1
- package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
- package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
- package/dist/collection/components/cpsl-select/cpsl-select.js +3 -1
- package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -1
- package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +1 -1
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +14 -3
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js.map +1 -1
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +2 -2
- package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
- package/dist/collection/components/cpsl-tab/cpsl-tab.js +1 -1
- package/dist/collection/components/cpsl-table/cpsl-table.js +11 -1
- package/dist/collection/components/cpsl-table/cpsl-table.js.map +1 -1
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +7 -1
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js.map +1 -1
- package/dist/collection/components/cpsl-text/cpsl-text.js +5 -2
- package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -1
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
- package/dist/collection/interface.js.map +1 -1
- package/dist/collection/utils/media.js +3 -0
- package/dist/collection/utils/media.js.map +1 -1
- package/dist/collection/utils/theme/generateBorderRadii.js +1 -1
- package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -1
- package/dist/collection/utils/theme/generatePalette.js +4 -1
- package/dist/collection/utils/theme/generatePalette.js.map +1 -1
- package/dist/collection/utils/theme/generateTheme.js +4 -0
- package/dist/collection/utils/theme/generateTheme.js.map +1 -1
- package/dist/collection/utils/theme/utils.js +1 -0
- package/dist/collection/utils/theme/utils.js.map +1 -1
- package/dist/esm/capsule.js +11 -11
- package/dist/esm/capsule.js.map +1 -1
- package/dist/esm/{cpsl-alert_34.entry.js → cpsl-alert_33.entry.js} +137 -95
- package/dist/esm/cpsl-alert_33.entry.js.map +1 -0
- package/dist/esm/cpsl-animation.entry.js +5 -2
- package/dist/esm/cpsl-animation.entry.js.map +1 -1
- package/dist/esm/cpsl-col.entry.js +25 -6
- package/dist/esm/cpsl-col.entry.js.map +1 -1
- package/dist/esm/cpsl-grid.entry.js +3 -3
- package/dist/esm/cpsl-hero.entry.js +31 -0
- package/dist/esm/cpsl-hero.entry.js.map +1 -0
- package/dist/esm/cpsl-identicon.entry.js +2 -2
- package/dist/esm/cpsl-info-box.entry.js +2 -2
- package/dist/esm/cpsl-modal-v2.entry.js +3 -2
- package/dist/esm/cpsl-modal-v2.entry.js.map +1 -1
- package/dist/esm/cpsl-row.entry.js +2 -2
- package/dist/esm/index-91db3414.js +1408 -0
- package/dist/esm/index-91db3414.js.map +1 -0
- package/dist/esm/index.js +10 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/loader/cdn.js +1 -3
- package/dist/loader/index.cjs.js +1 -3
- package/dist/loader/index.d.ts +3 -0
- package/dist/loader/index.es2017.js +1 -3
- package/dist/loader/index.js +1 -3
- package/dist/scripts/buildAssets.js +1 -1
- package/dist/types/assets/icons/index.d.ts +0 -2
- package/dist/types/components/cpsl-alert/cpsl-alert.d.ts +8 -0
- package/dist/types/components/cpsl-animation/cpsl-animation.d.ts +6 -0
- package/dist/types/components/cpsl-app-bar/cpsl-app-bar.d.ts +10 -0
- package/dist/types/components/cpsl-avatar/cpsl-avatar.d.ts +11 -0
- package/dist/types/components/cpsl-button/cpsl-button.d.ts +29 -0
- package/dist/types/components/cpsl-button-group/cpsl-button-group.d.ts +3 -0
- package/dist/types/components/cpsl-checkbox/cpsl-checkbox.d.ts +6 -0
- package/dist/types/components/cpsl-code-input/cpsl-code-input.d.ts +19 -0
- package/dist/types/components/cpsl-col/cpsl-col.d.ts +96 -0
- package/dist/types/components/cpsl-drawer/cpsl-drawer.d.ts +31 -0
- package/dist/types/components/cpsl-dropdown/cpsl-dropdown.d.ts +15 -0
- package/dist/types/components/cpsl-dropdown/dropdown-interface.d.ts +1 -1
- package/dist/types/components/cpsl-file-upload/cpsl-file-upload.d.ts +43 -0
- package/dist/types/components/cpsl-grid/cpsl-grid.d.ts +3 -0
- package/dist/types/components/cpsl-hero/cpsl-hero.d.ts +5 -0
- package/dist/types/components/cpsl-icon/cpsl-icon.d.ts +6 -0
- package/dist/types/components/cpsl-identicon/cpsl-identicon.d.ts +4 -0
- package/dist/types/components/cpsl-input/cpsl-input.d.ts +138 -0
- package/dist/types/components/cpsl-input/input-interface.d.ts +5 -0
- package/dist/types/components/cpsl-modal/cpsl-modal.d.ts +39 -0
- package/dist/types/components/cpsl-modal-v2/cpsl-modal-v2.d.ts +32 -0
- package/dist/types/components/cpsl-nav-button-group/cpsl-nav-button-group.d.ts +3 -0
- package/dist/types/components/cpsl-overlay/cpsl-overlay.d.ts +14 -0
- package/dist/types/components/cpsl-pagination/cpsl-pagination.d.ts +15 -0
- package/dist/types/components/cpsl-pill/cpsl-pill.d.ts +3 -0
- package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +55 -2
- package/dist/types/components/cpsl-progress-indicator/cpsl-progress-indicator.d.ts +6 -0
- package/dist/types/components/cpsl-qr-code/cpsl-qr-code.d.ts +10 -0
- package/dist/types/components/cpsl-radio/cpsl-radio.d.ts +6 -0
- package/dist/types/components/cpsl-select/cpsl-select.d.ts +45 -0
- package/dist/types/components/cpsl-select-item/cpsl-select-item.d.ts +10 -0
- package/dist/types/components/cpsl-slide-button/cpsl-slide-button.d.ts +18 -0
- package/dist/types/components/cpsl-spinner/cpsl-spinner.d.ts +8 -0
- package/dist/types/components/cpsl-switch/cpsl-switch.d.ts +6 -0
- package/dist/types/components/cpsl-tab/cpsl-tab.d.ts +11 -0
- package/dist/types/components/cpsl-tabs/cpsl-tabs.d.ts +13 -0
- package/dist/types/components/cpsl-text/cpsl-text.d.ts +15 -0
- package/dist/types/components/cpsl-tile-button/cpsl-tile-button.d.ts +6 -0
- package/dist/types/components.d.ts +28 -6
- package/dist/types/stencil-public-runtime.d.ts +3 -10
- package/dist/types/utils/theme/generateBorderRadii.d.ts +1 -1
- package/dist/types/utils/theme/generatePalette.d.ts +1 -1
- package/dist/types/utils/theme/generateTheme.d.ts +4 -0
- package/package.json +4 -10
- package/readme.md +47 -2
- package/dist/capsule/p-303e6e89.entry.js +0 -29
- package/dist/capsule/p-303e6e89.entry.js.map +0 -1
- package/dist/capsule/p-6793ef7a.entry.js +0 -2
- package/dist/capsule/p-7dde3172.js +0 -3
- package/dist/capsule/p-7dde3172.js.map +0 -1
- package/dist/capsule/p-a6aaf3f4.entry.js +0 -10
- package/dist/capsule/p-a6aaf3f4.entry.js.map +0 -1
- package/dist/cjs/cpsl-alert_34.cjs.entry.js.map +0 -1
- package/dist/cjs/index-528f7428.js +0 -2107
- package/dist/cjs/index-528f7428.js.map +0 -1
- package/dist/collection/assets/icons/double-arc.svg +0 -13
- package/dist/collection/assets/icons/single-arc.svg +0 -11
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js +0 -29
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js +0 -37
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js.map +0 -1
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js +0 -29
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js +0 -37
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js.map +0 -1
- package/dist/collection/components/cpsl-app-bar/test/cpsl-app-bar.e2e.js +0 -29
- package/dist/collection/components/cpsl-app-bar/test/cpsl-app-bar.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-app-bar/test/cpsl-app-bar.spec.js +0 -37
- package/dist/collection/components/cpsl-app-bar/test/cpsl-app-bar.spec.js.map +0 -1
- package/dist/collection/components/cpsl-avatar/test/cpsl-avatar.e2e.js +0 -29
- package/dist/collection/components/cpsl-avatar/test/cpsl-avatar.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-avatar/test/cpsl-avatar.spec.js +0 -37
- package/dist/collection/components/cpsl-avatar/test/cpsl-avatar.spec.js.map +0 -1
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js +0 -29
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js +0 -37
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js.map +0 -1
- package/dist/collection/components/cpsl-button-group/test/cpsl-button-group.e2e.js +0 -29
- package/dist/collection/components/cpsl-button-group/test/cpsl-button-group.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-button-group/test/cpsl-button-group.spec.js +0 -37
- package/dist/collection/components/cpsl-button-group/test/cpsl-button-group.spec.js.map +0 -1
- package/dist/collection/components/cpsl-card/test/cpsl-card.e2e.js +0 -29
- package/dist/collection/components/cpsl-card/test/cpsl-card.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-card/test/cpsl-card.spec.js +0 -37
- package/dist/collection/components/cpsl-card/test/cpsl-card.spec.js.map +0 -1
- package/dist/collection/components/cpsl-checkbox/test/cpsl-checkbox.e2e.js +0 -29
- package/dist/collection/components/cpsl-checkbox/test/cpsl-checkbox.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-checkbox/test/cpsl-checkbox.spec.js +0 -37
- package/dist/collection/components/cpsl-checkbox/test/cpsl-checkbox.spec.js.map +0 -1
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js +0 -29
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js +0 -37
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js.map +0 -1
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js +0 -29
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js +0 -37
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js.map +0 -1
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js +0 -29
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js +0 -37
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js.map +0 -1
- package/dist/collection/components/cpsl-drawer/test/cpsl-drawer.e2e.js +0 -29
- package/dist/collection/components/cpsl-drawer/test/cpsl-drawer.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-drawer/test/cpsl-drawer.spec.js +0 -37
- package/dist/collection/components/cpsl-drawer/test/cpsl-drawer.spec.js.map +0 -1
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.e2e.js +0 -29
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.spec.js +0 -37
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.spec.js.map +0 -1
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js +0 -29
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js +0 -37
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js.map +0 -1
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js +0 -29
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js +0 -37
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js.map +0 -1
- package/dist/collection/components/cpsl-hero/test/cpsl-hero.e2e.js +0 -29
- package/dist/collection/components/cpsl-hero/test/cpsl-hero.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-hero/test/cpsl-hero.spec.js +0 -37
- package/dist/collection/components/cpsl-hero/test/cpsl-hero.spec.js.map +0 -1
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js +0 -29
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js +0 -37
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js.map +0 -1
- package/dist/collection/components/cpsl-identicon/test/cpsl-identicon.e2e.js +0 -29
- package/dist/collection/components/cpsl-identicon/test/cpsl-identicon.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-identicon/test/cpsl-identicon.spec.js +0 -37
- package/dist/collection/components/cpsl-identicon/test/cpsl-identicon.spec.js.map +0 -1
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js +0 -29
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js +0 -37
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js.map +0 -1
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js +0 -29
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js +0 -37
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js.map +0 -1
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js +0 -29
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js +0 -37
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js.map +0 -1
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js +0 -29
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js +0 -37
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js.map +0 -1
- package/dist/collection/components/cpsl-nav-button-group/test/cpsl-nav-button-group.e2e.js +0 -29
- package/dist/collection/components/cpsl-nav-button-group/test/cpsl-nav-button-group.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-nav-button-group/test/cpsl-nav-button-group.spec.js +0 -37
- package/dist/collection/components/cpsl-nav-button-group/test/cpsl-nav-button-group.spec.js.map +0 -1
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js +0 -29
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js +0 -37
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js.map +0 -1
- package/dist/collection/components/cpsl-pagination/test/cpsl-pagination.e2e.js +0 -29
- package/dist/collection/components/cpsl-pagination/test/cpsl-pagination.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-pagination/test/cpsl-pagination.spec.js +0 -37
- package/dist/collection/components/cpsl-pagination/test/cpsl-pagination.spec.js.map +0 -1
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js +0 -29
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js +0 -37
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js.map +0 -1
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js +0 -29
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js +0 -37
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js.map +0 -1
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js +0 -29
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js +0 -37
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js.map +0 -1
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js +0 -29
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js +0 -37
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js.map +0 -1
- package/dist/collection/components/cpsl-radio/test/cpsl-radio.e2e.js +0 -29
- package/dist/collection/components/cpsl-radio/test/cpsl-radio.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-radio/test/cpsl-radio.spec.js +0 -37
- package/dist/collection/components/cpsl-radio/test/cpsl-radio.spec.js.map +0 -1
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js +0 -29
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js +0 -37
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js.map +0 -1
- package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js +0 -29
- package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js +0 -37
- package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js.map +0 -1
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js +0 -29
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js +0 -37
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js.map +0 -1
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js +0 -29
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js +0 -37
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js.map +0 -1
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js +0 -29
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js +0 -37
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js.map +0 -1
- package/dist/collection/components/cpsl-switch/test/cpsl-switch.e2e.js +0 -29
- package/dist/collection/components/cpsl-switch/test/cpsl-switch.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-switch/test/cpsl-switch.spec.js +0 -37
- package/dist/collection/components/cpsl-switch/test/cpsl-switch.spec.js.map +0 -1
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js +0 -29
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js +0 -37
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js.map +0 -1
- package/dist/collection/components/cpsl-table/test/cpsl-table.e2e.js +0 -29
- package/dist/collection/components/cpsl-table/test/cpsl-table.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-table/test/cpsl-table.spec.js +0 -37
- package/dist/collection/components/cpsl-table/test/cpsl-table.spec.js.map +0 -1
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js +0 -29
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js +0 -37
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js.map +0 -1
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js +0 -29
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js +0 -37
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js.map +0 -1
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js +0 -29
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js.map +0 -1
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js +0 -37
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js.map +0 -1
- package/dist/esm/cpsl-alert_34.entry.js.map +0 -1
- package/dist/esm/index-b188f201.js +0 -2076
- package/dist/esm/index-b188f201.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- /package/dist/types/Users/{briancorbin/Documents/Programming/Capsule/component-library/core → norwood/capsule-repos/web-sdk/packages/core-components}/.stencil/scripts/buildAssets.d.ts +0 -0
@@ -1,2076 +0,0 @@
|
|
1
|
-
const NAMESPACE = 'capsule';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Virtual DOM patching algorithm based on Snabbdom by
|
5
|
-
* Simon Friis Vindum (@paldepind)
|
6
|
-
* Licensed under the MIT License
|
7
|
-
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
8
|
-
*
|
9
|
-
* Modified for Stencil's renderer and slot projection
|
10
|
-
*/
|
11
|
-
let scopeId;
|
12
|
-
let hostTagName;
|
13
|
-
let useNativeShadowDom = false;
|
14
|
-
let isSvgMode = false;
|
15
|
-
let queuePending = false;
|
16
|
-
const createTime = (fnName, tagName = '') => {
|
17
|
-
{
|
18
|
-
return () => {
|
19
|
-
return;
|
20
|
-
};
|
21
|
-
}
|
22
|
-
};
|
23
|
-
const uniqueTime = (key, measureText) => {
|
24
|
-
{
|
25
|
-
return () => {
|
26
|
-
return;
|
27
|
-
};
|
28
|
-
}
|
29
|
-
};
|
30
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
31
|
-
/**
|
32
|
-
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
33
|
-
*
|
34
|
-
* Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
|
35
|
-
* support as of Stencil v4.
|
36
|
-
*/
|
37
|
-
const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
|
38
|
-
/**
|
39
|
-
* Default style mode id
|
40
|
-
*/
|
41
|
-
/**
|
42
|
-
* Reusable empty obj/array
|
43
|
-
* Don't add values to these!!
|
44
|
-
*/
|
45
|
-
const EMPTY_OBJ = {};
|
46
|
-
/**
|
47
|
-
* Namespaces
|
48
|
-
*/
|
49
|
-
const SVG_NS = 'http://www.w3.org/2000/svg';
|
50
|
-
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
51
|
-
const isDef = (v) => v != null;
|
52
|
-
/**
|
53
|
-
* Check whether a value is a 'complex type', defined here as an object or a
|
54
|
-
* function.
|
55
|
-
*
|
56
|
-
* @param o the value to check
|
57
|
-
* @returns whether it's a complex type or not
|
58
|
-
*/
|
59
|
-
const isComplexType = (o) => {
|
60
|
-
// https://jsperf.com/typeof-fn-object/5
|
61
|
-
o = typeof o;
|
62
|
-
return o === 'object' || o === 'function';
|
63
|
-
};
|
64
|
-
/**
|
65
|
-
* Helper method for querying a `meta` tag that contains a nonce value
|
66
|
-
* out of a DOM's head.
|
67
|
-
*
|
68
|
-
* @param doc The DOM containing the `head` to query against
|
69
|
-
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
70
|
-
* exists or the tag has no content.
|
71
|
-
*/
|
72
|
-
function queryNonceMetaTagContent(doc) {
|
73
|
-
var _a, _b, _c;
|
74
|
-
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
75
|
-
}
|
76
|
-
/**
|
77
|
-
* Production h() function based on Preact by
|
78
|
-
* Jason Miller (@developit)
|
79
|
-
* Licensed under the MIT License
|
80
|
-
* https://github.com/developit/preact/blob/master/LICENSE
|
81
|
-
*
|
82
|
-
* Modified for Stencil's compiler and vdom
|
83
|
-
*/
|
84
|
-
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
85
|
-
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
86
|
-
const h = (nodeName, vnodeData, ...children) => {
|
87
|
-
let child = null;
|
88
|
-
let key = null;
|
89
|
-
let simple = false;
|
90
|
-
let lastSimple = false;
|
91
|
-
const vNodeChildren = [];
|
92
|
-
const walk = (c) => {
|
93
|
-
for (let i = 0; i < c.length; i++) {
|
94
|
-
child = c[i];
|
95
|
-
if (Array.isArray(child)) {
|
96
|
-
walk(child);
|
97
|
-
}
|
98
|
-
else if (child != null && typeof child !== 'boolean') {
|
99
|
-
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
|
100
|
-
child = String(child);
|
101
|
-
}
|
102
|
-
if (simple && lastSimple) {
|
103
|
-
// If the previous child was simple (string), we merge both
|
104
|
-
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
105
|
-
}
|
106
|
-
else {
|
107
|
-
// Append a new vNode, if it's text, we create a text vNode
|
108
|
-
vNodeChildren.push(simple ? newVNode(null, child) : child);
|
109
|
-
}
|
110
|
-
lastSimple = simple;
|
111
|
-
}
|
112
|
-
}
|
113
|
-
};
|
114
|
-
walk(children);
|
115
|
-
if (vnodeData) {
|
116
|
-
if (vnodeData.key) {
|
117
|
-
key = vnodeData.key;
|
118
|
-
}
|
119
|
-
// normalize class / className attributes
|
120
|
-
{
|
121
|
-
const classData = vnodeData.className || vnodeData.class;
|
122
|
-
if (classData) {
|
123
|
-
vnodeData.class =
|
124
|
-
typeof classData !== 'object'
|
125
|
-
? classData
|
126
|
-
: Object.keys(classData)
|
127
|
-
.filter((k) => classData[k])
|
128
|
-
.join(' ');
|
129
|
-
}
|
130
|
-
}
|
131
|
-
}
|
132
|
-
if (typeof nodeName === 'function') {
|
133
|
-
// nodeName is a functional component
|
134
|
-
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
135
|
-
}
|
136
|
-
const vnode = newVNode(nodeName, null);
|
137
|
-
vnode.$attrs$ = vnodeData;
|
138
|
-
if (vNodeChildren.length > 0) {
|
139
|
-
vnode.$children$ = vNodeChildren;
|
140
|
-
}
|
141
|
-
{
|
142
|
-
vnode.$key$ = key;
|
143
|
-
}
|
144
|
-
return vnode;
|
145
|
-
};
|
146
|
-
/**
|
147
|
-
* A utility function for creating a virtual DOM node from a tag and some
|
148
|
-
* possible text content.
|
149
|
-
*
|
150
|
-
* @param tag the tag for this element
|
151
|
-
* @param text possible text content for the node
|
152
|
-
* @returns a newly-minted virtual DOM node
|
153
|
-
*/
|
154
|
-
const newVNode = (tag, text) => {
|
155
|
-
const vnode = {
|
156
|
-
$flags$: 0,
|
157
|
-
$tag$: tag,
|
158
|
-
$text$: text,
|
159
|
-
$elm$: null,
|
160
|
-
$children$: null,
|
161
|
-
};
|
162
|
-
{
|
163
|
-
vnode.$attrs$ = null;
|
164
|
-
}
|
165
|
-
{
|
166
|
-
vnode.$key$ = null;
|
167
|
-
}
|
168
|
-
return vnode;
|
169
|
-
};
|
170
|
-
const Host = {};
|
171
|
-
/**
|
172
|
-
* Check whether a given node is a Host node or not
|
173
|
-
*
|
174
|
-
* @param node the virtual DOM node to check
|
175
|
-
* @returns whether it's a Host node or not
|
176
|
-
*/
|
177
|
-
const isHost = (node) => node && node.$tag$ === Host;
|
178
|
-
/**
|
179
|
-
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
180
|
-
*
|
181
|
-
* Note that these functions convert from {@link d.VNode} to
|
182
|
-
* {@link d.ChildNode} to give functional component developers a friendly
|
183
|
-
* interface.
|
184
|
-
*/
|
185
|
-
const vdomFnUtils = {
|
186
|
-
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
187
|
-
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
188
|
-
};
|
189
|
-
/**
|
190
|
-
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
191
|
-
* friendlier public interface (hence, 'convertToPublic').
|
192
|
-
*
|
193
|
-
* @param node the virtual DOM node to convert
|
194
|
-
* @returns a converted child node
|
195
|
-
*/
|
196
|
-
const convertToPublic = (node) => ({
|
197
|
-
vattrs: node.$attrs$,
|
198
|
-
vchildren: node.$children$,
|
199
|
-
vkey: node.$key$,
|
200
|
-
vname: node.$name$,
|
201
|
-
vtag: node.$tag$,
|
202
|
-
vtext: node.$text$,
|
203
|
-
});
|
204
|
-
/**
|
205
|
-
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
206
|
-
* order to use the resulting object in the virtual DOM. The initial object was
|
207
|
-
* likely created as part of presenting a public API, so converting it back
|
208
|
-
* involved making it 'private' again (hence, `convertToPrivate`).
|
209
|
-
*
|
210
|
-
* @param node the child node to convert
|
211
|
-
* @returns a converted virtual DOM node
|
212
|
-
*/
|
213
|
-
const convertToPrivate = (node) => {
|
214
|
-
if (typeof node.vtag === 'function') {
|
215
|
-
const vnodeData = Object.assign({}, node.vattrs);
|
216
|
-
if (node.vkey) {
|
217
|
-
vnodeData.key = node.vkey;
|
218
|
-
}
|
219
|
-
if (node.vname) {
|
220
|
-
vnodeData.name = node.vname;
|
221
|
-
}
|
222
|
-
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
223
|
-
}
|
224
|
-
const vnode = newVNode(node.vtag, node.vtext);
|
225
|
-
vnode.$attrs$ = node.vattrs;
|
226
|
-
vnode.$children$ = node.vchildren;
|
227
|
-
vnode.$key$ = node.vkey;
|
228
|
-
vnode.$name$ = node.vname;
|
229
|
-
return vnode;
|
230
|
-
};
|
231
|
-
/**
|
232
|
-
* Parse a new property value for a given property type.
|
233
|
-
*
|
234
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
235
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
236
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
237
|
-
* 2. the type stored from `propType`.
|
238
|
-
*
|
239
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
240
|
-
*
|
241
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
242
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
243
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
244
|
-
* ```tsx
|
245
|
-
* <my-cmp prop-val={0}></my-cmp>
|
246
|
-
* ```
|
247
|
-
*
|
248
|
-
* HTML prop values on the other hand, will always a string
|
249
|
-
*
|
250
|
-
* @param propValue the new value to coerce to some type
|
251
|
-
* @param propType the type of the prop, expressed as a binary number
|
252
|
-
* @returns the parsed/coerced value
|
253
|
-
*/
|
254
|
-
const parsePropertyValue = (propValue, propType) => {
|
255
|
-
// ensure this value is of the correct prop type
|
256
|
-
if (propValue != null && !isComplexType(propValue)) {
|
257
|
-
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
258
|
-
// per the HTML spec, any string value means it is a boolean true value
|
259
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
260
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
261
|
-
}
|
262
|
-
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
263
|
-
// force it to be a number
|
264
|
-
return parseFloat(propValue);
|
265
|
-
}
|
266
|
-
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
267
|
-
// could have been passed as a number or boolean
|
268
|
-
// but we still want it as a string
|
269
|
-
return String(propValue);
|
270
|
-
}
|
271
|
-
// redundant return here for better minification
|
272
|
-
return propValue;
|
273
|
-
}
|
274
|
-
// not sure exactly what type we want
|
275
|
-
// so no need to change to a different type
|
276
|
-
return propValue;
|
277
|
-
};
|
278
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
279
|
-
const createEvent = (ref, name, flags) => {
|
280
|
-
const elm = getElement(ref);
|
281
|
-
return {
|
282
|
-
emit: (detail) => {
|
283
|
-
return emitEvent(elm, name, {
|
284
|
-
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
285
|
-
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
286
|
-
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
287
|
-
detail,
|
288
|
-
});
|
289
|
-
},
|
290
|
-
};
|
291
|
-
};
|
292
|
-
/**
|
293
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
294
|
-
* @param elm the target of the Event
|
295
|
-
* @param name the name to give the custom Event
|
296
|
-
* @param opts options for configuring a custom Event
|
297
|
-
* @returns the custom Event
|
298
|
-
*/
|
299
|
-
const emitEvent = (elm, name, opts) => {
|
300
|
-
const ev = plt.ce(name, opts);
|
301
|
-
elm.dispatchEvent(ev);
|
302
|
-
return ev;
|
303
|
-
};
|
304
|
-
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
305
|
-
const registerStyle = (scopeId, cssText, allowCS) => {
|
306
|
-
let style = styles.get(scopeId);
|
307
|
-
if (supportsConstructableStylesheets && allowCS) {
|
308
|
-
style = (style || new CSSStyleSheet());
|
309
|
-
if (typeof style === 'string') {
|
310
|
-
style = cssText;
|
311
|
-
}
|
312
|
-
else {
|
313
|
-
style.replaceSync(cssText);
|
314
|
-
}
|
315
|
-
}
|
316
|
-
else {
|
317
|
-
style = cssText;
|
318
|
-
}
|
319
|
-
styles.set(scopeId, style);
|
320
|
-
};
|
321
|
-
const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
322
|
-
var _a;
|
323
|
-
const scopeId = getScopeId(cmpMeta);
|
324
|
-
const style = styles.get(scopeId);
|
325
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
326
|
-
// so the fallback is to always use the document for the root node in those cases
|
327
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
328
|
-
if (style) {
|
329
|
-
if (typeof style === 'string') {
|
330
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
331
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
332
|
-
let styleElm;
|
333
|
-
if (!appliedStyles) {
|
334
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
335
|
-
}
|
336
|
-
if (!appliedStyles.has(scopeId)) {
|
337
|
-
{
|
338
|
-
styleElm = doc.createElement('style');
|
339
|
-
styleElm.innerHTML = style;
|
340
|
-
// Apply CSP nonce to the style tag if it exists
|
341
|
-
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
342
|
-
if (nonce != null) {
|
343
|
-
styleElm.setAttribute('nonce', nonce);
|
344
|
-
}
|
345
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
346
|
-
}
|
347
|
-
// Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
|
348
|
-
if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
|
349
|
-
styleElm.innerHTML += SLOT_FB_CSS;
|
350
|
-
}
|
351
|
-
if (appliedStyles) {
|
352
|
-
appliedStyles.add(scopeId);
|
353
|
-
}
|
354
|
-
}
|
355
|
-
}
|
356
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
357
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
358
|
-
}
|
359
|
-
}
|
360
|
-
return scopeId;
|
361
|
-
};
|
362
|
-
const attachStyles = (hostRef) => {
|
363
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
364
|
-
const elm = hostRef.$hostElement$;
|
365
|
-
const flags = cmpMeta.$flags$;
|
366
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
367
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
368
|
-
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
369
|
-
// only required when we're NOT using native shadow dom (slot)
|
370
|
-
// or this browser doesn't support native shadow dom
|
371
|
-
// and this host element was NOT created with SSR
|
372
|
-
// let's pick out the inner content for slot projection
|
373
|
-
// create a node to represent where the original
|
374
|
-
// content was first placed, which is useful later on
|
375
|
-
// DOM WRITE!!
|
376
|
-
elm['s-sc'] = scopeId;
|
377
|
-
elm.classList.add(scopeId + '-h');
|
378
|
-
}
|
379
|
-
endAttachStyles();
|
380
|
-
};
|
381
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
382
|
-
/**
|
383
|
-
* Production setAccessor() function based on Preact by
|
384
|
-
* Jason Miller (@developit)
|
385
|
-
* Licensed under the MIT License
|
386
|
-
* https://github.com/developit/preact/blob/master/LICENSE
|
387
|
-
*
|
388
|
-
* Modified for Stencil's compiler and vdom
|
389
|
-
*/
|
390
|
-
/**
|
391
|
-
* When running a VDom render set properties present on a VDom node onto the
|
392
|
-
* corresponding HTML element.
|
393
|
-
*
|
394
|
-
* Note that this function has special functionality for the `class`,
|
395
|
-
* `style`, `key`, and `ref` attributes, as well as event handlers (like
|
396
|
-
* `onClick`, etc). All others are just passed through as-is.
|
397
|
-
*
|
398
|
-
* @param elm the HTMLElement onto which attributes should be set
|
399
|
-
* @param memberName the name of the attribute to set
|
400
|
-
* @param oldValue the old value for the attribute
|
401
|
-
* @param newValue the new value for the attribute
|
402
|
-
* @param isSvg whether we're in an svg context or not
|
403
|
-
* @param flags bitflags for Vdom variables
|
404
|
-
*/
|
405
|
-
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
406
|
-
if (oldValue !== newValue) {
|
407
|
-
let isProp = isMemberInElement(elm, memberName);
|
408
|
-
let ln = memberName.toLowerCase();
|
409
|
-
if (memberName === 'class') {
|
410
|
-
const classList = elm.classList;
|
411
|
-
const oldClasses = parseClassList(oldValue);
|
412
|
-
const newClasses = parseClassList(newValue);
|
413
|
-
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
414
|
-
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
415
|
-
}
|
416
|
-
else if (memberName === 'style') {
|
417
|
-
// update style attribute, css properties and values
|
418
|
-
{
|
419
|
-
for (const prop in oldValue) {
|
420
|
-
if (!newValue || newValue[prop] == null) {
|
421
|
-
if (prop.includes('-')) {
|
422
|
-
elm.style.removeProperty(prop);
|
423
|
-
}
|
424
|
-
else {
|
425
|
-
elm.style[prop] = '';
|
426
|
-
}
|
427
|
-
}
|
428
|
-
}
|
429
|
-
}
|
430
|
-
for (const prop in newValue) {
|
431
|
-
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
432
|
-
if (prop.includes('-')) {
|
433
|
-
elm.style.setProperty(prop, newValue[prop]);
|
434
|
-
}
|
435
|
-
else {
|
436
|
-
elm.style[prop] = newValue[prop];
|
437
|
-
}
|
438
|
-
}
|
439
|
-
}
|
440
|
-
}
|
441
|
-
else if (memberName === 'key')
|
442
|
-
;
|
443
|
-
else if (memberName === 'ref') {
|
444
|
-
// minifier will clean this up
|
445
|
-
if (newValue) {
|
446
|
-
newValue(elm);
|
447
|
-
}
|
448
|
-
}
|
449
|
-
else if ((!isProp ) &&
|
450
|
-
memberName[0] === 'o' &&
|
451
|
-
memberName[1] === 'n') {
|
452
|
-
// Event Handlers
|
453
|
-
// so if the member name starts with "on" and the 3rd characters is
|
454
|
-
// a capital letter, and it's not already a member on the element,
|
455
|
-
// then we're assuming it's an event listener
|
456
|
-
if (memberName[2] === '-') {
|
457
|
-
// on- prefixed events
|
458
|
-
// allows to be explicit about the dom event to listen without any magic
|
459
|
-
// under the hood:
|
460
|
-
// <my-cmp on-click> // listens for "click"
|
461
|
-
// <my-cmp on-Click> // listens for "Click"
|
462
|
-
// <my-cmp on-ionChange> // listens for "ionChange"
|
463
|
-
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
464
|
-
memberName = memberName.slice(3);
|
465
|
-
}
|
466
|
-
else if (isMemberInElement(win, ln)) {
|
467
|
-
// standard event
|
468
|
-
// the JSX attribute could have been "onMouseOver" and the
|
469
|
-
// member name "onmouseover" is on the window's prototype
|
470
|
-
// so let's add the listener "mouseover", which is all lowercased
|
471
|
-
memberName = ln.slice(2);
|
472
|
-
}
|
473
|
-
else {
|
474
|
-
// custom event
|
475
|
-
// the JSX attribute could have been "onMyCustomEvent"
|
476
|
-
// so let's trim off the "on" prefix and lowercase the first character
|
477
|
-
// and add the listener "myCustomEvent"
|
478
|
-
// except for the first character, we keep the event name case
|
479
|
-
memberName = ln[2] + memberName.slice(3);
|
480
|
-
}
|
481
|
-
if (oldValue || newValue) {
|
482
|
-
// Need to account for "capture" events.
|
483
|
-
// If the event name ends with "Capture", we'll update the name to remove
|
484
|
-
// the "Capture" suffix and make sure the event listener is setup to handle the capture event.
|
485
|
-
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
486
|
-
// Make sure we only replace the last instance of "Capture"
|
487
|
-
memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
|
488
|
-
if (oldValue) {
|
489
|
-
plt.rel(elm, memberName, oldValue, capture);
|
490
|
-
}
|
491
|
-
if (newValue) {
|
492
|
-
plt.ael(elm, memberName, newValue, capture);
|
493
|
-
}
|
494
|
-
}
|
495
|
-
}
|
496
|
-
else {
|
497
|
-
// Set property if it exists and it's not a SVG
|
498
|
-
const isComplex = isComplexType(newValue);
|
499
|
-
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
500
|
-
try {
|
501
|
-
if (!elm.tagName.includes('-')) {
|
502
|
-
const n = newValue == null ? '' : newValue;
|
503
|
-
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
504
|
-
if (memberName === 'list') {
|
505
|
-
isProp = false;
|
506
|
-
}
|
507
|
-
else if (oldValue == null || elm[memberName] != n) {
|
508
|
-
elm[memberName] = n;
|
509
|
-
}
|
510
|
-
}
|
511
|
-
else {
|
512
|
-
elm[memberName] = newValue;
|
513
|
-
}
|
514
|
-
}
|
515
|
-
catch (e) {
|
516
|
-
/**
|
517
|
-
* in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
|
518
|
-
*/
|
519
|
-
}
|
520
|
-
}
|
521
|
-
if (newValue == null || newValue === false) {
|
522
|
-
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
523
|
-
{
|
524
|
-
elm.removeAttribute(memberName);
|
525
|
-
}
|
526
|
-
}
|
527
|
-
}
|
528
|
-
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
529
|
-
newValue = newValue === true ? '' : newValue;
|
530
|
-
{
|
531
|
-
elm.setAttribute(memberName, newValue);
|
532
|
-
}
|
533
|
-
}
|
534
|
-
}
|
535
|
-
}
|
536
|
-
};
|
537
|
-
const parseClassListRegex = /\s/;
|
538
|
-
/**
|
539
|
-
* Parsed a string of classnames into an array
|
540
|
-
* @param value className string, e.g. "foo bar baz"
|
541
|
-
* @returns list of classes, e.g. ["foo", "bar", "baz"]
|
542
|
-
*/
|
543
|
-
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
544
|
-
const CAPTURE_EVENT_SUFFIX = 'Capture';
|
545
|
-
const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
|
546
|
-
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
547
|
-
// if the element passed in is a shadow root, which is a document fragment
|
548
|
-
// then we want to be adding attrs/props to the shadow root's "host" element
|
549
|
-
// if it's not a shadow root, then we add attrs/props to the same element
|
550
|
-
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
551
|
-
? newVnode.$elm$.host
|
552
|
-
: newVnode.$elm$;
|
553
|
-
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
554
|
-
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
555
|
-
{
|
556
|
-
// remove attributes no longer present on the vnode by setting them to undefined
|
557
|
-
for (memberName in oldVnodeAttrs) {
|
558
|
-
if (!(memberName in newVnodeAttrs)) {
|
559
|
-
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
560
|
-
}
|
561
|
-
}
|
562
|
-
}
|
563
|
-
// add new & update changed attributes
|
564
|
-
for (memberName in newVnodeAttrs) {
|
565
|
-
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
566
|
-
}
|
567
|
-
};
|
568
|
-
/**
|
569
|
-
* Create a DOM Node corresponding to one of the children of a given VNode.
|
570
|
-
*
|
571
|
-
* @param oldParentVNode the parent VNode from the previous render
|
572
|
-
* @param newParentVNode the parent VNode from the current render
|
573
|
-
* @param childIndex the index of the VNode, in the _new_ parent node's
|
574
|
-
* children, for which we will create a new DOM node
|
575
|
-
* @param parentElm the parent DOM node which our new node will be a child of
|
576
|
-
* @returns the newly created node
|
577
|
-
*/
|
578
|
-
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
579
|
-
// tslint:disable-next-line: prefer-const
|
580
|
-
const newVNode = newParentVNode.$children$[childIndex];
|
581
|
-
let i = 0;
|
582
|
-
let elm;
|
583
|
-
let childNode;
|
584
|
-
if (newVNode.$text$ !== null) {
|
585
|
-
// create text node
|
586
|
-
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
587
|
-
}
|
588
|
-
else {
|
589
|
-
if (!isSvgMode) {
|
590
|
-
isSvgMode = newVNode.$tag$ === 'svg';
|
591
|
-
}
|
592
|
-
// create element
|
593
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
|
594
|
-
);
|
595
|
-
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
596
|
-
isSvgMode = false;
|
597
|
-
}
|
598
|
-
// add css classes, attrs, props, listeners, etc.
|
599
|
-
{
|
600
|
-
updateElement(null, newVNode, isSvgMode);
|
601
|
-
}
|
602
|
-
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
603
|
-
// if there is a scopeId and this is the initial render
|
604
|
-
// then let's add the scopeId as a css class
|
605
|
-
elm.classList.add((elm['s-si'] = scopeId));
|
606
|
-
}
|
607
|
-
if (newVNode.$children$) {
|
608
|
-
for (i = 0; i < newVNode.$children$.length; ++i) {
|
609
|
-
// create the node
|
610
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
611
|
-
// return node could have been null
|
612
|
-
if (childNode) {
|
613
|
-
// append our new node
|
614
|
-
elm.appendChild(childNode);
|
615
|
-
}
|
616
|
-
}
|
617
|
-
}
|
618
|
-
{
|
619
|
-
if (newVNode.$tag$ === 'svg') {
|
620
|
-
// Only reset the SVG context when we're exiting <svg> element
|
621
|
-
isSvgMode = false;
|
622
|
-
}
|
623
|
-
else if (elm.tagName === 'foreignObject') {
|
624
|
-
// Reenter SVG context when we're exiting <foreignObject> element
|
625
|
-
isSvgMode = true;
|
626
|
-
}
|
627
|
-
}
|
628
|
-
}
|
629
|
-
// This needs to always happen so we can hide nodes that are projected
|
630
|
-
// to another component but don't end up in a slot
|
631
|
-
elm['s-hn'] = hostTagName;
|
632
|
-
return elm;
|
633
|
-
};
|
634
|
-
/**
|
635
|
-
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
636
|
-
* add them to the DOM in the appropriate place.
|
637
|
-
*
|
638
|
-
* @param parentElm the DOM node which should be used as a parent for the new
|
639
|
-
* DOM nodes
|
640
|
-
* @param before a child of the `parentElm` which the new children should be
|
641
|
-
* inserted before (optional)
|
642
|
-
* @param parentVNode the parent virtual DOM node
|
643
|
-
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
644
|
-
* @param startIdx the index in the child virtual DOM nodes at which to start
|
645
|
-
* creating DOM nodes (inclusive)
|
646
|
-
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
647
|
-
* creating DOM nodes (inclusive)
|
648
|
-
*/
|
649
|
-
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
650
|
-
let containerElm = (parentElm);
|
651
|
-
let childNode;
|
652
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
653
|
-
containerElm = containerElm.shadowRoot;
|
654
|
-
}
|
655
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
656
|
-
if (vnodes[startIdx]) {
|
657
|
-
childNode = createElm(null, parentVNode, startIdx);
|
658
|
-
if (childNode) {
|
659
|
-
vnodes[startIdx].$elm$ = childNode;
|
660
|
-
containerElm.insertBefore(childNode, before);
|
661
|
-
}
|
662
|
-
}
|
663
|
-
}
|
664
|
-
};
|
665
|
-
/**
|
666
|
-
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
667
|
-
* This can be used to, for instance, clean up after a list of children which
|
668
|
-
* should no longer be shown.
|
669
|
-
*
|
670
|
-
* This function also handles some of Stencil's slot relocation logic.
|
671
|
-
*
|
672
|
-
* @param vnodes a list of virtual DOM nodes to remove
|
673
|
-
* @param startIdx the index at which to start removing nodes (inclusive)
|
674
|
-
* @param endIdx the index at which to stop removing nodes (inclusive)
|
675
|
-
*/
|
676
|
-
const removeVnodes = (vnodes, startIdx, endIdx) => {
|
677
|
-
for (let index = startIdx; index <= endIdx; ++index) {
|
678
|
-
const vnode = vnodes[index];
|
679
|
-
if (vnode) {
|
680
|
-
const elm = vnode.$elm$;
|
681
|
-
nullifyVNodeRefs(vnode);
|
682
|
-
if (elm) {
|
683
|
-
// remove the vnode's element from the dom
|
684
|
-
elm.remove();
|
685
|
-
}
|
686
|
-
}
|
687
|
-
}
|
688
|
-
};
|
689
|
-
/**
|
690
|
-
* Reconcile the children of a new VNode with the children of an old VNode by
|
691
|
-
* traversing the two collections of children, identifying nodes that are
|
692
|
-
* conserved or changed, calling out to `patch` to make any necessary
|
693
|
-
* updates to the DOM, and rearranging DOM nodes as needed.
|
694
|
-
*
|
695
|
-
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
696
|
-
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
697
|
-
* 'windows' by storing start and end indices and references to the
|
698
|
-
* corresponding array entries. Initially the two 'windows' are basically equal
|
699
|
-
* to the entire array, but we progressively narrow the windows until there are
|
700
|
-
* no children left to update by doing the following:
|
701
|
-
*
|
702
|
-
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
703
|
-
* that if we have an initial array like the following we'll end up dealing
|
704
|
-
* only with a window bounded by the highlighted elements:
|
705
|
-
*
|
706
|
-
* [null, null, VNode1 , ... , VNode2, null, null]
|
707
|
-
* ^^^^^^ ^^^^^^
|
708
|
-
*
|
709
|
-
* 2. Check to see if the elements at the head and tail positions are equal
|
710
|
-
* across the windows. This will basically detect elements which haven't
|
711
|
-
* been added, removed, or changed position, i.e. if you had the following
|
712
|
-
* VNode elements (represented as HTML):
|
713
|
-
*
|
714
|
-
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
715
|
-
* newVNode: `<div><p><span>THERE</span></p></div>`
|
716
|
-
*
|
717
|
-
* Then when comparing the children of the `<div>` tag we check the equality
|
718
|
-
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
719
|
-
* same tag in the same position, we'd be able to avoid completely
|
720
|
-
* re-rendering the subtree under them with a new DOM element and would just
|
721
|
-
* call out to `patch` to handle reconciling their children and so on.
|
722
|
-
*
|
723
|
-
* 3. Check, for both windows, to see if the element at the beginning of the
|
724
|
-
* window corresponds to the element at the end of the other window. This is
|
725
|
-
* a heuristic which will let us identify _some_ situations in which
|
726
|
-
* elements have changed position, for instance it _should_ detect that the
|
727
|
-
* children nodes themselves have not changed but merely moved in the
|
728
|
-
* following example:
|
729
|
-
*
|
730
|
-
* oldVNode: `<div><element-one /><element-two /></div>`
|
731
|
-
* newVNode: `<div><element-two /><element-one /></div>`
|
732
|
-
*
|
733
|
-
* If we find cases like this then we also need to move the concrete DOM
|
734
|
-
* elements corresponding to the moved children to write the re-order to the
|
735
|
-
* DOM.
|
736
|
-
*
|
737
|
-
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
738
|
-
* nodes in the old children which have the same key as the first element in
|
739
|
-
* our window on the new children. If we find such a node we handle calling
|
740
|
-
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
741
|
-
* what we find.
|
742
|
-
*
|
743
|
-
* Finally, once we've narrowed our 'windows' to the point that either of them
|
744
|
-
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
745
|
-
* insertion or deletion that needs to happen to get a DOM state that correctly
|
746
|
-
* reflects the new child VNodes. If, for instance, after our window on the old
|
747
|
-
* children has collapsed we still have more nodes on the new children that
|
748
|
-
* we haven't dealt with yet then we need to add them, or if the new children
|
749
|
-
* collapse but we still have unhandled _old_ children then we need to make
|
750
|
-
* sure the corresponding DOM nodes are removed.
|
751
|
-
*
|
752
|
-
* @param parentElm the node into which the parent VNode is rendered
|
753
|
-
* @param oldCh the old children of the parent node
|
754
|
-
* @param newVNode the new VNode which will replace the parent
|
755
|
-
* @param newCh the new children of the parent node
|
756
|
-
* @param isInitialRender whether or not this is the first render of the vdom
|
757
|
-
*/
|
758
|
-
const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
|
759
|
-
let oldStartIdx = 0;
|
760
|
-
let newStartIdx = 0;
|
761
|
-
let idxInOld = 0;
|
762
|
-
let i = 0;
|
763
|
-
let oldEndIdx = oldCh.length - 1;
|
764
|
-
let oldStartVnode = oldCh[0];
|
765
|
-
let oldEndVnode = oldCh[oldEndIdx];
|
766
|
-
let newEndIdx = newCh.length - 1;
|
767
|
-
let newStartVnode = newCh[0];
|
768
|
-
let newEndVnode = newCh[newEndIdx];
|
769
|
-
let node;
|
770
|
-
let elmToMove;
|
771
|
-
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
772
|
-
if (oldStartVnode == null) {
|
773
|
-
// VNode might have been moved left
|
774
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
775
|
-
}
|
776
|
-
else if (oldEndVnode == null) {
|
777
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
778
|
-
}
|
779
|
-
else if (newStartVnode == null) {
|
780
|
-
newStartVnode = newCh[++newStartIdx];
|
781
|
-
}
|
782
|
-
else if (newEndVnode == null) {
|
783
|
-
newEndVnode = newCh[--newEndIdx];
|
784
|
-
}
|
785
|
-
else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
|
786
|
-
// if the start nodes are the same then we should patch the new VNode
|
787
|
-
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
788
|
-
// indices to reflect that. We don't need to move any DOM Nodes around
|
789
|
-
// since things are matched up in order.
|
790
|
-
patch(oldStartVnode, newStartVnode, isInitialRender);
|
791
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
792
|
-
newStartVnode = newCh[++newStartIdx];
|
793
|
-
}
|
794
|
-
else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
|
795
|
-
// likewise, if the end nodes are the same we patch new onto old and
|
796
|
-
// decrement our end indices, and also likewise in this case we don't
|
797
|
-
// need to move any DOM Nodes.
|
798
|
-
patch(oldEndVnode, newEndVnode, isInitialRender);
|
799
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
800
|
-
newEndVnode = newCh[--newEndIdx];
|
801
|
-
}
|
802
|
-
else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
803
|
-
patch(oldStartVnode, newEndVnode, isInitialRender);
|
804
|
-
// We need to move the element for `oldStartVnode` into a position which
|
805
|
-
// will be appropriate for `newEndVnode`. For this we can use
|
806
|
-
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
807
|
-
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
808
|
-
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
809
|
-
//
|
810
|
-
// <old-start-node />
|
811
|
-
// <some-intervening-node />
|
812
|
-
// <old-end-node />
|
813
|
-
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
814
|
-
// <next-sibling />
|
815
|
-
//
|
816
|
-
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
817
|
-
// the node for `oldStartVnode` at the end of the children of
|
818
|
-
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
819
|
-
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
820
|
-
// append it to the children of the parent element.
|
821
|
-
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
822
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
823
|
-
newEndVnode = newCh[--newEndIdx];
|
824
|
-
}
|
825
|
-
else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
826
|
-
patch(oldEndVnode, newStartVnode, isInitialRender);
|
827
|
-
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
828
|
-
// the same node, so since we're here we know that they are not. Thus we
|
829
|
-
// can move the element for `oldEndVnode` _before_ the element for
|
830
|
-
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
831
|
-
// future.
|
832
|
-
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
833
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
834
|
-
newStartVnode = newCh[++newStartIdx];
|
835
|
-
}
|
836
|
-
else {
|
837
|
-
// Here we do some checks to match up old and new nodes based on the
|
838
|
-
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
839
|
-
// in the JSX for a DOM element in the implementation of a Stencil
|
840
|
-
// component.
|
841
|
-
//
|
842
|
-
// First we check to see if there are any nodes in the array of old
|
843
|
-
// children which have the same key as the first node in the new
|
844
|
-
// children.
|
845
|
-
idxInOld = -1;
|
846
|
-
{
|
847
|
-
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
848
|
-
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
849
|
-
idxInOld = i;
|
850
|
-
break;
|
851
|
-
}
|
852
|
-
}
|
853
|
-
}
|
854
|
-
if (idxInOld >= 0) {
|
855
|
-
// We found a node in the old children which matches up with the first
|
856
|
-
// node in the new children! So let's deal with that
|
857
|
-
elmToMove = oldCh[idxInOld];
|
858
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
859
|
-
// the tag doesn't match so we'll need a new DOM element
|
860
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
861
|
-
}
|
862
|
-
else {
|
863
|
-
patch(elmToMove, newStartVnode, isInitialRender);
|
864
|
-
// invalidate the matching old node so that we won't try to update it
|
865
|
-
// again later on
|
866
|
-
oldCh[idxInOld] = undefined;
|
867
|
-
node = elmToMove.$elm$;
|
868
|
-
}
|
869
|
-
newStartVnode = newCh[++newStartIdx];
|
870
|
-
}
|
871
|
-
else {
|
872
|
-
// We either didn't find an element in the old children that matches
|
873
|
-
// the key of the first new child OR the build is not using `key`
|
874
|
-
// attributes at all. In either case we need to create a new element
|
875
|
-
// for the new node.
|
876
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
877
|
-
newStartVnode = newCh[++newStartIdx];
|
878
|
-
}
|
879
|
-
if (node) {
|
880
|
-
// if we created a new node then handle inserting it to the DOM
|
881
|
-
{
|
882
|
-
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
883
|
-
}
|
884
|
-
}
|
885
|
-
}
|
886
|
-
}
|
887
|
-
if (oldStartIdx > oldEndIdx) {
|
888
|
-
// we have some more new nodes to add which don't match up with old nodes
|
889
|
-
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
890
|
-
}
|
891
|
-
else if (newStartIdx > newEndIdx) {
|
892
|
-
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
893
|
-
// in the new array, so lets remove them (which entails cleaning up the
|
894
|
-
// relevant DOM nodes)
|
895
|
-
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
896
|
-
}
|
897
|
-
};
|
898
|
-
/**
|
899
|
-
* Compare two VNodes to determine if they are the same
|
900
|
-
*
|
901
|
-
* **NB**: This function is an equality _heuristic_ based on the available
|
902
|
-
* information set on the two VNodes and can be misleading under certain
|
903
|
-
* circumstances. In particular, if the two nodes do not have `key` attrs
|
904
|
-
* (available under `$key$` on VNodes) then the function falls back on merely
|
905
|
-
* checking that they have the same tag.
|
906
|
-
*
|
907
|
-
* So, in other words, if `key` attrs are not set on VNodes which may be
|
908
|
-
* changing order within a `children` array or something along those lines then
|
909
|
-
* we could obtain a false negative and then have to do needless re-rendering
|
910
|
-
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
911
|
-
*
|
912
|
-
* @param leftVNode the first VNode to check
|
913
|
-
* @param rightVNode the second VNode to check
|
914
|
-
* @param isInitialRender whether or not this is the first render of the vdom
|
915
|
-
* @returns whether they're equal or not
|
916
|
-
*/
|
917
|
-
const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
918
|
-
// compare if two vnode to see if they're "technically" the same
|
919
|
-
// need to have the same element tag, and same key to be the same
|
920
|
-
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
921
|
-
// this will be set if JSX tags in the build have `key` attrs set on them
|
922
|
-
// we only want to check this if we're not on the first render since on
|
923
|
-
// first render `leftVNode.$key$` will always be `null`, so we can be led
|
924
|
-
// astray and, for instance, accidentally delete a DOM node that we want to
|
925
|
-
// keep around.
|
926
|
-
if (!isInitialRender) {
|
927
|
-
return leftVNode.$key$ === rightVNode.$key$;
|
928
|
-
}
|
929
|
-
return true;
|
930
|
-
}
|
931
|
-
return false;
|
932
|
-
};
|
933
|
-
/**
|
934
|
-
* Handle reconciling an outdated VNode with a new one which corresponds to
|
935
|
-
* it. This function handles flushing updates to the DOM and reconciling the
|
936
|
-
* children of the two nodes (if any).
|
937
|
-
*
|
938
|
-
* @param oldVNode an old VNode whose DOM element and children we want to update
|
939
|
-
* @param newVNode a new VNode representing an updated version of the old one
|
940
|
-
* @param isInitialRender whether or not this is the first render of the vdom
|
941
|
-
*/
|
942
|
-
const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
943
|
-
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
944
|
-
const oldChildren = oldVNode.$children$;
|
945
|
-
const newChildren = newVNode.$children$;
|
946
|
-
const tag = newVNode.$tag$;
|
947
|
-
const text = newVNode.$text$;
|
948
|
-
if (text === null) {
|
949
|
-
{
|
950
|
-
// test if we're rendering an svg element, or still rendering nodes inside of one
|
951
|
-
// only add this to the when the compiler sees we're using an svg somewhere
|
952
|
-
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
953
|
-
}
|
954
|
-
{
|
955
|
-
if (tag === 'slot' && !useNativeShadowDom) ;
|
956
|
-
else {
|
957
|
-
// either this is the first render of an element OR it's an update
|
958
|
-
// AND we already know it's possible it could have changed
|
959
|
-
// this updates the element's css classes, attrs, props, listeners, etc.
|
960
|
-
updateElement(oldVNode, newVNode, isSvgMode);
|
961
|
-
}
|
962
|
-
}
|
963
|
-
if (oldChildren !== null && newChildren !== null) {
|
964
|
-
// looks like there's child vnodes for both the old and new vnodes
|
965
|
-
// so we need to call `updateChildren` to reconcile them
|
966
|
-
updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
|
967
|
-
}
|
968
|
-
else if (newChildren !== null) {
|
969
|
-
// no old child vnodes, but there are new child vnodes to add
|
970
|
-
if (oldVNode.$text$ !== null) {
|
971
|
-
// the old vnode was text, so be sure to clear it out
|
972
|
-
elm.textContent = '';
|
973
|
-
}
|
974
|
-
// add the new vnode children
|
975
|
-
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
976
|
-
}
|
977
|
-
else if (oldChildren !== null) {
|
978
|
-
// no new child vnodes, but there are old child vnodes to remove
|
979
|
-
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
980
|
-
}
|
981
|
-
if (isSvgMode && tag === 'svg') {
|
982
|
-
isSvgMode = false;
|
983
|
-
}
|
984
|
-
}
|
985
|
-
else if (oldVNode.$text$ !== text) {
|
986
|
-
// update the text content for the text only vnode
|
987
|
-
// and also only if the text is different than before
|
988
|
-
elm.data = text;
|
989
|
-
}
|
990
|
-
};
|
991
|
-
/**
|
992
|
-
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
|
993
|
-
* them with `null`. This signals that the DOM element corresponding to the VDom
|
994
|
-
* node has been removed from the DOM.
|
995
|
-
*
|
996
|
-
* @param vNode a virtual DOM node
|
997
|
-
*/
|
998
|
-
const nullifyVNodeRefs = (vNode) => {
|
999
|
-
{
|
1000
|
-
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
1001
|
-
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
1002
|
-
}
|
1003
|
-
};
|
1004
|
-
/**
|
1005
|
-
* The main entry point for Stencil's virtual DOM-based rendering engine
|
1006
|
-
*
|
1007
|
-
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
1008
|
-
* function will handle creating a virtual DOM tree with a single root, patching
|
1009
|
-
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
1010
|
-
* relocation, and reflecting attributes.
|
1011
|
-
*
|
1012
|
-
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
1013
|
-
* the DOM node into which it should be rendered.
|
1014
|
-
* @param renderFnResults the virtual DOM nodes to be rendered
|
1015
|
-
* @param isInitialLoad whether or not this is the first call after page load
|
1016
|
-
*/
|
1017
|
-
const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
1018
|
-
const hostElm = hostRef.$hostElement$;
|
1019
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
1020
|
-
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
1021
|
-
// if `renderFnResults` is a Host node then we can use it directly. If not,
|
1022
|
-
// we need to call `h` again to wrap the children of our component in a
|
1023
|
-
// 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
|
1024
|
-
// implicitly that the top-level vdom node is 1) an only child and 2)
|
1025
|
-
// contains attrs that need to be set on the host element.
|
1026
|
-
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
1027
|
-
hostTagName = hostElm.tagName;
|
1028
|
-
if (cmpMeta.$attrsToReflect$) {
|
1029
|
-
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
1030
|
-
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
1031
|
-
}
|
1032
|
-
// On the first render and *only* on the first render we want to check for
|
1033
|
-
// any attributes set on the host element which are also set on the vdom
|
1034
|
-
// node. If we find them, we override the value on the VDom node attrs with
|
1035
|
-
// the value from the host element, which allows developers building apps
|
1036
|
-
// with Stencil components to override e.g. the `role` attribute on a
|
1037
|
-
// component even if it's already set on the `Host`.
|
1038
|
-
if (isInitialLoad && rootVnode.$attrs$) {
|
1039
|
-
for (const key of Object.keys(rootVnode.$attrs$)) {
|
1040
|
-
// We have a special implementation in `setAccessor` for `style` and
|
1041
|
-
// `class` which reconciles values coming from the VDom with values
|
1042
|
-
// already present on the DOM element, so we don't want to override those
|
1043
|
-
// attributes on the VDom tree with values from the host element if they
|
1044
|
-
// are present.
|
1045
|
-
//
|
1046
|
-
// Likewise, `ref` and `key` are special internal values for the Stencil
|
1047
|
-
// runtime and we don't want to override those either.
|
1048
|
-
if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
|
1049
|
-
rootVnode.$attrs$[key] = hostElm[key];
|
1050
|
-
}
|
1051
|
-
}
|
1052
|
-
}
|
1053
|
-
rootVnode.$tag$ = null;
|
1054
|
-
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
1055
|
-
hostRef.$vnode$ = rootVnode;
|
1056
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
1057
|
-
{
|
1058
|
-
scopeId = hostElm['s-sc'];
|
1059
|
-
}
|
1060
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
1061
|
-
// synchronous patch
|
1062
|
-
patch(oldVNode, rootVnode, isInitialLoad);
|
1063
|
-
};
|
1064
|
-
const attachToAncestor = (hostRef, ancestorComponent) => {
|
1065
|
-
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
1066
|
-
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
1067
|
-
}
|
1068
|
-
};
|
1069
|
-
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
1070
|
-
{
|
1071
|
-
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
1072
|
-
}
|
1073
|
-
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
1074
|
-
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
1075
|
-
return;
|
1076
|
-
}
|
1077
|
-
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
1078
|
-
// there is no ancestor component or the ancestor component
|
1079
|
-
// has already fired off its lifecycle update then
|
1080
|
-
// fire off the initial update
|
1081
|
-
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
1082
|
-
return writeTask(dispatch) ;
|
1083
|
-
};
|
1084
|
-
/**
|
1085
|
-
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
1086
|
-
* component lifecycle methods like `componentWillLoad` as well as
|
1087
|
-
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
1088
|
-
*
|
1089
|
-
* @param hostRef a reference to a host DOM node
|
1090
|
-
* @param isInitialLoad whether we're on the initial load or not
|
1091
|
-
* @returns an empty Promise which is used to enqueue a series of operations for
|
1092
|
-
* the component
|
1093
|
-
*/
|
1094
|
-
const dispatchHooks = (hostRef, isInitialLoad) => {
|
1095
|
-
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
1096
|
-
const instance = hostRef.$lazyInstance$ ;
|
1097
|
-
// We're going to use this variable together with `enqueue` to implement a
|
1098
|
-
// little promise-based queue. We start out with it `undefined`. When we add
|
1099
|
-
// the first function to the queue we'll set this variable to be that
|
1100
|
-
// function's return value. When we attempt to add subsequent values to the
|
1101
|
-
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
1102
|
-
// the new function off of that `Promise` using `.then()`. This will give our
|
1103
|
-
// queue two nice properties:
|
1104
|
-
//
|
1105
|
-
// 1. If all functions added to the queue are synchronous they'll be called
|
1106
|
-
// synchronously right away.
|
1107
|
-
// 2. If all functions added to the queue are asynchronous they'll all be
|
1108
|
-
// called in order after `dispatchHooks` exits.
|
1109
|
-
let maybePromise;
|
1110
|
-
if (isInitialLoad) {
|
1111
|
-
{
|
1112
|
-
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
1113
|
-
if (hostRef.$queuedListeners$) {
|
1114
|
-
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
1115
|
-
hostRef.$queuedListeners$ = undefined;
|
1116
|
-
}
|
1117
|
-
}
|
1118
|
-
{
|
1119
|
-
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
1120
|
-
// whatever's going on in that `Promise` before we launch into
|
1121
|
-
// rendering the component, doing other lifecycle stuff, etc. So
|
1122
|
-
// in that case we assign the returned promise to the variable we
|
1123
|
-
// declared above to hold a possible 'queueing' Promise
|
1124
|
-
maybePromise = safeCall(instance, 'componentWillLoad');
|
1125
|
-
}
|
1126
|
-
}
|
1127
|
-
{
|
1128
|
-
maybePromise = enqueue(maybePromise, () => safeCall(instance, 'componentWillRender'));
|
1129
|
-
}
|
1130
|
-
endSchedule();
|
1131
|
-
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
1132
|
-
};
|
1133
|
-
/**
|
1134
|
-
* This function uses a Promise to implement a simple first-in, first-out queue
|
1135
|
-
* of functions to be called.
|
1136
|
-
*
|
1137
|
-
* The queue is ordered on the basis of the first argument. If it's
|
1138
|
-
* `undefined`, then nothing is on the queue yet, so the provided function can
|
1139
|
-
* be called synchronously (although note that this function may return a
|
1140
|
-
* `Promise`). The idea is that then the return value of that enqueueing
|
1141
|
-
* operation is kept around, so that if it was a `Promise` then subsequent
|
1142
|
-
* functions can be enqueued by calling this function again with that `Promise`
|
1143
|
-
* as the first argument.
|
1144
|
-
*
|
1145
|
-
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
1146
|
-
* @param fn a function to enqueue
|
1147
|
-
* @returns either a `Promise` or the return value of the provided function
|
1148
|
-
*/
|
1149
|
-
const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
|
1150
|
-
/**
|
1151
|
-
* Check that a value is a `Promise`. To check, we first see if the value is an
|
1152
|
-
* instance of the `Promise` global. In a few circumstances, in particular if
|
1153
|
-
* the global has been overwritten, this is could be misleading, so we also do
|
1154
|
-
* a little 'duck typing' check to see if the `.then` property of the value is
|
1155
|
-
* defined and a function.
|
1156
|
-
*
|
1157
|
-
* @param maybePromise it might be a promise!
|
1158
|
-
* @returns whether it is or not
|
1159
|
-
*/
|
1160
|
-
const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
|
1161
|
-
(maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
|
1162
|
-
/**
|
1163
|
-
* Update a component given reference to its host elements and so on.
|
1164
|
-
*
|
1165
|
-
* @param hostRef an object containing references to the element's host node,
|
1166
|
-
* VDom nodes, and other metadata
|
1167
|
-
* @param instance a reference to the underlying host element where it will be
|
1168
|
-
* rendered
|
1169
|
-
* @param isInitialLoad whether or not this function is being called as part of
|
1170
|
-
* the first render cycle
|
1171
|
-
*/
|
1172
|
-
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
1173
|
-
var _a;
|
1174
|
-
const elm = hostRef.$hostElement$;
|
1175
|
-
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
1176
|
-
const rc = elm['s-rc'];
|
1177
|
-
if (isInitialLoad) {
|
1178
|
-
// DOM WRITE!
|
1179
|
-
attachStyles(hostRef);
|
1180
|
-
}
|
1181
|
-
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
1182
|
-
{
|
1183
|
-
callRender(hostRef, instance, elm, isInitialLoad);
|
1184
|
-
}
|
1185
|
-
if (rc) {
|
1186
|
-
// ok, so turns out there are some child host elements
|
1187
|
-
// waiting on this parent element to load
|
1188
|
-
// let's fire off all update callbacks waiting
|
1189
|
-
rc.map((cb) => cb());
|
1190
|
-
elm['s-rc'] = undefined;
|
1191
|
-
}
|
1192
|
-
endRender();
|
1193
|
-
endUpdate();
|
1194
|
-
{
|
1195
|
-
const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
|
1196
|
-
const postUpdate = () => postUpdateComponent(hostRef);
|
1197
|
-
if (childrenPromises.length === 0) {
|
1198
|
-
postUpdate();
|
1199
|
-
}
|
1200
|
-
else {
|
1201
|
-
Promise.all(childrenPromises).then(postUpdate);
|
1202
|
-
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
1203
|
-
childrenPromises.length = 0;
|
1204
|
-
}
|
1205
|
-
}
|
1206
|
-
};
|
1207
|
-
/**
|
1208
|
-
* Handle making the call to the VDom renderer with the proper context given
|
1209
|
-
* various build variables
|
1210
|
-
*
|
1211
|
-
* @param hostRef an object containing references to the element's host node,
|
1212
|
-
* VDom nodes, and other metadata
|
1213
|
-
* @param instance a reference to the underlying host element where it will be
|
1214
|
-
* rendered
|
1215
|
-
* @param elm the Host element for the component
|
1216
|
-
* @param isInitialLoad whether or not this function is being called as part of
|
1217
|
-
* @returns an empty promise
|
1218
|
-
*/
|
1219
|
-
const callRender = (hostRef, instance, elm, isInitialLoad) => {
|
1220
|
-
try {
|
1221
|
-
/**
|
1222
|
-
* minification optimization: `allRenderFn` is `true` if all components have a `render`
|
1223
|
-
* method, so we can call the method immediately. If not, check before calling it.
|
1224
|
-
*/
|
1225
|
-
instance = instance.render() ;
|
1226
|
-
{
|
1227
|
-
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
1228
|
-
}
|
1229
|
-
{
|
1230
|
-
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
1231
|
-
}
|
1232
|
-
{
|
1233
|
-
{
|
1234
|
-
// looks like we've got child nodes to render into this host element
|
1235
|
-
// or we need to update the css class/attrs on the host element
|
1236
|
-
// DOM WRITE!
|
1237
|
-
{
|
1238
|
-
renderVdom(hostRef, instance, isInitialLoad);
|
1239
|
-
}
|
1240
|
-
}
|
1241
|
-
}
|
1242
|
-
}
|
1243
|
-
catch (e) {
|
1244
|
-
consoleError(e, hostRef.$hostElement$);
|
1245
|
-
}
|
1246
|
-
return null;
|
1247
|
-
};
|
1248
|
-
const postUpdateComponent = (hostRef) => {
|
1249
|
-
const tagName = hostRef.$cmpMeta$.$tagName$;
|
1250
|
-
const elm = hostRef.$hostElement$;
|
1251
|
-
const endPostUpdate = createTime('postUpdate', tagName);
|
1252
|
-
const instance = hostRef.$lazyInstance$ ;
|
1253
|
-
const ancestorComponent = hostRef.$ancestorComponent$;
|
1254
|
-
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
1255
|
-
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
1256
|
-
{
|
1257
|
-
// DOM WRITE!
|
1258
|
-
addHydratedFlag(elm);
|
1259
|
-
}
|
1260
|
-
{
|
1261
|
-
safeCall(instance, 'componentDidLoad');
|
1262
|
-
}
|
1263
|
-
endPostUpdate();
|
1264
|
-
{
|
1265
|
-
hostRef.$onReadyResolve$(elm);
|
1266
|
-
if (!ancestorComponent) {
|
1267
|
-
appDidLoad();
|
1268
|
-
}
|
1269
|
-
}
|
1270
|
-
}
|
1271
|
-
else {
|
1272
|
-
endPostUpdate();
|
1273
|
-
}
|
1274
|
-
{
|
1275
|
-
hostRef.$onInstanceResolve$(elm);
|
1276
|
-
}
|
1277
|
-
// load events fire from bottom to top
|
1278
|
-
// the deepest elements load first then bubbles up
|
1279
|
-
{
|
1280
|
-
if (hostRef.$onRenderResolve$) {
|
1281
|
-
hostRef.$onRenderResolve$();
|
1282
|
-
hostRef.$onRenderResolve$ = undefined;
|
1283
|
-
}
|
1284
|
-
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
1285
|
-
nextTick(() => scheduleUpdate(hostRef, false));
|
1286
|
-
}
|
1287
|
-
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
1288
|
-
}
|
1289
|
-
// ( •_•)
|
1290
|
-
// ( •_•)>⌐■-■
|
1291
|
-
// (⌐■_■)
|
1292
|
-
};
|
1293
|
-
const forceUpdate = (ref) => {
|
1294
|
-
{
|
1295
|
-
const hostRef = getHostRef(ref);
|
1296
|
-
const isConnected = hostRef.$hostElement$.isConnected;
|
1297
|
-
if (isConnected &&
|
1298
|
-
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
1299
|
-
scheduleUpdate(hostRef, false);
|
1300
|
-
}
|
1301
|
-
// Returns "true" when the forced update was successfully scheduled
|
1302
|
-
return isConnected;
|
1303
|
-
}
|
1304
|
-
};
|
1305
|
-
const appDidLoad = (who) => {
|
1306
|
-
// on appload
|
1307
|
-
// we have finish the first big initial render
|
1308
|
-
{
|
1309
|
-
addHydratedFlag(doc.documentElement);
|
1310
|
-
}
|
1311
|
-
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
1312
|
-
};
|
1313
|
-
/**
|
1314
|
-
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
1315
|
-
* e.g. custom element node. If a build figures out that e.g. no component
|
1316
|
-
* has a `componentDidLoad` method, the instance method gets removed from the
|
1317
|
-
* output bundle and this function returns `undefined`.
|
1318
|
-
* @param instance any object that may or may not contain methods
|
1319
|
-
* @param method method name
|
1320
|
-
* @param arg single arbitrary argument
|
1321
|
-
* @returns result of method call if it exists, otherwise `undefined`
|
1322
|
-
*/
|
1323
|
-
const safeCall = (instance, method, arg) => {
|
1324
|
-
if (instance && instance[method]) {
|
1325
|
-
try {
|
1326
|
-
return instance[method](arg);
|
1327
|
-
}
|
1328
|
-
catch (e) {
|
1329
|
-
consoleError(e);
|
1330
|
-
}
|
1331
|
-
}
|
1332
|
-
return undefined;
|
1333
|
-
};
|
1334
|
-
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
1335
|
-
;
|
1336
|
-
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
1337
|
-
const setValue = (ref, propName, newVal, cmpMeta) => {
|
1338
|
-
// check our new property value against our internal value
|
1339
|
-
const hostRef = getHostRef(ref);
|
1340
|
-
const elm = hostRef.$hostElement$ ;
|
1341
|
-
const oldVal = hostRef.$instanceValues$.get(propName);
|
1342
|
-
const flags = hostRef.$flags$;
|
1343
|
-
const instance = hostRef.$lazyInstance$ ;
|
1344
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
1345
|
-
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
1346
|
-
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
1347
|
-
const didValueChange = newVal !== oldVal && !areBothNaN;
|
1348
|
-
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
1349
|
-
// gadzooks! the property's value has changed!!
|
1350
|
-
// set our new value!
|
1351
|
-
hostRef.$instanceValues$.set(propName, newVal);
|
1352
|
-
if (instance) {
|
1353
|
-
// get an array of method names of watch functions to call
|
1354
|
-
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
1355
|
-
const watchMethods = cmpMeta.$watchers$[propName];
|
1356
|
-
if (watchMethods) {
|
1357
|
-
// this instance is watching for when this property changed
|
1358
|
-
watchMethods.map((watchMethodName) => {
|
1359
|
-
try {
|
1360
|
-
// fire off each of the watch methods that are watching this property
|
1361
|
-
instance[watchMethodName](newVal, oldVal, propName);
|
1362
|
-
}
|
1363
|
-
catch (e) {
|
1364
|
-
consoleError(e, elm);
|
1365
|
-
}
|
1366
|
-
});
|
1367
|
-
}
|
1368
|
-
}
|
1369
|
-
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
1370
|
-
// looks like this value actually changed, so we've got work to do!
|
1371
|
-
// but only if we've already rendered, otherwise just chill out
|
1372
|
-
// queue that we need to do an update, but don't worry about queuing
|
1373
|
-
// up millions cuz this function ensures it only runs once
|
1374
|
-
scheduleUpdate(hostRef, false);
|
1375
|
-
}
|
1376
|
-
}
|
1377
|
-
}
|
1378
|
-
};
|
1379
|
-
/**
|
1380
|
-
* Attach a series of runtime constructs to a compiled Stencil component
|
1381
|
-
* constructor, including getters and setters for the `@Prop` and `@State`
|
1382
|
-
* decorators, callbacks for when attributes change, and so on.
|
1383
|
-
*
|
1384
|
-
* @param Cstr the constructor for a component that we need to process
|
1385
|
-
* @param cmpMeta metadata collected previously about the component
|
1386
|
-
* @param flags a number used to store a series of bit flags
|
1387
|
-
* @returns a reference to the same constructor passed in (but now mutated)
|
1388
|
-
*/
|
1389
|
-
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
1390
|
-
var _a;
|
1391
|
-
const prototype = Cstr.prototype;
|
1392
|
-
if (cmpMeta.$members$) {
|
1393
|
-
if (Cstr.watchers) {
|
1394
|
-
cmpMeta.$watchers$ = Cstr.watchers;
|
1395
|
-
}
|
1396
|
-
// It's better to have a const than two Object.entries()
|
1397
|
-
const members = Object.entries(cmpMeta.$members$);
|
1398
|
-
members.map(([memberName, [memberFlags]]) => {
|
1399
|
-
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
1400
|
-
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
1401
|
-
// proxyComponent - prop
|
1402
|
-
Object.defineProperty(prototype, memberName, {
|
1403
|
-
get() {
|
1404
|
-
// proxyComponent, get value
|
1405
|
-
return getValue(this, memberName);
|
1406
|
-
},
|
1407
|
-
set(newValue) {
|
1408
|
-
// proxyComponent, set value
|
1409
|
-
setValue(this, memberName, newValue, cmpMeta);
|
1410
|
-
},
|
1411
|
-
configurable: true,
|
1412
|
-
enumerable: true,
|
1413
|
-
});
|
1414
|
-
}
|
1415
|
-
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
1416
|
-
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
1417
|
-
// proxyComponent - method
|
1418
|
-
Object.defineProperty(prototype, memberName, {
|
1419
|
-
value(...args) {
|
1420
|
-
var _a;
|
1421
|
-
const ref = getHostRef(this);
|
1422
|
-
return (_a = ref === null || ref === void 0 ? void 0 : ref.$onInstancePromise$) === null || _a === void 0 ? void 0 : _a.then(() => { var _a; return (_a = ref.$lazyInstance$) === null || _a === void 0 ? void 0 : _a[memberName](...args); });
|
1423
|
-
},
|
1424
|
-
});
|
1425
|
-
}
|
1426
|
-
});
|
1427
|
-
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
1428
|
-
const attrNameToPropName = new Map();
|
1429
|
-
prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
|
1430
|
-
plt.jmp(() => {
|
1431
|
-
var _a;
|
1432
|
-
const propName = attrNameToPropName.get(attrName);
|
1433
|
-
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
1434
|
-
// in the case where an attribute was set inline.
|
1435
|
-
// ```html
|
1436
|
-
// <my-component some-attribute="some-value"></my-component>
|
1437
|
-
// ```
|
1438
|
-
//
|
1439
|
-
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
1440
|
-
// programmatically changes it before it has been upgraded as shown below:
|
1441
|
-
//
|
1442
|
-
// ```html
|
1443
|
-
// <!-- this component has _not_ been upgraded yet -->
|
1444
|
-
// <my-component id="test" some-attribute="some-value"></my-component>
|
1445
|
-
// <script>
|
1446
|
-
// // grab non-upgraded component
|
1447
|
-
// el = document.querySelector("#test");
|
1448
|
-
// el.someAttribute = "another-value";
|
1449
|
-
// // upgrade component
|
1450
|
-
// customElements.define('my-component', MyComponent);
|
1451
|
-
// </script>
|
1452
|
-
// ```
|
1453
|
-
// In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
|
1454
|
-
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
1455
|
-
// to the value that was set inline i.e. "some-value" from above example. When
|
1456
|
-
// the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
|
1457
|
-
//
|
1458
|
-
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
|
1459
|
-
// by connectedCallback as this attributeChangedCallback will not fire.
|
1460
|
-
//
|
1461
|
-
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
1462
|
-
//
|
1463
|
-
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
1464
|
-
// properties here given that this goes against best practices outlined here
|
1465
|
-
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
1466
|
-
if (this.hasOwnProperty(propName)) {
|
1467
|
-
newValue = this[propName];
|
1468
|
-
delete this[propName];
|
1469
|
-
}
|
1470
|
-
else if (prototype.hasOwnProperty(propName) &&
|
1471
|
-
typeof this[propName] === 'number' &&
|
1472
|
-
this[propName] == newValue) {
|
1473
|
-
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
1474
|
-
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
1475
|
-
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
1476
|
-
return;
|
1477
|
-
}
|
1478
|
-
else if (propName == null) {
|
1479
|
-
// At this point we should know this is not a "member", so we can treat it like watching an attribute
|
1480
|
-
// on a vanilla web component
|
1481
|
-
const hostRef = getHostRef(this);
|
1482
|
-
const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
|
1483
|
-
// We only want to trigger the callback(s) if:
|
1484
|
-
// 1. The instance is ready
|
1485
|
-
// 2. The watchers are ready
|
1486
|
-
// 3. The value has changed
|
1487
|
-
if (flags &&
|
1488
|
-
!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
|
1489
|
-
flags & 128 /* HOST_FLAGS.isWatchReady */ &&
|
1490
|
-
newValue !== oldValue) {
|
1491
|
-
const instance = hostRef.$lazyInstance$ ;
|
1492
|
-
const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
|
1493
|
-
entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
|
1494
|
-
if (instance[callbackName] != null) {
|
1495
|
-
instance[callbackName].call(instance, newValue, oldValue, attrName);
|
1496
|
-
}
|
1497
|
-
});
|
1498
|
-
}
|
1499
|
-
return;
|
1500
|
-
}
|
1501
|
-
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
1502
|
-
});
|
1503
|
-
};
|
1504
|
-
// Create an array of attributes to observe
|
1505
|
-
// This list in comprised of all strings used within a `@Watch()` decorator
|
1506
|
-
// on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
|
1507
|
-
// As such, there is no way to guarantee type-safety here that a user hasn't entered
|
1508
|
-
// an invalid attribute.
|
1509
|
-
Cstr.observedAttributes = Array.from(new Set([
|
1510
|
-
...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
|
1511
|
-
...members
|
1512
|
-
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
|
1513
|
-
.map(([propName, m]) => {
|
1514
|
-
var _a;
|
1515
|
-
const attrName = m[1] || propName;
|
1516
|
-
attrNameToPropName.set(attrName, propName);
|
1517
|
-
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
1518
|
-
(_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
|
1519
|
-
}
|
1520
|
-
return attrName;
|
1521
|
-
}),
|
1522
|
-
]));
|
1523
|
-
}
|
1524
|
-
}
|
1525
|
-
return Cstr;
|
1526
|
-
};
|
1527
|
-
/**
|
1528
|
-
* Initialize a Stencil component given a reference to its host element, its
|
1529
|
-
* runtime bookkeeping data structure, runtime metadata about the component,
|
1530
|
-
* and (optionally) an HMR version ID.
|
1531
|
-
*
|
1532
|
-
* @param elm a host element
|
1533
|
-
* @param hostRef the element's runtime bookkeeping object
|
1534
|
-
* @param cmpMeta runtime metadata for the Stencil component
|
1535
|
-
* @param hmrVersionId an (optional) HMR version ID
|
1536
|
-
*/
|
1537
|
-
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
1538
|
-
let Cstr;
|
1539
|
-
// initializeComponent
|
1540
|
-
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
1541
|
-
// Let the runtime know that the component has been initialized
|
1542
|
-
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
1543
|
-
const bundleId = cmpMeta.$lazyBundleId$;
|
1544
|
-
if (bundleId) {
|
1545
|
-
// lazy loaded components
|
1546
|
-
// request the component's implementation to be
|
1547
|
-
// wired up with the host element
|
1548
|
-
Cstr = loadModule(cmpMeta);
|
1549
|
-
if (Cstr.then) {
|
1550
|
-
// Await creates a micro-task avoid if possible
|
1551
|
-
const endLoad = uniqueTime();
|
1552
|
-
Cstr = await Cstr;
|
1553
|
-
endLoad();
|
1554
|
-
}
|
1555
|
-
if (!Cstr.isProxied) {
|
1556
|
-
// we've never proxied this Constructor before
|
1557
|
-
// let's add the getters/setters to its prototype before
|
1558
|
-
// the first time we create an instance of the implementation
|
1559
|
-
{
|
1560
|
-
cmpMeta.$watchers$ = Cstr.watchers;
|
1561
|
-
}
|
1562
|
-
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
1563
|
-
Cstr.isProxied = true;
|
1564
|
-
}
|
1565
|
-
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
1566
|
-
// ok, time to construct the instance
|
1567
|
-
// but let's keep track of when we start and stop
|
1568
|
-
// so that the getters/setters don't incorrectly step on data
|
1569
|
-
{
|
1570
|
-
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
1571
|
-
}
|
1572
|
-
// construct the lazy-loaded component implementation
|
1573
|
-
// passing the hostRef is very important during
|
1574
|
-
// construction in order to directly wire together the
|
1575
|
-
// host element and the lazy-loaded instance
|
1576
|
-
try {
|
1577
|
-
new Cstr(hostRef);
|
1578
|
-
}
|
1579
|
-
catch (e) {
|
1580
|
-
consoleError(e);
|
1581
|
-
}
|
1582
|
-
{
|
1583
|
-
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
1584
|
-
}
|
1585
|
-
{
|
1586
|
-
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
1587
|
-
}
|
1588
|
-
endNewInstance();
|
1589
|
-
}
|
1590
|
-
else {
|
1591
|
-
// sync constructor component
|
1592
|
-
Cstr = elm.constructor;
|
1593
|
-
// wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
|
1594
|
-
// watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
|
1595
|
-
// Stencil has completed instantiating the component.
|
1596
|
-
customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
|
1597
|
-
}
|
1598
|
-
if (Cstr.style) {
|
1599
|
-
// this component has styles but we haven't registered them yet
|
1600
|
-
let style = Cstr.style;
|
1601
|
-
const scopeId = getScopeId(cmpMeta);
|
1602
|
-
if (!styles.has(scopeId)) {
|
1603
|
-
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
1604
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
1605
|
-
endRegisterStyles();
|
1606
|
-
}
|
1607
|
-
}
|
1608
|
-
}
|
1609
|
-
// we've successfully created a lazy instance
|
1610
|
-
const ancestorComponent = hostRef.$ancestorComponent$;
|
1611
|
-
const schedule = () => scheduleUpdate(hostRef, true);
|
1612
|
-
if (ancestorComponent && ancestorComponent['s-rc']) {
|
1613
|
-
// this is the initial load and this component it has an ancestor component
|
1614
|
-
// but the ancestor component has NOT fired its will update lifecycle yet
|
1615
|
-
// so let's just cool our jets and wait for the ancestor to continue first
|
1616
|
-
// this will get fired off when the ancestor component
|
1617
|
-
// finally gets around to rendering its lazy self
|
1618
|
-
// fire off the initial update
|
1619
|
-
ancestorComponent['s-rc'].push(schedule);
|
1620
|
-
}
|
1621
|
-
else {
|
1622
|
-
schedule();
|
1623
|
-
}
|
1624
|
-
};
|
1625
|
-
const fireConnectedCallback = (instance) => {
|
1626
|
-
};
|
1627
|
-
const connectedCallback = (elm) => {
|
1628
|
-
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1629
|
-
const hostRef = getHostRef(elm);
|
1630
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
1631
|
-
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
1632
|
-
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
1633
|
-
// first time this component has connected
|
1634
|
-
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
1635
|
-
{
|
1636
|
-
// find the first ancestor component (if there is one) and register
|
1637
|
-
// this component as one of the actively loading child components for its ancestor
|
1638
|
-
let ancestorComponent = elm;
|
1639
|
-
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
1640
|
-
// climb up the ancestors looking for the first
|
1641
|
-
// component that hasn't finished its lifecycle update yet
|
1642
|
-
if (ancestorComponent['s-p']) {
|
1643
|
-
// we found this components first ancestor component
|
1644
|
-
// keep a reference to this component's ancestor component
|
1645
|
-
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
1646
|
-
break;
|
1647
|
-
}
|
1648
|
-
}
|
1649
|
-
}
|
1650
|
-
// Lazy properties
|
1651
|
-
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
1652
|
-
if (cmpMeta.$members$) {
|
1653
|
-
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
1654
|
-
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
1655
|
-
const value = elm[memberName];
|
1656
|
-
delete elm[memberName];
|
1657
|
-
elm[memberName] = value;
|
1658
|
-
}
|
1659
|
-
});
|
1660
|
-
}
|
1661
|
-
{
|
1662
|
-
initializeComponent(elm, hostRef, cmpMeta);
|
1663
|
-
}
|
1664
|
-
}
|
1665
|
-
else {
|
1666
|
-
// not the first time this has connected
|
1667
|
-
// reattach any event listeners to the host
|
1668
|
-
// since they would have been removed when disconnected
|
1669
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
1670
|
-
// fire off connectedCallback() on component instance
|
1671
|
-
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
|
1672
|
-
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
1673
|
-
hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
|
1674
|
-
}
|
1675
|
-
}
|
1676
|
-
endConnected();
|
1677
|
-
}
|
1678
|
-
};
|
1679
|
-
const disconnectInstance = (instance) => {
|
1680
|
-
{
|
1681
|
-
safeCall(instance, 'disconnectedCallback');
|
1682
|
-
}
|
1683
|
-
};
|
1684
|
-
const disconnectedCallback = async (elm) => {
|
1685
|
-
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1686
|
-
const hostRef = getHostRef(elm);
|
1687
|
-
{
|
1688
|
-
if (hostRef.$rmListeners$) {
|
1689
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
1690
|
-
hostRef.$rmListeners$ = undefined;
|
1691
|
-
}
|
1692
|
-
}
|
1693
|
-
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
1694
|
-
disconnectInstance(hostRef.$lazyInstance$);
|
1695
|
-
}
|
1696
|
-
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
1697
|
-
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
|
1698
|
-
}
|
1699
|
-
}
|
1700
|
-
};
|
1701
|
-
const bootstrapLazy = (lazyBundles, options = {}) => {
|
1702
|
-
var _a;
|
1703
|
-
const endBootstrap = createTime();
|
1704
|
-
const cmpTags = [];
|
1705
|
-
const exclude = options.exclude || [];
|
1706
|
-
const customElements = win.customElements;
|
1707
|
-
const head = doc.head;
|
1708
|
-
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
1709
|
-
const dataStyles = /*@__PURE__*/ doc.createElement('style');
|
1710
|
-
const deferredConnectedCallbacks = [];
|
1711
|
-
let appLoadFallback;
|
1712
|
-
let isBootstrapping = true;
|
1713
|
-
Object.assign(plt, options);
|
1714
|
-
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
1715
|
-
let hasSlotRelocation = false;
|
1716
|
-
lazyBundles.map((lazyBundle) => {
|
1717
|
-
lazyBundle[1].map((compactMeta) => {
|
1718
|
-
var _a;
|
1719
|
-
const cmpMeta = {
|
1720
|
-
$flags$: compactMeta[0],
|
1721
|
-
$tagName$: compactMeta[1],
|
1722
|
-
$members$: compactMeta[2],
|
1723
|
-
$listeners$: compactMeta[3],
|
1724
|
-
};
|
1725
|
-
// Check if we are using slots outside the shadow DOM in this component.
|
1726
|
-
// We'll use this information later to add styles for `slot-fb` elements
|
1727
|
-
if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
|
1728
|
-
hasSlotRelocation = true;
|
1729
|
-
}
|
1730
|
-
{
|
1731
|
-
cmpMeta.$members$ = compactMeta[2];
|
1732
|
-
}
|
1733
|
-
{
|
1734
|
-
cmpMeta.$listeners$ = compactMeta[3];
|
1735
|
-
}
|
1736
|
-
{
|
1737
|
-
cmpMeta.$attrsToReflect$ = [];
|
1738
|
-
}
|
1739
|
-
{
|
1740
|
-
cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
|
1741
|
-
}
|
1742
|
-
const tagName = cmpMeta.$tagName$;
|
1743
|
-
const HostElement = class extends HTMLElement {
|
1744
|
-
// StencilLazyHost
|
1745
|
-
constructor(self) {
|
1746
|
-
// @ts-ignore
|
1747
|
-
super(self);
|
1748
|
-
self = this;
|
1749
|
-
registerHost(self, cmpMeta);
|
1750
|
-
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
1751
|
-
// this component is using shadow dom
|
1752
|
-
// and this browser supports shadow dom
|
1753
|
-
// add the read-only property "shadowRoot" to the host element
|
1754
|
-
// adding the shadow root build conditionals to minimize runtime
|
1755
|
-
{
|
1756
|
-
{
|
1757
|
-
self.attachShadow({ mode: 'open' });
|
1758
|
-
}
|
1759
|
-
}
|
1760
|
-
}
|
1761
|
-
}
|
1762
|
-
connectedCallback() {
|
1763
|
-
if (appLoadFallback) {
|
1764
|
-
clearTimeout(appLoadFallback);
|
1765
|
-
appLoadFallback = null;
|
1766
|
-
}
|
1767
|
-
if (isBootstrapping) {
|
1768
|
-
// connectedCallback will be processed once all components have been registered
|
1769
|
-
deferredConnectedCallbacks.push(this);
|
1770
|
-
}
|
1771
|
-
else {
|
1772
|
-
plt.jmp(() => connectedCallback(this));
|
1773
|
-
}
|
1774
|
-
}
|
1775
|
-
disconnectedCallback() {
|
1776
|
-
plt.jmp(() => disconnectedCallback(this));
|
1777
|
-
}
|
1778
|
-
componentOnReady() {
|
1779
|
-
return getHostRef(this).$onReadyPromise$;
|
1780
|
-
}
|
1781
|
-
};
|
1782
|
-
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
1783
|
-
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
1784
|
-
cmpTags.push(tagName);
|
1785
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
1786
|
-
}
|
1787
|
-
});
|
1788
|
-
});
|
1789
|
-
// Only bother generating CSS if we have components
|
1790
|
-
// TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
|
1791
|
-
if (cmpTags.length > 0) {
|
1792
|
-
// Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
|
1793
|
-
if (hasSlotRelocation) {
|
1794
|
-
dataStyles.textContent += SLOT_FB_CSS;
|
1795
|
-
}
|
1796
|
-
// Add hydration styles
|
1797
|
-
{
|
1798
|
-
dataStyles.textContent += cmpTags + HYDRATED_CSS;
|
1799
|
-
}
|
1800
|
-
// If we have styles, add them to the DOM
|
1801
|
-
if (dataStyles.innerHTML.length) {
|
1802
|
-
dataStyles.setAttribute('data-styles', '');
|
1803
|
-
// Apply CSP nonce to the style tag if it exists
|
1804
|
-
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
1805
|
-
if (nonce != null) {
|
1806
|
-
dataStyles.setAttribute('nonce', nonce);
|
1807
|
-
}
|
1808
|
-
// Insert the styles into the document head
|
1809
|
-
// NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
|
1810
|
-
head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
1811
|
-
}
|
1812
|
-
}
|
1813
|
-
// Process deferred connectedCallbacks now all components have been registered
|
1814
|
-
isBootstrapping = false;
|
1815
|
-
if (deferredConnectedCallbacks.length) {
|
1816
|
-
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
1817
|
-
}
|
1818
|
-
else {
|
1819
|
-
{
|
1820
|
-
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
|
1821
|
-
}
|
1822
|
-
}
|
1823
|
-
// Fallback appLoad event
|
1824
|
-
endBootstrap();
|
1825
|
-
};
|
1826
|
-
const Fragment = (_, children) => children;
|
1827
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
1828
|
-
if (listeners) {
|
1829
|
-
listeners.map(([flags, name, method]) => {
|
1830
|
-
const target = getHostListenerTarget(elm, flags) ;
|
1831
|
-
const handler = hostListenerProxy(hostRef, method);
|
1832
|
-
const opts = hostListenerOpts(flags);
|
1833
|
-
plt.ael(target, name, handler, opts);
|
1834
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
1835
|
-
});
|
1836
|
-
}
|
1837
|
-
};
|
1838
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
1839
|
-
try {
|
1840
|
-
{
|
1841
|
-
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
1842
|
-
// instance is ready, let's call it's member method for this event
|
1843
|
-
hostRef.$lazyInstance$[methodName](ev);
|
1844
|
-
}
|
1845
|
-
else {
|
1846
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
1847
|
-
}
|
1848
|
-
}
|
1849
|
-
}
|
1850
|
-
catch (e) {
|
1851
|
-
consoleError(e);
|
1852
|
-
}
|
1853
|
-
};
|
1854
|
-
const getHostListenerTarget = (elm, flags) => {
|
1855
|
-
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
1856
|
-
return win;
|
1857
|
-
return elm;
|
1858
|
-
};
|
1859
|
-
// prettier-ignore
|
1860
|
-
const hostListenerOpts = (flags) => supportsListenerOptions
|
1861
|
-
? ({
|
1862
|
-
passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
|
1863
|
-
capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
|
1864
|
-
})
|
1865
|
-
: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
1866
|
-
/**
|
1867
|
-
* Assigns the given value to the nonce property on the runtime platform object.
|
1868
|
-
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
1869
|
-
* @param nonce The value to be assigned to the platform nonce property.
|
1870
|
-
* @returns void
|
1871
|
-
*/
|
1872
|
-
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
1873
|
-
/**
|
1874
|
-
* A WeakMap mapping runtime component references to their corresponding host reference
|
1875
|
-
* instances.
|
1876
|
-
*
|
1877
|
-
* **Note**: If we're in an HMR context we need to store a reference to this
|
1878
|
-
* value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
|
1879
|
-
* to {@link d.HostRef} across HMR updates.
|
1880
|
-
*
|
1881
|
-
* This is necessary because when HMR updates for a component are processed by
|
1882
|
-
* the browser-side dev server client the JS bundle for that component is
|
1883
|
-
* re-fetched. Since the module containing {@link hostRefs} is included in
|
1884
|
-
* that bundle, if we do not store a reference to it the new iteration of the
|
1885
|
-
* component will not have access to the previous hostRef map, leading to a
|
1886
|
-
* bug where the new version of the component cannot properly initialize.
|
1887
|
-
*/
|
1888
|
-
const hostRefs = new WeakMap();
|
1889
|
-
/**
|
1890
|
-
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
1891
|
-
*
|
1892
|
-
* @param ref the runtime ref of interest
|
1893
|
-
* @returns the Host reference (if found) or undefined
|
1894
|
-
*/
|
1895
|
-
const getHostRef = (ref) => hostRefs.get(ref);
|
1896
|
-
/**
|
1897
|
-
* Register a lazy instance with the {@link hostRefs} object so it's
|
1898
|
-
* corresponding {@link d.HostRef} can be retrieved later.
|
1899
|
-
*
|
1900
|
-
* @param lazyInstance the lazy instance of interest
|
1901
|
-
* @param hostRef that instances `HostRef` object
|
1902
|
-
* @returns a reference to the host ref WeakMap
|
1903
|
-
*/
|
1904
|
-
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
1905
|
-
/**
|
1906
|
-
* Register a host element for a Stencil component, setting up various metadata
|
1907
|
-
* and callbacks based on {@link BUILD} flags as well as the component's runtime
|
1908
|
-
* metadata.
|
1909
|
-
*
|
1910
|
-
* @param hostElement the host element to register
|
1911
|
-
* @param cmpMeta runtime metadata for that component
|
1912
|
-
* @returns a reference to the host ref WeakMap
|
1913
|
-
*/
|
1914
|
-
const registerHost = (hostElement, cmpMeta) => {
|
1915
|
-
const hostRef = {
|
1916
|
-
$flags$: 0,
|
1917
|
-
$hostElement$: hostElement,
|
1918
|
-
$cmpMeta$: cmpMeta,
|
1919
|
-
$instanceValues$: new Map(),
|
1920
|
-
};
|
1921
|
-
{
|
1922
|
-
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
1923
|
-
}
|
1924
|
-
{
|
1925
|
-
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
1926
|
-
hostElement['s-p'] = [];
|
1927
|
-
hostElement['s-rc'] = [];
|
1928
|
-
}
|
1929
|
-
addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
|
1930
|
-
return hostRefs.set(hostElement, hostRef);
|
1931
|
-
};
|
1932
|
-
const isMemberInElement = (elm, memberName) => memberName in elm;
|
1933
|
-
const consoleError = (e, el) => (0, console.error)(e, el);
|
1934
|
-
const cmpModules = /*@__PURE__*/ new Map();
|
1935
|
-
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
1936
|
-
// loadModuleImport
|
1937
|
-
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
1938
|
-
const bundleId = cmpMeta.$lazyBundleId$;
|
1939
|
-
const module = cmpModules.get(bundleId) ;
|
1940
|
-
if (module) {
|
1941
|
-
return module[exportName];
|
1942
|
-
}
|
1943
|
-
|
1944
|
-
if (!hmrVersionId || !BUILD.hotModuleReplacement) {
|
1945
|
-
const processMod = importedModule => {
|
1946
|
-
cmpModules.set(bundleId, importedModule);
|
1947
|
-
return importedModule[exportName];
|
1948
|
-
}
|
1949
|
-
switch(bundleId) {
|
1950
|
-
|
1951
|
-
case 'cpsl-alert_34':
|
1952
|
-
return import(
|
1953
|
-
/* webpackMode: "lazy" */
|
1954
|
-
'./cpsl-alert_34.entry.js').then(processMod, consoleError);
|
1955
|
-
case 'cpsl-animation':
|
1956
|
-
return import(
|
1957
|
-
/* webpackMode: "lazy" */
|
1958
|
-
'./cpsl-animation.entry.js').then(processMod, consoleError);
|
1959
|
-
case 'cpsl-col':
|
1960
|
-
return import(
|
1961
|
-
/* webpackMode: "lazy" */
|
1962
|
-
'./cpsl-col.entry.js').then(processMod, consoleError);
|
1963
|
-
case 'cpsl-grid':
|
1964
|
-
return import(
|
1965
|
-
/* webpackMode: "lazy" */
|
1966
|
-
'./cpsl-grid.entry.js').then(processMod, consoleError);
|
1967
|
-
case 'cpsl-identicon':
|
1968
|
-
return import(
|
1969
|
-
/* webpackMode: "lazy" */
|
1970
|
-
'./cpsl-identicon.entry.js').then(processMod, consoleError);
|
1971
|
-
case 'cpsl-info-box':
|
1972
|
-
return import(
|
1973
|
-
/* webpackMode: "lazy" */
|
1974
|
-
'./cpsl-info-box.entry.js').then(processMod, consoleError);
|
1975
|
-
case 'cpsl-modal-v2':
|
1976
|
-
return import(
|
1977
|
-
/* webpackMode: "lazy" */
|
1978
|
-
'./cpsl-modal-v2.entry.js').then(processMod, consoleError);
|
1979
|
-
case 'cpsl-row':
|
1980
|
-
return import(
|
1981
|
-
/* webpackMode: "lazy" */
|
1982
|
-
'./cpsl-row.entry.js').then(processMod, consoleError);
|
1983
|
-
}
|
1984
|
-
}
|
1985
|
-
return import(
|
1986
|
-
/* @vite-ignore */
|
1987
|
-
/* webpackInclude: /\.entry\.js$/ */
|
1988
|
-
/* webpackExclude: /\.system\.entry\.js$/ */
|
1989
|
-
/* webpackMode: "lazy" */
|
1990
|
-
`./${bundleId}.entry.js${''}`).then((importedModule) => {
|
1991
|
-
{
|
1992
|
-
cmpModules.set(bundleId, importedModule);
|
1993
|
-
}
|
1994
|
-
return importedModule[exportName];
|
1995
|
-
}, consoleError);
|
1996
|
-
};
|
1997
|
-
const styles = /*@__PURE__*/ new Map();
|
1998
|
-
const win = typeof window !== 'undefined' ? window : {};
|
1999
|
-
const doc = win.document || { head: {} };
|
2000
|
-
const plt = {
|
2001
|
-
$flags$: 0,
|
2002
|
-
$resourcesUrl$: '',
|
2003
|
-
jmp: (h) => h(),
|
2004
|
-
raf: (h) => requestAnimationFrame(h),
|
2005
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
2006
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
2007
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
2008
|
-
};
|
2009
|
-
const supportsListenerOptions = /*@__PURE__*/ (() => {
|
2010
|
-
let supportsListenerOptions = false;
|
2011
|
-
try {
|
2012
|
-
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
|
2013
|
-
get() {
|
2014
|
-
supportsListenerOptions = true;
|
2015
|
-
},
|
2016
|
-
}));
|
2017
|
-
}
|
2018
|
-
catch (e) { }
|
2019
|
-
return supportsListenerOptions;
|
2020
|
-
})();
|
2021
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
2022
|
-
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
2023
|
-
try {
|
2024
|
-
new CSSStyleSheet();
|
2025
|
-
return typeof new CSSStyleSheet().replaceSync === 'function';
|
2026
|
-
}
|
2027
|
-
catch (e) { }
|
2028
|
-
return false;
|
2029
|
-
})()
|
2030
|
-
;
|
2031
|
-
const queueDomReads = [];
|
2032
|
-
const queueDomWrites = [];
|
2033
|
-
const queueTask = (queue, write) => (cb) => {
|
2034
|
-
queue.push(cb);
|
2035
|
-
if (!queuePending) {
|
2036
|
-
queuePending = true;
|
2037
|
-
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
2038
|
-
nextTick(flush);
|
2039
|
-
}
|
2040
|
-
else {
|
2041
|
-
plt.raf(flush);
|
2042
|
-
}
|
2043
|
-
}
|
2044
|
-
};
|
2045
|
-
const consume = (queue) => {
|
2046
|
-
for (let i = 0; i < queue.length; i++) {
|
2047
|
-
try {
|
2048
|
-
queue[i](performance.now());
|
2049
|
-
}
|
2050
|
-
catch (e) {
|
2051
|
-
consoleError(e);
|
2052
|
-
}
|
2053
|
-
}
|
2054
|
-
queue.length = 0;
|
2055
|
-
};
|
2056
|
-
const flush = () => {
|
2057
|
-
// always force a bunch of medium callbacks to run, but still have
|
2058
|
-
// a throttle on how many can run in a certain time
|
2059
|
-
// DOM READS!!!
|
2060
|
-
consume(queueDomReads);
|
2061
|
-
// DOM WRITES!!!
|
2062
|
-
{
|
2063
|
-
consume(queueDomWrites);
|
2064
|
-
if ((queuePending = queueDomReads.length > 0)) {
|
2065
|
-
// still more to do yet, but we've run out of time
|
2066
|
-
// let's let this thing cool off and try again in the next tick
|
2067
|
-
plt.raf(flush);
|
2068
|
-
}
|
2069
|
-
}
|
2070
|
-
};
|
2071
|
-
const nextTick = (cb) => promiseResolve().then(cb);
|
2072
|
-
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
2073
|
-
|
2074
|
-
export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
2075
|
-
|
2076
|
-
//# sourceMappingURL=index-b188f201.js.map
|