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
@@ -206,39 +206,11 @@
206
206
  * SPDX-License-Identifier: MIT
207
207
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
208
208
  */
209
- // Inspired from: https://mathiasbynens.be/notes/globalthis
210
- var _globalThis = /*@__PURE__*/function () {
211
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
212
- if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object') {
213
- return globalThis;
214
- }
215
- var _globalThis;
216
- try {
217
- // eslint-disable-next-line no-extend-native
218
- Object.defineProperty(Object.prototype, '__magic__', {
219
- get: function get() {
220
- return this;
221
- },
222
- configurable: true
223
- });
224
- // __magic__ is undefined in Safari 10 and IE10 and older.
225
- // @ts-ignore
226
- // eslint-disable-next-line no-undef
227
- _globalThis = __magic__;
228
- // @ts-ignore
229
- delete Object.prototype.__magic__;
230
- } catch (ex) {
231
- // In IE8, Object.defineProperty only works on DOM objects.
232
- } finally {
233
- // If the magic above fails for some reason we assume that we are in a legacy browser.
234
- // Assume `window` exists in this case.
235
- if (typeof _globalThis === 'undefined') {
236
- // @ts-ignore
237
- _globalThis = window;
238
- }
239
- }
240
- return _globalThis;
241
- }();
209
+ // See browser support for globalThis:
210
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
211
+ /* istanbul ignore next */
212
+ // @ts-ignore
213
+ var _globalThis = (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object' ? globalThis : window;
242
214
 
243
215
  /*
244
216
  * Copyright (c) 2018, salesforce.com, inc.
@@ -341,7 +313,7 @@
341
313
  CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
342
314
  return propertyName;
343
315
  }
344
- /** version: 2.35.0 */
316
+ /** version: 2.35.1 */
345
317
 
346
318
  /**
347
319
  * Copyright (C) 2018 salesforce.com, inc.
@@ -393,6 +365,7 @@
393
365
  console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
394
366
  return;
395
367
  }
368
+ // This may seem redundant, but `"production" === 'test-karma-lwc'` is replaced by Karma tests
396
369
  {
397
370
  // Disallow the same flag to be set more than once in production
398
371
  var runtimeValue = lwcRuntimeFlags[name];
@@ -412,7 +385,7 @@
412
385
  */
413
386
  function setFeatureFlagForTest(name, value) {
414
387
  }
415
- /** version: 2.35.0 */
388
+ /** version: 2.35.1 */
416
389
 
417
390
  /**
418
391
  * Copyright (C) 2018 salesforce.com, inc.
@@ -476,7 +449,7 @@
476
449
  }
477
450
  }
478
451
  }
479
- /** version: 2.35.0 */
452
+ /** version: 2.35.1 */
480
453
 
481
454
  /*
482
455
  * Copyright (c) 2018, salesforce.com, inc.
@@ -868,6 +841,14 @@
868
841
  refVNodes[ref] = vnode;
869
842
  }
870
843
  }
844
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
845
+ function assertNotProd() {
846
+ /* istanbul ignore if */
847
+ {
848
+ // this method should never leak to prod
849
+ throw new ReferenceError();
850
+ }
851
+ }
871
852
 
