lwc 2.45.5 → 2.46.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.
Files changed (65) hide show
  1. package/README.md +5 -11
  2. package/dist/engine-dom/esm/es2017/engine-dom.js +60 -115
  3. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom.js +60 -115
  5. package/dist/engine-dom/iife/es2017/engine-dom.js.map +1 -1
  6. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +58 -113
  8. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
  9. package/dist/engine-dom/iife/es5/engine-dom.js +54 -110
  10. package/dist/engine-dom/iife/es5/engine-dom.js.map +1 -1
  11. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  12. package/dist/engine-dom/iife/es5/engine-dom_debug.js +52 -108
  13. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
  14. package/dist/engine-dom/umd/es2017/engine-dom.js +60 -115
  15. package/dist/engine-dom/umd/es2017/engine-dom.js.map +1 -1
  16. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  17. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +58 -113
  18. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
  19. package/dist/engine-dom/umd/es5/engine-dom.js +54 -110
  20. package/dist/engine-dom/umd/es5/engine-dom.js.map +1 -1
  21. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  22. package/dist/engine-dom/umd/es5/engine-dom_debug.js +52 -108
  23. package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
  24. package/dist/engine-server/commonjs/es2017/engine-server.js +58 -114
  25. package/dist/engine-server/commonjs/es2017/engine-server.js.map +1 -1
  26. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  27. package/dist/engine-server/esm/es2017/engine-server.js +58 -114
  28. package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
  29. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  30. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
  31. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  32. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +1 -1
  33. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  34. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
  35. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  36. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
  37. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  38. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
  39. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  40. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -1
  41. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  42. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
  43. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  44. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
  45. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  46. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -1
  47. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  48. package/dist/wire-service/esm/es2017/wire-service.js.map +1 -1
  49. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  50. package/dist/wire-service/iife/es2017/wire-service.js.map +1 -1
  51. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  52. package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -1
  53. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  54. package/dist/wire-service/iife/es5/wire-service.js.map +1 -1
  55. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  56. package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -1
  57. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  58. package/dist/wire-service/umd/es2017/wire-service.js.map +1 -1
  59. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  60. package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -1
  61. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  62. package/dist/wire-service/umd/es5/wire-service.js.map +1 -1
  63. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  64. package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -1
  65. package/package.json +7 -7
