lwc 2.13.0 → 2.13.3

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 (43) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +155 -145
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +155 -145
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +143 -133
  5. package/dist/engine-dom/iife/es5/engine-dom.js +162 -142
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +144 -124
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +155 -145
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +143 -133
  11. package/dist/engine-dom/umd/es5/engine-dom.js +162 -142
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +144 -124
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +132 -124
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +132 -124
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +693 -693
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +693 -693
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +681 -681
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +686 -686
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +1 -1
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +697 -697
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +693 -693
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +681 -681
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +686 -686
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +1 -1
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +697 -697
  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.min.js +1 -1
  33. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service.js +5 -5
  35. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  36. package/dist/wire-service/iife/es5/wire-service_debug.js +5 -5
  37. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  39. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  40. package/dist/wire-service/umd/es5/wire-service.js +5 -5
  41. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  42. package/dist/wire-service/umd/es5/wire-service_debug.js +5 -5
  43. package/package.json +7 -7
@@ -417,9 +417,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
417
417
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
418
418
  */
419
419
  // Increment whenever the LWC template compiler changes
420
- const LWC_VERSION = "2.13.0";
420
+ const LWC_VERSION = "2.13.3";
421
421
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
422
- /** version: 2.13.0 */
422
+ /** version: 2.13.3 */
423
423
 
424
424
  /*
425
425
  * Copyright (c) 2020, salesforce.com, inc.
@@ -527,7 +527,7 @@ function setFeatureFlagForTest(name, value) {
527
527
  setFeatureFlag(name, value);
528
528
  }
529
529
  }
530
- /** version: 2.13.0 */
530
+ /** version: 2.13.3 */
531
531
 
532
532
  /* proxy-compat-disable */
533
533
 
@@ -935,6 +935,20 @@ function logError(message, vm) {
935
935
  log('error', message, vm);
936
936
  }
937
937
 
