lwc 2.35.0 → 2.35.1

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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +48 -121
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +48 -121
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +87 -61
  5. package/dist/engine-dom/iife/es5/engine-dom.js +48 -119
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +89 -60
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +48 -121
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +87 -61
  11. package/dist/engine-dom/umd/es5/engine-dom.js +48 -119
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +89 -60
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +45 -134
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +45 -134
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +9 -40
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +9 -40
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +8 -38
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +9 -38
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +8 -36
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +9 -40
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +8 -38
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +9 -38
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +8 -36
  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_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -215,39 +215,11 @@
215
215
  * SPDX-License-Identifier: MIT
216
216
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
217
217
  */
218
- // Inspired from: https://mathiasbynens.be/notes/globalthis
219
- var _globalThis = /*@__PURE__*/function () {
220
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
221
- if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object') {
222
- return globalThis;
223
- }
224
- var _globalThis;
225
- try {
226
- // eslint-disable-next-line no-extend-native
227
- Object.defineProperty(Object.prototype, '__magic__', {
228
- get: function get() {
229
- return this;
230
- },
231
- configurable: true
232
- });
233
- // __magic__ is undefined in Safari 10 and IE10 and older.
234
- // @ts-ignore
235
- // eslint-disable-next-line no-undef
236
- _globalThis = __magic__;
237
- // @ts-ignore
238
- delete Object.prototype.__magic__;
239
- } catch (ex) {
240
- // In IE8, Object.defineProperty only works on DOM objects.
241
- } finally {
242
- // If the magic above fails for some reason we assume that we are in a legacy browser.
243
- // Assume `window` exists in this case.
244
- if (typeof _globalThis === 'undefined') {
245
- // @ts-ignore
246
- _globalThis = window;
247
- }
248
- }
249
- return _globalThis;
250
- }();
218
+ // See browser support for globalThis:
219
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
220
+ /* istanbul ignore next */
221
+ // @ts-ignore
222
+ var _globalThis = (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object' ? globalThis : window;
251
223
 
252
224
  /*
253
225
  * Copyright (c) 2018, salesforce.com, inc.
@@ -358,9 +330,9 @@
358
330
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
359
331
  */
360
332
  // Increment whenever the LWC template compiler changes
361
- var LWC_VERSION = "2.35.0";
333
+ var LWC_VERSION = "2.35.1";
362
334
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
363
- /** version: 2.35.0 */
335
+ /** version: 2.35.1 */
364
336
 
365
337
  /**
366
338
  * Copyright (C) 2018 salesforce.com, inc.
@@ -414,7 +386,8 @@
414
386
  console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
415
387
  return;
416
388
  }
417
- if (process.env.NODE_ENV !== 'production') {
389
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
390
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
418
391
  // Allow the same flag to be set more than once outside of production to enable testing
419
392
  lwcRuntimeFlags[name] = value;
420
393
  } else {
@@ -435,11 +408,12 @@
435
408
  * purposes. It is a no-op when invoked in production mode.
436
409
  */
437
410
  function setFeatureFlagForTest(name, value) {
438
- if (process.env.NODE_ENV !== 'production') {
411
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
412
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
439
413
  setFeatureFlag(name, value);
440
414
  }
441
415
  }
442
- /** version: 2.35.0 */
416
+ /** version: 2.35.1 */
443
417
 
444
418
  /**
445
419
  * Copyright (C) 2018 salesforce.com, inc.
@@ -503,7 +477,7 @@
503
477
  }
504
478
  }
505
479
  }
506
- /** version: 2.35.0 */
480
+ /** version: 2.35.1 */
507
481
 
508
482
  /*
509
483
  * Copyright (c) 2018, salesforce.com, inc.
@@ -524,8 +498,7 @@
524
498
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
525
499
  */
526
500
  // Only used in LWC's Karma tests
527
- // @ts-ignore
528
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
501
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
529
502
  window.addEventListener('test-dummy-flag', function () {
530
503
  var hasFlag = false;
531
504
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -549,8 +522,7 @@
549
522
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
550
523
  */
551
524
  // Only used in LWC's Karma tests
552
- // @ts-ignore
553
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
525
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
554
526
  window.addEventListener('test-dummy-flag', function () {
555
527
  var hasFlag = false;
556
528
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -698,8 +670,8 @@
698
670
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
699
671
  */
700
672
  var alreadyLoggedMessages = new Set();
701
- // @ts-ignore
702
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
673
+ // Only used in LWC's Karma tests
674
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
703
675
  // @ts-ignore
704
676
  window.__lwcResetAlreadyLoggedMessages = function () {
705
677
  alreadyLoggedMessages.clear();
@@ -975,6 +947,14 @@
975
947
  refVNodes[ref] = vnode;
976
948
  }
977
949
  }
950
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
951
+ function assertNotProd() {
952
+ /* istanbul ignore if */
953
+ if (process.env.NODE_ENV === 'production') {
954
+ // this method should never leak to prod
955
+ throw new ReferenceError();
956
+ }
957
+ }
978
958
 
979
959
  /*
980
960
  * Copyright (c) 2020, salesforce.com, inc.
@@ -1170,27 +1150,18 @@
1170
1150
  }
1171
1151
  var isDomMutationAllowed = false;
1172
1152
  function unlockDomMutation() {
1173
- if (process.env.NODE_ENV === 'production') {
1174
- // this method should never leak to prod
1175
- throw new ReferenceError();
1176
- }
1153
+ assertNotProd(); // this method should never leak to prod
1177
1154
  isDomMutationAllowed = true;
1178
1155
  }
1179
1156
  function lockDomMutation() {
1180
- if (process.env.NODE_ENV === 'production') {
1181
- // this method should never leak to prod
1182
- throw new ReferenceError();
1183
- }
1157
+ assertNotProd(); // this method should never leak to prod
1184
1158
  isDomMutationAllowed = false;
1185
1159
  }
1186
1160
  function logMissingPortalError(name, type) {
1187
1161
  return logError("The `".concat(name, "` ").concat(type, " is available only on elements that use the `lwc:dom=\"manual\"` directive."));
1188
1162
  }
1189
1163
  function patchElementWithRestrictions(elm, options) {
1190
- if (process.env.NODE_ENV === 'production') {
1191
- // this method should never leak to prod
1192
- throw new ReferenceError();
1193
- }
1164
+ assertNotProd(); // this method should never leak to prod
1194
1165
  var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
1195
1166
  var descriptors = {
1196
1167
  outerHTML: generateAccessorDescriptor({
@@ -1274,10 +1245,7 @@
1274
1245
  defineProperties(elm, descriptors);
1275
1246
  }
1276
1247
  function getShadowRootRestrictionsDescriptors(sr) {
1277
- if (process.env.NODE_ENV === 'production') {
1278
- // this method should never leak to prod
1279
- throw new ReferenceError();
1280
- }
1248
+ assertNotProd(); // this method should never leak to prod
1281
1249
  // Disallowing properties in dev mode only to avoid people doing the wrong
1282
1250
  // thing when using the real shadow root, because if that's the case,
1283
1251
  // the component will not work when running with synthetic shadow.
@@ -1318,10 +1286,7 @@
1318
1286
  // Custom Elements Restrictions:
1319
1287
  // -----------------------------
1320
1288
  function getCustomElementRestrictionsDescriptors(elm) {
1321
- if (process.env.NODE_ENV === 'production') {
1322
- // this method should never leak to prod
1323
- throw new ReferenceError();
1324
- }
1289
+ assertNotProd(); // this method should never leak to prod
1325
1290
  var originalAddEventListener = elm.addEventListener;
1326
1291
  var originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
1327
1292
  var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
@@ -1366,10 +1331,7 @@
1366
1331
  };
1367
1332
  }
1368
1333
  function getComponentRestrictionsDescriptors() {
1369
- if (process.env.NODE_ENV === 'production') {
1370
- // this method should never leak to prod
1371
- throw new ReferenceError();
1372
- }
1334
+ assertNotProd(); // this method should never leak to prod
1373
1335
  return {
1374
1336
  tagName: generateAccessorDescriptor({
1375
1337
  get: function get() {
@@ -1382,10 +1344,7 @@
1382
1344
  }
1383
1345
 
1384
1346
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1385
- if (process.env.NODE_ENV === 'production') {
1386
- // this method should never leak to prod
1387
- throw new ReferenceError();
1388
- }
1347
+ assertNotProd(); // this method should never leak to prod
1389
1348
  var originalDispatchEvent = proto.dispatchEvent;
1390
1349
  var descriptors = {
1391
1350
  dispatchEvent: generateDataDescriptor({
@@ -2212,7 +2171,6 @@
2212
2171
  }
2213
2172
  };
2214
2173
  }
2215
- var EMPTY_REFS = freeze(create(null));
2216
2174
  var refsCache = new WeakMap();
2217
2175
  /**
2218
2176
  * This class is the base class for any LWC element.
@@ -2428,7 +2386,6 @@
2428
2386
  warnIfInvokedDuringConstruction(vm, 'refs');
2429
2387
  }
2430
2388
  var refVNodes = vm.refVNodes,
2431
- hasRefVNodes = vm.hasRefVNodes,
2432
2389
  cmpTemplate = vm.cmpTemplate;
2433
2390
  // If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
2434
2391
  // if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
@@ -2441,15 +2398,9 @@
2441
2398
  // were introduced, we return undefined if the template has no refs defined
2442
2399
  // anywhere. This fixes components that may want to add an expando called `refs`
2443
2400
  // and are checking if it exists with `if (this.refs)` before adding it.
2444
- // Note it is not sufficient to just check if `refVNodes` is null or empty,
2445
- // because a template may have `lwc:ref` defined within a falsy `if:true` block.
2446
- if (!hasRefVNodes) {
2447
- return;
2448
- }
2449
- // For templates that are using `lwc:ref`, if there are no refs currently available
2450
- // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
2401
+ // Note we use a null refVNodes to indicate that the template has no refs defined.
2451
2402
  if (isNull(refVNodes)) {
2452
- return EMPTY_REFS;
2403
+ return;
2453
2404
  }
2454
2405
  // The refNodes can be cached based on the refVNodes, since the refVNodes
2455
2406
  // are recreated from scratch every time the template is rendered.
@@ -3269,8 +3220,8 @@
3269
3220
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3270
3221
  */
3271
3222
  var warned = false;
3272
- // @ts-ignore
3273
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
3223
+ // Only used in LWC's Karma tests
3224
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
3274
3225
  // @ts-ignore
3275
3226
  window.__lwcResetWarnedOnVersionMismatch = function () {
3276
3227
  warned = false;
@@ -3569,10 +3520,7 @@
3569
3520
  return canRefreshAllInstances;
3570
3521
  }
3571
3522
  function getTemplateOrSwappedTemplate(tpl) {
3572
- if (process.env.NODE_ENV === 'production') {
3573
- // this method should never leak to prod
3574
- throw new ReferenceError();
3575
- }
3523
+ assertNotProd(); // this method should never leak to prod
3576
3524
  var visited = new Set();
3577
3525
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
3578
3526
  visited.add(tpl);
@@ -3581,10 +3529,7 @@
3581
3529
  return tpl;
3582
3530
  }
3583
3531
  function getComponentOrSwappedComponent(Ctor) {
3584
- if (process.env.NODE_ENV === 'production') {
3585
- // this method should never leak to prod
3586
- throw new ReferenceError();
3587
- }
3532
+ assertNotProd(); // this method should never leak to prod
3588
3533
  var visited = new Set();
3589
3534
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
3590
3535
  visited.add(Ctor);
@@ -3593,10 +3538,7 @@
3593
3538
  return Ctor;
3594
3539
  }
3595
3540
  function getStyleOrSwappedStyle(style) {
3596
- if (process.env.NODE_ENV === 'production') {
3597
- // this method should never leak to prod
3598
- throw new ReferenceError();
3599
- }
3541
+ assertNotProd(); // this method should never leak to prod
3600
3542
  var visited = new Set();
3601
3543
  while (swappedStyleMap.has(style) && !visited.has(style)) {
3602
3544
  visited.add(style);
@@ -3605,10 +3547,7 @@
3605
3547
  return style;
3606
3548
  }
3607
3549
  function setActiveVM(vm) {
3608
- if (process.env.NODE_ENV === 'production') {
3609
- // this method should never leak to prod
3610
- throw new ReferenceError();
3611
- }
3550
+ assertNotProd(); // this method should never leak to prod
3612
3551
  // tracking active component
3613
3552
  var Ctor = vm.def.ctor;
3614
3553
  var componentVMs = activeComponents.get(Ctor);
@@ -3651,10 +3590,7 @@
3651
3590
  }
3652
3591
  }
3653
3592
  function removeActiveVM(vm) {
3654
- if (process.env.NODE_ENV === 'production') {
3655
- // this method should never leak to prod
3656
- throw new ReferenceError();
3657
- }
3593
+ assertNotProd(); // this method should never leak to prod
3658
3594
  // tracking inactive component
3659
3595
  var Ctor = vm.def.ctor;
3660
3596
  var list = activeComponents.get(Ctor);
@@ -5749,10 +5685,7 @@
5749
5685
  vmBeingRendered = vm;
5750
5686
  }
5751
5687
  function validateSlots(vm, html) {
5752
- if (process.env.NODE_ENV === 'production') {
5753
- // this method should never leak to prod
5754
- throw new ReferenceError();
5755
- }
5688
+ assertNotProd(); // this method should never leak to prod
5756
5689
  var cmpSlots = vm.cmpSlots;
5757
5690
  var _html$slots = html.slots,
5758
5691
  slots = _html$slots === void 0 ? EmptyArray : _html$slots;
@@ -5901,9 +5834,7 @@
5901
5834
  setActiveVM(vm);
5902
5835
  }
5903
5836
  // reset the refs; they will be set during the tmpl() instantiation
5904
- var hasRefVNodes = Boolean(html.hasRefs);
5905
- vm.hasRefVNodes = hasRefVNodes;
5906
- vm.refVNodes = hasRefVNodes ? create(null) : null;
5837
+ vm.refVNodes = html.hasRefs ? create(null) : null;
5907
5838
  // right before producing the vnodes, we clear up all internal references
5908
5839
  // to custom elements from the template.
5909
5840
  vm.velements = [];
@@ -6095,7 +6026,7 @@
6095
6026
  var cmpEventListenerMap = new WeakMap();
6096
6027
  function getWrappedComponentsListener(vm, listener) {
6097
6028
  if (!isFunction$1(listener)) {
6098
- throw new TypeError(); // avoiding problems with non-valid listeners
6029
+ throw new TypeError('Expected an EventListener but received ' + _typeof(listener)); // avoiding problems with non-valid listeners
6099
6030
  }
6100
6031
 
6101
6032
  var wrappedListener = cmpEventListenerMap.get(listener);
@@ -6238,7 +6169,6 @@
6238
6169
  mode: mode,
6239
6170
  owner: owner,
6240
6171
  refVNodes: null,
6241
- hasRefVNodes: false,
6242
6172
  children: EmptyArray,
6243
6173
  aChildren: EmptyArray,
6244
6174
  velements: EmptyArray,
@@ -7541,7 +7471,7 @@
7541
7471
  }
7542
7472
  return ctor;
7543
7473
  }
7544
- /* version: 2.35.0 */
7474
+ /* version: 2.35.1 */
7545
7475
 
7546
7476
  /*
7547
7477
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7645,8 +7575,7 @@
7645
7575
  // Test utilities
7646
7576
  //
7647
7577
  // Only used in LWC's Karma tests
7648
- // @ts-ignore
7649
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7578
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
7650
7579
  // @ts-ignore
7651
7580
  window.__lwcResetGlobalStylesheets = function () {
7652
7581
  stylesheetCache.clear();
@@ -8580,7 +8509,7 @@
8580
8509
  function isNull(obj) {
8581
8510
  return obj === null;
8582
8511
  }
8583
- /** version: 2.35.0 */
8512
+ /** version: 2.35.1 */
8584
8513
 
8585
8514
  /*
8586
8515
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9146,7 +9075,7 @@
9146
9075
  });
9147
9076
  freeze(LightningElement);
9148
9077
  seal(LightningElement.prototype);
9149
- /* version: 2.35.0 */
9078
+ /* version: 2.35.1 */
9150
9079
 
9151
9080
  exports.LightningElement = LightningElement;
9152
9081
  exports.__unstable__ProfilerControl = profilerControl;