@@ -335,55 +335,35 @@ const GLOBAL_ATTRIBUTE = /*@__PURE__*/ new Set([
335
335
  function isGlobalHtmlAttribute(attrName) {
336
336
  return GLOBAL_ATTRIBUTE.has(attrName);
337
337
  }
338
- // Convoluted map generation so that @lwc/shared remains fully tree-shakable (verify-treeshakable)
339
- const { NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING, NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING } =
340
- /*#__PURE__*/ (() => {
341
- /**
342
- * Map composed of properties to attributes not following the HTML property to attribute mapping
343
- * convention.
344
- */
345
- const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = new Map([
346
- ['accessKey', 'accesskey'],
347
- ['readOnly', 'readonly'],
348
- ['tabIndex', 'tabindex'],
349
- ['bgColor', 'bgcolor'],
350
- ['colSpan', 'colspan'],
351
- ['rowSpan', 'rowspan'],
352
- ['contentEditable', 'contenteditable'],
353
- ['crossOrigin', 'crossorigin'],
354
- ['dateTime', 'datetime'],
355
- ['formAction', 'formaction'],
356
- ['isMap', 'ismap'],
357
- ['maxLength', 'maxlength'],
358
- ['minLength', 'minlength'],
359
- ['noValidate', 'novalidate'],
360
- ['useMap', 'usemap'],
361
- ['htmlFor', 'for'],
362
- ]);
363
- /**
364
- * Inverted map with attribute name key and property name value.
365
- */
366
- const NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING = new Map();
367
- NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING.forEach((value, key) => NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.set(value, key));
368
- return {
369
- NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING,
370
- NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING,
371
- };
372
- })();
338
+ // These are HTML standard prop/attribute IDL mappings, but are not predictable based on camel/kebab-case conversion
339
+ const SPECIAL_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map([
340
+ ['accessKey', 'accesskey'],
341
+ ['readOnly', 'readonly'],
342
+ ['tabIndex', 'tabindex'],
343
+ ['bgColor', 'bgcolor'],
344
+ ['colSpan', 'colspan'],
345
+ ['rowSpan', 'rowspan'],
346
+ ['contentEditable', 'contenteditable'],
347
+ ['crossOrigin', 'crossorigin'],
348
+ ['dateTime', 'datetime'],
349
+ ['formAction', 'formaction'],
350
+ ['isMap', 'ismap'],
351
+ ['maxLength', 'maxlength'],
352
+ ['minLength', 'minlength'],
353
+ ['noValidate', 'novalidate'],
354
+ ['useMap', 'usemap'],
355
+ ['htmlFor', 'for'],
356
+ ]);
373
357
  /**
374
358
  * Map associating previously transformed HTML property into HTML attribute.
375
359
  */
376
360
  const CACHED_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map();
377
- /**
378
- * Map associating previously transformed HTML attribute into HTML property.
379
- */
380
- const CACHED_ATTRIBUTE_PROPERTY_MAPPING = /*@__PURE__@*/ new Map();
381
361
  function htmlPropertyToAttribute(propName) {
382
362
  const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
383
363
  if (!isUndefined$1(ariaAttributeName)) {
384
364
  return ariaAttributeName;
385
365
  }
386
- const specialAttributeName = NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING.get(propName);
366
+ const specialAttributeName = SPECIAL_PROPERTY_ATTRIBUTE_MAPPING.get(propName);
387
367
  if (!isUndefined$1(specialAttributeName)) {
388
368
  return specialAttributeName;
389
369
  }
@@ -406,22 +386,17 @@ function htmlPropertyToAttribute(propName) {
406
386
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
407
387
  return attributeName;
408
388
  }
409
- function htmlAttributeToProperty(attrName) {
410
- const ariaPropertyName = AriaAttrNameToPropNameMap[attrName];
411
- if (!isUndefined$1(ariaPropertyName)) {
412
- return ariaPropertyName;
413
- }
414
- const specialPropertyName = NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
415
- if (!isUndefined$1(specialPropertyName)) {
416
- return specialPropertyName;
417
- }
418
- const cachedPropertyName = CACHED_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
419
- if (!isUndefined$1(cachedPropertyName)) {
420
- return cachedPropertyName;
389
+ /**
390
+ * Map associating previously transformed kabab-case attributes into camel-case props.
391
+ */
392
+ const CACHED_KEBAB_CAMEL_MAPPING = /*@__PURE__@*/ new Map();
393
+ function kebabCaseToCamelCase(attrName) {
394
+ let result = CACHED_KEBAB_CAMEL_MAPPING.get(attrName);
395
+ if (isUndefined$1(result)) {
396
+ result = StringReplace.call(attrName, CAMEL_REGEX, (g) => g[1].toUpperCase());
397
+ CACHED_KEBAB_CAMEL_MAPPING.set(attrName, result);
421
398
  }
422
- const propertyName = StringReplace.call(attrName, CAMEL_REGEX, (g) => g[1].toUpperCase());
423
- CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
424
- return propertyName;
399
+ return result;
425
400
  }
426
401
 
427
402
  /*
@@ -449,9 +424,9 @@ function htmlEscape(str, attrMode = false) {
449
424
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
450
425
  */
451
426
  // Increment whenever the LWC template compiler changes
452
- const LWC_VERSION = "2.45.5";
427
+ const LWC_VERSION = "2.46.0";
453
428
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
454
- /** version: 2.45.5 */
429
+ /** version: 2.46.0 */
455
430
 
456
431
  /* proxy-compat-disable */
457
432
  /**
@@ -530,7 +505,7 @@ function setFeatureFlagForTest(name, value) {
530
505
  setFeatureFlag(name, value);
531
506
  }
532
507
  }
533
- /** version: 2.45.5 */
508
+ /** version: 2.46.0 */
534
509
 
535
510
  /*
536
511
  * Copyright (c) 2020, salesforce.com, inc.
@@ -627,7 +602,7 @@ function applyAriaReflection(prototype = Element.prototype) {
627
602
  }
628
603
  }
629
604
  }
630
- /** version: 2.45.5 */
605
+ /** version: 2.46.0 */
631
606
 
632
607
  /* proxy-compat-disable */
633
608
  /**
@@ -3552,27 +3527,35 @@ function isVScopedSlotFragment(vnode) {
3552
3527
  * SPDX-License-Identifier: MIT
3553
3528
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3554
3529
  */
3555
- const ColonCharCode$1 = 58;
3530
+ const ColonCharCode = 58;
3556
3531
  function patchAttributes(oldVnode, vnode, renderer) {
3557
- const { attrs } = vnode.data;
3532
+ const { attrs, external } = vnode.data;
3558
3533
  if (isUndefined$1(attrs)) {
3559
3534
  return;
3560
3535
  }
3561
3536
  const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
3537
+ // Attrs may be the same due to the static content optimization, so we can skip diffing
3562
3538
  if (oldAttrs === attrs) {
3563
3539
  return;
3564
3540
  }
3565
3541
  const { elm } = vnode;
3566
- const { setAttribute, removeAttribute } = renderer;
3542
+ const { setAttribute, removeAttribute, setProperty } = renderer;
3567
3543
  for (const key in attrs) {
3568
3544
  const cur = attrs[key];
3569
3545
  const old = oldAttrs[key];
3570
3546
  if (old !== cur) {
3571
- if (StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
3547
+ let propName;
3548
+ // For external custom elements, sniff to see if the attr should be considered a prop.
3549
+ // Use kebabCaseToCamelCase directly because we don't want to set props like `ariaLabel` or `tabIndex`
3550
+ // on a custom element versus just using the more reliable attribute format.
3551
+ if (external && (propName = kebabCaseToCamelCase(key)) in elm) {
3552
+ setProperty(elm, propName, cur);
3553
+ }
3554
+ else if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
3572
3555
  // Assume xml namespace
3573
3556
  setAttribute(elm, key, cur, XML_NAMESPACE);
3574
3557
  }
3575
- else if (StringCharCodeAt.call(key, 5) === ColonCharCode$1) {
3558
+ else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
3576
3559
  // Assume xlink namespace
3577
3560
  setAttribute(elm, key, cur, XLINK_NAMESPACE);
3578
3561
  }
@@ -3586,46 +3569,6 @@ function patchAttributes(oldVnode, vnode, renderer) {
3586
3569
  }
3587
3570
  }
3588
3571
 
3589
- /*
3590
- * Copyright (c) 2018, salesforce.com, inc.
3591
- * All rights reserved.
3592
- * SPDX-License-Identifier: MIT
3593
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3594
- */
3595
- const ColonCharCode = 58;
3596
- function patchAttrUnlessProp(oldVnode, vnode, renderer) {
3597
- const { data: { attrs }, elm, } = vnode;
3598
- if (isUndefined$1(attrs)) {
3599
- return;
3600
- }
3601
- const { removeAttribute, setAttribute, setProperty } = renderer;
3602
- const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
3603
- for (const name in attrs) {
3604
- const cur = attrs[name];
3605
- const old = oldAttrs[name];
3606
- if (old !== cur) {
3607
- const propName = htmlAttributeToProperty(name);
3608
- if (propName in elm) {
3609
- setProperty(elm, name, cur);
3610
- }
3611
- else if (StringCharCodeAt.call(name, 3) === ColonCharCode) {
3612
- // Assume xml namespace
3613
- setAttribute(elm, name, cur, XML_NAMESPACE);
3614
- }
3615
- else if (StringCharCodeAt.call(name, 5) === ColonCharCode) {
3616
- // Assume xlink namespace
3617
- setAttribute(elm, name, cur, XLINK_NAMESPACE);
3618
- }
3619
- else if (isNull(cur) || isUndefined$1(cur)) {
3620
- removeAttribute(elm, name);
3621
- }
3622
- else {
3623
- setAttribute(elm, name, cur);
3624
- }
3625
- }
3626
- }
3627
- }
3628
-
3629
3572
  /*
3630
3573
  * Copyright (c) 2018, salesforce.com, inc.
3631
3574
  * All rights reserved.
@@ -3647,6 +3590,7 @@ function patchProps(oldVnode, vnode, renderer) {
3647
3590
  if (!isNull(oldVnode)) {
3648
3591
  oldProps = oldVnode.data.props;
3649
3592
  const oldSpread = oldVnode.data.spread;
3593
+ // Props may be the same due to the static content optimization, so we can skip diffing
3650
3594
  if (oldProps === props && oldSpread === spread) {
3651
3595
  return;
3652
3596
  }
@@ -3769,7 +3713,9 @@ function patchStyleAttribute(oldVnode, vnode, renderer) {
3769
3713
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3770
3714
  */
3771
3715
  function applyEventListeners(vnode, renderer) {
3772
- const { elm, data: { on }, } = vnode;
3716
+ var _a;
3717
+ const { elm } = vnode;
3718
+ const on = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.on;
3773
3719
  if (isUndefined$1(on)) {
3774
3720
  return;
3775
3721
  }
@@ -3981,6 +3927,8 @@ function mountStatic(vnode, parent, anchor, renderer) {
3981
3927
  }
3982
3928
  }
3983
3929
  insertNode(elm, parent, anchor, renderer);
3930
+ // Event listeners are only applied once when mounting, so they are allowed for static vnodes
3931
+ applyEventListeners(vnode, renderer);
3984
3932
  }
3985
3933
  function mountCustomElement(vnode, parent, anchor, renderer) {
3986
3934
  const { sel, owner } = vnode;
@@ -4203,12 +4151,7 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4203
4151
  // value is set before type=radio.
4204
4152
  patchClassAttribute(oldVnode, vnode, renderer);
4205
4153
  patchStyleAttribute(oldVnode, vnode, renderer);
4206
- if (vnode.data.external) {
4207
- patchAttrUnlessProp(oldVnode, vnode, renderer);
4208
- }
4209
- else {
4210
- patchAttributes(oldVnode, vnode, renderer);
4211
- }
4154
+ patchAttributes(oldVnode, vnode, renderer);
4212
4155
  patchProps(oldVnode, vnode, renderer);
4213
4156
  }
4214
4157
  function applyStyleScoping(elm, owner, renderer) {
@@ -4608,7 +4551,7 @@ function ssf(slotName, factory) {
4608
4551
  };
4609
4552
  }
4610
4553
  // [st]atic node
4611
- function st(fragment, key) {
4554
+ function st(fragment, key, data) {
4612
4555
  return {
4613
4556
  type: 4 /* VNodeType.Static */,
4614
4557
  sel: undefined,
@@ -4616,6 +4559,7 @@ function st(fragment, key) {
4616
4559
  elm: undefined,
4617
4560
  fragment,
4618
4561
  owner: getVMBeingRendered(),
4562
+ data,
4619
4563
  };
4620
4564
  }
4621
4565
  // [fr]agment node
@@ -6250,7 +6194,7 @@ function readonly(obj) {
6250
6194
  }
6251
6195
  return getReadOnlyProxy(obj);
6252
6196
  }
6253
- /** version: 2.45.5 */
6197
+ /** version: 2.46.0 */
6254
6198
 
6255
6199
  /*
6256
6200
  * Copyright (c) 2020, salesforce.com, inc.
@@ -14562,7 +14506,7 @@ seal(LightningElement.prototype);
14562
14506
  function createElement() {
14563
14507
  throw new Error('createElement is not supported in @lwc/engine-server, only @lwc/engine-dom.');
14564
14508
  }
14565
- /** version: 2.45.5 */
14509
+ /** version: 2.46.0 */
14566
14510
 
14567
14511
  exports.LightningElement = LightningElement;
14568
14512
  exports.api = api$1;