lwc 2.11.0 → 2.11.4

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 (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +339 -263
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +339 -263
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +294 -126
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1137 -1047
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +425 -182
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +339 -263
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +294 -126
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1137 -1047
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +425 -182
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +44 -11
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +44 -11
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. 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.0";
304
+ const LWC_VERSION = "2.11.4";
305
305
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
306
- /** version: 2.11.0 */
306
+ /** version: 2.11.4 */
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.0 */
459
+ /** version: 2.11.4 */
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;
@@ -5159,11 +5189,15 @@ var LWC = (function (exports) {
5159
5189
  * INTERNAL: This function can only be invoked by compiled code. The compiler
5160
5190
  * will prevent this function from being imported by userland code.
5161
5191
  */
5162
- function registerComponent(Ctor, { tmpl }) {
5163
- if (process.env.NODE_ENV !== 'production') {
5164
- checkVersionMismatch(Ctor, 'component');
5192
+ function registerComponent(
5193
+ // We typically expect a LightningElementConstructor, but technically you can call this with anything
5194
+ Ctor, { tmpl }) {
5195
+ if (isFunction$1(Ctor)) {
5196
+ if (process.env.NODE_ENV !== 'production') {
5197
+ checkVersionMismatch(Ctor, 'component');
5198
+ }
5199
+ signedTemplateMap.set(Ctor, tmpl);
5165
5200
  }
5166
- signedTemplateMap.set(Ctor, tmpl);
5167
5201
  // chaining this method as a way to wrap existing assignment of component constructor easily,
5168
5202
  // without too much transformation
5169
5203
  return Ctor;
@@ -5252,236 +5286,6 @@ var LWC = (function (exports) {
5252
5286
  }
5253
5287
  }
5254
5288
 
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
5289
  /*
5486
5290
  * Copyright (c) 2018, salesforce.com, inc.
5487
5291
  * All rights reserved.
@@ -5527,32 +5331,12 @@ var LWC = (function (exports) {
5527
5331
  /* GlobalHydrate */
5528
5332
  , vm);
5529
5333
  }
5530
- function hydrateRootElement(elm) {
5531
- const vm = getAssociatedVM(elm);
5532
- runConnectedCallback(vm);
5533
- hydrateVM(vm);
5534
- }
5535
5334
  function disconnectRootElement(elm) {
5536
5335
  const vm = getAssociatedVM(elm);
5537
5336
  resetComponentStateWhenRemoved(vm);
5538
5337
  }
5539
5338
  function appendVM(vm) {
5540
5339
  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
5340
  } // just in case the component comes back, with this we guarantee re-rendering it
5557
5341
  // while preventing any attempt to rehydration until after reinsertion.
5558
5342
 
@@ -5857,7 +5641,6 @@ var LWC = (function (exports) {
5857
5641
  , vm);
5858
5642
  }
5859
5643
  }
5860
-
5861
5644
  let rehydrateQueue = [];
5862
5645
 
5863
5646
  function flushRehydrationQueue() {
@@ -6514,6 +6297,298 @@ var LWC = (function (exports) {
6514
6297
  return reactiveMembrane.getReadOnlyProxy(obj);
6515
6298
  }
6516
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
+
6517
6592
  /*
6518
6593
  * Copyright (c) 2018, salesforce.com, inc.
6519
6594
  * All rights reserved.
@@ -6526,7 +6601,7 @@ var LWC = (function (exports) {
6526
6601
  hooksAreSet = true;
6527
6602
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6528
6603
  }
6529
- /* version: 2.11.0 */
6604
+ /* version: 2.11.4 */
6530
6605
 
6531
6606
  /*
6532
6607
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6871,7 +6946,7 @@ var LWC = (function (exports) {
6871
6946
  }
6872
6947
  }
6873
6948
  function createVMWithProps(element, Ctor, props) {
6874
- createVM(element, Ctor, {
6949
+ const vm = createVM(element, Ctor, {
6875
6950
  mode: 'open',
6876
6951
  owner: null,
6877
6952
  tagName: element.tagName.toLowerCase(),
@@ -6879,6 +6954,7 @@ var LWC = (function (exports) {
6879
6954
  for (const [key, value] of Object.entries(props)) {
6880
6955
  element[key] = value;
6881
6956
  }
6957
+ return vm;
6882
6958
  }
6883
6959
  function hydrateComponent(element, Ctor, props = {}) {
6884
6960
  if (!(element instanceof Element)) {
@@ -6899,8 +6975,8 @@ var LWC = (function (exports) {
6899
6975
  // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
6900
6976
  // and uses the same algo to create the stylesheets as in SSR.
6901
6977
  setIsHydrating(true);
6902
- createVMWithProps(element, Ctor, props);
6903
- hydrateRootElement(element);
6978
+ const vm = createVMWithProps(element, Ctor, props);
6979
+ hydrateRoot(vm);
6904
6980
  // set it back since now we finished hydration.
6905
6981
  setIsHydrating(false);
6906
6982
  }
@@ -7165,7 +7241,7 @@ var LWC = (function (exports) {
7165
7241
  });
7166
7242
  freeze(LightningElement);
7167
7243
  seal(LightningElement.prototype);
7168
- /* version: 2.11.0 */
7244
+ /* version: 2.11.4 */
7169
7245
 
7170
7246
  exports.LightningElement = LightningElement;
7171
7247
  exports.__unstable__ProfilerControl = profilerControl;