872
853
  /*
873
854
  * Copyright (c) 2020, salesforce.com, inc.
@@ -1565,7 +1546,6 @@
1565
1546
  }
1566
1547
  };
1567
1548
  }
1568
- var EMPTY_REFS = freeze(create(null));
1569
1549
  var refsCache = new WeakMap();
1570
1550
  /**
1571
1551
  * This class is the base class for any LWC element.
@@ -1732,22 +1712,15 @@
1732
1712
  // based on `this.refs.bar`.
1733
1713
  return;
1734
1714
  }
1735
- var refVNodes = vm.refVNodes,
1736
- hasRefVNodes = vm.hasRefVNodes;
1715
+ var refVNodes = vm.refVNodes;
1737
1716
  vm.cmpTemplate;
1738
1717
  // For backwards compatibility with component written before template refs
1739
1718
  // were introduced, we return undefined if the template has no refs defined
1740
1719
  // anywhere. This fixes components that may want to add an expando called `refs`
1741
1720
  // and are checking if it exists with `if (this.refs)` before adding it.
1742
- // Note it is not sufficient to just check if `refVNodes` is null or empty,
1743
- // because a template may have `lwc:ref` defined within a falsy `if:true` block.
1744
- if (!hasRefVNodes) {
1745
- return;
1746
- }
1747
- // For templates that are using `lwc:ref`, if there are no refs currently available
1748
- // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
1721
+ // Note we use a null refVNodes to indicate that the template has no refs defined.
1749
1722
  if (isNull(refVNodes)) {
1750
- return EMPTY_REFS;
1723
+ return;
1751
1724
  }
1752
1725
  // The refNodes can be cached based on the refVNodes, since the refVNodes
1753
1726
  // are recreated from scratch every time the template is rendered.
@@ -2573,10 +2546,60 @@
2573
2546
  }
2574
2547
  freeze(BaseBridgeElement);
2575
2548
  seal(BaseBridgeElement.prototype);
2549
+ var swappedStyleMap = new WeakMap();
2550
+ var activeTemplates = new WeakMap();
2551
+ var activeComponents = new WeakMap();
2552
+ var activeStyles = new WeakMap();
2553
+ function getStyleOrSwappedStyle(style) {
2554
+ assertNotProd(); // this method should never leak to prod
2555
+ var visited = new Set();
2556
+ while (swappedStyleMap.has(style) && !visited.has(style)) {
2557
+ visited.add(style);
2558
+ style = swappedStyleMap.get(style);
2559
+ }
2560
+ return style;
2561
+ }
2576
2562
  function setActiveVM(vm) {
2577
- {
2578
- // this method should never leak to prod
2579
- throw new ReferenceError();
2563
+ assertNotProd(); // this method should never leak to prod
2564
+ // tracking active component
2565
+ var Ctor = vm.def.ctor;
2566
+ var componentVMs = activeComponents.get(Ctor);
2567
+ if (isUndefined$1(componentVMs)) {
2568
+ componentVMs = new Set();
2569
+ activeComponents.set(Ctor, componentVMs);
2570
+ }
2571
+ // this will allow us to keep track of the hot components
2572
+ componentVMs.add(vm);
2573
+ // tracking active template
2574
+ var tpl = vm.cmpTemplate;
2575
+ if (tpl) {
2576
+ var templateVMs = activeTemplates.get(tpl);
2577
+ if (isUndefined$1(templateVMs)) {
2578
+ templateVMs = new Set();
2579
+ activeTemplates.set(tpl, templateVMs);
2580
+ }
2581
+ // this will allow us to keep track of the templates that are
2582
+ // being used by a hot component
2583
+ templateVMs.add(vm);
2584
+ // tracking active styles associated to template
2585
+ var stylesheets = tpl.stylesheets;
2586
+ if (!isUndefined$1(stylesheets)) {
2587
+ flattenStylesheets(stylesheets).forEach(function (stylesheet) {
2588
+ // this is necessary because we don't hold the list of styles
2589
+ // in the vm, we only hold the selected (already swapped template)
2590
+ // but the styles attached to the template might not be the actual
2591
+ // active ones, but the swapped versions of those.
2592
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
2593
+ var stylesheetVMs = activeStyles.get(stylesheet);
2594
+ if (isUndefined$1(stylesheetVMs)) {
2595
+ stylesheetVMs = new Set();
2596
+ activeStyles.set(stylesheet, stylesheetVMs);
2597
+ }
2598
+ // this will allow us to keep track of the stylesheet that are
2599
+ // being used by a hot component
2600
+ stylesheetVMs.add(vm);
2601
+ });
2602
+ }
2580
2603
  }
2581
2604
  }
2582
2605
  function swapTemplate(oldTpl, newTpl) {
@@ -4356,9 +4379,18 @@
4356
4379
  vmBeingRendered = vm;
4357
4380
  }
4358
4381
  function validateSlots(vm, html) {
4359
- {
4360
- // this method should never leak to prod
4361
- throw new ReferenceError();
4382
+ assertNotProd(); // this method should never leak to prod
4383
+ var cmpSlots = vm.cmpSlots;
4384
+ var _html$slots = html.slots,
4385
+ slots = _html$slots === void 0 ? EmptyArray : _html$slots;
4386
+ for (var slotName in cmpSlots.slotAssignments) {
4387
+ // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
4388
+ assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), "Slots can only be set to an array, instead received ".concat(toString$1(cmpSlots.slotAssignments[slotName]), " for slot \"").concat(slotName, "\" in ").concat(vm, "."));
4389
+ if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
4390
+ // TODO [#1297]: this should never really happen because the compiler should always validate
4391
+ // eslint-disable-next-line @lwc/lwc-internal/no-production-assert
4392
+ logError("Ignoring unknown provided slot name \"".concat(slotName, "\" in ").concat(vm, ". Check for a typo on the slot attribute."), vm);
4393
+ }
4362
4394
  }
4363
4395
  }
4364
4396
  function validateLightDomTemplate(template, vm) {
@@ -4482,9 +4514,7 @@
4482
4514
  }
4483
4515
  if ("production" !== 'production') ;
4484
4516
  // reset the refs; they will be set during the tmpl() instantiation
4485
- var hasRefVNodes = Boolean(html.hasRefs);
4486
- vm.hasRefVNodes = hasRefVNodes;
4487
- vm.refVNodes = hasRefVNodes ? create(null) : null;
4517
+ vm.refVNodes = html.hasRefs ? create(null) : null;
4488
4518
  // right before producing the vnodes, we clear up all internal references
4489
4519
  // to custom elements from the template.
4490
4520
  vm.velements = [];
@@ -4646,7 +4676,7 @@
4646
4676
  var cmpEventListenerMap = new WeakMap();
4647
4677
  function getWrappedComponentsListener(vm, listener) {
4648
4678
  if (!isFunction$1(listener)) {
4649
- throw new TypeError(); // avoiding problems with non-valid listeners
4679
+ throw new TypeError('Expected an EventListener but received ' + _typeof(listener)); // avoiding problems with non-valid listeners
4650
4680
  }
4651
4681
 
4652
4682
  var wrappedListener = cmpEventListenerMap.get(listener);
@@ -4777,7 +4807,6 @@
4777
4807
  mode: mode,
4778
4808
  owner: owner,
4779
4809
  refVNodes: null,
4780
- hasRefVNodes: false,
4781
4810
  children: EmptyArray,
4782
4811
  aChildren: EmptyArray,
4783
4812
  velements: EmptyArray,
@@ -6753,7 +6782,7 @@
6753
6782
  function isNull(obj) {
6754
6783
  return obj === null;
6755
6784
  }
6756
- /** version: 2.35.0 */
6785
+ /** version: 2.35.1 */
6757
6786
 
