ku4web-components 6.7.10 → 6.7.13
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/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
|
@@ -67,7 +67,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
67
67
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
68
68
|
try {
|
|
69
69
|
{
|
|
70
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
70
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
71
71
|
// instance is ready, let's call it's member method for this event
|
|
72
72
|
hostRef.$lazyInstance$[methodName](ev);
|
|
73
73
|
}
|
|
@@ -81,12 +81,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
const getHostListenerTarget = (elm, flags) => {
|
|
84
|
-
if (flags & 8 /* TargetWindow */)
|
|
84
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
85
85
|
return win;
|
|
86
86
|
return elm;
|
|
87
87
|
};
|
|
88
88
|
// prettier-ignore
|
|
89
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
89
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
90
90
|
const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
|
|
91
91
|
const createTime = (fnName, tagName = '') => {
|
|
92
92
|
{
|
|
@@ -102,7 +102,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
const rootAppliedStyles = new WeakMap();
|
|
105
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
106
106
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
107
107
|
let style = styles.get(scopeId);
|
|
108
108
|
if (supportsConstructableStylesheets && allowCS) {
|
|
@@ -124,7 +124,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
124
124
|
const style = styles.get(scopeId);
|
|
125
125
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
126
126
|
// so the fallback is to always use the document for the root node in those cases
|
|
127
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
127
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
128
128
|
if (style) {
|
|
129
129
|
if (typeof style === 'string') {
|
|
130
130
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -158,7 +158,7 @@ const attachStyles = (hostRef) => {
|
|
|
158
158
|
const flags = cmpMeta.$flags$;
|
|
159
159
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
160
160
|
const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
161
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
161
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
162
162
|
// only required when we're NOT using native shadow dom (slot)
|
|
163
163
|
// or this browser doesn't support native shadow dom
|
|
164
164
|
// and this host element was NOT created with SSR
|
|
@@ -381,7 +381,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
384
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
385
385
|
newValue = newValue === true ? '' : newValue;
|
|
386
386
|
{
|
|
387
387
|
elm.setAttribute(memberName, newValue);
|
|
@@ -396,7 +396,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
396
396
|
// if the element passed in is a shadow root, which is a document fragment
|
|
397
397
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
398
398
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
399
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
399
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
400
400
|
? newVnode.$elm$.host
|
|
401
401
|
: newVnode.$elm$;
|
|
402
402
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -414,6 +414,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
414
414
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
415
415
|
}
|
|
416
416
|
};
|
|
417
|
+
/**
|
|
418
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
419
|
+
*
|
|
420
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
421
|
+
* @param newParentVNode the parent VNode from the current render
|
|
422
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
423
|
+
* children, for which we will create a new DOM node
|
|
424
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
425
|
+
* @returns the newly created node
|
|
426
|
+
*/
|
|
417
427
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
418
428
|
// tslint:disable-next-line: prefer-const
|
|
419
429
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -431,23 +441,23 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
431
441
|
}
|
|
432
442
|
newVNode.$flags$ |= newVNode.$children$
|
|
433
443
|
? // slot element has fallback content
|
|
434
|
-
2 /* isSlotFallback */
|
|
444
|
+
2 /* VNODE_FLAGS.isSlotFallback */
|
|
435
445
|
: // slot element does not have fallback content
|
|
436
|
-
1 /* isSlotReference */;
|
|
446
|
+
1 /* VNODE_FLAGS.isSlotReference */;
|
|
437
447
|
}
|
|
438
448
|
}
|
|
439
449
|
if (newVNode.$text$ !== null) {
|
|
440
450
|
// create text node
|
|
441
451
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
442
452
|
}
|
|
443
|
-
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
453
|
+
else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
|
|
444
454
|
// create a slot reference node
|
|
445
455
|
elm = newVNode.$elm$ =
|
|
446
456
|
doc.createTextNode('');
|
|
447
457
|
}
|
|
448
458
|
else {
|
|
449
459
|
// create element
|
|
450
|
-
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
|
|
460
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
|
|
451
461
|
? 'slot-fb'
|
|
452
462
|
: newVNode.$tag$));
|
|
453
463
|
// add css classes, attrs, props, listeners, etc.
|
|
@@ -473,7 +483,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
473
483
|
}
|
|
474
484
|
{
|
|
475
485
|
elm['s-hn'] = hostTagName;
|
|
476
|
-
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
486
|
+
if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
|
|
477
487
|
// remember the content reference comment
|
|
478
488
|
elm['s-sr'] = true;
|
|
479
489
|
// remember the content reference comment
|
|
@@ -492,7 +502,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
492
502
|
return elm;
|
|
493
503
|
};
|
|
494
504
|
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
495
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
505
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
496
506
|
const oldSlotChildNodes = parentElm.childNodes;
|
|
497
507
|
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
498
508
|
const childNode = oldSlotChildNodes[i];
|
|
@@ -513,7 +523,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
513
523
|
putBackInOriginalLocation(childNode, recursive);
|
|
514
524
|
}
|
|
515
525
|
}
|
|
516
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
526
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
517
527
|
};
|
|
518
528
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
519
529
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
@@ -554,6 +564,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
554
564
|
}
|
|
555
565
|
}
|
|
556
566
|
};
|
|
567
|
+
/**
|
|
568
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
569
|
+
* traversing the two collections of children, identifying nodes that are
|
|
570
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
571
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
572
|
+
*
|
|
573
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
574
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
575
|
+
* 'windows' by storing start and end indices and references to the
|
|
576
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
577
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
578
|
+
* no children left to update by doing the following:
|
|
579
|
+
*
|
|
580
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
581
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
582
|
+
* only with a window bounded by the highlighted elements:
|
|
583
|
+
*
|
|
584
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
585
|
+
* ^^^^^^ ^^^^^^
|
|
586
|
+
*
|
|
587
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
588
|
+
* across the windows. This will basically detect elements which haven't
|
|
589
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
590
|
+
* VNode elements (represented as HTML):
|
|
591
|
+
*
|
|
592
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
593
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
594
|
+
*
|
|
595
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
596
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
597
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
598
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
599
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
600
|
+
*
|
|
601
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
602
|
+
* window corresponds to the element at the end of the other window. This is
|
|
603
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
604
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
605
|
+
* children nodes themselves have not changed but merely moved in the
|
|
606
|
+
* following example:
|
|
607
|
+
*
|
|
608
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
609
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
610
|
+
*
|
|
611
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
612
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
613
|
+
* DOM.
|
|
614
|
+
*
|
|
615
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
616
|
+
* nodes in the old children which have the same key as the first element in
|
|
617
|
+
* our window on the new children. If we find such a node we handle calling
|
|
618
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
619
|
+
* what we find.
|
|
620
|
+
*
|
|
621
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
622
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
623
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
624
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
625
|
+
* children has collapsed we still have more nodes on the new children that
|
|
626
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
627
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
628
|
+
* sure the corresponding DOM nodes are removed.
|
|
629
|
+
*
|
|
630
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
631
|
+
* @param oldCh the old children of the parent node
|
|
632
|
+
* @param newVNode the new VNode which will replace the parent
|
|
633
|
+
* @param newCh the new children of the parent node
|
|
634
|
+
*/
|
|
557
635
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
558
636
|
let oldStartIdx = 0;
|
|
559
637
|
let newStartIdx = 0;
|
|
@@ -566,7 +644,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
566
644
|
let node;
|
|
567
645
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
568
646
|
if (oldStartVnode == null) {
|
|
569
|
-
//
|
|
647
|
+
// VNode might have been moved left
|
|
570
648
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
571
649
|
}
|
|
572
650
|
else if (oldEndVnode == null) {
|
|
@@ -579,42 +657,102 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
579
657
|
newEndVnode = newCh[--newEndIdx];
|
|
580
658
|
}
|
|
581
659
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
660
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
661
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
662
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
663
|
+
// since things are matched up in order.
|
|
582
664
|
patch(oldStartVnode, newStartVnode);
|
|
583
665
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
584
666
|
newStartVnode = newCh[++newStartIdx];
|
|
585
667
|
}
|
|
586
668
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
669
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
670
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
671
|
+
// need to move any DOM Nodes.
|
|
587
672
|
patch(oldEndVnode, newEndVnode);
|
|
588
673
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
589
674
|
newEndVnode = newCh[--newEndIdx];
|
|
590
675
|
}
|
|
591
676
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
592
|
-
// Vnode moved right
|
|
677
|
+
// case: "Vnode moved right"
|
|
678
|
+
//
|
|
679
|
+
// We've found that the last node in our window on the new children is
|
|
680
|
+
// the same VNode as the _first_ node in our window on the old children
|
|
681
|
+
// we're dealing with now. Visually, this is the layout of these two
|
|
682
|
+
// nodes:
|
|
683
|
+
//
|
|
684
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
685
|
+
// ^^^^^^^^^^^
|
|
686
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
687
|
+
// ^^^^^^^^^^^^^
|
|
688
|
+
//
|
|
689
|
+
// In this situation we need to patch `newEndVnode` onto `oldStartVnode`
|
|
690
|
+
// and move the DOM element for `oldStartVnode`.
|
|
593
691
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
594
692
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
595
693
|
}
|
|
596
694
|
patch(oldStartVnode, newEndVnode);
|
|
695
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
696
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
697
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
698
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
699
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
700
|
+
//
|
|
701
|
+
// <old-start-node />
|
|
702
|
+
// <some-intervening-node />
|
|
703
|
+
// <old-end-node />
|
|
704
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
705
|
+
// <next-sibling />
|
|
706
|
+
//
|
|
707
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
708
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
709
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
710
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
711
|
+
// append it to the children of the parent element.
|
|
597
712
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
598
713
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
599
714
|
newEndVnode = newCh[--newEndIdx];
|
|
600
715
|
}
|
|
601
716
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
602
|
-
// Vnode moved left
|
|
717
|
+
// case: "Vnode moved left"
|
|
718
|
+
//
|
|
719
|
+
// We've found that the first node in our window on the new children is
|
|
720
|
+
// the same VNode as the _last_ node in our window on the old children.
|
|
721
|
+
// Visually, this is the layout of these two nodes:
|
|
722
|
+
//
|
|
723
|
+
// newCh: [..., newStartVnode , ... , newEndVnode , ...]
|
|
724
|
+
// ^^^^^^^^^^^^^
|
|
725
|
+
// oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
|
|
726
|
+
// ^^^^^^^^^^^
|
|
727
|
+
//
|
|
728
|
+
// In this situation we need to patch `newStartVnode` onto `oldEndVnode`
|
|
729
|
+
// (which will handle updating any changed attributes, reconciling their
|
|
730
|
+
// children etc) but we also need to move the DOM node to which
|
|
731
|
+
// `oldEndVnode` corresponds.
|
|
603
732
|
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
604
733
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
605
734
|
}
|
|
606
735
|
patch(oldEndVnode, newStartVnode);
|
|
736
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
737
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
738
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
739
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
740
|
+
// future.
|
|
607
741
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
608
742
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
609
743
|
newStartVnode = newCh[++newStartIdx];
|
|
610
744
|
}
|
|
611
745
|
else {
|
|
612
746
|
{
|
|
613
|
-
//
|
|
747
|
+
// We either didn't find an element in the old children that matches
|
|
748
|
+
// the key of the first new child OR the build is not using `key`
|
|
749
|
+
// attributes at all. In either case we need to create a new element
|
|
750
|
+
// for the new node.
|
|
614
751
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
615
752
|
newStartVnode = newCh[++newStartIdx];
|
|
616
753
|
}
|
|
617
754
|
if (node) {
|
|
755
|
+
// if we created a new node then handle inserting it to the DOM
|
|
618
756
|
{
|
|
619
757
|
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
620
758
|
}
|
|
@@ -622,18 +760,39 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
622
760
|
}
|
|
623
761
|
}
|
|
624
762
|
if (oldStartIdx > oldEndIdx) {
|
|
763
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
625
764
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
626
765
|
}
|
|
627
766
|
else if (newStartIdx > newEndIdx) {
|
|
767
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
768
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
769
|
+
// relevant DOM nodes)
|
|
628
770
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
629
771
|
}
|
|
630
772
|
};
|
|
631
|
-
|
|
773
|
+
/**
|
|
774
|
+
* Compare two VNodes to determine if they are the same
|
|
775
|
+
*
|
|
776
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
777
|
+
* information set on the two VNodes and can be misleading under certain
|
|
778
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
779
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
780
|
+
* checking that they have the same tag.
|
|
781
|
+
*
|
|
782
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
783
|
+
* changing order within a `children` array or something along those lines then
|
|
784
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
785
|
+
*
|
|
786
|
+
* @param leftVNode the first VNode to check
|
|
787
|
+
* @param rightVNode the second VNode to check
|
|
788
|
+
* @returns whether they're equal or not
|
|
789
|
+
*/
|
|
790
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
632
791
|
// compare if two vnode to see if they're "technically" the same
|
|
633
792
|
// need to have the same element tag, and same key to be the same
|
|
634
|
-
if (
|
|
635
|
-
if (
|
|
636
|
-
return
|
|
793
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
794
|
+
if (leftVNode.$tag$ === 'slot') {
|
|
795
|
+
return leftVNode.$name$ === rightVNode.$name$;
|
|
637
796
|
}
|
|
638
797
|
return true;
|
|
639
798
|
}
|
|
@@ -647,6 +806,14 @@ const referenceNode = (node) => {
|
|
|
647
806
|
return (node && node['s-ol']) || node;
|
|
648
807
|
};
|
|
649
808
|
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
809
|
+
/**
|
|
810
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
811
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
812
|
+
* children of the two nodes (if any).
|
|
813
|
+
*
|
|
814
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
815
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
816
|
+
*/
|
|
650
817
|
const patch = (oldVNode, newVNode) => {
|
|
651
818
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
652
819
|
const oldChildren = oldVNode.$children$;
|
|
@@ -655,7 +822,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
655
822
|
const text = newVNode.$text$;
|
|
656
823
|
let defaultHolder;
|
|
657
824
|
if (text === null) {
|
|
658
|
-
// element node
|
|
659
825
|
{
|
|
660
826
|
if (tag === 'slot')
|
|
661
827
|
;
|
|
@@ -668,6 +834,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
668
834
|
}
|
|
669
835
|
if (oldChildren !== null && newChildren !== null) {
|
|
670
836
|
// looks like there's child vnodes for both the old and new vnodes
|
|
837
|
+
// so we need to call `updateChildren` to reconcile them
|
|
671
838
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
672
839
|
}
|
|
673
840
|
else if (newChildren !== null) {
|
|
@@ -705,7 +872,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
705
872
|
let nodeType;
|
|
706
873
|
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
707
874
|
childNode = childNodes[i];
|
|
708
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
875
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
709
876
|
if (childNode['s-sr']) {
|
|
710
877
|
// this is a slot fallback node
|
|
711
878
|
// get the slot name for this slot reference node
|
|
@@ -717,7 +884,7 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
717
884
|
nodeType = childNodes[j].nodeType;
|
|
718
885
|
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
719
886
|
// this sibling node is from a different component OR is a named fallback slot node
|
|
720
|
-
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
887
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
721
888
|
childNode.hidden = true;
|
|
722
889
|
break;
|
|
723
890
|
}
|
|
@@ -726,8 +893,8 @@ const updateFallbackSlotVisibility = (elm) => {
|
|
|
726
893
|
// this is a default fallback slot node
|
|
727
894
|
// any element or text node (with content)
|
|
728
895
|
// should hide the default fallback slot node
|
|
729
|
-
if (nodeType === 1 /* ElementNode */ ||
|
|
730
|
-
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
896
|
+
if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
|
|
897
|
+
(nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
731
898
|
childNode.hidden = true;
|
|
732
899
|
break;
|
|
733
900
|
}
|
|
@@ -805,13 +972,13 @@ const relocateSlotContent = (elm) => {
|
|
|
805
972
|
}
|
|
806
973
|
}
|
|
807
974
|
}
|
|
808
|
-
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
975
|
+
if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
809
976
|
relocateSlotContent(childNode);
|
|
810
977
|
}
|
|
811
978
|
}
|
|
812
979
|
};
|
|
813
980
|
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
814
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
981
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
815
982
|
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
816
983
|
return true;
|
|
817
984
|
}
|
|
@@ -836,7 +1003,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
836
1003
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
837
1004
|
}
|
|
838
1005
|
rootVnode.$tag$ = null;
|
|
839
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
1006
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
840
1007
|
hostRef.$vnode$ = rootVnode;
|
|
841
1008
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
842
1009
|
{
|
|
@@ -844,7 +1011,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
844
1011
|
}
|
|
845
1012
|
{
|
|
846
1013
|
contentRef = hostElm['s-cr'];
|
|
847
|
-
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
1014
|
+
useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
848
1015
|
// always reset
|
|
849
1016
|
checkSlotFallbackVisibility = false;
|
|
850
1017
|
}
|
|
@@ -853,7 +1020,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
853
1020
|
{
|
|
854
1021
|
// while we're moving nodes around existing nodes, temporarily disable
|
|
855
1022
|
// the disconnectCallback from working
|
|
856
|
-
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
1023
|
+
plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
857
1024
|
if (checkSlotRelocate) {
|
|
858
1025
|
relocateSlotContent(rootVnode.$elm$);
|
|
859
1026
|
let relocateData;
|
|
@@ -911,7 +1078,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
911
1078
|
}
|
|
912
1079
|
else {
|
|
913
1080
|
// this node doesn't have a slot home to go to, so let's hide it
|
|
914
|
-
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1081
|
+
if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
915
1082
|
nodeToRelocate.hidden = true;
|
|
916
1083
|
}
|
|
917
1084
|
}
|
|
@@ -922,7 +1089,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
922
1089
|
}
|
|
923
1090
|
// done moving nodes around
|
|
924
1091
|
// allow the disconnect callback to work again
|
|
925
|
-
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
1092
|
+
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
926
1093
|
// always reset
|
|
927
1094
|
relocateNodes.length = 0;
|
|
928
1095
|
}
|
|
@@ -933,9 +1100,9 @@ const createEvent = (ref, name, flags) => {
|
|
|
933
1100
|
return {
|
|
934
1101
|
emit: (detail) => {
|
|
935
1102
|
return emitEvent(elm, name, {
|
|
936
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
937
|
-
composed: !!(flags & 2 /* Composed */),
|
|
938
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
1103
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
1104
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
1105
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
939
1106
|
detail,
|
|
940
1107
|
});
|
|
941
1108
|
},
|
|
@@ -960,10 +1127,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
960
1127
|
};
|
|
961
1128
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
962
1129
|
{
|
|
963
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
1130
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
964
1131
|
}
|
|
965
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
966
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
1132
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
1133
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
967
1134
|
return;
|
|
968
1135
|
}
|
|
969
1136
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -979,7 +1146,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
979
1146
|
let promise;
|
|
980
1147
|
if (isInitialLoad) {
|
|
981
1148
|
{
|
|
982
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
1149
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
983
1150
|
if (hostRef.$queuedListeners$) {
|
|
984
1151
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
985
1152
|
hostRef.$queuedListeners$ = null;
|
|
@@ -1022,7 +1189,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1022
1189
|
}
|
|
1023
1190
|
else {
|
|
1024
1191
|
Promise.all(childrenPromises).then(postUpdate);
|
|
1025
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
1192
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
1026
1193
|
childrenPromises.length = 0;
|
|
1027
1194
|
}
|
|
1028
1195
|
}
|
|
@@ -1031,10 +1198,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
1031
1198
|
try {
|
|
1032
1199
|
instance = instance.render() ;
|
|
1033
1200
|
{
|
|
1034
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
1201
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
1035
1202
|
}
|
|
1036
1203
|
{
|
|
1037
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
1204
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
1038
1205
|
}
|
|
1039
1206
|
{
|
|
1040
1207
|
{
|
|
@@ -1061,8 +1228,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1061
1228
|
{
|
|
1062
1229
|
safeCall(instance, 'componentDidRender');
|
|
1063
1230
|
}
|
|
1064
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
1065
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
1231
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
1232
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
1066
1233
|
{
|
|
1067
1234
|
// DOM WRITE!
|
|
1068
1235
|
addHydratedFlag(elm);
|
|
@@ -1091,10 +1258,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
1091
1258
|
hostRef.$onRenderResolve$();
|
|
1092
1259
|
hostRef.$onRenderResolve$ = undefined;
|
|
1093
1260
|
}
|
|
1094
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
1261
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
1095
1262
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
1096
1263
|
}
|
|
1097
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
1264
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
1098
1265
|
}
|
|
1099
1266
|
// ( •_•)
|
|
1100
1267
|
// ( •_•)>⌐■-■
|
|
@@ -1150,16 +1317,16 @@ const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
|
|
|
1150
1317
|
const parsePropertyValue = (propValue, propType) => {
|
|
1151
1318
|
// ensure this value is of the correct prop type
|
|
1152
1319
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1153
|
-
if (propType & 4 /* Boolean */) {
|
|
1320
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
1154
1321
|
// per the HTML spec, any string value means it is a boolean true value
|
|
1155
1322
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
1156
1323
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
1157
1324
|
}
|
|
1158
|
-
if (propType & 2 /* Number */) {
|
|
1325
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
1159
1326
|
// force it to be a number
|
|
1160
1327
|
return parseFloat(propValue);
|
|
1161
1328
|
}
|
|
1162
|
-
if (propType & 1 /* String */) {
|
|
1329
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
1163
1330
|
// could have been passed as a number or boolean
|
|
1164
1331
|
// but we still want it as a string
|
|
1165
1332
|
return String(propValue);
|
|
@@ -1183,13 +1350,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1183
1350
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
1184
1351
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
1185
1352
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
1186
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1353
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1187
1354
|
// gadzooks! the property's value has changed!!
|
|
1188
1355
|
// set our new value!
|
|
1189
1356
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
1190
1357
|
if (instance) {
|
|
1191
1358
|
// get an array of method names of watch functions to call
|
|
1192
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1359
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
1193
1360
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1194
1361
|
if (watchMethods) {
|
|
1195
1362
|
// this instance is watching for when this property changed
|
|
@@ -1204,7 +1371,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1204
1371
|
});
|
|
1205
1372
|
}
|
|
1206
1373
|
}
|
|
1207
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1374
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
1208
1375
|
// looks like this value actually changed, so we've got work to do!
|
|
1209
1376
|
// but only if we've already rendered, otherwise just chill out
|
|
1210
1377
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -1223,8 +1390,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1223
1390
|
const members = Object.entries(cmpMeta.$members$);
|
|
1224
1391
|
const prototype = Cstr.prototype;
|
|
1225
1392
|
members.map(([memberName, [memberFlags]]) => {
|
|
1226
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
1227
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1393
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1394
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
1228
1395
|
// proxyComponent - prop
|
|
1229
1396
|
Object.defineProperty(prototype, memberName, {
|
|
1230
1397
|
get() {
|
|
@@ -1239,8 +1406,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1239
1406
|
enumerable: true,
|
|
1240
1407
|
});
|
|
1241
1408
|
}
|
|
1242
|
-
else if (flags & 1 /* isElementConstructor */ &&
|
|
1243
|
-
memberFlags & 64 /* Method */) {
|
|
1409
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
|
1410
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
|
1244
1411
|
// proxyComponent - method
|
|
1245
1412
|
Object.defineProperty(prototype, memberName, {
|
|
1246
1413
|
value(...args) {
|
|
@@ -1250,7 +1417,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1250
1417
|
});
|
|
1251
1418
|
}
|
|
1252
1419
|
});
|
|
1253
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1420
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
1254
1421
|
const attrNameToPropName = new Map();
|
|
1255
1422
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1256
1423
|
plt.jmp(() => {
|
|
@@ -1306,11 +1473,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1306
1473
|
// create an array of attributes to observe
|
|
1307
1474
|
// and also create a map of html attribute name to js property name
|
|
1308
1475
|
Cstr.observedAttributes = members
|
|
1309
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1476
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1310
1477
|
.map(([propName, m]) => {
|
|
1311
1478
|
const attrName = m[1] || propName;
|
|
1312
1479
|
attrNameToPropName.set(attrName, propName);
|
|
1313
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1480
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1314
1481
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1315
1482
|
}
|
|
1316
1483
|
return attrName;
|
|
@@ -1321,10 +1488,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1321
1488
|
};
|
|
1322
1489
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1323
1490
|
// initializeComponent
|
|
1324
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1491
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1325
1492
|
{
|
|
1326
1493
|
// we haven't initialized this element yet
|
|
1327
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1494
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1328
1495
|
// lazy loaded components
|
|
1329
1496
|
// request the component's implementation to be
|
|
1330
1497
|
// wired up with the host element
|
|
@@ -1342,7 +1509,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1342
1509
|
{
|
|
1343
1510
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1344
1511
|
}
|
|
1345
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1512
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1346
1513
|
Cstr.isProxied = true;
|
|
1347
1514
|
}
|
|
1348
1515
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1350,7 +1517,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1350
1517
|
// but let's keep track of when we start and stop
|
|
1351
1518
|
// so that the getters/setters don't incorrectly step on data
|
|
1352
1519
|
{
|
|
1353
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1520
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1354
1521
|
}
|
|
1355
1522
|
// construct the lazy-loaded component implementation
|
|
1356
1523
|
// passing the hostRef is very important during
|
|
@@ -1363,10 +1530,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1363
1530
|
consoleError(e);
|
|
1364
1531
|
}
|
|
1365
1532
|
{
|
|
1366
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1533
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1367
1534
|
}
|
|
1368
1535
|
{
|
|
1369
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1536
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1370
1537
|
}
|
|
1371
1538
|
endNewInstance();
|
|
1372
1539
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1377,10 +1544,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1377
1544
|
const scopeId = getScopeId(cmpMeta);
|
|
1378
1545
|
if (!styles.has(scopeId)) {
|
|
1379
1546
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1380
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1381
|
-
style = await Promise.resolve().then(function () { return require('./shadow-css-
|
|
1547
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1548
|
+
style = await Promise.resolve().then(function () { return require('./shadow-css-a33dc836.js'); }).then((m) => m.scopeCss(style, scopeId, false));
|
|
1382
1549
|
}
|
|
1383
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1550
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1384
1551
|
endRegisterStyles();
|
|
1385
1552
|
}
|
|
1386
1553
|
}
|
|
@@ -1407,19 +1574,19 @@ const fireConnectedCallback = (instance) => {
|
|
|
1407
1574
|
}
|
|
1408
1575
|
};
|
|
1409
1576
|
const connectedCallback = (elm) => {
|
|
1410
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1577
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1411
1578
|
const hostRef = getHostRef(elm);
|
|
1412
1579
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1413
1580
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1414
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1581
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1415
1582
|
// first time this component has connected
|
|
1416
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1583
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1417
1584
|
{
|
|
1418
1585
|
// initUpdate
|
|
1419
1586
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1420
1587
|
// in here to act as original content anchors as we move nodes around
|
|
1421
1588
|
// host element has been connected to the DOM
|
|
1422
|
-
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1589
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1423
1590
|
setContentReference(elm);
|
|
1424
1591
|
}
|
|
1425
1592
|
}
|
|
@@ -1442,7 +1609,7 @@ const connectedCallback = (elm) => {
|
|
|
1442
1609
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1443
1610
|
if (cmpMeta.$members$) {
|
|
1444
1611
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1445
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1612
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1446
1613
|
const value = elm[memberName];
|
|
1447
1614
|
delete elm[memberName];
|
|
1448
1615
|
elm[memberName] = value;
|
|
@@ -1476,7 +1643,7 @@ const setContentReference = (elm) => {
|
|
|
1476
1643
|
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1477
1644
|
};
|
|
1478
1645
|
const disconnectedCallback = (elm) => {
|
|
1479
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1646
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1480
1647
|
const hostRef = getHostRef(elm);
|
|
1481
1648
|
const instance = hostRef.$lazyInstance$ ;
|
|
1482
1649
|
{
|
|
@@ -1523,8 +1690,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1523
1690
|
{
|
|
1524
1691
|
cmpMeta.$watchers$ = {};
|
|
1525
1692
|
}
|
|
1526
|
-
if (!supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1527
|
-
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
1693
|
+
if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1694
|
+
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
1528
1695
|
}
|
|
1529
1696
|
const tagName = cmpMeta.$tagName$;
|
|
1530
1697
|
const HostElement = class extends HTMLElement {
|
|
@@ -1534,7 +1701,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1534
1701
|
super(self);
|
|
1535
1702
|
self = this;
|
|
1536
1703
|
registerHost(self, cmpMeta);
|
|
1537
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1704
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1538
1705
|
// this component is using shadow dom
|
|
1539
1706
|
// and this browser supports shadow dom
|
|
1540
1707
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1572,7 +1739,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1572
1739
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1573
1740
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1574
1741
|
cmpTags.push(tagName);
|
|
1575
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1742
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1576
1743
|
}
|
|
1577
1744
|
});
|
|
1578
1745
|
});
|
|
@@ -1594,7 +1761,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1594
1761
|
// Fallback appLoad event
|
|
1595
1762
|
endBootstrap();
|
|
1596
1763
|
};
|
|
1597
|
-
const hostRefs = new WeakMap();
|
|
1764
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1598
1765
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1599
1766
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1600
1767
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1639,14 +1806,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1639
1806
|
return importedModule[exportName];
|
|
1640
1807
|
}, consoleError);
|
|
1641
1808
|
};
|
|
1642
|
-
const styles = new Map();
|
|
1809
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1643
1810
|
const queueDomReads = [];
|
|
1644
1811
|
const queueDomWrites = [];
|
|
1645
1812
|
const queueTask = (queue, write) => (cb) => {
|
|
1646
1813
|
queue.push(cb);
|
|
1647
1814
|
if (!queuePending) {
|
|
1648
1815
|
queuePending = true;
|
|
1649
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1816
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1650
1817
|
nextTick(flush);
|
|
1651
1818
|
}
|
|
1652
1819
|
else {
|