lwc 2.11.1 → 2.11.5
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 +331 -259
- package/dist/engine-dom/iife/es2017/engine-dom.js +331 -259
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +288 -124
- package/dist/engine-dom/iife/es5/engine-dom.js +1132 -1046
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +418 -180
- package/dist/engine-dom/umd/es2017/engine-dom.js +331 -259
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +288 -124
- package/dist/engine-dom/umd/es5/engine-dom.js +1132 -1046
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +418 -180
- package/dist/engine-server/commonjs/es2017/engine-server.js +36 -7
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +36 -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 +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.5";
|
|
302
302
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
303
|
-
/** version: 2.11.
|
|
303
|
+
/** version: 2.11.5 */
|
|
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.5 */
|
|
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;
|
|
@@ -5253,236 +5283,6 @@ function invokeServiceHook(vm, cbs) {
|
|
|
5253
5283
|
}
|
|
5254
5284
|
}
|
|
5255
5285
|
|
|
5256
|
-
/*
|
|
5257
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
5258
|
-
* All rights reserved.
|
|
5259
|
-
* SPDX-License-Identifier: MIT
|
|
5260
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5261
|
-
*/
|
|
5262
|
-
function hydrate(vnode, node) {
|
|
5263
|
-
switch (vnode.type) {
|
|
5264
|
-
case 0 /* Text */:
|
|
5265
|
-
hydrateText(vnode, node);
|
|
5266
|
-
break;
|
|
5267
|
-
case 1 /* Comment */:
|
|
5268
|
-
hydrateComment(vnode, node);
|
|
5269
|
-
break;
|
|
5270
|
-
case 2 /* Element */:
|
|
5271
|
-
hydrateElement(vnode, node);
|
|
5272
|
-
break;
|
|
5273
|
-
case 3 /* CustomElement */:
|
|
5274
|
-
hydrateCustomElement(vnode, node);
|
|
5275
|
-
break;
|
|
5276
|
-
}
|
|
5277
|
-
}
|
|
5278
|
-
function hydrateText(vnode, node) {
|
|
5279
|
-
var _a;
|
|
5280
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5281
|
-
validateNodeType(vnode, node, 3 /* TEXT */);
|
|
5282
|
-
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
5283
|
-
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
5284
|
-
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
5285
|
-
}
|
|
5286
|
-
}
|
|
5287
|
-
// always set the text value to the one from the vnode.
|
|
5288
|
-
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5289
|
-
vnode.elm = node;
|
|
5290
|
-
}
|
|
5291
|
-
function hydrateComment(vnode, node) {
|
|
5292
|
-
var _a;
|
|
5293
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5294
|
-
validateNodeType(vnode, node, 8 /* COMMENT */);
|
|
5295
|
-
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
5296
|
-
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
5297
|
-
}
|
|
5298
|
-
}
|
|
5299
|
-
// always set the text value to the one from the vnode.
|
|
5300
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5301
|
-
vnode.elm = node;
|
|
5302
|
-
}
|
|
5303
|
-
function hydrateElement(vnode, node) {
|
|
5304
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5305
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5306
|
-
validateElement(vnode, node);
|
|
5307
|
-
}
|
|
5308
|
-
const elm = node;
|
|
5309
|
-
vnode.elm = elm;
|
|
5310
|
-
const { context } = vnode.data;
|
|
5311
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
5312
|
-
if (isDomManual) {
|
|
5313
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5314
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5315
|
-
const { props } = vnode.data;
|
|
5316
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5317
|
-
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
5318
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
5319
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
5320
|
-
}
|
|
5321
|
-
else {
|
|
5322
|
-
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5323
|
-
}
|
|
5324
|
-
}
|
|
5325
|
-
}
|
|
5326
|
-
patchElementPropsAndAttrs(vnode);
|
|
5327
|
-
if (!isDomManual) {
|
|
5328
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
5329
|
-
}
|
|
5330
|
-
}
|
|
5331
|
-
function hydrateCustomElement(vnode, node) {
|
|
5332
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5333
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5334
|
-
validateElement(vnode, node);
|
|
5335
|
-
}
|
|
5336
|
-
const elm = node;
|
|
5337
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
5338
|
-
const vm = createVM(elm, ctor, {
|
|
5339
|
-
mode,
|
|
5340
|
-
owner,
|
|
5341
|
-
tagName: sel,
|
|
5342
|
-
});
|
|
5343
|
-
vnode.elm = elm;
|
|
5344
|
-
vnode.vm = vm;
|
|
5345
|
-
allocateChildren(vnode, vm);
|
|
5346
|
-
patchElementPropsAndAttrs(vnode);
|
|
5347
|
-
// Insert hook section:
|
|
5348
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5349
|
-
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
5350
|
-
}
|
|
5351
|
-
runConnectedCallback(vm);
|
|
5352
|
-
if (vm.renderMode !== 0 /* Light */) {
|
|
5353
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5354
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5355
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
5356
|
-
}
|
|
5357
|
-
hydrateVM(vm);
|
|
5358
|
-
}
|
|
5359
|
-
function hydrateChildren(elmChildren, children, vm) {
|
|
5360
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5361
|
-
const filteredVNodes = ArrayFilter.call(children, (vnode) => !!vnode);
|
|
5362
|
-
if (elmChildren.length !== filteredVNodes.length) {
|
|
5363
|
-
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
5364
|
-
throwHydrationError();
|
|
5365
|
-
}
|
|
5366
|
-
}
|
|
5367
|
-
let childNodeIndex = 0;
|
|
5368
|
-
for (let i = 0; i < children.length; i++) {
|
|
5369
|
-
const childVnode = children[i];
|
|
5370
|
-
if (!isNull(childVnode)) {
|
|
5371
|
-
const childNode = elmChildren[childNodeIndex];
|
|
5372
|
-
hydrate(childVnode, childNode);
|
|
5373
|
-
childNodeIndex++;
|
|
5374
|
-
}
|
|
5375
|
-
}
|
|
5376
|
-
}
|
|
5377
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
5378
|
-
applyEventListeners(vnode);
|
|
5379
|
-
patchProps(null, vnode);
|
|
5380
|
-
}
|
|
5381
|
-
function throwHydrationError() {
|
|
5382
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
5383
|
-
}
|
|
5384
|
-
function validateNodeType(vnode, node, nodeType) {
|
|
5385
|
-
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
5386
|
-
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
5387
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5388
|
-
}
|
|
5389
|
-
}
|
|
5390
|
-
function validateElement(vnode, elm) {
|
|
5391
|
-
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
5392
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
5393
|
-
throwHydrationError();
|
|
5394
|
-
}
|
|
5395
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5396
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5397
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5398
|
-
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5399
|
-
if (!isVNodeAndElementCompatible) {
|
|
5400
|
-
throwHydrationError();
|
|
5401
|
-
}
|
|
5402
|
-
}
|
|
5403
|
-
function validateAttrs(vnode, elm) {
|
|
5404
|
-
const { data: { attrs = {} }, } = vnode;
|
|
5405
|
-
let nodesAreCompatible = true;
|
|
5406
|
-
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5407
|
-
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5408
|
-
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5409
|
-
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
5410
|
-
if (String(attrValue) !== elmAttrValue) {
|
|
5411
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
5412
|
-
nodesAreCompatible = false;
|
|
5413
|
-
}
|
|
5414
|
-
}
|
|
5415
|
-
return nodesAreCompatible;
|
|
5416
|
-
}
|
|
5417
|
-
function validateClassAttr(vnode, elm) {
|
|
5418
|
-
const { data: { className, classMap }, } = vnode;
|
|
5419
|
-
let nodesAreCompatible = true;
|
|
5420
|
-
let vnodeClassName;
|
|
5421
|
-
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
5422
|
-
// className is used when class is bound to an expr.
|
|
5423
|
-
nodesAreCompatible = false;
|
|
5424
|
-
vnodeClassName = className;
|
|
5425
|
-
}
|
|
5426
|
-
else if (!isUndefined$1(classMap)) {
|
|
5427
|
-
// classMap is used when class is set to static value.
|
|
5428
|
-
const classList = getClassList$1(elm);
|
|
5429
|
-
let computedClassName = '';
|
|
5430
|
-
// all classes from the vnode should be in the element.classList
|
|
5431
|
-
for (const name in classMap) {
|
|
5432
|
-
computedClassName += ' ' + name;
|
|
5433
|
-
if (!classList.contains(name)) {
|
|
5434
|
-
nodesAreCompatible = false;
|
|
5435
|
-
}
|
|
5436
|
-
}
|
|
5437
|
-
vnodeClassName = computedClassName.trim();
|
|
5438
|
-
if (classList.length > keys(classMap).length) {
|
|
5439
|
-
nodesAreCompatible = false;
|
|
5440
|
-
}
|
|
5441
|
-
}
|
|
5442
|
-
if (!nodesAreCompatible) {
|
|
5443
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
5444
|
-
}
|
|
5445
|
-
return nodesAreCompatible;
|
|
5446
|
-
}
|
|
5447
|
-
function validateStyleAttr(vnode, elm) {
|
|
5448
|
-
const { data: { style, styleDecls }, } = vnode;
|
|
5449
|
-
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
5450
|
-
let vnodeStyle;
|
|
5451
|
-
let nodesAreCompatible = true;
|
|
5452
|
-
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5453
|
-
nodesAreCompatible = false;
|
|
5454
|
-
vnodeStyle = style;
|
|
5455
|
-
}
|
|
5456
|
-
else if (!isUndefined$1(styleDecls)) {
|
|
5457
|
-
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5458
|
-
const expectedStyle = [];
|
|
5459
|
-
// styleMap is used when style is set to static value.
|
|
5460
|
-
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
5461
|
-
const [prop, value, important] = styleDecls[i];
|
|
5462
|
-
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
5463
|
-
const parsedPropValue = parsedVnodeStyle[prop];
|
|
5464
|
-
if (isUndefined$1(parsedPropValue)) {
|
|
5465
|
-
nodesAreCompatible = false;
|
|
5466
|
-
}
|
|
5467
|
-
else if (!parsedPropValue.startsWith(value)) {
|
|
5468
|
-
nodesAreCompatible = false;
|
|
5469
|
-
}
|
|
5470
|
-
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
5471
|
-
nodesAreCompatible = false;
|
|
5472
|
-
}
|
|
5473
|
-
}
|
|
5474
|
-
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
5475
|
-
nodesAreCompatible = false;
|
|
5476
|
-
}
|
|
5477
|
-
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
5478
|
-
}
|
|
5479
|
-
if (!nodesAreCompatible) {
|
|
5480
|
-
// style is used when class is bound to an expr.
|
|
5481
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
5482
|
-
}
|
|
5483
|
-
return nodesAreCompatible;
|
|
5484
|
-
}
|
|
5485
|
-
|
|
5486
5286
|
/*
|
|
5487
5287
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5488
5288
|
* All rights reserved.
|
|
@@ -5528,32 +5328,12 @@ function connectRootElement(elm) {
|
|
|
5528
5328
|
/* GlobalHydrate */
|
|
5529
5329
|
, vm);
|
|
5530
5330
|
}
|
|
5531
|
-
function hydrateRootElement(elm) {
|
|
5532
|
-
const vm = getAssociatedVM(elm);
|
|
5533
|
-
runConnectedCallback(vm);
|
|
5534
|
-
hydrateVM(vm);
|
|
5535
|
-
}
|
|
5536
5331
|
function disconnectRootElement(elm) {
|
|
5537
5332
|
const vm = getAssociatedVM(elm);
|
|
5538
5333
|
resetComponentStateWhenRemoved(vm);
|
|
5539
5334
|
}
|
|
5540
5335
|
function appendVM(vm) {
|
|
5541
5336
|
rehydrate(vm);
|
|
5542
|
-
}
|
|
5543
|
-
function hydrateVM(vm) {
|
|
5544
|
-
if (isTrue(vm.isDirty)) {
|
|
5545
|
-
// manually diffing/patching here.
|
|
5546
|
-
// This routine is:
|
|
5547
|
-
// patchShadowRoot(vm, children);
|
|
5548
|
-
// -> addVnodes.
|
|
5549
|
-
const children = renderComponent(vm);
|
|
5550
|
-
vm.children = children;
|
|
5551
|
-
const vmChildren = vm.renderMode === 0
|
|
5552
|
-
/* Light */
|
|
5553
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
5554
|
-
hydrateChildren(vmChildren, children, vm);
|
|
5555
|
-
runRenderedCallback(vm);
|
|
5556
|
-
}
|
|
5557
5337
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
5558
5338
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5559
5339
|
|
|
@@ -5858,7 +5638,6 @@ function runRenderedCallback(vm) {
|
|
|
5858
5638
|
, vm);
|
|
5859
5639
|
}
|
|
5860
5640
|
}
|
|
5861
|
-
|
|
5862
5641
|
let rehydrateQueue = [];
|
|
5863
5642
|
|
|
5864
5643
|
function flushRehydrationQueue() {
|
|
@@ -6515,6 +6294,298 @@ function readonly(obj) {
|
|
|
6515
6294
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
6516
6295
|
}
|
|
6517
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
|
+
|
|
6518
6589
|
/*
|
|
6519
6590
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6520
6591
|
* All rights reserved.
|
|
@@ -6527,7 +6598,7 @@ function setHooks(hooks) {
|
|
|
6527
6598
|
hooksAreSet = true;
|
|
6528
6599
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6529
6600
|
}
|
|
6530
|
-
/* version: 2.11.
|
|
6601
|
+
/* version: 2.11.5 */
|
|
6531
6602
|
|
|
6532
6603
|
/*
|
|
6533
6604
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6872,7 +6943,7 @@ function resetShadowRootAndLightDom(element, Ctor) {
|
|
|
6872
6943
|
}
|
|
6873
6944
|
}
|
|
6874
6945
|
function createVMWithProps(element, Ctor, props) {
|
|
6875
|
-
createVM(element, Ctor, {
|
|
6946
|
+
const vm = createVM(element, Ctor, {
|
|
6876
6947
|
mode: 'open',
|
|
6877
6948
|
owner: null,
|
|
6878
6949
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -6880,6 +6951,7 @@ function createVMWithProps(element, Ctor, props) {
|
|
|
6880
6951
|
for (const [key, value] of Object.entries(props)) {
|
|
6881
6952
|
element[key] = value;
|
|
6882
6953
|
}
|
|
6954
|
+
return vm;
|
|
6883
6955
|
}
|
|
6884
6956
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
6885
6957
|
if (!(element instanceof Element)) {
|
|
@@ -6900,8 +6972,8 @@ function hydrateComponent(element, Ctor, props = {}) {
|
|
|
6900
6972
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6901
6973
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
6902
6974
|
setIsHydrating(true);
|
|
6903
|
-
createVMWithProps(element, Ctor, props);
|
|
6904
|
-
|
|
6975
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
6976
|
+
hydrateRoot(vm);
|
|
6905
6977
|
// set it back since now we finished hydration.
|
|
6906
6978
|
setIsHydrating(false);
|
|
6907
6979
|
}
|
|
@@ -7166,6 +7238,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
7166
7238
|
});
|
|
7167
7239
|
freeze(LightningElement);
|
|
7168
7240
|
seal(LightningElement.prototype);
|
|
7169
|
-
/* version: 2.11.
|
|
7241
|
+
/* version: 2.11.5 */
|
|
7170
7242
|
|
|
7171
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 };
|