@revolist/revogrid 3.6.6 → 3.6.8
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/custom-element/_baseIteratee.js +3 -1
- package/custom-element/_baseIteratee.js.map +1 -0
- package/custom-element/columnService.js +6 -4
- package/custom-element/columnService.js.map +1 -0
- package/custom-element/consts.js +3 -1
- package/custom-element/consts.js.map +1 -0
- package/custom-element/data.store.js +55 -33
- package/custom-element/data.store.js.map +1 -0
- package/custom-element/debounce.js +3 -1
- package/custom-element/debounce.js.map +1 -0
- package/custom-element/dimension.helpers.js +3 -1
- package/custom-element/dimension.helpers.js.map +1 -0
- package/custom-element/each.js +2 -0
- package/custom-element/each.js.map +1 -0
- package/custom-element/filter.button.js +2 -0
- package/custom-element/filter.button.js.map +1 -0
- package/custom-element/identity.js +2 -0
- package/custom-element/identity.js.map +1 -0
- package/custom-element/index.d.ts +9 -16
- package/custom-element/index.js +4 -15
- package/custom-element/index.js.map +1 -0
- package/custom-element/isSymbol.js +3 -1
- package/custom-element/isSymbol.js.map +1 -0
- package/custom-element/keys.js +3 -1
- package/custom-element/keys.js.map +1 -0
- package/custom-element/localScrollService.js +2 -0
- package/custom-element/localScrollService.js.map +1 -0
- package/custom-element/resize-observer.js +2 -0
- package/custom-element/resize-observer.js.map +1 -0
- package/custom-element/revo-grid.js +29 -154
- package/custom-element/revo-grid.js.map +1 -0
- package/custom-element/revogr-clipboard.js +4 -4
- package/custom-element/revogr-clipboard.js.map +1 -0
- package/custom-element/revogr-data.js +2 -0
- package/custom-element/revogr-data.js.map +1 -0
- package/custom-element/revogr-data2.js +14 -3
- package/custom-element/revogr-data2.js.map +1 -0
- package/custom-element/revogr-edit.js +2 -0
- package/custom-element/revogr-edit.js.map +1 -0
- package/custom-element/revogr-edit2.js +7 -3
- package/custom-element/revogr-edit2.js.map +1 -0
- package/custom-element/revogr-filter-panel.js +10 -6
- package/custom-element/revogr-filter-panel.js.map +1 -0
- package/custom-element/revogr-focus.js +2 -0
- package/custom-element/revogr-focus.js.map +1 -0
- package/custom-element/revogr-focus2.js +8 -2
- package/custom-element/revogr-focus2.js.map +1 -0
- package/custom-element/revogr-header.js +2 -0
- package/custom-element/revogr-header.js.map +1 -0
- package/custom-element/revogr-header2.js +11 -3
- package/custom-element/revogr-header2.js.map +1 -0
- package/custom-element/revogr-order-editor.js +2 -0
- package/custom-element/revogr-order-editor.js.map +1 -0
- package/custom-element/revogr-order-editor2.js +8 -3
- package/custom-element/revogr-order-editor2.js.map +1 -0
- package/custom-element/revogr-overlay-selection.js +2 -0
- package/custom-element/revogr-overlay-selection.js.map +1 -0
- package/custom-element/revogr-overlay-selection2.js +42 -40
- package/custom-element/revogr-overlay-selection2.js.map +1 -0
- package/custom-element/revogr-row-headers.js +2 -0
- package/custom-element/revogr-row-headers.js.map +1 -0
- package/custom-element/revogr-row-headers2.js +9 -2
- package/custom-element/revogr-row-headers2.js.map +1 -0
- package/custom-element/revogr-scroll-virtual.js +2 -0
- package/custom-element/revogr-scroll-virtual.js.map +1 -0
- package/custom-element/revogr-scroll-virtual2.js +5 -2
- package/custom-element/revogr-scroll-virtual2.js.map +1 -0
- package/custom-element/revogr-temp-range.js +2 -0
- package/custom-element/revogr-temp-range.js.map +1 -0
- package/custom-element/revogr-temp-range2.js +8 -4
- package/custom-element/revogr-temp-range2.js.map +1 -0
- package/custom-element/revogr-viewport-scroll.js +2 -0
- package/custom-element/revogr-viewport-scroll.js.map +1 -0
- package/custom-element/revogr-viewport-scroll2.js +6 -11
- package/custom-element/revogr-viewport-scroll2.js.map +1 -0
- package/custom-element/selection.utils.js +2 -0
- package/custom-element/selection.utils.js.map +1 -0
- package/custom-element/themeService.js +65 -0
- package/custom-element/themeService.js.map +1 -0
- package/custom-element/toInteger.js +2 -0
- package/custom-element/toInteger.js.map +1 -0
- package/custom-element/toNumber.js +3 -1
- package/custom-element/toNumber.js.map +1 -0
- package/custom-element/utils.js +2 -0
- package/custom-element/utils.js.map +1 -0
- package/dist/cjs/{debounce-6cea2774.js → debounce-a0628875.js} +3 -1
- package/dist/cjs/debounce-a0628875.js.map +1 -0
- package/dist/cjs/{index-cb904e00.js → index-c209f988.js} +667 -315
- package/dist/cjs/index-c209f988.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +6 -26
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/{resize-observer-bf327d6a.js → resize-observer-cc749e66.js} +2 -0
- package/dist/cjs/resize-observer-cc749e66.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.js +9 -60
- package/dist/cjs/revo-grid.cjs.js.map +1 -0
- package/dist/cjs/revo-grid_11.cjs.entry.js +169 -180
- package/dist/cjs/revo-grid_11.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-clipboard.cjs.entry.js +4 -3
- package/dist/cjs/revogr-clipboard.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +11 -6
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +16 -16
- package/dist/collection/components/button/button.js +2 -1
- package/dist/collection/components/button/button.js.map +1 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js +86 -80
- package/dist/collection/components/clipboard/revogr-clipboard.js.map +1 -0
- package/dist/collection/components/data/cellRenderer.js +5 -5
- package/dist/collection/components/data/cellRenderer.js.map +1 -0
- package/dist/collection/components/data/columnService.js +9 -8
- package/dist/collection/components/data/columnService.js.map +1 -0
- package/dist/collection/components/data/revogr-data.js +258 -226
- package/dist/collection/components/data/revogr-data.js.map +1 -0
- package/dist/collection/components/data/rowRenderer.js +2 -1
- package/dist/collection/components/data/rowRenderer.js.map +1 -0
- package/dist/collection/components/header/headerCellRenderer.js +6 -7
- package/dist/collection/components/header/headerCellRenderer.js.map +1 -0
- package/dist/collection/components/header/headerRenderer.js +7 -8
- package/dist/collection/components/header/headerRenderer.js.map +1 -0
- package/dist/collection/components/header/revogr-header.js +259 -233
- package/dist/collection/components/header/revogr-header.js.map +1 -0
- package/dist/collection/components/order/orderRenderer.js +3 -6
- package/dist/collection/components/order/orderRenderer.js.map +1 -0
- package/dist/collection/components/order/revogr-order-editor.js +279 -252
- package/dist/collection/components/order/revogr-order-editor.js.map +1 -0
- package/dist/collection/components/order/rowOrderService.js +2 -1
- package/dist/collection/components/order/rowOrderService.js.map +1 -0
- package/dist/collection/components/overlay/autofill.service.js +8 -7
- package/dist/collection/components/overlay/autofill.service.js.map +1 -0
- package/dist/collection/components/overlay/clipboard.service.js +4 -3
- package/dist/collection/components/overlay/clipboard.service.js.map +1 -0
- package/dist/collection/components/overlay/editors/edit.utils.js +2 -1
- package/dist/collection/components/overlay/editors/edit.utils.js.map +1 -0
- package/dist/collection/components/overlay/editors/text.js +4 -3
- package/dist/collection/components/overlay/editors/text.js.map +1 -0
- package/dist/collection/components/overlay/keyboard.service.js +6 -5
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -0
- package/dist/collection/components/overlay/revogr-edit.js +112 -96
- package/dist/collection/components/overlay/revogr-edit.js.map +1 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +546 -482
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -0
- package/dist/collection/components/overlay/selection.utils.js +2 -1
- package/dist/collection/components/overlay/selection.utils.js.map +1 -0
- package/dist/collection/components/revo-grid/revo-grid-style.css +7 -13
- package/dist/collection/components/revo-grid/revo-grid.js +1668 -1638
- package/dist/collection/components/revo-grid/revo-grid.js.map +1 -0
- package/dist/collection/components/revo-grid/viewport.helpers.js +1 -0
- package/dist/collection/components/revo-grid/viewport.helpers.js.map +1 -0
- package/dist/collection/components/revo-grid/viewport.interfaces.js +1 -3
- package/dist/collection/components/revo-grid/viewport.interfaces.js.map +1 -0
- package/dist/collection/components/revo-grid/viewport.js +4 -7
- package/dist/collection/components/revo-grid/viewport.js.map +1 -0
- package/dist/collection/components/revo-grid/viewport.resize.service.js +3 -2
- package/dist/collection/components/revo-grid/viewport.resize.service.js.map +1 -0
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js +1 -0
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js.map +1 -0
- package/dist/collection/components/revo-grid/viewport.section.js +5 -7
- package/dist/collection/components/revo-grid/viewport.section.js.map +1 -0
- package/dist/collection/components/revo-grid/viewport.service.js +7 -6
- package/dist/collection/components/revo-grid/viewport.service.js.map +1 -0
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +161 -147
- package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -0
- package/dist/collection/components/rowHeaders/row-header-render.js +1 -0
- package/dist/collection/components/rowHeaders/row-header-render.js.map +1 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +2 -4
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +172 -168
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -0
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +159 -137
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -0
- package/dist/collection/components/selection-focus/revogr-focus.js +153 -128
- package/dist/collection/components/selection-focus/revogr-focus.js.map +1 -0
- package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +1 -1
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js +92 -77
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js.map +1 -0
- package/dist/collection/global/global.js +3 -2
- package/dist/collection/global/global.js.map +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/plugins/autoSizeColumn.js +7 -6
- package/dist/collection/plugins/autoSizeColumn.js.map +1 -0
- package/dist/collection/plugins/basePlugin.js +1 -0
- package/dist/collection/plugins/basePlugin.js.map +1 -0
- package/dist/collection/plugins/dispatcher.js +1 -0
- package/dist/collection/plugins/dispatcher.js.map +1 -0
- package/dist/collection/plugins/export/csv.js +2 -1
- package/dist/collection/plugins/export/csv.js.map +1 -0
- package/dist/collection/plugins/export/export.plugin.js +6 -5
- package/dist/collection/plugins/export/export.plugin.js.map +1 -0
- package/dist/collection/plugins/export/types.js +1 -3
- package/dist/collection/plugins/export/types.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/equal.js +1 -0
- package/dist/collection/plugins/filter/conditions/equal.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +1 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +3 -2
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +1 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +3 -2
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/set.js +1 -0
- package/dist/collection/plugins/filter/conditions/set.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +1 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js +1 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js.map +1 -0
- package/dist/collection/plugins/filter/filter.button.js +7 -12
- package/dist/collection/plugins/filter/filter.button.js.map +1 -0
- package/dist/collection/plugins/filter/filter.plugin.js +5 -4
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -0
- package/dist/collection/plugins/filter/filter.pop.js +254 -238
- package/dist/collection/plugins/filter/filter.pop.js.map +1 -0
- package/dist/collection/plugins/filter/filter.service.js +9 -8
- package/dist/collection/plugins/filter/filter.service.js.map +1 -0
- package/dist/collection/plugins/filter/filter.style.css +2 -3
- package/dist/collection/plugins/filter/filter.types.js +1 -3
- package/dist/collection/plugins/filter/filter.types.js.map +1 -0
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +6 -5
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js.map +1 -0
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +4 -3
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js.map +1 -0
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +4 -3
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js +2 -1
- package/dist/collection/plugins/groupingRow/grouping.const.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +3 -2
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +14 -13
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +6 -10
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +1 -3
- package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js +2 -1
- package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +2 -1
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js.map +1 -0
- package/dist/collection/plugins/moveColumn/columnDragPlugin.js +8 -7
- package/dist/collection/plugins/moveColumn/columnDragPlugin.js.map +1 -0
- package/dist/collection/plugins/moveColumn/columnOrderHandler.js +2 -1
- package/dist/collection/plugins/moveColumn/columnOrderHandler.js.map +1 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js +8 -7
- package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -0
- package/dist/collection/plugins/sorting/sorting.sign.js +2 -1
- package/dist/collection/plugins/sorting/sorting.sign.js.map +1 -0
- package/dist/collection/plugins/stretchPlugin.js +4 -3
- package/dist/collection/plugins/stretchPlugin.js.map +1 -0
- package/dist/collection/plugins/trimmed/trimmed.plugin.js +1 -0
- package/dist/collection/plugins/trimmed/trimmed.plugin.js.map +1 -0
- package/dist/collection/services/cell.helpers.js +2 -1
- package/dist/collection/services/cell.helpers.js.map +1 -0
- package/dist/collection/services/column.data.provider.js +14 -13
- package/dist/collection/services/column.data.provider.js.map +1 -0
- package/dist/collection/services/data.provider.js +4 -3
- package/dist/collection/services/data.provider.js.map +1 -0
- package/dist/collection/services/dimension.provider.js +5 -4
- package/dist/collection/services/dimension.provider.js.map +1 -0
- package/dist/collection/services/localScrollService.js +2 -1
- package/dist/collection/services/localScrollService.js.map +1 -0
- package/dist/collection/services/resizable.directive.js +3 -4
- package/dist/collection/services/resizable.directive.js.map +1 -0
- package/dist/collection/services/selection.store.connector.js +3 -2
- package/dist/collection/services/selection.store.connector.js.map +1 -0
- package/dist/collection/services/viewport.provider.js +4 -3
- package/dist/collection/services/viewport.provider.js.map +1 -0
- package/dist/collection/store/dataSource/data.proxy.js +1 -0
- package/dist/collection/store/dataSource/data.proxy.js.map +1 -0
- package/dist/collection/store/dataSource/data.store.js +10 -9
- package/dist/collection/store/dataSource/data.store.js.map +1 -0
- package/dist/collection/store/dimension/dimension.helpers.js +5 -4
- package/dist/collection/store/dimension/dimension.helpers.js.map +1 -0
- package/dist/collection/store/dimension/dimension.store.js +9 -7
- package/dist/collection/store/dimension/dimension.store.js.map +1 -0
- package/dist/collection/store/selection/selection.helpers.js +2 -1
- package/dist/collection/store/selection/selection.helpers.js.map +1 -0
- package/dist/collection/store/selection/selection.store.js +4 -3
- package/dist/collection/store/selection/selection.store.js.map +1 -0
- package/dist/collection/store/selection/selection.store.service.js +2 -1
- package/dist/collection/store/selection/selection.store.service.js.map +1 -0
- package/dist/collection/store/storeTypes.js +1 -0
- package/dist/collection/store/storeTypes.js.map +1 -0
- package/dist/collection/store/viewPort/viewport.helpers.js +2 -1
- package/dist/collection/store/viewPort/viewport.helpers.js.map +1 -0
- package/dist/collection/store/viewPort/viewport.store.js +4 -3
- package/dist/collection/store/viewPort/viewport.store.js.map +1 -0
- package/dist/collection/themeManager/theme.compact.js +1 -0
- package/dist/collection/themeManager/theme.compact.js.map +1 -0
- package/dist/collection/themeManager/theme.default.js +1 -0
- package/dist/collection/themeManager/theme.default.js.map +1 -0
- package/dist/collection/themeManager/theme.material.js +1 -0
- package/dist/collection/themeManager/theme.material.js.map +1 -0
- package/dist/collection/themeManager/themeService.js +9 -8
- package/dist/collection/themeManager/themeService.js.map +1 -0
- package/dist/collection/utils/closestPolifill.js +1 -0
- package/dist/collection/utils/closestPolifill.js.map +1 -0
- package/dist/collection/utils/consts.js +1 -0
- package/dist/collection/utils/consts.js.map +1 -0
- package/dist/collection/utils/generateAlphabetHeader.js +1 -0
- package/dist/collection/utils/generateAlphabetHeader.js.map +1 -0
- package/dist/collection/utils/keyCodes.js +1 -0
- package/dist/collection/utils/keyCodes.js.map +1 -0
- package/dist/collection/utils/keyCodes.utils.js +4 -3
- package/dist/collection/utils/keyCodes.utils.js.map +1 -0
- package/dist/collection/utils/platform.js +1 -0
- package/dist/collection/utils/platform.js.map +1 -0
- package/dist/collection/utils/resizeObserver.js +1 -0
- package/dist/collection/utils/resizeObserver.js.map +1 -0
- package/dist/collection/utils/store.utils.js +1 -0
- package/dist/collection/utils/store.utils.js.map +1 -0
- package/dist/collection/utils/utils.js +1 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/esm/{debounce-e4e6dd45.js → debounce-cb7aac48.js} +3 -1
- package/dist/esm/debounce-cb7aac48.js.map +1 -0
- package/dist/esm/{index-6f753b3c.js → index-f21f8a13.js} +667 -311
- package/dist/esm/index-f21f8a13.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +6 -26
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/{resize-observer-00c48d78.js → resize-observer-4f34a839.js} +2 -0
- package/dist/esm/resize-observer-4f34a839.js.map +1 -0
- package/dist/esm/revo-grid.js +7 -61
- package/dist/esm/revo-grid.js.map +1 -0
- package/dist/esm/revo-grid_11.entry.js +169 -180
- package/dist/esm/revo-grid_11.entry.js.map +1 -0
- package/dist/esm/revogr-clipboard.entry.js +4 -3
- package/dist/esm/revogr-clipboard.entry.js.map +1 -0
- package/dist/esm/revogr-filter-panel.entry.js +11 -6
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -0
- package/dist/esm-es5/{debounce-e4e6dd45.js → debounce-cb7aac48.js} +2 -1
- package/dist/esm-es5/debounce-cb7aac48.js.map +1 -0
- package/dist/esm-es5/index-f21f8a13.js +5 -0
- package/dist/esm-es5/index-f21f8a13.js.map +1 -0
- package/dist/esm-es5/index.js +1 -0
- package/dist/esm-es5/index.js.map +1 -0
- package/dist/esm-es5/loader.js +2 -1
- package/dist/esm-es5/loader.js.map +1 -0
- package/dist/esm-es5/{resize-observer-00c48d78.js → resize-observer-4f34a839.js} +2 -1
- package/dist/esm-es5/resize-observer-4f34a839.js.map +1 -0
- package/dist/esm-es5/revo-grid.js +2 -1
- package/dist/esm-es5/revo-grid.js.map +1 -0
- package/dist/esm-es5/revo-grid_11.entry.js +3 -2
- package/dist/esm-es5/revo-grid_11.entry.js.map +1 -0
- package/dist/esm-es5/revogr-clipboard.entry.js +3 -2
- package/dist/esm-es5/revogr-clipboard.entry.js.map +1 -0
- package/dist/esm-es5/revogr-filter-panel.entry.js +3 -2
- package/dist/esm-es5/revogr-filter-panel.entry.js.map +1 -0
- package/dist/revo-grid/{debounce-5a33c710.system.js → debounce-3aba7c4d.system.js} +2 -1
- package/dist/revo-grid/debounce-3aba7c4d.system.js.map +1 -0
- package/dist/revo-grid/debounce-cb7aac48.js +5 -0
- package/dist/revo-grid/debounce-cb7aac48.js.map +1 -0
- package/dist/revo-grid/index-20224007.system.js +6 -0
- package/dist/revo-grid/index-20224007.system.js.map +1 -0
- package/dist/revo-grid/index-f21f8a13.js +6 -0
- package/dist/revo-grid/index-f21f8a13.js.map +1 -0
- package/dist/revo-grid/index.esm.js +2 -0
- package/dist/revo-grid/index.esm.js.map +1 -0
- package/dist/revo-grid/index.system.js +2 -1
- package/dist/revo-grid/index.system.js.map +1 -0
- package/dist/revo-grid/{resize-observer-8af0bc0e.system.js → resize-observer-2a36c9e4.system.js} +2 -1
- package/dist/revo-grid/resize-observer-2a36c9e4.system.js.map +1 -0
- package/dist/revo-grid/resize-observer-4f34a839.js +5 -0
- package/dist/revo-grid/resize-observer-4f34a839.js.map +1 -0
- package/dist/revo-grid/revo-grid.esm.js +2 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -0
- package/dist/revo-grid/revo-grid.js +1 -7
- package/dist/revo-grid/revo-grid.system.js +2 -1
- package/dist/revo-grid/revo-grid.system.js.map +1 -0
- package/dist/revo-grid/revo-grid_11.entry.js +2 -1
- package/dist/revo-grid/revo-grid_11.entry.js.map +1 -0
- package/dist/revo-grid/revo-grid_11.system.entry.js +3 -2
- package/dist/revo-grid/revo-grid_11.system.entry.js.map +1 -0
- package/dist/revo-grid/revogr-clipboard.entry.js +2 -1
- package/dist/revo-grid/revogr-clipboard.entry.js.map +1 -0
- package/dist/revo-grid/revogr-clipboard.system.entry.js +3 -2
- package/dist/revo-grid/revogr-clipboard.system.entry.js.map +1 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +2 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -0
- package/dist/revo-grid/revogr-filter-panel.system.entry.js +3 -2
- package/dist/revo-grid/revogr-filter-panel.system.entry.js.map +1 -0
- package/dist/types/components/data/cellRenderer.d.ts +1 -1
- package/dist/types/components/data/columnService.d.ts +4 -4
- package/dist/types/components/header/headerCellRenderer.d.ts +1 -1
- package/dist/types/components/header/headerRenderer.d.ts +1 -1
- package/dist/types/components/order/orderRenderer.d.ts +1 -1
- package/dist/types/components/order/rowOrderService.d.ts +1 -1
- package/dist/types/components/overlay/autofill.service.d.ts +1 -1
- package/dist/types/components/overlay/clipboard.service.d.ts +1 -1
- package/dist/types/components/overlay/editors/text.d.ts +1 -1
- package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +9 -3
- package/dist/types/components/overlay/selection.utils.d.ts +1 -1
- package/dist/types/components/revo-grid/viewport.d.ts +1 -1
- package/dist/types/components/revo-grid/viewport.interfaces.d.ts +5 -5
- package/dist/types/components/revo-grid/viewport.scrolling.service.d.ts +1 -1
- package/dist/types/components/revo-grid/viewport.section.d.ts +1 -1
- package/dist/types/components/revo-grid/viewport.service.d.ts +3 -3
- package/dist/types/components/rowHeaders/row-header-render.d.ts +1 -1
- package/dist/types/components.d.ts +26 -0
- package/dist/types/plugins/autoSizeColumn.d.ts +1 -1
- package/dist/types/plugins/dispatcher.d.ts +1 -1
- package/dist/types/plugins/export/csv.d.ts +1 -1
- package/dist/types/plugins/export/export.plugin.d.ts +1 -1
- package/dist/types/plugins/export/types.d.ts +2 -2
- package/dist/types/plugins/filter/filter.button.d.ts +1 -1
- package/dist/types/plugins/filter/filter.plugin.d.ts +6 -6
- package/dist/types/plugins/filter/filter.pop.d.ts +4 -4
- package/dist/types/plugins/filter/filter.service.d.ts +1 -1
- package/dist/types/plugins/filter/filter.types.d.ts +5 -5
- package/dist/types/plugins/groupingColumn/columnGroupsRenderer.d.ts +1 -1
- package/dist/types/plugins/groupingColumn/grouping.col.plugin.d.ts +1 -1
- package/dist/types/plugins/groupingColumn/headerGroupRenderer.d.ts +1 -1
- package/dist/types/plugins/groupingRow/grouping.row.renderer.d.ts +1 -1
- package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +5 -5
- package/dist/types/plugins/groupingRow/grouping.service.d.ts +1 -1
- package/dist/types/plugins/moveColumn/columnDragPlugin.d.ts +5 -5
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +1 -1
- package/dist/types/plugins/sorting/sorting.sign.d.ts +1 -1
- package/dist/types/plugins/trimmed/trimmed.plugin.d.ts +2 -2
- package/dist/types/services/column.data.provider.d.ts +4 -4
- package/dist/types/services/data.provider.d.ts +1 -1
- package/dist/types/services/dimension.provider.d.ts +2 -2
- package/dist/types/services/localScrollService.d.ts +1 -1
- package/dist/types/services/resizable.directive.d.ts +2 -2
- package/dist/types/services/selection.store.connector.d.ts +2 -2
- package/dist/types/services/viewport.provider.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +95 -20
- package/dist/types/store/dataSource/data.proxy.d.ts +1 -1
- package/dist/types/store/dataSource/data.store.d.ts +4 -4
- package/dist/types/store/dimension/dimension.helpers.d.ts +3 -3
- package/dist/types/store/selection/selection.store.d.ts +1 -1
- package/dist/types/store/viewPort/viewport.helpers.d.ts +2 -2
- package/loader/index.d.ts +10 -1
- package/loader/package.json +1 -0
- package/package.json +10 -10
- package/dist/cjs/css-shim-9f5bc84d.js +0 -9
- package/dist/cjs/dom-fcb646f0.js +0 -78
- package/dist/esm/css-shim-e1e1ea5e.js +0 -7
- package/dist/esm/dom-21bd1807.js +0 -76
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm-es5/css-shim-e1e1ea5e.js +0 -4
- package/dist/esm-es5/dom-21bd1807.js +0 -24
- package/dist/esm-es5/index-6f753b3c.js +0 -4
- package/dist/revo-grid/css-shim-bcf89cc0.system.js +0 -4
- package/dist/revo-grid/css-shim-e1e1ea5e.js +0 -4
- package/dist/revo-grid/debounce-726bdadb.js +0 -4
- package/dist/revo-grid/dom-21bd1807.js +0 -22
- package/dist/revo-grid/dom-726246e2.system.js +0 -24
- package/dist/revo-grid/index-f14b41a0.system.js +0 -5
- package/dist/revo-grid/index-f30d1de1.js +0 -5
- package/dist/revo-grid/resize-observer-00c48d78.js +0 -4
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const NAMESPACE = 'revo-grid';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
8
|
+
* Simon Friis Vindum (@paldepind)
|
|
9
|
+
* Licensed under the MIT License
|
|
10
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
11
|
+
*
|
|
12
|
+
* Modified for Stencil's renderer and slot projection
|
|
13
|
+
*/
|
|
6
14
|
let contentRef;
|
|
7
15
|
let hostTagName;
|
|
8
16
|
let useNativeShadowDom = false;
|
|
@@ -11,64 +19,6 @@ let checkSlotRelocate = false;
|
|
|
11
19
|
let isSvgMode = false;
|
|
12
20
|
let renderingRef = null;
|
|
13
21
|
let queuePending = false;
|
|
14
|
-
const win = typeof window !== 'undefined' ? window : {};
|
|
15
|
-
const CSS = win.CSS ;
|
|
16
|
-
const doc = win.document || { head: {} };
|
|
17
|
-
const plt = {
|
|
18
|
-
$flags$: 0,
|
|
19
|
-
$resourcesUrl$: '',
|
|
20
|
-
jmp: (h) => h(),
|
|
21
|
-
raf: (h) => requestAnimationFrame(h),
|
|
22
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
23
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
24
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
25
|
-
};
|
|
26
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
27
|
-
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
28
|
-
try {
|
|
29
|
-
new CSSStyleSheet();
|
|
30
|
-
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
31
|
-
}
|
|
32
|
-
catch (e) { }
|
|
33
|
-
return false;
|
|
34
|
-
})()
|
|
35
|
-
;
|
|
36
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
37
|
-
if (listeners) {
|
|
38
|
-
listeners.map(([flags, name, method]) => {
|
|
39
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
40
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
41
|
-
const opts = hostListenerOpts(flags);
|
|
42
|
-
plt.ael(target, name, handler, opts);
|
|
43
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
48
|
-
try {
|
|
49
|
-
{
|
|
50
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
51
|
-
// instance is ready, let's call it's member method for this event
|
|
52
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
consoleError(e);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
64
|
-
if (flags & 4 /* TargetDocument */)
|
|
65
|
-
return doc;
|
|
66
|
-
return elm;
|
|
67
|
-
};
|
|
68
|
-
// prettier-ignore
|
|
69
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
70
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
71
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
72
22
|
const createTime = (fnName, tagName = '') => {
|
|
73
23
|
{
|
|
74
24
|
return () => {
|
|
@@ -83,75 +33,8 @@ const uniqueTime = (key, measureText) => {
|
|
|
83
33
|
};
|
|
84
34
|
}
|
|
85
35
|
};
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
let style = styles.get(scopeId);
|
|
89
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
90
|
-
style = (style || new CSSStyleSheet());
|
|
91
|
-
if (typeof style === 'string') {
|
|
92
|
-
style = cssText;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
style.replaceSync(cssText);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
style = cssText;
|
|
100
|
-
}
|
|
101
|
-
styles.set(scopeId, style);
|
|
102
|
-
};
|
|
103
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
104
|
-
let scopeId = getScopeId(cmpMeta);
|
|
105
|
-
const style = styles.get(scopeId);
|
|
106
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
107
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
108
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
109
|
-
if (style) {
|
|
110
|
-
if (typeof style === 'string') {
|
|
111
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
112
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
113
|
-
let styleElm;
|
|
114
|
-
if (!appliedStyles) {
|
|
115
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
116
|
-
}
|
|
117
|
-
if (!appliedStyles.has(scopeId)) {
|
|
118
|
-
{
|
|
119
|
-
if (plt.$cssShim$) {
|
|
120
|
-
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
|
|
121
|
-
const newScopeId = styleElm['s-sc'];
|
|
122
|
-
if (newScopeId) {
|
|
123
|
-
scopeId = newScopeId;
|
|
124
|
-
// we don't want to add this styleID to the appliedStyles Set
|
|
125
|
-
// since the cssVarShim might need to apply several different
|
|
126
|
-
// stylesheets for the same component
|
|
127
|
-
appliedStyles = null;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
styleElm = doc.createElement('style');
|
|
132
|
-
styleElm.innerHTML = style;
|
|
133
|
-
}
|
|
134
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
135
|
-
}
|
|
136
|
-
if (appliedStyles) {
|
|
137
|
-
appliedStyles.add(scopeId);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
142
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return scopeId;
|
|
146
|
-
};
|
|
147
|
-
const attachStyles = (hostRef) => {
|
|
148
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
149
|
-
const elm = hostRef.$hostElement$;
|
|
150
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
151
|
-
addStyle(elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
|
|
152
|
-
endAttachStyles();
|
|
153
|
-
};
|
|
154
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
36
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
37
|
+
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
155
38
|
/**
|
|
156
39
|
* Default style mode id
|
|
157
40
|
*/
|
|
@@ -165,11 +48,30 @@ const EMPTY_OBJ = {};
|
|
|
165
48
|
*/
|
|
166
49
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
167
50
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
51
|
+
/**
|
|
52
|
+
* Check whether a value is a 'complex type', defined here as an object or a
|
|
53
|
+
* function.
|
|
54
|
+
*
|
|
55
|
+
* @param o the value to check
|
|
56
|
+
* @returns whether it's a complex type or not
|
|
57
|
+
*/
|
|
168
58
|
const isComplexType = (o) => {
|
|
169
59
|
// https://jsperf.com/typeof-fn-object/5
|
|
170
60
|
o = typeof o;
|
|
171
61
|
return o === 'object' || o === 'function';
|
|
172
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
|
65
|
+
* out of a DOM's head.
|
|
66
|
+
*
|
|
67
|
+
* @param doc The DOM containing the `head` to query against
|
|
68
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
69
|
+
* exists or the tag has no content.
|
|
70
|
+
*/
|
|
71
|
+
function queryNonceMetaTagContent(doc) {
|
|
72
|
+
var _a, _b, _c;
|
|
73
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
74
|
+
}
|
|
173
75
|
/**
|
|
174
76
|
* Production h() function based on Preact by
|
|
175
77
|
* Jason Miller (@developit)
|
|
@@ -178,7 +80,6 @@ const isComplexType = (o) => {
|
|
|
178
80
|
*
|
|
179
81
|
* Modified for Stencil's compiler and vdom
|
|
180
82
|
*/
|
|
181
|
-
// const stack: any[] = [];
|
|
182
83
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
183
84
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
184
85
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -248,6 +149,14 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
248
149
|
}
|
|
249
150
|
return vnode;
|
|
250
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* A utility function for creating a virtual DOM node from a tag and some
|
|
154
|
+
* possible text content.
|
|
155
|
+
*
|
|
156
|
+
* @param tag the tag for this element
|
|
157
|
+
* @param text possible text content for the node
|
|
158
|
+
* @returns a newly-minted virtual DOM node
|
|
159
|
+
*/
|
|
251
160
|
const newVNode = (tag, text) => {
|
|
252
161
|
const vnode = {
|
|
253
162
|
$flags$: 0,
|
|
@@ -268,11 +177,31 @@ const newVNode = (tag, text) => {
|
|
|
268
177
|
return vnode;
|
|
269
178
|
};
|
|
270
179
|
const Host = {};
|
|
180
|
+
/**
|
|
181
|
+
* Check whether a given node is a Host node or not
|
|
182
|
+
*
|
|
183
|
+
* @param node the virtual DOM node to check
|
|
184
|
+
* @returns whether it's a Host node or not
|
|
185
|
+
*/
|
|
271
186
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
187
|
+
/**
|
|
188
|
+
* Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
|
|
189
|
+
*
|
|
190
|
+
* Note that these functions convert from {@link d.VNode} to
|
|
191
|
+
* {@link d.ChildNode} to give functional component developers a friendly
|
|
192
|
+
* interface.
|
|
193
|
+
*/
|
|
272
194
|
const vdomFnUtils = {
|
|
273
195
|
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
274
196
|
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
275
197
|
};
|
|
198
|
+
/**
|
|
199
|
+
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
|
200
|
+
* friendlier public interface (hence, 'convertToPublic').
|
|
201
|
+
*
|
|
202
|
+
* @param node the virtual DOM node to convert
|
|
203
|
+
* @returns a converted child node
|
|
204
|
+
*/
|
|
276
205
|
const convertToPublic = (node) => ({
|
|
277
206
|
vattrs: node.$attrs$,
|
|
278
207
|
vchildren: node.$children$,
|
|
@@ -281,6 +210,15 @@ const convertToPublic = (node) => ({
|
|
|
281
210
|
vtag: node.$tag$,
|
|
282
211
|
vtext: node.$text$,
|
|
283
212
|
});
|
|
213
|
+
/**
|
|
214
|
+
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
|
215
|
+
* order to use the resulting object in the virtual DOM. The initial object was
|
|
216
|
+
* likely created as part of presenting a public API, so converting it back
|
|
217
|
+
* involved making it 'private' again (hence, `convertToPrivate`).
|
|
218
|
+
*
|
|
219
|
+
* @param node the child node to convert
|
|
220
|
+
* @returns a converted virtual DOM node
|
|
221
|
+
*/
|
|
284
222
|
const convertToPrivate = (node) => {
|
|
285
223
|
if (typeof node.vtag === 'function') {
|
|
286
224
|
const vnodeData = Object.assign({}, node.vattrs);
|
|
@@ -299,6 +237,141 @@ const convertToPrivate = (node) => {
|
|
|
299
237
|
vnode.$name$ = node.vname;
|
|
300
238
|
return vnode;
|
|
301
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Parse a new property value for a given property type.
|
|
242
|
+
*
|
|
243
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
244
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
245
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
246
|
+
* 2. the type stored from `propType`.
|
|
247
|
+
*
|
|
248
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
249
|
+
*
|
|
250
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
251
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
252
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
253
|
+
* ```tsx
|
|
254
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* HTML prop values on the other hand, will always a string
|
|
258
|
+
*
|
|
259
|
+
* @param propValue the new value to coerce to some type
|
|
260
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
261
|
+
* @returns the parsed/coerced value
|
|
262
|
+
*/
|
|
263
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
264
|
+
// ensure this value is of the correct prop type
|
|
265
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
266
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
267
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
268
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
269
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
270
|
+
}
|
|
271
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
272
|
+
// force it to be a number
|
|
273
|
+
return parseFloat(propValue);
|
|
274
|
+
}
|
|
275
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
276
|
+
// could have been passed as a number or boolean
|
|
277
|
+
// but we still want it as a string
|
|
278
|
+
return String(propValue);
|
|
279
|
+
}
|
|
280
|
+
// redundant return here for better minification
|
|
281
|
+
return propValue;
|
|
282
|
+
}
|
|
283
|
+
// not sure exactly what type we want
|
|
284
|
+
// so no need to change to a different type
|
|
285
|
+
return propValue;
|
|
286
|
+
};
|
|
287
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
288
|
+
const createEvent = (ref, name, flags) => {
|
|
289
|
+
const elm = getElement(ref);
|
|
290
|
+
return {
|
|
291
|
+
emit: (detail) => {
|
|
292
|
+
return emitEvent(elm, name, {
|
|
293
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
294
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
295
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
296
|
+
detail,
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
303
|
+
* @param elm the target of the Event
|
|
304
|
+
* @param name the name to give the custom Event
|
|
305
|
+
* @param opts options for configuring a custom Event
|
|
306
|
+
* @returns the custom Event
|
|
307
|
+
*/
|
|
308
|
+
const emitEvent = (elm, name, opts) => {
|
|
309
|
+
const ev = plt.ce(name, opts);
|
|
310
|
+
elm.dispatchEvent(ev);
|
|
311
|
+
return ev;
|
|
312
|
+
};
|
|
313
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
314
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
315
|
+
let style = styles.get(scopeId);
|
|
316
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
317
|
+
style = (style || new CSSStyleSheet());
|
|
318
|
+
if (typeof style === 'string') {
|
|
319
|
+
style = cssText;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
style.replaceSync(cssText);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
style = cssText;
|
|
327
|
+
}
|
|
328
|
+
styles.set(scopeId, style);
|
|
329
|
+
};
|
|
330
|
+
const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
331
|
+
var _a;
|
|
332
|
+
const scopeId = getScopeId(cmpMeta);
|
|
333
|
+
const style = styles.get(scopeId);
|
|
334
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
335
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
336
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
337
|
+
if (style) {
|
|
338
|
+
if (typeof style === 'string') {
|
|
339
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
340
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
341
|
+
let styleElm;
|
|
342
|
+
if (!appliedStyles) {
|
|
343
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
344
|
+
}
|
|
345
|
+
if (!appliedStyles.has(scopeId)) {
|
|
346
|
+
{
|
|
347
|
+
styleElm = doc.createElement('style');
|
|
348
|
+
styleElm.innerHTML = style;
|
|
349
|
+
// Apply CSP nonce to the style tag if it exists
|
|
350
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
351
|
+
if (nonce != null) {
|
|
352
|
+
styleElm.setAttribute('nonce', nonce);
|
|
353
|
+
}
|
|
354
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
355
|
+
}
|
|
356
|
+
if (appliedStyles) {
|
|
357
|
+
appliedStyles.add(scopeId);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
362
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return scopeId;
|
|
366
|
+
};
|
|
367
|
+
const attachStyles = (hostRef) => {
|
|
368
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
369
|
+
const elm = hostRef.$hostElement$;
|
|
370
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
371
|
+
addStyle(elm.getRootNode(), cmpMeta);
|
|
372
|
+
endAttachStyles();
|
|
373
|
+
};
|
|
374
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
302
375
|
/**
|
|
303
376
|
* Production setAccessor() function based on Preact by
|
|
304
377
|
* Jason Miller (@developit)
|
|
@@ -435,7 +508,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
435
508
|
}
|
|
436
509
|
}
|
|
437
510
|
}
|
|
438
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
511
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
439
512
|
newValue = newValue === true ? '' : newValue;
|
|
440
513
|
if (xlink) {
|
|
441
514
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
@@ -453,7 +526,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
453
526
|
// if the element passed in is a shadow root, which is a document fragment
|
|
454
527
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
455
528
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
456
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
529
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
457
530
|
? newVnode.$elm$.host
|
|
458
531
|
: newVnode.$elm$;
|
|
459
532
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -471,6 +544,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
471
544
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
472
545
|
}
|
|
473
546
|
};
|
|
547
|
+
/**
|
|
548
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
549
|
+
*
|
|
550
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
551
|
+
* @param newParentVNode the parent VNode from the current render
|
|
552
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
553
|
+
* children, for which we will create a new DOM node
|
|
554
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
555
|
+
* @returns the newly created node
|
|
556
|
+
*/
|
|
474
557
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
475
558
|
// tslint:disable-next-line: prefer-const
|
|
476
559
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -484,16 +567,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
484
567
|
if (newVNode.$tag$ === 'slot') {
|
|
485
568
|
newVNode.$flags$ |= newVNode.$children$
|
|
486
569
|
? // slot element has fallback content
|
|
487
|
-
2 /* isSlotFallback */
|
|
570
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
488
571
|
: // slot element does not have fallback content
|
|
489
|
-
1 /* isSlotReference */;
|
|
572
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
490
573
|
}
|
|
491
574
|
}
|
|
492
575
|
if (newVNode.$text$ !== null) {
|
|
493
576
|
// create text node
|
|
494
577
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
495
578
|
}
|
|
496
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
579
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
497
580
|
// create a slot reference node
|
|
498
581
|
elm = newVNode.$elm$ =
|
|
499
582
|
doc.createTextNode('');
|
|
@@ -503,7 +586,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
503
586
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
504
587
|
}
|
|
505
588
|
// create element
|
|
506
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
589
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
507
590
|
? 'slot-fb'
|
|
508
591
|
: newVNode.$tag$)
|
|
509
592
|
);
|
|
@@ -538,7 +621,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
538
621
|
}
|
|
539
622
|
{
|
|
540
623
|
elm['s-hn'] = hostTagName;
|
|
541
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
624
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
542
625
|
// remember the content reference comment
|
|
543
626
|
elm['s-sr'] = true;
|
|
544
627
|
// remember the content reference comment
|
|
@@ -557,7 +640,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
557
640
|
return elm;
|
|
558
641
|
};
|
|
559
642
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
560
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
643
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
561
644
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
562
645
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
563
646
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -578,8 +661,23 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
578
661
|
putBackInOriginalLocation(childNode, recursive);
|
|
579
662
|
}
|
|
580
663
|
}
|
|
581
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
664
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
582
665
|
};
|
|
666
|
+
/**
|
|
667
|
+
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
668
|
+
* add them to the DOM in the appropriate place.
|
|
669
|
+
*
|
|
670
|
+
* @param parentElm the DOM node which should be used as a parent for the new
|
|
671
|
+
* DOM nodes
|
|
672
|
+
* @param before a child of the `parentElm` which the new children should be
|
|
673
|
+
* inserted before (optional)
|
|
674
|
+
* @param parentVNode the parent virtual DOM node
|
|
675
|
+
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
|
676
|
+
* @param startIdx the index in the child virtual DOM nodes at which to start
|
|
677
|
+
* creating DOM nodes (inclusive)
|
|
678
|
+
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
|
679
|
+
* creating DOM nodes (inclusive)
|
|
680
|
+
*/
|
|
583
681
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
584
682
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
585
683
|
let childNode;
|
|
@@ -593,30 +691,112 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
593
691
|
}
|
|
594
692
|
}
|
|
595
693
|
};
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
694
|
+
/**
|
|
695
|
+
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
|
696
|
+
* This can be used to, for instance, clean up after a list of children which
|
|
697
|
+
* should no longer be shown.
|
|
698
|
+
*
|
|
699
|
+
* This function also handles some of Stencil's slot relocation logic.
|
|
700
|
+
*
|
|
701
|
+
* @param vnodes a list of virtual DOM nodes to remove
|
|
702
|
+
* @param startIdx the index at which to start removing nodes (inclusive)
|
|
703
|
+
* @param endIdx the index at which to stop removing nodes (inclusive)
|
|
704
|
+
*/
|
|
705
|
+
const removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
706
|
+
for (let index = startIdx; index <= endIdx; ++index) {
|
|
707
|
+
const vnode = vnodes[index];
|
|
708
|
+
if (vnode) {
|
|
709
|
+
const elm = vnode.$elm$;
|
|
710
|
+
nullifyVNodeRefs(vnode);
|
|
711
|
+
if (elm) {
|
|
712
|
+
{
|
|
713
|
+
// we're removing this element
|
|
714
|
+
// so it's possible we need to show slot fallback content now
|
|
715
|
+
checkSlotFallbackVisibility = true;
|
|
716
|
+
if (elm['s-ol']) {
|
|
717
|
+
// remove the original location comment
|
|
718
|
+
elm['s-ol'].remove();
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
// it's possible that child nodes of the node
|
|
722
|
+
// that's being removed are slot nodes
|
|
723
|
+
putBackInOriginalLocation(elm, true);
|
|
724
|
+
}
|
|
613
725
|
}
|
|
726
|
+
// remove the vnode's element from the dom
|
|
727
|
+
elm.remove();
|
|
614
728
|
}
|
|
615
|
-
// remove the vnode's element from the dom
|
|
616
|
-
elm.remove();
|
|
617
729
|
}
|
|
618
730
|
}
|
|
619
731
|
};
|
|
732
|
+
/**
|
|
733
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
734
|
+
* traversing the two collections of children, identifying nodes that are
|
|
735
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
736
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
737
|
+
*
|
|
738
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
739
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
740
|
+
* 'windows' by storing start and end indices and references to the
|
|
741
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
742
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
743
|
+
* no children left to update by doing the following:
|
|
744
|
+
*
|
|
745
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
746
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
747
|
+
* only with a window bounded by the highlighted elements:
|
|
748
|
+
*
|
|
749
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
750
|
+
* ^^^^^^ ^^^^^^
|
|
751
|
+
*
|
|
752
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
753
|
+
* across the windows. This will basically detect elements which haven't
|
|
754
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
755
|
+
* VNode elements (represented as HTML):
|
|
756
|
+
*
|
|
757
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
758
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
759
|
+
*
|
|
760
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
761
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
762
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
763
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
764
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
765
|
+
*
|
|
766
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
767
|
+
* window corresponds to the element at the end of the other window. This is
|
|
768
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
769
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
770
|
+
* children nodes themselves have not changed but merely moved in the
|
|
771
|
+
* following example:
|
|
772
|
+
*
|
|
773
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
774
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
775
|
+
*
|
|
776
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
777
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
778
|
+
* DOM.
|
|
779
|
+
*
|
|
780
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
781
|
+
* nodes in the old children which have the same key as the first element in
|
|
782
|
+
* our window on the new children. If we find such a node we handle calling
|
|
783
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
784
|
+
* what we find.
|
|
785
|
+
*
|
|
786
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
787
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
788
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
789
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
790
|
+
* children has collapsed we still have more nodes on the new children that
|
|
791
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
792
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
793
|
+
* sure the corresponding DOM nodes are removed.
|
|
794
|
+
*
|
|
795
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
796
|
+
* @param oldCh the old children of the parent node
|
|
797
|
+
* @param newVNode the new VNode which will replace the parent
|
|
798
|
+
* @param newCh the new children of the parent node
|
|
799
|
+
*/
|
|
620
800
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
621
801
|
let oldStartIdx = 0;
|
|
622
802
|
let newStartIdx = 0;
|
|
@@ -632,7 +812,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
632
812
|
let elmToMove;
|
|
633
813
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
634
814
|
if (oldStartVnode == null) {
|
|
635
|
-
//
|
|
815
|
+
// VNode might have been moved left
|
|
636
816
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
637
817
|
}
|
|
638
818
|
else if (oldEndVnode == null) {
|
|
@@ -645,37 +825,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
645
825
|
newEndVnode = newCh[--newEndIdx];
|
|
646
826
|
}
|
|
647
827
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
828
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
829
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
830
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
831
|
+
// since things are matched up in order.
|
|
648
832
|
patch(oldStartVnode, newStartVnode);
|
|
649
833
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
650
834
|
newStartVnode = newCh[++newStartIdx];
|
|
651
835
|
}
|
|
652
836
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
837
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
838
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
839
|
+
// need to move any DOM Nodes.
|
|
653
840
|
patch(oldEndVnode, newEndVnode);
|
|
654
841
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
655
842
|
newEndVnode = newCh[--newEndIdx];
|
|
656
843
|
}
|
|
657
844
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
658
|
-
// Vnode moved right
|
|
845
|
+
// case: "Vnode moved right"
|
|
846
|
+
//
|
|
847
|
+
// We've found that the last node in our window on the new children is
|
|
848
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
849
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
850
|
+
// nodes:
|
|
851
|
+
//
|
|
852
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
853
|
+
// ^^^^^^^^^^^
|
|
854
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
855
|
+
// ^^^^^^^^^^^^^
|
|
856
|
+
//
|
|
857
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
858
|
+
// and move the DOM element for `oldStartVnode`.
|
|
659
859
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
660
860
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
661
861
|
}
|
|
662
862
|
patch(oldStartVnode, newEndVnode);
|
|
863
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
864
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
865
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
866
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
867
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
868
|
+
//
|
|
869
|
+
// <old-start-node />
|
|
870
|
+
// <some-intervening-node />
|
|
871
|
+
// <old-end-node />
|
|
872
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
873
|
+
// <next-sibling />
|
|
874
|
+
//
|
|
875
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
876
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
877
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
878
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
879
|
+
// append it to the children of the parent element.
|
|
663
880
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
664
881
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
665
882
|
newEndVnode = newCh[--newEndIdx];
|
|
666
883
|
}
|
|
667
884
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
668
|
-
// Vnode moved left
|
|
885
|
+
// case: "Vnode moved left"
|
|
886
|
+
//
|
|
887
|
+
// We've found that the first node in our window on the new children is
|
|
888
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
889
|
+
// Visually, this is the layout of these two nodes:
|
|
890
|
+
//
|
|
891
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
892
|
+
// ^^^^^^^^^^^^^
|
|
893
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
894
|
+
// ^^^^^^^^^^^
|
|
895
|
+
//
|
|
896
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
897
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
898
|
+
// children etc) but we also need to move the DOM node to which
|
|
899
|
+
// `oldEndVnode` corresponds.
|
|
669
900
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
670
901
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
671
902
|
}
|
|
672
903
|
patch(oldEndVnode, newStartVnode);
|
|
904
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
905
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
906
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
907
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
908
|
+
// future.
|
|
673
909
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
674
910
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
675
911
|
newStartVnode = newCh[++newStartIdx];
|
|
676
912
|
}
|
|
677
913
|
else {
|
|
678
|
-
//
|
|
914
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
915
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
916
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
917
|
+
// component.
|
|
918
|
+
//
|
|
919
|
+
// First we check to see if there are any nodes in the array of old
|
|
920
|
+
// children which have the same key as the first node in the new
|
|
921
|
+
// children.
|
|
679
922
|
idxInOld = -1;
|
|
680
923
|
{
|
|
681
924
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
@@ -686,23 +929,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
686
929
|
}
|
|
687
930
|
}
|
|
688
931
|
if (idxInOld >= 0) {
|
|
932
|
+
// We found a node in the old children which matches up with the first
|
|
933
|
+
// node in the new children! So let's deal with that
|
|
689
934
|
elmToMove = oldCh[idxInOld];
|
|
690
935
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
936
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
691
937
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
692
938
|
}
|
|
693
939
|
else {
|
|
694
940
|
patch(elmToMove, newStartVnode);
|
|
941
|
+
// invalidate the matching old node so that we won't try to update it
|
|
942
|
+
// again later on
|
|
695
943
|
oldCh[idxInOld] = undefined;
|
|
696
944
|
node = elmToMove.$elm$;
|
|
697
945
|
}
|
|
698
946
|
newStartVnode = newCh[++newStartIdx];
|
|
699
947
|
}
|
|
700
948
|
else {
|
|
701
|
-
//
|
|
949
|
+
// We either didn't find an element in the old children that matches
|
|
950
|
+
// the key of the first new child OR the build is not using `key`
|
|
951
|
+
// attributes at all. In either case we need to create a new element
|
|
952
|
+
// for the new node.
|
|
702
953
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
703
954
|
newStartVnode = newCh[++newStartIdx];
|
|
704
955
|
}
|
|
705
956
|
if (node) {
|
|
957
|
+
// if we created a new node then handle inserting it to the DOM
|
|
706
958
|
{
|
|
707
959
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
708
960
|
}
|
|
@@ -710,21 +962,44 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
710
962
|
}
|
|
711
963
|
}
|
|
712
964
|
if (oldStartIdx > oldEndIdx) {
|
|
965
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
713
966
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
714
967
|
}
|
|
715
968
|
else if (newStartIdx > newEndIdx) {
|
|
969
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
970
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
971
|
+
// relevant DOM nodes)
|
|
716
972
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
717
973
|
}
|
|
718
974
|
};
|
|
719
|
-
|
|
975
|
+
/**
|
|
976
|
+
* Compare two VNodes to determine if they are the same
|
|
977
|
+
*
|
|
978
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
979
|
+
* information set on the two VNodes and can be misleading under certain
|
|
980
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
981
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
982
|
+
* checking that they have the same tag.
|
|
983
|
+
*
|
|
984
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
985
|
+
* changing order within a `children` array or something along those lines then
|
|
986
|
+
* we could obtain a false negative and then have to do needless re-rendering
|
|
987
|
+
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
|
988
|
+
*
|
|
989
|
+
* @param leftVNode the first VNode to check
|
|
990
|
+
* @param rightVNode the second VNode to check
|
|
991
|
+
* @returns whether they're equal or not
|
|
992
|
+
*/
|
|
993
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
720
994
|
// compare if two vnode to see if they're "technically" the same
|
|
721
995
|
// need to have the same element tag, and same key to be the same
|
|
722
|
-
if (
|
|
723
|
-
if (
|
|
724
|
-
return
|
|
996
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
997
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
998
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
725
999
|
}
|
|
1000
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
726
1001
|
{
|
|
727
|
-
return
|
|
1002
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
728
1003
|
}
|
|
729
1004
|
}
|
|
730
1005
|
return false;
|
|
@@ -737,6 +1012,14 @@ const referenceNode = (node) => {
|
|
|
737
1012
|
return (node && node['s-ol']) || node;
|
|
738
1013
|
};
|
|
739
1014
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
1015
|
+
/**
|
|
1016
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
1017
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
1018
|
+
* children of the two nodes (if any).
|
|
1019
|
+
*
|
|
1020
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
1021
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
1022
|
+
*/
|
|
740
1023
|
const patch = (oldVNode, newVNode) => {
|
|
741
1024
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
742
1025
|
const oldChildren = oldVNode.$children$;
|
|
@@ -750,7 +1033,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
750
1033
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
751
1034
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
752
1035
|
}
|
|
753
|
-
// element node
|
|
754
1036
|
{
|
|
755
1037
|
if (tag === 'slot')
|
|
756
1038
|
;
|
|
@@ -763,6 +1045,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
763
1045
|
}
|
|
764
1046
|
if (oldChildren !== null && newChildren !== null) {
|
|
765
1047
|
// looks like there's child vnodes for both the old and new vnodes
|
|
1048
|
+
// so we need to call `updateChildren` to reconcile them
|
|
766
1049
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
767
1050
|
}
|
|
768
1051
|
else if (newChildren !== null) {
|
|
@@ -803,7 +1086,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
803
1086
|
let nodeType;
|
|
804
1087
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
805
1088
|
childNode = childNodes[i];
|
|
806
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1089
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
807
1090
|
if (childNode['s-sr']) {
|
|
808
1091
|
// this is a slot fallback node
|
|
809
1092
|
// get the slot name for this slot reference node
|
|
@@ -815,7 +1098,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
815
1098
|
nodeType = childNodes[j].nodeType;
|
|
816
1099
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
817
1100
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
818
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
1101
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
819
1102
|
childNode.hidden = true;
|
|
820
1103
|
break;
|
|
821
1104
|
}
|
|
@@ -824,8 +1107,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
824
1107
|
// this is a default fallback slot node
|
|
825
1108
|
// any element or text node (with content)
|
|
826
1109
|
// should hide the default fallback slot node
|
|
827
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
828
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
1110
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
1111
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
829
1112
|
childNode.hidden = true;
|
|
830
1113
|
break;
|
|
831
1114
|
}
|
|
@@ -903,13 +1186,13 @@ const relocateSlotContent = (elm) => {
|
|
|
903
1186
|
}
|
|
904
1187
|
}
|
|
905
1188
|
}
|
|
906
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
1189
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
907
1190
|
relocateSlotContent(childNode);
|
|
908
1191
|
}
|
|
909
1192
|
}
|
|
910
1193
|
};
|
|
911
1194
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
912
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1195
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
913
1196
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
914
1197
|
return true;
|
|
915
1198
|
}
|
|
@@ -923,12 +1206,31 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
|
923
1206
|
}
|
|
924
1207
|
return slotNameAttr === '';
|
|
925
1208
|
};
|
|
926
|
-
|
|
1209
|
+
/**
|
|
1210
|
+
* 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
|
|
1211
|
+
* calling them with `null`. This signals that the DOM element corresponding to
|
|
1212
|
+
* the VDom node has been removed from the DOM.
|
|
1213
|
+
*
|
|
1214
|
+
* @param vNode a virtual DOM node
|
|
1215
|
+
*/
|
|
1216
|
+
const nullifyVNodeRefs = (vNode) => {
|
|
927
1217
|
{
|
|
928
1218
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
929
|
-
vNode.$children$ && vNode.$children$.map(
|
|
1219
|
+
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
930
1220
|
}
|
|
931
1221
|
};
|
|
1222
|
+
/**
|
|
1223
|
+
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
1224
|
+
*
|
|
1225
|
+
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
1226
|
+
* function will handle creating a virtual DOM tree with a single root, patching
|
|
1227
|
+
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
1228
|
+
* relocation, and reflecting attributes.
|
|
1229
|
+
*
|
|
1230
|
+
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
1231
|
+
* the DOM node into which it should be rendered.
|
|
1232
|
+
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
1233
|
+
*/
|
|
932
1234
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
933
1235
|
const hostElm = hostRef.$hostElement$;
|
|
934
1236
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -940,12 +1242,12 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
940
1242
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
941
1243
|
}
|
|
942
1244
|
rootVnode.$tag$ = null;
|
|
943
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1245
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
944
1246
|
hostRef.$vnode$ = rootVnode;
|
|
945
1247
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
946
1248
|
{
|
|
947
1249
|
contentRef = hostElm['s-cr'];
|
|
948
|
-
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1250
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
949
1251
|
// always reset
|
|
950
1252
|
checkSlotFallbackVisibility = false;
|
|
951
1253
|
}
|
|
@@ -954,7 +1256,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
954
1256
|
{
|
|
955
1257
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
956
1258
|
// the disconnectCallback from working
|
|
957
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1259
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
958
1260
|
if (checkSlotRelocate) {
|
|
959
1261
|
relocateSlotContent(rootVnode.$elm$);
|
|
960
1262
|
let relocateData;
|
|
@@ -1012,7 +1314,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1012
1314
|
}
|
|
1013
1315
|
else {
|
|
1014
1316
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
1015
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1317
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
1016
1318
|
nodeToRelocate.hidden = true;
|
|
1017
1319
|
}
|
|
1018
1320
|
}
|
|
@@ -1023,37 +1325,11 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1023
1325
|
}
|
|
1024
1326
|
// done moving nodes around
|
|
1025
1327
|
// allow the disconnect callback to work again
|
|
1026
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1328
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
1027
1329
|
// always reset
|
|
1028
1330
|
relocateNodes.length = 0;
|
|
1029
1331
|
}
|
|
1030
1332
|
};
|
|
1031
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1032
|
-
const createEvent = (ref, name, flags) => {
|
|
1033
|
-
const elm = getElement(ref);
|
|
1034
|
-
return {
|
|
1035
|
-
emit: (detail) => {
|
|
1036
|
-
return emitEvent(elm, name, {
|
|
1037
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1038
|
-
composed: !!(flags & 2 /* Composed */),
|
|
1039
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1040
|
-
detail,
|
|
1041
|
-
});
|
|
1042
|
-
},
|
|
1043
|
-
};
|
|
1044
|
-
};
|
|
1045
|
-
/**
|
|
1046
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
1047
|
-
* @param elm the target of the Event
|
|
1048
|
-
* @param name the name to give the custom Event
|
|
1049
|
-
* @param opts options for configuring a custom Event
|
|
1050
|
-
* @returns the custom Event
|
|
1051
|
-
*/
|
|
1052
|
-
const emitEvent = (elm, name, opts) => {
|
|
1053
|
-
const ev = plt.ce(name, opts);
|
|
1054
|
-
elm.dispatchEvent(ev);
|
|
1055
|
-
return ev;
|
|
1056
|
-
};
|
|
1057
1333
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1058
1334
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1059
1335
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -1061,10 +1337,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
1061
1337
|
};
|
|
1062
1338
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1063
1339
|
{
|
|
1064
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1340
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1065
1341
|
}
|
|
1066
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1067
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1342
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1343
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
1068
1344
|
return;
|
|
1069
1345
|
}
|
|
1070
1346
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -1074,30 +1350,86 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1074
1350
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1075
1351
|
return writeTask(dispatch) ;
|
|
1076
1352
|
};
|
|
1353
|
+
/**
|
|
1354
|
+
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
|
1355
|
+
* component lifecycle methods like `componentWillLoad` as well as
|
|
1356
|
+
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
|
1357
|
+
*
|
|
1358
|
+
* @param hostRef a reference to a host DOM node
|
|
1359
|
+
* @param isInitialLoad whether we're on the initial load or not
|
|
1360
|
+
* @returns an empty Promise which is used to enqueue a series of operations for
|
|
1361
|
+
* the component
|
|
1362
|
+
*/
|
|
1077
1363
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1078
1364
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1079
1365
|
const instance = hostRef.$lazyInstance$ ;
|
|
1080
|
-
|
|
1366
|
+
// We're going to use this variable together with `enqueue` to implement a
|
|
1367
|
+
// little promise-based queue. We start out with it `undefined`. When we add
|
|
1368
|
+
// the first function to the queue we'll set this variable to be that
|
|
1369
|
+
// function's return value. When we attempt to add subsequent values to the
|
|
1370
|
+
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
|
1371
|
+
// the new function off of that `Promise` using `.then()`. This will give our
|
|
1372
|
+
// queue two nice properties:
|
|
1373
|
+
//
|
|
1374
|
+
// 1. If all functions added to the queue are synchronous they'll be called
|
|
1375
|
+
// synchronously right away.
|
|
1376
|
+
// 2. If all functions added to the queue are asynchronous they'll all be
|
|
1377
|
+
// called in order after `dispatchHooks` exits.
|
|
1378
|
+
let maybePromise;
|
|
1081
1379
|
if (isInitialLoad) {
|
|
1082
1380
|
{
|
|
1083
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1381
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
1084
1382
|
if (hostRef.$queuedListeners$) {
|
|
1085
1383
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1086
|
-
hostRef.$queuedListeners$ =
|
|
1384
|
+
hostRef.$queuedListeners$ = undefined;
|
|
1087
1385
|
}
|
|
1088
1386
|
}
|
|
1089
1387
|
{
|
|
1090
|
-
|
|
1388
|
+
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
|
1389
|
+
// whatever's going on in that `Promise` before we launch into
|
|
1390
|
+
// rendering the component, doing other lifecycle stuff, etc. So
|
|
1391
|
+
// in that case we assign the returned promise to the variable we
|
|
1392
|
+
// declared above to hold a possible 'queueing' Promise
|
|
1393
|
+
maybePromise = safeCall(instance, 'componentWillLoad');
|
|
1091
1394
|
}
|
|
1092
1395
|
}
|
|
1093
1396
|
{
|
|
1094
|
-
|
|
1397
|
+
maybePromise = enqueue(maybePromise, () => safeCall(instance, 'componentWillRender'));
|
|
1095
1398
|
}
|
|
1096
1399
|
endSchedule();
|
|
1097
|
-
return
|
|
1400
|
+
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1098
1401
|
};
|
|
1402
|
+
/**
|
|
1403
|
+
* This function uses a Promise to implement a simple first-in, first-out queue
|
|
1404
|
+
* of functions to be called.
|
|
1405
|
+
*
|
|
1406
|
+
* The queue is ordered on the basis of the first argument. If it's
|
|
1407
|
+
* `undefined`, then nothing is on the queue yet, so the provided function can
|
|
1408
|
+
* be called synchronously (although note that this function may return a
|
|
1409
|
+
* `Promise`). The idea is that then the return value of that enqueueing
|
|
1410
|
+
* operation is kept around, so that if it was a `Promise` then subsequent
|
|
1411
|
+
* functions can be enqueued by calling this function again with that `Promise`
|
|
1412
|
+
* as the first argument.
|
|
1413
|
+
*
|
|
1414
|
+
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
|
1415
|
+
* @param fn a function to enqueue
|
|
1416
|
+
* @returns either a `Promise` or the return value of the provided function
|
|
1417
|
+
*/
|
|
1418
|
+
const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
|
|
1419
|
+
/**
|
|
1420
|
+
* Check that a value is a `Promise`. To check, we first see if the value is an
|
|
1421
|
+
* instance of the `Promise` global. In a few circumstances, in particular if
|
|
1422
|
+
* the global has been overwritten, this is could be misleading, so we also do
|
|
1423
|
+
* a little 'duck typing' check to see if the `.then` property of the value is
|
|
1424
|
+
* defined and a function.
|
|
1425
|
+
*
|
|
1426
|
+
* @param maybePromise it might be a promise!
|
|
1427
|
+
* @returns whether it is or not
|
|
1428
|
+
*/
|
|
1429
|
+
const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
|
|
1430
|
+
(maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
|
|
1099
1431
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1100
|
-
|
|
1432
|
+
var _a;
|
|
1101
1433
|
const elm = hostRef.$hostElement$;
|
|
1102
1434
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1103
1435
|
const rc = elm['s-rc'];
|
|
@@ -1109,9 +1441,6 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1109
1441
|
{
|
|
1110
1442
|
callRender(hostRef, instance);
|
|
1111
1443
|
}
|
|
1112
|
-
if (plt.$cssShim$) {
|
|
1113
|
-
plt.$cssShim$.updateHost(elm);
|
|
1114
|
-
}
|
|
1115
1444
|
if (rc) {
|
|
1116
1445
|
// ok, so turns out there are some child host elements
|
|
1117
1446
|
// waiting on this parent element to load
|
|
@@ -1122,14 +1451,14 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1122
1451
|
endRender();
|
|
1123
1452
|
endUpdate();
|
|
1124
1453
|
{
|
|
1125
|
-
const childrenPromises = elm['s-p'];
|
|
1454
|
+
const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
|
|
1126
1455
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1127
1456
|
if (childrenPromises.length === 0) {
|
|
1128
1457
|
postUpdate();
|
|
1129
1458
|
}
|
|
1130
1459
|
else {
|
|
1131
1460
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1132
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1461
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1133
1462
|
childrenPromises.length = 0;
|
|
1134
1463
|
}
|
|
1135
1464
|
}
|
|
@@ -1139,10 +1468,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1139
1468
|
renderingRef = instance;
|
|
1140
1469
|
instance = instance.render && instance.render();
|
|
1141
1470
|
{
|
|
1142
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1471
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1143
1472
|
}
|
|
1144
1473
|
{
|
|
1145
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1474
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1146
1475
|
}
|
|
1147
1476
|
{
|
|
1148
1477
|
{
|
|
@@ -1171,8 +1500,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1171
1500
|
{
|
|
1172
1501
|
safeCall(instance, 'componentDidRender');
|
|
1173
1502
|
}
|
|
1174
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1175
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1503
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1504
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1176
1505
|
{
|
|
1177
1506
|
// DOM WRITE!
|
|
1178
1507
|
addHydratedFlag(elm);
|
|
@@ -1201,10 +1530,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1201
1530
|
hostRef.$onRenderResolve$();
|
|
1202
1531
|
hostRef.$onRenderResolve$ = undefined;
|
|
1203
1532
|
}
|
|
1204
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1533
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1205
1534
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1206
1535
|
}
|
|
1207
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1536
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1208
1537
|
}
|
|
1209
1538
|
// ( •_•)
|
|
1210
1539
|
// ( •_•)>⌐■-■
|
|
@@ -1215,7 +1544,7 @@ const forceUpdate = (ref) => {
|
|
|
1215
1544
|
const hostRef = getHostRef(ref);
|
|
1216
1545
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1217
1546
|
if (isConnected &&
|
|
1218
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1547
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1219
1548
|
scheduleUpdate(hostRef, false);
|
|
1220
1549
|
}
|
|
1221
1550
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -1241,58 +1570,8 @@ const safeCall = (instance, method, arg) => {
|
|
|
1241
1570
|
}
|
|
1242
1571
|
return undefined;
|
|
1243
1572
|
};
|
|
1244
|
-
const then = (promise, thenFn) => {
|
|
1245
|
-
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1246
|
-
};
|
|
1247
1573
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1248
1574
|
;
|
|
1249
|
-
/**
|
|
1250
|
-
* Parse a new property value for a given property type.
|
|
1251
|
-
*
|
|
1252
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
1253
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
1254
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
1255
|
-
* 2. the type stored from `propType`.
|
|
1256
|
-
*
|
|
1257
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
1258
|
-
*
|
|
1259
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
1260
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
1261
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
1262
|
-
* ```tsx
|
|
1263
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
1264
|
-
* ```
|
|
1265
|
-
*
|
|
1266
|
-
* HTML prop values on the other hand, will always a string
|
|
1267
|
-
*
|
|
1268
|
-
* @param propValue the new value to coerce to some type
|
|
1269
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
1270
|
-
* @returns the parsed/coerced value
|
|
1271
|
-
*/
|
|
1272
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
1273
|
-
// ensure this value is of the correct prop type
|
|
1274
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
1275
|
-
if (propType & 4 /* Boolean */) {
|
|
1276
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
1277
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1278
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1279
|
-
}
|
|
1280
|
-
if (propType & 2 /* Number */) {
|
|
1281
|
-
// force it to be a number
|
|
1282
|
-
return parseFloat(propValue);
|
|
1283
|
-
}
|
|
1284
|
-
if (propType & 1 /* String */) {
|
|
1285
|
-
// could have been passed as a number or boolean
|
|
1286
|
-
// but we still want it as a string
|
|
1287
|
-
return String(propValue);
|
|
1288
|
-
}
|
|
1289
|
-
// redundant return here for better minification
|
|
1290
|
-
return propValue;
|
|
1291
|
-
}
|
|
1292
|
-
// not sure exactly what type we want
|
|
1293
|
-
// so no need to change to a different type
|
|
1294
|
-
return propValue;
|
|
1295
|
-
};
|
|
1296
1575
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1297
1576
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1298
1577
|
// check our new property value against our internal value
|
|
@@ -1305,13 +1584,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1305
1584
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1306
1585
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1307
1586
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1308
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1587
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1309
1588
|
// gadzooks! the property's value has changed!!
|
|
1310
1589
|
// set our new value!
|
|
1311
1590
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1312
1591
|
if (instance) {
|
|
1313
1592
|
// get an array of method names of watch functions to call
|
|
1314
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1593
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1315
1594
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1316
1595
|
if (watchMethods) {
|
|
1317
1596
|
// this instance is watching for when this property changed
|
|
@@ -1326,7 +1605,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1326
1605
|
});
|
|
1327
1606
|
}
|
|
1328
1607
|
}
|
|
1329
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1608
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1330
1609
|
// looks like this value actually changed, so we've got work to do!
|
|
1331
1610
|
// but only if we've already rendered, otherwise just chill out
|
|
1332
1611
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1336,6 +1615,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1336
1615
|
}
|
|
1337
1616
|
}
|
|
1338
1617
|
};
|
|
1618
|
+
/**
|
|
1619
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
1620
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
1621
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
1622
|
+
*
|
|
1623
|
+
* @param Cstr the constructor for a component that we need to process
|
|
1624
|
+
* @param cmpMeta metadata collected previously about the component
|
|
1625
|
+
* @param flags a number used to store a series of bit flags
|
|
1626
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
1627
|
+
*/
|
|
1339
1628
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1340
1629
|
if (cmpMeta.$members$) {
|
|
1341
1630
|
if (Cstr.watchers) {
|
|
@@ -1345,8 +1634,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1345
1634
|
const members = Object.entries(cmpMeta.$members$);
|
|
1346
1635
|
const prototype = Cstr.prototype;
|
|
1347
1636
|
members.map(([memberName, [memberFlags]]) => {
|
|
1348
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1349
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1637
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1638
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1350
1639
|
// proxyComponent - prop
|
|
1351
1640
|
Object.defineProperty(prototype, memberName, {
|
|
1352
1641
|
get() {
|
|
@@ -1361,8 +1650,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1361
1650
|
enumerable: true,
|
|
1362
1651
|
});
|
|
1363
1652
|
}
|
|
1364
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1365
|
-
memberFlags & 64 /* Method */) {
|
|
1653
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1654
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1366
1655
|
// proxyComponent - method
|
|
1367
1656
|
Object.defineProperty(prototype, memberName, {
|
|
1368
1657
|
value(...args) {
|
|
@@ -1372,7 +1661,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1372
1661
|
});
|
|
1373
1662
|
}
|
|
1374
1663
|
});
|
|
1375
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1664
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1376
1665
|
const attrNameToPropName = new Map();
|
|
1377
1666
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1378
1667
|
plt.jmp(() => {
|
|
@@ -1428,11 +1717,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1428
1717
|
// create an array of attributes to observe
|
|
1429
1718
|
// and also create a map of html attribute name to js property name
|
|
1430
1719
|
Cstr.observedAttributes = members
|
|
1431
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1720
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1432
1721
|
.map(([propName, m]) => {
|
|
1433
1722
|
const attrName = m[1] || propName;
|
|
1434
1723
|
attrNameToPropName.set(attrName, propName);
|
|
1435
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1724
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1436
1725
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1437
1726
|
}
|
|
1438
1727
|
return attrName;
|
|
@@ -1443,10 +1732,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1443
1732
|
};
|
|
1444
1733
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1445
1734
|
// initializeComponent
|
|
1446
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1735
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1736
|
+
// Let the runtime know that the component has been initialized
|
|
1737
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1447
1738
|
{
|
|
1448
|
-
// we haven't initialized this element yet
|
|
1449
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1450
1739
|
// lazy loaded components
|
|
1451
1740
|
// request the component's implementation to be
|
|
1452
1741
|
// wired up with the host element
|
|
@@ -1464,7 +1753,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1464
1753
|
{
|
|
1465
1754
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1466
1755
|
}
|
|
1467
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1756
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1468
1757
|
Cstr.isProxied = true;
|
|
1469
1758
|
}
|
|
1470
1759
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1472,7 +1761,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1472
1761
|
// but let's keep track of when we start and stop
|
|
1473
1762
|
// so that the getters/setters don't incorrectly step on data
|
|
1474
1763
|
{
|
|
1475
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1764
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1476
1765
|
}
|
|
1477
1766
|
// construct the lazy-loaded component implementation
|
|
1478
1767
|
// passing the hostRef is very important during
|
|
@@ -1485,10 +1774,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1485
1774
|
consoleError(e);
|
|
1486
1775
|
}
|
|
1487
1776
|
{
|
|
1488
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1777
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1489
1778
|
}
|
|
1490
1779
|
{
|
|
1491
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1780
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1492
1781
|
}
|
|
1493
1782
|
endNewInstance();
|
|
1494
1783
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1499,7 +1788,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1499
1788
|
const scopeId = getScopeId(cmpMeta);
|
|
1500
1789
|
if (!styles.has(scopeId)) {
|
|
1501
1790
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1502
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1791
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1503
1792
|
endRegisterStyles();
|
|
1504
1793
|
}
|
|
1505
1794
|
}
|
|
@@ -1526,19 +1815,20 @@ const fireConnectedCallback = (instance) => {
|
|
|
1526
1815
|
}
|
|
1527
1816
|
};
|
|
1528
1817
|
const connectedCallback = (elm) => {
|
|
1529
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1818
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1530
1819
|
const hostRef = getHostRef(elm);
|
|
1531
1820
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1532
1821
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1533
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1822
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1534
1823
|
// first time this component has connected
|
|
1535
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1824
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1536
1825
|
{
|
|
1537
1826
|
// initUpdate
|
|
1538
1827
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1539
1828
|
// in here to act as original content anchors as we move nodes around
|
|
1540
1829
|
// host element has been connected to the DOM
|
|
1541
|
-
if ((
|
|
1830
|
+
if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
|
1831
|
+
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1542
1832
|
setContentReference(elm);
|
|
1543
1833
|
}
|
|
1544
1834
|
}
|
|
@@ -1561,7 +1851,7 @@ const connectedCallback = (elm) => {
|
|
|
1561
1851
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1562
1852
|
if (cmpMeta.$members$) {
|
|
1563
1853
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1564
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1854
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1565
1855
|
const value = elm[memberName];
|
|
1566
1856
|
delete elm[memberName];
|
|
1567
1857
|
elm[memberName] = value;
|
|
@@ -1599,7 +1889,7 @@ const setContentReference = (elm) => {
|
|
|
1599
1889
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1600
1890
|
};
|
|
1601
1891
|
const disconnectedCallback = (elm) => {
|
|
1602
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1892
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1603
1893
|
const hostRef = getHostRef(elm);
|
|
1604
1894
|
const instance = hostRef.$lazyInstance$ ;
|
|
1605
1895
|
{
|
|
@@ -1608,16 +1898,13 @@ const disconnectedCallback = (elm) => {
|
|
|
1608
1898
|
hostRef.$rmListeners$ = undefined;
|
|
1609
1899
|
}
|
|
1610
1900
|
}
|
|
1611
|
-
// clear CSS var-shim tracking
|
|
1612
|
-
if (plt.$cssShim$) {
|
|
1613
|
-
plt.$cssShim$.removeHost(elm);
|
|
1614
|
-
}
|
|
1615
1901
|
{
|
|
1616
1902
|
safeCall(instance, 'disconnectedCallback');
|
|
1617
1903
|
}
|
|
1618
1904
|
}
|
|
1619
1905
|
};
|
|
1620
1906
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1907
|
+
var _a;
|
|
1621
1908
|
const endBootstrap = createTime();
|
|
1622
1909
|
const cmpTags = [];
|
|
1623
1910
|
const exclude = options.exclude || [];
|
|
@@ -1682,13 +1969,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1682
1969
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1683
1970
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1684
1971
|
cmpTags.push(tagName);
|
|
1685
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1972
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1686
1973
|
}
|
|
1687
1974
|
});
|
|
1688
1975
|
});
|
|
1689
1976
|
{
|
|
1690
1977
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1691
1978
|
visibilityStyle.setAttribute('data-styles', '');
|
|
1979
|
+
// Apply CSP nonce to the style tag if it exists
|
|
1980
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
1981
|
+
if (nonce != null) {
|
|
1982
|
+
visibilityStyle.setAttribute('nonce', nonce);
|
|
1983
|
+
}
|
|
1692
1984
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
1693
1985
|
}
|
|
1694
1986
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -1704,7 +1996,48 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1704
1996
|
// Fallback appLoad event
|
|
1705
1997
|
endBootstrap();
|
|
1706
1998
|
};
|
|
1707
|
-
const
|
|
1999
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
2000
|
+
if (listeners) {
|
|
2001
|
+
listeners.map(([flags, name, method]) => {
|
|
2002
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
2003
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
2004
|
+
const opts = hostListenerOpts(flags);
|
|
2005
|
+
plt.ael(target, name, handler, opts);
|
|
2006
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
2010
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
2011
|
+
try {
|
|
2012
|
+
{
|
|
2013
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
2014
|
+
// instance is ready, let's call it's member method for this event
|
|
2015
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
2016
|
+
}
|
|
2017
|
+
else {
|
|
2018
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
catch (e) {
|
|
2023
|
+
consoleError(e);
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
2027
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
2028
|
+
return doc;
|
|
2029
|
+
return elm;
|
|
2030
|
+
};
|
|
2031
|
+
// prettier-ignore
|
|
2032
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
2033
|
+
/**
|
|
2034
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
|
2035
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
2036
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
|
2037
|
+
* @returns void
|
|
2038
|
+
*/
|
|
2039
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
2040
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1708
2041
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1709
2042
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1710
2043
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1770,14 +2103,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1770
2103
|
return importedModule[exportName];
|
|
1771
2104
|
}, consoleError);
|
|
1772
2105
|
};
|
|
1773
|
-
const styles = new Map();
|
|
2106
|
+
const styles = /*@__PURE__*/ new Map();
|
|
2107
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
2108
|
+
const doc = win.document || { head: {} };
|
|
2109
|
+
const plt = {
|
|
2110
|
+
$flags$: 0,
|
|
2111
|
+
$resourcesUrl$: '',
|
|
2112
|
+
jmp: (h) => h(),
|
|
2113
|
+
raf: (h) => requestAnimationFrame(h),
|
|
2114
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
2115
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
2116
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
2117
|
+
};
|
|
2118
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
2119
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
2120
|
+
try {
|
|
2121
|
+
new CSSStyleSheet();
|
|
2122
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
2123
|
+
}
|
|
2124
|
+
catch (e) { }
|
|
2125
|
+
return false;
|
|
2126
|
+
})()
|
|
2127
|
+
;
|
|
1774
2128
|
const queueDomReads = [];
|
|
1775
2129
|
const queueDomWrites = [];
|
|
1776
2130
|
const queueTask = (queue, write) => (cb) => {
|
|
1777
2131
|
queue.push(cb);
|
|
1778
2132
|
if (!queuePending) {
|
|
1779
2133
|
queuePending = true;
|
|
1780
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
2134
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1781
2135
|
nextTick(flush);
|
|
1782
2136
|
}
|
|
1783
2137
|
else {
|
|
@@ -1814,4 +2168,6 @@ const flush = () => {
|
|
|
1814
2168
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1815
2169
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1816
2170
|
|
|
1817
|
-
export {
|
|
2171
|
+
export { Host as H, getElement as a, bootstrapLazy as b, createEvent as c, forceUpdate as f, getRenderingRef as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
2172
|
+
|
|
2173
|
+
//# sourceMappingURL=index-f21f8a13.js.map
|