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
|
@@ -304,9 +304,9 @@
|
|
|
304
304
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
305
305
|
*/
|
|
306
306
|
// Increment whenever the LWC template compiler changes
|
|
307
|
-
const LWC_VERSION = "2.11.
|
|
307
|
+
const LWC_VERSION = "2.11.5";
|
|
308
308
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
309
|
-
/** version: 2.11.
|
|
309
|
+
/** version: 2.11.5 */
|
|
310
310
|
|
|
311
311
|
/*
|
|
312
312
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -459,7 +459,7 @@
|
|
|
459
459
|
setFeatureFlag(name, value);
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
/** version: 2.11.
|
|
462
|
+
/** version: 2.11.5 */
|
|
463
463
|
|
|
464
464
|
/* proxy-compat-disable */
|
|
465
465
|
|
|
@@ -2764,6 +2764,12 @@
|
|
|
2764
2764
|
}
|
|
2765
2765
|
}
|
|
2766
2766
|
|
|
2767
|
+
/*
|
|
2768
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2769
|
+
* All rights reserved.
|
|
2770
|
+
* SPDX-License-Identifier: MIT
|
|
2771
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2772
|
+
*/
|
|
2767
2773
|
const signedTemplateSet = new Set();
|
|
2768
2774
|
function defaultEmptyTemplate() {
|
|
2769
2775
|
return [];
|
|
@@ -2781,6 +2787,30 @@
|
|
|
2781
2787
|
checkVersionMismatch(tpl, 'template');
|
|
2782
2788
|
}
|
|
2783
2789
|
signedTemplateSet.add(tpl);
|
|
2790
|
+
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2791
|
+
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2792
|
+
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2793
|
+
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2794
|
+
defineProperty(tpl, 'stylesheetTokens', {
|
|
2795
|
+
get() {
|
|
2796
|
+
const { stylesheetToken } = this;
|
|
2797
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
2798
|
+
return stylesheetToken;
|
|
2799
|
+
}
|
|
2800
|
+
// Shim for the old `stylesheetTokens` property
|
|
2801
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2802
|
+
return {
|
|
2803
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
2804
|
+
shadowAttribute: stylesheetToken,
|
|
2805
|
+
};
|
|
2806
|
+
},
|
|
2807
|
+
set(value) {
|
|
2808
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2809
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2810
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2811
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2812
|
+
},
|
|
2813
|
+
});
|
|
2784
2814
|
// chaining this method as a way to wrap existing
|
|
2785
2815
|
// assignment of templates easily, without too much transformation
|
|
2786
2816
|
return tpl;
|
|
@@ -5259,236 +5289,6 @@
|
|
|
5259
5289
|
}
|
|
5260
5290
|
}
|
|
5261
5291
|
|
|
5262
|
-
/*
|
|
5263
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
5264
|
-
* All rights reserved.
|
|
5265
|
-
* SPDX-License-Identifier: MIT
|
|
5266
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5267
|
-
*/
|
|
5268
|
-
function hydrate(vnode, node) {
|
|
5269
|
-
switch (vnode.type) {
|
|
5270
|
-
case 0 /* Text */:
|
|
5271
|
-
hydrateText(vnode, node);
|
|
5272
|
-
break;
|
|
5273
|
-
case 1 /* Comment */:
|
|
5274
|
-
hydrateComment(vnode, node);
|
|
5275
|
-
break;
|
|
5276
|
-
case 2 /* Element */:
|
|
5277
|
-
hydrateElement(vnode, node);
|
|
5278
|
-
break;
|
|
5279
|
-
case 3 /* CustomElement */:
|
|
5280
|
-
hydrateCustomElement(vnode, node);
|
|
5281
|
-
break;
|
|
5282
|
-
}
|
|
5283
|
-
}
|
|
5284
|
-
function hydrateText(vnode, node) {
|
|
5285
|
-
var _a;
|
|
5286
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5287
|
-
validateNodeType(vnode, node, 3 /* TEXT */);
|
|
5288
|
-
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
5289
|
-
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
5290
|
-
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
5291
|
-
}
|
|
5292
|
-
}
|
|
5293
|
-
// always set the text value to the one from the vnode.
|
|
5294
|
-
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5295
|
-
vnode.elm = node;
|
|
5296
|
-
}
|
|
5297
|
-
function hydrateComment(vnode, node) {
|
|
5298
|
-
var _a;
|
|
5299
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5300
|
-
validateNodeType(vnode, node, 8 /* COMMENT */);
|
|
5301
|
-
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
5302
|
-
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
5303
|
-
}
|
|
5304
|
-
}
|
|
5305
|
-
// always set the text value to the one from the vnode.
|
|
5306
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5307
|
-
vnode.elm = node;
|
|
5308
|
-
}
|
|
5309
|
-
function hydrateElement(vnode, node) {
|
|
5310
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5311
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5312
|
-
validateElement(vnode, node);
|
|
5313
|
-
}
|
|
5314
|
-
const elm = node;
|
|
5315
|
-
vnode.elm = elm;
|
|
5316
|
-
const { context } = vnode.data;
|
|
5317
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
5318
|
-
if (isDomManual) {
|
|
5319
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5320
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5321
|
-
const { props } = vnode.data;
|
|
5322
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5323
|
-
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
5324
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
5325
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
5326
|
-
}
|
|
5327
|
-
else {
|
|
5328
|
-
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5329
|
-
}
|
|
5330
|
-
}
|
|
5331
|
-
}
|
|
5332
|
-
patchElementPropsAndAttrs(vnode);
|
|
5333
|
-
if (!isDomManual) {
|
|
5334
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
5335
|
-
}
|
|
5336
|
-
}
|
|
5337
|
-
function hydrateCustomElement(vnode, node) {
|
|
5338
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5339
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5340
|
-
validateElement(vnode, node);
|
|
5341
|
-
}
|
|
5342
|
-
const elm = node;
|
|
5343
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
5344
|
-
const vm = createVM(elm, ctor, {
|
|
5345
|
-
mode,
|
|
5346
|
-
owner,
|
|
5347
|
-
tagName: sel,
|
|
5348
|
-
});
|
|
5349
|
-
vnode.elm = elm;
|
|
5350
|
-
vnode.vm = vm;
|
|
5351
|
-
allocateChildren(vnode, vm);
|
|
5352
|
-
patchElementPropsAndAttrs(vnode);
|
|
5353
|
-
// Insert hook section:
|
|
5354
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5355
|
-
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
5356
|
-
}
|
|
5357
|
-
runConnectedCallback(vm);
|
|
5358
|
-
if (vm.renderMode !== 0 /* Light */) {
|
|
5359
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5360
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5361
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
5362
|
-
}
|
|
5363
|
-
hydrateVM(vm);
|
|
5364
|
-
}
|
|
5365
|
-
function hydrateChildren(elmChildren, children, vm) {
|
|
5366
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5367
|
-
const filteredVNodes = ArrayFilter.call(children, (vnode) => !!vnode);
|
|
5368
|
-
if (elmChildren.length !== filteredVNodes.length) {
|
|
5369
|
-
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
5370
|
-
throwHydrationError();
|
|
5371
|
-
}
|
|
5372
|
-
}
|
|
5373
|
-
let childNodeIndex = 0;
|
|
5374
|
-
for (let i = 0; i < children.length; i++) {
|
|
5375
|
-
const childVnode = children[i];
|
|
5376
|
-
if (!isNull(childVnode)) {
|
|
5377
|
-
const childNode = elmChildren[childNodeIndex];
|
|
5378
|
-
hydrate(childVnode, childNode);
|
|
5379
|
-
childNodeIndex++;
|
|
5380
|
-
}
|
|
5381
|
-
}
|
|
5382
|
-
}
|
|
5383
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
5384
|
-
applyEventListeners(vnode);
|
|
5385
|
-
patchProps(null, vnode);
|
|
5386
|
-
}
|
|
5387
|
-
function throwHydrationError() {
|
|
5388
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
5389
|
-
}
|
|
5390
|
-
function validateNodeType(vnode, node, nodeType) {
|
|
5391
|
-
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
5392
|
-
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
5393
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5394
|
-
}
|
|
5395
|
-
}
|
|
5396
|
-
function validateElement(vnode, elm) {
|
|
5397
|
-
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
5398
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
5399
|
-
throwHydrationError();
|
|
5400
|
-
}
|
|
5401
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5402
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5403
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5404
|
-
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5405
|
-
if (!isVNodeAndElementCompatible) {
|
|
5406
|
-
throwHydrationError();
|
|
5407
|
-
}
|
|
5408
|
-
}
|
|
5409
|
-
function validateAttrs(vnode, elm) {
|
|
5410
|
-
const { data: { attrs = {} }, } = vnode;
|
|
5411
|
-
let nodesAreCompatible = true;
|
|
5412
|
-
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5413
|
-
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5414
|
-
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5415
|
-
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
5416
|
-
if (String(attrValue) !== elmAttrValue) {
|
|
5417
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
5418
|
-
nodesAreCompatible = false;
|
|
5419
|
-
}
|
|
5420
|
-
}
|
|
5421
|
-
return nodesAreCompatible;
|
|
5422
|
-
}
|
|
5423
|
-
function validateClassAttr(vnode, elm) {
|
|
5424
|
-
const { data: { className, classMap }, } = vnode;
|
|
5425
|
-
let nodesAreCompatible = true;
|
|
5426
|
-
let vnodeClassName;
|
|
5427
|
-
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
5428
|
-
// className is used when class is bound to an expr.
|
|
5429
|
-
nodesAreCompatible = false;
|
|
5430
|
-
vnodeClassName = className;
|
|
5431
|
-
}
|
|
5432
|
-
else if (!isUndefined$1(classMap)) {
|
|
5433
|
-
// classMap is used when class is set to static value.
|
|
5434
|
-
const classList = getClassList$1(elm);
|
|
5435
|
-
let computedClassName = '';
|
|
5436
|
-
// all classes from the vnode should be in the element.classList
|
|
5437
|
-
for (const name in classMap) {
|
|
5438
|
-
computedClassName += ' ' + name;
|
|
5439
|
-
if (!classList.contains(name)) {
|
|
5440
|
-
nodesAreCompatible = false;
|
|
5441
|
-
}
|
|
5442
|
-
}
|
|
5443
|
-
vnodeClassName = computedClassName.trim();
|
|
5444
|
-
if (classList.length > keys(classMap).length) {
|
|
5445
|
-
nodesAreCompatible = false;
|
|
5446
|
-
}
|
|
5447
|
-
}
|
|
5448
|
-
if (!nodesAreCompatible) {
|
|
5449
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
5450
|
-
}
|
|
5451
|
-
return nodesAreCompatible;
|
|
5452
|
-
}
|
|
5453
|
-
function validateStyleAttr(vnode, elm) {
|
|
5454
|
-
const { data: { style, styleDecls }, } = vnode;
|
|
5455
|
-
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
5456
|
-
let vnodeStyle;
|
|
5457
|
-
let nodesAreCompatible = true;
|
|
5458
|
-
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5459
|
-
nodesAreCompatible = false;
|
|
5460
|
-
vnodeStyle = style;
|
|
5461
|
-
}
|
|
5462
|
-
else if (!isUndefined$1(styleDecls)) {
|
|
5463
|
-
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5464
|
-
const expectedStyle = [];
|
|
5465
|
-
// styleMap is used when style is set to static value.
|
|
5466
|
-
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
5467
|
-
const [prop, value, important] = styleDecls[i];
|
|
5468
|
-
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
5469
|
-
const parsedPropValue = parsedVnodeStyle[prop];
|
|
5470
|
-
if (isUndefined$1(parsedPropValue)) {
|
|
5471
|
-
nodesAreCompatible = false;
|
|
5472
|
-
}
|
|
5473
|
-
else if (!parsedPropValue.startsWith(value)) {
|
|
5474
|
-
nodesAreCompatible = false;
|
|
5475
|
-
}
|
|
5476
|
-
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
5477
|
-
nodesAreCompatible = false;
|
|
5478
|
-
}
|
|
5479
|
-
}
|
|
5480
|
-
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
5481
|
-
nodesAreCompatible = false;
|
|
5482
|
-
}
|
|
5483
|
-
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
5484
|
-
}
|
|
5485
|
-
if (!nodesAreCompatible) {
|
|
5486
|
-
// style is used when class is bound to an expr.
|
|
5487
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
5488
|
-
}
|
|
5489
|
-
return nodesAreCompatible;
|
|
5490
|
-
}
|
|
5491
|
-
|
|
5492
5292
|
/*
|
|
5493
5293
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5494
5294
|
* All rights reserved.
|
|
@@ -5534,32 +5334,12 @@
|
|
|
5534
5334
|
/* GlobalHydrate */
|
|
5535
5335
|
, vm);
|
|
5536
5336
|
}
|
|
5537
|
-
function hydrateRootElement(elm) {
|
|
5538
|
-
const vm = getAssociatedVM(elm);
|
|
5539
|
-
runConnectedCallback(vm);
|
|
5540
|
-
hydrateVM(vm);
|
|
5541
|
-
}
|
|
5542
5337
|
function disconnectRootElement(elm) {
|
|
5543
5338
|
const vm = getAssociatedVM(elm);
|
|
5544
5339
|
resetComponentStateWhenRemoved(vm);
|
|
5545
5340
|
}
|
|
5546
5341
|
function appendVM(vm) {
|
|
5547
5342
|
rehydrate(vm);
|
|
5548
|
-
}
|
|
5549
|
-
function hydrateVM(vm) {
|
|
5550
|
-
if (isTrue(vm.isDirty)) {
|
|
5551
|
-
// manually diffing/patching here.
|
|
5552
|
-
// This routine is:
|
|
5553
|
-
// patchShadowRoot(vm, children);
|
|
5554
|
-
// -> addVnodes.
|
|
5555
|
-
const children = renderComponent(vm);
|
|
5556
|
-
vm.children = children;
|
|
5557
|
-
const vmChildren = vm.renderMode === 0
|
|
5558
|
-
/* Light */
|
|
5559
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
5560
|
-
hydrateChildren(vmChildren, children, vm);
|
|
5561
|
-
runRenderedCallback(vm);
|
|
5562
|
-
}
|
|
5563
5343
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
5564
5344
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5565
5345
|
|
|
@@ -5864,7 +5644,6 @@
|
|
|
5864
5644
|
, vm);
|
|
5865
5645
|
}
|
|
5866
5646
|
}
|
|
5867
|
-
|
|
5868
5647
|
let rehydrateQueue = [];
|
|
5869
5648
|
|
|
5870
5649
|
function flushRehydrationQueue() {
|
|
@@ -6521,6 +6300,298 @@
|
|
|
6521
6300
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
6522
6301
|
}
|
|
6523
6302
|
|
|
6303
|
+
/*
|
|
6304
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6305
|
+
* All rights reserved.
|
|
6306
|
+
* SPDX-License-Identifier: MIT
|
|
6307
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6308
|
+
*/
|
|
6309
|
+
// flag indicating if the hydration recovered from the DOM mismatch
|
|
6310
|
+
let hasMismatch = false;
|
|
6311
|
+
function hydrateRoot(vm) {
|
|
6312
|
+
hasMismatch = false;
|
|
6313
|
+
runConnectedCallback(vm);
|
|
6314
|
+
hydrateVM(vm);
|
|
6315
|
+
if (hasMismatch) {
|
|
6316
|
+
logError('Hydration completed with errors.', vm);
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6319
|
+
function hydrateVM(vm) {
|
|
6320
|
+
const children = renderComponent(vm);
|
|
6321
|
+
vm.children = children;
|
|
6322
|
+
const parentNode = vm.renderRoot;
|
|
6323
|
+
hydrateChildren(getFirstChild$1(parentNode), children, parentNode, vm);
|
|
6324
|
+
runRenderedCallback(vm);
|
|
6325
|
+
}
|
|
6326
|
+
function hydrateNode(node, vnode) {
|
|
6327
|
+
let hydratedNode;
|
|
6328
|
+
switch (vnode.type) {
|
|
6329
|
+
case 0 /* Text */:
|
|
6330
|
+
hydratedNode = hydrateText(node, vnode);
|
|
6331
|
+
break;
|
|
6332
|
+
case 1 /* Comment */:
|
|
6333
|
+
hydratedNode = hydrateComment(node, vnode);
|
|
6334
|
+
break;
|
|
6335
|
+
case 2 /* Element */:
|
|
6336
|
+
hydratedNode = hydrateElement(node, vnode);
|
|
6337
|
+
break;
|
|
6338
|
+
case 3 /* CustomElement */:
|
|
6339
|
+
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6340
|
+
break;
|
|
6341
|
+
}
|
|
6342
|
+
return nextSibling$1(hydratedNode);
|
|
6343
|
+
}
|
|
6344
|
+
function hydrateText(node, vnode) {
|
|
6345
|
+
var _a;
|
|
6346
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
|
|
6347
|
+
return handleMismatch(node, vnode);
|
|
6348
|
+
}
|
|
6349
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6350
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6351
|
+
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6352
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6353
|
+
}
|
|
6354
|
+
}
|
|
6355
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6356
|
+
vnode.elm = node;
|
|
6357
|
+
return node;
|
|
6358
|
+
}
|
|
6359
|
+
function hydrateComment(node, vnode) {
|
|
6360
|
+
var _a;
|
|
6361
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
|
|
6362
|
+
return handleMismatch(node, vnode);
|
|
6363
|
+
}
|
|
6364
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6365
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6366
|
+
if (nodeValue !== vnode.text) {
|
|
6367
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6368
|
+
}
|
|
6369
|
+
}
|
|
6370
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6371
|
+
vnode.elm = node;
|
|
6372
|
+
return node;
|
|
6373
|
+
}
|
|
6374
|
+
function hydrateElement(elm, vnode) {
|
|
6375
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6376
|
+
!isMatchingElement(vnode, elm)) {
|
|
6377
|
+
return handleMismatch(elm, vnode);
|
|
6378
|
+
}
|
|
6379
|
+
vnode.elm = elm;
|
|
6380
|
+
const { context } = vnode.data;
|
|
6381
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6382
|
+
if (isDomManual) {
|
|
6383
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6384
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6385
|
+
const { props } = vnode.data;
|
|
6386
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6387
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
6388
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6389
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6390
|
+
}
|
|
6391
|
+
else {
|
|
6392
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6393
|
+
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
patchElementPropsAndAttrs(vnode);
|
|
6399
|
+
if (!isDomManual) {
|
|
6400
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
|
|
6401
|
+
}
|
|
6402
|
+
return elm;
|
|
6403
|
+
}
|
|
6404
|
+
function hydrateCustomElement(elm, vnode) {
|
|
6405
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6406
|
+
!isMatchingElement(vnode, elm)) {
|
|
6407
|
+
return handleMismatch(elm, vnode);
|
|
6408
|
+
}
|
|
6409
|
+
const { sel, mode, ctor, owner } = vnode;
|
|
6410
|
+
const vm = createVM(elm, ctor, {
|
|
6411
|
+
mode,
|
|
6412
|
+
owner,
|
|
6413
|
+
tagName: sel,
|
|
6414
|
+
});
|
|
6415
|
+
vnode.elm = elm;
|
|
6416
|
+
vnode.vm = vm;
|
|
6417
|
+
allocateChildren(vnode, vm);
|
|
6418
|
+
patchElementPropsAndAttrs(vnode);
|
|
6419
|
+
// Insert hook section:
|
|
6420
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6421
|
+
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6422
|
+
}
|
|
6423
|
+
runConnectedCallback(vm);
|
|
6424
|
+
if (vm.renderMode !== 0 /* Light */) {
|
|
6425
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6426
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6427
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vm);
|
|
6428
|
+
}
|
|
6429
|
+
hydrateVM(vm);
|
|
6430
|
+
return elm;
|
|
6431
|
+
}
|
|
6432
|
+
function hydrateChildren(node, children, parentNode, owner) {
|
|
6433
|
+
let hasWarned = false;
|
|
6434
|
+
let nextNode = node;
|
|
6435
|
+
let anchor = null;
|
|
6436
|
+
for (let i = 0; i < children.length; i++) {
|
|
6437
|
+
const childVnode = children[i];
|
|
6438
|
+
if (!isNull(childVnode)) {
|
|
6439
|
+
if (nextNode) {
|
|
6440
|
+
nextNode = hydrateNode(nextNode, childVnode);
|
|
6441
|
+
anchor = childVnode.elm;
|
|
6442
|
+
}
|
|
6443
|
+
else {
|
|
6444
|
+
hasMismatch = true;
|
|
6445
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6446
|
+
if (!hasWarned) {
|
|
6447
|
+
hasWarned = true;
|
|
6448
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6449
|
+
}
|
|
6450
|
+
}
|
|
6451
|
+
mount(childVnode, parentNode, anchor);
|
|
6452
|
+
anchor = childVnode.elm;
|
|
6453
|
+
}
|
|
6454
|
+
}
|
|
6455
|
+
}
|
|
6456
|
+
if (nextNode) {
|
|
6457
|
+
hasMismatch = true;
|
|
6458
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6459
|
+
if (!hasWarned) {
|
|
6460
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
do {
|
|
6464
|
+
const current = nextNode;
|
|
6465
|
+
nextNode = nextSibling$1(nextNode);
|
|
6466
|
+
removeNode(current, parentNode);
|
|
6467
|
+
} while (nextNode);
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
function handleMismatch(node, vnode, msg) {
|
|
6471
|
+
hasMismatch = true;
|
|
6472
|
+
if (!isUndefined$1(msg)) {
|
|
6473
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6474
|
+
logError(msg, vnode.owner);
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
const parentNode = getProperty$1(node, 'parentNode');
|
|
6478
|
+
mount(vnode, parentNode, node);
|
|
6479
|
+
removeNode(node, parentNode);
|
|
6480
|
+
return vnode.elm;
|
|
6481
|
+
}
|
|
6482
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
6483
|
+
applyEventListeners(vnode);
|
|
6484
|
+
patchProps(null, vnode);
|
|
6485
|
+
}
|
|
6486
|
+
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6487
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
6488
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6489
|
+
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6490
|
+
}
|
|
6491
|
+
return false;
|
|
6492
|
+
}
|
|
6493
|
+
return true;
|
|
6494
|
+
}
|
|
6495
|
+
function isMatchingElement(vnode, elm) {
|
|
6496
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
6497
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6498
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6499
|
+
}
|
|
6500
|
+
return false;
|
|
6501
|
+
}
|
|
6502
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6503
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6504
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6505
|
+
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6506
|
+
}
|
|
6507
|
+
function validateAttrs(vnode, elm) {
|
|
6508
|
+
const { data: { attrs = {} }, } = vnode;
|
|
6509
|
+
let nodesAreCompatible = true;
|
|
6510
|
+
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6511
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6512
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6513
|
+
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
6514
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
6515
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6516
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
6517
|
+
}
|
|
6518
|
+
nodesAreCompatible = false;
|
|
6519
|
+
}
|
|
6520
|
+
}
|
|
6521
|
+
return nodesAreCompatible;
|
|
6522
|
+
}
|
|
6523
|
+
function validateClassAttr(vnode, elm) {
|
|
6524
|
+
const { data: { className, classMap }, } = vnode;
|
|
6525
|
+
let nodesAreCompatible = true;
|
|
6526
|
+
let vnodeClassName;
|
|
6527
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
6528
|
+
// className is used when class is bound to an expr.
|
|
6529
|
+
nodesAreCompatible = false;
|
|
6530
|
+
vnodeClassName = className;
|
|
6531
|
+
}
|
|
6532
|
+
else if (!isUndefined$1(classMap)) {
|
|
6533
|
+
// classMap is used when class is set to static value.
|
|
6534
|
+
const classList = getClassList$1(elm);
|
|
6535
|
+
let computedClassName = '';
|
|
6536
|
+
// all classes from the vnode should be in the element.classList
|
|
6537
|
+
for (const name in classMap) {
|
|
6538
|
+
computedClassName += ' ' + name;
|
|
6539
|
+
if (!classList.contains(name)) {
|
|
6540
|
+
nodesAreCompatible = false;
|
|
6541
|
+
}
|
|
6542
|
+
}
|
|
6543
|
+
vnodeClassName = computedClassName.trim();
|
|
6544
|
+
if (classList.length > keys(classMap).length) {
|
|
6545
|
+
nodesAreCompatible = false;
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
if (!nodesAreCompatible) {
|
|
6549
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6550
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
6551
|
+
}
|
|
6552
|
+
}
|
|
6553
|
+
return nodesAreCompatible;
|
|
6554
|
+
}
|
|
6555
|
+
function validateStyleAttr(vnode, elm) {
|
|
6556
|
+
const { data: { style, styleDecls }, } = vnode;
|
|
6557
|
+
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
6558
|
+
let vnodeStyle;
|
|
6559
|
+
let nodesAreCompatible = true;
|
|
6560
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
6561
|
+
nodesAreCompatible = false;
|
|
6562
|
+
vnodeStyle = style;
|
|
6563
|
+
}
|
|
6564
|
+
else if (!isUndefined$1(styleDecls)) {
|
|
6565
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6566
|
+
const expectedStyle = [];
|
|
6567
|
+
// styleMap is used when style is set to static value.
|
|
6568
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
6569
|
+
const [prop, value, important] = styleDecls[i];
|
|
6570
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
6571
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
6572
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
6573
|
+
nodesAreCompatible = false;
|
|
6574
|
+
}
|
|
6575
|
+
else if (!parsedPropValue.startsWith(value)) {
|
|
6576
|
+
nodesAreCompatible = false;
|
|
6577
|
+
}
|
|
6578
|
+
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
6579
|
+
nodesAreCompatible = false;
|
|
6580
|
+
}
|
|
6581
|
+
}
|
|
6582
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
6583
|
+
nodesAreCompatible = false;
|
|
6584
|
+
}
|
|
6585
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
6586
|
+
}
|
|
6587
|
+
if (!nodesAreCompatible) {
|
|
6588
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6589
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6590
|
+
}
|
|
6591
|
+
}
|
|
6592
|
+
return nodesAreCompatible;
|
|
6593
|
+
}
|
|
6594
|
+
|
|
6524
6595
|
/*
|
|
6525
6596
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6526
6597
|
* All rights reserved.
|
|
@@ -6533,7 +6604,7 @@
|
|
|
6533
6604
|
hooksAreSet = true;
|
|
6534
6605
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6535
6606
|
}
|
|
6536
|
-
/* version: 2.11.
|
|
6607
|
+
/* version: 2.11.5 */
|
|
6537
6608
|
|
|
6538
6609
|
/*
|
|
6539
6610
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6878,7 +6949,7 @@
|
|
|
6878
6949
|
}
|
|
6879
6950
|
}
|
|
6880
6951
|
function createVMWithProps(element, Ctor, props) {
|
|
6881
|
-
createVM(element, Ctor, {
|
|
6952
|
+
const vm = createVM(element, Ctor, {
|
|
6882
6953
|
mode: 'open',
|
|
6883
6954
|
owner: null,
|
|
6884
6955
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -6886,6 +6957,7 @@
|
|
|
6886
6957
|
for (const [key, value] of Object.entries(props)) {
|
|
6887
6958
|
element[key] = value;
|
|
6888
6959
|
}
|
|
6960
|
+
return vm;
|
|
6889
6961
|
}
|
|
6890
6962
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
6891
6963
|
if (!(element instanceof Element)) {
|
|
@@ -6906,8 +6978,8 @@
|
|
|
6906
6978
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6907
6979
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
6908
6980
|
setIsHydrating(true);
|
|
6909
|
-
createVMWithProps(element, Ctor, props);
|
|
6910
|
-
|
|
6981
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
6982
|
+
hydrateRoot(vm);
|
|
6911
6983
|
// set it back since now we finished hydration.
|
|
6912
6984
|
setIsHydrating(false);
|
|
6913
6985
|
}
|
|
@@ -7172,7 +7244,7 @@
|
|
|
7172
7244
|
});
|
|
7173
7245
|
freeze(LightningElement);
|
|
7174
7246
|
seal(LightningElement.prototype);
|
|
7175
|
-
/* version: 2.11.
|
|
7247
|
+
/* version: 2.11.5 */
|
|
7176
7248
|
|
|
7177
7249
|
exports.LightningElement = LightningElement;
|
|
7178
7250
|
exports.__unstable__ProfilerControl = profilerControl;
|