lwc 2.21.1 → 2.22.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 (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +145 -71
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +145 -71
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +143 -69
  5. package/dist/engine-dom/iife/es5/engine-dom.js +182 -79
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +167 -64
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +145 -71
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +143 -69
  11. package/dist/engine-dom/umd/es5/engine-dom.js +182 -79
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +167 -64
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +53 -262
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +53 -262
  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 +7 -7
@@ -368,9 +368,9 @@
368
368
  // Increment whenever the LWC template compiler changes
369
369
 
370
370
 
371
- var LWC_VERSION = "2.21.1";
371
+ var LWC_VERSION = "2.22.0";
372
372
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.21.1 */
373
+ /** version: 2.22.0 */
374
374
 
375
375
  /*
376
376
  * Copyright (c) 2018, salesforce.com, inc.
@@ -549,7 +549,7 @@
549
549
  setFeatureFlag(name, value);
550
550
  }
551
551
  }
552
- /** version: 2.21.1 */
552
+ /** version: 2.22.0 */
553
553
 
554
554
  /*
555
555
  * Copyright (c) 2018, salesforce.com, inc.
@@ -855,20 +855,24 @@
855
855
 
856
856
  return ReactiveObserver;
857
857
  }();
858
- /*
859
- * Copyright (c) 2018, salesforce.com, inc.
860
- * All rights reserved.
861
- * SPDX-License-Identifier: MIT
862
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
863
- */
864
-
865
858
 
866
859
  function componentValueMutated(vm, key) {
867
- valueMutated(vm.component, key);
860
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
861
+ {
862
+ valueMutated(vm.component, key);
863
+ }
868
864
  }
869
865
 
870
866
  function componentValueObserved(vm, key) {
871
- valueObserved(vm.component, key);
867
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
868
+ {
869
+ valueObserved(vm.component, key);
870
+ }
871
+ }
872
+
873
+ function createReactiveObserver(callback) {
874
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
875
+ return new ReactiveObserver(callback);
872
876
  }
873
877
  /*
874
878
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2283,8 +2287,28 @@
2283
2287
  */
2284
2288
 
2285
2289
  function unwrap(value) {
2290
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2286
2291
  return reactiveMembrane.unwrapProxy(value);
2287
2292
  }
2293
+
2294
+ function getReadOnlyProxy(value) {
2295
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
2296
+ // them from their parents. This applies to both the client and server.
2297
+ return reactiveMembrane.getReadOnlyProxy(value);
2298
+ }
2299
+
2300
+ function getReactiveProxy(value) {
2301
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2302
+ return reactiveMembrane.getProxy(value);
2303
+ } // Making the component instance a live value when using Locker to support expandos.
2304
+
2305
+
2306
+ function markLockerLiveObject(obj) {
2307
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2308
+ {
2309
+ obj[lockerLivePropertyKey] = undefined;
2310
+ }
2311
+ }
2288
2312
  /*
2289
2313
  * Copyright (c) 2018, salesforce.com, inc.
2290
2314
  * All rights reserved.
@@ -2399,10 +2423,9 @@
2399
2423
  vm.callHook = _callHook;
2400
2424
  vm.setHook = _setHook;
2401
2425
  vm.getHook = _getHook;
2402
- } // Making the component instance a live value when using Locker to support expandos.
2403
-
2426
+ }
2404
2427
 
2405
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
2428
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
2406
2429
 
2407
2430
  associateVM(component, vm);
2408
2431
  associateVM(elm, vm);
@@ -2742,55 +2765,6 @@
2742
2765
  configurable: true
2743
2766
  };
2744
2767
  }
2745
- /*
2746
- * Copyright (c) 2018, salesforce.com, inc.
2747
- * All rights reserved.
2748
- * SPDX-License-Identifier: MIT
2749
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2750
- */
2751
-
2752
-
2753
- function api$1() {
2754
- if (process.env.NODE_ENV !== 'production') {
2755
- assert.fail("@api decorator can only be used as a decorator function.");
2756
- }
2757
-
2758
- throw new Error();
2759
- }
2760
-
2761
- function createPublicPropertyDescriptor(key) {
2762
- return {
2763
- get: function get() {
2764
- var vm = getAssociatedVM(this);
2765
-
2766
- if (isBeingConstructed(vm)) {
2767
- if (process.env.NODE_ENV !== 'production') {
2768
- logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2769
- }
2770
-
2771
- return;
2772
- }
2773
-
2774
- componentValueObserved(vm, key);
2775
- return vm.cmpProps[key];
2776
- },
2777
- set: function set(newValue) {
2778
- var vm = getAssociatedVM(this);
2779
-
2780
- if (process.env.NODE_ENV !== 'production') {
2781
- var _vmBeingRendered3 = getVMBeingRendered();
2782
-
2783
- assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2784
- assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2785
- }
2786
-
2787
- vm.cmpProps[key] = newValue;
2788
- componentValueMutated(vm, key);
2789
- },
2790
- enumerable: true,
2791
- configurable: true
2792
- };
2793
- }
2794
2768
 
2795
2769
  var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
2796
2770
  _inherits(AccessorReactiveObserver, _ReactiveObserver);
@@ -2849,6 +2823,60 @@
2849
2823
  return AccessorReactiveObserver;
2850
2824
  }(ReactiveObserver);
