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
@@ -365,9 +365,9 @@ var LWC = (function (exports) {
365
365
  // Increment whenever the LWC template compiler changes
366
366
 
367
367
 
368
- var LWC_VERSION = "2.21.1";
368
+ var LWC_VERSION = "2.22.0";
369
369
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
370
- /** version: 2.21.1 */
370
+ /** version: 2.22.0 */
371
371
 
372
372
  /*
373
373
  * Copyright (c) 2018, salesforce.com, inc.
@@ -546,7 +546,7 @@ var LWC = (function (exports) {
546
546
  setFeatureFlag(name, value);
547
547
  }
548
548
  }
549
- /** version: 2.21.1 */
549
+ /** version: 2.22.0 */
550
550
 
551
551
  /*
552
552
  * Copyright (c) 2018, salesforce.com, inc.
@@ -852,20 +852,24 @@ var LWC = (function (exports) {
852
852
 
853
853
  return ReactiveObserver;
854
854
  }();
855
- /*
856
- * Copyright (c) 2018, salesforce.com, inc.
857
- * All rights reserved.
858
- * SPDX-License-Identifier: MIT
859
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
860
- */
861
-
862
855
 
863
856
  function componentValueMutated(vm, key) {
864
- valueMutated(vm.component, key);
857
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
858
+ {
859
+ valueMutated(vm.component, key);
860
+ }
865
861
  }
866
862
 
867
863
  function componentValueObserved(vm, key) {
868
- valueObserved(vm.component, key);
864
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
865
+ {
866
+ valueObserved(vm.component, key);
867
+ }
868
+ }
869
+
870
+ function createReactiveObserver(callback) {
871
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
872
+ return new ReactiveObserver(callback);
869
873
  }
870
874
  /*
871
875
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2280,8 +2284,28 @@ var LWC = (function (exports) {
2280
2284
  */
2281
2285
 
2282
2286
  function unwrap(value) {
2287
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2283
2288
  return reactiveMembrane.unwrapProxy(value);
2284
2289
  }
2290
+
2291
+ function getReadOnlyProxy(value) {
2292
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
2293
+ // them from their parents. This applies to both the client and server.
2294
+ return reactiveMembrane.getReadOnlyProxy(value);
2295
+ }
2296
+
2297
+ function getReactiveProxy(value) {
2298
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2299
+ return reactiveMembrane.getProxy(value);
2300
+ } // Making the component instance a live value when using Locker to support expandos.
2301
+
2302
+
2303
+ function markLockerLiveObject(obj) {
2304
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2305
+ {
2306
+ obj[lockerLivePropertyKey] = undefined;
2307
+ }
2308
+ }
2285
2309
  /*
2286
2310
  * Copyright (c) 2018, salesforce.com, inc.
2287
2311
  * All rights reserved.
@@ -2396,10 +2420,9 @@ var LWC = (function (exports) {
2396
2420
  vm.callHook = _callHook;
2397
2421
  vm.setHook = _setHook;
2398
2422
  vm.getHook = _getHook;
2399
- } // Making the component instance a live value when using Locker to support expandos.
2400
-
2423
+ }
2401
2424
 
2402
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
2425
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
2403
2426
 
2404
2427
  associateVM(component, vm);
2405
2428
  associateVM(elm, vm);
@@ -2739,55 +2762,6 @@ var LWC = (function (exports) {
2739
2762
  configurable: true
2740
2763
  };
2741
2764
  }
2742
- /*
2743
- * Copyright (c) 2018, salesforce.com, inc.
2744
- * All rights reserved.
2745
- * SPDX-License-Identifier: MIT
2746
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2747
- */
2748
-
2749
-
2750
- function api$1() {
2751
- if (process.env.NODE_ENV !== 'production') {
2752
- assert.fail("@api decorator can only be used as a decorator function.");
2753
- }
2754
-
2755
- throw new Error();
2756
- }
2757
-
2758
- function createPublicPropertyDescriptor(key) {
2759
- return {
2760
- get: function get() {
2761
- var vm = getAssociatedVM(this);
2762
-
2763
- if (isBeingConstructed(vm)) {
2764
- if (process.env.NODE_ENV !== 'production') {
2765
- 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);
2766
- }
2767
-
2768
- return;
2769
- }
2770
-
2771
- componentValueObserved(vm, key);
2772
- return vm.cmpProps[key];
2773
- },
2774
- set: function set(newValue) {
2775
- var vm = getAssociatedVM(this);
2776
-
2777
- if (process.env.NODE_ENV !== 'production') {
2778
- var _vmBeingRendered3 = getVMBeingRendered();
2779
-
2780
- assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2781
- assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2782
- }
2783
-
2784
- vm.cmpProps[key] = newValue;
2785
- componentValueMutated(vm, key);
2786
- },
2787
- enumerable: true,
2788
- configurable: true
2789
- };
2790
- }
2791
2765
 
2792
2766
  var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
2793
2767
  _inherits(AccessorReactiveObserver, _ReactiveObserver);
@@ -2846,6 +2820,60 @@ var LWC = (function (exports) {
2846
2820
  return AccessorReactiveObserver;
2847
2821
  }(ReactiveObserver);
2848
2822
 
2823
+ function createAccessorReactiveObserver(vm, set) {
2824
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2825
+ return new AccessorReactiveObserver(vm, set);
2826
+ }
2827
+ /*
2828
+ * Copyright (c) 2018, salesforce.com, inc.
2829
+ * All rights reserved.
2830
+ * SPDX-License-Identifier: MIT
2831
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2832
+ */
2833
+
2834
+
2835
+ function api$1() {
2836
+ if (process.env.NODE_ENV !== 'production') {
2837
+ assert.fail("@api decorator can only be used as a decorator function.");
2838
+ }
2839
+
2840
+ throw new Error();
2841
+ }
2842
+
2843
+ function createPublicPropertyDescriptor(key) {
2844
+ return {
2845
+ get: function get() {
2846
+ var vm = getAssociatedVM(this);
2847
+
2848
+ if (isBeingConstructed(vm)) {
2849
+ if (process.env.NODE_ENV !== 'production') {
2850
+ 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);
2851
+ }
2852
+
2853
+ return;
2854
+ }
2855
+
2856
+ componentValueObserved(vm, key);
2857
+ return vm.cmpProps[key];
2858
+ },
2859
+ set: function set(newValue) {
2860
+ var vm = getAssociatedVM(this);
2861
+
2862
+ if (process.env.NODE_ENV !== 'production') {
2863
+ var _vmBeingRendered3 = getVMBeingRendered();
2864
+
2865
+ assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2866
+ assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2867
+ }
2868
+
2869
+ vm.cmpProps[key] = newValue;
2870
+ componentValueMutated(vm, key);
2871
+ },
2872
+ enumerable: true,
2873
+ configurable: true
2874
+ };
2875
+ }
2876
+
2849
2877
  function createPublicAccessorDescriptor(key, descriptor) {
2850
2878
  var _get3 = descriptor.get,
2851
2879
  _set2 = descriptor.set,
@@ -2886,7 +2914,7 @@ var LWC = (function (exports) {
2886
2914
  var ro = vm.oar[key];
2887
2915
 
2888
2916
  if (isUndefined$1(ro)) {
2889
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2917
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2890
2918
  } // every time we invoke this setter from outside (through this wrapper setter)
2891
2919
  // we should reset the value and then debounce just in case there is a pending
2892
2920
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2918,7 +2946,7 @@ var LWC = (function (exports) {
2918
2946
 
2919
2947
  function track(target) {
2920
2948
  if (arguments.length === 1) {
2921
- return reactiveMembrane.getProxy(target);
2949
+ return getReactiveProxy(target);
2922
2950
  }
2923
2951
 
2924
2952
  if (process.env.NODE_ENV !== 'production') {
@@ -2945,7 +2973,7 @@ var LWC = (function (exports) {
2945
2973
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2946
2974
  }
2947
2975
 
2948
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2976
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2949
2977
 
2950
2978
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2951
2979
  vm.cmpFields[key] = reactiveOrAnyValue;
@@ -3420,7 +3448,7 @@ var LWC = (function (exports) {
3420
3448
  fn = cachedSetterByKey[key] = function (newValue) {
3421
3449
  var vm = getAssociatedVM(this);
3422
3450
  var setHook = vm.setHook;
3423
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
3451
+ newValue = getReadOnlyProxy(newValue);
3424
3452
  setHook(vm.component, key, newValue);
3425
3453
  };
3426
3454
  }
@@ -6469,7 +6497,7 @@ var LWC = (function (exports) {
6469
6497
  }
6470
6498
 
6471
6499
  function getTemplateReactiveObserver(vm) {
6472
- return new ReactiveObserver(function () {
6500
+ return createReactiveObserver(function () {
6473
6501
  var isDirty = vm.isDirty;
6474
6502
 
6475
6503
  if (isFalse(isDirty)) {
@@ -7288,7 +7316,7 @@ var LWC = (function (exports) {
7288
7316
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
7289
7317
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
7290
7318
 
7291
- var ro = new ReactiveObserver(function () {
7319
+ var ro = createReactiveObserver(function () {
7292
7320
  if (hasPendingConfig === false) {
7293
7321
  hasPendingConfig = true; // collect new config in the micro-task
7294
7322
 
@@ -7589,7 +7617,7 @@ var LWC = (function (exports) {
7589
7617
  }
7590
7618
  }
7591
7619
 
7592
- return reactiveMembrane.getReadOnlyProxy(obj);
7620
+ return getReadOnlyProxy(obj);
7593
7621
  }
7594
7622
  /*
7595
7623
  * Copyright (c) 2022, salesforce.com, inc.
@@ -8270,7 +8298,7 @@ var LWC = (function (exports) {
8270
8298
 
8271
8299
  return ctor;
8272
8300
  }
8273
- /* version: 2.21.1 */
8301
+ /* version: 2.22.0 */
8274
8302
 
8275
8303
  /*
8276
8304
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8438,6 +8466,85 @@ var LWC = (function (exports) {
8438
8466
  */
8439
8467
 
8440
8468
 
8469
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8470
+ var createFragment;
8471
+
8472
+ if (SUPPORTS_TEMPLATE) {
8473
+ // Parse the fragment HTML string into DOM
8474
+ createFragment = function createFragment(html) {
8475
+ var template = document.createElement('template');
8476
+ template.innerHTML = html;
8477
+ return template.content.firstChild;
8478
+ };
8479
+ } else {
8480
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8481
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8482
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8483
+ // With other elements added from:
8484
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8485
+ // Using the test:
8486
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8487
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8488
+ var topLevelWrappingMap = {
8489
+ caption: ['table'],
8490
+ col: ['colgroup', 'table'],
8491
+ colgroup: ['table'],
8492
+ option: ['select'],
8493
+ tbody: ['table'],
8494
+ td: ['tr', 'tbody', 'table'],
8495
+ th: ['tr', 'tbody', 'table'],
8496
+ thead: ['table'],
8497
+ tfoot: ['table'],
8498
+ tr: ['tbody', 'table']
8499
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8500
+
8501
+ var getTagName = function getTagName(text) {
8502
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8503
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8504
+
8505
+
8506
+ createFragment = function createFragment(html) {
8507
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8508
+
8509
+ if (!isUndefined$1(wrapperTags)) {
8510
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8511
+ _step5;
8512
+
8513
+ try {
8514
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8515
+ var wrapperTag = _step5.value;
8516
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8517
+ }
8518
+ } catch (err) {
8519
+ _iterator5.e(err);
8520
+ } finally {
8521
+ _iterator5.f();
8522
+ }
8523
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8524
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8525
+
8526
+
8527
+ var doc = document.implementation.createHTMLDocument('');
8528
+ doc.body.innerHTML = html;
8529
+ var content = doc.body;
8530
+
8531
+ if (!isUndefined$1(wrapperTags)) {
8532
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8533
+ content = content.firstChild;
8534
+ }
8535
+ }
8536
+
8537
+ return content.firstChild;
8538
+ };
8539
+ }
8540
+ /*
8541
+ * Copyright (c) 2018, salesforce.com, inc.
8542
+ * All rights reserved.
8543
+ * SPDX-License-Identifier: MIT
8544
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8545
+ */
8546
+
8547
+
8441
8548
  var getCustomElement;
8442
8549
  var defineCustomElement;
8443
8550
  var HTMLElementConstructor;
@@ -8538,10 +8645,6 @@ var LWC = (function (exports) {
8538
8645
  return node.cloneNode(deep);
8539
8646
  }
8540
8647
 
8541
- function createFragment(html) {
8542
- return document.createRange().createContextualFragment(html).firstChild;
8543
- }
8544
-
8545
8648
  function createElement$1(tagName, namespace) {
8546
8649
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8547
8650
  }
@@ -8766,8 +8869,8 @@ var LWC = (function (exports) {
8766
8869
  hydrated: true
8767
8870
  });
8768
8871
 
8769
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
8770
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
8872
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
8873
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
8771
8874
  key = _Object$entries2$_i[0],
8772
8875
  value = _Object$entries2$_i[1];
8773
8876
 
@@ -9099,7 +9202,7 @@ var LWC = (function (exports) {
9099
9202
  });
9100
9203
  freeze(LightningElement);
9101
9204
  seal(LightningElement.prototype);
9102
- /* version: 2.21.1 */
9205
+ /* version: 2.22.0 */
9103
9206
 
9104
9207
  exports.LightningElement = LightningElement;
9105
9208
  exports.__unstable__ProfilerControl = profilerControl;