@revolist/revogrid 3.2.4 → 3.2.7
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/index.js +29217 -0
- package/custom-element/resize-observer.js +503 -0
- package/dist/cjs/css-shim-9f5bc84d.js +9 -0
- package/dist/cjs/debounce-6cea2774.js +578 -0
- package/dist/cjs/dom-fcb646f0.js +78 -0
- package/dist/{revo-grid/index-8a604c17.js → cjs/index-cb904e00.js} +230 -1445
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/loader.cjs.js +38 -0
- package/dist/cjs/resize-observer-bf327d6a.js +507 -0
- package/dist/cjs/revo-grid.cjs.js +79 -0
- package/dist/cjs/revo-grid_11.cjs.entry.js +28301 -0
- package/dist/cjs/revogr-clipboard.cjs.entry.js +56 -0
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +278 -0
- package/dist/collection/collection-manifest.json +25 -0
- package/dist/collection/components/button/button.js +7 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js +124 -0
- package/dist/collection/components/data/cellRenderer.js +27 -0
- package/dist/{revo-grid/columnService-91e552ba.js → collection/components/data/columnService.js} +6 -8
- package/dist/collection/components/data/revogr-data-style.css +135 -0
- package/dist/collection/components/data/revogr-data.js +325 -0
- package/dist/collection/components/data/rowRenderer.js +9 -0
- package/dist/collection/components/header/headerCellRenderer.js +29 -0
- package/dist/collection/components/header/headerRenderer.js +48 -0
- package/dist/collection/components/header/revogr-header-style.css +198 -0
- package/dist/collection/components/header/revogr-header.js +300 -0
- package/dist/collection/components/order/orderRenderer.js +53 -0
- package/dist/collection/components/order/revogr-order-editor.js +361 -0
- package/dist/collection/components/order/rowOrderService.js +71 -0
- package/dist/collection/components/overlay/autofill.service.js +185 -0
- package/dist/collection/components/overlay/clipboard.service.js +42 -0
- package/dist/collection/components/overlay/editors/edit.utils.js +8 -0
- package/dist/collection/components/overlay/editors/text.js +38 -0
- package/dist/collection/components/overlay/keyboard.service.js +131 -0
- package/dist/collection/components/overlay/revogr-edit-style.css +86 -0
- package/dist/collection/components/overlay/revogr-edit.js +162 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +729 -0
- package/dist/collection/components/overlay/revogr-overlay-style.css +98 -0
- package/dist/{revo-grid/selection.utils-a9932db6.js → collection/components/overlay/selection.utils.js} +9 -12
- package/dist/collection/components/revo-grid/revo-grid-style.css +544 -0
- package/dist/collection/components/revo-grid/revo-grid.js +2226 -0
- package/dist/collection/components/revo-grid/viewport.helpers.js +14 -0
- package/dist/collection/components/revo-grid/viewport.interfaces.js +4 -0
- package/dist/collection/components/revo-grid/viewport.js +21 -0
- package/dist/collection/components/revo-grid/viewport.resize.service.js +24 -0
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js +63 -0
- package/dist/collection/components/revo-grid/viewport.section.js +31 -0
- package/dist/collection/components/revo-grid/viewport.service.js +212 -0
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +213 -0
- package/dist/collection/components/rowHeaders/row-header-render.js +4 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +137 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +402 -0
- package/dist/collection/components/scrollable/revogr-scroll-style.css +104 -0
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +256 -0
- package/dist/collection/components/selection-focus/revogr-focus-style.css +77 -0
- package/dist/collection/components/selection-focus/revogr-focus.js +106 -0
- package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +98 -0
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js +141 -0
- package/dist/{revo-grid/app-globals-7e6866ba.js → collection/global/global.js} +2 -8
- package/dist/collection/index.js +4 -0
- package/dist/collection/plugins/autoSizeColumn.js +233 -0
- package/dist/collection/plugins/basePlugin.js +30 -0
- package/dist/{revo-grid/dispatcher-891af82e.js → collection/plugins/dispatcher.js} +2 -4
- package/dist/collection/plugins/export/csv.js +71 -0
- package/dist/collection/plugins/export/export.plugin.js +168 -0
- package/dist/collection/plugins/export/types.js +4 -0
- package/dist/collection/plugins/filter/conditions/equal.js +20 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +13 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +10 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +15 -0
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +10 -0
- package/dist/collection/plugins/filter/conditions/set.js +6 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +20 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js +21 -0
- package/dist/{revo-grid/filter.button-74c1cd9c.js → collection/plugins/filter/filter.button.js} +10 -13
- package/dist/collection/plugins/filter/filter.plugin.js +259 -0
- package/dist/collection/plugins/filter/filter.pop.js +488 -0
- package/dist/collection/plugins/filter/filter.service.js +47 -0
- package/dist/collection/plugins/filter/filter.style.css +239 -0
- package/dist/collection/plugins/filter/filter.types.js +4 -0
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +33 -0
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +39 -0
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +24 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js +13 -0
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +79 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +261 -0
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +32 -0
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +4 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js +158 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +60 -0
- package/dist/collection/plugins/moveColumn/columnDragPlugin.js +151 -0
- package/dist/collection/plugins/moveColumn/columnOrderHandler.js +63 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js +184 -0
- package/dist/collection/plugins/sorting/sorting.sign.js +9 -0
- package/dist/collection/plugins/stretchPlugin.js +71 -0
- package/dist/collection/plugins/trimmed/trimmed.plugin.js +35 -0
- package/dist/collection/services/cell.helpers.js +10 -0
- package/dist/collection/services/column.data.provider.js +191 -0
- package/dist/collection/services/data.provider.js +50 -0
- package/dist/collection/services/dimension.provider.js +81 -0
- package/dist/{revo-grid/localScrollService-e9b73323.js → collection/services/localScrollService.js} +2 -5
- package/dist/collection/services/resizable.directive.js +255 -0
- package/dist/collection/services/selection.store.connector.js +216 -0
- package/dist/collection/services/viewport.provider.js +17 -0
- package/dist/collection/store/dataSource/data.proxy.js +37 -0
- package/dist/collection/store/dataSource/data.store.js +130 -0
- package/dist/collection/store/dimension/dimension.helpers.js +110 -0
- package/dist/collection/store/dimension/dimension.store.js +62 -0
- package/dist/collection/store/selection/selection.helpers.js +56 -0
- package/dist/collection/store/selection/selection.store.js +71 -0
- package/dist/collection/store/selection/selection.store.service.js +38 -0
- package/dist/collection/store/storeTypes.js +8 -0
- package/dist/{revo-grid/viewport.store-ffaaab6d.js → collection/store/viewPort/viewport.helpers.js} +9 -132
- package/dist/collection/store/viewPort/viewport.store.js +124 -0
- package/dist/collection/themeManager/theme.compact.js +8 -0
- package/dist/collection/themeManager/theme.default.js +8 -0
- package/dist/collection/themeManager/theme.material.js +8 -0
- package/dist/{revo-grid/themeService-ddaaa364.js → collection/themeManager/themeService.js} +6 -23
- package/dist/collection/utils/closestPolifill.js +21 -0
- package/dist/collection/utils/consts.js +22 -0
- package/dist/collection/utils/generateAlphabetHeader.js +23 -0
- package/dist/collection/utils/keyCodes.js +73 -0
- package/dist/collection/utils/keyCodes.utils.js +67 -0
- package/dist/collection/utils/platform.js +8 -0
- package/dist/collection/utils/resizeObserver.js +9 -0
- package/dist/collection/utils/store.utils.js +10 -0
- package/dist/{revo-grid/utils-2c3b3857.js → collection/utils/utils.js} +8 -10
- package/dist/collection/utilsExternal/generate-data.js +132 -0
- package/dist/esm/css-shim-e1e1ea5e.js +7 -0
- package/dist/esm/debounce-e4e6dd45.js +561 -0
- package/dist/esm/dom-21bd1807.js +76 -0
- package/dist/esm/index-6f753b3c.js +1817 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +34 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/resize-observer-00c48d78.js +503 -0
- package/dist/esm/revo-grid.js +77 -0
- package/dist/{revo-grid/lodash-a0ab4cdd.js → esm/revo-grid_11.entry.js} +25351 -14282
- package/dist/esm/revogr-clipboard.entry.js +52 -0
- package/dist/esm/revogr-filter-panel.entry.js +274 -0
- package/dist/esm-es5/css-shim-e1e1ea5e.js +4 -0
- package/dist/esm-es5/debounce-e4e6dd45.js +4 -0
- package/dist/esm-es5/dom-21bd1807.js +24 -0
- package/dist/esm-es5/index-6f753b3c.js +4 -0
- package/dist/esm-es5/index.js +3 -0
- package/dist/esm-es5/loader.js +4 -0
- package/dist/esm-es5/resize-observer-00c48d78.js +4 -0
- package/dist/esm-es5/revo-grid.js +4 -0
- package/dist/esm-es5/revo-grid_11.entry.js +4 -0
- package/dist/esm-es5/revogr-clipboard.entry.js +4 -0
- package/dist/esm-es5/revogr-filter-panel.entry.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/revo-grid/css-shim-bcf89cc0.system.js +4 -0
- package/dist/revo-grid/css-shim-e1e1ea5e.js +4 -0
- package/dist/revo-grid/debounce-5a33c710.system.js +4 -0
- package/dist/revo-grid/debounce-726bdadb.js +4 -0
- package/dist/revo-grid/dom-21bd1807.js +5 -59
- package/dist/revo-grid/dom-726246e2.system.js +24 -0
- package/dist/revo-grid/index-f14b41a0.system.js +5 -0
- package/dist/revo-grid/index-f30d1de1.js +5 -0
- package/dist/revo-grid/index.system.js +4 -0
- package/dist/revo-grid/resize-observer-00c48d78.js +1 -500
- package/dist/revo-grid/resize-observer-8af0bc0e.system.js +4 -0
- package/dist/revo-grid/revo-grid.esm.js +1 -130
- package/dist/revo-grid/revo-grid.js +133 -0
- package/dist/revo-grid/revo-grid.system.js +4 -0
- package/dist/revo-grid/revo-grid_11.entry.js +4 -0
- package/dist/revo-grid/revo-grid_11.system.entry.js +4 -0
- package/dist/revo-grid/revogr-clipboard.entry.js +1 -49
- package/dist/revo-grid/revogr-clipboard.system.entry.js +4 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -274
- package/dist/revo-grid/revogr-filter-panel.system.entry.js +4 -0
- package/dist/types/components/revo-grid/revo-grid.d.ts +0 -1
- package/dist/types/components.d.ts +2 -2
- package/loader/cdn.js +3 -1
- package/loader/index.cjs.js +3 -1
- package/loader/index.d.ts +0 -1
- package/loader/index.es2017.js +3 -1
- package/loader/index.js +3 -1
- package/package.json +1 -1
- package/dist/revo-grid/_baseIteratee-af30b221.js +0 -2070
- package/dist/revo-grid/consts-ef824e6f.js +0 -46
- package/dist/revo-grid/css-shim-5387c708.js +0 -7
- package/dist/revo-grid/data.store-3263fff9.js +0 -557
- package/dist/revo-grid/debounce-aaa4b4da.js +0 -217
- package/dist/revo-grid/dimension.helpers-a7944fc4.js +0 -340
- package/dist/revo-grid/each-0378e5a3.js +0 -180
- package/dist/revo-grid/identity-c8c7d3d8.js +0 -26
- package/dist/revo-grid/isString-a51066b5.js +0 -34
- package/dist/revo-grid/isSymbol-e4b5dafe.js +0 -247
- package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +0 -299
- package/dist/revo-grid/keys-70b7c240.js +0 -561
- package/dist/revo-grid/revo-grid.entry.js +0 -3484
- package/dist/revo-grid/revogr-data.entry.js +0 -152
- package/dist/revo-grid/revogr-edit.entry.js +0 -105
- package/dist/revo-grid/revogr-focus.entry.js +0 -41
- package/dist/revo-grid/revogr-header.entry.js +0 -560
- package/dist/revo-grid/revogr-order-editor.entry.js +0 -175
- package/dist/revo-grid/revogr-overlay-selection.entry.js +0 -711
- package/dist/revo-grid/revogr-row-headers.entry.js +0 -73
- package/dist/revo-grid/revogr-scroll-virtual.entry.js +0 -114
- package/dist/revo-grid/revogr-temp-range.entry.js +0 -73
- package/dist/revo-grid/revogr-viewport-scroll.entry.js +0 -340
- package/dist/revo-grid/selection.store.connector-2b613fd0.js +0 -503
- package/dist/revo-grid/shadow-css-602a09db.js +0 -390
- package/dist/revo-grid/toInteger-9e6cbfd2.js +0 -107
- package/dist/revo-grid/toNumber-913b0b72.js +0 -105
- package/dist/revo-grid/viewport.helpers-49d3f031.js +0 -16
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist
|
|
3
3
|
*/
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return e[k];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n['default'] = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
4
26
|
const NAMESPACE = 'revo-grid';
|
|
5
|
-
const BUILD = /* revo-grid */ { allRenderFn: false, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, cssVarShim: true, devTools: true, disconnectedCallback: true, dynamicImportShim: true, element: false, event: true, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: true, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: true, invisiblePrehydration: true, isDebug: false, isDev: true, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: true, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, safari10: false, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, shadowDomShim: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
|
|
6
|
-
const Env = /* revo-grid */ {};
|
|
7
27
|
|
|
8
|
-
let scopeId;
|
|
9
28
|
let contentRef;
|
|
10
29
|
let hostTagName;
|
|
11
|
-
let customError;
|
|
12
|
-
let i = 0;
|
|
13
30
|
let useNativeShadowDom = false;
|
|
14
31
|
let checkSlotFallbackVisibility = false;
|
|
15
32
|
let checkSlotRelocate = false;
|
|
16
33
|
let isSvgMode = false;
|
|
17
34
|
let renderingRef = null;
|
|
18
|
-
let queueCongestion = 0;
|
|
19
35
|
let queuePending = false;
|
|
20
36
|
const win = typeof window !== 'undefined' ? window : {};
|
|
21
|
-
const CSS =
|
|
37
|
+
const CSS = win.CSS ;
|
|
22
38
|
const doc = win.document || { head: {} };
|
|
23
|
-
const H = (win.HTMLElement || class {
|
|
24
|
-
});
|
|
25
39
|
const plt = {
|
|
26
40
|
$flags$: 0,
|
|
27
41
|
$resourcesUrl$: '',
|
|
@@ -31,27 +45,8 @@ const plt = {
|
|
|
31
45
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
32
46
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
33
47
|
};
|
|
34
|
-
const setPlatformHelpers = (helpers) => {
|
|
35
|
-
Object.assign(plt, helpers);
|
|
36
|
-
};
|
|
37
|
-
const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom
|
|
38
|
-
? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
39
|
-
: true;
|
|
40
|
-
const supportsListenerOptions = /*@__PURE__*/ (() => {
|
|
41
|
-
let supportsListenerOptions = false;
|
|
42
|
-
try {
|
|
43
|
-
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
|
|
44
|
-
get() {
|
|
45
|
-
supportsListenerOptions = true;
|
|
46
|
-
},
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
catch (e) { }
|
|
50
|
-
return supportsListenerOptions;
|
|
51
|
-
})();
|
|
52
48
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
53
|
-
const supportsConstructableStylesheets =
|
|
54
|
-
? /*@__PURE__*/ (() => {
|
|
49
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
55
50
|
try {
|
|
56
51
|
new CSSStyleSheet();
|
|
57
52
|
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
@@ -59,31 +54,11 @@ const supportsConstructableStylesheets = BUILD.constructableCSS
|
|
|
59
54
|
catch (e) { }
|
|
60
55
|
return false;
|
|
61
56
|
})()
|
|
62
|
-
|
|
63
|
-
const Context = {};
|
|
57
|
+
;
|
|
64
58
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
65
|
-
if (
|
|
66
|
-
// this is called immediately within the element's constructor
|
|
67
|
-
// initialize our event listeners on the host element
|
|
68
|
-
// we do this now so that we can listen to events that may
|
|
69
|
-
// have fired even before the instance is ready
|
|
70
|
-
if (BUILD.hostListenerTargetParent) {
|
|
71
|
-
// this component may have event listeners that should be attached to the parent
|
|
72
|
-
if (attachParentListeners) {
|
|
73
|
-
// this is being ran from within the connectedCallback
|
|
74
|
-
// which is important so that we know the host element actually has a parent element
|
|
75
|
-
// filter out the listeners to only have the ones that ARE being attached to the parent
|
|
76
|
-
listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
// this is being ran from within the component constructor
|
|
80
|
-
// everything BUT the parent element listeners should be attached at this time
|
|
81
|
-
// filter out the listeners that are NOT being attached to the parent
|
|
82
|
-
listeners = listeners.filter(([flags]) => !(flags & 32 /* TargetParent */));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
59
|
+
if (listeners) {
|
|
85
60
|
listeners.map(([flags, name, method]) => {
|
|
86
|
-
const target =
|
|
61
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
87
62
|
const handler = hostListenerProxy(hostRef, method);
|
|
88
63
|
const opts = hostListenerOpts(flags);
|
|
89
64
|
plt.ael(target, name, handler, opts);
|
|
@@ -93,7 +68,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
93
68
|
};
|
|
94
69
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
95
70
|
try {
|
|
96
|
-
|
|
71
|
+
{
|
|
97
72
|
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
98
73
|
// instance is ready, let's call it's member method for this event
|
|
99
74
|
hostRef.$lazyInstance$[methodName](ev);
|
|
@@ -102,127 +77,34 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
102
77
|
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
103
78
|
}
|
|
104
79
|
}
|
|
105
|
-
else {
|
|
106
|
-
hostRef.$hostElement$[methodName](ev);
|
|
107
|
-
}
|
|
108
80
|
}
|
|
109
81
|
catch (e) {
|
|
110
82
|
consoleError(e);
|
|
111
83
|
}
|
|
112
84
|
};
|
|
113
85
|
const getHostListenerTarget = (elm, flags) => {
|
|
114
|
-
if (
|
|
86
|
+
if (flags & 4 /* TargetDocument */)
|
|
115
87
|
return doc;
|
|
116
|
-
if (BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
|
|
117
|
-
return win;
|
|
118
|
-
if (BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */)
|
|
119
|
-
return doc.body;
|
|
120
|
-
if (BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */)
|
|
121
|
-
return elm.parentElement;
|
|
122
88
|
return elm;
|
|
123
89
|
};
|
|
124
90
|
// prettier-ignore
|
|
125
|
-
const hostListenerOpts = (flags) =>
|
|
126
|
-
? ({
|
|
127
|
-
passive: (flags & 1 /* Passive */) !== 0,
|
|
128
|
-
capture: (flags & 2 /* Capture */) !== 0,
|
|
129
|
-
})
|
|
130
|
-
: (flags & 2 /* Capture */) !== 0;
|
|
131
|
-
const CONTENT_REF_ID = 'r';
|
|
132
|
-
const ORG_LOCATION_ID = 'o';
|
|
133
|
-
const SLOT_NODE_ID = 's';
|
|
134
|
-
const TEXT_NODE_ID = 't';
|
|
135
|
-
const HYDRATE_ID = 's-id';
|
|
136
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
137
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
91
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
138
92
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
139
93
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
140
94
|
const createTime = (fnName, tagName = '') => {
|
|
141
|
-
|
|
142
|
-
const key = `st:${fnName}:${tagName}:${i++}`;
|
|
143
|
-
// Start
|
|
144
|
-
performance.mark(key);
|
|
145
|
-
// End
|
|
146
|
-
return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
95
|
+
{
|
|
149
96
|
return () => {
|
|
150
97
|
return;
|
|
151
98
|
};
|
|
152
99
|
}
|
|
153
100
|
};
|
|
154
101
|
const uniqueTime = (key, measureText) => {
|
|
155
|
-
|
|
156
|
-
if (performance.getEntriesByName(key).length === 0) {
|
|
157
|
-
performance.mark(key);
|
|
158
|
-
}
|
|
159
|
-
return () => {
|
|
160
|
-
if (performance.getEntriesByName(measureText).length === 0) {
|
|
161
|
-
performance.measure(measureText, key);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
102
|
+
{
|
|
166
103
|
return () => {
|
|
167
104
|
return;
|
|
168
105
|
};
|
|
169
106
|
}
|
|
170
107
|
};
|
|
171
|
-
const inspect = (ref) => {
|
|
172
|
-
const hostRef = getHostRef(ref);
|
|
173
|
-
if (!hostRef) {
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
const flags = hostRef.$flags$;
|
|
177
|
-
const hostElement = hostRef.$hostElement$;
|
|
178
|
-
return {
|
|
179
|
-
renderCount: hostRef.$renderCount$,
|
|
180
|
-
flags: {
|
|
181
|
-
hasRendered: !!(flags & 2 /* hasRendered */),
|
|
182
|
-
hasConnected: !!(flags & 1 /* hasConnected */),
|
|
183
|
-
isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
|
|
184
|
-
isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
|
|
185
|
-
isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
|
|
186
|
-
hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
|
|
187
|
-
hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
|
|
188
|
-
isWatchReady: !!(flags & 128 /* isWatchReady */),
|
|
189
|
-
isListenReady: !!(flags & 256 /* isListenReady */),
|
|
190
|
-
needsRerender: !!(flags & 512 /* needsRerender */),
|
|
191
|
-
},
|
|
192
|
-
instanceValues: hostRef.$instanceValues$,
|
|
193
|
-
ancestorComponent: hostRef.$ancestorComponent$,
|
|
194
|
-
hostElement,
|
|
195
|
-
lazyInstance: hostRef.$lazyInstance$,
|
|
196
|
-
vnode: hostRef.$vnode$,
|
|
197
|
-
modeName: hostRef.$modeName$,
|
|
198
|
-
onReadyPromise: hostRef.$onReadyPromise$,
|
|
199
|
-
onReadyResolve: hostRef.$onReadyResolve$,
|
|
200
|
-
onInstancePromise: hostRef.$onInstancePromise$,
|
|
201
|
-
onInstanceResolve: hostRef.$onInstanceResolve$,
|
|
202
|
-
onRenderResolve: hostRef.$onRenderResolve$,
|
|
203
|
-
queuedListeners: hostRef.$queuedListeners$,
|
|
204
|
-
rmListeners: hostRef.$rmListeners$,
|
|
205
|
-
['s-id']: hostElement['s-id'],
|
|
206
|
-
['s-cr']: hostElement['s-cr'],
|
|
207
|
-
['s-lr']: hostElement['s-lr'],
|
|
208
|
-
['s-p']: hostElement['s-p'],
|
|
209
|
-
['s-rc']: hostElement['s-rc'],
|
|
210
|
-
['s-sc']: hostElement['s-sc'],
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
const installDevTools = () => {
|
|
214
|
-
if (BUILD.devTools) {
|
|
215
|
-
const stencil = (win.stencil = win.stencil || {});
|
|
216
|
-
const originalInspect = stencil.inspect;
|
|
217
|
-
stencil.inspect = (ref) => {
|
|
218
|
-
let result = inspect(ref);
|
|
219
|
-
if (!result && typeof originalInspect === 'function') {
|
|
220
|
-
result = originalInspect(ref);
|
|
221
|
-
}
|
|
222
|
-
return result;
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
108
|
const rootAppliedStyles = new WeakMap();
|
|
227
109
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
228
110
|
let style = styles.get(scopeId);
|
|
@@ -241,11 +123,8 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
241
123
|
styles.set(scopeId, style);
|
|
242
124
|
};
|
|
243
125
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
244
|
-
let scopeId = getScopeId(cmpMeta
|
|
126
|
+
let scopeId = getScopeId(cmpMeta);
|
|
245
127
|
const style = styles.get(scopeId);
|
|
246
|
-
if (!BUILD.attachStyles) {
|
|
247
|
-
return scopeId;
|
|
248
|
-
}
|
|
249
128
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
250
129
|
// so the fallback is to always use the document for the root node in those cases
|
|
251
130
|
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
@@ -258,14 +137,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
258
137
|
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
259
138
|
}
|
|
260
139
|
if (!appliedStyles.has(scopeId)) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
(styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
|
|
264
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
265
|
-
styleElm.innerHTML = style;
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
140
|
+
{
|
|
141
|
+
if (plt.$cssShim$) {
|
|
269
142
|
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
|
|
270
143
|
const newScopeId = styleElm['s-sc'];
|
|
271
144
|
if (newScopeId) {
|
|
@@ -280,9 +153,6 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
280
153
|
styleElm = doc.createElement('style');
|
|
281
154
|
styleElm.innerHTML = style;
|
|
282
155
|
}
|
|
283
|
-
if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
|
|
284
|
-
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
|
|
285
|
-
}
|
|
286
156
|
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
287
157
|
}
|
|
288
158
|
if (appliedStyles) {
|
|
@@ -290,7 +160,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
290
160
|
}
|
|
291
161
|
}
|
|
292
162
|
}
|
|
293
|
-
else if (
|
|
163
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
294
164
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
295
165
|
}
|
|
296
166
|
}
|
|
@@ -299,32 +169,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
299
169
|
const attachStyles = (hostRef) => {
|
|
300
170
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
301
171
|
const elm = hostRef.$hostElement$;
|
|
302
|
-
const flags = cmpMeta.$flags$;
|
|
303
172
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
304
|
-
|
|
305
|
-
if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
|
|
306
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
307
|
-
// or this browser doesn't support native shadow dom
|
|
308
|
-
// and this host element was NOT created with SSR
|
|
309
|
-
// let's pick out the inner content for slot projection
|
|
310
|
-
// create a node to represent where the original
|
|
311
|
-
// content was first placed, which is useful later on
|
|
312
|
-
// DOM WRITE!!
|
|
313
|
-
elm['s-sc'] = scopeId;
|
|
314
|
-
elm.classList.add(scopeId + '-h');
|
|
315
|
-
if (BUILD.scoped && flags & 2 /* scopedCssEncapsulation */) {
|
|
316
|
-
elm.classList.add(scopeId + '-s');
|
|
317
|
-
}
|
|
318
|
-
}
|
|
173
|
+
addStyle(elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
|
|
319
174
|
endAttachStyles();
|
|
320
175
|
};
|
|
321
|
-
const getScopeId = (cmp, mode) => 'sc-' + (
|
|
322
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
323
|
-
// Private
|
|
324
|
-
const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
|
|
325
|
-
// Public
|
|
326
|
-
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
327
|
-
const getMode = (ref) => getHostRef(ref).$modeName$;
|
|
176
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
328
177
|
/**
|
|
329
178
|
* Default style mode id
|
|
330
179
|
*/
|
|
@@ -338,7 +187,6 @@ const EMPTY_OBJ = {};
|
|
|
338
187
|
*/
|
|
339
188
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
340
189
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
341
|
-
const isDef = (v) => v != null;
|
|
342
190
|
const isComplexType = (o) => {
|
|
343
191
|
// https://jsperf.com/typeof-fn-object/5
|
|
344
192
|
o = typeof o;
|
|
@@ -372,11 +220,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
372
220
|
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
|
|
373
221
|
child = String(child);
|
|
374
222
|
}
|
|
375
|
-
else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
|
|
376
|
-
consoleDevError(`vNode passed as children has unexpected type.
|
|
377
|
-
Make sure it's using the correct h() function.
|
|
378
|
-
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
|
379
|
-
}
|
|
380
223
|
if (simple && lastSimple) {
|
|
381
224
|
// If the previous child was simple (string), we merge both
|
|
382
225
|
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
@@ -391,17 +234,14 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
391
234
|
};
|
|
392
235
|
walk(children);
|
|
393
236
|
if (vnodeData) {
|
|
394
|
-
if (BUILD.isDev && nodeName === 'input') {
|
|
395
|
-
validateInputProperties(vnodeData);
|
|
396
|
-
}
|
|
397
237
|
// normalize class / classname attributes
|
|
398
|
-
if (
|
|
238
|
+
if (vnodeData.key) {
|
|
399
239
|
key = vnodeData.key;
|
|
400
240
|
}
|
|
401
|
-
if (
|
|
241
|
+
if (vnodeData.name) {
|
|
402
242
|
slotName = vnodeData.name;
|
|
403
243
|
}
|
|
404
|
-
|
|
244
|
+
{
|
|
405
245
|
const classData = vnodeData.className || vnodeData.class;
|
|
406
246
|
if (classData) {
|
|
407
247
|
vnodeData.class =
|
|
@@ -413,12 +253,7 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
413
253
|
}
|
|
414
254
|
}
|
|
415
255
|
}
|
|
416
|
-
if (
|
|
417
|
-
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
418
|
-
- You are NOT using hostData() and <Host> in the same component.
|
|
419
|
-
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
420
|
-
}
|
|
421
|
-
if (BUILD.vdomFunctional && typeof nodeName === 'function') {
|
|
256
|
+
if (typeof nodeName === 'function') {
|
|
422
257
|
// nodeName is a functional component
|
|
423
258
|
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
424
259
|
}
|
|
@@ -427,10 +262,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
427
262
|
if (vNodeChildren.length > 0) {
|
|
428
263
|
vnode.$children$ = vNodeChildren;
|
|
429
264
|
}
|
|
430
|
-
|
|
265
|
+
{
|
|
431
266
|
vnode.$key$ = key;
|
|
432
267
|
}
|
|
433
|
-
|
|
268
|
+
{
|
|
434
269
|
vnode.$name$ = slotName;
|
|
435
270
|
}
|
|
436
271
|
return vnode;
|
|
@@ -443,13 +278,13 @@ const newVNode = (tag, text) => {
|
|
|
443
278
|
$elm$: null,
|
|
444
279
|
$children$: null,
|
|
445
280
|
};
|
|
446
|
-
|
|
281
|
+
{
|
|
447
282
|
vnode.$attrs$ = null;
|
|
448
283
|
}
|
|
449
|
-
|
|
284
|
+
{
|
|
450
285
|
vnode.$key$ = null;
|
|
451
286
|
}
|
|
452
|
-
|
|
287
|
+
{
|
|
453
288
|
vnode.$name$ = null;
|
|
454
289
|
}
|
|
455
290
|
return vnode;
|
|
@@ -486,24 +321,6 @@ const convertToPrivate = (node) => {
|
|
|
486
321
|
vnode.$name$ = node.vname;
|
|
487
322
|
return vnode;
|
|
488
323
|
};
|
|
489
|
-
/**
|
|
490
|
-
* Validates the ordering of attributes on an input element
|
|
491
|
-
* @param inputElm the element to validate
|
|
492
|
-
*/
|
|
493
|
-
const validateInputProperties = (inputElm) => {
|
|
494
|
-
const props = Object.keys(inputElm);
|
|
495
|
-
const value = props.indexOf('value');
|
|
496
|
-
if (value === -1) {
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
const typeIndex = props.indexOf('type');
|
|
500
|
-
const minIndex = props.indexOf('min');
|
|
501
|
-
const maxIndex = props.indexOf('max');
|
|
502
|
-
const stepIndex = props.indexOf('step');
|
|
503
|
-
if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
|
|
504
|
-
consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
324
|
/**
|
|
508
325
|
* Production setAccessor() function based on Preact by
|
|
509
326
|
* Jason Miller (@developit)
|
|
@@ -516,19 +333,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
516
333
|
if (oldValue !== newValue) {
|
|
517
334
|
let isProp = isMemberInElement(elm, memberName);
|
|
518
335
|
let ln = memberName.toLowerCase();
|
|
519
|
-
if (
|
|
336
|
+
if (memberName === 'class') {
|
|
520
337
|
const classList = elm.classList;
|
|
521
338
|
const oldClasses = parseClassList(oldValue);
|
|
522
339
|
const newClasses = parseClassList(newValue);
|
|
523
340
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
524
341
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
525
342
|
}
|
|
526
|
-
else if (
|
|
343
|
+
else if (memberName === 'style') {
|
|
527
344
|
// update style attribute, css properties and values
|
|
528
|
-
|
|
345
|
+
{
|
|
529
346
|
for (const prop in oldValue) {
|
|
530
347
|
if (!newValue || newValue[prop] == null) {
|
|
531
|
-
if (
|
|
348
|
+
if (prop.includes('-')) {
|
|
532
349
|
elm.style.removeProperty(prop);
|
|
533
350
|
}
|
|
534
351
|
else {
|
|
@@ -539,7 +356,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
539
356
|
}
|
|
540
357
|
for (const prop in newValue) {
|
|
541
358
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
542
|
-
if (
|
|
359
|
+
if (prop.includes('-')) {
|
|
543
360
|
elm.style.setProperty(prop, newValue[prop]);
|
|
544
361
|
}
|
|
545
362
|
else {
|
|
@@ -548,16 +365,15 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
548
365
|
}
|
|
549
366
|
}
|
|
550
367
|
}
|
|
551
|
-
else if (
|
|
368
|
+
else if (memberName === 'key')
|
|
552
369
|
;
|
|
553
|
-
else if (
|
|
370
|
+
else if (memberName === 'ref') {
|
|
554
371
|
// minifier will clean this up
|
|
555
372
|
if (newValue) {
|
|
556
373
|
newValue(elm);
|
|
557
374
|
}
|
|
558
375
|
}
|
|
559
|
-
else if (
|
|
560
|
-
(BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
|
|
376
|
+
else if ((!isProp ) &&
|
|
561
377
|
memberName[0] === 'o' &&
|
|
562
378
|
memberName[1] === 'n') {
|
|
563
379
|
// Event Handlers
|
|
@@ -596,7 +412,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
596
412
|
plt.ael(elm, memberName, newValue, false);
|
|
597
413
|
}
|
|
598
414
|
}
|
|
599
|
-
else
|
|
415
|
+
else {
|
|
600
416
|
// Set property if it exists and it's not a SVG
|
|
601
417
|
const isComplex = isComplexType(newValue);
|
|
602
418
|
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
|
@@ -625,7 +441,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
625
441
|
* - if the newValue is null/undefined or 'false'.
|
|
626
442
|
*/
|
|
627
443
|
let xlink = false;
|
|
628
|
-
|
|
444
|
+
{
|
|
629
445
|
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
|
|
630
446
|
memberName = ln;
|
|
631
447
|
xlink = true;
|
|
@@ -633,7 +449,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
633
449
|
}
|
|
634
450
|
if (newValue == null || newValue === false) {
|
|
635
451
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
636
|
-
if (
|
|
452
|
+
if (xlink) {
|
|
637
453
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
638
454
|
}
|
|
639
455
|
else {
|
|
@@ -643,7 +459,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
643
459
|
}
|
|
644
460
|
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
645
461
|
newValue = newValue === true ? '' : newValue;
|
|
646
|
-
if (
|
|
462
|
+
if (xlink) {
|
|
647
463
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
648
464
|
}
|
|
649
465
|
else {
|
|
@@ -664,7 +480,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
664
480
|
: newVnode.$elm$;
|
|
665
481
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
666
482
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
667
|
-
|
|
483
|
+
{
|
|
668
484
|
// remove attributes no longer present on the vnode by setting them to undefined
|
|
669
485
|
for (memberName in oldVnodeAttrs) {
|
|
670
486
|
if (!(memberName in newVnodeAttrs)) {
|
|
@@ -684,14 +500,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
684
500
|
let elm;
|
|
685
501
|
let childNode;
|
|
686
502
|
let oldVNode;
|
|
687
|
-
if (
|
|
503
|
+
if (!useNativeShadowDom) {
|
|
688
504
|
// remember for later we need to check to relocate nodes
|
|
689
505
|
checkSlotRelocate = true;
|
|
690
506
|
if (newVNode.$tag$ === 'slot') {
|
|
691
|
-
if (scopeId) {
|
|
692
|
-
// scoped css needs to add its scoped id to the parent element
|
|
693
|
-
parentElm.classList.add(scopeId + '-s');
|
|
694
|
-
}
|
|
695
507
|
newVNode.$flags$ |= newVNode.$children$
|
|
696
508
|
? // slot element has fallback content
|
|
697
509
|
2 /* isSlotFallback */
|
|
@@ -699,46 +511,35 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
699
511
|
1 /* isSlotReference */;
|
|
700
512
|
}
|
|
701
513
|
}
|
|
702
|
-
if (
|
|
703
|
-
consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
|
|
704
|
-
}
|
|
705
|
-
if (BUILD.vdomText && newVNode.$text$ !== null) {
|
|
514
|
+
if (newVNode.$text$ !== null) {
|
|
706
515
|
// create text node
|
|
707
516
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
708
517
|
}
|
|
709
|
-
else if (
|
|
518
|
+
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
710
519
|
// create a slot reference node
|
|
711
520
|
elm = newVNode.$elm$ =
|
|
712
|
-
|
|
521
|
+
doc.createTextNode('');
|
|
713
522
|
}
|
|
714
523
|
else {
|
|
715
|
-
if (
|
|
524
|
+
if (!isSvgMode) {
|
|
716
525
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
717
526
|
}
|
|
718
527
|
// create element
|
|
719
|
-
elm = newVNode.$elm$ = (
|
|
720
|
-
? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */
|
|
528
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
|
|
721
529
|
? 'slot-fb'
|
|
722
530
|
: newVNode.$tag$)
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
: newVNode.$tag$));
|
|
726
|
-
if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
531
|
+
);
|
|
532
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
727
533
|
isSvgMode = false;
|
|
728
534
|
}
|
|
729
535
|
// add css classes, attrs, props, listeners, etc.
|
|
730
|
-
|
|
536
|
+
{
|
|
731
537
|
updateElement(null, newVNode, isSvgMode);
|
|
732
538
|
}
|
|
733
|
-
if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
734
|
-
// if there is a scopeId and this is the initial render
|
|
735
|
-
// then let's add the scopeId as a css class
|
|
736
|
-
elm.classList.add((elm['s-si'] = scopeId));
|
|
737
|
-
}
|
|
738
539
|
if (newVNode.$children$) {
|
|
739
540
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
740
541
|
// create the node
|
|
741
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
542
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
742
543
|
// return node could have been null
|
|
743
544
|
if (childNode) {
|
|
744
545
|
// append our new node
|
|
@@ -746,7 +547,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
746
547
|
}
|
|
747
548
|
}
|
|
748
549
|
}
|
|
749
|
-
|
|
550
|
+
{
|
|
750
551
|
if (newVNode.$tag$ === 'svg') {
|
|
751
552
|
// Only reset the SVG context when we're exiting <svg> element
|
|
752
553
|
isSvgMode = false;
|
|
@@ -757,7 +558,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
757
558
|
}
|
|
758
559
|
}
|
|
759
560
|
}
|
|
760
|
-
|
|
561
|
+
{
|
|
761
562
|
elm['s-hn'] = hostTagName;
|
|
762
563
|
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
763
564
|
// remember the content reference comment
|
|
@@ -802,17 +603,14 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
802
603
|
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
803
604
|
};
|
|
804
605
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
805
|
-
let containerElm = ((
|
|
606
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
806
607
|
let childNode;
|
|
807
|
-
if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
808
|
-
containerElm = containerElm.shadowRoot;
|
|
809
|
-
}
|
|
810
608
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
811
609
|
if (vnodes[startIdx]) {
|
|
812
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
610
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
813
611
|
if (childNode) {
|
|
814
612
|
vnodes[startIdx].$elm$ = childNode;
|
|
815
|
-
containerElm.insertBefore(childNode,
|
|
613
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
816
614
|
}
|
|
817
615
|
}
|
|
818
616
|
}
|
|
@@ -822,7 +620,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
822
620
|
if ((vnode = vnodes[startIdx])) {
|
|
823
621
|
elm = vnode.$elm$;
|
|
824
622
|
callNodeRefs(vnode);
|
|
825
|
-
|
|
623
|
+
{
|
|
826
624
|
// we're removing this element
|
|
827
625
|
// so it's possible we need to show slot fallback content now
|
|
828
626
|
checkSlotFallbackVisibility = true;
|
|
@@ -880,7 +678,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
880
678
|
}
|
|
881
679
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
882
680
|
// Vnode moved right
|
|
883
|
-
if (
|
|
681
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
884
682
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
885
683
|
}
|
|
886
684
|
patch(oldStartVnode, newEndVnode);
|
|
@@ -890,7 +688,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
890
688
|
}
|
|
891
689
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
892
690
|
// Vnode moved left
|
|
893
|
-
if (
|
|
691
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
894
692
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
895
693
|
}
|
|
896
694
|
patch(oldEndVnode, newStartVnode);
|
|
@@ -901,7 +699,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
901
699
|
else {
|
|
902
700
|
// createKeyToOldIdx
|
|
903
701
|
idxInOld = -1;
|
|
904
|
-
|
|
702
|
+
{
|
|
905
703
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
906
704
|
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
907
705
|
idxInOld = i;
|
|
@@ -909,10 +707,10 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
909
707
|
}
|
|
910
708
|
}
|
|
911
709
|
}
|
|
912
|
-
if (
|
|
710
|
+
if (idxInOld >= 0) {
|
|
913
711
|
elmToMove = oldCh[idxInOld];
|
|
914
712
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
915
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld
|
|
713
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
916
714
|
}
|
|
917
715
|
else {
|
|
918
716
|
patch(elmToMove, newStartVnode);
|
|
@@ -923,23 +721,20 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
923
721
|
}
|
|
924
722
|
else {
|
|
925
723
|
// new element
|
|
926
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
724
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
927
725
|
newStartVnode = newCh[++newStartIdx];
|
|
928
726
|
}
|
|
929
727
|
if (node) {
|
|
930
|
-
|
|
728
|
+
{
|
|
931
729
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
932
730
|
}
|
|
933
|
-
else {
|
|
934
|
-
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
935
|
-
}
|
|
936
731
|
}
|
|
937
732
|
}
|
|
938
733
|
}
|
|
939
734
|
if (oldStartIdx > oldEndIdx) {
|
|
940
735
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
941
736
|
}
|
|
942
|
-
else if (
|
|
737
|
+
else if (newStartIdx > newEndIdx) {
|
|
943
738
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
944
739
|
}
|
|
945
740
|
};
|
|
@@ -947,13 +742,12 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
947
742
|
// compare if two vnode to see if they're "technically" the same
|
|
948
743
|
// need to have the same element tag, and same key to be the same
|
|
949
744
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
950
|
-
if (
|
|
745
|
+
if (vnode1.$tag$ === 'slot') {
|
|
951
746
|
return vnode1.$name$ === vnode2.$name$;
|
|
952
747
|
}
|
|
953
|
-
|
|
748
|
+
{
|
|
954
749
|
return vnode1.$key$ === vnode2.$key$;
|
|
955
750
|
}
|
|
956
|
-
return true;
|
|
957
751
|
}
|
|
958
752
|
return false;
|
|
959
753
|
};
|
|
@@ -972,15 +766,15 @@ const patch = (oldVNode, newVNode) => {
|
|
|
972
766
|
const tag = newVNode.$tag$;
|
|
973
767
|
const text = newVNode.$text$;
|
|
974
768
|
let defaultHolder;
|
|
975
|
-
if (
|
|
976
|
-
|
|
769
|
+
if (text === null) {
|
|
770
|
+
{
|
|
977
771
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
978
772
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
979
773
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
980
774
|
}
|
|
981
775
|
// element node
|
|
982
|
-
|
|
983
|
-
if (
|
|
776
|
+
{
|
|
777
|
+
if (tag === 'slot')
|
|
984
778
|
;
|
|
985
779
|
else {
|
|
986
780
|
// either this is the first render of an element OR it's an update
|
|
@@ -989,32 +783,32 @@ const patch = (oldVNode, newVNode) => {
|
|
|
989
783
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
990
784
|
}
|
|
991
785
|
}
|
|
992
|
-
if (
|
|
786
|
+
if (oldChildren !== null && newChildren !== null) {
|
|
993
787
|
// looks like there's child vnodes for both the old and new vnodes
|
|
994
788
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
995
789
|
}
|
|
996
790
|
else if (newChildren !== null) {
|
|
997
791
|
// no old child vnodes, but there are new child vnodes to add
|
|
998
|
-
if (
|
|
792
|
+
if (oldVNode.$text$ !== null) {
|
|
999
793
|
// the old vnode was text, so be sure to clear it out
|
|
1000
794
|
elm.textContent = '';
|
|
1001
795
|
}
|
|
1002
796
|
// add the new vnode children
|
|
1003
797
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
1004
798
|
}
|
|
1005
|
-
else if (
|
|
799
|
+
else if (oldChildren !== null) {
|
|
1006
800
|
// no new child vnodes, but there are old child vnodes to remove
|
|
1007
801
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
1008
802
|
}
|
|
1009
|
-
if (
|
|
803
|
+
if (isSvgMode && tag === 'svg') {
|
|
1010
804
|
isSvgMode = false;
|
|
1011
805
|
}
|
|
1012
806
|
}
|
|
1013
|
-
else if (
|
|
807
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
1014
808
|
// this element has slotted content
|
|
1015
809
|
defaultHolder.parentNode.textContent = text;
|
|
1016
810
|
}
|
|
1017
|
-
else if (
|
|
811
|
+
else if (oldVNode.$text$ !== text) {
|
|
1018
812
|
// update the text content for the text only vnode
|
|
1019
813
|
// and also only if the text is different than before
|
|
1020
814
|
elm.data = text;
|
|
@@ -1152,7 +946,7 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
|
1152
946
|
return slotNameAttr === '';
|
|
1153
947
|
};
|
|
1154
948
|
const callNodeRefs = (vNode) => {
|
|
1155
|
-
|
|
949
|
+
{
|
|
1156
950
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
1157
951
|
vNode.$children$ && vNode.$children$.map(callNodeRefs);
|
|
1158
952
|
}
|
|
@@ -1163,41 +957,23 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1163
957
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1164
958
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1165
959
|
hostTagName = hostElm.tagName;
|
|
1166
|
-
|
|
1167
|
-
if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
1168
|
-
throw new Error(`The <Host> must be the single root component.
|
|
1169
|
-
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
1170
|
-
|
|
1171
|
-
The render() function should look like this instead:
|
|
1172
|
-
|
|
1173
|
-
render() {
|
|
1174
|
-
// Do not return an array
|
|
1175
|
-
return (
|
|
1176
|
-
<Host>{content}</Host>
|
|
1177
|
-
);
|
|
1178
|
-
}
|
|
1179
|
-
`);
|
|
1180
|
-
}
|
|
1181
|
-
if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
|
|
960
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
1182
961
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
1183
962
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
1184
963
|
}
|
|
1185
964
|
rootVnode.$tag$ = null;
|
|
1186
965
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1187
966
|
hostRef.$vnode$ = rootVnode;
|
|
1188
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (
|
|
1189
|
-
|
|
1190
|
-
scopeId = hostElm['s-sc'];
|
|
1191
|
-
}
|
|
1192
|
-
if (BUILD.slotRelocation) {
|
|
967
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
968
|
+
{
|
|
1193
969
|
contentRef = hostElm['s-cr'];
|
|
1194
|
-
useNativeShadowDom =
|
|
970
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1195
971
|
// always reset
|
|
1196
972
|
checkSlotFallbackVisibility = false;
|
|
1197
973
|
}
|
|
1198
974
|
// synchronous patch
|
|
1199
975
|
patch(oldVNode, rootVnode);
|
|
1200
|
-
|
|
976
|
+
{
|
|
1201
977
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
1202
978
|
// the disconnectCallback from working
|
|
1203
979
|
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
@@ -1217,9 +993,7 @@ render() {
|
|
|
1217
993
|
// add a reference node marking this node's original location
|
|
1218
994
|
// keep a reference to this node for later lookups
|
|
1219
995
|
orgLocationNode =
|
|
1220
|
-
|
|
1221
|
-
? originalLocationDebugNode(nodeToRelocate)
|
|
1222
|
-
: doc.createTextNode('');
|
|
996
|
+
doc.createTextNode('');
|
|
1223
997
|
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
1224
998
|
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
1225
999
|
}
|
|
@@ -1276,21 +1050,11 @@ render() {
|
|
|
1276
1050
|
relocateNodes.length = 0;
|
|
1277
1051
|
}
|
|
1278
1052
|
};
|
|
1279
|
-
|
|
1280
|
-
// otherwise these nodes are text nodes w/out content
|
|
1281
|
-
const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
|
|
1282
|
-
const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
|
|
1283
|
-
(nodeToRelocate.localName
|
|
1284
|
-
? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
|
|
1285
|
-
: `[${nodeToRelocate.textContent}]`));
|
|
1286
|
-
const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
|
|
1053
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
1287
1054
|
const createEvent = (ref, name, flags) => {
|
|
1288
1055
|
const elm = getElement(ref);
|
|
1289
1056
|
return {
|
|
1290
1057
|
emit: (detail) => {
|
|
1291
|
-
if (BUILD.isDev && !elm.isConnected) {
|
|
1292
|
-
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
1293
|
-
}
|
|
1294
1058
|
return emitEvent(elm, name, {
|
|
1295
1059
|
bubbles: !!(flags & 4 /* Bubbles */),
|
|
1296
1060
|
composed: !!(flags & 2 /* Composed */),
|
|
@@ -1313,15 +1077,15 @@ const emitEvent = (elm, name, opts) => {
|
|
|
1313
1077
|
return ev;
|
|
1314
1078
|
};
|
|
1315
1079
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
1316
|
-
if (
|
|
1080
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
1317
1081
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
1318
1082
|
}
|
|
1319
1083
|
};
|
|
1320
1084
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
1321
|
-
|
|
1085
|
+
{
|
|
1322
1086
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1323
1087
|
}
|
|
1324
|
-
if (
|
|
1088
|
+
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
1325
1089
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1326
1090
|
return;
|
|
1327
1091
|
}
|
|
@@ -1330,34 +1094,25 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1330
1094
|
// has already fired off its lifecycle update then
|
|
1331
1095
|
// fire off the initial update
|
|
1332
1096
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1333
|
-
return
|
|
1097
|
+
return writeTask(dispatch) ;
|
|
1334
1098
|
};
|
|
1335
1099
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1336
|
-
const elm = hostRef.$hostElement$;
|
|
1337
1100
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1338
|
-
const instance =
|
|
1101
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1339
1102
|
let promise;
|
|
1340
1103
|
if (isInitialLoad) {
|
|
1341
|
-
|
|
1104
|
+
{
|
|
1342
1105
|
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1343
1106
|
if (hostRef.$queuedListeners$) {
|
|
1344
1107
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
1345
1108
|
hostRef.$queuedListeners$ = null;
|
|
1346
1109
|
}
|
|
1347
1110
|
}
|
|
1348
|
-
|
|
1349
|
-
if (BUILD.cmpWillLoad) {
|
|
1111
|
+
{
|
|
1350
1112
|
promise = safeCall(instance, 'componentWillLoad');
|
|
1351
1113
|
}
|
|
1352
1114
|
}
|
|
1353
|
-
|
|
1354
|
-
emitLifecycleEvent(elm, 'componentWillUpdate');
|
|
1355
|
-
if (BUILD.cmpWillUpdate) {
|
|
1356
|
-
promise = safeCall(instance, 'componentWillUpdate');
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
emitLifecycleEvent(elm, 'componentWillRender');
|
|
1360
|
-
if (BUILD.cmpWillRender) {
|
|
1115
|
+
{
|
|
1361
1116
|
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
|
|
1362
1117
|
}
|
|
1363
1118
|
endSchedule();
|
|
@@ -1368,46 +1123,18 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1368
1123
|
const elm = hostRef.$hostElement$;
|
|
1369
1124
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1370
1125
|
const rc = elm['s-rc'];
|
|
1371
|
-
if (
|
|
1126
|
+
if (isInitialLoad) {
|
|
1372
1127
|
// DOM WRITE!
|
|
1373
1128
|
attachStyles(hostRef);
|
|
1374
1129
|
}
|
|
1375
1130
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
1376
|
-
|
|
1377
|
-
hostRef
|
|
1378
|
-
}
|
|
1379
|
-
if (BUILD.hydrateServerSide) {
|
|
1380
|
-
await callRender(hostRef, instance, elm);
|
|
1131
|
+
{
|
|
1132
|
+
callRender(hostRef, instance);
|
|
1381
1133
|
}
|
|
1382
|
-
|
|
1383
|
-
callRender(hostRef, instance, elm);
|
|
1384
|
-
}
|
|
1385
|
-
if (BUILD.cssVarShim && plt.$cssShim$) {
|
|
1134
|
+
if (plt.$cssShim$) {
|
|
1386
1135
|
plt.$cssShim$.updateHost(elm);
|
|
1387
1136
|
}
|
|
1388
|
-
if (
|
|
1389
|
-
hostRef.$renderCount$++;
|
|
1390
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
1391
|
-
}
|
|
1392
|
-
if (BUILD.hydrateServerSide) {
|
|
1393
|
-
try {
|
|
1394
|
-
// manually connected child components during server-side hydrate
|
|
1395
|
-
serverSideConnected(elm);
|
|
1396
|
-
if (isInitialLoad) {
|
|
1397
|
-
// using only during server-side hydrate
|
|
1398
|
-
if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1399
|
-
elm['s-en'] = '';
|
|
1400
|
-
}
|
|
1401
|
-
else if (hostRef.$cmpMeta$.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
1402
|
-
elm['s-en'] = 'c';
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
catch (e) {
|
|
1407
|
-
consoleError(e, elm);
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
if (BUILD.asyncLoading && rc) {
|
|
1137
|
+
if (rc) {
|
|
1411
1138
|
// ok, so turns out there are some child host elements
|
|
1412
1139
|
// waiting on this parent element to load
|
|
1413
1140
|
// let's fire off all update callbacks waiting
|
|
@@ -1416,7 +1143,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1416
1143
|
}
|
|
1417
1144
|
endRender();
|
|
1418
1145
|
endUpdate();
|
|
1419
|
-
|
|
1146
|
+
{
|
|
1420
1147
|
const childrenPromises = elm['s-p'];
|
|
1421
1148
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1422
1149
|
if (childrenPromises.length === 0) {
|
|
@@ -1428,42 +1155,26 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1428
1155
|
childrenPromises.length = 0;
|
|
1429
1156
|
}
|
|
1430
1157
|
}
|
|
1431
|
-
else {
|
|
1432
|
-
postUpdateComponent(hostRef);
|
|
1433
|
-
}
|
|
1434
1158
|
};
|
|
1435
1159
|
const callRender = (hostRef, instance, elm) => {
|
|
1436
|
-
// in order for bundlers to correctly treeshake the BUILD object
|
|
1437
|
-
// we need to ensure BUILD is not deoptimized within a try/catch
|
|
1438
|
-
// https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
|
|
1439
|
-
const allRenderFn = BUILD.allRenderFn ? true : false;
|
|
1440
|
-
const lazyLoad = BUILD.lazyLoad ? true : false;
|
|
1441
|
-
const taskQueue = BUILD.taskQueue ? true : false;
|
|
1442
|
-
const updatable = BUILD.updatable ? true : false;
|
|
1443
1160
|
try {
|
|
1444
1161
|
renderingRef = instance;
|
|
1445
|
-
instance =
|
|
1446
|
-
|
|
1162
|
+
instance = instance.render && instance.render();
|
|
1163
|
+
{
|
|
1447
1164
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1448
1165
|
}
|
|
1449
|
-
|
|
1166
|
+
{
|
|
1450
1167
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1451
1168
|
}
|
|
1452
|
-
|
|
1453
|
-
|
|
1169
|
+
{
|
|
1170
|
+
{
|
|
1454
1171
|
// looks like we've got child nodes to render into this host element
|
|
1455
1172
|
// or we need to update the css class/attrs on the host element
|
|
1456
1173
|
// DOM WRITE!
|
|
1457
|
-
|
|
1458
|
-
return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
|
|
1459
|
-
}
|
|
1460
|
-
else {
|
|
1174
|
+
{
|
|
1461
1175
|
renderVdom(hostRef, instance);
|
|
1462
1176
|
}
|
|
1463
1177
|
}
|
|
1464
|
-
else {
|
|
1465
|
-
elm.textContent = instance;
|
|
1466
|
-
}
|
|
1467
1178
|
}
|
|
1468
1179
|
}
|
|
1469
1180
|
catch (e) {
|
|
@@ -1477,68 +1188,37 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1477
1188
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
1478
1189
|
const elm = hostRef.$hostElement$;
|
|
1479
1190
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
1480
|
-
const instance =
|
|
1191
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1481
1192
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1482
|
-
|
|
1483
|
-
if (BUILD.isDev) {
|
|
1484
|
-
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
1485
|
-
}
|
|
1193
|
+
{
|
|
1486
1194
|
safeCall(instance, 'componentDidRender');
|
|
1487
|
-
if (BUILD.isDev) {
|
|
1488
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
1489
|
-
}
|
|
1490
1195
|
}
|
|
1491
|
-
emitLifecycleEvent(elm, 'componentDidRender');
|
|
1492
1196
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1493
1197
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1494
|
-
|
|
1198
|
+
{
|
|
1495
1199
|
// DOM WRITE!
|
|
1496
1200
|
addHydratedFlag(elm);
|
|
1497
1201
|
}
|
|
1498
|
-
|
|
1499
|
-
if (BUILD.isDev) {
|
|
1500
|
-
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
1501
|
-
}
|
|
1202
|
+
{
|
|
1502
1203
|
safeCall(instance, 'componentDidLoad');
|
|
1503
|
-
if (BUILD.isDev) {
|
|
1504
|
-
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
1505
|
-
}
|
|
1506
1204
|
}
|
|
1507
|
-
emitLifecycleEvent(elm, 'componentDidLoad');
|
|
1508
1205
|
endPostUpdate();
|
|
1509
|
-
|
|
1206
|
+
{
|
|
1510
1207
|
hostRef.$onReadyResolve$(elm);
|
|
1511
1208
|
if (!ancestorComponent) {
|
|
1512
|
-
appDidLoad(
|
|
1209
|
+
appDidLoad();
|
|
1513
1210
|
}
|
|
1514
1211
|
}
|
|
1515
1212
|
}
|
|
1516
1213
|
else {
|
|
1517
|
-
if (BUILD.cmpDidUpdate) {
|
|
1518
|
-
// we've already loaded this component
|
|
1519
|
-
// fire off the user's componentDidUpdate method (if one was provided)
|
|
1520
|
-
// componentDidUpdate runs AFTER render() has been called
|
|
1521
|
-
// and all child components have finished updating
|
|
1522
|
-
if (BUILD.isDev) {
|
|
1523
|
-
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
1524
|
-
}
|
|
1525
|
-
safeCall(instance, 'componentDidUpdate');
|
|
1526
|
-
if (BUILD.isDev) {
|
|
1527
|
-
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
emitLifecycleEvent(elm, 'componentDidUpdate');
|
|
1531
1214
|
endPostUpdate();
|
|
1532
1215
|
}
|
|
1533
|
-
|
|
1534
|
-
elm['s-hmr-load'] && elm['s-hmr-load']();
|
|
1535
|
-
}
|
|
1536
|
-
if (BUILD.method && BUILD.lazyLoad) {
|
|
1216
|
+
{
|
|
1537
1217
|
hostRef.$onInstanceResolve$(elm);
|
|
1538
1218
|
}
|
|
1539
1219
|
// load events fire from bottom to top
|
|
1540
1220
|
// the deepest elements load first then bubbles up
|
|
1541
|
-
|
|
1221
|
+
{
|
|
1542
1222
|
if (hostRef.$onRenderResolve$) {
|
|
1543
1223
|
hostRef.$onRenderResolve$();
|
|
1544
1224
|
hostRef.$onRenderResolve$ = undefined;
|
|
@@ -1553,7 +1233,7 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1553
1233
|
// (⌐■_■)
|
|
1554
1234
|
};
|
|
1555
1235
|
const forceUpdate = (ref) => {
|
|
1556
|
-
|
|
1236
|
+
{
|
|
1557
1237
|
const hostRef = getHostRef(ref);
|
|
1558
1238
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
1559
1239
|
if (isConnected &&
|
|
@@ -1563,21 +1243,14 @@ const forceUpdate = (ref) => {
|
|
|
1563
1243
|
// Returns "true" when the forced update was successfully scheduled
|
|
1564
1244
|
return isConnected;
|
|
1565
1245
|
}
|
|
1566
|
-
return false;
|
|
1567
1246
|
};
|
|
1568
1247
|
const appDidLoad = (who) => {
|
|
1569
1248
|
// on appload
|
|
1570
1249
|
// we have finish the first big initial render
|
|
1571
|
-
|
|
1250
|
+
{
|
|
1572
1251
|
addHydratedFlag(doc.documentElement);
|
|
1573
1252
|
}
|
|
1574
|
-
if (BUILD.asyncQueue) {
|
|
1575
|
-
plt.$flags$ |= 2 /* appLoaded */;
|
|
1576
|
-
}
|
|
1577
1253
|
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
|
1578
|
-
if (BUILD.profile && performance.measure) {
|
|
1579
|
-
performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
|
|
1580
|
-
}
|
|
1581
1254
|
};
|
|
1582
1255
|
const safeCall = (instance, method, arg) => {
|
|
1583
1256
|
if (instance && instance[method]) {
|
|
@@ -1593,239 +1266,8 @@ const safeCall = (instance, method, arg) => {
|
|
|
1593
1266
|
const then = (promise, thenFn) => {
|
|
1594
1267
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1595
1268
|
};
|
|
1596
|
-
const
|
|
1597
|
-
|
|
1598
|
-
emitEvent(elm, 'stencil_' + lifecycleName, {
|
|
1599
|
-
bubbles: true,
|
|
1600
|
-
composed: true,
|
|
1601
|
-
detail: {
|
|
1602
|
-
namespace: NAMESPACE,
|
|
1603
|
-
},
|
|
1604
|
-
});
|
|
1605
|
-
}
|
|
1606
|
-
};
|
|
1607
|
-
const addHydratedFlag = (elm) => BUILD.hydratedClass
|
|
1608
|
-
? elm.classList.add('hydrated')
|
|
1609
|
-
: BUILD.hydratedAttribute
|
|
1610
|
-
? elm.setAttribute('hydrated', '')
|
|
1611
|
-
: undefined;
|
|
1612
|
-
const serverSideConnected = (elm) => {
|
|
1613
|
-
const children = elm.children;
|
|
1614
|
-
if (children != null) {
|
|
1615
|
-
for (let i = 0, ii = children.length; i < ii; i++) {
|
|
1616
|
-
const childElm = children[i];
|
|
1617
|
-
if (typeof childElm.connectedCallback === 'function') {
|
|
1618
|
-
childElm.connectedCallback();
|
|
1619
|
-
}
|
|
1620
|
-
serverSideConnected(childElm);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
};
|
|
1624
|
-
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1625
|
-
const endHydrate = createTime('hydrateClient', tagName);
|
|
1626
|
-
const shadowRoot = hostElm.shadowRoot;
|
|
1627
|
-
const childRenderNodes = [];
|
|
1628
|
-
const slotNodes = [];
|
|
1629
|
-
const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
|
|
1630
|
-
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
1631
|
-
if (!plt.$orgLocNodes$) {
|
|
1632
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
1633
|
-
}
|
|
1634
|
-
hostElm[HYDRATE_ID] = hostId;
|
|
1635
|
-
hostElm.removeAttribute(HYDRATE_ID);
|
|
1636
|
-
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
1637
|
-
childRenderNodes.map((c) => {
|
|
1638
|
-
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
1639
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
1640
|
-
const node = c.$elm$;
|
|
1641
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
1642
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
1643
|
-
}
|
|
1644
|
-
if (!shadowRoot) {
|
|
1645
|
-
node['s-hn'] = tagName;
|
|
1646
|
-
if (orgLocationNode) {
|
|
1647
|
-
node['s-ol'] = orgLocationNode;
|
|
1648
|
-
node['s-ol']['s-nr'] = node;
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
1652
|
-
});
|
|
1653
|
-
if (BUILD.shadowDom && shadowRoot) {
|
|
1654
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
1655
|
-
if (shadowRootNode) {
|
|
1656
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
1657
|
-
}
|
|
1658
|
-
});
|
|
1659
|
-
}
|
|
1660
|
-
endHydrate();
|
|
1661
|
-
};
|
|
1662
|
-
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
1663
|
-
let childNodeType;
|
|
1664
|
-
let childIdSplt;
|
|
1665
|
-
let childVNode;
|
|
1666
|
-
let i;
|
|
1667
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
1668
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
1669
|
-
if (childNodeType) {
|
|
1670
|
-
// got the node data from the element's attribute
|
|
1671
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
1672
|
-
childIdSplt = childNodeType.split('.');
|
|
1673
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
1674
|
-
childVNode = {
|
|
1675
|
-
$flags$: 0,
|
|
1676
|
-
$hostId$: childIdSplt[0],
|
|
1677
|
-
$nodeId$: childIdSplt[1],
|
|
1678
|
-
$depth$: childIdSplt[2],
|
|
1679
|
-
$index$: childIdSplt[3],
|
|
1680
|
-
$tag$: node.tagName.toLowerCase(),
|
|
1681
|
-
$elm$: node,
|
|
1682
|
-
$attrs$: null,
|
|
1683
|
-
$children$: null,
|
|
1684
|
-
$key$: null,
|
|
1685
|
-
$name$: null,
|
|
1686
|
-
$text$: null,
|
|
1687
|
-
};
|
|
1688
|
-
childRenderNodes.push(childVNode);
|
|
1689
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
1690
|
-
// this is a new child vnode
|
|
1691
|
-
// so ensure its parent vnode has the vchildren array
|
|
1692
|
-
if (!parentVNode.$children$) {
|
|
1693
|
-
parentVNode.$children$ = [];
|
|
1694
|
-
}
|
|
1695
|
-
// add our child vnode to a specific index of the vnode's children
|
|
1696
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1697
|
-
// this is now the new parent vnode for all the next child checks
|
|
1698
|
-
parentVNode = childVNode;
|
|
1699
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1700
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
// recursively drill down, end to start so we can remove nodes
|
|
1705
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
1706
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
1707
|
-
}
|
|
1708
|
-
if (node.shadowRoot) {
|
|
1709
|
-
// keep drilling down through the shadow root nodes
|
|
1710
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
1711
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
else if (node.nodeType === 8 /* CommentNode */) {
|
|
1716
|
-
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
1717
|
-
childIdSplt = node.nodeValue.split('.');
|
|
1718
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
1719
|
-
// comment node for either the host id or a 0 host id
|
|
1720
|
-
childNodeType = childIdSplt[0];
|
|
1721
|
-
childVNode = {
|
|
1722
|
-
$flags$: 0,
|
|
1723
|
-
$hostId$: childIdSplt[1],
|
|
1724
|
-
$nodeId$: childIdSplt[2],
|
|
1725
|
-
$depth$: childIdSplt[3],
|
|
1726
|
-
$index$: childIdSplt[4],
|
|
1727
|
-
$elm$: node,
|
|
1728
|
-
$attrs$: null,
|
|
1729
|
-
$children$: null,
|
|
1730
|
-
$key$: null,
|
|
1731
|
-
$name$: null,
|
|
1732
|
-
$tag$: null,
|
|
1733
|
-
$text$: null,
|
|
1734
|
-
};
|
|
1735
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
1736
|
-
childVNode.$elm$ = node.nextSibling;
|
|
1737
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
|
|
1738
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
1739
|
-
childRenderNodes.push(childVNode);
|
|
1740
|
-
// remove the text comment since it's no longer needed
|
|
1741
|
-
node.remove();
|
|
1742
|
-
if (!parentVNode.$children$) {
|
|
1743
|
-
parentVNode.$children$ = [];
|
|
1744
|
-
}
|
|
1745
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1746
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
1747
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
else if (childVNode.$hostId$ === hostId) {
|
|
1752
|
-
// this comment node is specifcally for this host id
|
|
1753
|
-
if (childNodeType === SLOT_NODE_ID) {
|
|
1754
|
-
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
1755
|
-
childVNode.$tag$ = 'slot';
|
|
1756
|
-
if (childIdSplt[5]) {
|
|
1757
|
-
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
1758
|
-
}
|
|
1759
|
-
else {
|
|
1760
|
-
node['s-sn'] = '';
|
|
1761
|
-
}
|
|
1762
|
-
node['s-sr'] = true;
|
|
1763
|
-
if (BUILD.shadowDom && shadowRootNodes) {
|
|
1764
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
1765
|
-
// create an actual slot element
|
|
1766
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
1767
|
-
if (childVNode.$name$) {
|
|
1768
|
-
// add the slot name attribute
|
|
1769
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
1770
|
-
}
|
|
1771
|
-
// insert the new slot element before the slot comment
|
|
1772
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
1773
|
-
// remove the slot comment since it's not needed for shadow
|
|
1774
|
-
node.remove();
|
|
1775
|
-
if (childVNode.$depth$ === '0') {
|
|
1776
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
slotNodes.push(childVNode);
|
|
1780
|
-
if (!parentVNode.$children$) {
|
|
1781
|
-
parentVNode.$children$ = [];
|
|
1782
|
-
}
|
|
1783
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
1784
|
-
}
|
|
1785
|
-
else if (childNodeType === CONTENT_REF_ID) {
|
|
1786
|
-
// `${CONTENT_REF_ID}.${hostId}`;
|
|
1787
|
-
if (BUILD.shadowDom && shadowRootNodes) {
|
|
1788
|
-
// remove the content ref comment since it's not needed for shadow
|
|
1789
|
-
node.remove();
|
|
1790
|
-
}
|
|
1791
|
-
else if (BUILD.slotRelocation) {
|
|
1792
|
-
hostElm['s-cr'] = node;
|
|
1793
|
-
node['s-cn'] = true;
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
1800
|
-
const vnode = newVNode(null, node.textContent);
|
|
1801
|
-
vnode.$elm$ = node;
|
|
1802
|
-
vnode.$index$ = '0';
|
|
1803
|
-
parentVNode.$children$ = [vnode];
|
|
1804
|
-
}
|
|
1805
|
-
};
|
|
1806
|
-
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
1807
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
1808
|
-
let i = 0;
|
|
1809
|
-
for (; i < node.childNodes.length; i++) {
|
|
1810
|
-
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
1811
|
-
}
|
|
1812
|
-
if (node.shadowRoot) {
|
|
1813
|
-
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
1814
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
else if (node.nodeType === 8 /* CommentNode */) {
|
|
1819
|
-
const childIdSplt = node.nodeValue.split('.');
|
|
1820
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
1821
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
1822
|
-
node.nodeValue = '';
|
|
1823
|
-
// useful to know if the original location is
|
|
1824
|
-
// the root light-dom of a shadow dom component
|
|
1825
|
-
node['s-en'] = childIdSplt[3];
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1269
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1270
|
+
;
|
|
1829
1271
|
/**
|
|
1830
1272
|
* Parse a new property value for a given property type.
|
|
1831
1273
|
*
|
|
@@ -1852,16 +1294,16 @@ const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
|
1852
1294
|
const parsePropertyValue = (propValue, propType) => {
|
|
1853
1295
|
// ensure this value is of the correct prop type
|
|
1854
1296
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1855
|
-
if (
|
|
1297
|
+
if (propType & 4 /* Boolean */) {
|
|
1856
1298
|
// per the HTML spec, any string value means it is a boolean true value
|
|
1857
1299
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1858
1300
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1859
1301
|
}
|
|
1860
|
-
if (
|
|
1302
|
+
if (propType & 2 /* Number */) {
|
|
1861
1303
|
// force it to be a number
|
|
1862
1304
|
return parseFloat(propValue);
|
|
1863
1305
|
}
|
|
1864
|
-
if (
|
|
1306
|
+
if (propType & 1 /* String */) {
|
|
1865
1307
|
// could have been passed as a number or boolean
|
|
1866
1308
|
// but we still want it as a string
|
|
1867
1309
|
return String(propValue);
|
|
@@ -1877,29 +1319,21 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
1877
1319
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1878
1320
|
// check our new property value against our internal value
|
|
1879
1321
|
const hostRef = getHostRef(ref);
|
|
1880
|
-
const elm =
|
|
1322
|
+
const elm = hostRef.$hostElement$ ;
|
|
1881
1323
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1882
1324
|
const flags = hostRef.$flags$;
|
|
1883
|
-
const instance =
|
|
1325
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1884
1326
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
1885
1327
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1886
1328
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1887
1329
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1888
|
-
if ((!
|
|
1330
|
+
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1889
1331
|
// gadzooks! the property's value has changed!!
|
|
1890
1332
|
// set our new value!
|
|
1891
1333
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1892
|
-
if (
|
|
1893
|
-
if (hostRef.$flags$ & 1024 /* devOnRender */) {
|
|
1894
|
-
consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
|
|
1895
|
-
}
|
|
1896
|
-
else if (hostRef.$flags$ & 2048 /* devOnDidLoad */) {
|
|
1897
|
-
consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
if (!BUILD.lazyLoad || instance) {
|
|
1334
|
+
if (instance) {
|
|
1901
1335
|
// get an array of method names of watch functions to call
|
|
1902
|
-
if (
|
|
1336
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1903
1337
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1904
1338
|
if (watchMethods) {
|
|
1905
1339
|
// this instance is watching for when this property changed
|
|
@@ -1914,13 +1348,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1914
1348
|
});
|
|
1915
1349
|
}
|
|
1916
1350
|
}
|
|
1917
|
-
if (
|
|
1918
|
-
(flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1919
|
-
if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
|
|
1920
|
-
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
1921
|
-
return;
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1351
|
+
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1924
1352
|
// looks like this value actually changed, so we've got work to do!
|
|
1925
1353
|
// but only if we've already rendered, otherwise just chill out
|
|
1926
1354
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1931,17 +1359,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1931
1359
|
}
|
|
1932
1360
|
};
|
|
1933
1361
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1934
|
-
if (
|
|
1935
|
-
if (
|
|
1362
|
+
if (cmpMeta.$members$) {
|
|
1363
|
+
if (Cstr.watchers) {
|
|
1936
1364
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1937
1365
|
}
|
|
1938
1366
|
// It's better to have a const than two Object.entries()
|
|
1939
1367
|
const members = Object.entries(cmpMeta.$members$);
|
|
1940
1368
|
const prototype = Cstr.prototype;
|
|
1941
1369
|
members.map(([memberName, [memberFlags]]) => {
|
|
1942
|
-
if ((
|
|
1943
|
-
|
|
1944
|
-
((!BUILD.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1370
|
+
if ((memberFlags & 31 /* Prop */ ||
|
|
1371
|
+
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1945
1372
|
// proxyComponent - prop
|
|
1946
1373
|
Object.defineProperty(prototype, memberName, {
|
|
1947
1374
|
get() {
|
|
@@ -1949,21 +1376,6 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1949
1376
|
return getValue(this, memberName);
|
|
1950
1377
|
},
|
|
1951
1378
|
set(newValue) {
|
|
1952
|
-
// only during dev time
|
|
1953
|
-
if (BUILD.isDev) {
|
|
1954
|
-
const ref = getHostRef(this);
|
|
1955
|
-
if (
|
|
1956
|
-
// we are proxying the instance (not element)
|
|
1957
|
-
(flags & 1 /* isElementConstructor */) === 0 &&
|
|
1958
|
-
// the element is not constructing
|
|
1959
|
-
(ref.$flags$ & 8 /* isConstructingInstance */) === 0 &&
|
|
1960
|
-
// the member is a prop
|
|
1961
|
-
(memberFlags & 31 /* Prop */) !== 0 &&
|
|
1962
|
-
// the member is not mutable
|
|
1963
|
-
(memberFlags & 1024 /* Mutable */) === 0) {
|
|
1964
|
-
consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://stenciljs.com/docs/properties#prop-mutability`);
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
1379
|
// proxyComponent, set value
|
|
1968
1380
|
setValue(this, memberName, newValue, cmpMeta);
|
|
1969
1381
|
},
|
|
@@ -1971,9 +1383,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1971
1383
|
enumerable: true,
|
|
1972
1384
|
});
|
|
1973
1385
|
}
|
|
1974
|
-
else if (
|
|
1975
|
-
BUILD.method &&
|
|
1976
|
-
flags & 1 /* isElementConstructor */ &&
|
|
1386
|
+
else if (flags & 1 /* isElementConstructor */ &&
|
|
1977
1387
|
memberFlags & 64 /* Method */) {
|
|
1978
1388
|
// proxyComponent - method
|
|
1979
1389
|
Object.defineProperty(prototype, memberName, {
|
|
@@ -1984,7 +1394,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1984
1394
|
});
|
|
1985
1395
|
}
|
|
1986
1396
|
});
|
|
1987
|
-
if (
|
|
1397
|
+
if ((flags & 1 /* isElementConstructor */)) {
|
|
1988
1398
|
const attrNameToPropName = new Map();
|
|
1989
1399
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1990
1400
|
plt.jmp(() => {
|
|
@@ -2044,7 +1454,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2044
1454
|
.map(([propName, m]) => {
|
|
2045
1455
|
const attrName = m[1] || propName;
|
|
2046
1456
|
attrNameToPropName.set(attrName, propName);
|
|
2047
|
-
if (
|
|
1457
|
+
if (m[0] & 512 /* ReflectAttr */) {
|
|
2048
1458
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
2049
1459
|
}
|
|
2050
1460
|
return attrName;
|
|
@@ -2055,29 +1465,25 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
2055
1465
|
};
|
|
2056
1466
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
2057
1467
|
// initializeComponent
|
|
2058
|
-
if ((
|
|
2059
|
-
|
|
2060
|
-
if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
|
|
1468
|
+
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1469
|
+
{
|
|
2061
1470
|
// we haven't initialized this element yet
|
|
2062
1471
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
2063
1472
|
// lazy loaded components
|
|
2064
1473
|
// request the component's implementation to be
|
|
2065
1474
|
// wired up with the host element
|
|
2066
|
-
Cstr = loadModule(cmpMeta
|
|
1475
|
+
Cstr = loadModule(cmpMeta);
|
|
2067
1476
|
if (Cstr.then) {
|
|
2068
1477
|
// Await creates a micro-task avoid if possible
|
|
2069
|
-
const endLoad = uniqueTime(
|
|
1478
|
+
const endLoad = uniqueTime();
|
|
2070
1479
|
Cstr = await Cstr;
|
|
2071
1480
|
endLoad();
|
|
2072
1481
|
}
|
|
2073
|
-
if (
|
|
2074
|
-
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
2075
|
-
}
|
|
2076
|
-
if (BUILD.member && !Cstr.isProxied) {
|
|
1482
|
+
if (!Cstr.isProxied) {
|
|
2077
1483
|
// we've never proxied this Constructor before
|
|
2078
1484
|
// let's add the getters/setters to its prototype before
|
|
2079
1485
|
// the first time we create an instance of the implementation
|
|
2080
|
-
|
|
1486
|
+
{
|
|
2081
1487
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
2082
1488
|
}
|
|
2083
1489
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
@@ -2087,7 +1493,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2087
1493
|
// ok, time to construct the instance
|
|
2088
1494
|
// but let's keep track of when we start and stop
|
|
2089
1495
|
// so that the getters/setters don't incorrectly step on data
|
|
2090
|
-
|
|
1496
|
+
{
|
|
2091
1497
|
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
2092
1498
|
}
|
|
2093
1499
|
// construct the lazy-loaded component implementation
|
|
@@ -2100,42 +1506,21 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2100
1506
|
catch (e) {
|
|
2101
1507
|
consoleError(e);
|
|
2102
1508
|
}
|
|
2103
|
-
|
|
1509
|
+
{
|
|
2104
1510
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
2105
1511
|
}
|
|
2106
|
-
|
|
1512
|
+
{
|
|
2107
1513
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
2108
1514
|
}
|
|
2109
1515
|
endNewInstance();
|
|
2110
1516
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
2111
1517
|
}
|
|
2112
|
-
|
|
2113
|
-
// sync constructor component
|
|
2114
|
-
Cstr = elm.constructor;
|
|
2115
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
2116
|
-
// wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
|
|
2117
|
-
// watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
|
|
2118
|
-
// Stencil has completed instantiating the component.
|
|
2119
|
-
customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* isWatchReady */));
|
|
2120
|
-
}
|
|
2121
|
-
if (BUILD.style && Cstr.style) {
|
|
1518
|
+
if (Cstr.style) {
|
|
2122
1519
|
// this component has styles but we haven't registered them yet
|
|
2123
1520
|
let style = Cstr.style;
|
|
2124
|
-
|
|
2125
|
-
style = style[(hostRef.$modeName$ = computeMode(elm))];
|
|
2126
|
-
if (BUILD.hydrateServerSide && hostRef.$modeName$) {
|
|
2127
|
-
elm.setAttribute('s-mode', hostRef.$modeName$);
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
1521
|
+
const scopeId = getScopeId(cmpMeta);
|
|
2131
1522
|
if (!styles.has(scopeId)) {
|
|
2132
1523
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
2133
|
-
if (!BUILD.hydrateServerSide &&
|
|
2134
|
-
BUILD.shadowDom &&
|
|
2135
|
-
BUILD.shadowDomShim &&
|
|
2136
|
-
cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
2137
|
-
style = await __sc_import_revo_grid('./shadow-css-602a09db.js').then((m) => m.scopeCss(style, scopeId, false));
|
|
2138
|
-
}
|
|
2139
1524
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
2140
1525
|
endRegisterStyles();
|
|
2141
1526
|
}
|
|
@@ -2144,7 +1529,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2144
1529
|
// we've successfully created a lazy instance
|
|
2145
1530
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2146
1531
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
2147
|
-
if (
|
|
1532
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
2148
1533
|
// this is the initial load and this component it has an ancestor component
|
|
2149
1534
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
2150
1535
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -2158,7 +1543,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
2158
1543
|
}
|
|
2159
1544
|
};
|
|
2160
1545
|
const fireConnectedCallback = (instance) => {
|
|
2161
|
-
|
|
1546
|
+
{
|
|
2162
1547
|
safeCall(instance, 'connectedCallback');
|
|
2163
1548
|
}
|
|
2164
1549
|
};
|
|
@@ -2167,49 +1552,26 @@ const connectedCallback = (elm) => {
|
|
|
2167
1552
|
const hostRef = getHostRef(elm);
|
|
2168
1553
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
2169
1554
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
2170
|
-
if (BUILD.hostListenerTargetParent) {
|
|
2171
|
-
// only run if we have listeners being attached to a parent
|
|
2172
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
2173
|
-
}
|
|
2174
1555
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
2175
1556
|
// first time this component has connected
|
|
2176
1557
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
2177
|
-
|
|
2178
|
-
if (BUILD.hydrateClientSide) {
|
|
2179
|
-
hostId = elm.getAttribute(HYDRATE_ID);
|
|
2180
|
-
if (hostId) {
|
|
2181
|
-
if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2182
|
-
const scopeId = BUILD.mode
|
|
2183
|
-
? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
|
|
2184
|
-
: addStyle(elm.shadowRoot, cmpMeta);
|
|
2185
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
2186
|
-
}
|
|
2187
|
-
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
if (BUILD.slotRelocation && !hostId) {
|
|
1558
|
+
{
|
|
2191
1559
|
// initUpdate
|
|
2192
1560
|
// if the slot polyfill is required we'll need to put some nodes
|
|
2193
1561
|
// in here to act as original content anchors as we move nodes around
|
|
2194
1562
|
// host element has been connected to the DOM
|
|
2195
|
-
if (
|
|
2196
|
-
((BUILD.slot || BUILD.shadowDom) &&
|
|
2197
|
-
cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1563
|
+
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
2198
1564
|
setContentReference(elm);
|
|
2199
1565
|
}
|
|
2200
1566
|
}
|
|
2201
|
-
|
|
1567
|
+
{
|
|
2202
1568
|
// find the first ancestor component (if there is one) and register
|
|
2203
1569
|
// this component as one of the actively loading child components for its ancestor
|
|
2204
1570
|
let ancestorComponent = elm;
|
|
2205
1571
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
2206
1572
|
// climb up the ancestors looking for the first
|
|
2207
1573
|
// component that hasn't finished its lifecycle update yet
|
|
2208
|
-
if (
|
|
2209
|
-
ancestorComponent.nodeType === 1 /* ElementNode */ &&
|
|
2210
|
-
ancestorComponent.hasAttribute('s-id') &&
|
|
2211
|
-
ancestorComponent['s-p']) ||
|
|
2212
|
-
ancestorComponent['s-p']) {
|
|
1574
|
+
if (ancestorComponent['s-p']) {
|
|
2213
1575
|
// we found this components first ancestor component
|
|
2214
1576
|
// keep a reference to this component's ancestor component
|
|
2215
1577
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -2219,7 +1581,7 @@ const connectedCallback = (elm) => {
|
|
|
2219
1581
|
}
|
|
2220
1582
|
// Lazy properties
|
|
2221
1583
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
2222
|
-
if (
|
|
1584
|
+
if (cmpMeta.$members$) {
|
|
2223
1585
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
2224
1586
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
2225
1587
|
const value = elm[memberName];
|
|
@@ -2228,22 +1590,19 @@ const connectedCallback = (elm) => {
|
|
|
2228
1590
|
}
|
|
2229
1591
|
});
|
|
2230
1592
|
}
|
|
2231
|
-
|
|
1593
|
+
{
|
|
2232
1594
|
// connectedCallback, taskQueue, initialLoad
|
|
2233
1595
|
// angular sets attribute AFTER connectCallback
|
|
2234
1596
|
// https://github.com/angular/angular/issues/18909
|
|
2235
1597
|
// https://github.com/angular/angular/issues/19940
|
|
2236
1598
|
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
2237
1599
|
}
|
|
2238
|
-
else {
|
|
2239
|
-
initializeComponent(elm, hostRef, cmpMeta);
|
|
2240
|
-
}
|
|
2241
1600
|
}
|
|
2242
1601
|
else {
|
|
2243
1602
|
// not the first time this has connected
|
|
2244
1603
|
// reattach any event listeners to the host
|
|
2245
1604
|
// since they would have been removed when disconnected
|
|
2246
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
1605
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2247
1606
|
// fire off connectedCallback() on component instance
|
|
2248
1607
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
2249
1608
|
}
|
|
@@ -2257,316 +1616,31 @@ const setContentReference = (elm) => {
|
|
|
2257
1616
|
// let's pick out the inner content for slot projection
|
|
2258
1617
|
// create a node to represent where the original
|
|
2259
1618
|
// content was first placed, which is useful later on
|
|
2260
|
-
const contentRefElm = (elm['s-cr'] = doc.createComment(
|
|
1619
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
2261
1620
|
contentRefElm['s-cn'] = true;
|
|
2262
1621
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
2263
1622
|
};
|
|
2264
1623
|
const disconnectedCallback = (elm) => {
|
|
2265
1624
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
2266
1625
|
const hostRef = getHostRef(elm);
|
|
2267
|
-
const instance =
|
|
2268
|
-
|
|
1626
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1627
|
+
{
|
|
2269
1628
|
if (hostRef.$rmListeners$) {
|
|
2270
1629
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
2271
1630
|
hostRef.$rmListeners$ = undefined;
|
|
2272
1631
|
}
|
|
2273
1632
|
}
|
|
2274
1633
|
// clear CSS var-shim tracking
|
|
2275
|
-
if (
|
|
1634
|
+
if (plt.$cssShim$) {
|
|
2276
1635
|
plt.$cssShim$.removeHost(elm);
|
|
2277
1636
|
}
|
|
2278
|
-
|
|
1637
|
+
{
|
|
2279
1638
|
safeCall(instance, 'disconnectedCallback');
|
|
2280
1639
|
}
|
|
2281
|
-
if (BUILD.cmpDidUnload) {
|
|
2282
|
-
safeCall(instance, 'componentDidUnload');
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
};
|
|
2286
|
-
const defineCustomElement = (Cstr, compactMeta) => {
|
|
2287
|
-
customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
|
|
2288
|
-
};
|
|
2289
|
-
const proxyCustomElement = (Cstr, compactMeta) => {
|
|
2290
|
-
const cmpMeta = {
|
|
2291
|
-
$flags$: compactMeta[0],
|
|
2292
|
-
$tagName$: compactMeta[1],
|
|
2293
|
-
};
|
|
2294
|
-
if (BUILD.member) {
|
|
2295
|
-
cmpMeta.$members$ = compactMeta[2];
|
|
2296
|
-
}
|
|
2297
|
-
if (BUILD.hostListener) {
|
|
2298
|
-
cmpMeta.$listeners$ = compactMeta[3];
|
|
2299
|
-
}
|
|
2300
|
-
if (BUILD.watchCallback) {
|
|
2301
|
-
cmpMeta.$watchers$ = Cstr.$watchers$;
|
|
2302
|
-
}
|
|
2303
|
-
if (BUILD.reflect) {
|
|
2304
|
-
cmpMeta.$attrsToReflect$ = [];
|
|
2305
|
-
}
|
|
2306
|
-
if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2307
|
-
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
2308
|
-
}
|
|
2309
|
-
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
2310
|
-
const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
|
|
2311
|
-
Object.assign(Cstr.prototype, {
|
|
2312
|
-
__registerHost() {
|
|
2313
|
-
registerHost(this, cmpMeta);
|
|
2314
|
-
},
|
|
2315
|
-
connectedCallback() {
|
|
2316
|
-
connectedCallback(this);
|
|
2317
|
-
if (BUILD.connectedCallback && originalConnectedCallback) {
|
|
2318
|
-
originalConnectedCallback.call(this);
|
|
2319
|
-
}
|
|
2320
|
-
},
|
|
2321
|
-
disconnectedCallback() {
|
|
2322
|
-
disconnectedCallback(this);
|
|
2323
|
-
if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
|
|
2324
|
-
originalDisconnectedCallback.call(this);
|
|
2325
|
-
}
|
|
2326
|
-
},
|
|
2327
|
-
__attachShadow() {
|
|
2328
|
-
if (supportsShadow) {
|
|
2329
|
-
if (BUILD.shadowDelegatesFocus) {
|
|
2330
|
-
this.attachShadow({
|
|
2331
|
-
mode: 'open',
|
|
2332
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */),
|
|
2333
|
-
});
|
|
2334
|
-
}
|
|
2335
|
-
else {
|
|
2336
|
-
this.attachShadow({ mode: 'open' });
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
else {
|
|
2340
|
-
this.shadowRoot = this;
|
|
2341
|
-
}
|
|
2342
|
-
},
|
|
2343
|
-
});
|
|
2344
|
-
Cstr.is = cmpMeta.$tagName$;
|
|
2345
|
-
return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
|
|
2346
|
-
};
|
|
2347
|
-
const forceModeUpdate = (elm) => {
|
|
2348
|
-
if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
|
|
2349
|
-
const mode = computeMode(elm);
|
|
2350
|
-
const hostRef = getHostRef(elm);
|
|
2351
|
-
if (hostRef.$modeName$ !== mode) {
|
|
2352
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
2353
|
-
const oldScopeId = elm['s-sc'];
|
|
2354
|
-
const scopeId = getScopeId(cmpMeta, mode);
|
|
2355
|
-
const style = elm.constructor.style[mode];
|
|
2356
|
-
const flags = cmpMeta.$flags$;
|
|
2357
|
-
if (style) {
|
|
2358
|
-
if (!styles.has(scopeId)) {
|
|
2359
|
-
registerStyle(scopeId, style, !!(flags & 1 /* shadowDomEncapsulation */));
|
|
2360
|
-
}
|
|
2361
|
-
hostRef.$modeName$ = mode;
|
|
2362
|
-
elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
|
|
2363
|
-
attachStyles(hostRef);
|
|
2364
|
-
forceUpdate(elm);
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
};
|
|
2369
|
-
const hmrStart = (elm, cmpMeta, hmrVersionId) => {
|
|
2370
|
-
// ¯\_(ツ)_/¯
|
|
2371
|
-
const hostRef = getHostRef(elm);
|
|
2372
|
-
// reset state flags to only have been connected
|
|
2373
|
-
hostRef.$flags$ = 1 /* hasConnected */;
|
|
2374
|
-
// TODO
|
|
2375
|
-
// detatch any event listeners that may have been added
|
|
2376
|
-
// because we're not passing an exact event name it'll
|
|
2377
|
-
// remove all of this element's event, which is good
|
|
2378
|
-
// create a callback for when this component finishes hmr
|
|
2379
|
-
elm['s-hmr-load'] = () => {
|
|
2380
|
-
// finished hmr for this element
|
|
2381
|
-
delete elm['s-hmr-load'];
|
|
2382
|
-
};
|
|
2383
|
-
// re-initialize the component
|
|
2384
|
-
initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
|
|
2385
|
-
};
|
|
2386
|
-
const patchCloneNode = (HostElementPrototype) => {
|
|
2387
|
-
const orgCloneNode = HostElementPrototype.cloneNode;
|
|
2388
|
-
HostElementPrototype.cloneNode = function (deep) {
|
|
2389
|
-
const srcNode = this;
|
|
2390
|
-
const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
|
2391
|
-
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
|
2392
|
-
if (BUILD.slot && !isShadowDom && deep) {
|
|
2393
|
-
let i = 0;
|
|
2394
|
-
let slotted, nonStencilNode;
|
|
2395
|
-
const stencilPrivates = [
|
|
2396
|
-
's-id',
|
|
2397
|
-
's-cr',
|
|
2398
|
-
's-lr',
|
|
2399
|
-
's-rc',
|
|
2400
|
-
's-sc',
|
|
2401
|
-
's-p',
|
|
2402
|
-
's-cn',
|
|
2403
|
-
's-sr',
|
|
2404
|
-
's-sn',
|
|
2405
|
-
's-hn',
|
|
2406
|
-
's-ol',
|
|
2407
|
-
's-nr',
|
|
2408
|
-
's-si',
|
|
2409
|
-
];
|
|
2410
|
-
for (; i < srcNode.childNodes.length; i++) {
|
|
2411
|
-
slotted = srcNode.childNodes[i]['s-nr'];
|
|
2412
|
-
nonStencilNode = stencilPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
|
|
2413
|
-
if (slotted) {
|
|
2414
|
-
if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
|
|
2415
|
-
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
2416
|
-
}
|
|
2417
|
-
else {
|
|
2418
|
-
clonedNode.appendChild(slotted.cloneNode(true));
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
if (nonStencilNode) {
|
|
2422
|
-
clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
return clonedNode;
|
|
2427
|
-
};
|
|
2428
|
-
};
|
|
2429
|
-
const patchSlotAppendChild = (HostElementPrototype) => {
|
|
2430
|
-
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
|
|
2431
|
-
HostElementPrototype.appendChild = function (newChild) {
|
|
2432
|
-
const slotName = (newChild['s-sn'] = getSlotName(newChild));
|
|
2433
|
-
const slotNode = getHostSlotNode(this.childNodes, slotName);
|
|
2434
|
-
if (slotNode) {
|
|
2435
|
-
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
2436
|
-
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
2437
|
-
return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
|
|
2438
|
-
}
|
|
2439
|
-
return this.__appendChild(newChild);
|
|
2440
|
-
};
|
|
2441
|
-
};
|
|
2442
|
-
/**
|
|
2443
|
-
* Patches the text content of an unnamed slotted node inside a scoped component
|
|
2444
|
-
* @param hostElementPrototype the `Element` to be patched
|
|
2445
|
-
* @param cmpMeta component runtime metadata used to determine if the component should be patched or not
|
|
2446
|
-
*/
|
|
2447
|
-
const patchTextContent = (hostElementPrototype, cmpMeta) => {
|
|
2448
|
-
if (BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2449
|
-
const descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent');
|
|
2450
|
-
Object.defineProperty(hostElementPrototype, '__textContent', descriptor);
|
|
2451
|
-
Object.defineProperty(hostElementPrototype, 'textContent', {
|
|
2452
|
-
get() {
|
|
2453
|
-
var _a;
|
|
2454
|
-
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
|
2455
|
-
// the empty string
|
|
2456
|
-
const slotNode = getHostSlotNode(this.childNodes, '');
|
|
2457
|
-
// when a slot node is found, the textContent _may_ be found in the next sibling (text) node, depending on how
|
|
2458
|
-
// nodes were reordered during the vdom render. first try to get the text content from the sibling.
|
|
2459
|
-
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* TEXT_NODE */) {
|
|
2460
|
-
return slotNode.nextSibling.textContent;
|
|
2461
|
-
}
|
|
2462
|
-
else if (slotNode) {
|
|
2463
|
-
return slotNode.textContent;
|
|
2464
|
-
}
|
|
2465
|
-
else {
|
|
2466
|
-
// fallback to the original implementation
|
|
2467
|
-
return this.__textContent;
|
|
2468
|
-
}
|
|
2469
|
-
},
|
|
2470
|
-
set(value) {
|
|
2471
|
-
var _a;
|
|
2472
|
-
// get the 'default slot', which would be the first slot in a shadow tree (if we were using one), whose name is
|
|
2473
|
-
// the empty string
|
|
2474
|
-
const slotNode = getHostSlotNode(this.childNodes, '');
|
|
2475
|
-
// when a slot node is found, the textContent _may_ need to be placed in the next sibling (text) node,
|
|
2476
|
-
// depending on how nodes were reordered during the vdom render. first try to set the text content on the
|
|
2477
|
-
// sibling.
|
|
2478
|
-
if (((_a = slotNode === null || slotNode === void 0 ? void 0 : slotNode.nextSibling) === null || _a === void 0 ? void 0 : _a.nodeType) === 3 /* TEXT_NODE */) {
|
|
2479
|
-
slotNode.nextSibling.textContent = value;
|
|
2480
|
-
}
|
|
2481
|
-
else if (slotNode) {
|
|
2482
|
-
slotNode.textContent = value;
|
|
2483
|
-
}
|
|
2484
|
-
else {
|
|
2485
|
-
// we couldn't find a slot, but that doesn't mean that there isn't one. if this check ran before the DOM
|
|
2486
|
-
// loaded, we could have missed it. check for a content reference element on the scoped component and insert
|
|
2487
|
-
// it there
|
|
2488
|
-
this.__textContent = value;
|
|
2489
|
-
const contentRefElm = this['s-cr'];
|
|
2490
|
-
if (contentRefElm) {
|
|
2491
|
-
this.insertBefore(contentRefElm, this.firstChild);
|
|
2492
|
-
}
|
|
2493
|
-
}
|
|
2494
|
-
},
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
};
|
|
2498
|
-
const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
2499
|
-
class FakeNodeList extends Array {
|
|
2500
|
-
item(n) {
|
|
2501
|
-
return this[n];
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
2505
|
-
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
2506
|
-
Object.defineProperty(elm, 'children', {
|
|
2507
|
-
get() {
|
|
2508
|
-
return this.childNodes.map((n) => n.nodeType === 1);
|
|
2509
|
-
},
|
|
2510
|
-
});
|
|
2511
|
-
Object.defineProperty(elm, 'childElementCount', {
|
|
2512
|
-
get() {
|
|
2513
|
-
return elm.children.length;
|
|
2514
|
-
},
|
|
2515
|
-
});
|
|
2516
|
-
Object.defineProperty(elm, 'childNodes', {
|
|
2517
|
-
get() {
|
|
2518
|
-
const childNodes = childNodesFn.call(this);
|
|
2519
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
2520
|
-
getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
2521
|
-
const result = new FakeNodeList();
|
|
2522
|
-
for (let i = 0; i < childNodes.length; i++) {
|
|
2523
|
-
const slot = childNodes[i]['s-nr'];
|
|
2524
|
-
if (slot) {
|
|
2525
|
-
result.push(slot);
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
return result;
|
|
2529
|
-
}
|
|
2530
|
-
return FakeNodeList.from(childNodes);
|
|
2531
|
-
},
|
|
2532
|
-
});
|
|
2533
1640
|
}
|
|
2534
1641
|
};
|
|
2535
|
-
const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
|
|
2536
|
-
/**
|
|
2537
|
-
* Recursively searches a series of child nodes for a slot with the provided name.
|
|
2538
|
-
* @param childNodes the nodes to search for a slot with a specific name.
|
|
2539
|
-
* @param slotName the name of the slot to match on.
|
|
2540
|
-
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
|
2541
|
-
*/
|
|
2542
|
-
const getHostSlotNode = (childNodes, slotName) => {
|
|
2543
|
-
let i = 0;
|
|
2544
|
-
let childNode;
|
|
2545
|
-
for (; i < childNodes.length; i++) {
|
|
2546
|
-
childNode = childNodes[i];
|
|
2547
|
-
if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
|
|
2548
|
-
return childNode;
|
|
2549
|
-
}
|
|
2550
|
-
childNode = getHostSlotNode(childNode.childNodes, slotName);
|
|
2551
|
-
if (childNode) {
|
|
2552
|
-
return childNode;
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
return null;
|
|
2556
|
-
};
|
|
2557
|
-
const getHostSlotChildNodes = (n, slotName) => {
|
|
2558
|
-
const childNodes = [n];
|
|
2559
|
-
while ((n = n.nextSibling) && n['s-sn'] === slotName) {
|
|
2560
|
-
childNodes.push(n);
|
|
2561
|
-
}
|
|
2562
|
-
return childNodes;
|
|
2563
|
-
};
|
|
2564
1642
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
2565
|
-
|
|
2566
|
-
performance.mark('st:app:start');
|
|
2567
|
-
}
|
|
2568
|
-
installDevTools();
|
|
2569
|
-
const endBootstrap = createTime('bootstrapLazy');
|
|
1643
|
+
const endBootstrap = createTime();
|
|
2570
1644
|
const cmpTags = [];
|
|
2571
1645
|
const exclude = options.exclude || [];
|
|
2572
1646
|
const customElements = win.customElements;
|
|
@@ -2574,27 +1648,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2574
1648
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
2575
1649
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
2576
1650
|
const deferredConnectedCallbacks = [];
|
|
2577
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2578
1651
|
let appLoadFallback;
|
|
2579
1652
|
let isBootstrapping = true;
|
|
2580
|
-
let i = 0;
|
|
2581
1653
|
Object.assign(plt, options);
|
|
2582
1654
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
2583
|
-
if (BUILD.asyncQueue) {
|
|
2584
|
-
if (options.syncQueue) {
|
|
2585
|
-
plt.$flags$ |= 4 /* queueSync */;
|
|
2586
|
-
}
|
|
2587
|
-
}
|
|
2588
|
-
if (BUILD.hydrateClientSide) {
|
|
2589
|
-
// If the app is already hydrated there is not point to disable the
|
|
2590
|
-
// async queue. This will improve the first input delay
|
|
2591
|
-
plt.$flags$ |= 2 /* appLoaded */;
|
|
2592
|
-
}
|
|
2593
|
-
if (BUILD.hydrateClientSide && BUILD.shadowDom) {
|
|
2594
|
-
for (; i < styles.length; i++) {
|
|
2595
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
1655
|
lazyBundles.map((lazyBundle) => {
|
|
2599
1656
|
lazyBundle[1].map((compactMeta) => {
|
|
2600
1657
|
const cmpMeta = {
|
|
@@ -2603,24 +1660,19 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2603
1660
|
$members$: compactMeta[2],
|
|
2604
1661
|
$listeners$: compactMeta[3],
|
|
2605
1662
|
};
|
|
2606
|
-
|
|
1663
|
+
{
|
|
2607
1664
|
cmpMeta.$members$ = compactMeta[2];
|
|
2608
1665
|
}
|
|
2609
|
-
|
|
1666
|
+
{
|
|
2610
1667
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
2611
1668
|
}
|
|
2612
|
-
|
|
1669
|
+
{
|
|
2613
1670
|
cmpMeta.$attrsToReflect$ = [];
|
|
2614
1671
|
}
|
|
2615
|
-
|
|
1672
|
+
{
|
|
2616
1673
|
cmpMeta.$watchers$ = {};
|
|
2617
1674
|
}
|
|
2618
|
-
|
|
2619
|
-
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
2620
|
-
}
|
|
2621
|
-
const tagName = BUILD.transformTagName && options.transformTagName
|
|
2622
|
-
? options.transformTagName(cmpMeta.$tagName$)
|
|
2623
|
-
: cmpMeta.$tagName$;
|
|
1675
|
+
const tagName = cmpMeta.$tagName$;
|
|
2624
1676
|
const HostElement = class extends HTMLElement {
|
|
2625
1677
|
// StencilLazyHost
|
|
2626
1678
|
constructor(self) {
|
|
@@ -2628,29 +1680,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2628
1680
|
super(self);
|
|
2629
1681
|
self = this;
|
|
2630
1682
|
registerHost(self, cmpMeta);
|
|
2631
|
-
if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2632
|
-
// this component is using shadow dom
|
|
2633
|
-
// and this browser supports shadow dom
|
|
2634
|
-
// add the read-only property "shadowRoot" to the host element
|
|
2635
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
2636
|
-
if (supportsShadow) {
|
|
2637
|
-
if (BUILD.shadowDelegatesFocus) {
|
|
2638
|
-
self.attachShadow({
|
|
2639
|
-
mode: 'open',
|
|
2640
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */),
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2643
|
-
else {
|
|
2644
|
-
self.attachShadow({ mode: 'open' });
|
|
2645
|
-
}
|
|
2646
|
-
}
|
|
2647
|
-
else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
|
|
2648
|
-
self.shadowRoot = self;
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
if (BUILD.slotChildNodesFix) {
|
|
2652
|
-
patchChildSlotNodes(self, cmpMeta);
|
|
2653
|
-
}
|
|
2654
1683
|
}
|
|
2655
1684
|
connectedCallback() {
|
|
2656
1685
|
if (appLoadFallback) {
|
|
@@ -2672,20 +1701,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2672
1701
|
return getHostRef(this).$onReadyPromise$;
|
|
2673
1702
|
}
|
|
2674
1703
|
};
|
|
2675
|
-
if (BUILD.cloneNodeFix) {
|
|
2676
|
-
patchCloneNode(HostElement.prototype);
|
|
2677
|
-
}
|
|
2678
|
-
if (BUILD.appendChildSlotFix) {
|
|
2679
|
-
patchSlotAppendChild(HostElement.prototype);
|
|
2680
|
-
}
|
|
2681
|
-
if (BUILD.hotModuleReplacement) {
|
|
2682
|
-
HostElement.prototype['s-hmr'] = function (hmrVersionId) {
|
|
2683
|
-
hmrStart(this, cmpMeta, hmrVersionId);
|
|
2684
|
-
};
|
|
2685
|
-
}
|
|
2686
|
-
if (BUILD.scopedSlotTextContentFix) {
|
|
2687
|
-
patchTextContent(HostElement.prototype, cmpMeta);
|
|
2688
|
-
}
|
|
2689
1704
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
2690
1705
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
2691
1706
|
cmpTags.push(tagName);
|
|
@@ -2693,7 +1708,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2693
1708
|
}
|
|
2694
1709
|
});
|
|
2695
1710
|
});
|
|
2696
|
-
|
|
1711
|
+
{
|
|
2697
1712
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
2698
1713
|
visibilityStyle.setAttribute('data-styles', '');
|
|
2699
1714
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
@@ -2704,211 +1719,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2704
1719
|
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
2705
1720
|
}
|
|
2706
1721
|
else {
|
|
2707
|
-
|
|
2708
|
-
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
|
|
2709
|
-
}
|
|
2710
|
-
else {
|
|
1722
|
+
{
|
|
2711
1723
|
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
|
|
2712
1724
|
}
|
|
2713
1725
|
}
|
|
2714
1726
|
// Fallback appLoad event
|
|
2715
1727
|
endBootstrap();
|
|
2716
1728
|
};
|
|
2717
|
-
const getAssetPath = (path) => {
|
|
2718
|
-
const assetUrl = new URL(path, plt.$resourcesUrl$);
|
|
2719
|
-
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
2720
|
-
};
|
|
2721
|
-
const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
|
|
2722
|
-
const getConnect = (_ref, tagName) => {
|
|
2723
|
-
const componentOnReady = () => {
|
|
2724
|
-
let elm = doc.querySelector(tagName);
|
|
2725
|
-
if (!elm) {
|
|
2726
|
-
elm = doc.createElement(tagName);
|
|
2727
|
-
doc.body.appendChild(elm);
|
|
2728
|
-
}
|
|
2729
|
-
return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
|
|
2730
|
-
};
|
|
2731
|
-
const create = (...args) => {
|
|
2732
|
-
return componentOnReady().then((el) => el.create(...args));
|
|
2733
|
-
};
|
|
2734
|
-
return {
|
|
2735
|
-
create,
|
|
2736
|
-
componentOnReady,
|
|
2737
|
-
};
|
|
2738
|
-
};
|
|
2739
|
-
const getContext = (_elm, context) => {
|
|
2740
|
-
if (context in Context) {
|
|
2741
|
-
return Context[context];
|
|
2742
|
-
}
|
|
2743
|
-
else if (context === 'window') {
|
|
2744
|
-
return win;
|
|
2745
|
-
}
|
|
2746
|
-
else if (context === 'document') {
|
|
2747
|
-
return doc;
|
|
2748
|
-
}
|
|
2749
|
-
else if (context === 'isServer' || context === 'isPrerender') {
|
|
2750
|
-
return BUILD.hydrateServerSide ? true : false;
|
|
2751
|
-
}
|
|
2752
|
-
else if (context === 'isClient') {
|
|
2753
|
-
return BUILD.hydrateServerSide ? false : true;
|
|
2754
|
-
}
|
|
2755
|
-
else if (context === 'resourcesUrl' || context === 'publicPath') {
|
|
2756
|
-
return getAssetPath('.');
|
|
2757
|
-
}
|
|
2758
|
-
else if (context === 'queue') {
|
|
2759
|
-
return {
|
|
2760
|
-
write: writeTask,
|
|
2761
|
-
read: readTask,
|
|
2762
|
-
tick: {
|
|
2763
|
-
then(cb) {
|
|
2764
|
-
return nextTick(cb);
|
|
2765
|
-
},
|
|
2766
|
-
},
|
|
2767
|
-
};
|
|
2768
|
-
}
|
|
2769
|
-
return undefined;
|
|
2770
|
-
};
|
|
2771
|
-
const insertVdomAnnotations = (doc, staticComponents) => {
|
|
2772
|
-
if (doc != null) {
|
|
2773
|
-
const docData = {
|
|
2774
|
-
hostIds: 0,
|
|
2775
|
-
rootLevelIds: 0,
|
|
2776
|
-
staticComponents: new Set(staticComponents),
|
|
2777
|
-
};
|
|
2778
|
-
const orgLocationNodes = [];
|
|
2779
|
-
parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
|
|
2780
|
-
orgLocationNodes.forEach((orgLocationNode) => {
|
|
2781
|
-
if (orgLocationNode != null) {
|
|
2782
|
-
const nodeRef = orgLocationNode['s-nr'];
|
|
2783
|
-
let hostId = nodeRef['s-host-id'];
|
|
2784
|
-
let nodeId = nodeRef['s-node-id'];
|
|
2785
|
-
let childId = `${hostId}.${nodeId}`;
|
|
2786
|
-
if (hostId == null) {
|
|
2787
|
-
hostId = 0;
|
|
2788
|
-
docData.rootLevelIds++;
|
|
2789
|
-
nodeId = docData.rootLevelIds;
|
|
2790
|
-
childId = `${hostId}.${nodeId}`;
|
|
2791
|
-
if (nodeRef.nodeType === 1 /* ElementNode */) {
|
|
2792
|
-
nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
2793
|
-
}
|
|
2794
|
-
else if (nodeRef.nodeType === 3 /* TextNode */) {
|
|
2795
|
-
if (hostId === 0) {
|
|
2796
|
-
const textContent = nodeRef.nodeValue.trim();
|
|
2797
|
-
if (textContent === '') {
|
|
2798
|
-
// useless whitespace node at the document root
|
|
2799
|
-
orgLocationNode.remove();
|
|
2800
|
-
return;
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
const commentBeforeTextNode = doc.createComment(childId);
|
|
2804
|
-
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
2805
|
-
nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
|
-
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
|
2809
|
-
const orgLocationParentNode = orgLocationNode.parentElement;
|
|
2810
|
-
if (orgLocationParentNode) {
|
|
2811
|
-
if (orgLocationParentNode['s-en'] === '') {
|
|
2812
|
-
// ending with a "." means that the parent element
|
|
2813
|
-
// of this node's original location is a SHADOW dom element
|
|
2814
|
-
// and this node is apart of the root level light dom
|
|
2815
|
-
orgLocationNodeId += `.`;
|
|
2816
|
-
}
|
|
2817
|
-
else if (orgLocationParentNode['s-en'] === 'c') {
|
|
2818
|
-
// ending with a ".c" means that the parent element
|
|
2819
|
-
// of this node's original location is a SCOPED element
|
|
2820
|
-
// and this node is apart of the root level light dom
|
|
2821
|
-
orgLocationNodeId += `.c`;
|
|
2822
|
-
}
|
|
2823
|
-
}
|
|
2824
|
-
orgLocationNode.nodeValue = orgLocationNodeId;
|
|
2825
|
-
}
|
|
2826
|
-
});
|
|
2827
|
-
}
|
|
2828
|
-
};
|
|
2829
|
-
const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
|
|
2830
|
-
if (node == null) {
|
|
2831
|
-
return;
|
|
2832
|
-
}
|
|
2833
|
-
if (node['s-nr'] != null) {
|
|
2834
|
-
orgLocationNodes.push(node);
|
|
2835
|
-
}
|
|
2836
|
-
if (node.nodeType === 1 /* ElementNode */) {
|
|
2837
|
-
node.childNodes.forEach((childNode) => {
|
|
2838
|
-
const hostRef = getHostRef(childNode);
|
|
2839
|
-
if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
|
|
2840
|
-
const cmpData = {
|
|
2841
|
-
nodeIds: 0,
|
|
2842
|
-
};
|
|
2843
|
-
insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
|
|
2844
|
-
}
|
|
2845
|
-
parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
|
|
2846
|
-
});
|
|
2847
|
-
}
|
|
2848
|
-
};
|
|
2849
|
-
const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
|
|
2850
|
-
if (vnode != null) {
|
|
2851
|
-
const hostId = ++docData.hostIds;
|
|
2852
|
-
hostElm.setAttribute(HYDRATE_ID, hostId);
|
|
2853
|
-
if (hostElm['s-cr'] != null) {
|
|
2854
|
-
hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
|
|
2855
|
-
}
|
|
2856
|
-
if (vnode.$children$ != null) {
|
|
2857
|
-
const depth = 0;
|
|
2858
|
-
vnode.$children$.forEach((vnodeChild, index) => {
|
|
2859
|
-
insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
|
|
2860
|
-
});
|
|
2861
|
-
}
|
|
2862
|
-
if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
|
|
2863
|
-
const parent = hostElm.parentElement;
|
|
2864
|
-
if (parent && parent.childNodes) {
|
|
2865
|
-
const parentChildNodes = Array.from(parent.childNodes);
|
|
2866
|
-
const comment = parentChildNodes.find((node) => node.nodeType === 8 /* CommentNode */ && node['s-sr']);
|
|
2867
|
-
if (comment) {
|
|
2868
|
-
const index = parentChildNodes.indexOf(hostElm) - 1;
|
|
2869
|
-
vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
|
|
2870
|
-
}
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
};
|
|
2875
|
-
const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
|
|
2876
|
-
const childElm = vnodeChild.$elm$;
|
|
2877
|
-
if (childElm == null) {
|
|
2878
|
-
return;
|
|
2879
|
-
}
|
|
2880
|
-
const nodeId = cmpData.nodeIds++;
|
|
2881
|
-
const childId = `${hostId}.${nodeId}.${depth}.${index}`;
|
|
2882
|
-
childElm['s-host-id'] = hostId;
|
|
2883
|
-
childElm['s-node-id'] = nodeId;
|
|
2884
|
-
if (childElm.nodeType === 1 /* ElementNode */) {
|
|
2885
|
-
childElm.setAttribute(HYDRATE_CHILD_ID, childId);
|
|
2886
|
-
}
|
|
2887
|
-
else if (childElm.nodeType === 3 /* TextNode */) {
|
|
2888
|
-
const parentNode = childElm.parentNode;
|
|
2889
|
-
const nodeName = parentNode.nodeName;
|
|
2890
|
-
if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
|
|
2891
|
-
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
2892
|
-
const commentBeforeTextNode = doc.createComment(textNodeId);
|
|
2893
|
-
parentNode.insertBefore(commentBeforeTextNode, childElm);
|
|
2894
|
-
}
|
|
2895
|
-
}
|
|
2896
|
-
else if (childElm.nodeType === 8 /* CommentNode */) {
|
|
2897
|
-
if (childElm['s-sr']) {
|
|
2898
|
-
const slotName = childElm['s-sn'] || '';
|
|
2899
|
-
const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
|
|
2900
|
-
childElm.nodeValue = slotNodeId;
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
if (vnodeChild.$children$ != null) {
|
|
2904
|
-
const childDepth = depth + 1;
|
|
2905
|
-
vnodeChild.$children$.forEach((vnode, index) => {
|
|
2906
|
-
insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
|
|
2907
|
-
});
|
|
2908
|
-
}
|
|
2909
|
-
};
|
|
2910
|
-
const setPlatformOptions = (opts) => Object.assign(plt, opts);
|
|
2911
|
-
const Fragment = (_, children) => children;
|
|
2912
1729
|
const hostRefs = new WeakMap();
|
|
2913
1730
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
2914
1731
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -2919,63 +1736,65 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
2919
1736
|
$cmpMeta$: cmpMeta,
|
|
2920
1737
|
$instanceValues$: new Map(),
|
|
2921
1738
|
};
|
|
2922
|
-
|
|
2923
|
-
hostRef.$renderCount$ = 0;
|
|
2924
|
-
}
|
|
2925
|
-
if (BUILD.method && BUILD.lazyLoad) {
|
|
1739
|
+
{
|
|
2926
1740
|
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
|
2927
1741
|
}
|
|
2928
|
-
|
|
1742
|
+
{
|
|
2929
1743
|
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
|
2930
1744
|
elm['s-p'] = [];
|
|
2931
1745
|
elm['s-rc'] = [];
|
|
2932
1746
|
}
|
|
2933
|
-
addHostEventListeners(elm, hostRef, cmpMeta.$listeners
|
|
1747
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
2934
1748
|
return hostRefs.set(elm, hostRef);
|
|
2935
1749
|
};
|
|
2936
1750
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
2937
|
-
const consoleError = (e, el) => (
|
|
2938
|
-
const STENCIL_DEV_MODE = BUILD.isTesting
|
|
2939
|
-
? ['STENCIL:'] // E2E testing
|
|
2940
|
-
: [
|
|
2941
|
-
'%cstencil',
|
|
2942
|
-
'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
|
|
2943
|
-
];
|
|
2944
|
-
const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
|
|
2945
|
-
const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
|
|
2946
|
-
const consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
|
|
2947
|
-
const setErrorHandler = (handler) => (customError = handler);
|
|
1751
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
2948
1752
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
2949
1753
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
2950
1754
|
// loadModuleImport
|
|
2951
1755
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
2952
1756
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
2953
|
-
|
|
2954
|
-
consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
|
|
2955
|
-
return undefined;
|
|
2956
|
-
}
|
|
2957
|
-
const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
|
|
1757
|
+
const module = cmpModules.get(bundleId) ;
|
|
2958
1758
|
if (module) {
|
|
2959
1759
|
return module[exportName];
|
|
2960
1760
|
}
|
|
2961
|
-
|
|
2962
|
-
|
|
1761
|
+
|
|
1762
|
+
if (!hmrVersionId || !BUILD.hotModuleReplacement) {
|
|
1763
|
+
const processMod = importedModule => {
|
|
1764
|
+
cmpModules.set(bundleId, importedModule);
|
|
1765
|
+
return importedModule[exportName];
|
|
1766
|
+
}
|
|
1767
|
+
switch(bundleId) {
|
|
1768
|
+
|
|
1769
|
+
case 'revo-grid_11.cjs':
|
|
1770
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1771
|
+
/* webpackMode: "lazy" */
|
|
1772
|
+
'./revo-grid_11.cjs.entry.js')); }).then(processMod, consoleError);
|
|
1773
|
+
case 'revogr-clipboard.cjs':
|
|
1774
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1775
|
+
/* webpackMode: "lazy" */
|
|
1776
|
+
'./revogr-clipboard.cjs.entry.js')); }).then(processMod, consoleError);
|
|
1777
|
+
case 'revogr-filter-panel.cjs':
|
|
1778
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1779
|
+
/* webpackMode: "lazy" */
|
|
1780
|
+
'./revogr-filter-panel.cjs.entry.js')); }).then(processMod, consoleError);
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
2963
1784
|
/* @vite-ignore */
|
|
2964
1785
|
/* webpackInclude: /\.entry\.js$/ */
|
|
2965
1786
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
2966
1787
|
/* webpackMode: "lazy" */
|
|
2967
|
-
`./${bundleId}.entry.js${
|
|
2968
|
-
|
|
1788
|
+
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
|
|
1789
|
+
{
|
|
2969
1790
|
cmpModules.set(bundleId, importedModule);
|
|
2970
1791
|
}
|
|
2971
1792
|
return importedModule[exportName];
|
|
2972
1793
|
}, consoleError);
|
|
2973
1794
|
};
|
|
2974
1795
|
const styles = new Map();
|
|
2975
|
-
const modeResolutionChain = [];
|
|
2976
1796
|
const queueDomReads = [];
|
|
2977
1797
|
const queueDomWrites = [];
|
|
2978
|
-
const queueDomWritesLow = [];
|
|
2979
1798
|
const queueTask = (queue, write) => (cb) => {
|
|
2980
1799
|
queue.push(cb);
|
|
2981
1800
|
if (!queuePending) {
|
|
@@ -2999,53 +1818,13 @@ const consume = (queue) => {
|
|
|
2999
1818
|
}
|
|
3000
1819
|
queue.length = 0;
|
|
3001
1820
|
};
|
|
3002
|
-
const consumeTimeout = (queue, timeout) => {
|
|
3003
|
-
let i = 0;
|
|
3004
|
-
let ts = 0;
|
|
3005
|
-
while (i < queue.length && (ts = performance.now()) < timeout) {
|
|
3006
|
-
try {
|
|
3007
|
-
queue[i++](ts);
|
|
3008
|
-
}
|
|
3009
|
-
catch (e) {
|
|
3010
|
-
consoleError(e);
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
if (i === queue.length) {
|
|
3014
|
-
queue.length = 0;
|
|
3015
|
-
}
|
|
3016
|
-
else if (i !== 0) {
|
|
3017
|
-
queue.splice(0, i);
|
|
3018
|
-
}
|
|
3019
|
-
};
|
|
3020
1821
|
const flush = () => {
|
|
3021
|
-
if (BUILD.asyncQueue) {
|
|
3022
|
-
queueCongestion++;
|
|
3023
|
-
}
|
|
3024
1822
|
// always force a bunch of medium callbacks to run, but still have
|
|
3025
1823
|
// a throttle on how many can run in a certain time
|
|
3026
1824
|
// DOM READS!!!
|
|
3027
1825
|
consume(queueDomReads);
|
|
3028
1826
|
// DOM WRITES!!!
|
|
3029
|
-
|
|
3030
|
-
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
|
|
3031
|
-
? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
|
|
3032
|
-
: Infinity;
|
|
3033
|
-
consumeTimeout(queueDomWrites, timeout);
|
|
3034
|
-
consumeTimeout(queueDomWritesLow, timeout);
|
|
3035
|
-
if (queueDomWrites.length > 0) {
|
|
3036
|
-
queueDomWritesLow.push(...queueDomWrites);
|
|
3037
|
-
queueDomWrites.length = 0;
|
|
3038
|
-
}
|
|
3039
|
-
if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
|
|
3040
|
-
// still more to do yet, but we've run out of time
|
|
3041
|
-
// let's let this thing cool off and try again in the next tick
|
|
3042
|
-
plt.raf(flush);
|
|
3043
|
-
}
|
|
3044
|
-
else {
|
|
3045
|
-
queueCongestion = 0;
|
|
3046
|
-
}
|
|
3047
|
-
}
|
|
3048
|
-
else {
|
|
1827
|
+
{
|
|
3049
1828
|
consume(queueDomWrites);
|
|
3050
1829
|
if ((queuePending = queueDomReads.length > 0)) {
|
|
3051
1830
|
// still more to do yet, but we've run out of time
|
|
@@ -3055,13 +1834,19 @@ const flush = () => {
|
|
|
3055
1834
|
}
|
|
3056
1835
|
};
|
|
3057
1836
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
3058
|
-
const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
|
|
3059
1837
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
3060
|
-
const Build = {
|
|
3061
|
-
isDev: BUILD.isDev ? true : false,
|
|
3062
|
-
isBrowser: true,
|
|
3063
|
-
isServer: false,
|
|
3064
|
-
isTesting: BUILD.isTesting ? true : false,
|
|
3065
|
-
};
|
|
3066
1838
|
|
|
3067
|
-
|
|
1839
|
+
exports.CSS = CSS;
|
|
1840
|
+
exports.Host = Host;
|
|
1841
|
+
exports.NAMESPACE = NAMESPACE;
|
|
1842
|
+
exports.bootstrapLazy = bootstrapLazy;
|
|
1843
|
+
exports.createEvent = createEvent;
|
|
1844
|
+
exports.doc = doc;
|
|
1845
|
+
exports.forceUpdate = forceUpdate;
|
|
1846
|
+
exports.getElement = getElement;
|
|
1847
|
+
exports.getRenderingRef = getRenderingRef;
|
|
1848
|
+
exports.h = h;
|
|
1849
|
+
exports.plt = plt;
|
|
1850
|
+
exports.promiseResolve = promiseResolve;
|
|
1851
|
+
exports.registerInstance = registerInstance;
|
|
1852
|
+
exports.win = win;
|