938
+ /*
939
+ * Copyright (c) 2020, salesforce.com, inc.
940
+ * All rights reserved.
941
+ * SPDX-License-Identifier: MIT
942
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
943
+ */
944
+ function resolveCircularModuleDependency(fn) {
945
+ const module = fn();
946
+ return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
947
+ }
948
+ function isCircularModuleDependency(obj) {
949
+ return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
950
+ }
951
+
938
952
  /*
939
953
  * Copyright (c) 2018, salesforce.com, inc.
940
954
  * All rights reserved.
@@ -2300,64 +2314,7 @@ if (process.env.NODE_ENV !== 'production') {
2300
2314
  patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
2301
2315
  }
2302
2316
 
2303
- /*
2304
- * Copyright (c) 2018, salesforce.com, inc.
2305
- * All rights reserved.
2306
- * SPDX-License-Identifier: MIT
2307
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2308
- */
2309
- /**
2310
- * @wire decorator to wire fields and methods to a wire adapter in
2311
- * LWC Components. This function implements the internals of this
2312
- * decorator.
2313
- */
2314
- function wire(_adapter, _config) {
2315
- if (process.env.NODE_ENV !== 'production') {
2316
- assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2317
- }
2318
- throw new Error();
2319
- }
2320
- function internalWireFieldDecorator(key) {
2321
- return {
2322
- get() {
2323
- const vm = getAssociatedVM(this);
2324
- componentValueObserved(vm, key);
2325
- return vm.cmpFields[key];
2326
- },
2327
- set(value) {
2328
- const vm = getAssociatedVM(this);
2329
- /**
2330
- * Reactivity for wired fields is provided in wiring.
2331
- * We intentionally add reactivity here since this is just
2332
- * letting the author to do the wrong thing, but it will keep our
2333
- * system to be backward compatible.
2334
- */
2335
- if (value !== vm.cmpFields[key]) {
2336
- vm.cmpFields[key] = value;
2337
- componentValueMutated(vm, key);
2338
- }
2339
- },
2340
- enumerable: true,
2341
- configurable: true,
2342
- };
2343
- }
2344
-
2345
- /*
2346
- * Copyright (c) 2018, salesforce.com, inc.
2347
- * All rights reserved.
2348
- * SPDX-License-Identifier: MIT
2349
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2350
- */
2351
- function track(target) {
2352
- if (arguments.length === 1) {
2353
- return reactiveMembrane.getProxy(target);
2354
- }
2355
- if (process.env.NODE_ENV !== 'production') {
2356
- assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2357
- }
2358
- throw new Error();
2359
- }
2360
- function internalTrackDecorator(key) {
2317
+ function createObservedFieldPropertyDescriptor(key) {
2361
2318
  return {
2362
2319
  get() {
2363
2320
  const vm = getAssociatedVM(this);
@@ -2366,14 +2323,8 @@ function internalTrackDecorator(key) {
2366
2323
  },
2367
2324
  set(newValue) {
2368
2325
  const vm = getAssociatedVM(this);
2369
- if (process.env.NODE_ENV !== 'production') {
2370
- const vmBeingRendered = getVMBeingRendered();
2371
- assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2372
- assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2373
- }
2374
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2375
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2376
- vm.cmpFields[key] = reactiveOrAnyValue;
2326
+ if (newValue !== vm.cmpFields[key]) {
2327
+ vm.cmpFields[key] = newValue;
2377
2328
  componentValueMutated(vm, key);
2378
2329
  }
2379
2330
  },
@@ -2537,7 +2488,22 @@ function createPublicAccessorDescriptor(key, descriptor) {
2537
2488
  };
2538
2489
  }
2539
2490
 
2540
- function createObservedFieldPropertyDescriptor(key) {
2491
+ /*
2492
+ * Copyright (c) 2018, salesforce.com, inc.
2493
+ * All rights reserved.
2494
+ * SPDX-License-Identifier: MIT
2495
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2496
+ */
2497
+ function track(target) {
2498
+ if (arguments.length === 1) {
2499
+ return reactiveMembrane.getProxy(target);
2500
+ }
2501
+ if (process.env.NODE_ENV !== 'production') {
2502
+ assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2503
+ }
2504
+ throw new Error();
2505
+ }
2506
+ function internalTrackDecorator(key) {
2541
2507
  return {
2542
2508
  get() {
2543
2509
  const vm = getAssociatedVM(this);
@@ -2546,8 +2512,56 @@ function createObservedFieldPropertyDescriptor(key) {
2546
2512
  },
2547
2513
  set(newValue) {
2548
2514
  const vm = getAssociatedVM(this);
2549
- if (newValue !== vm.cmpFields[key]) {
2550
- vm.cmpFields[key] = newValue;
2515
+ if (process.env.NODE_ENV !== 'production') {
2516
+ const vmBeingRendered = getVMBeingRendered();
2517
+ assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2518
+ assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2519
+ }
2520
+ const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2521
+ if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2522
+ vm.cmpFields[key] = reactiveOrAnyValue;
2523
+ componentValueMutated(vm, key);
2524
+ }
2525
+ },
2526
+ enumerable: true,
2527
+ configurable: true,
2528
+ };
2529
+ }
2530
+
2531
+ /*
2532
+ * Copyright (c) 2018, salesforce.com, inc.
2533
+ * All rights reserved.
2534
+ * SPDX-License-Identifier: MIT
2535
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2536
+ */
2537
+ /**
2538
+ * @wire decorator to wire fields and methods to a wire adapter in
2539
+ * LWC Components. This function implements the internals of this
2540
+ * decorator.
2541
+ */
2542
+ function wire(_adapter, _config) {
2543
+ if (process.env.NODE_ENV !== 'production') {
2544
+ assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2545
+ }
2546
+ throw new Error();
2547
+ }
2548
+ function internalWireFieldDecorator(key) {
2549
+ return {
2550
+ get() {
2551
+ const vm = getAssociatedVM(this);
2552
+ componentValueObserved(vm, key);
2553
+ return vm.cmpFields[key];
2554
+ },
2555
+ set(value) {
2556
+ const vm = getAssociatedVM(this);
2557
+ /**
2558
+ * Reactivity for wired fields is provided in wiring.
2559
+ * We intentionally add reactivity here since this is just
2560
+ * letting the author to do the wrong thing, but it will keep our
2561
+ * system to be backward compatible.
2562
+ */
2563
+ if (value !== vm.cmpFields[key]) {
2564
+ vm.cmpFields[key] = value;
2551
2565
  componentValueMutated(vm, key);
2552
2566
  }
2553
2567
  },
@@ -2802,6 +2816,12 @@ function checkVersionMismatch(func, type) {
2802
2816
  }
2803
2817
  }
2804
2818
 
2819
+ /*
2820
+ * Copyright (c) 2018, salesforce.com, inc.
2821
+ * All rights reserved.
2822
+ * SPDX-License-Identifier: MIT
2823
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2824
+ */
2805
2825
  const signedTemplateSet = new Set();
2806
2826
  function defaultEmptyTemplate() {
2807
2827
  return [];
@@ -2819,6 +2839,30 @@ function registerTemplate(tpl) {
2819
2839
  checkVersionMismatch(tpl, 'template');
2820
2840
  }
2821
2841
  signedTemplateSet.add(tpl);
2842
+ // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2843
+ // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2844
+ // on top of stylesheetToken for anyone who is accessing the old internal API.
2845
+ // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2846
+ defineProperty(tpl, 'stylesheetTokens', {
2847
+ get() {
2848
+ const { stylesheetToken } = this;
2849
+ if (isUndefined$1(stylesheetToken)) {
2850
+ return stylesheetToken;
2851
+ }
2852
+ // Shim for the old `stylesheetTokens` property
2853
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2854
+ return {
2855
+ hostAttribute: `${stylesheetToken}-host`,
2856
+ shadowAttribute: stylesheetToken,
2857
+ };
2858
+ },
2859
+ set(value) {
2860
+ // If the value is null or some other exotic object, you would be broken anyway in the past
2861
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2862
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2863
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2864
+ },
2865
+ });
2822
2866
  // chaining this method as a way to wrap existing
2823
2867
  // assignment of templates easily, without too much transformation
2824
2868
  return tpl;
@@ -2981,20 +3025,6 @@ const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOw
2981
3025
  freeze(BaseBridgeElement);
2982
3026
  seal(BaseBridgeElement.prototype);
2983
3027
 
2984
- /*
2985
- * Copyright (c) 2020, salesforce.com, inc.
2986
- * All rights reserved.
2987
- * SPDX-License-Identifier: MIT
2988
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2989
- */
2990
- function resolveCircularModuleDependency(fn) {
2991
- const module = fn();
2992
- return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
2993
- }
2994
- function isCircularModuleDependency(obj) {
2995
- return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
2996
- }
2997
-
2998
3028
  /*
2999
3029
  * Copyright (c) 2020, salesforce.com, inc.
3000
3030
  * All rights reserved.
@@ -5232,20 +5262,9 @@ function removeVM(vm) {
5232
5262
 
5233
5263
  resetComponentStateWhenRemoved(vm);
5234
5264
  }
5235
-
5236
- function getNearestShadowAncestor(vm) {
5237
- let ancestor = vm.owner;
5238
-
5239
- while (!isNull(ancestor) && ancestor.renderMode === 0
5240
- /* Light */
5241
- ) {
5242
- ancestor = ancestor.owner;
5243
- }
5244
-
5245
- return ancestor;
5246
- }
5247
-
5248
5265
  function createVM(elm, ctor, options) {
5266
+ var _a;
5267
+
5249
5268
  const {
5250
5269
  mode,
5251
5270
  owner,
@@ -5273,6 +5292,8 @@ function createVM(elm, ctor, options) {
5273
5292
  oar: create(null),
5274
5293
  cmpTemplate: null,
5275
5294
  renderMode: def.renderMode,
5295
+ shadowMode: computeShadowMode(def, owner),
5296
+ nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
5276
5297
  context: {
5277
5298
  stylesheetToken: undefined,
5278
5299
  hasTokenInClass: undefined,
@@ -5285,7 +5306,6 @@ function createVM(elm, ctor, options) {
5285
5306
  },
5286
5307
  // Properties set right after VM creation.
5287
5308
  tro: null,
5288
- shadowMode: null,
5289
5309
  // Properties set by the LightningElement constructor.
5290
5310
  component: null,
5291
5311
  shadowRoot: null,
@@ -5294,7 +5314,6 @@ function createVM(elm, ctor, options) {
5294
5314
  setHook,
5295
5315
  getHook
5296
5316
  };
5297
- vm.shadowMode = computeShadowMode(vm);
5298
5317
  vm.tro = getTemplateReactiveObserver(vm);
5299
5318
 
5300
5319
  if (process.env.NODE_ENV !== 'production') {
@@ -5319,10 +5338,9 @@ function createVM(elm, ctor, options) {
5319
5338
  return vm;
5320
5339
  }
5321
5340
 
5322
- function computeShadowMode(vm) {
5323
- const {
5324
- def
5325
- } = vm;
5341
+ function computeShadowMode(def, owner) {
5342
+ var _a;
5343
+
5326
5344
  let shadowMode;
5327
5345
 
5328
5346
  if (isSyntheticShadowDefined$1) {
@@ -5345,23 +5363,13 @@ function computeShadowMode(vm) {
5345
5363
  /* Native */
5346
5364
  ;
5347
5365
  } else {
5348
- const shadowAncestor = getNearestShadowAncestor(vm);
5349
-
5350
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
5351
- /* Native */
5352
- ) {
5353
- // Transitive support for native Shadow DOM. A component in native mode
5354
- // transitively opts all of its descendants into native.
5355
- shadowMode = 0
5356
- /* Native */
5357
- ;
5358
- } else {
5359
- // Synthetic if neither this component nor any of its ancestors are configured
5360
- // to be native.
5361
- shadowMode = 1
5362
- /* Synthetic */
5363
- ;
5364
- }
5366
+ // Transitive support for native Shadow DOM. A component in native mode
5367
+ // transitively opts all of its descendants into native.
5368
+ // Synthetic if neither this component nor any of its ancestors are configured
5369
+ // to be native.
5370
+ shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
5371
+ /* Synthetic */
5372
+ ;
5365
5373
  }
5366
5374
  } else {
5367
5375
  shadowMode = 1
@@ -6141,7 +6149,7 @@ function setHooks(hooks) {
6141
6149
  hooksAreSet = true;
6142
6150
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6143
6151
  }
6144
- /* version: 2.13.0 */
6152
+ /* version: 2.13.3 */
6145
6153
 
6146
6154
  /*
6147
6155
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6608,6 +6616,6 @@ function renderComponent(tagName, Ctor, props = {}) {
6608
6616
  */
6609
6617
  freeze(LightningElement);
6610
6618
  seal(LightningElement.prototype);
6611
- /* version: 2.13.0 */
6619
+ /* version: 2.13.3 */
6612
6620
 
6613
6621
  export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };