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