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