@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
|
@@ -21,8 +21,6 @@ function _interopNamespace(e) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'sankhyablocks';
|
|
24
|
-
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 };
|
|
25
|
-
const Env = /* sankhyablocks */ {};
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* Virtual DOM patching algorithm based on Snabbdom by
|
|
@@ -35,120 +33,25 @@ const Env = /* sankhyablocks */ {};
|
|
|
35
33
|
let scopeId;
|
|
36
34
|
let contentRef;
|
|
37
35
|
let hostTagName;
|
|
38
|
-
let customError;
|
|
39
|
-
let i = 0;
|
|
40
36
|
let useNativeShadowDom = false;
|
|
41
37
|
let checkSlotFallbackVisibility = false;
|
|
42
38
|
let checkSlotRelocate = false;
|
|
43
39
|
let isSvgMode = false;
|
|
44
|
-
let renderingRef = null;
|
|
45
|
-
let queueCongestion = 0;
|
|
46
40
|
let queuePending = false;
|
|
47
|
-
const Build = {
|
|
48
|
-
isDev: BUILD.isDev ? true : false,
|
|
49
|
-
isBrowser: true,
|
|
50
|
-
isServer: false,
|
|
51
|
-
isTesting: BUILD.isTesting ? true : false,
|
|
52
|
-
};
|
|
53
|
-
const Context = {};
|
|
54
|
-
const getAssetPath = (path) => {
|
|
55
|
-
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
|
56
|
-
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
57
|
-
};
|
|
58
|
-
const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
|
|
59
41
|
const createTime = (fnName, tagName = '') => {
|
|
60
|
-
|
|
61
|
-
const key = `st:${fnName}:${tagName}:${i++}`;
|
|
62
|
-
// Start
|
|
63
|
-
performance.mark(key);
|
|
64
|
-
// End
|
|
65
|
-
return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
42
|
+
{
|
|
68
43
|
return () => {
|
|
69
44
|
return;
|
|
70
45
|
};
|
|
71
46
|
}
|
|
72
47
|
};
|
|
73
48
|
const uniqueTime = (key, measureText) => {
|
|
74
|
-
|
|
75
|
-
if (performance.getEntriesByName(key).length === 0) {
|
|
76
|
-
performance.mark(key);
|
|
77
|
-
}
|
|
78
|
-
return () => {
|
|
79
|
-
if (performance.getEntriesByName(measureText).length === 0) {
|
|
80
|
-
performance.measure(measureText, key);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
49
|
+
{
|
|
85
50
|
return () => {
|
|
86
51
|
return;
|
|
87
52
|
};
|
|
88
53
|
}
|
|
89
54
|
};
|
|
90
|
-
const inspect = (ref) => {
|
|
91
|
-
const hostRef = getHostRef(ref);
|
|
92
|
-
if (!hostRef) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
const flags = hostRef.$flags$;
|
|
96
|
-
const hostElement = hostRef.$hostElement$;
|
|
97
|
-
return {
|
|
98
|
-
renderCount: hostRef.$renderCount$,
|
|
99
|
-
flags: {
|
|
100
|
-
hasRendered: !!(flags & 2 /* HOST_FLAGS.hasRendered */),
|
|
101
|
-
hasConnected: !!(flags & 1 /* HOST_FLAGS.hasConnected */),
|
|
102
|
-
isWaitingForChildren: !!(flags & 4 /* HOST_FLAGS.isWaitingForChildren */),
|
|
103
|
-
isConstructingInstance: !!(flags & 8 /* HOST_FLAGS.isConstructingInstance */),
|
|
104
|
-
isQueuedForUpdate: !!(flags & 16 /* HOST_FLAGS.isQueuedForUpdate */),
|
|
105
|
-
hasInitializedComponent: !!(flags & 32 /* HOST_FLAGS.hasInitializedComponent */),
|
|
106
|
-
hasLoadedComponent: !!(flags & 64 /* HOST_FLAGS.hasLoadedComponent */),
|
|
107
|
-
isWatchReady: !!(flags & 128 /* HOST_FLAGS.isWatchReady */),
|
|
108
|
-
isListenReady: !!(flags & 256 /* HOST_FLAGS.isListenReady */),
|
|
109
|
-
needsRerender: !!(flags & 512 /* HOST_FLAGS.needsRerender */),
|
|
110
|
-
},
|
|
111
|
-
instanceValues: hostRef.$instanceValues$,
|
|
112
|
-
ancestorComponent: hostRef.$ancestorComponent$,
|
|
113
|
-
hostElement,
|
|
114
|
-
lazyInstance: hostRef.$lazyInstance$,
|
|
115
|
-
vnode: hostRef.$vnode$,
|
|
116
|
-
modeName: hostRef.$modeName$,
|
|
117
|
-
onReadyPromise: hostRef.$onReadyPromise$,
|
|
118
|
-
onReadyResolve: hostRef.$onReadyResolve$,
|
|
119
|
-
onInstancePromise: hostRef.$onInstancePromise$,
|
|
120
|
-
onInstanceResolve: hostRef.$onInstanceResolve$,
|
|
121
|
-
onRenderResolve: hostRef.$onRenderResolve$,
|
|
122
|
-
queuedListeners: hostRef.$queuedListeners$,
|
|
123
|
-
rmListeners: hostRef.$rmListeners$,
|
|
124
|
-
['s-id']: hostElement['s-id'],
|
|
125
|
-
['s-cr']: hostElement['s-cr'],
|
|
126
|
-
['s-lr']: hostElement['s-lr'],
|
|
127
|
-
['s-p']: hostElement['s-p'],
|
|
128
|
-
['s-rc']: hostElement['s-rc'],
|
|
129
|
-
['s-sc']: hostElement['s-sc'],
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
const installDevTools = () => {
|
|
133
|
-
if (BUILD.devTools) {
|
|
134
|
-
const stencil = (win.stencil = win.stencil || {});
|
|
135
|
-
const originalInspect = stencil.inspect;
|
|
136
|
-
stencil.inspect = (ref) => {
|
|
137
|
-
let result = inspect(ref);
|
|
138
|
-
if (!result && typeof originalInspect === 'function') {
|
|
139
|
-
result = originalInspect(ref);
|
|
140
|
-
}
|
|
141
|
-
return result;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
const CONTENT_REF_ID = 'r';
|
|
146
|
-
const ORG_LOCATION_ID = 'o';
|
|
147
|
-
const SLOT_NODE_ID = 's';
|
|
148
|
-
const TEXT_NODE_ID = 't';
|
|
149
|
-
const HYDRATE_ID = 's-id';
|
|
150
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
151
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
152
55
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
153
56
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
154
57
|
/**
|
|
@@ -159,11 +62,6 @@ const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
|
159
62
|
* Don't add values to these!!
|
|
160
63
|
*/
|
|
161
64
|
const EMPTY_OBJ = {};
|
|
162
|
-
/**
|
|
163
|
-
* Namespaces
|
|
164
|
-
*/
|
|
165
|
-
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
166
|
-
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
167
65
|
const isDef = (v) => v != null;
|
|
168
66
|
const isComplexType = (o) => {
|
|
169
67
|
// https://jsperf.com/typeof-fn-object/5
|
|
@@ -198,11 +96,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
198
96
|
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
|
|
199
97
|
child = String(child);
|
|
200
98
|
}
|
|
201
|
-
else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
|
|
202
|
-
consoleDevError(`vNode passed as children has unexpected type.
|
|
203
|
-
Make sure it's using the correct h() function.
|
|
204
|
-
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
|
205
|
-
}
|
|
206
99
|
if (simple && lastSimple) {
|
|
207
100
|
// If the previous child was simple (string), we merge both
|
|
208
101
|
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
@@ -217,17 +110,14 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
217
110
|
};
|
|
218
111
|
walk(children);
|
|
219
112
|
if (vnodeData) {
|
|
220
|
-
if (BUILD.isDev && nodeName === 'input') {
|
|
221
|
-
validateInputProperties(vnodeData);
|
|
222
|
-
}
|
|
223
113
|
// normalize class / classname attributes
|
|
224
|
-
if (
|
|
114
|
+
if (vnodeData.key) {
|
|
225
115
|
key = vnodeData.key;
|
|
226
116
|
}
|
|
227
|
-
if (
|
|
117
|
+
if (vnodeData.name) {
|
|
228
118
|
slotName = vnodeData.name;
|
|
229
119
|
}
|
|
230
|
-
|
|
120
|
+
{
|
|
231
121
|
const classData = vnodeData.className || vnodeData.class;
|
|
232
122
|
if (classData) {
|
|
233
123
|
vnodeData.class =
|
|
@@ -239,12 +129,7 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
239
129
|
}
|
|
240
130
|
}
|
|
241
131
|
}
|
|
242
|
-
if (
|
|
243
|
-
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
244
|
-
- You are NOT using hostData() and <Host> in the same component.
|
|
245
|
-
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
246
|
-
}
|
|
247
|
-
if (BUILD.vdomFunctional && typeof nodeName === 'function') {
|
|
132
|
+
if (typeof nodeName === 'function') {
|
|
248
133
|
// nodeName is a functional component
|
|
249
134
|
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
250
135
|
}
|
|
@@ -253,10 +138,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
253
138
|
if (vNodeChildren.length > 0) {
|
|
254
139
|
vnode.$children$ = vNodeChildren;
|
|
255
140
|
}
|
|
256
|
-
|
|
141
|
+
{
|
|
257
142
|
vnode.$key$ = key;
|
|
258
143
|
}
|
|
259
|
-
|
|
144
|
+
{
|
|
260
145
|
vnode.$name$ = slotName;
|
|
261
146
|
}
|
|
262
147
|
return vnode;
|
|
@@ -269,13 +154,13 @@ const newVNode = (tag, text) => {
|
|
|
269
154
|
$elm$: null,
|
|
270
155
|
$children$: null,
|
|
271
156
|
};
|
|
272
|
-
|
|
157
|
+
{
|
|
273
158
|
vnode.$attrs$ = null;
|
|
274
159
|
}
|
|
275
|
-
|
|
160
|
+
{
|
|
276
161
|
vnode.$key$ = null;
|
|
277
162
|
}
|
|
278
|
-
|
|
163
|
+
{
|
|
279
164
|
vnode.$name$ = null;
|
|
280
165
|
}
|
|
281
166
|
return vnode;
|
|
@@ -312,234 +197,6 @@ const convertToPrivate = (node) => {
|
|
|
312
197
|
vnode.$name$ = node.vname;
|
|
313
198
|
return vnode;
|
|
314
199
|
};
|
|
315
|
-
/**
|
|
316
|
-
* Validates the ordering of attributes on an input element
|
|
317
|
-
* @param inputElm the element to validate
|
|
318
|
-
*/
|
|
319
|
-
const validateInputProperties = (inputElm) => {
|
|
320
|
-
const props = Object.keys(inputElm);
|
|
321
|
-
const value = props.indexOf('value');
|
|
322
|
-
if (value === -1) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
const typeIndex = props.indexOf('type');
|
|
326
|
-
const minIndex = props.indexOf('min');
|
|
327
|
-
const maxIndex = props.indexOf('max');
|
|
328
|
-
const stepIndex = props.indexOf('step');
|
|
329
|
-
if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
|
|
330
|
-
consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
334
|
-
const endHydrate = createTime('hydrateClient', tagName);
|
|
335
|
-
const shadowRoot = hostElm.shadowRoot;
|
|
336
|
-
const childRenderNodes = [];
|
|
337
|
-
const slotNodes = [];
|
|
338
|
-
const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
|
|
339
|
-
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
340
|
-
if (!plt.$orgLocNodes$) {
|
|
341
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
342
|
-
}
|
|
343
|
-
hostElm[HYDRATE_ID] = hostId;
|
|
344
|
-
hostElm.removeAttribute(HYDRATE_ID);
|
|
345
|
-
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
346
|
-
childRenderNodes.map((c) => {
|
|
347
|
-
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
348
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
349
|
-
const node = c.$elm$;
|
|
350
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
351
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
352
|
-
}
|
|
353
|
-
if (!shadowRoot) {
|
|
354
|
-
node['s-hn'] = tagName;
|
|
355
|
-
if (orgLocationNode) {
|
|
356
|
-
node['s-ol'] = orgLocationNode;
|
|
357
|
-
node['s-ol']['s-nr'] = node;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
361
|
-
});
|
|
362
|
-
if (BUILD.shadowDom && shadowRoot) {
|
|
363
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
364
|
-
if (shadowRootNode) {
|
|
365
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
endHydrate();
|
|
370
|
-
};
|
|
371
|
-
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
372
|
-
let childNodeType;
|
|
373
|
-
let childIdSplt;
|
|
374
|
-
let childVNode;
|
|
375
|
-
let i;
|
|
376
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
377
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
378
|
-
if (childNodeType) {
|
|
379
|
-
// got the node data from the element's attribute
|
|
380
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
381
|
-
childIdSplt = childNodeType.split('.');
|
|
382
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
383
|
-
childVNode = {
|
|
384
|
-
$flags$: 0,
|
|
385
|
-
$hostId$: childIdSplt[0],
|
|
386
|
-
$nodeId$: childIdSplt[1],
|
|
387
|
-
$depth$: childIdSplt[2],
|
|
388
|
-
$index$: childIdSplt[3],
|
|
389
|
-
$tag$: node.tagName.toLowerCase(),
|
|
390
|
-
$elm$: node,
|
|
391
|
-
$attrs$: null,
|
|
392
|
-
$children$: null,
|
|
393
|
-
$key$: null,
|
|
394
|
-
$name$: null,
|
|
395
|
-
$text$: null,
|
|
396
|
-
};
|
|
397
|
-
childRenderNodes.push(childVNode);
|
|
398
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
399
|
-
// this is a new child vnode
|
|
400
|
-
// so ensure its parent vnode has the vchildren array
|
|
401
|
-
if (!parentVNode.$children$) {
|
|
402
|
-
parentVNode.$children$ = [];
|
|
403
|
-
}
|
|
404
|
-
// add our child vnode to a specific index of the vnode's children
|
|
405
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
406
|
-
// this is now the new parent vnode for all the next child checks
|
|
407
|
-
parentVNode = childVNode;
|
|
408
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
409
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
// recursively drill down, end to start so we can remove nodes
|
|
414
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
415
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
416
|
-
}
|
|
417
|
-
if (node.shadowRoot) {
|
|
418
|
-
// keep drilling down through the shadow root nodes
|
|
419
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
420
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
425
|
-
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
426
|
-
childIdSplt = node.nodeValue.split('.');
|
|
427
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
428
|
-
// comment node for either the host id or a 0 host id
|
|
429
|
-
childNodeType = childIdSplt[0];
|
|
430
|
-
childVNode = {
|
|
431
|
-
$flags$: 0,
|
|
432
|
-
$hostId$: childIdSplt[1],
|
|
433
|
-
$nodeId$: childIdSplt[2],
|
|
434
|
-
$depth$: childIdSplt[3],
|
|
435
|
-
$index$: childIdSplt[4],
|
|
436
|
-
$elm$: node,
|
|
437
|
-
$attrs$: null,
|
|
438
|
-
$children$: null,
|
|
439
|
-
$key$: null,
|
|
440
|
-
$name$: null,
|
|
441
|
-
$tag$: null,
|
|
442
|
-
$text$: null,
|
|
443
|
-
};
|
|
444
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
445
|
-
childVNode.$elm$ = node.nextSibling;
|
|
446
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
447
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
448
|
-
childRenderNodes.push(childVNode);
|
|
449
|
-
// remove the text comment since it's no longer needed
|
|
450
|
-
node.remove();
|
|
451
|
-
if (!parentVNode.$children$) {
|
|
452
|
-
parentVNode.$children$ = [];
|
|
453
|
-
}
|
|
454
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
455
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
456
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
else if (childVNode.$hostId$ === hostId) {
|
|
461
|
-
// this comment node is specifcally for this host id
|
|
462
|
-
if (childNodeType === SLOT_NODE_ID) {
|
|
463
|
-
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
464
|
-
childVNode.$tag$ = 'slot';
|
|
465
|
-
if (childIdSplt[5]) {
|
|
466
|
-
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
467
|
-
}
|
|
468
|
-
else {
|
|
469
|
-
node['s-sn'] = '';
|
|
470
|
-
}
|
|
471
|
-
node['s-sr'] = true;
|
|
472
|
-
if (BUILD.shadowDom && shadowRootNodes) {
|
|
473
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
474
|
-
// create an actual slot element
|
|
475
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
476
|
-
if (childVNode.$name$) {
|
|
477
|
-
// add the slot name attribute
|
|
478
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
479
|
-
}
|
|
480
|
-
// insert the new slot element before the slot comment
|
|
481
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
482
|
-
// remove the slot comment since it's not needed for shadow
|
|
483
|
-
node.remove();
|
|
484
|
-
if (childVNode.$depth$ === '0') {
|
|
485
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
slotNodes.push(childVNode);
|
|
489
|
-
if (!parentVNode.$children$) {
|
|
490
|
-
parentVNode.$children$ = [];
|
|
491
|
-
}
|
|
492
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
493
|
-
}
|
|
494
|
-
else if (childNodeType === CONTENT_REF_ID) {
|
|
495
|
-
// `${CONTENT_REF_ID}.${hostId}`;
|
|
496
|
-
if (BUILD.shadowDom && shadowRootNodes) {
|
|
497
|
-
// remove the content ref comment since it's not needed for shadow
|
|
498
|
-
node.remove();
|
|
499
|
-
}
|
|
500
|
-
else if (BUILD.slotRelocation) {
|
|
501
|
-
hostElm['s-cr'] = node;
|
|
502
|
-
node['s-cn'] = true;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
509
|
-
const vnode = newVNode(null, node.textContent);
|
|
510
|
-
vnode.$elm$ = node;
|
|
511
|
-
vnode.$index$ = '0';
|
|
512
|
-
parentVNode.$children$ = [vnode];
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
516
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
517
|
-
let i = 0;
|
|
518
|
-
for (; i < node.childNodes.length; i++) {
|
|
519
|
-
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
520
|
-
}
|
|
521
|
-
if (node.shadowRoot) {
|
|
522
|
-
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
523
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
528
|
-
const childIdSplt = node.nodeValue.split('.');
|
|
529
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
530
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
531
|
-
node.nodeValue = '';
|
|
532
|
-
// useful to know if the original location is
|
|
533
|
-
// the root light-dom of a shadow dom component
|
|
534
|
-
node['s-en'] = childIdSplt[3];
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
};
|
|
538
|
-
// Private
|
|
539
|
-
const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
|
|
540
|
-
// Public
|
|
541
|
-
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
542
|
-
const getMode = (ref) => getHostRef(ref).$modeName$;
|
|
543
200
|
/**
|
|
544
201
|
* Parse a new property value for a given property type.
|
|
545
202
|
*
|
|
@@ -566,16 +223,16 @@ const getMode = (ref) => getHostRef(ref).$modeName$;
|
|
|
566
223
|
const parsePropertyValue = (propValue, propType) => {
|
|
567
224
|
// ensure this value is of the correct prop type
|
|
568
225
|
if (propValue != null && !isComplexType(propValue)) {
|
|
569
|
-
if (
|
|
226
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
570
227
|
// per the HTML spec, any string value means it is a boolean true value
|
|
571
228
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
572
229
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
573
230
|
}
|
|
574
|
-
if (
|
|
231
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
575
232
|
// force it to be a number
|
|
576
233
|
return parseFloat(propValue);
|
|
577
234
|
}
|
|
578
|
-
if (
|
|
235
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
579
236
|
// could have been passed as a number or boolean
|
|
580
237
|
// but we still want it as a string
|
|
581
238
|
return String(propValue);
|
|
@@ -587,14 +244,11 @@ const parsePropertyValue = (propValue, propType) => {
|
|
|
587
244
|
// so no need to change to a different type
|
|
588
245
|
return propValue;
|
|
589
246
|
};
|
|
590
|
-
const getElement = (ref) => (
|
|
247
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
591
248
|
const createEvent = (ref, name, flags) => {
|
|
592
249
|
const elm = getElement(ref);
|
|
593
250
|
return {
|
|
594
251
|
emit: (detail) => {
|
|
595
|
-
if (BUILD.isDev && !elm.isConnected) {
|
|
596
|
-
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
597
|
-
}
|
|
598
252
|
return emitEvent(elm, name, {
|
|
599
253
|
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
600
254
|
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
@@ -634,11 +288,8 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
634
288
|
styles.set(scopeId, style);
|
|
635
289
|
};
|
|
636
290
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
637
|
-
let scopeId = getScopeId(cmpMeta
|
|
291
|
+
let scopeId = getScopeId(cmpMeta);
|
|
638
292
|
const style = styles.get(scopeId);
|
|
639
|
-
if (!BUILD.attachStyles) {
|
|
640
|
-
return scopeId;
|
|
641
|
-
}
|
|
642
293
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
643
294
|
// so the fallback is to always use the document for the root node in those cases
|
|
644
295
|
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
@@ -651,31 +302,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
651
302
|
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
652
303
|
}
|
|
653
304
|
if (!appliedStyles.has(scopeId)) {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
657
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
658
|
-
styleElm.innerHTML = style;
|
|
659
|
-
}
|
|
660
|
-
else {
|
|
661
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
662
|
-
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
|
|
663
|
-
const newScopeId = styleElm['s-sc'];
|
|
664
|
-
if (newScopeId) {
|
|
665
|
-
scopeId = newScopeId;
|
|
666
|
-
// we don't want to add this styleID to the appliedStyles Set
|
|
667
|
-
// since the cssVarShim might need to apply several different
|
|
668
|
-
// stylesheets for the same component
|
|
669
|
-
appliedStyles = null;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
else {
|
|
305
|
+
{
|
|
306
|
+
{
|
|
673
307
|
styleElm = doc.createElement('style');
|
|
674
308
|
styleElm.innerHTML = style;
|
|
675
309
|
}
|
|
676
|
-
if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
|
|
677
|
-
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
|
|
678
|
-
}
|
|
679
310
|
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
680
311
|
}
|
|
681
312
|
if (appliedStyles) {
|
|
@@ -683,7 +314,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
683
314
|
}
|
|
684
315
|
}
|
|
685
316
|
}
|
|
686
|
-
else if (
|
|
317
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
687
318
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
688
319
|
}
|
|
689
320
|
}
|
|
@@ -694,8 +325,8 @@ const attachStyles = (hostRef) => {
|
|
|
694
325
|
const elm = hostRef.$hostElement$;
|
|
695
326
|
const flags = cmpMeta.$flags$;
|
|
696
327
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
697
|
-
const scopeId = addStyle(
|
|
698
|
-
if (
|
|
328
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
329
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
699
330
|
// only required when we're NOT using native shadow dom (slot)
|
|
700
331
|
// or this browser doesn't support native shadow dom
|
|
701
332
|
// and this host element was NOT created with SSR
|
|
@@ -705,14 +336,13 @@ const attachStyles = (hostRef) => {
|
|
|
705
336
|
// DOM WRITE!!
|
|
706
337
|
elm['s-sc'] = scopeId;
|
|
707
338
|
elm.classList.add(scopeId + '-h');
|
|
708
|
-
if (
|
|
339
|
+
if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
709
340
|
elm.classList.add(scopeId + '-s');
|
|
710
341
|
}
|
|
711
342
|
}
|
|
712
343
|
endAttachStyles();
|
|
713
344
|
};
|
|
714
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
715
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
345
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
716
346
|
/**
|
|
717
347
|
* Production setAccessor() function based on Preact by
|
|
718
348
|
* Jason Miller (@developit)
|
|
@@ -725,19 +355,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
725
355
|
if (oldValue !== newValue) {
|
|
726
356
|
let isProp = isMemberInElement(elm, memberName);
|
|
727
357
|
let ln = memberName.toLowerCase();
|
|
728
|
-
if (
|
|
358
|
+
if (memberName === 'class') {
|
|
729
359
|
const classList = elm.classList;
|
|
730
360
|
const oldClasses = parseClassList(oldValue);
|
|
731
361
|
const newClasses = parseClassList(newValue);
|
|
732
362
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
733
363
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
734
364
|
}
|
|
735
|
-
else if (
|
|
365
|
+
else if (memberName === 'style') {
|
|
736
366
|
// update style attribute, css properties and values
|
|
737
|
-
|
|
367
|
+
{
|
|
738
368
|
for (const prop in oldValue) {
|
|
739
369
|
if (!newValue || newValue[prop] == null) {
|
|
740
|
-
if (
|
|
370
|
+
if (prop.includes('-')) {
|
|
741
371
|
elm.style.removeProperty(prop);
|
|
742
372
|
}
|
|
743
373
|
else {
|
|
@@ -748,7 +378,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
748
378
|
}
|
|
749
379
|
for (const prop in newValue) {
|
|
750
380
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
751
|
-
if (
|
|
381
|
+
if (prop.includes('-')) {
|
|
752
382
|
elm.style.setProperty(prop, newValue[prop]);
|
|
753
383
|
}
|
|
754
384
|
else {
|
|
@@ -757,16 +387,15 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
757
387
|
}
|
|
758
388
|
}
|
|
759
389
|
}
|
|
760
|
-
else if (
|
|
390
|
+
else if (memberName === 'key')
|
|
761
391
|
;
|
|
762
|
-
else if (
|
|
392
|
+
else if (memberName === 'ref') {
|
|
763
393
|
// minifier will clean this up
|
|
764
394
|
if (newValue) {
|
|
765
395
|
newValue(elm);
|
|
766
396
|
}
|
|
767
397
|
}
|
|
768
|
-
else if (
|
|
769
|
-
(BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
|
|
398
|
+
else if ((!isProp ) &&
|
|
770
399
|
memberName[0] === 'o' &&
|
|
771
400
|
memberName[1] === 'n') {
|
|
772
401
|
// Event Handlers
|
|
@@ -805,7 +434,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
805
434
|
plt.ael(elm, memberName, newValue, false);
|
|
806
435
|
}
|
|
807
436
|
}
|
|
808
|
-
else
|
|
437
|
+
else {
|
|
809
438
|
// Set property if it exists and it's not a SVG
|
|
810
439
|
const isComplex = isComplexType(newValue);
|
|
811
440
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
@@ -834,7 +463,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
834
463
|
* - if the newValue is null/undefined or 'false'.
|
|
835
464
|
*/
|
|
836
465
|
let xlink = false;
|
|
837
|
-
|
|
466
|
+
{
|
|
838
467
|
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
|
839
468
|
memberName = ln;
|
|
840
469
|
xlink = true;
|
|
@@ -842,7 +471,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
842
471
|
}
|
|
843
472
|
if (newValue == null || newValue === false) {
|
|
844
473
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
845
|
-
if (
|
|
474
|
+
if (xlink) {
|
|
846
475
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
847
476
|
}
|
|
848
477
|
else {
|
|
@@ -852,7 +481,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
852
481
|
}
|
|
853
482
|
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
854
483
|
newValue = newValue === true ? '' : newValue;
|
|
855
|
-
if (
|
|
484
|
+
if (xlink) {
|
|
856
485
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
857
486
|
}
|
|
858
487
|
else {
|
|
@@ -873,7 +502,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
873
502
|
: newVnode.$elm$;
|
|
874
503
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
875
504
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
876
|
-
|
|
505
|
+
{
|
|
877
506
|
// remove attributes no longer present on the vnode by setting them to undefined
|
|
878
507
|
for (memberName in oldVnodeAttrs) {
|
|
879
508
|
if (!(memberName in newVnodeAttrs)) {
|
|
@@ -903,7 +532,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
903
532
|
let elm;
|
|
904
533
|
let childNode;
|
|
905
534
|
let oldVNode;
|
|
906
|
-
if (
|
|
535
|
+
if (!useNativeShadowDom) {
|
|
907
536
|
// remember for later we need to check to relocate nodes
|
|
908
537
|
checkSlotRelocate = true;
|
|
909
538
|
if (newVNode.$tag$ === 'slot') {
|
|
@@ -918,38 +547,25 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
918
547
|
1 /* VNODE_FLAGS.isSlotReference */;
|
|
919
548
|
}
|
|
920
549
|
}
|
|
921
|
-
if (
|
|
922
|
-
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`);
|
|
923
|
-
}
|
|
924
|
-
if (BUILD.vdomText && newVNode.$text$ !== null) {
|
|
550
|
+
if (newVNode.$text$ !== null) {
|
|
925
551
|
// create text node
|
|
926
552
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
927
553
|
}
|
|
928
|
-
else if (
|
|
554
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
929
555
|
// create a slot reference node
|
|
930
556
|
elm = newVNode.$elm$ =
|
|
931
|
-
|
|
557
|
+
doc.createTextNode('');
|
|
932
558
|
}
|
|
933
559
|
else {
|
|
934
|
-
if (BUILD.svg && !isSvgMode) {
|
|
935
|
-
isSvgMode = newVNode.$tag$ === 'svg';
|
|
936
|
-
}
|
|
937
560
|
// create element
|
|
938
|
-
elm = newVNode.$elm$ = (
|
|
939
|
-
? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
940
|
-
? 'slot-fb'
|
|
941
|
-
: newVNode.$tag$)
|
|
942
|
-
: doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
561
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
943
562
|
? 'slot-fb'
|
|
944
563
|
: newVNode.$tag$));
|
|
945
|
-
if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
946
|
-
isSvgMode = false;
|
|
947
|
-
}
|
|
948
564
|
// add css classes, attrs, props, listeners, etc.
|
|
949
|
-
|
|
565
|
+
{
|
|
950
566
|
updateElement(null, newVNode, isSvgMode);
|
|
951
567
|
}
|
|
952
|
-
if (
|
|
568
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
953
569
|
// if there is a scopeId and this is the initial render
|
|
954
570
|
// then let's add the scopeId as a css class
|
|
955
571
|
elm.classList.add((elm['s-si'] = scopeId));
|
|
@@ -965,18 +581,8 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
965
581
|
}
|
|
966
582
|
}
|
|
967
583
|
}
|
|
968
|
-
if (BUILD.svg) {
|
|
969
|
-
if (newVNode.$tag$ === 'svg') {
|
|
970
|
-
// Only reset the SVG context when we're exiting <svg> element
|
|
971
|
-
isSvgMode = false;
|
|
972
|
-
}
|
|
973
|
-
else if (elm.tagName === 'foreignObject') {
|
|
974
|
-
// Reenter SVG context when we're exiting <foreignObject> element
|
|
975
|
-
isSvgMode = true;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
584
|
}
|
|
979
|
-
|
|
585
|
+
{
|
|
980
586
|
elm['s-hn'] = hostTagName;
|
|
981
587
|
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
982
588
|
// remember the content reference comment
|
|
@@ -1021,9 +627,9 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
1021
627
|
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1022
628
|
};
|
|
1023
629
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
1024
|
-
let containerElm = ((
|
|
630
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
1025
631
|
let childNode;
|
|
1026
|
-
if (
|
|
632
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
1027
633
|
containerElm = containerElm.shadowRoot;
|
|
1028
634
|
}
|
|
1029
635
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -1031,7 +637,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
1031
637
|
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
1032
638
|
if (childNode) {
|
|
1033
639
|
vnodes[startIdx].$elm$ = childNode;
|
|
1034
|
-
containerElm.insertBefore(childNode,
|
|
640
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
1035
641
|
}
|
|
1036
642
|
}
|
|
1037
643
|
}
|
|
@@ -1041,7 +647,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
1041
647
|
if ((vnode = vnodes[startIdx])) {
|
|
1042
648
|
elm = vnode.$elm$;
|
|
1043
649
|
callNodeRefs(vnode);
|
|
1044
|
-
|
|
650
|
+
{
|
|
1045
651
|
// we're removing this element
|
|
1046
652
|
// so it's possible we need to show slot fallback content now
|
|
1047
653
|
checkSlotFallbackVisibility = true;
|
|
@@ -1187,7 +793,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1187
793
|
//
|
|
1188
794
|
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
1189
795
|
// and move the DOM element for `oldStartVnode`.
|
|
1190
|
-
if (
|
|
796
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
1191
797
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
1192
798
|
}
|
|
1193
799
|
patch(oldStartVnode, newEndVnode);
|
|
@@ -1228,7 +834,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1228
834
|
// (which will handle updating any changed attributes, reconciling their
|
|
1229
835
|
// children etc) but we also need to move the DOM node to which
|
|
1230
836
|
// `oldEndVnode` corresponds.
|
|
1231
|
-
if (
|
|
837
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
1232
838
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
1233
839
|
}
|
|
1234
840
|
patch(oldEndVnode, newStartVnode);
|
|
@@ -1251,7 +857,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1251
857
|
// children which have the same key as the first node in the new
|
|
1252
858
|
// children.
|
|
1253
859
|
idxInOld = -1;
|
|
1254
|
-
|
|
860
|
+
{
|
|
1255
861
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
1256
862
|
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
1257
863
|
idxInOld = i;
|
|
@@ -1259,7 +865,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1259
865
|
}
|
|
1260
866
|
}
|
|
1261
867
|
}
|
|
1262
|
-
if (
|
|
868
|
+
if (idxInOld >= 0) {
|
|
1263
869
|
// We found a node in the old children which matches up with the first
|
|
1264
870
|
// node in the new children! So let's deal with that
|
|
1265
871
|
elmToMove = oldCh[idxInOld];
|
|
@@ -1286,12 +892,9 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1286
892
|
}
|
|
1287
893
|
if (node) {
|
|
1288
894
|
// if we created a new node then handle inserting it to the DOM
|
|
1289
|
-
|
|
895
|
+
{
|
|
1290
896
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
1291
897
|
}
|
|
1292
|
-
else {
|
|
1293
|
-
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
1294
|
-
}
|
|
1295
898
|
}
|
|
1296
899
|
}
|
|
1297
900
|
}
|
|
@@ -1299,7 +902,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1299
902
|
// we have some more new nodes to add which don't match up with old nodes
|
|
1300
903
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
1301
904
|
}
|
|
1302
|
-
else if (
|
|
905
|
+
else if (newStartIdx > newEndIdx) {
|
|
1303
906
|
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
1304
907
|
// in the new array, so lets remove them (which entails cleaning up the
|
|
1305
908
|
// relevant DOM nodes)
|
|
@@ -1327,14 +930,13 @@ const isSameVnode = (leftVNode, rightVNode) => {
|
|
|
1327
930
|
// compare if two vnode to see if they're "technically" the same
|
|
1328
931
|
// need to have the same element tag, and same key to be the same
|
|
1329
932
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
1330
|
-
if (
|
|
933
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
1331
934
|
return leftVNode.$name$ === rightVNode.$name$;
|
|
1332
935
|
}
|
|
1333
936
|
// this will be set if components in the build have `key` attrs set on them
|
|
1334
|
-
|
|
937
|
+
{
|
|
1335
938
|
return leftVNode.$key$ === rightVNode.$key$;
|
|
1336
939
|
}
|
|
1337
|
-
return true;
|
|
1338
940
|
}
|
|
1339
941
|
return false;
|
|
1340
942
|
};
|
|
@@ -1361,14 +963,9 @@ const patch = (oldVNode, newVNode) => {
|
|
|
1361
963
|
const tag = newVNode.$tag$;
|
|
1362
964
|
const text = newVNode.$text$;
|
|
1363
965
|
let defaultHolder;
|
|
1364
|
-
if (
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
// only add this to the when the compiler sees we're using an svg somewhere
|
|
1368
|
-
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
1369
|
-
}
|
|
1370
|
-
if (BUILD.vdomAttribute || BUILD.reflect) {
|
|
1371
|
-
if (BUILD.slot && tag === 'slot')
|
|
966
|
+
if (text === null) {
|
|
967
|
+
{
|
|
968
|
+
if (tag === 'slot')
|
|
1372
969
|
;
|
|
1373
970
|
else {
|
|
1374
971
|
// either this is the first render of an element OR it's an update
|
|
@@ -1377,33 +974,30 @@ const patch = (oldVNode, newVNode) => {
|
|
|
1377
974
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
1378
975
|
}
|
|
1379
976
|
}
|
|
1380
|
-
if (
|
|
977
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
1381
978
|
// looks like there's child vnodes for both the old and new vnodes
|
|
1382
979
|
// so we need to call `updateChildren` to reconcile them
|
|
1383
980
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
1384
981
|
}
|
|
1385
982
|
else if (newChildren !== null) {
|
|
1386
983
|
// no old child vnodes, but there are new child vnodes to add
|
|
1387
|
-
if (
|
|
984
|
+
if (oldVNode.$text$ !== null) {
|
|
1388
985
|
// the old vnode was text, so be sure to clear it out
|
|
1389
986
|
elm.textContent = '';
|
|
1390
987
|
}
|
|
1391
988
|
// add the new vnode children
|
|
1392
989
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
1393
990
|
}
|
|
1394
|
-
else if (
|
|
991
|
+
else if (oldChildren !== null) {
|
|
1395
992
|
// no new child vnodes, but there are old child vnodes to remove
|
|
1396
993
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
1397
994
|
}
|
|
1398
|
-
if (BUILD.svg && isSvgMode && tag === 'svg') {
|
|
1399
|
-
isSvgMode = false;
|
|
1400
|
-
}
|
|
1401
995
|
}
|
|
1402
|
-
else if (
|
|
996
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1403
997
|
// this element has slotted content
|
|
1404
998
|
defaultHolder.parentNode.textContent = text;
|
|
1405
999
|
}
|
|
1406
|
-
else if (
|
|
1000
|
+
else if (oldVNode.$text$ !== text) {
|
|
1407
1001
|
// update the text content for the text only vnode
|
|
1408
1002
|
// and also only if the text is different than before
|
|
1409
1003
|
elm.data = text;
|
|
@@ -1541,7 +1135,7 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
|
1541
1135
|
return slotNameAttr === '';
|
|
1542
1136
|
};
|
|
1543
1137
|
const callNodeRefs = (vNode) => {
|
|
1544
|
-
|
|
1138
|
+
{
|
|
1545
1139
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
1546
1140
|
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
1547
1141
|
}
|
|
@@ -1552,41 +1146,26 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1552
1146
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1553
1147
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1554
1148
|
hostTagName = hostElm.tagName;
|
|
1555
|
-
|
|
1556
|
-
if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
1557
|
-
throw new Error(`The <Host> must be the single root component.
|
|
1558
|
-
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1559
|
-
|
|
1560
|
-
The render() function should look like this instead:
|
|
1561
|
-
|
|
1562
|
-
render() {
|
|
1563
|
-
// Do not return an array
|
|
1564
|
-
return (
|
|
1565
|
-
<Host>{content}</Host>
|
|
1566
|
-
);
|
|
1567
|
-
}
|
|
1568
|
-
`);
|
|
1569
|
-
}
|
|
1570
|
-
if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
|
|
1149
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
1571
1150
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
1572
1151
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
1573
1152
|
}
|
|
1574
1153
|
rootVnode.$tag$ = null;
|
|
1575
1154
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
1576
1155
|
hostRef.$vnode$ = rootVnode;
|
|
1577
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
1578
|
-
|
|
1156
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
1157
|
+
{
|
|
1579
1158
|
scopeId = hostElm['s-sc'];
|
|
1580
1159
|
}
|
|
1581
|
-
|
|
1160
|
+
{
|
|
1582
1161
|
contentRef = hostElm['s-cr'];
|
|
1583
|
-
useNativeShadowDom =
|
|
1162
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1584
1163
|
// always reset
|
|
1585
1164
|
checkSlotFallbackVisibility = false;
|
|
1586
1165
|
}
|
|
1587
1166
|
// synchronous patch
|
|
1588
1167
|
patch(oldVNode, rootVnode);
|
|
1589
|
-
|
|
1168
|
+
{
|
|
1590
1169
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
1591
1170
|
// the disconnectCallback from working
|
|
1592
1171
|
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
@@ -1606,9 +1185,7 @@ render() {
|
|
|
1606
1185
|
// add a reference node marking this node's original location
|
|
1607
1186
|
// keep a reference to this node for later lookups
|
|
1608
1187
|
orgLocationNode =
|
|
1609
|
-
|
|
1610
|
-
? originalLocationDebugNode(nodeToRelocate)
|
|
1611
|
-
: doc.createTextNode('');
|
|
1188
|
+
doc.createTextNode('');
|
|
1612
1189
|
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1613
1190
|
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1614
1191
|
}
|
|
@@ -1665,23 +1242,16 @@ render() {
|
|
|
1665
1242
|
relocateNodes.length = 0;
|
|
1666
1243
|
}
|
|
1667
1244
|
};
|
|
1668
|
-
// slot comment debug nodes only created with the `--debug` flag
|
|
1669
|
-
// otherwise these nodes are text nodes w/out content
|
|
1670
|
-
const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
|
|
1671
|
-
const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
|
|
1672
|
-
(nodeToRelocate.localName
|
|
1673
|
-
? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
|
|
1674
|
-
: `[${nodeToRelocate.textContent}]`));
|
|
1675
1245
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1676
|
-
if (
|
|
1246
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1677
1247
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
1678
1248
|
}
|
|
1679
1249
|
};
|
|
1680
1250
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1681
|
-
|
|
1251
|
+
{
|
|
1682
1252
|
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1683
1253
|
}
|
|
1684
|
-
if (
|
|
1254
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1685
1255
|
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1686
1256
|
return;
|
|
1687
1257
|
}
|
|
@@ -1690,34 +1260,25 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1690
1260
|
// has already fired off its lifecycle update then
|
|
1691
1261
|
// fire off the initial update
|
|
1692
1262
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1693
|
-
return
|
|
1263
|
+
return writeTask(dispatch) ;
|
|
1694
1264
|
};
|
|
1695
1265
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1696
|
-
const elm = hostRef.$hostElement$;
|
|
1697
1266
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1698
|
-
const instance =
|
|
1267
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1699
1268
|
let promise;
|
|
1700
1269
|
if (isInitialLoad) {
|
|
1701
|
-
|
|
1270
|
+
{
|
|
1702
1271
|
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1703
1272
|
if (hostRef.$queuedListeners$) {
|
|
1704
1273
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1705
1274
|
hostRef.$queuedListeners$ = null;
|
|
1706
1275
|
}
|
|
1707
1276
|
}
|
|
1708
|
-
|
|
1709
|
-
if (BUILD.cmpWillLoad) {
|
|
1277
|
+
{
|
|
1710
1278
|
promise = safeCall(instance, 'componentWillLoad');
|
|
1711
1279
|
}
|
|
1712
1280
|
}
|
|
1713
|
-
|
|
1714
|
-
emitLifecycleEvent(elm, 'componentWillUpdate');
|
|
1715
|
-
if (BUILD.cmpWillUpdate) {
|
|
1716
|
-
promise = safeCall(instance, 'componentWillUpdate');
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
emitLifecycleEvent(elm, 'componentWillRender');
|
|
1720
|
-
if (BUILD.cmpWillRender) {
|
|
1281
|
+
{
|
|
1721
1282
|
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
|
|
1722
1283
|
}
|
|
1723
1284
|
endSchedule();
|
|
@@ -1728,46 +1289,15 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1728
1289
|
const elm = hostRef.$hostElement$;
|
|
1729
1290
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1730
1291
|
const rc = elm['s-rc'];
|
|
1731
|
-
if (
|
|
1292
|
+
if (isInitialLoad) {
|
|
1732
1293
|
// DOM WRITE!
|
|
1733
1294
|
attachStyles(hostRef);
|
|
1734
1295
|
}
|
|
1735
1296
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1736
|
-
|
|
1737
|
-
hostRef
|
|
1297
|
+
{
|
|
1298
|
+
callRender(hostRef, instance);
|
|
1738
1299
|
}
|
|
1739
|
-
if (
|
|
1740
|
-
await callRender(hostRef, instance, elm);
|
|
1741
|
-
}
|
|
1742
|
-
else {
|
|
1743
|
-
callRender(hostRef, instance, elm);
|
|
1744
|
-
}
|
|
1745
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
1746
|
-
plt.$cssShim$.updateHost(elm);
|
|
1747
|
-
}
|
|
1748
|
-
if (BUILD.isDev) {
|
|
1749
|
-
hostRef.$renderCount$++;
|
|
1750
|
-
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
|
1751
|
-
}
|
|
1752
|
-
if (BUILD.hydrateServerSide) {
|
|
1753
|
-
try {
|
|
1754
|
-
// manually connected child components during server-side hydrate
|
|
1755
|
-
serverSideConnected(elm);
|
|
1756
|
-
if (isInitialLoad) {
|
|
1757
|
-
// using only during server-side hydrate
|
|
1758
|
-
if (hostRef.$cmpMeta$.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1759
|
-
elm['s-en'] = '';
|
|
1760
|
-
}
|
|
1761
|
-
else if (hostRef.$cmpMeta$.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
1762
|
-
elm['s-en'] = 'c';
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
catch (e) {
|
|
1767
|
-
consoleError(e, elm);
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
if (BUILD.asyncLoading && rc) {
|
|
1300
|
+
if (rc) {
|
|
1771
1301
|
// ok, so turns out there are some child host elements
|
|
1772
1302
|
// waiting on this parent element to load
|
|
1773
1303
|
// let's fire off all update callbacks waiting
|
|
@@ -1776,7 +1306,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1776
1306
|
}
|
|
1777
1307
|
endRender();
|
|
1778
1308
|
endUpdate();
|
|
1779
|
-
|
|
1309
|
+
{
|
|
1780
1310
|
const childrenPromises = elm['s-p'];
|
|
1781
1311
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1782
1312
|
if (childrenPromises.length === 0) {
|
|
@@ -1788,117 +1318,67 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1788
1318
|
childrenPromises.length = 0;
|
|
1789
1319
|
}
|
|
1790
1320
|
}
|
|
1791
|
-
else {
|
|
1792
|
-
postUpdateComponent(hostRef);
|
|
1793
|
-
}
|
|
1794
1321
|
};
|
|
1795
1322
|
const callRender = (hostRef, instance, elm) => {
|
|
1796
|
-
// in order for bundlers to correctly treeshake the BUILD object
|
|
1797
|
-
// we need to ensure BUILD is not deoptimized within a try/catch
|
|
1798
|
-
// https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
|
|
1799
|
-
const allRenderFn = BUILD.allRenderFn ? true : false;
|
|
1800
|
-
const lazyLoad = BUILD.lazyLoad ? true : false;
|
|
1801
|
-
const taskQueue = BUILD.taskQueue ? true : false;
|
|
1802
|
-
const updatable = BUILD.updatable ? true : false;
|
|
1803
1323
|
try {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
if (updatable && taskQueue) {
|
|
1324
|
+
instance = instance.render() ;
|
|
1325
|
+
{
|
|
1807
1326
|
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1808
1327
|
}
|
|
1809
|
-
|
|
1328
|
+
{
|
|
1810
1329
|
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1811
1330
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1331
|
+
{
|
|
1332
|
+
{
|
|
1814
1333
|
// looks like we've got child nodes to render into this host element
|
|
1815
1334
|
// or we need to update the css class/attrs on the host element
|
|
1816
1335
|
// DOM WRITE!
|
|
1817
|
-
|
|
1818
|
-
return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
|
|
1819
|
-
}
|
|
1820
|
-
else {
|
|
1336
|
+
{
|
|
1821
1337
|
renderVdom(hostRef, instance);
|
|
1822
1338
|
}
|
|
1823
1339
|
}
|
|
1824
|
-
else {
|
|
1825
|
-
elm.textContent = instance;
|
|
1826
|
-
}
|
|
1827
1340
|
}
|
|
1828
1341
|
}
|
|
1829
1342
|
catch (e) {
|
|
1830
1343
|
consoleError(e, hostRef.$hostElement$);
|
|
1831
1344
|
}
|
|
1832
|
-
renderingRef = null;
|
|
1833
1345
|
return null;
|
|
1834
1346
|
};
|
|
1835
|
-
const getRenderingRef = () => renderingRef;
|
|
1836
1347
|
const postUpdateComponent = (hostRef) => {
|
|
1837
1348
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1838
1349
|
const elm = hostRef.$hostElement$;
|
|
1839
1350
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1840
|
-
const instance =
|
|
1351
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1841
1352
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1842
|
-
|
|
1843
|
-
if (BUILD.isDev) {
|
|
1844
|
-
hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
|
|
1845
|
-
}
|
|
1353
|
+
{
|
|
1846
1354
|
safeCall(instance, 'componentDidRender');
|
|
1847
|
-
if (BUILD.isDev) {
|
|
1848
|
-
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
|
1849
|
-
}
|
|
1850
1355
|
}
|
|
1851
|
-
emitLifecycleEvent(elm, 'componentDidRender');
|
|
1852
1356
|
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1853
1357
|
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1854
|
-
|
|
1358
|
+
{
|
|
1855
1359
|
// DOM WRITE!
|
|
1856
1360
|
addHydratedFlag(elm);
|
|
1857
1361
|
}
|
|
1858
|
-
|
|
1859
|
-
if (BUILD.isDev) {
|
|
1860
|
-
hostRef.$flags$ |= 2048 /* HOST_FLAGS.devOnDidLoad */;
|
|
1861
|
-
}
|
|
1362
|
+
{
|
|
1862
1363
|
safeCall(instance, 'componentDidLoad');
|
|
1863
|
-
if (BUILD.isDev) {
|
|
1864
|
-
hostRef.$flags$ &= ~2048 /* HOST_FLAGS.devOnDidLoad */;
|
|
1865
|
-
}
|
|
1866
1364
|
}
|
|
1867
|
-
emitLifecycleEvent(elm, 'componentDidLoad');
|
|
1868
1365
|
endPostUpdate();
|
|
1869
|
-
|
|
1366
|
+
{
|
|
1870
1367
|
hostRef.$onReadyResolve$(elm);
|
|
1871
1368
|
if (!ancestorComponent) {
|
|
1872
|
-
appDidLoad(
|
|
1369
|
+
appDidLoad();
|
|
1873
1370
|
}
|
|
1874
1371
|
}
|
|
1875
1372
|
}
|
|
1876
1373
|
else {
|
|
1877
|
-
if (BUILD.cmpDidUpdate) {
|
|
1878
|
-
// we've already loaded this component
|
|
1879
|
-
// fire off the user's componentDidUpdate method (if one was provided)
|
|
1880
|
-
// componentDidUpdate runs AFTER render() has been called
|
|
1881
|
-
// and all child components have finished updating
|
|
1882
|
-
if (BUILD.isDev) {
|
|
1883
|
-
hostRef.$flags$ |= 1024 /* HOST_FLAGS.devOnRender */;
|
|
1884
|
-
}
|
|
1885
|
-
safeCall(instance, 'componentDidUpdate');
|
|
1886
|
-
if (BUILD.isDev) {
|
|
1887
|
-
hostRef.$flags$ &= ~1024 /* HOST_FLAGS.devOnRender */;
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
emitLifecycleEvent(elm, 'componentDidUpdate');
|
|
1891
1374
|
endPostUpdate();
|
|
1892
1375
|
}
|
|
1893
|
-
|
|
1894
|
-
elm['s-hmr-load'] && elm['s-hmr-load']();
|
|
1895
|
-
}
|
|
1896
|
-
if (BUILD.method && BUILD.lazyLoad) {
|
|
1376
|
+
{
|
|
1897
1377
|
hostRef.$onInstanceResolve$(elm);
|
|
1898
1378
|
}
|
|
1899
1379
|
// load events fire from bottom to top
|
|
1900
1380
|
// the deepest elements load first then bubbles up
|
|
1901
|
-
|
|
1381
|
+
{
|
|
1902
1382
|
if (hostRef.$onRenderResolve$) {
|
|
1903
1383
|
hostRef.$onRenderResolve$();
|
|
1904
1384
|
hostRef.$onRenderResolve$ = undefined;
|
|
@@ -1912,32 +1392,13 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1912
1392
|
// ( •_•)>⌐■-■
|
|
1913
1393
|
// (⌐■_■)
|
|
1914
1394
|
};
|
|
1915
|
-
const forceUpdate = (ref) => {
|
|
1916
|
-
if (BUILD.updatable) {
|
|
1917
|
-
const hostRef = getHostRef(ref);
|
|
1918
|
-
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1919
|
-
if (isConnected &&
|
|
1920
|
-
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1921
|
-
scheduleUpdate(hostRef, false);
|
|
1922
|
-
}
|
|
1923
|
-
// Returns "true" when the forced update was successfully scheduled
|
|
1924
|
-
return isConnected;
|
|
1925
|
-
}
|
|
1926
|
-
return false;
|
|
1927
|
-
};
|
|
1928
1395
|
const appDidLoad = (who) => {
|
|
1929
1396
|
// on appload
|
|
1930
1397
|
// we have finish the first big initial render
|
|
1931
|
-
|
|
1398
|
+
{
|
|
1932
1399
|
addHydratedFlag(doc.documentElement);
|
|
1933
1400
|
}
|
|
1934
|
-
if (BUILD.asyncQueue) {
|
|
1935
|
-
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
|
1936
|
-
}
|
|
1937
1401
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1938
|
-
if (BUILD.profile && performance.measure) {
|
|
1939
|
-
performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
|
|
1940
|
-
}
|
|
1941
1402
|
};
|
|
1942
1403
|
const safeCall = (instance, method, arg) => {
|
|
1943
1404
|
if (instance && instance[method]) {
|
|
@@ -1953,61 +1414,27 @@ const safeCall = (instance, method, arg) => {
|
|
|
1953
1414
|
const then = (promise, thenFn) => {
|
|
1954
1415
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1955
1416
|
};
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1958
|
-
emitEvent(elm, 'stencil_' + lifecycleName, {
|
|
1959
|
-
bubbles: true,
|
|
1960
|
-
composed: true,
|
|
1961
|
-
detail: {
|
|
1962
|
-
namespace: NAMESPACE,
|
|
1963
|
-
},
|
|
1964
|
-
});
|
|
1965
|
-
}
|
|
1966
|
-
};
|
|
1967
|
-
const addHydratedFlag = (elm) => BUILD.hydratedClass
|
|
1968
|
-
? elm.classList.add('hydrated')
|
|
1969
|
-
: BUILD.hydratedAttribute
|
|
1970
|
-
? elm.setAttribute('hydrated', '')
|
|
1971
|
-
: undefined;
|
|
1972
|
-
const serverSideConnected = (elm) => {
|
|
1973
|
-
const children = elm.children;
|
|
1974
|
-
if (children != null) {
|
|
1975
|
-
for (let i = 0, ii = children.length; i < ii; i++) {
|
|
1976
|
-
const childElm = children[i];
|
|
1977
|
-
if (typeof childElm.connectedCallback === 'function') {
|
|
1978
|
-
childElm.connectedCallback();
|
|
1979
|
-
}
|
|
1980
|
-
serverSideConnected(childElm);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
};
|
|
1417
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1418
|
+
;
|
|
1984
1419
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1985
1420
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1986
1421
|
// check our new property value against our internal value
|
|
1987
1422
|
const hostRef = getHostRef(ref);
|
|
1988
|
-
const elm =
|
|
1423
|
+
const elm = hostRef.$hostElement$ ;
|
|
1989
1424
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1990
1425
|
const flags = hostRef.$flags$;
|
|
1991
|
-
const instance =
|
|
1426
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1992
1427
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1993
1428
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1994
1429
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1995
1430
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1996
|
-
if ((!
|
|
1431
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1997
1432
|
// gadzooks! the property's value has changed!!
|
|
1998
1433
|
// set our new value!
|
|
1999
1434
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
2000
|
-
if (
|
|
2001
|
-
if (hostRef.$flags$ & 1024 /* HOST_FLAGS.devOnRender */) {
|
|
2002
|
-
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);
|
|
2003
|
-
}
|
|
2004
|
-
else if (hostRef.$flags$ & 2048 /* HOST_FLAGS.devOnDidLoad */) {
|
|
2005
|
-
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);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
if (!BUILD.lazyLoad || instance) {
|
|
1435
|
+
if (instance) {
|
|
2009
1436
|
// get an array of method names of watch functions to call
|
|
2010
|
-
if (
|
|
1437
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
2011
1438
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
2012
1439
|
if (watchMethods) {
|
|
2013
1440
|
// this instance is watching for when this property changed
|
|
@@ -2022,13 +1449,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2022
1449
|
});
|
|
2023
1450
|
}
|
|
2024
1451
|
}
|
|
2025
|
-
if (
|
|
2026
|
-
(flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
2027
|
-
if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
|
|
2028
|
-
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
1452
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
2032
1453
|
// looks like this value actually changed, so we've got work to do!
|
|
2033
1454
|
// but only if we've already rendered, otherwise just chill out
|
|
2034
1455
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -2049,17 +1470,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
2049
1470
|
* @returns a reference to the same constructor passed in (but now mutated)
|
|
2050
1471
|
*/
|
|
2051
1472
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
2052
|
-
if (
|
|
2053
|
-
if (
|
|
1473
|
+
if (cmpMeta.$members$) {
|
|
1474
|
+
if (Cstr.watchers) {
|
|
2054
1475
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
2055
1476
|
}
|
|
2056
1477
|
// It's better to have a const than two Object.entries()
|
|
2057
1478
|
const members = Object.entries(cmpMeta.$members$);
|
|
2058
1479
|
const prototype = Cstr.prototype;
|
|
2059
1480
|
members.map(([memberName, [memberFlags]]) => {
|
|
2060
|
-
if ((
|
|
2061
|
-
|
|
2062
|
-
((!BUILD.lazyLoad || flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1481
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1482
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
2063
1483
|
// proxyComponent - prop
|
|
2064
1484
|
Object.defineProperty(prototype, memberName, {
|
|
2065
1485
|
get() {
|
|
@@ -2067,21 +1487,6 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2067
1487
|
return getValue(this, memberName);
|
|
2068
1488
|
},
|
|
2069
1489
|
set(newValue) {
|
|
2070
|
-
// only during dev time
|
|
2071
|
-
if (BUILD.isDev) {
|
|
2072
|
-
const ref = getHostRef(this);
|
|
2073
|
-
if (
|
|
2074
|
-
// we are proxying the instance (not element)
|
|
2075
|
-
(flags & 1 /* PROXY_FLAGS.isElementConstructor */) === 0 &&
|
|
2076
|
-
// the element is not constructing
|
|
2077
|
-
(ref.$flags$ & 8 /* HOST_FLAGS.isConstructingInstance */) === 0 &&
|
|
2078
|
-
// the member is a prop
|
|
2079
|
-
(memberFlags & 31 /* MEMBER_FLAGS.Prop */) !== 0 &&
|
|
2080
|
-
// the member is not mutable
|
|
2081
|
-
(memberFlags & 1024 /* MEMBER_FLAGS.Mutable */) === 0) {
|
|
2082
|
-
consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability`);
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
1490
|
// proxyComponent, set value
|
|
2086
1491
|
setValue(this, memberName, newValue, cmpMeta);
|
|
2087
1492
|
},
|
|
@@ -2089,9 +1494,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2089
1494
|
enumerable: true,
|
|
2090
1495
|
});
|
|
2091
1496
|
}
|
|
2092
|
-
else if (
|
|
2093
|
-
BUILD.method &&
|
|
2094
|
-
flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1497
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
2095
1498
|
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
2096
1499
|
// proxyComponent - method
|
|
2097
1500
|
Object.defineProperty(prototype, memberName, {
|
|
@@ -2102,7 +1505,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2102
1505
|
});
|
|
2103
1506
|
}
|
|
2104
1507
|
});
|
|
2105
|
-
if (
|
|
1508
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
2106
1509
|
const attrNameToPropName = new Map();
|
|
2107
1510
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
2108
1511
|
plt.jmp(() => {
|
|
@@ -2162,7 +1565,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2162
1565
|
.map(([propName, m]) => {
|
|
2163
1566
|
const attrName = m[1] || propName;
|
|
2164
1567
|
attrNameToPropName.set(attrName, propName);
|
|
2165
|
-
if (
|
|
1568
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
2166
1569
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
2167
1570
|
}
|
|
2168
1571
|
return attrName;
|
|
@@ -2173,29 +1576,25 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2173
1576
|
};
|
|
2174
1577
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
2175
1578
|
// initializeComponent
|
|
2176
|
-
if ((
|
|
2177
|
-
|
|
2178
|
-
if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
|
|
1579
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1580
|
+
{
|
|
2179
1581
|
// we haven't initialized this element yet
|
|
2180
1582
|
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
2181
1583
|
// lazy loaded components
|
|
2182
1584
|
// request the component's implementation to be
|
|
2183
1585
|
// wired up with the host element
|
|
2184
|
-
Cstr = loadModule(cmpMeta
|
|
1586
|
+
Cstr = loadModule(cmpMeta);
|
|
2185
1587
|
if (Cstr.then) {
|
|
2186
1588
|
// Await creates a micro-task avoid if possible
|
|
2187
|
-
const endLoad = uniqueTime(
|
|
1589
|
+
const endLoad = uniqueTime();
|
|
2188
1590
|
Cstr = await Cstr;
|
|
2189
1591
|
endLoad();
|
|
2190
1592
|
}
|
|
2191
|
-
if (
|
|
2192
|
-
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
2193
|
-
}
|
|
2194
|
-
if (BUILD.member && !Cstr.isProxied) {
|
|
1593
|
+
if (!Cstr.isProxied) {
|
|
2195
1594
|
// we've never proxied this Constructor before
|
|
2196
1595
|
// let's add the getters/setters to its prototype before
|
|
2197
1596
|
// the first time we create an instance of the implementation
|
|
2198
|
-
|
|
1597
|
+
{
|
|
2199
1598
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
2200
1599
|
}
|
|
2201
1600
|
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
@@ -2205,7 +1604,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2205
1604
|
// ok, time to construct the instance
|
|
2206
1605
|
// but let's keep track of when we start and stop
|
|
2207
1606
|
// so that the getters/setters don't incorrectly step on data
|
|
2208
|
-
|
|
1607
|
+
{
|
|
2209
1608
|
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
2210
1609
|
}
|
|
2211
1610
|
// construct the lazy-loaded component implementation
|
|
@@ -2218,42 +1617,21 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2218
1617
|
catch (e) {
|
|
2219
1618
|
consoleError(e);
|
|
2220
1619
|
}
|
|
2221
|
-
|
|
1620
|
+
{
|
|
2222
1621
|
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
2223
1622
|
}
|
|
2224
|
-
|
|
1623
|
+
{
|
|
2225
1624
|
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
2226
1625
|
}
|
|
2227
1626
|
endNewInstance();
|
|
2228
1627
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
2229
1628
|
}
|
|
2230
|
-
|
|
2231
|
-
// sync constructor component
|
|
2232
|
-
Cstr = elm.constructor;
|
|
2233
|
-
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
2234
|
-
// wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
|
|
2235
|
-
// watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
|
|
2236
|
-
// Stencil has completed instantiating the component.
|
|
2237
|
-
customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
|
|
2238
|
-
}
|
|
2239
|
-
if (BUILD.style && Cstr.style) {
|
|
1629
|
+
if (Cstr.style) {
|
|
2240
1630
|
// this component has styles but we haven't registered them yet
|
|
2241
1631
|
let style = Cstr.style;
|
|
2242
|
-
|
|
2243
|
-
style = style[(hostRef.$modeName$ = computeMode(elm))];
|
|
2244
|
-
if (BUILD.hydrateServerSide && hostRef.$modeName$) {
|
|
2245
|
-
elm.setAttribute('s-mode', hostRef.$modeName$);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
1632
|
+
const scopeId = getScopeId(cmpMeta);
|
|
2249
1633
|
if (!styles.has(scopeId)) {
|
|
2250
1634
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
2251
|
-
if (!BUILD.hydrateServerSide &&
|
|
2252
|
-
BUILD.shadowDom &&
|
|
2253
|
-
BUILD.shadowDomShim &&
|
|
2254
|
-
cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
2255
|
-
style = await Promise.resolve().then(function () { return require('./shadow-css-346c0795.js'); }).then((m) => m.scopeCss(style, scopeId, false));
|
|
2256
|
-
}
|
|
2257
1635
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
2258
1636
|
endRegisterStyles();
|
|
2259
1637
|
}
|
|
@@ -2262,7 +1640,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2262
1640
|
// we've successfully created a lazy instance
|
|
2263
1641
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2264
1642
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
2265
|
-
if (
|
|
1643
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
2266
1644
|
// this is the initial load and this component it has an ancestor component
|
|
2267
1645
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
2268
1646
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -2276,7 +1654,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2276
1654
|
}
|
|
2277
1655
|
};
|
|
2278
1656
|
const fireConnectedCallback = (instance) => {
|
|
2279
|
-
|
|
1657
|
+
{
|
|
2280
1658
|
safeCall(instance, 'connectedCallback');
|
|
2281
1659
|
}
|
|
2282
1660
|
};
|
|
@@ -2285,49 +1663,26 @@ const connectedCallback = (elm) => {
|
|
|
2285
1663
|
const hostRef = getHostRef(elm);
|
|
2286
1664
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
2287
1665
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
2288
|
-
if (BUILD.hostListenerTargetParent) {
|
|
2289
|
-
// only run if we have listeners being attached to a parent
|
|
2290
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
2291
|
-
}
|
|
2292
1666
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
2293
1667
|
// first time this component has connected
|
|
2294
1668
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
2295
|
-
|
|
2296
|
-
if (BUILD.hydrateClientSide) {
|
|
2297
|
-
hostId = elm.getAttribute(HYDRATE_ID);
|
|
2298
|
-
if (hostId) {
|
|
2299
|
-
if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2300
|
-
const scopeId = BUILD.mode
|
|
2301
|
-
? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
|
|
2302
|
-
: addStyle(elm.shadowRoot, cmpMeta);
|
|
2303
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
2304
|
-
}
|
|
2305
|
-
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
if (BUILD.slotRelocation && !hostId) {
|
|
1669
|
+
{
|
|
2309
1670
|
// initUpdate
|
|
2310
1671
|
// if the slot polyfill is required we'll need to put some nodes
|
|
2311
1672
|
// in here to act as original content anchors as we move nodes around
|
|
2312
1673
|
// host element has been connected to the DOM
|
|
2313
|
-
if (
|
|
2314
|
-
((BUILD.slot || BUILD.shadowDom) &&
|
|
2315
|
-
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1674
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
2316
1675
|
setContentReference(elm);
|
|
2317
1676
|
}
|
|
2318
1677
|
}
|
|
2319
|
-
|
|
1678
|
+
{
|
|
2320
1679
|
// find the first ancestor component (if there is one) and register
|
|
2321
1680
|
// this component as one of the actively loading child components for its ancestor
|
|
2322
1681
|
let ancestorComponent = elm;
|
|
2323
1682
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
2324
1683
|
// climb up the ancestors looking for the first
|
|
2325
1684
|
// component that hasn't finished its lifecycle update yet
|
|
2326
|
-
if (
|
|
2327
|
-
ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
|
|
2328
|
-
ancestorComponent.hasAttribute('s-id') &&
|
|
2329
|
-
ancestorComponent['s-p']) ||
|
|
2330
|
-
ancestorComponent['s-p']) {
|
|
1685
|
+
if (ancestorComponent['s-p']) {
|
|
2331
1686
|
// we found this components first ancestor component
|
|
2332
1687
|
// keep a reference to this component's ancestor component
|
|
2333
1688
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -2337,7 +1692,7 @@ const connectedCallback = (elm) => {
|
|
|
2337
1692
|
}
|
|
2338
1693
|
// Lazy properties
|
|
2339
1694
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
2340
|
-
if (
|
|
1695
|
+
if (cmpMeta.$members$) {
|
|
2341
1696
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
2342
1697
|
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
2343
1698
|
const value = elm[memberName];
|
|
@@ -2346,14 +1701,7 @@ const connectedCallback = (elm) => {
|
|
|
2346
1701
|
}
|
|
2347
1702
|
});
|
|
2348
1703
|
}
|
|
2349
|
-
|
|
2350
|
-
// connectedCallback, taskQueue, initialLoad
|
|
2351
|
-
// angular sets attribute AFTER connectCallback
|
|
2352
|
-
// https://github.com/angular/angular/issues/18909
|
|
2353
|
-
// https://github.com/angular/angular/issues/19940
|
|
2354
|
-
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
2355
|
-
}
|
|
2356
|
-
else {
|
|
1704
|
+
{
|
|
2357
1705
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
2358
1706
|
}
|
|
2359
1707
|
}
|
|
@@ -2361,7 +1709,7 @@ const connectedCallback = (elm) => {
|
|
|
2361
1709
|
// not the first time this has connected
|
|
2362
1710
|
// reattach any event listeners to the host
|
|
2363
1711
|
// since they would have been removed when disconnected
|
|
2364
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
1712
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2365
1713
|
// fire off connectedCallback() on component instance
|
|
2366
1714
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
2367
1715
|
}
|
|
@@ -2375,316 +1723,27 @@ const setContentReference = (elm) => {
|
|
|
2375
1723
|
// let's pick out the inner content for slot projection
|
|
2376
1724
|
// create a node to represent where the original
|
|
2377
1725
|
// content was first placed, which is useful later on
|
|
2378
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment(
|
|
1726
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
2379
1727
|
contentRefElm['s-cn'] = true;
|
|
2380
1728
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
2381
1729
|
};
|
|
2382
1730
|
const disconnectedCallback = (elm) => {
|
|
2383
1731
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
2384
1732
|
const hostRef = getHostRef(elm);
|
|
2385
|
-
const instance =
|
|
2386
|
-
|
|
1733
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1734
|
+
{
|
|
2387
1735
|
if (hostRef.$rmListeners$) {
|
|
2388
1736
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
2389
1737
|
hostRef.$rmListeners$ = undefined;
|
|
2390
1738
|
}
|
|
2391
1739
|
}
|
|
2392
|
-
|
|
2393
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
2394
|
-
plt.$cssShim$.removeHost(elm);
|
|
2395
|
-
}
|
|
2396
|
-
if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
|
|
1740
|
+
{
|
|
2397
1741
|
safeCall(instance, 'disconnectedCallback');
|
|
2398
1742
|
}
|
|
2399
|
-
if (BUILD.cmpDidUnload) {
|
|
2400
|
-
safeCall(instance, 'componentDidUnload');
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
};
|
|
2404
|
-
const defineCustomElement = (Cstr, compactMeta) => {
|
|
2405
|
-
customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
|
|
2406
|
-
};
|
|
2407
|
-
const proxyCustomElement = (Cstr, compactMeta) => {
|
|
2408
|
-
const cmpMeta = {
|
|
2409
|
-
$flags$: compactMeta[0],
|
|
2410
|
-
$tagName$: compactMeta[1],
|
|
2411
|
-
};
|
|
2412
|
-
if (BUILD.member) {
|
|
2413
|
-
cmpMeta.$members$ = compactMeta[2];
|
|
2414
|
-
}
|
|
2415
|
-
if (BUILD.hostListener) {
|
|
2416
|
-
cmpMeta.$listeners$ = compactMeta[3];
|
|
2417
|
-
}
|
|
2418
|
-
if (BUILD.watchCallback) {
|
|
2419
|
-
cmpMeta.$watchers$ = Cstr.$watchers$;
|
|
2420
|
-
}
|
|
2421
|
-
if (BUILD.reflect) {
|
|
2422
|
-
cmpMeta.$attrsToReflect$ = [];
|
|
2423
|
-
}
|
|
2424
|
-
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2425
|
-
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
2426
|
-
}
|
|
2427
|
-
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
2428
|
-
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
2429
|
-
Object.assign(Cstr.prototype, {
|
|
2430
|
-
__registerHost() {
|
|
2431
|
-
registerHost(this, cmpMeta);
|
|
2432
|
-
},
|
|
2433
|
-
connectedCallback() {
|
|
2434
|
-
connectedCallback(this);
|
|
2435
|
-
if (BUILD.connectedCallback && originalConnectedCallback) {
|
|
2436
|
-
originalConnectedCallback.call(this);
|
|
2437
|
-
}
|
|
2438
|
-
},
|
|
2439
|
-
disconnectedCallback() {
|
|
2440
|
-
disconnectedCallback(this);
|
|
2441
|
-
if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
|
|
2442
|
-
originalDisconnectedCallback.call(this);
|
|
2443
|
-
}
|
|
2444
|
-
},
|
|
2445
|
-
__attachShadow() {
|
|
2446
|
-
if (supportsShadow) {
|
|
2447
|
-
if (BUILD.shadowDelegatesFocus) {
|
|
2448
|
-
this.attachShadow({
|
|
2449
|
-
mode: 'open',
|
|
2450
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
|
2451
|
-
});
|
|
2452
|
-
}
|
|
2453
|
-
else {
|
|
2454
|
-
this.attachShadow({ mode: 'open' });
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
else {
|
|
2458
|
-
this.shadowRoot = this;
|
|
2459
|
-
}
|
|
2460
|
-
},
|
|
2461
|
-
});
|
|
2462
|
-
Cstr.is = cmpMeta.$tagName$;
|
|
2463
|
-
return proxyComponent(Cstr, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */ | 2 /* PROXY_FLAGS.proxyState */);
|
|
2464
|
-
};
|
|
2465
|
-
const forceModeUpdate = (elm) => {
|
|
2466
|
-
if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
|
|
2467
|
-
const mode = computeMode(elm);
|
|
2468
|
-
const hostRef = getHostRef(elm);
|
|
2469
|
-
if (hostRef.$modeName$ !== mode) {
|
|
2470
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
2471
|
-
const oldScopeId = elm['s-sc'];
|
|
2472
|
-
const scopeId = getScopeId(cmpMeta, mode);
|
|
2473
|
-
const style = elm.constructor.style[mode];
|
|
2474
|
-
const flags = cmpMeta.$flags$;
|
|
2475
|
-
if (style) {
|
|
2476
|
-
if (!styles.has(scopeId)) {
|
|
2477
|
-
registerStyle(scopeId, style, !!(flags & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
2478
|
-
}
|
|
2479
|
-
hostRef.$modeName$ = mode;
|
|
2480
|
-
elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
|
|
2481
|
-
attachStyles(hostRef);
|
|
2482
|
-
forceUpdate(elm);
|
|
2483
|
-
}
|
|
2484
|
-
}
|
|
2485
1743
|
}
|
|
2486
1744
|
};
|
|
2487
|
-
const patchCloneNode = (HostElementPrototype) => {
|
|
2488
|
-
const orgCloneNode = HostElementPrototype.cloneNode;
|
|
2489
|
-
HostElementPrototype.cloneNode = function (deep) {
|
|
2490
|
-
const srcNode = this;
|
|
2491
|
-
const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
|
2492
|
-
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
|
2493
|
-
if (BUILD.slot && !isShadowDom && deep) {
|
|
2494
|
-
let i = 0;
|
|
2495
|
-
let slotted, nonStencilNode;
|
|
2496
|
-
const stencilPrivates = [
|
|
2497
|
-
's-id',
|
|
2498
|
-
's-cr',
|
|
2499
|
-
's-lr',
|
|
2500
|
-
's-rc',
|
|
2501
|
-
's-sc',
|
|
2502
|
-
's-p',
|
|
2503
|
-
's-cn',
|
|
2504
|
-
's-sr',
|
|
2505
|
-
's-sn',
|
|
2506
|
-
's-hn',
|
|
2507
|
-
's-ol',
|
|
2508
|
-
's-nr',
|
|
2509
|
-
's-si',
|
|
2510
|
-
];
|
|
2511
|
-
for (; i < srcNode.childNodes.length; i++) {
|
|
2512
|
-
slotted = srcNode.childNodes[i]['s-nr'];
|
|
2513
|
-
nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
|
|
2514
|
-
if (slotted) {
|
|
2515
|
-
if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
|
|
2516
|
-
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
2517
|
-
}
|
|
2518
|
-
else {
|
|
2519
|
-
clonedNode.appendChild(slotted.cloneNode(true));
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
if (nonStencilNode) {
|
|
2523
|
-
clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
return clonedNode;
|
|
2528
|
-
};
|
|
2529
|
-
};
|
|
2530
|
-
const patchSlotAppendChild = (HostElementPrototype) => {
|
|
2531
|
-
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
2532
|
-
HostElementPrototype.appendChild = function (newChild) {
|
|
2533
|
-
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
|
2534
|
-
const slotNode = getHostSlotNode(this.childNodes, slotName);
|
|
2535
|
-
if (slotNode) {
|
|
2536
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
2537
|
-
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
2538
|
-
return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
|
|
2539
|
-
}
|
|
2540
|
-
return this.__appendChild(newChild);
|
|
2541
|
-
};
|
|
2542
|
-
};
|
|
2543
|
-
/**
|
|
2544
|
-
* Patches the text content of an unnamed slotted node inside a scoped component
|
|
2545
|
-
* @param hostElementPrototype the `Element` to be patched
|
|
2546
|
-
* @param cmpMeta component runtime metadata used to determine if the component should be patched or not
|
|
2547
|
-
*/
|
|
2548
|
-
const patchTextContent = (hostElementPrototype, cmpMeta) => {
|
|
2549
|
-
if (BUILD.scoped && cmpMeta.$flags$ & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
|
|
2550
|
-
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
|
|
2551
|
-
Object.defineProperty(hostElementPrototype, '__textContent', descriptor);
|
|
2552
|
-
Object.defineProperty(hostElementPrototype, 'textContent', {
|
|
2553
|
-
get() {
|
|
2554
|
-
var _a;
|
|
2555
|
-
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
|
2556
|
-
// the empty string
|
|
2557
|
-
const slotNode = getHostSlotNode(this.childNodes, '');
|
|
2558
|
-
// when a slot node is found, the textContent _may_ be found in the next sibling (text) node, depending on how
|
|
2559
|
-
// nodes were reordered during the vdom render. first try to get the text content from the sibling.
|
|
2560
|
-
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2561
|
-
return slotNode.nextSibling.textContent;
|
|
2562
|
-
}
|
|
2563
|
-
else if (slotNode) {
|
|
2564
|
-
return slotNode.textContent;
|
|
2565
|
-
}
|
|
2566
|
-
else {
|
|
2567
|
-
// fallback to the original implementation
|
|
2568
|
-
return this.__textContent;
|
|
2569
|
-
}
|
|
2570
|
-
},
|
|
2571
|
-
set(value) {
|
|
2572
|
-
var _a;
|
|
2573
|
-
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
|
2574
|
-
// the empty string
|
|
2575
|
-
const slotNode = getHostSlotNode(this.childNodes, '');
|
|
2576
|
-
// when a slot node is found, the textContent _may_ need to be placed in the next sibling (text) node,
|
|
2577
|
-
// depending on how nodes were reordered during the vdom render. first try to set the text content on the
|
|
2578
|
-
// sibling.
|
|
2579
|
-
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* NODE_TYPES.TEXT_NODE */) {
|
|
2580
|
-
slotNode.nextSibling.textContent = value;
|
|
2581
|
-
}
|
|
2582
|
-
else if (slotNode) {
|
|
2583
|
-
slotNode.textContent = value;
|
|
2584
|
-
}
|
|
2585
|
-
else {
|
|
2586
|
-
// we couldn't find a slot, but that doesn't mean that there isn't one. if this check ran before the DOM
|
|
2587
|
-
// loaded, we could have missed it. check for a content reference element on the scoped component and insert
|
|
2588
|
-
// it there
|
|
2589
|
-
this.__textContent = value;
|
|
2590
|
-
const contentRefElm = this['s-cr'];
|
|
2591
|
-
if (contentRefElm) {
|
|
2592
|
-
this.insertBefore(contentRefElm, this.firstChild);
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
},
|
|
2596
|
-
});
|
|
2597
|
-
}
|
|
2598
|
-
};
|
|
2599
|
-
const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
2600
|
-
class FakeNodeList extends Array {
|
|
2601
|
-
item(n) {
|
|
2602
|
-
return this[n];
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
2606
|
-
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
2607
|
-
Object.defineProperty(elm, 'children', {
|
|
2608
|
-
get() {
|
|
2609
|
-
return this.childNodes.map((n) => n.nodeType === 1);
|
|
2610
|
-
},
|
|
2611
|
-
});
|
|
2612
|
-
Object.defineProperty(elm, 'childElementCount', {
|
|
2613
|
-
get() {
|
|
2614
|
-
return elm.children.length;
|
|
2615
|
-
},
|
|
2616
|
-
});
|
|
2617
|
-
Object.defineProperty(elm, 'childNodes', {
|
|
2618
|
-
get() {
|
|
2619
|
-
const childNodes = childNodesFn.call(this);
|
|
2620
|
-
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
|
|
2621
|
-
getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
|
|
2622
|
-
const result = new FakeNodeList();
|
|
2623
|
-
for (let i = 0; i < childNodes.length; i++) {
|
|
2624
|
-
const slot = childNodes[i]['s-nr'];
|
|
2625
|
-
if (slot) {
|
|
2626
|
-
result.push(slot);
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
return result;
|
|
2630
|
-
}
|
|
2631
|
-
return FakeNodeList.from(childNodes);
|
|
2632
|
-
},
|
|
2633
|
-
});
|
|
2634
|
-
}
|
|
2635
|
-
};
|
|
2636
|
-
const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
|
|
2637
|
-
/**
|
|
2638
|
-
* Recursively searches a series of child nodes for a slot with the provided name.
|
|
2639
|
-
* @param childNodes the nodes to search for a slot with a specific name.
|
|
2640
|
-
* @param slotName the name of the slot to match on.
|
|
2641
|
-
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
|
2642
|
-
*/
|
|
2643
|
-
const getHostSlotNode = (childNodes, slotName) => {
|
|
2644
|
-
let i = 0;
|
|
2645
|
-
let childNode;
|
|
2646
|
-
for (; i < childNodes.length; i++) {
|
|
2647
|
-
childNode = childNodes[i];
|
|
2648
|
-
if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
|
|
2649
|
-
return childNode;
|
|
2650
|
-
}
|
|
2651
|
-
childNode = getHostSlotNode(childNode.childNodes, slotName);
|
|
2652
|
-
if (childNode) {
|
|
2653
|
-
return childNode;
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
return null;
|
|
2657
|
-
};
|
|
2658
|
-
const getHostSlotChildNodes = (n, slotName) => {
|
|
2659
|
-
const childNodes = [n];
|
|
2660
|
-
while ((n = n.nextSibling) && n['s-sn'] === slotName) {
|
|
2661
|
-
childNodes.push(n);
|
|
2662
|
-
}
|
|
2663
|
-
return childNodes;
|
|
2664
|
-
};
|
|
2665
|
-
const hmrStart = (elm, cmpMeta, hmrVersionId) => {
|
|
2666
|
-
// ¯\_(ツ)_/¯
|
|
2667
|
-
const hostRef = getHostRef(elm);
|
|
2668
|
-
// reset state flags to only have been connected
|
|
2669
|
-
hostRef.$flags$ = 1 /* HOST_FLAGS.hasConnected */;
|
|
2670
|
-
// TODO
|
|
2671
|
-
// detatch any event listeners that may have been added
|
|
2672
|
-
// because we're not passing an exact event name it'll
|
|
2673
|
-
// remove all of this element's event, which is good
|
|
2674
|
-
// create a callback for when this component finishes hmr
|
|
2675
|
-
elm['s-hmr-load'] = () => {
|
|
2676
|
-
// finished hmr for this element
|
|
2677
|
-
delete elm['s-hmr-load'];
|
|
2678
|
-
};
|
|
2679
|
-
// re-initialize the component
|
|
2680
|
-
initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
|
|
2681
|
-
};
|
|
2682
1745
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
2683
|
-
|
|
2684
|
-
performance.mark('st:app:start');
|
|
2685
|
-
}
|
|
2686
|
-
installDevTools();
|
|
2687
|
-
const endBootstrap = createTime('bootstrapLazy');
|
|
1746
|
+
const endBootstrap = createTime();
|
|
2688
1747
|
const cmpTags = [];
|
|
2689
1748
|
const exclude = options.exclude || [];
|
|
2690
1749
|
const customElements = win.customElements;
|
|
@@ -2692,27 +1751,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2692
1751
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
2693
1752
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
2694
1753
|
const deferredConnectedCallbacks = [];
|
|
2695
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2696
1754
|
let appLoadFallback;
|
|
2697
1755
|
let isBootstrapping = true;
|
|
2698
|
-
let i = 0;
|
|
2699
1756
|
Object.assign(plt, options);
|
|
2700
1757
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
2701
|
-
if (BUILD.asyncQueue) {
|
|
2702
|
-
if (options.syncQueue) {
|
|
2703
|
-
plt.$flags$ |= 4 /* PLATFORM_FLAGS.queueSync */;
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
if (BUILD.hydrateClientSide) {
|
|
2707
|
-
// If the app is already hydrated there is not point to disable the
|
|
2708
|
-
// async queue. This will improve the first input delay
|
|
2709
|
-
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
|
2710
|
-
}
|
|
2711
|
-
if (BUILD.hydrateClientSide && BUILD.shadowDom) {
|
|
2712
|
-
for (; i < styles.length; i++) {
|
|
2713
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
2714
|
-
}
|
|
2715
|
-
}
|
|
2716
1758
|
lazyBundles.map((lazyBundle) => {
|
|
2717
1759
|
lazyBundle[1].map((compactMeta) => {
|
|
2718
1760
|
const cmpMeta = {
|
|
@@ -2721,24 +1763,19 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2721
1763
|
$members$: compactMeta[2],
|
|
2722
1764
|
$listeners$: compactMeta[3],
|
|
2723
1765
|
};
|
|
2724
|
-
|
|
1766
|
+
{
|
|
2725
1767
|
cmpMeta.$members$ = compactMeta[2];
|
|
2726
1768
|
}
|
|
2727
|
-
|
|
1769
|
+
{
|
|
2728
1770
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
2729
1771
|
}
|
|
2730
|
-
|
|
1772
|
+
{
|
|
2731
1773
|
cmpMeta.$attrsToReflect$ = [];
|
|
2732
1774
|
}
|
|
2733
|
-
|
|
1775
|
+
{
|
|
2734
1776
|
cmpMeta.$watchers$ = {};
|
|
2735
1777
|
}
|
|
2736
|
-
|
|
2737
|
-
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
2738
|
-
}
|
|
2739
|
-
const tagName = BUILD.transformTagName && options.transformTagName
|
|
2740
|
-
? options.transformTagName(cmpMeta.$tagName$)
|
|
2741
|
-
: cmpMeta.$tagName$;
|
|
1778
|
+
const tagName = cmpMeta.$tagName$;
|
|
2742
1779
|
const HostElement = class extends HTMLElement {
|
|
2743
1780
|
// StencilLazyHost
|
|
2744
1781
|
constructor(self) {
|
|
@@ -2746,28 +1783,16 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2746
1783
|
super(self);
|
|
2747
1784
|
self = this;
|
|
2748
1785
|
registerHost(self, cmpMeta);
|
|
2749
|
-
if (
|
|
1786
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2750
1787
|
// this component is using shadow dom
|
|
2751
1788
|
// and this browser supports shadow dom
|
|
2752
1789
|
// add the read-only property "shadowRoot" to the host element
|
|
2753
1790
|
// adding the shadow root build conditionals to minimize runtime
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
self.attachShadow({
|
|
2757
|
-
mode: 'open',
|
|
2758
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
|
|
2759
|
-
});
|
|
2760
|
-
}
|
|
2761
|
-
else {
|
|
1791
|
+
{
|
|
1792
|
+
{
|
|
2762
1793
|
self.attachShadow({ mode: 'open' });
|
|
2763
1794
|
}
|
|
2764
1795
|
}
|
|
2765
|
-
else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
|
|
2766
|
-
self.shadowRoot = self;
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
if (BUILD.slotChildNodesFix) {
|
|
2770
|
-
patchChildSlotNodes(self, cmpMeta);
|
|
2771
1796
|
}
|
|
2772
1797
|
}
|
|
2773
1798
|
connectedCallback() {
|
|
@@ -2790,20 +1815,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2790
1815
|
return getHostRef(this).$onReadyPromise$;
|
|
2791
1816
|
}
|
|
2792
1817
|
};
|
|
2793
|
-
if (BUILD.cloneNodeFix) {
|
|
2794
|
-
patchCloneNode(HostElement.prototype);
|
|
2795
|
-
}
|
|
2796
|
-
if (BUILD.appendChildSlotFix) {
|
|
2797
|
-
patchSlotAppendChild(HostElement.prototype);
|
|
2798
|
-
}
|
|
2799
|
-
if (BUILD.hotModuleReplacement) {
|
|
2800
|
-
HostElement.prototype['s-hmr'] = function (hmrVersionId) {
|
|
2801
|
-
hmrStart(this, cmpMeta, hmrVersionId);
|
|
2802
|
-
};
|
|
2803
|
-
}
|
|
2804
|
-
if (BUILD.scopedSlotTextContentFix) {
|
|
2805
|
-
patchTextContent(HostElement.prototype, cmpMeta);
|
|
2806
|
-
}
|
|
2807
1818
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
2808
1819
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
2809
1820
|
cmpTags.push(tagName);
|
|
@@ -2811,7 +1822,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2811
1822
|
}
|
|
2812
1823
|
});
|
|
2813
1824
|
});
|
|
2814
|
-
|
|
1825
|
+
{
|
|
2815
1826
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
2816
1827
|
visibilityStyle.setAttribute('data-styles', '');
|
|
2817
1828
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
@@ -2822,89 +1833,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2822
1833
|
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
2823
1834
|
}
|
|
2824
1835
|
else {
|
|
2825
|
-
|
|
2826
|
-
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
|
|
2827
|
-
}
|
|
2828
|
-
else {
|
|
1836
|
+
{
|
|
2829
1837
|
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
|
|
2830
1838
|
}
|
|
2831
1839
|
}
|
|
2832
1840
|
// Fallback appLoad event
|
|
2833
1841
|
endBootstrap();
|
|
2834
1842
|
};
|
|
2835
|
-
const getConnect = (_ref, tagName) => {
|
|
2836
|
-
const componentOnReady = () => {
|
|
2837
|
-
let elm = doc.querySelector(tagName);
|
|
2838
|
-
if (!elm) {
|
|
2839
|
-
elm = doc.createElement(tagName);
|
|
2840
|
-
doc.body.appendChild(elm);
|
|
2841
|
-
}
|
|
2842
|
-
return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
|
|
2843
|
-
};
|
|
2844
|
-
const create = (...args) => {
|
|
2845
|
-
return componentOnReady().then((el) => el.create(...args));
|
|
2846
|
-
};
|
|
2847
|
-
return {
|
|
2848
|
-
create,
|
|
2849
|
-
componentOnReady,
|
|
2850
|
-
};
|
|
2851
|
-
};
|
|
2852
|
-
const getContext = (_elm, context) => {
|
|
2853
|
-
if (context in Context) {
|
|
2854
|
-
return Context[context];
|
|
2855
|
-
}
|
|
2856
|
-
else if (context === 'window') {
|
|
2857
|
-
return win;
|
|
2858
|
-
}
|
|
2859
|
-
else if (context === 'document') {
|
|
2860
|
-
return doc;
|
|
2861
|
-
}
|
|
2862
|
-
else if (context === 'isServer' || context === 'isPrerender') {
|
|
2863
|
-
return BUILD.hydrateServerSide ? true : false;
|
|
2864
|
-
}
|
|
2865
|
-
else if (context === 'isClient') {
|
|
2866
|
-
return BUILD.hydrateServerSide ? false : true;
|
|
2867
|
-
}
|
|
2868
|
-
else if (context === 'resourcesUrl' || context === 'publicPath') {
|
|
2869
|
-
return getAssetPath('.');
|
|
2870
|
-
}
|
|
2871
|
-
else if (context === 'queue') {
|
|
2872
|
-
return {
|
|
2873
|
-
write: writeTask,
|
|
2874
|
-
read: readTask,
|
|
2875
|
-
tick: {
|
|
2876
|
-
then(cb) {
|
|
2877
|
-
return nextTick(cb);
|
|
2878
|
-
},
|
|
2879
|
-
},
|
|
2880
|
-
};
|
|
2881
|
-
}
|
|
2882
|
-
return undefined;
|
|
2883
|
-
};
|
|
2884
1843
|
const Fragment = (_, children) => children;
|
|
2885
1844
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
2886
|
-
if (
|
|
2887
|
-
// this is called immediately within the element's constructor
|
|
2888
|
-
// initialize our event listeners on the host element
|
|
2889
|
-
// we do this now so that we can listen to events that may
|
|
2890
|
-
// have fired even before the instance is ready
|
|
2891
|
-
if (BUILD.hostListenerTargetParent) {
|
|
2892
|
-
// this component may have event listeners that should be attached to the parent
|
|
2893
|
-
if (attachParentListeners) {
|
|
2894
|
-
// this is being ran from within the connectedCallback
|
|
2895
|
-
// which is important so that we know the host element actually has a parent element
|
|
2896
|
-
// filter out the listeners to only have the ones that ARE being attached to the parent
|
|
2897
|
-
listeners = listeners.filter(([flags]) => flags & 32 /* LISTENER_FLAGS.TargetParent */);
|
|
2898
|
-
}
|
|
2899
|
-
else {
|
|
2900
|
-
// this is being ran from within the component constructor
|
|
2901
|
-
// everything BUT the parent element listeners should be attached at this time
|
|
2902
|
-
// filter out the listeners that are NOT being attached to the parent
|
|
2903
|
-
listeners = listeners.filter(([flags]) => !(flags & 32 /* LISTENER_FLAGS.TargetParent */));
|
|
2904
|
-
}
|
|
2905
|
-
}
|
|
1845
|
+
if (listeners) {
|
|
2906
1846
|
listeners.map(([flags, name, method]) => {
|
|
2907
|
-
const target =
|
|
1847
|
+
const target = elm;
|
|
2908
1848
|
const handler = hostListenerProxy(hostRef, method);
|
|
2909
1849
|
const opts = hostListenerOpts(flags);
|
|
2910
1850
|
plt.ael(target, name, handler, opts);
|
|
@@ -2914,7 +1854,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
2914
1854
|
};
|
|
2915
1855
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
2916
1856
|
try {
|
|
2917
|
-
|
|
1857
|
+
{
|
|
2918
1858
|
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
2919
1859
|
// instance is ready, let's call it's member method for this event
|
|
2920
1860
|
hostRef.$lazyInstance$[methodName](ev);
|
|
@@ -2923,172 +1863,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
2923
1863
|
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
2924
1864
|
}
|
|
2925
1865
|
}
|
|
2926
|
-
else {
|
|
2927
|
-
hostRef.$hostElement$[methodName](ev);
|
|
2928
|
-
}
|
|
2929
1866
|
}
|
|
2930
1867
|
catch (e) {
|
|
2931
1868
|
consoleError(e);
|
|
2932
1869
|
}
|
|
2933
1870
|
};
|
|
2934
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
2935
|
-
if (BUILD.hostListenerTargetDocument && flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
2936
|
-
return doc;
|
|
2937
|
-
if (BUILD.hostListenerTargetWindow && flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
2938
|
-
return win;
|
|
2939
|
-
if (BUILD.hostListenerTargetBody && flags & 16 /* LISTENER_FLAGS.TargetBody */)
|
|
2940
|
-
return doc.body;
|
|
2941
|
-
if (BUILD.hostListenerTargetParent && flags & 32 /* LISTENER_FLAGS.TargetParent */)
|
|
2942
|
-
return elm.parentElement;
|
|
2943
|
-
return elm;
|
|
2944
|
-
};
|
|
2945
1871
|
// prettier-ignore
|
|
2946
|
-
const hostListenerOpts = (flags) =>
|
|
2947
|
-
? ({
|
|
2948
|
-
passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
|
|
2949
|
-
capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
|
|
2950
|
-
})
|
|
2951
|
-
: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
2952
|
-
const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
2953
|
-
const insertVdomAnnotations = (doc, staticComponents) => {
|
|
2954
|
-
if (doc != null) {
|
|
2955
|
-
const docData = {
|
|
2956
|
-
hostIds: 0,
|
|
2957
|
-
rootLevelIds: 0,
|
|
2958
|
-
staticComponents: new Set(staticComponents),
|
|
2959
|
-
};
|
|
2960
|
-
const orgLocationNodes = [];
|
|
2961
|
-
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
2962
|
-
orgLocationNodes.forEach((orgLocationNode) => {
|
|
2963
|
-
if (orgLocationNode != null) {
|
|
2964
|
-
const nodeRef = orgLocationNode['s-nr'];
|
|
2965
|
-
let hostId = nodeRef['s-host-id'];
|
|
2966
|
-
let nodeId = nodeRef['s-node-id'];
|
|
2967
|
-
let childId = `${hostId}.${nodeId}`;
|
|
2968
|
-
if (hostId == null) {
|
|
2969
|
-
hostId = 0;
|
|
2970
|
-
docData.rootLevelIds++;
|
|
2971
|
-
nodeId = docData.rootLevelIds;
|
|
2972
|
-
childId = `${hostId}.${nodeId}`;
|
|
2973
|
-
if (nodeRef.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
2974
|
-
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
2975
|
-
}
|
|
2976
|
-
else if (nodeRef.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
2977
|
-
if (hostId === 0) {
|
|
2978
|
-
const textContent = nodeRef.nodeValue.trim();
|
|
2979
|
-
if (textContent === '') {
|
|
2980
|
-
// useless whitespace node at the document root
|
|
2981
|
-
orgLocationNode.remove();
|
|
2982
|
-
return;
|
|
2983
|
-
}
|
|
2984
|
-
}
|
|
2985
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
2986
|
-
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
2987
|
-
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
2988
|
-
}
|
|
2989
|
-
}
|
|
2990
|
-
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
|
2991
|
-
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
2992
|
-
if (orgLocationParentNode) {
|
|
2993
|
-
if (orgLocationParentNode['s-en'] === '') {
|
|
2994
|
-
// ending with a "." means that the parent element
|
|
2995
|
-
// of this node's original location is a SHADOW dom element
|
|
2996
|
-
// and this node is apart of the root level light dom
|
|
2997
|
-
orgLocationNodeId += `.`;
|
|
2998
|
-
}
|
|
2999
|
-
else if (orgLocationParentNode['s-en'] === 'c') {
|
|
3000
|
-
// ending with a ".c" means that the parent element
|
|
3001
|
-
// of this node's original location is a SCOPED element
|
|
3002
|
-
// and this node is apart of the root level light dom
|
|
3003
|
-
orgLocationNodeId += `.c`;
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
3007
|
-
}
|
|
3008
|
-
});
|
|
3009
|
-
}
|
|
3010
|
-
};
|
|
3011
|
-
const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
3012
|
-
if (node == null) {
|
|
3013
|
-
return;
|
|
3014
|
-
}
|
|
3015
|
-
if (node['s-nr'] != null) {
|
|
3016
|
-
orgLocationNodes.push(node);
|
|
3017
|
-
}
|
|
3018
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
3019
|
-
node.childNodes.forEach((childNode) => {
|
|
3020
|
-
const hostRef = getHostRef(childNode);
|
|
3021
|
-
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
|
|
3022
|
-
const cmpData = {
|
|
3023
|
-
nodeIds: 0,
|
|
3024
|
-
};
|
|
3025
|
-
insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
|
|
3026
|
-
}
|
|
3027
|
-
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
3028
|
-
});
|
|
3029
|
-
}
|
|
3030
|
-
};
|
|
3031
|
-
const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
3032
|
-
if (vnode != null) {
|
|
3033
|
-
const hostId = ++docData.hostIds;
|
|
3034
|
-
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
3035
|
-
if (hostElm['s-cr'] != null) {
|
|
3036
|
-
hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
|
|
3037
|
-
}
|
|
3038
|
-
if (vnode.$children$ != null) {
|
|
3039
|
-
const depth = 0;
|
|
3040
|
-
vnode.$children$.forEach((vnodeChild, index) => {
|
|
3041
|
-
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
3042
|
-
});
|
|
3043
|
-
}
|
|
3044
|
-
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
|
|
3045
|
-
const parent = hostElm.parentElement;
|
|
3046
|
-
if (parent && parent.childNodes) {
|
|
3047
|
-
const parentChildNodes = Array.from(parent.childNodes);
|
|
3048
|
-
const comment = parentChildNodes.find((node) => node.nodeType === 8 /* NODE_TYPE.CommentNode */ && node['s-sr']);
|
|
3049
|
-
if (comment) {
|
|
3050
|
-
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
3051
|
-
vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
|
-
};
|
|
3057
|
-
const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
3058
|
-
const childElm = vnodeChild.$elm$;
|
|
3059
|
-
if (childElm == null) {
|
|
3060
|
-
return;
|
|
3061
|
-
}
|
|
3062
|
-
const nodeId = cmpData.nodeIds++;
|
|
3063
|
-
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
3064
|
-
childElm['s-host-id'] = hostId;
|
|
3065
|
-
childElm['s-node-id'] = nodeId;
|
|
3066
|
-
if (childElm.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
3067
|
-
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
3068
|
-
}
|
|
3069
|
-
else if (childElm.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
3070
|
-
const parentNode = childElm.parentNode;
|
|
3071
|
-
const nodeName = parentNode.nodeName;
|
|
3072
|
-
if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
|
|
3073
|
-
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
3074
|
-
const commentBeforeTextNode = doc.createComment(textNodeId);
|
|
3075
|
-
parentNode.insertBefore(commentBeforeTextNode, childElm);
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
else if (childElm.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
3079
|
-
if (childElm['s-sr']) {
|
|
3080
|
-
const slotName = childElm['s-sn'] || '';
|
|
3081
|
-
const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
|
|
3082
|
-
childElm.nodeValue = slotNodeId;
|
|
3083
|
-
}
|
|
3084
|
-
}
|
|
3085
|
-
if (vnodeChild.$children$ != null) {
|
|
3086
|
-
const childDepth = depth + 1;
|
|
3087
|
-
vnodeChild.$children$.forEach((vnode, index) => {
|
|
3088
|
-
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
|
|
3089
|
-
});
|
|
3090
|
-
}
|
|
3091
|
-
};
|
|
1872
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
3092
1873
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
3093
1874
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
3094
1875
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -3099,42 +1880,25 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
3099
1880
|
$cmpMeta$: cmpMeta,
|
|
3100
1881
|
$instanceValues$: new Map(),
|
|
3101
1882
|
};
|
|
3102
|
-
|
|
3103
|
-
hostRef.$renderCount$ = 0;
|
|
3104
|
-
}
|
|
3105
|
-
if (BUILD.method && BUILD.lazyLoad) {
|
|
1883
|
+
{
|
|
3106
1884
|
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
3107
1885
|
}
|
|
3108
|
-
|
|
1886
|
+
{
|
|
3109
1887
|
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
3110
1888
|
elm['s-p'] = [];
|
|
3111
1889
|
elm['s-rc'] = [];
|
|
3112
1890
|
}
|
|
3113
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
1891
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
3114
1892
|
return hostRefs.set(elm, hostRef);
|
|
3115
1893
|
};
|
|
3116
1894
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
3117
|
-
const consoleError = (e, el) => (
|
|
3118
|
-
const STENCIL_DEV_MODE = BUILD.isTesting
|
|
3119
|
-
? ['STENCIL:'] // E2E testing
|
|
3120
|
-
: [
|
|
3121
|
-
'%cstencil',
|
|
3122
|
-
'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
|
|
3123
|
-
];
|
|
3124
|
-
const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
|
|
3125
|
-
const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
|
|
3126
|
-
const consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
|
|
3127
|
-
const setErrorHandler = (handler) => (customError = handler);
|
|
1895
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
3128
1896
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
3129
1897
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
3130
1898
|
// loadModuleImport
|
|
3131
1899
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
3132
1900
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
3133
|
-
|
|
3134
|
-
consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
|
|
3135
|
-
return undefined;
|
|
3136
|
-
}
|
|
3137
|
-
const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
|
|
1901
|
+
const module = cmpModules.get(bundleId) ;
|
|
3138
1902
|
if (module) {
|
|
3139
1903
|
return module[exportName];
|
|
3140
1904
|
}
|
|
@@ -3144,20 +1908,16 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
3144
1908
|
/* webpackInclude: /\.entry\.js$/ */
|
|
3145
1909
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
3146
1910
|
/* webpackMode: "lazy" */
|
|
3147
|
-
`./${bundleId}.entry.js${
|
|
3148
|
-
|
|
1911
|
+
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
|
|
1912
|
+
{
|
|
3149
1913
|
cmpModules.set(bundleId, importedModule);
|
|
3150
1914
|
}
|
|
3151
1915
|
return importedModule[exportName];
|
|
3152
1916
|
}, consoleError);
|
|
3153
1917
|
};
|
|
3154
1918
|
const styles = /*@__PURE__*/ new Map();
|
|
3155
|
-
const modeResolutionChain = [];
|
|
3156
1919
|
const win = typeof window !== 'undefined' ? window : {};
|
|
3157
|
-
const CSS = BUILD.cssVarShim ? win.CSS : null;
|
|
3158
1920
|
const doc = win.document || { head: {} };
|
|
3159
|
-
const H = (win.HTMLElement || class {
|
|
3160
|
-
});
|
|
3161
1921
|
const plt = {
|
|
3162
1922
|
$flags$: 0,
|
|
3163
1923
|
$resourcesUrl$: '',
|
|
@@ -3167,27 +1927,8 @@ const plt = {
|
|
|
3167
1927
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
3168
1928
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
3169
1929
|
};
|
|
3170
|
-
const setPlatformHelpers = (helpers) => {
|
|
3171
|
-
Object.assign(plt, helpers);
|
|
3172
|
-
};
|
|
3173
|
-
const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom
|
|
3174
|
-
? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
3175
|
-
: true;
|
|
3176
|
-
const supportsListenerOptions = /*@__PURE__*/ (() => {
|
|
3177
|
-
let supportsListenerOptions = false;
|
|
3178
|
-
try {
|
|
3179
|
-
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
|
|
3180
|
-
get() {
|
|
3181
|
-
supportsListenerOptions = true;
|
|
3182
|
-
},
|
|
3183
|
-
}));
|
|
3184
|
-
}
|
|
3185
|
-
catch (e) { }
|
|
3186
|
-
return supportsListenerOptions;
|
|
3187
|
-
})();
|
|
3188
1930
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
3189
|
-
const supportsConstructableStylesheets =
|
|
3190
|
-
? /*@__PURE__*/ (() => {
|
|
1931
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
3191
1932
|
try {
|
|
3192
1933
|
new CSSStyleSheet();
|
|
3193
1934
|
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
@@ -3195,10 +1936,9 @@ const supportsConstructableStylesheets = BUILD.constructableCSS
|
|
|
3195
1936
|
catch (e) { }
|
|
3196
1937
|
return false;
|
|
3197
1938
|
})()
|
|
3198
|
-
|
|
1939
|
+
;
|
|
3199
1940
|
const queueDomReads = [];
|
|
3200
1941
|
const queueDomWrites = [];
|
|
3201
|
-
const queueDomWritesLow = [];
|
|
3202
1942
|
const queueTask = (queue, write) => (cb) => {
|
|
3203
1943
|
queue.push(cb);
|
|
3204
1944
|
if (!queuePending) {
|
|
@@ -3222,53 +1962,13 @@ const consume = (queue) => {
|
|
|
3222
1962
|
}
|
|
3223
1963
|
queue.length = 0;
|
|
3224
1964
|
};
|
|
3225
|
-
const consumeTimeout = (queue, timeout) => {
|
|
3226
|
-
let i = 0;
|
|
3227
|
-
let ts = 0;
|
|
3228
|
-
while (i < queue.length && (ts = performance.now()) < timeout) {
|
|
3229
|
-
try {
|
|
3230
|
-
queue[i++](ts);
|
|
3231
|
-
}
|
|
3232
|
-
catch (e) {
|
|
3233
|
-
consoleError(e);
|
|
3234
|
-
}
|
|
3235
|
-
}
|
|
3236
|
-
if (i === queue.length) {
|
|
3237
|
-
queue.length = 0;
|
|
3238
|
-
}
|
|
3239
|
-
else if (i !== 0) {
|
|
3240
|
-
queue.splice(0, i);
|
|
3241
|
-
}
|
|
3242
|
-
};
|
|
3243
1965
|
const flush = () => {
|
|
3244
|
-
if (BUILD.asyncQueue) {
|
|
3245
|
-
queueCongestion++;
|
|
3246
|
-
}
|
|
3247
1966
|
// always force a bunch of medium callbacks to run, but still have
|
|
3248
1967
|
// a throttle on how many can run in a certain time
|
|
3249
1968
|
// DOM READS!!!
|
|
3250
1969
|
consume(queueDomReads);
|
|
3251
1970
|
// DOM WRITES!!!
|
|
3252
|
-
|
|
3253
|
-
const timeout = (plt.$flags$ & 6 /* PLATFORM_FLAGS.queueMask */) === 2 /* PLATFORM_FLAGS.appLoaded */
|
|
3254
|
-
? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
|
|
3255
|
-
: Infinity;
|
|
3256
|
-
consumeTimeout(queueDomWrites, timeout);
|
|
3257
|
-
consumeTimeout(queueDomWritesLow, timeout);
|
|
3258
|
-
if (queueDomWrites.length > 0) {
|
|
3259
|
-
queueDomWritesLow.push(...queueDomWrites);
|
|
3260
|
-
queueDomWrites.length = 0;
|
|
3261
|
-
}
|
|
3262
|
-
if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
|
|
3263
|
-
// still more to do yet, but we've run out of time
|
|
3264
|
-
// let's let this thing cool off and try again in the next tick
|
|
3265
|
-
plt.raf(flush);
|
|
3266
|
-
}
|
|
3267
|
-
else {
|
|
3268
|
-
queueCongestion = 0;
|
|
3269
|
-
}
|
|
3270
|
-
}
|
|
3271
|
-
else {
|
|
1971
|
+
{
|
|
3272
1972
|
consume(queueDomWrites);
|
|
3273
1973
|
if ((queuePending = queueDomReads.length > 0)) {
|
|
3274
1974
|
// still more to do yet, but we've run out of time
|
|
@@ -3278,21 +1978,13 @@ const flush = () => {
|
|
|
3278
1978
|
}
|
|
3279
1979
|
};
|
|
3280
1980
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
3281
|
-
const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
|
|
3282
1981
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
3283
1982
|
|
|
3284
|
-
exports.
|
|
3285
|
-
exports.CSS = CSS;
|
|
3286
|
-
exports.H = H;
|
|
1983
|
+
exports.Fragment = Fragment;
|
|
3287
1984
|
exports.Host = Host;
|
|
3288
|
-
exports.NAMESPACE = NAMESPACE;
|
|
3289
1985
|
exports.bootstrapLazy = bootstrapLazy;
|
|
3290
|
-
exports.consoleDevInfo = consoleDevInfo;
|
|
3291
1986
|
exports.createEvent = createEvent;
|
|
3292
|
-
exports.doc = doc;
|
|
3293
1987
|
exports.getElement = getElement;
|
|
3294
1988
|
exports.h = h;
|
|
3295
|
-
exports.plt = plt;
|
|
3296
1989
|
exports.promiseResolve = promiseResolve;
|
|
3297
1990
|
exports.registerInstance = registerInstance;
|
|
3298
|
-
exports.win = win;
|