@geotrekce/geotrek-rando-widget 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{css-shim-6f592941.js → css-shim-06c204c1.js} +1 -1
- package/dist/cjs/{dom-d5e52c7e.js → dom-874a1e39.js} +1 -1
- package/dist/cjs/geotrek-rando-widget.cjs.js +4 -4
- package/dist/cjs/grw-app.cjs.entry.js +4 -3
- package/dist/cjs/grw-filter_6.cjs.entry.js +14447 -14156
- package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +2 -2
- package/dist/cjs/grw-trek-card.cjs.entry.js +15 -7
- package/dist/cjs/{index-66d58516.js → index-c3fb4999.js} +219 -66
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/{shadow-css-cf936b02.js → shadow-css-a33dc836.js} +1 -1
- package/dist/cjs/{store-d301af22.js → store-5183d8f8.js} +4 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/grw-app/grw-app.js +432 -450
- package/dist/collection/components/grw-filter/grw-filter.js +65 -61
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +35 -44
- package/dist/collection/components/grw-map/grw-map.css +5 -4
- package/dist/collection/components/grw-map/grw-map.js +251 -217
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +33 -32
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +42 -47
- package/dist/collection/components/grw-trek-card/grw-trek-card.js +142 -129
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +135 -208
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +95 -65
- package/dist/collection/store/grw-trek-provider.js +61 -55
- package/dist/collection/store/grw-treks-provider.js +181 -177
- package/dist/collection/store/store.js +3 -2
- package/dist/components/grw-app.js +3 -2
- package/dist/components/grw-map2.js +14405 -14129
- package/dist/components/grw-trek-card2.js +17 -7
- package/dist/components/grw-trek-detail2.js +10 -3
- package/dist/components/grw-trek-provider2.js +6 -2
- package/dist/components/grw-treks-list2.js +7 -2
- package/dist/components/grw-treks-provider2.js +5 -3
- package/dist/components/store.js +3 -2
- package/dist/esm/{css-shim-2d0a698c.js → css-shim-bfa379cd.js} +1 -1
- package/dist/esm/{dom-9794f747.js → dom-104fb833.js} +1 -1
- package/dist/esm/geotrek-rando-widget.js +4 -4
- package/dist/esm/grw-app.entry.js +4 -3
- package/dist/esm/grw-filter_6.entry.js +14427 -14136
- package/dist/esm/grw-information-desk-detail_3.entry.js +2 -2
- package/dist/esm/grw-trek-card.entry.js +15 -7
- package/dist/esm/{index-899307bb.js → index-e834943f.js} +219 -66
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{shadow-css-4cd4480f.js → shadow-css-4261c637.js} +1 -1
- package/dist/esm/{store-70461a28.js → store-c6ccb3db.js} +4 -3
- package/dist/esm-es5/{css-shim-2d0a698c.js → css-shim-bfa379cd.js} +0 -0
- package/dist/esm-es5/{dom-9794f747.js → dom-104fb833.js} +0 -0
- package/dist/esm-es5/geotrek-rando-widget.js +1 -1
- package/dist/esm-es5/grw-app.entry.js +1 -1
- package/dist/esm-es5/grw-filter_6.entry.js +4 -5
- package/dist/esm-es5/grw-information-desk-detail_3.entry.js +1 -1
- package/dist/esm-es5/grw-trek-card.entry.js +1 -1
- package/dist/esm-es5/{index-899307bb.js → index-e834943f.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/esm-es5/{store-70461a28.js → store-c6ccb3db.js} +1 -1
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/geotrek-rando-widget.js +1 -1
- package/dist/geotrek-rando-widget/p-392538a1.system.entry.js +1 -0
- package/dist/geotrek-rando-widget/{p-d1582cff.js → p-4c61dcad.js} +0 -0
- package/dist/geotrek-rando-widget/p-4e0fcbe6.js +1 -0
- package/dist/geotrek-rando-widget/p-6469fc8a.system.js +1 -0
- package/dist/geotrek-rando-widget/{p-c8c96517.system.js → p-6523a23b.system.js} +0 -0
- package/dist/geotrek-rando-widget/{p-32d97a4f.system.js → p-70ecdd1b.system.js} +0 -0
- package/dist/geotrek-rando-widget/{p-0c5b047c.js → p-88046639.js} +0 -0
- package/dist/geotrek-rando-widget/p-88e55e13.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-93d51eaa.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-95932d69.system.entry.js +5 -0
- package/dist/geotrek-rando-widget/{p-4690907e.js → p-9c0d229f.js} +1 -1
- package/dist/geotrek-rando-widget/{p-b1530d9c.system.js → p-a8de6293.system.js} +0 -0
- package/dist/geotrek-rando-widget/p-d56c1888.system.entry.js +1 -0
- package/dist/geotrek-rando-widget/{p-533fc2bb.entry.js → p-dce99cef.entry.js} +1 -1
- package/dist/geotrek-rando-widget/{p-8f9914f4.system.js → p-e2d589f8.system.js} +1 -1
- package/dist/geotrek-rando-widget/{p-82ca029f.system.js → p-e3c13365.system.js} +1 -1
- package/dist/geotrek-rando-widget/{p-2bd0278f.system.entry.js → p-e9f13f25.system.entry.js} +1 -1
- package/dist/geotrek-rando-widget/{p-4eaf20b7.js → p-ef5d4167.js} +0 -0
- package/dist/geotrek-rando-widget/p-fce69064.entry.js +1 -0
- package/dist/types/components/grw-map/grw-map.d.ts +3 -1
- package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +4 -1
- package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +3 -1
- package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +1 -0
- package/dist/types/components.d.ts +8 -0
- package/dist/types/store/store.d.ts +5 -3
- package/dist/types/types/types.d.ts +6 -0
- package/loader/package.json +1 -0
- package/package.json +12 -12
- package/readme.md +4 -6
- package/dist/geotrek-rando-widget/p-067c02c4.system.js +0 -1
- package/dist/geotrek-rando-widget/p-18038011.js +0 -1
- package/dist/geotrek-rando-widget/p-2712caa8.system.entry.js +0 -6
- package/dist/geotrek-rando-widget/p-3ed52659.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-48d5dde7.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-e1431f36.system.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-e38f4ff4.system.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-f5d98aae.entry.js +0 -1
|
@@ -43,7 +43,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
43
43
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
44
44
|
try {
|
|
45
45
|
{
|
|
46
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
46
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
47
47
|
// instance is ready, let's call it's member method for this event
|
|
48
48
|
hostRef.$lazyInstance$[methodName](ev);
|
|
49
49
|
}
|
|
@@ -57,12 +57,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
const getHostListenerTarget = (elm, flags) => {
|
|
60
|
-
if (flags & 8 /* TargetWindow */)
|
|
60
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
|
61
61
|
return win;
|
|
62
62
|
return elm;
|
|
63
63
|
};
|
|
64
64
|
// prettier-ignore
|
|
65
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
65
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
66
66
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
67
67
|
const createTime = (fnName, tagName = '') => {
|
|
68
68
|
{
|
|
@@ -78,7 +78,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
const rootAppliedStyles = new WeakMap();
|
|
81
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
82
82
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
83
83
|
let style = styles.get(scopeId);
|
|
84
84
|
if (supportsConstructableStylesheets && allowCS) {
|
|
@@ -100,7 +100,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
100
100
|
const style = styles.get(scopeId);
|
|
101
101
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
102
102
|
// so the fallback is to always use the document for the root node in those cases
|
|
103
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
103
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
104
104
|
if (style) {
|
|
105
105
|
if (typeof style === 'string') {
|
|
106
106
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -112,7 +112,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
112
112
|
if (!appliedStyles.has(scopeId)) {
|
|
113
113
|
{
|
|
114
114
|
if (plt.$cssShim$) {
|
|
115
|
-
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
|
|
115
|
+
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
|
|
116
116
|
const newScopeId = styleElm['s-sc'];
|
|
117
117
|
if (newScopeId) {
|
|
118
118
|
scopeId = newScopeId;
|
|
@@ -145,7 +145,7 @@ const attachStyles = (hostRef) => {
|
|
|
145
145
|
const flags = cmpMeta.$flags$;
|
|
146
146
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
147
147
|
const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
|
|
148
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
148
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
149
149
|
// only required when we're NOT using native shadow dom (slot)
|
|
150
150
|
// or this browser doesn't support native shadow dom
|
|
151
151
|
// and this host element was NOT created with SSR
|
|
@@ -371,7 +371,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
374
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
375
375
|
newValue = newValue === true ? '' : newValue;
|
|
376
376
|
{
|
|
377
377
|
elm.setAttribute(memberName, newValue);
|
|
@@ -386,7 +386,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
386
386
|
// if the element passed in is a shadow root, which is a document fragment
|
|
387
387
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
388
388
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
389
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
389
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
390
390
|
? newVnode.$elm$.host
|
|
391
391
|
: newVnode.$elm$;
|
|
392
392
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -404,6 +404,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
404
404
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
|
+
/**
|
|
408
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
409
|
+
*
|
|
410
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
411
|
+
* @param newParentVNode the parent VNode from the current render
|
|
412
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
413
|
+
* children, for which we will create a new DOM node
|
|
414
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
415
|
+
* @returns the newly created node
|
|
416
|
+
*/
|
|
407
417
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
408
418
|
// tslint:disable-next-line: prefer-const
|
|
409
419
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -465,6 +475,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
465
475
|
}
|
|
466
476
|
}
|
|
467
477
|
};
|
|
478
|
+
/**
|
|
479
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
480
|
+
* traversing the two collections of children, identifying nodes that are
|
|
481
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
482
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
483
|
+
*
|
|
484
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
485
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
486
|
+
* 'windows' by storing start and end indices and references to the
|
|
487
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
488
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
489
|
+
* no children left to update by doing the following:
|
|
490
|
+
*
|
|
491
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
492
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
493
|
+
* only with a window bounded by the highlighted elements:
|
|
494
|
+
*
|
|
495
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
496
|
+
* ^^^^^^ ^^^^^^
|
|
497
|
+
*
|
|
498
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
499
|
+
* across the windows. This will basically detect elements which haven't
|
|
500
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
501
|
+
* VNode elements (represented as HTML):
|
|
502
|
+
*
|
|
503
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
504
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
505
|
+
*
|
|
506
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
507
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
508
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
509
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
510
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
511
|
+
*
|
|
512
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
513
|
+
* window corresponds to the element at the end of the other window. This is
|
|
514
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
515
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
516
|
+
* children nodes themselves have not changed but merely moved in the
|
|
517
|
+
* following example:
|
|
518
|
+
*
|
|
519
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
520
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
521
|
+
*
|
|
522
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
523
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
524
|
+
* DOM.
|
|
525
|
+
*
|
|
526
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
527
|
+
* nodes in the old children which have the same key as the first element in
|
|
528
|
+
* our window on the new children. If we find such a node we handle calling
|
|
529
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
530
|
+
* what we find.
|
|
531
|
+
*
|
|
532
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
533
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
534
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
535
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
536
|
+
* children has collapsed we still have more nodes on the new children that
|
|
537
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
538
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
539
|
+
* sure the corresponding DOM nodes are removed.
|
|
540
|
+
*
|
|
541
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
542
|
+
* @param oldCh the old children of the parent node
|
|
543
|
+
* @param newVNode the new VNode which will replace the parent
|
|
544
|
+
* @param newCh the new children of the parent node
|
|
545
|
+
*/
|
|
468
546
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
469
547
|
let oldStartIdx = 0;
|
|
470
548
|
let newStartIdx = 0;
|
|
@@ -480,7 +558,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
480
558
|
let elmToMove;
|
|
481
559
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
482
560
|
if (oldStartVnode == null) {
|
|
483
|
-
//
|
|
561
|
+
// VNode might have been moved left
|
|
484
562
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
485
563
|
}
|
|
486
564
|
else if (oldEndVnode == null) {
|
|
@@ -493,29 +571,65 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
493
571
|
newEndVnode = newCh[--newEndIdx];
|
|
494
572
|
}
|
|
495
573
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
574
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
575
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
576
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
577
|
+
// since things are matched up in order.
|
|
496
578
|
patch(oldStartVnode, newStartVnode);
|
|
497
579
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
498
580
|
newStartVnode = newCh[++newStartIdx];
|
|
499
581
|
}
|
|
500
582
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
583
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
584
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
585
|
+
// need to move any DOM Nodes.
|
|
501
586
|
patch(oldEndVnode, newEndVnode);
|
|
502
587
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
503
588
|
newEndVnode = newCh[--newEndIdx];
|
|
504
589
|
}
|
|
505
590
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
506
591
|
patch(oldStartVnode, newEndVnode);
|
|
592
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
593
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
594
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
595
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
596
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
597
|
+
//
|
|
598
|
+
// <old-start-node />
|
|
599
|
+
// <some-intervening-node />
|
|
600
|
+
// <old-end-node />
|
|
601
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
602
|
+
// <next-sibling />
|
|
603
|
+
//
|
|
604
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
605
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
606
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
607
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
608
|
+
// append it to the children of the parent element.
|
|
507
609
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
508
610
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
509
611
|
newEndVnode = newCh[--newEndIdx];
|
|
510
612
|
}
|
|
511
613
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
512
614
|
patch(oldEndVnode, newStartVnode);
|
|
615
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
616
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
617
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
618
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
619
|
+
// future.
|
|
513
620
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
514
621
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
515
622
|
newStartVnode = newCh[++newStartIdx];
|
|
516
623
|
}
|
|
517
624
|
else {
|
|
518
|
-
//
|
|
625
|
+
// Here we do some checks to match up old and new nodes based on the
|
|
626
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
|
627
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
|
628
|
+
// component.
|
|
629
|
+
//
|
|
630
|
+
// First we check to see if there are any nodes in the array of old
|
|
631
|
+
// children which have the same key as the first node in the new
|
|
632
|
+
// children.
|
|
519
633
|
idxInOld = -1;
|
|
520
634
|
{
|
|
521
635
|
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
@@ -526,23 +640,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
526
640
|
}
|
|
527
641
|
}
|
|
528
642
|
if (idxInOld >= 0) {
|
|
643
|
+
// We found a node in the old children which matches up with the first
|
|
644
|
+
// node in the new children! So let's deal with that
|
|
529
645
|
elmToMove = oldCh[idxInOld];
|
|
530
646
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
647
|
+
// the tag doesn't match so we'll need a new DOM element
|
|
531
648
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
532
649
|
}
|
|
533
650
|
else {
|
|
534
651
|
patch(elmToMove, newStartVnode);
|
|
652
|
+
// invalidate the matching old node so that we won't try to update it
|
|
653
|
+
// again later on
|
|
535
654
|
oldCh[idxInOld] = undefined;
|
|
536
655
|
node = elmToMove.$elm$;
|
|
537
656
|
}
|
|
538
657
|
newStartVnode = newCh[++newStartIdx];
|
|
539
658
|
}
|
|
540
659
|
else {
|
|
541
|
-
//
|
|
660
|
+
// We either didn't find an element in the old children that matches
|
|
661
|
+
// the key of the first new child OR the build is not using `key`
|
|
662
|
+
// attributes at all. In either case we need to create a new element
|
|
663
|
+
// for the new node.
|
|
542
664
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
543
665
|
newStartVnode = newCh[++newStartIdx];
|
|
544
666
|
}
|
|
545
667
|
if (node) {
|
|
668
|
+
// if we created a new node then handle inserting it to the DOM
|
|
546
669
|
{
|
|
547
670
|
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
548
671
|
}
|
|
@@ -550,29 +673,58 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
550
673
|
}
|
|
551
674
|
}
|
|
552
675
|
if (oldStartIdx > oldEndIdx) {
|
|
676
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
553
677
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
554
678
|
}
|
|
555
679
|
else if (newStartIdx > newEndIdx) {
|
|
680
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
681
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
682
|
+
// relevant DOM nodes)
|
|
556
683
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
557
684
|
}
|
|
558
685
|
};
|
|
559
|
-
|
|
686
|
+
/**
|
|
687
|
+
* Compare two VNodes to determine if they are the same
|
|
688
|
+
*
|
|
689
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
690
|
+
* information set on the two VNodes and can be misleading under certain
|
|
691
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
692
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
693
|
+
* checking that they have the same tag.
|
|
694
|
+
*
|
|
695
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
696
|
+
* changing order within a `children` array or something along those lines then
|
|
697
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
698
|
+
*
|
|
699
|
+
* @param leftVNode the first VNode to check
|
|
700
|
+
* @param rightVNode the second VNode to check
|
|
701
|
+
* @returns whether they're equal or not
|
|
702
|
+
*/
|
|
703
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
560
704
|
// compare if two vnode to see if they're "technically" the same
|
|
561
705
|
// need to have the same element tag, and same key to be the same
|
|
562
|
-
if (
|
|
706
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
707
|
+
// this will be set if components in the build have `key` attrs set on them
|
|
563
708
|
{
|
|
564
|
-
return
|
|
709
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
|
565
710
|
}
|
|
566
711
|
}
|
|
567
712
|
return false;
|
|
568
713
|
};
|
|
714
|
+
/**
|
|
715
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
716
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
717
|
+
* children of the two nodes (if any).
|
|
718
|
+
*
|
|
719
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
720
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
721
|
+
*/
|
|
569
722
|
const patch = (oldVNode, newVNode) => {
|
|
570
723
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
571
724
|
const oldChildren = oldVNode.$children$;
|
|
572
725
|
const newChildren = newVNode.$children$;
|
|
573
726
|
const text = newVNode.$text$;
|
|
574
727
|
if (text === null) {
|
|
575
|
-
// element node
|
|
576
728
|
{
|
|
577
729
|
{
|
|
578
730
|
// either this is the first render of an element OR it's an update
|
|
@@ -583,6 +735,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
583
735
|
}
|
|
584
736
|
if (oldChildren !== null && newChildren !== null) {
|
|
585
737
|
// looks like there's child vnodes for both the old and new vnodes
|
|
738
|
+
// so we need to call `updateChildren` to reconcile them
|
|
586
739
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
587
740
|
}
|
|
588
741
|
else if (newChildren !== null) {
|
|
@@ -611,7 +764,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
611
764
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
612
765
|
hostTagName = hostElm.tagName;
|
|
613
766
|
rootVnode.$tag$ = null;
|
|
614
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
767
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
615
768
|
hostRef.$vnode$ = rootVnode;
|
|
616
769
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
617
770
|
{
|
|
@@ -626,9 +779,9 @@ const createEvent = (ref, name, flags) => {
|
|
|
626
779
|
return {
|
|
627
780
|
emit: (detail) => {
|
|
628
781
|
return emitEvent(elm, name, {
|
|
629
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
630
|
-
composed: !!(flags & 2 /* Composed */),
|
|
631
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
782
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
783
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
784
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
632
785
|
detail,
|
|
633
786
|
});
|
|
634
787
|
},
|
|
@@ -653,10 +806,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
653
806
|
};
|
|
654
807
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
655
808
|
{
|
|
656
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
809
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
657
810
|
}
|
|
658
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
659
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
811
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
812
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
660
813
|
return;
|
|
661
814
|
}
|
|
662
815
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -672,7 +825,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
672
825
|
let promise;
|
|
673
826
|
if (isInitialLoad) {
|
|
674
827
|
{
|
|
675
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
828
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
676
829
|
if (hostRef.$queuedListeners$) {
|
|
677
830
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
678
831
|
hostRef.$queuedListeners$ = null;
|
|
@@ -718,7 +871,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
718
871
|
}
|
|
719
872
|
else {
|
|
720
873
|
Promise.all(childrenPromises).then(postUpdate);
|
|
721
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
874
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
722
875
|
childrenPromises.length = 0;
|
|
723
876
|
}
|
|
724
877
|
}
|
|
@@ -728,10 +881,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
728
881
|
renderingRef = instance;
|
|
729
882
|
instance = instance.render() ;
|
|
730
883
|
{
|
|
731
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
884
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
732
885
|
}
|
|
733
886
|
{
|
|
734
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
887
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
735
888
|
}
|
|
736
889
|
{
|
|
737
890
|
{
|
|
@@ -757,8 +910,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
757
910
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
758
911
|
const instance = hostRef.$lazyInstance$ ;
|
|
759
912
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
760
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
761
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
913
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
914
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
762
915
|
{
|
|
763
916
|
// DOM WRITE!
|
|
764
917
|
addHydratedFlag(elm);
|
|
@@ -784,10 +937,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
784
937
|
hostRef.$onRenderResolve$();
|
|
785
938
|
hostRef.$onRenderResolve$ = undefined;
|
|
786
939
|
}
|
|
787
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
940
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
788
941
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
789
942
|
}
|
|
790
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
943
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
791
944
|
}
|
|
792
945
|
// ( •_•)
|
|
793
946
|
// ( •_•)>⌐■-■
|
|
@@ -798,7 +951,7 @@ const forceUpdate = (ref) => {
|
|
|
798
951
|
const hostRef = getHostRef(ref);
|
|
799
952
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
800
953
|
if (isConnected &&
|
|
801
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
954
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
802
955
|
scheduleUpdate(hostRef, false);
|
|
803
956
|
}
|
|
804
957
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -855,16 +1008,16 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
|
855
1008
|
const parsePropertyValue = (propValue, propType) => {
|
|
856
1009
|
// ensure this value is of the correct prop type
|
|
857
1010
|
if (propValue != null && !isComplexType(propValue)) {
|
|
858
|
-
if (propType & 4 /* Boolean */) {
|
|
1011
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
859
1012
|
// per the HTML spec, any string value means it is a boolean true value
|
|
860
1013
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
861
1014
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
862
1015
|
}
|
|
863
|
-
if (propType & 2 /* Number */) {
|
|
1016
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
|
864
1017
|
// force it to be a number
|
|
865
1018
|
return parseFloat(propValue);
|
|
866
1019
|
}
|
|
867
|
-
if (propType & 1 /* String */) {
|
|
1020
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
868
1021
|
// could have been passed as a number or boolean
|
|
869
1022
|
// but we still want it as a string
|
|
870
1023
|
return String(propValue);
|
|
@@ -888,13 +1041,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
888
1041
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
889
1042
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
890
1043
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
891
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
1044
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
892
1045
|
// gadzooks! the property's value has changed!!
|
|
893
1046
|
// set our new value!
|
|
894
1047
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
895
1048
|
if (instance) {
|
|
896
1049
|
// get an array of method names of watch functions to call
|
|
897
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1050
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
898
1051
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
899
1052
|
if (watchMethods) {
|
|
900
1053
|
// this instance is watching for when this property changed
|
|
@@ -909,7 +1062,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
909
1062
|
});
|
|
910
1063
|
}
|
|
911
1064
|
}
|
|
912
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
1065
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
913
1066
|
// looks like this value actually changed, so we've got work to do!
|
|
914
1067
|
// but only if we've already rendered, otherwise just chill out
|
|
915
1068
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -928,8 +1081,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
928
1081
|
const members = Object.entries(cmpMeta.$members$);
|
|
929
1082
|
const prototype = Cstr.prototype;
|
|
930
1083
|
members.map(([memberName, [memberFlags]]) => {
|
|
931
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
932
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
1084
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1085
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
933
1086
|
// proxyComponent - prop
|
|
934
1087
|
Object.defineProperty(prototype, memberName, {
|
|
935
1088
|
get() {
|
|
@@ -945,7 +1098,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
945
1098
|
});
|
|
946
1099
|
}
|
|
947
1100
|
});
|
|
948
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
1101
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
949
1102
|
const attrNameToPropName = new Map();
|
|
950
1103
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
951
1104
|
plt.jmp(() => {
|
|
@@ -1001,7 +1154,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1001
1154
|
// create an array of attributes to observe
|
|
1002
1155
|
// and also create a map of html attribute name to js property name
|
|
1003
1156
|
Cstr.observedAttributes = members
|
|
1004
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1157
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
1005
1158
|
.map(([propName, m]) => {
|
|
1006
1159
|
const attrName = m[1] || propName;
|
|
1007
1160
|
attrNameToPropName.set(attrName, propName);
|
|
@@ -1013,10 +1166,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1013
1166
|
};
|
|
1014
1167
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1015
1168
|
// initializeComponent
|
|
1016
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1169
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1017
1170
|
{
|
|
1018
1171
|
// we haven't initialized this element yet
|
|
1019
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1172
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1020
1173
|
// lazy loaded components
|
|
1021
1174
|
// request the component's implementation to be
|
|
1022
1175
|
// wired up with the host element
|
|
@@ -1034,7 +1187,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1034
1187
|
{
|
|
1035
1188
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1036
1189
|
}
|
|
1037
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1190
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
1038
1191
|
Cstr.isProxied = true;
|
|
1039
1192
|
}
|
|
1040
1193
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -1042,7 +1195,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1042
1195
|
// but let's keep track of when we start and stop
|
|
1043
1196
|
// so that the getters/setters don't incorrectly step on data
|
|
1044
1197
|
{
|
|
1045
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1198
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1046
1199
|
}
|
|
1047
1200
|
// construct the lazy-loaded component implementation
|
|
1048
1201
|
// passing the hostRef is very important during
|
|
@@ -1055,10 +1208,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1055
1208
|
consoleError(e);
|
|
1056
1209
|
}
|
|
1057
1210
|
{
|
|
1058
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1211
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
1059
1212
|
}
|
|
1060
1213
|
{
|
|
1061
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1214
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
1062
1215
|
}
|
|
1063
1216
|
endNewInstance();
|
|
1064
1217
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
@@ -1069,10 +1222,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1069
1222
|
const scopeId = getScopeId(cmpMeta);
|
|
1070
1223
|
if (!styles.has(scopeId)) {
|
|
1071
1224
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1072
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1073
|
-
style = await import('./shadow-css-
|
|
1225
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1226
|
+
style = await import('./shadow-css-4261c637.js').then((m) => m.scopeCss(style, scopeId, false));
|
|
1074
1227
|
}
|
|
1075
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1228
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1076
1229
|
endRegisterStyles();
|
|
1077
1230
|
}
|
|
1078
1231
|
}
|
|
@@ -1099,13 +1252,13 @@ const fireConnectedCallback = (instance) => {
|
|
|
1099
1252
|
}
|
|
1100
1253
|
};
|
|
1101
1254
|
const connectedCallback = (elm) => {
|
|
1102
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1255
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1103
1256
|
const hostRef = getHostRef(elm);
|
|
1104
1257
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1105
1258
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1106
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1259
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1107
1260
|
// first time this component has connected
|
|
1108
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1261
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1109
1262
|
{
|
|
1110
1263
|
// find the first ancestor component (if there is one) and register
|
|
1111
1264
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1125,7 +1278,7 @@ const connectedCallback = (elm) => {
|
|
|
1125
1278
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1126
1279
|
if (cmpMeta.$members$) {
|
|
1127
1280
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1128
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1281
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1129
1282
|
const value = elm[memberName];
|
|
1130
1283
|
delete elm[memberName];
|
|
1131
1284
|
elm[memberName] = value;
|
|
@@ -1148,7 +1301,7 @@ const connectedCallback = (elm) => {
|
|
|
1148
1301
|
}
|
|
1149
1302
|
};
|
|
1150
1303
|
const disconnectedCallback = (elm) => {
|
|
1151
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1304
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1152
1305
|
const hostRef = getHostRef(elm);
|
|
1153
1306
|
const instance = hostRef.$lazyInstance$ ;
|
|
1154
1307
|
{
|
|
@@ -1172,7 +1325,7 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1172
1325
|
return this[n];
|
|
1173
1326
|
}
|
|
1174
1327
|
}
|
|
1175
|
-
if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
|
|
1328
|
+
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1176
1329
|
const childNodesFn = elm.__lookupGetter__('childNodes');
|
|
1177
1330
|
Object.defineProperty(elm, 'children', {
|
|
1178
1331
|
get() {
|
|
@@ -1187,8 +1340,8 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
|
|
|
1187
1340
|
Object.defineProperty(elm, 'childNodes', {
|
|
1188
1341
|
get() {
|
|
1189
1342
|
const childNodes = childNodesFn.call(this);
|
|
1190
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
|
|
1191
|
-
getHostRef(this).$flags$ & 2 /* hasRendered */) {
|
|
1343
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
|
|
1344
|
+
getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
|
|
1192
1345
|
const result = new FakeNodeList();
|
|
1193
1346
|
for (let i = 0; i < childNodes.length; i++) {
|
|
1194
1347
|
const slot = childNodes[i]['s-nr'];
|
|
@@ -1233,8 +1386,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1233
1386
|
{
|
|
1234
1387
|
cmpMeta.$watchers$ = {};
|
|
1235
1388
|
}
|
|
1236
|
-
if (!supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1237
|
-
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
1389
|
+
if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1390
|
+
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
1238
1391
|
}
|
|
1239
1392
|
const tagName = cmpMeta.$tagName$;
|
|
1240
1393
|
const HostElement = class extends HTMLElement {
|
|
@@ -1244,7 +1397,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1244
1397
|
super(self);
|
|
1245
1398
|
self = this;
|
|
1246
1399
|
registerHost(self, cmpMeta);
|
|
1247
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1400
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1248
1401
|
// this component is using shadow dom
|
|
1249
1402
|
// and this browser supports shadow dom
|
|
1250
1403
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1285,7 +1438,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1285
1438
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1286
1439
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1287
1440
|
cmpTags.push(tagName);
|
|
1288
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1441
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1289
1442
|
}
|
|
1290
1443
|
});
|
|
1291
1444
|
});
|
|
@@ -1307,7 +1460,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1307
1460
|
// Fallback appLoad event
|
|
1308
1461
|
endBootstrap();
|
|
1309
1462
|
};
|
|
1310
|
-
const hostRefs = new WeakMap();
|
|
1463
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1311
1464
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1312
1465
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1313
1466
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1349,14 +1502,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1349
1502
|
return importedModule[exportName];
|
|
1350
1503
|
}, consoleError);
|
|
1351
1504
|
};
|
|
1352
|
-
const styles = new Map();
|
|
1505
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1353
1506
|
const queueDomReads = [];
|
|
1354
1507
|
const queueDomWrites = [];
|
|
1355
1508
|
const queueTask = (queue, write) => (cb) => {
|
|
1356
1509
|
queue.push(cb);
|
|
1357
1510
|
if (!queuePending) {
|
|
1358
1511
|
queuePending = true;
|
|
1359
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1512
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1360
1513
|
nextTick(flush);
|
|
1361
1514
|
}
|
|
1362
1515
|
else {
|