2851
2825
 
2826
+ function createAccessorReactiveObserver(vm, set) {
2827
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2828
+ return new AccessorReactiveObserver(vm, set);
2829
+ }
2830
+ /*
2831
+ * Copyright (c) 2018, salesforce.com, inc.
2832
+ * All rights reserved.
2833
+ * SPDX-License-Identifier: MIT
2834
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2835
+ */
2836
+
2837
+
2838
+ function api$1() {
2839
+ if (process.env.NODE_ENV !== 'production') {
2840
+ assert.fail("@api decorator can only be used as a decorator function.");
2841
+ }
2842
+
2843
+ throw new Error();
2844
+ }
2845
+
2846
+ function createPublicPropertyDescriptor(key) {
2847
+ return {
2848
+ get: function get() {
2849
+ var vm = getAssociatedVM(this);
2850
+
2851
+ if (isBeingConstructed(vm)) {
2852
+ if (process.env.NODE_ENV !== 'production') {
2853
+ logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2854
+ }
2855
+
2856
+ return;
2857
+ }
2858
+
2859
+ componentValueObserved(vm, key);
2860
+ return vm.cmpProps[key];
2861
+ },
2862
+ set: function set(newValue) {
2863
+ var vm = getAssociatedVM(this);
2864
+
2865
+ if (process.env.NODE_ENV !== 'production') {
2866
+ var _vmBeingRendered3 = getVMBeingRendered();
2867
+
2868
+ assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2869
+ assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2870
+ }
2871
+
2872
+ vm.cmpProps[key] = newValue;
2873
+ componentValueMutated(vm, key);
2874
+ },
2875
+ enumerable: true,
2876
+ configurable: true
2877
+ };
2878
+ }
2879
+
2852
2880
  function createPublicAccessorDescriptor(key, descriptor) {
2853
2881
  var _get3 = descriptor.get,
2854
2882
  _set2 = descriptor.set,
@@ -2889,7 +2917,7 @@
2889
2917
  var ro = vm.oar[key];
2890
2918
 
2891
2919
  if (isUndefined$1(ro)) {
2892
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2920
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2893
2921
  } // every time we invoke this setter from outside (through this wrapper setter)
2894
2922
  // we should reset the value and then debounce just in case there is a pending
2895
2923
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2921,7 +2949,7 @@
2921
2949
 
2922
2950
  function track(target) {
2923
2951
  if (arguments.length === 1) {
2924
- return reactiveMembrane.getProxy(target);
2952
+ return getReactiveProxy(target);
2925
2953
  }
2926
2954
 
2927
2955
  if (process.env.NODE_ENV !== 'production') {
@@ -2948,7 +2976,7 @@
2948
2976
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2949
2977
  }
2950
2978
 
2951
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2979
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2952
2980
 
2953
2981
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2954
2982
  vm.cmpFields[key] = reactiveOrAnyValue;
@@ -3423,7 +3451,7 @@
3423
3451
  fn = cachedSetterByKey[key] = function (newValue) {
3424
3452
  var vm = getAssociatedVM(this);
3425
3453
  var setHook = vm.setHook;
3426
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
3454
+ newValue = getReadOnlyProxy(newValue);
3427
3455
  setHook(vm.component, key, newValue);
3428
3456
  };
3429
3457
  }
@@ -6472,7 +6500,7 @@
6472
6500
  }
6473
6501
 
