lwc 2.11.0 → 2.11.4
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 +339 -263
- package/dist/engine-dom/iife/es2017/engine-dom.js +339 -263
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +294 -126
- package/dist/engine-dom/iife/es5/engine-dom.js +1137 -1047
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +425 -182
- package/dist/engine-dom/umd/es2017/engine-dom.js +339 -263
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +294 -126
- package/dist/engine-dom/umd/es5/engine-dom.js +1137 -1047
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +425 -182
- package/dist/engine-server/commonjs/es2017/engine-server.js +44 -11
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +44 -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 +8 -9
|
@@ -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.11.
|
|
293
|
+
/** version: 2.11.4 */
|
|
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.11.
|
|
436
|
+
/** version: 2.11.4 */
|
|
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
|
/*
|
|
@@ -2020,6 +2037,12 @@ var LWC = (function (exports) {
|
|
|
2020
2037
|
return isUndefined$1(meta) ? defaultMeta : meta;
|
|
2021
2038
|
}
|
|
2022
2039
|
|
|
2040
|
+
/*
|
|
2041
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2042
|
+
* All rights reserved.
|
|
2043
|
+
* SPDX-License-Identifier: MIT
|
|
2044
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2045
|
+
*/
|
|
2023
2046
|
const signedTemplateSet = new Set();
|
|
2024
2047
|
function defaultEmptyTemplate() {
|
|
2025
2048
|
return [];
|
|
@@ -2034,6 +2057,30 @@ var LWC = (function (exports) {
|
|
|
2034
2057
|
*/
|
|
2035
2058
|
function registerTemplate(tpl) {
|
|
2036
2059
|
signedTemplateSet.add(tpl);
|
|
2060
|
+
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2061
|
+
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2062
|
+
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2063
|
+
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2064
|
+
defineProperty(tpl, 'stylesheetTokens', {
|
|
2065
|
+
get() {
|
|
2066
|
+
const { stylesheetToken } = this;
|
|
2067
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
2068
|
+
return stylesheetToken;
|
|
2069
|
+
}
|
|
2070
|
+
// Shim for the old `stylesheetTokens` property
|
|
2071
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2072
|
+
return {
|
|
2073
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
2074
|
+
shadowAttribute: stylesheetToken,
|
|
2075
|
+
};
|
|
2076
|
+
},
|
|
2077
|
+
set(value) {
|
|
2078
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2079
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2080
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2081
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2082
|
+
},
|
|
2083
|
+
});
|
|
2037
2084
|
// chaining this method as a way to wrap existing
|
|
2038
2085
|
// assignment of templates easily, without too much transformation
|
|
2039
2086
|
return tpl;
|
|
@@ -3860,8 +3907,12 @@ var LWC = (function (exports) {
|
|
|
3860
3907
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3861
3908
|
* will prevent this function from being imported by userland code.
|
|
3862
3909
|
*/
|
|
3863
|
-
function registerComponent(
|
|
3864
|
-
|
|
3910
|
+
function registerComponent(
|
|
3911
|
+
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
3912
|
+
Ctor, { tmpl }) {
|
|
3913
|
+
if (isFunction$1(Ctor)) {
|
|
3914
|
+
signedTemplateMap.set(Ctor, tmpl);
|
|
3915
|
+
}
|
|
3865
3916
|
// chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
3866
3917
|
// without too much transformation
|
|
3867
3918
|
return Ctor;
|
|
@@ -3935,100 +3986,6 @@ var LWC = (function (exports) {
|
|
|
3935
3986
|
}
|
|
3936
3987
|
}
|
|
3937
3988
|
|
|
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
3989
|
/*
|
|
4033
3990
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4034
3991
|
* All rights reserved.
|
|
@@ -4074,32 +4031,12 @@ var LWC = (function (exports) {
|
|
|
4074
4031
|
/* GlobalHydrate */
|
|
4075
4032
|
, vm);
|
|
4076
4033
|
}
|
|
4077
|
-
function hydrateRootElement(elm) {
|
|
4078
|
-
const vm = getAssociatedVM(elm);
|
|
4079
|
-
runConnectedCallback(vm);
|
|
4080
|
-
hydrateVM(vm);
|
|
4081
|
-
}
|
|
4082
4034
|
function disconnectRootElement(elm) {
|
|
4083
4035
|
const vm = getAssociatedVM(elm);
|
|
4084
4036
|
resetComponentStateWhenRemoved(vm);
|
|
4085
4037
|
}
|
|
4086
4038
|
function appendVM(vm) {
|
|
4087
4039
|
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
4040
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4104
4041
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4105
4042
|
|
|
@@ -4365,7 +4302,6 @@ var LWC = (function (exports) {
|
|
|
4365
4302
|
, vm);
|
|
4366
4303
|
}
|
|
4367
4304
|
}
|
|
4368
|
-
|
|
4369
4305
|
let rehydrateQueue = [];
|
|
4370
4306
|
|
|
4371
4307
|
function flushRehydrationQueue() {
|
|
@@ -4986,6 +4922,237 @@ var LWC = (function (exports) {
|
|
|
4986
4922
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
4987
4923
|
}
|
|
4988
4924
|
|
|
4925
|
+
/*
|
|
4926
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4927
|
+
* All rights reserved.
|
|
4928
|
+
* SPDX-License-Identifier: MIT
|
|
4929
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4930
|
+
*/
|
|
4931
|
+
// flag indicating if the hydration recovered from the DOM mismatch
|
|
4932
|
+
let hasMismatch = false;
|
|
4933
|
+
function hydrateRoot(vm) {
|
|
4934
|
+
hasMismatch = false;
|
|
4935
|
+
runConnectedCallback(vm);
|
|
4936
|
+
hydrateVM(vm);
|
|
4937
|
+
if (hasMismatch) {
|
|
4938
|
+
logError('Hydration completed with errors.', vm);
|
|
4939
|
+
}
|
|
4940
|
+
}
|
|
4941
|
+
function hydrateVM(vm) {
|
|
4942
|
+
const children = renderComponent(vm);
|
|
4943
|
+
vm.children = children;
|
|
4944
|
+
const parentNode = vm.renderRoot;
|
|
4945
|
+
hydrateChildren(getFirstChild$1(parentNode), children, parentNode);
|
|
4946
|
+
runRenderedCallback(vm);
|
|
4947
|
+
}
|
|
4948
|
+
function hydrateNode(node, vnode) {
|
|
4949
|
+
let hydratedNode;
|
|
4950
|
+
switch (vnode.type) {
|
|
4951
|
+
case 0 /* Text */:
|
|
4952
|
+
hydratedNode = hydrateText(node, vnode);
|
|
4953
|
+
break;
|
|
4954
|
+
case 1 /* Comment */:
|
|
4955
|
+
hydratedNode = hydrateComment(node, vnode);
|
|
4956
|
+
break;
|
|
4957
|
+
case 2 /* Element */:
|
|
4958
|
+
hydratedNode = hydrateElement(node, vnode);
|
|
4959
|
+
break;
|
|
4960
|
+
case 3 /* CustomElement */:
|
|
4961
|
+
hydratedNode = hydrateCustomElement(node, vnode);
|
|
4962
|
+
break;
|
|
4963
|
+
}
|
|
4964
|
+
return nextSibling$1(hydratedNode);
|
|
4965
|
+
}
|
|
4966
|
+
function hydrateText(node, vnode) {
|
|
4967
|
+
var _a;
|
|
4968
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
|
|
4969
|
+
return handleMismatch(node, vnode);
|
|
4970
|
+
}
|
|
4971
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4972
|
+
vnode.elm = node;
|
|
4973
|
+
return node;
|
|
4974
|
+
}
|
|
4975
|
+
function hydrateComment(node, vnode) {
|
|
4976
|
+
var _a;
|
|
4977
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
|
|
4978
|
+
return handleMismatch(node, vnode);
|
|
4979
|
+
}
|
|
4980
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4981
|
+
vnode.elm = node;
|
|
4982
|
+
return node;
|
|
4983
|
+
}
|
|
4984
|
+
function hydrateElement(elm, vnode) {
|
|
4985
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
4986
|
+
!isMatchingElement(vnode, elm)) {
|
|
4987
|
+
return handleMismatch(elm, vnode);
|
|
4988
|
+
}
|
|
4989
|
+
vnode.elm = elm;
|
|
4990
|
+
const { context } = vnode.data;
|
|
4991
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
4992
|
+
if (isDomManual) {
|
|
4993
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
4994
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
4995
|
+
const { props } = vnode.data;
|
|
4996
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
4997
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
4998
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
4999
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
}
|
|
5003
|
+
patchElementPropsAndAttrs(vnode);
|
|
5004
|
+
if (!isDomManual) {
|
|
5005
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
|
|
5006
|
+
}
|
|
5007
|
+
return elm;
|
|
5008
|
+
}
|
|
5009
|
+
function hydrateCustomElement(elm, vnode) {
|
|
5010
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
5011
|
+
!isMatchingElement(vnode, elm)) {
|
|
5012
|
+
return handleMismatch(elm, vnode);
|
|
5013
|
+
}
|
|
5014
|
+
const { sel, mode, ctor, owner } = vnode;
|
|
5015
|
+
const vm = createVM(elm, ctor, {
|
|
5016
|
+
mode,
|
|
5017
|
+
owner,
|
|
5018
|
+
tagName: sel,
|
|
5019
|
+
});
|
|
5020
|
+
vnode.elm = elm;
|
|
5021
|
+
vnode.vm = vm;
|
|
5022
|
+
allocateChildren(vnode, vm);
|
|
5023
|
+
patchElementPropsAndAttrs(vnode);
|
|
5024
|
+
runConnectedCallback(vm);
|
|
5025
|
+
if (vm.renderMode !== 0 /* Light */) {
|
|
5026
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5027
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5028
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm);
|
|
5029
|
+
}
|
|
5030
|
+
hydrateVM(vm);
|
|
5031
|
+
return elm;
|
|
5032
|
+
}
|
|
5033
|
+
function hydrateChildren(node, children, parentNode, owner) {
|
|
5034
|
+
let nextNode = node;
|
|
5035
|
+
let anchor = null;
|
|
5036
|
+
for (let i = 0; i < children.length; i++) {
|
|
5037
|
+
const childVnode = children[i];
|
|
5038
|
+
if (!isNull(childVnode)) {
|
|
5039
|
+
if (nextNode) {
|
|
5040
|
+
nextNode = hydrateNode(nextNode, childVnode);
|
|
5041
|
+
anchor = childVnode.elm;
|
|
5042
|
+
}
|
|
5043
|
+
else {
|
|
5044
|
+
hasMismatch = true;
|
|
5045
|
+
mount(childVnode, parentNode, anchor);
|
|
5046
|
+
anchor = childVnode.elm;
|
|
5047
|
+
}
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
if (nextNode) {
|
|
5051
|
+
hasMismatch = true;
|
|
5052
|
+
do {
|
|
5053
|
+
const current = nextNode;
|
|
5054
|
+
nextNode = nextSibling$1(nextNode);
|
|
5055
|
+
removeNode(current, parentNode);
|
|
5056
|
+
} while (nextNode);
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
function handleMismatch(node, vnode, msg) {
|
|
5060
|
+
hasMismatch = true;
|
|
5061
|
+
const parentNode = getProperty$1(node, 'parentNode');
|
|
5062
|
+
mount(vnode, parentNode, node);
|
|
5063
|
+
removeNode(node, parentNode);
|
|
5064
|
+
return vnode.elm;
|
|
5065
|
+
}
|
|
5066
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
5067
|
+
applyEventListeners(vnode);
|
|
5068
|
+
patchProps(null, vnode);
|
|
5069
|
+
}
|
|
5070
|
+
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
5071
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
5072
|
+
return false;
|
|
5073
|
+
}
|
|
5074
|
+
return true;
|
|
5075
|
+
}
|
|
5076
|
+
function isMatchingElement(vnode, elm) {
|
|
5077
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
5078
|
+
return false;
|
|
5079
|
+
}
|
|
5080
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5081
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5082
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5083
|
+
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5084
|
+
}
|
|
5085
|
+
function validateAttrs(vnode, elm) {
|
|
5086
|
+
const { data: { attrs = {} }, } = vnode;
|
|
5087
|
+
let nodesAreCompatible = true;
|
|
5088
|
+
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5089
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5090
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5091
|
+
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
5092
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
5093
|
+
nodesAreCompatible = false;
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
5096
|
+
return nodesAreCompatible;
|
|
5097
|
+
}
|
|
5098
|
+
function validateClassAttr(vnode, elm) {
|
|
5099
|
+
const { data: { className, classMap }, } = vnode;
|
|
5100
|
+
let nodesAreCompatible = true;
|
|
5101
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
5102
|
+
// className is used when class is bound to an expr.
|
|
5103
|
+
nodesAreCompatible = false;
|
|
5104
|
+
}
|
|
5105
|
+
else if (!isUndefined$1(classMap)) {
|
|
5106
|
+
// classMap is used when class is set to static value.
|
|
5107
|
+
const classList = getClassList$1(elm);
|
|
5108
|
+
let computedClassName = '';
|
|
5109
|
+
// all classes from the vnode should be in the element.classList
|
|
5110
|
+
for (const name in classMap) {
|
|
5111
|
+
computedClassName += ' ' + name;
|
|
5112
|
+
if (!classList.contains(name)) {
|
|
5113
|
+
nodesAreCompatible = false;
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5116
|
+
computedClassName.trim();
|
|
5117
|
+
if (classList.length > keys(classMap).length) {
|
|
5118
|
+
nodesAreCompatible = false;
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5121
|
+
return nodesAreCompatible;
|
|
5122
|
+
}
|
|
5123
|
+
function validateStyleAttr(vnode, elm) {
|
|
5124
|
+
const { data: { style, styleDecls }, } = vnode;
|
|
5125
|
+
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
5126
|
+
let nodesAreCompatible = true;
|
|
5127
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5128
|
+
nodesAreCompatible = false;
|
|
5129
|
+
}
|
|
5130
|
+
else if (!isUndefined$1(styleDecls)) {
|
|
5131
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5132
|
+
const expectedStyle = [];
|
|
5133
|
+
// styleMap is used when style is set to static value.
|
|
5134
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
5135
|
+
const [prop, value, important] = styleDecls[i];
|
|
5136
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
5137
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
5138
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
5139
|
+
nodesAreCompatible = false;
|
|
5140
|
+
}
|
|
5141
|
+
else if (!parsedPropValue.startsWith(value)) {
|
|
5142
|
+
nodesAreCompatible = false;
|
|
5143
|
+
}
|
|
5144
|
+
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
5145
|
+
nodesAreCompatible = false;
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
5149
|
+
nodesAreCompatible = false;
|
|
5150
|
+
}
|
|
5151
|
+
ArrayJoin.call(expectedStyle, ';');
|
|
5152
|
+
}
|
|
5153
|
+
return nodesAreCompatible;
|
|
5154
|
+
}
|
|
5155
|
+
|
|
4989
5156
|
/*
|
|
4990
5157
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4991
5158
|
* All rights reserved.
|
|
@@ -4998,7 +5165,7 @@ var LWC = (function (exports) {
|
|
|
4998
5165
|
hooksAreSet = true;
|
|
4999
5166
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5000
5167
|
}
|
|
5001
|
-
/* version: 2.11.
|
|
5168
|
+
/* version: 2.11.4 */
|
|
5002
5169
|
|
|
5003
5170
|
/*
|
|
5004
5171
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5318,7 +5485,7 @@ var LWC = (function (exports) {
|
|
|
5318
5485
|
}
|
|
5319
5486
|
}
|
|
5320
5487
|
function createVMWithProps(element, Ctor, props) {
|
|
5321
|
-
createVM(element, Ctor, {
|
|
5488
|
+
const vm = createVM(element, Ctor, {
|
|
5322
5489
|
mode: 'open',
|
|
5323
5490
|
owner: null,
|
|
5324
5491
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -5326,6 +5493,7 @@ var LWC = (function (exports) {
|
|
|
5326
5493
|
for (const [key, value] of Object.entries(props)) {
|
|
5327
5494
|
element[key] = value;
|
|
5328
5495
|
}
|
|
5496
|
+
return vm;
|
|
5329
5497
|
}
|
|
5330
5498
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
5331
5499
|
if (!(element instanceof Element)) {
|
|
@@ -5346,8 +5514,8 @@ var LWC = (function (exports) {
|
|
|
5346
5514
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
5347
5515
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
5348
5516
|
setIsHydrating(true);
|
|
5349
|
-
createVMWithProps(element, Ctor, props);
|
|
5350
|
-
|
|
5517
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
5518
|
+
hydrateRoot(vm);
|
|
5351
5519
|
// set it back since now we finished hydration.
|
|
5352
5520
|
setIsHydrating(false);
|
|
5353
5521
|
}
|
|
@@ -5604,7 +5772,7 @@ var LWC = (function (exports) {
|
|
|
5604
5772
|
});
|
|
5605
5773
|
freeze(LightningElement);
|
|
5606
5774
|
seal(LightningElement.prototype);
|
|
5607
|
-
/* version: 2.11.
|
|
5775
|
+
/* version: 2.11.4 */
|
|
5608
5776
|
|
|
5609
5777
|
exports.LightningElement = LightningElement;
|
|
5610
5778
|
exports.__unstable__ProfilerControl = profilerControl;
|