lwc 2.35.2 → 2.36.0

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 (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +245 -89
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +245 -89
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +273 -45
  5. package/dist/engine-dom/iife/es5/engine-dom.js +402 -232
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +449 -161
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +245 -89
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +273 -45
  11. package/dist/engine-dom/umd/es5/engine-dom.js +402 -232
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +449 -161
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +124 -77
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +124 -77
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -330,9 +330,9 @@
330
330
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
331
331
  */
332
332
  // Increment whenever the LWC template compiler changes
333
- var LWC_VERSION = "2.35.2";
333
+ var LWC_VERSION = "2.36.0";
334
334
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
335
- /** version: 2.35.2 */
335
+ /** version: 2.36.0 */
336
336
 
337
337
  /**
338
338
  * Copyright (C) 2018 salesforce.com, inc.
@@ -413,7 +413,7 @@
413
413
  setFeatureFlag(name, value);
414
414
  }
415
415
  }
416
- /** version: 2.35.2 */
416
+ /** version: 2.36.0 */
417
417
 
418
418
  /**
419
419
  * Copyright (C) 2018 salesforce.com, inc.
@@ -477,7 +477,7 @@
477
477
  }
478
478
  }
479
479
  }
480
- /** version: 2.35.2 */
480
+ /** version: 2.36.0 */
481
481
 
482
482
  /*
483
483
  * Copyright (c) 2018, salesforce.com, inc.
@@ -543,7 +543,6 @@
543
543
  * SPDX-License-Identifier: MIT
544
544
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
545
545
  */
546
- /** Callbacks to invoke when reporting is enabled **/
547
546
  var onReportingEnabledCallbacks = [];
548
547
  /** The currently assigned reporting dispatcher. */
549
548
  var currentDispatcher$1 = noop;
@@ -600,11 +599,11 @@
600
599
  /**
601
600
  * Report to the current dispatcher, if there is one.
602
601
  * @param reportingEventId
603
- * @param vm
602
+ * @param payload - data to report
604
603
  */
605
- function report(reportingEventId, vm) {
604
+ function report(reportingEventId, payload) {
606
605
  if (enabled$1) {
607
- currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
606
+ currentDispatcher$1(reportingEventId, payload);
608
607
  }
609
608
  }
610
609
 
@@ -897,31 +896,39 @@
897
896
  // Make a shallow copy of an object but omit the given key
898
897
  function cloneAndOmitKey(object, keyToOmit) {
899
898
  var result = {};
900
- for (var _i7 = 0, _Object$keys = Object.keys(object); _i7 < _Object$keys.length; _i7++) {
901
- var key = _Object$keys[_i7];
902
- if (key !== keyToOmit) {
903
- result[key] = object[key];
899
+ var _iterator2 = _createForOfIteratorHelper(keys(object)),
900
+ _step2;
901
+ try {
902
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
903
+ var key = _step2.value;
904
+ if (key !== keyToOmit) {
905
+ result[key] = object[key];
906
+ }
904
907
  }
908
+ } catch (err) {
909
+ _iterator2.e(err);
910
+ } finally {
911
+ _iterator2.f();
905
912
  }
906
913
  return result;
907
914
  }
908
915
  function flattenStylesheets(stylesheets) {
909
916
  var list = [];
910
- var _iterator2 = _createForOfIteratorHelper(stylesheets),
911
- _step2;
917
+ var _iterator3 = _createForOfIteratorHelper(stylesheets),
918
+ _step3;
912
919
  try {
913
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
914
- var stylesheet = _step2.value;
915
- if (!Array.isArray(stylesheet)) {
920
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
921
+ var stylesheet = _step3.value;
922
+ if (!isArray$1(stylesheet)) {
916
923
  list.push(stylesheet);
917
924
  } else {
918
925
  list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
919
926
  }
920
927
  }
921
928
  } catch (err) {
922
- _iterator2.e(err);
929
+ _iterator3.e(err);
923
930
  } finally {
924
- _iterator2.f();
931
+ _iterator3.f();
925
932
  }
926
933
  return list;
927
934
  }
@@ -2400,17 +2407,17 @@
2400
2407
  var refs = refsCache.get(refVNodes);
2401
2408
  if (isUndefined$1(refs)) {
2402
2409
  refs = create(null);
2403
- var _iterator3 = _createForOfIteratorHelper(keys(refVNodes)),
2404
- _step3;
2410
+ var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
2411
+ _step4;
2405
2412
  try {
2406
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2407
- var key = _step3.value;
2413
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
2414
+ var key = _step4.value;
2408
2415
  refs[key] = refVNodes[key].elm;
2409
2416
  }
2410
2417
  } catch (err) {
2411
- _iterator3.e(err);
2418
+ _iterator4.e(err);
2412
2419
  } finally {
2413
- _iterator3.f();
2420
+ _iterator4.f();
2414
2421
  }
2415
2422
  freeze(refs);
2416
2423
  refsCache.set(refVNodes, refs);
@@ -2492,7 +2499,7 @@
2492
2499
  var queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
2493
2500
  // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2494
2501
  var _loop = function _loop() {
2495
- var queryMethod = _queryMethods[_i8];
2502
+ var queryMethod = _queryMethods[_i7];
2496
2503
  queryAndChildGetterDescriptors[queryMethod] = {
2497
2504
  value: function value(arg) {
2498
2505
  var vm = getAssociatedVM(this);
@@ -2508,7 +2515,7 @@
2508
2515
  writable: true
2509
2516
  };
2510
2517
  };
2511
- for (var _i8 = 0, _queryMethods = queryMethods; _i8 < _queryMethods.length; _i8++) {
2518
+ for (var _i7 = 0, _queryMethods = queryMethods; _i7 < _queryMethods.length; _i7++) {
2512
2519
  _loop();
2513
2520
  }
2514
2521
  defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
@@ -2821,16 +2828,16 @@
2821
2828
  }
2822
2829
  function connectWireAdapters(vm) {
2823
2830
  var wiredConnecting = vm.context.wiredConnecting;
2824
- for (var _i9 = 0, len = wiredConnecting.length; _i9 < len; _i9 += 1) {
2825
- wiredConnecting[_i9]();
2831
+ for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
2832
+ wiredConnecting[_i8]();
2826
2833
  }
2827
2834
  }
2828
2835
  function disconnectWireAdapters(vm) {
2829
2836
  var wiredDisconnecting = vm.context.wiredDisconnecting;
2830
2837
  runWithBoundaryProtection(vm, vm, noop, function () {
2831
2838
  // job
2832
- for (var _i10 = 0, len = wiredDisconnecting.length; _i10 < len; _i10 += 1) {
2833
- wiredDisconnecting[_i10]();
2839
+ for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
2840
+ wiredDisconnecting[_i9]();
2834
2841
  }
2835
2842
  }, noop);
2836
2843
  }
@@ -3164,8 +3171,8 @@
3164
3171
  }
3165
3172
  }
3166
3173
  if (!isUndefined$1(fields)) {
3167
- for (var _i11 = 0, n = fields.length; _i11 < n; _i11++) {
3168
- var _fieldName2 = fields[_i11];
3174
+ for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
3175
+ var _fieldName2 = fields[_i10];
3169
3176
  descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
3170
3177
  if (process.env.NODE_ENV !== 'production') {
3171
3178
  validateObservedField(Ctor, _fieldName2, descriptor);
@@ -3237,6 +3244,10 @@
3237
3244
  // stylesheets and templates do not have user-meaningful names, but components do
3238
3245
  var friendlyName = type === 'component' ? "".concat(type, " ").concat(func.name) : type;
3239
3246
  logError("LWC WARNING: current engine is v".concat(LWC_VERSION, ", but ").concat(friendlyName, " was compiled with v").concat(version, ".\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear."));
3247
+ report(1 /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
3248
+ compilerVersion: version,
3249
+ runtimeVersion: LWC_VERSION
3250
+ });
3240
3251
  }
3241
3252
  }
3242
3253
  }
@@ -3387,8 +3398,8 @@
3387
3398
  superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
3388
3399
  var descriptors = create(null);
3389
3400
  // expose getters and setters for each public props on the new Element Bridge
3390
- for (var _i12 = 0, len = props.length; _i12 < len; _i12 += 1) {
3391
- var _propName = props[_i12];
3401
+ for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
3402
+ var _propName = props[_i11];
3392
3403
  attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
3393
3404
  descriptors[_propName] = {
3394
3405
  get: createGetter(_propName),
@@ -3398,8 +3409,8 @@
3398
3409
  };
3399
3410
  }
3400
3411
  // expose public methods as props on the new Element Bridge
3401
- for (var _i13 = 0, _len = methods.length; _i13 < _len; _i13 += 1) {
3402
- var methodName = methods[_i13];
3412
+ for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
3413
+ var methodName = methods[_i12];
3403
3414
  descriptors[methodName] = {
3404
3415
  value: createMethodCaller(methodName),
3405
3416
  writable: true,
@@ -3928,8 +3939,8 @@
3928
3939
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3929
3940
  var content = [];
3930
3941
  var root;
3931
- for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
3932
- var stylesheet = stylesheets[_i14];
3942
+ for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
3943
+ var stylesheet = stylesheets[_i13];
3933
3944
  if (isArray$1(stylesheet)) {
3934
3945
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3935
3946
  } else {
@@ -4037,8 +4048,8 @@
4037
4048
  shadowMode = vm.shadowMode,
4038
4049
  insertStylesheet = vm.renderer.insertStylesheet;
4039
4050
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
4040
- for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4041
- insertStylesheet(stylesheets[_i15]);
4051
+ for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
4052
+ insertStylesheet(stylesheets[_i14]);
4042
4053
  }
4043
4054
  } else if (vm.hydrated) {
4044
4055
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
@@ -4051,8 +4062,8 @@
4051
4062
  var root = getNearestNativeShadowComponent(vm);
4052
4063
  // null root means a global style
4053
4064
  var target = isNull(root) ? undefined : root.shadowRoot;
4054
- for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
4055
- insertStylesheet(stylesheets[_i16], target);
4065
+ for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4066
+ insertStylesheet(stylesheets[_i15], target);
4056
4067
  }
4057
4068
  }
4058
4069
  return null;
@@ -4366,8 +4377,8 @@
4366
4377
  return;
4367
4378
  }
