lwc 2.11.1 → 2.12.1

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