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