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