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