4368
4379
  var setCSSStyleProperty = renderer.setCSSStyleProperty;
4369
- for (var _i17 = 0; _i17 < styleDecls.length; _i17++) {
4370
- var _styleDecls$_i = _slicedToArray(styleDecls[_i17], 3),
4380
+ for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
4381
+ var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
4371
4382
  prop = _styleDecls$_i[0],
4372
4383
  value = _styleDecls$_i[1],
4373
4384
  important = _styleDecls$_i[2];
@@ -4849,8 +4860,8 @@
4849
4860
  // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
4850
4861
  var nodeStack = [];
4851
4862
  var fragmentFound = false;
4852
- for (var _i18 = children.length - 1; _i18 > -1; _i18 -= 1) {
4853
- var child = children[_i18];
4863
+ for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
4864
+ var child = children[_i17];
4854
4865
  ArrayPush$1.call(nodeStack, child);
4855
4866
  fragmentFound = fragmentFound || !!(child && isVFragment(child));
4856
4867
  }
@@ -4862,8 +4873,8 @@
4862
4873
  if (!isNull(currentNode) && isVFragment(currentNode)) {
4863
4874
  var fChildren = currentNode.children;
4864
4875
  // Ignore the start and end text node delimiters
4865
- for (var _i19 = fChildren.length - 2; _i19 > 0; _i19 -= 1) {
4866
- ArrayPush$1.call(nodeStack, fChildren[_i19]);
4876
+ for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
4877
+ ArrayPush$1.call(nodeStack, fChildren[_i18]);
4867
4878
  }
4868
4879
  } else {
4869
4880
  ArrayPush$1.call(flattenedChildren, currentNode);
@@ -4902,8 +4913,8 @@
4902
4913
  var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4903
4914
  var cmpSlotsMapping = create(null);
4904
4915
  // Collect all slots into cmpSlotsMapping
4905
- for (var _i20 = 0, len = children.length; _i20 < len; _i20 += 1) {
4906
- var vnode = children[_i20];
4916
+ for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
4917
+ var vnode = children[_i19];
4907
4918
  if (isNull(vnode)) {
4908
4919
  continue;
4909
4920
  }
@@ -4913,7 +4924,12 @@
4913
4924
  } else if (isVScopedSlotFragment(vnode)) {
4914
4925
  slotName = vnode.slotName;
4915
4926
  }
4916
- var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4927
+ // Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
4928
+ // but elm.setAttribute('slot', Symbol(1)) is an error.
4929
+ // the following line also throws same error for symbols
4930
+ // Similar for Object.create(null)
4931
+ var normalizedSlotName = '' + slotName;
4932
+ var vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
4917
4933
  ArrayPush$1.call(vnodes, vnode);
4918
4934
  }
4919
4935
  vm.cmpSlots = {
@@ -4928,8 +4944,8 @@
4928
4944
  markComponentAsDirty(vm);
4929
4945
  return;
4930
4946
  }
4931
- for (var _i21 = 0, _len2 = oldKeys.length; _i21 < _len2; _i21 += 1) {
4932
- var key = oldKeys[_i21];
4947
+ for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
4948
+ var key = oldKeys[_i20];
4933
4949
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4934
4950
  markComponentAsDirty(vm);
4935
4951
  return;
@@ -5052,11 +5068,11 @@
5052
5068
  if (oldStartIdx > oldEndIdx) {
5053
5069
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
5054
5070
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
5055
- var _i22 = newEndIdx;
5071
+ var _i21 = newEndIdx;
5056
5072
  var n;
5057
5073
  do {
5058
- n = newCh[++_i22];
5059
- } while (!isVNode(n) && _i22 < newChEnd);
5074
+ n = newCh[++_i21];
5075
+ } while (!isVNode(n) && _i21 < newChEnd);
5060
5076
  before = isVNode(n) ? n.elm : null;
5061
5077
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
5062
5078
  } else {
@@ -5081,9 +5097,9 @@
5081
5097
  // if the old list is not empty, the new list MUST have the same
5082
5098
  // amount of nodes, that's why we call this static children
5083
5099
  var anchor = null;
5084
- for (var _i23 = c2Length - 1; _i23 >= 0; _i23 -= 1) {
5085
- var n1 = c1[_i23];
5086
- var n2 = c2[_i23];
5100
+ for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
5101
+ var n1 = c1[_i22];
5102
+ var n2 = c2[_i22];
5087
5103
  if (n2 !== n1) {
5088
5104
  if (isVNode(n1)) {
5089
5105
  if (isVNode(n2)) {
@@ -5208,8 +5224,8 @@
5208
5224
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
5209
5225
  var newChildren = [];
5210
5226
  var slotAssignments = slotset.slotAssignments[slotName];
5211
- for (var _i24 = 0; _i24 < slotAssignments.length; _i24++) {
5212
- var vnode = slotAssignments[_i24];
5227
+ for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
5228
+ var vnode = slotAssignments[_i23];
5213
5229
  if (!isNull(vnode)) {
5214
5230
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
5215
5231
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -5731,23 +5747,23 @@
5731
5747
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
5732
5748
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
5733
5749
  var htmlFragment = '';
5734
- for (var _i25 = 0, n = keys.length; _i25 < n; _i25++) {
5735
- switch (keys[_i25]) {
5750
+ for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
5751
+ switch (keys[_i24]) {
5736
5752
  case 0:
5737
5753
  // styleToken in existing class attr
5738
- htmlFragment += strings[_i25] + classToken;
5754
+ htmlFragment += strings[_i24] + classToken;
5739
5755
  break;
5740
5756
  case 1:
5741
5757
  // styleToken for added class attr
5742
- htmlFragment += strings[_i25] + classAttrToken;
5758
+ htmlFragment += strings[_i24] + classAttrToken;
5743
5759
  break;
5744
5760
  case 2:
5745
5761
  // styleToken as attr
5746
- htmlFragment += strings[_i25] + attrToken;
5762
+ htmlFragment += strings[_i24] + attrToken;
5747
5763
  break;
5748
5764
  case 3:
5749
5765
  // ${1}${2}
5750
- htmlFragment += strings[_i25] + classAttrToken + attrToken;
5766
+ htmlFragment += strings[_i24] + classAttrToken + attrToken;
5751
5767
  break;
5752
5768
  }
5753
5769
  }
@@ -5852,8 +5868,8 @@
5852
5868
  }
5853
5869
  function computeHasScopedStylesInStylesheets(stylesheets) {
5854
5870
  if (hasStyles(stylesheets)) {
5855
- for (var _i26 = 0; _i26 < stylesheets.length; _i26++) {
5856
- if (isTrue(stylesheets[_i26][KEY__SCOPED_CSS])) {
5871
+ for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
5872
+ if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
5857
5873
  return true;
5858
5874
  }
5859
5875
  }
@@ -5977,6 +5993,8 @@
5977
5993
  var tmpl = _ref4.tmpl;
5978
5994
  if (isFunction$1(Ctor)) {
5979
5995
  if (process.env.NODE_ENV !== 'production') {
5996
+ // There is no point in running this in production, because the version mismatch check relies
5997
+ // on code comments which are stripped out in production by minifiers
5980
5998
  checkVersionMismatch(Ctor, 'component');
5981
5999
  }
5982
6000
  signedTemplateMap.set(Ctor, tmpl);
@@ -6049,8 +6067,8 @@
6049
6067
  if (process.env.NODE_ENV !== 'production') {
6050
6068
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
6051
6069
  }
6052
- for (var _i27 = 0; _i27 < hooks.length; ++_i27) {
6053
- var hookName = hooks[_i27];
6070
+ for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
6071
+ var hookName = hooks[_i26];
6054
6072
  if (hookName in service) {
6055
6073
  var l = Services[hookName];
6056
6074
  if (isUndefined$1(l)) {
@@ -6067,8 +6085,8 @@
6067
6085
  var component = vm.component,
6068
6086
  def = vm.def,
6069
6087
  context = vm.context;
6070
- for (var _i28 = 0, len = cbs.length; _i28 < len; ++_i28) {
6071
- cbs[_i28].call(undefined, component, {}, def, context);
6088
+ for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
6089
+ cbs[_i27].call(undefined, component, {}, def, context);
6072
6090
  }
6073
6091
  }
6074
6092
 
@@ -6222,8 +6240,8 @@
6222
6240
  var valid = true;
6223
6241
  var validate = function validate(arrayOrStylesheet) {
6224
6242
  if (isArray$1(arrayOrStylesheet)) {
6225
- for (var _i29 = 0; _i29 < arrayOrStylesheet.length; _i29++) {
6226
- validate(arrayOrStylesheet[_i29]);
6243
+ for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
6244
+ validate(arrayOrStylesheet[_i28]);
6227
6245
  }
6228
6246
  } else if (!isFunction$1(arrayOrStylesheet)) {
6229
6247
  // function assumed to be a stylesheet factory
@@ -6240,6 +6258,7 @@
6240
6258
  // Validate and flatten any stylesheets defined as `static stylesheets`
6241
6259
  function computeStylesheets(vm, ctor) {
6242
6260
  if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
6261
+ warnOnStylesheetsMutation(ctor);
6243
6262
  var stylesheets = ctor.stylesheets;
6244
6263
  if (!isUndefined$1(stylesheets)) {
6245
6264
  var valid = validateComponentStylesheets(vm, stylesheets);
@@ -6252,6 +6271,22 @@
6252
6271
  }
6253
6272
  return null;
6254
6273
  }
6274
+ function warnOnStylesheetsMutation(ctor) {
6275
+ if (process.env.NODE_ENV !== 'production') {
6276
+ var stylesheets = ctor.stylesheets;
6277
+ defineProperty(ctor, 'stylesheets', {
6278
+ enumerable: true,
6279
+ configurable: true,
6280
+ get: function get() {
6281
+ return stylesheets;
6282
+ },
6283
+ set: function set(newValue) {
6284
+ logWarnOnce("Dynamically setting the \"stylesheets\" static property on ".concat(ctor.name, " ") + 'will not affect the stylesheets injected.');
6285
+ stylesheets = newValue;
6286
+ }
6287
+ });
6288
+ }
6289
+ }
6255
6290
  function computeShadowMode(vm, renderer) {
6256
6291
  var def = vm.def;
6257
6292
  var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
@@ -6376,17 +6411,17 @@
6376
6411
  return a.idx - b.idx;
6377
6412
  });
6378
6413
  rehydrateQueue = []; // reset to a new queue
6379
- for (var _i30 = 0, len = vms.length; _i30 < len; _i30 += 1) {
6380
- var vm = vms[_i30];
6414
+ for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
6415
+ var vm = vms[_i29];
6381
6416
  try {
6382
6417
  rehydrate(vm);
6383
6418
  } catch (error) {
6384
- if (_i30 + 1 < len) {
6419
+ if (_i29 + 1 < len) {
6385
6420
  // pieces of the queue are still pending to be rehydrated, those should have priority
6386
6421
  if (rehydrateQueue.length === 0) {
6387
6422
  addCallbackToNextTick(flushRehydrationQueue);
6388
6423
  }
6389
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i30 + 1));
6424
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
6390
6425
  }
6391
6426
  // we need to end the measure before throwing.
6392
6427
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -6455,8 +6490,8 @@
6455
6490
  var vCustomElementCollection = vm.velements;
6456
6491
  // Reporting disconnection for every child in inverse order since they are
6457
6492
  // inserted in reserved order.
6458
- for (var _i31 = vCustomElementCollection.length - 1; _i31 >= 0; _i31 -= 1) {
6459
- var elm = vCustomElementCollection[_i31].elm;
6493
+ for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
6494
+ var elm = vCustomElementCollection[_i30].elm;
6460
6495
  // There are two cases where the element could be undefined:
6461
6496
  // * when there is an error during the construction phase, and an error
6462
6497
  // boundary picks it, there is a possibility that the VCustomElement
@@ -6487,8 +6522,8 @@
6487
6522
  * defined on its shadow.
6488
6523
  */
6489
6524
  function recursivelyDisconnectChildren(vnodes) {
6490
- for (var _i32 = 0, len = vnodes.length; _i32 < len; _i32 += 1) {
6491
- var vnode = vnodes[_i32];
6525
+ for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
6526
+ var vnode = vnodes[_i31];
6492
6527
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
6493
6528
  switch (vnode.type) {
6494
6529
  case 2 /* VNodeType.Element */:
@@ -6512,8 +6547,8 @@
6512
6547
  var children = vm.children,
6513
6548
  renderRoot = vm.renderRoot,
6514
6549
  remove = vm.renderer.remove;
6515
- for (var _i33 = 0, len = children.length; _i33 < len; _i33++) {
6516
- var child = children[_i33];
6550
+ for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
6551
+ var child = children[_i32];
6517
6552
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6518
6553
  remove(child.elm, renderRoot);
6519
6554
  }
@@ -6603,7 +6638,7 @@
6603
6638
  function isSyntheticShadowRootInstance(rootNode) {
6604
6639
  return rootNode !== document && isTrue(rootNode.synthetic);
6605
6640
  }
6606
- function reportViolation(source, target, attrName) {
6641
+ function reportViolation$1(source, target, attrName) {
6607
6642
  // The vm is either for the source, the target, or both. Either one or both must be using synthetic
6608
6643
  // shadow for a violation to be detected.
6609
6644
  var vm = getAssociatedVMIfPresent(source.getRootNode().host);
@@ -6614,7 +6649,10 @@
6614
6649
  // vm should never be undefined here, but just to be safe, bail out and don't report
6615
6650
  return;
6616
6651
  }
6617
- report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
6652
+ report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
6653
+ tagName: vm.tagName,
6654
+ attributeName: attrName
6655
+ });
6618
6656
  if (process.env.NODE_ENV !== 'production') {
6619
6657
  // Avoid excessively logging to the console in the case of duplicates.
6620
6658
  logWarnOnce("Element <".concat(source.tagName.toLowerCase(), "> uses attribute \"").concat(attrName, "\" to reference element ") + "<".concat(target.tagName.toLowerCase(), ">, which is not in the same shadow root. This will break in native shadow DOM. ") + "For details, see: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates", vm);
@@ -6635,57 +6673,57 @@
6635
6673
  // if our id is null or empty, nobody can reference us
6636
6674
  return;
6637
6675
  }
6638
- var _iterator4 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
6639
- _step4;
6676
+ var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
6677
+ _step5;
6640
6678
  try {
6641
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
6642
- var idRefAttrName = _step4.value;
6679
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6680
+ var idRefAttrName = _step5.value;
6643
6681
  // Query all global elements with this attribute. The attribute selector syntax `~=` is for values
6644
6682
  // that reference multiple IDs, separated by whitespace.
6645
6683
  var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
6646
6684
  var sourceElements = querySelectorAll.call(document, query);
6647
- for (var _i34 = 0; _i34 < sourceElements.length; _i34++) {
6648
- var sourceElement = sourceElements[_i34];
6685
+ for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
6686
+ var sourceElement = sourceElements[_i33];
6649
6687
  var sourceRoot = sourceElement.getRootNode();
6650
6688
  if (sourceRoot !== root) {
6651
- reportViolation(sourceElement, elm, idRefAttrName);
6689
+ reportViolation$1(sourceElement, elm, idRefAttrName);
6652
6690
  break;
6653
6691
  }
6654
6692
  }
6655
6693
  }
6656
6694
  } catch (err) {
6657
- _iterator4.e(err);
6695
+ _iterator5.e(err);
6658
6696
  } finally {
6659
- _iterator4.f();
6697
+ _iterator5.f();
6660
6698
  }
6661
6699
  } else {
6662
6700
  // elm is the source, find the target
6663
6701
  var ids = parseIdRefAttributeValue(attrValue);
6664
- var _iterator5 = _createForOfIteratorHelper(ids),
6665
- _step5;
6702
+ var _iterator6 = _createForOfIteratorHelper(ids),
6703
+ _step6;
6666
6704
  try {
6667
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6668
- var id = _step5.value;
6705
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
6706
+ var id = _step6.value;
6669
6707
  var target = getElementById.call(document, id);
6670
6708
  if (!isNull(target)) {
6671
6709
  var targetRoot = target.getRootNode();
6672
6710
  if (targetRoot !== root) {
6673
6711
  // target element's shadow root is not the same as ours
6674
- reportViolation(elm, target, attrName);
6712
+ reportViolation$1(elm, target, attrName);
6675
6713
  }
6676
6714
  }
6677
6715
  }
6678
6716
  } catch (err) {
6679
- _iterator5.e(err);
6717
+ _iterator6.e(err);
6680
6718
  } finally {
6681
- _iterator5.f();
6719
+ _iterator6.f();
6682
6720
  }
6683
6721
  }
6684
6722
  }
6685
6723
  var enabled = false;
6686
6724
  // We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
6687
6725
  // reporting is not enabled. It should also only run once
6688
- function enableDetection() {
6726
+ function enableDetection$1() {
6689
6727
  if (enabled) {
6690
6728
  return; // don't double-apply the patches
6691
6729
  }
@@ -6739,10 +6777,116 @@
6739
6777
  if (supportsCssEscape() && isSyntheticShadowLoaded()) {
6740
6778
  // Always run detection in dev mode, so we can at least print to the console
6741
6779
  if (process.env.NODE_ENV !== 'production') {
6742
- enableDetection();
6780
+ enableDetection$1();
6743
6781
  } else {
6744
6782
  // In prod mode, only enable detection if reporting is enabled
6745
- onReportingEnabled(enableDetection);
6783
+ onReportingEnabled(enableDetection$1);
6784
+ }
6785
+ }
6786
+
6787
+ /*
6788
+ * Copyright (c) 2018, salesforce.com, inc.
6789
+ * All rights reserved.
6790
+ * SPDX-License-Identifier: MIT
6791
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6792
+ */
6793
+ //
6794
+ // The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
6795
+ // legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
6796
+ //
6797
+ // See the README for @lwc/aria-reflection
6798
+ var NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
6799
+ function isLightningElement(elm) {
6800
+ // The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
6801
+ // In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
6802
+ return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
6803
+ }
6804
+ function findVM(elm) {
6805
+ // If it's a shadow DOM component, then it has a host
6806
+ var _elm$getRootNode = elm.getRootNode(),
6807
+ host = _elm$getRootNode.host;
6808
+ var vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
6809
+ if (!isUndefined$1(vm)) {
6810
+ return vm;
6811
+ }
6812
+ // Else it might be a light DOM component. Walk up the tree trying to find the owner
6813
+ var parentElement = elm;
6814
+ while (!isNull(parentElement = parentElement.parentElement)) {
6815
+ if (isLightningElement(parentElement)) {
6816
+ var _vm = getAssociatedVMIfPresent(parentElement);
6817
+ if (!isUndefined$1(_vm)) {
6818
+ return _vm;
6819
+ }
6820
+ }
6821
+ }
6822
+ // If we return undefined, it's because the element was rendered wholly outside a LightningElement
6823
+ }
6824
+
6825
+ function checkAndReportViolation(elm, prop) {
6826
+ if (!isLightningElement(elm)) {
6827
+ var vm = findVM(elm);
6828
+ if (process.env.NODE_ENV !== 'production') {
6829
+ logWarnOnce("Element <".concat(elm.tagName.toLowerCase(), "> ") + (isUndefined$1(vm) ? '' : "owned by <".concat(vm.elm.tagName.toLowerCase(), "> ")) + "uses non-standard property \"".concat(prop, "\". This will be removed in a future version of LWC. ") + "See https://lwc.dev/guide/accessibility#deprecated-aria-reflected-properties");
6830
+ }
6831
+ report(2 /* ReportingEventId.NonStandardAriaReflection */, {
6832
+ tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
6833
+ propertyName: prop
6834
+ });
6835
+ }
6836
+ }
6837
+ function enableDetection() {
6838
+ var _Element = Element,
6839
+ prototype = _Element.prototype;
6840
+ var _iterator7 = _createForOfIteratorHelper(NON_STANDARD_ARIA_PROPS),
6841
+ _step7;
6842
+ try {
6843
+ var _loop3 = function _loop3() {
6844
+ var prop = _step7.value;
6845
+ var descriptor = getOwnPropertyDescriptor$1(prototype, prop);
6846
+ // The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
6847
+ // This happens automatically because of the ordering of imports.
6848
+ if (process.env.NODE_ENV !== 'production') {
6849
+ /* istanbul ignore if */
6850
+ if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
6851
+ // should never happen
6852
+ throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
6853
+ }
6854
+ }
6855
+ // @ts-ignore
6856
+ var _get4 = descriptor.get,
6857
+ _set4 = descriptor.set;
6858
+ defineProperty(prototype, prop, {
6859
+ get: function get() {
6860
+ checkAndReportViolation(this, prop);
6861
+ return _get4.call(this);
6862
+ },
6863
+ set: function set(val) {
6864
+ checkAndReportViolation(this, prop);
6865
+ return _set4.call(this, val);
6866
+ },
6867
+ configurable: true,
6868
+ enumerable: true
6869
+ });
6870
+ };
6871
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
6872
+ _loop3();
6873
+ }
6874
+ } catch (err) {
6875
+ _iterator7.e(err);
6876
+ } finally {
6877
+ _iterator7.f();
6878
+ }
6879
+ }
6880
+ // No point in running this code if we're not in a browser, or if the global polyfill is not loaded
6881
+ {
6882
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
6883
+ // Always run detection in dev mode, so we can at least print to the console
6884
+ if (process.env.NODE_ENV !== 'production') {
6885
+ enableDetection();
6886
+ } else {
6887
+ // In prod mode, only enable detection if reporting is enabled
6888
+ onReportingEnabled(enableDetection);
6889
+ }
6746
6890
  }
6747
6891
  }
6748
6892
 
@@ -6980,8 +7124,8 @@
6980
7124
  var nextNode = node;
6981
7125
  var anchor = null;
6982
7126
  var renderer = owner.renderer;
6983
- for (var _i35 = 0; _i35 < children.length; _i35++) {
6984
- var childVnode = children[_i35];
7127
+ for (var _i34 = 0; _i34 < children.length; _i34++) {
7128
+ var childVnode = children[_i34];
6985
7129
  if (!isNull(childVnode)) {
6986
7130
  if (nextNode) {
6987
7131
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -7059,8 +7203,8 @@
7059
7203
  var nodesAreCompatible = true;
7060
7204
  // Validate attributes, though we could always recovery from those by running the update mods.
7061
7205
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
7062
- for (var _i36 = 0, _Object$entries = Object.entries(attrs); _i36 < _Object$entries.length; _i36++) {
7063
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i36], 2),
7206
+ for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
7207
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
7064
7208
  attrName = _Object$entries$_i[0],
7065
7209
  attrValue = _Object$entries$_i[1];
7066
7210
  var owner = vnode.owner;
@@ -7161,8 +7305,8 @@
7161
7305
  var parsedVnodeStyle = parseStyleText(elmStyle);
7162
7306
  var expectedStyle = [];
7163
7307
  // styleMap is used when style is set to static value.
7164
- for (var _i37 = 0, n = styleDecls.length; _i37 < n; _i37++) {
7165
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i37], 3),
7308
+ for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
7309
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
7166
7310
  prop = _styleDecls$_i2[0],
7167
7311
  value = _styleDecls$_i2[1],
7168
7312
  important = _styleDecls$_i2[2];
@@ -7245,12 +7389,13 @@
7245
7389
  */
7246
7390
  // See @lwc/engine-core/src/framework/template.ts
7247
7391
  var TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7248
- // Via https://www.npmjs.com/package/object-observer
7249
- var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7250
7392
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7251
- var STYLESHEET_FUNCTION_EXPANDOS = [
7393
+ var STYLESHEET_PROPS = [
7252
7394
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
7253
7395
  '$scoped$'];
7396
+ // Via https://www.npmjs.com/package/object-observer
7397
+ var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7398
+ var mutationTrackingDisabled = false;
7254
7399
  function getOriginalArrayMethod(prop) {
7255
7400
  switch (prop) {
7256
7401
  case 'pop':
@@ -7273,42 +7418,54 @@
7273
7418
  return ArrayCopyWithin;
7274
7419
  }
7275
7420
  }
7276
- var mutationWarningsSilenced = false;
7421
+ function reportViolation(type, eventId, prop) {
7422
+ if (process.env.NODE_ENV !== 'production') {
7423
+ logWarnOnce("Mutating the \"".concat(prop, "\" property on a ").concat(type, " ") + "is deprecated and will be removed in a future version of LWC. " + "See: https://lwc.dev/guide/css#deprecated-template-mutation");
7424
+ }
7425
+ report(eventId, {
7426
+ propertyName: prop
7427
+ });
7428
+ }
7429
+ function reportTemplateViolation(prop) {
7430
+ reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
7431
+ }
7432
+ function reportStylesheetViolation(prop) {
7433
+ reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
7434
+ }
7277
7435
  // Warn if the user tries to mutate a stylesheets array, e.g.:
7278
7436
  // `tmpl.stylesheets.push(someStylesheetFunction)`
7279
7437
  function warnOnArrayMutation(stylesheets) {
7280
7438
  // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
7281
7439
  // we can at least warn when they use the most common mutation methods.
7282
- var _iterator6 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
7283
- _step6;
7440
+ var _iterator8 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
7441
+ _step8;
7284
7442
  try {
7285
- var _loop3 = function _loop3() {
7286
- var prop = _step6.value;
7443
+ var _loop4 = function _loop4() {
7444
+ var prop = _step8.value;
7287
7445
  var originalArrayMethod = getOriginalArrayMethod(prop);
7288
7446
  stylesheets[prop] = function arrayMutationWarningWrapper() {
7289
- logError("Mutating the \"stylesheets\" array on a template function " + "is deprecated and may be removed in a future version of LWC.");
7447
+ reportTemplateViolation('stylesheets');
7290
7448
  // @ts-ignore
7291
7449
  return originalArrayMethod.apply(this, arguments);
7292
7450
  };
7293
7451
  };
7294
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7295
- _loop3();
7452
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7453
+ _loop4();
7296
7454
  }
7297
7455
  } catch (err) {
7298
- _iterator6.e(err);
7456
+ _iterator8.e(err);
7299
7457
  } finally {
7300
- _iterator6.f();
7458
+ _iterator8.f();
7301
7459
  }
7302
7460
  }
7303
7461
  // Warn if the user tries to mutate a stylesheet factory function, e.g.:
7304
7462
  // `stylesheet.$scoped$ = true`
7305
7463
  function warnOnStylesheetFunctionMutation(stylesheet) {
7306
- // We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
7307
- var _iterator7 = _createForOfIteratorHelper(STYLESHEET_FUNCTION_EXPANDOS),
7308
- _step7;
7464
+ var _iterator9 = _createForOfIteratorHelper(STYLESHEET_PROPS),
7465
+ _step9;
7309
7466
  try {
7310
- var _loop4 = function _loop4() {
7311
- var prop = _step7.value;
7467
+ var _loop5 = function _loop5() {
7468
+ var prop = _step9.value;
7312
7469
  var value = stylesheet[prop];
7313
7470
  defineProperty(stylesheet, prop, {
7314
7471
  enumerable: true,
@@ -7317,22 +7474,22 @@
7317
7474
  return value;
7318
7475
  },
7319
7476
  set: function set(newValue) {
7320
- logError("Dynamically setting the \"".concat(prop, "\" property on a stylesheet function ") + "is deprecated and may be removed in a future version of LWC.");
7477
+ reportStylesheetViolation(prop);
7321
7478
  value = newValue;
7322
7479
  }
7323
7480
  });
7324
7481
  };
7325
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7326
- _loop4();
7482
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
7483
+ _loop5();
7327
7484
  }
7328
7485
  } catch (err) {
7329
- _iterator7.e(err);
7486
+ _iterator9.e(err);
7330
7487
  } finally {
7331
- _iterator7.f();
7488
+ _iterator9.f();
7332
7489
  }
7333
7490
  }
7334
7491
  // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
7335
- function warnOnStylesheetsMutation(stylesheets) {
7492
+ function trackStylesheetsMutation(stylesheets) {
7336
7493
  traverseStylesheets(stylesheets, function (subStylesheets) {
7337
7494
  if (isArray$1(subStylesheets)) {
7338
7495
  warnOnArrayMutation(subStylesheets);
@@ -7350,8 +7507,8 @@
7350
7507
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
7351
7508
  function traverseStylesheets(stylesheets, callback) {
7352
7509
  callback(stylesheets);
7353
- for (var _i38 = 0; _i38 < stylesheets.length; _i38++) {
7354
- var stylesheet = stylesheets[_i38];
7510
+ for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
7511
+ var stylesheet = stylesheets[_i37];
7355
7512
  if (isArray$1(stylesheet)) {
7356
7513
  traverseStylesheets(stylesheet, callback);
7357
7514
  } else {
@@ -7359,7 +7516,80 @@
7359
7516
  }
7360
7517
  }
7361
7518
  }
7519
+ function trackMutations(tmpl) {
7520
+ if (!isUndefined$1(tmpl.stylesheets)) {
7521
+ trackStylesheetsMutation(tmpl.stylesheets);
7522
+ }
7523
+ var _iterator10 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7524
+ _step10;
7525
+ try {
7526
+ var _loop6 = function _loop6() {
7527
+ var prop = _step10.value;
7528
+ var value = tmpl[prop];
7529
+ defineProperty(tmpl, prop, {
7530
+ enumerable: true,
7531
+ configurable: true,
7532
+ get: function get() {
7533
+ return value;
7534
+ },
7535
+ set: function set(newValue) {
7536
+ if (!mutationTrackingDisabled) {
7537
+ reportTemplateViolation(prop);
7538
+ }
7539
+ value = newValue;
7540
+ }
7541
+ });
7542
+ };
7543
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
7544
+ _loop6();
7545
+ }
7546
+ } catch (err) {
7547
+ _iterator10.e(err);
7548
+ } finally {
7549
+ _iterator10.f();
7550
+ }
7551
+ var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7552
+ defineProperty(tmpl, 'stylesheetTokens', {
7553
+ enumerable: true,
7554
+ configurable: true,
7555
+ get: originalDescriptor.get,
7556
+ set: function set(value) {
7557
+ reportTemplateViolation('stylesheetTokens');
7558
+ // Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
7559
+ mutationTrackingDisabled = true;
7560
+ originalDescriptor.set.call(this, value);
7561
+ mutationTrackingDisabled = false;
7562
+ }
7563
+ });
7564
+ }
7565
+ function addLegacyStylesheetTokensShim(tmpl) {
7566
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7567
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7568
+ defineProperty(tmpl, 'stylesheetTokens', {
7569
+ enumerable: true,
7570
+ configurable: true,
7571
+ get: function get() {
7572
+ var stylesheetToken = this.stylesheetToken;
7573
+ if (isUndefined$1(stylesheetToken)) {
7574
+ return stylesheetToken;
7575
+ }
7576
+ // Shim for the old `stylesheetTokens` property
7577
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7578
+ return {
7579
+ hostAttribute: "".concat(stylesheetToken, "-host"),
7580
+ shadowAttribute: stylesheetToken
7581
+ };
7582
+ },
7583
+ set: function set(value) {
7584
+ // If the value is null or some other exotic object, you would be broken anyway in the past
7585
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7586
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7587
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7588
+ }
7589
+ });
7590
+ }
7362
7591
  function freezeTemplate(tmpl) {
7592
+ // TODO [#2782]: remove this flag and delete the legacy behavior
7363
7593
  if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
7364
7594
  // Deep freeze the template
7365
7595
  freeze(tmpl);
@@ -7367,76 +7597,16 @@
7367
7597
  deepFreeze(tmpl.stylesheets);
7368
7598
  }
7369
7599
  } else {
7370
- // TODO [#2782]: remove this flag and delete the legacy behavior
7371
- // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7372
- // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7373
- defineProperty(tmpl, 'stylesheetTokens', {
7374
- enumerable: true,
7375
- configurable: true,
7376
- get: function get() {
7377
- var stylesheetToken = this.stylesheetToken;
7378
- if (isUndefined$1(stylesheetToken)) {
7379
- return stylesheetToken;
7380
- }
7381
- // Shim for the old `stylesheetTokens` property
7382
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7383
- return {
7384
- hostAttribute: "".concat(stylesheetToken, "-host"),
7385
- shadowAttribute: stylesheetToken
7386
- };
7387
- },
7388
- set: function set(value) {
7389
- // If the value is null or some other exotic object, you would be broken anyway in the past
7390
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7391
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7392
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7393
- }
7394
- });
7395
- // When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
7600
+ // template is not frozen - shim, report, and warn
7601
+ // this shim should be applied in both dev and prod
7602
+ addLegacyStylesheetTokensShim(tmpl);
7603
+ // When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
7396
7604
  if (process.env.NODE_ENV !== 'production') {
7397
- if (!isUndefined$1(tmpl.stylesheets)) {
7398
- warnOnStylesheetsMutation(tmpl.stylesheets);
7399
- }
7400
- var _iterator8 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7401
- _step8;
7402
- try {
7403
- var _loop5 = function _loop5() {
7404
- var prop = _step8.value;
7405
- var value = tmpl[prop];
7406
- defineProperty(tmpl, prop, {
7407
- enumerable: true,
7408
- configurable: true,
7409
- get: function get() {
7410
- return value;
7411
- },
7412
- set: function set(newValue) {
7413
- if (!mutationWarningsSilenced) {
7414
- logError("Dynamically setting the \"".concat(prop, "\" property on a template function ") + "is deprecated and may be removed in a future version of LWC.");
7415
- }
7416
- value = newValue;
7417
- }
7418
- });
7419
- };
7420
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7421
- _loop5();
7422
- }
7423
- } catch (err) {
7424
- _iterator8.e(err);
7425
- } finally {
7426
- _iterator8.f();
7427
- }
7428
- var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7429
- defineProperty(tmpl, 'stylesheetTokens', {
7430
- enumerable: true,
7431
- configurable: true,
7432
- get: originalDescriptor.get,
7433
- set: function set(value) {
7434
- logError("Dynamically setting the \"stylesheetTokens\" property on a template function " + "is deprecated and may be removed in a future version of LWC.");
7435
- // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7436
- mutationWarningsSilenced = true;
7437
- originalDescriptor.set.call(this, value);
7438
- mutationWarningsSilenced = false;
7439
- }
7605
+ trackMutations(tmpl);
7606
+ } else {
7607
+ // In prod mode, we only track mutations if reporting is enabled
7608
+ onReportingEnabled(function () {
7609
+ trackMutations(tmpl);
7440
7610
  });
7441
7611
  }
7442
7612
  }
@@ -7464,7 +7634,7 @@
7464
7634
  }
7465
7635
  return ctor;
7466
7636
  }
7467
- /* version: 2.35.2 */
7637
+ /* version: 2.36.0 */
7468
7638
 
7469
7639
  /*
7470
7640
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8147,17 +8317,17 @@
8147
8317
  function flushPendingWhenDefinedCallbacks(tagName, ctor) {
8148
8318
  var resolvers = pendingWhenDefinedCallbacks.get(tagName);
8149
8319
  if (!isUndefined$1(resolvers)) {
8150
- var _iterator9 = _createForOfIteratorHelper(resolvers),
8151
- _step9;
8320
+ var _iterator11 = _createForOfIteratorHelper(resolvers),
8321
+ _step11;
8152
8322
  try {
8153
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
8154
- var resolver = _step9.value;
8323
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
8324
+ var resolver = _step11.value;
8155
8325
  resolver(ctor);
8156
8326
  }
8157
8327
  } catch (err) {
8158
- _iterator9.e(err);
8328
+ _iterator11.e(err);
8159
8329
  } finally {
8160
- _iterator9.f();
8330
+ _iterator11.f();
8161
8331
  }
8162
8332
  }
8163
8333
  pendingWhenDefinedCallbacks.delete(tagName);
@@ -8207,11 +8377,11 @@
8207
8377
  var awaiting = awaitingUpgrade.get(tagName);
8208
8378
  if (!isUndefined$1(awaiting)) {
8209
8379
  awaitingUpgrade.delete(tagName);
8210
- var _iterator10 = _createForOfIteratorHelper(awaiting),
8211
- _step10;
8380
+ var _iterator12 = _createForOfIteratorHelper(awaiting),
8381
+ _step12;
8212
8382
  try {
8213
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
8214
- var element = _step10.value;
8383
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
8384
+ var element = _step12.value;
8215
8385
  var registeredDefinition = pendingRegistryForElement.get(element);
8216
8386
  // At this point, registeredDefinition should never be undefined because awaitingUpgrade
8217
8387
  // is only populated when we haven't run internalUpgrade yet, and we only populate
@@ -8223,9 +8393,9 @@
8223
8393
  }
8224
8394
  }
8225
8395
  } catch (err) {
8226
- _iterator10.e(err);
8396
+ _iterator12.e(err);
8227
8397
  } finally {
8228
- _iterator10.f();
8398
+ _iterator12.f();
8229
8399
  }
8230
8400
  }
8231
8401
  // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
@@ -8502,7 +8672,7 @@
8502
8672
  function isNull(obj) {
8503
8673
  return obj === null;
8504
8674
  }
8505
- /** version: 2.35.2 */
8675
+ /** version: 2.36.0 */
8506
8676
 
8507
8677
  /*
8508
8678
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8561,17 +8731,17 @@
8561
8731
  exports.createFragment = function (html) {
8562
8732
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8563
8733
  if (!isUndefined(wrapperTags)) {
8564
- var _iterator11 = _createForOfIteratorHelper(wrapperTags),
8565
- _step11;
8734
+ var _iterator13 = _createForOfIteratorHelper(wrapperTags),
8735
+ _step13;
8566
8736
  try {
8567
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
8568
- var wrapperTag = _step11.value;
8737
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
8738
+ var wrapperTag = _step13.value;
8569
8739
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8570
8740
  }
8571
8741
  } catch (err) {
8572
- _iterator11.e(err);
8742
+ _iterator13.e(err);
8573
8743
  } finally {
8574
- _iterator11.f();
8744
+ _iterator13.f();
8575
8745
  }
8576
8746
  }
8577
8747
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -8580,7 +8750,7 @@
8580
8750
  doc.body.innerHTML = html;
8581
8751
  var content = doc.body;
8582
8752
  if (!isUndefined(wrapperTags)) {
8583
- for (var _i39 = 0; _i39 < wrapperTags.length; _i39++) {
8753
+ for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
8584
8754
  content = content.firstChild;
8585
8755
  }
8586
8756
  }
@@ -8773,8 +8943,8 @@
8773
8943
  tagName: element.tagName.toLowerCase(),
8774
8944
  hydrated: true
8775
8945
  });
8776
- for (var _i40 = 0, _Object$entries2 = Object.entries(props); _i40 < _Object$entries2.length; _i40++) {
8777
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i40], 2),
8946
+ for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
8947
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
8778
8948
  key = _Object$entries2$_i[0],
8779
8949
  value = _Object$entries2$_i[1];
8780
8950
  element[key] = value;
@@ -9068,7 +9238,7 @@
9068
9238
  });
9069
9239
  freeze(LightningElement);
9070
9240
  seal(LightningElement.prototype);
9071
- /* version: 2.35.2 */
9241
+ /* version: 2.36.0 */
9072
9242
 
9073
9243
  exports.LightningElement = LightningElement;
9074
9244
  exports.__unstable__ProfilerControl = profilerControl;