lwc 2.11.1 → 2.12.1
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 +301 -259
- package/dist/engine-dom/iife/es2017/engine-dom.js +301 -259
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +258 -124
- package/dist/engine-dom/iife/es5/engine-dom.js +1094 -1041
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +384 -179
- package/dist/engine-dom/umd/es2017/engine-dom.js +301 -259
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +258 -124
- package/dist/engine-dom/umd/es5/engine-dom.js +1094 -1041
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +384 -179
- package/dist/engine-server/commonjs/es2017/engine-server.js +6 -7
- package/dist/engine-server/esm/es2017/engine-server.js +6 -7
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +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.1 */
|
|
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.1 */
|
|
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
|
/*
|
|
@@ -3939,100 +3956,6 @@ var LWC = (function (exports) {
|
|
|
3939
3956
|
}
|
|
3940
3957
|
}
|
|
3941
3958
|
|
|
3942
|
-
/*
|
|
3943
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
3944
|
-
* All rights reserved.
|
|
3945
|
-
* SPDX-License-Identifier: MIT
|
|
3946
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3947
|
-
*/
|
|
3948
|
-
function hydrate(vnode, node) {
|
|
3949
|
-
switch (vnode.type) {
|
|
3950
|
-
case 0 /* Text */:
|
|
3951
|
-
hydrateText(vnode, node);
|
|
3952
|
-
break;
|
|
3953
|
-
case 1 /* Comment */:
|
|
3954
|
-
hydrateComment(vnode, node);
|
|
3955
|
-
break;
|
|
3956
|
-
case 2 /* Element */:
|
|
3957
|
-
hydrateElement(vnode, node);
|
|
3958
|
-
break;
|
|
3959
|
-
case 3 /* CustomElement */:
|
|
3960
|
-
hydrateCustomElement(vnode, node);
|
|
3961
|
-
break;
|
|
3962
|
-
}
|
|
3963
|
-
}
|
|
3964
|
-
function hydrateText(vnode, node) {
|
|
3965
|
-
var _a;
|
|
3966
|
-
// always set the text value to the one from the vnode.
|
|
3967
|
-
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
3968
|
-
vnode.elm = node;
|
|
3969
|
-
}
|
|
3970
|
-
function hydrateComment(vnode, node) {
|
|
3971
|
-
var _a;
|
|
3972
|
-
// always set the text value to the one from the vnode.
|
|
3973
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
3974
|
-
vnode.elm = node;
|
|
3975
|
-
}
|
|
3976
|
-
function hydrateElement(vnode, node) {
|
|
3977
|
-
const elm = node;
|
|
3978
|
-
vnode.elm = elm;
|
|
3979
|
-
const { context } = vnode.data;
|
|
3980
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
3981
|
-
if (isDomManual) {
|
|
3982
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
3983
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
3984
|
-
const { props } = vnode.data;
|
|
3985
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
3986
|
-
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
3987
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
3988
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
3989
|
-
}
|
|
3990
|
-
else {
|
|
3991
|
-
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
3992
|
-
}
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3995
|
-
patchElementPropsAndAttrs(vnode);
|
|
3996
|
-
if (!isDomManual) {
|
|
3997
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
3998
|
-
}
|
|
3999
|
-
}
|
|
4000
|
-
function hydrateCustomElement(vnode, node) {
|
|
4001
|
-
const elm = node;
|
|
4002
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
4003
|
-
const vm = createVM(elm, ctor, {
|
|
4004
|
-
mode,
|
|
4005
|
-
owner,
|
|
4006
|
-
tagName: sel,
|
|
4007
|
-
});
|
|
4008
|
-
vnode.elm = elm;
|
|
4009
|
-
vnode.vm = vm;
|
|
4010
|
-
allocateChildren(vnode, vm);
|
|
4011
|
-
patchElementPropsAndAttrs(vnode);
|
|
4012
|
-
runConnectedCallback(vm);
|
|
4013
|
-
if (vm.renderMode !== 0 /* Light */) {
|
|
4014
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
4015
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
4016
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
|
|
4017
|
-
}
|
|
4018
|
-
hydrateVM(vm);
|
|
4019
|
-
}
|
|
4020
|
-
function hydrateChildren(elmChildren, children, vm) {
|
|
4021
|
-
let childNodeIndex = 0;
|
|
4022
|
-
for (let i = 0; i < children.length; i++) {
|
|
4023
|
-
const childVnode = children[i];
|
|
4024
|
-
if (!isNull(childVnode)) {
|
|
4025
|
-
const childNode = elmChildren[childNodeIndex];
|
|
4026
|
-
hydrate(childVnode, childNode);
|
|
4027
|
-
childNodeIndex++;
|
|
4028
|
-
}
|
|
4029
|
-
}
|
|
4030
|
-
}
|
|
4031
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
4032
|
-
applyEventListeners(vnode);
|
|
4033
|
-
patchProps(null, vnode);
|
|
4034
|
-
}
|
|
4035
|
-
|
|
4036
3959
|
/*
|
|
4037
3960
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4038
3961
|
* All rights reserved.
|
|
@@ -4078,32 +4001,12 @@ var LWC = (function (exports) {
|
|
|
4078
4001
|
/* GlobalHydrate */
|
|
4079
4002
|
, vm);
|
|
4080
4003
|
}
|
|
4081
|
-
function hydrateRootElement(elm) {
|
|
4082
|
-
const vm = getAssociatedVM(elm);
|
|
4083
|
-
runConnectedCallback(vm);
|
|
4084
|
-
hydrateVM(vm);
|
|
4085
|
-
}
|
|
4086
4004
|
function disconnectRootElement(elm) {
|
|
4087
4005
|
const vm = getAssociatedVM(elm);
|
|
4088
4006
|
resetComponentStateWhenRemoved(vm);
|
|
4089
4007
|
}
|
|
4090
4008
|
function appendVM(vm) {
|
|
4091
4009
|
rehydrate(vm);
|
|
4092
|
-
}
|
|
4093
|
-
function hydrateVM(vm) {
|
|
4094
|
-
if (isTrue(vm.isDirty)) {
|
|
4095
|
-
// manually diffing/patching here.
|
|
4096
|
-
// This routine is:
|
|
4097
|
-
// patchShadowRoot(vm, children);
|
|
4098
|
-
// -> addVnodes.
|
|
4099
|
-
const children = renderComponent(vm);
|
|
4100
|
-
vm.children = children;
|
|
4101
|
-
const vmChildren = vm.renderMode === 0
|
|
4102
|
-
/* Light */
|
|
4103
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
4104
|
-
hydrateChildren(vmChildren, children);
|
|
4105
|
-
runRenderedCallback(vm);
|
|
4106
|
-
}
|
|
4107
4010
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4108
4011
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4109
4012
|
|
|
@@ -4369,7 +4272,6 @@ var LWC = (function (exports) {
|
|
|
4369
4272
|
, vm);
|
|
4370
4273
|
}
|
|
4371
4274
|
}
|
|
4372
|
-
|
|
4373
4275
|
let rehydrateQueue = [];
|
|
4374
4276
|
|
|
4375
4277
|
function flushRehydrationQueue() {
|
|
@@ -4990,6 +4892,237 @@ var LWC = (function (exports) {
|
|
|
4990
4892
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
4991
4893
|
}
|
|
4992
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
|
+
|
|
4993
5126
|
/*
|
|
4994
5127
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4995
5128
|
* All rights reserved.
|
|
@@ -5002,7 +5135,7 @@ var LWC = (function (exports) {
|
|
|
5002
5135
|
hooksAreSet = true;
|
|
5003
5136
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5004
5137
|
}
|
|
5005
|
-
/* version: 2.
|
|
5138
|
+
/* version: 2.12.1 */
|
|
5006
5139
|
|
|
5007
5140
|
/*
|
|
5008
5141
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5322,7 +5455,7 @@ var LWC = (function (exports) {
|
|
|
5322
5455
|
}
|
|
5323
5456
|
}
|
|
5324
5457
|
function createVMWithProps(element, Ctor, props) {
|
|
5325
|
-
createVM(element, Ctor, {
|
|
5458
|
+
const vm = createVM(element, Ctor, {
|
|
5326
5459
|
mode: 'open',
|
|
5327
5460
|
owner: null,
|
|
5328
5461
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -5330,6 +5463,7 @@ var LWC = (function (exports) {
|
|
|
5330
5463
|
for (const [key, value] of Object.entries(props)) {
|
|
5331
5464
|
element[key] = value;
|
|
5332
5465
|
}
|
|
5466
|
+
return vm;
|
|
5333
5467
|
}
|
|
5334
5468
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
5335
5469
|
if (!(element instanceof Element)) {
|
|
@@ -5350,8 +5484,8 @@ var LWC = (function (exports) {
|
|
|
5350
5484
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
5351
5485
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
5352
5486
|
setIsHydrating(true);
|
|
5353
|
-
createVMWithProps(element, Ctor, props);
|
|
5354
|
-
|
|
5487
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
5488
|
+
hydrateRoot(vm);
|
|
5355
5489
|
// set it back since now we finished hydration.
|
|
5356
5490
|
setIsHydrating(false);
|
|
5357
5491
|
}
|
|
@@ -5608,7 +5742,7 @@ var LWC = (function (exports) {
|
|
|
5608
5742
|
});
|
|
5609
5743
|
freeze(LightningElement);
|
|
5610
5744
|
seal(LightningElement.prototype);
|
|
5611
|
-
/* version: 2.
|
|
5745
|
+
/* version: 2.12.1 */
|
|
5612
5746
|
|
|
5613
5747
|
exports.LightningElement = LightningElement;
|
|
5614
5748
|
exports.__unstable__ProfilerControl = profilerControl;
|