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
@@ -299,9 +299,9 @@ function htmlPropertyToAttribute(propName) {
299
299
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
300
300
  */
301
301
  // Increment whenever the LWC template compiler changes
302
- const LWC_VERSION = "2.21.1";
302
+ const LWC_VERSION = "2.22.0";
303
303
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
304
- /** version: 2.21.1 */
304
+ /** version: 2.22.0 */
305
305
 
306
306
  /*
307
307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -455,7 +455,7 @@ function setFeatureFlagForTest(name, value) {
455
455
  setFeatureFlag(name, value);
456
456
  }
457
457
  }
458
- /** version: 2.21.1 */
458
+ /** version: 2.22.0 */
459
459
 
460
460
  /*
461
461
  * Copyright (c) 2018, salesforce.com, inc.
@@ -687,18 +687,21 @@ class ReactiveObserver {
687
687
  ArrayPush$1.call(this.listeners, reactiveObservers);
688
688
  }
689
689
  }
690
-
691
- /*
692
- * Copyright (c) 2018, salesforce.com, inc.
693
- * All rights reserved.
694
- * SPDX-License-Identifier: MIT
695
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
696
- */
697
690
  function componentValueMutated(vm, key) {
698
- valueMutated(vm.component, key);
691
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
692
+ {
693
+ valueMutated(vm.component, key);
694
+ }
699
695
  }
700
696
  function componentValueObserved(vm, key) {
701
- valueObserved(vm.component, key);
697
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
698
+ {
699
+ valueObserved(vm.component, key);
700
+ }
701
+ }
702
+ function createReactiveObserver(callback) {
703
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
704
+ return new ReactiveObserver(callback) ;
702
705
  }
703
706
 
704
707
  /*
@@ -1820,7 +1823,24 @@ const reactiveMembrane = new ObservableMembrane({
1820
1823
  * change or being removed.
1821
1824
  */
1822
1825
  function unwrap(value) {
1823
- return reactiveMembrane.unwrapProxy(value);
1826
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1827
+ return reactiveMembrane.unwrapProxy(value) ;
1828
+ }
1829
+ function getReadOnlyProxy(value) {
1830
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1831
+ // them from their parents. This applies to both the client and server.
1832
+ return reactiveMembrane.getReadOnlyProxy(value);
1833
+ }
1834
+ function getReactiveProxy(value) {
1835
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1836
+ return reactiveMembrane.getProxy(value) ;
1837
+ }
1838
+ // Making the component instance a live value when using Locker to support expandos.
1839
+ function markLockerLiveObject(obj) {
1840
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1841
+ {
1842
+ obj[lockerLivePropertyKey] = undefined;
1843
+ }
1824
1844
  }
1825
1845
 
1826
1846
  /*
@@ -1910,8 +1930,7 @@ const LightningElement = function () {
1910
1930
  vm.setHook = setHook;
1911
1931
  vm.getHook = getHook;
1912
1932
  }
1913
- // Making the component instance a live value when using Locker to support expandos.
1914
- this[lockerLivePropertyKey] = undefined;
1933
+ markLockerLiveObject(this);
1915
1934
  // Linking elm, shadow root and component with the VM.
1916
1935
  associateVM(component, vm);
1917
1936
  associateVM(elm, vm);
@@ -2180,6 +2199,45 @@ function createObservedFieldPropertyDescriptor(key) {
2180
2199
  configurable: true,
2181
2200
  };
2182
2201
  }
2202
+ class AccessorReactiveObserver extends ReactiveObserver {
2203
+ constructor(vm, set) {
2204
+ super(() => {
2205
+ if (isFalse(this.debouncing)) {
2206
+ this.debouncing = true;
2207
+ addCallbackToNextTick(() => {
2208
+ if (isTrue(this.debouncing)) {
2209
+ const { value } = this;
2210
+ const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
2211
+ set.call(component, value);
2212
+ // de-bouncing after the call to the original setter to prevent
2213
+ // infinity loop if the setter itself is mutating things that
2214
+ // were accessed during the previous invocation.
2215
+ this.debouncing = false;
2216
+ if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2217
+ // immediate rehydration due to a setter driven mutation, otherwise
2218
+ // the component will get rendered on the second tick, which it is not
2219
+ // desirable.
2220
+ rerenderVM(vm);
2221
+ }
2222
+ }
2223
+ });
2224
+ }
2225
+ });
2226
+ this.debouncing = false;
2227
+ }
2228
+ reset(value) {
2229
+ super.reset();
2230
+ this.debouncing = false;
2231
+ if (arguments.length > 0) {
2232
+ this.value = value;
2233
+ }
2234
+ }
2235
+ }
2236
+ function createAccessorReactiveObserver(vm, set) {
2237
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2238
+ return new AccessorReactiveObserver(vm, set)
2239
+ ;
2240
+ }
2183
2241
 
2184
2242
  /*
2185
2243
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2228,50 +2286,6 @@ function createPublicPropertyDescriptor(key) {
2228
2286
  configurable: true
2229
2287
  };
2230
2288
  }
2231
- class AccessorReactiveObserver extends ReactiveObserver {
2232
- constructor(vm, set) {
2233
- super(() => {
2234
- if (isFalse(this.debouncing)) {
2235
- this.debouncing = true;
2236
- addCallbackToNextTick(() => {
2237
- if (isTrue(this.debouncing)) {
2238
- const {
2239
- value
2240
- } = this;
2241
- const {
2242
- isDirty: dirtyStateBeforeSetterCall,
2243
- component,
2244
- idx
2245
- } = vm;
2246
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2247
- // infinity loop if the setter itself is mutating things that
2248
- // were accessed during the previous invocation.
2249
-
2250
- this.debouncing = false;
2251
-
2252
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2253
- // immediate rehydration due to a setter driven mutation, otherwise
2254
- // the component will get rendered on the second tick, which it is not
2255
- // desirable.
2256
- rerenderVM(vm);
2257
- }
2258
- }
2259
- });
2260
- }
2261
- });
2262
- this.debouncing = false;
2263
- }
2264
-
2265
- reset(value) {
2266
- super.reset();
2267
- this.debouncing = false;
2268
-
2269
- if (arguments.length > 0) {
2270
- this.value = value;
2271
- }
2272
- }
2273
-
2274
- }
2275
2289
  function createPublicAccessorDescriptor(key, descriptor) {
2276
2290
  const {
2277
2291
  get,
@@ -2312,7 +2326,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
2312
2326
  let ro = vm.oar[key];
2313
2327
 
2314
2328
  if (isUndefined$1(ro)) {
2315
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2329
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
2316
2330
  } // every time we invoke this setter from outside (through this wrapper setter)
2317
2331
  // we should reset the value and then debounce just in case there is a pending
2318
2332
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2344,7 +2358,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
2344
2358
  */
2345
2359
  function track(target) {
2346
2360
  if (arguments.length === 1) {
2347
- return reactiveMembrane.getProxy(target);
2361
+ return getReactiveProxy(target);
2348
2362
  }
2349
2363
  if (process.env.NODE_ENV !== 'production') {
2350
2364
  assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
@@ -2365,7 +2379,7 @@ function internalTrackDecorator(key) {
2365
2379
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2366
2380
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2367
2381
  }
2368
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2382
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2369
2383
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2370
2384
  vm.cmpFields[key] = reactiveOrAnyValue;
2371
2385
  componentValueMutated(vm, key);
@@ -2757,7 +2771,7 @@ function createSetter(key) {
2757
2771
  fn = cachedSetterByKey[key] = function (newValue) {
2758
2772
  const vm = getAssociatedVM(this);
2759
2773
  const { setHook } = vm;
2760
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2774
+ newValue = getReadOnlyProxy(newValue);
2761
2775
  setHook(vm.component, key, newValue);
2762
2776
  };
2763
2777
  }
@@ -5193,7 +5207,7 @@ function getComponentRegisteredTemplate(Ctor) {
5193
5207
  return signedTemplateMap.get(Ctor);
5194
5208
  }
5195
5209
  function getTemplateReactiveObserver(vm) {
5196
- return new ReactiveObserver(() => {
5210
+ return createReactiveObserver(() => {
5197
5211
  const { isDirty } = vm;
5198
5212
  if (isFalse(isDirty)) {
5199
5213
  markComponentAsDirty(vm);
@@ -6008,7 +6022,7 @@ function createMethodDataCallback(vm, method) {
6008
6022
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
6009
6023
  let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
6010
6024
 
6011
- const ro = new ReactiveObserver(() => {
6025
+ const ro = createReactiveObserver(() => {
6012
6026
  if (hasPendingConfig === false) {
6013
6027
  hasPendingConfig = true; // collect new config in the micro-task
6014
6028
 
@@ -6304,7 +6318,7 @@ function readonly(obj) {
6304
6318
  assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6305
6319
  }
6306
6320
  }
6307
- return reactiveMembrane.getReadOnlyProxy(obj);
6321
+ return getReadOnlyProxy(obj);
6308
6322
  }
6309
6323
 
6310
6324
  /*
@@ -6815,7 +6829,7 @@ function getComponentConstructor(elm) {
6815
6829
  }
6816
6830
  return ctor;
6817
6831
  }
6818
- /* version: 2.21.1 */
6832
+ /* version: 2.22.0 */
6819
6833
 
6820
6834
  /*
6821
6835
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6959,6 +6973,69 @@ function insertStylesheet(content, target) {
6959
6973
  }
6960
6974
  }
6961
6975
 
6976
+ /*
6977
+ * Copyright (c) 2018, salesforce.com, inc.
6978
+ * All rights reserved.
6979
+ * SPDX-License-Identifier: MIT
6980
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6981
+ */
6982
+ const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6983
+ let createFragment;
6984
+ if (SUPPORTS_TEMPLATE) {
6985
+ // Parse the fragment HTML string into DOM
6986
+ createFragment = function (html) {
6987
+ const template = document.createElement('template');
6988
+ template.innerHTML = html;
6989
+ return template.content.firstChild;
6990
+ };
6991
+ }
6992
+ else {
6993
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6994
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6995
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6996
+ // With other elements added from:
6997
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6998
+ // Using the test:
6999
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
7000
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
7001
+ const topLevelWrappingMap = {
7002
+ caption: ['table'],
7003
+ col: ['colgroup', 'table'],
7004
+ colgroup: ['table'],
7005
+ option: ['select'],
7006
+ tbody: ['table'],
7007
+ td: ['tr', 'tbody', 'table'],
7008
+ th: ['tr', 'tbody', 'table'],
7009
+ thead: ['table'],
7010
+ tfoot: ['table'],
7011
+ tr: ['tbody', 'table'],
7012
+ };
7013
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
7014
+ const getTagName = function (text) {
7015
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
7016
+ };
7017
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
7018
+ createFragment = function (html) {
7019
+ const wrapperTags = topLevelWrappingMap[getTagName(html)];
7020
+ if (!isUndefined$1(wrapperTags)) {
7021
+ for (const wrapperTag of wrapperTags) {
7022
+ html = `<${wrapperTag}>${html}</${wrapperTag}>`;
7023
+ }
7024
+ }
7025
+ // For IE11, the document title must not be undefined, but it can be an empty string
7026
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
7027
+ const doc = document.implementation.createHTMLDocument('');
7028
+ doc.body.innerHTML = html;
7029
+ let content = doc.body;
7030
+ if (!isUndefined$1(wrapperTags)) {
7031
+ for (let i = 0; i < wrapperTags.length; i++) {
7032
+ content = content.firstChild;
7033
+ }
7034
+ }
7035
+ return content.firstChild;
7036
+ };
7037
+ }
7038
+
6962
7039
  /*
6963
7040
  * Copyright (c) 2018, salesforce.com, inc.
6964
7041
  * All rights reserved.
@@ -7037,9 +7114,6 @@ const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__S
7037
7114
  function cloneNode(node, deep) {
7038
7115
  return node.cloneNode(deep);
7039
7116
  }
7040
- function createFragment(html) {
7041
- return document.createRange().createContextualFragment(html).firstChild;
7042
- }
7043
7117
  function createElement$1(tagName, namespace) {
7044
7118
  return isUndefined$1(namespace)
7045
7119
  ? document.createElement(tagName)
@@ -7503,6 +7577,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
7503
7577
  });
7504
7578
  freeze(LightningElement);
7505
7579
  seal(LightningElement.prototype);
7506
- /* version: 2.21.1 */
7580
+ /* version: 2.22.0 */
7507
7581
 
7508
7582
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
302
302
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
303
303
  */
304
304
  // Increment whenever the LWC template compiler changes
305
- const LWC_VERSION = "2.21.1";
305
+ const LWC_VERSION = "2.22.0";
306
306
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
307
- /** version: 2.21.1 */
307
+ /** version: 2.22.0 */
308
308
 
309
309
  /*
310
310
  * Copyright (c) 2018, salesforce.com, inc.
@@ -458,7 +458,7 @@ var LWC = (function (exports) {
458
458
  setFeatureFlag(name, value);
459
459
  }
460
460
  }
461
- /** version: 2.21.1 */
461
+ /** version: 2.22.0 */
462
462
 
463
463
  /*
464
464
  * Copyright (c) 2018, salesforce.com, inc.
@@ -690,18 +690,21 @@ var LWC = (function (exports) {
690
690
  ArrayPush$1.call(this.listeners, reactiveObservers);
691
691
  }
692
692
  }
693
-
694
- /*
695
- * Copyright (c) 2018, salesforce.com, inc.
696
- * All rights reserved.
697
- * SPDX-License-Identifier: MIT
698
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
699
- */
700
693
  function componentValueMutated(vm, key) {
701
- valueMutated(vm.component, key);
694
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
695
+ {
696
+ valueMutated(vm.component, key);
697
+ }
702
698
  }
703
699
  function componentValueObserved(vm, key) {
704
- valueObserved(vm.component, key);
700
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
701
+ {
702
+ valueObserved(vm.component, key);
703
+ }
704
+ }
705
+ function createReactiveObserver(callback) {
706
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
707
+ return new ReactiveObserver(callback) ;
705
708
  }
706
709
 
707
710
  /*
@@ -1823,7 +1826,24 @@ var LWC = (function (exports) {
1823
1826
  * change or being removed.
1824
1827
  */
1825
1828
  function unwrap(value) {
1826
- return reactiveMembrane.unwrapProxy(value);
1829
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1830
+ return reactiveMembrane.unwrapProxy(value) ;
1831
+ }
1832
+ function getReadOnlyProxy(value) {
1833
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
1834
+ // them from their parents. This applies to both the client and server.
1835
+ return reactiveMembrane.getReadOnlyProxy(value);
1836
+ }
1837
+ function getReactiveProxy(value) {
1838
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1839
+ return reactiveMembrane.getProxy(value) ;
1840
+ }
1841
+ // Making the component instance a live value when using Locker to support expandos.
1842
+ function markLockerLiveObject(obj) {
1843
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
1844
+ {
1845
+ obj[lockerLivePropertyKey] = undefined;
1846
+ }
1827
1847
  }
1828
1848
 
1829
1849
  /*
@@ -1913,8 +1933,7 @@ var LWC = (function (exports) {
1913
1933
  vm.setHook = setHook;
1914
1934
  vm.getHook = getHook;
1915
1935
  }
1916
- // Making the component instance a live value when using Locker to support expandos.
1917
- this[lockerLivePropertyKey] = undefined;
1936
+ markLockerLiveObject(this);
1918
1937
  // Linking elm, shadow root and component with the VM.
1919
1938
  associateVM(component, vm);
1920
1939
  associateVM(elm, vm);
@@ -2183,6 +2202,45 @@ var LWC = (function (exports) {
2183
2202
  configurable: true,
2184
2203
  };
2185
2204
  }
2205
+ class AccessorReactiveObserver extends ReactiveObserver {
2206
+ constructor(vm, set) {
2207
+ super(() => {
2208
+ if (isFalse(this.debouncing)) {
2209
+ this.debouncing = true;
2210
+ addCallbackToNextTick(() => {
2211
+ if (isTrue(this.debouncing)) {
2212
+ const { value } = this;
2213
+ const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
2214
+ set.call(component, value);
2215
+ // de-bouncing after the call to the original setter to prevent
2216
+ // infinity loop if the setter itself is mutating things that
2217
+ // were accessed during the previous invocation.
2218
+ this.debouncing = false;
2219
+ if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2220
+ // immediate rehydration due to a setter driven mutation, otherwise
2221
+ // the component will get rendered on the second tick, which it is not
2222
+ // desirable.
2223
+ rerenderVM(vm);
2224
+ }
2225
+ }
2226
+ });
2227
+ }
2228
+ });
2229
+ this.debouncing = false;
2230
+ }
2231
+ reset(value) {
2232
+ super.reset();
2233
+ this.debouncing = false;
2234
+ if (arguments.length > 0) {
2235
+ this.value = value;
2236
+ }
2237
+ }
2238
+ }
2239
+ function createAccessorReactiveObserver(vm, set) {
2240
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2241
+ return new AccessorReactiveObserver(vm, set)
2242
+ ;
2243
+ }
2186
2244
 
2187
2245
  /*
2188
2246
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2231,50 +2289,6 @@ var LWC = (function (exports) {
2231
2289
  configurable: true
2232
2290
  };
2233
2291
  }
2234
- class AccessorReactiveObserver extends ReactiveObserver {
2235
- constructor(vm, set) {
2236
- super(() => {
2237
- if (isFalse(this.debouncing)) {
2238
- this.debouncing = true;
2239
- addCallbackToNextTick(() => {
2240
- if (isTrue(this.debouncing)) {
2241
- const {
2242
- value
2243
- } = this;
2244
- const {
2245
- isDirty: dirtyStateBeforeSetterCall,
2246
- component,
2247
- idx
2248
- } = vm;
2249
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2250
- // infinity loop if the setter itself is mutating things that
2251
- // were accessed during the previous invocation.
2252
-
2253
- this.debouncing = false;
2254
-
2255
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
2256
- // immediate rehydration due to a setter driven mutation, otherwise
2257
- // the component will get rendered on the second tick, which it is not
2258
- // desirable.
2259
- rerenderVM(vm);
2260
- }
2261
- }
2262
- });
2263
- }
2264
- });
2265
- this.debouncing = false;
2266
- }
2267
-
2268
- reset(value) {
2269
- super.reset();
2270
- this.debouncing = false;
2271
-
2272
- if (arguments.length > 0) {
2273
- this.value = value;
2274
- }
2275
- }
2276
-
2277
- }
2278
2292
  function createPublicAccessorDescriptor(key, descriptor) {
2279
2293
  const {
2280
2294
  get,
@@ -2315,7 +2329,7 @@ var LWC = (function (exports) {
2315
2329
  let ro = vm.oar[key];
2316
2330
 
2317
2331
  if (isUndefined$1(ro)) {
2318
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2332
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
2319
2333
  } // every time we invoke this setter from outside (through this wrapper setter)
2320
2334
  // we should reset the value and then debounce just in case there is a pending
2321
2335
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2347,7 +2361,7 @@ var LWC = (function (exports) {
2347
2361
  */
2348
2362
  function track(target) {
2349
2363
  if (arguments.length === 1) {
2350
- return reactiveMembrane.getProxy(target);
2364
+ return getReactiveProxy(target);
2351
2365
  }
2352
2366
  if (process.env.NODE_ENV !== 'production') {
2353
2367
  assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
@@ -2368,7 +2382,7 @@ var LWC = (function (exports) {
2368
2382
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2369
2383
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2370
2384
  }
2371
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2385
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2372
2386
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2373
2387
  vm.cmpFields[key] = reactiveOrAnyValue;
2374
2388
  componentValueMutated(vm, key);
@@ -2760,7 +2774,7 @@ var LWC = (function (exports) {
2760
2774
  fn = cachedSetterByKey[key] = function (newValue) {
2761
2775
  const vm = getAssociatedVM(this);
2762
2776
  const { setHook } = vm;
2763
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2777
+ newValue = getReadOnlyProxy(newValue);
2764
2778
  setHook(vm.component, key, newValue);
2765
2779
  };
2766
2780
  }
@@ -5196,7 +5210,7 @@ var LWC = (function (exports) {
5196
5210
  return signedTemplateMap.get(Ctor);
5197
5211
  }
5198
5212
  function getTemplateReactiveObserver(vm) {
5199
- return new ReactiveObserver(() => {
5213
+ return createReactiveObserver(() => {
5200
5214
  const { isDirty } = vm;
5201
5215
  if (isFalse(isDirty)) {
5202
5216
  markComponentAsDirty(vm);
@@ -6011,7 +6025,7 @@ var LWC = (function (exports) {
6011
6025
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
6012
6026
  let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
6013
6027
 
6014
- const ro = new ReactiveObserver(() => {
6028
+ const ro = createReactiveObserver(() => {
6015
6029
  if (hasPendingConfig === false) {
6016
6030
  hasPendingConfig = true; // collect new config in the micro-task
6017
6031
 
@@ -6307,7 +6321,7 @@ var LWC = (function (exports) {
6307
6321
  assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
6308
6322
  }
6309
6323
  }
6310
- return reactiveMembrane.getReadOnlyProxy(obj);
6324
+ return getReadOnlyProxy(obj);
6311
6325
  }
6312
6326
 
6313
6327
  /*
@@ -6818,7 +6832,7 @@ var LWC = (function (exports) {
6818
6832
  }
6819
6833
  return ctor;
6820
6834
  }
6821
- /* version: 2.21.1 */
6835
+ /* version: 2.22.0 */
6822
6836
 
6823
6837
  /*
6824
6838
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6962,6 +6976,69 @@ var LWC = (function (exports) {
6962
6976
  }
6963
6977
  }
6964
6978
 
6979
+ /*
6980
+ * Copyright (c) 2018, salesforce.com, inc.
6981
+ * All rights reserved.
6982
+ * SPDX-License-Identifier: MIT
6983
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6984
+ */
6985
+ const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6986
+ let createFragment;
6987
+ if (SUPPORTS_TEMPLATE) {
6988
+ // Parse the fragment HTML string into DOM
6989
+ createFragment = function (html) {
6990
+ const template = document.createElement('template');
6991
+ template.innerHTML = html;
6992
+ return template.content.firstChild;
6993
+ };
6994
+ }
6995
+ else {
6996
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6997
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6998
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6999
+ // With other elements added from:
7000
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
7001
+ // Using the test:
7002
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
7003
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
7004
+ const topLevelWrappingMap = {
7005
+ caption: ['table'],
7006
+ col: ['colgroup', 'table'],
7007
+ colgroup: ['table'],
7008
+ option: ['select'],
7009
+ tbody: ['table'],
7010
+ td: ['tr', 'tbody', 'table'],
7011
+ th: ['tr', 'tbody', 'table'],
7012
+ thead: ['table'],
7013
+ tfoot: ['table'],
7014
+ tr: ['tbody', 'table'],
7015
+ };
7016
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
7017
+ const getTagName = function (text) {
7018
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
7019
+ };
7020
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
7021
+ createFragment = function (html) {
7022
+ const wrapperTags = topLevelWrappingMap[getTagName(html)];
7023
+ if (!isUndefined$1(wrapperTags)) {
7024
+ for (const wrapperTag of wrapperTags) {
7025
+ html = `<${wrapperTag}>${html}</${wrapperTag}>`;
7026
+ }
7027
+ }
7028
+ // For IE11, the document title must not be undefined, but it can be an empty string
7029
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
7030
+ const doc = document.implementation.createHTMLDocument('');
7031
+ doc.body.innerHTML = html;
7032
+ let content = doc.body;
7033
+ if (!isUndefined$1(wrapperTags)) {
7034
+ for (let i = 0; i < wrapperTags.length; i++) {
7035
+ content = content.firstChild;
7036
+ }
7037
+ }
7038
+ return content.firstChild;
7039
+ };
7040
+ }
7041
+
6965
7042
  /*
6966
7043
  * Copyright (c) 2018, salesforce.com, inc.
6967
7044
  * All rights reserved.
@@ -7040,9 +7117,6 @@ var LWC = (function (exports) {
7040
7117
  function cloneNode(node, deep) {
7041
7118
  return node.cloneNode(deep);
7042
7119
  }
7043
- function createFragment(html) {
7044
- return document.createRange().createContextualFragment(html).firstChild;
7045
- }
7046
7120
  function createElement$1(tagName, namespace) {
7047
7121
  return isUndefined$1(namespace)
7048
7122
  ? document.createElement(tagName)
@@ -7506,7 +7580,7 @@ var LWC = (function (exports) {
7506
7580
  });
7507
7581
  freeze(LightningElement);
7508
7582
  seal(LightningElement.prototype);
7509
- /* version: 2.21.1 */
7583
+ /* version: 2.22.0 */
7510
7584
 
7511
7585
  exports.LightningElement = LightningElement;
7512
7586
  exports.__unstable__ProfilerControl = profilerControl;