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
|
@@ -298,9 +298,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
298
298
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
299
299
|
*/
|
|
300
300
|
// Increment whenever the LWC template compiler changes
|
|
301
|
-
const LWC_VERSION = "2.11.
|
|
301
|
+
const LWC_VERSION = "2.11.4";
|
|
302
302
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
303
|
-
/** version: 2.11.
|
|
303
|
+
/** version: 2.11.4 */
|
|
304
304
|
|
|
305
305
|
/*
|
|
306
306
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -453,7 +453,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
453
453
|
setFeatureFlag(name, value);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
-
/** version: 2.11.
|
|
456
|
+
/** version: 2.11.4 */
|
|
457
457
|
|
|
458
458
|
/* proxy-compat-disable */
|
|
459
459
|
|
|
@@ -2758,6 +2758,12 @@ function checkVersionMismatch(func, type) {
|
|
|
2758
2758
|
}
|
|
2759
2759
|
}
|
|
2760
2760
|
|
|
2761
|
+
/*
|
|
2762
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2763
|
+
* All rights reserved.
|
|
2764
|
+
* SPDX-License-Identifier: MIT
|
|
2765
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2766
|
+
*/
|
|
2761
2767
|
const signedTemplateSet = new Set();
|
|
2762
2768
|
function defaultEmptyTemplate() {
|
|
2763
2769
|
return [];
|
|
@@ -2775,6 +2781,30 @@ function registerTemplate(tpl) {
|
|
|
2775
2781
|
checkVersionMismatch(tpl, 'template');
|
|
2776
2782
|
}
|
|
2777
2783
|
signedTemplateSet.add(tpl);
|
|
2784
|
+
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2785
|
+
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2786
|
+
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2787
|
+
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2788
|
+
defineProperty(tpl, 'stylesheetTokens', {
|
|
2789
|
+
get() {
|
|
2790
|
+
const { stylesheetToken } = this;
|
|
2791
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
2792
|
+
return stylesheetToken;
|
|
2793
|
+
}
|
|
2794
|
+
// Shim for the old `stylesheetTokens` property
|
|
2795
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2796
|
+
return {
|
|
2797
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
2798
|
+
shadowAttribute: stylesheetToken,
|
|
2799
|
+
};
|
|
2800
|
+
},
|
|
2801
|
+
set(value) {
|
|
2802
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2803
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2804
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2805
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2806
|
+
},
|
|
2807
|
+
});
|
|
2778
2808
|
// chaining this method as a way to wrap existing
|
|
2779
2809
|
// assignment of templates easily, without too much transformation
|
|
2780
2810
|
return tpl;
|
|
@@ -5156,11 +5186,15 @@ const signedTemplateMap = new Map();
|
|
|
5156
5186
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
5157
5187
|
* will prevent this function from being imported by userland code.
|
|
5158
5188
|
*/
|
|
5159
|
-
function registerComponent(
|
|
5160
|
-
|
|
5161
|
-
|
|
5189
|
+
function registerComponent(
|
|
5190
|
+
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
5191
|
+
Ctor, { tmpl }) {
|
|
5192
|
+
if (isFunction$1(Ctor)) {
|
|
5193
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5194
|
+
checkVersionMismatch(Ctor, 'component');
|
|
5195
|
+
}
|
|
5196
|
+
signedTemplateMap.set(Ctor, tmpl);
|
|
5162
5197
|
}
|
|
5163
|
-
signedTemplateMap.set(Ctor, tmpl);
|
|
5164
5198
|
// chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
5165
5199
|
// without too much transformation
|
|
5166
5200
|
return Ctor;
|
|
@@ -5249,236 +5283,6 @@ function invokeServiceHook(vm, cbs) {
|
|
|
5249
5283
|
}
|
|
5250
5284
|
}
|
|
5251
5285
|
|
|
5252
|
-
/*
|
|
5253
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
5254
|
-
* All rights reserved.
|
|
5255
|
-
* SPDX-License-Identifier: MIT
|
|
5256
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5257
|
-
*/
|
|
5258
|
-
function hydrate(vnode, node) {
|
|
5259
|
-
switch (vnode.type) {
|
|
5260
|
-
case 0 /* Text */:
|
|
5261
|
-
hydrateText(vnode, node);
|
|
5262
|
-
break;
|
|
5263
|
-
case 1 /* Comment */:
|
|
5264
|
-
hydrateComment(vnode, node);
|
|
5265
|
-
break;
|
|
5266
|
-
case 2 /* Element */:
|
|
5267
|
-
hydrateElement(vnode, node);
|
|
5268
|
-
break;
|
|
5269
|
-
case 3 /* CustomElement */:
|
|
5270
|
-
hydrateCustomElement(vnode, node);
|
|
5271
|
-
break;
|
|
5272
|
-
}
|
|
5273
|
-
}
|
|
5274
|
-
function hydrateText(vnode, node) {
|
|
5275
|
-
var _a;
|
|
5276
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5277
|
-
validateNodeType(vnode, node, 3 /* TEXT */);
|
|
5278
|
-
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
5279
|
-
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
5280
|
-
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
5281
|
-
}
|
|
5282
|
-
}
|
|
5283
|
-
// always set the text value to the one from the vnode.
|
|
5284
|
-
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5285
|
-
vnode.elm = node;
|
|
5286
|
-
}
|
|
5287
|
-
function hydrateComment(vnode, node) {
|
|
5288
|
-
var _a;
|
|
5289
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5290
|
-
validateNodeType(vnode, node, 8 /* COMMENT */);
|
|
5291
|
-
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
5292
|
-
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
5293
|
-
}
|
|
5294
|
-
}
|
|
5295
|
-
// always set the text value to the one from the vnode.
|
|
5296
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5297
|
-
vnode.elm = node;
|
|
5298
|
-
}
|
|
5299
|
-
function hydrateElement(vnode, node) {
|
|
5300
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5301
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5302
|
-
validateElement(vnode, node);
|
|
5303
|
-
}
|
|
5304
|
-
const elm = node;
|
|
5305
|
-
vnode.elm = elm;
|
|
5306
|
-
const { context } = vnode.data;
|
|
5307
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
5308
|
-
if (isDomManual) {
|
|
5309
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5310
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5311
|
-
const { props } = vnode.data;
|
|
5312
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5313
|
-
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
5314
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
5315
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
5316
|
-
}
|
|
5317
|
-
else {
|
|
5318
|
-
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5319
|
-
}
|
|
5320
|
-
}
|
|
5321
|
-
}
|
|
5322
|
-
patchElementPropsAndAttrs(vnode);
|
|
5323
|
-
if (!isDomManual) {
|
|
5324
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
function hydrateCustomElement(vnode, node) {
|
|
5328
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5329
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5330
|
-
validateElement(vnode, node);
|
|
5331
|
-
}
|
|
5332
|
-
const elm = node;
|
|
5333
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
5334
|
-
const vm = createVM(elm, ctor, {
|
|
5335
|
-
mode,
|
|
5336
|
-
owner,
|
|
5337
|
-
tagName: sel,
|
|
5338
|
-
});
|
|
5339
|
-
vnode.elm = elm;
|
|
5340
|
-
vnode.vm = vm;
|
|
5341
|
-
allocateChildren(vnode, vm);
|
|
5342
|
-
patchElementPropsAndAttrs(vnode);
|
|
5343
|
-
// Insert hook section:
|
|
5344
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5345
|
-
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
5346
|
-
}
|
|
5347
|
-
runConnectedCallback(vm);
|
|
5348
|
-
if (vm.renderMode !== 0 /* Light */) {
|
|
5349
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5350
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5351
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
5352
|
-
}
|
|
5353
|
-
hydrateVM(vm);
|
|
5354
|
-
}
|
|
5355
|
-
function hydrateChildren(elmChildren, children, vm) {
|
|
5356
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5357
|
-
const filteredVNodes = ArrayFilter.call(children, (vnode) => !!vnode);
|
|
5358
|
-
if (elmChildren.length !== filteredVNodes.length) {
|
|
5359
|
-
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
5360
|
-
throwHydrationError();
|
|
5361
|
-
}
|
|
5362
|
-
}
|
|
5363
|
-
let childNodeIndex = 0;
|
|
5364
|
-
for (let i = 0; i < children.length; i++) {
|
|
5365
|
-
const childVnode = children[i];
|
|
5366
|
-
if (!isNull(childVnode)) {
|
|
5367
|
-
const childNode = elmChildren[childNodeIndex];
|
|
5368
|
-
hydrate(childVnode, childNode);
|
|
5369
|
-
childNodeIndex++;
|
|
5370
|
-
}
|
|
5371
|
-
}
|
|
5372
|
-
}
|
|
5373
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
5374
|
-
applyEventListeners(vnode);
|
|
5375
|
-
patchProps(null, vnode);
|
|
5376
|
-
}
|
|
5377
|
-
function throwHydrationError() {
|
|
5378
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
5379
|
-
}
|
|
5380
|
-
function validateNodeType(vnode, node, nodeType) {
|
|
5381
|
-
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
5382
|
-
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
5383
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5384
|
-
}
|
|
5385
|
-
}
|
|
5386
|
-
function validateElement(vnode, elm) {
|
|
5387
|
-
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
5388
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
5389
|
-
throwHydrationError();
|
|
5390
|
-
}
|
|
5391
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5392
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5393
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5394
|
-
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5395
|
-
if (!isVNodeAndElementCompatible) {
|
|
5396
|
-
throwHydrationError();
|
|
5397
|
-
}
|
|
5398
|
-
}
|
|
5399
|
-
function validateAttrs(vnode, elm) {
|
|
5400
|
-
const { data: { attrs = {} }, } = vnode;
|
|
5401
|
-
let nodesAreCompatible = true;
|
|
5402
|
-
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5403
|
-
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5404
|
-
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5405
|
-
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
5406
|
-
if (String(attrValue) !== elmAttrValue) {
|
|
5407
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
5408
|
-
nodesAreCompatible = false;
|
|
5409
|
-
}
|
|
5410
|
-
}
|
|
5411
|
-
return nodesAreCompatible;
|
|
5412
|
-
}
|
|
5413
|
-
function validateClassAttr(vnode, elm) {
|
|
5414
|
-
const { data: { className, classMap }, } = vnode;
|
|
5415
|
-
let nodesAreCompatible = true;
|
|
5416
|
-
let vnodeClassName;
|
|
5417
|
-
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
5418
|
-
// className is used when class is bound to an expr.
|
|
5419
|
-
nodesAreCompatible = false;
|
|
5420
|
-
vnodeClassName = className;
|
|
5421
|
-
}
|
|
5422
|
-
else if (!isUndefined$1(classMap)) {
|
|
5423
|
-
// classMap is used when class is set to static value.
|
|
5424
|
-
const classList = getClassList$1(elm);
|
|
5425
|
-
let computedClassName = '';
|
|
5426
|
-
// all classes from the vnode should be in the element.classList
|
|
5427
|
-
for (const name in classMap) {
|
|
5428
|
-
computedClassName += ' ' + name;
|
|
5429
|
-
if (!classList.contains(name)) {
|
|
5430
|
-
nodesAreCompatible = false;
|
|
5431
|
-
}
|
|
5432
|
-
}
|
|
5433
|
-
vnodeClassName = computedClassName.trim();
|
|
5434
|
-
if (classList.length > keys(classMap).length) {
|
|
5435
|
-
nodesAreCompatible = false;
|
|
5436
|
-
}
|
|
5437
|
-
}
|
|
5438
|
-
if (!nodesAreCompatible) {
|
|
5439
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
5440
|
-
}
|
|
5441
|
-
return nodesAreCompatible;
|
|
5442
|
-
}
|
|
5443
|
-
function validateStyleAttr(vnode, elm) {
|
|
5444
|
-
const { data: { style, styleDecls }, } = vnode;
|
|
5445
|
-
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
5446
|
-
let vnodeStyle;
|
|
5447
|
-
let nodesAreCompatible = true;
|
|
5448
|
-
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5449
|
-
nodesAreCompatible = false;
|
|
5450
|
-
vnodeStyle = style;
|
|
5451
|
-
}
|
|
5452
|
-
else if (!isUndefined$1(styleDecls)) {
|
|
5453
|
-
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5454
|
-
const expectedStyle = [];
|
|
5455
|
-
// styleMap is used when style is set to static value.
|
|
5456
|
-
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
5457
|
-
const [prop, value, important] = styleDecls[i];
|
|
5458
|
-
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
5459
|
-
const parsedPropValue = parsedVnodeStyle[prop];
|
|
5460
|
-
if (isUndefined$1(parsedPropValue)) {
|
|
5461
|
-
nodesAreCompatible = false;
|
|
5462
|
-
}
|
|
5463
|
-
else if (!parsedPropValue.startsWith(value)) {
|
|
5464
|
-
nodesAreCompatible = false;
|
|
5465
|
-
}
|
|
5466
|
-
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
5467
|
-
nodesAreCompatible = false;
|
|
5468
|
-
}
|
|
5469
|
-
}
|
|
5470
|
-
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
5471
|
-
nodesAreCompatible = false;
|
|
5472
|
-
}
|
|
5473
|
-
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
5474
|
-
}
|
|
5475
|
-
if (!nodesAreCompatible) {
|
|
5476
|
-
// style is used when class is bound to an expr.
|
|
5477
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
5478
|
-
}
|
|
5479
|
-
return nodesAreCompatible;
|
|
5480
|
-
}
|
|
5481
|
-
|
|
5482
5286
|
/*
|
|
5483
5287
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5484
5288
|
* All rights reserved.
|
|
@@ -5524,32 +5328,12 @@ function connectRootElement(elm) {
|
|
|
5524
5328
|
/* GlobalHydrate */
|
|
5525
5329
|
, vm);
|
|
5526
5330
|
}
|
|
5527
|
-
function hydrateRootElement(elm) {
|
|
5528
|
-
const vm = getAssociatedVM(elm);
|
|
5529
|
-
runConnectedCallback(vm);
|
|
5530
|
-
hydrateVM(vm);
|
|
5531
|
-
}
|
|
5532
5331
|
function disconnectRootElement(elm) {
|
|
5533
5332
|
const vm = getAssociatedVM(elm);
|
|
5534
5333
|
resetComponentStateWhenRemoved(vm);
|
|
5535
5334
|
}
|
|
5536
5335
|
function appendVM(vm) {
|
|
5537
5336
|
rehydrate(vm);
|
|
5538
|
-
}
|
|
5539
|
-
function hydrateVM(vm) {
|
|
5540
|
-
if (isTrue(vm.isDirty)) {
|
|
5541
|
-
// manually diffing/patching here.
|
|
5542
|
-
// This routine is:
|
|
5543
|
-
// patchShadowRoot(vm, children);
|
|
5544
|
-
// -> addVnodes.
|
|
5545
|
-
const children = renderComponent(vm);
|
|
5546
|
-
vm.children = children;
|
|
5547
|
-
const vmChildren = vm.renderMode === 0
|
|
5548
|
-
/* Light */
|
|
5549
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
5550
|
-
hydrateChildren(vmChildren, children, vm);
|
|
5551
|
-
runRenderedCallback(vm);
|
|
5552
|
-
}
|
|
5553
5337
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
5554
5338
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5555
5339
|
|
|
@@ -5854,7 +5638,6 @@ function runRenderedCallback(vm) {
|
|
|
5854
5638
|
, vm);
|
|
5855
5639
|
}
|
|
5856
5640
|
}
|
|
5857
|
-
|
|
5858
5641
|
let rehydrateQueue = [];
|
|
5859
5642
|
|
|
5860
5643
|
function flushRehydrationQueue() {
|
|
@@ -6511,6 +6294,298 @@ function readonly(obj) {
|
|
|
6511
6294
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
6512
6295
|
}
|
|
6513
6296
|
|
|
6297
|
+
/*
|
|
6298
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6299
|
+
* All rights reserved.
|
|
6300
|
+
* SPDX-License-Identifier: MIT
|
|
6301
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6302
|
+
*/
|
|
6303
|
+
// flag indicating if the hydration recovered from the DOM mismatch
|
|
6304
|
+
let hasMismatch = false;
|
|
6305
|
+
function hydrateRoot(vm) {
|
|
6306
|
+
hasMismatch = false;
|
|
6307
|
+
runConnectedCallback(vm);
|
|
6308
|
+
hydrateVM(vm);
|
|
6309
|
+
if (hasMismatch) {
|
|
6310
|
+
logError('Hydration completed with errors.', vm);
|
|
6311
|
+
}
|
|
6312
|
+
}
|
|
6313
|
+
function hydrateVM(vm) {
|
|
6314
|
+
const children = renderComponent(vm);
|
|
6315
|
+
vm.children = children;
|
|
6316
|
+
const parentNode = vm.renderRoot;
|
|
6317
|
+
hydrateChildren(getFirstChild$1(parentNode), children, parentNode, vm);
|
|
6318
|
+
runRenderedCallback(vm);
|
|
6319
|
+
}
|
|
6320
|
+
function hydrateNode(node, vnode) {
|
|
6321
|
+
let hydratedNode;
|
|
6322
|
+
switch (vnode.type) {
|
|
6323
|
+
case 0 /* Text */:
|
|
6324
|
+
hydratedNode = hydrateText(node, vnode);
|
|
6325
|
+
break;
|
|
6326
|
+
case 1 /* Comment */:
|
|
6327
|
+
hydratedNode = hydrateComment(node, vnode);
|
|
6328
|
+
break;
|
|
6329
|
+
case 2 /* Element */:
|
|
6330
|
+
hydratedNode = hydrateElement(node, vnode);
|
|
6331
|
+
break;
|
|
6332
|
+
case 3 /* CustomElement */:
|
|
6333
|
+
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6334
|
+
break;
|
|
6335
|
+
}
|
|
6336
|
+
return nextSibling$1(hydratedNode);
|
|
6337
|
+
}
|
|
6338
|
+
function hydrateText(node, vnode) {
|
|
6339
|
+
var _a;
|
|
6340
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
|
|
6341
|
+
return handleMismatch(node, vnode);
|
|
6342
|
+
}
|
|
6343
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6344
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6345
|
+
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6346
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6347
|
+
}
|
|
6348
|
+
}
|
|
6349
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6350
|
+
vnode.elm = node;
|
|
6351
|
+
return node;
|
|
6352
|
+
}
|
|
6353
|
+
function hydrateComment(node, vnode) {
|
|
6354
|
+
var _a;
|
|
6355
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
|
|
6356
|
+
return handleMismatch(node, vnode);
|
|
6357
|
+
}
|
|
6358
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6359
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6360
|
+
if (nodeValue !== vnode.text) {
|
|
6361
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6365
|
+
vnode.elm = node;
|
|
6366
|
+
return node;
|
|
6367
|
+
}
|
|
6368
|
+
function hydrateElement(elm, vnode) {
|
|
6369
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6370
|
+
!isMatchingElement(vnode, elm)) {
|
|
6371
|
+
return handleMismatch(elm, vnode);
|
|
6372
|
+
}
|
|
6373
|
+
vnode.elm = elm;
|
|
6374
|
+
const { context } = vnode.data;
|
|
6375
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6376
|
+
if (isDomManual) {
|
|
6377
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6378
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6379
|
+
const { props } = vnode.data;
|
|
6380
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6381
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
6382
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6383
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6384
|
+
}
|
|
6385
|
+
else {
|
|
6386
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6387
|
+
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
6388
|
+
}
|
|
6389
|
+
}
|
|
6390
|
+
}
|
|
6391
|
+
}
|
|
6392
|
+
patchElementPropsAndAttrs(vnode);
|
|
6393
|
+
if (!isDomManual) {
|
|
6394
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
|
|
6395
|
+
}
|
|
6396
|
+
return elm;
|
|
6397
|
+
}
|
|
6398
|
+
function hydrateCustomElement(elm, vnode) {
|
|
6399
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6400
|
+
!isMatchingElement(vnode, elm)) {
|
|
6401
|
+
return handleMismatch(elm, vnode);
|
|
6402
|
+
}
|
|
6403
|
+
const { sel, mode, ctor, owner } = vnode;
|
|
6404
|
+
const vm = createVM(elm, ctor, {
|
|
6405
|
+
mode,
|
|
6406
|
+
owner,
|
|
6407
|
+
tagName: sel,
|
|
6408
|
+
});
|
|
6409
|
+
vnode.elm = elm;
|
|
6410
|
+
vnode.vm = vm;
|
|
6411
|
+
allocateChildren(vnode, vm);
|
|
6412
|
+
patchElementPropsAndAttrs(vnode);
|
|
6413
|
+
// Insert hook section:
|
|
6414
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6415
|
+
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6416
|
+
}
|
|
6417
|
+
runConnectedCallback(vm);
|
|
6418
|
+
if (vm.renderMode !== 0 /* Light */) {
|
|
6419
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6420
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6421
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vm);
|
|
6422
|
+
}
|
|
6423
|
+
hydrateVM(vm);
|
|
6424
|
+
return elm;
|
|
6425
|
+
}
|
|
6426
|
+
function hydrateChildren(node, children, parentNode, owner) {
|
|
6427
|
+
let hasWarned = false;
|
|
6428
|
+
let nextNode = node;
|
|
6429
|
+
let anchor = null;
|
|
6430
|
+
for (let i = 0; i < children.length; i++) {
|
|
6431
|
+
const childVnode = children[i];
|
|
6432
|
+
if (!isNull(childVnode)) {
|
|
6433
|
+
if (nextNode) {
|
|
6434
|
+
nextNode = hydrateNode(nextNode, childVnode);
|
|
6435
|
+
anchor = childVnode.elm;
|
|
6436
|
+
}
|
|
6437
|
+
else {
|
|
6438
|
+
hasMismatch = true;
|
|
6439
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6440
|
+
if (!hasWarned) {
|
|
6441
|
+
hasWarned = true;
|
|
6442
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6443
|
+
}
|
|
6444
|
+
}
|
|
6445
|
+
mount(childVnode, parentNode, anchor);
|
|
6446
|
+
anchor = childVnode.elm;
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
}
|
|
6450
|
+
if (nextNode) {
|
|
6451
|
+
hasMismatch = true;
|
|
6452
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6453
|
+
if (!hasWarned) {
|
|
6454
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
do {
|
|
6458
|
+
const current = nextNode;
|
|
6459
|
+
nextNode = nextSibling$1(nextNode);
|
|
6460
|
+
removeNode(current, parentNode);
|
|
6461
|
+
} while (nextNode);
|
|
6462
|
+
}
|
|
6463
|
+
}
|
|
6464
|
+
function handleMismatch(node, vnode, msg) {
|
|
6465
|
+
hasMismatch = true;
|
|
6466
|
+
if (!isUndefined$1(msg)) {
|
|
6467
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6468
|
+
logError(msg, vnode.owner);
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
const parentNode = getProperty$1(node, 'parentNode');
|
|
6472
|
+
mount(vnode, parentNode, node);
|
|
6473
|
+
removeNode(node, parentNode);
|
|
6474
|
+
return vnode.elm;
|
|
6475
|
+
}
|
|
6476
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
6477
|
+
applyEventListeners(vnode);
|
|
6478
|
+
patchProps(null, vnode);
|
|
6479
|
+
}
|
|
6480
|
+
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6481
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
6482
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6483
|
+
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6484
|
+
}
|
|
6485
|
+
return false;
|
|
6486
|
+
}
|
|
6487
|
+
return true;
|
|
6488
|
+
}
|
|
6489
|
+
function isMatchingElement(vnode, elm) {
|
|
6490
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
6491
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6492
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6493
|
+
}
|
|
6494
|
+
return false;
|
|
6495
|
+
}
|
|
6496
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6497
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6498
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6499
|
+
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6500
|
+
}
|
|
6501
|
+
function validateAttrs(vnode, elm) {
|
|
6502
|
+
const { data: { attrs = {} }, } = vnode;
|
|
6503
|
+
let nodesAreCompatible = true;
|
|
6504
|
+
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6505
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6506
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6507
|
+
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
6508
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
6509
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6510
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
6511
|
+
}
|
|
6512
|
+
nodesAreCompatible = false;
|
|
6513
|
+
}
|
|
6514
|
+
}
|
|
6515
|
+
return nodesAreCompatible;
|
|
6516
|
+
}
|
|
6517
|
+
function validateClassAttr(vnode, elm) {
|
|
6518
|
+
const { data: { className, classMap }, } = vnode;
|
|
6519
|
+
let nodesAreCompatible = true;
|
|
6520
|
+
let vnodeClassName;
|
|
6521
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
6522
|
+
// className is used when class is bound to an expr.
|
|
6523
|
+
nodesAreCompatible = false;
|
|
6524
|
+
vnodeClassName = className;
|
|
6525
|
+
}
|
|
6526
|
+
else if (!isUndefined$1(classMap)) {
|
|
6527
|
+
// classMap is used when class is set to static value.
|
|
6528
|
+
const classList = getClassList$1(elm);
|
|
6529
|
+
let computedClassName = '';
|
|
6530
|
+
// all classes from the vnode should be in the element.classList
|
|
6531
|
+
for (const name in classMap) {
|
|
6532
|
+
computedClassName += ' ' + name;
|
|
6533
|
+
if (!classList.contains(name)) {
|
|
6534
|
+
nodesAreCompatible = false;
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
vnodeClassName = computedClassName.trim();
|
|
6538
|
+
if (classList.length > keys(classMap).length) {
|
|
6539
|
+
nodesAreCompatible = false;
|
|
6540
|
+
}
|
|
6541
|
+
}
|
|
6542
|
+
if (!nodesAreCompatible) {
|
|
6543
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6544
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
return nodesAreCompatible;
|
|
6548
|
+
}
|
|
6549
|
+
function validateStyleAttr(vnode, elm) {
|
|
6550
|
+
const { data: { style, styleDecls }, } = vnode;
|
|
6551
|
+
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
6552
|
+
let vnodeStyle;
|
|
6553
|
+
let nodesAreCompatible = true;
|
|
6554
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
6555
|
+
nodesAreCompatible = false;
|
|
6556
|
+
vnodeStyle = style;
|
|
6557
|
+
}
|
|
6558
|
+
else if (!isUndefined$1(styleDecls)) {
|
|
6559
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6560
|
+
const expectedStyle = [];
|
|
6561
|
+
// styleMap is used when style is set to static value.
|
|
6562
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
6563
|
+
const [prop, value, important] = styleDecls[i];
|
|
6564
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
6565
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
6566
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
6567
|
+
nodesAreCompatible = false;
|
|
6568
|
+
}
|
|
6569
|
+
else if (!parsedPropValue.startsWith(value)) {
|
|
6570
|
+
nodesAreCompatible = false;
|
|
6571
|
+
}
|
|
6572
|
+
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
6573
|
+
nodesAreCompatible = false;
|
|
6574
|
+
}
|
|
6575
|
+
}
|
|
6576
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
6577
|
+
nodesAreCompatible = false;
|
|
6578
|
+
}
|
|
6579
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
6580
|
+
}
|
|
6581
|
+
if (!nodesAreCompatible) {
|
|
6582
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6583
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
return nodesAreCompatible;
|
|
6587
|
+
}
|
|
6588
|
+
|
|
6514
6589
|
/*
|
|
6515
6590
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6516
6591
|
* All rights reserved.
|
|
@@ -6523,7 +6598,7 @@ function setHooks(hooks) {
|
|
|
6523
6598
|
hooksAreSet = true;
|
|
6524
6599
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6525
6600
|
}
|
|
6526
|
-
/* version: 2.11.
|
|
6601
|
+
/* version: 2.11.4 */
|
|
6527
6602
|
|
|
6528
6603
|
/*
|
|
6529
6604
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6868,7 +6943,7 @@ function resetShadowRootAndLightDom(element, Ctor) {
|
|
|
6868
6943
|
}
|
|
6869
6944
|
}
|
|
6870
6945
|
function createVMWithProps(element, Ctor, props) {
|
|
6871
|
-
createVM(element, Ctor, {
|
|
6946
|
+
const vm = createVM(element, Ctor, {
|
|
6872
6947
|
mode: 'open',
|
|
6873
6948
|
owner: null,
|
|
6874
6949
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -6876,6 +6951,7 @@ function createVMWithProps(element, Ctor, props) {
|
|
|
6876
6951
|
for (const [key, value] of Object.entries(props)) {
|
|
6877
6952
|
element[key] = value;
|
|
6878
6953
|
}
|
|
6954
|
+
return vm;
|
|
6879
6955
|
}
|
|
6880
6956
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
6881
6957
|
if (!(element instanceof Element)) {
|
|
@@ -6896,8 +6972,8 @@ function hydrateComponent(element, Ctor, props = {}) {
|
|
|
6896
6972
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6897
6973
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
6898
6974
|
setIsHydrating(true);
|
|
6899
|
-
createVMWithProps(element, Ctor, props);
|
|
6900
|
-
|
|
6975
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
6976
|
+
hydrateRoot(vm);
|
|
6901
6977
|
// set it back since now we finished hydration.
|
|
6902
6978
|
setIsHydrating(false);
|
|
6903
6979
|
}
|
|
@@ -7162,6 +7238,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
7162
7238
|
});
|
|
7163
7239
|
freeze(LightningElement);
|
|
7164
7240
|
seal(LightningElement.prototype);
|
|
7165
|
-
/* version: 2.11.
|
|
7241
|
+
/* version: 2.11.4 */
|
|
7166
7242
|
|
|
7167
7243
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|