@sankhyalabs/sankhyablocks 1.4.0-beta.1 → 1.4.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkMessageBuilder-7717f1e4.js → SnkMessageBuilder-6c2f7bcd.js} +107 -131
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/configurableElementsStorage-93459c72.js +20 -0
- package/dist/cjs/constants-9056ca9e.js +84 -0
- package/dist/cjs/draggable.bundle-82a25c06.js +6886 -0
- package/dist/cjs/{filter-item-type.enum-e2e1bc5b.js → filter-item-type.enum-3daf58d3.js} +2 -0
- package/dist/cjs/form-config-fetcher-2de7c16a.js +6895 -0
- package/dist/cjs/{index-b0b676c5.js → index-20e8b68a.js} +165 -1473
- package/dist/cjs/loader.cjs.js +2 -18
- package/dist/cjs/sankhyablocks.cjs.js +4 -116
- package/dist/cjs/snk-application.cjs.entry.js +330 -7196
- package/dist/cjs/snk-config-modal.cjs.entry.js +62 -0
- package/dist/cjs/snk-config-options.cjs.entry.js +230 -0
- package/dist/cjs/snk-configurator_6.cjs.entry.js +1156 -0
- package/dist/cjs/snk-crud.cjs.entry.js +21 -13
- package/dist/cjs/snk-data-unit.cjs.entry.js +24 -32
- package/dist/cjs/snk-field-config_2.cjs.entry.js +135 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +5 -2
- package/dist/cjs/snk-filter-detail.cjs.entry.js +62 -5
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +6 -3
- package/dist/cjs/snk-filter-number.cjs.entry.js +6 -3
- package/dist/cjs/snk-filter-period.cjs.entry.js +5 -2
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +89 -0
- package/dist/cjs/snk-filter-search.cjs.entry.js +7 -13
- package/dist/cjs/snk-filter-text.cjs.entry.js +2 -2
- package/dist/cjs/snk-form-config.cjs.entry.js +957 -0
- package/dist/cjs/snk-form.cjs.entry.js +41 -28
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
- package/dist/cjs/snk-tab-config.cjs.entry.js +321 -0
- package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-9a4b1e19.js} +10 -6
- package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +29 -1
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +236 -37
- package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
- package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
- package/dist/collection/components/snk-crud/snk-crud.js +46 -17
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +1 -28
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +180 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +22 -38
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +2 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +80 -20
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +65 -31
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +85 -19
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +222 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +39 -4
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +250 -141
- package/dist/collection/components/snk-form/snk-form.css +4 -0
- package/dist/collection/components/snk-form/snk-form.js +108 -30
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +315 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
- package/dist/collection/components/snk-grid/snk-grid.js +94 -26
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -5
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +35 -3
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +35 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +18 -10
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +15 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
- package/dist/collection/lib/index.js +1 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +11 -2
- package/dist/collection/lib/message/resources/crud-utils.msg.js +4 -0
- package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -2
- package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
- package/dist/collection/lib/utils/CrudUtils.js +73 -0
- package/dist/collection/lib/utils/constants.js +72 -0
- package/dist/components/SnkMessageBuilder.js +108 -131
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/constants.js +74 -0
- package/dist/components/filter-item-type.enum.js +2 -0
- package/dist/{sankhyablocks/snk-application.entry.js → components/form-config-fetcher.js} +88 -1347
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +8 -4
- package/dist/components/snk-application2.js +313 -7173
- package/dist/components/snk-config-modal.d.ts +11 -0
- package/dist/components/snk-config-modal.js +6 -0
- package/dist/components/snk-config-modal2.js +91 -0
- package/dist/components/snk-config-options.d.ts +11 -0
- package/dist/components/snk-config-options.js +6 -0
- package/dist/components/snk-config-options2.js +245 -0
- package/dist/components/snk-configurator.d.ts +11 -0
- package/dist/components/snk-configurator.js +6 -0
- package/dist/components/snk-configurator2.js +212 -0
- package/dist/components/snk-crud.js +76 -26
- package/dist/components/snk-data-unit.js +4 -13
- package/dist/components/snk-field-config.d.ts +11 -0
- package/dist/components/snk-field-config.js +6 -0
- package/dist/components/snk-field-config2.js +70 -0
- package/dist/components/snk-filter-bar2.js +354 -148
- package/dist/components/snk-filter-binary-select.js +5 -1
- package/dist/components/snk-filter-detail2.js +62 -5
- package/dist/components/snk-filter-item2.js +52 -33
- package/dist/components/snk-filter-list2.js +60 -22
- package/dist/components/snk-filter-modal.d.ts +11 -0
- package/dist/components/snk-filter-modal.js +6 -0
- package/dist/components/snk-filter-modal2.js +84 -0
- package/dist/components/snk-filter-multi-select.js +6 -2
- package/dist/components/snk-filter-number.js +6 -2
- package/dist/components/snk-filter-period.js +5 -1
- package/dist/components/snk-filter-personalized.d.ts +11 -0
- package/dist/components/snk-filter-personalized.js +108 -0
- package/dist/components/snk-filter-search.js +5 -12
- package/dist/components/snk-filter-text.js +1 -1
- package/dist/components/snk-form-config.d.ts +11 -0
- package/dist/components/snk-form-config.js +6 -0
- package/dist/components/snk-form-config2.js +996 -0
- package/dist/components/snk-form2.js +79 -29
- package/dist/components/snk-grid2.js +57 -32
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-tab-config.d.ts +11 -0
- package/dist/components/snk-tab-config.js +6 -0
- package/dist/components/snk-tab-config2.js +7220 -0
- package/dist/components/snk-taskbar2.js +28 -10
- package/dist/components/teste-pesquisa.js +1 -1
- package/dist/{sankhyablocks/SnkMessageBuilder-a7da466b.js → esm/SnkMessageBuilder-5792c260.js} +108 -131
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
- package/dist/esm/constants-c6039d3d.js +74 -0
- package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
- package/dist/esm/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
- package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
- package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-e4121713.js} +165 -1466
- package/dist/esm/loader.js +2 -18
- package/dist/esm/sankhyablocks.js +4 -116
- package/dist/esm/snk-application.entry.js +308 -7174
- package/dist/esm/snk-config-modal.entry.js +58 -0
- package/dist/esm/snk-config-options.entry.js +226 -0
- package/dist/esm/snk-configurator_6.entry.js +1147 -0
- package/dist/esm/snk-crud.entry.js +20 -12
- package/dist/esm/snk-data-unit.entry.js +5 -13
- package/dist/esm/snk-field-config_2.entry.js +130 -0
- package/dist/esm/snk-filter-binary-select.entry.js +5 -2
- package/dist/esm/snk-filter-detail.entry.js +62 -5
- package/dist/esm/snk-filter-multi-select.entry.js +6 -3
- package/dist/esm/snk-filter-number.entry.js +6 -3
- package/dist/esm/snk-filter-period.entry.js +5 -2
- package/dist/esm/snk-filter-personalized.entry.js +85 -0
- package/dist/esm/snk-filter-search.entry.js +6 -12
- package/dist/esm/snk-filter-text.entry.js +2 -2
- package/dist/esm/snk-form-config.entry.js +953 -0
- package/dist/esm/snk-form.entry.js +40 -27
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/snk-tab-config.entry.js +317 -0
- package/dist/{sankhyablocks/taskbar-elements-35d64ff9.js → esm/taskbar-elements-e2ed0536.js} +10 -6
- package/dist/esm/teste-pesquisa.entry.js +2 -2
- package/dist/sankhyablocks/index.esm.js +0 -1
- package/dist/sankhyablocks/p-029ae4e4.entry.js +1 -0
- package/dist/sankhyablocks/p-03f9c407.js +1 -0
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-12ad2a19.entry.js +1 -0
- package/dist/sankhyablocks/p-21c8929b.js +1 -0
- package/dist/sankhyablocks/p-2b891c4a.entry.js +1 -0
- package/dist/sankhyablocks/p-2dc76d79.entry.js +1 -0
- package/dist/sankhyablocks/p-361299e8.js +26 -0
- package/dist/sankhyablocks/p-3a276f3d.entry.js +1 -0
- package/dist/sankhyablocks/p-400cc777.entry.js +1 -0
- package/dist/sankhyablocks/p-44ce5b90.entry.js +1 -0
- package/dist/sankhyablocks/p-521c96f0.entry.js +1 -0
- package/dist/sankhyablocks/p-60eef7cd.entry.js +1 -0
- package/dist/sankhyablocks/p-6988f4a6.entry.js +1 -0
- package/dist/sankhyablocks/p-6a4162bd.entry.js +1 -0
- package/dist/sankhyablocks/p-776ff4d1.entry.js +1 -0
- package/dist/sankhyablocks/p-9ba3df4c.js +2 -0
- package/dist/sankhyablocks/p-9dc4426d.entry.js +1 -0
- package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
- package/dist/sankhyablocks/p-a17a4fca.entry.js +1 -0
- package/dist/sankhyablocks/p-a5b26df2.js +1 -0
- package/dist/sankhyablocks/p-b6d6b172.js +1 -0
- package/dist/sankhyablocks/p-cc4bef9f.entry.js +1 -0
- package/dist/sankhyablocks/p-d50651a3.js +1 -0
- package/dist/sankhyablocks/p-d690b6b5.entry.js +75 -0
- package/dist/sankhyablocks/p-d9fbb26f.js +1 -0
- package/dist/sankhyablocks/p-deb1f523.entry.js +1 -0
- package/dist/sankhyablocks/p-e871aa92.entry.js +1 -0
- package/dist/sankhyablocks/p-e9beab79.entry.js +1 -0
- package/dist/sankhyablocks/p-f37cdeb5.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
- package/dist/types/components/snk-application/snk-application.d.ts +38 -16
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
- package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
- package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
- package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +24 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +4 -5
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +3 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +7 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +8 -3
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +26 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +31 -17
- package/dist/types/components/snk-form/snk-form.d.ts +71 -0
- package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +51 -0
- package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
- package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +6 -5
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -3
- package/dist/types/components.d.ts +424 -24
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +7 -7
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
- package/dist/types/lib/index.d.ts +1 -0
- package/dist/types/lib/message/resources/crud-utils.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
- package/dist/types/lib/utils/CrudUtils.d.ts +6 -0
- package/dist/types/lib/utils/constants.d.ts +76 -0
- package/dist/types/lib/utils/pesquisa.d.ts +2 -1
- package/package.json +4 -3
- package/react/components.d.ts +25 -0
- package/react/components.js +25 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -5
- package/dist/cjs/css-shim-b8158822.js +0 -6
- package/dist/cjs/dom-36862b77.js +0 -75
- package/dist/cjs/index-02201bc9.js +0 -2397
- package/dist/cjs/shadow-css-346c0795.js +0 -389
- package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -278
- package/dist/cjs/snk-filter-item.cjs.entry.js +0 -154
- package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
- package/dist/cjs/snk-grid.cjs.entry.js +0 -79
- package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
- package/dist/components/index2.js +0 -2384
- package/dist/esm/SnkMessageBuilder-a7da466b.js +0 -303
- package/dist/esm/app-globals-0f993ce5.js +0 -3
- package/dist/esm/css-shim-b3f2ee8d.js +0 -4
- package/dist/esm/dom-665d6011.js +0 -73
- package/dist/esm/index-2b4d2d14.js +0 -3262
- package/dist/esm/index-f1d3e4da.js +0 -2384
- package/dist/esm/shadow-css-b18e99d7.js +0 -387
- package/dist/esm/snk-filter-bar.entry.js +0 -274
- package/dist/esm/snk-filter-item.entry.js +0 -150
- package/dist/esm/snk-filter-list.entry.js +0 -87
- package/dist/esm/snk-grid.entry.js +0 -75
- package/dist/esm/snk-taskbar.entry.js +0 -156
- package/dist/esm/taskbar-elements-35d64ff9.js +0 -90
- package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
- package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
- package/dist/sankhyablocks/dom-665d6011.js +0 -73
- package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +0 -12
- package/dist/sankhyablocks/index-f1d3e4da.js +0 -2384
- package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
- package/dist/sankhyablocks/snk-crud.entry.js +0 -66
- package/dist/sankhyablocks/snk-data-unit.entry.js +0 -276
- package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -274
- package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
- package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -45
- package/dist/sankhyablocks/snk-filter-item.entry.js +0 -150
- package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
- package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
- package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
- package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
- package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
- package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
- package/dist/sankhyablocks/snk-form.entry.js +0 -129
- package/dist/sankhyablocks/snk-grid.entry.js +0 -75
- package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
- package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
- package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
- package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const NAMESPACE = 'sankhyablocks';
|
|
2
|
-
const BUILD = /* sankhyablocks */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: true, cssAnnotations: true, cssVarShim: false, devTools: false, disconnectedCallback: true, dynamicImportShim: false, element: false, event: true, hasRenderFn: true, hostListener: true, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, 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, safari10: false, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, shadowDomShim: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: true };
|
|
3
|
-
const Env = /* sankhyablocks */ {};
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Virtual DOM patching algorithm based on Snabbdom by
|
|
@@ -13,120 +11,25 @@ const Env = /* sankhyablocks */ {};
|
|
|
13
11
|
let scopeId;
|
|
14
12
|
let contentRef;
|
|
15
13
|
let hostTagName;
|
|
16
|
-
let customError;
|
|
17
|
-
let i = 0;
|
|
18
14
|
let useNativeShadowDom = false;
|
|
19
15
|
let checkSlotFallbackVisibility = false;
|
|
20
16
|
let checkSlotRelocate = false;
|
|
21
17
|
let isSvgMode = false;
|
|
22
|
-
let renderingRef = null;
|
|
23
|
-
let queueCongestion = 0;
|
|
24
18
|
let queuePending = false;
|
|
25
|
-
const Build = {
|
|
26
|
-
isDev: BUILD.isDev ? true : false,
|
|
27
|
-
isBrowser: true,
|
|
28
|
-
isServer: false,
|
|
29
|
-
isTesting: BUILD.isTesting ? true : false,
|
|
30
|
-
};
|
|
31
|
-
const Context = {};
|
|
32
|
-
const getAssetPath = (path) => {
|
|
33
|
-
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
|
34
|
-
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
35
|
-
};
|
|
36
|
-
const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
|
|
37
19
|
const createTime = (fnName, tagName = '') => {
|
|
38
|
-
|
|
39
|
-
const key = `st:${fnName}:${tagName}:${i++}`;
|
|
40
|
-
// Start
|
|
41
|
-
performance.mark(key);
|
|
42
|
-
// End
|
|
43
|
-
return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
20
|
+
{
|
|
46
21
|
return () => {
|
|
47
22
|
return;
|
|
48
23
|
};
|
|
49
24
|
}
|
|
50
25
|
};
|
|
51
26
|
const uniqueTime = (key, measureText) => {
|
|
52
|
-
|
|
53
|
-
if (performance.getEntriesByName(key).length === 0) {
|
|
54
|
-
performance.mark(key);
|
|
55
|
-
}
|
|
56
|
-
return () => {
|
|
57
|
-
if (performance.getEntriesByName(measureText).length === 0) {
|
|
58
|
-
performance.measure(measureText, key);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
27
|
+
{
|
|
63
28
|
return () => {
|
|
64
29
|
return;
|
|
65
30
|
};
|
|
66
31
|
}
|
|
67
32
|
};
|
|
68
|
-
const inspect = (ref) => {
|
|
69
|
-
const hostRef = getHostRef(ref);
|
|
70
|
-
if (!hostRef) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
const flags = hostRef.$flags$;
|
|
74
|
-
const hostElement = hostRef.$hostElement$;
|
|
75
|
-
return {
|
|
76
|
-
renderCount: hostRef.$renderCount$,
|
|
77
|
-
flags: {
|
|
78
|
-
hasRendered: !!(flags & 2 /* HOST_FLAGS.hasRendered */),
|
|
79
|
-
hasConnected: !!(flags & 1 /* HOST_FLAGS.hasConnected */),
|
|
80
|
-
isWaitingForChildren: !!(flags & 4 /* HOST_FLAGS.isWaitingForChildren */),
|
|
81
|
-
isConstructingInstance: !!(flags & 8 /* HOST_FLAGS.isConstructingInstance */),
|
|
82
|
-
isQueuedForUpdate: !!(flags & 16 /* HOST_FLAGS.isQueuedForUpdate */),
|
|
83
|
-
hasInitializedComponent: !!(flags & 32 /* HOST_FLAGS.hasInitializedComponent */),
|
|
84
|
-
hasLoadedComponent: !!(flags & 64 /* HOST_FLAGS.hasLoadedComponent */),
|
|
85
|
-
isWatchReady: !!(flags & 128 /* HOST_FLAGS.isWatchReady */),
|
|
86
|
-
isListenReady: !!(flags & 256 /* HOST_FLAGS.isListenReady */),
|
|
87
|
-
needsRerender: !!(flags & 512 /* HOST_FLAGS.needsRerender */),
|
|
88
|
-
},
|
|
89
|
-
instanceValues: hostRef.$instanceValues$,
|
|
90
|
-
ancestorComponent: hostRef.$ancestorComponent$,
|
|
91
|
-
hostElement,
|
|
92
|
-
lazyInstance: hostRef.$lazyInstance$,
|
|
93
|
-
vnode: hostRef.$vnode$,
|
|
94
|
-
modeName: hostRef.$modeName$,
|
|
95
|
-
onReadyPromise: hostRef.$onReadyPromise$,
|
|
96
|
-
onReadyResolve: hostRef.$onReadyResolve$,
|
|
97
|
-
onInstancePromise: hostRef.$onInstancePromise$,
|
|
98
|
-
onInstanceResolve: hostRef.$onInstanceResolve$,
|
|
99
|
-
onRenderResolve: hostRef.$onRenderResolve$,
|
|
100
|
-
queuedListeners: hostRef.$queuedListeners$,
|
|
101
|
-
rmListeners: hostRef.$rmListeners$,
|
|
102
|
-
['s-id']: hostElement['s-id'],
|
|
103
|
-
['s-cr']: hostElement['s-cr'],
|
|
104
|
-
['s-lr']: hostElement['s-lr'],
|
|
105
|
-
['s-p']: hostElement['s-p'],
|
|
106
|
-
['s-rc']: hostElement['s-rc'],
|
|
107
|
-
['s-sc']: hostElement['s-sc'],
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
const installDevTools = () => {
|
|
111
|
-
if (BUILD.devTools) {
|
|
112
|
-
const stencil = (win.stencil = win.stencil || {});
|
|
113
|
-
const originalInspect = stencil.inspect;
|
|
114
|
-
stencil.inspect = (ref) => {
|
|
115
|
-
let result = inspect(ref);
|
|
116
|
-
if (!result && typeof originalInspect === 'function') {
|
|
117
|
-
result = originalInspect(ref);
|
|
118
|
-
}
|
|
119
|
-
return result;
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const CONTENT_REF_ID = 'r';
|
|
124
|
-
const ORG_LOCATION_ID = 'o';
|
|
125
|
-
const SLOT_NODE_ID = 's';
|
|
126
|
-
const TEXT_NODE_ID = 't';
|
|
127
|
-
const HYDRATE_ID = 's-id';
|
|
128
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
129
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
130
33
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
131
34
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
132
35
|
/**
|
|
@@ -137,11 +40,6 @@ const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
|
137
40
|
* Don't add values to these!!
|
|
138
41
|
*/
|
|
139
42
|
const EMPTY_OBJ = {};
|
|
140
|
-
/**
|
|
141
|
-
* Namespaces
|
|
142
|
-
*/
|
|
143
|
-
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
144
|
-
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
145
43
|
const isDef = (v) => v != null;
|
|
146
44
|
const isComplexType = (o) => {
|
|
147
45
|
// https://jsperf.com/typeof-fn-object/5
|
|
@@ -176,11 +74,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
176
74
|
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
|
|
177
75
|
child = String(child);
|
|
178
76
|
}
|
|
179
|
-
else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
|
|
180
|
-
consoleDevError(`vNode passed as children has unexpected type.
|
|
181
|
-
Make sure it's using the correct h() function.
|
|
182
|
-
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
|
183
|
-
}
|
|
184
77
|
if (simple && lastSimple) {
|
|
185
78
|
// If the previous child was simple (string), we merge both
|
|
186
79
|
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
@@ -195,17 +88,14 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
195
88
|
};
|
|
196
89
|
walk(children);
|
|
197
90
|
if (vnodeData) {
|
|
198
|
-
if (BUILD.isDev && nodeName === 'input') {
|
|
199
|
-
validateInputProperties(vnodeData);
|
|
200
|
-
}
|
|
201
91
|
// normalize class / classname attributes
|
|
202
|
-
if (
|
|
92
|
+
if (vnodeData.key) {
|
|
203
93
|
key = vnodeData.key;
|
|
204
94
|
}
|
|
205
|
-
if (
|
|
95
|
+
if (vnodeData.name) {
|
|
206
96
|
slotName = vnodeData.name;
|
|
207
97
|
}
|
|
208
|
-
|
|
98
|
+
{
|
|
209
99
|
const classData = vnodeData.className || vnodeData.class;
|
|
210
100
|
if (classData) {
|
|
211
101
|
vnodeData.class =
|
|
@@ -217,12 +107,7 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
217
107
|
}
|
|
218
108
|
}
|
|
219
109
|
}
|
|
220
|
-
if (
|
|
221
|
-
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
222
|
-
- You are NOT using hostData() and <Host> in the same component.
|
|
223
|
-
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
224
|
-
}
|
|
225
|
-
if (BUILD.vdomFunctional && typeof nodeName === 'function') {
|
|
110
|
+
if (typeof nodeName === 'function') {
|
|
226
111
|
// nodeName is a functional component
|
|
227
112
|
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
228
113
|
}
|
|
@@ -231,10 +116,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
231
116
|
if (vNodeChildren.length > 0) {
|
|
232
117
|
vnode.$children$ = vNodeChildren;
|
|
233
118
|
}
|
|
234
|
-
|
|
119
|
+
{
|
|
235
120
|
vnode.$key$ = key;
|
|
236
121
|
}
|
|
237
|
-
|
|
122
|
+
{
|
|
238
123
|
vnode.$name$ = slotName;
|
|
239
124
|
}
|
|
240
125
|
return vnode;
|
|
@@ -247,13 +132,13 @@ const newVNode = (tag, text) => {
|
|
|
247
132
|
$elm$: null,
|
|
248
133
|
$children$: null,
|
|
249
134
|
};
|
|
250
|
-
|
|
135
|
+
{
|
|
251
136
|
vnode.$attrs$ = null;
|
|
252
137
|
}
|
|
253
|
-
|
|
138
|
+
{
|
|
254
139
|
vnode.$key$ = null;
|
|
255
140
|
}
|
|
256
|
-
|
|
141
|
+
{
|
|
257
142
|
vnode.$name$ = null;
|
|
258
143
|
}
|
|
259
144
|
return vnode;
|
|
@@ -290,234 +175,6 @@ const convertToPrivate = (node) => {
|
|
|
290
175
|
vnode.$name$ = node.vname;
|
|
291
176
|
return vnode;
|
|
292
177
|
};
|
|
293
|
-
/**
|
|
294
|
-
* Validates the ordering of attributes on an input element
|
|
295
|
-
* @param inputElm the element to validate
|
|
296
|
-
*/
|
|
297
|
-
const validateInputProperties = (inputElm) => {
|
|
298
|
-
const props = Object.keys(inputElm);
|
|
299
|
-
const value = props.indexOf('value');
|
|
300
|
-
if (value === -1) {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
const typeIndex = props.indexOf('type');
|
|
304
|
-
const minIndex = props.indexOf('min');
|
|
305
|
-
const maxIndex = props.indexOf('max');
|
|
306
|
-
const stepIndex = props.indexOf('step');
|
|
307
|
-
if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
|
|
308
|
-
consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
312
|
-
const endHydrate = createTime('hydrateClient', tagName);
|
|
313
|
-
const shadowRoot = hostElm.shadowRoot;
|
|
314
|
-
const childRenderNodes = [];
|
|
315
|
-
const slotNodes = [];
|
|
316
|
-
const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
|
|
317
|
-
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
318
|
-
if (!plt.$orgLocNodes$) {
|
|
319
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
320
|
-
}
|
|
321
|
-
hostElm[HYDRATE_ID] = hostId;
|
|
322
|
-
hostElm.removeAttribute(HYDRATE_ID);
|
|
323
|
-
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
324
|
-
childRenderNodes.map((c) => {
|
|
325
|
-
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
326
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
327
|
-
const node = c.$elm$;
|
|
328
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
329
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
330
|
-
}
|
|
331
|
-
if (!shadowRoot) {
|
|
332
|
-
node['s-hn'] = tagName;
|
|
333
|
-
if (orgLocationNode) {
|
|
334
|
-
node['s-ol'] = orgLocationNode;
|
|
335
|
-
node['s-ol']['s-nr'] = node;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
339
|
-
});
|
|
340
|
-
if (BUILD.shadowDom && shadowRoot) {
|
|
341
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
342
|
-
if (shadowRootNode) {
|
|
343
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
endHydrate();
|
|
348
|
-
};
|
|
349
|
-
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
350
|
-
let childNodeType;
|
|
351
|
-
let childIdSplt;
|
|
352
|
-
let childVNode;
|
|
353
|
-
let i;
|
|
354
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
355
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
356
|
-
if (childNodeType) {
|
|
357
|
-
// got the node data from the element's attribute
|
|
358
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
359
|
-
childIdSplt = childNodeType.split('.');
|
|
360
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
361
|
-
childVNode = {
|
|
362
|
-
$flags$: 0,
|
|
363
|
-
$hostId$: childIdSplt[0],
|
|
364
|
-
$nodeId$: childIdSplt[1],
|
|
365
|
-
$depth$: childIdSplt[2],
|
|
366
|
-
$index$: childIdSplt[3],
|
|
367
|
-
$tag$: node.tagName.toLowerCase(),
|
|
368
|
-
$elm$: node,
|
|
369
|
-
$attrs$: null,
|
|
370
|
-
$children$: null,
|
|
371
|
-
$key$: null,
|
|
372
|
-
$name$: null,
|
|
373
|
-
$text$: null,
|
|
374
|
-
};
|
|
375
|
-
childRenderNodes.push(childVNode);
|
|
376
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
377
|
-
// this is a new child vnode
|
|
378
|
-
// so ensure its parent vnode has the vchildren array
|
|
379
|
-
if (!parentVNode.$children$) {
|
|
380
|
-
parentVNode.$children$ = [];
|
|
381
|
-
}
|
|
382
|
-
// add our child vnode to a specific index of the vnode's children
|
|
383
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
384
|
-
// this is now the new parent vnode for all the next child checks
|
|
385
|
-
parentVNode = childVNode;
|
|
386
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
387
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
// recursively drill down, end to start so we can remove nodes
|
|
392
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
393
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
394
|
-
}
|
|
395
|
-
if (node.shadowRoot) {
|
|
396
|
-
// keep drilling down through the shadow root nodes
|
|
397
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
398
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
403
|
-
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
404
|
-
childIdSplt = node.nodeValue.split('.');
|
|
405
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
406
|
-
// comment node for either the host id or a 0 host id
|
|
407
|
-
childNodeType = childIdSplt[0];
|
|
408
|
-
childVNode = {
|
|
409
|
-
$flags$: 0,
|
|
410
|
-
$hostId$: childIdSplt[1],
|
|
411
|
-
$nodeId$: childIdSplt[2],
|
|
412
|
-
$depth$: childIdSplt[3],
|
|
413
|
-
$index$: childIdSplt[4],
|
|
414
|
-
$elm$: node,
|
|
415
|
-
$attrs$: null,
|
|
416
|
-
$children$: null,
|
|
417
|
-
$key$: null,
|
|
418
|
-
$name$: null,
|
|
419
|
-
$tag$: null,
|
|
420
|
-
$text$: null,
|
|
421
|
-
};
|
|
422
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
423
|
-
childVNode.$elm$ = node.nextSibling;
|
|
424
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
425
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
426
|
-
childRenderNodes.push(childVNode);
|
|
427
|
-
// remove the text comment since it's no longer needed
|
|
428
|
-
node.remove();
|
|
429
|
-
if (!parentVNode.$children$) {
|
|
430
|
-
parentVNode.$children$ = [];
|
|
431
|
-
}
|
|
432
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
433
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
434
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
else if (childVNode.$hostId$ === hostId) {
|
|
439
|
-
// this comment node is specifcally for this host id
|
|
440
|
-
if (childNodeType === SLOT_NODE_ID) {
|
|
441
|
-
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
442
|
-
childVNode.$tag$ = 'slot';
|
|
443
|
-
if (childIdSplt[5]) {
|
|
444
|
-
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
node['s-sn'] = '';
|
|
448
|
-
}
|
|
449
|
-
node['s-sr'] = true;
|
|
450
|
-
if (BUILD.shadowDom && shadowRootNodes) {
|
|
451
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
452
|
-
// create an actual slot element
|
|
453
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
454
|
-
if (childVNode.$name$) {
|
|
455
|
-
// add the slot name attribute
|
|
456
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
457
|
-
}
|
|
458
|
-
// insert the new slot element before the slot comment
|
|
459
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
460
|
-
// remove the slot comment since it's not needed for shadow
|
|
461
|
-
node.remove();
|
|
462
|
-
if (childVNode.$depth$ === '0') {
|
|
463
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
slotNodes.push(childVNode);
|
|
467
|
-
if (!parentVNode.$children$) {
|
|
468
|
-
parentVNode.$children$ = [];
|
|
469
|
-
}
|
|
470
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
471
|
-
}
|
|
472
|
-
else if (childNodeType === CONTENT_REF_ID) {
|
|
473
|
-
// `${CONTENT_REF_ID}.${hostId}`;
|
|
474
|
-
if (BUILD.shadowDom && shadowRootNodes) {
|
|
475
|
-
// remove the content ref comment since it's not needed for shadow
|
|
476
|
-
node.remove();
|
|
477
|
-
}
|
|
478
|
-
else if (BUILD.slotRelocation) {
|
|
479
|
-
hostElm['s-cr'] = node;
|
|
480
|
-
node['s-cn'] = true;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
487
|
-
const vnode = newVNode(null, node.textContent);
|
|
488
|
-
vnode.$elm$ = node;
|
|
489
|
-
vnode.$index$ = '0';
|
|
490
|
-
parentVNode.$children$ = [vnode];
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
494
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
495
|
-
let i = 0;
|
|
496
|
-
for (; i < node.childNodes.length; i++) {
|
|
497
|
-
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
498
|
-
}
|
|
499
|
-
if (node.shadowRoot) {
|
|
500
|
-
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
501
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
506
|
-
const childIdSplt = node.nodeValue.split('.');
|
|
507
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
508
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
509
|
-
node.nodeValue = '';
|
|
510
|
-
// useful to know if the original location is
|
|
511
|
-
// the root light-dom of a shadow dom component
|
|
512
|
-
node['s-en'] = childIdSplt[3];
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
// Private
|
|
517
|
-
const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
|
|
518
|
-
// Public
|
|
519
|
-
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
520
|
-
const getMode = (ref) => getHostRef(ref).$modeName$;
|
|
521
178
|
/**
|
|
522
179
|
* Parse a new property value for a given property type.
|
|
523
180
|
*
|
|
@@ -544,16 +201,16 @@ const getMode = (ref) => getHostRef(ref).$modeName$;
|
|
|
544
201
|
const parsePropertyValue = (propValue, propType) => {
|
|
545
202
|
// ensure this value is of the correct prop type
|
|
546
203
|
if (propValue != null && !isComplexType(propValue)) {
|
|
547
|
-
if (
|
|
204
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
548
205
|
// per the HTML spec, any string value means it is a boolean true value
|
|
549
206
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
550
207
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
551
208
|
}
|
|
552
|
-
if (
|
|
209
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
553
210
|
// force it to be a number
|
|
554
211
|
return parseFloat(propValue);
|
|
555
212
|
}
|
|
556
|
-
if (
|
|
213
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
557
214
|
// could have been passed as a number or boolean
|
|
558
215
|
// but we still want it as a string
|
|
559
216
|
return String(propValue);
|
|
@@ -565,14 +222,11 @@ const parsePropertyValue = (propValue, propType) => {
|
|
|
565
222
|
// so no need to change to a different type
|
|
566
223
|
return propValue;
|
|
567
224
|
};
|
|
568
|
-
const getElement = (ref) => (
|
|
225
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
569
226
|
const createEvent = (ref, name, flags) => {
|
|
570
227
|
const elm = getElement(ref);
|
|
571
228
|
return {
|
|
572
229
|
emit: (detail) => {
|
|
573
|
-
if (BUILD.isDev && !elm.isConnected) {
|
|
574
|
-
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
575
|
-
}
|
|
576
230
|
return emitEvent(elm, name, {
|
|
577
231
|
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
578
232
|
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
@@ -612,11 +266,8 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
612
266
|
styles.set(scopeId, style);
|
|
613
267
|
};
|
|
614
268
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
615
|
-
let scopeId = getScopeId(cmpMeta
|
|
269
|
+
let scopeId = getScopeId(cmpMeta);
|
|
616
270
|
const style = styles.get(scopeId);
|
|
617
|
-
if (!BUILD.attachStyles) {
|
|
618
|
-
return scopeId;
|
|
619
|
-
}
|
|
620
271
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
621
272
|
// so the fallback is to always use the document for the root node in those cases
|
|
622
273
|
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
@@ -629,31 +280,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
629
280
|
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
630
281
|
}
|
|
631
282
|
if (!appliedStyles.has(scopeId)) {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
635
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
636
|
-
styleElm.innerHTML = style;
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
640
|
-
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
|
|
641
|
-
const newScopeId = styleElm['s-sc'];
|
|
642
|
-
if (newScopeId) {
|
|
643
|
-
scopeId = newScopeId;
|
|
644
|
-
// we don't want to add this styleID to the appliedStyles Set
|
|
645
|
-
// since the cssVarShim might need to apply several different
|
|
646
|
-
// stylesheets for the same component
|
|
647
|
-
appliedStyles = null;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
283
|
+
{
|
|
284
|
+
{
|
|
651
285
|
styleElm = doc.createElement('style');
|
|
652
286
|
styleElm.innerHTML = style;
|
|
653
287
|
}
|
|
654
|
-
if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
|
|
655
|
-
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
|
|
656
|
-
}
|
|
657
288
|
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
658
289
|
}
|
|
659
290
|
if (appliedStyles) {
|
|
@@ -661,7 +292,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
661
292
|
}
|
|
662
293
|
}
|
|
663
294
|
}
|
|
664
|
-
else if (
|
|
295
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
665
296
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
666
297
|
}
|
|
667
298
|
}
|
|
@@ -672,8 +303,8 @@ const attachStyles = (hostRef) => {
|
|
|
672
303
|
const elm = hostRef.$hostElement$;
|
|
673
304
|
const flags = cmpMeta.$flags$;
|
|
674
305
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
675
|
-
const scopeId = addStyle(
|
|
676
|
-
if (
|
|
306
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
307
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
677
308
|
// only required when we're NOT using native shadow dom (slot)
|
|
678
309
|
// or this browser doesn't support native shadow dom
|
|
679
310
|
// and this host element was NOT created with SSR
|
|
@@ -683,14 +314,13 @@ const attachStyles = (hostRef) => {
|
|
|
683
314
|
// DOM WRITE!!
|
|
684
315
|
elm['s-sc'] = scopeId;
|
|
685
316
|
elm.classList.add(scopeId + '-h');
|
|
686
|
-
if (
|
|
317
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
687
318
|
elm.classList.add(scopeId + '-s');
|
|
688
319
|
}
|
|
689
320
|
}
|
|
690
321
|
endAttachStyles();
|
|
691
322
|
};
|
|
692
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
693
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
323
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
694
324
|
/**
|
|
695
325
|
* Production setAccessor() function based on Preact by
|
|
696
326
|
* Jason Miller (@developit)
|
|
@@ -703,19 +333,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
703
333
|
if (oldValue !== newValue) {
|
|
704
334
|
let isProp = isMemberInElement(elm, memberName);
|
|
705
335
|
let ln = memberName.toLowerCase();
|
|
706
|
-
if (
|
|
336
|
+
if (memberName === 'class') {
|
|
707
337
|
const classList = elm.classList;
|
|
708
338
|
const oldClasses = parseClassList(oldValue);
|
|
709
339
|
const newClasses = parseClassList(newValue);
|
|
710
340
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
711
341
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
712
342
|
}
|
|
713
|
-
else if (
|
|
343
|
+
else if (memberName === 'style') {
|
|
714
344
|
// update style attribute, css properties and values
|
|
715
|
-
|
|
345
|
+
{
|
|
716
346
|
for (const prop in oldValue) {
|
|
717
347
|
if (!newValue || newValue[prop] == null) {
|
|
718
|
-
if (
|
|
348
|
+
if (prop.includes('-')) {
|
|
719
349
|
elm.style.removeProperty(prop);
|
|
720
350
|
}
|
|
721
351
|
else {
|
|
@@ -726,7 +356,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
726
356
|
}
|
|
727
357
|
for (const prop in newValue) {
|
|
728
358
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
729
|
-
if (
|
|
359
|
+
if (prop.includes('-')) {
|
|
730
360
|
elm.style.setProperty(prop, newValue[prop]);
|
|
731
361
|
}
|
|
732
362
|
else {
|
|
@@ -735,16 +365,15 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
735
365
|
}
|
|
736
366
|
}
|
|
737
367
|
}
|
|
738
|
-
else if (
|
|
368
|
+
else if (memberName === 'key')
|
|
739
369
|
;
|
|
740
|
-
else if (
|
|
370
|
+
else if (memberName === 'ref') {
|
|
741
371
|
// minifier will clean this up
|
|
742
372
|
if (newValue) {
|
|
743
373
|
newValue(elm);
|
|
744
374
|
}
|
|
745
375
|
}
|
|
746
|
-
else if (
|
|
747
|
-
(BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
|
|
376
|
+
else if ((!isProp ) &&
|
|
748
377
|
memberName[0] === 'o' &&
|
|
749
378
|
memberName[1] === 'n') {
|
|
750
379
|
// Event Handlers
|
|
@@ -783,7 +412,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
783
412
|
plt.ael(elm, memberName, newValue, false);
|
|
784
413
|
}
|
|
785
414
|
}
|
|
786
|
-
else
|
|
415
|
+
else {
|
|
787
416
|
// Set property if it exists and it's not a SVG
|
|
788
417
|
const isComplex = isComplexType(newValue);
|
|
789
418
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
@@ -812,7 +441,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
812
441
|
* - if the newValue is null/undefined or 'false'.
|
|
813
442
|
*/
|
|
814
443
|
let xlink = false;
|
|
815
|
-
|
|
444
|
+
{
|
|
816
445
|
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
|
817
446
|
memberName = ln;
|
|
818
447
|
xlink = true;
|
|
@@ -820,7 +449,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
820
449
|
}
|
|
821
450
|
if (newValue == null || newValue === false) {
|
|
822
451
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
823
|
-
if (
|
|
452
|
+
if (xlink) {
|
|
824
453
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
825
454
|
}
|
|
826
455
|
else {
|
|
@@ -830,7 +459,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
830
459
|
}
|
|
831
460
|
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
832
461
|
newValue = newValue === true ? '' : newValue;
|
|
833
|
-
if (
|
|
462
|
+
if (xlink) {
|
|
834
463
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
835
464
|
}
|
|
836
465
|
else {
|
|
@@ -851,7 +480,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
851
480
|
: newVnode.$elm$;
|
|
852
481
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
853
482
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
854
|
-
|
|
483
|
+
{
|
|
855
484
|
// remove attributes no longer present on the vnode by setting them to undefined
|
|
856
485
|
for (memberName in oldVnodeAttrs) {
|
|
857
486
|
if (!(memberName in newVnodeAttrs)) {
|
|
@@ -881,7 +510,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
881
510
|
let elm;
|
|
882
511
|
let childNode;
|
|
883
512
|
let oldVNode;
|
|
884
|
-
if (
|
|
513
|
+
if (!useNativeShadowDom) {
|
|
885
514
|
// remember for later we need to check to relocate nodes
|
|
886
515
|
checkSlotRelocate = true;
|
|
887
516
|
if (newVNode.$tag$ === 'slot') {
|
|
@@ -896,38 +525,25 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
896
525
|
1 /* VNODE_FLAGS.isSlotReference */;
|
|
897
526
|
}
|
|
898
527
|
}
|
|
899
|
-
if (
|
|
900
|
-
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`);
|
|
901
|
-
}
|
|
902
|
-
if (BUILD.vdomText && newVNode.$text$ !== null) {
|
|
528
|
+
if (newVNode.$text$ !== null) {
|
|
903
529
|
// create text node
|
|
904
530
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
905
531
|
}
|
|
906
|
-
else if (
|
|
532
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
907
533
|
// create a slot reference node
|
|
908
534
|
elm = newVNode.$elm$ =
|
|
909
|
-
|
|
535
|
+
doc.createTextNode('');
|
|
910
536
|
}
|
|
911
537
|
else {
|
|
912
|
-
if (BUILD.svg && !isSvgMode) {
|
|
913
|
-
isSvgMode = newVNode.$tag$ === 'svg';
|
|
914
|
-
}
|
|
915
538
|
// create element
|
|
916
|
-
elm = newVNode.$elm$ = (
|
|
917
|
-
? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
918
|
-
? 'slot-fb'
|
|
919
|
-
: newVNode.$tag$)
|
|
920
|
-
: doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
539
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
921
540
|
? 'slot-fb'
|
|
922
541
|
: newVNode.$tag$));
|
|
923
|
-
if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
924
|
-
isSvgMode = false;
|
|
925
|
-
}
|
|
926
542
|
// add css classes, attrs, props, listeners, etc.
|
|
927
|
-
|
|
543
|
+
{
|
|
928
544
|
updateElement(null, newVNode, isSvgMode);
|
|
929
545
|
}
|
|
930
|
-
if (
|
|
546
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
931
547
|
// if there is a scopeId and this is the initial render
|
|
932
548
|
// then let's add the scopeId as a css class
|
|
933
549
|
elm.classList.add((elm['s-si'] = scopeId));
|
|
@@ -943,18 +559,8 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
943
559
|
}
|
|
944
560
|
}
|
|
945
561
|
}
|
|
946
|
-
if (BUILD.svg) {
|
|
947
|
-
if (newVNode.$tag$ === 'svg') {
|
|
948
|
-
// Only reset the SVG context when we're exiting <svg> element
|
|
949
|
-
isSvgMode = false;
|
|
950
|
-
}
|
|
951
|
-
else if (elm.tagName === 'foreignObject') {
|
|
952
|
-
// Reenter SVG context when we're exiting <foreignObject> element
|
|
953
|
-
isSvgMode = true;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
562
|
}
|
|
957
|
-
|
|
563
|
+
{
|
|
958
564
|
elm['s-hn'] = hostTagName;
|
|
959
565
|
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
960
566
|
// remember the content reference comment
|
|
@@ -999,9 +605,9 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
999
605
|
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1000
606
|
};
|
|
1001
607
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
1002
|
-
let containerElm = ((
|
|
608
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
1003
609
|
let childNode;
|
|
1004
|
-
if (
|
|
610
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
1005
611
|
containerElm = containerElm.shadowRoot;
|
|
1006
612
|
}
|
|
1007
613
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -1009,7 +615,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
1009
615
|
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
1010
616
|
if (childNode) {
|
|
1011
617
|
vnodes[startIdx].$elm$ = childNode;
|
|
1012
|
-
containerElm.insertBefore(childNode,
|
|
618
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
1013
619
|
}
|
|
1014
620
|
}
|
|
1015
621
|
}
|
|
@@ -1019,7 +625,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
1019
625
|
if ((vnode = vnodes[startIdx])) {
|
|
1020
626
|
elm = vnode.$elm$;
|
|
1021
627
|
callNodeRefs(vnode);
|
|
1022
|
-
|
|
628
|
+
{
|
|
1023
629
|
// we're removing this element
|
|
1024
630
|
// so it's possible we need to show slot fallback content now
|
|
1025
631
|
checkSlotFallbackVisibility = true;
|
|
@@ -1165,7 +771,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1165
771
|
//
|
|
1166
772
|
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
1167
773
|
// and move the DOM element for `oldStartVnode`.
|
|
1168
|
-
if (
|
|
774
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
1169
775
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
1170
776
|
}
|
|
1171
777
|
patch(oldStartVnode, newEndVnode);
|
|
@@ -1206,7 +812,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1206
812
|
// (which will handle updating any changed attributes, reconciling their
|
|
1207
813
|
// children etc) but we also need to move the DOM node to which
|
|
1208
814
|
// `oldEndVnode` corresponds.
|
|
1209
|
-
if (
|
|
815
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
1210
816
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
1211
817
|
}
|
|
1212
818
|
patch(oldEndVnode, newStartVnode);
|
|
@@ -1229,7 +835,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1229
835
|
// children which have the same key as the first node in the new
|
|
1230
836
|
// children.
|
|
1231
837
|
idxInOld = -1;
|
|
1232
|
-
|
|
838
|
+
{
|
|
1233
839
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
1234
840
|
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
1235
841
|
idxInOld = i;
|
|
@@ -1237,7 +843,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1237
843
|
}
|
|
1238
844
|
}
|
|
1239
845
|
}
|
|
1240
|
-
if (
|
|
846
|
+
if (idxInOld >= 0) {
|
|
1241
847
|
// We found a node in the old children which matches up with the first
|
|
1242
848
|
// node in the new children! So let's deal with that
|
|
1243
849
|
elmToMove = oldCh[idxInOld];
|
|
@@ -1264,12 +870,9 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1264
870
|
}
|
|
1265
871
|
if (node) {
|
|
1266
872
|
// if we created a new node then handle inserting it to the DOM
|
|
1267
|
-
|
|
873
|
+
{
|
|
1268
874
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
1269
875
|
}
|
|
1270
|
-
else {
|
|
1271
|
-
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
1272
|
-
}
|
|
1273
876
|
}
|
|
1274
877
|
}
|
|
1275
878
|
}
|
|
@@ -1277,7 +880,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1277
880
|
// we have some more new nodes to add which don't match up with old nodes
|
|
1278
881
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
1279
882
|
}
|
|
1280
|
-
else if (
|
|
883
|
+
else if (newStartIdx > newEndIdx) {
|
|
1281
884
|
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
1282
885
|
// in the new array, so lets remove them (which entails cleaning up the
|
|
1283
886
|
// relevant DOM nodes)
|
|
@@ -1305,14 +908,13 @@ const isSameVnode = (leftVNode, rightVNode) => {
|
|
|
1305
908
|
// compare if two vnode to see if they're "technically" the same
|
|
1306
909
|
// need to have the same element tag, and same key to be the same
|
|
1307
910
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
1308
|
-
if (
|
|
911
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
1309
912
|
return leftVNode.$name$ === rightVNode.$name$;
|
|
1310
913
|
}
|
|
1311
914
|
// this will be set if components in the build have `key` attrs set on them
|
|
1312
|
-
|
|
915
|
+
{
|
|
1313
916
|
return leftVNode.$key$ === rightVNode.$key$;
|
|
1314
917
|
}
|
|
1315
|
-
return true;
|
|
1316
918
|
}
|
|
1317
919
|
return false;
|
|
1318
920
|
};
|
|
@@ -1339,14 +941,9 @@ const patch = (oldVNode, newVNode) => {
|
|
|
1339
941
|
const tag = newVNode.$tag$;
|
|
1340
942
|
const text = newVNode.$text$;
|
|
1341
943
|
let defaultHolder;
|
|
1342
|
-
if (
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
// only add this to the when the compiler sees we're using an svg somewhere
|
|
1346
|
-
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
1347
|
-
}
|
|
1348
|
-
if (BUILD.vdomAttribute || BUILD.reflect) {
|
|
1349
|
-
if (BUILD.slot && tag === 'slot')
|
|
944
|
+
if (text === null) {
|
|
945
|
+
{
|
|
946
|
+
if (tag === 'slot')
|
|
1350
947
|
;
|
|
1351
948
|
else {
|
|
1352
949
|
// either this is the first render of an element OR it's an update
|
|
@@ -1355,33 +952,30 @@ const patch = (oldVNode, newVNode) => {
|
|
|
1355
952
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
1356
953
|
}
|
|
1357
954
|
}
|
|
1358
|
-
if (
|
|
955
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
1359
956
|
// looks like there's child vnodes for both the old and new vnodes
|
|
1360
957
|
// so we need to call `updateChildren` to reconcile them
|
|
1361
958
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
1362
959
|
}
|
|
1363
960
|
else if (newChildren !== null) {
|
|
1364
961
|
// no old child vnodes, but there are new child vnodes to add
|
|
1365
|
-
if (
|
|
962
|
+
if (oldVNode.$text$ !== null) {
|
|
1366
963
|
// the old vnode was text, so be sure to clear it out
|
|
1367
964
|
elm.textContent = '';
|
|
1368
965
|
}
|
|
1369
966
|
// add the new vnode children
|
|
1370
967
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
1371
968
|
}
|
|
1372
|
-
else if (
|
|
969
|
+
else if (oldChildren !== null) {
|
|
1373
970
|
// no new child vnodes, but there are old child vnodes to remove
|
|
1374
971
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
1375
972
|
}
|
|
1376
|
-
if (BUILD.svg && isSvgMode && tag === 'svg') {
|
|
1377
|
-
isSvgMode = false;
|
|
1378
|
-
}
|
|
1379
973
|
}
|
|
1380
|
-
else if (
|
|
974
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1381
975
|
// this element has slotted content
|
|
1382
976
|
defaultHolder.parentNode.textContent = text;
|
|
1383
977
|
}
|
|
1384
|
-
else if (
|
|
978
|
+
else if (oldVNode.$text$ !== text) {
|
|
1385
979
|
// update the text content for the text only vnode
|
|
1386
980
|
// and also only if the text is different than before
|
|
1387
981
|
elm.data = text;
|
|
@@ -1519,7 +1113,7 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
|
1519
1113
|
return slotNameAttr === '';
|
|
1520
1114
|
};
|
|
1521
1115
|
const callNodeRefs = (vNode) => {
|
|
1522
|
-
|
|
1116
|
+
{
|
|
1523
1117
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
1524
1118
|
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
1525
1119
|
}
|
|
@@ -1530,41 +1124,26 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1530
1124
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1531
1125
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1532
1126
|
hostTagName = hostElm.tagName;
|
|
1533
|
-
|
|
1534
|
-
if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
1535
|
-
throw new Error(`The <Host> must be the single root component.
|
|
1536
|
-
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1537
|
-
|
|
1538
|
-
The render() function should look like this instead:
|
|
1539
|
-
|
|
1540
|
-
render() {
|
|
1541
|
-
// Do not return an array
|
|
1542
|
-
return (
|
|
1543
|
-
<Host>{content}</Host>
|
|
1544
|
-
);
|
|
1545
|
-
}
|
|
1546
|
-
`);
|
|
1547
|
-
}
|
|
1548
|
-
if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
|
|
1127
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
1549
1128
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
1550
1129
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
1551
1130
|
}
|
|
1552
1131
|
rootVnode.$tag$ = null;
|
|
1553
1132
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
1554
1133
|
hostRef.$vnode$ = rootVnode;
|
|
1555
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
1556
|
-
|
|
1134
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
1135
|
+
{
|
|
1557
1136
|
scopeId = hostElm['s-sc'];
|
|
1558
1137
|
}
|
|
1559
|
-
|
|
1138
|
+
{
|
|
1560
1139
|
contentRef = hostElm['s-cr'];
|
|
1561
|
-
useNativeShadowDom =
|
|
1140
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1562
1141
|
// always reset
|
|
1563
1142
|
checkSlotFallbackVisibility = false;
|
|
1564
1143
|
}
|
|
1565
1144
|
// synchronous patch
|
|
1566
1145
|
patch(oldVNode, rootVnode);
|
|
1567
|
-
|
|
1146
|
+
{
|
|
1568
1147
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
1569
1148
|
// the disconnectCallback from working
|
|
1570
1149
|
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
@@ -1584,9 +1163,7 @@ render() {
|
|
|
1584
1163
|
// add a reference node marking this node's original location
|
|
1585
1164
|
// keep a reference to this node for later lookups
|
|
1586
1165
|
orgLocationNode =
|
|
1587
|
-
|
|
1588
|
-
? originalLocationDebugNode(nodeToRelocate)
|
|
1589
|
-
: doc.createTextNode('');
|
|
1166
|
+
doc.createTextNode('');
|
|
1590
1167
|
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1591
1168
|
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1592
1169
|
}
|
|
@@ -1643,23 +1220,16 @@ render() {
|
|
|
1643
1220
|
relocateNodes.length = 0;
|
|
1644
1221
|
}
|
|
1645
1222
|
};
|
|
1646
|
-
// slot comment debug nodes only created with the `--debug` flag
|
|
1647
|
-
// otherwise these nodes are text nodes w/out content
|
|
1648
|
-
const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
|
|
1649
|
-
const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
|
|
1650
|
-
(nodeToRelocate.localName
|
|
1651
|
-
? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
|
|
1652
|
-
: `[${nodeToRelocate.textContent}]`));
|
|
1653
1223
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1654
|
-
if (
|
|
1224
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1655
1225
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
1656
1226
|
}
|
|
1657
1227
|
};
|
|
1658
1228
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1659
|
-
|
|
1229
|
+
{
|
|
1660
1230
|
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1661
1231
|
}
|
|
1662
|
-
if (
|
|
1232
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1663
1233
|
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1664
1234
|
return;
|
|
1665
1235
|
}
|
|
@@ -1668,34 +1238,25 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1668
1238
|
// has already fired off its lifecycle update then
|
|
1669
1239
|
// fire off the initial update
|
|
1670
1240
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1671
|
-
return
|
|
1241
|
+
return writeTask(dispatch) ;
|
|
1672
1242
|
};
|
|
1673
1243
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1674
|
-
const elm = hostRef.$hostElement$;
|
|
1675
1244
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1676
|
-
const instance =
|
|
1245
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1677
1246
|
let promise;
|
|
1678
1247
|
if (isInitialLoad) {
|
|
1679
|
-
|
|
1248
|
+
{
|
|
1680
1249
|
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1681
1250
|
if (hostRef.$queuedListeners$) {
|
|
1682
1251
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1683
1252
|
hostRef.$queuedListeners$ = null;
|
|
1684
1253
|
}
|
|
1685
1254
|
}
|
|
1686
|
-
|
|
1687
|
-
if (BUILD.cmpWillLoad) {
|
|
1255
|
+
{
|
|
1688
1256
|
promise = safeCall(instance, 'componentWillLoad');
|
|
1689
1257
|
}
|
|
1690
1258
|
}
|
|
1691
|
-
|
|
1692
|
-
emitLifecycleEvent(elm, 'componentWillUpdate');
|
|
1693
|
-
if (BUILD.cmpWillUpdate) {
|
|
1694
|
-
promise = safeCall(instance, 'componentWillUpdate');
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
emitLifecycleEvent(elm, 'componentWillRender');
|
|
1698
|
-
if (BUILD.cmpWillRender) {
|
|
1259
|
+
{
|
|
1699
1260
|
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
|
|
1700
1261
|
}
|
|
1701
1262
|
endSchedule();
|
|
@@ -1706,46 +1267,15 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1706
1267
|
const elm = hostRef.$hostElement$;
|
|
1707
1268
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1708
1269
|
const rc = elm['s-rc'];
|
|
1709
|
-
if (
|
|
1270
|
+
if (isInitialLoad) {
|
|
1710
1271
|
// DOM WRITE!
|
|
1711
1272
|
attachStyles(hostRef);
|
|
1712
1273
|
}
|
|
1713
1274
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1714
|
-
|
|
1715
|
-
hostRef
|
|
1275
|
+
{
|
|
1276
|
+
callRender(hostRef, instance);
|
|
1716
1277
|
}
|
|
1717
|
-
if (
|
|
1718
|
-
await callRender(hostRef, instance, elm);
|
|
1719
|
-
}
|
|
1720
|
-
else {
|
|
1721
|
-
callRender(hostRef, instance, elm);
|
|
1722
|
-
}
|
|
1723
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
1724
|
-
plt.$cssShim$.updateHost(elm);
|
|
1725
|
-
}
|
|
1726
|
-
if (BUILD.isDev) {
|
|
1727
|
-
hostRef.$renderCount$++;
|
|
1728
|
-
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
|
1729
|
-
}
|
|
1730
|
-
if (BUILD.hydrateServerSide) {
|
|
1731
|
-
try {
|
|
1732
|
-
// manually connected child components during server-side hydrate
|
|
1733
|
-
serverSideConnected(elm);
|
|
1734
|
-
if (isInitialLoad) {
|
|
1735
|
-
// using only during server-side hydrate
|
|
1736
|
-
if (hostRef.$cmpMeta$.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1737
|
-
elm['s-en'] = '';
|
|
1738
|
-
}
|
|
1739
|
-
else if (hostRef.$cmpMeta$.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
1740
|
-
elm['s-en'] = 'c';
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
catch (e) {
|
|
1745
|
-
consoleError(e, elm);
|
|
1746
|
-
}
|
|
1747
|
-
}
|
|
1748
|
-
if (BUILD.asyncLoading && rc) {
|
|
1278
|
+
if (rc) {
|
|
1749
1279
|
// ok, so turns out there are some child host elements
|
|
1750
1280
|
// waiting on this parent element to load
|
|
1751
1281
|
// let's fire off all update callbacks waiting
|
|
@@ -1754,7 +1284,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1754
1284
|
}
|
|
1755
1285
|
endRender();
|
|
1756
1286
|
endUpdate();
|
|
1757
|
-
|
|
1287
|
+
{
|
|
1758
1288
|
const childrenPromises = elm['s-p'];
|
|
1759
1289
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1760
1290
|
if (childrenPromises.length === 0) {
|
|
@@ -1766,117 +1296,67 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1766
1296
|
childrenPromises.length = 0;
|
|
1767
1297
|
}
|
|
1768
1298
|
}
|
|
1769
|
-
else {
|
|
1770
|
-
postUpdateComponent(hostRef);
|
|
1771
|
-
}
|
|
1772
1299
|
};
|
|
1773
1300
|
const callRender = (hostRef, instance, elm) => {
|
|
1774
|
-
// in order for bundlers to correctly treeshake the BUILD object
|
|
1775
|
-
// we need to ensure BUILD is not deoptimized within a try/catch
|
|
1776
|
-
// https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
|
|
1777
|
-
const allRenderFn = BUILD.allRenderFn ? true : false;
|
|
1778
|
-
const lazyLoad = BUILD.lazyLoad ? true : false;
|
|
1779
|
-
const taskQueue = BUILD.taskQueue ? true : false;
|
|
1780
|
-
const updatable = BUILD.updatable ? true : false;
|
|
1781
1301
|
try {
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
if (updatable && taskQueue) {
|
|
1302
|
+
instance = instance.render() ;
|
|
1303
|
+
{
|
|
1785
1304
|
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1786
1305
|
}
|
|
1787
|
-
|
|
1306
|
+
{
|
|
1788
1307
|
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1789
1308
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1309
|
+
{
|
|
1310
|
+
{
|
|
1792
1311
|
// looks like we've got child nodes to render into this host element
|
|
1793
1312
|
// or we need to update the css class/attrs on the host element
|
|
1794
1313
|
// DOM WRITE!
|
|
1795
|
-
|
|
1796
|
-
return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
|
|
1797
|
-
}
|
|
1798
|
-
else {
|
|
1314
|
+
{
|
|
1799
1315
|
renderVdom(hostRef, instance);
|
|
1800
1316
|
}
|
|
1801
1317
|
}
|
|
1802
|
-
else {
|
|
1803
|
-
elm.textContent = instance;
|
|
1804
|
-
}
|
|
1805
1318
|
}
|
|
1806
1319
|
}
|
|
1807
1320
|
catch (e) {
|
|
1808
1321
|
consoleError(e, hostRef.$hostElement$);
|
|
1809
1322
|
}
|
|
1810
|
-
renderingRef = null;
|
|
1811
1323
|
return null;
|
|
1812
1324
|
};
|
|
1813
|
-
const getRenderingRef = () => renderingRef;
|
|
1814
1325
|
const postUpdateComponent = (hostRef) => {
|
|
1815
1326
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1816
1327
|
const elm = hostRef.$hostElement$;
|
|
1817
1328
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1818
|
-
const instance =
|
|
1329
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1819
1330
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1820
|
-
|
|
1821
|
-
if (BUILD.isDev) {
|
|
1822
|
-
hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
|
|
1823
|
-
}
|
|
1331
|
+
{
|
|
1824
1332
|
safeCall(instance, 'componentDidRender');
|
|
1825
|
-
if (BUILD.isDev) {
|
|
1826
|
-
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
|
1827
|
-
}
|
|
1828
1333
|
}
|
|
1829
|
-
emitLifecycleEvent(elm, 'componentDidRender');
|
|
1830
1334
|
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1831
1335
|
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1832
|
-
|
|
1336
|
+
{
|
|
1833
1337
|
// DOM WRITE!
|
|
1834
1338
|
addHydratedFlag(elm);
|
|
1835
1339
|
}
|
|
1836
|
-
|
|
1837
|
-
if (BUILD.isDev) {
|
|
1838
|
-
hostRef.$flags$ |= 2048 /* HOST_FLAGS.devOnDidLoad */;
|
|
1839
|
-
}
|
|
1340
|
+
{
|
|
1840
1341
|
safeCall(instance, 'componentDidLoad');
|
|
1841
|
-
if (BUILD.isDev) {
|
|
1842
|
-
hostRef.$flags$ &= ~2048 /* HOST_FLAGS.devOnDidLoad */;
|
|
1843
|
-
}
|
|
1844
1342
|
}
|
|
1845
|
-
emitLifecycleEvent(elm, 'componentDidLoad');
|
|
1846
1343
|
endPostUpdate();
|
|
1847
|
-
|
|
1344
|
+
{
|
|
1848
1345
|
hostRef.$onReadyResolve$(elm);
|
|
1849
1346
|
if (!ancestorComponent) {
|
|
1850
|
-
appDidLoad(
|
|
1347
|
+
appDidLoad();
|
|
1851
1348
|
}
|
|
1852
1349
|
}
|
|
1853
1350
|
}
|
|
1854
1351
|
else {
|
|
1855
|
-
if (BUILD.cmpDidUpdate) {
|
|
1856
|
-
// we've already loaded this component
|
|
1857
|
-
// fire off the user's componentDidUpdate method (if one was provided)
|
|
1858
|
-
// componentDidUpdate runs AFTER render() has been called
|
|
1859
|
-
// and all child components have finished updating
|
|
1860
|
-
if (BUILD.isDev) {
|
|
1861
|
-
hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
|
|
1862
|
-
}
|
|
1863
|
-
safeCall(instance, 'componentDidUpdate');
|
|
1864
|
-
if (BUILD.isDev) {
|
|
1865
|
-
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
emitLifecycleEvent(elm, 'componentDidUpdate');
|
|
1869
1352
|
endPostUpdate();
|
|
1870
1353
|
}
|
|
1871
|
-
|
|
1872
|
-
elm['s-hmr-load'] && elm['s-hmr-load']();
|
|
1873
|
-
}
|
|
1874
|
-
if (BUILD.method && BUILD.lazyLoad) {
|
|
1354
|
+
{
|
|
1875
1355
|
hostRef.$onInstanceResolve$(elm);
|
|
1876
1356
|
}
|
|
1877
1357
|
// load events fire from bottom to top
|
|
1878
1358
|
// the deepest elements load first then bubbles up
|
|
1879
|
-
|
|
1359
|
+
{
|
|
1880
1360
|
if (hostRef.$onRenderResolve$) {
|
|
1881
1361
|
hostRef.$onRenderResolve$();
|
|
1882
1362
|
hostRef.$onRenderResolve$ = undefined;
|
|
@@ -1890,32 +1370,13 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1890
1370
|
// ( •_•)>⌐■-■
|
|
1891
1371
|
// (⌐■_■)
|
|
1892
1372
|
};
|
|
1893
|
-
const forceUpdate = (ref) => {
|
|
1894
|
-
if (BUILD.updatable) {
|
|
1895
|
-
const hostRef = getHostRef(ref);
|
|
1896
|
-
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1897
|
-
if (isConnected &&
|
|
1898
|
-
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1899
|
-
scheduleUpdate(hostRef, false);
|
|
1900
|
-
}
|
|
1901
|
-
// Returns "true" when the forced update was successfully scheduled
|
|
1902
|
-
return isConnected;
|
|
1903
|
-
}
|
|
1904
|
-
return false;
|
|
1905
|
-
};
|
|
1906
1373
|
const appDidLoad = (who) => {
|
|
1907
1374
|
// on appload
|
|
1908
1375
|
// we have finish the first big initial render
|
|
1909
|
-
|
|
1376
|
+
{
|
|
1910
1377
|
addHydratedFlag(doc.documentElement);
|
|
1911
1378
|
}
|
|
1912
|
-
if (BUILD.asyncQueue) {
|
|
1913
|
-
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
|
1914
|
-
}
|
|
1915
1379
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1916
|
-
if (BUILD.profile && performance.measure) {
|
|
1917
|
-
performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
|
|
1918
|
-
}
|
|
1919
1380
|
};
|
|
1920
1381
|
const safeCall = (instance, method, arg) => {
|
|
1921
1382
|
if (instance && instance[method]) {
|
|
@@ -1931,61 +1392,27 @@ const safeCall = (instance, method, arg) => {
|
|
|
1931
1392
|
const then = (promise, thenFn) => {
|
|
1932
1393
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1933
1394
|
};
|
|
1934
|
-
const
|
|
1935
|
-
|
|
1936
|
-
emitEvent(elm, 'stencil_' + lifecycleName, {
|
|
1937
|
-
bubbles: true,
|
|
1938
|
-
composed: true,
|
|
1939
|
-
detail: {
|
|
1940
|
-
namespace: NAMESPACE,
|
|
1941
|
-
},
|
|
1942
|
-
});
|
|
1943
|
-
}
|
|
1944
|
-
};
|
|
1945
|
-
const addHydratedFlag = (elm) => BUILD.hydratedClass
|
|
1946
|
-
? elm.classList.add('hydrated')
|
|
1947
|
-
: BUILD.hydratedAttribute
|
|
1948
|
-
? elm.setAttribute('hydrated', '')
|
|
1949
|
-
: undefined;
|
|
1950
|
-
const serverSideConnected = (elm) => {
|
|
1951
|
-
const children = elm.children;
|
|
1952
|
-
if (children != null) {
|
|
1953
|
-
for (let i = 0, ii = children.length; i < ii; i++) {
|
|
1954
|
-
const childElm = children[i];
|
|
1955
|
-
if (typeof childElm.connectedCallback === 'function') {
|
|
1956
|
-
childElm.connectedCallback();
|
|
1957
|
-
}
|
|
1958
|
-
serverSideConnected(childElm);
|
|
1959
|
-
}
|
|
1960
|
-
}
|
|
1961
|
-
};
|
|
1395
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1396
|
+
;
|
|
1962
1397
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1963
1398
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1964
1399
|
// check our new property value against our internal value
|
|
1965
1400
|
const hostRef = getHostRef(ref);
|
|
1966
|
-
const elm =
|
|
1401
|
+
const elm = hostRef.$hostElement$ ;
|
|
1967
1402
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1968
1403
|
const flags = hostRef.$flags$;
|
|
1969
|
-
const instance =
|
|
1404
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1970
1405
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1971
1406
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1972
1407
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1973
1408
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1974
|
-
if ((!
|
|
1409
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1975
1410
|
// gadzooks! the property's value has changed!!
|
|
1976
1411
|
// set our new value!
|
|
1977
1412
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1978
|
-
if (
|
|
1979
|
-
if (hostRef.$flags$ & 1024 /* HOST_FLAGS.devOnRender */) {
|
|
1980
|
-
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);
|
|
1981
|
-
}
|
|
1982
|
-
else if (hostRef.$flags$ & 2048 /* HOST_FLAGS.devOnDidLoad */) {
|
|
1983
|
-
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);
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
if (!BUILD.lazyLoad || instance) {
|
|
1413
|
+
if (instance) {
|
|
1987
1414
|
// get an array of method names of watch functions to call
|
|
1988
|
-
if (
|
|
1415
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1989
1416
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1990
1417
|
if (watchMethods) {
|
|
1991
1418
|
// this instance is watching for when this property changed
|
|
@@ -2000,13 +1427,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2000
1427
|
});
|
|
2001
1428
|
}
|
|
2002
1429
|
}
|
|
2003
|
-
if (
|
|
2004
|
-
(flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
2005
|
-
if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
|
|
2006
|
-
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
2007
|
-
return;
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
1430
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
2010
1431
|
// looks like this value actually changed, so we've got work to do!
|
|
2011
1432
|
// but only if we've already rendered, otherwise just chill out
|
|
2012
1433
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -2027,17 +1448,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2027
1448
|
* @returns a reference to the same constructor passed in (but now mutated)
|
|
2028
1449
|
*/
|
|
2029
1450
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
2030
|
-
if (
|
|
2031
|
-
if (
|
|
1451
|
+
if (cmpMeta.$members$) {
|
|
1452
|
+
if (Cstr.watchers) {
|
|
2032
1453
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
2033
1454
|
}
|
|
2034
1455
|
// It's better to have a const than two Object.entries()
|
|
2035
1456
|
const members = Object.entries(cmpMeta.$members$);
|
|
2036
1457
|
const prototype = Cstr.prototype;
|
|
2037
1458
|
members.map(([memberName, [memberFlags]]) => {
|
|
2038
|
-
if ((
|
|
2039
|
-
|
|
2040
|
-
((!BUILD.lazyLoad || flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1459
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1460
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
2041
1461
|
// proxyComponent - prop
|
|
2042
1462
|
Object.defineProperty(prototype, memberName, {
|
|
2043
1463
|
get() {
|
|
@@ -2045,21 +1465,6 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2045
1465
|
return getValue(this, memberName);
|
|
2046
1466
|
},
|
|
2047
1467
|
set(newValue) {
|
|
2048
|
-
// only during dev time
|
|
2049
|
-
if (BUILD.isDev) {
|
|
2050
|
-
const ref = getHostRef(this);
|
|
2051
|
-
if (
|
|
2052
|
-
// we are proxying the instance (not element)
|
|
2053
|
-
(flags & 1 /* PROXY_FLAGS.isElementConstructor */) === 0 &&
|
|
2054
|
-
// the element is not constructing
|
|
2055
|
-
(ref.$flags$ & 8 /* HOST_FLAGS.isConstructingInstance */) === 0 &&
|
|
2056
|
-
// the member is a prop
|
|
2057
|
-
(memberFlags & 31 /* MEMBER_FLAGS.Prop */) !== 0 &&
|
|
2058
|
-
// the member is not mutable
|
|
2059
|
-
(memberFlags & 1024 /* MEMBER_FLAGS.Mutable */) === 0) {
|
|
2060
|
-
consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability`);
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
1468
|
// proxyComponent, set value
|
|
2064
1469
|
setValue(this, memberName, newValue, cmpMeta);
|
|
2065
1470
|
},
|
|
@@ -2067,9 +1472,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2067
1472
|
enumerable: true,
|
|
2068
1473
|
});
|
|
2069
1474
|
}
|
|
2070
|
-
else if (
|
|
2071
|
-
BUILD.method &&
|
|
2072
|
-
flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1475
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
2073
1476
|
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
2074
1477
|
// proxyComponent - method
|
|
2075
1478
|
Object.defineProperty(prototype, memberName, {
|
|
@@ -2080,7 +1483,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2080
1483
|
});
|
|
2081
1484
|
}
|
|
2082
1485
|
});
|
|
2083
|
-
if (
|
|
1486
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
2084
1487
|
const attrNameToPropName = new Map();
|
|
2085
1488
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
2086
1489
|
plt.jmp(() => {
|
|
@@ -2140,7 +1543,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2140
1543
|
.map(([propName, m]) => {
|
|
2141
1544
|
const attrName = m[1] || propName;
|
|
2142
1545
|
attrNameToPropName.set(attrName, propName);
|
|
2143
|
-
if (
|
|
1546
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
2144
1547
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
2145
1548
|
}
|
|
2146
1549
|
return attrName;
|
|
@@ -2151,29 +1554,25 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2151
1554
|
};
|
|
2152
1555
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
2153
1556
|
// initializeComponent
|
|
2154
|
-
if ((
|
|
2155
|
-
|
|
2156
|
-
if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
|
|
1557
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1558
|
+
{
|
|
2157
1559
|
// we haven't initialized this element yet
|
|
2158
1560
|
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
2159
1561
|
// lazy loaded components
|
|
2160
1562
|
// request the component's implementation to be
|
|
2161
1563
|
// wired up with the host element
|
|
2162
|
-
Cstr = loadModule(cmpMeta
|
|
1564
|
+
Cstr = loadModule(cmpMeta);
|
|
2163
1565
|
if (Cstr.then) {
|
|
2164
1566
|
// Await creates a micro-task avoid if possible
|
|
2165
|
-
const endLoad = uniqueTime(
|
|
1567
|
+
const endLoad = uniqueTime();
|
|
2166
1568
|
Cstr = await Cstr;
|
|
2167
1569
|
endLoad();
|
|
2168
1570
|
}
|
|
2169
|
-
if (
|
|
2170
|
-
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
2171
|
-
}
|
|
2172
|
-
if (BUILD.member && !Cstr.isProxied) {
|
|
1571
|
+
if (!Cstr.isProxied) {
|
|
2173
1572
|
// we've never proxied this Constructor before
|
|
2174
1573
|
// let's add the getters/setters to its prototype before
|
|
2175
1574
|
// the first time we create an instance of the implementation
|
|
2176
|
-
|
|
1575
|
+
{
|
|
2177
1576
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
2178
1577
|
}
|
|
2179
1578
|
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
@@ -2183,7 +1582,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2183
1582
|
// ok, time to construct the instance
|
|
2184
1583
|
// but let's keep track of when we start and stop
|
|
2185
1584
|
// so that the getters/setters don't incorrectly step on data
|
|
2186
|
-
|
|
1585
|
+
{
|
|
2187
1586
|
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
2188
1587
|
}
|
|
2189
1588
|
// construct the lazy-loaded component implementation
|
|
@@ -2196,42 +1595,21 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2196
1595
|
catch (e) {
|
|
2197
1596
|
consoleError(e);
|
|
2198
1597
|
}
|
|
2199
|
-
|
|
1598
|
+
{
|
|
2200
1599
|
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
2201
1600
|
}
|
|
2202
|
-
|
|
1601
|
+
{
|
|
2203
1602
|
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
2204
1603
|
}
|
|
2205
1604
|
endNewInstance();
|
|
2206
1605
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
2207
1606
|
}
|
|
2208
|
-
|
|
2209
|
-
// sync constructor component
|
|
2210
|
-
Cstr = elm.constructor;
|
|
2211
|
-
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
2212
|
-
// wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
|
|
2213
|
-
// watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
|
|
2214
|
-
// Stencil has completed instantiating the component.
|
|
2215
|
-
customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
|
|
2216
|
-
}
|
|
2217
|
-
if (BUILD.style && Cstr.style) {
|
|
1607
|
+
if (Cstr.style) {
|
|
2218
1608
|
// this component has styles but we haven't registered them yet
|
|
2219
1609
|
let style = Cstr.style;
|
|
2220
|
-
|
|
2221
|
-
style = style[(hostRef.$modeName$ = computeMode(elm))];
|
|
2222
|
-
if (BUILD.hydrateServerSide && hostRef.$modeName$) {
|
|
2223
|
-
elm.setAttribute('s-mode', hostRef.$modeName$);
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
1610
|
+
const scopeId = getScopeId(cmpMeta);
|
|
2227
1611
|
if (!styles.has(scopeId)) {
|
|
2228
1612
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
2229
|
-
if (!BUILD.hydrateServerSide &&
|
|
2230
|
-
BUILD.shadowDom &&
|
|
2231
|
-
BUILD.shadowDomShim &&
|
|
2232
|
-
cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
2233
|
-
style = await import('./shadow-css-b18e99d7.js').then((m) => m.scopeCss(style, scopeId, false));
|
|
2234
|
-
}
|
|
2235
1613
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
2236
1614
|
endRegisterStyles();
|
|
2237
1615
|
}
|
|
@@ -2240,7 +1618,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2240
1618
|
// we've successfully created a lazy instance
|
|
2241
1619
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2242
1620
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
2243
|
-
if (
|
|
1621
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
2244
1622
|
// this is the initial load and this component it has an ancestor component
|
|
2245
1623
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
2246
1624
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -2254,7 +1632,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2254
1632
|
}
|
|
2255
1633
|
};
|
|
2256
1634
|
const fireConnectedCallback = (instance) => {
|
|
2257
|
-
|
|
1635
|
+
{
|
|
2258
1636
|
safeCall(instance, 'connectedCallback');
|
|
2259
1637
|
}
|
|
2260
1638
|
};
|
|
@@ -2263,49 +1641,26 @@ const connectedCallback = (elm) => {
|
|
|
2263
1641
|
const hostRef = getHostRef(elm);
|
|
2264
1642
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
2265
1643
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
2266
|
-
if (BUILD.hostListenerTargetParent) {
|
|
2267
|
-
// only run if we have listeners being attached to a parent
|
|
2268
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
2269
|
-
}
|
|
2270
1644
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
2271
1645
|
// first time this component has connected
|
|
2272
1646
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
2273
|
-
|
|
2274
|
-
if (BUILD.hydrateClientSide) {
|
|
2275
|
-
hostId = elm.getAttribute(HYDRATE_ID);
|
|
2276
|
-
if (hostId) {
|
|
2277
|
-
if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2278
|
-
const scopeId = BUILD.mode
|
|
2279
|
-
? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
|
|
2280
|
-
: addStyle(elm.shadowRoot, cmpMeta);
|
|
2281
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
2282
|
-
}
|
|
2283
|
-
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
if (BUILD.slotRelocation && !hostId) {
|
|
1647
|
+
{
|
|
2287
1648
|
// initUpdate
|
|
2288
1649
|
// if the slot polyfill is required we'll need to put some nodes
|
|
2289
1650
|
// in here to act as original content anchors as we move nodes around
|
|
2290
1651
|
// host element has been connected to the DOM
|
|
2291
|
-
if (
|
|
2292
|
-
((BUILD.slot || BUILD.shadowDom) &&
|
|
2293
|
-
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1652
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
2294
1653
|
setContentReference(elm);
|
|
2295
1654
|
}
|
|
2296
1655
|
}
|
|
2297
|
-
|
|
1656
|
+
{
|
|
2298
1657
|
// find the first ancestor component (if there is one) and register
|
|
2299
1658
|
// this component as one of the actively loading child components for its ancestor
|
|
2300
1659
|
let ancestorComponent = elm;
|
|
2301
1660
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
2302
1661
|
// climb up the ancestors looking for the first
|
|
2303
1662
|
// component that hasn't finished its lifecycle update yet
|
|
2304
|
-
if (
|
|
2305
|
-
ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
|
2306
|
-
ancestorComponent.hasAttribute('s-id') &&
|
|
2307
|
-
ancestorComponent['s-p']) ||
|
|
2308
|
-
ancestorComponent['s-p']) {
|
|
1663
|
+
if (ancestorComponent['s-p']) {
|
|
2309
1664
|
// we found this components first ancestor component
|
|
2310
1665
|
// keep a reference to this component's ancestor component
|
|
2311
1666
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -2315,7 +1670,7 @@ const connectedCallback = (elm) => {
|
|
|
2315
1670
|
}
|
|
2316
1671
|
// Lazy properties
|
|
2317
1672
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
2318
|
-
if (
|
|
1673
|
+
if (cmpMeta.$members$) {
|
|
2319
1674
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
2320
1675
|
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
2321
1676
|
const value = elm[memberName];
|
|
@@ -2324,14 +1679,7 @@ const connectedCallback = (elm) => {
|
|
|
2324
1679
|
}
|
|
2325
1680
|
});
|
|
2326
1681
|
}
|
|
2327
|
-
|
|
2328
|
-
// connectedCallback, taskQueue, initialLoad
|
|
2329
|
-
// angular sets attribute AFTER connectCallback
|
|
2330
|
-
// https://github.com/angular/angular/issues/18909
|
|
2331
|
-
// https://github.com/angular/angular/issues/19940
|
|
2332
|
-
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
2333
|
-
}
|
|
2334
|
-
else {
|
|
1682
|
+
{
|
|
2335
1683
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
2336
1684
|
}
|
|
2337
1685
|
}
|
|
@@ -2339,7 +1687,7 @@ const connectedCallback = (elm) => {
|
|
|
2339
1687
|
// not the first time this has connected
|
|
2340
1688
|
// reattach any event listeners to the host
|
|
2341
1689
|
// since they would have been removed when disconnected
|
|
2342
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
1690
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2343
1691
|
// fire off connectedCallback() on component instance
|
|
2344
1692
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
2345
1693
|
}
|
|
@@ -2353,316 +1701,27 @@ const setContentReference = (elm) => {
|
|
|
2353
1701
|
// let's pick out the inner content for slot projection
|
|
2354
1702
|
// create a node to represent where the original
|
|
2355
1703
|
// content was first placed, which is useful later on
|
|
2356
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment(
|
|
1704
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
2357
1705
|
contentRefElm['s-cn'] = true;
|
|
2358
1706
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
2359
1707
|
};
|
|
2360
1708
|
const disconnectedCallback = (elm) => {
|
|
2361
1709
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
2362
1710
|
const hostRef = getHostRef(elm);
|
|
2363
|
-
const instance =
|
|
2364
|
-
|
|
1711
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1712
|
+
{
|
|
2365
1713
|
if (hostRef.$rmListeners$) {
|
|
2366
1714
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
2367
1715
|
hostRef.$rmListeners$ = undefined;
|
|
2368
1716
|
}
|
|
2369
1717
|
}
|
|
2370
|
-
|
|
2371
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
2372
|
-
plt.$cssShim$.removeHost(elm);
|
|
2373
|
-
}
|
|
2374
|
-
if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
|
|
1718
|
+
{
|
|
2375
1719
|
safeCall(instance, 'disconnectedCallback');
|
|
2376
1720
|
}
|
|
2377
|
-
if (BUILD.cmpDidUnload) {
|
|
2378
|
-
safeCall(instance, 'componentDidUnload');
|
|
2379
|
-
}
|
|
2380
1721
|
}
|
|
2381
1722
|
};
|
|
2382
|
-
const defineCustomElement = (Cstr, compactMeta) => {
|
|
2383
|
-
customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
|
|
2384
|
-
};
|
|
2385
|
-
const proxyCustomElement = (Cstr, compactMeta) => {
|
|
2386
|
-
const cmpMeta = {
|
|
2387
|
-
$flags$: compactMeta[0],
|
|
2388
|
-
$tagName$: compactMeta[1],
|
|
2389
|
-
};
|
|
2390
|
-
if (BUILD.member) {
|
|
2391
|
-
cmpMeta.$members$ = compactMeta[2];
|
|
2392
|
-
}
|
|
2393
|
-
if (BUILD.hostListener) {
|
|
2394
|
-
cmpMeta.$listeners$ = compactMeta[3];
|
|
2395
|
-
}
|
|
2396
|
-
if (BUILD.watchCallback) {
|
|
2397
|
-
cmpMeta.$watchers$ = Cstr.$watchers$;
|
|
2398
|
-
}
|
|
2399
|
-
if (BUILD.reflect) {
|
|
2400
|
-
cmpMeta.$attrsToReflect$ = [];
|
|
2401
|
-
}
|
|
2402
|
-
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2403
|
-
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
2404
|
-
}
|
|
2405
|
-
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
2406
|
-
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
2407
|
-
Object.assign(Cstr.prototype, {
|
|
2408
|
-
__registerHost() {
|
|
2409
|
-
registerHost(this, cmpMeta);
|
|
2410
|
-
},
|
|
2411
|
-
connectedCallback() {
|
|
2412
|
-
connectedCallback(this);
|
|
2413
|
-
if (BUILD.connectedCallback && originalConnectedCallback) {
|
|
2414
|
-
originalConnectedCallback.call(this);
|
|
2415
|
-
}
|
|
2416
|
-
},
|
|
2417
|
-
disconnectedCallback() {
|
|
2418
|
-
disconnectedCallback(this);
|
|
2419
|
-
if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
|
|
2420
|
-
originalDisconnectedCallback.call(this);
|
|
2421
|
-
}
|
|
2422
|
-
},
|
|
2423
|
-
__attachShadow() {
|
|
2424
|
-
if (supportsShadow) {
|
|
2425
|
-
if (BUILD.shadowDelegatesFocus) {
|
|
2426
|
-
this.attachShadow({
|
|
2427
|
-
mode: 'open',
|
|
2428
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
|
2429
|
-
});
|
|
2430
|
-
}
|
|
2431
|
-
else {
|
|
2432
|
-
this.attachShadow({ mode: 'open' });
|
|
2433
|
-
}
|
|
2434
|
-
}
|
|
2435
|
-
else {
|
|
2436
|
-
this.shadowRoot = this;
|
|
2437
|
-
}
|
|
2438
|
-
},
|
|
2439
|
-
});
|
|
2440
|
-
Cstr.is = cmpMeta.$tagName$;
|
|
2441
|
-
return proxyComponent(Cstr, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */ | 2 /* PROXY_FLAGS.proxyState */);
|
|
2442
|
-
};
|
|
2443
|
-
const forceModeUpdate = (elm) => {
|
|
2444
|
-
if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
|
|
2445
|
-
const mode = computeMode(elm);
|
|
2446
|
-
const hostRef = getHostRef(elm);
|
|
2447
|
-
if (hostRef.$modeName$ !== mode) {
|
|
2448
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
2449
|
-
const oldScopeId = elm['s-sc'];
|
|
2450
|
-
const scopeId = getScopeId(cmpMeta, mode);
|
|
2451
|
-
const style = elm.constructor.style[mode];
|
|
2452
|
-
const flags = cmpMeta.$flags$;
|
|
2453
|
-
if (style) {
|
|
2454
|
-
if (!styles.has(scopeId)) {
|
|
2455
|
-
registerStyle(scopeId, style, !!(flags & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
2456
|
-
}
|
|
2457
|
-
hostRef.$modeName$ = mode;
|
|
2458
|
-
elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
|
|
2459
|
-
attachStyles(hostRef);
|
|
2460
|
-
forceUpdate(elm);
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
};
|
|
2465
|
-
const patchCloneNode = (HostElementPrototype) => {
|
|
2466
|
-
const orgCloneNode = HostElementPrototype.cloneNode;
|
|
2467
|
-
HostElementPrototype.cloneNode = function (deep) {
|
|
2468
|
-
const srcNode = this;
|
|
2469
|
-
const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
|
2470
|
-
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
|
2471
|
-
if (BUILD.slot && !isShadowDom && deep) {
|
|
2472
|
-
let i = 0;
|
|
2473
|
-
let slotted, nonStencilNode;
|
|
2474
|
-
const stencilPrivates = [
|
|
2475
|
-
's-id',
|
|
2476
|
-
's-cr',
|
|
2477
|
-
's-lr',
|
|
2478
|
-
's-rc',
|
|
2479
|
-
's-sc',
|
|
2480
|
-
's-p',
|
|
2481
|
-
's-cn',
|
|
2482
|
-
's-sr',
|
|
2483
|
-
's-sn',
|
|
2484
|
-
's-hn',
|
|
2485
|
-
's-ol',
|
|
2486
|
-
's-nr',
|
|
2487
|
-
's-si',
|
|
2488
|
-
];
|
|
2489
|
-
for (; i < srcNode.childNodes.length; i++) {
|
|
2490
|
-
slotted = srcNode.childNodes[i]['s-nr'];
|
|
2491
|
-
nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
|
|
2492
|
-
if (slotted) {
|
|
2493
|
-
if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
|
|
2494
|
-
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
2495
|
-
}
|
|
2496
|
-
else {
|
|
2497
|
-
clonedNode.appendChild(slotted.cloneNode(true));
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
if (nonStencilNode) {
|
|
2501
|
-
clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
return clonedNode;
|
|
2506
|
-
};
|
|
2507
|
-
};
|
|
2508
|
-
const patchSlotAppendChild = (HostElementPrototype) => {
|
|
2509
|
-
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
2510
|
-
HostElementPrototype.appendChild = function (newChild) {
|
|
2511
|
-
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
|
2512
|
-
const slotNode = getHostSlotNode(this.childNodes, slotName);
|
|
2513
|
-
if (slotNode) {
|
|
2514
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
2515
|
-
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
2516
|
-
return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
|
|
2517
|
-
}
|
|
2518
|
-
return this.__appendChild(newChild);
|
|
2519
|
-
};
|
|
2520
|
-
};
|
|
2521
|
-
/**
|
|
2522
|
-
* Patches the text content of an unnamed slotted node inside a scoped component
|
|
2523
|
-
* @param hostElementPrototype the `Element` to be patched
|
|
2524
|
-
* @param cmpMeta component runtime metadata used to determine if the component should be patched or not
|
|
2525
|
-
*/
|
|
2526
|
-
const patchTextContent = (hostElementPrototype, cmpMeta) => {
|
|
2527
|
-
if (BUILD.scoped && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
2528
|
-
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
|
|
2529
|
-
Object.defineProperty(hostElementPrototype, '__textContent', descriptor);
|
|
2530
|
-
Object.defineProperty(hostElementPrototype, 'textContent', {
|
|
2531
|
-
get() {
|
|
2532
|
-
var _a;
|
|
2533
|
-
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
|
2534
|
-
// the empty string
|
|
2535
|
-
const slotNode = getHostSlotNode(this.childNodes, '');
|
|
2536
|
-
// when a slot node is found, the textContent _may_ be found in the next sibling (text) node, depending on how
|
|
2537
|
-
// nodes were reordered during the vdom render. first try to get the text content from the sibling.
|
|
2538
|
-
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2539
|
-
return slotNode.nextSibling.textContent;
|
|
2540
|
-
}
|
|
2541
|
-
else if (slotNode) {
|
|
2542
|
-
return slotNode.textContent;
|
|
2543
|
-
}
|
|
2544
|
-
else {
|
|
2545
|
-
// fallback to the original implementation
|
|
2546
|
-
return this.__textContent;
|
|
2547
|
-
}
|
|
2548
|
-
},
|
|
2549
|
-
set(value) {
|
|
2550
|
-
var _a;
|
|
2551
|
-
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
|
2552
|
-
// the empty string
|
|
2553
|
-
const slotNode = getHostSlotNode(this.childNodes, '');
|
|
2554
|
-
// when a slot node is found, the textContent _may_ need to be placed in the next sibling (text) node,
|
|
2555
|
-
// depending on how nodes were reordered during the vdom render. first try to set the text content on the
|
|
2556
|
-
// sibling.
|
|
2557
|
-
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2558
|
-
slotNode.nextSibling.textContent = value;
|
|
2559
|
-
}
|
|
2560
|
-
else if (slotNode) {
|
|
2561
|
-
slotNode.textContent = value;
|
|
2562
|
-
}
|
|
2563
|
-
else {
|
|
2564
|
-
// we couldn't find a slot, but that doesn't mean that there isn't one. if this check ran before the DOM
|
|
2565
|
-
// loaded, we could have missed it. check for a content reference element on the scoped component and insert
|
|
2566
|
-
// it there
|
|
2567
|
-
this.__textContent = value;
|
|
2568
|
-
const contentRefElm = this['s-cr'];
|
|
2569
|
-
if (contentRefElm) {
|
|
2570
|
-
this.insertBefore(contentRefElm, this.firstChild);
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
},
|
|
2574
|
-
});
|
|
2575
|
-
}
|
|
2576
|
-
};
|
|
2577
|
-
const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
2578
|
-
class FakeNodeList extends Array {
|
|
2579
|
-
item(n) {
|
|
2580
|
-
return this[n];
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
2584
|
-
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
2585
|
-
Object.defineProperty(elm, 'children', {
|
|
2586
|
-
get() {
|
|
2587
|
-
return this.childNodes.map((n) => n.nodeType === 1);
|
|
2588
|
-
},
|
|
2589
|
-
});
|
|
2590
|
-
Object.defineProperty(elm, 'childElementCount', {
|
|
2591
|
-
get() {
|
|
2592
|
-
return elm.children.length;
|
|
2593
|
-
},
|
|
2594
|
-
});
|
|
2595
|
-
Object.defineProperty(elm, 'childNodes', {
|
|
2596
|
-
get() {
|
|
2597
|
-
const childNodes = childNodesFn.call(this);
|
|
2598
|
-
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
|
|
2599
|
-
getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
|
|
2600
|
-
const result = new FakeNodeList();
|
|
2601
|
-
for (let i = 0; i < childNodes.length; i++) {
|
|
2602
|
-
const slot = childNodes[i]['s-nr'];
|
|
2603
|
-
if (slot) {
|
|
2604
|
-
result.push(slot);
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
2607
|
-
return result;
|
|
2608
|
-
}
|
|
2609
|
-
return FakeNodeList.from(childNodes);
|
|
2610
|
-
},
|
|
2611
|
-
});
|
|
2612
|
-
}
|
|
2613
|
-
};
|
|
2614
|
-
const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
|
|
2615
|
-
/**
|
|
2616
|
-
* Recursively searches a series of child nodes for a slot with the provided name.
|
|
2617
|
-
* @param childNodes the nodes to search for a slot with a specific name.
|
|
2618
|
-
* @param slotName the name of the slot to match on.
|
|
2619
|
-
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
|
2620
|
-
*/
|
|
2621
|
-
const getHostSlotNode = (childNodes, slotName) => {
|
|
2622
|
-
let i = 0;
|
|
2623
|
-
let childNode;
|
|
2624
|
-
for (; i < childNodes.length; i++) {
|
|
2625
|
-
childNode = childNodes[i];
|
|
2626
|
-
if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
|
|
2627
|
-
return childNode;
|
|
2628
|
-
}
|
|
2629
|
-
childNode = getHostSlotNode(childNode.childNodes, slotName);
|
|
2630
|
-
if (childNode) {
|
|
2631
|
-
return childNode;
|
|
2632
|
-
}
|
|
2633
|
-
}
|
|
2634
|
-
return null;
|
|
2635
|
-
};
|
|
2636
|
-
const getHostSlotChildNodes = (n, slotName) => {
|
|
2637
|
-
const childNodes = [n];
|
|
2638
|
-
while ((n = n.nextSibling) && n['s-sn'] === slotName) {
|
|
2639
|
-
childNodes.push(n);
|
|
2640
|
-
}
|
|
2641
|
-
return childNodes;
|
|
2642
|
-
};
|
|
2643
|
-
const hmrStart = (elm, cmpMeta, hmrVersionId) => {
|
|
2644
|
-
// ¯\_(ツ)_/¯
|
|
2645
|
-
const hostRef = getHostRef(elm);
|
|
2646
|
-
// reset state flags to only have been connected
|
|
2647
|
-
hostRef.$flags$ = 1 /* HOST_FLAGS.hasConnected */;
|
|
2648
|
-
// TODO
|
|
2649
|
-
// detatch any event listeners that may have been added
|
|
2650
|
-
// because we're not passing an exact event name it'll
|
|
2651
|
-
// remove all of this element's event, which is good
|
|
2652
|
-
// create a callback for when this component finishes hmr
|
|
2653
|
-
elm['s-hmr-load'] = () => {
|
|
2654
|
-
// finished hmr for this element
|
|
2655
|
-
delete elm['s-hmr-load'];
|
|
2656
|
-
};
|
|
2657
|
-
// re-initialize the component
|
|
2658
|
-
initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
|
|
2659
|
-
};
|
|
2660
1723
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
2661
|
-
|
|
2662
|
-
performance.mark('st:app:start');
|
|
2663
|
-
}
|
|
2664
|
-
installDevTools();
|
|
2665
|
-
const endBootstrap = createTime('bootstrapLazy');
|
|
1724
|
+
const endBootstrap = createTime();
|
|
2666
1725
|
const cmpTags = [];
|
|
2667
1726
|
const exclude = options.exclude || [];
|
|
2668
1727
|
const customElements = win.customElements;
|
|
@@ -2670,27 +1729,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2670
1729
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
2671
1730
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
2672
1731
|
const deferredConnectedCallbacks = [];
|
|
2673
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2674
1732
|
let appLoadFallback;
|
|
2675
1733
|
let isBootstrapping = true;
|
|
2676
|
-
let i = 0;
|
|
2677
1734
|
Object.assign(plt, options);
|
|
2678
1735
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
2679
|
-
if (BUILD.asyncQueue) {
|
|
2680
|
-
if (options.syncQueue) {
|
|
2681
|
-
plt.$flags$ |= 4 /* PLATFORM_FLAGS.queueSync */;
|
|
2682
|
-
}
|
|
2683
|
-
}
|
|
2684
|
-
if (BUILD.hydrateClientSide) {
|
|
2685
|
-
// If the app is already hydrated there is not point to disable the
|
|
2686
|
-
// async queue. This will improve the first input delay
|
|
2687
|
-
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
|
2688
|
-
}
|
|
2689
|
-
if (BUILD.hydrateClientSide && BUILD.shadowDom) {
|
|
2690
|
-
for (; i < styles.length; i++) {
|
|
2691
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
1736
|
lazyBundles.map((lazyBundle) => {
|
|
2695
1737
|
lazyBundle[1].map((compactMeta) => {
|
|
2696
1738
|
const cmpMeta = {
|
|
@@ -2699,24 +1741,19 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2699
1741
|
$members$: compactMeta[2],
|
|
2700
1742
|
$listeners$: compactMeta[3],
|
|
2701
1743
|
};
|
|
2702
|
-
|
|
1744
|
+
{
|
|
2703
1745
|
cmpMeta.$members$ = compactMeta[2];
|
|
2704
1746
|
}
|
|
2705
|
-
|
|
1747
|
+
{
|
|
2706
1748
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
2707
1749
|
}
|
|
2708
|
-
|
|
1750
|
+
{
|
|
2709
1751
|
cmpMeta.$attrsToReflect$ = [];
|
|
2710
1752
|
}
|
|
2711
|
-
|
|
1753
|
+
{
|
|
2712
1754
|
cmpMeta.$watchers$ = {};
|
|
2713
1755
|
}
|
|
2714
|
-
|
|
2715
|
-
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
2716
|
-
}
|
|
2717
|
-
const tagName = BUILD.transformTagName && options.transformTagName
|
|
2718
|
-
? options.transformTagName(cmpMeta.$tagName$)
|
|
2719
|
-
: cmpMeta.$tagName$;
|
|
1756
|
+
const tagName = cmpMeta.$tagName$;
|
|
2720
1757
|
const HostElement = class extends HTMLElement {
|
|
2721
1758
|
// StencilLazyHost
|
|
2722
1759
|
constructor(self) {
|
|
@@ -2724,28 +1761,16 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2724
1761
|
super(self);
|
|
2725
1762
|
self = this;
|
|
2726
1763
|
registerHost(self, cmpMeta);
|
|
2727
|
-
if (
|
|
1764
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2728
1765
|
// this component is using shadow dom
|
|
2729
1766
|
// and this browser supports shadow dom
|
|
2730
1767
|
// add the read-only property "shadowRoot" to the host element
|
|
2731
1768
|
// adding the shadow root build conditionals to minimize runtime
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
self.attachShadow({
|
|
2735
|
-
mode: 'open',
|
|
2736
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
|
2737
|
-
});
|
|
2738
|
-
}
|
|
2739
|
-
else {
|
|
1769
|
+
{
|
|
1770
|
+
{
|
|
2740
1771
|
self.attachShadow({ mode: 'open' });
|
|
2741
1772
|
}
|
|
2742
1773
|
}
|
|
2743
|
-
else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
|
|
2744
|
-
self.shadowRoot = self;
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
if (BUILD.slotChildNodesFix) {
|
|
2748
|
-
patchChildSlotNodes(self, cmpMeta);
|
|
2749
1774
|
}
|
|
2750
1775
|
}
|
|
2751
1776
|
connectedCallback() {
|
|
@@ -2768,20 +1793,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2768
1793
|
return getHostRef(this).$onReadyPromise$;
|
|
2769
1794
|
}
|
|
2770
1795
|
};
|
|
2771
|
-
if (BUILD.cloneNodeFix) {
|
|
2772
|
-
patchCloneNode(HostElement.prototype);
|
|
2773
|
-
}
|
|
2774
|
-
if (BUILD.appendChildSlotFix) {
|
|
2775
|
-
patchSlotAppendChild(HostElement.prototype);
|
|
2776
|
-
}
|
|
2777
|
-
if (BUILD.hotModuleReplacement) {
|
|
2778
|
-
HostElement.prototype['s-hmr'] = function (hmrVersionId) {
|
|
2779
|
-
hmrStart(this, cmpMeta, hmrVersionId);
|
|
2780
|
-
};
|
|
2781
|
-
}
|
|
2782
|
-
if (BUILD.scopedSlotTextContentFix) {
|
|
2783
|
-
patchTextContent(HostElement.prototype, cmpMeta);
|
|
2784
|
-
}
|
|
2785
1796
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
2786
1797
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
2787
1798
|
cmpTags.push(tagName);
|
|
@@ -2789,7 +1800,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2789
1800
|
}
|
|
2790
1801
|
});
|
|
2791
1802
|
});
|
|
2792
|
-
|
|
1803
|
+
{
|
|
2793
1804
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
2794
1805
|
visibilityStyle.setAttribute('data-styles', '');
|
|
2795
1806
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
@@ -2800,89 +1811,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2800
1811
|
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
2801
1812
|
}
|
|
2802
1813
|
else {
|
|
2803
|
-
|
|
2804
|
-
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
|
|
2805
|
-
}
|
|
2806
|
-
else {
|
|
1814
|
+
{
|
|
2807
1815
|
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
|
|
2808
1816
|
}
|
|
2809
1817
|
}
|
|
2810
1818
|
// Fallback appLoad event
|
|
2811
1819
|
endBootstrap();
|
|
2812
1820
|
};
|
|
2813
|
-
const getConnect = (_ref, tagName) => {
|
|
2814
|
-
const componentOnReady = () => {
|
|
2815
|
-
let elm = doc.querySelector(tagName);
|
|
2816
|
-
if (!elm) {
|
|
2817
|
-
elm = doc.createElement(tagName);
|
|
2818
|
-
doc.body.appendChild(elm);
|
|
2819
|
-
}
|
|
2820
|
-
return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
|
|
2821
|
-
};
|
|
2822
|
-
const create = (...args) => {
|
|
2823
|
-
return componentOnReady().then((el) => el.create(...args));
|
|
2824
|
-
};
|
|
2825
|
-
return {
|
|
2826
|
-
create,
|
|
2827
|
-
componentOnReady,
|
|
2828
|
-
};
|
|
2829
|
-
};
|
|
2830
|
-
const getContext = (_elm, context) => {
|
|
2831
|
-
if (context in Context) {
|
|
2832
|
-
return Context[context];
|
|
2833
|
-
}
|
|
2834
|
-
else if (context === 'window') {
|
|
2835
|
-
return win;
|
|
2836
|
-
}
|
|
2837
|
-
else if (context === 'document') {
|
|
2838
|
-
return doc;
|
|
2839
|
-
}
|
|
2840
|
-
else if (context === 'isServer' || context === 'isPrerender') {
|
|
2841
|
-
return BUILD.hydrateServerSide ? true : false;
|
|
2842
|
-
}
|
|
2843
|
-
else if (context === 'isClient') {
|
|
2844
|
-
return BUILD.hydrateServerSide ? false : true;
|
|
2845
|
-
}
|
|
2846
|
-
else if (context === 'resourcesUrl' || context === 'publicPath') {
|
|
2847
|
-
return getAssetPath('.');
|
|
2848
|
-
}
|
|
2849
|
-
else if (context === 'queue') {
|
|
2850
|
-
return {
|
|
2851
|
-
write: writeTask,
|
|
2852
|
-
read: readTask,
|
|
2853
|
-
tick: {
|
|
2854
|
-
then(cb) {
|
|
2855
|
-
return nextTick(cb);
|
|
2856
|
-
},
|
|
2857
|
-
},
|
|
2858
|
-
};
|
|
2859
|
-
}
|
|
2860
|
-
return undefined;
|
|
2861
|
-
};
|
|
2862
1821
|
const Fragment = (_, children) => children;
|
|
2863
1822
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
2864
|
-
if (
|
|
2865
|
-
// this is called immediately within the element's constructor
|
|
2866
|
-
// initialize our event listeners on the host element
|
|
2867
|
-
// we do this now so that we can listen to events that may
|
|
2868
|
-
// have fired even before the instance is ready
|
|
2869
|
-
if (BUILD.hostListenerTargetParent) {
|
|
2870
|
-
// this component may have event listeners that should be attached to the parent
|
|
2871
|
-
if (attachParentListeners) {
|
|
2872
|
-
// this is being ran from within the connectedCallback
|
|
2873
|
-
// which is important so that we know the host element actually has a parent element
|
|
2874
|
-
// filter out the listeners to only have the ones that ARE being attached to the parent
|
|
2875
|
-
listeners = listeners.filter(([flags]) => flags & 32 /* LISTENER_FLAGS.TargetParent */);
|
|
2876
|
-
}
|
|
2877
|
-
else {
|
|
2878
|
-
// this is being ran from within the component constructor
|
|
2879
|
-
// everything BUT the parent element listeners should be attached at this time
|
|
2880
|
-
// filter out the listeners that are NOT being attached to the parent
|
|
2881
|
-
listeners = listeners.filter(([flags]) => !(flags & 32 /* LISTENER_FLAGS.TargetParent */));
|
|
2882
|
-
}
|
|
2883
|
-
}
|
|
1823
|
+
if (listeners) {
|
|
2884
1824
|
listeners.map(([flags, name, method]) => {
|
|
2885
|
-
const target =
|
|
1825
|
+
const target = elm;
|
|
2886
1826
|
const handler = hostListenerProxy(hostRef, method);
|
|
2887
1827
|
const opts = hostListenerOpts(flags);
|
|
2888
1828
|
plt.ael(target, name, handler, opts);
|
|
@@ -2892,7 +1832,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
2892
1832
|
};
|
|
2893
1833
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
2894
1834
|
try {
|
|
2895
|
-
|
|
1835
|
+
{
|
|
2896
1836
|
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
2897
1837
|
// instance is ready, let's call it's member method for this event
|
|
2898
1838
|
hostRef.$lazyInstance$[methodName](ev);
|
|
@@ -2901,172 +1841,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
2901
1841
|
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
2902
1842
|
}
|
|
2903
1843
|
}
|
|
2904
|
-
else {
|
|
2905
|
-
hostRef.$hostElement$[methodName](ev);
|
|
2906
|
-
}
|
|
2907
1844
|
}
|
|
2908
1845
|
catch (e) {
|
|
2909
1846
|
consoleError(e);
|
|
2910
1847
|
}
|
|
2911
1848
|
};
|
|
2912
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
2913
|
-
if (BUILD.hostListenerTargetDocument && flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
2914
|
-
return doc;
|
|
2915
|
-
if (BUILD.hostListenerTargetWindow && flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
2916
|
-
return win;
|
|
2917
|
-
if (BUILD.hostListenerTargetBody && flags & 16 /* LISTENER_FLAGS.TargetBody */)
|
|
2918
|
-
return doc.body;
|
|
2919
|
-
if (BUILD.hostListenerTargetParent && flags & 32 /* LISTENER_FLAGS.TargetParent */)
|
|
2920
|
-
return elm.parentElement;
|
|
2921
|
-
return elm;
|
|
2922
|
-
};
|
|
2923
1849
|
// prettier-ignore
|
|
2924
|
-
const hostListenerOpts = (flags) =>
|
|
2925
|
-
? ({
|
|
2926
|
-
passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
|
|
2927
|
-
capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
|
|
2928
|
-
})
|
|
2929
|
-
: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
2930
|
-
const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
2931
|
-
const insertVdomAnnotations = (doc, staticComponents) => {
|
|
2932
|
-
if (doc != null) {
|
|
2933
|
-
const docData = {
|
|
2934
|
-
hostIds: 0,
|
|
2935
|
-
rootLevelIds: 0,
|
|
2936
|
-
staticComponents: new Set(staticComponents),
|
|
2937
|
-
};
|
|
2938
|
-
const orgLocationNodes = [];
|
|
2939
|
-
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
2940
|
-
orgLocationNodes.forEach((orgLocationNode) => {
|
|
2941
|
-
if (orgLocationNode != null) {
|
|
2942
|
-
const nodeRef = orgLocationNode['s-nr'];
|
|
2943
|
-
let hostId = nodeRef['s-host-id'];
|
|
2944
|
-
let nodeId = nodeRef['s-node-id'];
|
|
2945
|
-
let childId = `${hostId}.${nodeId}`;
|
|
2946
|
-
if (hostId == null) {
|
|
2947
|
-
hostId = 0;
|
|
2948
|
-
docData.rootLevelIds++;
|
|
2949
|
-
nodeId = docData.rootLevelIds;
|
|
2950
|
-
childId = `${hostId}.${nodeId}`;
|
|
2951
|
-
if (nodeRef.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
2952
|
-
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
2953
|
-
}
|
|
2954
|
-
else if (nodeRef.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
2955
|
-
if (hostId === 0) {
|
|
2956
|
-
const textContent = nodeRef.nodeValue.trim();
|
|
2957
|
-
if (textContent === '') {
|
|
2958
|
-
// useless whitespace node at the document root
|
|
2959
|
-
orgLocationNode.remove();
|
|
2960
|
-
return;
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
2964
|
-
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
2965
|
-
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
|
2969
|
-
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
2970
|
-
if (orgLocationParentNode) {
|
|
2971
|
-
if (orgLocationParentNode['s-en'] === '') {
|
|
2972
|
-
// ending with a "." means that the parent element
|
|
2973
|
-
// of this node's original location is a SHADOW dom element
|
|
2974
|
-
// and this node is apart of the root level light dom
|
|
2975
|
-
orgLocationNodeId += `.`;
|
|
2976
|
-
}
|
|
2977
|
-
else if (orgLocationParentNode['s-en'] === 'c') {
|
|
2978
|
-
// ending with a ".c" means that the parent element
|
|
2979
|
-
// of this node's original location is a SCOPED element
|
|
2980
|
-
// and this node is apart of the root level light dom
|
|
2981
|
-
orgLocationNodeId += `.c`;
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
|
-
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
2985
|
-
}
|
|
2986
|
-
});
|
|
2987
|
-
}
|
|
2988
|
-
};
|
|
2989
|
-
const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
2990
|
-
if (node == null) {
|
|
2991
|
-
return;
|
|
2992
|
-
}
|
|
2993
|
-
if (node['s-nr'] != null) {
|
|
2994
|
-
orgLocationNodes.push(node);
|
|
2995
|
-
}
|
|
2996
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
2997
|
-
node.childNodes.forEach((childNode) => {
|
|
2998
|
-
const hostRef = getHostRef(childNode);
|
|
2999
|
-
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
|
|
3000
|
-
const cmpData = {
|
|
3001
|
-
nodeIds: 0,
|
|
3002
|
-
};
|
|
3003
|
-
insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
|
|
3004
|
-
}
|
|
3005
|
-
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
3006
|
-
});
|
|
3007
|
-
}
|
|
3008
|
-
};
|
|
3009
|
-
const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
3010
|
-
if (vnode != null) {
|
|
3011
|
-
const hostId = ++docData.hostIds;
|
|
3012
|
-
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
3013
|
-
if (hostElm['s-cr'] != null) {
|
|
3014
|
-
hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
|
|
3015
|
-
}
|
|
3016
|
-
if (vnode.$children$ != null) {
|
|
3017
|
-
const depth = 0;
|
|
3018
|
-
vnode.$children$.forEach((vnodeChild, index) => {
|
|
3019
|
-
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
3020
|
-
});
|
|
3021
|
-
}
|
|
3022
|
-
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
|
|
3023
|
-
const parent = hostElm.parentElement;
|
|
3024
|
-
if (parent && parent.childNodes) {
|
|
3025
|
-
const parentChildNodes = Array.from(parent.childNodes);
|
|
3026
|
-
const comment = parentChildNodes.find((node) => node.nodeType === 8 /* NODE_TYPE.CommentNode */ && node['s-sr']);
|
|
3027
|
-
if (comment) {
|
|
3028
|
-
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
3029
|
-
vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
|
|
3030
|
-
}
|
|
3031
|
-
}
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
};
|
|
3035
|
-
const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
3036
|
-
const childElm = vnodeChild.$elm$;
|
|
3037
|
-
if (childElm == null) {
|
|
3038
|
-
return;
|
|
3039
|
-
}
|
|
3040
|
-
const nodeId = cmpData.nodeIds++;
|
|
3041
|
-
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
3042
|
-
childElm['s-host-id'] = hostId;
|
|
3043
|
-
childElm['s-node-id'] = nodeId;
|
|
3044
|
-
if (childElm.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
3045
|
-
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
3046
|
-
}
|
|
3047
|
-
else if (childElm.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
3048
|
-
const parentNode = childElm.parentNode;
|
|
3049
|
-
const nodeName = parentNode.nodeName;
|
|
3050
|
-
if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
|
|
3051
|
-
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
3052
|
-
const commentBeforeTextNode = doc.createComment(textNodeId);
|
|
3053
|
-
parentNode.insertBefore(commentBeforeTextNode, childElm);
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
|
-
else if (childElm.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
3057
|
-
if (childElm['s-sr']) {
|
|
3058
|
-
const slotName = childElm['s-sn'] || '';
|
|
3059
|
-
const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
|
|
3060
|
-
childElm.nodeValue = slotNodeId;
|
|
3061
|
-
}
|
|
3062
|
-
}
|
|
3063
|
-
if (vnodeChild.$children$ != null) {
|
|
3064
|
-
const childDepth = depth + 1;
|
|
3065
|
-
vnodeChild.$children$.forEach((vnode, index) => {
|
|
3066
|
-
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
|
|
3067
|
-
});
|
|
3068
|
-
}
|
|
3069
|
-
};
|
|
1850
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
3070
1851
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
3071
1852
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
3072
1853
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -3077,42 +1858,25 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
3077
1858
|
$cmpMeta$: cmpMeta,
|
|
3078
1859
|
$instanceValues$: new Map(),
|
|
3079
1860
|
};
|
|
3080
|
-
|
|
3081
|
-
hostRef.$renderCount$ = 0;
|
|
3082
|
-
}
|
|
3083
|
-
if (BUILD.method && BUILD.lazyLoad) {
|
|
1861
|
+
{
|
|
3084
1862
|
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
3085
1863
|
}
|
|
3086
|
-
|
|
1864
|
+
{
|
|
3087
1865
|
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
3088
1866
|
elm['s-p'] = [];
|
|
3089
1867
|
elm['s-rc'] = [];
|
|
3090
1868
|
}
|
|
3091
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
1869
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
3092
1870
|
return hostRefs.set(elm, hostRef);
|
|
3093
1871
|
};
|
|
3094
1872
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
3095
|
-
const consoleError = (e, el) => (
|
|
3096
|
-
const STENCIL_DEV_MODE = BUILD.isTesting
|
|
3097
|
-
? ['STENCIL:'] // E2E testing
|
|
3098
|
-
: [
|
|
3099
|
-
'%cstencil',
|
|
3100
|
-
'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
|
|
3101
|
-
];
|
|
3102
|
-
const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
|
|
3103
|
-
const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
|
|
3104
|
-
const consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
|
|
3105
|
-
const setErrorHandler = (handler) => (customError = handler);
|
|
1873
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
3106
1874
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
3107
1875
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
3108
1876
|
// loadModuleImport
|
|
3109
1877
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
3110
1878
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
3111
|
-
|
|
3112
|
-
consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
|
|
3113
|
-
return undefined;
|
|
3114
|
-
}
|
|
3115
|
-
const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
|
|
1879
|
+
const module = cmpModules.get(bundleId) ;
|
|
3116
1880
|
if (module) {
|
|
3117
1881
|
return module[exportName];
|
|
3118
1882
|
}
|
|
@@ -3122,20 +1886,16 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
3122
1886
|
/* webpackInclude: /\.entry\.js$/ */
|
|
3123
1887
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
3124
1888
|
/* webpackMode: "lazy" */
|
|
3125
|
-
`./${bundleId}.entry.js${
|
|
3126
|
-
|
|
1889
|
+
`./${bundleId}.entry.js${''}`).then((importedModule) => {
|
|
1890
|
+
{
|
|
3127
1891
|
cmpModules.set(bundleId, importedModule);
|
|
3128
1892
|
}
|
|
3129
1893
|
return importedModule[exportName];
|
|
3130
1894
|
}, consoleError);
|
|
3131
1895
|
};
|
|
3132
1896
|
const styles = /*@__PURE__*/ new Map();
|
|
3133
|
-
const modeResolutionChain = [];
|
|
3134
1897
|
const win = typeof window !== 'undefined' ? window : {};
|
|
3135
|
-
const CSS = BUILD.cssVarShim ? win.CSS : null;
|
|
3136
1898
|
const doc = win.document || { head: {} };
|
|
3137
|
-
const H = (win.HTMLElement || class {
|
|
3138
|
-
});
|
|
3139
1899
|
const plt = {
|
|
3140
1900
|
$flags$: 0,
|
|
3141
1901
|
$resourcesUrl$: '',
|
|
@@ -3145,27 +1905,8 @@ const plt = {
|
|
|
3145
1905
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
3146
1906
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
3147
1907
|
};
|
|
3148
|
-
const setPlatformHelpers = (helpers) => {
|
|
3149
|
-
Object.assign(plt, helpers);
|
|
3150
|
-
};
|
|
3151
|
-
const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom
|
|
3152
|
-
? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
3153
|
-
: true;
|
|
3154
|
-
const supportsListenerOptions = /*@__PURE__*/ (() => {
|
|
3155
|
-
let supportsListenerOptions = false;
|
|
3156
|
-
try {
|
|
3157
|
-
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
|
|
3158
|
-
get() {
|
|
3159
|
-
supportsListenerOptions = true;
|
|
3160
|
-
},
|
|
3161
|
-
}));
|
|
3162
|
-
}
|
|
3163
|
-
catch (e) { }
|
|
3164
|
-
return supportsListenerOptions;
|
|
3165
|
-
})();
|
|
3166
1908
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
3167
|
-
const supportsConstructableStylesheets =
|
|
3168
|
-
? /*@__PURE__*/ (() => {
|
|
1909
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
3169
1910
|
try {
|
|
3170
1911
|
new CSSStyleSheet();
|
|
3171
1912
|
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
@@ -3173,10 +1914,9 @@ const supportsConstructableStylesheets = BUILD.constructableCSS
|
|
|
3173
1914
|
catch (e) { }
|
|
3174
1915
|
return false;
|
|
3175
1916
|
})()
|
|
3176
|
-
|
|
1917
|
+
;
|
|
3177
1918
|
const queueDomReads = [];
|
|
3178
1919
|
const queueDomWrites = [];
|
|
3179
|
-
const queueDomWritesLow = [];
|
|
3180
1920
|
const queueTask = (queue, write) => (cb) => {
|
|
3181
1921
|
queue.push(cb);
|
|
3182
1922
|
if (!queuePending) {
|
|
@@ -3200,53 +1940,13 @@ const consume = (queue) => {
|
|
|
3200
1940
|
}
|
|
3201
1941
|
queue.length = 0;
|
|
3202
1942
|
};
|
|
3203
|
-
const consumeTimeout = (queue, timeout) => {
|
|
3204
|
-
let i = 0;
|
|
3205
|
-
let ts = 0;
|
|
3206
|
-
while (i < queue.length && (ts = performance.now()) < timeout) {
|
|
3207
|
-
try {
|
|
3208
|
-
queue[i++](ts);
|
|
3209
|
-
}
|
|
3210
|
-
catch (e) {
|
|
3211
|
-
consoleError(e);
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
if (i === queue.length) {
|
|
3215
|
-
queue.length = 0;
|
|
3216
|
-
}
|
|
3217
|
-
else if (i !== 0) {
|
|
3218
|
-
queue.splice(0, i);
|
|
3219
|
-
}
|
|
3220
|
-
};
|
|
3221
1943
|
const flush = () => {
|
|
3222
|
-
if (BUILD.asyncQueue) {
|
|
3223
|
-
queueCongestion++;
|
|
3224
|
-
}
|
|
3225
1944
|
// always force a bunch of medium callbacks to run, but still have
|
|
3226
1945
|
// a throttle on how many can run in a certain time
|
|
3227
1946
|
// DOM READS!!!
|
|
3228
1947
|
consume(queueDomReads);
|
|
3229
1948
|
// DOM WRITES!!!
|
|
3230
|
-
|
|
3231
|
-
const timeout = (plt.$flags$ & 6 /* PLATFORM_FLAGS.queueMask */) === 2 /* PLATFORM_FLAGS.appLoaded */
|
|
3232
|
-
? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
|
|
3233
|
-
: Infinity;
|
|
3234
|
-
consumeTimeout(queueDomWrites, timeout);
|
|
3235
|
-
consumeTimeout(queueDomWritesLow, timeout);
|
|
3236
|
-
if (queueDomWrites.length > 0) {
|
|
3237
|
-
queueDomWritesLow.push(...queueDomWrites);
|
|
3238
|
-
queueDomWrites.length = 0;
|
|
3239
|
-
}
|
|
3240
|
-
if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
|
|
3241
|
-
// still more to do yet, but we've run out of time
|
|
3242
|
-
// let's let this thing cool off and try again in the next tick
|
|
3243
|
-
plt.raf(flush);
|
|
3244
|
-
}
|
|
3245
|
-
else {
|
|
3246
|
-
queueCongestion = 0;
|
|
3247
|
-
}
|
|
3248
|
-
}
|
|
3249
|
-
else {
|
|
1949
|
+
{
|
|
3250
1950
|
consume(queueDomWrites);
|
|
3251
1951
|
if ((queuePending = queueDomReads.length > 0)) {
|
|
3252
1952
|
// still more to do yet, but we've run out of time
|
|
@@ -3256,7 +1956,6 @@ const flush = () => {
|
|
|
3256
1956
|
}
|
|
3257
1957
|
};
|
|
3258
1958
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
3259
|
-
const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
|
|
3260
1959
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
3261
1960
|
|
|
3262
|
-
export {
|
|
1961
|
+
export { Fragment as F, Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
|