6758
6787
  /*
6759
6788
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7312,7 +7341,7 @@
7312
7341
  });
7313
7342
  freeze(LightningElement);
7314
7343
  seal(LightningElement.prototype);
7315
- /* version: 2.35.0 */
7344
+ /* version: 2.35.1 */
7316
7345
 
7317
7346
  exports.LightningElement = LightningElement;
7318
7347
  exports.__unstable__ProfilerControl = profilerControl;
@@ -194,47 +194,15 @@ function isAriaAttribute(attrName) {
194
194
  * SPDX-License-Identifier: MIT
195
195
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
196
196
  */
197
- // Inspired from: https://mathiasbynens.be/notes/globalthis
198
- const _globalThis = /*@__PURE__*/ (function () {
199
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
200
- if (typeof globalThis === 'object') {
201
- return globalThis;
202
- }
203
- let _globalThis;
204
- try {
205
- // eslint-disable-next-line no-extend-native
206
- Object.defineProperty(Object.prototype, '__magic__', {
207
- get: function () {
208
- return this;
209
- },
210
- configurable: true,
211
- });
212
- // __magic__ is undefined in Safari 10 and IE10 and older.
213
- // @ts-ignore
214
- // eslint-disable-next-line no-undef
215
- _globalThis = __magic__;
216
- // @ts-ignore
217
- delete Object.prototype.__magic__;
218
- }
219
- catch (ex) {
220
- // In IE8, Object.defineProperty only works on DOM objects.
221
- }
222
- finally {
223
- // If the magic above fails for some reason we assume that we are in a legacy browser.
224
- // Assume `window` exists in this case.
225
- if (typeof _globalThis === 'undefined') {
226
- // @ts-ignore
227
- _globalThis = window;
228
- }
229
- }
230
- return _globalThis;
231
- })();
197
+ // See browser support for globalThis:
198
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
199
+ /* istanbul ignore next */
200
+ // @ts-ignore
201
+ const _globalThis = typeof globalThis === 'object' ? globalThis : window;
232
202
  const KEY__SHADOW_RESOLVER = '$shadowResolver$';
233
203
  const KEY__SHADOW_STATIC = '$shadowStaticNode$';
234
204
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
235
205
  const KEY__SCOPED_CSS = '$scoped$';
236
- const KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
237
- const KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
238
206
 
239
207
  /*
240
208
  * Copyright (c) 2022, salesforce.com, inc.
@@ -474,9 +442,9 @@ function htmlEscape(str, attrMode = false) {
474
442
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
475
443
  */
476
444
  // Increment whenever the LWC template compiler changes
477
- const LWC_VERSION = "2.35.0";
445
+ const LWC_VERSION = "2.35.1";
478
446
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
479
- /** version: 2.35.0 */
447
+ /** version: 2.35.1 */
480
448
 
481
449
  /*
482
450
  * Copyright (c) 2020, salesforce.com, inc.
@@ -561,7 +529,8 @@ function setFeatureFlag(name, value) {
561
529
  console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
562
530
  return;
563
531
  }
564
- if (process.env.NODE_ENV !== 'production') {
532
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
533
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
565
534
  // Allow the same flag to be set more than once outside of production to enable testing
566
535
  lwcRuntimeFlags[name] = value;
567
536
  }
@@ -581,11 +550,12 @@ function setFeatureFlag(name, value) {
581
550
  * purposes. It is a no-op when invoked in production mode.
582
551
  */
583
552
  function setFeatureFlagForTest(name, value) {
584
- if (process.env.NODE_ENV !== 'production') {
553
+ // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
554
+ if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
585
555
  setFeatureFlag(name, value);
586
556
  }
587
557
  }
588
- /** version: 2.35.0 */
558
+ /** version: 2.35.1 */
589
559
 
590
560
  /**
591
561
  * Copyright (C) 2018 salesforce.com, inc.
@@ -649,7 +619,7 @@ function applyAriaReflection(prototype = Element.prototype) {
649
619
  }
650
620
  }
651
621
  }
652
- /** version: 2.35.0 */
622
+ /** version: 2.35.1 */
653
623
 
654
624
  /* proxy-compat-disable */
655
625
 
@@ -660,8 +630,7 @@ function applyAriaReflection(prototype = Element.prototype) {
660
630
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
661
631
  */
662
632
  // Only used in LWC's Karma tests
663
- // @ts-ignore
664
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
633
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
665
634
  window.addEventListener('test-dummy-flag', () => {
666
635
  let hasFlag = false;
667
636
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
@@ -730,8 +699,8 @@ function addErrorComponentStack(vm, error) {
730
699
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
731
700
  */
732
701
  const alreadyLoggedMessages = new Set();
733
- // @ts-ignore
734
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
702
+ // Only used in LWC's Karma tests
703
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
735
704
  // @ts-ignore
736
705
  window.__lwcResetAlreadyLoggedMessages = () => {
737
706
  alreadyLoggedMessages.clear();
@@ -846,6 +815,14 @@ function setRefVNode(vm, ref, vnode) {
846
815
  refVNodes[ref] = vnode;
847
816
  }
848
817
  }
818
+ // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
819
+ function assertNotProd() {
820
+ /* istanbul ignore if */
821
+ if (process.env.NODE_ENV === 'production') {
822
+ // this method should never leak to prod
823
+ throw new ReferenceError();
824
+ }
825
+ }
849
826
 
850
827
  /*
851
828
  * Copyright (c) 2020, salesforce.com, inc.
@@ -1051,27 +1028,18 @@ function generateAccessorDescriptor(options) {
1051
1028
  }
1052
1029
  let isDomMutationAllowed = false;
1053
1030
  function unlockDomMutation() {
1054
- if (process.env.NODE_ENV === 'production') {
1055
- // this method should never leak to prod
1056
- throw new ReferenceError();
1057
- }
1031
+ assertNotProd(); // this method should never leak to prod
1058
1032
  isDomMutationAllowed = true;
1059
1033
  }
1060
1034
  function lockDomMutation() {
1061
- if (process.env.NODE_ENV === 'production') {
1062
- // this method should never leak to prod
1063
- throw new ReferenceError();
1064
- }
1035
+ assertNotProd(); // this method should never leak to prod
1065
1036
  isDomMutationAllowed = false;
1066
1037
  }
1067
1038
  function logMissingPortalError(name, type) {
1068
1039
  return logError(`The \`${name}\` ${type} is available only on elements that use the \`lwc:dom="manual"\` directive.`);
1069
1040
  }
1070
1041
  function patchElementWithRestrictions(elm, options) {
1071
- if (process.env.NODE_ENV === 'production') {
1072
- // this method should never leak to prod
1073
- throw new ReferenceError();
1074
- }
1042
+ assertNotProd(); // this method should never leak to prod
1075
1043
  const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
1076
1044
  const descriptors = {
1077
1045
  outerHTML: generateAccessorDescriptor({
@@ -1152,10 +1120,7 @@ function patchElementWithRestrictions(elm, options) {
1152
1120
  defineProperties(elm, descriptors);
1153
1121
  }
1154
1122
  function getShadowRootRestrictionsDescriptors(sr) {
1155
- if (process.env.NODE_ENV === 'production') {
1156
- // this method should never leak to prod
1157
- throw new ReferenceError();
1158
- }
1123
+ assertNotProd(); // this method should never leak to prod
1159
1124
  // Disallowing properties in dev mode only to avoid people doing the wrong
1160
1125
  // thing when using the real shadow root, because if that's the case,
1161
1126
  // the component will not work when running with synthetic shadow.
@@ -1196,10 +1161,7 @@ function getShadowRootRestrictionsDescriptors(sr) {
1196
1161
  // Custom Elements Restrictions:
1197
1162
  // -----------------------------
1198
1163
  function getCustomElementRestrictionsDescriptors(elm) {
1199
- if (process.env.NODE_ENV === 'production') {
1200
- // this method should never leak to prod
1201
- throw new ReferenceError();
1202
- }
1164
+ assertNotProd(); // this method should never leak to prod
1203
1165
  const originalAddEventListener = elm.addEventListener;
1204
1166
  const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
1205
1167
  const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
@@ -1244,10 +1206,7 @@ function getCustomElementRestrictionsDescriptors(elm) {
1244
1206
  };
1245
1207
  }
1246
1208
  function getComponentRestrictionsDescriptors() {
1247
- if (process.env.NODE_ENV === 'production') {
1248
- // this method should never leak to prod
1249
- throw new ReferenceError();
1250
- }
1209
+ assertNotProd(); // this method should never leak to prod
1251
1210
  return {
1252
1211
  tagName: generateAccessorDescriptor({
1253
1212
  get() {
@@ -1261,10 +1220,7 @@ function getComponentRestrictionsDescriptors() {
1261
1220
  };
1262
1221
  }
1263
1222
  function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1264
- if (process.env.NODE_ENV === 'production') {
1265
- // this method should never leak to prod
1266
- throw new ReferenceError();
1267
- }
1223
+ assertNotProd(); // this method should never leak to prod
1268
1224
  const originalDispatchEvent = proto.dispatchEvent;
1269
1225
  const descriptors = {
1270
1226
  dispatchEvent: generateDataDescriptor({
@@ -1969,7 +1925,6 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1969
1925
  }
1970
1926
  };
1971
1927
  }
1972
- const EMPTY_REFS = freeze(create(null));
1973
1928
  const refsCache = new WeakMap();
1974
1929
  /**
1975
1930
  * This class is the base class for any LWC element.
@@ -2256,7 +2211,6 @@ LightningElement.prototype = {
2256
2211
  }
2257
2212
  const {
2258
2213
  refVNodes,
2259
- hasRefVNodes,
2260
2214
  cmpTemplate
2261
2215
  } = vm;
2262
2216
  // If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
@@ -2270,15 +2224,9 @@ LightningElement.prototype = {
2270
2224
  // were introduced, we return undefined if the template has no refs defined
2271
2225
  // anywhere. This fixes components that may want to add an expando called `refs`
2272
2226
  // and are checking if it exists with `if (this.refs)` before adding it.
2273
- // Note it is not sufficient to just check if `refVNodes` is null or empty,
2274
- // because a template may have `lwc:ref` defined within a falsy `if:true` block.
2275
- if (!hasRefVNodes) {
2276
- return;
2277
- }
2278
- // For templates that are using `lwc:ref`, if there are no refs currently available
2279
- // (e.g. refs inside of a falsy `if:true` block), we return an empty object.
2227
+ // Note we use a null refVNodes to indicate that the template has no refs defined.
2280
2228
  if (isNull(refVNodes)) {
2281
- return EMPTY_REFS;
2229
+ return;
2282
2230
  }
2283
2231
  // The refNodes can be cached based on the refVNodes, since the refVNodes
2284
2232
  // are recreated from scratch every time the template is rendered.
@@ -3077,8 +3025,8 @@ function getDecoratorsMeta(Ctor) {
3077
3025
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3078
3026
  */
3079
3027
  let warned = false;
3080
- // @ts-ignore
3081
- if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
3028
+ // Only used in LWC's Karma tests
3029
+ if (process.env.NODE_ENV === 'test-karma-lwc') {
3082
3030
  // @ts-ignore
3083
3031
  window.__lwcResetWarnedOnVersionMismatch = () => {
3084
3032
  warned = false;
@@ -3300,10 +3248,7 @@ const activeTemplates = new WeakMap();
3300
3248
  const activeComponents = new WeakMap();
3301
3249
  const activeStyles = new WeakMap();
3302
3250
  function getTemplateOrSwappedTemplate(tpl) {
3303
- if (process.env.NODE_ENV === 'production') {
3304
- // this method should never leak to prod
3305
- throw new ReferenceError();
3306
- }
3251
+ assertNotProd(); // this method should never leak to prod
3307
3252
  const visited = new Set();
3308
3253
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
3309
3254
  visited.add(tpl);
@@ -3312,10 +3257,7 @@ function getTemplateOrSwappedTemplate(tpl) {
3312
3257
  return tpl;
3313
3258
  }
3314
3259
  function getComponentOrSwappedComponent(Ctor) {
3315
- if (process.env.NODE_ENV === 'production') {
3316
- // this method should never leak to prod
3317
- throw new ReferenceError();
3318
- }
3260
+ assertNotProd(); // this method should never leak to prod
3319
3261
  const visited = new Set();
3320
3262
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
3321
3263
  visited.add(Ctor);
@@ -3324,10 +3266,7 @@ function getComponentOrSwappedComponent(Ctor) {
3324
3266
  return Ctor;
3325
3267
  }
3326
3268
  function getStyleOrSwappedStyle(style) {
3327
- if (process.env.NODE_ENV === 'production') {
3328
- // this method should never leak to prod
3329
- throw new ReferenceError();
3330
- }
3269
+ assertNotProd(); // this method should never leak to prod
3331
3270
  const visited = new Set();
3332
3271
  while (swappedStyleMap.has(style) && !visited.has(style)) {
3333
3272
  visited.add(style);
@@ -3336,10 +3275,7 @@ function getStyleOrSwappedStyle(style) {
3336
3275
  return style;
3337
3276
  }
3338
3277
  function setActiveVM(vm) {
3339
- if (process.env.NODE_ENV === 'production') {
3340
- // this method should never leak to prod
3341
- throw new ReferenceError();
3342
- }
3278
+ assertNotProd(); // this method should never leak to prod
3343
3279
  // tracking active component
3344
3280
  const Ctor = vm.def.ctor;
3345
3281
  let componentVMs = activeComponents.get(Ctor);
@@ -3382,10 +3318,7 @@ function setActiveVM(vm) {
3382
3318
  }
3383
3319
  }
3384
3320
  function removeActiveVM(vm) {
3385
- if (process.env.NODE_ENV === 'production') {
3386
- // this method should never leak to prod
3387
- throw new ReferenceError();
3388
- }
3321
+ assertNotProd(); // this method should never leak to prod
3389
3322
  // tracking inactive component
3390
3323
  const Ctor = vm.def.ctor;
3391
3324
  let list = activeComponents.get(Ctor);
@@ -5436,10 +5369,7 @@ function setVMBeingRendered(vm) {
5436
5369
  vmBeingRendered = vm;
5437
5370
  }
5438
5371
  function validateSlots(vm, html) {
5439
- if (process.env.NODE_ENV === 'production') {
5440
- // this method should never leak to prod
5441
- throw new ReferenceError();
5442
- }
5372
+ assertNotProd(); // this method should never leak to prod
5443
5373
  const { cmpSlots } = vm;
5444
5374
  const { slots = EmptyArray } = html;
5445
5375
  for (const slotName in cmpSlots.slotAssignments) {
@@ -5568,9 +5498,7 @@ function evaluateTemplate(vm, html) {
5568
5498
  setActiveVM(vm);
5569
5499
  }
5570
5500
  // reset the refs; they will be set during the tmpl() instantiation
5571
- const hasRefVNodes = Boolean(html.hasRefs);
5572
- vm.hasRefVNodes = hasRefVNodes;
5573
- vm.refVNodes = hasRefVNodes ? create(null) : null;
5501
+ vm.refVNodes = html.hasRefs ? create(null) : null;
5574
5502
  // right before producing the vnodes, we clear up all internal references
5575
5503
  // to custom elements from the template.
5576
5504
  vm.velements = [];
@@ -5751,7 +5679,7 @@ function markComponentAsDirty(vm) {
5751
5679
  const cmpEventListenerMap = new WeakMap();
5752
5680
  function getWrappedComponentsListener(vm, listener) {
5753
5681
  if (!isFunction$1(listener)) {
5754
- throw new TypeError(); // avoiding problems with non-valid listeners
5682
+ throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
5755
5683
  }
5756
5684
  let wrappedListener = cmpEventListenerMap.get(listener);
5757
5685
  if (isUndefined$1(wrappedListener)) {
@@ -5896,7 +5824,6 @@ function createVM(elm, ctor, renderer, options) {
5896
5824
  mode,
5897
5825
  owner,
5898
5826
  refVNodes: null,
5899
- hasRefVNodes: false,
5900
5827
  children: EmptyArray,
5901
5828
  aChildren: EmptyArray,
5902
5829
  velements: EmptyArray,
@@ -6270,22 +6197,6 @@ function runWithBoundaryProtection(vm, owner, pre, job, post) {
6270
6197
  }
6271
6198
  }
6272
6199
 
6273
- /*
6274
- * Copyright (c) 2018, salesforce.com, inc.
6275
- * All rights reserved.
6276
- * SPDX-License-Identifier: MIT
6277
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6278
- */
6279
- //
6280
- // The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
6281
- // These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
6282
- // When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
6283
- // See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
6284
- //
6285
- // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
6286
- _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
6287
- _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
6288
-
6289
6200
  /*
6290
6201
  * Copyright (c) 2018, salesforce.com, inc.
6291
6202
  * All rights reserved.
@@ -6530,7 +6441,7 @@ function freezeTemplate(tmpl) {
6530
6441
  }
6531
6442
  }
6532
6443
  }
6533
- /* version: 2.35.0 */
6444
+ /* version: 2.35.1 */
6534
6445
 
6535
6446
  /*
6536
6447
  * Copyright (c) 2020, salesforce.com, inc.
@@ -7001,7 +6912,7 @@ function renderComponent(tagName, Ctor, props = {}) {
7001
6912
  */
7002
6913
  freeze(LightningElement);
7003
6914
  seal(LightningElement.prototype);
7004
- /* version: 2.35.0 */
6915
+ /* version: 2.35.1 */
7005
6916
 
7006
6917
  exports.LightningElement = LightningElement;
7007
6918
  exports.api = api$1;