ku4web-components 6.7.10 → 6.7.13
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/index.js +1 -1
- package/angular/index.mjs +1 -1
- package/dist/cjs/index-3f6b12f6.js +10 -0
- package/dist/cjs/{index-8b7230db.js → index-d4518258.js} +251 -84
- package/dist/cjs/ku4-carousel-controls.cjs.entry.js +1 -1
- package/dist/cjs/ku4-carousel-slide.cjs.entry.js +1 -1
- package/dist/cjs/ku4-carousel.cjs.entry.js +2 -2
- package/dist/cjs/ku4-col.cjs.entry.js +1 -1
- package/dist/cjs/ku4-drawer.cjs.entry.js +1 -1
- package/dist/cjs/ku4-feature.cjs.entry.js +1 -1
- package/dist/cjs/ku4-focus-trap.cjs.entry.js +2 -2
- package/dist/cjs/ku4-form.cjs.entry.js +2 -2
- package/dist/cjs/ku4-grid.cjs.entry.js +1 -1
- package/dist/cjs/ku4-label.cjs.entry.js +1 -1
- package/dist/cjs/ku4-mask.cjs.entry.js +1 -1
- package/dist/cjs/ku4-modal.cjs.entry.js +2 -2
- package/dist/cjs/ku4-panel.cjs.entry.js +1 -1
- package/dist/cjs/ku4-preview.cjs.entry.js +2 -2
- package/dist/cjs/ku4-tab-list.cjs.entry.js +2 -2
- package/dist/cjs/ku4-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/ku4-tab.cjs.entry.js +1 -1
- package/dist/cjs/ku4-table.cjs.entry.js +1 -1
- package/dist/cjs/ku4-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/ku4-validation.cjs.entry.js +1 -1
- package/dist/cjs/ku4web-components.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{shadow-css-cf936b02.js → shadow-css-a33dc836.js} +1 -1
- package/dist/esm/{index-ed88cd9f.js → index-86df1782.js} +251 -84
- package/dist/esm/index-b9d8468a.js +3 -0
- package/dist/esm/ku4-carousel-controls.entry.js +1 -1
- package/dist/esm/ku4-carousel-slide.entry.js +1 -1
- package/dist/esm/ku4-carousel.entry.js +2 -2
- package/dist/esm/ku4-col.entry.js +1 -1
- package/dist/esm/ku4-drawer.entry.js +1 -1
- package/dist/esm/ku4-feature.entry.js +1 -1
- package/dist/esm/ku4-focus-trap.entry.js +2 -2
- package/dist/esm/ku4-form.entry.js +2 -2
- package/dist/esm/ku4-grid.entry.js +1 -1
- package/dist/esm/ku4-label.entry.js +1 -1
- package/dist/esm/ku4-mask.entry.js +1 -1
- package/dist/esm/ku4-modal.entry.js +2 -2
- package/dist/esm/ku4-panel.entry.js +1 -1
- package/dist/esm/ku4-preview.entry.js +2 -2
- package/dist/esm/ku4-tab-list.entry.js +2 -2
- package/dist/esm/ku4-tab-panel.entry.js +1 -1
- package/dist/esm/ku4-tab.entry.js +1 -1
- package/dist/esm/ku4-table.entry.js +1 -1
- package/dist/esm/ku4-tooltip.entry.js +1 -1
- package/dist/esm/ku4-validation.entry.js +1 -1
- package/dist/esm/ku4web-components.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{shadow-css-4cd4480f.js → shadow-css-4261c637.js} +1 -1
- package/dist/esm-es5/{index-ed88cd9f.js → index-86df1782.js} +1 -1
- package/dist/esm-es5/index-b9d8468a.js +1 -0
- package/dist/esm-es5/ku4-carousel-controls.entry.js +1 -1
- package/dist/esm-es5/ku4-carousel-slide.entry.js +1 -1
- package/dist/esm-es5/ku4-carousel.entry.js +1 -1
- package/dist/esm-es5/ku4-col.entry.js +1 -1
- package/dist/esm-es5/ku4-drawer.entry.js +1 -1
- package/dist/esm-es5/ku4-feature.entry.js +1 -1
- package/dist/esm-es5/ku4-focus-trap.entry.js +1 -1
- package/dist/esm-es5/ku4-form.entry.js +1 -1
- package/dist/esm-es5/ku4-grid.entry.js +1 -1
- package/dist/esm-es5/ku4-label.entry.js +1 -1
- package/dist/esm-es5/ku4-mask.entry.js +1 -1
- package/dist/esm-es5/ku4-modal.entry.js +1 -1
- package/dist/esm-es5/ku4-panel.entry.js +1 -1
- package/dist/esm-es5/ku4-preview.entry.js +1 -1
- package/dist/esm-es5/ku4-tab-list.entry.js +1 -1
- package/dist/esm-es5/ku4-tab-panel.entry.js +1 -1
- package/dist/esm-es5/ku4-tab.entry.js +1 -1
- package/dist/esm-es5/ku4-table.entry.js +1 -1
- package/dist/esm-es5/ku4-tooltip.entry.js +1 -1
- package/dist/esm-es5/ku4-validation.entry.js +1 -1
- package/dist/esm-es5/ku4web-components.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{shadow-css-4cd4480f.js → shadow-css-4261c637.js} +0 -0
- package/dist/ku4web-components/ku4web-components.esm.js +1 -1
- package/dist/ku4web-components/ku4web-components.js +1 -1
- package/dist/ku4web-components/{p-918a802a.entry.js → p-0611607f.entry.js} +1 -1
- package/dist/ku4web-components/{p-11757f38.system.entry.js → p-0c2fe92e.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-3074face.system.js → p-0ced1fa7.system.js} +1 -1
- package/dist/ku4web-components/{p-db4732d6.system.entry.js → p-168f206e.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-825c4eb1.entry.js → p-1d80d5ea.entry.js} +1 -1
- package/dist/ku4web-components/{p-00f6f7a2.system.entry.js → p-2a510b37.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-416cf70d.system.entry.js → p-2a630678.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-46b0daaf.entry.js → p-2a862665.entry.js} +1 -1
- package/dist/ku4web-components/{p-0e578877.system.entry.js → p-2f625567.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-0f3da44d.system.entry.js → p-33da409b.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-36f621f0.entry.js → p-42bd3225.entry.js} +1 -1
- package/dist/ku4web-components/{p-e56f956e.entry.js → p-43a3b16a.entry.js} +1 -1
- package/dist/ku4web-components/{p-3bf6b262.entry.js → p-517da8da.entry.js} +1 -1
- package/dist/ku4web-components/p-5d8e9dd5.js +1 -0
- package/dist/ku4web-components/{p-376b72f4.system.entry.js → p-63b36bc5.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-68376c90.system.js → p-69165a40.system.js} +1 -1
- package/dist/ku4web-components/{p-80c99a74.entry.js → p-722f1484.entry.js} +1 -1
- package/dist/ku4web-components/{p-7fb3c20b.entry.js → p-728958cf.entry.js} +1 -1
- package/dist/ku4web-components/{p-76ed1a14.system.entry.js → p-7a05df32.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-b32c7075.system.entry.js → p-80a59984.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-15a87049.system.entry.js → p-8410b9b5.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-c52796ac.entry.js → p-89fe8fa0.entry.js} +1 -1
- package/dist/ku4web-components/{p-29a8bbab.entry.js → p-96b2c669.entry.js} +1 -1
- package/dist/ku4web-components/{p-9dfc9b1f.system.entry.js → p-9d5d5758.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-e2515ee6.entry.js → p-a4f7342a.entry.js} +1 -1
- package/dist/ku4web-components/{p-a3636f09.entry.js → p-a84dd208.entry.js} +1 -1
- package/dist/ku4web-components/{p-b1530d9c.system.js → p-a8de6293.system.js} +0 -0
- package/dist/ku4web-components/{p-f5f5958d.system.entry.js → p-a8ef8a26.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-9d3e0ac4.entry.js → p-aac61317.entry.js} +1 -1
- package/dist/ku4web-components/{p-a43cea20.system.entry.js → p-abb96c12.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-0ca65b63.entry.js → p-ad0e5cff.entry.js} +1 -1
- package/dist/ku4web-components/{p-89670006.system.entry.js → p-b0edddc6.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-5cccec1b.system.entry.js → p-b9b65d90.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-003842e3.entry.js → p-bcbf1f48.entry.js} +1 -1
- package/dist/ku4web-components/{p-e4e56edf.system.entry.js → p-c2dc6f6d.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-adbc2f7a.system.entry.js → p-c3616b74.system.entry.js} +1 -1
- package/dist/ku4web-components/p-c7ab12de.system.js +1 -0
- package/dist/ku4web-components/{p-8e94fc34.entry.js → p-d932f0d5.entry.js} +1 -1
- package/dist/ku4web-components/{p-4f30a3b4.entry.js → p-dadf46ab.entry.js} +1 -1
- package/dist/ku4web-components/p-dcb37faf.entry.js +1 -0
- package/dist/ku4web-components/{p-dd984902.system.entry.js → p-e1a494a4.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-23ff9bcd.entry.js → p-e37a1d15.entry.js} +1 -1
- package/dist/ku4web-components/{p-a51c6fe5.system.entry.js → p-e4c836ca.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-4eaf20b7.js → p-ef5d4167.js} +0 -0
- package/dist/ku4web-components/{p-ba6e9e3d.entry.js → p-f03c5bf4.entry.js} +1 -1
- package/dist/ku4web-components/{p-6c6c1035.system.entry.js → p-f8eab33b.system.entry.js} +1 -1
- package/dist/ku4web-components/{p-a145181f.js → p-fbee7bb3.js} +1 -1
- package/dist/types/capabilities/decorators/deprecated.d.ts +1 -1
- package/dist/types/capabilities/testing/html.d.ts +1 -1
- package/dist/types/capabilities/testing/styles.d.ts +1 -1
- package/dist/types/components/ku4-validation/validate.d.ts +1 -1
- package/loader/package.json +1 -0
- package/package.json +32 -32
- package/react/index.js +1 -1
- package/react/index.mjs +1 -1
- package/vue/index.js +1 -1
- package/vue/index.mjs +1 -1
- package/vue3/index.js +1 -1
- package/vue3/index.mjs +1 -1
- package/dist/cjs/index-5ea4489d.js +0 -10
- package/dist/esm/index-bb8d5d62.js +0 -3
- package/dist/esm-es5/index-bb8d5d62.js +0 -1
- package/dist/ku4web-components/p-7d459d29.entry.js +0 -1
- package/dist/ku4web-components/p-e8b35187.js +0 -1
- package/dist/ku4web-components/p-eb21757a.system.js +0 -1
@@ -45,7 +45,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
45
45
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
46
46
|
try {
|
47
47
|
{
|
48
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
48
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
49
49
|
// instance is ready, let's call it's member method for this event
|
50
50
|
hostRef.$lazyInstance$[methodName](ev);
|
51
51
|
}
|
@@ -59,12 +59,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
59
59
|
}
|
60
60
|
};
|
61
61
|
const getHostListenerTarget = (elm, flags) => {
|
62
|
-
if (flags & 8 /* TargetWindow */)
|
62
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
63
63
|
return win;
|
64
64
|
return elm;
|
65
65
|
};
|
66
66
|
// prettier-ignore
|
67
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
67
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
68
68
|
const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
|
69
69
|
const createTime = (fnName, tagName = '') => {
|
70
70
|
{
|
@@ -80,7 +80,7 @@ const uniqueTime = (key, measureText) => {
|
|
80
80
|
};
|
81
81
|
}
|
82
82
|
};
|
83
|
-
const rootAppliedStyles = new WeakMap();
|
83
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
84
84
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
85
85
|
let style = styles.get(scopeId);
|
86
86
|
if (supportsConstructableStylesheets && allowCS) {
|
@@ -102,7 +102,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
102
102
|
const style = styles.get(scopeId);
|
103
103
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
104
104
|
// so the fallback is to always use the document for the root node in those cases
|
105
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
105
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
106
106
|
if (style) {
|
107
107
|
if (typeof style === 'string') {
|
108
108
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
@@ -136,7 +136,7 @@ const attachStyles = (hostRef) => {
|
|
136
136
|
const flags = cmpMeta.$flags$;
|
137
137
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
138
138
|
const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
139
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
139
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
140
140
|
// only required when we're NOT using native shadow dom (slot)
|
141
141
|
// or this browser doesn't support native shadow dom
|
142
142
|
// and this host element was NOT created with SSR
|
@@ -359,7 +359,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
359
359
|
}
|
360
360
|
}
|
361
361
|
}
|
362
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
362
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
363
363
|
newValue = newValue === true ? '' : newValue;
|
364
364
|
{
|
365
365
|
elm.setAttribute(memberName, newValue);
|
@@ -374,7 +374,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
374
374
|
// if the element passed in is a shadow root, which is a document fragment
|
375
375
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
376
376
|
// if it's not a shadow root, then we add attrs/props to the same element
|
377
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
377
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
378
378
|
? newVnode.$elm$.host
|
379
379
|
: newVnode.$elm$;
|
380
380
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
@@ -392,6 +392,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
392
392
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
393
393
|
}
|
394
394
|
};
|
395
|
+
/**
|
396
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
397
|
+
*
|
398
|
+
* @param oldParentVNode the parent VNode from the previous render
|
399
|
+
* @param newParentVNode the parent VNode from the current render
|
400
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
401
|
+
* children, for which we will create a new DOM node
|
402
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
403
|
+
* @returns the newly created node
|
404
|
+
*/
|
395
405
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
396
406
|
// tslint:disable-next-line: prefer-const
|
397
407
|
const newVNode = newParentVNode.$children$[childIndex];
|
@@ -409,23 +419,23 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
409
419
|
}
|
410
420
|
newVNode.$flags$ |= newVNode.$children$
|
411
421
|
? // slot element has fallback content
|
412
|
-
2 /* isSlotFallback */
|
422
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
413
423
|
: // slot element does not have fallback content
|
414
|
-
1 /* isSlotReference */;
|
424
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
415
425
|
}
|
416
426
|
}
|
417
427
|
if (newVNode.$text$ !== null) {
|
418
428
|
// create text node
|
419
429
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
420
430
|
}
|
421
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
431
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
422
432
|
// create a slot reference node
|
423
433
|
elm = newVNode.$elm$ =
|
424
434
|
doc.createTextNode('');
|
425
435
|
}
|
426
436
|
else {
|
427
437
|
// create element
|
428
|
-
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
|
438
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
429
439
|
? 'slot-fb'
|
430
440
|
: newVNode.$tag$));
|
431
441
|
// add css classes, attrs, props, listeners, etc.
|
@@ -451,7 +461,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
451
461
|
}
|
452
462
|
{
|
453
463
|
elm['s-hn'] = hostTagName;
|
454
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
464
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
455
465
|
// remember the content reference comment
|
456
466
|
elm['s-sr'] = true;
|
457
467
|
// remember the content reference comment
|
@@ -470,7 +480,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
470
480
|
return elm;
|
471
481
|
};
|
472
482
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
473
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
483
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
474
484
|
const oldSlotChildNodes = parentElm.childNodes;
|
475
485
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
476
486
|
const childNode = oldSlotChildNodes[i];
|
@@ -491,7 +501,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
491
501
|
putBackInOriginalLocation(childNode, recursive);
|
492
502
|
}
|
493
503
|
}
|
494
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
504
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
495
505
|
};
|
496
506
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
497
507
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
@@ -532,6 +542,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
532
542
|
}
|
533
543
|
}
|
534
544
|
};
|
545
|
+
/**
|
546
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
547
|
+
* traversing the two collections of children, identifying nodes that are
|
548
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
549
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
550
|
+
*
|
551
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
552
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
553
|
+
* 'windows' by storing start and end indices and references to the
|
554
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
555
|
+
* to the entire array, but we progressively narrow the windows until there are
|
556
|
+
* no children left to update by doing the following:
|
557
|
+
*
|
558
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
559
|
+
* that if we have an initial array like the following we'll end up dealing
|
560
|
+
* only with a window bounded by the highlighted elements:
|
561
|
+
*
|
562
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
563
|
+
* ^^^^^^ ^^^^^^
|
564
|
+
*
|
565
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
566
|
+
* across the windows. This will basically detect elements which haven't
|
567
|
+
* been added, removed, or changed position, i.e. if you had the following
|
568
|
+
* VNode elements (represented as HTML):
|
569
|
+
*
|
570
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
571
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
572
|
+
*
|
573
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
574
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
575
|
+
* same tag in the same position, we'd be able to avoid completely
|
576
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
577
|
+
* call out to `patch` to handle reconciling their children and so on.
|
578
|
+
*
|
579
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
580
|
+
* window corresponds to the element at the end of the other window. This is
|
581
|
+
* a heuristic which will let us identify _some_ situations in which
|
582
|
+
* elements have changed position, for instance it _should_ detect that the
|
583
|
+
* children nodes themselves have not changed but merely moved in the
|
584
|
+
* following example:
|
585
|
+
*
|
586
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
587
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
588
|
+
*
|
589
|
+
* If we find cases like this then we also need to move the concrete DOM
|
590
|
+
* elements corresponding to the moved children to write the re-order to the
|
591
|
+
* DOM.
|
592
|
+
*
|
593
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
594
|
+
* nodes in the old children which have the same key as the first element in
|
595
|
+
* our window on the new children. If we find such a node we handle calling
|
596
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
597
|
+
* what we find.
|
598
|
+
*
|
599
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
600
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
601
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
602
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
603
|
+
* children has collapsed we still have more nodes on the new children that
|
604
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
605
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
606
|
+
* sure the corresponding DOM nodes are removed.
|
607
|
+
*
|
608
|
+
* @param parentElm the node into which the parent VNode is rendered
|
609
|
+
* @param oldCh the old children of the parent node
|
610
|
+
* @param newVNode the new VNode which will replace the parent
|
611
|
+
* @param newCh the new children of the parent node
|
612
|
+
*/
|
535
613
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
536
614
|
let oldStartIdx = 0;
|
537
615
|
let newStartIdx = 0;
|
@@ -544,7 +622,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
544
622
|
let node;
|
545
623
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
546
624
|
if (oldStartVnode == null) {
|
547
|
-
//
|
625
|
+
// VNode might have been moved left
|
548
626
|
oldStartVnode = oldCh[++oldStartIdx];
|
549
627
|
}
|
550
628
|
else if (oldEndVnode == null) {
|
@@ -557,42 +635,102 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
557
635
|
newEndVnode = newCh[--newEndIdx];
|
558
636
|
}
|
559
637
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
638
|
+
// if the start nodes are the same then we should patch the new VNode
|
639
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
640
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
641
|
+
// since things are matched up in order.
|
560
642
|
patch(oldStartVnode, newStartVnode);
|
561
643
|
oldStartVnode = oldCh[++oldStartIdx];
|
562
644
|
newStartVnode = newCh[++newStartIdx];
|
563
645
|
}
|
564
646
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
647
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
648
|
+
// decrement our end indices, and also likewise in this case we don't
|
649
|
+
// need to move any DOM Nodes.
|
565
650
|
patch(oldEndVnode, newEndVnode);
|
566
651
|
oldEndVnode = oldCh[--oldEndIdx];
|
567
652
|
newEndVnode = newCh[--newEndIdx];
|
568
653
|
}
|
569
654
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
570
|
-
// Vnode moved right
|
655
|
+
// case: "Vnode moved right"
|
656
|
+
//
|
657
|
+
// We've found that the last node in our window on the new children is
|
658
|
+
// the same VNode as the _first_ node in our window on the old children
|
659
|
+
// we're dealing with now. Visually, this is the layout of these two
|
660
|
+
// nodes:
|
661
|
+
//
|
662
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
663
|
+
// ^^^^^^^^^^^
|
664
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
665
|
+
// ^^^^^^^^^^^^^
|
666
|
+
//
|
667
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
668
|
+
// and move the DOM element for `oldStartVnode`.
|
571
669
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
572
670
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
573
671
|
}
|
574
672
|
patch(oldStartVnode, newEndVnode);
|
673
|
+
// We need to move the element for `oldStartVnode` into a position which
|
674
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
675
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
676
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
677
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
678
|
+
//
|
679
|
+
// <old-start-node />
|
680
|
+
// <some-intervening-node />
|
681
|
+
// <old-end-node />
|
682
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
683
|
+
// <next-sibling />
|
684
|
+
//
|
685
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
686
|
+
// the node for `oldStartVnode` at the end of the children of
|
687
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
688
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
689
|
+
// append it to the children of the parent element.
|
575
690
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
576
691
|
oldStartVnode = oldCh[++oldStartIdx];
|
577
692
|
newEndVnode = newCh[--newEndIdx];
|
578
693
|
}
|
579
694
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
580
|
-
// Vnode moved left
|
695
|
+
// case: "Vnode moved left"
|
696
|
+
//
|
697
|
+
// We've found that the first node in our window on the new children is
|
698
|
+
// the same VNode as the _last_ node in our window on the old children.
|
699
|
+
// Visually, this is the layout of these two nodes:
|
700
|
+
//
|
701
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
702
|
+
// ^^^^^^^^^^^^^
|
703
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
704
|
+
// ^^^^^^^^^^^
|
705
|
+
//
|
706
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
707
|
+
// (which will handle updating any changed attributes, reconciling their
|
708
|
+
// children etc) but we also need to move the DOM node to which
|
709
|
+
// `oldEndVnode` corresponds.
|
581
710
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
582
711
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
583
712
|
}
|
584
713
|
patch(oldEndVnode, newStartVnode);
|
714
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
715
|
+
// the same node, so since we're here we know that they are not. Thus we
|
716
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
717
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
718
|
+
// future.
|
585
719
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
586
720
|
oldEndVnode = oldCh[--oldEndIdx];
|
587
721
|
newStartVnode = newCh[++newStartIdx];
|
588
722
|
}
|
589
723
|
else {
|
590
724
|
{
|
591
|
-
//
|
725
|
+
// We either didn't find an element in the old children that matches
|
726
|
+
// the key of the first new child OR the build is not using `key`
|
727
|
+
// attributes at all. In either case we need to create a new element
|
728
|
+
// for the new node.
|
592
729
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
593
730
|
newStartVnode = newCh[++newStartIdx];
|
594
731
|
}
|
595
732
|
if (node) {
|
733
|
+
// if we created a new node then handle inserting it to the DOM
|
596
734
|
{
|
597
735
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
598
736
|
}
|
@@ -600,18 +738,39 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
600
738
|
}
|
601
739
|
}
|
602
740
|
if (oldStartIdx > oldEndIdx) {
|
741
|
+
// we have some more new nodes to add which don't match up with old nodes
|
603
742
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
604
743
|
}
|
605
744
|
else if (newStartIdx > newEndIdx) {
|
745
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
746
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
747
|
+
// relevant DOM nodes)
|
606
748
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
607
749
|
}
|
608
750
|
};
|
609
|
-
|
751
|
+
/**
|
752
|
+
* Compare two VNodes to determine if they are the same
|
753
|
+
*
|
754
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
755
|
+
* information set on the two VNodes and can be misleading under certain
|
756
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
757
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
758
|
+
* checking that they have the same tag.
|
759
|
+
*
|
760
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
761
|
+
* changing order within a `children` array or something along those lines then
|
762
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
763
|
+
*
|
764
|
+
* @param leftVNode the first VNode to check
|
765
|
+
* @param rightVNode the second VNode to check
|
766
|
+
* @returns whether they're equal or not
|
767
|
+
*/
|
768
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
610
769
|
// compare if two vnode to see if they're "technically" the same
|
611
770
|
// need to have the same element tag, and same key to be the same
|
612
|
-
if (
|
613
|
-
if (
|
614
|
-
return
|
771
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
772
|
+
if (leftVNode.$tag$ === 'slot') {
|
773
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
615
774
|
}
|
616
775
|
return true;
|
617
776
|
}
|
@@ -625,6 +784,14 @@ const referenceNode = (node) => {
|
|
625
784
|
return (node && node['s-ol']) || node;
|
626
785
|
};
|
627
786
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
787
|
+
/**
|
788
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
789
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
790
|
+
* children of the two nodes (if any).
|
791
|
+
*
|
792
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
793
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
794
|
+
*/
|
628
795
|
const patch = (oldVNode, newVNode) => {
|
629
796
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
630
797
|
const oldChildren = oldVNode.$children$;
|
@@ -633,7 +800,6 @@ const patch = (oldVNode, newVNode) => {
|
|
633
800
|
const text = newVNode.$text$;
|
634
801
|
let defaultHolder;
|
635
802
|
if (text === null) {
|
636
|
-
// element node
|
637
803
|
{
|
638
804
|
if (tag === 'slot')
|
639
805
|
;
|
@@ -646,6 +812,7 @@ const patch = (oldVNode, newVNode) => {
|
|
646
812
|
}
|
647
813
|
if (oldChildren !== null && newChildren !== null) {
|
648
814
|
// looks like there's child vnodes for both the old and new vnodes
|
815
|
+
// so we need to call `updateChildren` to reconcile them
|
649
816
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
650
817
|
}
|
651
818
|
else if (newChildren !== null) {
|
@@ -683,7 +850,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
683
850
|
let nodeType;
|
684
851
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
685
852
|
childNode = childNodes[i];
|
686
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
853
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
687
854
|
if (childNode['s-sr']) {
|
688
855
|
// this is a slot fallback node
|
689
856
|
// get the slot name for this slot reference node
|
@@ -695,7 +862,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
695
862
|
nodeType = childNodes[j].nodeType;
|
696
863
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
697
864
|
// this sibling node is from a different component OR is a named fallback slot node
|
698
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
865
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
699
866
|
childNode.hidden = true;
|
700
867
|
break;
|
701
868
|
}
|
@@ -704,8 +871,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
704
871
|
// this is a default fallback slot node
|
705
872
|
// any element or text node (with content)
|
706
873
|
// should hide the default fallback slot node
|
707
|
-
if (nodeType === 1 /* ElementNode */ ||
|
708
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
874
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
875
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
709
876
|
childNode.hidden = true;
|
710
877
|
break;
|
711
878
|
}
|
@@ -783,13 +950,13 @@ const relocateSlotContent = (elm) => {
|
|
783
950
|
}
|
784
951
|
}
|
785
952
|
}
|
786
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
953
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
787
954
|
relocateSlotContent(childNode);
|
788
955
|
}
|
789
956
|
}
|
790
957
|
};
|
791
958
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
792
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
959
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
793
960
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
794
961
|
return true;
|
795
962
|
}
|
@@ -814,7 +981,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
814
981
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
815
982
|
}
|
816
983
|
rootVnode.$tag$ = null;
|
817
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
984
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
818
985
|
hostRef.$vnode$ = rootVnode;
|
819
986
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
820
987
|
{
|
@@ -822,7 +989,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
822
989
|
}
|
823
990
|
{
|
824
991
|
contentRef = hostElm['s-cr'];
|
825
|
-
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
992
|
+
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
826
993
|
// always reset
|
827
994
|
checkSlotFallbackVisibility = false;
|
828
995
|
}
|
@@ -831,7 +998,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
831
998
|
{
|
832
999
|
// while we're moving nodes around existing nodes, temporarily disable
|
833
1000
|
// the disconnectCallback from working
|
834
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
1001
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
835
1002
|
if (checkSlotRelocate) {
|
836
1003
|
relocateSlotContent(rootVnode.$elm$);
|
837
1004
|
let relocateData;
|
@@ -889,7 +1056,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
889
1056
|
}
|
890
1057
|
else {
|
891
1058
|
// this node doesn't have a slot home to go to, so let's hide it
|
892
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
1059
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
893
1060
|
nodeToRelocate.hidden = true;
|
894
1061
|
}
|
895
1062
|
}
|
@@ -900,7 +1067,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
900
1067
|
}
|
901
1068
|
// done moving nodes around
|
902
1069
|
// allow the disconnect callback to work again
|
903
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
1070
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
904
1071
|
// always reset
|
905
1072
|
relocateNodes.length = 0;
|
906
1073
|
}
|
@@ -911,9 +1078,9 @@ const createEvent = (ref, name, flags) => {
|
|
911
1078
|
return {
|
912
1079
|
emit: (detail) => {
|
913
1080
|
return emitEvent(elm, name, {
|
914
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
915
|
-
composed: !!(flags & 2 /* Composed */),
|
916
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
1081
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
1082
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
1083
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
917
1084
|
detail,
|
918
1085
|
});
|
919
1086
|
},
|
@@ -938,10 +1105,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
938
1105
|
};
|
939
1106
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
940
1107
|
{
|
941
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
1108
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
942
1109
|
}
|
943
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
944
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
1110
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
1111
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
945
1112
|
return;
|
946
1113
|
}
|
947
1114
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
@@ -957,7 +1124,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
957
1124
|
let promise;
|
958
1125
|
if (isInitialLoad) {
|
959
1126
|
{
|
960
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
1127
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
961
1128
|
if (hostRef.$queuedListeners$) {
|
962
1129
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
963
1130
|
hostRef.$queuedListeners$ = null;
|
@@ -1000,7 +1167,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1000
1167
|
}
|
1001
1168
|
else {
|
1002
1169
|
Promise.all(childrenPromises).then(postUpdate);
|
1003
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
1170
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
1004
1171
|
childrenPromises.length = 0;
|
1005
1172
|
}
|
1006
1173
|
}
|
@@ -1009,10 +1176,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
1009
1176
|
try {
|
1010
1177
|
instance = instance.render() ;
|
1011
1178
|
{
|
1012
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
1179
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
1013
1180
|
}
|
1014
1181
|
{
|
1015
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
1182
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
1016
1183
|
}
|
1017
1184
|
{
|
1018
1185
|
{
|
@@ -1039,8 +1206,8 @@ const postUpdateComponent = (hostRef) => {
|
|
1039
1206
|
{
|
1040
1207
|
safeCall(instance, 'componentDidRender');
|
1041
1208
|
}
|
1042
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
1043
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
1209
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
1210
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
1044
1211
|
{
|
1045
1212
|
// DOM WRITE!
|
1046
1213
|
addHydratedFlag(elm);
|
@@ -1069,10 +1236,10 @@ const postUpdateComponent = (hostRef) => {
|
|
1069
1236
|
hostRef.$onRenderResolve$();
|
1070
1237
|
hostRef.$onRenderResolve$ = undefined;
|
1071
1238
|
}
|
1072
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
1239
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
1073
1240
|
nextTick(() => scheduleUpdate(hostRef, false));
|
1074
1241
|
}
|
1075
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
1242
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
1076
1243
|
}
|
1077
1244
|
// ( •_•)
|
1078
1245
|
// ( •_•)>⌐■-■
|
@@ -1128,16 +1295,16 @@ const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
|
|
1128
1295
|
const parsePropertyValue = (propValue, propType) => {
|
1129
1296
|
// ensure this value is of the correct prop type
|
1130
1297
|
if (propValue != null && !isComplexType(propValue)) {
|
1131
|
-
if (propType & 4 /* Boolean */) {
|
1298
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
1132
1299
|
// per the HTML spec, any string value means it is a boolean true value
|
1133
1300
|
// but we'll cheat here and say that the string "false" is the boolean false
|
1134
1301
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
1135
1302
|
}
|
1136
|
-
if (propType & 2 /* Number */) {
|
1303
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
1137
1304
|
// force it to be a number
|
1138
1305
|
return parseFloat(propValue);
|
1139
1306
|
}
|
1140
|
-
if (propType & 1 /* String */) {
|
1307
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
1141
1308
|
// could have been passed as a number or boolean
|
1142
1309
|
// but we still want it as a string
|
1143
1310
|
return String(propValue);
|
@@ -1161,13 +1328,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1161
1328
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
1162
1329
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
1163
1330
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
1164
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
1331
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
1165
1332
|
// gadzooks! the property's value has changed!!
|
1166
1333
|
// set our new value!
|
1167
1334
|
hostRef.$instanceValues$.set(propName, newVal);
|
1168
1335
|
if (instance) {
|
1169
1336
|
// get an array of method names of watch functions to call
|
1170
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
1337
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
1171
1338
|
const watchMethods = cmpMeta.$watchers$[propName];
|
1172
1339
|
if (watchMethods) {
|
1173
1340
|
// this instance is watching for when this property changed
|
@@ -1182,7 +1349,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1182
1349
|
});
|
1183
1350
|
}
|
1184
1351
|
}
|
1185
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
1352
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
1186
1353
|
// looks like this value actually changed, so we've got work to do!
|
1187
1354
|
// but only if we've already rendered, otherwise just chill out
|
1188
1355
|
// queue that we need to do an update, but don't worry about queuing
|
@@ -1201,8 +1368,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1201
1368
|
const members = Object.entries(cmpMeta.$members$);
|
1202
1369
|
const prototype = Cstr.prototype;
|
1203
1370
|
members.map(([memberName, [memberFlags]]) => {
|
1204
|
-
if ((memberFlags & 31 /* Prop */ ||
|
1205
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
1371
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
1372
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
1206
1373
|
// proxyComponent - prop
|
1207
1374
|
Object.defineProperty(prototype, memberName, {
|
1208
1375
|
get() {
|
@@ -1217,8 +1384,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1217
1384
|
enumerable: true,
|
1218
1385
|
});
|
1219
1386
|
}
|
1220
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
1221
|
-
memberFlags & 64 /* Method */) {
|
1387
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
1388
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
1222
1389
|
// proxyComponent - method
|
1223
1390
|
Object.defineProperty(prototype, memberName, {
|
1224
1391
|
value(...args) {
|
@@ -1228,7 +1395,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1228
1395
|
});
|
1229
1396
|
}
|
1230
1397
|
});
|
1231
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
1398
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
1232
1399
|
const attrNameToPropName = new Map();
|
1233
1400
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
1234
1401
|
plt.jmp(() => {
|
@@ -1284,11 +1451,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1284
1451
|
// create an array of attributes to observe
|
1285
1452
|
// and also create a map of html attribute name to js property name
|
1286
1453
|
Cstr.observedAttributes = members
|
1287
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
1454
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
1288
1455
|
.map(([propName, m]) => {
|
1289
1456
|
const attrName = m[1] || propName;
|
1290
1457
|
attrNameToPropName.set(attrName, propName);
|
1291
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
1458
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
1292
1459
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
1293
1460
|
}
|
1294
1461
|
return attrName;
|
@@ -1299,10 +1466,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1299
1466
|
};
|
1300
1467
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
1301
1468
|
// initializeComponent
|
1302
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
1469
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
1303
1470
|
{
|
1304
1471
|
// we haven't initialized this element yet
|
1305
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
1472
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
1306
1473
|
// lazy loaded components
|
1307
1474
|
// request the component's implementation to be
|
1308
1475
|
// wired up with the host element
|
@@ -1320,7 +1487,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
1320
1487
|
{
|
1321
1488
|
cmpMeta.$watchers$ = Cstr.watchers;
|
1322
1489
|
}
|
1323
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
1490
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
1324
1491
|
Cstr.isProxied = true;
|
1325
1492
|
}
|
1326
1493
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
@@ -1328,7 +1495,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
1328
1495
|
// but let's keep track of when we start and stop
|
1329
1496
|
// so that the getters/setters don't incorrectly step on data
|
1330
1497
|
{
|
1331
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
1498
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
1332
1499
|
}
|
1333
1500
|
// construct the lazy-loaded component implementation
|
1334
1501
|
// passing the hostRef is very important during
|
@@ -1341,10 +1508,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
1341
1508
|
consoleError(e);
|
1342
1509
|
}
|
1343
1510
|
{
|
1344
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
1511
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
1345
1512
|
}
|
1346
1513
|
{
|
1347
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
1514
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
1348
1515
|
}
|
1349
1516
|
endNewInstance();
|
1350
1517
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
@@ -1355,10 +1522,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
1355
1522
|
const scopeId = getScopeId(cmpMeta);
|
1356
1523
|
if (!styles.has(scopeId)) {
|
1357
1524
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
1358
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
1359
|
-
style = await import('./shadow-css-
|
1525
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
1526
|
+
style = await import('./shadow-css-4261c637.js').then((m) => m.scopeCss(style, scopeId, false));
|
1360
1527
|
}
|
1361
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
1528
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
1362
1529
|
endRegisterStyles();
|
1363
1530
|
}
|
1364
1531
|
}
|
@@ -1385,19 +1552,19 @@ const fireConnectedCallback = (instance) => {
|
|
1385
1552
|
}
|
1386
1553
|
};
|
1387
1554
|
const connectedCallback = (elm) => {
|
1388
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
1555
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1389
1556
|
const hostRef = getHostRef(elm);
|
1390
1557
|
const cmpMeta = hostRef.$cmpMeta$;
|
1391
1558
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
1392
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
1559
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
1393
1560
|
// first time this component has connected
|
1394
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
1561
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
1395
1562
|
{
|
1396
1563
|
// initUpdate
|
1397
1564
|
// if the slot polyfill is required we'll need to put some nodes
|
1398
1565
|
// in here to act as original content anchors as we move nodes around
|
1399
1566
|
// host element has been connected to the DOM
|
1400
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
1567
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
1401
1568
|
setContentReference(elm);
|
1402
1569
|
}
|
1403
1570
|
}
|
@@ -1420,7 +1587,7 @@ const connectedCallback = (elm) => {
|
|
1420
1587
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
1421
1588
|
if (cmpMeta.$members$) {
|
1422
1589
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
1423
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
1590
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
1424
1591
|
const value = elm[memberName];
|
1425
1592
|
delete elm[memberName];
|
1426
1593
|
elm[memberName] = value;
|
@@ -1454,7 +1621,7 @@ const setContentReference = (elm) => {
|
|
1454
1621
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
1455
1622
|
};
|
1456
1623
|
const disconnectedCallback = (elm) => {
|
1457
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
1624
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1458
1625
|
const hostRef = getHostRef(elm);
|
1459
1626
|
const instance = hostRef.$lazyInstance$ ;
|
1460
1627
|
{
|
@@ -1501,8 +1668,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1501
1668
|
{
|
1502
1669
|
cmpMeta.$watchers$ = {};
|
1503
1670
|
}
|
1504
|
-
if (!supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
1505
|
-
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
1671
|
+
if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
1672
|
+
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
1506
1673
|
}
|
1507
1674
|
const tagName = cmpMeta.$tagName$;
|
1508
1675
|
const HostElement = class extends HTMLElement {
|
@@ -1512,7 +1679,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1512
1679
|
super(self);
|
1513
1680
|
self = this;
|
1514
1681
|
registerHost(self, cmpMeta);
|
1515
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
1682
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
1516
1683
|
// this component is using shadow dom
|
1517
1684
|
// and this browser supports shadow dom
|
1518
1685
|
// add the read-only property "shadowRoot" to the host element
|
@@ -1550,7 +1717,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1550
1717
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
1551
1718
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
1552
1719
|
cmpTags.push(tagName);
|
1553
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
1720
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
1554
1721
|
}
|
1555
1722
|
});
|
1556
1723
|
});
|
@@ -1572,7 +1739,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1572
1739
|
// Fallback appLoad event
|
1573
1740
|
endBootstrap();
|
1574
1741
|
};
|
1575
|
-
const hostRefs = new WeakMap();
|
1742
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
1576
1743
|
const getHostRef = (ref) => hostRefs.get(ref);
|
1577
1744
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
1578
1745
|
const registerHost = (elm, cmpMeta) => {
|
@@ -1617,14 +1784,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1617
1784
|
return importedModule[exportName];
|
1618
1785
|
}, consoleError);
|
1619
1786
|
};
|
1620
|
-
const styles = new Map();
|
1787
|
+
const styles = /*@__PURE__*/ new Map();
|
1621
1788
|
const queueDomReads = [];
|
1622
1789
|
const queueDomWrites = [];
|
1623
1790
|
const queueTask = (queue, write) => (cb) => {
|
1624
1791
|
queue.push(cb);
|
1625
1792
|
if (!queuePending) {
|
1626
1793
|
queuePending = true;
|
1627
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
1794
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
1628
1795
|
nextTick(flush);
|
1629
1796
|
}
|
1630
1797
|
else {
|