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