@watermarkinsights/ripple 3.3.2 → 3.4.0-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/functions-a6491ba8.js +7943 -0
- package/dist/cjs/{global-e79f2300.js → global-4d3b13c3.js} +1 -1
- package/dist/cjs/{index-cd179539.js → index-921ef454.js} +103 -157
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/priv-chart-popover.cjs.entry.js +2 -2
- package/dist/cjs/priv-datepicker.cjs.entry.js +11 -5
- package/dist/cjs/priv-navigator-button.cjs.entry.js +1 -1
- package/dist/cjs/priv-navigator-item.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +6 -6
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +2 -2
- package/dist/cjs/wm-button.cjs.entry.js +2 -2
- package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart.cjs.entry.js +9 -7
- package/dist/cjs/wm-datepicker.cjs.entry.js +6 -6
- package/dist/cjs/wm-input.cjs.entry.js +11 -3
- package/dist/cjs/wm-modal-footer.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal-header.cjs.entry.js +2 -2
- package/dist/cjs/wm-modal.cjs.entry.js +2 -2
- package/dist/cjs/wm-navigator.cjs.entry.js +2 -2
- package/dist/cjs/wm-network-uploader.cjs.entry.js +2 -2
- package/dist/cjs/wm-option_2.cjs.entry.js +3 -3
- package/dist/cjs/wm-pagination.cjs.entry.js +2 -2
- package/dist/cjs/wm-search.cjs.entry.js +2 -2
- package/dist/cjs/wm-snackbar.cjs.entry.js +2 -2
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-tag-input.cjs.entry.js +2 -2
- package/dist/cjs/wm-timepicker.cjs.entry.js +2 -2
- package/dist/cjs/wm-toggletip.cjs.entry.js +2 -2
- package/dist/cjs/wm-uploader.cjs.entry.js +2 -2
- package/dist/cjs/wm-wrapper.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/wm-chart/wm-chart.css +7 -5
- package/dist/collection/components/wm-chart/wm-chart.js +17 -13
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +15 -3
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +4 -4
- package/dist/collection/components/wm-input/wm-input.js +9 -1
- package/dist/collection/components/wm-select/wm-select.css +1 -0
- package/dist/esm/functions-5aebd578.js +7923 -0
- package/dist/esm/{global-5c26edba.js → global-a335f845.js} +1 -1
- package/dist/esm/{index-66f8130e.js → index-f8b130b6.js} +103 -157
- package/dist/esm/loader.js +4 -4
- package/dist/esm/polyfills/index.js +2 -2
- package/dist/esm/priv-chart-popover.entry.js +2 -2
- package/dist/esm/priv-datepicker.entry.js +11 -5
- package/dist/esm/priv-navigator-button.entry.js +1 -1
- package/dist/esm/priv-navigator-item.entry.js +1 -1
- package/dist/esm/ripple.js +6 -6
- package/dist/esm/wm-action-menu_2.entry.js +2 -2
- package/dist/esm/wm-button.entry.js +2 -2
- package/dist/esm/wm-chart-slice.entry.js +1 -1
- package/dist/esm/wm-chart.entry.js +9 -7
- package/dist/esm/wm-datepicker.entry.js +6 -6
- package/dist/esm/wm-input.entry.js +11 -3
- package/dist/esm/wm-modal-footer.entry.js +1 -1
- package/dist/esm/wm-modal-header.entry.js +2 -2
- package/dist/esm/wm-modal.entry.js +2 -2
- package/dist/esm/wm-navigator.entry.js +2 -2
- package/dist/esm/wm-network-uploader.entry.js +2 -2
- package/dist/esm/wm-option_2.entry.js +3 -3
- package/dist/esm/wm-pagination.entry.js +2 -2
- package/dist/esm/wm-search.entry.js +2 -2
- package/dist/esm/wm-snackbar.entry.js +2 -2
- package/dist/esm/wm-tab-item_3.entry.js +2 -2
- package/dist/esm/wm-tag-input.entry.js +2 -2
- package/dist/esm/wm-timepicker.entry.js +2 -2
- package/dist/esm/wm-toggletip.entry.js +2 -2
- package/dist/esm/wm-uploader.entry.js +2 -2
- package/dist/esm/wm-wrapper.entry.js +1 -1
- package/dist/ripple/p-0865e7cf.js +16 -0
- package/dist/ripple/p-0f663e59.entry.js +1 -0
- package/dist/ripple/p-1b790a7d.entry.js +1 -0
- package/dist/ripple/{p-99db8501.entry.js → p-22a1a636.entry.js} +1 -1
- package/dist/ripple/p-3b4c01b8.entry.js +1 -0
- package/dist/ripple/p-54c1f704.entry.js +1 -0
- package/dist/ripple/{p-dea72d46.entry.js → p-5e49aba7.entry.js} +1 -1
- package/dist/ripple/p-76c615e9.entry.js +1 -0
- package/dist/ripple/{p-1a934627.entry.js → p-7d009793.entry.js} +1 -1
- package/dist/ripple/p-7d993d52.js +1 -0
- package/dist/ripple/p-8198cc9c.entry.js +1 -0
- package/dist/ripple/p-839d35bd.entry.js +1 -0
- package/dist/ripple/p-8708b8cb.entry.js +1 -0
- package/dist/ripple/{p-c5e44367.entry.js → p-8bd66955.entry.js} +1 -1
- package/dist/ripple/p-957e3a05.entry.js +1 -0
- package/dist/ripple/{p-b4a8c8d3.entry.js → p-a61977b2.entry.js} +1 -1
- package/dist/ripple/p-af6eb4d5.entry.js +1 -0
- package/dist/ripple/p-b3f9f575.entry.js +1 -0
- package/dist/ripple/p-bba99fcd.entry.js +1 -0
- package/dist/ripple/{p-0c58f50d.entry.js → p-c995acbc.entry.js} +1 -1
- package/dist/ripple/p-cd30198d.entry.js +1 -0
- package/dist/ripple/{p-8b0eb05e.entry.js → p-d52033d5.entry.js} +1 -1
- package/dist/ripple/p-e097c562.entry.js +1 -0
- package/dist/ripple/p-e8993d49.js +1 -0
- package/dist/ripple/p-e9db6122.entry.js +1 -0
- package/dist/ripple/p-eabbd1e9.entry.js +1 -0
- package/dist/ripple/p-ec496b8b.entry.js +1 -0
- package/dist/ripple/p-fc8ec142.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +1 -0
- package/dist/types/components/wm-input/wm-input.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +186 -194
- package/package.json +1 -1
- package/dist/cjs/functions-8fb310fe.js +0 -6164
- package/dist/esm/functions-c315390d.js +0 -6144
- package/dist/ripple/p-042d6449.entry.js +0 -1
- package/dist/ripple/p-053e8324.entry.js +0 -1
- package/dist/ripple/p-11c09317.entry.js +0 -1
- package/dist/ripple/p-2689c3ff.entry.js +0 -1
- package/dist/ripple/p-36da5d4a.entry.js +0 -1
- package/dist/ripple/p-374b4fa6.entry.js +0 -1
- package/dist/ripple/p-41f39509.entry.js +0 -1
- package/dist/ripple/p-589f8195.entry.js +0 -1
- package/dist/ripple/p-5ffa983b.entry.js +0 -1
- package/dist/ripple/p-635cfaa9.js +0 -1
- package/dist/ripple/p-7bbd123c.entry.js +0 -1
- package/dist/ripple/p-9baa3039.js +0 -1
- package/dist/ripple/p-a50439f1.entry.js +0 -1
- package/dist/ripple/p-af4b2ea9.entry.js +0 -1
- package/dist/ripple/p-b03382ea.entry.js +0 -1
- package/dist/ripple/p-ba9d3069.entry.js +0 -1
- package/dist/ripple/p-bc9ca97b.entry.js +0 -1
- package/dist/ripple/p-d5fafa9c.entry.js +0 -1
- package/dist/ripple/p-e574fb73.entry.js +0 -1
- package/dist/ripple/p-e60fe2f5.js +0 -16
- package/dist/ripple/p-ec5db255.entry.js +0 -1
- package/dist/types/global/functions.d.ts +0 -40
|
@@ -9,26 +9,26 @@ const doc = win.document || { head: {} };
|
|
|
9
9
|
const plt = {
|
|
10
10
|
$flags$: 0,
|
|
11
11
|
$resourcesUrl$: '',
|
|
12
|
-
jmp:
|
|
13
|
-
raf:
|
|
12
|
+
jmp: h => h(),
|
|
13
|
+
raf: h => requestAnimationFrame(h),
|
|
14
14
|
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
15
15
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
16
16
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
17
17
|
};
|
|
18
18
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
19
|
-
const supportsConstructibleStylesheets =
|
|
19
|
+
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
20
20
|
try {
|
|
21
21
|
new CSSStyleSheet();
|
|
22
|
-
return
|
|
22
|
+
return true;
|
|
23
23
|
}
|
|
24
24
|
catch (e) { }
|
|
25
25
|
return false;
|
|
26
26
|
})()
|
|
27
27
|
;
|
|
28
28
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
29
|
-
if (listeners) {
|
|
29
|
+
if ( listeners) {
|
|
30
30
|
listeners.map(([flags, name, method]) => {
|
|
31
|
-
const target =
|
|
31
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
32
32
|
const handler = hostListenerProxy(hostRef, method);
|
|
33
33
|
const opts = hostListenerOpts(flags);
|
|
34
34
|
plt.ael(target, name, handler, opts);
|
|
@@ -53,14 +53,14 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const getHostListenerTarget = (elm, flags) => {
|
|
56
|
-
if (flags & 4 /* TargetDocument */)
|
|
56
|
+
if ( flags & 4 /* TargetDocument */)
|
|
57
57
|
return doc;
|
|
58
|
-
if (flags & 8 /* TargetWindow */)
|
|
58
|
+
if ( flags & 8 /* TargetWindow */)
|
|
59
59
|
return win;
|
|
60
60
|
return elm;
|
|
61
61
|
};
|
|
62
62
|
// prettier-ignore
|
|
63
|
-
const hostListenerOpts = (flags) =>
|
|
63
|
+
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
64
64
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
65
65
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
66
66
|
const createTime = (fnName, tagName = '') => {
|
|
@@ -116,7 +116,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
119
|
+
else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
120
120
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -127,8 +127,8 @@ const attachStyles = (hostRef) => {
|
|
|
127
127
|
const elm = hostRef.$hostElement$;
|
|
128
128
|
const flags = cmpMeta.$flags$;
|
|
129
129
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
130
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
131
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
130
|
+
const scopeId = addStyle( elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
131
|
+
if ( flags & 10 /* needsScopedEncapsulation */) {
|
|
132
132
|
// only required when we're NOT using native shadow dom (slot)
|
|
133
133
|
// or this browser doesn't support native shadow dom
|
|
134
134
|
// and this host element was NOT created with SSR
|
|
@@ -141,7 +141,7 @@ const attachStyles = (hostRef) => {
|
|
|
141
141
|
}
|
|
142
142
|
endAttachStyles();
|
|
143
143
|
};
|
|
144
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
144
|
+
const getScopeId = (cmp, mode) => 'sc-' + ( cmp.$tagName$);
|
|
145
145
|
/**
|
|
146
146
|
* Default style mode id
|
|
147
147
|
*/
|
|
@@ -203,7 +203,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
203
203
|
walk(children);
|
|
204
204
|
if (vnodeData) {
|
|
205
205
|
// normalize class / classname attributes
|
|
206
|
-
if (vnodeData.key) {
|
|
206
|
+
if ( vnodeData.key) {
|
|
207
207
|
key = vnodeData.key;
|
|
208
208
|
}
|
|
209
209
|
{
|
|
@@ -213,7 +213,7 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
213
213
|
typeof classData !== 'object'
|
|
214
214
|
? classData
|
|
215
215
|
: Object.keys(classData)
|
|
216
|
-
.filter(
|
|
216
|
+
.filter(k => classData[k])
|
|
217
217
|
.join(' ');
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -258,19 +258,19 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
258
258
|
if (oldValue !== newValue) {
|
|
259
259
|
let isProp = isMemberInElement(elm, memberName);
|
|
260
260
|
let ln = memberName.toLowerCase();
|
|
261
|
-
if (memberName === 'class') {
|
|
261
|
+
if ( memberName === 'class') {
|
|
262
262
|
const classList = elm.classList;
|
|
263
263
|
const oldClasses = parseClassList(oldValue);
|
|
264
264
|
const newClasses = parseClassList(newValue);
|
|
265
|
-
classList.remove(...oldClasses.filter(
|
|
266
|
-
classList.add(...newClasses.filter(
|
|
265
|
+
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
|
|
266
|
+
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
|
|
267
267
|
}
|
|
268
|
-
else if (memberName === 'style') {
|
|
268
|
+
else if ( memberName === 'style') {
|
|
269
269
|
// update style attribute, css properties and values
|
|
270
270
|
{
|
|
271
271
|
for (const prop in oldValue) {
|
|
272
272
|
if (!newValue || newValue[prop] == null) {
|
|
273
|
-
if (prop.includes('-')) {
|
|
273
|
+
if ( prop.includes('-')) {
|
|
274
274
|
elm.style.removeProperty(prop);
|
|
275
275
|
}
|
|
276
276
|
else {
|
|
@@ -281,7 +281,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
281
281
|
}
|
|
282
282
|
for (const prop in newValue) {
|
|
283
283
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
284
|
-
if (prop.includes('-')) {
|
|
284
|
+
if ( prop.includes('-')) {
|
|
285
285
|
elm.style.setProperty(prop, newValue[prop]);
|
|
286
286
|
}
|
|
287
287
|
else {
|
|
@@ -290,17 +290,15 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
else if (memberName === 'key')
|
|
293
|
+
else if ( memberName === 'key')
|
|
294
294
|
;
|
|
295
|
-
else if (memberName === 'ref') {
|
|
295
|
+
else if ( memberName === 'ref') {
|
|
296
296
|
// minifier will clean this up
|
|
297
297
|
if (newValue) {
|
|
298
298
|
newValue(elm);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
else if ((!isProp ) &&
|
|
302
|
-
memberName[0] === 'o' &&
|
|
303
|
-
memberName[1] === 'n') {
|
|
301
|
+
else if ( ( !isProp ) && memberName[0] === 'o' && memberName[1] === 'n') {
|
|
304
302
|
// Event Handlers
|
|
305
303
|
// so if the member name starts with "on" and the 3rd characters is
|
|
306
304
|
// a capital letter, and it's not already a member on the element,
|
|
@@ -375,7 +373,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
375
373
|
}
|
|
376
374
|
if (newValue == null || newValue === false) {
|
|
377
375
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
378
|
-
if (xlink) {
|
|
376
|
+
if ( xlink) {
|
|
379
377
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
380
378
|
}
|
|
381
379
|
else {
|
|
@@ -385,7 +383,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
385
383
|
}
|
|
386
384
|
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
387
385
|
newValue = newValue === true ? '' : newValue;
|
|
388
|
-
if (xlink) {
|
|
386
|
+
if ( xlink) {
|
|
389
387
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
390
388
|
}
|
|
391
389
|
else {
|
|
@@ -401,9 +399,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
401
399
|
// if the element passed in is a shadow root, which is a document fragment
|
|
402
400
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
403
401
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
404
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
405
|
-
? newVnode.$elm$.host
|
|
406
|
-
: newVnode.$elm$;
|
|
402
|
+
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
|
407
403
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
408
404
|
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
|
409
405
|
{
|
|
@@ -425,25 +421,25 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
425
421
|
let i = 0;
|
|
426
422
|
let elm;
|
|
427
423
|
let childNode;
|
|
428
|
-
if (newVNode.$text$ !== null) {
|
|
424
|
+
if ( newVNode.$text$ !== null) {
|
|
429
425
|
// create text node
|
|
430
426
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
431
427
|
}
|
|
432
428
|
else {
|
|
433
|
-
if (!isSvgMode) {
|
|
429
|
+
if ( !isSvgMode) {
|
|
434
430
|
isSvgMode = newVNode.$tag$ === 'svg';
|
|
435
431
|
}
|
|
436
432
|
// create element
|
|
437
|
-
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS,
|
|
433
|
+
elm = newVNode.$elm$ = ( doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
|
|
438
434
|
);
|
|
439
|
-
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
435
|
+
if ( isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
|
440
436
|
isSvgMode = false;
|
|
441
437
|
}
|
|
442
438
|
// add css classes, attrs, props, listeners, etc.
|
|
443
439
|
{
|
|
444
440
|
updateElement(null, newVNode, isSvgMode);
|
|
445
441
|
}
|
|
446
|
-
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
442
|
+
if ( isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
447
443
|
// if there is a scopeId and this is the initial render
|
|
448
444
|
// then let's add the scopeId as a css class
|
|
449
445
|
elm.classList.add((elm['s-si'] = scopeId));
|
|
@@ -473,9 +469,9 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
473
469
|
return elm;
|
|
474
470
|
};
|
|
475
471
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
476
|
-
let containerElm = (parentElm);
|
|
472
|
+
let containerElm = ( parentElm);
|
|
477
473
|
let childNode;
|
|
478
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
474
|
+
if ( containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
479
475
|
containerElm = containerElm.shadowRoot;
|
|
480
476
|
}
|
|
481
477
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -483,7 +479,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
483
479
|
childNode = createElm(null, parentVNode, startIdx);
|
|
484
480
|
if (childNode) {
|
|
485
481
|
vnodes[startIdx].$elm$ = childNode;
|
|
486
|
-
containerElm.insertBefore(childNode,
|
|
482
|
+
containerElm.insertBefore(childNode, before);
|
|
487
483
|
}
|
|
488
484
|
}
|
|
489
485
|
}
|
|
@@ -558,7 +554,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
558
554
|
}
|
|
559
555
|
}
|
|
560
556
|
}
|
|
561
|
-
if (idxInOld >= 0) {
|
|
557
|
+
if ( idxInOld >= 0) {
|
|
562
558
|
elmToMove = oldCh[idxInOld];
|
|
563
559
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
564
560
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
@@ -585,7 +581,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
585
581
|
if (oldStartIdx > oldEndIdx) {
|
|
586
582
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
587
583
|
}
|
|
588
|
-
else if (newStartIdx > newEndIdx) {
|
|
584
|
+
else if ( newStartIdx > newEndIdx) {
|
|
589
585
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
590
586
|
}
|
|
591
587
|
};
|
|
@@ -605,7 +601,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
605
601
|
const newChildren = newVNode.$children$;
|
|
606
602
|
const tag = newVNode.$tag$;
|
|
607
603
|
const text = newVNode.$text$;
|
|
608
|
-
if (text === null) {
|
|
604
|
+
if ( text === null) {
|
|
609
605
|
{
|
|
610
606
|
// test if we're rendering an svg element, or still rendering nodes inside of one
|
|
611
607
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
@@ -613,7 +609,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
613
609
|
}
|
|
614
610
|
// element node
|
|
615
611
|
{
|
|
616
|
-
if (tag === 'slot')
|
|
612
|
+
if ( tag === 'slot')
|
|
617
613
|
;
|
|
618
614
|
else {
|
|
619
615
|
// either this is the first render of an element OR it's an update
|
|
@@ -622,28 +618,28 @@ const patch = (oldVNode, newVNode) => {
|
|
|
622
618
|
updateElement(oldVNode, newVNode, isSvgMode);
|
|
623
619
|
}
|
|
624
620
|
}
|
|
625
|
-
if (oldChildren !== null && newChildren !== null) {
|
|
621
|
+
if ( oldChildren !== null && newChildren !== null) {
|
|
626
622
|
// looks like there's child vnodes for both the old and new vnodes
|
|
627
623
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
628
624
|
}
|
|
629
625
|
else if (newChildren !== null) {
|
|
630
626
|
// no old child vnodes, but there are new child vnodes to add
|
|
631
|
-
if (oldVNode.$text$ !== null) {
|
|
627
|
+
if ( oldVNode.$text$ !== null) {
|
|
632
628
|
// the old vnode was text, so be sure to clear it out
|
|
633
629
|
elm.textContent = '';
|
|
634
630
|
}
|
|
635
631
|
// add the new vnode children
|
|
636
632
|
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
|
637
633
|
}
|
|
638
|
-
else if (oldChildren !== null) {
|
|
634
|
+
else if ( oldChildren !== null) {
|
|
639
635
|
// no new child vnodes, but there are old child vnodes to remove
|
|
640
636
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
641
637
|
}
|
|
642
|
-
if (isSvgMode && tag === 'svg') {
|
|
638
|
+
if ( isSvgMode && tag === 'svg') {
|
|
643
639
|
isSvgMode = false;
|
|
644
640
|
}
|
|
645
641
|
}
|
|
646
|
-
else if (oldVNode.$text$ !== text) {
|
|
642
|
+
else if ( oldVNode.$text$ !== text) {
|
|
647
643
|
// update the text content for the text only vnode
|
|
648
644
|
// and also only if the text is different than before
|
|
649
645
|
elm.data = text;
|
|
@@ -661,21 +657,21 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
661
657
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
662
658
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
663
659
|
hostTagName = hostElm.tagName;
|
|
664
|
-
if (cmpMeta.$attrsToReflect$) {
|
|
660
|
+
if ( cmpMeta.$attrsToReflect$) {
|
|
665
661
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
666
662
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
667
663
|
}
|
|
668
664
|
rootVnode.$tag$ = null;
|
|
669
665
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
670
666
|
hostRef.$vnode$ = rootVnode;
|
|
671
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
667
|
+
rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm.shadowRoot || hostElm );
|
|
672
668
|
{
|
|
673
669
|
scopeId = hostElm['s-sc'];
|
|
674
670
|
}
|
|
675
671
|
// synchronous patch
|
|
676
672
|
patch(oldVNode, rootVnode);
|
|
677
673
|
};
|
|
678
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
674
|
+
const getElement = (ref) => ( getHostRef(ref).$hostElement$ );
|
|
679
675
|
const createEvent = (ref, name, flags) => {
|
|
680
676
|
const elm = getElement(ref);
|
|
681
677
|
return {
|
|
@@ -689,28 +685,21 @@ const createEvent = (ref, name, flags) => {
|
|
|
689
685
|
},
|
|
690
686
|
};
|
|
691
687
|
};
|
|
692
|
-
/**
|
|
693
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
694
|
-
* @param elm the target of the Event
|
|
695
|
-
* @param name the name to give the custom Event
|
|
696
|
-
* @param opts options for configuring a custom Event
|
|
697
|
-
* @returns the custom Event
|
|
698
|
-
*/
|
|
699
688
|
const emitEvent = (elm, name, opts) => {
|
|
700
689
|
const ev = plt.ce(name, opts);
|
|
701
690
|
elm.dispatchEvent(ev);
|
|
702
691
|
return ev;
|
|
703
692
|
};
|
|
704
693
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
705
|
-
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
706
|
-
ancestorComponent['s-p'].push(new Promise(
|
|
694
|
+
if ( ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
695
|
+
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
|
|
707
696
|
}
|
|
708
697
|
};
|
|
709
698
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
710
699
|
{
|
|
711
700
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
712
701
|
}
|
|
713
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
702
|
+
if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
714
703
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
715
704
|
return;
|
|
716
705
|
}
|
|
@@ -719,11 +708,11 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
719
708
|
// has already fired off its lifecycle update then
|
|
720
709
|
// fire off the initial update
|
|
721
710
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
722
|
-
return
|
|
711
|
+
return writeTask(dispatch) ;
|
|
723
712
|
};
|
|
724
713
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
725
714
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
726
|
-
const instance =
|
|
715
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
727
716
|
let promise;
|
|
728
717
|
if (isInitialLoad) {
|
|
729
718
|
{
|
|
@@ -745,19 +734,26 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
745
734
|
const elm = hostRef.$hostElement$;
|
|
746
735
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
747
736
|
const rc = elm['s-rc'];
|
|
748
|
-
if (isInitialLoad) {
|
|
737
|
+
if ( isInitialLoad) {
|
|
749
738
|
// DOM WRITE!
|
|
750
739
|
attachStyles(hostRef);
|
|
751
740
|
}
|
|
752
741
|
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
|
753
742
|
{
|
|
754
|
-
|
|
743
|
+
{
|
|
744
|
+
// looks like we've got child nodes to render into this host element
|
|
745
|
+
// or we need to update the css class/attrs on the host element
|
|
746
|
+
// DOM WRITE!
|
|
747
|
+
{
|
|
748
|
+
renderVdom(hostRef, callRender(hostRef, instance));
|
|
749
|
+
}
|
|
750
|
+
}
|
|
755
751
|
}
|
|
756
|
-
if (rc) {
|
|
752
|
+
if ( rc) {
|
|
757
753
|
// ok, so turns out there are some child host elements
|
|
758
754
|
// waiting on this parent element to load
|
|
759
755
|
// let's fire off all update callbacks waiting
|
|
760
|
-
rc.map(
|
|
756
|
+
rc.map(cb => cb());
|
|
761
757
|
elm['s-rc'] = undefined;
|
|
762
758
|
}
|
|
763
759
|
endRender();
|
|
@@ -775,36 +771,26 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
775
771
|
}
|
|
776
772
|
}
|
|
777
773
|
};
|
|
778
|
-
const callRender = (hostRef, instance
|
|
774
|
+
const callRender = (hostRef, instance) => {
|
|
779
775
|
try {
|
|
780
|
-
instance =
|
|
776
|
+
instance = instance.render && instance.render();
|
|
781
777
|
{
|
|
782
778
|
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
783
779
|
}
|
|
784
780
|
{
|
|
785
781
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
786
782
|
}
|
|
787
|
-
{
|
|
788
|
-
{
|
|
789
|
-
// looks like we've got child nodes to render into this host element
|
|
790
|
-
// or we need to update the css class/attrs on the host element
|
|
791
|
-
// DOM WRITE!
|
|
792
|
-
{
|
|
793
|
-
renderVdom(hostRef, instance);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
783
|
}
|
|
798
784
|
catch (e) {
|
|
799
785
|
consoleError(e, hostRef.$hostElement$);
|
|
800
786
|
}
|
|
801
|
-
return
|
|
787
|
+
return instance;
|
|
802
788
|
};
|
|
803
789
|
const postUpdateComponent = (hostRef) => {
|
|
804
790
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
805
791
|
const elm = hostRef.$hostElement$;
|
|
806
792
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
807
|
-
const instance =
|
|
793
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
808
794
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
809
795
|
{
|
|
810
796
|
safeCall(instance, 'componentDidRender');
|
|
@@ -855,8 +841,7 @@ const forceUpdate = (ref) => {
|
|
|
855
841
|
{
|
|
856
842
|
const hostRef = getHostRef(ref);
|
|
857
843
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
858
|
-
if (isConnected &&
|
|
859
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
844
|
+
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
860
845
|
scheduleUpdate(hostRef, false);
|
|
861
846
|
}
|
|
862
847
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -885,21 +870,20 @@ const safeCall = (instance, method, arg) => {
|
|
|
885
870
|
const then = (promise, thenFn) => {
|
|
886
871
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
887
872
|
};
|
|
888
|
-
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
889
|
-
;
|
|
873
|
+
const addHydratedFlag = (elm) => ( elm.classList.add('hydrated') );
|
|
890
874
|
const parsePropertyValue = (propValue, propType) => {
|
|
891
875
|
// ensure this value is of the correct prop type
|
|
892
876
|
if (propValue != null && !isComplexType(propValue)) {
|
|
893
|
-
if (propType & 4 /* Boolean */) {
|
|
877
|
+
if ( propType & 4 /* Boolean */) {
|
|
894
878
|
// per the HTML spec, any string value means it is a boolean true value
|
|
895
879
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
896
880
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
897
881
|
}
|
|
898
|
-
if (propType & 2 /* Number */) {
|
|
882
|
+
if ( propType & 2 /* Number */) {
|
|
899
883
|
// force it to be a number
|
|
900
884
|
return parseFloat(propValue);
|
|
901
885
|
}
|
|
902
|
-
if (propType & 1 /* String */) {
|
|
886
|
+
if ( propType & 1 /* String */) {
|
|
903
887
|
// could have been passed as a number or boolean
|
|
904
888
|
// but we still want it as a string
|
|
905
889
|
return String(propValue);
|
|
@@ -915,22 +899,22 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
915
899
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
916
900
|
// check our new property value against our internal value
|
|
917
901
|
const hostRef = getHostRef(ref);
|
|
918
|
-
const elm =
|
|
902
|
+
const elm = hostRef.$hostElement$ ;
|
|
919
903
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
920
904
|
const flags = hostRef.$flags$;
|
|
921
|
-
const instance =
|
|
905
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
922
906
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
923
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
|
|
907
|
+
if (( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
|
|
924
908
|
// gadzooks! the property's value has changed!!
|
|
925
909
|
// set our new value!
|
|
926
910
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
927
|
-
if (instance) {
|
|
911
|
+
if ( instance) {
|
|
928
912
|
// get an array of method names of watch functions to call
|
|
929
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
913
|
+
if ( cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
930
914
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
931
915
|
if (watchMethods) {
|
|
932
916
|
// this instance is watching for when this property changed
|
|
933
|
-
watchMethods.map(
|
|
917
|
+
watchMethods.map(watchMethodName => {
|
|
934
918
|
try {
|
|
935
919
|
// fire off each of the watch methods that are watching this property
|
|
936
920
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
@@ -941,7 +925,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
941
925
|
});
|
|
942
926
|
}
|
|
943
927
|
}
|
|
944
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
928
|
+
if ( (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
945
929
|
// looks like this value actually changed, so we've got work to do!
|
|
946
930
|
// but only if we've already rendered, otherwise just chill out
|
|
947
931
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -952,16 +936,15 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
952
936
|
}
|
|
953
937
|
};
|
|
954
938
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
955
|
-
if (cmpMeta.$members$) {
|
|
956
|
-
if (Cstr.watchers) {
|
|
939
|
+
if ( cmpMeta.$members$) {
|
|
940
|
+
if ( Cstr.watchers) {
|
|
957
941
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
958
942
|
}
|
|
959
943
|
// It's better to have a const than two Object.entries()
|
|
960
944
|
const members = Object.entries(cmpMeta.$members$);
|
|
961
945
|
const prototype = Cstr.prototype;
|
|
962
946
|
members.map(([memberName, [memberFlags]]) => {
|
|
963
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
964
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
947
|
+
if ( (memberFlags & 31 /* Prop */ || (( flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
965
948
|
// proxyComponent - prop
|
|
966
949
|
Object.defineProperty(prototype, memberName, {
|
|
967
950
|
get() {
|
|
@@ -976,8 +959,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
976
959
|
enumerable: true,
|
|
977
960
|
});
|
|
978
961
|
}
|
|
979
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
980
|
-
memberFlags & 64 /* Method */) {
|
|
962
|
+
else if ( flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
|
|
981
963
|
// proxyComponent - method
|
|
982
964
|
Object.defineProperty(prototype, memberName, {
|
|
983
965
|
value(...args) {
|
|
@@ -987,48 +969,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
987
969
|
});
|
|
988
970
|
}
|
|
989
971
|
});
|
|
990
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
972
|
+
if ( ( flags & 1 /* isElementConstructor */)) {
|
|
991
973
|
const attrNameToPropName = new Map();
|
|
992
974
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
993
975
|
plt.jmp(() => {
|
|
994
976
|
const propName = attrNameToPropName.get(attrName);
|
|
995
|
-
// In a webcomponent lifecyle the attributeChangedCallback runs prior to connectedCallback
|
|
996
|
-
// in the case where an attribute was set inline.
|
|
997
|
-
// ```html
|
|
998
|
-
// <my-component some-attribute="some-value"></my-component>
|
|
999
|
-
// ```
|
|
1000
|
-
//
|
|
1001
|
-
// There is an edge case where a developer sets the attribute inline on a custom element and then programatically
|
|
1002
|
-
// changes it before it has been upgraded as shown below:
|
|
1003
|
-
//
|
|
1004
|
-
// ```html
|
|
1005
|
-
// <!-- this component has _not_ been upgraded yet -->
|
|
1006
|
-
// <my-component id="test" some-attribute="some-value"></my-component>
|
|
1007
|
-
// <script>
|
|
1008
|
-
// // grab non-upgraded component
|
|
1009
|
-
// el = document.querySelector("#test");
|
|
1010
|
-
// el.someAttribute = "another-value";
|
|
1011
|
-
// // upgrade component
|
|
1012
|
-
// cutsomElements.define('my-component', MyComponent);
|
|
1013
|
-
// </script>
|
|
1014
|
-
// ```
|
|
1015
|
-
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1016
|
-
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1017
|
-
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1018
|
-
// the connectedCallback attempts to unshadow it will use "some-value" as the intial value rather than "another-value"
|
|
1019
|
-
//
|
|
1020
|
-
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1021
|
-
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
1022
|
-
//
|
|
1023
|
-
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1024
|
-
//
|
|
1025
|
-
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
|
1026
|
-
// properties here given that this goes against best practices outlined here
|
|
1027
|
-
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
|
1028
|
-
if (this.hasOwnProperty(propName)) {
|
|
1029
|
-
newValue = this[propName];
|
|
1030
|
-
delete this[propName];
|
|
1031
|
-
}
|
|
1032
977
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1033
978
|
});
|
|
1034
979
|
};
|
|
@@ -1039,7 +984,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1039
984
|
.map(([propName, m]) => {
|
|
1040
985
|
const attrName = m[1] || propName;
|
|
1041
986
|
attrNameToPropName.set(attrName, propName);
|
|
1042
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
987
|
+
if ( m[0] & 512 /* ReflectAttr */) {
|
|
1043
988
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1044
989
|
}
|
|
1045
990
|
return attrName;
|
|
@@ -1050,7 +995,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1050
995
|
};
|
|
1051
996
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1052
997
|
// initializeComponent
|
|
1053
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
998
|
+
if ( (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1054
999
|
{
|
|
1055
1000
|
// we haven't initialized this element yet
|
|
1056
1001
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
@@ -1064,8 +1009,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1064
1009
|
Cstr = await Cstr;
|
|
1065
1010
|
endLoad();
|
|
1066
1011
|
}
|
|
1067
|
-
if (!Cstr.isProxied) {
|
|
1068
|
-
// we'
|
|
1012
|
+
if ( !Cstr.isProxied) {
|
|
1013
|
+
// we'eve never proxied this Constructor before
|
|
1069
1014
|
// let's add the getters/setters to its prototype before
|
|
1070
1015
|
// the first time we create an instance of the implementation
|
|
1071
1016
|
{
|
|
@@ -1099,7 +1044,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1099
1044
|
}
|
|
1100
1045
|
endNewInstance();
|
|
1101
1046
|
}
|
|
1102
|
-
if (Cstr.style) {
|
|
1047
|
+
if ( Cstr.style) {
|
|
1103
1048
|
// this component has styles but we haven't registered them yet
|
|
1104
1049
|
let style = Cstr.style;
|
|
1105
1050
|
const scopeId = getScopeId(cmpMeta);
|
|
@@ -1113,7 +1058,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1113
1058
|
// we've successfully created a lazy instance
|
|
1114
1059
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1115
1060
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1116
|
-
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1061
|
+
if ( ancestorComponent && ancestorComponent['s-rc']) {
|
|
1117
1062
|
// this is the intial load and this component it has an ancestor component
|
|
1118
1063
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1119
1064
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
@@ -1141,7 +1086,8 @@ const connectedCallback = (elm) => {
|
|
|
1141
1086
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1142
1087
|
// climb up the ancestors looking for the first
|
|
1143
1088
|
// component that hasn't finished its lifecycle update yet
|
|
1144
|
-
if (
|
|
1089
|
+
if (
|
|
1090
|
+
ancestorComponent['s-p']) {
|
|
1145
1091
|
// we found this components first ancestor component
|
|
1146
1092
|
// keep a reference to this component's ancestor component
|
|
1147
1093
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1151,7 +1097,7 @@ const connectedCallback = (elm) => {
|
|
|
1151
1097
|
}
|
|
1152
1098
|
// Lazy properties
|
|
1153
1099
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1154
|
-
if (cmpMeta.$members$) {
|
|
1100
|
+
if ( cmpMeta.$members$) {
|
|
1155
1101
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1156
1102
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1157
1103
|
const value = elm[memberName];
|
|
@@ -1178,7 +1124,7 @@ const disconnectedCallback = (elm) => {
|
|
|
1178
1124
|
const hostRef = getHostRef(elm);
|
|
1179
1125
|
{
|
|
1180
1126
|
if (hostRef.$rmListeners$) {
|
|
1181
|
-
hostRef.$rmListeners$.map(
|
|
1127
|
+
hostRef.$rmListeners$.map(rmListener => rmListener());
|
|
1182
1128
|
hostRef.$rmListeners$ = undefined;
|
|
1183
1129
|
}
|
|
1184
1130
|
}
|
|
@@ -1197,7 +1143,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1197
1143
|
let isBootstrapping = true;
|
|
1198
1144
|
Object.assign(plt, options);
|
|
1199
1145
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1200
|
-
lazyBundles.map(
|
|
1146
|
+
lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
|
|
1201
1147
|
const cmpMeta = {
|
|
1202
1148
|
$flags$: compactMeta[0],
|
|
1203
1149
|
$tagName$: compactMeta[1],
|
|
@@ -1216,7 +1162,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1216
1162
|
{
|
|
1217
1163
|
cmpMeta.$watchers$ = {};
|
|
1218
1164
|
}
|
|
1219
|
-
const tagName =
|
|
1165
|
+
const tagName = cmpMeta.$tagName$;
|
|
1220
1166
|
const HostElement = class extends HTMLElement {
|
|
1221
1167
|
// StencilLazyHost
|
|
1222
1168
|
constructor(self) {
|
|
@@ -1224,7 +1170,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1224
1170
|
super(self);
|
|
1225
1171
|
self = this;
|
|
1226
1172
|
registerHost(self, cmpMeta);
|
|
1227
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1173
|
+
if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1228
1174
|
// this component is using shadow dom
|
|
1229
1175
|
// and this browser supports shadow dom
|
|
1230
1176
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1270,7 +1216,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1270
1216
|
// Process deferred connectedCallbacks now all components have been registered
|
|
1271
1217
|
isBootstrapping = false;
|
|
1272
1218
|
if (deferredConnectedCallbacks.length) {
|
|
1273
|
-
deferredConnectedCallbacks.map(
|
|
1219
|
+
deferredConnectedCallbacks.map(host => host.connectedCallback());
|
|
1274
1220
|
}
|
|
1275
1221
|
else {
|
|
1276
1222
|
{
|
|
@@ -1291,10 +1237,10 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1291
1237
|
$instanceValues$: new Map(),
|
|
1292
1238
|
};
|
|
1293
1239
|
{
|
|
1294
|
-
hostRef.$onInstancePromise$ = new Promise(
|
|
1240
|
+
hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
|
|
1295
1241
|
}
|
|
1296
1242
|
{
|
|
1297
|
-
hostRef.$onReadyPromise$ = new Promise(
|
|
1243
|
+
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
|
|
1298
1244
|
elm['s-p'] = [];
|
|
1299
1245
|
elm['s-rc'] = [];
|
|
1300
1246
|
}
|
|
@@ -1302,13 +1248,13 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1302
1248
|
return hostRefs.set(elm, hostRef);
|
|
1303
1249
|
};
|
|
1304
1250
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
|
1305
|
-
const consoleError = (e, el) => (0, console.error)(e, el);
|
|
1251
|
+
const consoleError = (e, el) => ( 0, console.error)(e, el);
|
|
1306
1252
|
const cmpModules = /*@__PURE__*/ new Map();
|
|
1307
1253
|
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1308
1254
|
// loadModuleImport
|
|
1309
1255
|
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
|
1310
1256
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
1311
|
-
const module =
|
|
1257
|
+
const module = cmpModules.get(bundleId) ;
|
|
1312
1258
|
if (module) {
|
|
1313
1259
|
return module[exportName];
|
|
1314
1260
|
}
|
|
@@ -1316,7 +1262,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1316
1262
|
/* webpackInclude: /\.entry\.js$/ */
|
|
1317
1263
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
1318
1264
|
/* webpackMode: "lazy" */
|
|
1319
|
-
`./${bundleId}.entry.js${''}`).then(
|
|
1265
|
+
`./${bundleId}.entry.js${ ''}`).then(importedModule => {
|
|
1320
1266
|
{
|
|
1321
1267
|
cmpModules.set(bundleId, importedModule);
|
|
1322
1268
|
}
|