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