@esri/solutions-components 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/ExpandToggle-3ab7dfd7.js +118 -0
- package/dist/cjs/FloatingArrow-89e0e55a.js +50 -0
- package/dist/cjs/Heading-9112a4c5.js +25 -0
- package/dist/cjs/InitiativeUiSchemaEdit-108652db.js +28 -0
- package/dist/cjs/ProjectUiSchemaCreate-81217580.js +126 -0
- package/dist/cjs/ProjectUiSchemaEdit-d5f11c17.js +178 -0
- package/dist/cjs/Validation-20182093.js +20 -0
- package/dist/cjs/_commonjsHelpers-ed90c4ad.js +55 -0
- package/dist/cjs/app-globals-379d737f.js +69 -0
- package/dist/cjs/ar-a694ca24.js +105 -0
- package/dist/cjs/arcgis-login.cjs.entry.js +1 -1
- package/dist/cjs/basemap-gallery.cjs.entry.js +121 -0
- package/dist/cjs/bg-62b6b3ba.js +83 -0
- package/dist/cjs/browser-fe25aefa.js +28 -0
- package/dist/cjs/bs-e673542b.js +52 -0
- package/dist/cjs/buffer-tools.cjs.entry.js +257 -0
- package/dist/cjs/ca-e4d2f562.js +72 -0
- package/dist/cjs/calcite-accordion-item.cjs.entry.js +5 -5
- package/dist/cjs/calcite-accordion.cjs.entry.js +2 -2
- package/dist/cjs/calcite-action-bar.cjs.entry.js +12 -12
- package/dist/cjs/calcite-action-group.cjs.entry.js +9 -9
- package/dist/cjs/calcite-action-menu.cjs.entry.js +295 -0
- package/dist/cjs/calcite-action-pad.cjs.entry.js +169 -0
- package/dist/cjs/calcite-action-pad_2.cjs.entry.js +1 -1
- package/dist/cjs/calcite-action.cjs.entry.js +188 -0
- package/dist/cjs/calcite-alert.cjs.entry.js +322 -0
- package/dist/cjs/calcite-avatar.cjs.entry.js +4 -4
- package/dist/cjs/calcite-block-section.cjs.entry.js +8 -8
- package/dist/cjs/calcite-block.cjs.entry.js +214 -0
- package/dist/cjs/calcite-button.cjs.entry.js +13 -13
- package/dist/cjs/calcite-card.cjs.entry.js +8 -8
- package/dist/cjs/calcite-checkbox.cjs.entry.js +9 -9
- package/dist/cjs/calcite-chip-group.cjs.entry.js +7 -7
- package/dist/cjs/calcite-chip.cjs.entry.js +262 -0
- package/dist/cjs/calcite-color-picker-hex-input.cjs.entry.js +274 -0
- package/dist/cjs/calcite-color-picker-swatch.cjs.entry.js +99 -0
- package/dist/cjs/calcite-color-picker.cjs.entry.js +22 -22
- package/dist/cjs/calcite-combobox-item-group.cjs.entry.js +4 -4
- package/dist/cjs/calcite-combobox-item.cjs.entry.js +145 -0
- package/dist/cjs/calcite-combobox.cjs.entry.js +1431 -0
- package/dist/cjs/calcite-date-picker-day.cjs.entry.js +97 -0
- package/dist/cjs/calcite-date-picker-month-header.cjs.entry.js +207 -0
- package/dist/cjs/calcite-date-picker-month.cjs.entry.js +362 -0
- package/dist/cjs/calcite-date-picker.cjs.entry.js +460 -0
- package/dist/cjs/calcite-dropdown-group.cjs.entry.js +85 -0
- package/dist/cjs/calcite-dropdown-item.cjs.entry.js +188 -0
- package/dist/cjs/calcite-dropdown.cjs.entry.js +430 -0
- package/dist/cjs/calcite-fab.cjs.entry.js +6 -6
- package/dist/cjs/calcite-filter.cjs.entry.js +179 -0
- package/dist/cjs/calcite-flow-item.cjs.entry.js +198 -0
- package/dist/cjs/calcite-flow.cjs.entry.js +153 -0
- package/dist/cjs/calcite-graph.cjs.entry.js +226 -0
- package/dist/cjs/calcite-handle.cjs.entry.js +204 -0
- package/dist/cjs/calcite-icon.cjs.entry.js +5 -5
- package/dist/cjs/calcite-inline-editable.cjs.entry.js +11 -11
- package/dist/cjs/calcite-input-date-picker.cjs.entry.js +744 -0
- package/dist/cjs/calcite-input-date-picker_3.cjs.entry.js +16 -10
- package/dist/cjs/calcite-input-message.cjs.entry.js +70 -0
- package/dist/cjs/calcite-input-number.cjs.entry.js +13 -13
- package/dist/cjs/calcite-input-text.cjs.entry.js +13 -13
- package/dist/cjs/calcite-input-time-picker-9e93f694.js +1854 -0
- package/dist/cjs/calcite-input-time-picker.cjs.entry.js +17 -17
- package/dist/cjs/calcite-input-time-zone.cjs.entry.js +12 -12
- package/dist/cjs/calcite-input.cjs.entry.js +695 -0
- package/dist/cjs/calcite-label.cjs.entry.js +4 -4
- package/dist/cjs/calcite-link.cjs.entry.js +6 -6
- package/dist/cjs/calcite-list-item-group.cjs.entry.js +4 -4
- package/dist/cjs/calcite-list-item.cjs.entry.js +454 -0
- package/dist/cjs/calcite-list.cjs.entry.js +567 -0
- package/dist/cjs/calcite-loader.cjs.entry.js +80 -0
- package/dist/cjs/calcite-menu-item.cjs.entry.js +8 -8
- package/dist/cjs/calcite-menu.cjs.entry.js +8 -8
- package/dist/cjs/calcite-meter.cjs.entry.js +8 -8
- package/dist/cjs/calcite-modal.cjs.entry.js +17 -11
- package/dist/cjs/calcite-navigation-logo.cjs.entry.js +2 -2
- package/dist/cjs/calcite-navigation-user.cjs.entry.js +2 -2
- package/dist/cjs/calcite-navigation.cjs.entry.js +4 -4
- package/dist/cjs/calcite-notice.cjs.entry.js +10 -10
- package/dist/cjs/calcite-option-group.cjs.entry.js +1 -1
- package/dist/cjs/calcite-option.cjs.entry.js +88 -0
- package/dist/cjs/calcite-pagination.cjs.entry.js +201 -8
- package/dist/cjs/calcite-panel.cjs.entry.js +270 -0
- package/dist/cjs/calcite-pick-list-group.cjs.entry.js +6 -6
- package/dist/cjs/calcite-pick-list-item.cjs.entry.js +23 -23
- package/dist/cjs/calcite-pick-list.cjs.entry.js +10 -10
- package/dist/cjs/calcite-popover.cjs.entry.js +418 -0
- package/dist/cjs/calcite-progress.cjs.entry.js +41 -0
- package/dist/cjs/calcite-radio-button-group.cjs.entry.js +4 -4
- package/dist/cjs/calcite-radio-button.cjs.entry.js +8 -8
- package/dist/cjs/calcite-rating.cjs.entry.js +14 -12
- package/dist/cjs/calcite-scrim.cjs.entry.js +7 -7
- package/dist/cjs/calcite-segmented-control-item.cjs.entry.js +70 -0
- package/dist/cjs/calcite-segmented-control.cjs.entry.js +245 -0
- package/dist/cjs/calcite-select.cjs.entry.js +235 -0
- package/dist/cjs/calcite-sheet.cjs.entry.js +7 -7
- package/dist/cjs/calcite-shell-center-row.cjs.entry.js +5 -5
- package/dist/cjs/calcite-shell-panel.cjs.entry.js +414 -0
- package/dist/cjs/calcite-shell.cjs.entry.js +174 -0
- package/dist/cjs/calcite-slider.cjs.entry.js +844 -0
- package/dist/cjs/calcite-sortable-list.cjs.entry.js +7 -7
- package/dist/cjs/calcite-split-button.cjs.entry.js +4 -4
- package/dist/cjs/calcite-stack.cjs.entry.js +74 -0
- package/dist/cjs/calcite-stepper-item.cjs.entry.js +10 -10
- package/dist/cjs/calcite-stepper.cjs.entry.js +7 -7
- package/dist/cjs/calcite-switch.cjs.entry.js +9 -9
- package/dist/cjs/calcite-tab-nav.cjs.entry.js +263 -0
- package/dist/cjs/calcite-tab-title.cjs.entry.js +291 -0
- package/dist/cjs/calcite-tab.cjs.entry.js +112 -0
- package/dist/cjs/calcite-table-cell.cjs.entry.js +156 -0
- package/dist/cjs/calcite-table-header.cjs.entry.js +169 -0
- package/dist/cjs/calcite-table-row.cjs.entry.js +6 -6
- package/dist/cjs/calcite-table.cjs.entry.js +9 -9
- package/dist/cjs/calcite-tabs.cjs.entry.js +178 -0
- package/dist/cjs/calcite-text-area.cjs.entry.js +15 -16
- package/dist/cjs/calcite-tile-select-group.cjs.entry.js +3 -3
- package/dist/cjs/calcite-tile-select.cjs.entry.js +4 -4
- package/dist/cjs/calcite-tile.cjs.entry.js +7 -7
- package/dist/cjs/calcite-time-picker.cjs.entry.js +9 -9
- package/dist/cjs/calcite-tip-group.cjs.entry.js +1 -1
- package/dist/cjs/calcite-tip-manager.cjs.entry.js +15 -8
- package/dist/cjs/calcite-tip.cjs.entry.js +9 -9
- package/dist/cjs/calcite-tooltip.cjs.entry.js +7 -7
- package/dist/cjs/calcite-tree-item.cjs.entry.js +296 -0
- package/dist/cjs/calcite-tree.cjs.entry.js +315 -0
- package/dist/cjs/calcite-value-list-item.cjs.entry.js +157 -0
- package/dist/cjs/calcite-value-list.cjs.entry.js +326 -0
- package/dist/cjs/card-manager.cjs.entry.js +107 -0
- package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
- package/dist/cjs/common-1b4bd8de.js +297 -0
- package/dist/cjs/conditionalSlot-73e71a05.js +63 -0
- package/dist/cjs/consent-manager.cjs.entry.js +379 -15
- package/dist/cjs/create-feature.cjs.entry.js +263 -0
- package/dist/cjs/crowdsource-manager.cjs.entry.js +7 -5
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +9 -7
- package/dist/cjs/cs-1ea34123.js +148 -0
- package/dist/cjs/da-199f5488.js +67 -0
- package/dist/cjs/date-3d094f58.js +261 -0
- package/dist/cjs/de-222afa04.js +92 -0
- package/dist/cjs/de-at-a62870ea.js +91 -0
- package/dist/cjs/de-ch-b0b46c1b.js +91 -0
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/delete-button.cjs.entry.js +150 -0
- package/dist/cjs/dom-cf1e2e9f.js +1114 -0
- package/dist/cjs/{downloadUtils-c2bd7c80.js → downloadUtils-1f283d95.js} +37 -6
- package/dist/cjs/downloadUtils-de0c0682.js +4246 -0
- package/dist/cjs/edit-card.cjs.entry.js +228 -0
- package/dist/cjs/el-934951a0.js +67 -0
- package/dist/cjs/en-au-6872d248.js +67 -0
- package/dist/cjs/en-ca-7133c4f2.js +66 -0
- package/dist/cjs/en-gb-2c66b954.js +70 -0
- package/dist/cjs/es-48e65aa5.js +67 -0
- package/dist/cjs/es-mx-46d70897.js +66 -0
- package/dist/cjs/esri-loader-5b8fbfa4.js +308 -0
- package/dist/cjs/et-63c5628d.js +93 -0
- package/dist/cjs/feature-comments.cjs.entry.js +1 -1
- package/dist/cjs/feature-form-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/feature-list.cjs.entry.js +199 -0
- package/dist/cjs/features-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/fi-dc20f9ac.js +116 -0
- package/dist/cjs/filter-cc2705b7.js +48 -0
- package/dist/cjs/floating-ui-90bd00af.js +2350 -0
- package/dist/cjs/floor-filter.cjs.entry.js +111 -0
- package/dist/cjs/focusTrapComponent-946b0666.js +1028 -0
- package/dist/cjs/form-da52e819.js +316 -0
- package/dist/cjs/fr-7067996a.js +69 -0
- package/dist/cjs/fr-ch-dbd7ba02.js +67 -0
- package/dist/cjs/he-4eb6a5a9.js +106 -0
- package/dist/cjs/helpers-7415d67a.js +830 -0
- package/dist/cjs/{helpers-81779c18.js → helpers-b014d9a9.js} +1 -1
- package/dist/cjs/hi-5563acd4.js +66 -0
- package/dist/cjs/hr-7a0a4191.js +81 -0
- package/dist/cjs/html2canvas-57f1616d.js +7847 -0
- package/dist/cjs/hu-0b69b8fb.js +89 -0
- package/dist/cjs/id-345dd5a9.js +67 -0
- package/dist/cjs/index-5799a29c.js +41521 -0
- package/dist/cjs/index-8c75d784.js +1958 -0
- package/dist/cjs/index-af047760.js +201 -0
- package/dist/cjs/index-b53bfd7c.js +4185 -0
- package/dist/cjs/index.cjs.js +15 -0
- package/dist/cjs/index.es-152bb462.js +11342 -0
- package/dist/cjs/{index.es-22b3d1a2.js → index.es-4af23ecc.js} +1 -1
- package/dist/cjs/info-card.cjs.entry.js +320 -0
- package/dist/cjs/instant-apps-ckeditor-wrapper.cjs.entry.js +125 -0
- package/dist/cjs/instant-apps-ckeditor-wrapper_3.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-control-panel.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-export.cjs.entry.js +20 -14
- package/dist/cjs/instant-apps-filter-list.cjs.entry.js +1059 -0
- package/dist/cjs/instant-apps-header.cjs.entry.js +5 -4
- package/dist/cjs/instant-apps-interactive-legend-classic.cjs.entry.js +25 -21
- package/dist/cjs/instant-apps-interactive-legend-count.cjs.entry.js +104 -0
- package/dist/cjs/instant-apps-interactive-legend-count_2.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element-caption.cjs.entry.js +7 -6
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element.cjs.entry.js +56 -0
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element_5.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-interactive-legend-layer-element-caption.cjs.entry.js +55 -0
- package/dist/cjs/instant-apps-interactive-legend-layer-element.cjs.entry.js +57 -0
- package/dist/cjs/instant-apps-interactive-legend-legend-element-caption.cjs.entry.js +104 -0
- package/dist/cjs/instant-apps-interactive-legend-legend-element.cjs.entry.js +65 -0
- package/dist/cjs/instant-apps-interactive-legend-relationship.cjs.entry.js +552 -0
- package/dist/cjs/instant-apps-interactive-legend.cjs.entry.js +9 -8
- package/dist/cjs/instant-apps-keyboard-shortcuts.cjs.entry.js +6 -6
- package/dist/cjs/instant-apps-landing-page.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-language-switcher.cjs.entry.js +9 -9
- package/dist/cjs/instant-apps-language-translator-item.cjs.entry.js +384 -0
- package/dist/cjs/instant-apps-language-translator-search.cjs.entry.js +105 -0
- package/dist/cjs/instant-apps-language-translator.cjs.entry.js +9 -9
- package/dist/cjs/instant-apps-measurement-tool.cjs.entry.js +139 -0
- package/dist/cjs/instant-apps-measurement.cjs.entry.js +7 -7
- package/dist/cjs/instant-apps-popover.cjs.entry.js +6 -6
- package/dist/cjs/instant-apps-popovers.cjs.entry.js +1 -1
- package/dist/cjs/instant-apps-scoreboard.cjs.entry.js +6 -6
- package/dist/cjs/instant-apps-social-share.cjs.entry.js +515 -0
- package/dist/cjs/instant-apps-splash.cjs.entry.js +17 -8
- package/dist/cjs/interactive-08e5bc95.js +144 -0
- package/dist/cjs/it-ac7cf3e5.js +67 -0
- package/dist/cjs/it-ch-6f7209eb.js +67 -0
- package/dist/cjs/ja-29e7b0a2.js +73 -0
- package/dist/cjs/json-editor.cjs.entry.js +406 -0
- package/dist/cjs/key-86f4a0b0.js +47 -0
- package/dist/cjs/ko-aeebde8b.js +73 -0
- package/dist/cjs/label-24b05042.js +186 -0
- package/dist/cjs/{languageSwitcher-4822684b.js → languageSwitcher-3870c772.js} +1 -1
- package/dist/cjs/languageSwitcher-aafa5b47.js +58 -0
- package/dist/cjs/{languageUtil-9bd00bad.js → languageUtil-0df39c0c.js} +1 -1
- package/dist/cjs/languageUtil-43c3acdc.js +90 -0
- package/dist/cjs/layer-list.cjs.entry.js +207 -0
- package/dist/cjs/layer-table.cjs.entry.js +1487 -0
- package/dist/cjs/layout-manager.cjs.entry.js +5 -4
- package/dist/cjs/list-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/{loadModules-69fc5b98.js → loadModules-01306709.js} +1 -1
- package/dist/cjs/loadModules-a67b6702.js +23 -0
- package/dist/cjs/loadModules-b5f244cd.js +30 -0
- package/dist/cjs/loadable-41446b78.js +97 -0
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/{locale-3e33f44c.js → locale-28c7c569.js} +2 -2
- package/dist/cjs/locale-42a9e623.js +152 -0
- package/dist/cjs/locale-4cef466e.js +91 -0
- package/dist/cjs/locale-a615b02f.js +585 -0
- package/dist/cjs/location-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/lodash-7587da9f.js +18030 -0
- package/dist/cjs/lt-6816d14c.js +98 -0
- package/dist/cjs/lv-2c998515.js +67 -0
- package/dist/cjs/map-card.cjs.entry.js +192 -0
- package/dist/cjs/map-draw-tools.cjs.entry.js +358 -0
- package/dist/cjs/map-fullscreen.cjs.entry.js +116 -0
- package/dist/cjs/map-layer-picker.cjs.entry.js +346 -0
- package/dist/cjs/map-legend.cjs.entry.js +109 -0
- package/dist/cjs/map-picker.cjs.entry.js +174 -0
- package/dist/cjs/map-search.cjs.entry.js +184 -0
- package/dist/cjs/map-select-tools.cjs.entry.js +798 -0
- package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
- package/dist/cjs/map-tools.cjs.entry.js +375 -0
- package/dist/cjs/mapViewUtils-6fa5bab1.js +271 -0
- package/dist/cjs/mk-147994ea.js +67 -0
- package/dist/cjs/mode-a0417ce5.js +27 -0
- package/dist/cjs/nb-f3d75f05.js +68 -0
- package/dist/cjs/nl-cb0a22c8.js +68 -0
- package/dist/cjs/observers-5923a7cc.js +58 -0
- package/dist/cjs/openCloseComponent-8d9cb545.js +140 -0
- package/dist/cjs/parser-e80279bf.js +1656 -0
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pdf-download.cjs.entry.js +359 -0
- package/dist/cjs/pl-ade28edd.js +115 -0
- package/dist/cjs/popupUtils-4de17e65.js +96 -0
- package/dist/cjs/pt-5543b782.js +68 -0
- package/dist/cjs/pt-br-bdce1868.js +66 -0
- package/dist/cjs/public-notification.cjs.entry.js +12 -11
- package/dist/cjs/publicNotificationStore-f690e171.js +47 -0
- package/dist/cjs/purify-557ad134.js +1715 -0
- package/dist/cjs/queryUtils-aba29fcf.js +253 -0
- package/dist/cjs/refine-results-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/refine-selection.cjs.entry.js +411 -0
- package/dist/cjs/resources-2ccf85d3.js +53 -0
- package/dist/cjs/resources-37006465.js +29 -0
- package/dist/cjs/resources-63b3a6b8.js +116 -0
- package/dist/cjs/resources-a2b1b149.js +49 -0
- package/dist/cjs/resources-ac626172.js +26 -0
- package/dist/cjs/resources-b0cc39b4.js +30 -0
- package/dist/cjs/ro-f4bb9704.js +67 -0
- package/dist/cjs/ru-ba86b627.js +127 -0
- package/dist/cjs/shadow-css-bbaea014.js +483 -0
- package/dist/cjs/share-item.cjs.entry.js +1 -1
- package/dist/cjs/shared-list-render-c8555864.js +370 -0
- package/dist/cjs/sk-ac03aca5.js +149 -0
- package/dist/cjs/sl-c68e3fd0.js +169 -0
- package/dist/cjs/solution-configuration.cjs.entry.js +21 -1105
- package/dist/cjs/solution-contents.cjs.entry.js +84 -0
- package/dist/cjs/solution-item-details.cjs.entry.js +199 -0
- package/dist/cjs/solution-item-icon.cjs.entry.js +1 -1
- package/dist/cjs/solution-item-sharing.cjs.entry.js +139 -0
- package/dist/cjs/solution-item.cjs.entry.js +106 -0
- package/dist/cjs/solution-organization-variables.cjs.entry.js +95 -0
- package/dist/cjs/solution-resource-item.cjs.entry.js +284 -0
- package/dist/cjs/solution-spatial-ref.cjs.entry.js +158 -0
- package/dist/cjs/solution-store-6194ba89.js +589 -0
- package/dist/cjs/solution-template-data.cjs.entry.js +119 -0
- package/dist/cjs/solution-variables.cjs.entry.js +107 -0
- package/dist/cjs/solutions-components.cjs.js +36 -5
- package/dist/cjs/sortableComponent-5e3419af.js +3443 -0
- package/dist/cjs/spatial-ref.cjs.entry.js +7 -6
- package/dist/cjs/sr-80f65cf0.js +102 -0
- package/dist/cjs/store-1f422ad4.js +91 -0
- package/dist/cjs/store-manager.cjs.entry.js +1 -1
- package/dist/cjs/sv-eee15401.js +72 -0
- package/dist/cjs/t9n-463dcbff.js +103 -0
- package/dist/cjs/th-f90768db.js +66 -0
- package/dist/cjs/time-4a9bf7e2.js +289 -0
- package/dist/cjs/tr-37fec0b5.js +67 -0
- package/dist/cjs/uk-3041a292.js +105 -0
- package/dist/cjs/utils-3a633152.js +64 -0
- package/dist/cjs/utils-7281bf72.js +110 -0
- package/dist/cjs/utils-72a66b3c.js +66 -0
- package/dist/cjs/utils-934ee777.js +142 -0
- package/dist/cjs/{utils-ea7a5a63.js → utils-ac836e7a.js} +1 -1
- package/dist/cjs/utils-b276a49d.js +226 -0
- package/dist/cjs/vi-57a02ad1.js +71 -0
- package/dist/cjs/zh-cn-165c486d.js +95 -0
- package/dist/cjs/zh-hk-0aa560a6.js +72 -0
- package/dist/cjs/zh-tw-42d975f0.js +93 -0
- package/dist/collection/utils/downloadUtils.js +36 -5
- package/dist/collection/utils/downloadUtils.ts +44 -5
- package/dist/collection/utils/test/downloadUtils.spec.js +33 -1
- package/dist/collection/utils/test/downloadUtils.spec.tsx +40 -1
- package/dist/components/ExpandToggle.js +8 -8
- package/dist/components/InitiativeUiSchemaEdit.js +26 -0
- package/dist/components/ProjectUiSchemaCreate.js +122 -0
- package/dist/components/ProjectUiSchemaEdit.js +176 -0
- package/dist/components/_commonjsHelpers.js +10 -2
- package/dist/components/action-bar.js +3 -3
- package/dist/components/action-group.js +1 -1
- package/dist/components/action-menu.js +1 -1
- package/dist/components/action-pad.js +1 -1
- package/dist/components/action.js +1 -1
- package/dist/components/alert.js +2 -2
- package/dist/components/arcgis-login.js +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/basemap-gallery2.js +1 -1
- package/dist/components/block.js +1 -1
- package/dist/components/buffer-tools2.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/calcite-accordion-item.js +1 -1
- package/dist/components/calcite-accordion.js +1 -1
- package/dist/components/calcite-block-section.js +1 -1
- package/dist/components/calcite-card.js +1 -1
- package/dist/components/calcite-chip-group.js +1 -1
- package/dist/components/calcite-color-picker.js +5 -5
- package/dist/components/calcite-combobox-item-group.js +1 -1
- package/dist/components/calcite-fab.js +1 -1
- package/dist/components/calcite-inline-editable.js +1 -1
- package/dist/components/calcite-input-time-picker.js +5 -1
- package/dist/components/calcite-input-time-zone.js +2 -2
- package/dist/components/calcite-list-item-group.js +1 -1
- package/dist/components/calcite-menu-item.js +1 -1
- package/dist/components/calcite-meter.js +1 -1
- package/dist/components/calcite-navigation-logo.js +1 -1
- package/dist/components/calcite-navigation-user.js +1 -1
- package/dist/components/calcite-navigation.js +1 -1
- package/dist/components/calcite-option-group.js +1 -1
- package/dist/components/calcite-pick-list-group.js +3 -3
- package/dist/components/calcite-pick-list.js +1 -1
- package/dist/components/calcite-radio-button-group.js +1 -1
- package/dist/components/calcite-rating.js +3 -1
- package/dist/components/calcite-sheet.js +1 -1
- package/dist/components/calcite-shell-center-row.js +1 -1
- package/dist/components/calcite-sortable-list.js +1 -1
- package/dist/components/calcite-split-button.js +1 -1
- package/dist/components/calcite-stepper-item.js +1 -1
- package/dist/components/calcite-stepper.js +1 -1
- package/dist/components/calcite-table-row.js +1 -1
- package/dist/components/calcite-table.js +1 -1
- package/dist/components/calcite-text-area.js +2 -2
- package/dist/components/calcite-tile-select-group.js +1 -1
- package/dist/components/calcite-tile-select.js +1 -1
- package/dist/components/calcite-tile.js +1 -1
- package/dist/components/calcite-tip-group.js +1 -1
- package/dist/components/calcite-tip-manager.js +8 -1
- package/dist/components/calcite-tip.js +2 -2
- package/dist/components/card-manager2.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/chip.js +1 -1
- package/dist/components/color-picker-hex-input.js +2 -2
- package/dist/components/color-picker-swatch.js +1 -1
- package/dist/components/combobox-item.js +1 -1
- package/dist/components/combobox.js +314 -3
- package/dist/components/consent-manager.js +376 -13
- package/dist/components/create-feature2.js +1 -1
- package/dist/components/crowdsource-manager.js +1 -1
- package/dist/components/crowdsource-reporter.js +1 -1
- package/dist/components/date-picker-day.js +1 -1
- package/dist/components/date-picker-month-header.js +1 -1
- package/dist/components/date-picker-month.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/deduct-calculator2.js +1 -1
- package/dist/components/delete-button2.js +1 -1
- package/dist/components/dom.js +28 -1
- package/dist/components/downloadUtils.js +1213 -102
- package/dist/components/dropdown-group.js +1 -1
- package/dist/components/dropdown-item.js +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/edit-card2.js +1 -1
- package/dist/components/esri-loader.js +8 -3
- package/dist/components/feature-comments.js +1 -1
- package/dist/components/feature-form-flow-item.js +1 -1
- package/dist/components/feature-list2.js +1 -1
- package/dist/components/features-flow-item.js +1 -1
- package/dist/components/filter.js +1 -718
- package/dist/components/filter2.js +2 -2
- package/dist/components/floating-ui.js +384 -7
- package/dist/components/floor-filter2.js +1 -1
- package/dist/components/flow-item.js +1 -1
- package/dist/components/flow.js +1 -1
- package/dist/components/focusTrapComponent.js +1 -1
- package/dist/components/form.js +1 -1
- package/dist/components/graph.js +1 -1
- package/dist/components/handle.js +1 -1
- package/dist/components/helpers.js +6 -2
- package/dist/components/html2canvas.js +8 -3
- package/dist/components/icon.js +1 -1
- package/dist/components/index.es.js +555 -22
- package/dist/components/index.js +16 -0
- package/dist/components/index2.js +3 -0
- package/dist/components/index3.js +41270 -1873
- package/dist/components/index5.js +2086 -185
- package/dist/components/index6.js +188 -55
- package/dist/components/index7.js +71 -0
- package/dist/components/info-card2.js +1 -1
- package/dist/components/input-date-picker.js +1 -1
- package/dist/components/input-message.js +1 -1
- package/dist/components/input-number.js +1 -1
- package/dist/components/input-text.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/instant-apps-ckeditor-wrapper2.js +1 -1
- package/dist/components/instant-apps-control-panel.js +1 -1
- package/dist/components/instant-apps-export.js +14 -8
- package/dist/components/instant-apps-filter-list2.js +2 -1
- package/dist/components/instant-apps-header2.js +2 -2
- package/dist/components/instant-apps-interactive-legend-classic2.js +10 -7
- package/dist/components/instant-apps-interactive-legend-count2.js +2 -2
- package/dist/components/instant-apps-interactive-legend-group-legend-element-caption.js +1 -1
- package/dist/components/instant-apps-interactive-legend-group-legend-element2.js +1 -1
- package/dist/components/instant-apps-interactive-legend-layer-element-caption2.js +1 -1
- package/dist/components/instant-apps-interactive-legend-layer-element2.js +1 -1
- package/dist/components/instant-apps-interactive-legend-legend-element-caption2.js +2 -2
- package/dist/components/instant-apps-interactive-legend-legend-element2.js +1 -1
- package/dist/components/instant-apps-interactive-legend-relationship2.js +1 -1
- package/dist/components/instant-apps-interactive-legend.js +1 -1
- package/dist/components/instant-apps-keyboard-shortcuts.js +1 -1
- package/dist/components/instant-apps-landing-page.js +2 -2
- package/dist/components/instant-apps-language-switcher.js +1 -1
- package/dist/components/instant-apps-language-translator-item2.js +1 -1
- package/dist/components/instant-apps-language-translator-search2.js +1 -1
- package/dist/components/instant-apps-language-translator2.js +1 -1
- package/dist/components/instant-apps-measurement-tool2.js +1 -1
- package/dist/components/instant-apps-measurement.js +2 -2
- package/dist/components/instant-apps-popover.js +1 -1
- package/dist/components/instant-apps-popovers.js +1 -1
- package/dist/components/instant-apps-scoreboard.js +1 -1
- package/dist/components/instant-apps-social-share2.js +14 -8
- package/dist/components/instant-apps-splash.js +18 -4
- package/dist/components/json-editor2.js +1 -1
- package/dist/components/key.js +28 -0
- package/dist/components/label.js +1 -1
- package/dist/components/label2.js +1 -1
- package/dist/components/languageUtil.js +23 -2
- package/dist/components/layer-list2.js +1 -1
- package/dist/components/layer-table2.js +1 -1
- package/dist/components/layout-manager.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/list-flow-item.js +1 -1
- package/dist/components/list-item.js +1 -1
- package/dist/components/list.js +2 -2
- package/dist/components/loadModules2.js +1 -1
- package/dist/components/loader.js +1 -1
- package/dist/components/locale.js +12 -0
- package/dist/components/locale2.js +2 -1
- package/dist/components/location-flow-item.js +1 -1
- package/dist/components/lodash.js +18025 -0
- package/dist/components/map-card2.js +1 -1
- package/dist/components/map-draw-tools2.js +1 -1
- package/dist/components/map-fullscreen2.js +1 -1
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-legend2.js +1 -1
- package/dist/components/map-picker2.js +1 -1
- package/dist/components/map-search2.js +1 -1
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/map-tools2.js +3 -1
- package/dist/components/menu.js +1 -1
- package/dist/components/modal.js +7 -1
- package/dist/components/mode.js +8 -0
- package/dist/components/notice.js +1 -1
- package/dist/components/openCloseComponent.js +48 -0
- package/dist/components/option.js +1 -1
- package/dist/components/pagination.js +194 -1
- package/dist/components/panel.js +2 -1
- package/dist/components/parser.js +1654 -0
- package/dist/components/pci-calculator.js +1 -1
- package/dist/components/pdf-download2.js +1 -1
- package/dist/components/pick-list-item.js +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/public-notification.js +1 -1
- package/dist/components/purify.js +5 -2
- package/dist/components/queryUtils.js +43 -0
- package/dist/components/radio-button.js +1 -1
- package/dist/components/refine-results-flow-item.js +1 -1
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/resources.js +17 -0
- package/dist/components/resources4.js +3 -0
- package/dist/components/scrim.js +1 -1
- package/dist/components/segmented-control-item.js +1 -1
- package/dist/components/segmented-control.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/share-item.js +1 -1
- package/dist/components/shared-list-render.js +6 -1
- package/dist/components/shell-panel.js +1 -1
- package/dist/components/shell.js +1 -1
- package/dist/components/slider.js +3 -1
- package/dist/components/solution-configuration.js +2 -1088
- package/dist/components/solution-contents2.js +1 -1
- package/dist/components/solution-item-details2.js +1 -1
- package/dist/components/solution-item-icon2.js +1 -1
- package/dist/components/solution-item-sharing2.js +1 -1
- package/dist/components/solution-item2.js +1 -1
- package/dist/components/solution-organization-variables2.js +1 -1
- package/dist/components/solution-resource-item2.js +2 -3
- package/dist/components/solution-spatial-ref2.js +1 -1
- package/dist/components/solution-store.js +1 -756
- package/dist/components/solution-template-data2.js +1 -1
- package/dist/components/solution-variables2.js +1 -1
- package/dist/components/sortableComponent.js +701 -0
- package/dist/components/spatial-ref2.js +263 -4
- package/dist/components/stack.js +1 -1
- package/dist/components/store-manager.js +1 -1
- package/dist/components/store.js +1 -0
- package/dist/components/switch.js +1 -1
- package/dist/components/t9n.js +1 -1
- package/dist/components/tab-nav.js +1 -1
- package/dist/components/tab-title.js +1 -1
- package/dist/components/tab.js +1 -1
- package/dist/components/table-cell.js +1 -1
- package/dist/components/table-header.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/time-picker.js +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tree-item.js +1 -1
- package/dist/components/tree.js +1 -1
- package/dist/components/utils.js +6 -1
- package/dist/components/utils2.js +1 -1
- package/dist/components/utils4.js +12 -0
- package/dist/components/value-list-item.js +1 -1
- package/dist/components/value-list.js +4 -1
- package/dist/esm/ExpandToggle-22fd2faa.js +110 -0
- package/dist/esm/FloatingArrow-de6fd1c7.js +48 -0
- package/dist/esm/Heading-f003a141.js +22 -0
- package/dist/esm/InitiativeUiSchemaEdit-8ddacfe8.js +26 -0
- package/dist/esm/ProjectUiSchemaCreate-dd179c0f.js +124 -0
- package/dist/esm/ProjectUiSchemaEdit-fbfdf6e4.js +176 -0
- package/dist/esm/Validation-59a77488.js +18 -0
- package/dist/esm/_commonjsHelpers-3cd6d4ee.js +49 -0
- package/dist/esm/app-globals-928553ab.js +67 -0
- package/dist/esm/ar-75ffdabb.js +103 -0
- package/dist/esm/arcgis-login.entry.js +1 -1
- package/dist/esm/basemap-gallery.entry.js +117 -0
- package/dist/esm/bg-fac0bf10.js +81 -0
- package/dist/esm/browser-b8d08bed.js +26 -0
- package/dist/esm/bs-c03c8ef2.js +50 -0
- package/dist/esm/buffer-tools.entry.js +253 -0
- package/dist/esm/ca-29e49f82.js +70 -0
- package/dist/esm/calcite-accordion-item.entry.js +5 -5
- package/dist/esm/calcite-accordion.entry.js +2 -2
- package/dist/esm/calcite-action-bar.entry.js +11 -11
- package/dist/esm/calcite-action-group.entry.js +12 -12
- package/dist/esm/calcite-action-menu.entry.js +291 -0
- package/dist/esm/calcite-action-pad.entry.js +165 -0
- package/dist/esm/calcite-action-pad_2.entry.js +1 -1
- package/dist/esm/calcite-action.entry.js +184 -0
- package/dist/esm/calcite-alert.entry.js +318 -0
- package/dist/esm/calcite-avatar.entry.js +4 -4
- package/dist/esm/calcite-block-section.entry.js +8 -8
- package/dist/esm/calcite-block.entry.js +210 -0
- package/dist/esm/calcite-button.entry.js +13 -13
- package/dist/esm/calcite-card.entry.js +8 -8
- package/dist/esm/calcite-checkbox.entry.js +9 -9
- package/dist/esm/calcite-chip-group.entry.js +7 -7
- package/dist/esm/calcite-chip.entry.js +258 -0
- package/dist/esm/calcite-color-picker-hex-input.entry.js +270 -0
- package/dist/esm/calcite-color-picker-swatch.entry.js +95 -0
- package/dist/esm/calcite-color-picker.entry.js +16 -16
- package/dist/esm/calcite-combobox-item-group.entry.js +4 -4
- package/dist/esm/calcite-combobox-item.entry.js +141 -0
- package/dist/esm/calcite-combobox.entry.js +1427 -0
- package/dist/esm/calcite-date-picker-day.entry.js +93 -0
- package/dist/esm/calcite-date-picker-month-header.entry.js +203 -0
- package/dist/esm/calcite-date-picker-month.entry.js +358 -0
- package/dist/esm/calcite-date-picker.entry.js +456 -0
- package/dist/esm/calcite-dropdown-group.entry.js +81 -0
- package/dist/esm/calcite-dropdown-item.entry.js +184 -0
- package/dist/esm/calcite-dropdown.entry.js +426 -0
- package/dist/esm/calcite-fab.entry.js +6 -6
- package/dist/esm/calcite-filter.entry.js +175 -0
- package/dist/esm/calcite-flow-item.entry.js +194 -0
- package/dist/esm/calcite-flow.entry.js +149 -0
- package/dist/esm/calcite-graph.entry.js +222 -0
- package/dist/esm/calcite-handle.entry.js +200 -0
- package/dist/esm/calcite-icon.entry.js +5 -5
- package/dist/esm/calcite-inline-editable.entry.js +11 -11
- package/dist/esm/calcite-input-date-picker.entry.js +740 -0
- package/dist/esm/calcite-input-date-picker_3.entry.js +16 -10
- package/dist/esm/calcite-input-message.entry.js +66 -0
- package/dist/esm/calcite-input-number.entry.js +13 -13
- package/dist/esm/calcite-input-text.entry.js +13 -13
- package/dist/esm/calcite-input-time-picker-e5cd4d26.js +1851 -0
- package/dist/esm/calcite-input-time-picker.entry.js +17 -17
- package/dist/esm/calcite-input-time-zone.entry.js +12 -12
- package/dist/esm/calcite-input.entry.js +691 -0
- package/dist/esm/calcite-label.entry.js +4 -4
- package/dist/esm/calcite-link.entry.js +6 -6
- package/dist/esm/calcite-list-item-group.entry.js +4 -4
- package/dist/esm/calcite-list-item.entry.js +450 -0
- package/dist/esm/calcite-list.entry.js +563 -0
- package/dist/esm/calcite-loader.entry.js +76 -0
- package/dist/esm/calcite-menu-item.entry.js +8 -8
- package/dist/esm/calcite-menu.entry.js +8 -8
- package/dist/esm/calcite-meter.entry.js +8 -8
- package/dist/esm/calcite-modal.entry.js +17 -11
- package/dist/esm/calcite-navigation-logo.entry.js +2 -2
- package/dist/esm/calcite-navigation-user.entry.js +2 -2
- package/dist/esm/calcite-navigation.entry.js +4 -4
- package/dist/esm/calcite-notice.entry.js +10 -10
- package/dist/esm/calcite-option-group.entry.js +1 -1
- package/dist/esm/calcite-option.entry.js +84 -0
- package/dist/esm/calcite-pagination.entry.js +201 -8
- package/dist/esm/calcite-panel.entry.js +266 -0
- package/dist/esm/calcite-pick-list-group.entry.js +6 -6
- package/dist/esm/calcite-pick-list-item.entry.js +13 -13
- package/dist/esm/calcite-pick-list.entry.js +10 -10
- package/dist/esm/calcite-popover.entry.js +414 -0
- package/dist/esm/calcite-progress.entry.js +37 -0
- package/dist/esm/calcite-radio-button-group.entry.js +4 -4
- package/dist/esm/calcite-radio-button.entry.js +8 -8
- package/dist/esm/calcite-rating.entry.js +14 -12
- package/dist/esm/calcite-scrim.entry.js +7 -7
- package/dist/esm/calcite-segmented-control-item.entry.js +66 -0
- package/dist/esm/calcite-segmented-control.entry.js +241 -0
- package/dist/esm/calcite-select.entry.js +231 -0
- package/dist/esm/calcite-sheet.entry.js +7 -7
- package/dist/esm/calcite-shell-center-row.entry.js +5 -5
- package/dist/esm/calcite-shell-panel.entry.js +410 -0
- package/dist/esm/calcite-shell.entry.js +170 -0
- package/dist/esm/calcite-slider.entry.js +840 -0
- package/dist/esm/calcite-sortable-list.entry.js +7 -7
- package/dist/esm/calcite-split-button.entry.js +4 -4
- package/dist/esm/calcite-stack.entry.js +70 -0
- package/dist/esm/calcite-stepper-item.entry.js +10 -10
- package/dist/esm/calcite-stepper.entry.js +7 -7
- package/dist/esm/calcite-switch.entry.js +9 -9
- package/dist/esm/calcite-tab-nav.entry.js +259 -0
- package/dist/esm/calcite-tab-title.entry.js +287 -0
- package/dist/esm/calcite-tab.entry.js +108 -0
- package/dist/esm/calcite-table-cell.entry.js +152 -0
- package/dist/esm/calcite-table-header.entry.js +165 -0
- package/dist/esm/calcite-table-row.entry.js +6 -6
- package/dist/esm/calcite-table.entry.js +9 -9
- package/dist/esm/calcite-tabs.entry.js +174 -0
- package/dist/esm/calcite-text-area.entry.js +14 -15
- package/dist/esm/calcite-tile-select-group.entry.js +3 -3
- package/dist/esm/calcite-tile-select.entry.js +4 -4
- package/dist/esm/calcite-tile.entry.js +7 -7
- package/dist/esm/calcite-time-picker.entry.js +9 -9
- package/dist/esm/calcite-tip-group.entry.js +1 -1
- package/dist/esm/calcite-tip-manager.entry.js +15 -8
- package/dist/esm/calcite-tip.entry.js +9 -9
- package/dist/esm/calcite-tooltip.entry.js +7 -7
- package/dist/esm/calcite-tree-item.entry.js +292 -0
- package/dist/esm/calcite-tree.entry.js +311 -0
- package/dist/esm/calcite-value-list-item.entry.js +153 -0
- package/dist/esm/calcite-value-list.entry.js +322 -0
- package/dist/esm/card-manager.entry.js +103 -0
- package/dist/esm/card-manager_3.entry.js +1 -1
- package/dist/esm/common-7e0dcaa2.js +295 -0
- package/dist/esm/conditionalSlot-a395417e.js +60 -0
- package/dist/esm/consent-manager.entry.js +379 -15
- package/dist/esm/create-feature.entry.js +259 -0
- package/dist/esm/crowdsource-manager.entry.js +7 -5
- package/dist/esm/crowdsource-reporter.entry.js +7 -5
- package/dist/esm/cs-04f36d01.js +146 -0
- package/dist/esm/da-5a3b8600.js +65 -0
- package/dist/esm/date-74c7f03b.js +245 -0
- package/dist/esm/de-579cda2e.js +90 -0
- package/dist/esm/de-at-52bf1c4c.js +89 -0
- package/dist/esm/de-ch-12d03480.js +89 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/delete-button.entry.js +146 -0
- package/dist/esm/dom-b91aa537.js +1083 -0
- package/dist/esm/{downloadUtils-a6c0e25f.js → downloadUtils-01e2cb56.js} +37 -6
- package/dist/esm/downloadUtils-b3220f86.js +4240 -0
- package/dist/esm/edit-card.entry.js +224 -0
- package/dist/esm/el-c18d3ea4.js +65 -0
- package/dist/esm/en-au-2599e6da.js +65 -0
- package/dist/esm/en-ca-8cfbe6bc.js +64 -0
- package/dist/esm/en-gb-5e4e8a1e.js +68 -0
- package/dist/esm/es-d86f9957.js +65 -0
- package/dist/esm/es-mx-f99d9fd1.js +64 -0
- package/dist/esm/esri-loader-af2bbfd5.js +306 -0
- package/dist/esm/et-8bf52e57.js +91 -0
- package/dist/esm/feature-comments.entry.js +1 -1
- package/dist/esm/feature-form-flow-item.entry.js +1 -1
- package/dist/esm/feature-list.entry.js +195 -0
- package/dist/esm/features-flow-item.entry.js +1 -1
- package/dist/esm/fi-aeb49e52.js +114 -0
- package/dist/esm/filter-0d00d2e2.js +46 -0
- package/dist/esm/floating-ui-b3256614.js +2342 -0
- package/dist/esm/floor-filter.entry.js +107 -0
- package/dist/esm/focusTrapComponent-2fe6623b.js +1023 -0
- package/dist/esm/form-f2181470.js +307 -0
- package/dist/esm/fr-6200cc01.js +67 -0
- package/dist/esm/fr-ch-df62bb30.js +65 -0
- package/dist/esm/he-07ace6cb.js +104 -0
- package/dist/esm/helpers-85ca7251.js +807 -0
- package/dist/esm/{helpers-aeddac74.js → helpers-f9256189.js} +1 -1
- package/dist/esm/hi-5aa9519e.js +64 -0
- package/dist/esm/hr-e0614bed.js +79 -0
- package/dist/esm/html2canvas-d52e7c8d.js +7845 -0
- package/dist/esm/hu-732fe37c.js +87 -0
- package/dist/esm/id-0832fc24.js +65 -0
- package/dist/esm/index-7fc1cba9.js +41502 -0
- package/dist/esm/index-91eeaf01.js +199 -0
- package/dist/esm/index-b1fb529b.js +1956 -0
- package/dist/esm/index-bdfaac50.js +4145 -0
- package/dist/esm/index.es-3db60115.js +11256 -0
- package/dist/esm/{index.es-b0a676ae.js → index.es-ac6f5e76.js} +1 -1
- package/dist/esm/index.js +15 -0
- package/dist/esm/info-card.entry.js +316 -0
- package/dist/esm/instant-apps-ckeditor-wrapper.entry.js +121 -0
- package/dist/esm/instant-apps-ckeditor-wrapper_3.entry.js +4 -4
- package/dist/esm/instant-apps-control-panel.entry.js +4 -4
- package/dist/esm/instant-apps-export.entry.js +20 -14
- package/dist/esm/instant-apps-filter-list.entry.js +1055 -0
- package/dist/esm/instant-apps-header.entry.js +5 -4
- package/dist/esm/instant-apps-interactive-legend-classic.entry.js +15 -11
- package/dist/esm/instant-apps-interactive-legend-count.entry.js +100 -0
- package/dist/esm/instant-apps-interactive-legend-count_2.entry.js +2 -2
- package/dist/esm/instant-apps-interactive-legend-group-legend-element-caption.entry.js +7 -6
- package/dist/esm/instant-apps-interactive-legend-group-legend-element.entry.js +52 -0
- package/dist/esm/instant-apps-interactive-legend-group-legend-element_5.entry.js +2 -2
- package/dist/esm/instant-apps-interactive-legend-layer-element-caption.entry.js +51 -0
- package/dist/esm/instant-apps-interactive-legend-layer-element.entry.js +53 -0
- package/dist/esm/instant-apps-interactive-legend-legend-element-caption.entry.js +100 -0
- package/dist/esm/instant-apps-interactive-legend-legend-element.entry.js +61 -0
- package/dist/esm/instant-apps-interactive-legend-relationship.entry.js +548 -0
- package/dist/esm/instant-apps-interactive-legend.entry.js +9 -8
- package/dist/esm/instant-apps-keyboard-shortcuts.entry.js +6 -6
- package/dist/esm/instant-apps-landing-page.entry.js +2 -2
- package/dist/esm/instant-apps-language-switcher.entry.js +9 -9
- package/dist/esm/instant-apps-language-translator-item.entry.js +380 -0
- package/dist/esm/instant-apps-language-translator-search.entry.js +101 -0
- package/dist/esm/instant-apps-language-translator.entry.js +9 -9
- package/dist/esm/instant-apps-measurement-tool.entry.js +135 -0
- package/dist/esm/instant-apps-measurement.entry.js +7 -7
- package/dist/esm/instant-apps-popover.entry.js +6 -6
- package/dist/esm/instant-apps-popovers.entry.js +1 -1
- package/dist/esm/instant-apps-scoreboard.entry.js +6 -6
- package/dist/esm/instant-apps-social-share.entry.js +511 -0
- package/dist/esm/instant-apps-splash.entry.js +17 -8
- package/dist/esm/interactive-71585ecc.js +139 -0
- package/dist/esm/it-142bc820.js +65 -0
- package/dist/esm/it-ch-1ad1f0ac.js +65 -0
- package/dist/esm/ja-6a33e9d4.js +71 -0
- package/dist/esm/json-editor.entry.js +402 -0
- package/dist/esm/key-9a10d862.js +44 -0
- package/dist/esm/ko-d61df01d.js +71 -0
- package/dist/esm/label-16184ce7.js +179 -0
- package/dist/esm/{languageSwitcher-4faa659f.js → languageSwitcher-068998b1.js} +1 -1
- package/dist/esm/languageSwitcher-2a9037e5.js +55 -0
- package/dist/esm/{languageUtil-dc3111c1.js → languageUtil-035e7728.js} +1 -1
- package/dist/esm/languageUtil-71a7a914.js +87 -0
- package/dist/esm/layer-list.entry.js +203 -0
- package/dist/esm/layer-table.entry.js +1483 -0
- package/dist/esm/layout-manager.entry.js +5 -4
- package/dist/esm/list-flow-item.entry.js +1 -1
- package/dist/esm/{loadModules-877bbb89.js → loadModules-7a5f1022.js} +1 -1
- package/dist/esm/loadModules-827c5581.js +28 -0
- package/dist/esm/loadModules-acccbc1c.js +21 -0
- package/dist/esm/loadable-aea90723.js +92 -0
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{locale-bd9034e1.js → locale-4cab280d.js} +2 -2
- package/dist/esm/locale-4cfbae3e.js +86 -0
- package/dist/esm/locale-857f39cf.js +572 -0
- package/dist/esm/locale-d9463a95.js +148 -0
- package/dist/esm/location-flow-item.entry.js +1 -1
- package/dist/esm/lodash-98e4b7d0.js +18025 -0
- package/dist/esm/lt-652c530a.js +96 -0
- package/dist/esm/lv-84e48ed0.js +65 -0
- package/dist/esm/map-card.entry.js +188 -0
- package/dist/esm/map-draw-tools.entry.js +354 -0
- package/dist/esm/map-fullscreen.entry.js +112 -0
- package/dist/esm/map-layer-picker.entry.js +342 -0
- package/dist/esm/map-legend.entry.js +105 -0
- package/dist/esm/map-picker.entry.js +170 -0
- package/dist/esm/map-search.entry.js +180 -0
- package/dist/esm/map-select-tools.entry.js +794 -0
- package/dist/esm/map-select-tools_3.entry.js +1 -1
- package/dist/esm/map-tools.entry.js +371 -0
- package/dist/esm/mapViewUtils-436a516e.js +261 -0
- package/dist/esm/mk-bbf2ee01.js +65 -0
- package/dist/esm/mode-f9bfc4e9.js +25 -0
- package/dist/esm/nb-ccfaa0f7.js +66 -0
- package/dist/esm/nl-4bc56289.js +66 -0
- package/dist/esm/observers-5ba39eee.js +56 -0
- package/dist/esm/openCloseComponent-b4b3788b.js +138 -0
- package/dist/esm/parser-87982ce2.js +1654 -0
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/pdf-download.entry.js +355 -0
- package/dist/esm/pl-1f435988.js +113 -0
- package/dist/esm/popupUtils-b61d7ffd.js +94 -0
- package/dist/esm/pt-4a05a00d.js +66 -0
- package/dist/esm/pt-br-9720547b.js +64 -0
- package/dist/esm/public-notification.entry.js +11 -10
- package/dist/esm/publicNotificationStore-208e26f0.js +45 -0
- package/dist/esm/purify-909c20fa.js +1713 -0
- package/dist/esm/queryUtils-2529c537.js +244 -0
- package/dist/esm/refine-results-flow-item.entry.js +1 -1
- package/dist/esm/refine-selection.entry.js +407 -0
- package/dist/esm/resources-0f8db821.js +45 -0
- package/dist/esm/resources-3c6947d3.js +26 -0
- package/dist/esm/resources-47b3ca40.js +106 -0
- package/dist/esm/resources-667afb5d.js +27 -0
- package/dist/esm/resources-9b2084c6.js +24 -0
- package/dist/esm/resources-bb6c11c3.js +49 -0
- package/dist/esm/ro-f87076a1.js +65 -0
- package/dist/esm/ru-e69ca895.js +125 -0
- package/dist/esm/shadow-css-f5236d52.js +481 -0
- package/dist/esm/share-item.entry.js +1 -1
- package/dist/esm/shared-list-render-a572ef93.js +348 -0
- package/dist/esm/sk-d632e850.js +147 -0
- package/dist/esm/sl-5099fa6f.js +167 -0
- package/dist/esm/solution-configuration.entry.js +9 -1093
- package/dist/esm/solution-contents.entry.js +80 -0
- package/dist/esm/solution-item-details.entry.js +195 -0
- package/dist/esm/solution-item-icon.entry.js +1 -1
- package/dist/esm/solution-item-sharing.entry.js +135 -0
- package/dist/esm/solution-item.entry.js +102 -0
- package/dist/esm/solution-organization-variables.entry.js +91 -0
- package/dist/esm/solution-resource-item.entry.js +280 -0
- package/dist/esm/solution-spatial-ref.entry.js +154 -0
- package/dist/esm/solution-store-31cccb90.js +587 -0
- package/dist/esm/solution-template-data.entry.js +115 -0
- package/dist/esm/solution-variables.entry.js +103 -0
- package/dist/esm/solutions-components.js +37 -6
- package/dist/esm/sortableComponent-e715a3dd.js +3439 -0
- package/dist/esm/spatial-ref.entry.js +7 -6
- package/dist/esm/sr-944b7fd7.js +100 -0
- package/dist/esm/store-194c1a01.js +87 -0
- package/dist/esm/store-manager.entry.js +1 -1
- package/dist/esm/sv-e481fa6a.js +70 -0
- package/dist/esm/t9n-b39c5433.js +98 -0
- package/dist/esm/th-60961669.js +64 -0
- package/dist/esm/time-4a90614b.js +274 -0
- package/dist/esm/tr-eba8dd86.js +65 -0
- package/dist/esm/uk-ec375ce0.js +103 -0
- package/dist/esm/utils-32df4a1e.js +133 -0
- package/dist/esm/utils-57e2ccde.js +61 -0
- package/dist/esm/{utils-28d0a086.js → utils-78fe6e5b.js} +1 -1
- package/dist/esm/utils-7db4ecdc.js +100 -0
- package/dist/esm/utils-95e9dd51.js +55 -0
- package/dist/esm/utils-cfbe589a.js +208 -0
- package/dist/esm/vi-29345f79.js +69 -0
- package/dist/esm/zh-cn-32c7c714.js +93 -0
- package/dist/esm/zh-hk-7c770845.js +70 -0
- package/dist/esm/zh-tw-c318be5c.js +91 -0
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-header/instant-apps-header.css +1 -1
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-scoreboard/instant-apps-scoreboard.css +1 -1
- package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-social-share/instant-apps-social-share.css +8 -1
- package/dist/solutions-components/ExpandToggle-22fd2faa.js +110 -0
- package/dist/solutions-components/FloatingArrow-de6fd1c7.js +48 -0
- package/dist/solutions-components/Heading-f003a141.js +22 -0
- package/dist/solutions-components/InitiativeUiSchemaEdit-8ddacfe8.js +26 -0
- package/dist/solutions-components/ProjectUiSchemaCreate-dd179c0f.js +124 -0
- package/dist/solutions-components/ProjectUiSchemaEdit-fbfdf6e4.js +176 -0
- package/dist/solutions-components/Validation-59a77488.js +18 -0
- package/dist/solutions-components/_commonjsHelpers-3cd6d4ee.js +49 -0
- package/dist/solutions-components/app-globals-928553ab.js +67 -0
- package/dist/solutions-components/ar-75ffdabb.js +103 -0
- package/dist/solutions-components/arcgis-login.entry.js +56 -0
- package/dist/solutions-components/array-396bdf3c.js +15 -0
- package/dist/solutions-components/basemap-gallery.entry.js +117 -0
- package/dist/solutions-components/bg-fac0bf10.js +81 -0
- package/dist/solutions-components/breakpoints-f0f1417d.js +15 -0
- package/dist/solutions-components/browser-b8d08bed.js +26 -0
- package/dist/solutions-components/bs-c03c8ef2.js +50 -0
- package/dist/solutions-components/buffer-tools.entry.js +253 -0
- package/dist/solutions-components/ca-29e49f82.js +70 -0
- package/dist/solutions-components/calcite-accordion-item.entry.js +176 -0
- package/dist/solutions-components/calcite-accordion.entry.js +81 -0
- package/dist/solutions-components/calcite-action-bar.entry.js +252 -0
- package/dist/solutions-components/calcite-action-group.entry.js +112 -0
- package/dist/solutions-components/calcite-action-menu.entry.js +291 -0
- package/dist/solutions-components/calcite-action-pad.entry.js +165 -0
- package/dist/solutions-components/calcite-action.entry.js +184 -0
- package/dist/solutions-components/calcite-alert.entry.js +318 -0
- package/dist/solutions-components/calcite-avatar.entry.js +146 -0
- package/dist/solutions-components/calcite-block-section.entry.js +162 -0
- package/dist/solutions-components/calcite-block.entry.js +210 -0
- package/dist/solutions-components/calcite-button.entry.js +227 -0
- package/dist/solutions-components/calcite-card.entry.js +132 -0
- package/dist/solutions-components/calcite-checkbox.entry.js +134 -0
- package/dist/solutions-components/calcite-chip-group.entry.js +175 -0
- package/dist/solutions-components/calcite-chip.entry.js +258 -0
- package/dist/solutions-components/calcite-color-picker-hex-input.entry.js +270 -0
- package/dist/solutions-components/calcite-color-picker-swatch.entry.js +95 -0
- package/dist/solutions-components/calcite-color-picker.entry.js +906 -0
- package/dist/solutions-components/calcite-combobox-item-group.entry.js +56 -0
- package/dist/solutions-components/calcite-combobox-item.entry.js +141 -0
- package/dist/solutions-components/calcite-combobox.entry.js +1427 -0
- package/dist/solutions-components/calcite-date-picker-day.entry.js +93 -0
- package/dist/solutions-components/calcite-date-picker-month-header.entry.js +203 -0
- package/dist/solutions-components/calcite-date-picker-month.entry.js +358 -0
- package/dist/solutions-components/calcite-date-picker.entry.js +456 -0
- package/dist/solutions-components/calcite-dropdown-group.entry.js +81 -0
- package/dist/solutions-components/calcite-dropdown-item.entry.js +184 -0
- package/dist/solutions-components/calcite-dropdown.entry.js +426 -0
- package/dist/solutions-components/calcite-fab.entry.js +90 -0
- package/dist/solutions-components/calcite-filter.entry.js +175 -0
- package/dist/solutions-components/calcite-flow-item.entry.js +194 -0
- package/dist/solutions-components/calcite-flow.entry.js +149 -0
- package/dist/solutions-components/calcite-graph.entry.js +222 -0
- package/dist/solutions-components/calcite-handle.entry.js +200 -0
- package/dist/solutions-components/calcite-icon.entry.js +179 -0
- package/dist/solutions-components/calcite-inline-editable.entry.js +253 -0
- package/dist/solutions-components/calcite-input-date-picker.entry.js +740 -0
- package/dist/solutions-components/calcite-input-message.entry.js +66 -0
- package/dist/solutions-components/calcite-input-number.entry.js +610 -0
- package/dist/solutions-components/calcite-input-text.entry.js +349 -0
- package/dist/solutions-components/calcite-input-time-picker-e5cd4d26.js +1851 -0
- package/dist/solutions-components/calcite-input-time-picker.entry.js +25 -0
- package/dist/solutions-components/calcite-input-time-zone.entry.js +332 -0
- package/dist/solutions-components/calcite-input.entry.js +691 -0
- package/dist/solutions-components/calcite-label.entry.js +67 -0
- package/dist/solutions-components/calcite-link.entry.js +108 -0
- package/dist/solutions-components/calcite-list-item-group.entry.js +69 -0
- package/dist/solutions-components/calcite-list-item.entry.js +450 -0
- package/dist/solutions-components/calcite-list.entry.js +563 -0
- package/dist/solutions-components/calcite-loader.entry.js +76 -0
- package/dist/solutions-components/calcite-menu-item.entry.js +281 -0
- package/dist/solutions-components/calcite-menu.entry.js +180 -0
- package/dist/solutions-components/calcite-meter.entry.js +332 -0
- package/dist/solutions-components/calcite-modal.entry.js +394 -0
- package/dist/solutions-components/calcite-navigation-logo.entry.js +84 -0
- package/dist/solutions-components/calcite-navigation-user.entry.js +68 -0
- package/dist/solutions-components/calcite-navigation.entry.js +166 -0
- package/dist/solutions-components/calcite-notice.entry.js +163 -0
- package/dist/solutions-components/calcite-option-group.entry.js +35 -0
- package/dist/solutions-components/calcite-option.entry.js +84 -0
- package/dist/solutions-components/calcite-pagination.entry.js +554 -0
- package/dist/solutions-components/calcite-panel.entry.js +266 -0
- package/dist/solutions-components/calcite-pick-list-group.entry.js +57 -0
- package/dist/solutions-components/calcite-pick-list-item.entry.js +193 -0
- package/dist/solutions-components/calcite-pick-list.entry.js +142 -0
- package/dist/solutions-components/calcite-popover.entry.js +414 -0
- package/dist/solutions-components/calcite-progress.entry.js +37 -0
- package/dist/solutions-components/calcite-radio-button-group.entry.js +141 -0
- package/dist/solutions-components/calcite-radio-button.entry.js +318 -0
- package/dist/solutions-components/calcite-rating.entry.js +261 -0
- package/dist/solutions-components/calcite-scrim.entry.js +121 -0
- package/dist/solutions-components/calcite-segmented-control-item.entry.js +66 -0
- package/dist/solutions-components/calcite-segmented-control.entry.js +241 -0
- package/dist/solutions-components/calcite-select.entry.js +231 -0
- package/dist/solutions-components/calcite-sheet.entry.js +223 -0
- package/dist/solutions-components/calcite-shell-center-row.entry.js +66 -0
- package/dist/solutions-components/calcite-shell-panel.entry.js +410 -0
- package/dist/solutions-components/calcite-shell.entry.js +170 -0
- package/dist/solutions-components/calcite-slider.entry.js +840 -0
- package/dist/solutions-components/calcite-sortable-list.entry.js +166 -0
- package/dist/solutions-components/calcite-split-button.entry.js +112 -0
- package/dist/solutions-components/calcite-stack.entry.js +70 -0
- package/dist/solutions-components/calcite-stepper-item.entry.js +238 -0
- package/dist/solutions-components/calcite-stepper.entry.js +377 -0
- package/dist/solutions-components/calcite-switch.entry.js +113 -0
- package/dist/solutions-components/calcite-tab-nav.entry.js +259 -0
- package/dist/solutions-components/calcite-tab-title.entry.js +287 -0
- package/dist/solutions-components/calcite-tab.entry.js +108 -0
- package/dist/solutions-components/calcite-table-cell.entry.js +152 -0
- package/dist/solutions-components/calcite-table-header.entry.js +165 -0
- package/dist/solutions-components/calcite-table-row.entry.js +244 -0
- package/dist/solutions-components/calcite-table.entry.js +314 -0
- package/dist/solutions-components/calcite-tabs.entry.js +174 -0
- package/dist/solutions-components/calcite-text-area.entry.js +276 -0
- package/dist/solutions-components/calcite-tile-select-group.entry.js +39 -0
- package/dist/solutions-components/calcite-tile-select.entry.js +225 -0
- package/dist/solutions-components/calcite-tile.entry.js +75 -0
- package/dist/solutions-components/calcite-time-picker.entry.js +839 -0
- package/dist/solutions-components/calcite-tip-group.entry.js +21 -0
- package/dist/solutions-components/calcite-tip-manager.entry.js +227 -0
- package/dist/solutions-components/calcite-tip.entry.js +126 -0
- package/dist/solutions-components/calcite-tooltip.entry.js +434 -0
- package/dist/solutions-components/calcite-tree-item.entry.js +292 -0
- package/dist/solutions-components/calcite-tree.entry.js +311 -0
- package/dist/solutions-components/calcite-value-list-item.entry.js +153 -0
- package/dist/solutions-components/calcite-value-list.entry.js +322 -0
- package/dist/solutions-components/card-manager.entry.js +103 -0
- package/dist/solutions-components/common-7e0dcaa2.js +295 -0
- package/dist/solutions-components/component-edd2c3cd.js +30 -0
- package/dist/solutions-components/conditionalSlot-a395417e.js +60 -0
- package/dist/solutions-components/consent-manager.entry.js +2139 -0
- package/dist/solutions-components/create-feature.entry.js +259 -0
- package/dist/solutions-components/crowdsource-manager.entry.js +494 -0
- package/dist/solutions-components/crowdsource-reporter.entry.js +557 -0
- package/dist/solutions-components/cs-04f36d01.js +146 -0
- package/dist/solutions-components/da-5a3b8600.js +65 -0
- package/dist/solutions-components/date-74c7f03b.js +245 -0
- package/dist/solutions-components/de-579cda2e.js +90 -0
- package/dist/solutions-components/de-at-52bf1c4c.js +89 -0
- package/dist/solutions-components/de-ch-12d03480.js +89 -0
- package/dist/solutions-components/deduct-calculator.entry.js +101 -0
- package/dist/solutions-components/delete-button.entry.js +146 -0
- package/dist/solutions-components/dom-b91aa537.js +1083 -0
- package/dist/solutions-components/downloadUtils-b3220f86.js +4240 -0
- package/dist/solutions-components/edit-card.entry.js +224 -0
- package/dist/solutions-components/el-c18d3ea4.js +65 -0
- package/dist/solutions-components/en-au-2599e6da.js +65 -0
- package/dist/solutions-components/en-ca-8cfbe6bc.js +64 -0
- package/dist/solutions-components/en-gb-5e4e8a1e.js +68 -0
- package/dist/solutions-components/es-d86f9957.js +65 -0
- package/dist/solutions-components/es-mx-f99d9fd1.js +64 -0
- package/dist/solutions-components/esri-loader-af2bbfd5.js +306 -0
- package/dist/solutions-components/et-8bf52e57.js +91 -0
- package/dist/solutions-components/feature-comments.entry.js +56 -0
- package/dist/solutions-components/feature-form-flow-item.entry.js +56 -0
- package/dist/solutions-components/feature-list.entry.js +195 -0
- package/dist/solutions-components/features-flow-item.entry.js +56 -0
- package/dist/solutions-components/fi-aeb49e52.js +114 -0
- package/dist/solutions-components/filter-0d00d2e2.js +46 -0
- package/dist/solutions-components/floating-ui-b3256614.js +2342 -0
- package/dist/solutions-components/floor-filter.entry.js +107 -0
- package/dist/solutions-components/focusTrapComponent-2fe6623b.js +1023 -0
- package/dist/solutions-components/form-f2181470.js +307 -0
- package/dist/solutions-components/fr-6200cc01.js +67 -0
- package/dist/solutions-components/fr-ch-df62bb30.js +65 -0
- package/dist/solutions-components/guid-b75a5f7b.js +24 -0
- package/dist/solutions-components/he-07ace6cb.js +104 -0
- package/dist/solutions-components/helpers-85ca7251.js +807 -0
- package/dist/solutions-components/hi-5aa9519e.js +64 -0
- package/dist/solutions-components/hr-e0614bed.js +79 -0
- package/dist/solutions-components/html2canvas-d52e7c8d.js +7845 -0
- package/dist/solutions-components/hu-732fe37c.js +87 -0
- package/dist/solutions-components/id-0832fc24.js +65 -0
- package/dist/solutions-components/index-5110a27a.js +71 -0
- package/dist/solutions-components/index-7fc1cba9.js +41502 -0
- package/dist/solutions-components/index-91eeaf01.js +199 -0
- package/dist/solutions-components/index-a1e91462.js +2105 -0
- package/dist/solutions-components/index-b1fb529b.js +1956 -0
- package/dist/solutions-components/index-bdfaac50.js +4145 -0
- package/dist/solutions-components/index-d8ff08ed.js +204 -0
- package/dist/solutions-components/index.es-3db60115.js +11256 -0
- package/dist/solutions-components/index.esm.js +15 -0
- package/dist/solutions-components/info-card.entry.js +316 -0
- package/dist/solutions-components/instant-apps-ckeditor-wrapper.entry.js +121 -0
- package/dist/solutions-components/instant-apps-control-panel.entry.js +94 -0
- package/dist/solutions-components/instant-apps-export.entry.js +888 -0
- package/dist/solutions-components/instant-apps-filter-list.entry.js +1055 -0
- package/dist/solutions-components/instant-apps-header.entry.js +124 -0
- package/dist/solutions-components/instant-apps-interactive-legend-classic.entry.js +1604 -0
- package/dist/solutions-components/instant-apps-interactive-legend-count.entry.js +100 -0
- package/dist/solutions-components/instant-apps-interactive-legend-group-legend-element-caption.entry.js +53 -0
- package/dist/solutions-components/instant-apps-interactive-legend-group-legend-element.entry.js +52 -0
- package/dist/solutions-components/instant-apps-interactive-legend-layer-element-caption.entry.js +51 -0
- package/dist/solutions-components/instant-apps-interactive-legend-layer-element.entry.js +53 -0
- package/dist/solutions-components/instant-apps-interactive-legend-legend-element-caption.entry.js +100 -0
- package/dist/solutions-components/instant-apps-interactive-legend-legend-element.entry.js +61 -0
- package/dist/solutions-components/instant-apps-interactive-legend-relationship.entry.js +548 -0
- package/dist/solutions-components/instant-apps-interactive-legend.entry.js +112 -0
- package/dist/solutions-components/instant-apps-keyboard-shortcuts.entry.js +139 -0
- package/dist/solutions-components/instant-apps-landing-page.entry.js +114 -0
- package/dist/solutions-components/instant-apps-language-switcher.entry.js +173 -0
- package/dist/solutions-components/instant-apps-language-translator-item.entry.js +380 -0
- package/dist/solutions-components/instant-apps-language-translator-search.entry.js +101 -0
- package/dist/solutions-components/instant-apps-language-translator.entry.js +286 -0
- package/dist/solutions-components/instant-apps-measurement-tool.entry.js +135 -0
- package/dist/solutions-components/instant-apps-measurement.entry.js +66 -0
- package/dist/solutions-components/instant-apps-popover.entry.js +74 -0
- package/dist/solutions-components/instant-apps-popovers.entry.js +88 -0
- package/dist/solutions-components/instant-apps-scoreboard.entry.js +463 -0
- package/dist/solutions-components/instant-apps-social-share.entry.js +511 -0
- package/dist/solutions-components/instant-apps-splash.entry.js +144 -0
- package/dist/solutions-components/interactive-71585ecc.js +139 -0
- package/dist/solutions-components/interfaces-586e863c.js +80 -0
- package/dist/solutions-components/it-142bc820.js +65 -0
- package/dist/solutions-components/it-ch-1ad1f0ac.js +65 -0
- package/dist/solutions-components/ja-6a33e9d4.js +71 -0
- package/dist/solutions-components/json-editor.entry.js +402 -0
- package/dist/solutions-components/key-9a10d862.js +44 -0
- package/dist/solutions-components/ko-d61df01d.js +71 -0
- package/dist/solutions-components/label-16184ce7.js +179 -0
- package/dist/solutions-components/languageSwitcher-2a9037e5.js +55 -0
- package/dist/solutions-components/languageUtil-71a7a914.js +87 -0
- package/dist/solutions-components/layer-list.entry.js +203 -0
- package/dist/solutions-components/layer-table.entry.js +1483 -0
- package/dist/solutions-components/layout-manager.entry.js +91 -0
- package/dist/solutions-components/list-flow-item.entry.js +56 -0
- package/dist/solutions-components/loadModules-827c5581.js +28 -0
- package/dist/solutions-components/loadModules-acccbc1c.js +21 -0
- package/dist/solutions-components/loadable-aea90723.js +92 -0
- package/dist/solutions-components/locale-4cfbae3e.js +86 -0
- package/dist/solutions-components/locale-857f39cf.js +572 -0
- package/dist/solutions-components/locale-d9463a95.js +148 -0
- package/dist/solutions-components/location-flow-item.entry.js +56 -0
- package/dist/solutions-components/lodash-98e4b7d0.js +18025 -0
- package/dist/solutions-components/lt-652c530a.js +96 -0
- package/dist/solutions-components/lv-84e48ed0.js +65 -0
- package/dist/solutions-components/map-card.entry.js +188 -0
- package/dist/solutions-components/map-draw-tools.entry.js +354 -0
- package/dist/solutions-components/map-fullscreen.entry.js +112 -0
- package/dist/solutions-components/map-layer-picker.entry.js +342 -0
- package/dist/solutions-components/map-legend.entry.js +105 -0
- package/dist/solutions-components/map-picker.entry.js +170 -0
- package/dist/solutions-components/map-search.entry.js +180 -0
- package/dist/solutions-components/map-select-tools.entry.js +794 -0
- package/dist/solutions-components/map-tools.entry.js +371 -0
- package/dist/solutions-components/mapViewUtils-436a516e.js +261 -0
- package/dist/solutions-components/math-efada7a9.js +54 -0
- package/dist/solutions-components/mk-bbf2ee01.js +65 -0
- package/dist/solutions-components/mode-f9bfc4e9.js +25 -0
- package/dist/solutions-components/nb-ccfaa0f7.js +66 -0
- package/dist/solutions-components/nl-4bc56289.js +66 -0
- package/dist/solutions-components/observers-5ba39eee.js +56 -0
- package/dist/solutions-components/openCloseComponent-b4b3788b.js +138 -0
- package/dist/solutions-components/{p-a455c3f0.entry.js → p-00524417.entry.js} +1 -1
- package/dist/solutions-components/{p-52b37bad.entry.js → p-04dbc667.entry.js} +1 -1
- package/dist/solutions-components/{p-8e9f96db.js → p-12a7d0d1.js} +1 -1
- package/dist/solutions-components/{p-a7b7f8d1.js → p-15a0e7fb.js} +1 -1
- package/dist/solutions-components/p-2d72eac3.entry.js +6 -0
- package/dist/solutions-components/{p-a2544cba.entry.js → p-30edeb79.entry.js} +1 -1
- package/dist/solutions-components/{p-220c46c2.entry.js → p-3a6a1ce9.entry.js} +1 -1
- package/dist/solutions-components/{p-a59078ee.entry.js → p-3b9e4882.entry.js} +1 -1
- package/dist/solutions-components/{p-8ad937b4.entry.js → p-465aa7d9.entry.js} +1 -1
- package/dist/solutions-components/p-4dcc150d.entry.js +6 -0
- package/dist/solutions-components/{p-1bca71bf.entry.js → p-4efd2af6.entry.js} +1 -1
- package/dist/solutions-components/{p-5a28d60c.entry.js → p-5320dc25.entry.js} +1 -1
- package/dist/solutions-components/{p-015a45e2.entry.js → p-53ef8adf.entry.js} +1 -1
- package/dist/solutions-components/{p-0d72a9ca.entry.js → p-5f6e7429.entry.js} +1 -1
- package/dist/solutions-components/{p-0f427774.entry.js → p-607773a3.entry.js} +1 -1
- package/dist/solutions-components/{p-2e7a9b9b.entry.js → p-88932d2f.entry.js} +2 -2
- package/dist/solutions-components/{p-b41e2c4c.js → p-8910dc99.js} +10 -10
- package/dist/solutions-components/{p-104f07e3.entry.js → p-954dc86f.entry.js} +1 -1
- package/dist/solutions-components/{p-c302bbea.entry.js → p-a3132356.entry.js} +1 -1
- package/dist/solutions-components/{p-c10b44ee.entry.js → p-a886ab7f.entry.js} +1 -1
- package/dist/solutions-components/{p-03037cf9.js → p-ad98c346.js} +1 -1
- package/dist/solutions-components/{p-734d1dc5.js → p-b4913a01.js} +1 -1
- package/dist/solutions-components/{p-03a65871.entry.js → p-bf6b4eb7.entry.js} +1 -1
- package/dist/solutions-components/{p-09801ba6.entry.js → p-c4ff3b52.entry.js} +3 -3
- package/dist/solutions-components/p-d599cfa8.entry.js +6 -0
- package/dist/solutions-components/{p-cfe890f6.entry.js → p-f313b45b.entry.js} +1 -1
- package/dist/solutions-components/{p-aec4441b.entry.js → p-fc1367d9.entry.js} +1 -1
- package/dist/solutions-components/{p-07626c45.js → p-fc2fb61b.js} +1 -1
- package/dist/solutions-components/parser-87982ce2.js +1654 -0
- package/dist/solutions-components/pci-calculator.entry.js +113 -0
- package/dist/solutions-components/pciUtils-73d4b6b4.js +844 -0
- package/dist/solutions-components/pdf-download.entry.js +355 -0
- package/dist/solutions-components/pl-1f435988.js +113 -0
- package/dist/solutions-components/popupUtils-b61d7ffd.js +94 -0
- package/dist/solutions-components/pt-4a05a00d.js +66 -0
- package/dist/solutions-components/pt-br-9720547b.js +64 -0
- package/dist/solutions-components/public-notification.entry.js +886 -0
- package/dist/solutions-components/publicNotificationStore-208e26f0.js +45 -0
- package/dist/solutions-components/purify-909c20fa.js +1713 -0
- package/dist/solutions-components/queryUtils-2529c537.js +244 -0
- package/dist/solutions-components/refine-results-flow-item.entry.js +56 -0
- package/dist/solutions-components/refine-selection.entry.js +407 -0
- package/dist/solutions-components/resources-0f8db821.js +45 -0
- package/dist/solutions-components/resources-20074cb1.js +24 -0
- package/dist/solutions-components/resources-3709252d.js +35 -0
- package/dist/solutions-components/resources-3c6947d3.js +26 -0
- package/dist/solutions-components/resources-47b3ca40.js +106 -0
- package/dist/solutions-components/resources-667afb5d.js +27 -0
- package/dist/solutions-components/resources-88a48c5c.js +20 -0
- package/dist/solutions-components/resources-9b2084c6.js +24 -0
- package/dist/solutions-components/resources-9b7e72d5.js +20 -0
- package/dist/solutions-components/resources-b0e2b809.js +22 -0
- package/dist/solutions-components/resources-bb6c11c3.js +49 -0
- package/dist/solutions-components/ro-f87076a1.js +65 -0
- package/dist/solutions-components/ru-e69ca895.js +125 -0
- package/dist/solutions-components/shadow-css-f5236d52.js +481 -0
- package/dist/solutions-components/share-item.entry.js +56 -0
- package/dist/solutions-components/shared-list-render-a572ef93.js +348 -0
- package/dist/solutions-components/sk-d632e850.js +147 -0
- package/dist/solutions-components/sl-5099fa6f.js +167 -0
- package/dist/solutions-components/solution-configuration.entry.js +906 -0
- package/dist/solutions-components/solution-contents.entry.js +80 -0
- package/dist/solutions-components/solution-item-details.entry.js +195 -0
- package/dist/solutions-components/solution-item-icon.entry.js +323 -0
- package/dist/solutions-components/solution-item-sharing.entry.js +135 -0
- package/dist/solutions-components/solution-item.entry.js +102 -0
- package/dist/solutions-components/solution-organization-variables.entry.js +91 -0
- package/dist/solutions-components/solution-resource-item.entry.js +280 -0
- package/dist/solutions-components/solution-spatial-ref.entry.js +154 -0
- package/dist/solutions-components/solution-store-31cccb90.js +587 -0
- package/dist/solutions-components/solution-template-data.entry.js +115 -0
- package/dist/solutions-components/solution-variables.entry.js +103 -0
- package/dist/solutions-components/solutions-components.css +84 -1
- package/dist/solutions-components/solutions-components.esm.js +52 -1
- package/dist/solutions-components/sortableComponent-e715a3dd.js +3439 -0
- package/dist/solutions-components/spatial-ref.entry.js +21296 -0
- package/dist/solutions-components/sr-944b7fd7.js +100 -0
- package/dist/solutions-components/store-194c1a01.js +87 -0
- package/dist/solutions-components/store-manager.entry.js +61 -0
- package/dist/solutions-components/styles-367380b5.js +11 -0
- package/dist/solutions-components/sv-e481fa6a.js +70 -0
- package/dist/solutions-components/t9n-b39c5433.js +98 -0
- package/dist/solutions-components/th-60961669.js +64 -0
- package/dist/solutions-components/time-4a90614b.js +274 -0
- package/dist/solutions-components/tr-eba8dd86.js +65 -0
- package/dist/solutions-components/uk-ec375ce0.js +103 -0
- package/dist/solutions-components/utils/downloadUtils.ts +44 -5
- package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +40 -1
- package/dist/solutions-components/utils-32df4a1e.js +133 -0
- package/dist/solutions-components/utils-57e2ccde.js +61 -0
- package/dist/solutions-components/utils-7db4ecdc.js +100 -0
- package/dist/solutions-components/utils-95e9dd51.js +55 -0
- package/dist/solutions-components/utils-cfbe589a.js +208 -0
- package/dist/solutions-components/vi-29345f79.js +69 -0
- package/dist/solutions-components/zh-cn-32c7c714.js +93 -0
- package/dist/solutions-components/zh-hk-7c770845.js +70 -0
- package/dist/solutions-components/zh-tw-c318be5c.js +91 -0
- package/dist/types/utils/downloadUtils.d.ts +18 -4
- package/package.json +6 -6
- package/dist/solutions-components/p-7d6ee026.entry.js +0 -6
- package/dist/solutions-components/p-b80bc5b9.entry.js +0 -6
- package/dist/solutions-components/p-dd45738e.entry.js +0 -6
- /package/dist/solutions-components/{p-70359c2b.js → p-89218b6e.js} +0 -0
- /package/dist/solutions-components/{p-090e0241.js → p-e85ba21c.js} +0 -0
@@ -0,0 +1,4185 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
function _interopNamespace(e) {
|
9
|
+
if (e && e.__esModule) return e;
|
10
|
+
var n = Object.create(null);
|
11
|
+
if (e) {
|
12
|
+
Object.keys(e).forEach(function (k) {
|
13
|
+
if (k !== 'default') {
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
16
|
+
enumerable: true,
|
17
|
+
get: function () {
|
18
|
+
return e[k];
|
19
|
+
}
|
20
|
+
});
|
21
|
+
}
|
22
|
+
});
|
23
|
+
}
|
24
|
+
n['default'] = e;
|
25
|
+
return Object.freeze(n);
|
26
|
+
}
|
27
|
+
|
28
|
+
const NAMESPACE = 'solutions-components';
|
29
|
+
const BUILD = /* solutions-components */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: true, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: true, connectedCallback: true, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: true, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: true, isTesting: true, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: true, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: true, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
|
30
|
+
const Env = /* solutions-components */ {};
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
34
|
+
* Simon Friis Vindum (@paldepind)
|
35
|
+
* Licensed under the MIT License
|
36
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
37
|
+
*
|
38
|
+
* Modified for Stencil's renderer and slot projection
|
39
|
+
*/
|
40
|
+
let scopeId;
|
41
|
+
let contentRef;
|
42
|
+
let hostTagName;
|
43
|
+
let customError;
|
44
|
+
let i = 0;
|
45
|
+
let useNativeShadowDom = false;
|
46
|
+
let checkSlotFallbackVisibility = false;
|
47
|
+
let checkSlotRelocate = false;
|
48
|
+
let isSvgMode = false;
|
49
|
+
let renderingRef = null;
|
50
|
+
let queueCongestion = 0;
|
51
|
+
let queuePending = false;
|
52
|
+
const Build = {
|
53
|
+
isDev: BUILD.isDev ? true : false,
|
54
|
+
isBrowser: true,
|
55
|
+
isServer: false,
|
56
|
+
isTesting: BUILD.isTesting ? true : false,
|
57
|
+
};
|
58
|
+
const getAssetPath = (path) => {
|
59
|
+
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
60
|
+
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
61
|
+
};
|
62
|
+
const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
|
63
|
+
const createTime = (fnName, tagName = '') => {
|
64
|
+
if (BUILD.profile && performance.mark) {
|
65
|
+
const key = `st:${fnName}:${tagName}:${i++}`;
|
66
|
+
// Start
|
67
|
+
performance.mark(key);
|
68
|
+
// End
|
69
|
+
return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
return () => {
|
73
|
+
return;
|
74
|
+
};
|
75
|
+
}
|
76
|
+
};
|
77
|
+
const uniqueTime = (key, measureText) => {
|
78
|
+
if (BUILD.profile && performance.mark) {
|
79
|
+
if (performance.getEntriesByName(key, 'mark').length === 0) {
|
80
|
+
performance.mark(key);
|
81
|
+
}
|
82
|
+
return () => {
|
83
|
+
if (performance.getEntriesByName(measureText, 'measure').length === 0) {
|
84
|
+
performance.measure(measureText, key);
|
85
|
+
}
|
86
|
+
};
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
return () => {
|
90
|
+
return;
|
91
|
+
};
|
92
|
+
}
|
93
|
+
};
|
94
|
+
const inspect = (ref) => {
|
95
|
+
const hostRef = getHostRef(ref);
|
96
|
+
if (!hostRef) {
|
97
|
+
return undefined;
|
98
|
+
}
|
99
|
+
const flags = hostRef.$flags$;
|
100
|
+
const hostElement = hostRef.$hostElement$;
|
101
|
+
return {
|
102
|
+
renderCount: hostRef.$renderCount$,
|
103
|
+
flags: {
|
104
|
+
hasRendered: !!(flags & 2 /* HOST_FLAGS.hasRendered */),
|
105
|
+
hasConnected: !!(flags & 1 /* HOST_FLAGS.hasConnected */),
|
106
|
+
isWaitingForChildren: !!(flags & 4 /* HOST_FLAGS.isWaitingForChildren */),
|
107
|
+
isConstructingInstance: !!(flags & 8 /* HOST_FLAGS.isConstructingInstance */),
|
108
|
+
isQueuedForUpdate: !!(flags & 16 /* HOST_FLAGS.isQueuedForUpdate */),
|
109
|
+
hasInitializedComponent: !!(flags & 32 /* HOST_FLAGS.hasInitializedComponent */),
|
110
|
+
hasLoadedComponent: !!(flags & 64 /* HOST_FLAGS.hasLoadedComponent */),
|
111
|
+
isWatchReady: !!(flags & 128 /* HOST_FLAGS.isWatchReady */),
|
112
|
+
isListenReady: !!(flags & 256 /* HOST_FLAGS.isListenReady */),
|
113
|
+
needsRerender: !!(flags & 512 /* HOST_FLAGS.needsRerender */),
|
114
|
+
},
|
115
|
+
instanceValues: hostRef.$instanceValues$,
|
116
|
+
ancestorComponent: hostRef.$ancestorComponent$,
|
117
|
+
hostElement,
|
118
|
+
lazyInstance: hostRef.$lazyInstance$,
|
119
|
+
vnode: hostRef.$vnode$,
|
120
|
+
modeName: hostRef.$modeName$,
|
121
|
+
onReadyPromise: hostRef.$onReadyPromise$,
|
122
|
+
onReadyResolve: hostRef.$onReadyResolve$,
|
123
|
+
onInstancePromise: hostRef.$onInstancePromise$,
|
124
|
+
onInstanceResolve: hostRef.$onInstanceResolve$,
|
125
|
+
onRenderResolve: hostRef.$onRenderResolve$,
|
126
|
+
queuedListeners: hostRef.$queuedListeners$,
|
127
|
+
rmListeners: hostRef.$rmListeners$,
|
128
|
+
['s-id']: hostElement['s-id'],
|
129
|
+
['s-cr']: hostElement['s-cr'],
|
130
|
+
['s-lr']: hostElement['s-lr'],
|
131
|
+
['s-p']: hostElement['s-p'],
|
132
|
+
['s-rc']: hostElement['s-rc'],
|
133
|
+
['s-sc']: hostElement['s-sc'],
|
134
|
+
};
|
135
|
+
};
|
136
|
+
const installDevTools = () => {
|
137
|
+
if (BUILD.devTools) {
|
138
|
+
const stencil = (win.stencil = win.stencil || {});
|
139
|
+
const originalInspect = stencil.inspect;
|
140
|
+
stencil.inspect = (ref) => {
|
141
|
+
let result = inspect(ref);
|
142
|
+
if (!result && typeof originalInspect === 'function') {
|
143
|
+
result = originalInspect(ref);
|
144
|
+
}
|
145
|
+
return result;
|
146
|
+
};
|
147
|
+
}
|
148
|
+
};
|
149
|
+
const CONTENT_REF_ID = 'r';
|
150
|
+
const ORG_LOCATION_ID = 'o';
|
151
|
+
const SLOT_NODE_ID = 's';
|
152
|
+
const TEXT_NODE_ID = 't';
|
153
|
+
const HYDRATE_ID = 's-id';
|
154
|
+
const HYDRATED_STYLE_ID = 'sty-id';
|
155
|
+
const HYDRATE_CHILD_ID = 'c-id';
|
156
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
157
|
+
/**
|
158
|
+
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
159
|
+
*
|
160
|
+
* Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
|
161
|
+
* support as of Stencil v4.
|
162
|
+
*/
|
163
|
+
const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
|
164
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
165
|
+
const FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
166
|
+
'formAssociatedCallback',
|
167
|
+
'formResetCallback',
|
168
|
+
'formDisabledCallback',
|
169
|
+
'formStateRestoreCallback',
|
170
|
+
];
|
171
|
+
/**
|
172
|
+
* Default style mode id
|
173
|
+
*/
|
174
|
+
/**
|
175
|
+
* Reusable empty obj/array
|
176
|
+
* Don't add values to these!!
|
177
|
+
*/
|
178
|
+
const EMPTY_OBJ = {};
|
179
|
+
/**
|
180
|
+
* Namespaces
|
181
|
+
*/
|
182
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
183
|
+
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
184
|
+
const isDef = (v) => v != null;
|
185
|
+
/**
|
186
|
+
* Check whether a value is a 'complex type', defined here as an object or a
|
187
|
+
* function.
|
188
|
+
*
|
189
|
+
* @param o the value to check
|
190
|
+
* @returns whether it's a complex type or not
|
191
|
+
*/
|
192
|
+
const isComplexType = (o) => {
|
193
|
+
// https://jsperf.com/typeof-fn-object/5
|
194
|
+
o = typeof o;
|
195
|
+
return o === 'object' || o === 'function';
|
196
|
+
};
|
197
|
+
/**
|
198
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
199
|
+
* out of a DOM's head.
|
200
|
+
*
|
201
|
+
* @param doc The DOM containing the `head` to query against
|
202
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
203
|
+
* exists or the tag has no content.
|
204
|
+
*/
|
205
|
+
function queryNonceMetaTagContent(doc) {
|
206
|
+
var _a, _b, _c;
|
207
|
+
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;
|
208
|
+
}
|
209
|
+
/**
|
210
|
+
* Production h() function based on Preact by
|
211
|
+
* Jason Miller (@developit)
|
212
|
+
* Licensed under the MIT License
|
213
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
214
|
+
*
|
215
|
+
* Modified for Stencil's compiler and vdom
|
216
|
+
*/
|
217
|
+
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
218
|
+
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
219
|
+
const h = (nodeName, vnodeData, ...children) => {
|
220
|
+
let child = null;
|
221
|
+
let key = null;
|
222
|
+
let slotName = null;
|
223
|
+
let simple = false;
|
224
|
+
let lastSimple = false;
|
225
|
+
const vNodeChildren = [];
|
226
|
+
const walk = (c) => {
|
227
|
+
for (let i = 0; i < c.length; i++) {
|
228
|
+
child = c[i];
|
229
|
+
if (Array.isArray(child)) {
|
230
|
+
walk(child);
|
231
|
+
}
|
232
|
+
else if (child != null && typeof child !== 'boolean') {
|
233
|
+
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
|
234
|
+
child = String(child);
|
235
|
+
}
|
236
|
+
else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
|
237
|
+
consoleDevError(`vNode passed as children has unexpected type.
|
238
|
+
Make sure it's using the correct h() function.
|
239
|
+
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
240
|
+
}
|
241
|
+
if (simple && lastSimple) {
|
242
|
+
// If the previous child was simple (string), we merge both
|
243
|
+
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
244
|
+
}
|
245
|
+
else {
|
246
|
+
// Append a new vNode, if it's text, we create a text vNode
|
247
|
+
vNodeChildren.push(simple ? newVNode(null, child) : child);
|
248
|
+
}
|
249
|
+
lastSimple = simple;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
};
|
253
|
+
walk(children);
|
254
|
+
if (vnodeData) {
|
255
|
+
if (BUILD.isDev && nodeName === 'input') {
|
256
|
+
validateInputProperties(vnodeData);
|
257
|
+
}
|
258
|
+
if (BUILD.vdomKey && vnodeData.key) {
|
259
|
+
key = vnodeData.key;
|
260
|
+
}
|
261
|
+
if (BUILD.slotRelocation && vnodeData.name) {
|
262
|
+
slotName = vnodeData.name;
|
263
|
+
}
|
264
|
+
// normalize class / className attributes
|
265
|
+
if (BUILD.vdomClass) {
|
266
|
+
const classData = vnodeData.className || vnodeData.class;
|
267
|
+
if (classData) {
|
268
|
+
vnodeData.class =
|
269
|
+
typeof classData !== 'object'
|
270
|
+
? classData
|
271
|
+
: Object.keys(classData)
|
272
|
+
.filter((k) => classData[k])
|
273
|
+
.join(' ');
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|
277
|
+
if (BUILD.isDev && vNodeChildren.some(isHost)) {
|
278
|
+
consoleDevError(`The <Host> must be the single root component. Make sure:
|
279
|
+
- You are NOT using hostData() and <Host> in the same component.
|
280
|
+
- <Host> is used once, and it's the single root component of the render() function.`);
|
281
|
+
}
|
282
|
+
if (BUILD.vdomFunctional && typeof nodeName === 'function') {
|
283
|
+
// nodeName is a functional component
|
284
|
+
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
285
|
+
}
|
286
|
+
const vnode = newVNode(nodeName, null);
|
287
|
+
vnode.$attrs$ = vnodeData;
|
288
|
+
if (vNodeChildren.length > 0) {
|
289
|
+
vnode.$children$ = vNodeChildren;
|
290
|
+
}
|
291
|
+
if (BUILD.vdomKey) {
|
292
|
+
vnode.$key$ = key;
|
293
|
+
}
|
294
|
+
if (BUILD.slotRelocation) {
|
295
|
+
vnode.$name$ = slotName;
|
296
|
+
}
|
297
|
+
return vnode;
|
298
|
+
};
|
299
|
+
/**
|
300
|
+
* A utility function for creating a virtual DOM node from a tag and some
|
301
|
+
* possible text content.
|
302
|
+
*
|
303
|
+
* @param tag the tag for this element
|
304
|
+
* @param text possible text content for the node
|
305
|
+
* @returns a newly-minted virtual DOM node
|
306
|
+
*/
|
307
|
+
const newVNode = (tag, text) => {
|
308
|
+
const vnode = {
|
309
|
+
$flags$: 0,
|
310
|
+
$tag$: tag,
|
311
|
+
$text$: text,
|
312
|
+
$elm$: null,
|
313
|
+
$children$: null,
|
314
|
+
};
|
315
|
+
if (BUILD.vdomAttribute) {
|
316
|
+
vnode.$attrs$ = null;
|
317
|
+
}
|
318
|
+
if (BUILD.vdomKey) {
|
319
|
+
vnode.$key$ = null;
|
320
|
+
}
|
321
|
+
if (BUILD.slotRelocation) {
|
322
|
+
vnode.$name$ = null;
|
323
|
+
}
|
324
|
+
return vnode;
|
325
|
+
};
|
326
|
+
const Host = {};
|
327
|
+
/**
|
328
|
+
* Check whether a given node is a Host node or not
|
329
|
+
*
|
330
|
+
* @param node the virtual DOM node to check
|
331
|
+
* @returns whether it's a Host node or not
|
332
|
+
*/
|
333
|
+
const isHost = (node) => node && node.$tag$ === Host;
|
334
|
+
/**
|
335
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
336
|
+
*
|
337
|
+
* Note that these functions convert from {@link d.VNode} to
|
338
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
339
|
+
* interface.
|
340
|
+
*/
|
341
|
+
const vdomFnUtils = {
|
342
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
343
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
344
|
+
};
|
345
|
+
/**
|
346
|
+
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
347
|
+
* friendlier public interface (hence, 'convertToPublic').
|
348
|
+
*
|
349
|
+
* @param node the virtual DOM node to convert
|
350
|
+
* @returns a converted child node
|
351
|
+
*/
|
352
|
+
const convertToPublic = (node) => ({
|
353
|
+
vattrs: node.$attrs$,
|
354
|
+
vchildren: node.$children$,
|
355
|
+
vkey: node.$key$,
|
356
|
+
vname: node.$name$,
|
357
|
+
vtag: node.$tag$,
|
358
|
+
vtext: node.$text$,
|
359
|
+
});
|
360
|
+
/**
|
361
|
+
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
362
|
+
* order to use the resulting object in the virtual DOM. The initial object was
|
363
|
+
* likely created as part of presenting a public API, so converting it back
|
364
|
+
* involved making it 'private' again (hence, `convertToPrivate`).
|
365
|
+
*
|
366
|
+
* @param node the child node to convert
|
367
|
+
* @returns a converted virtual DOM node
|
368
|
+
*/
|
369
|
+
const convertToPrivate = (node) => {
|
370
|
+
if (typeof node.vtag === 'function') {
|
371
|
+
const vnodeData = Object.assign({}, node.vattrs);
|
372
|
+
if (node.vkey) {
|
373
|
+
vnodeData.key = node.vkey;
|
374
|
+
}
|
375
|
+
if (node.vname) {
|
376
|
+
vnodeData.name = node.vname;
|
377
|
+
}
|
378
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
379
|
+
}
|
380
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
381
|
+
vnode.$attrs$ = node.vattrs;
|
382
|
+
vnode.$children$ = node.vchildren;
|
383
|
+
vnode.$key$ = node.vkey;
|
384
|
+
vnode.$name$ = node.vname;
|
385
|
+
return vnode;
|
386
|
+
};
|
387
|
+
/**
|
388
|
+
* Validates the ordering of attributes on an input element
|
389
|
+
*
|
390
|
+
* @param inputElm the element to validate
|
391
|
+
*/
|
392
|
+
const validateInputProperties = (inputElm) => {
|
393
|
+
const props = Object.keys(inputElm);
|
394
|
+
const value = props.indexOf('value');
|
395
|
+
if (value === -1) {
|
396
|
+
return;
|
397
|
+
}
|
398
|
+
const typeIndex = props.indexOf('type');
|
399
|
+
const minIndex = props.indexOf('min');
|
400
|
+
const maxIndex = props.indexOf('max');
|
401
|
+
const stepIndex = props.indexOf('step');
|
402
|
+
if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
|
403
|
+
consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
|
404
|
+
}
|
405
|
+
};
|
406
|
+
/**
|
407
|
+
* Entrypoint of the client-side hydration process. Facilitates calls to hydrate the
|
408
|
+
* document and all its nodes.
|
409
|
+
*
|
410
|
+
* This process will also reconstruct the shadow root and slot DOM nodes for components using shadow DOM.
|
411
|
+
*
|
412
|
+
* @param hostElm The element to hydrate.
|
413
|
+
* @param tagName The element's tag name.
|
414
|
+
* @param hostId The host ID assigned to the element by the server.
|
415
|
+
* @param hostRef The host reference for the element.
|
416
|
+
*/
|
417
|
+
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
418
|
+
const endHydrate = createTime('hydrateClient', tagName);
|
419
|
+
const shadowRoot = hostElm.shadowRoot;
|
420
|
+
const childRenderNodes = [];
|
421
|
+
const slotNodes = [];
|
422
|
+
const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
|
423
|
+
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
424
|
+
if (!plt.$orgLocNodes$) {
|
425
|
+
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
426
|
+
}
|
427
|
+
hostElm[HYDRATE_ID] = hostId;
|
428
|
+
hostElm.removeAttribute(HYDRATE_ID);
|
429
|
+
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
430
|
+
childRenderNodes.map((c) => {
|
431
|
+
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
432
|
+
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
433
|
+
const node = c.$elm$;
|
434
|
+
// Put the node back in its original location since the native Shadow DOM
|
435
|
+
// can handle rendering it its correct location now
|
436
|
+
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
437
|
+
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
438
|
+
}
|
439
|
+
if (!shadowRoot) {
|
440
|
+
node['s-hn'] = tagName;
|
441
|
+
if (orgLocationNode) {
|
442
|
+
node['s-ol'] = orgLocationNode;
|
443
|
+
node['s-ol']['s-nr'] = node;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
plt.$orgLocNodes$.delete(orgLocationId);
|
447
|
+
});
|
448
|
+
if (BUILD.shadowDom && shadowRoot) {
|
449
|
+
shadowRootNodes.map((shadowRootNode) => {
|
450
|
+
if (shadowRootNode) {
|
451
|
+
shadowRoot.appendChild(shadowRootNode);
|
452
|
+
}
|
453
|
+
});
|
454
|
+
}
|
455
|
+
endHydrate();
|
456
|
+
};
|
457
|
+
/**
|
458
|
+
* Recursively constructs the virtual node tree for a host element and its children.
|
459
|
+
* The tree is constructed by parsing the annotations set on the nodes by the server.
|
460
|
+
*
|
461
|
+
* In addition to constructing the vNode tree, we also track information about the node's
|
462
|
+
* descendants like which are slots, which should exist in the shadow root, and which
|
463
|
+
* are nodes that should be rendered as children of the parent node.
|
464
|
+
*
|
465
|
+
* @param parentVNode The vNode representing the parent node.
|
466
|
+
* @param childRenderNodes An array of all child nodes in the parent's node tree.
|
467
|
+
* @param slotNodes An array of all slot nodes in the parent's node tree.
|
468
|
+
* @param shadowRootNodes An array all nodes that should be rendered in the shadow root in the parent's node tree.
|
469
|
+
* @param hostElm The parent element.
|
470
|
+
* @param node The node to construct the vNode tree for.
|
471
|
+
* @param hostId The host ID assigned to the element by the server.
|
472
|
+
*/
|
473
|
+
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
474
|
+
let childNodeType;
|
475
|
+
let childIdSplt;
|
476
|
+
let childVNode;
|
477
|
+
let i;
|
478
|
+
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
479
|
+
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
480
|
+
if (childNodeType) {
|
481
|
+
// got the node data from the element's attribute
|
482
|
+
// `${hostId}.${nodeId}.${depth}.${index}`
|
483
|
+
childIdSplt = childNodeType.split('.');
|
484
|
+
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
485
|
+
childVNode = {
|
486
|
+
$flags$: 0,
|
487
|
+
$hostId$: childIdSplt[0],
|
488
|
+
$nodeId$: childIdSplt[1],
|
489
|
+
$depth$: childIdSplt[2],
|
490
|
+
$index$: childIdSplt[3],
|
491
|
+
$tag$: node.tagName.toLowerCase(),
|
492
|
+
$elm$: node,
|
493
|
+
$attrs$: null,
|
494
|
+
$children$: null,
|
495
|
+
$key$: null,
|
496
|
+
$name$: null,
|
497
|
+
$text$: null,
|
498
|
+
};
|
499
|
+
childRenderNodes.push(childVNode);
|
500
|
+
node.removeAttribute(HYDRATE_CHILD_ID);
|
501
|
+
// this is a new child vnode
|
502
|
+
// so ensure its parent vnode has the vchildren array
|
503
|
+
if (!parentVNode.$children$) {
|
504
|
+
parentVNode.$children$ = [];
|
505
|
+
}
|
506
|
+
// add our child vnode to a specific index of the vnode's children
|
507
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
508
|
+
// this is now the new parent vnode for all the next child checks
|
509
|
+
parentVNode = childVNode;
|
510
|
+
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
511
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
512
|
+
}
|
513
|
+
}
|
514
|
+
}
|
515
|
+
// recursively drill down, end to start so we can remove nodes
|
516
|
+
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
517
|
+
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
518
|
+
}
|
519
|
+
if (node.shadowRoot) {
|
520
|
+
// keep drilling down through the shadow root nodes
|
521
|
+
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
522
|
+
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
523
|
+
}
|
524
|
+
}
|
525
|
+
}
|
526
|
+
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
527
|
+
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
528
|
+
childIdSplt = node.nodeValue.split('.');
|
529
|
+
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
530
|
+
// comment node for either the host id or a 0 host id
|
531
|
+
childNodeType = childIdSplt[0];
|
532
|
+
childVNode = {
|
533
|
+
$flags$: 0,
|
534
|
+
$hostId$: childIdSplt[1],
|
535
|
+
$nodeId$: childIdSplt[2],
|
536
|
+
$depth$: childIdSplt[3],
|
537
|
+
$index$: childIdSplt[4],
|
538
|
+
$elm$: node,
|
539
|
+
$attrs$: null,
|
540
|
+
$children$: null,
|
541
|
+
$key$: null,
|
542
|
+
$name$: null,
|
543
|
+
$tag$: null,
|
544
|
+
$text$: null,
|
545
|
+
};
|
546
|
+
if (childNodeType === TEXT_NODE_ID) {
|
547
|
+
childVNode.$elm$ = node.nextSibling;
|
548
|
+
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
549
|
+
childVNode.$text$ = childVNode.$elm$.textContent;
|
550
|
+
childRenderNodes.push(childVNode);
|
551
|
+
// remove the text comment since it's no longer needed
|
552
|
+
node.remove();
|
553
|
+
if (!parentVNode.$children$) {
|
554
|
+
parentVNode.$children$ = [];
|
555
|
+
}
|
556
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
557
|
+
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
558
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
559
|
+
}
|
560
|
+
}
|
561
|
+
}
|
562
|
+
else if (childVNode.$hostId$ === hostId) {
|
563
|
+
// this comment node is specifically for this host id
|
564
|
+
if (childNodeType === SLOT_NODE_ID) {
|
565
|
+
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
566
|
+
childVNode.$tag$ = 'slot';
|
567
|
+
if (childIdSplt[5]) {
|
568
|
+
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
569
|
+
}
|
570
|
+
else {
|
571
|
+
node['s-sn'] = '';
|
572
|
+
}
|
573
|
+
node['s-sr'] = true;
|
574
|
+
if (BUILD.shadowDom && shadowRootNodes) {
|
575
|
+
// browser support shadowRoot and this is a shadow dom component
|
576
|
+
// create an actual slot element
|
577
|
+
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
578
|
+
if (childVNode.$name$) {
|
579
|
+
// add the slot name attribute
|
580
|
+
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
581
|
+
}
|
582
|
+
// insert the new slot element before the slot comment
|
583
|
+
node.parentNode.insertBefore(childVNode.$elm$, node);
|
584
|
+
// remove the slot comment since it's not needed for shadow
|
585
|
+
node.remove();
|
586
|
+
if (childVNode.$depth$ === '0') {
|
587
|
+
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
588
|
+
}
|
589
|
+
}
|
590
|
+
slotNodes.push(childVNode);
|
591
|
+
if (!parentVNode.$children$) {
|
592
|
+
parentVNode.$children$ = [];
|
593
|
+
}
|
594
|
+
parentVNode.$children$[childVNode.$index$] = childVNode;
|
595
|
+
}
|
596
|
+
else if (childNodeType === CONTENT_REF_ID) {
|
597
|
+
// `${CONTENT_REF_ID}.${hostId}`;
|
598
|
+
if (BUILD.shadowDom && shadowRootNodes) {
|
599
|
+
// remove the content ref comment since it's not needed for shadow
|
600
|
+
node.remove();
|
601
|
+
}
|
602
|
+
else if (BUILD.slotRelocation) {
|
603
|
+
hostElm['s-cr'] = node;
|
604
|
+
node['s-cn'] = true;
|
605
|
+
}
|
606
|
+
}
|
607
|
+
}
|
608
|
+
}
|
609
|
+
}
|
610
|
+
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
611
|
+
const vnode = newVNode(null, node.textContent);
|
612
|
+
vnode.$elm$ = node;
|
613
|
+
vnode.$index$ = '0';
|
614
|
+
parentVNode.$children$ = [vnode];
|
615
|
+
}
|
616
|
+
};
|
617
|
+
/**
|
618
|
+
* Recursively locate any comments representing an original location for a node in a node's
|
619
|
+
* children or shadowRoot children.
|
620
|
+
*
|
621
|
+
* @param node The node to search.
|
622
|
+
* @param orgLocNodes A map of the original location annotation and the current node being searched.
|
623
|
+
*/
|
624
|
+
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
625
|
+
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
626
|
+
let i = 0;
|
627
|
+
for (; i < node.childNodes.length; i++) {
|
628
|
+
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
629
|
+
}
|
630
|
+
if (node.shadowRoot) {
|
631
|
+
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
632
|
+
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
633
|
+
}
|
634
|
+
}
|
635
|
+
}
|
636
|
+
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
637
|
+
const childIdSplt = node.nodeValue.split('.');
|
638
|
+
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
639
|
+
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
640
|
+
node.nodeValue = '';
|
641
|
+
// useful to know if the original location is
|
642
|
+
// the root light-dom of a shadow dom component
|
643
|
+
node['s-en'] = childIdSplt[3];
|
644
|
+
}
|
645
|
+
}
|
646
|
+
};
|
647
|
+
// Private
|
648
|
+
const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
|
649
|
+
// Public
|
650
|
+
const setMode = (handler) => modeResolutionChain.push(handler);
|
651
|
+
const getMode = (ref) => getHostRef(ref).$modeName$;
|
652
|
+
/**
|
653
|
+
* Parse a new property value for a given property type.
|
654
|
+
*
|
655
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
656
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
657
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
658
|
+
* 2. the type stored from `propType`.
|
659
|
+
*
|
660
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
661
|
+
*
|
662
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
663
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
664
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
665
|
+
* ```tsx
|
666
|
+
* <my-cmp prop-val={0}></my-cmp>
|
667
|
+
* ```
|
668
|
+
*
|
669
|
+
* HTML prop values on the other hand, will always a string
|
670
|
+
*
|
671
|
+
* @param propValue the new value to coerce to some type
|
672
|
+
* @param propType the type of the prop, expressed as a binary number
|
673
|
+
* @returns the parsed/coerced value
|
674
|
+
*/
|
675
|
+
const parsePropertyValue = (propValue, propType) => {
|
676
|
+
// ensure this value is of the correct prop type
|
677
|
+
if (propValue != null && !isComplexType(propValue)) {
|
678
|
+
if (BUILD.propBoolean && propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
679
|
+
// per the HTML spec, any string value means it is a boolean true value
|
680
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
681
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
682
|
+
}
|
683
|
+
if (BUILD.propNumber && propType & 2 /* MEMBER_FLAGS.Number */) {
|
684
|
+
// force it to be a number
|
685
|
+
return parseFloat(propValue);
|
686
|
+
}
|
687
|
+
if (BUILD.propString && propType & 1 /* MEMBER_FLAGS.String */) {
|
688
|
+
// could have been passed as a number or boolean
|
689
|
+
// but we still want it as a string
|
690
|
+
return String(propValue);
|
691
|
+
}
|
692
|
+
// redundant return here for better minification
|
693
|
+
return propValue;
|
694
|
+
}
|
695
|
+
// not sure exactly what type we want
|
696
|
+
// so no need to change to a different type
|
697
|
+
return propValue;
|
698
|
+
};
|
699
|
+
const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
|
700
|
+
const createEvent = (ref, name, flags) => {
|
701
|
+
const elm = getElement(ref);
|
702
|
+
return {
|
703
|
+
emit: (detail) => {
|
704
|
+
if (BUILD.isDev && !elm.isConnected) {
|
705
|
+
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
706
|
+
}
|
707
|
+
return emitEvent(elm, name, {
|
708
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
709
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
710
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
711
|
+
detail,
|
712
|
+
});
|
713
|
+
},
|
714
|
+
};
|
715
|
+
};
|
716
|
+
/**
|
717
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
718
|
+
* @param elm the target of the Event
|
719
|
+
* @param name the name to give the custom Event
|
720
|
+
* @param opts options for configuring a custom Event
|
721
|
+
* @returns the custom Event
|
722
|
+
*/
|
723
|
+
const emitEvent = (elm, name, opts) => {
|
724
|
+
const ev = plt.ce(name, opts);
|
725
|
+
elm.dispatchEvent(ev);
|
726
|
+
return ev;
|
727
|
+
};
|
728
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
729
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
730
|
+
let style = styles.get(scopeId);
|
731
|
+
if (supportsConstructableStylesheets && allowCS) {
|
732
|
+
style = (style || new CSSStyleSheet());
|
733
|
+
if (typeof style === 'string') {
|
734
|
+
style = cssText;
|
735
|
+
}
|
736
|
+
else {
|
737
|
+
style.replaceSync(cssText);
|
738
|
+
}
|
739
|
+
}
|
740
|
+
else {
|
741
|
+
style = cssText;
|
742
|
+
}
|
743
|
+
styles.set(scopeId, style);
|
744
|
+
};
|
745
|
+
const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
746
|
+
var _a;
|
747
|
+
const scopeId = getScopeId(cmpMeta, mode);
|
748
|
+
const style = styles.get(scopeId);
|
749
|
+
if (!BUILD.attachStyles) {
|
750
|
+
return scopeId;
|
751
|
+
}
|
752
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
753
|
+
// so the fallback is to always use the document for the root node in those cases
|
754
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
755
|
+
if (style) {
|
756
|
+
if (typeof style === 'string') {
|
757
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
758
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
759
|
+
let styleElm;
|
760
|
+
if (!appliedStyles) {
|
761
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
762
|
+
}
|
763
|
+
if (!appliedStyles.has(scopeId)) {
|
764
|
+
if (BUILD.hydrateClientSide &&
|
765
|
+
styleContainerNode.host &&
|
766
|
+
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
767
|
+
// This is only happening on native shadow-dom, do not needs CSS var shim
|
768
|
+
styleElm.innerHTML = style;
|
769
|
+
}
|
770
|
+
else {
|
771
|
+
styleElm = doc.createElement('style');
|
772
|
+
styleElm.innerHTML = style;
|
773
|
+
// Apply CSP nonce to the style tag if it exists
|
774
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
775
|
+
if (nonce != null) {
|
776
|
+
styleElm.setAttribute('nonce', nonce);
|
777
|
+
}
|
778
|
+
if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
|
779
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
|
780
|
+
}
|
781
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
782
|
+
}
|
783
|
+
// Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
|
784
|
+
if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
|
785
|
+
styleElm.innerHTML += SLOT_FB_CSS;
|
786
|
+
}
|
787
|
+
if (appliedStyles) {
|
788
|
+
appliedStyles.add(scopeId);
|
789
|
+
}
|
790
|
+
}
|
791
|
+
}
|
792
|
+
else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
793
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
794
|
+
}
|
795
|
+
}
|
796
|
+
return scopeId;
|
797
|
+
};
|
798
|
+
const attachStyles = (hostRef) => {
|
799
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
800
|
+
const elm = hostRef.$hostElement$;
|
801
|
+
const flags = cmpMeta.$flags$;
|
802
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
803
|
+
const scopeId = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$);
|
804
|
+
if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
805
|
+
// only required when we're NOT using native shadow dom (slot)
|
806
|
+
// or this browser doesn't support native shadow dom
|
807
|
+
// and this host element was NOT created with SSR
|
808
|
+
// let's pick out the inner content for slot projection
|
809
|
+
// create a node to represent where the original
|
810
|
+
// content was first placed, which is useful later on
|
811
|
+
// DOM WRITE!!
|
812
|
+
elm['s-sc'] = scopeId;
|
813
|
+
elm.classList.add(scopeId + '-h');
|
814
|
+
if (BUILD.scoped && flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
815
|
+
elm.classList.add(scopeId + '-s');
|
816
|
+
}
|
817
|
+
}
|
818
|
+
endAttachStyles();
|
819
|
+
};
|
820
|
+
const getScopeId = (cmp, mode) => 'sc-' + (BUILD.mode && mode && cmp.$flags$ & 32 /* CMP_FLAGS.hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
|
821
|
+
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
822
|
+
/**
|
823
|
+
* Production setAccessor() function based on Preact by
|
824
|
+
* Jason Miller (@developit)
|
825
|
+
* Licensed under the MIT License
|
826
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
827
|
+
*
|
828
|
+
* Modified for Stencil's compiler and vdom
|
829
|
+
*/
|
830
|
+
/**
|
831
|
+
* When running a VDom render set properties present on a VDom node onto the
|
832
|
+
* corresponding HTML element.
|
833
|
+
*
|
834
|
+
* Note that this function has special functionality for the `class`,
|
835
|
+
* `style`, `key`, and `ref` attributes, as well as event handlers (like
|
836
|
+
* `onClick`, etc). All others are just passed through as-is.
|
837
|
+
*
|
838
|
+
* @param elm the HTMLElement onto which attributes should be set
|
839
|
+
* @param memberName the name of the attribute to set
|
840
|
+
* @param oldValue the old value for the attribute
|
841
|
+
* @param newValue the new value for the attribute
|
842
|
+
* @param isSvg whether we're in an svg context or not
|
843
|
+
* @param flags bitflags for Vdom variables
|
844
|
+
*/
|
845
|
+
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
846
|
+
if (oldValue !== newValue) {
|
847
|
+
let isProp = isMemberInElement(elm, memberName);
|
848
|
+
let ln = memberName.toLowerCase();
|
849
|
+
if (BUILD.vdomClass && memberName === 'class') {
|
850
|
+
const classList = elm.classList;
|
851
|
+
const oldClasses = parseClassList(oldValue);
|
852
|
+
const newClasses = parseClassList(newValue);
|
853
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
854
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
855
|
+
}
|
856
|
+
else if (BUILD.vdomStyle && memberName === 'style') {
|
857
|
+
// update style attribute, css properties and values
|
858
|
+
if (BUILD.updatable) {
|
859
|
+
for (const prop in oldValue) {
|
860
|
+
if (!newValue || newValue[prop] == null) {
|
861
|
+
if (!BUILD.hydrateServerSide && prop.includes('-')) {
|
862
|
+
elm.style.removeProperty(prop);
|
863
|
+
}
|
864
|
+
else {
|
865
|
+
elm.style[prop] = '';
|
866
|
+
}
|
867
|
+
}
|
868
|
+
}
|
869
|
+
}
|
870
|
+
for (const prop in newValue) {
|
871
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
872
|
+
if (!BUILD.hydrateServerSide && prop.includes('-')) {
|
873
|
+
elm.style.setProperty(prop, newValue[prop]);
|
874
|
+
}
|
875
|
+
else {
|
876
|
+
elm.style[prop] = newValue[prop];
|
877
|
+
}
|
878
|
+
}
|
879
|
+
}
|
880
|
+
}
|
881
|
+
else if (BUILD.vdomKey && memberName === 'key')
|
882
|
+
;
|
883
|
+
else if (BUILD.vdomRef && memberName === 'ref') {
|
884
|
+
// minifier will clean this up
|
885
|
+
if (newValue) {
|
886
|
+
newValue(elm);
|
887
|
+
}
|
888
|
+
}
|
889
|
+
else if (BUILD.vdomListener &&
|
890
|
+
(BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
|
891
|
+
memberName[0] === 'o' &&
|
892
|
+
memberName[1] === 'n') {
|
893
|
+
// Event Handlers
|
894
|
+
// so if the member name starts with "on" and the 3rd characters is
|
895
|
+
// a capital letter, and it's not already a member on the element,
|
896
|
+
// then we're assuming it's an event listener
|
897
|
+
if (memberName[2] === '-') {
|
898
|
+
// on- prefixed events
|
899
|
+
// allows to be explicit about the dom event to listen without any magic
|
900
|
+
// under the hood:
|
901
|
+
// <my-cmp on-click> // listens for "click"
|
902
|
+
// <my-cmp on-Click> // listens for "Click"
|
903
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
904
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
905
|
+
memberName = memberName.slice(3);
|
906
|
+
}
|
907
|
+
else if (isMemberInElement(win, ln)) {
|
908
|
+
// standard event
|
909
|
+
// the JSX attribute could have been "onMouseOver" and the
|
910
|
+
// member name "onmouseover" is on the window's prototype
|
911
|
+
// so let's add the listener "mouseover", which is all lowercased
|
912
|
+
memberName = ln.slice(2);
|
913
|
+
}
|
914
|
+
else {
|
915
|
+
// custom event
|
916
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
917
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
918
|
+
// and add the listener "myCustomEvent"
|
919
|
+
// except for the first character, we keep the event name case
|
920
|
+
memberName = ln[2] + memberName.slice(3);
|
921
|
+
}
|
922
|
+
if (oldValue || newValue) {
|
923
|
+
// Need to account for "capture" events.
|
924
|
+
// If the event name ends with "Capture", we'll update the name to remove
|
925
|
+
// the "Capture" suffix and make sure the event listener is setup to handle the capture event.
|
926
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
927
|
+
// Make sure we only replace the last instance of "Capture"
|
928
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
|
929
|
+
if (oldValue) {
|
930
|
+
plt.rel(elm, memberName, oldValue, capture);
|
931
|
+
}
|
932
|
+
if (newValue) {
|
933
|
+
plt.ael(elm, memberName, newValue, capture);
|
934
|
+
}
|
935
|
+
}
|
936
|
+
}
|
937
|
+
else if (BUILD.vdomPropOrAttr) {
|
938
|
+
// Set property if it exists and it's not a SVG
|
939
|
+
const isComplex = isComplexType(newValue);
|
940
|
+
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
941
|
+
try {
|
942
|
+
if (!elm.tagName.includes('-')) {
|
943
|
+
const n = newValue == null ? '' : newValue;
|
944
|
+
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
945
|
+
if (memberName === 'list') {
|
946
|
+
isProp = false;
|
947
|
+
}
|
948
|
+
else if (oldValue == null || elm[memberName] != n) {
|
949
|
+
elm[memberName] = n;
|
950
|
+
}
|
951
|
+
}
|
952
|
+
else {
|
953
|
+
elm[memberName] = newValue;
|
954
|
+
}
|
955
|
+
}
|
956
|
+
catch (e) {
|
957
|
+
/**
|
958
|
+
* in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
|
959
|
+
*/
|
960
|
+
}
|
961
|
+
}
|
962
|
+
/**
|
963
|
+
* Need to manually update attribute if:
|
964
|
+
* - memberName is not an attribute
|
965
|
+
* - if we are rendering the host element in order to reflect attribute
|
966
|
+
* - if it's a SVG, since properties might not work in <svg>
|
967
|
+
* - if the newValue is null/undefined or 'false'.
|
968
|
+
*/
|
969
|
+
let xlink = false;
|
970
|
+
if (BUILD.vdomXlink) {
|
971
|
+
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
972
|
+
memberName = ln;
|
973
|
+
xlink = true;
|
974
|
+
}
|
975
|
+
}
|
976
|
+
if (newValue == null || newValue === false) {
|
977
|
+
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
978
|
+
if (BUILD.vdomXlink && xlink) {
|
979
|
+
elm.removeAttributeNS(XLINK_NS, memberName);
|
980
|
+
}
|
981
|
+
else {
|
982
|
+
elm.removeAttribute(memberName);
|
983
|
+
}
|
984
|
+
}
|
985
|
+
}
|
986
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
987
|
+
newValue = newValue === true ? '' : newValue;
|
988
|
+
if (BUILD.vdomXlink && xlink) {
|
989
|
+
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
990
|
+
}
|
991
|
+
else {
|
992
|
+
elm.setAttribute(memberName, newValue);
|
993
|
+
}
|
994
|
+
}
|
995
|
+
}
|
996
|
+
}
|
997
|
+
};
|
998
|
+
const parseClassListRegex = /\s/;
|
999
|
+
/**
|
1000
|
+
* Parsed a string of classnames into an array
|
1001
|
+
* @param value className string, e.g. "foo bar baz"
|
1002
|
+
* @returns list of classes, e.g. ["foo", "bar", "baz"]
|
1003
|
+
*/
|
1004
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
1005
|
+
const CAPTURE_EVENT_SUFFIX = 'Capture';
|
1006
|
+
const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
|
1007
|
+
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
1008
|
+
// if the element passed in is a shadow root, which is a document fragment
|
1009
|
+
// then we want to be adding attrs/props to the shadow root's "host" element
|
1010
|
+
// if it's not a shadow root, then we add attrs/props to the same element
|
1011
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
1012
|
+
? newVnode.$elm$.host
|
1013
|
+
: newVnode.$elm$;
|
1014
|
+
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
1015
|
+
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
1016
|
+
if (BUILD.updatable) {
|
1017
|
+
// remove attributes no longer present on the vnode by setting them to undefined
|
1018
|
+
for (memberName in oldVnodeAttrs) {
|
1019
|
+
if (!(memberName in newVnodeAttrs)) {
|
1020
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
}
|
1024
|
+
// add new & update changed attributes
|
1025
|
+
for (memberName in newVnodeAttrs) {
|
1026
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
1027
|
+
}
|
1028
|
+
};
|
1029
|
+
/**
|
1030
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
1031
|
+
*
|
1032
|
+
* @param oldParentVNode the parent VNode from the previous render
|
1033
|
+
* @param newParentVNode the parent VNode from the current render
|
1034
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
1035
|
+
* children, for which we will create a new DOM node
|
1036
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
1037
|
+
* @returns the newly created node
|
1038
|
+
*/
|
1039
|
+
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
1040
|
+
var _a;
|
1041
|
+
// tslint:disable-next-line: prefer-const
|
1042
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
1043
|
+
let i = 0;
|
1044
|
+
let elm;
|
1045
|
+
let childNode;
|
1046
|
+
let oldVNode;
|
1047
|
+
if (BUILD.slotRelocation && !useNativeShadowDom) {
|
1048
|
+
// remember for later we need to check to relocate nodes
|
1049
|
+
checkSlotRelocate = true;
|
1050
|
+
if (newVNode.$tag$ === 'slot') {
|
1051
|
+
if (scopeId) {
|
1052
|
+
// scoped css needs to add its scoped id to the parent element
|
1053
|
+
parentElm.classList.add(scopeId + '-s');
|
1054
|
+
}
|
1055
|
+
newVNode.$flags$ |= newVNode.$children$
|
1056
|
+
? // slot element has fallback content
|
1057
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
1058
|
+
: // slot element does not have fallback content
|
1059
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
1060
|
+
}
|
1061
|
+
}
|
1062
|
+
if (BUILD.isDev && newVNode.$elm$) {
|
1063
|
+
consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
|
1064
|
+
}
|
1065
|
+
if (BUILD.vdomText && newVNode.$text$ !== null) {
|
1066
|
+
// create text node
|
1067
|
+
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
1068
|
+
}
|
1069
|
+
else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
1070
|
+
// create a slot reference node
|
1071
|
+
elm = newVNode.$elm$ =
|
1072
|
+
BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
|
1073
|
+
}
|
1074
|
+
else {
|
1075
|
+
if (BUILD.svg && !isSvgMode) {
|
1076
|
+
isSvgMode = newVNode.$tag$ === 'svg';
|
1077
|
+
}
|
1078
|
+
// create element
|
1079
|
+
elm = newVNode.$elm$ = (BUILD.svg
|
1080
|
+
? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
1081
|
+
? 'slot-fb'
|
1082
|
+
: newVNode.$tag$)
|
1083
|
+
: doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
1084
|
+
? 'slot-fb'
|
1085
|
+
: newVNode.$tag$));
|
1086
|
+
if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
1087
|
+
isSvgMode = false;
|
1088
|
+
}
|
1089
|
+
// add css classes, attrs, props, listeners, etc.
|
1090
|
+
if (BUILD.vdomAttribute) {
|
1091
|
+
updateElement(null, newVNode, isSvgMode);
|
1092
|
+
}
|
1093
|
+
if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm['s-si'] !== scopeId) {
|
1094
|
+
// if there is a scopeId and this is the initial render
|
1095
|
+
// then let's add the scopeId as a css class
|
1096
|
+
elm.classList.add((elm['s-si'] = scopeId));
|
1097
|
+
}
|
1098
|
+
if (newVNode.$children$) {
|
1099
|
+
for (i = 0; i < newVNode.$children$.length; ++i) {
|
1100
|
+
// create the node
|
1101
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
1102
|
+
// return node could have been null
|
1103
|
+
if (childNode) {
|
1104
|
+
// append our new node
|
1105
|
+
elm.appendChild(childNode);
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
}
|
1109
|
+
if (BUILD.svg) {
|
1110
|
+
if (newVNode.$tag$ === 'svg') {
|
1111
|
+
// Only reset the SVG context when we're exiting <svg> element
|
1112
|
+
isSvgMode = false;
|
1113
|
+
}
|
1114
|
+
else if (elm.tagName === 'foreignObject') {
|
1115
|
+
// Reenter SVG context when we're exiting <foreignObject> element
|
1116
|
+
isSvgMode = true;
|
1117
|
+
}
|
1118
|
+
}
|
1119
|
+
}
|
1120
|
+
// This needs to always happen so we can hide nodes that are projected
|
1121
|
+
// to another component but don't end up in a slot
|
1122
|
+
elm['s-hn'] = hostTagName;
|
1123
|
+
if (BUILD.slotRelocation) {
|
1124
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
1125
|
+
// remember the content reference comment
|
1126
|
+
elm['s-sr'] = true;
|
1127
|
+
// Persist the name of the slot that this slot was going to be projected into.
|
1128
|
+
elm['s-fs'] = (_a = newVNode.$attrs$) === null || _a === void 0 ? void 0 : _a.slot;
|
1129
|
+
// remember the content reference comment
|
1130
|
+
elm['s-cr'] = contentRef;
|
1131
|
+
// remember the slot name, or empty string for default slot
|
1132
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
1133
|
+
// check if we've got an old vnode for this slot
|
1134
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
1135
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
1136
|
+
if (BUILD.experimentalSlotFixes) {
|
1137
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
1138
|
+
// so let's move the old slot content to the root of the element currently being rendered
|
1139
|
+
relocateToHostRoot(oldParentVNode.$elm$);
|
1140
|
+
}
|
1141
|
+
else {
|
1142
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
1143
|
+
// so let's move the old slot content back to its original location
|
1144
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
1145
|
+
}
|
1146
|
+
}
|
1147
|
+
}
|
1148
|
+
}
|
1149
|
+
return elm;
|
1150
|
+
};
|
1151
|
+
/**
|
1152
|
+
* Relocates all child nodes of an element that were a part of a previous slot relocation
|
1153
|
+
* to the root of the Stencil component currently being rendered. This happens when a parent
|
1154
|
+
* element of a slot reference node dynamically changes and triggers a re-render. We cannot use
|
1155
|
+
* `putBackInOriginalLocation()` because that may relocate nodes to elements that will not be re-rendered
|
1156
|
+
* and so they will not be relocated again.
|
1157
|
+
*
|
1158
|
+
* @param parentElm The element potentially containing relocated nodes.
|
1159
|
+
*/
|
1160
|
+
const relocateToHostRoot = (parentElm) => {
|
1161
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
1162
|
+
const host = parentElm.closest(hostTagName.toLowerCase());
|
1163
|
+
if (host != null) {
|
1164
|
+
for (const childNode of Array.from(parentElm.childNodes)) {
|
1165
|
+
// Only relocate nodes that were slotted in
|
1166
|
+
if (childNode['s-sh'] != null) {
|
1167
|
+
host.insertBefore(childNode, null);
|
1168
|
+
// Reset so we can correctly move the node around again.
|
1169
|
+
childNode['s-sh'] = undefined;
|
1170
|
+
// When putting an element node back in its original location,
|
1171
|
+
// we need to reset the `slot` attribute back to the value it originally had
|
1172
|
+
// so we can correctly relocate it again in the future
|
1173
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */ && !!childNode['s-sn']) {
|
1174
|
+
childNode.setAttribute('slot', childNode['s-sn']);
|
1175
|
+
}
|
1176
|
+
// Need to tell the render pipeline to check to relocate slot content again
|
1177
|
+
checkSlotRelocate = true;
|
1178
|
+
}
|
1179
|
+
}
|
1180
|
+
}
|
1181
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
1182
|
+
};
|
1183
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
1184
|
+
var _a;
|
1185
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
1186
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
1187
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
1188
|
+
const childNode = oldSlotChildNodes[i];
|
1189
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
1190
|
+
// and relocate it back to it's original location
|
1191
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
1192
|
+
// remove the old original location comment entirely
|
1193
|
+
// later on the patch function will know what to do
|
1194
|
+
// and move this to the correct spot if need be
|
1195
|
+
childNode['s-ol'].remove();
|
1196
|
+
childNode['s-ol'] = undefined;
|
1197
|
+
// Reset so we can correctly move the node around again.
|
1198
|
+
childNode['s-sh'] = undefined;
|
1199
|
+
// When putting an element node back in its original location,
|
1200
|
+
// we need to reset the `slot` attribute back to the value it originally had
|
1201
|
+
// so we can correctly relocate it again in the future
|
1202
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1203
|
+
childNode.setAttribute('slot', (_a = childNode['s-sn']) !== null && _a !== void 0 ? _a : '');
|
1204
|
+
}
|
1205
|
+
checkSlotRelocate = true;
|
1206
|
+
}
|
1207
|
+
if (recursive) {
|
1208
|
+
putBackInOriginalLocation(childNode, recursive);
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
1212
|
+
};
|
1213
|
+
/**
|
1214
|
+
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
1215
|
+
* add them to the DOM in the appropriate place.
|
1216
|
+
*
|
1217
|
+
* @param parentElm the DOM node which should be used as a parent for the new
|
1218
|
+
* DOM nodes
|
1219
|
+
* @param before a child of the `parentElm` which the new children should be
|
1220
|
+
* inserted before (optional)
|
1221
|
+
* @param parentVNode the parent virtual DOM node
|
1222
|
+
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
1223
|
+
* @param startIdx the index in the child virtual DOM nodes at which to start
|
1224
|
+
* creating DOM nodes (inclusive)
|
1225
|
+
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
1226
|
+
* creating DOM nodes (inclusive)
|
1227
|
+
*/
|
1228
|
+
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
1229
|
+
let containerElm = ((BUILD.slotRelocation && parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
1230
|
+
let childNode;
|
1231
|
+
if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
1232
|
+
containerElm = containerElm.shadowRoot;
|
1233
|
+
}
|
1234
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
1235
|
+
if (vnodes[startIdx]) {
|
1236
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
1237
|
+
if (childNode) {
|
1238
|
+
vnodes[startIdx].$elm$ = childNode;
|
1239
|
+
containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
}
|
1243
|
+
};
|
1244
|
+
/**
|
1245
|
+
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
1246
|
+
* This can be used to, for instance, clean up after a list of children which
|
1247
|
+
* should no longer be shown.
|
1248
|
+
*
|
1249
|
+
* This function also handles some of Stencil's slot relocation logic.
|
1250
|
+
*
|
1251
|
+
* @param vnodes a list of virtual DOM nodes to remove
|
1252
|
+
* @param startIdx the index at which to start removing nodes (inclusive)
|
1253
|
+
* @param endIdx the index at which to stop removing nodes (inclusive)
|
1254
|
+
*/
|
1255
|
+
const removeVnodes = (vnodes, startIdx, endIdx) => {
|
1256
|
+
for (let index = startIdx; index <= endIdx; ++index) {
|
1257
|
+
const vnode = vnodes[index];
|
1258
|
+
if (vnode) {
|
1259
|
+
const elm = vnode.$elm$;
|
1260
|
+
nullifyVNodeRefs(vnode);
|
1261
|
+
if (elm) {
|
1262
|
+
if (BUILD.slotRelocation) {
|
1263
|
+
// we're removing this element
|
1264
|
+
// so it's possible we need to show slot fallback content now
|
1265
|
+
checkSlotFallbackVisibility = true;
|
1266
|
+
if (elm['s-ol']) {
|
1267
|
+
// remove the original location comment
|
1268
|
+
elm['s-ol'].remove();
|
1269
|
+
}
|
1270
|
+
else {
|
1271
|
+
// it's possible that child nodes of the node
|
1272
|
+
// that's being removed are slot nodes
|
1273
|
+
putBackInOriginalLocation(elm, true);
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
// remove the vnode's element from the dom
|
1277
|
+
elm.remove();
|
1278
|
+
}
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
};
|
1282
|
+
/**
|
1283
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
1284
|
+
* traversing the two collections of children, identifying nodes that are
|
1285
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
1286
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
1287
|
+
*
|
1288
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
1289
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
1290
|
+
* 'windows' by storing start and end indices and references to the
|
1291
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
1292
|
+
* to the entire array, but we progressively narrow the windows until there are
|
1293
|
+
* no children left to update by doing the following:
|
1294
|
+
*
|
1295
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
1296
|
+
* that if we have an initial array like the following we'll end up dealing
|
1297
|
+
* only with a window bounded by the highlighted elements:
|
1298
|
+
*
|
1299
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
1300
|
+
* ^^^^^^ ^^^^^^
|
1301
|
+
*
|
1302
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
1303
|
+
* across the windows. This will basically detect elements which haven't
|
1304
|
+
* been added, removed, or changed position, i.e. if you had the following
|
1305
|
+
* VNode elements (represented as HTML):
|
1306
|
+
*
|
1307
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
1308
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
1309
|
+
*
|
1310
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
1311
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
1312
|
+
* same tag in the same position, we'd be able to avoid completely
|
1313
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
1314
|
+
* call out to `patch` to handle reconciling their children and so on.
|
1315
|
+
*
|
1316
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
1317
|
+
* window corresponds to the element at the end of the other window. This is
|
1318
|
+
* a heuristic which will let us identify _some_ situations in which
|
1319
|
+
* elements have changed position, for instance it _should_ detect that the
|
1320
|
+
* children nodes themselves have not changed but merely moved in the
|
1321
|
+
* following example:
|
1322
|
+
*
|
1323
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
1324
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
1325
|
+
*
|
1326
|
+
* If we find cases like this then we also need to move the concrete DOM
|
1327
|
+
* elements corresponding to the moved children to write the re-order to the
|
1328
|
+
* DOM.
|
1329
|
+
*
|
1330
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
1331
|
+
* nodes in the old children which have the same key as the first element in
|
1332
|
+
* our window on the new children. If we find such a node we handle calling
|
1333
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
1334
|
+
* what we find.
|
1335
|
+
*
|
1336
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
1337
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
1338
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
1339
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
1340
|
+
* children has collapsed we still have more nodes on the new children that
|
1341
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
1342
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
1343
|
+
* sure the corresponding DOM nodes are removed.
|
1344
|
+
*
|
1345
|
+
* @param parentElm the node into which the parent VNode is rendered
|
1346
|
+
* @param oldCh the old children of the parent node
|
1347
|
+
* @param newVNode the new VNode which will replace the parent
|
1348
|
+
* @param newCh the new children of the parent node
|
1349
|
+
* @param isInitialRender whether or not this is the first render of the vdom
|
1350
|
+
*/
|
1351
|
+
const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
|
1352
|
+
let oldStartIdx = 0;
|
1353
|
+
let newStartIdx = 0;
|
1354
|
+
let idxInOld = 0;
|
1355
|
+
let i = 0;
|
1356
|
+
let oldEndIdx = oldCh.length - 1;
|
1357
|
+
let oldStartVnode = oldCh[0];
|
1358
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
1359
|
+
let newEndIdx = newCh.length - 1;
|
1360
|
+
let newStartVnode = newCh[0];
|
1361
|
+
let newEndVnode = newCh[newEndIdx];
|
1362
|
+
let node;
|
1363
|
+
let elmToMove;
|
1364
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
1365
|
+
if (oldStartVnode == null) {
|
1366
|
+
// VNode might have been moved left
|
1367
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
1368
|
+
}
|
1369
|
+
else if (oldEndVnode == null) {
|
1370
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
1371
|
+
}
|
1372
|
+
else if (newStartVnode == null) {
|
1373
|
+
newStartVnode = newCh[++newStartIdx];
|
1374
|
+
}
|
1375
|
+
else if (newEndVnode == null) {
|
1376
|
+
newEndVnode = newCh[--newEndIdx];
|
1377
|
+
}
|
1378
|
+
else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
|
1379
|
+
// if the start nodes are the same then we should patch the new VNode
|
1380
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
1381
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
1382
|
+
// since things are matched up in order.
|
1383
|
+
patch(oldStartVnode, newStartVnode, isInitialRender);
|
1384
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
1385
|
+
newStartVnode = newCh[++newStartIdx];
|
1386
|
+
}
|
1387
|
+
else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
|
1388
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
1389
|
+
// decrement our end indices, and also likewise in this case we don't
|
1390
|
+
// need to move any DOM Nodes.
|
1391
|
+
patch(oldEndVnode, newEndVnode, isInitialRender);
|
1392
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
1393
|
+
newEndVnode = newCh[--newEndIdx];
|
1394
|
+
}
|
1395
|
+
else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
1396
|
+
// case: "Vnode moved right"
|
1397
|
+
//
|
1398
|
+
// We've found that the last node in our window on the new children is
|
1399
|
+
// the same VNode as the _first_ node in our window on the old children
|
1400
|
+
// we're dealing with now. Visually, this is the layout of these two
|
1401
|
+
// nodes:
|
1402
|
+
//
|
1403
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
1404
|
+
// ^^^^^^^^^^^
|
1405
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
1406
|
+
// ^^^^^^^^^^^^^
|
1407
|
+
//
|
1408
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
1409
|
+
// and move the DOM element for `oldStartVnode`.
|
1410
|
+
if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
1411
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
1412
|
+
}
|
1413
|
+
patch(oldStartVnode, newEndVnode, isInitialRender);
|
1414
|
+
// We need to move the element for `oldStartVnode` into a position which
|
1415
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
1416
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
1417
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
1418
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
1419
|
+
//
|
1420
|
+
// <old-start-node />
|
1421
|
+
// <some-intervening-node />
|
1422
|
+
// <old-end-node />
|
1423
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
1424
|
+
// <next-sibling />
|
1425
|
+
//
|
1426
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
1427
|
+
// the node for `oldStartVnode` at the end of the children of
|
1428
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
1429
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
1430
|
+
// append it to the children of the parent element.
|
1431
|
+
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
1432
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
1433
|
+
newEndVnode = newCh[--newEndIdx];
|
1434
|
+
}
|
1435
|
+
else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
1436
|
+
// case: "Vnode moved left"
|
1437
|
+
//
|
1438
|
+
// We've found that the first node in our window on the new children is
|
1439
|
+
// the same VNode as the _last_ node in our window on the old children.
|
1440
|
+
// Visually, this is the layout of these two nodes:
|
1441
|
+
//
|
1442
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
1443
|
+
// ^^^^^^^^^^^^^
|
1444
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
1445
|
+
// ^^^^^^^^^^^
|
1446
|
+
//
|
1447
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
1448
|
+
// (which will handle updating any changed attributes, reconciling their
|
1449
|
+
// children etc) but we also need to move the DOM node to which
|
1450
|
+
// `oldEndVnode` corresponds.
|
1451
|
+
if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
1452
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
1453
|
+
}
|
1454
|
+
patch(oldEndVnode, newStartVnode, isInitialRender);
|
1455
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
1456
|
+
// the same node, so since we're here we know that they are not. Thus we
|
1457
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
1458
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
1459
|
+
// future.
|
1460
|
+
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
1461
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
1462
|
+
newStartVnode = newCh[++newStartIdx];
|
1463
|
+
}
|
1464
|
+
else {
|
1465
|
+
// Here we do some checks to match up old and new nodes based on the
|
1466
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
1467
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
1468
|
+
// component.
|
1469
|
+
//
|
1470
|
+
// First we check to see if there are any nodes in the array of old
|
1471
|
+
// children which have the same key as the first node in the new
|
1472
|
+
// children.
|
1473
|
+
idxInOld = -1;
|
1474
|
+
if (BUILD.vdomKey) {
|
1475
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
1476
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
1477
|
+
idxInOld = i;
|
1478
|
+
break;
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
}
|
1482
|
+
if (BUILD.vdomKey && idxInOld >= 0) {
|
1483
|
+
// We found a node in the old children which matches up with the first
|
1484
|
+
// node in the new children! So let's deal with that
|
1485
|
+
elmToMove = oldCh[idxInOld];
|
1486
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
1487
|
+
// the tag doesn't match so we'll need a new DOM element
|
1488
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
|
1489
|
+
}
|
1490
|
+
else {
|
1491
|
+
patch(elmToMove, newStartVnode, isInitialRender);
|
1492
|
+
// invalidate the matching old node so that we won't try to update it
|
1493
|
+
// again later on
|
1494
|
+
oldCh[idxInOld] = undefined;
|
1495
|
+
node = elmToMove.$elm$;
|
1496
|
+
}
|
1497
|
+
newStartVnode = newCh[++newStartIdx];
|
1498
|
+
}
|
1499
|
+
else {
|
1500
|
+
// We either didn't find an element in the old children that matches
|
1501
|
+
// the key of the first new child OR the build is not using `key`
|
1502
|
+
// attributes at all. In either case we need to create a new element
|
1503
|
+
// for the new node.
|
1504
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
1505
|
+
newStartVnode = newCh[++newStartIdx];
|
1506
|
+
}
|
1507
|
+
if (node) {
|
1508
|
+
// if we created a new node then handle inserting it to the DOM
|
1509
|
+
if (BUILD.slotRelocation) {
|
1510
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
1511
|
+
}
|
1512
|
+
else {
|
1513
|
+
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
1514
|
+
}
|
1515
|
+
}
|
1516
|
+
}
|
1517
|
+
}
|
1518
|
+
if (oldStartIdx > oldEndIdx) {
|
1519
|
+
// we have some more new nodes to add which don't match up with old nodes
|
1520
|
+
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
1521
|
+
}
|
1522
|
+
else if (BUILD.updatable && newStartIdx > newEndIdx) {
|
1523
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
1524
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
1525
|
+
// relevant DOM nodes)
|
1526
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
1527
|
+
}
|
1528
|
+
};
|
1529
|
+
/**
|
1530
|
+
* Compare two VNodes to determine if they are the same
|
1531
|
+
*
|
1532
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
1533
|
+
* information set on the two VNodes and can be misleading under certain
|
1534
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
1535
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
1536
|
+
* checking that they have the same tag.
|
1537
|
+
*
|
1538
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
1539
|
+
* changing order within a `children` array or something along those lines then
|
1540
|
+
* we could obtain a false negative and then have to do needless re-rendering
|
1541
|
+
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
1542
|
+
*
|
1543
|
+
* @param leftVNode the first VNode to check
|
1544
|
+
* @param rightVNode the second VNode to check
|
1545
|
+
* @param isInitialRender whether or not this is the first render of the vdom
|
1546
|
+
* @returns whether they're equal or not
|
1547
|
+
*/
|
1548
|
+
const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
1549
|
+
// compare if two vnode to see if they're "technically" the same
|
1550
|
+
// need to have the same element tag, and same key to be the same
|
1551
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
1552
|
+
if (BUILD.slotRelocation && leftVNode.$tag$ === 'slot') {
|
1553
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
1554
|
+
}
|
1555
|
+
// this will be set if JSX tags in the build have `key` attrs set on them
|
1556
|
+
// we only want to check this if we're not on the first render since on
|
1557
|
+
// first render `leftVNode.$key$` will always be `null`, so we can be led
|
1558
|
+
// astray and, for instance, accidentally delete a DOM node that we want to
|
1559
|
+
// keep around.
|
1560
|
+
if (BUILD.vdomKey && !isInitialRender) {
|
1561
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
1562
|
+
}
|
1563
|
+
return true;
|
1564
|
+
}
|
1565
|
+
return false;
|
1566
|
+
};
|
1567
|
+
const referenceNode = (node) => {
|
1568
|
+
// this node was relocated to a new location in the dom
|
1569
|
+
// because of some other component's slot
|
1570
|
+
// but we still have an html comment in place of where
|
1571
|
+
// it's original location was according to it's original vdom
|
1572
|
+
return (node && node['s-ol']) || node;
|
1573
|
+
};
|
1574
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
1575
|
+
/**
|
1576
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
1577
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
1578
|
+
* children of the two nodes (if any).
|
1579
|
+
*
|
1580
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
1581
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
1582
|
+
* @param isInitialRender whether or not this is the first render of the vdom
|
1583
|
+
*/
|
1584
|
+
const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
1585
|
+
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
1586
|
+
const oldChildren = oldVNode.$children$;
|
1587
|
+
const newChildren = newVNode.$children$;
|
1588
|
+
const tag = newVNode.$tag$;
|
1589
|
+
const text = newVNode.$text$;
|
1590
|
+
let defaultHolder;
|
1591
|
+
if (!BUILD.vdomText || text === null) {
|
1592
|
+
if (BUILD.svg) {
|
1593
|
+
// test if we're rendering an svg element, or still rendering nodes inside of one
|
1594
|
+
// only add this to the when the compiler sees we're using an svg somewhere
|
1595
|
+
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
1596
|
+
}
|
1597
|
+
if (BUILD.vdomAttribute || BUILD.reflect) {
|
1598
|
+
if (BUILD.slot && tag === 'slot')
|
1599
|
+
;
|
1600
|
+
else {
|
1601
|
+
// either this is the first render of an element OR it's an update
|
1602
|
+
// AND we already know it's possible it could have changed
|
1603
|
+
// this updates the element's css classes, attrs, props, listeners, etc.
|
1604
|
+
updateElement(oldVNode, newVNode, isSvgMode);
|
1605
|
+
}
|
1606
|
+
}
|
1607
|
+
if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
|
1608
|
+
// looks like there's child vnodes for both the old and new vnodes
|
1609
|
+
// so we need to call `updateChildren` to reconcile them
|
1610
|
+
updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
|
1611
|
+
}
|
1612
|
+
else if (newChildren !== null) {
|
1613
|
+
// no old child vnodes, but there are new child vnodes to add
|
1614
|
+
if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
|
1615
|
+
// the old vnode was text, so be sure to clear it out
|
1616
|
+
elm.textContent = '';
|
1617
|
+
}
|
1618
|
+
// add the new vnode children
|
1619
|
+
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
1620
|
+
}
|
1621
|
+
else if (BUILD.updatable && oldChildren !== null) {
|
1622
|
+
// no new child vnodes, but there are old child vnodes to remove
|
1623
|
+
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
1624
|
+
}
|
1625
|
+
if (BUILD.svg && isSvgMode && tag === 'svg') {
|
1626
|
+
isSvgMode = false;
|
1627
|
+
}
|
1628
|
+
}
|
1629
|
+
else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm['s-cr'])) {
|
1630
|
+
// this element has slotted content
|
1631
|
+
defaultHolder.parentNode.textContent = text;
|
1632
|
+
}
|
1633
|
+
else if (BUILD.vdomText && oldVNode.$text$ !== text) {
|
1634
|
+
// update the text content for the text only vnode
|
1635
|
+
// and also only if the text is different than before
|
1636
|
+
elm.data = text;
|
1637
|
+
}
|
1638
|
+
};
|
1639
|
+
/**
|
1640
|
+
* Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
|
1641
|
+
* are slot fallbacks nodes.
|
1642
|
+
*
|
1643
|
+
* A slot fallback node should be visible by default. Then, it should be
|
1644
|
+
* conditionally hidden if:
|
1645
|
+
*
|
1646
|
+
* - it has a sibling with a `slot` property set to its slot name or if
|
1647
|
+
* - it is a default fallback slot node, in which case we hide if it has any
|
1648
|
+
* content
|
1649
|
+
*
|
1650
|
+
* @param elm the element of interest
|
1651
|
+
*/
|
1652
|
+
const updateFallbackSlotVisibility = (elm) => {
|
1653
|
+
const childNodes = elm.childNodes;
|
1654
|
+
for (const childNode of childNodes) {
|
1655
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1656
|
+
if (childNode['s-sr']) {
|
1657
|
+
// this is a slot fallback node
|
1658
|
+
// get the slot name for this slot reference node
|
1659
|
+
const slotName = childNode['s-sn'];
|
1660
|
+
// by default always show a fallback slot node
|
1661
|
+
// then hide it if there are other slots in the light dom
|
1662
|
+
childNode.hidden = false;
|
1663
|
+
// we need to check all of its sibling nodes in order to see if
|
1664
|
+
// `childNode` should be hidden
|
1665
|
+
for (const siblingNode of childNodes) {
|
1666
|
+
// Don't check the node against itself
|
1667
|
+
if (siblingNode !== childNode) {
|
1668
|
+
if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
|
1669
|
+
// this sibling node is from a different component OR is a named
|
1670
|
+
// fallback slot node
|
1671
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
1672
|
+
(slotName === siblingNode.getAttribute('slot') || slotName === siblingNode['s-sn'])) {
|
1673
|
+
childNode.hidden = true;
|
1674
|
+
break;
|
1675
|
+
}
|
1676
|
+
}
|
1677
|
+
else {
|
1678
|
+
// this is a default fallback slot node
|
1679
|
+
// any element or text node (with content)
|
1680
|
+
// should hide the default fallback slot node
|
1681
|
+
if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
1682
|
+
(siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
|
1683
|
+
childNode.hidden = true;
|
1684
|
+
break;
|
1685
|
+
}
|
1686
|
+
}
|
1687
|
+
}
|
1688
|
+
}
|
1689
|
+
}
|
1690
|
+
// keep drilling down
|
1691
|
+
updateFallbackSlotVisibility(childNode);
|
1692
|
+
}
|
1693
|
+
}
|
1694
|
+
};
|
1695
|
+
/**
|
1696
|
+
* Component-global information about nodes which are either currently being
|
1697
|
+
* relocated or will be shortly.
|
1698
|
+
*/
|
1699
|
+
const relocateNodes = [];
|
1700
|
+
/**
|
1701
|
+
* Mark the contents of a slot for relocation via adding references to them to
|
1702
|
+
* the {@link relocateNodes} data structure. The actual work of relocating them
|
1703
|
+
* will then be handled in {@link renderVdom}.
|
1704
|
+
*
|
1705
|
+
* @param elm a render node whose child nodes need to be relocated
|
1706
|
+
*/
|
1707
|
+
const markSlotContentForRelocation = (elm) => {
|
1708
|
+
// tslint:disable-next-line: prefer-const
|
1709
|
+
let node;
|
1710
|
+
let hostContentNodes;
|
1711
|
+
let j;
|
1712
|
+
for (const childNode of elm.childNodes) {
|
1713
|
+
// we need to find child nodes which are slot references so we can then try
|
1714
|
+
// to match them up with nodes that need to be relocated
|
1715
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
1716
|
+
// first get the content reference comment node ('s-cr'), then we get
|
1717
|
+
// its parent, which is where all the host content is now
|
1718
|
+
hostContentNodes = node.parentNode.childNodes;
|
1719
|
+
const slotName = childNode['s-sn'];
|
1720
|
+
// iterate through all the nodes under the location where the host was
|
1721
|
+
// originally rendered
|
1722
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
1723
|
+
node = hostContentNodes[j];
|
1724
|
+
// check that the node is not a content reference node or a node
|
1725
|
+
// reference and then check that the host name does not match that of
|
1726
|
+
// childNode.
|
1727
|
+
// In addition, check that the slot either has not already been relocated, or
|
1728
|
+
// that its current location's host is not childNode's host. This is essentially
|
1729
|
+
// a check so that we don't try to relocate (and then hide) a node that is already
|
1730
|
+
// where it should be.
|
1731
|
+
if (!node['s-cn'] &&
|
1732
|
+
!node['s-nr'] &&
|
1733
|
+
node['s-hn'] !== childNode['s-hn'] &&
|
1734
|
+
(!BUILD.experimentalSlotFixes || !node['s-sh'] || node['s-sh'] !== childNode['s-hn'])) {
|
1735
|
+
// if `node` is located in the slot that `childNode` refers to (via the
|
1736
|
+
// `'s-sn'` property) then we need to relocate it from it's current spot
|
1737
|
+
// (under the host element parent) to the right slot location
|
1738
|
+
if (isNodeLocatedInSlot(node, slotName)) {
|
1739
|
+
// it's possible we've already decided to relocate this node
|
1740
|
+
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
1741
|
+
// made some changes to slots
|
1742
|
+
// let's make sure we also double check
|
1743
|
+
// fallbacks are correctly hidden or shown
|
1744
|
+
checkSlotFallbackVisibility = true;
|
1745
|
+
// ensure that the slot-name attr is correct
|
1746
|
+
node['s-sn'] = node['s-sn'] || slotName;
|
1747
|
+
if (relocateNodeData) {
|
1748
|
+
relocateNodeData.$nodeToRelocate$['s-sh'] = childNode['s-hn'];
|
1749
|
+
// we marked this node for relocation previously but didn't find
|
1750
|
+
// out the slot reference node to which it needs to be relocated
|
1751
|
+
// so write it down now!
|
1752
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
1753
|
+
}
|
1754
|
+
else {
|
1755
|
+
node['s-sh'] = childNode['s-hn'];
|
1756
|
+
// add to our list of nodes to relocate
|
1757
|
+
relocateNodes.push({
|
1758
|
+
$slotRefNode$: childNode,
|
1759
|
+
$nodeToRelocate$: node,
|
1760
|
+
});
|
1761
|
+
}
|
1762
|
+
if (node['s-sr']) {
|
1763
|
+
relocateNodes.map((relocateNode) => {
|
1764
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
1765
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
1766
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
1767
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
1768
|
+
}
|
1769
|
+
}
|
1770
|
+
});
|
1771
|
+
}
|
1772
|
+
}
|
1773
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
1774
|
+
// the node is not found within the slot (`childNode`) that we're
|
1775
|
+
// currently looking at, so we stick it into `relocateNodes` to
|
1776
|
+
// handle later. If we never find a home for this element then
|
1777
|
+
// we'll need to hide it
|
1778
|
+
relocateNodes.push({
|
1779
|
+
$nodeToRelocate$: node,
|
1780
|
+
});
|
1781
|
+
}
|
1782
|
+
}
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
// if we're dealing with any type of element (capable of itself being a
|
1786
|
+
// slot reference or containing one) then we recur
|
1787
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1788
|
+
markSlotContentForRelocation(childNode);
|
1789
|
+
}
|
1790
|
+
}
|
1791
|
+
};
|
1792
|
+
/**
|
1793
|
+
* Check whether a node is located in a given named slot.
|
1794
|
+
*
|
1795
|
+
* @param nodeToRelocate the node of interest
|
1796
|
+
* @param slotName the slot name to check
|
1797
|
+
* @returns whether the node is located in the slot or not
|
1798
|
+
*/
|
1799
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
|
1800
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1801
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
|
1802
|
+
// if the node doesn't have a slot attribute, and the slot we're checking
|
1803
|
+
// is not a named slot, then we assume the node should be within the slot
|
1804
|
+
return true;
|
1805
|
+
}
|
1806
|
+
if (nodeToRelocate.getAttribute('slot') === slotName) {
|
1807
|
+
return true;
|
1808
|
+
}
|
1809
|
+
return false;
|
1810
|
+
}
|
1811
|
+
if (nodeToRelocate['s-sn'] === slotName) {
|
1812
|
+
return true;
|
1813
|
+
}
|
1814
|
+
return slotName === '';
|
1815
|
+
};
|
1816
|
+
/**
|
1817
|
+
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
|
1818
|
+
* them with `null`. This signals that the DOM element corresponding to the VDom
|
1819
|
+
* node has been removed from the DOM.
|
1820
|
+
*
|
1821
|
+
* @param vNode a virtual DOM node
|
1822
|
+
*/
|
1823
|
+
const nullifyVNodeRefs = (vNode) => {
|
1824
|
+
if (BUILD.vdomRef) {
|
1825
|
+
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
1826
|
+
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
1827
|
+
}
|
1828
|
+
};
|
1829
|
+
/**
|
1830
|
+
* The main entry point for Stencil's virtual DOM-based rendering engine
|
1831
|
+
*
|
1832
|
+
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
1833
|
+
* function will handle creating a virtual DOM tree with a single root, patching
|
1834
|
+
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
1835
|
+
* relocation, and reflecting attributes.
|
1836
|
+
*
|
1837
|
+
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
1838
|
+
* the DOM node into which it should be rendered.
|
1839
|
+
* @param renderFnResults the virtual DOM nodes to be rendered
|
1840
|
+
* @param isInitialLoad whether or not this is the first call after page load
|
1841
|
+
*/
|
1842
|
+
const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
1843
|
+
var _a, _b, _c, _d, _e;
|
1844
|
+
const hostElm = hostRef.$hostElement$;
|
1845
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
1846
|
+
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
1847
|
+
// if `renderFnResults` is a Host node then we can use it directly. If not,
|
1848
|
+
// we need to call `h` again to wrap the children of our component in a
|
1849
|
+
// 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
|
1850
|
+
// implicitly that the top-level vdom node is 1) an only child and 2)
|
1851
|
+
// contains attrs that need to be set on the host element.
|
1852
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
1853
|
+
hostTagName = hostElm.tagName;
|
1854
|
+
// <Host> runtime check
|
1855
|
+
if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
1856
|
+
throw new Error(`The <Host> must be the single root component.
|
1857
|
+
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
1858
|
+
|
1859
|
+
The render() function should look like this instead:
|
1860
|
+
|
1861
|
+
render() {
|
1862
|
+
// Do not return an array
|
1863
|
+
return (
|
1864
|
+
<Host>{content}</Host>
|
1865
|
+
);
|
1866
|
+
}
|
1867
|
+
`);
|
1868
|
+
}
|
1869
|
+
if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
|
1870
|
+
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
1871
|
+
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
1872
|
+
}
|
1873
|
+
// On the first render and *only* on the first render we want to check for
|
1874
|
+
// any attributes set on the host element which are also set on the vdom
|
1875
|
+
// node. If we find them, we override the value on the VDom node attrs with
|
1876
|
+
// the value from the host element, which allows developers building apps
|
1877
|
+
// with Stencil components to override e.g. the `role` attribute on a
|
1878
|
+
// component even if it's already set on the `Host`.
|
1879
|
+
if (isInitialLoad && rootVnode.$attrs$) {
|
1880
|
+
for (const key of Object.keys(rootVnode.$attrs$)) {
|
1881
|
+
// We have a special implementation in `setAccessor` for `style` and
|
1882
|
+
// `class` which reconciles values coming from the VDom with values
|
1883
|
+
// already present on the DOM element, so we don't want to override those
|
1884
|
+
// attributes on the VDom tree with values from the host element if they
|
1885
|
+
// are present.
|
1886
|
+
//
|
1887
|
+
// Likewise, `ref` and `key` are special internal values for the Stencil
|
1888
|
+
// runtime and we don't want to override those either.
|
1889
|
+
if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
|
1890
|
+
rootVnode.$attrs$[key] = hostElm[key];
|
1891
|
+
}
|
1892
|
+
}
|
1893
|
+
}
|
1894
|
+
rootVnode.$tag$ = null;
|
1895
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
1896
|
+
hostRef.$vnode$ = rootVnode;
|
1897
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm);
|
1898
|
+
if (BUILD.scoped || BUILD.shadowDom) {
|
1899
|
+
scopeId = hostElm['s-sc'];
|
1900
|
+
}
|
1901
|
+
if (BUILD.slotRelocation) {
|
1902
|
+
contentRef = hostElm['s-cr'];
|
1903
|
+
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
1904
|
+
// always reset
|
1905
|
+
checkSlotFallbackVisibility = false;
|
1906
|
+
}
|
1907
|
+
// synchronous patch
|
1908
|
+
patch(oldVNode, rootVnode, isInitialLoad);
|
1909
|
+
if (BUILD.slotRelocation) {
|
1910
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
1911
|
+
// the disconnectCallback from working
|
1912
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
1913
|
+
if (checkSlotRelocate) {
|
1914
|
+
markSlotContentForRelocation(rootVnode.$elm$);
|
1915
|
+
for (const relocateData of relocateNodes) {
|
1916
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
1917
|
+
if (!nodeToRelocate['s-ol']) {
|
1918
|
+
// add a reference node marking this node's original location
|
1919
|
+
// keep a reference to this node for later lookups
|
1920
|
+
const orgLocationNode = BUILD.isDebug || BUILD.hydrateServerSide
|
1921
|
+
? originalLocationDebugNode(nodeToRelocate)
|
1922
|
+
: doc.createTextNode('');
|
1923
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
1924
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
1925
|
+
}
|
1926
|
+
}
|
1927
|
+
for (const relocateData of relocateNodes) {
|
1928
|
+
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
1929
|
+
const slotRefNode = relocateData.$slotRefNode$;
|
1930
|
+
if (slotRefNode) {
|
1931
|
+
const parentNodeRef = slotRefNode.parentNode;
|
1932
|
+
// When determining where to insert content, the most simple case would be
|
1933
|
+
// to relocate the node immediately following the slot reference node. We do this
|
1934
|
+
// by getting a reference to the node immediately following the slot reference node
|
1935
|
+
// since we will use `insertBefore` to manipulate the DOM.
|
1936
|
+
//
|
1937
|
+
// If there is no node immediately following the slot reference node, then we will just
|
1938
|
+
// end up appending the node as the last child of the parent.
|
1939
|
+
let insertBeforeNode = slotRefNode.nextSibling;
|
1940
|
+
// If the node we're currently planning on inserting the new node before is an element,
|
1941
|
+
// we need to do some additional checks to make sure we're inserting the node in the correct order.
|
1942
|
+
// The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
|
1943
|
+
// to make sure they get inserted into their new how in the same order they were declared in their original location.
|
1944
|
+
//
|
1945
|
+
// TODO(STENCIL-914): Remove `experimentalSlotFixes` check
|
1946
|
+
if (!BUILD.experimentalSlotFixes ||
|
1947
|
+
(insertBeforeNode && insertBeforeNode.nodeType === 1 /* NODE_TYPE.ElementNode */)) {
|
1948
|
+
let orgLocationNode = (_a = nodeToRelocate['s-ol']) === null || _a === void 0 ? void 0 : _a.previousSibling;
|
1949
|
+
while (orgLocationNode) {
|
1950
|
+
let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
|
1951
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
1952
|
+
refNode = refNode.nextSibling;
|
1953
|
+
if (!refNode || !refNode['s-nr']) {
|
1954
|
+
insertBeforeNode = refNode;
|
1955
|
+
break;
|
1956
|
+
}
|
1957
|
+
}
|
1958
|
+
orgLocationNode = orgLocationNode.previousSibling;
|
1959
|
+
}
|
1960
|
+
}
|
1961
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
1962
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
1963
|
+
// we've checked that it's worth while to relocate
|
1964
|
+
// since that the node to relocate
|
1965
|
+
// has a different next sibling or parent relocated
|
1966
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
1967
|
+
if (!BUILD.experimentalSlotFixes && !nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
1968
|
+
// probably a component in the index.html that doesn't have its hostname set
|
1969
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
1970
|
+
}
|
1971
|
+
// Handle a use-case where we relocate a slot where
|
1972
|
+
// the slot name changes along the way (for instance, a default to a named slot).
|
1973
|
+
// In this case, we need to update the relocated node's slot attribute to match
|
1974
|
+
// the slot name it is being relocated into.
|
1975
|
+
//
|
1976
|
+
// There is a very niche use case where we may be relocating a text node. For now,
|
1977
|
+
// we ignore anything that is not an element node since non-element nodes cannot have
|
1978
|
+
// attributes to specify the slot. We'll deal with this if it becomes a problem... but super edge-case-y
|
1979
|
+
if (BUILD.experimentalSlotFixes &&
|
1980
|
+
nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
1981
|
+
slotRefNode['s-fs'] !== nodeToRelocate.getAttribute('slot')) {
|
1982
|
+
if (!slotRefNode['s-fs']) {
|
1983
|
+
nodeToRelocate.removeAttribute('slot');
|
1984
|
+
}
|
1985
|
+
else {
|
1986
|
+
nodeToRelocate.setAttribute('slot', slotRefNode['s-fs']);
|
1987
|
+
}
|
1988
|
+
}
|
1989
|
+
// Add it back to the dom but in its new home
|
1990
|
+
// If we get to this point and `insertBeforeNode` is `null`, that means
|
1991
|
+
// we're just going to append the node as the last child of the parent. Passing
|
1992
|
+
// `null` as the second arg here will trigger that behavior.
|
1993
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
1994
|
+
// Reset the `hidden` value back to what it was defined as originally
|
1995
|
+
// This solves a problem where a `slot` is dynamically rendered and `hidden` may have
|
1996
|
+
// been set on content originally, but now it has a slot to go to so it should have
|
1997
|
+
// the value it was defined as having in the DOM, not what we overrode it to.
|
1998
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
1999
|
+
nodeToRelocate.hidden = (_c = nodeToRelocate['s-ih']) !== null && _c !== void 0 ? _c : false;
|
2000
|
+
}
|
2001
|
+
}
|
2002
|
+
}
|
2003
|
+
}
|
2004
|
+
else {
|
2005
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
2006
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
2007
|
+
// Store the initial value of `hidden` so we can reset it later when
|
2008
|
+
// moving nodes around.
|
2009
|
+
if (isInitialLoad) {
|
2010
|
+
nodeToRelocate['s-ih'] = (_d = nodeToRelocate.hidden) !== null && _d !== void 0 ? _d : false;
|
2011
|
+
}
|
2012
|
+
nodeToRelocate.hidden = true;
|
2013
|
+
}
|
2014
|
+
}
|
2015
|
+
}
|
2016
|
+
}
|
2017
|
+
if (checkSlotFallbackVisibility) {
|
2018
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
2019
|
+
}
|
2020
|
+
// done moving nodes around
|
2021
|
+
// allow the disconnect callback to work again
|
2022
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
2023
|
+
// always reset
|
2024
|
+
relocateNodes.length = 0;
|
2025
|
+
}
|
2026
|
+
// Hide any elements that were projected through, but don't have a slot to go to.
|
2027
|
+
// Only an issue if there were no "slots" rendered. Otherwise, nodes are hidden correctly.
|
2028
|
+
// This _only_ happens for `scoped` components!
|
2029
|
+
if (BUILD.experimentalSlotFixes && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
2030
|
+
for (const childNode of rootVnode.$elm$.childNodes) {
|
2031
|
+
if (childNode['s-hn'] !== hostTagName && !childNode['s-sh']) {
|
2032
|
+
// Store the initial value of `hidden` so we can reset it later when
|
2033
|
+
// moving nodes around.
|
2034
|
+
if (isInitialLoad && childNode['s-ih'] == null) {
|
2035
|
+
childNode['s-ih'] = (_e = childNode.hidden) !== null && _e !== void 0 ? _e : false;
|
2036
|
+
}
|
2037
|
+
childNode.hidden = true;
|
2038
|
+
}
|
2039
|
+
}
|
2040
|
+
}
|
2041
|
+
};
|
2042
|
+
// slot comment debug nodes only created with the `--debug` flag
|
2043
|
+
// otherwise these nodes are text nodes w/out content
|
2044
|
+
const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
|
2045
|
+
const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
|
2046
|
+
(nodeToRelocate.localName
|
2047
|
+
? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
|
2048
|
+
: `[${nodeToRelocate.textContent}]`));
|
2049
|
+
const attachToAncestor = (hostRef, ancestorComponent) => {
|
2050
|
+
if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
2051
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
2052
|
+
}
|
2053
|
+
};
|
2054
|
+
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
2055
|
+
if (BUILD.taskQueue && BUILD.updatable) {
|
2056
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
2057
|
+
}
|
2058
|
+
if (BUILD.asyncLoading && hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
2059
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
2060
|
+
return;
|
2061
|
+
}
|
2062
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
2063
|
+
// there is no ancestor component or the ancestor component
|
2064
|
+
// has already fired off its lifecycle update then
|
2065
|
+
// fire off the initial update
|
2066
|
+
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
2067
|
+
return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
|
2068
|
+
};
|
2069
|
+
/**
|
2070
|
+
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
2071
|
+
* component lifecycle methods like `componentWillLoad` as well as
|
2072
|
+
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
2073
|
+
*
|
2074
|
+
* @param hostRef a reference to a host DOM node
|
2075
|
+
* @param isInitialLoad whether we're on the initial load or not
|
2076
|
+
* @returns an empty Promise which is used to enqueue a series of operations for
|
2077
|
+
* the component
|
2078
|
+
*/
|
2079
|
+
const dispatchHooks = (hostRef, isInitialLoad) => {
|
2080
|
+
const elm = hostRef.$hostElement$;
|
2081
|
+
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
2082
|
+
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
2083
|
+
// We're going to use this variable together with `enqueue` to implement a
|
2084
|
+
// little promise-based queue. We start out with it `undefined`. When we add
|
2085
|
+
// the first function to the queue we'll set this variable to be that
|
2086
|
+
// function's return value. When we attempt to add subsequent values to the
|
2087
|
+
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
2088
|
+
// the new function off of that `Promise` using `.then()`. This will give our
|
2089
|
+
// queue two nice properties:
|
2090
|
+
//
|
2091
|
+
// 1. If all functions added to the queue are synchronous they'll be called
|
2092
|
+
// synchronously right away.
|
2093
|
+
// 2. If all functions added to the queue are asynchronous they'll all be
|
2094
|
+
// called in order after `dispatchHooks` exits.
|
2095
|
+
let maybePromise;
|
2096
|
+
if (isInitialLoad) {
|
2097
|
+
if (BUILD.lazyLoad && BUILD.hostListener) {
|
2098
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
2099
|
+
if (hostRef.$queuedListeners$) {
|
2100
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
2101
|
+
hostRef.$queuedListeners$ = undefined;
|
2102
|
+
}
|
2103
|
+
}
|
2104
|
+
emitLifecycleEvent(elm, 'componentWillLoad');
|
2105
|
+
if (BUILD.cmpWillLoad) {
|
2106
|
+
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
2107
|
+
// whatever's going on in that `Promise` before we launch into
|
2108
|
+
// rendering the component, doing other lifecycle stuff, etc. So
|
2109
|
+
// in that case we assign the returned promise to the variable we
|
2110
|
+
// declared above to hold a possible 'queueing' Promise
|
2111
|
+
maybePromise = safeCall(instance, 'componentWillLoad');
|
2112
|
+
}
|
2113
|
+
}
|
2114
|
+
else {
|
2115
|
+
emitLifecycleEvent(elm, 'componentWillUpdate');
|
2116
|
+
if (BUILD.cmpWillUpdate) {
|
2117
|
+
// Like `componentWillLoad` above, we allow Stencil component
|
2118
|
+
// authors to return a `Promise` from this lifecycle callback, and
|
2119
|
+
// we specify that our runtime will wait for that `Promise` to
|
2120
|
+
// resolve before the component re-renders. So if the method
|
2121
|
+
// returns a `Promise` we need to keep it around!
|
2122
|
+
maybePromise = safeCall(instance, 'componentWillUpdate');
|
2123
|
+
}
|
2124
|
+
}
|
2125
|
+
emitLifecycleEvent(elm, 'componentWillRender');
|
2126
|
+
if (BUILD.cmpWillRender) {
|
2127
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, 'componentWillRender'));
|
2128
|
+
}
|
2129
|
+
endSchedule();
|
2130
|
+
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
2131
|
+
};
|
2132
|
+
/**
|
2133
|
+
* This function uses a Promise to implement a simple first-in, first-out queue
|
2134
|
+
* of functions to be called.
|
2135
|
+
*
|
2136
|
+
* The queue is ordered on the basis of the first argument. If it's
|
2137
|
+
* `undefined`, then nothing is on the queue yet, so the provided function can
|
2138
|
+
* be called synchronously (although note that this function may return a
|
2139
|
+
* `Promise`). The idea is that then the return value of that enqueueing
|
2140
|
+
* operation is kept around, so that if it was a `Promise` then subsequent
|
2141
|
+
* functions can be enqueued by calling this function again with that `Promise`
|
2142
|
+
* as the first argument.
|
2143
|
+
*
|
2144
|
+
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
2145
|
+
* @param fn a function to enqueue
|
2146
|
+
* @returns either a `Promise` or the return value of the provided function
|
2147
|
+
*/
|
2148
|
+
const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
|
2149
|
+
/**
|
2150
|
+
* Check that a value is a `Promise`. To check, we first see if the value is an
|
2151
|
+
* instance of the `Promise` global. In a few circumstances, in particular if
|
2152
|
+
* the global has been overwritten, this is could be misleading, so we also do
|
2153
|
+
* a little 'duck typing' check to see if the `.then` property of the value is
|
2154
|
+
* defined and a function.
|
2155
|
+
*
|
2156
|
+
* @param maybePromise it might be a promise!
|
2157
|
+
* @returns whether it is or not
|
2158
|
+
*/
|
2159
|
+
const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
|
2160
|
+
(maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
|
2161
|
+
/**
|
2162
|
+
* Update a component given reference to its host elements and so on.
|
2163
|
+
*
|
2164
|
+
* @param hostRef an object containing references to the element's host node,
|
2165
|
+
* VDom nodes, and other metadata
|
2166
|
+
* @param instance a reference to the underlying host element where it will be
|
2167
|
+
* rendered
|
2168
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
2169
|
+
* the first render cycle
|
2170
|
+
*/
|
2171
|
+
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
2172
|
+
var _a;
|
2173
|
+
const elm = hostRef.$hostElement$;
|
2174
|
+
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
2175
|
+
const rc = elm['s-rc'];
|
2176
|
+
if (BUILD.style && isInitialLoad) {
|
2177
|
+
// DOM WRITE!
|
2178
|
+
attachStyles(hostRef);
|
2179
|
+
}
|
2180
|
+
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
2181
|
+
if (BUILD.isDev) {
|
2182
|
+
hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
|
2183
|
+
}
|
2184
|
+
if (BUILD.hydrateServerSide) {
|
2185
|
+
await callRender(hostRef, instance, elm, isInitialLoad);
|
2186
|
+
}
|
2187
|
+
else {
|
2188
|
+
callRender(hostRef, instance, elm, isInitialLoad);
|
2189
|
+
}
|
2190
|
+
if (BUILD.isDev) {
|
2191
|
+
hostRef.$renderCount$ = hostRef.$renderCount$ === undefined ? 1 : hostRef.$renderCount$ + 1;
|
2192
|
+
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
2193
|
+
}
|
2194
|
+
if (BUILD.hydrateServerSide) {
|
2195
|
+
try {
|
2196
|
+
// manually connected child components during server-side hydrate
|
2197
|
+
serverSideConnected(elm);
|
2198
|
+
if (isInitialLoad) {
|
2199
|
+
// using only during server-side hydrate
|
2200
|
+
if (hostRef.$cmpMeta$.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
2201
|
+
elm['s-en'] = '';
|
2202
|
+
}
|
2203
|
+
else if (hostRef.$cmpMeta$.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
2204
|
+
elm['s-en'] = 'c';
|
2205
|
+
}
|
2206
|
+
}
|
2207
|
+
}
|
2208
|
+
catch (e) {
|
2209
|
+
consoleError(e, elm);
|
2210
|
+
}
|
2211
|
+
}
|
2212
|
+
if (BUILD.asyncLoading && rc) {
|
2213
|
+
// ok, so turns out there are some child host elements
|
2214
|
+
// waiting on this parent element to load
|
2215
|
+
// let's fire off all update callbacks waiting
|
2216
|
+
rc.map((cb) => cb());
|
2217
|
+
elm['s-rc'] = undefined;
|
2218
|
+
}
|
2219
|
+
endRender();
|
2220
|
+
endUpdate();
|
2221
|
+
if (BUILD.asyncLoading) {
|
2222
|
+
const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
|
2223
|
+
const postUpdate = () => postUpdateComponent(hostRef);
|
2224
|
+
if (childrenPromises.length === 0) {
|
2225
|
+
postUpdate();
|
2226
|
+
}
|
2227
|
+
else {
|
2228
|
+
Promise.all(childrenPromises).then(postUpdate);
|
2229
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
2230
|
+
childrenPromises.length = 0;
|
2231
|
+
}
|
2232
|
+
}
|
2233
|
+
else {
|
2234
|
+
postUpdateComponent(hostRef);
|
2235
|
+
}
|
2236
|
+
};
|
2237
|
+
/**
|
2238
|
+
* Handle making the call to the VDom renderer with the proper context given
|
2239
|
+
* various build variables
|
2240
|
+
*
|
2241
|
+
* @param hostRef an object containing references to the element's host node,
|
2242
|
+
* VDom nodes, and other metadata
|
2243
|
+
* @param instance a reference to the underlying host element where it will be
|
2244
|
+
* rendered
|
2245
|
+
* @param elm the Host element for the component
|
2246
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
2247
|
+
* @returns an empty promise
|
2248
|
+
*/
|
2249
|
+
const callRender = (hostRef, instance, elm, isInitialLoad) => {
|
2250
|
+
// in order for bundlers to correctly tree-shake the BUILD object
|
2251
|
+
// we need to ensure BUILD is not deoptimized within a try/catch
|
2252
|
+
// https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
|
2253
|
+
const allRenderFn = BUILD.allRenderFn ? true : false;
|
2254
|
+
const lazyLoad = BUILD.lazyLoad ? true : false;
|
2255
|
+
const taskQueue = BUILD.taskQueue ? true : false;
|
2256
|
+
const updatable = BUILD.updatable ? true : false;
|
2257
|
+
try {
|
2258
|
+
renderingRef = instance;
|
2259
|
+
/**
|
2260
|
+
* minification optimization: `allRenderFn` is `true` if all components have a `render`
|
2261
|
+
* method, so we can call the method immediately. If not, check before calling it.
|
2262
|
+
*/
|
2263
|
+
instance = allRenderFn ? instance.render() : instance.render && instance.render();
|
2264
|
+
if (updatable && taskQueue) {
|
2265
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
2266
|
+
}
|
2267
|
+
if (updatable || lazyLoad) {
|
2268
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
2269
|
+
}
|
2270
|
+
if (BUILD.hasRenderFn || BUILD.reflect) {
|
2271
|
+
if (BUILD.vdomRender || BUILD.reflect) {
|
2272
|
+
// looks like we've got child nodes to render into this host element
|
2273
|
+
// or we need to update the css class/attrs on the host element
|
2274
|
+
// DOM WRITE!
|
2275
|
+
if (BUILD.hydrateServerSide) {
|
2276
|
+
return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
|
2277
|
+
}
|
2278
|
+
else {
|
2279
|
+
renderVdom(hostRef, instance, isInitialLoad);
|
2280
|
+
}
|
2281
|
+
}
|
2282
|
+
else {
|
2283
|
+
const shadowRoot = elm.shadowRoot;
|
2284
|
+
if (hostRef.$cmpMeta$.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
2285
|
+
shadowRoot.textContent = instance;
|
2286
|
+
}
|
2287
|
+
else {
|
2288
|
+
elm.textContent = instance;
|
2289
|
+
}
|
2290
|
+
}
|
2291
|
+
}
|
2292
|
+
}
|
2293
|
+
catch (e) {
|
2294
|
+
consoleError(e, hostRef.$hostElement$);
|
2295
|
+
}
|
2296
|
+
renderingRef = null;
|
2297
|
+
return null;
|
2298
|
+
};
|
2299
|
+
const getRenderingRef = () => renderingRef;
|
2300
|
+
const postUpdateComponent = (hostRef) => {
|
2301
|
+
const tagName = hostRef.$cmpMeta$.$tagName$;
|
2302
|
+
const elm = hostRef.$hostElement$;
|
2303
|
+
const endPostUpdate = createTime('postUpdate', tagName);
|
2304
|
+
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
2305
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
2306
|
+
if (BUILD.cmpDidRender) {
|
2307
|
+
if (BUILD.isDev) {
|
2308
|
+
hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
|
2309
|
+
}
|
2310
|
+
safeCall(instance, 'componentDidRender');
|
2311
|
+
if (BUILD.isDev) {
|
2312
|
+
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
2313
|
+
}
|
2314
|
+
}
|
2315
|
+
emitLifecycleEvent(elm, 'componentDidRender');
|
2316
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
2317
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
2318
|
+
if (BUILD.asyncLoading && BUILD.cssAnnotations) {
|
2319
|
+
// DOM WRITE!
|
2320
|
+
addHydratedFlag(elm);
|
2321
|
+
}
|
2322
|
+
if (BUILD.cmpDidLoad) {
|
2323
|
+
if (BUILD.isDev) {
|
2324
|
+
hostRef.$flags$ |= 2048 /* HOST_FLAGS.devOnDidLoad */;
|
2325
|
+
}
|
2326
|
+
safeCall(instance, 'componentDidLoad');
|
2327
|
+
if (BUILD.isDev) {
|
2328
|
+
hostRef.$flags$ &= ~2048 /* HOST_FLAGS.devOnDidLoad */;
|
2329
|
+
}
|
2330
|
+
}
|
2331
|
+
emitLifecycleEvent(elm, 'componentDidLoad');
|
2332
|
+
endPostUpdate();
|
2333
|
+
if (BUILD.asyncLoading) {
|
2334
|
+
hostRef.$onReadyResolve$(elm);
|
2335
|
+
if (!ancestorComponent) {
|
2336
|
+
appDidLoad(tagName);
|
2337
|
+
}
|
2338
|
+
}
|
2339
|
+
}
|
2340
|
+
else {
|
2341
|
+
if (BUILD.cmpDidUpdate) {
|
2342
|
+
// we've already loaded this component
|
2343
|
+
// fire off the user's componentDidUpdate method (if one was provided)
|
2344
|
+
// componentDidUpdate runs AFTER render() has been called
|
2345
|
+
// and all child components have finished updating
|
2346
|
+
if (BUILD.isDev) {
|
2347
|
+
hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
|
2348
|
+
}
|
2349
|
+
safeCall(instance, 'componentDidUpdate');
|
2350
|
+
if (BUILD.isDev) {
|
2351
|
+
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
2352
|
+
}
|
2353
|
+
}
|
2354
|
+
emitLifecycleEvent(elm, 'componentDidUpdate');
|
2355
|
+
endPostUpdate();
|
2356
|
+
}
|
2357
|
+
if (BUILD.method && BUILD.lazyLoad) {
|
2358
|
+
hostRef.$onInstanceResolve$(elm);
|
2359
|
+
}
|
2360
|
+
// load events fire from bottom to top
|
2361
|
+
// the deepest elements load first then bubbles up
|
2362
|
+
if (BUILD.asyncLoading) {
|
2363
|
+
if (hostRef.$onRenderResolve$) {
|
2364
|
+
hostRef.$onRenderResolve$();
|
2365
|
+
hostRef.$onRenderResolve$ = undefined;
|
2366
|
+
}
|
2367
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
2368
|
+
nextTick(() => scheduleUpdate(hostRef, false));
|
2369
|
+
}
|
2370
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
2371
|
+
}
|
2372
|
+
// ( •_•)
|
2373
|
+
// ( •_•)>⌐■-■
|
2374
|
+
// (⌐■_■)
|
2375
|
+
};
|
2376
|
+
const forceUpdate = (ref) => {
|
2377
|
+
if (BUILD.updatable && (Build.isBrowser || Build.isTesting)) {
|
2378
|
+
const hostRef = getHostRef(ref);
|
2379
|
+
const isConnected = hostRef.$hostElement$.isConnected;
|
2380
|
+
if (isConnected &&
|
2381
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
2382
|
+
scheduleUpdate(hostRef, false);
|
2383
|
+
}
|
2384
|
+
// Returns "true" when the forced update was successfully scheduled
|
2385
|
+
return isConnected;
|
2386
|
+
}
|
2387
|
+
return false;
|
2388
|
+
};
|
2389
|
+
const appDidLoad = (who) => {
|
2390
|
+
// on appload
|
2391
|
+
// we have finish the first big initial render
|
2392
|
+
if (BUILD.cssAnnotations) {
|
2393
|
+
addHydratedFlag(doc.documentElement);
|
2394
|
+
}
|
2395
|
+
if (BUILD.asyncQueue) {
|
2396
|
+
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
2397
|
+
}
|
2398
|
+
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
2399
|
+
if (BUILD.profile && performance.measure) {
|
2400
|
+
performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
|
2401
|
+
}
|
2402
|
+
};
|
2403
|
+
/**
|
2404
|
+
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
2405
|
+
* e.g. custom element node. If a build figures out that e.g. no component
|
2406
|
+
* has a `componentDidLoad` method, the instance method gets removed from the
|
2407
|
+
* output bundle and this function returns `undefined`.
|
2408
|
+
* @param instance any object that may or may not contain methods
|
2409
|
+
* @param method method name
|
2410
|
+
* @param arg single arbitrary argument
|
2411
|
+
* @returns result of method call if it exists, otherwise `undefined`
|
2412
|
+
*/
|
2413
|
+
const safeCall = (instance, method, arg) => {
|
2414
|
+
if (instance && instance[method]) {
|
2415
|
+
try {
|
2416
|
+
return instance[method](arg);
|
2417
|
+
}
|
2418
|
+
catch (e) {
|
2419
|
+
consoleError(e);
|
2420
|
+
}
|
2421
|
+
}
|
2422
|
+
return undefined;
|
2423
|
+
};
|
2424
|
+
/**
|
2425
|
+
* For debugging purposes as `BUILD.lifecycleDOMEvents` is `false` by default and will
|
2426
|
+
* get removed by the compiler. Used for timing events to see how long they take.
|
2427
|
+
* @param elm the target of the Event
|
2428
|
+
* @param lifecycleName name of the event
|
2429
|
+
*/
|
2430
|
+
const emitLifecycleEvent = (elm, lifecycleName) => {
|
2431
|
+
if (BUILD.lifecycleDOMEvents) {
|
2432
|
+
emitEvent(elm, 'stencil_' + lifecycleName, {
|
2433
|
+
bubbles: true,
|
2434
|
+
composed: true,
|
2435
|
+
detail: {
|
2436
|
+
namespace: NAMESPACE,
|
2437
|
+
},
|
2438
|
+
});
|
2439
|
+
}
|
2440
|
+
};
|
2441
|
+
const addHydratedFlag = (elm) => BUILD.hydratedClass
|
2442
|
+
? elm.classList.add('hydrated')
|
2443
|
+
: BUILD.hydratedAttribute
|
2444
|
+
? elm.setAttribute('hydrated', '')
|
2445
|
+
: undefined;
|
2446
|
+
const serverSideConnected = (elm) => {
|
2447
|
+
const children = elm.children;
|
2448
|
+
if (children != null) {
|
2449
|
+
for (let i = 0, ii = children.length; i < ii; i++) {
|
2450
|
+
const childElm = children[i];
|
2451
|
+
if (typeof childElm.connectedCallback === 'function') {
|
2452
|
+
childElm.connectedCallback();
|
2453
|
+
}
|
2454
|
+
serverSideConnected(childElm);
|
2455
|
+
}
|
2456
|
+
}
|
2457
|
+
};
|
2458
|
+
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
2459
|
+
const setValue = (ref, propName, newVal, cmpMeta) => {
|
2460
|
+
// check our new property value against our internal value
|
2461
|
+
const hostRef = getHostRef(ref);
|
2462
|
+
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
2463
|
+
const oldVal = hostRef.$instanceValues$.get(propName);
|
2464
|
+
const flags = hostRef.$flags$;
|
2465
|
+
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
2466
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
2467
|
+
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
2468
|
+
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
2469
|
+
const didValueChange = newVal !== oldVal && !areBothNaN;
|
2470
|
+
if ((!BUILD.lazyLoad || !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
2471
|
+
// gadzooks! the property's value has changed!!
|
2472
|
+
// set our new value!
|
2473
|
+
hostRef.$instanceValues$.set(propName, newVal);
|
2474
|
+
if (BUILD.isDev) {
|
2475
|
+
if (hostRef.$flags$ & 1024 /* HOST_FLAGS.devOnRender */) {
|
2476
|
+
consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
|
2477
|
+
}
|
2478
|
+
else if (hostRef.$flags$ & 2048 /* HOST_FLAGS.devOnDidLoad */) {
|
2479
|
+
consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
|
2480
|
+
}
|
2481
|
+
}
|
2482
|
+
if (!BUILD.lazyLoad || instance) {
|
2483
|
+
// get an array of method names of watch functions to call
|
2484
|
+
if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
2485
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
2486
|
+
if (watchMethods) {
|
2487
|
+
// this instance is watching for when this property changed
|
2488
|
+
watchMethods.map((watchMethodName) => {
|
2489
|
+
try {
|
2490
|
+
// fire off each of the watch methods that are watching this property
|
2491
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
2492
|
+
}
|
2493
|
+
catch (e) {
|
2494
|
+
consoleError(e, elm);
|
2495
|
+
}
|
2496
|
+
});
|
2497
|
+
}
|
2498
|
+
}
|
2499
|
+
if (BUILD.updatable &&
|
2500
|
+
(flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
2501
|
+
if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
|
2502
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
2503
|
+
return;
|
2504
|
+
}
|
2505
|
+
}
|
2506
|
+
// looks like this value actually changed, so we've got work to do!
|
2507
|
+
// but only if we've already rendered, otherwise just chill out
|
2508
|
+
// queue that we need to do an update, but don't worry about queuing
|
2509
|
+
// up millions cuz this function ensures it only runs once
|
2510
|
+
scheduleUpdate(hostRef, false);
|
2511
|
+
}
|
2512
|
+
}
|
2513
|
+
}
|
2514
|
+
};
|
2515
|
+
/**
|
2516
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
2517
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
2518
|
+
* decorators, callbacks for when attributes change, and so on.
|
2519
|
+
*
|
2520
|
+
* @param Cstr the constructor for a component that we need to process
|
2521
|
+
* @param cmpMeta metadata collected previously about the component
|
2522
|
+
* @param flags a number used to store a series of bit flags
|
2523
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
2524
|
+
*/
|
2525
|
+
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
2526
|
+
var _a;
|
2527
|
+
const prototype = Cstr.prototype;
|
2528
|
+
/**
|
2529
|
+
* proxy form associated custom element lifecycle callbacks
|
2530
|
+
* @ref https://web.dev/articles/more-capable-form-controls#lifecycle_callbacks
|
2531
|
+
*/
|
2532
|
+
if (BUILD.formAssociated && cmpMeta.$flags$ & 64 /* CMP_FLAGS.formAssociated */ && flags & 1 /* PROXY_FLAGS.isElementConstructor */) {
|
2533
|
+
FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => Object.defineProperty(prototype, cbName, {
|
2534
|
+
value(...args) {
|
2535
|
+
const hostRef = getHostRef(this);
|
2536
|
+
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : this;
|
2537
|
+
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
2538
|
+
if (!instance) {
|
2539
|
+
hostRef.$onReadyPromise$.then((instance) => {
|
2540
|
+
const cb = instance[cbName];
|
2541
|
+
typeof cb === 'function' && cb.call(instance, ...args);
|
2542
|
+
});
|
2543
|
+
}
|
2544
|
+
else {
|
2545
|
+
const cb = instance[cbName];
|
2546
|
+
typeof cb === 'function' && cb.call(instance, ...args);
|
2547
|
+
}
|
2548
|
+
},
|
2549
|
+
}));
|
2550
|
+
}
|
2551
|
+
if (BUILD.member && cmpMeta.$members$) {
|
2552
|
+
if (BUILD.watchCallback && Cstr.watchers) {
|
2553
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
2554
|
+
}
|
2555
|
+
// It's better to have a const than two Object.entries()
|
2556
|
+
const members = Object.entries(cmpMeta.$members$);
|
2557
|
+
members.map(([memberName, [memberFlags]]) => {
|
2558
|
+
if ((BUILD.prop || BUILD.state) &&
|
2559
|
+
(memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
2560
|
+
((!BUILD.lazyLoad || flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
2561
|
+
// proxyComponent - prop
|
2562
|
+
Object.defineProperty(prototype, memberName, {
|
2563
|
+
get() {
|
2564
|
+
// proxyComponent, get value
|
2565
|
+
return getValue(this, memberName);
|
2566
|
+
},
|
2567
|
+
set(newValue) {
|
2568
|
+
// only during dev time
|
2569
|
+
if (BUILD.isDev) {
|
2570
|
+
const ref = getHostRef(this);
|
2571
|
+
if (
|
2572
|
+
// we are proxying the instance (not element)
|
2573
|
+
(flags & 1 /* PROXY_FLAGS.isElementConstructor */) === 0 &&
|
2574
|
+
// the element is not constructing
|
2575
|
+
(ref && ref.$flags$ & 8 /* HOST_FLAGS.isConstructingInstance */) === 0 &&
|
2576
|
+
// the member is a prop
|
2577
|
+
(memberFlags & 31 /* MEMBER_FLAGS.Prop */) !== 0 &&
|
2578
|
+
// the member is not mutable
|
2579
|
+
(memberFlags & 1024 /* MEMBER_FLAGS.Mutable */) === 0) {
|
2580
|
+
consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability`);
|
2581
|
+
}
|
2582
|
+
}
|
2583
|
+
// proxyComponent, set value
|
2584
|
+
setValue(this, memberName, newValue, cmpMeta);
|
2585
|
+
},
|
2586
|
+
configurable: true,
|
2587
|
+
enumerable: true,
|
2588
|
+
});
|
2589
|
+
}
|
2590
|
+
else if (BUILD.lazyLoad &&
|
2591
|
+
BUILD.method &&
|
2592
|
+
flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
2593
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
2594
|
+
// proxyComponent - method
|
2595
|
+
Object.defineProperty(prototype, memberName, {
|
2596
|
+
value(...args) {
|
2597
|
+
var _a;
|
2598
|
+
const ref = getHostRef(this);
|
2599
|
+
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); });
|
2600
|
+
},
|
2601
|
+
});
|
2602
|
+
}
|
2603
|
+
});
|
2604
|
+
if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
2605
|
+
const attrNameToPropName = new Map();
|
2606
|
+
prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
|
2607
|
+
plt.jmp(() => {
|
2608
|
+
var _a;
|
2609
|
+
const propName = attrNameToPropName.get(attrName);
|
2610
|
+
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
2611
|
+
// in the case where an attribute was set inline.
|
2612
|
+
// ```html
|
2613
|
+
// <my-component some-attribute="some-value"></my-component>
|
2614
|
+
// ```
|
2615
|
+
//
|
2616
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
2617
|
+
// programmatically changes it before it has been upgraded as shown below:
|
2618
|
+
//
|
2619
|
+
// ```html
|
2620
|
+
// <!-- this component has _not_ been upgraded yet -->
|
2621
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
2622
|
+
// <script>
|
2623
|
+
// // grab non-upgraded component
|
2624
|
+
// el = document.querySelector("#test");
|
2625
|
+
// el.someAttribute = "another-value";
|
2626
|
+
// // upgrade component
|
2627
|
+
// customElements.define('my-component', MyComponent);
|
2628
|
+
// </script>
|
2629
|
+
// ```
|
2630
|
+
// In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
|
2631
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
2632
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
2633
|
+
// the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
|
2634
|
+
//
|
2635
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
|
2636
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
2637
|
+
//
|
2638
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
2639
|
+
//
|
2640
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
2641
|
+
// properties here given that this goes against best practices outlined here
|
2642
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
2643
|
+
if (this.hasOwnProperty(propName)) {
|
2644
|
+
newValue = this[propName];
|
2645
|
+
delete this[propName];
|
2646
|
+
}
|
2647
|
+
else if (prototype.hasOwnProperty(propName) &&
|
2648
|
+
typeof this[propName] === 'number' &&
|
2649
|
+
this[propName] == newValue) {
|
2650
|
+
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
2651
|
+
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
2652
|
+
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
2653
|
+
return;
|
2654
|
+
}
|
2655
|
+
else if (propName == null) {
|
2656
|
+
// At this point we should know this is not a "member", so we can treat it like watching an attribute
|
2657
|
+
// on a vanilla web component
|
2658
|
+
const hostRef = getHostRef(this);
|
2659
|
+
const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
|
2660
|
+
// We only want to trigger the callback(s) if:
|
2661
|
+
// 1. The instance is ready
|
2662
|
+
// 2. The watchers are ready
|
2663
|
+
// 3. The value has changed
|
2664
|
+
if (flags &&
|
2665
|
+
!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
|
2666
|
+
flags & 128 /* HOST_FLAGS.isWatchReady */ &&
|
2667
|
+
newValue !== oldValue) {
|
2668
|
+
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : this;
|
2669
|
+
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
2670
|
+
const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
|
2671
|
+
entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
|
2672
|
+
if (instance[callbackName] != null) {
|
2673
|
+
instance[callbackName].call(instance, newValue, oldValue, attrName);
|
2674
|
+
}
|
2675
|
+
});
|
2676
|
+
}
|
2677
|
+
return;
|
2678
|
+
}
|
2679
|
+
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
2680
|
+
});
|
2681
|
+
};
|
2682
|
+
// Create an array of attributes to observe
|
2683
|
+
// This list in comprised of all strings used within a `@Watch()` decorator
|
2684
|
+
// on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
|
2685
|
+
// As such, there is no way to guarantee type-safety here that a user hasn't entered
|
2686
|
+
// an invalid attribute.
|
2687
|
+
Cstr.observedAttributes = Array.from(new Set([
|
2688
|
+
...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
|
2689
|
+
...members
|
2690
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
|
2691
|
+
.map(([propName, m]) => {
|
2692
|
+
var _a;
|
2693
|
+
const attrName = m[1] || propName;
|
2694
|
+
attrNameToPropName.set(attrName, propName);
|
2695
|
+
if (BUILD.reflect && m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
2696
|
+
(_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
|
2697
|
+
}
|
2698
|
+
return attrName;
|
2699
|
+
}),
|
2700
|
+
]));
|
2701
|
+
}
|
2702
|
+
}
|
2703
|
+
return Cstr;
|
2704
|
+
};
|
2705
|
+
/**
|
2706
|
+
* Initialize a Stencil component given a reference to its host element, its
|
2707
|
+
* runtime bookkeeping data structure, runtime metadata about the component,
|
2708
|
+
* and (optionally) an HMR version ID.
|
2709
|
+
*
|
2710
|
+
* @param elm a host element
|
2711
|
+
* @param hostRef the element's runtime bookkeeping object
|
2712
|
+
* @param cmpMeta runtime metadata for the Stencil component
|
2713
|
+
* @param hmrVersionId an (optional) HMR version ID
|
2714
|
+
*/
|
2715
|
+
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
2716
|
+
let Cstr;
|
2717
|
+
// initializeComponent
|
2718
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
2719
|
+
// Let the runtime know that the component has been initialized
|
2720
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
2721
|
+
if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
|
2722
|
+
// lazy loaded components
|
2723
|
+
// request the component's implementation to be
|
2724
|
+
// wired up with the host element
|
2725
|
+
Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
|
2726
|
+
if (Cstr.then) {
|
2727
|
+
// Await creates a micro-task avoid if possible
|
2728
|
+
const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
|
2729
|
+
Cstr = await Cstr;
|
2730
|
+
endLoad();
|
2731
|
+
}
|
2732
|
+
if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
|
2733
|
+
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
2734
|
+
}
|
2735
|
+
if (BUILD.member && !Cstr.isProxied) {
|
2736
|
+
// we've never proxied this Constructor before
|
2737
|
+
// let's add the getters/setters to its prototype before
|
2738
|
+
// the first time we create an instance of the implementation
|
2739
|
+
if (BUILD.watchCallback) {
|
2740
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
2741
|
+
}
|
2742
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
2743
|
+
Cstr.isProxied = true;
|
2744
|
+
}
|
2745
|
+
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
2746
|
+
// ok, time to construct the instance
|
2747
|
+
// but let's keep track of when we start and stop
|
2748
|
+
// so that the getters/setters don't incorrectly step on data
|
2749
|
+
if (BUILD.member) {
|
2750
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
2751
|
+
}
|
2752
|
+
// construct the lazy-loaded component implementation
|
2753
|
+
// passing the hostRef is very important during
|
2754
|
+
// construction in order to directly wire together the
|
2755
|
+
// host element and the lazy-loaded instance
|
2756
|
+
try {
|
2757
|
+
new Cstr(hostRef);
|
2758
|
+
}
|
2759
|
+
catch (e) {
|
2760
|
+
consoleError(e);
|
2761
|
+
}
|
2762
|
+
if (BUILD.member) {
|
2763
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
2764
|
+
}
|
2765
|
+
if (BUILD.watchCallback) {
|
2766
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
2767
|
+
}
|
2768
|
+
endNewInstance();
|
2769
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
2770
|
+
}
|
2771
|
+
else {
|
2772
|
+
// sync constructor component
|
2773
|
+
Cstr = elm.constructor;
|
2774
|
+
// wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
|
2775
|
+
// watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
|
2776
|
+
// Stencil has completed instantiating the component.
|
2777
|
+
customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
|
2778
|
+
}
|
2779
|
+
if (BUILD.style && Cstr.style) {
|
2780
|
+
// this component has styles but we haven't registered them yet
|
2781
|
+
let style = Cstr.style;
|
2782
|
+
if (BUILD.mode && typeof style !== 'string') {
|
2783
|
+
style = style[(hostRef.$modeName$ = computeMode(elm))];
|
2784
|
+
if (BUILD.hydrateServerSide && hostRef.$modeName$) {
|
2785
|
+
elm.setAttribute('s-mode', hostRef.$modeName$);
|
2786
|
+
}
|
2787
|
+
}
|
2788
|
+
const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
|
2789
|
+
if (!styles.has(scopeId)) {
|
2790
|
+
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
2791
|
+
if (!BUILD.hydrateServerSide &&
|
2792
|
+
BUILD.shadowDom &&
|
2793
|
+
// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
2794
|
+
BUILD.shadowDomShim &&
|
2795
|
+
cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
2796
|
+
style = await Promise.resolve().then(function () { return require('./shadow-css-bbaea014.js'); }).then((m) => m.scopeCss(style, scopeId, false));
|
2797
|
+
}
|
2798
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
2799
|
+
endRegisterStyles();
|
2800
|
+
}
|
2801
|
+
}
|
2802
|
+
}
|
2803
|
+
// we've successfully created a lazy instance
|
2804
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
2805
|
+
const schedule = () => scheduleUpdate(hostRef, true);
|
2806
|
+
if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
|
2807
|
+
// this is the initial load and this component it has an ancestor component
|
2808
|
+
// but the ancestor component has NOT fired its will update lifecycle yet
|
2809
|
+
// so let's just cool our jets and wait for the ancestor to continue first
|
2810
|
+
// this will get fired off when the ancestor component
|
2811
|
+
// finally gets around to rendering its lazy self
|
2812
|
+
// fire off the initial update
|
2813
|
+
ancestorComponent['s-rc'].push(schedule);
|
2814
|
+
}
|
2815
|
+
else {
|
2816
|
+
schedule();
|
2817
|
+
}
|
2818
|
+
};
|
2819
|
+
const fireConnectedCallback = (instance) => {
|
2820
|
+
if (BUILD.lazyLoad && BUILD.connectedCallback) {
|
2821
|
+
safeCall(instance, 'connectedCallback');
|
2822
|
+
}
|
2823
|
+
};
|
2824
|
+
const connectedCallback = (elm) => {
|
2825
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
2826
|
+
const hostRef = getHostRef(elm);
|
2827
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
2828
|
+
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
2829
|
+
if (BUILD.hostListenerTargetParent) {
|
2830
|
+
// only run if we have listeners being attached to a parent
|
2831
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
2832
|
+
}
|
2833
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
2834
|
+
// first time this component has connected
|
2835
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
2836
|
+
let hostId;
|
2837
|
+
if (BUILD.hydrateClientSide) {
|
2838
|
+
hostId = elm.getAttribute(HYDRATE_ID);
|
2839
|
+
if (hostId) {
|
2840
|
+
if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
2841
|
+
const scopeId = BUILD.mode
|
2842
|
+
? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
|
2843
|
+
: addStyle(elm.shadowRoot, cmpMeta);
|
2844
|
+
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
2845
|
+
}
|
2846
|
+
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
2847
|
+
}
|
2848
|
+
}
|
2849
|
+
if (BUILD.slotRelocation && !hostId) {
|
2850
|
+
// initUpdate
|
2851
|
+
// if the slot polyfill is required we'll need to put some nodes
|
2852
|
+
// in here to act as original content anchors as we move nodes around
|
2853
|
+
// host element has been connected to the DOM
|
2854
|
+
if (BUILD.hydrateServerSide ||
|
2855
|
+
((BUILD.slot || BUILD.shadowDom) &&
|
2856
|
+
// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
2857
|
+
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
2858
|
+
setContentReference(elm);
|
2859
|
+
}
|
2860
|
+
}
|
2861
|
+
if (BUILD.asyncLoading) {
|
2862
|
+
// find the first ancestor component (if there is one) and register
|
2863
|
+
// this component as one of the actively loading child components for its ancestor
|
2864
|
+
let ancestorComponent = elm;
|
2865
|
+
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
2866
|
+
// climb up the ancestors looking for the first
|
2867
|
+
// component that hasn't finished its lifecycle update yet
|
2868
|
+
if ((BUILD.hydrateClientSide &&
|
2869
|
+
ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
2870
|
+
ancestorComponent.hasAttribute('s-id') &&
|
2871
|
+
ancestorComponent['s-p']) ||
|
2872
|
+
ancestorComponent['s-p']) {
|
2873
|
+
// we found this components first ancestor component
|
2874
|
+
// keep a reference to this component's ancestor component
|
2875
|
+
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
2876
|
+
break;
|
2877
|
+
}
|
2878
|
+
}
|
2879
|
+
}
|
2880
|
+
// Lazy properties
|
2881
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
2882
|
+
if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) {
|
2883
|
+
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
2884
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
2885
|
+
const value = elm[memberName];
|
2886
|
+
delete elm[memberName];
|
2887
|
+
elm[memberName] = value;
|
2888
|
+
}
|
2889
|
+
});
|
2890
|
+
}
|
2891
|
+
if (BUILD.initializeNextTick) {
|
2892
|
+
// connectedCallback, taskQueue, initialLoad
|
2893
|
+
// angular sets attribute AFTER connectCallback
|
2894
|
+
// https://github.com/angular/angular/issues/18909
|
2895
|
+
// https://github.com/angular/angular/issues/19940
|
2896
|
+
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
2897
|
+
}
|
2898
|
+
else {
|
2899
|
+
initializeComponent(elm, hostRef, cmpMeta);
|
2900
|
+
}
|
2901
|
+
}
|
2902
|
+
else {
|
2903
|
+
// not the first time this has connected
|
2904
|
+
// reattach any event listeners to the host
|
2905
|
+
// since they would have been removed when disconnected
|
2906
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
|
2907
|
+
// fire off connectedCallback() on component instance
|
2908
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
2909
|
+
fireConnectedCallback(hostRef.$lazyInstance$);
|
2910
|
+
}
|
2911
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
2912
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
|
2913
|
+
}
|
2914
|
+
}
|
2915
|
+
endConnected();
|
2916
|
+
}
|
2917
|
+
};
|
2918
|
+
const setContentReference = (elm) => {
|
2919
|
+
// only required when we're NOT using native shadow dom (slot)
|
2920
|
+
// or this browser doesn't support native shadow dom
|
2921
|
+
// and this host element was NOT created with SSR
|
2922
|
+
// let's pick out the inner content for slot projection
|
2923
|
+
// create a node to represent where the original
|
2924
|
+
// content was first placed, which is useful later on
|
2925
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : ''));
|
2926
|
+
contentRefElm['s-cn'] = true;
|
2927
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
2928
|
+
};
|
2929
|
+
const disconnectInstance = (instance) => {
|
2930
|
+
if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
|
2931
|
+
safeCall(instance, 'disconnectedCallback');
|
2932
|
+
}
|
2933
|
+
if (BUILD.cmpDidUnload) {
|
2934
|
+
safeCall(instance, 'componentDidUnload');
|
2935
|
+
}
|
2936
|
+
};
|
2937
|
+
const disconnectedCallback = async (elm) => {
|
2938
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
2939
|
+
const hostRef = getHostRef(elm);
|
2940
|
+
if (BUILD.hostListener) {
|
2941
|
+
if (hostRef.$rmListeners$) {
|
2942
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
2943
|
+
hostRef.$rmListeners$ = undefined;
|
2944
|
+
}
|
2945
|
+
}
|
2946
|
+
if (!BUILD.lazyLoad) {
|
2947
|
+
disconnectInstance(elm);
|
2948
|
+
}
|
2949
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
|
2950
|
+
disconnectInstance(hostRef.$lazyInstance$);
|
2951
|
+
}
|
2952
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
2953
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
|
2954
|
+
}
|
2955
|
+
}
|
2956
|
+
};
|
2957
|
+
const patchPseudoShadowDom = (hostElementPrototype, descriptorPrototype) => {
|
2958
|
+
patchCloneNode(hostElementPrototype);
|
2959
|
+
patchSlotAppendChild(hostElementPrototype);
|
2960
|
+
patchSlotAppend(hostElementPrototype);
|
2961
|
+
patchSlotPrepend(hostElementPrototype);
|
2962
|
+
patchSlotInsertAdjacentElement(hostElementPrototype);
|
2963
|
+
patchSlotInsertAdjacentHTML(hostElementPrototype);
|
2964
|
+
patchSlotInsertAdjacentText(hostElementPrototype);
|
2965
|
+
patchTextContent(hostElementPrototype);
|
2966
|
+
patchChildSlotNodes(hostElementPrototype, descriptorPrototype);
|
2967
|
+
patchSlotRemoveChild(hostElementPrototype);
|
2968
|
+
};
|
2969
|
+
const patchCloneNode = (HostElementPrototype) => {
|
2970
|
+
const orgCloneNode = HostElementPrototype.cloneNode;
|
2971
|
+
HostElementPrototype.cloneNode = function (deep) {
|
2972
|
+
const srcNode = this;
|
2973
|
+
const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
2974
|
+
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
2975
|
+
if (BUILD.slot && !isShadowDom && deep) {
|
2976
|
+
let i = 0;
|
2977
|
+
let slotted, nonStencilNode;
|
2978
|
+
const stencilPrivates = [
|
2979
|
+
's-id',
|
2980
|
+
's-cr',
|
2981
|
+
's-lr',
|
2982
|
+
's-rc',
|
2983
|
+
's-sc',
|
2984
|
+
's-p',
|
2985
|
+
's-cn',
|
2986
|
+
's-sr',
|
2987
|
+
's-sn',
|
2988
|
+
's-hn',
|
2989
|
+
's-ol',
|
2990
|
+
's-nr',
|
2991
|
+
's-si',
|
2992
|
+
];
|
2993
|
+
for (; i < srcNode.childNodes.length; i++) {
|
2994
|
+
slotted = srcNode.childNodes[i]['s-nr'];
|
2995
|
+
nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
|
2996
|
+
if (slotted) {
|
2997
|
+
if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
|
2998
|
+
clonedNode.__appendChild(slotted.cloneNode(true));
|
2999
|
+
}
|
3000
|
+
else {
|
3001
|
+
clonedNode.appendChild(slotted.cloneNode(true));
|
3002
|
+
}
|
3003
|
+
}
|
3004
|
+
if (nonStencilNode) {
|
3005
|
+
clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
|
3006
|
+
}
|
3007
|
+
}
|
3008
|
+
}
|
3009
|
+
return clonedNode;
|
3010
|
+
};
|
3011
|
+
};
|
3012
|
+
/**
|
3013
|
+
* Patches the `appendChild` method on a `scoped` Stencil component.
|
3014
|
+
* The patch will attempt to find a slot with the same name as the node being appended
|
3015
|
+
* and insert it into the slot reference if found. Otherwise, it falls-back to the original
|
3016
|
+
* `appendChild` method.
|
3017
|
+
*
|
3018
|
+
* @param HostElementPrototype The Stencil component to be patched
|
3019
|
+
*/
|
3020
|
+
const patchSlotAppendChild = (HostElementPrototype) => {
|
3021
|
+
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
3022
|
+
HostElementPrototype.appendChild = function (newChild) {
|
3023
|
+
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
3024
|
+
const slotNode = getHostSlotNode(this.childNodes, slotName);
|
3025
|
+
if (slotNode) {
|
3026
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
3027
|
+
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
3028
|
+
appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
|
3029
|
+
// Check if there is fallback content that should be hidden
|
3030
|
+
updateFallbackSlotVisibility(this);
|
3031
|
+
return;
|
3032
|
+
}
|
3033
|
+
return this.__appendChild(newChild);
|
3034
|
+
};
|
3035
|
+
};
|
3036
|
+
/**
|
3037
|
+
* Patches the `removeChild` method on a `scoped` Stencil component.
|
3038
|
+
* This patch attempts to remove the specified node from a slot reference
|
3039
|
+
* if the slot exists. Otherwise, it falls-back to the original `removeChild` method.
|
3040
|
+
*
|
3041
|
+
* @param ElementPrototype The Stencil component to be patched
|
3042
|
+
*/
|
3043
|
+
const patchSlotRemoveChild = (ElementPrototype) => {
|
3044
|
+
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
3045
|
+
ElementPrototype.removeChild = function (toRemove) {
|
3046
|
+
if (toRemove && typeof toRemove['s-sn'] !== 'undefined') {
|
3047
|
+
const slotNode = getHostSlotNode(this.childNodes, toRemove['s-sn']);
|
3048
|
+
if (slotNode) {
|
3049
|
+
// Get all slot content
|
3050
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode, toRemove['s-sn']);
|
3051
|
+
// See if any of the slotted content matches the node to remove
|
3052
|
+
const existingNode = slotChildNodes.find((n) => n === toRemove);
|
3053
|
+
if (existingNode) {
|
3054
|
+
existingNode.remove();
|
3055
|
+
// Check if there is fallback content that should be displayed if that
|
3056
|
+
// was the last node in the slot
|
3057
|
+
updateFallbackSlotVisibility(this);
|
3058
|
+
return;
|
3059
|
+
}
|
3060
|
+
}
|
3061
|
+
}
|
3062
|
+
return this.__removeChild(toRemove);
|
3063
|
+
};
|
3064
|
+
};
|
3065
|
+
/**
|
3066
|
+
* Patches the `prepend` method for a slotted node inside a scoped component.
|
3067
|
+
*
|
3068
|
+
* @param HostElementPrototype the `Element` to be patched
|
3069
|
+
*/
|
3070
|
+
const patchSlotPrepend = (HostElementPrototype) => {
|
3071
|
+
const originalPrepend = HostElementPrototype.prepend;
|
3072
|
+
HostElementPrototype.prepend = function (...newChildren) {
|
3073
|
+
newChildren.forEach((newChild) => {
|
3074
|
+
if (typeof newChild === 'string') {
|
3075
|
+
newChild = this.ownerDocument.createTextNode(newChild);
|
3076
|
+
}
|
3077
|
+
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
3078
|
+
const slotNode = getHostSlotNode(this.childNodes, slotName);
|
3079
|
+
if (slotNode) {
|
3080
|
+
const slotPlaceholder = document.createTextNode('');
|
3081
|
+
slotPlaceholder['s-nr'] = newChild;
|
3082
|
+
slotNode['s-cr'].parentNode.__appendChild(slotPlaceholder);
|
3083
|
+
newChild['s-ol'] = slotPlaceholder;
|
3084
|
+
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
3085
|
+
const appendAfter = slotChildNodes[0];
|
3086
|
+
return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
|
3087
|
+
}
|
3088
|
+
if (newChild.nodeType === 1 && !!newChild.getAttribute('slot')) {
|
3089
|
+
newChild.hidden = true;
|
3090
|
+
}
|
3091
|
+
return originalPrepend.call(this, newChild);
|
3092
|
+
});
|
3093
|
+
};
|
3094
|
+
};
|
3095
|
+
/**
|
3096
|
+
* Patches the `append` method for a slotted node inside a scoped component. The patched method uses
|
3097
|
+
* `appendChild` under-the-hood while creating text nodes for any new children that passed as bare strings.
|
3098
|
+
*
|
3099
|
+
* @param HostElementPrototype the `Element` to be patched
|
3100
|
+
*/
|
3101
|
+
const patchSlotAppend = (HostElementPrototype) => {
|
3102
|
+
HostElementPrototype.append = function (...newChildren) {
|
3103
|
+
newChildren.forEach((newChild) => {
|
3104
|
+
if (typeof newChild === 'string') {
|
3105
|
+
newChild = this.ownerDocument.createTextNode(newChild);
|
3106
|
+
}
|
3107
|
+
this.appendChild(newChild);
|
3108
|
+
});
|
3109
|
+
};
|
3110
|
+
};
|
3111
|
+
/**
|
3112
|
+
* Patches the `insertAdjacentHTML` method for a slotted node inside a scoped component. Specifically,
|
3113
|
+
* we only need to patch the behavior for the specific `beforeend` and `afterbegin` positions so the element
|
3114
|
+
* gets inserted into the DOM in the correct location.
|
3115
|
+
*
|
3116
|
+
* @param HostElementPrototype the `Element` to be patched
|
3117
|
+
*/
|
3118
|
+
const patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
|
3119
|
+
const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
|
3120
|
+
HostElementPrototype.insertAdjacentHTML = function (position, text) {
|
3121
|
+
if (position !== 'afterbegin' && position !== 'beforeend') {
|
3122
|
+
return originalInsertAdjacentHtml.call(this, position, text);
|
3123
|
+
}
|
3124
|
+
const container = this.ownerDocument.createElement('_');
|
3125
|
+
let node;
|
3126
|
+
container.innerHTML = text;
|
3127
|
+
if (position === 'afterbegin') {
|
3128
|
+
while ((node = container.firstChild)) {
|
3129
|
+
this.prepend(node);
|
3130
|
+
}
|
3131
|
+
}
|
3132
|
+
else if (position === 'beforeend') {
|
3133
|
+
while ((node = container.firstChild)) {
|
3134
|
+
this.append(node);
|
3135
|
+
}
|
3136
|
+
}
|
3137
|
+
};
|
3138
|
+
};
|
3139
|
+
/**
|
3140
|
+
* Patches the `insertAdjacentText` method for a slotted node inside a scoped component. Specifically,
|
3141
|
+
* we only need to patch the behavior for the specific `beforeend` and `afterbegin` positions so the text node
|
3142
|
+
* gets inserted into the DOM in the correct location.
|
3143
|
+
*
|
3144
|
+
* @param HostElementPrototype the `Element` to be patched
|
3145
|
+
*/
|
3146
|
+
const patchSlotInsertAdjacentText = (HostElementPrototype) => {
|
3147
|
+
HostElementPrototype.insertAdjacentText = function (position, text) {
|
3148
|
+
this.insertAdjacentHTML(position, text);
|
3149
|
+
};
|
3150
|
+
};
|
3151
|
+
/**
|
3152
|
+
* Patches the `insertAdjacentElement` method for a slotted node inside a scoped component. Specifically,
|
3153
|
+
* we only need to patch the behavior for the specific `beforeend` and `afterbegin` positions so the element
|
3154
|
+
* gets inserted into the DOM in the correct location.
|
3155
|
+
*
|
3156
|
+
* @param HostElementPrototype the `Element` to be patched
|
3157
|
+
*/
|
3158
|
+
const patchSlotInsertAdjacentElement = (HostElementPrototype) => {
|
3159
|
+
const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
|
3160
|
+
HostElementPrototype.insertAdjacentElement = function (position, element) {
|
3161
|
+
if (position !== 'afterbegin' && position !== 'beforeend') {
|
3162
|
+
return originalInsertAdjacentElement.call(this, position, element);
|
3163
|
+
}
|
3164
|
+
if (position === 'afterbegin') {
|
3165
|
+
this.prepend(element);
|
3166
|
+
return element;
|
3167
|
+
}
|
3168
|
+
else if (position === 'beforeend') {
|
3169
|
+
this.append(element);
|
3170
|
+
return element;
|
3171
|
+
}
|
3172
|
+
return element;
|
3173
|
+
};
|
3174
|
+
};
|
3175
|
+
/**
|
3176
|
+
* Patches the text content of an unnamed slotted node inside a scoped component
|
3177
|
+
* @param hostElementPrototype the `Element` to be patched
|
3178
|
+
*/
|
3179
|
+
const patchTextContent = (hostElementPrototype) => {
|
3180
|
+
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
|
3181
|
+
Object.defineProperty(hostElementPrototype, '__textContent', descriptor);
|
3182
|
+
if (BUILD.experimentalSlotFixes) {
|
3183
|
+
// Patch `textContent` to mimic shadow root behavior
|
3184
|
+
Object.defineProperty(hostElementPrototype, 'textContent', {
|
3185
|
+
// To mimic shadow root behavior, we need to return the text content of all
|
3186
|
+
// nodes in a slot reference node
|
3187
|
+
get() {
|
3188
|
+
const slotRefNodes = getAllChildSlotNodes(this.childNodes);
|
3189
|
+
const textContent = slotRefNodes
|
3190
|
+
.map((node) => {
|
3191
|
+
var _a, _b;
|
3192
|
+
const text = [];
|
3193
|
+
// Need to get the text content of all nodes in the slot reference node
|
3194
|
+
let slotContent = node.nextSibling;
|
3195
|
+
while (slotContent && slotContent['s-sn'] === node['s-sn']) {
|
3196
|
+
if (slotContent.nodeType === 3 /* NODE_TYPES.TEXT_NODE */ || slotContent.nodeType === 1 /* NODE_TYPES.ELEMENT_NODE */) {
|
3197
|
+
text.push((_b = (_a = slotContent.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '');
|
3198
|
+
}
|
3199
|
+
slotContent = slotContent.nextSibling;
|
3200
|
+
}
|
3201
|
+
return text.filter((ref) => ref !== '').join(' ');
|
3202
|
+
})
|
3203
|
+
.filter((text) => text !== '')
|
3204
|
+
.join(' ');
|
3205
|
+
// Pad the string to return
|
3206
|
+
return ' ' + textContent + ' ';
|
3207
|
+
},
|
3208
|
+
// To mimic shadow root behavior, we need to overwrite all nodes in a slot
|
3209
|
+
// reference node. If a default slot reference node exists, the text content will be
|
3210
|
+
// placed there. Otherwise, the new text node will be hidden
|
3211
|
+
set(value) {
|
3212
|
+
const slotRefNodes = getAllChildSlotNodes(this.childNodes);
|
3213
|
+
slotRefNodes.forEach((node) => {
|
3214
|
+
// Remove the existing content of the slot
|
3215
|
+
let slotContent = node.nextSibling;
|
3216
|
+
while (slotContent && slotContent['s-sn'] === node['s-sn']) {
|
3217
|
+
const tmp = slotContent;
|
3218
|
+
slotContent = slotContent.nextSibling;
|
3219
|
+
tmp.remove();
|
3220
|
+
}
|
3221
|
+
// If this is a default slot, add the text node in the slot location.
|
3222
|
+
// Otherwise, destroy the slot reference node
|
3223
|
+
if (node['s-sn'] === '') {
|
3224
|
+
const textNode = this.ownerDocument.createTextNode(value);
|
3225
|
+
textNode['s-sn'] = '';
|
3226
|
+
node.parentElement.insertBefore(textNode, node.nextSibling);
|
3227
|
+
}
|
3228
|
+
else {
|
3229
|
+
node.remove();
|
3230
|
+
}
|
3231
|
+
});
|
3232
|
+
},
|
3233
|
+
});
|
3234
|
+
}
|
3235
|
+
else {
|
3236
|
+
Object.defineProperty(hostElementPrototype, 'textContent', {
|
3237
|
+
get() {
|
3238
|
+
var _a;
|
3239
|
+
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
3240
|
+
// the empty string
|
3241
|
+
const slotNode = getHostSlotNode(this.childNodes, '');
|
3242
|
+
// when a slot node is found, the textContent _may_ be found in the next sibling (text) node, depending on how
|
3243
|
+
// nodes were reordered during the vdom render. first try to get the text content from the sibling.
|
3244
|
+
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
|
3245
|
+
return slotNode.nextSibling.textContent;
|
3246
|
+
}
|
3247
|
+
else if (slotNode) {
|
3248
|
+
return slotNode.textContent;
|
3249
|
+
}
|
3250
|
+
else {
|
3251
|
+
// fallback to the original implementation
|
3252
|
+
return this.__textContent;
|
3253
|
+
}
|
3254
|
+
},
|
3255
|
+
set(value) {
|
3256
|
+
var _a;
|
3257
|
+
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
3258
|
+
// the empty string
|
3259
|
+
const slotNode = getHostSlotNode(this.childNodes, '');
|
3260
|
+
// when a slot node is found, the textContent _may_ need to be placed in the next sibling (text) node,
|
3261
|
+
// depending on how nodes were reordered during the vdom render. first try to set the text content on the
|
3262
|
+
// sibling.
|
3263
|
+
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
|
3264
|
+
slotNode.nextSibling.textContent = value;
|
3265
|
+
}
|
3266
|
+
else if (slotNode) {
|
3267
|
+
slotNode.textContent = value;
|
3268
|
+
}
|
3269
|
+
else {
|
3270
|
+
// we couldn't find a slot, but that doesn't mean that there isn't one. if this check ran before the DOM
|
3271
|
+
// loaded, we could have missed it. check for a content reference element on the scoped component and insert
|
3272
|
+
// it there
|
3273
|
+
this.__textContent = value;
|
3274
|
+
const contentRefElm = this['s-cr'];
|
3275
|
+
if (contentRefElm) {
|
3276
|
+
this.insertBefore(contentRefElm, this.firstChild);
|
3277
|
+
}
|
3278
|
+
}
|
3279
|
+
},
|
3280
|
+
});
|
3281
|
+
}
|
3282
|
+
};
|
3283
|
+
const patchChildSlotNodes = (elm, cmpMeta) => {
|
3284
|
+
class FakeNodeList extends Array {
|
3285
|
+
item(n) {
|
3286
|
+
return this[n];
|
3287
|
+
}
|
3288
|
+
}
|
3289
|
+
// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
3290
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
3291
|
+
const childNodesFn = elm.__lookupGetter__('childNodes');
|
3292
|
+
Object.defineProperty(elm, 'children', {
|
3293
|
+
get() {
|
3294
|
+
return this.childNodes.map((n) => n.nodeType === 1);
|
3295
|
+
},
|
3296
|
+
});
|
3297
|
+
Object.defineProperty(elm, 'childElementCount', {
|
3298
|
+
get() {
|
3299
|
+
return elm.children.length;
|
3300
|
+
},
|
3301
|
+
});
|
3302
|
+
Object.defineProperty(elm, 'childNodes', {
|
3303
|
+
get() {
|
3304
|
+
const childNodes = childNodesFn.call(this);
|
3305
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
|
3306
|
+
getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
|
3307
|
+
const result = new FakeNodeList();
|
3308
|
+
for (let i = 0; i < childNodes.length; i++) {
|
3309
|
+
const slot = childNodes[i]['s-nr'];
|
3310
|
+
if (slot) {
|
3311
|
+
result.push(slot);
|
3312
|
+
}
|
3313
|
+
}
|
3314
|
+
return result;
|
3315
|
+
}
|
3316
|
+
return FakeNodeList.from(childNodes);
|
3317
|
+
},
|
3318
|
+
});
|
3319
|
+
}
|
3320
|
+
};
|
3321
|
+
/**
|
3322
|
+
* Recursively finds all slot reference nodes ('s-sr') in a series of child nodes.
|
3323
|
+
*
|
3324
|
+
* @param childNodes The set of child nodes to search for slot reference nodes.
|
3325
|
+
* @returns An array of slot reference nodes.
|
3326
|
+
*/
|
3327
|
+
const getAllChildSlotNodes = (childNodes) => {
|
3328
|
+
const slotRefNodes = [];
|
3329
|
+
for (const childNode of Array.from(childNodes)) {
|
3330
|
+
if (childNode['s-sr']) {
|
3331
|
+
slotRefNodes.push(childNode);
|
3332
|
+
}
|
3333
|
+
slotRefNodes.push(...getAllChildSlotNodes(childNode.childNodes));
|
3334
|
+
}
|
3335
|
+
return slotRefNodes;
|
3336
|
+
};
|
3337
|
+
const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
|
3338
|
+
/**
|
3339
|
+
* Recursively searches a series of child nodes for a slot with the provided name.
|
3340
|
+
* @param childNodes the nodes to search for a slot with a specific name.
|
3341
|
+
* @param slotName the name of the slot to match on.
|
3342
|
+
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
3343
|
+
*/
|
3344
|
+
const getHostSlotNode = (childNodes, slotName) => {
|
3345
|
+
let i = 0;
|
3346
|
+
let childNode;
|
3347
|
+
for (; i < childNodes.length; i++) {
|
3348
|
+
childNode = childNodes[i];
|
3349
|
+
if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
|
3350
|
+
return childNode;
|
3351
|
+
}
|
3352
|
+
childNode = getHostSlotNode(childNode.childNodes, slotName);
|
3353
|
+
if (childNode) {
|
3354
|
+
return childNode;
|
3355
|
+
}
|
3356
|
+
}
|
3357
|
+
return null;
|
3358
|
+
};
|
3359
|
+
const getHostSlotChildNodes = (n, slotName) => {
|
3360
|
+
const childNodes = [n];
|
3361
|
+
while ((n = n.nextSibling) && n['s-sn'] === slotName) {
|
3362
|
+
childNodes.push(n);
|
3363
|
+
}
|
3364
|
+
return childNodes;
|
3365
|
+
};
|
3366
|
+
const defineCustomElement = (Cstr, compactMeta) => {
|
3367
|
+
customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
|
3368
|
+
};
|
3369
|
+
const proxyCustomElement = (Cstr, compactMeta) => {
|
3370
|
+
const cmpMeta = {
|
3371
|
+
$flags$: compactMeta[0],
|
3372
|
+
$tagName$: compactMeta[1],
|
3373
|
+
};
|
3374
|
+
if (BUILD.member) {
|
3375
|
+
cmpMeta.$members$ = compactMeta[2];
|
3376
|
+
}
|
3377
|
+
if (BUILD.hostListener) {
|
3378
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
3379
|
+
}
|
3380
|
+
if (BUILD.watchCallback) {
|
3381
|
+
cmpMeta.$watchers$ = Cstr.$watchers$;
|
3382
|
+
}
|
3383
|
+
if (BUILD.reflect) {
|
3384
|
+
cmpMeta.$attrsToReflect$ = [];
|
3385
|
+
}
|
3386
|
+
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
3387
|
+
// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
3388
|
+
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
3389
|
+
}
|
3390
|
+
// TODO(STENCIL-914): this check and `else` block can go away and be replaced by just the `scoped` check
|
3391
|
+
if (BUILD.experimentalSlotFixes && BUILD.scoped && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
3392
|
+
patchPseudoShadowDom(Cstr.prototype, cmpMeta);
|
3393
|
+
}
|
3394
|
+
else {
|
3395
|
+
if (BUILD.slotChildNodesFix) {
|
3396
|
+
patchChildSlotNodes(Cstr.prototype, cmpMeta);
|
3397
|
+
}
|
3398
|
+
if (BUILD.cloneNodeFix) {
|
3399
|
+
patchCloneNode(Cstr.prototype);
|
3400
|
+
}
|
3401
|
+
if (BUILD.appendChildSlotFix) {
|
3402
|
+
patchSlotAppendChild(Cstr.prototype);
|
3403
|
+
}
|
3404
|
+
if (BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
3405
|
+
patchTextContent(Cstr.prototype);
|
3406
|
+
}
|
3407
|
+
}
|
3408
|
+
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
3409
|
+
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
3410
|
+
Object.assign(Cstr.prototype, {
|
3411
|
+
__registerHost() {
|
3412
|
+
registerHost(this, cmpMeta);
|
3413
|
+
},
|
3414
|
+
connectedCallback() {
|
3415
|
+
connectedCallback(this);
|
3416
|
+
if (BUILD.connectedCallback && originalConnectedCallback) {
|
3417
|
+
originalConnectedCallback.call(this);
|
3418
|
+
}
|
3419
|
+
},
|
3420
|
+
disconnectedCallback() {
|
3421
|
+
disconnectedCallback(this);
|
3422
|
+
if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
|
3423
|
+
originalDisconnectedCallback.call(this);
|
3424
|
+
}
|
3425
|
+
},
|
3426
|
+
__attachShadow() {
|
3427
|
+
if (supportsShadow) {
|
3428
|
+
if (BUILD.shadowDelegatesFocus) {
|
3429
|
+
this.attachShadow({
|
3430
|
+
mode: 'open',
|
3431
|
+
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
3432
|
+
});
|
3433
|
+
}
|
3434
|
+
else {
|
3435
|
+
this.attachShadow({ mode: 'open' });
|
3436
|
+
}
|
3437
|
+
}
|
3438
|
+
else {
|
3439
|
+
this.shadowRoot = this;
|
3440
|
+
}
|
3441
|
+
},
|
3442
|
+
});
|
3443
|
+
Cstr.is = cmpMeta.$tagName$;
|
3444
|
+
return proxyComponent(Cstr, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */ | 2 /* PROXY_FLAGS.proxyState */);
|
3445
|
+
};
|
3446
|
+
const forceModeUpdate = (elm) => {
|
3447
|
+
if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
|
3448
|
+
const mode = computeMode(elm);
|
3449
|
+
const hostRef = getHostRef(elm);
|
3450
|
+
if (hostRef.$modeName$ !== mode) {
|
3451
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
3452
|
+
const oldScopeId = elm['s-sc'];
|
3453
|
+
const scopeId = getScopeId(cmpMeta, mode);
|
3454
|
+
const style = elm.constructor.style[mode];
|
3455
|
+
const flags = cmpMeta.$flags$;
|
3456
|
+
if (style) {
|
3457
|
+
if (!styles.has(scopeId)) {
|
3458
|
+
registerStyle(scopeId, style, !!(flags & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
3459
|
+
}
|
3460
|
+
hostRef.$modeName$ = mode;
|
3461
|
+
elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
|
3462
|
+
attachStyles(hostRef);
|
3463
|
+
forceUpdate(elm);
|
3464
|
+
}
|
3465
|
+
}
|
3466
|
+
}
|
3467
|
+
};
|
3468
|
+
/**
|
3469
|
+
* Kick off hot-module-replacement for a component. In order to replace the
|
3470
|
+
* component in-place we:
|
3471
|
+
*
|
3472
|
+
* 1. get a reference to the {@link d.HostRef} for the element
|
3473
|
+
* 2. reset the element's runtime flags
|
3474
|
+
* 3. re-run the initialization logic for the element (via
|
3475
|
+
* {@link initializeComponent})
|
3476
|
+
*
|
3477
|
+
* @param hostElement the host element for the component which we want to start
|
3478
|
+
* doing HMR
|
3479
|
+
* @param cmpMeta runtime metadata for the component
|
3480
|
+
* @param hmrVersionId the current HMR version ID
|
3481
|
+
*/
|
3482
|
+
const hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
|
3483
|
+
// ¯\_(ツ)_/¯
|
3484
|
+
const hostRef = getHostRef(hostElement);
|
3485
|
+
// reset state flags to only have been connected
|
3486
|
+
hostRef.$flags$ = 1 /* HOST_FLAGS.hasConnected */;
|
3487
|
+
// TODO
|
3488
|
+
// detach any event listeners that may have been added
|
3489
|
+
// because we're not passing an exact event name it'll
|
3490
|
+
// remove all of this element's event, which is good
|
3491
|
+
// re-initialize the component
|
3492
|
+
initializeComponent(hostElement, hostRef, cmpMeta, hmrVersionId);
|
3493
|
+
};
|
3494
|
+
const bootstrapLazy = (lazyBundles, options = {}) => {
|
3495
|
+
var _a;
|
3496
|
+
if (BUILD.profile && performance.mark) {
|
3497
|
+
performance.mark('st:app:start');
|
3498
|
+
}
|
3499
|
+
installDevTools();
|
3500
|
+
const endBootstrap = createTime('bootstrapLazy');
|
3501
|
+
const cmpTags = [];
|
3502
|
+
const exclude = options.exclude || [];
|
3503
|
+
const customElements = win.customElements;
|
3504
|
+
const head = doc.head;
|
3505
|
+
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
3506
|
+
const dataStyles = /*@__PURE__*/ doc.createElement('style');
|
3507
|
+
const deferredConnectedCallbacks = [];
|
3508
|
+
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
3509
|
+
let appLoadFallback;
|
3510
|
+
let isBootstrapping = true;
|
3511
|
+
let i = 0;
|
3512
|
+
Object.assign(plt, options);
|
3513
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
3514
|
+
if (BUILD.asyncQueue) {
|
3515
|
+
if (options.syncQueue) {
|
3516
|
+
plt.$flags$ |= 4 /* PLATFORM_FLAGS.queueSync */;
|
3517
|
+
}
|
3518
|
+
}
|
3519
|
+
if (BUILD.hydrateClientSide) {
|
3520
|
+
// If the app is already hydrated there is not point to disable the
|
3521
|
+
// async queue. This will improve the first input delay
|
3522
|
+
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
3523
|
+
}
|
3524
|
+
if (BUILD.hydrateClientSide && BUILD.shadowDom) {
|
3525
|
+
for (; i < styles.length; i++) {
|
3526
|
+
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
3527
|
+
}
|
3528
|
+
}
|
3529
|
+
let hasSlotRelocation = false;
|
3530
|
+
lazyBundles.map((lazyBundle) => {
|
3531
|
+
lazyBundle[1].map((compactMeta) => {
|
3532
|
+
var _a;
|
3533
|
+
const cmpMeta = {
|
3534
|
+
$flags$: compactMeta[0],
|
3535
|
+
$tagName$: compactMeta[1],
|
3536
|
+
$members$: compactMeta[2],
|
3537
|
+
$listeners$: compactMeta[3],
|
3538
|
+
};
|
3539
|
+
// Check if we are using slots outside the shadow DOM in this component.
|
3540
|
+
// We'll use this information later to add styles for `slot-fb` elements
|
3541
|
+
if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
|
3542
|
+
hasSlotRelocation = true;
|
3543
|
+
}
|
3544
|
+
if (BUILD.member) {
|
3545
|
+
cmpMeta.$members$ = compactMeta[2];
|
3546
|
+
}
|
3547
|
+
if (BUILD.hostListener) {
|
3548
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
3549
|
+
}
|
3550
|
+
if (BUILD.reflect) {
|
3551
|
+
cmpMeta.$attrsToReflect$ = [];
|
3552
|
+
}
|
3553
|
+
if (BUILD.watchCallback) {
|
3554
|
+
cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
|
3555
|
+
}
|
3556
|
+
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
3557
|
+
// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
3558
|
+
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
3559
|
+
}
|
3560
|
+
const tagName = BUILD.transformTagName && options.transformTagName
|
3561
|
+
? options.transformTagName(cmpMeta.$tagName$)
|
3562
|
+
: cmpMeta.$tagName$;
|
3563
|
+
const HostElement = class extends HTMLElement {
|
3564
|
+
// StencilLazyHost
|
3565
|
+
constructor(self) {
|
3566
|
+
// @ts-ignore
|
3567
|
+
super(self);
|
3568
|
+
self = this;
|
3569
|
+
registerHost(self, cmpMeta);
|
3570
|
+
if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
3571
|
+
// this component is using shadow dom
|
3572
|
+
// and this browser supports shadow dom
|
3573
|
+
// add the read-only property "shadowRoot" to the host element
|
3574
|
+
// adding the shadow root build conditionals to minimize runtime
|
3575
|
+
if (supportsShadow) {
|
3576
|
+
if (BUILD.shadowDelegatesFocus) {
|
3577
|
+
self.attachShadow({
|
3578
|
+
mode: 'open',
|
3579
|
+
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
3580
|
+
});
|
3581
|
+
}
|
3582
|
+
else {
|
3583
|
+
self.attachShadow({ mode: 'open' });
|
3584
|
+
}
|
3585
|
+
}
|
3586
|
+
else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
|
3587
|
+
self.shadowRoot = self;
|
3588
|
+
}
|
3589
|
+
}
|
3590
|
+
}
|
3591
|
+
connectedCallback() {
|
3592
|
+
if (appLoadFallback) {
|
3593
|
+
clearTimeout(appLoadFallback);
|
3594
|
+
appLoadFallback = null;
|
3595
|
+
}
|
3596
|
+
if (isBootstrapping) {
|
3597
|
+
// connectedCallback will be processed once all components have been registered
|
3598
|
+
deferredConnectedCallbacks.push(this);
|
3599
|
+
}
|
3600
|
+
else {
|
3601
|
+
plt.jmp(() => connectedCallback(this));
|
3602
|
+
}
|
3603
|
+
}
|
3604
|
+
disconnectedCallback() {
|
3605
|
+
plt.jmp(() => disconnectedCallback(this));
|
3606
|
+
}
|
3607
|
+
componentOnReady() {
|
3608
|
+
return getHostRef(this).$onReadyPromise$;
|
3609
|
+
}
|
3610
|
+
};
|
3611
|
+
// TODO(STENCIL-914): this check and `else` block can go away and be replaced by just the `scoped` check
|
3612
|
+
if (BUILD.experimentalSlotFixes && BUILD.scoped && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
3613
|
+
patchPseudoShadowDom(HostElement.prototype, cmpMeta);
|
3614
|
+
}
|
3615
|
+
else {
|
3616
|
+
if (BUILD.slotChildNodesFix) {
|
3617
|
+
patchChildSlotNodes(HostElement.prototype, cmpMeta);
|
3618
|
+
}
|
3619
|
+
if (BUILD.cloneNodeFix) {
|
3620
|
+
patchCloneNode(HostElement.prototype);
|
3621
|
+
}
|
3622
|
+
if (BUILD.appendChildSlotFix) {
|
3623
|
+
patchSlotAppendChild(HostElement.prototype);
|
3624
|
+
}
|
3625
|
+
if (BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
3626
|
+
patchTextContent(HostElement.prototype);
|
3627
|
+
}
|
3628
|
+
}
|
3629
|
+
// if the component is formAssociated we need to set that on the host
|
3630
|
+
// element so that it will be ready for `attachInternals` to be called on
|
3631
|
+
// it later on
|
3632
|
+
if (BUILD.formAssociated && cmpMeta.$flags$ & 64 /* CMP_FLAGS.formAssociated */) {
|
3633
|
+
HostElement.formAssociated = true;
|
3634
|
+
}
|
3635
|
+
if (BUILD.hotModuleReplacement) {
|
3636
|
+
// if we're in an HMR dev build then we need to set up the callback
|
3637
|
+
// which will carry out the work of actually replacing the module for
|
3638
|
+
// this particular component
|
3639
|
+
HostElement.prototype['s-hmr'] = function (hmrVersionId) {
|
3640
|
+
hmrStart(this, cmpMeta, hmrVersionId);
|
3641
|
+
};
|
3642
|
+
}
|
3643
|
+
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
3644
|
+
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
3645
|
+
cmpTags.push(tagName);
|
3646
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
3647
|
+
}
|
3648
|
+
});
|
3649
|
+
});
|
3650
|
+
// Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
|
3651
|
+
if (hasSlotRelocation) {
|
3652
|
+
dataStyles.innerHTML += SLOT_FB_CSS;
|
3653
|
+
}
|
3654
|
+
// Add hydration styles
|
3655
|
+
if (BUILD.invisiblePrehydration && (BUILD.hydratedClass || BUILD.hydratedAttribute)) {
|
3656
|
+
dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
|
3657
|
+
}
|
3658
|
+
// If we have styles, add them to the DOM
|
3659
|
+
if (dataStyles.innerHTML.length) {
|
3660
|
+
dataStyles.setAttribute('data-styles', '');
|
3661
|
+
// Apply CSP nonce to the style tag if it exists
|
3662
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
3663
|
+
if (nonce != null) {
|
3664
|
+
dataStyles.setAttribute('nonce', nonce);
|
3665
|
+
}
|
3666
|
+
// Insert the styles into the document head
|
3667
|
+
// NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
|
3668
|
+
head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
3669
|
+
}
|
3670
|
+
// Process deferred connectedCallbacks now all components have been registered
|
3671
|
+
isBootstrapping = false;
|
3672
|
+
if (deferredConnectedCallbacks.length) {
|
3673
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
3674
|
+
}
|
3675
|
+
else {
|
3676
|
+
if (BUILD.profile) {
|
3677
|
+
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
|
3678
|
+
}
|
3679
|
+
else {
|
3680
|
+
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
|
3681
|
+
}
|
3682
|
+
}
|
3683
|
+
// Fallback appLoad event
|
3684
|
+
endBootstrap();
|
3685
|
+
};
|
3686
|
+
const Fragment = (_, children) => children;
|
3687
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
3688
|
+
if (BUILD.hostListener && listeners) {
|
3689
|
+
// this is called immediately within the element's constructor
|
3690
|
+
// initialize our event listeners on the host element
|
3691
|
+
// we do this now so that we can listen to events that may
|
3692
|
+
// have fired even before the instance is ready
|
3693
|
+
if (BUILD.hostListenerTargetParent) {
|
3694
|
+
// this component may have event listeners that should be attached to the parent
|
3695
|
+
if (attachParentListeners) {
|
3696
|
+
// this is being ran from within the connectedCallback
|
3697
|
+
// which is important so that we know the host element actually has a parent element
|
3698
|
+
// filter out the listeners to only have the ones that ARE being attached to the parent
|
3699
|
+
listeners = listeners.filter(([flags]) => flags & 32 /* LISTENER_FLAGS.TargetParent */);
|
3700
|
+
}
|
3701
|
+
else {
|
3702
|
+
// this is being ran from within the component constructor
|
3703
|
+
// everything BUT the parent element listeners should be attached at this time
|
3704
|
+
// filter out the listeners that are NOT being attached to the parent
|
3705
|
+
listeners = listeners.filter(([flags]) => !(flags & 32 /* LISTENER_FLAGS.TargetParent */));
|
3706
|
+
}
|
3707
|
+
}
|
3708
|
+
listeners.map(([flags, name, method]) => {
|
3709
|
+
const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
|
3710
|
+
const handler = hostListenerProxy(hostRef, method);
|
3711
|
+
const opts = hostListenerOpts(flags);
|
3712
|
+
plt.ael(target, name, handler, opts);
|
3713
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
3714
|
+
});
|
3715
|
+
}
|
3716
|
+
};
|
3717
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
3718
|
+
try {
|
3719
|
+
if (BUILD.lazyLoad) {
|
3720
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
3721
|
+
// instance is ready, let's call it's member method for this event
|
3722
|
+
hostRef.$lazyInstance$[methodName](ev);
|
3723
|
+
}
|
3724
|
+
else {
|
3725
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
3726
|
+
}
|
3727
|
+
}
|
3728
|
+
else {
|
3729
|
+
hostRef.$hostElement$[methodName](ev);
|
3730
|
+
}
|
3731
|
+
}
|
3732
|
+
catch (e) {
|
3733
|
+
consoleError(e);
|
3734
|
+
}
|
3735
|
+
};
|
3736
|
+
const getHostListenerTarget = (elm, flags) => {
|
3737
|
+
if (BUILD.hostListenerTargetDocument && flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
3738
|
+
return doc;
|
3739
|
+
if (BUILD.hostListenerTargetWindow && flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
3740
|
+
return win;
|
3741
|
+
if (BUILD.hostListenerTargetBody && flags & 16 /* LISTENER_FLAGS.TargetBody */)
|
3742
|
+
return doc.body;
|
3743
|
+
if (BUILD.hostListenerTargetParent && flags & 32 /* LISTENER_FLAGS.TargetParent */)
|
3744
|
+
return elm.parentElement;
|
3745
|
+
return elm;
|
3746
|
+
};
|
3747
|
+
// prettier-ignore
|
3748
|
+
const hostListenerOpts = (flags) => supportsListenerOptions
|
3749
|
+
? ({
|
3750
|
+
passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
|
3751
|
+
capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
|
3752
|
+
})
|
3753
|
+
: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
3754
|
+
/**
|
3755
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
3756
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
3757
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
3758
|
+
* @returns void
|
3759
|
+
*/
|
3760
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
3761
|
+
const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
3762
|
+
/**
|
3763
|
+
* Updates the DOM generated on the server with annotations such as node attributes and
|
3764
|
+
* comment nodes to facilitate future client-side hydration. These annotations are used for things
|
3765
|
+
* like moving elements back to their original hosts if using Shadow DOM on the client, and for quickly
|
3766
|
+
* reconstructing the vNode representations of the DOM.
|
3767
|
+
*
|
3768
|
+
* @param doc The DOM generated by the server.
|
3769
|
+
* @param staticComponents Any components that should be considered static and do not need client-side hydration.
|
3770
|
+
*/
|
3771
|
+
const insertVdomAnnotations = (doc, staticComponents) => {
|
3772
|
+
if (doc != null) {
|
3773
|
+
const docData = {
|
3774
|
+
hostIds: 0,
|
3775
|
+
rootLevelIds: 0,
|
3776
|
+
staticComponents: new Set(staticComponents),
|
3777
|
+
};
|
3778
|
+
const orgLocationNodes = [];
|
3779
|
+
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
3780
|
+
orgLocationNodes.forEach((orgLocationNode) => {
|
3781
|
+
if (orgLocationNode != null) {
|
3782
|
+
const nodeRef = orgLocationNode['s-nr'];
|
3783
|
+
let hostId = nodeRef['s-host-id'];
|
3784
|
+
let nodeId = nodeRef['s-node-id'];
|
3785
|
+
let childId = `${hostId}.${nodeId}`;
|
3786
|
+
if (hostId == null) {
|
3787
|
+
hostId = 0;
|
3788
|
+
docData.rootLevelIds++;
|
3789
|
+
nodeId = docData.rootLevelIds;
|
3790
|
+
childId = `${hostId}.${nodeId}`;
|
3791
|
+
if (nodeRef.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
3792
|
+
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
3793
|
+
}
|
3794
|
+
else if (nodeRef.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
3795
|
+
if (hostId === 0) {
|
3796
|
+
const textContent = nodeRef.nodeValue.trim();
|
3797
|
+
if (textContent === '') {
|
3798
|
+
// useless whitespace node at the document root
|
3799
|
+
orgLocationNode.remove();
|
3800
|
+
return;
|
3801
|
+
}
|
3802
|
+
}
|
3803
|
+
const commentBeforeTextNode = doc.createComment(childId);
|
3804
|
+
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
3805
|
+
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
3806
|
+
}
|
3807
|
+
}
|
3808
|
+
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
3809
|
+
const orgLocationParentNode = orgLocationNode.parentElement;
|
3810
|
+
if (orgLocationParentNode) {
|
3811
|
+
if (orgLocationParentNode['s-en'] === '') {
|
3812
|
+
// ending with a "." means that the parent element
|
3813
|
+
// of this node's original location is a SHADOW dom element
|
3814
|
+
// and this node is apart of the root level light dom
|
3815
|
+
orgLocationNodeId += `.`;
|
3816
|
+
}
|
3817
|
+
else if (orgLocationParentNode['s-en'] === 'c') {
|
3818
|
+
// ending with a ".c" means that the parent element
|
3819
|
+
// of this node's original location is a SCOPED element
|
3820
|
+
// and this node is apart of the root level light dom
|
3821
|
+
orgLocationNodeId += `.c`;
|
3822
|
+
}
|
3823
|
+
}
|
3824
|
+
orgLocationNode.nodeValue = orgLocationNodeId;
|
3825
|
+
}
|
3826
|
+
});
|
3827
|
+
}
|
3828
|
+
};
|
3829
|
+
/**
|
3830
|
+
* Recursively parses a node generated by the server and its children to set host and child id
|
3831
|
+
* attributes read during client-side hydration. This function also tracks whether each node is
|
3832
|
+
* an original location reference node meaning that a node has been moved via slot relocation.
|
3833
|
+
*
|
3834
|
+
* @param doc The DOM generated by the server.
|
3835
|
+
* @param node The node to parse.
|
3836
|
+
* @param docData An object containing metadata about the document.
|
3837
|
+
* @param orgLocationNodes An array of nodes that have been moved via slot relocation.
|
3838
|
+
*/
|
3839
|
+
const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
3840
|
+
if (node == null) {
|
3841
|
+
return;
|
3842
|
+
}
|
3843
|
+
if (node['s-nr'] != null) {
|
3844
|
+
orgLocationNodes.push(node);
|
3845
|
+
}
|
3846
|
+
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
3847
|
+
node.childNodes.forEach((childNode) => {
|
3848
|
+
const hostRef = getHostRef(childNode);
|
3849
|
+
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
|
3850
|
+
const cmpData = {
|
3851
|
+
nodeIds: 0,
|
3852
|
+
};
|
3853
|
+
insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
|
3854
|
+
}
|
3855
|
+
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
3856
|
+
});
|
3857
|
+
}
|
3858
|
+
};
|
3859
|
+
/**
|
3860
|
+
* Insert attribute annotations on an element for its host ID and, potentially, its child ID.
|
3861
|
+
* Also makes calls to insert annotations on the element's children, keeping track of the depth of
|
3862
|
+
* the component tree.
|
3863
|
+
*
|
3864
|
+
* @param doc The DOM generated by the server.
|
3865
|
+
* @param hostElm The element to insert annotations for.
|
3866
|
+
* @param vnode The vNode representation of the element.
|
3867
|
+
* @param docData An object containing metadata about the document.
|
3868
|
+
* @param cmpData An object containing metadata about the component.
|
3869
|
+
*/
|
3870
|
+
const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
3871
|
+
if (vnode != null) {
|
3872
|
+
const hostId = ++docData.hostIds;
|
3873
|
+
hostElm.setAttribute(HYDRATE_ID, hostId);
|
3874
|
+
if (hostElm['s-cr'] != null) {
|
3875
|
+
hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
|
3876
|
+
}
|
3877
|
+
if (vnode.$children$ != null) {
|
3878
|
+
const depth = 0;
|
3879
|
+
vnode.$children$.forEach((vnodeChild, index) => {
|
3880
|
+
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
3881
|
+
});
|
3882
|
+
}
|
3883
|
+
// If this element does not already have a child ID and has a sibling comment node
|
3884
|
+
// representing a slot, we use the content of the comment to set the child ID attribute
|
3885
|
+
// on the host element.
|
3886
|
+
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
|
3887
|
+
const parent = hostElm.parentElement;
|
3888
|
+
if (parent && parent.childNodes) {
|
3889
|
+
const parentChildNodes = Array.from(parent.childNodes);
|
3890
|
+
const comment = parentChildNodes.find((node) => node.nodeType === 8 /* NODE_TYPE.CommentNode */ && node['s-sr']);
|
3891
|
+
if (comment) {
|
3892
|
+
const index = parentChildNodes.indexOf(hostElm) - 1;
|
3893
|
+
vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
|
3894
|
+
}
|
3895
|
+
}
|
3896
|
+
}
|
3897
|
+
}
|
3898
|
+
};
|
3899
|
+
/**
|
3900
|
+
* Recursively analyzes the type of a child vNode and inserts annotations on the vNodes's element based on its type.
|
3901
|
+
* Element nodes receive a child ID attribute, text nodes have a comment with the child ID inserted before them,
|
3902
|
+
* and comment nodes representing a slot have their node value set to a slot node ID containing the child ID.
|
3903
|
+
*
|
3904
|
+
* @param doc The DOM generated by the server.
|
3905
|
+
* @param vnodeChild The vNode to insert annotations for.
|
3906
|
+
* @param cmpData An object containing metadata about the component.
|
3907
|
+
* @param hostId The host ID of this element's parent.
|
3908
|
+
* @param depth How deep this element sits in the component tree relative to its parent.
|
3909
|
+
* @param index The index of this element in its parent's children array.
|
3910
|
+
*/
|
3911
|
+
const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
3912
|
+
const childElm = vnodeChild.$elm$;
|
3913
|
+
if (childElm == null) {
|
3914
|
+
return;
|
3915
|
+
}
|
3916
|
+
const nodeId = cmpData.nodeIds++;
|
3917
|
+
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
3918
|
+
childElm['s-host-id'] = hostId;
|
3919
|
+
childElm['s-node-id'] = nodeId;
|
3920
|
+
if (childElm.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
3921
|
+
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
3922
|
+
}
|
3923
|
+
else if (childElm.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
3924
|
+
const parentNode = childElm.parentNode;
|
3925
|
+
const nodeName = parentNode.nodeName;
|
3926
|
+
if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
|
3927
|
+
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
3928
|
+
const commentBeforeTextNode = doc.createComment(textNodeId);
|
3929
|
+
parentNode.insertBefore(commentBeforeTextNode, childElm);
|
3930
|
+
}
|
3931
|
+
}
|
3932
|
+
else if (childElm.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
3933
|
+
if (childElm['s-sr']) {
|
3934
|
+
const slotName = childElm['s-sn'] || '';
|
3935
|
+
const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
|
3936
|
+
childElm.nodeValue = slotNodeId;
|
3937
|
+
}
|
3938
|
+
}
|
3939
|
+
if (vnodeChild.$children$ != null) {
|
3940
|
+
// Increment depth each time we recur deeper into the tree
|
3941
|
+
const childDepth = depth + 1;
|
3942
|
+
vnodeChild.$children$.forEach((vnode, index) => {
|
3943
|
+
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
|
3944
|
+
});
|
3945
|
+
}
|
3946
|
+
};
|
3947
|
+
/**
|
3948
|
+
* A WeakMap mapping runtime component references to their corresponding host reference
|
3949
|
+
* instances.
|
3950
|
+
*/
|
3951
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
3952
|
+
/**
|
3953
|
+
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
3954
|
+
*
|
3955
|
+
* @param ref the runtime ref of interest
|
3956
|
+
* @returns the Host reference (if found) or undefined
|
3957
|
+
*/
|
3958
|
+
const getHostRef = (ref) => hostRefs.get(ref);
|
3959
|
+
/**
|
3960
|
+
* Register a lazy instance with the {@link hostRefs} object so it's
|
3961
|
+
* corresponding {@link d.HostRef} can be retrieved later.
|
3962
|
+
*
|
3963
|
+
* @param lazyInstance the lazy instance of interest
|
3964
|
+
* @param hostRef that instances `HostRef` object
|
3965
|
+
* @returns a reference to the host ref WeakMap
|
3966
|
+
*/
|
3967
|
+
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
3968
|
+
/**
|
3969
|
+
* Register a host element for a Stencil component, setting up various metadata
|
3970
|
+
* and callbacks based on {@link BUILD} flags as well as the component's runtime
|
3971
|
+
* metadata.
|
3972
|
+
*
|
3973
|
+
* @param hostElement the host element to register
|
3974
|
+
* @param cmpMeta runtime metadata for that component
|
3975
|
+
* @returns a reference to the host ref WeakMap
|
3976
|
+
*/
|
3977
|
+
const registerHost = (hostElement, cmpMeta) => {
|
3978
|
+
const hostRef = {
|
3979
|
+
$flags$: 0,
|
3980
|
+
$hostElement$: hostElement,
|
3981
|
+
$cmpMeta$: cmpMeta,
|
3982
|
+
$instanceValues$: new Map(),
|
3983
|
+
};
|
3984
|
+
if (BUILD.isDev) {
|
3985
|
+
hostRef.$renderCount$ = 0;
|
3986
|
+
}
|
3987
|
+
if (BUILD.method && BUILD.lazyLoad) {
|
3988
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
3989
|
+
}
|
3990
|
+
if (BUILD.asyncLoading) {
|
3991
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
3992
|
+
hostElement['s-p'] = [];
|
3993
|
+
hostElement['s-rc'] = [];
|
3994
|
+
}
|
3995
|
+
addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$, false);
|
3996
|
+
return hostRefs.set(hostElement, hostRef);
|
3997
|
+
};
|
3998
|
+
const isMemberInElement = (elm, memberName) => memberName in elm;
|
3999
|
+
const consoleError = (e, el) => (customError || console.error)(e, el);
|
4000
|
+
const STENCIL_DEV_MODE = BUILD.isTesting
|
4001
|
+
? ['STENCIL:'] // E2E testing
|
4002
|
+
: [
|
4003
|
+
'%cstencil',
|
4004
|
+
'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
|
4005
|
+
];
|
4006
|
+
const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
|
4007
|
+
const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
|
4008
|
+
const consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
|
4009
|
+
const setErrorHandler = (handler) => (customError = handler);
|
4010
|
+
const cmpModules = /*@__PURE__*/ new Map();
|
4011
|
+
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
4012
|
+
// loadModuleImport
|
4013
|
+
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
4014
|
+
const bundleId = cmpMeta.$lazyBundleId$;
|
4015
|
+
if (BUILD.isDev && typeof bundleId !== 'string') {
|
4016
|
+
consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
|
4017
|
+
return undefined;
|
4018
|
+
}
|
4019
|
+
const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
|
4020
|
+
if (module) {
|
4021
|
+
return module[exportName];
|
4022
|
+
}
|
4023
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
4024
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
4025
|
+
/* @vite-ignore */
|
4026
|
+
/* webpackInclude: /\.entry\.js$/ */
|
4027
|
+
/* webpackExclude: /\.system\.entry\.js$/ */
|
4028
|
+
/* webpackMode: "lazy" */
|
4029
|
+
`./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`)); }).then((importedModule) => {
|
4030
|
+
if (!BUILD.hotModuleReplacement) {
|
4031
|
+
cmpModules.set(bundleId, importedModule);
|
4032
|
+
}
|
4033
|
+
return importedModule[exportName];
|
4034
|
+
}, consoleError);
|
4035
|
+
};
|
4036
|
+
const styles = /*@__PURE__*/ new Map();
|
4037
|
+
const modeResolutionChain = [];
|
4038
|
+
const win = typeof window !== 'undefined' ? window : {};
|
4039
|
+
const doc = win.document || { head: {} };
|
4040
|
+
const H = (win.HTMLElement || class {
|
4041
|
+
});
|
4042
|
+
const plt = {
|
4043
|
+
$flags$: 0,
|
4044
|
+
$resourcesUrl$: '',
|
4045
|
+
jmp: (h) => h(),
|
4046
|
+
raf: (h) => requestAnimationFrame(h),
|
4047
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
4048
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
4049
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
4050
|
+
};
|
4051
|
+
const setPlatformHelpers = (helpers) => {
|
4052
|
+
Object.assign(plt, helpers);
|
4053
|
+
};
|
4054
|
+
const supportsShadow =
|
4055
|
+
// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
4056
|
+
BUILD.shadowDomShim && BUILD.shadowDom
|
4057
|
+
? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
4058
|
+
: true;
|
4059
|
+
const supportsListenerOptions = /*@__PURE__*/ (() => {
|
4060
|
+
let supportsListenerOptions = false;
|
4061
|
+
try {
|
4062
|
+
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
|
4063
|
+
get() {
|
4064
|
+
supportsListenerOptions = true;
|
4065
|
+
},
|
4066
|
+
}));
|
4067
|
+
}
|
4068
|
+
catch (e) { }
|
4069
|
+
return supportsListenerOptions;
|
4070
|
+
})();
|
4071
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
4072
|
+
const supportsConstructableStylesheets = BUILD.constructableCSS
|
4073
|
+
? /*@__PURE__*/ (() => {
|
4074
|
+
try {
|
4075
|
+
new CSSStyleSheet();
|
4076
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
4077
|
+
}
|
4078
|
+
catch (e) { }
|
4079
|
+
return false;
|
4080
|
+
})()
|
4081
|
+
: false;
|
4082
|
+
const queueDomReads = [];
|
4083
|
+
const queueDomWrites = [];
|
4084
|
+
const queueDomWritesLow = [];
|
4085
|
+
const queueTask = (queue, write) => (cb) => {
|
4086
|
+
queue.push(cb);
|
4087
|
+
if (!queuePending) {
|
4088
|
+
queuePending = true;
|
4089
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
4090
|
+
nextTick(flush);
|
4091
|
+
}
|
4092
|
+
else {
|
4093
|
+
plt.raf(flush);
|
4094
|
+
}
|
4095
|
+
}
|
4096
|
+
};
|
4097
|
+
const consume = (queue) => {
|
4098
|
+
for (let i = 0; i < queue.length; i++) {
|
4099
|
+
try {
|
4100
|
+
queue[i](performance.now());
|
4101
|
+
}
|
4102
|
+
catch (e) {
|
4103
|
+
consoleError(e);
|
4104
|
+
}
|
4105
|
+
}
|
4106
|
+
queue.length = 0;
|
4107
|
+
};
|
4108
|
+
const consumeTimeout = (queue, timeout) => {
|
4109
|
+
let i = 0;
|
4110
|
+
let ts = 0;
|
4111
|
+
while (i < queue.length && (ts = performance.now()) < timeout) {
|
4112
|
+
try {
|
4113
|
+
queue[i++](ts);
|
4114
|
+
}
|
4115
|
+
catch (e) {
|
4116
|
+
consoleError(e);
|
4117
|
+
}
|
4118
|
+
}
|
4119
|
+
if (i === queue.length) {
|
4120
|
+
queue.length = 0;
|
4121
|
+
}
|
4122
|
+
else if (i !== 0) {
|
4123
|
+
queue.splice(0, i);
|
4124
|
+
}
|
4125
|
+
};
|
4126
|
+
const flush = () => {
|
4127
|
+
if (BUILD.asyncQueue) {
|
4128
|
+
queueCongestion++;
|
4129
|
+
}
|
4130
|
+
// always force a bunch of medium callbacks to run, but still have
|
4131
|
+
// a throttle on how many can run in a certain time
|
4132
|
+
// DOM READS!!!
|
4133
|
+
consume(queueDomReads);
|
4134
|
+
// DOM WRITES!!!
|
4135
|
+
if (BUILD.asyncQueue) {
|
4136
|
+
const timeout = (plt.$flags$ & 6 /* PLATFORM_FLAGS.queueMask */) === 2 /* PLATFORM_FLAGS.appLoaded */
|
4137
|
+
? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
|
4138
|
+
: Infinity;
|
4139
|
+
consumeTimeout(queueDomWrites, timeout);
|
4140
|
+
consumeTimeout(queueDomWritesLow, timeout);
|
4141
|
+
if (queueDomWrites.length > 0) {
|
4142
|
+
queueDomWritesLow.push(...queueDomWrites);
|
4143
|
+
queueDomWrites.length = 0;
|
4144
|
+
}
|
4145
|
+
if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
|
4146
|
+
// still more to do yet, but we've run out of time
|
4147
|
+
// let's let this thing cool off and try again in the next tick
|
4148
|
+
plt.raf(flush);
|
4149
|
+
}
|
4150
|
+
else {
|
4151
|
+
queueCongestion = 0;
|
4152
|
+
}
|
4153
|
+
}
|
4154
|
+
else {
|
4155
|
+
consume(queueDomWrites);
|
4156
|
+
if ((queuePending = queueDomReads.length > 0)) {
|
4157
|
+
// still more to do yet, but we've run out of time
|
4158
|
+
// let's let this thing cool off and try again in the next tick
|
4159
|
+
plt.raf(flush);
|
4160
|
+
}
|
4161
|
+
}
|
4162
|
+
};
|
4163
|
+
const nextTick = (cb) => promiseResolve().then(cb);
|
4164
|
+
const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
|
4165
|
+
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
4166
|
+
|
4167
|
+
exports.BUILD = BUILD;
|
4168
|
+
exports.Build = Build;
|
4169
|
+
exports.Fragment = Fragment;
|
4170
|
+
exports.H = H;
|
4171
|
+
exports.Host = Host;
|
4172
|
+
exports.NAMESPACE = NAMESPACE;
|
4173
|
+
exports.bootstrapLazy = bootstrapLazy;
|
4174
|
+
exports.consoleDevInfo = consoleDevInfo;
|
4175
|
+
exports.createEvent = createEvent;
|
4176
|
+
exports.doc = doc;
|
4177
|
+
exports.forceUpdate = forceUpdate;
|
4178
|
+
exports.getAssetPath = getAssetPath;
|
4179
|
+
exports.getElement = getElement;
|
4180
|
+
exports.getRenderingRef = getRenderingRef;
|
4181
|
+
exports.h = h;
|
4182
|
+
exports.promiseResolve = promiseResolve;
|
4183
|
+
exports.readTask = readTask;
|
4184
|
+
exports.registerInstance = registerInstance;
|
4185
|
+
exports.setNonce = setNonce;
|