6474
6502
  function getTemplateReactiveObserver(vm) {
6475
- return new ReactiveObserver(function () {
6503
+ return createReactiveObserver(function () {
6476
6504
  var isDirty = vm.isDirty;
6477
6505
 
6478
6506
  if (isFalse(isDirty)) {
@@ -7291,7 +7319,7 @@
7291
7319
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
7292
7320
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
7293
7321
 
7294
- var ro = new ReactiveObserver(function () {
7322
+ var ro = createReactiveObserver(function () {
7295
7323
  if (hasPendingConfig === false) {
7296
7324
  hasPendingConfig = true; // collect new config in the micro-task
7297
7325
 
@@ -7592,7 +7620,7 @@
7592
7620
  }
7593
7621
  }
7594
7622
 
7595
- return reactiveMembrane.getReadOnlyProxy(obj);
7623
+ return getReadOnlyProxy(obj);
7596
7624
  }
7597
7625
  /*
7598
7626
  * Copyright (c) 2022, salesforce.com, inc.
@@ -8273,7 +8301,7 @@
8273
8301
 
8274
8302
  return ctor;
8275
8303
  }
8276
- /* version: 2.21.1 */
8304
+ /* version: 2.22.0 */
8277
8305
 
8278
8306
  /*
8279
8307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8441,6 +8469,85 @@
8441
8469
  */
8442
8470
 
8443
8471
 
8472
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8473
+ var createFragment;
8474
+
8475
+ if (SUPPORTS_TEMPLATE) {
8476
+ // Parse the fragment HTML string into DOM
8477
+ createFragment = function createFragment(html) {
8478
+ var template = document.createElement('template');
8479
+ template.innerHTML = html;
8480
+ return template.content.firstChild;
8481
+ };
8482
+ } else {
8483
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8484
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8485
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8486
+ // With other elements added from:
8487
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8488
+ // Using the test:
8489
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8490
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8491
+ var topLevelWrappingMap = {
8492
+ caption: ['table'],
8493
+ col: ['colgroup', 'table'],
8494
+ colgroup: ['table'],
8495
+ option: ['select'],
8496
+ tbody: ['table'],
8497
+ td: ['tr', 'tbody', 'table'],
8498
+ th: ['tr', 'tbody', 'table'],
8499
+ thead: ['table'],
8500
+ tfoot: ['table'],
8501
+ tr: ['tbody', 'table']
8502
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8503
+
8504
+ var getTagName = function getTagName(text) {
8505
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8506
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8507
+
8508
+
8509
+ createFragment = function createFragment(html) {
8510
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8511
+
8512
+ if (!isUndefined$1(wrapperTags)) {
8513
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8514
+ _step5;
8515
+
8516
+ try {
8517
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8518
+ var wrapperTag = _step5.value;
8519
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8520
+ }
8521
+ } catch (err) {
8522
+ _iterator5.e(err);
8523
+ } finally {
8524
+ _iterator5.f();
8525
+ }
8526
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8527
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8528
+
8529
+
8530
+ var doc = document.implementation.createHTMLDocument('');
8531
+ doc.body.innerHTML = html;
8532
+ var content = doc.body;
8533
+
8534
+ if (!isUndefined$1(wrapperTags)) {
8535
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8536
+ content = content.firstChild;
8537
+ }
8538
+ }
8539
+
8540
+ return content.firstChild;
8541
+ };
8542
+ }
8543
+ /*
8544
+ * Copyright (c) 2018, salesforce.com, inc.
8545
+ * All rights reserved.
8546
+ * SPDX-License-Identifier: MIT
8547
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8548
+ */
8549
+
8550
+
8444
8551
  var getCustomElement;
8445
8552
  var defineCustomElement;
8446
8553
  var HTMLElementConstructor;
@@ -8541,10 +8648,6 @@
8541
8648
  return node.cloneNode(deep);
8542
8649
  }
8543
8650
 
8544
- function createFragment(html) {
8545
- return document.createRange().createContextualFragment(html).firstChild;
8546
- }
8547
-
8548
8651
  function createElement$1(tagName, namespace) {
8549
8652
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8550
8653
  }
@@ -8769,8 +8872,8 @@
8769
8872
  hydrated: true
8770
8873
  });
8771
8874
 
8772
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
8773
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
8875
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
8876
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
8774
8877
  key = _Object$entries2$_i[0],
8775
8878
  value = _Object$entries2$_i[1];
8776
8879
 
@@ -9102,7 +9205,7 @@
9102
9205
  });
9103
9206
  freeze(LightningElement);
9104
9207
  seal(LightningElement.prototype);
9105
- /* version: 2.21.1 */
9208
+ /* version: 2.22.0 */
9106
9209
 
9107
9210
  exports.LightningElement = LightningElement;
9108
9211
  exports.__unstable__ProfilerControl = profilerControl;