lwc 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/iife/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +391 -181
- package/dist/engine-dom/umd/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/umd/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +391 -181
- package/dist/engine-server/commonjs/es2017/engine-server.js +14 -11
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +14 -11
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +10 -10
|
@@ -290,7 +290,7 @@ var LWC = (function (exports) {
|
|
|
290
290
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
291
291
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
292
292
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
293
|
-
/** version: 2.
|
|
293
|
+
/** version: 2.12.0 */
|
|
294
294
|
|
|
295
295
|
/*
|
|
296
296
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -433,7 +433,7 @@ var LWC = (function (exports) {
|
|
|
433
433
|
*/
|
|
434
434
|
function setFeatureFlagForTest(name, value) {
|
|
435
435
|
}
|
|
436
|
-
/** version: 2.
|
|
436
|
+
/** version: 2.12.0 */
|
|
437
437
|
|
|
438
438
|
/* proxy-compat-disable */
|
|
439
439
|
|
|
@@ -468,6 +468,23 @@ var LWC = (function (exports) {
|
|
|
468
468
|
}
|
|
469
469
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
470
470
|
}
|
|
471
|
+
// Borrowed from Vue template compiler.
|
|
472
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
473
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
474
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
475
|
+
function parseStyleText(cssText) {
|
|
476
|
+
const styleMap = {};
|
|
477
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
478
|
+
for (const declaration of declarations) {
|
|
479
|
+
if (declaration) {
|
|
480
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
481
|
+
if (prop !== undefined && value !== undefined) {
|
|
482
|
+
styleMap[prop.trim()] = value.trim();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return styleMap;
|
|
487
|
+
}
|
|
471
488
|
// Make a shallow copy of an object but omit the given key
|
|
472
489
|
function cloneAndOmitKey(object, keyToOmit) {
|
|
473
490
|
const result = {};
|
|
@@ -816,8 +833,8 @@ var LWC = (function (exports) {
|
|
|
816
833
|
console[method](e);
|
|
817
834
|
}
|
|
818
835
|
}
|
|
819
|
-
function
|
|
820
|
-
log('
|
|
836
|
+
function logError(message, vm) {
|
|
837
|
+
log('error', message, vm);
|
|
821
838
|
}
|
|
822
839
|
|
|
823
840
|
/*
|
|
@@ -3860,8 +3877,12 @@ var LWC = (function (exports) {
|
|
|
3860
3877
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3861
3878
|
* will prevent this function from being imported by userland code.
|
|
3862
3879
|
*/
|
|
3863
|
-
function registerComponent(
|
|
3864
|
-
|
|
3880
|
+
function registerComponent(
|
|
3881
|
+
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
3882
|
+
Ctor, { tmpl }) {
|
|
3883
|
+
if (isFunction$1(Ctor)) {
|
|
3884
|
+
signedTemplateMap.set(Ctor, tmpl);
|
|
3885
|
+
}
|
|
3865
3886
|
// chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
3866
3887
|
// without too much transformation
|
|
3867
3888
|
return Ctor;
|
|
@@ -3935,100 +3956,6 @@ var LWC = (function (exports) {
|
|
|
3935
3956
|
}
|
|
3936
3957
|
}
|
|
3937
3958
|
|
|
3938
|
-
/*
|
|
3939
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
3940
|
-
* All rights reserved.
|
|
3941
|
-
* SPDX-License-Identifier: MIT
|
|
3942
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3943
|
-
*/
|
|
3944
|
-
function hydrate(vnode, node) {
|
|
3945
|
-
switch (vnode.type) {
|
|
3946
|
-
case 0 /* Text */:
|
|
3947
|
-
hydrateText(vnode, node);
|
|
3948
|
-
break;
|
|
3949
|
-
case 1 /* Comment */:
|
|
3950
|
-
hydrateComment(vnode, node);
|
|
3951
|
-
break;
|
|
3952
|
-
case 2 /* Element */:
|
|
3953
|
-
hydrateElement(vnode, node);
|
|
3954
|
-
break;
|
|
3955
|
-
case 3 /* CustomElement */:
|
|
3956
|
-
hydrateCustomElement(vnode, node);
|
|
3957
|
-
break;
|
|
3958
|
-
}
|
|
3959
|
-
}
|
|
3960
|
-
function hydrateText(vnode, node) {
|
|
3961
|
-
var _a;
|
|
3962
|
-
// always set the text value to the one from the vnode.
|
|
3963
|
-
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
3964
|
-
vnode.elm = node;
|
|
3965
|
-
}
|
|
3966
|
-
function hydrateComment(vnode, node) {
|
|
3967
|
-
var _a;
|
|
3968
|
-
// always set the text value to the one from the vnode.
|
|
3969
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
3970
|
-
vnode.elm = node;
|
|
3971
|
-
}
|
|
3972
|
-
function hydrateElement(vnode, node) {
|
|
3973
|
-
const elm = node;
|
|
3974
|
-
vnode.elm = elm;
|
|
3975
|
-
const { context } = vnode.data;
|
|
3976
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
3977
|
-
if (isDomManual) {
|
|
3978
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
3979
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
3980
|
-
const { props } = vnode.data;
|
|
3981
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
3982
|
-
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
3983
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
3984
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
3985
|
-
}
|
|
3986
|
-
else {
|
|
3987
|
-
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
3988
|
-
}
|
|
3989
|
-
}
|
|
3990
|
-
}
|
|
3991
|
-
patchElementPropsAndAttrs(vnode);
|
|
3992
|
-
if (!isDomManual) {
|
|
3993
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
3994
|
-
}
|
|
3995
|
-
}
|
|
3996
|
-
function hydrateCustomElement(vnode, node) {
|
|
3997
|
-
const elm = node;
|
|
3998
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
3999
|
-
const vm = createVM(elm, ctor, {
|
|
4000
|
-
mode,
|
|
4001
|
-
owner,
|
|
4002
|
-
tagName: sel,
|
|
4003
|
-
});
|
|
4004
|
-
vnode.elm = elm;
|
|
4005
|
-
vnode.vm = vm;
|
|
4006
|
-
allocateChildren(vnode, vm);
|
|
4007
|
-
patchElementPropsAndAttrs(vnode);
|
|
4008
|
-
runConnectedCallback(vm);
|
|
4009
|
-
if (vm.renderMode !== 0 /* Light */) {
|
|
4010
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
4011
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
4012
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
|
|
4013
|
-
}
|
|
4014
|
-
hydrateVM(vm);
|
|
4015
|
-
}
|
|
4016
|
-
function hydrateChildren(elmChildren, children, vm) {
|
|
4017
|
-
let childNodeIndex = 0;
|
|
4018
|
-
for (let i = 0; i < children.length; i++) {
|
|
4019
|
-
const childVnode = children[i];
|
|
4020
|
-
if (!isNull(childVnode)) {
|
|
4021
|
-
const childNode = elmChildren[childNodeIndex];
|
|
4022
|
-
hydrate(childVnode, childNode);
|
|
4023
|
-
childNodeIndex++;
|
|
4024
|
-
}
|
|
4025
|
-
}
|
|
4026
|
-
}
|
|
4027
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
4028
|
-
applyEventListeners(vnode);
|
|
4029
|
-
patchProps(null, vnode);
|
|
4030
|
-
}
|
|
4031
|
-
|
|
4032
3959
|
/*
|
|
4033
3960
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4034
3961
|
* All rights reserved.
|
|
@@ -4074,32 +4001,12 @@ var LWC = (function (exports) {
|
|
|
4074
4001
|
/* GlobalHydrate */
|
|
4075
4002
|
, vm);
|
|
4076
4003
|
}
|
|
4077
|
-
function hydrateRootElement(elm) {
|
|
4078
|
-
const vm = getAssociatedVM(elm);
|
|
4079
|
-
runConnectedCallback(vm);
|
|
4080
|
-
hydrateVM(vm);
|
|
4081
|
-
}
|
|
4082
4004
|
function disconnectRootElement(elm) {
|
|
4083
4005
|
const vm = getAssociatedVM(elm);
|
|
4084
4006
|
resetComponentStateWhenRemoved(vm);
|
|
4085
4007
|
}
|
|
4086
4008
|
function appendVM(vm) {
|
|
4087
4009
|
rehydrate(vm);
|
|
4088
|
-
}
|
|
4089
|
-
function hydrateVM(vm) {
|
|
4090
|
-
if (isTrue(vm.isDirty)) {
|
|
4091
|
-
// manually diffing/patching here.
|
|
4092
|
-
// This routine is:
|
|
4093
|
-
// patchShadowRoot(vm, children);
|
|
4094
|
-
// -> addVnodes.
|
|
4095
|
-
const children = renderComponent(vm);
|
|
4096
|
-
vm.children = children;
|
|
4097
|
-
const vmChildren = vm.renderMode === 0
|
|
4098
|
-
/* Light */
|
|
4099
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
4100
|
-
hydrateChildren(vmChildren, children);
|
|
4101
|
-
runRenderedCallback(vm);
|
|
4102
|
-
}
|
|
4103
4010
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4104
4011
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4105
4012
|
|
|
@@ -4365,7 +4272,6 @@ var LWC = (function (exports) {
|
|
|
4365
4272
|
, vm);
|
|
4366
4273
|
}
|
|
4367
4274
|
}
|
|
4368
|
-
|
|
4369
4275
|
let rehydrateQueue = [];
|
|
4370
4276
|
|
|
4371
4277
|
function flushRehydrationQueue() {
|
|
@@ -4986,6 +4892,237 @@ var LWC = (function (exports) {
|
|
|
4986
4892
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
4987
4893
|
}
|
|
4988
4894
|
|
|
4895
|
+
/*
|
|
4896
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4897
|
+
* All rights reserved.
|
|
4898
|
+
* SPDX-License-Identifier: MIT
|
|
4899
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4900
|
+
*/
|
|
4901
|
+
// flag indicating if the hydration recovered from the DOM mismatch
|
|
4902
|
+
let hasMismatch = false;
|
|
4903
|
+
function hydrateRoot(vm) {
|
|
4904
|
+
hasMismatch = false;
|
|
4905
|
+
runConnectedCallback(vm);
|
|
4906
|
+
hydrateVM(vm);
|
|
4907
|
+
if (hasMismatch) {
|
|
4908
|
+
logError('Hydration completed with errors.', vm);
|
|
4909
|
+
}
|
|
4910
|
+
}
|
|
4911
|
+
function hydrateVM(vm) {
|
|
4912
|
+
const children = renderComponent(vm);
|
|
4913
|
+
vm.children = children;
|
|
4914
|
+
const parentNode = vm.renderRoot;
|
|
4915
|
+
hydrateChildren(getFirstChild$1(parentNode), children, parentNode);
|
|
4916
|
+
runRenderedCallback(vm);
|
|
4917
|
+
}
|
|
4918
|
+
function hydrateNode(node, vnode) {
|
|
4919
|
+
let hydratedNode;
|
|
4920
|
+
switch (vnode.type) {
|
|
4921
|
+
case 0 /* Text */:
|
|
4922
|
+
hydratedNode = hydrateText(node, vnode);
|
|
4923
|
+
break;
|
|
4924
|
+
case 1 /* Comment */:
|
|
4925
|
+
hydratedNode = hydrateComment(node, vnode);
|
|
4926
|
+
break;
|
|
4927
|
+
case 2 /* Element */:
|
|
4928
|
+
hydratedNode = hydrateElement(node, vnode);
|
|
4929
|
+
break;
|
|
4930
|
+
case 3 /* CustomElement */:
|
|
4931
|
+
hydratedNode = hydrateCustomElement(node, vnode);
|
|
4932
|
+
break;
|
|
4933
|
+
}
|
|
4934
|
+
return nextSibling$1(hydratedNode);
|
|
4935
|
+
}
|
|
4936
|
+
function hydrateText(node, vnode) {
|
|
4937
|
+
var _a;
|
|
4938
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
|
|
4939
|
+
return handleMismatch(node, vnode);
|
|
4940
|
+
}
|
|
4941
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4942
|
+
vnode.elm = node;
|
|
4943
|
+
return node;
|
|
4944
|
+
}
|
|
4945
|
+
function hydrateComment(node, vnode) {
|
|
4946
|
+
var _a;
|
|
4947
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
|
|
4948
|
+
return handleMismatch(node, vnode);
|
|
4949
|
+
}
|
|
4950
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4951
|
+
vnode.elm = node;
|
|
4952
|
+
return node;
|
|
4953
|
+
}
|
|
4954
|
+
function hydrateElement(elm, vnode) {
|
|
4955
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
4956
|
+
!isMatchingElement(vnode, elm)) {
|
|
4957
|
+
return handleMismatch(elm, vnode);
|
|
4958
|
+
}
|
|
4959
|
+
vnode.elm = elm;
|
|
4960
|
+
const { context } = vnode.data;
|
|
4961
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
4962
|
+
if (isDomManual) {
|
|
4963
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
4964
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
4965
|
+
const { props } = vnode.data;
|
|
4966
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
4967
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
4968
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
4969
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
4970
|
+
}
|
|
4971
|
+
}
|
|
4972
|
+
}
|
|
4973
|
+
patchElementPropsAndAttrs(vnode);
|
|
4974
|
+
if (!isDomManual) {
|
|
4975
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
|
|
4976
|
+
}
|
|
4977
|
+
return elm;
|
|
4978
|
+
}
|
|
4979
|
+
function hydrateCustomElement(elm, vnode) {
|
|
4980
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
4981
|
+
!isMatchingElement(vnode, elm)) {
|
|
4982
|
+
return handleMismatch(elm, vnode);
|
|
4983
|
+
}
|
|
4984
|
+
const { sel, mode, ctor, owner } = vnode;
|
|
4985
|
+
const vm = createVM(elm, ctor, {
|
|
4986
|
+
mode,
|
|
4987
|
+
owner,
|
|
4988
|
+
tagName: sel,
|
|
4989
|
+
});
|
|
4990
|
+
vnode.elm = elm;
|
|
4991
|
+
vnode.vm = vm;
|
|
4992
|
+
allocateChildren(vnode, vm);
|
|
4993
|
+
patchElementPropsAndAttrs(vnode);
|
|
4994
|
+
runConnectedCallback(vm);
|
|
4995
|
+
if (vm.renderMode !== 0 /* Light */) {
|
|
4996
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
4997
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
4998
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm);
|
|
4999
|
+
}
|
|
5000
|
+
hydrateVM(vm);
|
|
5001
|
+
return elm;
|
|
5002
|
+
}
|
|
5003
|
+
function hydrateChildren(node, children, parentNode, owner) {
|
|
5004
|
+
let nextNode = node;
|
|
5005
|
+
let anchor = null;
|
|
5006
|
+
for (let i = 0; i < children.length; i++) {
|
|
5007
|
+
const childVnode = children[i];
|
|
5008
|
+
if (!isNull(childVnode)) {
|
|
5009
|
+
if (nextNode) {
|
|
5010
|
+
nextNode = hydrateNode(nextNode, childVnode);
|
|
5011
|
+
anchor = childVnode.elm;
|
|
5012
|
+
}
|
|
5013
|
+
else {
|
|
5014
|
+
hasMismatch = true;
|
|
5015
|
+
mount(childVnode, parentNode, anchor);
|
|
5016
|
+
anchor = childVnode.elm;
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
if (nextNode) {
|
|
5021
|
+
hasMismatch = true;
|
|
5022
|
+
do {
|
|
5023
|
+
const current = nextNode;
|
|
5024
|
+
nextNode = nextSibling$1(nextNode);
|
|
5025
|
+
removeNode(current, parentNode);
|
|
5026
|
+
} while (nextNode);
|
|
5027
|
+
}
|
|
5028
|
+
}
|
|
5029
|
+
function handleMismatch(node, vnode, msg) {
|
|
5030
|
+
hasMismatch = true;
|
|
5031
|
+
const parentNode = getProperty$1(node, 'parentNode');
|
|
5032
|
+
mount(vnode, parentNode, node);
|
|
5033
|
+
removeNode(node, parentNode);
|
|
5034
|
+
return vnode.elm;
|
|
5035
|
+
}
|
|
5036
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
5037
|
+
applyEventListeners(vnode);
|
|
5038
|
+
patchProps(null, vnode);
|
|
5039
|
+
}
|
|
5040
|
+
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
5041
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
5042
|
+
return false;
|
|
5043
|
+
}
|
|
5044
|
+
return true;
|
|
5045
|
+
}
|
|
5046
|
+
function isMatchingElement(vnode, elm) {
|
|
5047
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
5048
|
+
return false;
|
|
5049
|
+
}
|
|
5050
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5051
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5052
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5053
|
+
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5054
|
+
}
|
|
5055
|
+
function validateAttrs(vnode, elm) {
|
|
5056
|
+
const { data: { attrs = {} }, } = vnode;
|
|
5057
|
+
let nodesAreCompatible = true;
|
|
5058
|
+
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5059
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5060
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5061
|
+
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
5062
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
5063
|
+
nodesAreCompatible = false;
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
5066
|
+
return nodesAreCompatible;
|
|
5067
|
+
}
|
|
5068
|
+
function validateClassAttr(vnode, elm) {
|
|
5069
|
+
const { data: { className, classMap }, } = vnode;
|
|
5070
|
+
let nodesAreCompatible = true;
|
|
5071
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
5072
|
+
// className is used when class is bound to an expr.
|
|
5073
|
+
nodesAreCompatible = false;
|
|
5074
|
+
}
|
|
5075
|
+
else if (!isUndefined$1(classMap)) {
|
|
5076
|
+
// classMap is used when class is set to static value.
|
|
5077
|
+
const classList = getClassList$1(elm);
|
|
5078
|
+
let computedClassName = '';
|
|
5079
|
+
// all classes from the vnode should be in the element.classList
|
|
5080
|
+
for (const name in classMap) {
|
|
5081
|
+
computedClassName += ' ' + name;
|
|
5082
|
+
if (!classList.contains(name)) {
|
|
5083
|
+
nodesAreCompatible = false;
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
computedClassName.trim();
|
|
5087
|
+
if (classList.length > keys(classMap).length) {
|
|
5088
|
+
nodesAreCompatible = false;
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
return nodesAreCompatible;
|
|
5092
|
+
}
|
|
5093
|
+
function validateStyleAttr(vnode, elm) {
|
|
5094
|
+
const { data: { style, styleDecls }, } = vnode;
|
|
5095
|
+
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
5096
|
+
let nodesAreCompatible = true;
|
|
5097
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5098
|
+
nodesAreCompatible = false;
|
|
5099
|
+
}
|
|
5100
|
+
else if (!isUndefined$1(styleDecls)) {
|
|
5101
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5102
|
+
const expectedStyle = [];
|
|
5103
|
+
// styleMap is used when style is set to static value.
|
|
5104
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
5105
|
+
const [prop, value, important] = styleDecls[i];
|
|
5106
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
5107
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
5108
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
5109
|
+
nodesAreCompatible = false;
|
|
5110
|
+
}
|
|
5111
|
+
else if (!parsedPropValue.startsWith(value)) {
|
|
5112
|
+
nodesAreCompatible = false;
|
|
5113
|
+
}
|
|
5114
|
+
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
5115
|
+
nodesAreCompatible = false;
|
|
5116
|
+
}
|
|
5117
|
+
}
|
|
5118
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
5119
|
+
nodesAreCompatible = false;
|
|
5120
|
+
}
|
|
5121
|
+
ArrayJoin.call(expectedStyle, ';');
|
|
5122
|
+
}
|
|
5123
|
+
return nodesAreCompatible;
|
|
5124
|
+
}
|
|
5125
|
+
|
|
4989
5126
|
/*
|
|
4990
5127
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4991
5128
|
* All rights reserved.
|
|
@@ -4998,7 +5135,7 @@ var LWC = (function (exports) {
|
|
|
4998
5135
|
hooksAreSet = true;
|
|
4999
5136
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5000
5137
|
}
|
|
5001
|
-
/* version: 2.
|
|
5138
|
+
/* version: 2.12.0 */
|
|
5002
5139
|
|
|
5003
5140
|
/*
|
|
5004
5141
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5318,7 +5455,7 @@ var LWC = (function (exports) {
|
|
|
5318
5455
|
}
|
|
5319
5456
|
}
|
|
5320
5457
|
function createVMWithProps(element, Ctor, props) {
|
|
5321
|
-
createVM(element, Ctor, {
|
|
5458
|
+
const vm = createVM(element, Ctor, {
|
|
5322
5459
|
mode: 'open',
|
|
5323
5460
|
owner: null,
|
|
5324
5461
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -5326,6 +5463,7 @@ var LWC = (function (exports) {
|
|
|
5326
5463
|
for (const [key, value] of Object.entries(props)) {
|
|
5327
5464
|
element[key] = value;
|
|
5328
5465
|
}
|
|
5466
|
+
return vm;
|
|
5329
5467
|
}
|
|
5330
5468
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
5331
5469
|
if (!(element instanceof Element)) {
|
|
@@ -5346,8 +5484,8 @@ var LWC = (function (exports) {
|
|
|
5346
5484
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
5347
5485
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
5348
5486
|
setIsHydrating(true);
|
|
5349
|
-
createVMWithProps(element, Ctor, props);
|
|
5350
|
-
|
|
5487
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
5488
|
+
hydrateRoot(vm);
|
|
5351
5489
|
// set it back since now we finished hydration.
|
|
5352
5490
|
setIsHydrating(false);
|
|
5353
5491
|
}
|
|
@@ -5604,7 +5742,7 @@ var LWC = (function (exports) {
|
|
|
5604
5742
|
});
|
|
5605
5743
|
freeze(LightningElement);
|
|
5606
5744
|
seal(LightningElement.prototype);
|
|
5607
|
-
/* version: 2.
|
|
5745
|
+
/* version: 2.12.0 */
|
|
5608
5746
|
|
|
5609
5747
|
exports.LightningElement = LightningElement;
|
|
5610
5748
|
exports.__unstable__ProfilerControl = profilerControl;
|