lwc 2.11.0 → 2.12.0
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 +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/iife/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +391 -181
- package/dist/engine-dom/umd/es2017/engine-dom.js +309 -263
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +264 -126
- package/dist/engine-dom/umd/es5/engine-dom.js +1104 -1047
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +391 -181
- package/dist/engine-server/commonjs/es2017/engine-server.js +14 -11
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +14 -11
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +10 -10
|
@@ -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.
|
|
304
|
+
const LWC_VERSION = "2.12.0";
|
|
305
305
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
306
|
-
/** version: 2.
|
|
306
|
+
/** version: 2.12.0 */
|
|
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.
|
|
459
|
+
/** version: 2.12.0 */
|
|
460
460
|
|
|
461
461
|
/* proxy-compat-disable */
|
|
462
462
|
|
|
@@ -5159,11 +5159,15 @@ var LWC = (function (exports) {
|
|
|
5159
5159
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
5160
5160
|
* will prevent this function from being imported by userland code.
|
|
5161
5161
|
*/
|
|
5162
|
-
function registerComponent(
|
|
5163
|
-
|
|
5164
|
-
|
|
5162
|
+
function registerComponent(
|
|
5163
|
+
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
5164
|
+
Ctor, { tmpl }) {
|
|
5165
|
+
if (isFunction$1(Ctor)) {
|
|
5166
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5167
|
+
checkVersionMismatch(Ctor, 'component');
|
|
5168
|
+
}
|
|
5169
|
+
signedTemplateMap.set(Ctor, tmpl);
|
|
5165
5170
|
}
|
|
5166
|
-
signedTemplateMap.set(Ctor, tmpl);
|
|
5167
5171
|
// chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
5168
5172
|
// without too much transformation
|
|
5169
5173
|
return Ctor;
|
|
@@ -5252,236 +5256,6 @@ var LWC = (function (exports) {
|
|
|
5252
5256
|
}
|
|
5253
5257
|
}
|
|
5254
5258
|
|
|
5255
|
-
/*
|
|
5256
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
5257
|
-
* All rights reserved.
|
|
5258
|
-
* SPDX-License-Identifier: MIT
|
|
5259
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5260
|
-
*/
|
|
5261
|
-
function hydrate(vnode, node) {
|
|
5262
|
-
switch (vnode.type) {
|
|
5263
|
-
case 0 /* Text */:
|
|
5264
|
-
hydrateText(vnode, node);
|
|
5265
|
-
break;
|
|
5266
|
-
case 1 /* Comment */:
|
|
5267
|
-
hydrateComment(vnode, node);
|
|
5268
|
-
break;
|
|
5269
|
-
case 2 /* Element */:
|
|
5270
|
-
hydrateElement(vnode, node);
|
|
5271
|
-
break;
|
|
5272
|
-
case 3 /* CustomElement */:
|
|
5273
|
-
hydrateCustomElement(vnode, node);
|
|
5274
|
-
break;
|
|
5275
|
-
}
|
|
5276
|
-
}
|
|
5277
|
-
function hydrateText(vnode, node) {
|
|
5278
|
-
var _a;
|
|
5279
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5280
|
-
validateNodeType(vnode, node, 3 /* TEXT */);
|
|
5281
|
-
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
5282
|
-
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
5283
|
-
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
5284
|
-
}
|
|
5285
|
-
}
|
|
5286
|
-
// always set the text value to the one from the vnode.
|
|
5287
|
-
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5288
|
-
vnode.elm = node;
|
|
5289
|
-
}
|
|
5290
|
-
function hydrateComment(vnode, node) {
|
|
5291
|
-
var _a;
|
|
5292
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5293
|
-
validateNodeType(vnode, node, 8 /* COMMENT */);
|
|
5294
|
-
if (getProperty$1(node, 'nodeValue') !== vnode.text) {
|
|
5295
|
-
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
5296
|
-
}
|
|
5297
|
-
}
|
|
5298
|
-
// always set the text value to the one from the vnode.
|
|
5299
|
-
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5300
|
-
vnode.elm = node;
|
|
5301
|
-
}
|
|
5302
|
-
function hydrateElement(vnode, node) {
|
|
5303
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5304
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5305
|
-
validateElement(vnode, node);
|
|
5306
|
-
}
|
|
5307
|
-
const elm = node;
|
|
5308
|
-
vnode.elm = elm;
|
|
5309
|
-
const { context } = vnode.data;
|
|
5310
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
5311
|
-
if (isDomManual) {
|
|
5312
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5313
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5314
|
-
const { props } = vnode.data;
|
|
5315
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5316
|
-
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
5317
|
-
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
5318
|
-
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
5319
|
-
}
|
|
5320
|
-
else {
|
|
5321
|
-
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5322
|
-
}
|
|
5323
|
-
}
|
|
5324
|
-
}
|
|
5325
|
-
patchElementPropsAndAttrs(vnode);
|
|
5326
|
-
if (!isDomManual) {
|
|
5327
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
5328
|
-
}
|
|
5329
|
-
}
|
|
5330
|
-
function hydrateCustomElement(vnode, node) {
|
|
5331
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5332
|
-
validateNodeType(vnode, node, 1 /* ELEMENT */);
|
|
5333
|
-
validateElement(vnode, node);
|
|
5334
|
-
}
|
|
5335
|
-
const elm = node;
|
|
5336
|
-
const { sel, mode, ctor, owner } = vnode;
|
|
5337
|
-
const vm = createVM(elm, ctor, {
|
|
5338
|
-
mode,
|
|
5339
|
-
owner,
|
|
5340
|
-
tagName: sel,
|
|
5341
|
-
});
|
|
5342
|
-
vnode.elm = elm;
|
|
5343
|
-
vnode.vm = vm;
|
|
5344
|
-
allocateChildren(vnode, vm);
|
|
5345
|
-
patchElementPropsAndAttrs(vnode);
|
|
5346
|
-
// Insert hook section:
|
|
5347
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5348
|
-
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
5349
|
-
}
|
|
5350
|
-
runConnectedCallback(vm);
|
|
5351
|
-
if (vm.renderMode !== 0 /* Light */) {
|
|
5352
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5353
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5354
|
-
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vm);
|
|
5355
|
-
}
|
|
5356
|
-
hydrateVM(vm);
|
|
5357
|
-
}
|
|
5358
|
-
function hydrateChildren(elmChildren, children, vm) {
|
|
5359
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5360
|
-
const filteredVNodes = ArrayFilter.call(children, (vnode) => !!vnode);
|
|
5361
|
-
if (elmChildren.length !== filteredVNodes.length) {
|
|
5362
|
-
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
5363
|
-
throwHydrationError();
|
|
5364
|
-
}
|
|
5365
|
-
}
|
|
5366
|
-
let childNodeIndex = 0;
|
|
5367
|
-
for (let i = 0; i < children.length; i++) {
|
|
5368
|
-
const childVnode = children[i];
|
|
5369
|
-
if (!isNull(childVnode)) {
|
|
5370
|
-
const childNode = elmChildren[childNodeIndex];
|
|
5371
|
-
hydrate(childVnode, childNode);
|
|
5372
|
-
childNodeIndex++;
|
|
5373
|
-
}
|
|
5374
|
-
}
|
|
5375
|
-
}
|
|
5376
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
5377
|
-
applyEventListeners(vnode);
|
|
5378
|
-
patchProps(null, vnode);
|
|
5379
|
-
}
|
|
5380
|
-
function throwHydrationError() {
|
|
5381
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
5382
|
-
}
|
|
5383
|
-
function validateNodeType(vnode, node, nodeType) {
|
|
5384
|
-
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
5385
|
-
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
5386
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5387
|
-
}
|
|
5388
|
-
}
|
|
5389
|
-
function validateElement(vnode, elm) {
|
|
5390
|
-
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
5391
|
-
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
5392
|
-
throwHydrationError();
|
|
5393
|
-
}
|
|
5394
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5395
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5396
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5397
|
-
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5398
|
-
if (!isVNodeAndElementCompatible) {
|
|
5399
|
-
throwHydrationError();
|
|
5400
|
-
}
|
|
5401
|
-
}
|
|
5402
|
-
function validateAttrs(vnode, elm) {
|
|
5403
|
-
const { data: { attrs = {} }, } = vnode;
|
|
5404
|
-
let nodesAreCompatible = true;
|
|
5405
|
-
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5406
|
-
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5407
|
-
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5408
|
-
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
5409
|
-
if (String(attrValue) !== elmAttrValue) {
|
|
5410
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
5411
|
-
nodesAreCompatible = false;
|
|
5412
|
-
}
|
|
5413
|
-
}
|
|
5414
|
-
return nodesAreCompatible;
|
|
5415
|
-
}
|
|
5416
|
-
function validateClassAttr(vnode, elm) {
|
|
5417
|
-
const { data: { className, classMap }, } = vnode;
|
|
5418
|
-
let nodesAreCompatible = true;
|
|
5419
|
-
let vnodeClassName;
|
|
5420
|
-
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
5421
|
-
// className is used when class is bound to an expr.
|
|
5422
|
-
nodesAreCompatible = false;
|
|
5423
|
-
vnodeClassName = className;
|
|
5424
|
-
}
|
|
5425
|
-
else if (!isUndefined$1(classMap)) {
|
|
5426
|
-
// classMap is used when class is set to static value.
|
|
5427
|
-
const classList = getClassList$1(elm);
|
|
5428
|
-
let computedClassName = '';
|
|
5429
|
-
// all classes from the vnode should be in the element.classList
|
|
5430
|
-
for (const name in classMap) {
|
|
5431
|
-
computedClassName += ' ' + name;
|
|
5432
|
-
if (!classList.contains(name)) {
|
|
5433
|
-
nodesAreCompatible = false;
|
|
5434
|
-
}
|
|
5435
|
-
}
|
|
5436
|
-
vnodeClassName = computedClassName.trim();
|
|
5437
|
-
if (classList.length > keys(classMap).length) {
|
|
5438
|
-
nodesAreCompatible = false;
|
|
5439
|
-
}
|
|
5440
|
-
}
|
|
5441
|
-
if (!nodesAreCompatible) {
|
|
5442
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
5443
|
-
}
|
|
5444
|
-
return nodesAreCompatible;
|
|
5445
|
-
}
|
|
5446
|
-
function validateStyleAttr(vnode, elm) {
|
|
5447
|
-
const { data: { style, styleDecls }, } = vnode;
|
|
5448
|
-
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
5449
|
-
let vnodeStyle;
|
|
5450
|
-
let nodesAreCompatible = true;
|
|
5451
|
-
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5452
|
-
nodesAreCompatible = false;
|
|
5453
|
-
vnodeStyle = style;
|
|
5454
|
-
}
|
|
5455
|
-
else if (!isUndefined$1(styleDecls)) {
|
|
5456
|
-
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5457
|
-
const expectedStyle = [];
|
|
5458
|
-
// styleMap is used when style is set to static value.
|
|
5459
|
-
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
5460
|
-
const [prop, value, important] = styleDecls[i];
|
|
5461
|
-
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
5462
|
-
const parsedPropValue = parsedVnodeStyle[prop];
|
|
5463
|
-
if (isUndefined$1(parsedPropValue)) {
|
|
5464
|
-
nodesAreCompatible = false;
|
|
5465
|
-
}
|
|
5466
|
-
else if (!parsedPropValue.startsWith(value)) {
|
|
5467
|
-
nodesAreCompatible = false;
|
|
5468
|
-
}
|
|
5469
|
-
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
5470
|
-
nodesAreCompatible = false;
|
|
5471
|
-
}
|
|
5472
|
-
}
|
|
5473
|
-
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
5474
|
-
nodesAreCompatible = false;
|
|
5475
|
-
}
|
|
5476
|
-
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
5477
|
-
}
|
|
5478
|
-
if (!nodesAreCompatible) {
|
|
5479
|
-
// style is used when class is bound to an expr.
|
|
5480
|
-
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
5481
|
-
}
|
|
5482
|
-
return nodesAreCompatible;
|
|
5483
|
-
}
|
|
5484
|
-
|
|
5485
5259
|
/*
|
|
5486
5260
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5487
5261
|
* All rights reserved.
|
|
@@ -5527,32 +5301,12 @@ var LWC = (function (exports) {
|
|
|
5527
5301
|
/* GlobalHydrate */
|
|
5528
5302
|
, vm);
|
|
5529
5303
|
}
|
|
5530
|
-
function hydrateRootElement(elm) {
|
|
5531
|
-
const vm = getAssociatedVM(elm);
|
|
5532
|
-
runConnectedCallback(vm);
|
|
5533
|
-
hydrateVM(vm);
|
|
5534
|
-
}
|
|
5535
5304
|
function disconnectRootElement(elm) {
|
|
5536
5305
|
const vm = getAssociatedVM(elm);
|
|
5537
5306
|
resetComponentStateWhenRemoved(vm);
|
|
5538
5307
|
}
|
|
5539
5308
|
function appendVM(vm) {
|
|
5540
5309
|
rehydrate(vm);
|
|
5541
|
-
}
|
|
5542
|
-
function hydrateVM(vm) {
|
|
5543
|
-
if (isTrue(vm.isDirty)) {
|
|
5544
|
-
// manually diffing/patching here.
|
|
5545
|
-
// This routine is:
|
|
5546
|
-
// patchShadowRoot(vm, children);
|
|
5547
|
-
// -> addVnodes.
|
|
5548
|
-
const children = renderComponent(vm);
|
|
5549
|
-
vm.children = children;
|
|
5550
|
-
const vmChildren = vm.renderMode === 0
|
|
5551
|
-
/* Light */
|
|
5552
|
-
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
5553
|
-
hydrateChildren(vmChildren, children, vm);
|
|
5554
|
-
runRenderedCallback(vm);
|
|
5555
|
-
}
|
|
5556
5310
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
5557
5311
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5558
5312
|
|
|
@@ -5857,7 +5611,6 @@ var LWC = (function (exports) {
|
|
|
5857
5611
|
, vm);
|
|
5858
5612
|
}
|
|
5859
5613
|
}
|
|
5860
|
-
|
|
5861
5614
|
let rehydrateQueue = [];
|
|
5862
5615
|
|
|
5863
5616
|
function flushRehydrationQueue() {
|
|
@@ -6514,6 +6267,298 @@ var LWC = (function (exports) {
|
|
|
6514
6267
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
6515
6268
|
}
|
|
6516
6269
|
|
|
6270
|
+
/*
|
|
6271
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6272
|
+
* All rights reserved.
|
|
6273
|
+
* SPDX-License-Identifier: MIT
|
|
6274
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6275
|
+
*/
|
|
6276
|
+
// flag indicating if the hydration recovered from the DOM mismatch
|
|
6277
|
+
let hasMismatch = false;
|
|
6278
|
+
function hydrateRoot(vm) {
|
|
6279
|
+
hasMismatch = false;
|
|
6280
|
+
runConnectedCallback(vm);
|
|
6281
|
+
hydrateVM(vm);
|
|
6282
|
+
if (hasMismatch) {
|
|
6283
|
+
logError('Hydration completed with errors.', vm);
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6286
|
+
function hydrateVM(vm) {
|
|
6287
|
+
const children = renderComponent(vm);
|
|
6288
|
+
vm.children = children;
|
|
6289
|
+
const parentNode = vm.renderRoot;
|
|
6290
|
+
hydrateChildren(getFirstChild$1(parentNode), children, parentNode, vm);
|
|
6291
|
+
runRenderedCallback(vm);
|
|
6292
|
+
}
|
|
6293
|
+
function hydrateNode(node, vnode) {
|
|
6294
|
+
let hydratedNode;
|
|
6295
|
+
switch (vnode.type) {
|
|
6296
|
+
case 0 /* Text */:
|
|
6297
|
+
hydratedNode = hydrateText(node, vnode);
|
|
6298
|
+
break;
|
|
6299
|
+
case 1 /* Comment */:
|
|
6300
|
+
hydratedNode = hydrateComment(node, vnode);
|
|
6301
|
+
break;
|
|
6302
|
+
case 2 /* Element */:
|
|
6303
|
+
hydratedNode = hydrateElement(node, vnode);
|
|
6304
|
+
break;
|
|
6305
|
+
case 3 /* CustomElement */:
|
|
6306
|
+
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6307
|
+
break;
|
|
6308
|
+
}
|
|
6309
|
+
return nextSibling$1(hydratedNode);
|
|
6310
|
+
}
|
|
6311
|
+
function hydrateText(node, vnode) {
|
|
6312
|
+
var _a;
|
|
6313
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */)) {
|
|
6314
|
+
return handleMismatch(node, vnode);
|
|
6315
|
+
}
|
|
6316
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6317
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6318
|
+
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6319
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6320
|
+
}
|
|
6321
|
+
}
|
|
6322
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6323
|
+
vnode.elm = node;
|
|
6324
|
+
return node;
|
|
6325
|
+
}
|
|
6326
|
+
function hydrateComment(node, vnode) {
|
|
6327
|
+
var _a;
|
|
6328
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */)) {
|
|
6329
|
+
return handleMismatch(node, vnode);
|
|
6330
|
+
}
|
|
6331
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6332
|
+
const nodeValue = getProperty$1(node, 'nodeValue');
|
|
6333
|
+
if (nodeValue !== vnode.text) {
|
|
6334
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6337
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6338
|
+
vnode.elm = node;
|
|
6339
|
+
return node;
|
|
6340
|
+
}
|
|
6341
|
+
function hydrateElement(elm, vnode) {
|
|
6342
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6343
|
+
!isMatchingElement(vnode, elm)) {
|
|
6344
|
+
return handleMismatch(elm, vnode);
|
|
6345
|
+
}
|
|
6346
|
+
vnode.elm = elm;
|
|
6347
|
+
const { context } = vnode.data;
|
|
6348
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6349
|
+
if (isDomManual) {
|
|
6350
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6351
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6352
|
+
const { props } = vnode.data;
|
|
6353
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6354
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
6355
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6356
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6357
|
+
}
|
|
6358
|
+
else {
|
|
6359
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6360
|
+
logWarn(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
6361
|
+
}
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
patchElementPropsAndAttrs(vnode);
|
|
6366
|
+
if (!isDomManual) {
|
|
6367
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vnode.owner);
|
|
6368
|
+
}
|
|
6369
|
+
return elm;
|
|
6370
|
+
}
|
|
6371
|
+
function hydrateCustomElement(elm, vnode) {
|
|
6372
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */) ||
|
|
6373
|
+
!isMatchingElement(vnode, elm)) {
|
|
6374
|
+
return handleMismatch(elm, vnode);
|
|
6375
|
+
}
|
|
6376
|
+
const { sel, mode, ctor, owner } = vnode;
|
|
6377
|
+
const vm = createVM(elm, ctor, {
|
|
6378
|
+
mode,
|
|
6379
|
+
owner,
|
|
6380
|
+
tagName: sel,
|
|
6381
|
+
});
|
|
6382
|
+
vnode.elm = elm;
|
|
6383
|
+
vnode.vm = vm;
|
|
6384
|
+
allocateChildren(vnode, vm);
|
|
6385
|
+
patchElementPropsAndAttrs(vnode);
|
|
6386
|
+
// Insert hook section:
|
|
6387
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6388
|
+
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6389
|
+
}
|
|
6390
|
+
runConnectedCallback(vm);
|
|
6391
|
+
if (vm.renderMode !== 0 /* Light */) {
|
|
6392
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6393
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6394
|
+
hydrateChildren(getFirstChild$1(elm), vnode.children, elm, vm);
|
|
6395
|
+
}
|
|
6396
|
+
hydrateVM(vm);
|
|
6397
|
+
return elm;
|
|
6398
|
+
}
|
|
6399
|
+
function hydrateChildren(node, children, parentNode, owner) {
|
|
6400
|
+
let hasWarned = false;
|
|
6401
|
+
let nextNode = node;
|
|
6402
|
+
let anchor = null;
|
|
6403
|
+
for (let i = 0; i < children.length; i++) {
|
|
6404
|
+
const childVnode = children[i];
|
|
6405
|
+
if (!isNull(childVnode)) {
|
|
6406
|
+
if (nextNode) {
|
|
6407
|
+
nextNode = hydrateNode(nextNode, childVnode);
|
|
6408
|
+
anchor = childVnode.elm;
|
|
6409
|
+
}
|
|
6410
|
+
else {
|
|
6411
|
+
hasMismatch = true;
|
|
6412
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6413
|
+
if (!hasWarned) {
|
|
6414
|
+
hasWarned = true;
|
|
6415
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6416
|
+
}
|
|
6417
|
+
}
|
|
6418
|
+
mount(childVnode, parentNode, anchor);
|
|
6419
|
+
anchor = childVnode.elm;
|
|
6420
|
+
}
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
if (nextNode) {
|
|
6424
|
+
hasMismatch = true;
|
|
6425
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6426
|
+
if (!hasWarned) {
|
|
6427
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6428
|
+
}
|
|
6429
|
+
}
|
|
6430
|
+
do {
|
|
6431
|
+
const current = nextNode;
|
|
6432
|
+
nextNode = nextSibling$1(nextNode);
|
|
6433
|
+
removeNode(current, parentNode);
|
|
6434
|
+
} while (nextNode);
|
|
6435
|
+
}
|
|
6436
|
+
}
|
|
6437
|
+
function handleMismatch(node, vnode, msg) {
|
|
6438
|
+
hasMismatch = true;
|
|
6439
|
+
if (!isUndefined$1(msg)) {
|
|
6440
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6441
|
+
logError(msg, vnode.owner);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
const parentNode = getProperty$1(node, 'parentNode');
|
|
6445
|
+
mount(vnode, parentNode, node);
|
|
6446
|
+
removeNode(node, parentNode);
|
|
6447
|
+
return vnode.elm;
|
|
6448
|
+
}
|
|
6449
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
6450
|
+
applyEventListeners(vnode);
|
|
6451
|
+
patchProps(null, vnode);
|
|
6452
|
+
}
|
|
6453
|
+
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6454
|
+
if (getProperty$1(node, 'nodeType') !== nodeType) {
|
|
6455
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6456
|
+
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6457
|
+
}
|
|
6458
|
+
return false;
|
|
6459
|
+
}
|
|
6460
|
+
return true;
|
|
6461
|
+
}
|
|
6462
|
+
function isMatchingElement(vnode, elm) {
|
|
6463
|
+
if (vnode.sel.toLowerCase() !== getProperty$1(elm, 'tagName').toLowerCase()) {
|
|
6464
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6465
|
+
logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty$1(elm, 'tagName').toLowerCase()}".`, vnode.owner);
|
|
6466
|
+
}
|
|
6467
|
+
return false;
|
|
6468
|
+
}
|
|
6469
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6470
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6471
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6472
|
+
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6473
|
+
}
|
|
6474
|
+
function validateAttrs(vnode, elm) {
|
|
6475
|
+
const { data: { attrs = {} }, } = vnode;
|
|
6476
|
+
let nodesAreCompatible = true;
|
|
6477
|
+
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6478
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6479
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6480
|
+
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
6481
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
6482
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6483
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
6484
|
+
}
|
|
6485
|
+
nodesAreCompatible = false;
|
|
6486
|
+
}
|
|
6487
|
+
}
|
|
6488
|
+
return nodesAreCompatible;
|
|
6489
|
+
}
|
|
6490
|
+
function validateClassAttr(vnode, elm) {
|
|
6491
|
+
const { data: { className, classMap }, } = vnode;
|
|
6492
|
+
let nodesAreCompatible = true;
|
|
6493
|
+
let vnodeClassName;
|
|
6494
|
+
if (!isUndefined$1(className) && String(className) !== getProperty$1(elm, 'className')) {
|
|
6495
|
+
// className is used when class is bound to an expr.
|
|
6496
|
+
nodesAreCompatible = false;
|
|
6497
|
+
vnodeClassName = className;
|
|
6498
|
+
}
|
|
6499
|
+
else if (!isUndefined$1(classMap)) {
|
|
6500
|
+
// classMap is used when class is set to static value.
|
|
6501
|
+
const classList = getClassList$1(elm);
|
|
6502
|
+
let computedClassName = '';
|
|
6503
|
+
// all classes from the vnode should be in the element.classList
|
|
6504
|
+
for (const name in classMap) {
|
|
6505
|
+
computedClassName += ' ' + name;
|
|
6506
|
+
if (!classList.contains(name)) {
|
|
6507
|
+
nodesAreCompatible = false;
|
|
6508
|
+
}
|
|
6509
|
+
}
|
|
6510
|
+
vnodeClassName = computedClassName.trim();
|
|
6511
|
+
if (classList.length > keys(classMap).length) {
|
|
6512
|
+
nodesAreCompatible = false;
|
|
6513
|
+
}
|
|
6514
|
+
}
|
|
6515
|
+
if (!nodesAreCompatible) {
|
|
6516
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6517
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty$1(elm, 'className')}"`, vnode.owner);
|
|
6518
|
+
}
|
|
6519
|
+
}
|
|
6520
|
+
return nodesAreCompatible;
|
|
6521
|
+
}
|
|
6522
|
+
function validateStyleAttr(vnode, elm) {
|
|
6523
|
+
const { data: { style, styleDecls }, } = vnode;
|
|
6524
|
+
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
6525
|
+
let vnodeStyle;
|
|
6526
|
+
let nodesAreCompatible = true;
|
|
6527
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
6528
|
+
nodesAreCompatible = false;
|
|
6529
|
+
vnodeStyle = style;
|
|
6530
|
+
}
|
|
6531
|
+
else if (!isUndefined$1(styleDecls)) {
|
|
6532
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6533
|
+
const expectedStyle = [];
|
|
6534
|
+
// styleMap is used when style is set to static value.
|
|
6535
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
6536
|
+
const [prop, value, important] = styleDecls[i];
|
|
6537
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
6538
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
6539
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
6540
|
+
nodesAreCompatible = false;
|
|
6541
|
+
}
|
|
6542
|
+
else if (!parsedPropValue.startsWith(value)) {
|
|
6543
|
+
nodesAreCompatible = false;
|
|
6544
|
+
}
|
|
6545
|
+
else if (important && !parsedPropValue.endsWith('!important')) {
|
|
6546
|
+
nodesAreCompatible = false;
|
|
6547
|
+
}
|
|
6548
|
+
}
|
|
6549
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
6550
|
+
nodesAreCompatible = false;
|
|
6551
|
+
}
|
|
6552
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
6553
|
+
}
|
|
6554
|
+
if (!nodesAreCompatible) {
|
|
6555
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6556
|
+
logError(`Mismatch hydrating element <${getProperty$1(elm, 'tagName').toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
6557
|
+
}
|
|
6558
|
+
}
|
|
6559
|
+
return nodesAreCompatible;
|
|
6560
|
+
}
|
|
6561
|
+
|
|
6517
6562
|
/*
|
|
6518
6563
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6519
6564
|
* All rights reserved.
|
|
@@ -6526,7 +6571,7 @@ var LWC = (function (exports) {
|
|
|
6526
6571
|
hooksAreSet = true;
|
|
6527
6572
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6528
6573
|
}
|
|
6529
|
-
/* version: 2.
|
|
6574
|
+
/* version: 2.12.0 */
|
|
6530
6575
|
|
|
6531
6576
|
/*
|
|
6532
6577
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6871,7 +6916,7 @@ var LWC = (function (exports) {
|
|
|
6871
6916
|
}
|
|
6872
6917
|
}
|
|
6873
6918
|
function createVMWithProps(element, Ctor, props) {
|
|
6874
|
-
createVM(element, Ctor, {
|
|
6919
|
+
const vm = createVM(element, Ctor, {
|
|
6875
6920
|
mode: 'open',
|
|
6876
6921
|
owner: null,
|
|
6877
6922
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -6879,6 +6924,7 @@ var LWC = (function (exports) {
|
|
|
6879
6924
|
for (const [key, value] of Object.entries(props)) {
|
|
6880
6925
|
element[key] = value;
|
|
6881
6926
|
}
|
|
6927
|
+
return vm;
|
|
6882
6928
|
}
|
|
6883
6929
|
function hydrateComponent(element, Ctor, props = {}) {
|
|
6884
6930
|
if (!(element instanceof Element)) {
|
|
@@ -6899,8 +6945,8 @@ var LWC = (function (exports) {
|
|
|
6899
6945
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6900
6946
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
6901
6947
|
setIsHydrating(true);
|
|
6902
|
-
createVMWithProps(element, Ctor, props);
|
|
6903
|
-
|
|
6948
|
+
const vm = createVMWithProps(element, Ctor, props);
|
|
6949
|
+
hydrateRoot(vm);
|
|
6904
6950
|
// set it back since now we finished hydration.
|
|
6905
6951
|
setIsHydrating(false);
|
|
6906
6952
|
}
|
|
@@ -7165,7 +7211,7 @@ var LWC = (function (exports) {
|
|
|
7165
7211
|
});
|
|
7166
7212
|
freeze(LightningElement);
|
|
7167
7213
|
seal(LightningElement.prototype);
|
|
7168
|
-
/* version: 2.
|
|
7214
|
+
/* version: 2.12.0 */
|
|
7169
7215
|
|
|
7170
7216
|
exports.LightningElement = LightningElement;
|
|
7171
7217
|
exports.__unstable__ProfilerControl = profilerControl;
|