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