lwc 2.30.2 → 2.31.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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +128 -41
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +128 -41
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +125 -38
  5. package/dist/engine-dom/iife/es5/engine-dom.js +156 -65
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +153 -62
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +128 -41
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +125 -38
  11. package/dist/engine-dom/umd/es5/engine-dom.js +156 -65
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +153 -62
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +120 -40
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +120 -40
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +7 -4
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +7 -4
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +7 -4
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +7 -4
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +7 -4
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +7 -4
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +7 -4
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +7 -4
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +7 -4
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -240,32 +240,57 @@
240
240
  const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
241
241
  const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
242
242
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
243
- /**
244
- * Map composed of properties to attributes not following the HTML property to attribute mapping
245
- * convention.
243
+
244
+ /*
245
+ * Copyright (c) 2020, salesforce.com, inc.
246
+ * All rights reserved.
247
+ * SPDX-License-Identifier: MIT
248
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
246
249
  */
247
- const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = new Map([
248
- ['accessKey', 'accesskey'],
249
- ['readOnly', 'readonly'],
250
- ['tabIndex', 'tabindex'],
251
- ['bgColor', 'bgcolor'],
252
- ['colSpan', 'colspan'],
253
- ['rowSpan', 'rowspan'],
254
- ['contentEditable', 'contenteditable'],
255
- ['crossOrigin', 'crossorigin'],
256
- ['dateTime', 'datetime'],
257
- ['formAction', 'formaction'],
258
- ['isMap', 'ismap'],
259
- ['maxLength', 'maxlength'],
260
- ['minLength', 'minlength'],
261
- ['noValidate', 'novalidate'],
262
- ['useMap', 'usemap'],
263
- ['htmlFor', 'for'],
264
- ]);
250
+ const CAMEL_REGEX = /-([a-z])/g;
251
+ // Convoluted map generation so that @lwc/shared remains fully tree-shakable (verify-treeshakable)
252
+ const { NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING, NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING } =
253
+ /*#__PURE__*/ (() => {
254
+ /**
255
+ * Map composed of properties to attributes not following the HTML property to attribute mapping
256
+ * convention.
257
+ */
258
+ const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = new Map([
259
+ ['accessKey', 'accesskey'],
260
+ ['readOnly', 'readonly'],
261
+ ['tabIndex', 'tabindex'],
262
+ ['bgColor', 'bgcolor'],
263
+ ['colSpan', 'colspan'],
264
+ ['rowSpan', 'rowspan'],
265
+ ['contentEditable', 'contenteditable'],
266
+ ['crossOrigin', 'crossorigin'],
267
+ ['dateTime', 'datetime'],
268
+ ['formAction', 'formaction'],
269
+ ['isMap', 'ismap'],
270
+ ['maxLength', 'maxlength'],
271
+ ['minLength', 'minlength'],
272
+ ['noValidate', 'novalidate'],
273
+ ['useMap', 'usemap'],
274
+ ['htmlFor', 'for'],
275
+ ]);
276
+ /**
277
+ * Inverted map with attribute name key and property name value.
278
+ */
279
+ const NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING = new Map();
280
+ NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING.forEach((value, key) => NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.set(value, key));
281
+ return {
282
+ NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING,
283
+ NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING,
284
+ };
285
+ })();
265
286
  /**
266
287
  * Map associating previously transformed HTML property into HTML attribute.
267
288
  */
268
289
  const CACHED_PROPERTY_ATTRIBUTE_MAPPING = new Map();
