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