lwc 2.11.1 → 2.11.3

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