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
@@ -301,9 +301,9 @@ var LWC = (function (exports) {
301
301
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
302
302
  */
303
303
  // Increment whenever the LWC template compiler changes
304
- const LWC_VERSION = "2.13.0";
304
+ const LWC_VERSION = "2.13.3";
305
305
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
306
- /** version: 2.13.0 */
306
+ /** version: 2.13.3 */
307
307
 
308
308
  /*
309
309
  * Copyright (c) 2018, salesforce.com, inc.
@@ -456,7 +456,7 @@ var LWC = (function (exports) {
456
456
  setFeatureFlag(name, value);
457
457
  }
458
458
  }
459
- /** version: 2.13.0 */
459
+ /** version: 2.13.3 */
460
460
 
461
461
  /* proxy-compat-disable */
462
462
 
@@ -894,6 +894,20 @@ var LWC = (function (exports) {
894
894
  log('warn', message, vm);
895
895
  }
896
896
 
897
+ /*
898
+ * Copyright (c) 2020, salesforce.com, inc.
899
+ * All rights reserved.
900
+ * SPDX-License-Identifier: MIT
901
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
902
+ */
903
+ function resolveCircularModuleDependency(fn) {
904
+ const module = fn();
905
+ return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
906
+ }
907
+ function isCircularModuleDependency(obj) {
908
+ return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
909
+ }
910
+
897
911
  /*
898
912
  * Copyright (c) 2018, salesforce.com, inc.
899
913
  * All rights reserved.
@@ -2259,64 +2273,7 @@ var LWC = (function (exports) {
2259
2273
  patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
2260
2274
  }
2261
2275
 
2262
- /*
2263
- * Copyright (c) 2018, salesforce.com, inc.
2264
- * All rights reserved.
2265
- * SPDX-License-Identifier: MIT
2266
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2267
- */
2268
- /**
2269
- * @wire decorator to wire fields and methods to a wire adapter in
2270
- * LWC Components. This function implements the internals of this
2271
- * decorator.
2272
- */
2273
- function wire(_adapter, _config) {
2274
- if (process.env.NODE_ENV !== 'production') {
2275
- assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2276
- }
2277
- throw new Error();
2278
- }
2279
- function internalWireFieldDecorator(key) {
2280
- return {
2281
- get() {
2282
- const vm = getAssociatedVM(this);
2283
- componentValueObserved(vm, key);
2284
- return vm.cmpFields[key];
2285
- },
2286
- set(value) {
2287
- const vm = getAssociatedVM(this);
2288
- /**
2289
- * Reactivity for wired fields is provided in wiring.
2290
- * We intentionally add reactivity here since this is just
2291
- * letting the author to do the wrong thing, but it will keep our
2292
- * system to be backward compatible.
2293
- */
2294
- if (value !== vm.cmpFields[key]) {
2295
- vm.cmpFields[key] = value;
2296
- componentValueMutated(vm, key);
2297
- }
2298
- },
2299
- enumerable: true,
2300
- configurable: true,
2301
- };
2302
- }
2303
-
2304
- /*
2305
- * Copyright (c) 2018, salesforce.com, inc.
2306
- * All rights reserved.
2307
- * SPDX-License-Identifier: MIT
2308
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2309
- */
2310
- function track(target) {
2311
- if (arguments.length === 1) {
2312
- return reactiveMembrane.getProxy(target);
2313
- }
2314
- if (process.env.NODE_ENV !== 'production') {
2315
- assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2316
- }
2317
- throw new Error();
2318
- }
2319
- function internalTrackDecorator(key) {
2276
+ function createObservedFieldPropertyDescriptor(key) {
2320
2277
  return {
2321
2278
  get() {
2322
2279
  const vm = getAssociatedVM(this);
@@ -2325,14 +2282,8 @@ var LWC = (function (exports) {
2325
2282
  },
2326
2283
  set(newValue) {
2327
2284
  const vm = getAssociatedVM(this);
2328
- if (process.env.NODE_ENV !== 'production') {
2329
- const vmBeingRendered = getVMBeingRendered();
2330
- assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2331
- assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2332
- }
2333
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2334
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2335
- vm.cmpFields[key] = reactiveOrAnyValue;
2285
+ if (newValue !== vm.cmpFields[key]) {
2286
+ vm.cmpFields[key] = newValue;
2336
2287
  componentValueMutated(vm, key);
2337
2288
  }
2338
2289
  },
@@ -2496,7 +2447,22 @@ var LWC = (function (exports) {
2496
2447
  };
2497
2448
  }
2498
2449
 
2499
- function createObservedFieldPropertyDescriptor(key) {
2450
+ /*
2451
+ * Copyright (c) 2018, salesforce.com, inc.
2452
+ * All rights reserved.
2453
+ * SPDX-License-Identifier: MIT
2454
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2455
+ */
2456
+ function track(target) {
2457
+ if (arguments.length === 1) {
2458
+ return reactiveMembrane.getProxy(target);
2459
+ }
2460
+ if (process.env.NODE_ENV !== 'production') {
2461
+ assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2462
+ }
2463
+ throw new Error();
2464
+ }
2465
+ function internalTrackDecorator(key) {
2500
2466
  return {
2501
2467
  get() {
2502
2468
  const vm = getAssociatedVM(this);
@@ -2505,8 +2471,56 @@ var LWC = (function (exports) {
2505
2471
  },
2506
2472
  set(newValue) {
2507
2473
  const vm = getAssociatedVM(this);
2508
- if (newValue !== vm.cmpFields[key]) {
2509
- vm.cmpFields[key] = newValue;
2474
+ if (process.env.NODE_ENV !== 'production') {
2475
+ const vmBeingRendered = getVMBeingRendered();
2476
+ assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2477
+ assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2478
+ }
2479
+ const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2480
+ if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2481
+ vm.cmpFields[key] = reactiveOrAnyValue;
2482
+ componentValueMutated(vm, key);
2483
+ }
2484
+ },
2485
+ enumerable: true,
2486
+ configurable: true,
2487
+ };
2488
+ }
2489
+
2490
+ /*
2491
+ * Copyright (c) 2018, salesforce.com, inc.
2492
+ * All rights reserved.
2493
+ * SPDX-License-Identifier: MIT
2494
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2495
+ */
2496
+ /**
2497
+ * @wire decorator to wire fields and methods to a wire adapter in
2498
+ * LWC Components. This function implements the internals of this
2499
+ * decorator.
2500
+ */
2501
+ function wire(_adapter, _config) {
2502
+ if (process.env.NODE_ENV !== 'production') {
2503
+ assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2504
+ }
2505
+ throw new Error();
2506
+ }
2507
+ function internalWireFieldDecorator(key) {
2508
+ return {
2509
+ get() {
2510
+ const vm = getAssociatedVM(this);
2511
+ componentValueObserved(vm, key);
2512
+ return vm.cmpFields[key];
2513
+ },
2514
+ set(value) {
2515
+ const vm = getAssociatedVM(this);
2516
+ /**
2517
+ * Reactivity for wired fields is provided in wiring.
2518
+ * We intentionally add reactivity here since this is just
2519
+ * letting the author to do the wrong thing, but it will keep our
2520
+ * system to be backward compatible.
2521
+ */
2522
+ if (value !== vm.cmpFields[key]) {
2523
+ vm.cmpFields[key] = value;
2510
2524
  componentValueMutated(vm, key);
2511
2525
  }
2512
2526
  },
@@ -2761,6 +2775,12 @@ var LWC = (function (exports) {
2761
2775
  }
2762
2776
  }
2763
2777
 
2778
+ /*
2779
+ * Copyright (c) 2018, salesforce.com, inc.
2780
+ * All rights reserved.
2781
+ * SPDX-License-Identifier: MIT
2782
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2783
+ */
2764
2784
  const signedTemplateSet = new Set();
2765
2785
  function defaultEmptyTemplate() {
2766
2786
  return [];
@@ -2778,6 +2798,30 @@ var LWC = (function (exports) {
2778
2798
  checkVersionMismatch(tpl, 'template');
2779
2799
  }
2780
2800
  signedTemplateSet.add(tpl);
2801
+ // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2802
+ // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2803
+ // on top of stylesheetToken for anyone who is accessing the old internal API.
2804
+ // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2805
+ defineProperty(tpl, 'stylesheetTokens', {
2806
+ get() {
2807
+ const { stylesheetToken } = this;
2808
+ if (isUndefined$1(stylesheetToken)) {
2809
+ return stylesheetToken;
2810
+ }
2811
+ // Shim for the old `stylesheetTokens` property
2812
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2813
+ return {
2814
+ hostAttribute: `${stylesheetToken}-host`,
2815
+ shadowAttribute: stylesheetToken,
2816
+ };
2817
+ },
2818
+ set(value) {
2819
+ // If the value is null or some other exotic object, you would be broken anyway in the past
2820
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2821
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2822
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2823
+ },
2824
+ });
2781
2825
  // chaining this method as a way to wrap existing
2782
2826
  // assignment of templates easily, without too much transformation
2783
2827
  return tpl;
@@ -2940,20 +2984,6 @@ var LWC = (function (exports) {
2940
2984
  freeze(BaseBridgeElement);
2941
2985
  seal(BaseBridgeElement.prototype);
2942
2986
 
2943
- /*
2944
- * Copyright (c) 2020, salesforce.com, inc.
2945
- * All rights reserved.
2946
- * SPDX-License-Identifier: MIT
2947
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2948
- */
2949
- function resolveCircularModuleDependency(fn) {
2950
- const module = fn();
2951
- return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
2952
- }
2953
- function isCircularModuleDependency(obj) {
2954
- return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
2955
- }
2956
-
2957
2987
  /*
2958
2988
  * Copyright (c) 2020, salesforce.com, inc.
2959
2989
  * All rights reserved.
@@ -5346,20 +5376,9 @@ var LWC = (function (exports) {
5346
5376
 
5347
5377
  resetComponentStateWhenRemoved(vm);
5348
5378
  }
5349
-
5350
- function getNearestShadowAncestor(vm) {
5351
- let ancestor = vm.owner;
5352
-
5353
- while (!isNull(ancestor) && ancestor.renderMode === 0
5354
- /* Light */
5355
- ) {
5356
- ancestor = ancestor.owner;
5357
- }
5358
-
5359
- return ancestor;
5360
- }
5361
-
5362
5379
  function createVM(elm, ctor, options) {
5380
+ var _a;
5381
+
5363
5382
  const {
5364
5383
  mode,
5365
5384
  owner,
@@ -5387,6 +5406,8 @@ var LWC = (function (exports) {
5387
5406
  oar: create(null),
5388
5407
  cmpTemplate: null,
5389
5408
  renderMode: def.renderMode,
5409
+ shadowMode: computeShadowMode(def, owner),
5410
+ 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,
5390
5411
  context: {
5391
5412
  stylesheetToken: undefined,
5392
5413
  hasTokenInClass: undefined,
@@ -5399,7 +5420,6 @@ var LWC = (function (exports) {
5399
5420
  },
5400
5421
  // Properties set right after VM creation.
5401
5422
  tro: null,
5402
- shadowMode: null,
5403
5423
  // Properties set by the LightningElement constructor.
5404
5424
  component: null,
5405
5425
  shadowRoot: null,
@@ -5408,7 +5428,6 @@ var LWC = (function (exports) {
5408
5428
  setHook,
5409
5429
  getHook
5410
5430
  };
5411
- vm.shadowMode = computeShadowMode(vm);
5412
5431
  vm.tro = getTemplateReactiveObserver(vm);
5413
5432
 
5414
5433
  if (process.env.NODE_ENV !== 'production') {
@@ -5433,10 +5452,9 @@ var LWC = (function (exports) {
5433
5452
  return vm;
5434
5453
  }
5435
5454
 
5436
- function computeShadowMode(vm) {
5437
- const {
5438
- def
5439
- } = vm;
5455
+ function computeShadowMode(def, owner) {
5456
+ var _a;
5457
+
5440
5458
  let shadowMode;
5441
5459
 
5442
5460
  if (isSyntheticShadowDefined$1) {
@@ -5459,23 +5477,13 @@ var LWC = (function (exports) {
5459
5477
  /* Native */
5460
5478
  ;
5461
5479
  } else {
5462
- const shadowAncestor = getNearestShadowAncestor(vm);
5463
-
5464
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
5465
- /* Native */
5466
- ) {
5467
- // Transitive support for native Shadow DOM. A component in native mode
5468
- // transitively opts all of its descendants into native.
5469
- shadowMode = 0
5470
- /* Native */
5471
- ;
5472
- } else {
5473
- // Synthetic if neither this component nor any of its ancestors are configured
5474
- // to be native.
5475
- shadowMode = 1
5476
- /* Synthetic */
5477
- ;
5478
- }
5480
+ // Transitive support for native Shadow DOM. A component in native mode
5481
+ // transitively opts all of its descendants into native.
5482
+ // Synthetic if neither this component nor any of its ancestors are configured
5483
+ // to be native.
5484
+ shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
5485
+ /* Synthetic */
5486
+ ;
5479
5487
  }
5480
5488
  } else {
5481
5489
  shadowMode = 1
@@ -6564,7 +6572,30 @@ var LWC = (function (exports) {
6564
6572
  hooksAreSet = true;
6565
6573
  setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
6566
6574
  }
6567
- /* version: 2.13.0 */
6575
+
6576
+ /*
6577
+ * Copyright (c) 2018, salesforce.com, inc.
6578
+ * All rights reserved.
6579
+ * SPDX-License-Identifier: MIT
6580
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6581
+ */
6582
+ /**
6583
+ * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
6584
+ * This API is subject to change or being removed.
6585
+ */
6586
+ function getComponentConstructor(elm) {
6587
+ let ctor = null;
6588
+ // intentionally checking for undefined due to some funky libraries patching weakmap.get
6589
+ // to throw when undefined.
6590
+ if (!isUndefined$1(elm)) {
6591
+ const vm = getAssociatedVMIfPresent(elm);
6592
+ if (!isUndefined$1(vm)) {
6593
+ ctor = vm.def.ctor;
6594
+ }
6595
+ }
6596
+ return ctor;
6597
+ }
6598
+ /* version: 2.13.3 */
6568
6599
 
6569
6600
  /*
6570
6601
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7115,27 +7146,6 @@ var LWC = (function (exports) {
7115
7146
  return element;
7116
7147
  }
7117
7148
 
7118
- /*
7119
- * Copyright (c) 2018, salesforce.com, inc.
7120
- * All rights reserved.
7121
- * SPDX-License-Identifier: MIT
7122
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7123
- */
7124
- /**
7125
- * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
7126
- * This API is subject to change or being removed.
7127
- */
7128
- function getComponentConstructor(elm) {
7129
- let ctor = null;
7130
- if (elm instanceof HTMLElement) {
7131
- const vm = getAssociatedVMIfPresent(elm);
7132
- if (!isUndefined$1(vm)) {
7133
- ctor = vm.def.ctor;
7134
- }
7135
- }
7136
- return ctor;
7137
- }
7138
-
7139
7149
  /*
7140
7150
  * Copyright (c) 2018, salesforce.com, inc.
7141
7151
  * All rights reserved.
@@ -7204,7 +7214,7 @@ var LWC = (function (exports) {
7204
7214
  });
7205
7215
  freeze(LightningElement);
7206
7216
  seal(LightningElement.prototype);
7207
- /* version: 2.13.0 */
7217
+ /* version: 2.13.3 */
7208
7218
 
7209
7219
  exports.LightningElement = LightningElement;
7210
7220
  exports.__unstable__ProfilerControl = profilerControl;