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