290
+ /**
291
+ * Map associating previously transformed HTML attribute into HTML property.
292
+ */
293
+ const CACHED_ATTRIBUTE_PROPERTY_MAPPING = new Map();
269
294
  function htmlPropertyToAttribute(propName) {
270
295
  const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
271
296
  if (!isUndefined$1(ariaAttributeName)) {
@@ -294,7 +319,24 @@
294
319
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
295
320
  return attributeName;
296
321
  }
297
- /** version: 2.30.2 */
322
+ function htmlAttributeToProperty(attrName) {
323
+ const ariaPropertyName = AriaAttrNameToPropNameMap[attrName];
324
+ if (!isUndefined$1(ariaPropertyName)) {
325
+ return ariaPropertyName;
326
+ }
327
+ const specialPropertyName = NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
328
+ if (!isUndefined$1(specialPropertyName)) {
329
+ return specialPropertyName;
330
+ }
331
+ const cachedPropertyName = CACHED_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
332
+ if (!isUndefined$1(cachedPropertyName)) {
333
+ return cachedPropertyName;
334
+ }
335
+ const propertyName = StringReplace.call(attrName, CAMEL_REGEX, (g) => g[1].toUpperCase());
336
+ CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
337
+ return propertyName;
338
+ }
339
+ /** version: 2.31.0 */
298
340
 
299
341
  /**
300
342
  * Copyright (C) 2018 salesforce.com, inc.
@@ -376,7 +418,7 @@
376
418
  patch$1(propName);
377
419
  }
378
420
  }
379
- /** version: 2.30.2 */
421
+ /** version: 2.31.0 */
380
422
 
381
423
  /**
382
424
  * Copyright (C) 2018 salesforce.com, inc.
@@ -2576,7 +2618,7 @@
2576
2618
  * SPDX-License-Identifier: MIT
2577
2619
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2578
2620
  */
2579
- const ColonCharCode = 58;
2621
+ const ColonCharCode$1 = 58;
2580
2622
  function patchAttributes(oldVnode, vnode, renderer) {
2581
2623
  const { attrs } = vnode.data;
2582
2624
  if (isUndefined$1(attrs)) {
@@ -2593,11 +2635,11 @@
2593
2635
  const old = oldAttrs[key];
2594
2636
  if (old !== cur) {
2595
2637
  unlockAttribute(elm, key);
2596
- if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
2638
+ if (StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
2597
2639
  // Assume xml namespace
2598
2640
  setAttribute(elm, key, cur, XML_NAMESPACE);
2599
2641
  }
2600
- else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
2642
+ else if (StringCharCodeAt.call(key, 5) === ColonCharCode$1) {
2601
2643
  // Assume xlink namespace
2602
2644
  setAttribute(elm, key, cur, XLINK_NAMESPACE);
2603
2645
  }
@@ -2612,6 +2654,46 @@
2612
2654
  }
2613
2655
  }
2614
2656
 
2657
+ /*
2658
+ * Copyright (c) 2018, salesforce.com, inc.
2659
+ * All rights reserved.
2660
+ * SPDX-License-Identifier: MIT
2661
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2662
+ */
2663
+ const ColonCharCode = 58;
2664
+ function patchAttrUnlessProp(oldVnode, vnode, renderer) {
2665
+ const { data: { attrs }, elm, } = vnode;
2666
+ if (isUndefined$1(attrs)) {
2667
+ return;
2668
+ }
2669
+ const { removeAttribute, setAttribute, setProperty } = renderer;
2670
+ const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
2671
+ for (const name in attrs) {
2672
+ const cur = attrs[name];
2673
+ const old = oldAttrs[name];
2674
+ if (old !== cur) {
2675
+ const propName = htmlAttributeToProperty(name);
2676
+ if (propName in elm) {
2677
+ setProperty(elm, name, cur);
2678
+ }
2679
+ else if (StringCharCodeAt.call(name, 3) === ColonCharCode) {
2680
+ // Assume xml namespace
2681
+ setAttribute(elm, name, cur, XML_NAMESPACE);
2682
+ }
2683
+ else if (StringCharCodeAt.call(name, 5) === ColonCharCode) {
2684
+ // Assume xlink namespace
2685
+ setAttribute(elm, name, cur, XLINK_NAMESPACE);
2686
+ }
2687
+ else if (isNull(cur) || isUndefined$1(cur)) {
2688
+ removeAttribute(elm, name);
2689
+ }
2690
+ else {
2691
+ setAttribute(elm, name, cur);
2692
+ }
2693
+ }
2694
+ }
2695
+ }
2696
+
2615
2697
  /*
2616
2698
  * Copyright (c) 2018, salesforce.com, inc.
2617
2699
  * All rights reserved.
@@ -3160,7 +3242,11 @@
3160
3242
  // value is set before type=radio.
3161
3243
  patchClassAttribute(oldVnode, vnode, renderer);
3162
3244
  patchStyleAttribute(oldVnode, vnode, renderer);
3163
- patchAttributes(oldVnode, vnode, renderer);
3245
+ if (vnode.data.external) {
3246
+ patchAttrUnlessProp(oldVnode, vnode, renderer);
3247
+ } else {
3248
+ patchAttributes(oldVnode, vnode, renderer);
3249
+ }
3164
3250
  patchProps(oldVnode, vnode, renderer);
3165
3251
  }
3166
3252
  function applyStyleScoping(elm, owner, renderer) {
@@ -3540,40 +3626,41 @@
3540
3626
  !isUndefined$1(slotset.slotAssignments) &&
3541
3627
  !isUndefined$1(slotset.slotAssignments[slotName]) &&
3542
3628
  slotset.slotAssignments[slotName].length !== 0) {
3543
- children = slotset.slotAssignments[slotName].reduce((accumulator, vnode) => {
3544
- if (vnode) {
3629
+ const newChildren = [];
3630
+ const slotAssignments = slotset.slotAssignments[slotName];
3631
+ for (let i = 0; i < slotAssignments.length; i++) {
3632
+ const vnode = slotAssignments[i];
3633
+ if (!isNull(vnode)) {
3545
3634
  const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
3546
3635
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
3547
3636
  const isScopedSlotElement = !isUndefined$1(data.slotData);
3548
3637
  // Check if slot types of parent and child are matching
3549
3638
  if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
3550
3639
  // Ignore slot content from parent
3551
- return accumulator;
3640
+ continue;
3552
3641
  }
3553
3642
  // If the passed slot content is factory, evaluate it and add the produced vnodes
3554
3643
  if (assignedNodeIsScopedSlot) {
3555
3644
  const vmBeingRenderedInception = getVMBeingRendered();
3556
- let scopedSlotChildren = [];
3557
3645
  // Evaluate in the scope of the slot content's owner
3558
3646
  // if a slotset is provided, there will always be an owner. The only case where owner is
3559
3647
  // undefined is for root components, but root components cannot accept slotted content
3560
3648
  setVMBeingRendered(slotset.owner);
3561
3649
  try {
3562
- scopedSlotChildren = vnode.factory(data.slotData);
3650
+ ArrayPush$1.apply(newChildren, vnode.factory(data.slotData));
3563
3651
  }
3564
3652
  finally {
3565
3653
  setVMBeingRendered(vmBeingRenderedInception);
3566
3654
  }
3567
- return ArrayConcat$1.call(accumulator, scopedSlotChildren);
3568
3655
  }
3569
3656
  else {
3570
3657
  // If the slot content is standard type, the content is static, no additional
3571
3658
  // processing needed on the vnode
3572
- return ArrayConcat$1.call(accumulator, vnode);
3659
+ ArrayPush$1.call(newChildren, vnode);
3573
3660
  }
3574
3661
  }
3575
- return accumulator;
3576
- }, []);
3662
+ }
3663
+ children = newChildren;
3577
3664
  }
3578
3665
  const vmBeingRendered = getVMBeingRendered();
3579
3666
  const { renderMode, shadowMode } = vmBeingRendered;
@@ -6221,7 +6308,7 @@
6221
6308
  function isNull(obj) {
6222
6309
  return obj === null;
6223
6310
  }
6224
- /** version: 2.30.2 */
6311
+ /** version: 2.31.0 */
6225
6312
 
6226
6313
  /*
6227
6314
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6774,7 +6861,7 @@
6774
6861
  });
6775
6862
  freeze(LightningElement);
6776
6863
  seal(LightningElement.prototype);
6777
- /* version: 2.30.2 */
6864
+ /* version: 2.31.0 */
6778
6865
 
6779
6866
  exports.LightningElement = LightningElement;
6780
6867
  exports.__unstable__ProfilerControl = profilerControl;