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
@@ -212,39 +212,11 @@ var LWC = (function (exports) {
212
212
  * SPDX-License-Identifier: MIT
213
213
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
214
214
  */
215
- // Inspired from: https://mathiasbynens.be/notes/globalthis
216
- var _globalThis = /*@__PURE__*/function () {
217
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
218
- if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object') {
219
- return globalThis;
220
- }
221
- var _globalThis;
222
- try {
223
- // eslint-disable-next-line no-extend-native
224
- Object.defineProperty(Object.prototype, '__magic__', {
225
- get: function get() {
226
- return this;
227
- },
228
- configurable: true
229
- });
230
- // __magic__ is undefined in Safari 10 and IE10 and older.
231
- // @ts-ignore
232
- // eslint-disable-next-line no-undef
233
- _globalThis = __magic__;
234
- // @ts-ignore
235
- delete Object.prototype.__magic__;
236
- } catch (ex) {
237
- // In IE8, Object.defineProperty only works on DOM objects.
238
- } finally {
239
- // If the magic above fails for some reason we assume that we are in a legacy browser.
240
- // Assume `window` exists in this case.
241
- if (typeof _globalThis === 'undefined') {
242
- // @ts-ignore
243
- _globalThis = window;
244
- }
245
- }
246
- return _globalThis;
247
- }();
215
+ // See browser support for globalThis:
216
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
217
+ /* istanbul ignore next */
218
+ // @ts-ignore
219
+ var _globalThis = (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object' ? globalThis : window;
248
220
 
249
221
  /*
250
222
  * Copyright (c) 2018, salesforce.com, inc.
@@ -355,9 +327,9 @@ var LWC = (function (exports) {
355
327
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
356
328
  */
357
329
  // Increment whenever the LWC template compiler changes
358
- var LWC_VERSION = "2.35.0";
330
+ var LWC_VERSION = "2.35.1";
359
331
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
360
- /** version: 2.35.0 */
332
+ /** version: 2.35.1 */
361
333
 
362
334
  /**
363
335
  * Copyright (C) 2018 salesforce.com, inc.
@@ -411,7 +383,8 @@ var LWC = (function (exports) {
411
383
  console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
412
384
  return;
413
385
  }
414
- if (process.env.NODE_ENV !== 'production') {
386
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
387
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
415
388
  // Allow the same flag to be set more than once outside of production to enable testing
416
389
  lwcRuntimeFlags[name] = value;
417
390
  } else {
@@ -432,11 +405,12 @@ var LWC = (function (exports) {
432
405
  * purposes. It is a no-op when invoked in production mode.
433
406
  */
434
407
  function setFeatureFlagForTest(name, value) {
435
- if (process.env.NODE_ENV !== 'production') {
408
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
409
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
436
410
  setFeatureFlag(name, value);
437
411
  }
438
412
  }
439
- /** version: 2.35.0 */
413
+ /** version: 2.35.1 */
440
414
 
441
415
  /**
442
416
  * Copyright (C) 2018 salesforce.com, inc.
@@ -500,7 +474,7 @@ var LWC = (function (exports) {
500
474
  }
501
475
  }
502
476
  }
503
- /** version: 2.35.0 */
477
+ /** version: 2.35.1 */
504
478
 
505
479
  /*
506
480
  * Copyright (c) 2018, salesforce.com, inc.
@@ -521,8 +495,7 @@ var LWC = (function (exports) {
521
495
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
522
496
  */
523
497
  // Only used in LWC's Karma tests
524
- // @ts-ignore
525
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
498
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
526
499
  window.addEventListener('test-dummy-flag', function () {
527
500
  var hasFlag = false;
528
501
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -546,8 +519,7 @@ var LWC = (function (exports) {
546
519
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
547
520
  */
548
521
  // Only used in LWC's Karma tests
549
- // @ts-ignore
550
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
522
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
551
523
  window.addEventListener('test-dummy-flag', function () {
552
524
  var hasFlag = false;
553
525
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -695,8 +667,8 @@ var LWC = (function (exports) {
695
667
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
696
668
  */
697
669
  var alreadyLoggedMessages = new Set();
698
- // @ts-ignore
699
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
670
+ // Only used in LWC's Karma tests
671
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
700
672
  // @ts-ignore
701
673
  window.__lwcResetAlreadyLoggedMessages = function () {
702
674
  alreadyLoggedMessages.clear();
@@ -972,6 +944,14 @@ var LWC = (function (exports) {
972
944
  refVNodes[ref] = vnode;
973
945
  }
974
946
  }
947
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
948
+ function assertNotProd() {
949
+ /* istanbul ignore if */
950
+ if (process.env.NODE_ENV === 'production') {
951
+ // this method should never leak to prod
952
+ throw new ReferenceError();
953
+ }
954
+ }
975
955
 
976
956
  /*
977
957
  * Copyright (c) 2020, salesforce.com, inc.
@@ -1167,27 +1147,18 @@ var LWC = (function (exports) {
1167
1147
  }
1168
1148
  var isDomMutationAllowed = false;
1169
1149
  function unlockDomMutation() {
1170
- if (process.env.NODE_ENV === 'production') {
1171
- // this method should never leak to prod
1172
- throw new ReferenceError();
1173
- }
1150
+ assertNotProd(); // this method should never leak to prod
1174
1151
  isDomMutationAllowed = true;
1175
1152
  }
1176
1153
  function lockDomMutation() {
1177
- if (process.env.NODE_ENV === 'production') {
1178
- // this method should never leak to prod
1179
- throw new ReferenceError();
1180
- }
1154
+ assertNotProd(); // this method should never leak to prod
1181
1155
  isDomMutationAllowed = false;
1182
1156
  }
1183
1157
  function logMissingPortalError(name, type) {
1184
1158
  return logError("The `".concat(name, "` ").concat(type, " is available only on elements that use the `lwc:dom=\"manual\"` directive."));
1185
1159
  }
1186
1160
  function patchElementWithRestrictions(elm, options) {
1187
- if (process.env.NODE_ENV === 'production') {
1188
- // this method should never leak to prod
1189
- throw new ReferenceError();
1190
- }
1161
+ assertNotProd(); // this method should never leak to prod
1191
1162
  var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
1192
1163
  var descriptors = {
1193
1164
  outerHTML: generateAccessorDescriptor({
@@ -1271,10 +1242,7 @@ var LWC = (function (exports) {
1271
1242
  defineProperties(elm, descriptors);
1272
1243
  }
1273
1244
  function getShadowRootRestrictionsDescriptors(sr) {
1274
- if (process.env.NODE_ENV === 'production') {
1275
- // this method should never leak to prod
1276
- throw new ReferenceError();
1277
- }
1245
+ assertNotProd(); // this method should never leak to prod
1278
1246
  // Disallowing properties in dev mode only to avoid people doing the wrong
1279
1247
  // thing when using the real shadow root, because if that's the case,
1280
1248
  // the component will not work when running with synthetic shadow.
@@ -1315,10 +1283,7 @@ var LWC = (function (exports) {
1315
1283
  // Custom Elements Restrictions:
1316
1284
  // -----------------------------
1317
1285
  function getCustomElementRestrictionsDescriptors(elm) {
1318
- if (process.env.NODE_ENV === 'production') {
1319
- // this method should never leak to prod
1320
- throw new ReferenceError();
1321
- }
1286
+ assertNotProd(); // this method should never leak to prod
1322
1287
  var originalAddEventListener = elm.addEventListener;
1323
1288
  var originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
1324
1289
  var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
@@ -1363,10 +1328,7 @@ var LWC = (function (exports) {
1363
1328
  };
1364
1329
  }
1365
1330
  function getComponentRestrictionsDescriptors() {
1366
- if (process.env.NODE_ENV === 'production') {
1367
- // this method should never leak to prod
1368
- throw new ReferenceError();
1369
- }
1331
+ assertNotProd(); // this method should never leak to prod
1370
1332
  return {
1371
1333
  tagName: generateAccessorDescriptor({
1372
1334
  get: function get() {
@@ -1379,10 +1341,7 @@ var LWC = (function (exports) {
1379
1341
  }
1380
1342
 
1381
1343
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1382
- if (process.env.NODE_ENV === 'production') {
1383
- // this method should never leak to prod
1384
- throw new ReferenceError();
1385
- }
1344
+ assertNotProd(); // this method should never leak to prod
1386
1345
  var originalDispatchEvent = proto.dispatchEvent;
1387
1346
  var descriptors = {
1388
1347
  dispatchEvent: generateDataDescriptor({
@@ -2209,7 +2168,6 @@ var LWC = (function (exports) {
2209
2168
  }
2210
2169
  };
2211
2170
  }
2212
- var EMPTY_REFS = freeze(create(null));
2213
2171
  var refsCache = new WeakMap();
2214
2172
  /**
2215
2173
  * This class is the base class for any LWC element.
@@ -2425,7 +2383,6 @@ var LWC = (function (exports) {
2425
2383
  warnIfInvokedDuringConstruction(vm, 'refs');
2426
2384
  }
2427
2385
  var refVNodes = vm.refVNodes,
2428
- hasRefVNodes = vm.hasRefVNodes,
2429
2386
  cmpTemplate = vm.cmpTemplate;
2430
2387
  // If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
2431
2388
  // if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
@@ -2438,15 +2395,9 @@ var LWC = (function (exports) {
2438
2395
  // were introduced, we return undefined if the template has no refs defined
2439
2396
  // anywhere. This fixes components that may want to add an expando called `refs`
2440
2397
  // and are checking if it exists with `if (this.refs)` before adding it.
2441
- // Note it is not sufficient to just check if `refVNodes` is null or empty,
2442
- // because a template may have `lwc:ref` defined within a falsy `if:true` block.
2443
- if (!hasRefVNodes) {
2444
- return;
2445
- }
2446
- // For templates that are using `lwc:ref`, if there are no refs currently available
2447
- // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
2398
+ // Note we use a null refVNodes to indicate that the template has no refs defined.
2448
2399
  if (isNull(refVNodes)) {
2449
- return EMPTY_REFS;
2400
+ return;
2450
2401
  }
2451
2402
  // The refNodes can be cached based on the refVNodes, since the refVNodes
2452
2403
  // are recreated from scratch every time the template is rendered.
@@ -3266,8 +3217,8 @@ var LWC = (function (exports) {
3266
3217
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3267
3218
  */
3268
3219
  var warned = false;
3269
- // @ts-ignore
3270
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
3220
+ // Only used in LWC's Karma tests
3221
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
3271
3222
  // @ts-ignore
3272
3223
  window.__lwcResetWarnedOnVersionMismatch = function () {
3273
3224
  warned = false;
@@ -3566,10 +3517,7 @@ var LWC = (function (exports) {
3566
3517
  return canRefreshAllInstances;
3567
3518
  }
3568
3519
  function getTemplateOrSwappedTemplate(tpl) {
3569
- if (process.env.NODE_ENV === 'production') {
3570
- // this method should never leak to prod
3571
- throw new ReferenceError();
3572
- }
3520
+ assertNotProd(); // this method should never leak to prod
3573
3521
  var visited = new Set();
3574
3522
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
3575
3523
  visited.add(tpl);
@@ -3578,10 +3526,7 @@ var LWC = (function (exports) {
3578
3526
  return tpl;
3579
3527
  }
3580
3528
  function getComponentOrSwappedComponent(Ctor) {
3581
- if (process.env.NODE_ENV === 'production') {
3582
- // this method should never leak to prod
3583
- throw new ReferenceError();
3584
- }
3529
+ assertNotProd(); // this method should never leak to prod
3585
3530
  var visited = new Set();
3586
3531
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
3587
3532
  visited.add(Ctor);
@@ -3590,10 +3535,7 @@ var LWC = (function (exports) {
3590
3535
  return Ctor;
3591
3536
  }
3592
3537
  function getStyleOrSwappedStyle(style) {
3593
- if (process.env.NODE_ENV === 'production') {
3594
- // this method should never leak to prod
3595
- throw new ReferenceError();
3596
- }
3538
+ assertNotProd(); // this method should never leak to prod
3597
3539
  var visited = new Set();
3598
3540
  while (swappedStyleMap.has(style) && !visited.has(style)) {
3599
3541
  visited.add(style);
@@ -3602,10 +3544,7 @@ var LWC = (function (exports) {
3602
3544
  return style;
3603
3545
  }
3604
3546
  function setActiveVM(vm) {
3605
- if (process.env.NODE_ENV === 'production') {
3606
- // this method should never leak to prod
3607
- throw new ReferenceError();
3608
- }
3547
+ assertNotProd(); // this method should never leak to prod
3609
3548
  // tracking active component
3610
3549
  var Ctor = vm.def.ctor;
3611
3550
  var componentVMs = activeComponents.get(Ctor);
@@ -3648,10 +3587,7 @@ var LWC = (function (exports) {
3648
3587
  }
3649
3588
  }
3650
3589
  function removeActiveVM(vm) {
3651
- if (process.env.NODE_ENV === 'production') {
3652
- // this method should never leak to prod
3653
- throw new ReferenceError();
3654
- }
3590
+ assertNotProd(); // this method should never leak to prod
3655
3591
  // tracking inactive component
3656
3592
  var Ctor = vm.def.ctor;
3657
3593
  var list = activeComponents.get(Ctor);
@@ -5746,10 +5682,7 @@ var LWC = (function (exports) {
5746
5682
  vmBeingRendered = vm;
5747
5683
  }
5748
5684
  function validateSlots(vm, html) {
5749
- if (process.env.NODE_ENV === 'production') {
5750
- // this method should never leak to prod
5751
- throw new ReferenceError();
5752
- }
5685
+ assertNotProd(); // this method should never leak to prod
5753
5686
  var cmpSlots = vm.cmpSlots;
5754
5687
  var _html$slots = html.slots,
5755
5688
  slots = _html$slots === void 0 ? EmptyArray : _html$slots;
@@ -5898,9 +5831,7 @@ var LWC = (function (exports) {
5898
5831
  setActiveVM(vm);
5899
5832
  }
5900
5833
  // reset the refs; they will be set during the tmpl() instantiation
5901
- var hasRefVNodes = Boolean(html.hasRefs);
5902
- vm.hasRefVNodes = hasRefVNodes;
5903
- vm.refVNodes = hasRefVNodes ? create(null) : null;
5834
+ vm.refVNodes = html.hasRefs ? create(null) : null;
5904
5835
  // right before producing the vnodes, we clear up all internal references
5905
5836
  // to custom elements from the template.
5906
5837
  vm.velements = [];
@@ -6092,7 +6023,7 @@ var LWC = (function (exports) {
6092
6023
  var cmpEventListenerMap = new WeakMap();
6093
6024
  function getWrappedComponentsListener(vm, listener) {
6094
6025
  if (!isFunction$1(listener)) {
6095
- throw new TypeError(); // avoiding problems with non-valid listeners
6026
+ throw new TypeError('Expected an EventListener but received ' + _typeof(listener)); // avoiding problems with non-valid listeners
6096
6027
  }
6097
6028
 
6098
6029
  var wrappedListener = cmpEventListenerMap.get(listener);
@@ -6235,7 +6166,6 @@ var LWC = (function (exports) {
6235
6166
  mode: mode,
6236
6167
  owner: owner,
6237
6168
  refVNodes: null,
6238
- hasRefVNodes: false,
6239
6169
  children: EmptyArray,
6240
6170
  aChildren: EmptyArray,
6241
6171
  velements: EmptyArray,
@@ -7538,7 +7468,7 @@ var LWC = (function (exports) {
7538
7468
  }
7539
7469
  return ctor;
7540
7470
  }
7541
- /* version: 2.35.0 */
7471
+ /* version: 2.35.1 */
7542
7472
 
7543
7473
  /*
7544
7474
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7642,8 +7572,7 @@ var LWC = (function (exports) {
7642
7572
  // Test utilities
7643
7573
  //
7644
7574
  // Only used in LWC's Karma tests
7645
- // @ts-ignore
7646
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
7575
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
7647
7576
  // @ts-ignore
7648
7577
  window.__lwcResetGlobalStylesheets = function () {
7649
7578
  stylesheetCache.clear();
@@ -8577,7 +8506,7 @@ var LWC = (function (exports) {
8577
8506
  function isNull(obj) {
8578
8507
  return obj === null;
8579
8508
  }
8580
- /** version: 2.35.0 */
8509
+ /** version: 2.35.1 */
8581
8510
 
8582
8511
  /*
8583
8512
  * Copyright (c) 2018, salesforce.com, inc.
@@ -9143,7 +9072,7 @@ var LWC = (function (exports) {
9143
9072
  });
9144
9073
  freeze(LightningElement);
9145
9074
  seal(LightningElement.prototype);
9146
- /* version: 2.35.0 */
9075
+ /* version: 2.35.1 */
9147
9076
 
9148
9077
  exports.LightningElement = LightningElement;
9149
9078
  exports.__unstable__ProfilerControl = profilerControl;