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