lwc 2.11.0 → 2.12.0
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/engine-dom/esm/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/iife/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +391 -181
- package/dist/engine-dom/umd/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/umd/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +391 -181
- package/dist/engine-server/commonjs/es2017/engine-server.js +14 -11
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +14 -11
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +10 -10
|
@@ -120,7 +120,6 @@ var LWC = (function (exports) {
|
|
|
120
120
|
setPrototypeOf = Object.setPrototypeOf;
|
|
121
121
|
var isArray$1 = Array.isArray;
|
|
122
122
|
var _Array$prototype = Array.prototype,
|
|
123
|
-
ArrayFilter = _Array$prototype.filter,
|
|
124
123
|
ArrayIndexOf = _Array$prototype.indexOf,
|
|
125
124
|
ArrayJoin = _Array$prototype.join,
|
|
126
125
|
ArrayMap = _Array$prototype.map,
|
|
@@ -360,9 +359,9 @@ var LWC = (function (exports) {
|
|
|
360
359
|
*/
|
|
361
360
|
// Increment whenever the LWC template compiler changes
|
|
362
361
|
|
|
363
|
-
var LWC_VERSION = "2.
|
|
362
|
+
var LWC_VERSION = "2.12.0";
|
|
364
363
|
var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
365
|
-
/** version: 2.
|
|
364
|
+
/** version: 2.12.0 */
|
|
366
365
|
|
|
367
366
|
/*
|
|
368
367
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -540,7 +539,7 @@ var LWC = (function (exports) {
|
|
|
540
539
|
setFeatureFlag(name, value);
|
|
541
540
|
}
|
|
542
541
|
}
|
|
543
|
-
/** version: 2.
|
|
542
|
+
/** version: 2.12.0 */
|
|
544
543
|
|
|
545
544
|
/* proxy-compat-disable */
|
|
546
545
|
|
|
@@ -6419,16 +6418,20 @@ var LWC = (function (exports) {
|
|
|
6419
6418
|
* will prevent this function from being imported by userland code.
|
|
6420
6419
|
*/
|
|
6421
6420
|
|
|
6422
|
-
function registerComponent(
|
|
6421
|
+
function registerComponent( // We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
6422
|
+
Ctor, _ref2) {
|
|
6423
6423
|
var tmpl = _ref2.tmpl;
|
|
6424
6424
|
|
|
6425
|
-
if (
|
|
6426
|
-
|
|
6427
|
-
|
|
6425
|
+
if (isFunction$1(Ctor)) {
|
|
6426
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6427
|
+
checkVersionMismatch(Ctor, 'component');
|
|
6428
|
+
}
|
|
6428
6429
|
|
|
6429
|
-
|
|
6430
|
+
signedTemplateMap.set(Ctor, tmpl);
|
|
6431
|
+
} // chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
6430
6432
|
// without too much transformation
|
|
6431
6433
|
|
|
6434
|
+
|
|
6432
6435
|
return Ctor;
|
|
6433
6436
|
}
|
|
6434
6437
|
|
|
@@ -6540,1353 +6543,1405 @@ var LWC = (function (exports) {
|
|
|
6540
6543
|
}
|
|
6541
6544
|
}
|
|
6542
6545
|
/*
|
|
6543
|
-
* Copyright (c)
|
|
6546
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6544
6547
|
* All rights reserved.
|
|
6545
6548
|
* SPDX-License-Identifier: MIT
|
|
6546
6549
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6547
6550
|
*/
|
|
6548
6551
|
|
|
6549
6552
|
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
case 0
|
|
6553
|
-
/* Text */
|
|
6554
|
-
:
|
|
6555
|
-
hydrateText(vnode, node);
|
|
6556
|
-
break;
|
|
6553
|
+
var idx = 0;
|
|
6554
|
+
/** The internal slot used to associate different objects the engine manipulates with the VM */
|
|
6557
6555
|
|
|
6558
|
-
|
|
6559
|
-
/* Comment */
|
|
6560
|
-
:
|
|
6561
|
-
hydrateComment(vnode, node);
|
|
6562
|
-
break;
|
|
6556
|
+
var ViewModelReflection = new WeakMap();
|
|
6563
6557
|
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
break;
|
|
6558
|
+
function callHook(cmp, fn) {
|
|
6559
|
+
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
6560
|
+
return fn.apply(cmp, args);
|
|
6561
|
+
}
|
|
6569
6562
|
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
:
|
|
6573
|
-
hydrateCustomElement(vnode, node);
|
|
6574
|
-
break;
|
|
6575
|
-
}
|
|
6563
|
+
function setHook(cmp, prop, newValue) {
|
|
6564
|
+
cmp[prop] = newValue;
|
|
6576
6565
|
}
|
|
6577
6566
|
|
|
6578
|
-
function
|
|
6579
|
-
|
|
6567
|
+
function getHook(cmp, prop) {
|
|
6568
|
+
return cmp[prop];
|
|
6569
|
+
}
|
|
6580
6570
|
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
);
|
|
6585
|
-
var nodeValue = getProperty$1(node, 'nodeValue');
|
|
6571
|
+
function rerenderVM(vm) {
|
|
6572
|
+
rehydrate(vm);
|
|
6573
|
+
}
|
|
6586
6574
|
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6575
|
+
function connectRootElement(elm) {
|
|
6576
|
+
var vm = getAssociatedVM(elm);
|
|
6577
|
+
logGlobalOperationStart(7
|
|
6578
|
+
/* GlobalHydrate */
|
|
6579
|
+
, vm); // Usually means moving the element from one place to another, which is observable via
|
|
6580
|
+
// life-cycle hooks.
|
|
6591
6581
|
|
|
6582
|
+
if (vm.state === 1
|
|
6583
|
+
/* connected */
|
|
6584
|
+
) {
|
|
6585
|
+
disconnectRootElement(elm);
|
|
6586
|
+
}
|
|
6592
6587
|
|
|
6593
|
-
|
|
6594
|
-
|
|
6588
|
+
runConnectedCallback(vm);
|
|
6589
|
+
rehydrate(vm);
|
|
6590
|
+
logGlobalOperationEnd(7
|
|
6591
|
+
/* GlobalHydrate */
|
|
6592
|
+
, vm);
|
|
6595
6593
|
}
|
|
6596
6594
|
|
|
6597
|
-
function
|
|
6598
|
-
var
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
validateNodeType(vnode, node, 8
|
|
6602
|
-
/* COMMENT */
|
|
6603
|
-
);
|
|
6604
|
-
|
|
6605
|
-
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
6606
|
-
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6607
|
-
}
|
|
6608
|
-
} // always set the text value to the one from the vnode.
|
|
6595
|
+
function disconnectRootElement(elm) {
|
|
6596
|
+
var vm = getAssociatedVM(elm);
|
|
6597
|
+
resetComponentStateWhenRemoved(vm);
|
|
6598
|
+
}
|
|
6609
6599
|
|
|
6600
|
+
function appendVM(vm) {
|
|
6601
|
+
rehydrate(vm);
|
|
6602
|
+
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6603
|
+
// while preventing any attempt to rehydration until after reinsertion.
|
|
6610
6604
|
|
|
6611
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6612
|
-
vnode.elm = node;
|
|
6613
|
-
}
|
|
6614
6605
|
|
|
6615
|
-
function
|
|
6616
|
-
|
|
6617
|
-
validateNodeType(vnode, node, 1
|
|
6618
|
-
/* ELEMENT */
|
|
6619
|
-
);
|
|
6620
|
-
validateElement(vnode, node);
|
|
6621
|
-
}
|
|
6606
|
+
function resetComponentStateWhenRemoved(vm) {
|
|
6607
|
+
var state = vm.state;
|
|
6622
6608
|
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
);
|
|
6609
|
+
if (state !== 2
|
|
6610
|
+
/* disconnected */
|
|
6611
|
+
) {
|
|
6612
|
+
var oar = vm.oar,
|
|
6613
|
+
tro = vm.tro; // Making sure that any observing record will not trigger the rehydrated on this vm
|
|
6629
6614
|
|
|
6630
|
-
|
|
6631
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6632
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6633
|
-
var props = vnode.data.props;
|
|
6615
|
+
tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked
|
|
6634
6616
|
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6638
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), {
|
|
6639
|
-
props: cloneAndOmitKey(props, 'innerHTML')
|
|
6640
|
-
});
|
|
6641
|
-
} else {
|
|
6642
|
-
logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
6643
|
-
}
|
|
6617
|
+
for (var key in oar) {
|
|
6618
|
+
oar[key].reset();
|
|
6644
6619
|
}
|
|
6645
|
-
}
|
|
6646
6620
|
|
|
6647
|
-
|
|
6621
|
+
runDisconnectedCallback(vm); // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
|
6648
6622
|
|
|
6649
|
-
|
|
6650
|
-
|
|
6623
|
+
runChildNodesDisconnectedCallback(vm);
|
|
6624
|
+
runLightChildNodesDisconnectedCallback(vm);
|
|
6651
6625
|
}
|
|
6652
|
-
}
|
|
6653
6626
|
|
|
6654
|
-
function hydrateCustomElement(vnode, node) {
|
|
6655
6627
|
if (process.env.NODE_ENV !== 'production') {
|
|
6656
|
-
|
|
6657
|
-
/* ELEMENT */
|
|
6658
|
-
);
|
|
6659
|
-
validateElement(vnode, node);
|
|
6628
|
+
removeActiveVM(vm);
|
|
6660
6629
|
}
|
|
6630
|
+
} // this method is triggered by the diffing algo only when a vnode from the
|
|
6631
|
+
// old vnode.children is removed from the DOM.
|
|
6661
6632
|
|
|
6662
|
-
var elm = node;
|
|
6663
|
-
var sel = vnode.sel,
|
|
6664
|
-
mode = vnode.mode,
|
|
6665
|
-
ctor = vnode.ctor,
|
|
6666
|
-
owner = vnode.owner;
|
|
6667
|
-
var vm = createVM(elm, ctor, {
|
|
6668
|
-
mode: mode,
|
|
6669
|
-
owner: owner,
|
|
6670
|
-
tagName: sel
|
|
6671
|
-
});
|
|
6672
|
-
vnode.elm = elm;
|
|
6673
|
-
vnode.vm = vm;
|
|
6674
|
-
allocateChildren(vnode, vm);
|
|
6675
|
-
patchElementPropsAndAttrs(vnode); // Insert hook section:
|
|
6676
6633
|
|
|
6634
|
+
function removeVM(vm) {
|
|
6677
6635
|
if (process.env.NODE_ENV !== 'production') {
|
|
6678
|
-
assert.isTrue(vm.state ===
|
|
6679
|
-
/*
|
|
6680
|
-
|
|
6636
|
+
assert.isTrue(vm.state === 1
|
|
6637
|
+
/* connected */
|
|
6638
|
+
|| vm.state === 2
|
|
6639
|
+
/* disconnected */
|
|
6640
|
+
, "".concat(vm, " must have been connected."));
|
|
6681
6641
|
}
|
|
6682
6642
|
|
|
6683
|
-
|
|
6643
|
+
resetComponentStateWhenRemoved(vm);
|
|
6644
|
+
}
|
|
6684
6645
|
|
|
6685
|
-
|
|
6646
|
+
function getNearestShadowAncestor(vm) {
|
|
6647
|
+
var ancestor = vm.owner;
|
|
6648
|
+
|
|
6649
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
6686
6650
|
/* Light */
|
|
6687
6651
|
) {
|
|
6688
|
-
|
|
6689
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6690
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
6652
|
+
ancestor = ancestor.owner;
|
|
6691
6653
|
}
|
|
6692
6654
|
|
|
6693
|
-
|
|
6655
|
+
return ancestor;
|
|
6694
6656
|
}
|
|
6695
6657
|
|
|
6696
|
-
function
|
|
6658
|
+
function createVM(elm, ctor, options) {
|
|
6659
|
+
var mode = options.mode,
|
|
6660
|
+
owner = options.owner,
|
|
6661
|
+
tagName = options.tagName;
|
|
6662
|
+
var def = getComponentInternalDef(ctor);
|
|
6663
|
+
var vm = {
|
|
6664
|
+
elm: elm,
|
|
6665
|
+
def: def,
|
|
6666
|
+
idx: idx++,
|
|
6667
|
+
state: 0
|
|
6668
|
+
/* created */
|
|
6669
|
+
,
|
|
6670
|
+
isScheduled: false,
|
|
6671
|
+
isDirty: true,
|
|
6672
|
+
tagName: tagName,
|
|
6673
|
+
mode: mode,
|
|
6674
|
+
owner: owner,
|
|
6675
|
+
children: EmptyArray,
|
|
6676
|
+
aChildren: EmptyArray,
|
|
6677
|
+
velements: EmptyArray,
|
|
6678
|
+
cmpProps: create(null),
|
|
6679
|
+
cmpFields: create(null),
|
|
6680
|
+
cmpSlots: create(null),
|
|
6681
|
+
oar: create(null),
|
|
6682
|
+
cmpTemplate: null,
|
|
6683
|
+
renderMode: def.renderMode,
|
|
6684
|
+
context: {
|
|
6685
|
+
stylesheetToken: undefined,
|
|
6686
|
+
hasTokenInClass: undefined,
|
|
6687
|
+
hasTokenInAttribute: undefined,
|
|
6688
|
+
hasScopedStyles: undefined,
|
|
6689
|
+
styleVNode: null,
|
|
6690
|
+
tplCache: EmptyObject,
|
|
6691
|
+
wiredConnecting: EmptyArray,
|
|
6692
|
+
wiredDisconnecting: EmptyArray
|
|
6693
|
+
},
|
|
6694
|
+
// Properties set right after VM creation.
|
|
6695
|
+
tro: null,
|
|
6696
|
+
shadowMode: null,
|
|
6697
|
+
// Properties set by the LightningElement constructor.
|
|
6698
|
+
component: null,
|
|
6699
|
+
shadowRoot: null,
|
|
6700
|
+
renderRoot: null,
|
|
6701
|
+
callHook: callHook,
|
|
6702
|
+
setHook: setHook,
|
|
6703
|
+
getHook: getHook
|
|
6704
|
+
};
|
|
6705
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
6706
|
+
vm.tro = getTemplateReactiveObserver(vm);
|
|
6707
|
+
|
|
6697
6708
|
if (process.env.NODE_ENV !== 'production') {
|
|
6698
|
-
|
|
6699
|
-
return
|
|
6700
|
-
}
|
|
6709
|
+
vm.toString = function () {
|
|
6710
|
+
return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
|
|
6711
|
+
};
|
|
6701
6712
|
|
|
6702
|
-
if (
|
|
6703
|
-
|
|
6704
|
-
|
|
6713
|
+
if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
|
|
6714
|
+
vm.shadowMode = 0
|
|
6715
|
+
/* Native */
|
|
6716
|
+
;
|
|
6705
6717
|
}
|
|
6706
|
-
}
|
|
6718
|
+
} // Create component instance associated to the vm and the element.
|
|
6707
6719
|
|
|
6708
|
-
var childNodeIndex = 0;
|
|
6709
6720
|
|
|
6710
|
-
|
|
6711
|
-
var childVnode = children[_i23];
|
|
6721
|
+
invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
|
|
6712
6722
|
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
hydrate(childVnode, childNode);
|
|
6716
|
-
childNodeIndex++;
|
|
6717
|
-
}
|
|
6723
|
+
if (hasWireAdapters(vm)) {
|
|
6724
|
+
installWireAdapters(vm);
|
|
6718
6725
|
}
|
|
6719
|
-
}
|
|
6720
|
-
|
|
6721
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
6722
|
-
applyEventListeners(vnode);
|
|
6723
|
-
patchProps(null, vnode);
|
|
6724
|
-
}
|
|
6725
6726
|
|
|
6726
|
-
|
|
6727
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
6727
|
+
return vm;
|
|
6728
6728
|
}
|
|
6729
6729
|
|
|
6730
|
-
function
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
6734
|
-
}
|
|
6735
|
-
}
|
|
6730
|
+
function computeShadowMode(vm) {
|
|
6731
|
+
var def = vm.def;
|
|
6732
|
+
var shadowMode;
|
|
6736
6733
|
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6734
|
+
if (isSyntheticShadowDefined$1) {
|
|
6735
|
+
if (def.renderMode === 0
|
|
6736
|
+
/* Light */
|
|
6737
|
+
) {
|
|
6738
|
+
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
6739
|
+
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
6740
|
+
shadowMode = 0
|
|
6741
|
+
/* Native */
|
|
6742
|
+
;
|
|
6743
|
+
} else if (isNativeShadowDefined$1) {
|
|
6744
|
+
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
6745
|
+
// the if-condition.
|
|
6746
|
+
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
6747
|
+
if (def.shadowSupportMode === "any"
|
|
6748
|
+
/* Any */
|
|
6749
|
+
) {
|
|
6750
|
+
shadowMode = 0
|
|
6751
|
+
/* Native */
|
|
6752
|
+
;
|
|
6753
|
+
} else {
|
|
6754
|
+
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
6742
6755
|
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6756
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
6757
|
+
/* Native */
|
|
6758
|
+
) {
|
|
6759
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
6760
|
+
// transitively opts all of its descendants into native.
|
|
6761
|
+
shadowMode = 0
|
|
6762
|
+
/* Native */
|
|
6763
|
+
;
|
|
6764
|
+
} else {
|
|
6765
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
6766
|
+
// to be native.
|
|
6767
|
+
shadowMode = 1
|
|
6768
|
+
/* Synthetic */
|
|
6769
|
+
;
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
} else {
|
|
6773
|
+
shadowMode = 1
|
|
6774
|
+
/* Synthetic */
|
|
6775
|
+
;
|
|
6776
|
+
}
|
|
6777
|
+
} else {
|
|
6778
|
+
// Synthetic if there is no native Shadow DOM support.
|
|
6779
|
+
shadowMode = 1
|
|
6780
|
+
/* Synthetic */
|
|
6781
|
+
;
|
|
6782
|
+
}
|
|
6783
|
+
} else {
|
|
6784
|
+
// Native if the synthetic shadow polyfill is unavailable.
|
|
6785
|
+
shadowMode = 0
|
|
6786
|
+
/* Native */
|
|
6787
|
+
;
|
|
6750
6788
|
}
|
|
6789
|
+
|
|
6790
|
+
return shadowMode;
|
|
6751
6791
|
}
|
|
6752
6792
|
|
|
6753
|
-
function
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6793
|
+
function assertIsVM(obj) {
|
|
6794
|
+
if (isNull(obj) || !isObject(obj) || !('renderRoot' in obj)) {
|
|
6795
|
+
throw new TypeError("".concat(obj, " is not a VM."));
|
|
6796
|
+
}
|
|
6797
|
+
}
|
|
6758
6798
|
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
attrValue = _Object$entries$_i[1];
|
|
6799
|
+
function associateVM(obj, vm) {
|
|
6800
|
+
ViewModelReflection.set(obj, vm);
|
|
6801
|
+
}
|
|
6763
6802
|
|
|
6764
|
-
|
|
6803
|
+
function getAssociatedVM(obj) {
|
|
6804
|
+
var vm = ViewModelReflection.get(obj);
|
|
6765
6805
|
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
nodesAreCompatible = false;
|
|
6769
|
-
}
|
|
6806
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6807
|
+
assertIsVM(vm);
|
|
6770
6808
|
}
|
|
6771
6809
|
|
|
6772
|
-
return
|
|
6810
|
+
return vm;
|
|
6773
6811
|
}
|
|
6774
6812
|
|
|
6775
|
-
function
|
|
6776
|
-
var
|
|
6777
|
-
className = _vnode$data.className,
|
|
6778
|
-
classMap = _vnode$data.classMap;
|
|
6779
|
-
var nodesAreCompatible = true;
|
|
6780
|
-
var vnodeClassName;
|
|
6813
|
+
function getAssociatedVMIfPresent(obj) {
|
|
6814
|
+
var maybeVm = ViewModelReflection.get(obj);
|
|
6781
6815
|
|
|
6782
|
-
if (
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
}
|
|
6787
|
-
// classMap is used when class is set to static value.
|
|
6788
|
-
var classList = getClassList$1(elm);
|
|
6789
|
-
var computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
6816
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6817
|
+
if (!isUndefined$1(maybeVm)) {
|
|
6818
|
+
assertIsVM(maybeVm);
|
|
6819
|
+
}
|
|
6820
|
+
}
|
|
6790
6821
|
|
|
6791
|
-
|
|
6792
|
-
|
|
6822
|
+
return maybeVm;
|
|
6823
|
+
}
|
|
6793
6824
|
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6825
|
+
function rehydrate(vm) {
|
|
6826
|
+
if (isTrue(vm.isDirty)) {
|
|
6827
|
+
var children = renderComponent(vm);
|
|
6828
|
+
patchShadowRoot(vm, children);
|
|
6829
|
+
}
|
|
6830
|
+
}
|
|
6798
6831
|
|
|
6799
|
-
|
|
6832
|
+
function patchShadowRoot(vm, newCh) {
|
|
6833
|
+
var renderRoot = vm.renderRoot,
|
|
6834
|
+
oldCh = vm.children; // caching the new children collection
|
|
6800
6835
|
|
|
6801
|
-
|
|
6802
|
-
|
|
6836
|
+
vm.children = newCh;
|
|
6837
|
+
|
|
6838
|
+
if (newCh.length > 0 || oldCh.length > 0) {
|
|
6839
|
+
// patch function mutates vnodes by adding the element reference,
|
|
6840
|
+
// however, if patching fails it contains partial changes.
|
|
6841
|
+
if (oldCh !== newCh) {
|
|
6842
|
+
runWithBoundaryProtection(vm, vm, function () {
|
|
6843
|
+
// pre
|
|
6844
|
+
logOperationStart(2
|
|
6845
|
+
/* Patch */
|
|
6846
|
+
, vm);
|
|
6847
|
+
}, function () {
|
|
6848
|
+
// job
|
|
6849
|
+
patchChildren(oldCh, newCh, renderRoot);
|
|
6850
|
+
}, function () {
|
|
6851
|
+
// post
|
|
6852
|
+
logOperationEnd(2
|
|
6853
|
+
/* Patch */
|
|
6854
|
+
, vm);
|
|
6855
|
+
});
|
|
6803
6856
|
}
|
|
6804
6857
|
}
|
|
6805
6858
|
|
|
6806
|
-
if (
|
|
6807
|
-
|
|
6859
|
+
if (vm.state === 1
|
|
6860
|
+
/* connected */
|
|
6861
|
+
) {
|
|
6862
|
+
// If the element is connected, that means connectedCallback was already issued, and
|
|
6863
|
+
// any successive rendering should finish with the call to renderedCallback, otherwise
|
|
6864
|
+
// the connectedCallback will take care of calling it in the right order at the end of
|
|
6865
|
+
// the current rehydration process.
|
|
6866
|
+
runRenderedCallback(vm);
|
|
6808
6867
|
}
|
|
6809
|
-
|
|
6810
|
-
return nodesAreCompatible;
|
|
6811
6868
|
}
|
|
6812
6869
|
|
|
6813
|
-
function
|
|
6814
|
-
var
|
|
6815
|
-
style = _vnode$data2.style,
|
|
6816
|
-
styleDecls = _vnode$data2.styleDecls;
|
|
6817
|
-
var elmStyle = getAttribute$1(elm, 'style') || '';
|
|
6818
|
-
var vnodeStyle;
|
|
6819
|
-
var nodesAreCompatible = true;
|
|
6870
|
+
function runRenderedCallback(vm) {
|
|
6871
|
+
var renderedCallback = vm.def.renderedCallback;
|
|
6820
6872
|
|
|
6821
|
-
if (
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
} else if (!isUndefined$1(styleDecls)) {
|
|
6825
|
-
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6826
|
-
var expectedStyle = []; // styleMap is used when style is set to static value.
|
|
6873
|
+
if (isTrue(ssr$1)) {
|
|
6874
|
+
return;
|
|
6875
|
+
}
|
|
6827
6876
|
|
|
6828
|
-
|
|
6829
|
-
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i25], 3),
|
|
6830
|
-
prop = _styleDecls$_i2[0],
|
|
6831
|
-
value = _styleDecls$_i2[1],
|
|
6832
|
-
important = _styleDecls$_i2[2];
|
|
6877
|
+
var rendered = Services.rendered;
|
|
6833
6878
|
|
|
6834
|
-
|
|
6835
|
-
|
|
6879
|
+
if (rendered) {
|
|
6880
|
+
invokeServiceHook(vm, rendered);
|
|
6881
|
+
}
|
|
6836
6882
|
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6883
|
+
if (!isUndefined$1(renderedCallback)) {
|
|
6884
|
+
logOperationStart(4
|
|
6885
|
+
/* RenderedCallback */
|
|
6886
|
+
, vm);
|
|
6887
|
+
invokeComponentCallback(vm, renderedCallback);
|
|
6888
|
+
logOperationEnd(4
|
|
6889
|
+
/* RenderedCallback */
|
|
6890
|
+
, vm);
|
|
6891
|
+
}
|
|
6892
|
+
}
|
|
6845
6893
|
|
|
6846
|
-
|
|
6847
|
-
nodesAreCompatible = false;
|
|
6848
|
-
}
|
|
6894
|
+
var rehydrateQueue = [];
|
|
6849
6895
|
|
|
6850
|
-
|
|
6851
|
-
|
|
6896
|
+
function flushRehydrationQueue() {
|
|
6897
|
+
logGlobalOperationStart(8
|
|
6898
|
+
/* GlobalRehydrate */
|
|
6899
|
+
);
|
|
6852
6900
|
|
|
6853
|
-
if (
|
|
6854
|
-
|
|
6855
|
-
logError("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
6901
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6902
|
+
assert.invariant(rehydrateQueue.length, "If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ".concat(rehydrateQueue, "."));
|
|
6856
6903
|
}
|
|
6857
6904
|
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
* All rights reserved.
|
|
6863
|
-
* SPDX-License-Identifier: MIT
|
|
6864
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6865
|
-
*/
|
|
6905
|
+
var vms = rehydrateQueue.sort(function (a, b) {
|
|
6906
|
+
return a.idx - b.idx;
|
|
6907
|
+
});
|
|
6908
|
+
rehydrateQueue = []; // reset to a new queue
|
|
6866
6909
|
|
|
6910
|
+
for (var _i23 = 0, _len8 = vms.length; _i23 < _len8; _i23 += 1) {
|
|
6911
|
+
var vm = vms[_i23];
|
|
6867
6912
|
|
|
6868
|
-
|
|
6869
|
-
|
|
6913
|
+
try {
|
|
6914
|
+
rehydrate(vm);
|
|
6915
|
+
} catch (error) {
|
|
6916
|
+
if (_i23 + 1 < _len8) {
|
|
6917
|
+
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6918
|
+
if (rehydrateQueue.length === 0) {
|
|
6919
|
+
addCallbackToNextTick(flushRehydrationQueue);
|
|
6920
|
+
}
|
|
6870
6921
|
|
|
6871
|
-
|
|
6922
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i23 + 1));
|
|
6923
|
+
} // we need to end the measure before throwing.
|
|
6872
6924
|
|
|
6873
|
-
function callHook(cmp, fn) {
|
|
6874
|
-
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
6875
|
-
return fn.apply(cmp, args);
|
|
6876
|
-
}
|
|
6877
6925
|
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6926
|
+
logGlobalOperationEnd(8
|
|
6927
|
+
/* GlobalRehydrate */
|
|
6928
|
+
); // re-throwing the original error will break the current tick, but since the next tick is
|
|
6929
|
+
// already scheduled, it should continue patching the rest.
|
|
6881
6930
|
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6931
|
+
throw error; // eslint-disable-line no-unsafe-finally
|
|
6932
|
+
}
|
|
6933
|
+
}
|
|
6885
6934
|
|
|
6886
|
-
|
|
6887
|
-
|
|
6935
|
+
logGlobalOperationEnd(8
|
|
6936
|
+
/* GlobalRehydrate */
|
|
6937
|
+
);
|
|
6888
6938
|
}
|
|
6889
6939
|
|
|
6890
|
-
function
|
|
6891
|
-
var
|
|
6892
|
-
logGlobalOperationStart(7
|
|
6893
|
-
/* GlobalHydrate */
|
|
6894
|
-
, vm); // Usually means moving the element from one place to another, which is observable via
|
|
6895
|
-
// life-cycle hooks.
|
|
6940
|
+
function runConnectedCallback(vm) {
|
|
6941
|
+
var state = vm.state;
|
|
6896
6942
|
|
|
6897
|
-
if (
|
|
6943
|
+
if (state === 1
|
|
6898
6944
|
/* connected */
|
|
6899
6945
|
) {
|
|
6900
|
-
|
|
6946
|
+
return; // nothing to do since it was already connected
|
|
6901
6947
|
}
|
|
6902
6948
|
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
/* GlobalHydrate */
|
|
6907
|
-
, vm);
|
|
6908
|
-
}
|
|
6949
|
+
vm.state = 1
|
|
6950
|
+
/* connected */
|
|
6951
|
+
; // reporting connection
|
|
6909
6952
|
|
|
6910
|
-
|
|
6911
|
-
var vm = getAssociatedVM(elm);
|
|
6912
|
-
runConnectedCallback(vm);
|
|
6913
|
-
hydrateVM(vm);
|
|
6914
|
-
}
|
|
6953
|
+
var connected = Services.connected;
|
|
6915
6954
|
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6955
|
+
if (connected) {
|
|
6956
|
+
invokeServiceHook(vm, connected);
|
|
6957
|
+
}
|
|
6958
|
+
|
|
6959
|
+
if (hasWireAdapters(vm)) {
|
|
6960
|
+
connectWireAdapters(vm);
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6963
|
+
var connectedCallback = vm.def.connectedCallback;
|
|
6964
|
+
|
|
6965
|
+
if (!isUndefined$1(connectedCallback)) {
|
|
6966
|
+
logOperationStart(3
|
|
6967
|
+
/* ConnectedCallback */
|
|
6968
|
+
, vm);
|
|
6969
|
+
invokeComponentCallback(vm, connectedCallback);
|
|
6970
|
+
logOperationEnd(3
|
|
6971
|
+
/* ConnectedCallback */
|
|
6972
|
+
, vm);
|
|
6973
|
+
}
|
|
6919
6974
|
}
|
|
6920
6975
|
|
|
6921
|
-
function
|
|
6922
|
-
|
|
6976
|
+
function hasWireAdapters(vm) {
|
|
6977
|
+
return getOwnPropertyNames$1(vm.def.wire).length > 0;
|
|
6923
6978
|
}
|
|
6924
6979
|
|
|
6925
|
-
function
|
|
6926
|
-
if (
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
// -> addVnodes.
|
|
6931
|
-
var children = renderComponent(vm);
|
|
6932
|
-
vm.children = children;
|
|
6933
|
-
var vmChildren = vm.renderMode === 0
|
|
6934
|
-
/* Light */
|
|
6935
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
6936
|
-
hydrateChildren(vmChildren, children, vm);
|
|
6937
|
-
runRenderedCallback(vm);
|
|
6980
|
+
function runDisconnectedCallback(vm) {
|
|
6981
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6982
|
+
assert.isTrue(vm.state !== 2
|
|
6983
|
+
/* disconnected */
|
|
6984
|
+
, "".concat(vm, " must be inserted."));
|
|
6938
6985
|
}
|
|
6939
|
-
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6940
|
-
// while preventing any attempt to rehydration until after reinsertion.
|
|
6941
6986
|
|
|
6987
|
+
if (isFalse(vm.isDirty)) {
|
|
6988
|
+
// this guarantees that if the component is reused/reinserted,
|
|
6989
|
+
// it will be re-rendered because we are disconnecting the reactivity
|
|
6990
|
+
// linking, so mutations are not automatically reflected on the state
|
|
6991
|
+
// of disconnected components.
|
|
6992
|
+
vm.isDirty = true;
|
|
6993
|
+
}
|
|
6942
6994
|
|
|
6943
|
-
|
|
6944
|
-
var state = vm.state;
|
|
6945
|
-
|
|
6946
|
-
if (state !== 2
|
|
6995
|
+
vm.state = 2
|
|
6947
6996
|
/* disconnected */
|
|
6948
|
-
|
|
6949
|
-
var oar = vm.oar,
|
|
6950
|
-
tro = vm.tro; // Making sure that any observing record will not trigger the rehydrated on this vm
|
|
6951
|
-
|
|
6952
|
-
tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked
|
|
6997
|
+
; // reporting disconnection
|
|
6953
6998
|
|
|
6954
|
-
|
|
6955
|
-
oar[key].reset();
|
|
6956
|
-
}
|
|
6999
|
+
var disconnected = Services.disconnected;
|
|
6957
7000
|
|
|
6958
|
-
|
|
7001
|
+
if (disconnected) {
|
|
7002
|
+
invokeServiceHook(vm, disconnected);
|
|
7003
|
+
}
|
|
6959
7004
|
|
|
6960
|
-
|
|
6961
|
-
|
|
7005
|
+
if (hasWireAdapters(vm)) {
|
|
7006
|
+
disconnectWireAdapters(vm);
|
|
6962
7007
|
}
|
|
6963
7008
|
|
|
6964
|
-
|
|
6965
|
-
|
|
7009
|
+
var disconnectedCallback = vm.def.disconnectedCallback;
|
|
7010
|
+
|
|
7011
|
+
if (!isUndefined$1(disconnectedCallback)) {
|
|
7012
|
+
logOperationStart(5
|
|
7013
|
+
/* DisconnectedCallback */
|
|
7014
|
+
, vm);
|
|
7015
|
+
invokeComponentCallback(vm, disconnectedCallback);
|
|
7016
|
+
logOperationEnd(5
|
|
7017
|
+
/* DisconnectedCallback */
|
|
7018
|
+
, vm);
|
|
6966
7019
|
}
|
|
6967
|
-
}
|
|
6968
|
-
// old vnode.children is removed from the DOM.
|
|
7020
|
+
}
|
|
6969
7021
|
|
|
7022
|
+
function runChildNodesDisconnectedCallback(vm) {
|
|
7023
|
+
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
7024
|
+
// inserted in reserved order.
|
|
6970
7025
|
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
,
|
|
7026
|
+
for (var _i24 = vCustomElementCollection.length - 1; _i24 >= 0; _i24 -= 1) {
|
|
7027
|
+
var elm = vCustomElementCollection[_i24].elm; // There are two cases where the element could be undefined:
|
|
7028
|
+
// * when there is an error during the construction phase, and an error
|
|
7029
|
+
// boundary picks it, there is a possibility that the VCustomElement
|
|
7030
|
+
// is not properly initialized, and therefore is should be ignored.
|
|
7031
|
+
// * when slotted custom element is not used by the element where it is
|
|
7032
|
+
// slotted into it, as a result, the custom element was never
|
|
7033
|
+
// initialized.
|
|
7034
|
+
|
|
7035
|
+
if (!isUndefined$1(elm)) {
|
|
7036
|
+
var childVM = getAssociatedVMIfPresent(elm); // The VM associated with the element might be associated undefined
|
|
7037
|
+
// in the case where the VM failed in the middle of its creation,
|
|
7038
|
+
// eg: constructor throwing before invoking super().
|
|
7039
|
+
|
|
7040
|
+
if (!isUndefined$1(childVM)) {
|
|
7041
|
+
resetComponentStateWhenRemoved(childVM);
|
|
7042
|
+
}
|
|
7043
|
+
}
|
|
6978
7044
|
}
|
|
7045
|
+
}
|
|
6979
7046
|
|
|
6980
|
-
|
|
7047
|
+
function runLightChildNodesDisconnectedCallback(vm) {
|
|
7048
|
+
var adoptedChildren = vm.aChildren;
|
|
7049
|
+
recursivelyDisconnectChildren(adoptedChildren);
|
|
6981
7050
|
}
|
|
7051
|
+
/**
|
|
7052
|
+
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
7053
|
+
* instead it can be partial, when a custom element vnode is found, we don't
|
|
7054
|
+
* need to continue into its children because by attempting to disconnect the
|
|
7055
|
+
* custom element itself will trigger the removal of anything slotted or anything
|
|
7056
|
+
* defined on its shadow.
|
|
7057
|
+
*/
|
|
6982
7058
|
|
|
6983
|
-
function getNearestShadowAncestor(vm) {
|
|
6984
|
-
var ancestor = vm.owner;
|
|
6985
7059
|
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
7060
|
+
function recursivelyDisconnectChildren(vnodes) {
|
|
7061
|
+
for (var _i25 = 0, _len9 = vnodes.length; _i25 < _len9; _i25 += 1) {
|
|
7062
|
+
var vnode = vnodes[_i25];
|
|
7063
|
+
|
|
7064
|
+
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
7065
|
+
switch (vnode.type) {
|
|
7066
|
+
case 2
|
|
7067
|
+
/* Element */
|
|
7068
|
+
:
|
|
7069
|
+
recursivelyDisconnectChildren(vnode.children);
|
|
7070
|
+
break;
|
|
7071
|
+
|
|
7072
|
+
case 3
|
|
7073
|
+
/* CustomElement */
|
|
7074
|
+
:
|
|
7075
|
+
{
|
|
7076
|
+
var vm = getAssociatedVM(vnode.elm);
|
|
7077
|
+
resetComponentStateWhenRemoved(vm);
|
|
7078
|
+
break;
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
6990
7082
|
}
|
|
7083
|
+
} // This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
7084
|
+
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
7085
|
+
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
7086
|
+
// children VNodes might not be representing the current state of the DOM.
|
|
6991
7087
|
|
|
6992
|
-
return ancestor;
|
|
6993
|
-
}
|
|
6994
7088
|
|
|
6995
|
-
function
|
|
6996
|
-
var
|
|
6997
|
-
|
|
6998
|
-
tagName = options.tagName;
|
|
6999
|
-
var def = getComponentInternalDef(ctor);
|
|
7000
|
-
var vm = {
|
|
7001
|
-
elm: elm,
|
|
7002
|
-
def: def,
|
|
7003
|
-
idx: idx++,
|
|
7004
|
-
state: 0
|
|
7005
|
-
/* created */
|
|
7006
|
-
,
|
|
7007
|
-
isScheduled: false,
|
|
7008
|
-
isDirty: true,
|
|
7009
|
-
tagName: tagName,
|
|
7010
|
-
mode: mode,
|
|
7011
|
-
owner: owner,
|
|
7012
|
-
children: EmptyArray,
|
|
7013
|
-
aChildren: EmptyArray,
|
|
7014
|
-
velements: EmptyArray,
|
|
7015
|
-
cmpProps: create(null),
|
|
7016
|
-
cmpFields: create(null),
|
|
7017
|
-
cmpSlots: create(null),
|
|
7018
|
-
oar: create(null),
|
|
7019
|
-
cmpTemplate: null,
|
|
7020
|
-
renderMode: def.renderMode,
|
|
7021
|
-
context: {
|
|
7022
|
-
stylesheetToken: undefined,
|
|
7023
|
-
hasTokenInClass: undefined,
|
|
7024
|
-
hasTokenInAttribute: undefined,
|
|
7025
|
-
hasScopedStyles: undefined,
|
|
7026
|
-
styleVNode: null,
|
|
7027
|
-
tplCache: EmptyObject,
|
|
7028
|
-
wiredConnecting: EmptyArray,
|
|
7029
|
-
wiredDisconnecting: EmptyArray
|
|
7030
|
-
},
|
|
7031
|
-
// Properties set right after VM creation.
|
|
7032
|
-
tro: null,
|
|
7033
|
-
shadowMode: null,
|
|
7034
|
-
// Properties set by the LightningElement constructor.
|
|
7035
|
-
component: null,
|
|
7036
|
-
shadowRoot: null,
|
|
7037
|
-
renderRoot: null,
|
|
7038
|
-
callHook: callHook,
|
|
7039
|
-
setHook: setHook,
|
|
7040
|
-
getHook: getHook
|
|
7041
|
-
};
|
|
7042
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
7043
|
-
vm.tro = getTemplateReactiveObserver(vm);
|
|
7089
|
+
function resetComponentRoot(vm) {
|
|
7090
|
+
var children = vm.children,
|
|
7091
|
+
renderRoot = vm.renderRoot;
|
|
7044
7092
|
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
|
|
7048
|
-
};
|
|
7093
|
+
for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26++) {
|
|
7094
|
+
var child = children[_i26];
|
|
7049
7095
|
|
|
7050
|
-
if (
|
|
7051
|
-
|
|
7052
|
-
/* Native */
|
|
7053
|
-
;
|
|
7096
|
+
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
7097
|
+
remove$1(child.elm, renderRoot);
|
|
7054
7098
|
}
|
|
7055
|
-
}
|
|
7099
|
+
}
|
|
7056
7100
|
|
|
7101
|
+
vm.children = EmptyArray;
|
|
7102
|
+
runChildNodesDisconnectedCallback(vm);
|
|
7103
|
+
vm.velements = EmptyArray;
|
|
7104
|
+
}
|
|
7057
7105
|
|
|
7058
|
-
|
|
7106
|
+
function scheduleRehydration(vm) {
|
|
7107
|
+
if (isTrue(ssr$1) || isTrue(vm.isScheduled)) {
|
|
7108
|
+
return;
|
|
7109
|
+
}
|
|
7059
7110
|
|
|
7060
|
-
|
|
7061
|
-
|
|
7111
|
+
vm.isScheduled = true;
|
|
7112
|
+
|
|
7113
|
+
if (rehydrateQueue.length === 0) {
|
|
7114
|
+
addCallbackToNextTick(flushRehydrationQueue);
|
|
7062
7115
|
}
|
|
7063
7116
|
|
|
7064
|
-
|
|
7117
|
+
ArrayPush$1.call(rehydrateQueue, vm);
|
|
7065
7118
|
}
|
|
7066
7119
|
|
|
7067
|
-
function
|
|
7068
|
-
var
|
|
7069
|
-
var shadowMode;
|
|
7120
|
+
function getErrorBoundaryVM(vm) {
|
|
7121
|
+
var currentVm = vm;
|
|
7070
7122
|
|
|
7071
|
-
|
|
7072
|
-
if (def.
|
|
7073
|
-
|
|
7074
|
-
) {
|
|
7075
|
-
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
7076
|
-
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
7077
|
-
shadowMode = 0
|
|
7078
|
-
/* Native */
|
|
7079
|
-
;
|
|
7080
|
-
} else if (isNativeShadowDefined$1) {
|
|
7081
|
-
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
7082
|
-
// the if-condition.
|
|
7083
|
-
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
7084
|
-
if (def.shadowSupportMode === "any"
|
|
7085
|
-
/* Any */
|
|
7086
|
-
) {
|
|
7087
|
-
shadowMode = 0
|
|
7088
|
-
/* Native */
|
|
7089
|
-
;
|
|
7090
|
-
} else {
|
|
7091
|
-
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
7092
|
-
|
|
7093
|
-
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
7094
|
-
/* Native */
|
|
7095
|
-
) {
|
|
7096
|
-
// Transitive support for native Shadow DOM. A component in native mode
|
|
7097
|
-
// transitively opts all of its descendants into native.
|
|
7098
|
-
shadowMode = 0
|
|
7099
|
-
/* Native */
|
|
7100
|
-
;
|
|
7101
|
-
} else {
|
|
7102
|
-
// Synthetic if neither this component nor any of its ancestors are configured
|
|
7103
|
-
// to be native.
|
|
7104
|
-
shadowMode = 1
|
|
7105
|
-
/* Synthetic */
|
|
7106
|
-
;
|
|
7107
|
-
}
|
|
7108
|
-
}
|
|
7109
|
-
} else {
|
|
7110
|
-
shadowMode = 1
|
|
7111
|
-
/* Synthetic */
|
|
7112
|
-
;
|
|
7113
|
-
}
|
|
7114
|
-
} else {
|
|
7115
|
-
// Synthetic if there is no native Shadow DOM support.
|
|
7116
|
-
shadowMode = 1
|
|
7117
|
-
/* Synthetic */
|
|
7118
|
-
;
|
|
7123
|
+
while (!isNull(currentVm)) {
|
|
7124
|
+
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
7125
|
+
return currentVm;
|
|
7119
7126
|
}
|
|
7120
|
-
} else {
|
|
7121
|
-
// Native if the synthetic shadow polyfill is unavailable.
|
|
7122
|
-
shadowMode = 0
|
|
7123
|
-
/* Native */
|
|
7124
|
-
;
|
|
7125
|
-
}
|
|
7126
|
-
|
|
7127
|
-
return shadowMode;
|
|
7128
|
-
}
|
|
7129
7127
|
|
|
7130
|
-
|
|
7131
|
-
if (isNull(obj) || !isObject(obj) || !('renderRoot' in obj)) {
|
|
7132
|
-
throw new TypeError("".concat(obj, " is not a VM."));
|
|
7128
|
+
currentVm = currentVm.owner;
|
|
7133
7129
|
}
|
|
7134
7130
|
}
|
|
7135
7131
|
|
|
7136
|
-
function
|
|
7137
|
-
|
|
7138
|
-
|
|
7132
|
+
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
7133
|
+
var error;
|
|
7134
|
+
pre();
|
|
7139
7135
|
|
|
7140
|
-
|
|
7141
|
-
|
|
7136
|
+
try {
|
|
7137
|
+
job();
|
|
7138
|
+
} catch (e) {
|
|
7139
|
+
error = Object(e);
|
|
7140
|
+
} finally {
|
|
7141
|
+
post();
|
|
7142
7142
|
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7143
|
+
if (!isUndefined$1(error)) {
|
|
7144
|
+
addErrorComponentStack(vm, error);
|
|
7145
|
+
var errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
7146
7146
|
|
|
7147
|
-
|
|
7148
|
-
|
|
7147
|
+
if (isUndefined$1(errorBoundaryVm)) {
|
|
7148
|
+
throw error; // eslint-disable-line no-unsafe-finally
|
|
7149
|
+
}
|
|
7149
7150
|
|
|
7150
|
-
|
|
7151
|
-
var maybeVm = ViewModelReflection.get(obj);
|
|
7151
|
+
resetComponentRoot(vm); // remove offenders
|
|
7152
7152
|
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7153
|
+
logOperationStart(6
|
|
7154
|
+
/* ErrorCallback */
|
|
7155
|
+
, vm); // error boundaries must have an ErrorCallback
|
|
7156
|
+
|
|
7157
|
+
var errorCallback = errorBoundaryVm.def.errorCallback;
|
|
7158
|
+
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
7159
|
+
logOperationEnd(6
|
|
7160
|
+
/* ErrorCallback */
|
|
7161
|
+
, vm);
|
|
7156
7162
|
}
|
|
7157
7163
|
}
|
|
7158
|
-
|
|
7159
|
-
return maybeVm;
|
|
7160
7164
|
}
|
|
7161
7165
|
|
|
7162
|
-
function
|
|
7163
|
-
if
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
+
function forceRehydration(vm) {
|
|
7167
|
+
// if we must reset the shadowRoot content and render the template
|
|
7168
|
+
// from scratch on an active instance, the way to force the reset
|
|
7169
|
+
// is by replacing the value of old template, which is used during
|
|
7170
|
+
// to determine if the template has changed or not during the rendering
|
|
7171
|
+
// process. If the template returned by render() is different from the
|
|
7172
|
+
// previous stored template, the styles will be reset, along with the
|
|
7173
|
+
// content of the shadowRoot, this way we can guarantee that all children
|
|
7174
|
+
// elements will be throw away, and new instances will be created.
|
|
7175
|
+
vm.cmpTemplate = function () {
|
|
7176
|
+
return [];
|
|
7177
|
+
};
|
|
7178
|
+
|
|
7179
|
+
if (isFalse(vm.isDirty)) {
|
|
7180
|
+
// forcing the vm to rehydrate in the next tick
|
|
7181
|
+
markComponentAsDirty(vm);
|
|
7182
|
+
scheduleRehydration(vm);
|
|
7166
7183
|
}
|
|
7167
7184
|
}
|
|
7185
|
+
/*
|
|
7186
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7187
|
+
* All rights reserved.
|
|
7188
|
+
* SPDX-License-Identifier: MIT
|
|
7189
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7190
|
+
*/
|
|
7168
7191
|
|
|
7169
|
-
function patchShadowRoot(vm, newCh) {
|
|
7170
|
-
var renderRoot = vm.renderRoot,
|
|
7171
|
-
oldCh = vm.children; // caching the new children collection
|
|
7172
|
-
|
|
7173
|
-
vm.children = newCh;
|
|
7174
7192
|
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
if (oldCh !== newCh) {
|
|
7179
|
-
runWithBoundaryProtection(vm, vm, function () {
|
|
7180
|
-
// pre
|
|
7181
|
-
logOperationStart(2
|
|
7182
|
-
/* Patch */
|
|
7183
|
-
, vm);
|
|
7184
|
-
}, function () {
|
|
7185
|
-
// job
|
|
7186
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
7187
|
-
}, function () {
|
|
7188
|
-
// post
|
|
7189
|
-
logOperationEnd(2
|
|
7190
|
-
/* Patch */
|
|
7191
|
-
, vm);
|
|
7192
|
-
});
|
|
7193
|
-
}
|
|
7194
|
-
}
|
|
7193
|
+
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
7194
|
+
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
7195
|
+
var WireMetaMap = new Map();
|
|
7195
7196
|
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
) {
|
|
7199
|
-
// If the element is connected, that means connectedCallback was already issued, and
|
|
7200
|
-
// any successive rendering should finish with the call to renderedCallback, otherwise
|
|
7201
|
-
// the connectedCallback will take care of calling it in the right order at the end of
|
|
7202
|
-
// the current rehydration process.
|
|
7203
|
-
runRenderedCallback(vm);
|
|
7204
|
-
}
|
|
7205
|
-
}
|
|
7197
|
+
var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
|
|
7198
|
+
_inherits(WireContextRegistrationEvent, _CustomEvent);
|
|
7206
7199
|
|
|
7207
|
-
|
|
7208
|
-
var renderedCallback = vm.def.renderedCallback;
|
|
7200
|
+
var _super6 = _createSuper(WireContextRegistrationEvent);
|
|
7209
7201
|
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
}
|
|
7202
|
+
function WireContextRegistrationEvent(adapterToken, _ref3) {
|
|
7203
|
+
var _this5;
|
|
7213
7204
|
|
|
7214
|
-
|
|
7205
|
+
var setNewContext = _ref3.setNewContext,
|
|
7206
|
+
setDisconnectedCallback = _ref3.setDisconnectedCallback;
|
|
7215
7207
|
|
|
7216
|
-
|
|
7217
|
-
invokeServiceHook(vm, rendered);
|
|
7218
|
-
}
|
|
7208
|
+
_classCallCheck(this, WireContextRegistrationEvent);
|
|
7219
7209
|
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7210
|
+
_this5 = _super6.call(this, adapterToken, {
|
|
7211
|
+
bubbles: true,
|
|
7212
|
+
composed: true
|
|
7213
|
+
});
|
|
7214
|
+
defineProperties(_assertThisInitialized(_this5), {
|
|
7215
|
+
setNewContext: {
|
|
7216
|
+
value: setNewContext
|
|
7217
|
+
},
|
|
7218
|
+
setDisconnectedCallback: {
|
|
7219
|
+
value: setDisconnectedCallback
|
|
7220
|
+
}
|
|
7221
|
+
});
|
|
7222
|
+
return _this5;
|
|
7228
7223
|
}
|
|
7229
|
-
}
|
|
7230
7224
|
|
|
7231
|
-
|
|
7225
|
+
return _createClass(WireContextRegistrationEvent);
|
|
7226
|
+
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
7232
7227
|
|
|
7233
|
-
function
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7228
|
+
function createFieldDataCallback(vm, name) {
|
|
7229
|
+
var cmpFields = vm.cmpFields;
|
|
7230
|
+
return function (value) {
|
|
7231
|
+
if (value !== vm.cmpFields[name]) {
|
|
7232
|
+
// storing the value in the underlying storage
|
|
7233
|
+
cmpFields[name] = value;
|
|
7234
|
+
componentValueMutated(vm, name);
|
|
7235
|
+
}
|
|
7236
|
+
};
|
|
7237
|
+
}
|
|
7237
7238
|
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7239
|
+
function createMethodDataCallback(vm, method) {
|
|
7240
|
+
return function (value) {
|
|
7241
|
+
// dispatching new value into the wired method
|
|
7242
|
+
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
7243
|
+
// job
|
|
7244
|
+
method.call(vm.component, value);
|
|
7245
|
+
}, noop);
|
|
7246
|
+
};
|
|
7247
|
+
}
|
|
7241
7248
|
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
});
|
|
7245
|
-
rehydrateQueue = []; // reset to a new queue
|
|
7249
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
7250
|
+
var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
|
|
7246
7251
|
|
|
7247
|
-
|
|
7248
|
-
|
|
7252
|
+
var ro = new ReactiveObserver(function () {
|
|
7253
|
+
if (hasPendingConfig === false) {
|
|
7254
|
+
hasPendingConfig = true; // collect new config in the micro-task
|
|
7249
7255
|
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
} catch (error) {
|
|
7253
|
-
if (_i26 + 1 < _len8) {
|
|
7254
|
-
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
7255
|
-
if (rehydrateQueue.length === 0) {
|
|
7256
|
-
addCallbackToNextTick(flushRehydrationQueue);
|
|
7257
|
-
}
|
|
7256
|
+
Promise.resolve().then(function () {
|
|
7257
|
+
hasPendingConfig = false; // resetting current reactive params
|
|
7258
7258
|
|
|
7259
|
-
|
|
7260
|
-
} // we need to end the measure before throwing.
|
|
7259
|
+
ro.reset(); // dispatching a new config due to a change in the configuration
|
|
7261
7260
|
|
|
7261
|
+
computeConfigAndUpdate();
|
|
7262
|
+
});
|
|
7263
|
+
}
|
|
7264
|
+
});
|
|
7262
7265
|
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7266
|
+
var computeConfigAndUpdate = function computeConfigAndUpdate() {
|
|
7267
|
+
var config;
|
|
7268
|
+
ro.observe(function () {
|
|
7269
|
+
return config = configCallback(component);
|
|
7270
|
+
}); // eslint-disable-next-line lwc-internal/no-invalid-todo
|
|
7271
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
7272
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
7267
7273
|
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
}
|
|
7274
|
+
callbackWhenConfigIsReady(config);
|
|
7275
|
+
};
|
|
7271
7276
|
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7277
|
+
return {
|
|
7278
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
7279
|
+
ro: ro
|
|
7280
|
+
};
|
|
7275
7281
|
}
|
|
7276
7282
|
|
|
7277
|
-
function
|
|
7278
|
-
var
|
|
7283
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
7284
|
+
var adapter = wireDef.adapter;
|
|
7285
|
+
var adapterContextToken = getAdapterToken(adapter);
|
|
7279
7286
|
|
|
7280
|
-
if (
|
|
7281
|
-
|
|
7282
|
-
) {
|
|
7283
|
-
return; // nothing to do since it was already connected
|
|
7287
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
7288
|
+
return; // no provider found, nothing to be done
|
|
7284
7289
|
}
|
|
7285
7290
|
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
var connected = Services.connected;
|
|
7291
|
-
|
|
7292
|
-
if (connected) {
|
|
7293
|
-
invokeServiceHook(vm, connected);
|
|
7294
|
-
}
|
|
7291
|
+
var elm = vm.elm,
|
|
7292
|
+
_vm$context = vm.context,
|
|
7293
|
+
wiredConnecting = _vm$context.wiredConnecting,
|
|
7294
|
+
wiredDisconnecting = _vm$context.wiredDisconnecting; // waiting for the component to be connected to formally request the context via the token
|
|
7295
7295
|
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7296
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
7297
|
+
// This event is responsible for connecting the host element with another
|
|
7298
|
+
// element in the composed path that is providing contextual data. The provider
|
|
7299
|
+
// must be listening for a special dom event with the name corresponding to the value of
|
|
7300
|
+
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
7301
|
+
// guarantee that the linkage can be forged.
|
|
7302
|
+
var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
7303
|
+
setNewContext: function setNewContext(newContext) {
|
|
7304
|
+
// eslint-disable-next-line lwc-internal/no-invalid-todo
|
|
7305
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
7306
|
+
callbackWhenContextIsReady(newContext);
|
|
7307
|
+
},
|
|
7308
|
+
setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
|
|
7309
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
7310
|
+
// the the element hosting the wire is disconnected
|
|
7311
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
7312
|
+
}
|
|
7313
|
+
});
|
|
7314
|
+
dispatchEvent$1(elm, contextRegistrationEvent);
|
|
7315
|
+
});
|
|
7316
|
+
}
|
|
7299
7317
|
|
|
7300
|
-
|
|
7318
|
+
function createConnector(vm, name, wireDef) {
|
|
7319
|
+
var method = wireDef.method,
|
|
7320
|
+
adapter = wireDef.adapter,
|
|
7321
|
+
configCallback = wireDef.configCallback,
|
|
7322
|
+
dynamic = wireDef.dynamic;
|
|
7323
|
+
var dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
7324
|
+
var context;
|
|
7325
|
+
var connector; // Workaround to pass the component element associated to this wire adapter instance.
|
|
7301
7326
|
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7327
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
7328
|
+
value: vm.elm
|
|
7329
|
+
});
|
|
7330
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
7331
|
+
value: dynamic
|
|
7332
|
+
});
|
|
7333
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7334
|
+
// job
|
|
7335
|
+
connector = new adapter(dataCallback);
|
|
7336
|
+
}, noop);
|
|
7312
7337
|
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7338
|
+
var updateConnectorConfig = function updateConnectorConfig(config) {
|
|
7339
|
+
// every time the config is recomputed due to tracking,
|
|
7340
|
+
// this callback will be invoked with the new computed config
|
|
7341
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7342
|
+
// job
|
|
7343
|
+
connector.update(config, context);
|
|
7344
|
+
}, noop);
|
|
7345
|
+
}; // Computes the current wire config and calls the update method on the wire adapter.
|
|
7346
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
7316
7347
|
|
|
7317
|
-
function runDisconnectedCallback(vm) {
|
|
7318
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7319
|
-
assert.isTrue(vm.state !== 2
|
|
7320
|
-
/* disconnected */
|
|
7321
|
-
, "".concat(vm, " must be inserted."));
|
|
7322
|
-
}
|
|
7323
7348
|
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
// linking, so mutations are not automatically reflected on the state
|
|
7328
|
-
// of disconnected components.
|
|
7329
|
-
vm.isDirty = true;
|
|
7330
|
-
}
|
|
7349
|
+
var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
|
|
7350
|
+
computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
|
|
7351
|
+
ro = _createConfigWatcher.ro; // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
7331
7352
|
|
|
7332
|
-
vm.state = 2
|
|
7333
|
-
/* disconnected */
|
|
7334
|
-
; // reporting disconnection
|
|
7335
7353
|
|
|
7336
|
-
|
|
7354
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
7355
|
+
createContextWatcher(vm, wireDef, function (newContext) {
|
|
7356
|
+
// every time the context is pushed into this component,
|
|
7357
|
+
// this callback will be invoked with the new computed context
|
|
7358
|
+
if (context !== newContext) {
|
|
7359
|
+
context = newContext; // Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
7360
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
7361
|
+
// (ever), while context can have identity
|
|
7337
7362
|
|
|
7338
|
-
|
|
7339
|
-
|
|
7363
|
+
if (vm.state === 1
|
|
7364
|
+
/* connected */
|
|
7365
|
+
) {
|
|
7366
|
+
computeConfigAndUpdate();
|
|
7367
|
+
}
|
|
7368
|
+
}
|
|
7369
|
+
});
|
|
7340
7370
|
}
|
|
7341
7371
|
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7372
|
+
return {
|
|
7373
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
7374
|
+
connector: connector,
|
|
7375
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
7376
|
+
resetConfigWatcher: function resetConfigWatcher() {
|
|
7377
|
+
return ro.reset();
|
|
7378
|
+
}
|
|
7379
|
+
};
|
|
7380
|
+
}
|
|
7345
7381
|
|
|
7346
|
-
|
|
7382
|
+
var AdapterToTokenMap = new Map();
|
|
7347
7383
|
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
/* DisconnectedCallback */
|
|
7351
|
-
, vm);
|
|
7352
|
-
invokeComponentCallback(vm, disconnectedCallback);
|
|
7353
|
-
logOperationEnd(5
|
|
7354
|
-
/* DisconnectedCallback */
|
|
7355
|
-
, vm);
|
|
7356
|
-
}
|
|
7384
|
+
function getAdapterToken(adapter) {
|
|
7385
|
+
return AdapterToTokenMap.get(adapter);
|
|
7357
7386
|
}
|
|
7358
7387
|
|
|
7359
|
-
function
|
|
7360
|
-
|
|
7361
|
-
|
|
7388
|
+
function setAdapterToken(adapter, token) {
|
|
7389
|
+
AdapterToTokenMap.set(adapter, token);
|
|
7390
|
+
}
|
|
7362
7391
|
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
// * when slotted custom element is not used by the element where it is
|
|
7369
|
-
// slotted into it, as a result, the custom element was never
|
|
7370
|
-
// initialized.
|
|
7392
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
7393
|
+
// support for callable adapters
|
|
7394
|
+
if (adapter.adapter) {
|
|
7395
|
+
adapter = adapter.adapter;
|
|
7396
|
+
}
|
|
7371
7397
|
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7398
|
+
var method = descriptor.value;
|
|
7399
|
+
var def = {
|
|
7400
|
+
adapter: adapter,
|
|
7401
|
+
method: method,
|
|
7402
|
+
configCallback: configCallback,
|
|
7403
|
+
dynamic: dynamic
|
|
7404
|
+
};
|
|
7405
|
+
WireMetaMap.set(descriptor, def);
|
|
7406
|
+
}
|
|
7376
7407
|
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7408
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
7409
|
+
// support for callable adapters
|
|
7410
|
+
if (adapter.adapter) {
|
|
7411
|
+
adapter = adapter.adapter;
|
|
7381
7412
|
}
|
|
7382
|
-
}
|
|
7383
7413
|
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7414
|
+
var def = {
|
|
7415
|
+
adapter: adapter,
|
|
7416
|
+
configCallback: configCallback,
|
|
7417
|
+
dynamic: dynamic
|
|
7418
|
+
};
|
|
7419
|
+
WireMetaMap.set(descriptor, def);
|
|
7387
7420
|
}
|
|
7388
|
-
/**
|
|
7389
|
-
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
7390
|
-
* instead it can be partial, when a custom element vnode is found, we don't
|
|
7391
|
-
* need to continue into its children because by attempting to disconnect the
|
|
7392
|
-
* custom element itself will trigger the removal of anything slotted or anything
|
|
7393
|
-
* defined on its shadow.
|
|
7394
|
-
*/
|
|
7395
|
-
|
|
7396
7421
|
|
|
7397
|
-
function
|
|
7398
|
-
|
|
7399
|
-
|
|
7422
|
+
function installWireAdapters(vm) {
|
|
7423
|
+
var context = vm.context,
|
|
7424
|
+
wire = vm.def.wire;
|
|
7425
|
+
var wiredConnecting = context.wiredConnecting = [];
|
|
7426
|
+
var wiredDisconnecting = context.wiredDisconnecting = [];
|
|
7400
7427
|
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
/* Element */
|
|
7405
|
-
:
|
|
7406
|
-
recursivelyDisconnectChildren(vnode.children);
|
|
7407
|
-
break;
|
|
7428
|
+
for (var fieldNameOrMethod in wire) {
|
|
7429
|
+
var descriptor = wire[fieldNameOrMethod];
|
|
7430
|
+
var wireDef = WireMetaMap.get(descriptor);
|
|
7408
7431
|
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
:
|
|
7412
|
-
{
|
|
7413
|
-
var vm = getAssociatedVM(vnode.elm);
|
|
7414
|
-
resetComponentStateWhenRemoved(vm);
|
|
7415
|
-
break;
|
|
7416
|
-
}
|
|
7417
|
-
}
|
|
7432
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7433
|
+
assert.invariant(wireDef, "Internal Error: invalid wire definition found.");
|
|
7418
7434
|
}
|
|
7419
|
-
}
|
|
7420
|
-
} // This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
7421
|
-
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
7422
|
-
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
7423
|
-
// children VNodes might not be representing the current state of the DOM.
|
|
7424
7435
|
|
|
7436
|
+
if (!isUndefined$1(wireDef)) {
|
|
7437
|
+
(function () {
|
|
7438
|
+
var _createConnector = createConnector(vm, fieldNameOrMethod, wireDef),
|
|
7439
|
+
connector = _createConnector.connector,
|
|
7440
|
+
computeConfigAndUpdate = _createConnector.computeConfigAndUpdate,
|
|
7441
|
+
resetConfigWatcher = _createConnector.resetConfigWatcher;
|
|
7425
7442
|
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7443
|
+
var hasDynamicParams = wireDef.dynamic.length > 0;
|
|
7444
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
7445
|
+
connector.connect();
|
|
7429
7446
|
|
|
7430
|
-
|
|
7431
|
-
|
|
7447
|
+
if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
7448
|
+
if (hasDynamicParams) {
|
|
7449
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
7450
|
+
return;
|
|
7451
|
+
}
|
|
7452
|
+
}
|
|
7432
7453
|
|
|
7433
|
-
|
|
7434
|
-
|
|
7454
|
+
computeConfigAndUpdate();
|
|
7455
|
+
});
|
|
7456
|
+
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
7457
|
+
connector.disconnect();
|
|
7458
|
+
resetConfigWatcher();
|
|
7459
|
+
});
|
|
7460
|
+
})();
|
|
7435
7461
|
}
|
|
7436
7462
|
}
|
|
7437
|
-
|
|
7438
|
-
vm.children = EmptyArray;
|
|
7439
|
-
runChildNodesDisconnectedCallback(vm);
|
|
7440
|
-
vm.velements = EmptyArray;
|
|
7441
7463
|
}
|
|
7442
7464
|
|
|
7443
|
-
function
|
|
7444
|
-
|
|
7445
|
-
return;
|
|
7446
|
-
}
|
|
7447
|
-
|
|
7448
|
-
vm.isScheduled = true;
|
|
7465
|
+
function connectWireAdapters(vm) {
|
|
7466
|
+
var wiredConnecting = vm.context.wiredConnecting;
|
|
7449
7467
|
|
|
7450
|
-
|
|
7451
|
-
|
|
7468
|
+
for (var _i27 = 0, _len11 = wiredConnecting.length; _i27 < _len11; _i27 += 1) {
|
|
7469
|
+
wiredConnecting[_i27]();
|
|
7452
7470
|
}
|
|
7453
|
-
|
|
7454
|
-
ArrayPush$1.call(rehydrateQueue, vm);
|
|
7455
7471
|
}
|
|
7456
7472
|
|
|
7457
|
-
function
|
|
7458
|
-
var
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7473
|
+
function disconnectWireAdapters(vm) {
|
|
7474
|
+
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
7475
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7476
|
+
// job
|
|
7477
|
+
for (var _i28 = 0, _len12 = wiredDisconnecting.length; _i28 < _len12; _i28 += 1) {
|
|
7478
|
+
wiredDisconnecting[_i28]();
|
|
7463
7479
|
}
|
|
7464
|
-
|
|
7465
|
-
currentVm = currentVm.owner;
|
|
7466
|
-
}
|
|
7480
|
+
}, noop);
|
|
7467
7481
|
}
|
|
7482
|
+
/*
|
|
7483
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7484
|
+
* All rights reserved.
|
|
7485
|
+
* SPDX-License-Identifier: MIT
|
|
7486
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7487
|
+
*/
|
|
7488
|
+
// this is lwc internal implementation
|
|
7468
7489
|
|
|
7469
|
-
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
7470
|
-
var error;
|
|
7471
|
-
pre();
|
|
7472
7490
|
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
} catch (e) {
|
|
7476
|
-
error = Object(e);
|
|
7477
|
-
} finally {
|
|
7478
|
-
post();
|
|
7491
|
+
function createContextProvider(adapter) {
|
|
7492
|
+
var adapterContextToken = getAdapterToken(adapter);
|
|
7479
7493
|
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7494
|
+
if (!isUndefined$1(adapterContextToken)) {
|
|
7495
|
+
throw new Error("Adapter already has a context provider.");
|
|
7496
|
+
}
|
|
7483
7497
|
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7498
|
+
adapterContextToken = guid();
|
|
7499
|
+
setAdapterToken(adapter, adapterContextToken);
|
|
7500
|
+
var providers = new WeakSet();
|
|
7501
|
+
return function (elm, options) {
|
|
7502
|
+
if (providers.has(elm)) {
|
|
7503
|
+
throw new Error("Adapter was already installed on ".concat(elm, "."));
|
|
7504
|
+
}
|
|
7487
7505
|
|
|
7488
|
-
|
|
7506
|
+
providers.add(elm);
|
|
7507
|
+
var consumerConnectedCallback = options.consumerConnectedCallback,
|
|
7508
|
+
consumerDisconnectedCallback = options.consumerDisconnectedCallback;
|
|
7509
|
+
elm.addEventListener(adapterContextToken, function (evt) {
|
|
7510
|
+
var setNewContext = evt.setNewContext,
|
|
7511
|
+
setDisconnectedCallback = evt.setDisconnectedCallback;
|
|
7512
|
+
var consumer = {
|
|
7513
|
+
provide: function provide(newContext) {
|
|
7514
|
+
setNewContext(newContext);
|
|
7515
|
+
}
|
|
7516
|
+
};
|
|
7489
7517
|
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7518
|
+
var disconnectCallback = function disconnectCallback() {
|
|
7519
|
+
if (!isUndefined$1(consumerDisconnectedCallback)) {
|
|
7520
|
+
consumerDisconnectedCallback(consumer);
|
|
7521
|
+
}
|
|
7522
|
+
};
|
|
7493
7523
|
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
}
|
|
7500
|
-
}
|
|
7524
|
+
setDisconnectedCallback(disconnectCallback);
|
|
7525
|
+
consumerConnectedCallback(consumer);
|
|
7526
|
+
evt.stopImmediatePropagation();
|
|
7527
|
+
});
|
|
7528
|
+
};
|
|
7501
7529
|
}
|
|
7530
|
+
/*
|
|
7531
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7532
|
+
* All rights reserved.
|
|
7533
|
+
* SPDX-License-Identifier: MIT
|
|
7534
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7535
|
+
*/
|
|
7502
7536
|
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
// process. If the template returned by render() is different from the
|
|
7509
|
-
// previous stored template, the styles will be reset, along with the
|
|
7510
|
-
// content of the shadowRoot, this way we can guarantee that all children
|
|
7511
|
-
// elements will be throw away, and new instances will be created.
|
|
7512
|
-
vm.cmpTemplate = function () {
|
|
7513
|
-
return [];
|
|
7514
|
-
};
|
|
7537
|
+
/**
|
|
7538
|
+
* EXPERIMENTAL: This function allows you to create a reactive readonly
|
|
7539
|
+
* membrane around any object value. This API is subject to change or
|
|
7540
|
+
* being removed.
|
|
7541
|
+
*/
|
|
7515
7542
|
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7543
|
+
|
|
7544
|
+
function readonly(obj) {
|
|
7545
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7546
|
+
// TODO [#1292]: Remove the readonly decorator
|
|
7547
|
+
if (arguments.length !== 1) {
|
|
7548
|
+
assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
|
|
7549
|
+
}
|
|
7520
7550
|
}
|
|
7551
|
+
|
|
7552
|
+
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
7521
7553
|
}
|
|
7522
7554
|
/*
|
|
7523
|
-
* Copyright (c)
|
|
7555
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
7524
7556
|
* All rights reserved.
|
|
7525
7557
|
* SPDX-License-Identifier: MIT
|
|
7526
7558
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7527
7559
|
*/
|
|
7560
|
+
// flag indicating if the hydration recovered from the DOM mismatch
|
|
7528
7561
|
|
|
7529
7562
|
|
|
7530
|
-
var
|
|
7531
|
-
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
7532
|
-
var WireMetaMap = new Map();
|
|
7563
|
+
var hasMismatch = false;
|
|
7533
7564
|
|
|
7534
|
-
|
|
7535
|
-
|
|
7565
|
+
function hydrateRoot(vm) {
|
|
7566
|
+
hasMismatch = false;
|
|
7567
|
+
runConnectedCallback(vm);
|
|
7568
|
+
hydrateVM(vm);
|
|
7536
7569
|
|
|
7537
|
-
|
|
7570
|
+
if (hasMismatch) {
|
|
7571
|
+
logError('Hydration completed with errors.', vm);
|
|
7572
|
+
}
|
|
7573
|
+
}
|
|
7538
7574
|
|
|
7539
|
-
|
|
7540
|
-
|
|
7575
|
+
function hydrateVM(vm) {
|
|
7576
|
+
var children = renderComponent(vm);
|
|
7577
|
+
vm.children = children;
|
|
7578
|
+
var parentNode = vm.renderRoot;
|
|
7579
|
+
hydrateChildren(getFirstChild$1(parentNode), children, parentNode, vm);
|
|
7580
|
+
runRenderedCallback(vm);
|
|
7581
|
+
}
|
|
7541
7582
|
|
|
7542
|
-
|
|
7543
|
-
|
|
7583
|
+
function hydrateNode(node, vnode) {
|
|
7584
|
+
var hydratedNode;
|
|
7544
7585
|
|
|
7545
|
-
|
|
7586
|
+
switch (vnode.type) {
|
|
7587
|
+
case 0
|
|
7588
|
+
/* Text */
|
|
7589
|
+
:
|
|
7590
|
+
hydratedNode = hydrateText(node, vnode);
|
|
7591
|
+
break;
|
|
7546
7592
|
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7593
|
+
case 1
|
|
7594
|
+
/* Comment */
|
|
7595
|
+
:
|
|
7596
|
+
hydratedNode = hydrateComment(node, vnode);
|
|
7597
|
+
break;
|
|
7598
|
+
|
|
7599
|
+
case 2
|
|
7600
|
+
/* Element */
|
|
7601
|
+
:
|
|
7602
|
+
hydratedNode = hydrateElement(node, vnode);
|
|
7603
|
+
break;
|
|
7604
|
+
|
|
7605
|
+
case 3
|
|
7606
|
+
/* CustomElement */
|
|
7607
|
+
:
|
|
7608
|
+
hydratedNode = hydrateCustomElement(node, vnode);
|
|
7609
|
+
break;
|
|
7560
7610
|
}
|
|
7561
7611
|
|
|
7562
|
-
return
|
|
7563
|
-
}
|
|
7612
|
+
return nextSibling$1(hydratedNode);
|
|
7613
|
+
}
|
|
7564
7614
|
|
|
7565
|
-
function
|
|
7566
|
-
var
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7615
|
+
function hydrateText(node, vnode) {
|
|
7616
|
+
var _a;
|
|
7617
|
+
|
|
7618
|
+
if (!hasCorrectNodeType(vnode, node, 3
|
|
7619
|
+
/* TEXT */
|
|
7620
|
+
)) {
|
|
7621
|
+
return handleMismatch(node, vnode);
|
|
7622
|
+
}
|
|
7623
|
+
|
|
7624
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7625
|
+
var nodeValue = getProperty$1(node, 'nodeValue');
|
|
7626
|
+
|
|
7627
|
+
if (nodeValue !== vnode.text && !(nodeValue === "\u200D" && vnode.text === '')) {
|
|
7628
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
7572
7629
|
}
|
|
7573
|
-
}
|
|
7574
|
-
}
|
|
7630
|
+
}
|
|
7575
7631
|
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
7580
|
-
// job
|
|
7581
|
-
method.call(vm.component, value);
|
|
7582
|
-
}, noop);
|
|
7583
|
-
};
|
|
7632
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
7633
|
+
vnode.elm = node;
|
|
7634
|
+
return node;
|
|
7584
7635
|
}
|
|
7585
7636
|
|
|
7586
|
-
function
|
|
7587
|
-
var
|
|
7588
|
-
|
|
7589
|
-
var ro = new ReactiveObserver(function () {
|
|
7590
|
-
if (hasPendingConfig === false) {
|
|
7591
|
-
hasPendingConfig = true; // collect new config in the micro-task
|
|
7637
|
+
function hydrateComment(node, vnode) {
|
|
7638
|
+
var _a;
|
|
7592
7639
|
|
|
7593
|
-
|
|
7594
|
-
|
|
7640
|
+
if (!hasCorrectNodeType(vnode, node, 8
|
|
7641
|
+
/* COMMENT */
|
|
7642
|
+
)) {
|
|
7643
|
+
return handleMismatch(node, vnode);
|
|
7644
|
+
}
|
|
7595
7645
|
|
|
7596
|
-
|
|
7646
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7647
|
+
var nodeValue = getProperty$1(node, 'nodeValue');
|
|
7597
7648
|
|
|
7598
|
-
|
|
7599
|
-
|
|
7649
|
+
if (nodeValue !== vnode.text) {
|
|
7650
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
7600
7651
|
}
|
|
7601
|
-
}
|
|
7652
|
+
}
|
|
7602
7653
|
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
}); // eslint-disable-next-line lwc-internal/no-invalid-todo
|
|
7608
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
7609
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
7654
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
7655
|
+
vnode.elm = node;
|
|
7656
|
+
return node;
|
|
7657
|
+
}
|
|
7610
7658
|
|
|
7611
|
-
|
|
7612
|
-
|
|
7659
|
+
function hydrateElement(elm, vnode) {
|
|
7660
|
+
if (!hasCorrectNodeType(vnode, elm, 1
|
|
7661
|
+
/* ELEMENT */
|
|
7662
|
+
) || !isMatchingElement(vnode, elm)) {
|
|
7663
|
+
return handleMismatch(elm, vnode);
|
|
7664
|
+
}
|
|
7613
7665
|
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7666
|
+
vnode.elm = elm;
|
|
7667
|
+
var context = vnode.data.context;
|
|
7668
|
+
var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
7669
|
+
/* Manual */
|
|
7670
|
+
);
|
|
7619
7671
|
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7672
|
+
if (isDomManual) {
|
|
7673
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
7674
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
7675
|
+
var props = vnode.data.props;
|
|
7623
7676
|
|
|
7624
|
-
|
|
7625
|
-
|
|
7677
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
7678
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
7679
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
7680
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), {
|
|
7681
|
+
props: cloneAndOmitKey(props, 'innerHTML')
|
|
7682
|
+
});
|
|
7683
|
+
} else {
|
|
7684
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7685
|
+
logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
7686
|
+
}
|
|
7687
|
+
}
|
|
7688
|
+
}
|
|
7626
7689
|
}
|
|
7627
7690
|
|
|
7628
|
-
|
|
7629
|
-
_vm$context = vm.context,
|
|
7630
|
-
wiredConnecting = _vm$context.wiredConnecting,
|
|
7631
|
-
wiredDisconnecting = _vm$context.wiredDisconnecting; // waiting for the component to be connected to formally request the context via the token
|
|
7691
|
+
patchElementPropsAndAttrs(vnode);
|
|
7632
7692
|
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
// guarantee that the linkage can be forged.
|
|
7639
|
-
var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
7640
|
-
setNewContext: function setNewContext(newContext) {
|
|
7641
|
-
// eslint-disable-next-line lwc-internal/no-invalid-todo
|
|
7642
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
7643
|
-
callbackWhenContextIsReady(newContext);
|
|
7644
|
-
},
|
|
7645
|
-
setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
|
|
7646
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
7647
|
-
// the the element hosting the wire is disconnected
|
|
7648
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
7649
|
-
}
|
|
7650
|
-
});
|
|
7651
|
-
dispatchEvent$1(elm, contextRegistrationEvent);
|
|
7652
|
-
});
|
|
7693
|
+
if (!isDomManual) {
|
|
7694
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
|
|
7695
|
+
}
|
|
7696
|
+
|
|
7697
|
+
return elm;
|
|
7653
7698
|
}
|
|
7654
7699
|
|
|
7655
|
-
function
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
var context;
|
|
7662
|
-
var connector; // Workaround to pass the component element associated to this wire adapter instance.
|
|
7700
|
+
function hydrateCustomElement(elm, vnode) {
|
|
7701
|
+
if (!hasCorrectNodeType(vnode, elm, 1
|
|
7702
|
+
/* ELEMENT */
|
|
7703
|
+
) || !isMatchingElement(vnode, elm)) {
|
|
7704
|
+
return handleMismatch(elm, vnode);
|
|
7705
|
+
}
|
|
7663
7706
|
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7707
|
+
var sel = vnode.sel,
|
|
7708
|
+
mode = vnode.mode,
|
|
7709
|
+
ctor = vnode.ctor,
|
|
7710
|
+
owner = vnode.owner;
|
|
7711
|
+
var vm = createVM(elm, ctor, {
|
|
7712
|
+
mode: mode,
|
|
7713
|
+
owner: owner,
|
|
7714
|
+
tagName: sel
|
|
7669
7715
|
});
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7716
|
+
vnode.elm = elm;
|
|
7717
|
+
vnode.vm = vm;
|
|
7718
|
+
allocateChildren(vnode, vm);
|
|
7719
|
+
patchElementPropsAndAttrs(vnode); // Insert hook section:
|
|
7674
7720
|
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
connector.update(config, context);
|
|
7681
|
-
}, noop);
|
|
7682
|
-
}; // Computes the current wire config and calls the update method on the wire adapter.
|
|
7683
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
7721
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7722
|
+
assert.isTrue(vm.state === 0
|
|
7723
|
+
/* created */
|
|
7724
|
+
, "".concat(vm, " cannot be recycled."));
|
|
7725
|
+
}
|
|
7684
7726
|
|
|
7727
|
+
runConnectedCallback(vm);
|
|
7685
7728
|
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7729
|
+
if (vm.renderMode !== 0
|
|
7730
|
+
/* Light */
|
|
7731
|
+
) {
|
|
7732
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
7733
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
7734
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vm);
|
|
7735
|
+
}
|
|
7689
7736
|
|
|
7737
|
+
hydrateVM(vm);
|
|
7738
|
+
return elm;
|
|
7739
|
+
}
|
|
7690
7740
|
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7741
|
+
function hydrateChildren(node, children, parentNode, owner) {
|
|
7742
|
+
var hasWarned = false;
|
|
7743
|
+
var nextNode = node;
|
|
7744
|
+
var anchor = null;
|
|
7745
|
+
|
|
7746
|
+
for (var _i29 = 0; _i29 < children.length; _i29++) {
|
|
7747
|
+
var childVnode = children[_i29];
|
|
7748
|
+
|
|
7749
|
+
if (!isNull(childVnode)) {
|
|
7750
|
+
if (nextNode) {
|
|
7751
|
+
nextNode = hydrateNode(nextNode, childVnode);
|
|
7752
|
+
anchor = childVnode.elm;
|
|
7753
|
+
} else {
|
|
7754
|
+
hasMismatch = true;
|
|
7699
7755
|
|
|
7700
|
-
if (
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7756
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7757
|
+
if (!hasWarned) {
|
|
7758
|
+
hasWarned = true;
|
|
7759
|
+
logError("Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.", owner);
|
|
7760
|
+
}
|
|
7704
7761
|
}
|
|
7762
|
+
|
|
7763
|
+
mount(childVnode, parentNode, anchor);
|
|
7764
|
+
anchor = childVnode.elm;
|
|
7705
7765
|
}
|
|
7706
|
-
}
|
|
7766
|
+
}
|
|
7707
7767
|
}
|
|
7708
7768
|
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7769
|
+
if (nextNode) {
|
|
7770
|
+
hasMismatch = true;
|
|
7771
|
+
|
|
7772
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7773
|
+
if (!hasWarned) {
|
|
7774
|
+
logError("Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.", owner);
|
|
7775
|
+
}
|
|
7715
7776
|
}
|
|
7716
|
-
|
|
7777
|
+
|
|
7778
|
+
do {
|
|
7779
|
+
var current = nextNode;
|
|
7780
|
+
nextNode = nextSibling$1(nextNode);
|
|
7781
|
+
removeNode(current, parentNode);
|
|
7782
|
+
} while (nextNode);
|
|
7783
|
+
}
|
|
7717
7784
|
}
|
|
7718
7785
|
|
|
7719
|
-
|
|
7786
|
+
function handleMismatch(node, vnode, msg) {
|
|
7787
|
+
hasMismatch = true;
|
|
7720
7788
|
|
|
7721
|
-
|
|
7722
|
-
|
|
7789
|
+
if (!isUndefined$1(msg)) {
|
|
7790
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7791
|
+
logError(msg, vnode.owner);
|
|
7792
|
+
}
|
|
7793
|
+
}
|
|
7794
|
+
|
|
7795
|
+
var parentNode = getProperty$1(node, 'parentNode');
|
|
7796
|
+
mount(vnode, parentNode, node);
|
|
7797
|
+
removeNode(node, parentNode);
|
|
7798
|
+
return vnode.elm;
|
|
7723
7799
|
}
|
|
7724
7800
|
|
|
7725
|
-
function
|
|
7726
|
-
|
|
7801
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
7802
|
+
applyEventListeners(vnode);
|
|
7803
|
+
patchProps(null, vnode);
|
|
7727
7804
|
}
|
|
7728
7805
|
|
|
7729
|
-
function
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7806
|
+
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
7807
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
7808
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7809
|
+
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
7810
|
+
}
|
|
7811
|
+
|
|
7812
|
+
return false;
|
|
7733
7813
|
}
|
|
7734
7814
|
|
|
7735
|
-
|
|
7736
|
-
var def = {
|
|
7737
|
-
adapter: adapter,
|
|
7738
|
-
method: method,
|
|
7739
|
-
configCallback: configCallback,
|
|
7740
|
-
dynamic: dynamic
|
|
7741
|
-
};
|
|
7742
|
-
WireMetaMap.set(descriptor, def);
|
|
7815
|
+
return true;
|
|
7743
7816
|
}
|
|
7744
7817
|
|
|
7745
|
-
function
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7818
|
+
function isMatchingElement(vnode, elm) {
|
|
7819
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
7820
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7821
|
+
logError("Hydration mismatch: expecting element with tag \"".concat(vnode.sel.toLowerCase(), "\" but found \"").concat(getProperty$1(elm, 'tagName').toLowerCase(), "\"."), vnode.owner);
|
|
7822
|
+
}
|
|
7823
|
+
|
|
7824
|
+
return false;
|
|
7749
7825
|
}
|
|
7750
7826
|
|
|
7751
|
-
var
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
};
|
|
7756
|
-
WireMetaMap.set(descriptor, def);
|
|
7827
|
+
var hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
7828
|
+
var hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
7829
|
+
var hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
7830
|
+
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
7757
7831
|
}
|
|
7758
7832
|
|
|
7759
|
-
function
|
|
7760
|
-
var
|
|
7761
|
-
|
|
7762
|
-
var
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
for (var fieldNameOrMethod in wire) {
|
|
7766
|
-
var descriptor = wire[fieldNameOrMethod];
|
|
7767
|
-
var wireDef = WireMetaMap.get(descriptor);
|
|
7768
|
-
|
|
7769
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7770
|
-
assert.invariant(wireDef, "Internal Error: invalid wire definition found.");
|
|
7771
|
-
}
|
|
7833
|
+
function validateAttrs(vnode, elm) {
|
|
7834
|
+
var _vnode$data$attrs = vnode.data.attrs,
|
|
7835
|
+
attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs;
|
|
7836
|
+
var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
7837
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
7772
7838
|
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
computeConfigAndUpdate = _createConnector.computeConfigAndUpdate,
|
|
7778
|
-
resetConfigWatcher = _createConnector.resetConfigWatcher;
|
|
7839
|
+
for (var _i30 = 0, _Object$entries = Object.entries(attrs); _i30 < _Object$entries.length; _i30++) {
|
|
7840
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i30], 2),
|
|
7841
|
+
attrName = _Object$entries$_i[0],
|
|
7842
|
+
attrValue = _Object$entries$_i[1];
|
|
7779
7843
|
|
|
7780
|
-
|
|
7781
|
-
ArrayPush$1.call(wiredConnecting, function () {
|
|
7782
|
-
connector.connect();
|
|
7844
|
+
var elmAttrValue = getAttribute$1(elm, attrName);
|
|
7783
7845
|
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
}
|
|
7789
|
-
}
|
|
7846
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
7847
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7848
|
+
logError("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
|
|
7849
|
+
}
|
|
7790
7850
|
|
|
7791
|
-
|
|
7792
|
-
});
|
|
7793
|
-
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
7794
|
-
connector.disconnect();
|
|
7795
|
-
resetConfigWatcher();
|
|
7796
|
-
});
|
|
7797
|
-
})();
|
|
7851
|
+
nodesAreCompatible = false;
|
|
7798
7852
|
}
|
|
7799
7853
|
}
|
|
7854
|
+
|
|
7855
|
+
return nodesAreCompatible;
|
|
7800
7856
|
}
|
|
7801
7857
|
|
|
7802
|
-
function
|
|
7803
|
-
var
|
|
7858
|
+
function validateClassAttr(vnode, elm) {
|
|
7859
|
+
var _vnode$data = vnode.data,
|
|
7860
|
+
className = _vnode$data.className,
|
|
7861
|
+
classMap = _vnode$data.classMap;
|
|
7862
|
+
var nodesAreCompatible = true;
|
|
7863
|
+
var vnodeClassName;
|
|
7804
7864
|
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7865
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
7866
|
+
// className is used when class is bound to an expr.
|
|
7867
|
+
nodesAreCompatible = false;
|
|
7868
|
+
vnodeClassName = className;
|
|
7869
|
+
} else if (!isUndefined$1(classMap)) {
|
|
7870
|
+
// classMap is used when class is set to static value.
|
|
7871
|
+
var classList = getClassList$1(elm);
|
|
7872
|
+
var computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
7809
7873
|
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7813
|
-
// job
|
|
7814
|
-
for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
|
|
7815
|
-
wiredDisconnecting[_i31]();
|
|
7816
|
-
}
|
|
7817
|
-
}, noop);
|
|
7818
|
-
}
|
|
7819
|
-
/*
|
|
7820
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7821
|
-
* All rights reserved.
|
|
7822
|
-
* SPDX-License-Identifier: MIT
|
|
7823
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7824
|
-
*/
|
|
7825
|
-
// this is lwc internal implementation
|
|
7874
|
+
for (var name in classMap) {
|
|
7875
|
+
computedClassName += ' ' + name;
|
|
7826
7876
|
|
|
7877
|
+
if (!classList.contains(name)) {
|
|
7878
|
+
nodesAreCompatible = false;
|
|
7879
|
+
}
|
|
7880
|
+
}
|
|
7827
7881
|
|
|
7828
|
-
|
|
7829
|
-
var adapterContextToken = getAdapterToken(adapter);
|
|
7882
|
+
vnodeClassName = computedClassName.trim();
|
|
7830
7883
|
|
|
7831
|
-
|
|
7832
|
-
|
|
7884
|
+
if (classList.length > keys(classMap).length) {
|
|
7885
|
+
nodesAreCompatible = false;
|
|
7886
|
+
}
|
|
7833
7887
|
}
|
|
7834
7888
|
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
return function (elm, options) {
|
|
7839
|
-
if (providers.has(elm)) {
|
|
7840
|
-
throw new Error("Adapter was already installed on ".concat(elm, "."));
|
|
7889
|
+
if (!nodesAreCompatible) {
|
|
7890
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7891
|
+
logError("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(getProperty$1(elm, 'className'), "\""), vnode.owner);
|
|
7841
7892
|
}
|
|
7893
|
+
}
|
|
7842
7894
|
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
consumerDisconnectedCallback = options.consumerDisconnectedCallback;
|
|
7846
|
-
elm.addEventListener(adapterContextToken, function (evt) {
|
|
7847
|
-
var setNewContext = evt.setNewContext,
|
|
7848
|
-
setDisconnectedCallback = evt.setDisconnectedCallback;
|
|
7849
|
-
var consumer = {
|
|
7850
|
-
provide: function provide(newContext) {
|
|
7851
|
-
setNewContext(newContext);
|
|
7852
|
-
}
|
|
7853
|
-
};
|
|
7895
|
+
return nodesAreCompatible;
|
|
7896
|
+
}
|
|
7854
7897
|
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7898
|
+
function validateStyleAttr(vnode, elm) {
|
|
7899
|
+
var _vnode$data2 = vnode.data,
|
|
7900
|
+
style = _vnode$data2.style,
|
|
7901
|
+
styleDecls = _vnode$data2.styleDecls;
|
|
7902
|
+
var elmStyle = getAttribute$1(elm, 'style') || '';
|
|
7903
|
+
var vnodeStyle;
|
|
7904
|
+
var nodesAreCompatible = true;
|
|
7860
7905
|
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
/*
|
|
7868
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7869
|
-
* All rights reserved.
|
|
7870
|
-
* SPDX-License-Identifier: MIT
|
|
7871
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7872
|
-
*/
|
|
7906
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
7907
|
+
nodesAreCompatible = false;
|
|
7908
|
+
vnodeStyle = style;
|
|
7909
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
7910
|
+
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
7911
|
+
var expectedStyle = []; // styleMap is used when style is set to static value.
|
|
7873
7912
|
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7913
|
+
for (var _i31 = 0, n = styleDecls.length; _i31 < n; _i31++) {
|
|
7914
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i31], 3),
|
|
7915
|
+
prop = _styleDecls$_i2[0],
|
|
7916
|
+
value = _styleDecls$_i2[1],
|
|
7917
|
+
important = _styleDecls$_i2[2];
|
|
7879
7918
|
|
|
7919
|
+
expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
|
|
7920
|
+
var parsedPropValue = parsedVnodeStyle[prop];
|
|
7880
7921
|
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7922
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
7923
|
+
nodesAreCompatible = false;
|
|
7924
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
7925
|
+
nodesAreCompatible = false;
|
|
7926
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
7927
|
+
nodesAreCompatible = false;
|
|
7928
|
+
}
|
|
7886
7929
|
}
|
|
7930
|
+
|
|
7931
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
7932
|
+
nodesAreCompatible = false;
|
|
7933
|
+
}
|
|
7934
|
+
|
|
7935
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
7887
7936
|
}
|
|
7888
7937
|
|
|
7889
|
-
|
|
7938
|
+
if (!nodesAreCompatible) {
|
|
7939
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7940
|
+
logError("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
7941
|
+
}
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7944
|
+
return nodesAreCompatible;
|
|
7890
7945
|
}
|
|
7891
7946
|
/*
|
|
7892
7947
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7903,7 +7958,7 @@ var LWC = (function (exports) {
|
|
|
7903
7958
|
hooksAreSet = true;
|
|
7904
7959
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7905
7960
|
}
|
|
7906
|
-
/* version: 2.
|
|
7961
|
+
/* version: 2.12.0 */
|
|
7907
7962
|
|
|
7908
7963
|
/*
|
|
7909
7964
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8318,7 +8373,7 @@ var LWC = (function (exports) {
|
|
|
8318
8373
|
}
|
|
8319
8374
|
|
|
8320
8375
|
function createVMWithProps(element, Ctor, props) {
|
|
8321
|
-
createVM(element, Ctor, {
|
|
8376
|
+
var vm = createVM(element, Ctor, {
|
|
8322
8377
|
mode: 'open',
|
|
8323
8378
|
owner: null,
|
|
8324
8379
|
tagName: element.tagName.toLowerCase()
|
|
@@ -8331,6 +8386,8 @@ var LWC = (function (exports) {
|
|
|
8331
8386
|
|
|
8332
8387
|
element[key] = value;
|
|
8333
8388
|
}
|
|
8389
|
+
|
|
8390
|
+
return vm;
|
|
8334
8391
|
}
|
|
8335
8392
|
|
|
8336
8393
|
function hydrateComponent(element, Ctor) {
|
|
@@ -8358,8 +8415,8 @@ var LWC = (function (exports) {
|
|
|
8358
8415
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8359
8416
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
8360
8417
|
setIsHydrating(true);
|
|
8361
|
-
createVMWithProps(element, Ctor, props);
|
|
8362
|
-
|
|
8418
|
+
var vm = createVMWithProps(element, Ctor, props);
|
|
8419
|
+
hydrateRoot(vm); // set it back since now we finished hydration.
|
|
8363
8420
|
|
|
8364
8421
|
setIsHydrating(false);
|
|
8365
8422
|
} catch (e) {
|
|
@@ -8681,7 +8738,7 @@ var LWC = (function (exports) {
|
|
|
8681
8738
|
});
|
|
8682
8739
|
freeze(LightningElement);
|
|
8683
8740
|
seal(LightningElement.prototype);
|
|
8684
|
-
/* version: 2.
|
|
8741
|
+
/* version: 2.12.0 */
|
|
8685
8742
|
|
|
8686
8743
|
exports.LightningElement = LightningElement;
|
|
8687
8744
|
exports.__unstable__ProfilerControl = profilerControl;
|