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
@@ -327,9 +327,9 @@ var LWC = (function (exports) {
327
327
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
328
328
  */
329
329
  // Increment whenever the LWC template compiler changes
330
- var LWC_VERSION = "2.35.2";
330
+ var LWC_VERSION = "2.36.0";
331
331
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
332
- /** version: 2.35.2 */
332
+ /** version: 2.36.0 */
333
333
 
334
334
  /**
335
335
  * Copyright (C) 2018 salesforce.com, inc.
@@ -410,7 +410,7 @@ var LWC = (function (exports) {
410
410
  setFeatureFlag(name, value);
411
411
  }
412
412
  }
413
- /** version: 2.35.2 */
413
+ /** version: 2.36.0 */
414
414
 
415
415
  /**
416
416
  * Copyright (C) 2018 salesforce.com, inc.
@@ -474,7 +474,7 @@ var LWC = (function (exports) {
474
474
  }
475
475
  }
476
476
  }
477
- /** version: 2.35.2 */
477
+ /** version: 2.36.0 */
478
478
 
479
479
  /*
480
480
  * Copyright (c) 2018, salesforce.com, inc.
@@ -540,7 +540,6 @@ var LWC = (function (exports) {
540
540
  * SPDX-License-Identifier: MIT
541
541
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
542
542
  */
543
- /** Callbacks to invoke when reporting is enabled **/
544
543
  var onReportingEnabledCallbacks = [];
545
544
  /** The currently assigned reporting dispatcher. */
546
545
  var currentDispatcher$1 = noop;
@@ -597,11 +596,11 @@ var LWC = (function (exports) {
597
596
  /**
598
597
  * Report to the current dispatcher, if there is one.
599
598
  * @param reportingEventId
600
- * @param vm
599
+ * @param payload - data to report
601
600
  */
602
- function report(reportingEventId, vm) {
601
+ function report(reportingEventId, payload) {
603
602
  if (enabled$1) {
604
- currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
603
+ currentDispatcher$1(reportingEventId, payload);
605
604
  }
606
605
  }
607
606
 
@@ -894,31 +893,39 @@ var LWC = (function (exports) {
894
893
  // Make a shallow copy of an object but omit the given key
895
894
  function cloneAndOmitKey(object, keyToOmit) {
896
895
  var result = {};
897
- for (var _i7 = 0, _Object$keys = Object.keys(object); _i7 < _Object$keys.length; _i7++) {
898
- var key = _Object$keys[_i7];
899
- if (key !== keyToOmit) {
900
- result[key] = object[key];
896
+ var _iterator2 = _createForOfIteratorHelper(keys(object)),
897
+ _step2;
898
+ try {
899
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
900
+ var key = _step2.value;
901
+ if (key !== keyToOmit) {
902
+ result[key] = object[key];
903
+ }
901
904
  }
905
+ } catch (err) {
906
+ _iterator2.e(err);
907
+ } finally {
908
+ _iterator2.f();
902
909
  }
903
910
  return result;
904
911
  }
905
912
  function flattenStylesheets(stylesheets) {
906
913
  var list = [];
907
- var _iterator2 = _createForOfIteratorHelper(stylesheets),
908
- _step2;
914
+ var _iterator3 = _createForOfIteratorHelper(stylesheets),
915
+ _step3;
909
916
  try {
910
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
911
- var stylesheet = _step2.value;
912
- if (!Array.isArray(stylesheet)) {
917
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
918
+ var stylesheet = _step3.value;
919
+ if (!isArray$1(stylesheet)) {
913
920
  list.push(stylesheet);
914
921
  } else {
915
922
  list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
916
923
  }
917
924
  }
918
925
  } catch (err) {
919
- _iterator2.e(err);
926
+ _iterator3.e(err);
920
927
  } finally {
921
- _iterator2.f();
928
+ _iterator3.f();
922
929
  }
923
930
  return list;
924
931
  }
@@ -2397,17 +2404,17 @@ var LWC = (function (exports) {
2397
2404
  var refs = refsCache.get(refVNodes);
2398
2405
  if (isUndefined$1(refs)) {
2399
2406
  refs = create(null);
2400
- var _iterator3 = _createForOfIteratorHelper(keys(refVNodes)),
2401
- _step3;
2407
+ var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
2408
+ _step4;
2402
2409
  try {
2403
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
2404
- var key = _step3.value;
2410
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
2411
+ var key = _step4.value;
2405
2412
  refs[key] = refVNodes[key].elm;
2406
2413
  }
2407
2414
  } catch (err) {
2408
- _iterator3.e(err);
2415
+ _iterator4.e(err);
2409
2416
  } finally {
2410
- _iterator3.f();
2417
+ _iterator4.f();
2411
2418
  }
2412
2419
  freeze(refs);
2413
2420
  refsCache.set(refVNodes, refs);
@@ -2489,7 +2496,7 @@ var LWC = (function (exports) {
2489
2496
  var queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
2490
2497
  // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
2491
2498
  var _loop = function _loop() {
2492
- var queryMethod = _queryMethods[_i8];
2499
+ var queryMethod = _queryMethods[_i7];
2493
2500
  queryAndChildGetterDescriptors[queryMethod] = {
2494
2501
  value: function value(arg) {
2495
2502
  var vm = getAssociatedVM(this);
@@ -2505,7 +2512,7 @@ var LWC = (function (exports) {
2505
2512
  writable: true
2506
2513
  };
2507
2514
  };
2508
- for (var _i8 = 0, _queryMethods = queryMethods; _i8 < _queryMethods.length; _i8++) {
2515
+ for (var _i7 = 0, _queryMethods = queryMethods; _i7 < _queryMethods.length; _i7++) {
2509
2516
  _loop();
2510
2517
  }
2511
2518
  defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
@@ -2818,16 +2825,16 @@ var LWC = (function (exports) {
2818
2825
  }
2819
2826
  function connectWireAdapters(vm) {
2820
2827
  var wiredConnecting = vm.context.wiredConnecting;
2821
- for (var _i9 = 0, len = wiredConnecting.length; _i9 < len; _i9 += 1) {
2822
- wiredConnecting[_i9]();
2828
+ for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
2829
+ wiredConnecting[_i8]();
2823
2830
  }
2824
2831
  }
2825
2832
  function disconnectWireAdapters(vm) {
2826
2833
  var wiredDisconnecting = vm.context.wiredDisconnecting;
2827
2834
  runWithBoundaryProtection(vm, vm, noop, function () {
2828
2835
  // job
2829
- for (var _i10 = 0, len = wiredDisconnecting.length; _i10 < len; _i10 += 1) {
2830
- wiredDisconnecting[_i10]();
2836
+ for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
2837
+ wiredDisconnecting[_i9]();
2831
2838
  }
2832
2839
  }, noop);
2833
2840
  }
@@ -3161,8 +3168,8 @@ var LWC = (function (exports) {
3161
3168
  }
3162
3169
  }
3163
3170
  if (!isUndefined$1(fields)) {
3164
- for (var _i11 = 0, n = fields.length; _i11 < n; _i11++) {
3165
- var _fieldName2 = fields[_i11];
3171
+ for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
3172
+ var _fieldName2 = fields[_i10];
3166
3173
  descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
3167
3174
  if (process.env.NODE_ENV !== 'production') {
3168
3175
  validateObservedField(Ctor, _fieldName2, descriptor);
@@ -3234,6 +3241,10 @@ var LWC = (function (exports) {
3234
3241
  // stylesheets and templates do not have user-meaningful names, but components do
3235
3242
  var friendlyName = type === 'component' ? "".concat(type, " ").concat(func.name) : type;
3236
3243
  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."));
3244
+ report(1 /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
3245
+ compilerVersion: version,
3246
+ runtimeVersion: LWC_VERSION
3247
+ });
3237
3248
  }
3238
3249
  }
3239
3250
  }
@@ -3384,8 +3395,8 @@ var LWC = (function (exports) {
3384
3395
  superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
3385
3396
  var descriptors = create(null);
3386
3397
  // expose getters and setters for each public props on the new Element Bridge
3387
- for (var _i12 = 0, len = props.length; _i12 < len; _i12 += 1) {
3388
- var _propName = props[_i12];
3398
+ for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
3399
+ var _propName = props[_i11];
3389
3400
  attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
3390
3401
  descriptors[_propName] = {
3391
3402
  get: createGetter(_propName),
@@ -3395,8 +3406,8 @@ var LWC = (function (exports) {
3395
3406
  };
3396
3407
  }
3397
3408
  // expose public methods as props on the new Element Bridge
3398
- for (var _i13 = 0, _len = methods.length; _i13 < _len; _i13 += 1) {
3399
- var methodName = methods[_i13];
3409
+ for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
3410
+ var methodName = methods[_i12];
3400
3411
  descriptors[methodName] = {
3401
3412
  value: createMethodCaller(methodName),
3402
3413
  writable: true,
@@ -3925,8 +3936,8 @@ var LWC = (function (exports) {
3925
3936
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3926
3937
  var content = [];
3927
3938
  var root;
3928
- for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
3929
- var stylesheet = stylesheets[_i14];
3939
+ for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
3940
+ var stylesheet = stylesheets[_i13];
3930
3941
  if (isArray$1(stylesheet)) {
3931
3942
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3932
3943
  } else {
@@ -4034,8 +4045,8 @@ var LWC = (function (exports) {
4034
4045
  shadowMode = vm.shadowMode,
4035
4046
  insertStylesheet = vm.renderer.insertStylesheet;
4036
4047
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
4037
- for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4038
- insertStylesheet(stylesheets[_i15]);
4048
+ for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
4049
+ insertStylesheet(stylesheets[_i14]);
4039
4050
  }
4040
4051
  } else if (vm.hydrated) {
4041
4052
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
@@ -4048,8 +4059,8 @@ var LWC = (function (exports) {
4048
4059
  var root = getNearestNativeShadowComponent(vm);
4049
4060
  // null root means a global style
4050
4061
  var target = isNull(root) ? undefined : root.shadowRoot;
4051
- for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
4052
- insertStylesheet(stylesheets[_i16], target);
4062
+ for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
4063
+ insertStylesheet(stylesheets[_i15], target);
4053
4064
  }
4054
4065
  }
4055
4066
  return null;
@@ -4363,8 +4374,8 @@ var LWC = (function (exports) {
4363
4374
  return;
4364
4375
  }
4365
4376
  var setCSSStyleProperty = renderer.setCSSStyleProperty;
4366
- for (var _i17 = 0; _i17 < styleDecls.length; _i17++) {
4367
- var _styleDecls$_i = _slicedToArray(styleDecls[_i17], 3),
4377
+ for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
4378
+ var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
4368
4379
  prop = _styleDecls$_i[0],
4369
4380
  value = _styleDecls$_i[1],
4370
4381
  important = _styleDecls$_i[2];
@@ -4846,8 +4857,8 @@ var LWC = (function (exports) {
4846
4857
  // If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
4847
4858
  var nodeStack = [];
4848
4859
  var fragmentFound = false;
4849
- for (var _i18 = children.length - 1; _i18 > -1; _i18 -= 1) {
4850
- var child = children[_i18];
4860
+ for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
4861
+ var child = children[_i17];
4851
4862
  ArrayPush$1.call(nodeStack, child);
4852
4863
  fragmentFound = fragmentFound || !!(child && isVFragment(child));
4853
4864
  }
@@ -4859,8 +4870,8 @@ var LWC = (function (exports) {
4859
4870
  if (!isNull(currentNode) && isVFragment(currentNode)) {
4860
4871
  var fChildren = currentNode.children;
4861
4872
  // Ignore the start and end text node delimiters
4862
- for (var _i19 = fChildren.length - 2; _i19 > 0; _i19 -= 1) {
4863
- ArrayPush$1.call(nodeStack, fChildren[_i19]);
4873
+ for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
4874
+ ArrayPush$1.call(nodeStack, fChildren[_i18]);
4864
4875
  }
4865
4876
  } else {
4866
4877
  ArrayPush$1.call(flattenedChildren, currentNode);
@@ -4899,8 +4910,8 @@ var LWC = (function (exports) {
4899
4910
  var oldSlotsMapping = vm.cmpSlots.slotAssignments;
4900
4911
  var cmpSlotsMapping = create(null);
4901
4912
  // Collect all slots into cmpSlotsMapping
4902
- for (var _i20 = 0, len = children.length; _i20 < len; _i20 += 1) {
4903
- var vnode = children[_i20];
4913
+ for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
4914
+ var vnode = children[_i19];
4904
4915
  if (isNull(vnode)) {
4905
4916
  continue;
4906
4917
  }
@@ -4910,7 +4921,12 @@ var LWC = (function (exports) {
4910
4921
  } else if (isVScopedSlotFragment(vnode)) {
4911
4922
  slotName = vnode.slotName;
4912
4923
  }
4913
- var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4924
+ // Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
4925
+ // but elm.setAttribute('slot', Symbol(1)) is an error.
4926
+ // the following line also throws same error for symbols
4927
+ // Similar for Object.create(null)
4928
+ var normalizedSlotName = '' + slotName;
4929
+ var vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
4914
4930
  ArrayPush$1.call(vnodes, vnode);
4915
4931
  }
4916
4932
  vm.cmpSlots = {
@@ -4925,8 +4941,8 @@ var LWC = (function (exports) {
4925
4941
  markComponentAsDirty(vm);
4926
4942
  return;
4927
4943
  }
4928
- for (var _i21 = 0, _len2 = oldKeys.length; _i21 < _len2; _i21 += 1) {
4929
- var key = oldKeys[_i21];
4944
+ for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
4945
+ var key = oldKeys[_i20];
4930
4946
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4931
4947
  markComponentAsDirty(vm);
4932
4948
  return;
@@ -5049,11 +5065,11 @@ var LWC = (function (exports) {
5049
5065
  if (oldStartIdx > oldEndIdx) {
5050
5066
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
5051
5067
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
5052
- var _i22 = newEndIdx;
5068
+ var _i21 = newEndIdx;
5053
5069
  var n;
5054
5070
  do {
5055
- n = newCh[++_i22];
5056
- } while (!isVNode(n) && _i22 < newChEnd);
5071
+ n = newCh[++_i21];
5072
+ } while (!isVNode(n) && _i21 < newChEnd);
5057
5073
  before = isVNode(n) ? n.elm : null;
5058
5074
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
5059
5075
  } else {
@@ -5078,9 +5094,9 @@ var LWC = (function (exports) {
5078
5094
  // if the old list is not empty, the new list MUST have the same
5079
5095
  // amount of nodes, that's why we call this static children
5080
5096
  var anchor = null;
5081
- for (var _i23 = c2Length - 1; _i23 >= 0; _i23 -= 1) {
5082
- var n1 = c1[_i23];
5083
- var n2 = c2[_i23];
5097
+ for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
5098
+ var n1 = c1[_i22];
5099
+ var n2 = c2[_i22];
5084
5100
  if (n2 !== n1) {
5085
5101
  if (isVNode(n1)) {
5086
5102
  if (isVNode(n2)) {
@@ -5205,8 +5221,8 @@ var LWC = (function (exports) {
5205
5221
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
5206
5222
  var newChildren = [];
5207
5223
  var slotAssignments = slotset.slotAssignments[slotName];
5208
- for (var _i24 = 0; _i24 < slotAssignments.length; _i24++) {
5209
- var vnode = slotAssignments[_i24];
5224
+ for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
5225
+ var vnode = slotAssignments[_i23];
5210
5226
  if (!isNull(vnode)) {
5211
5227
  var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
5212
5228
  // The only sniff test for a scoped <slot> element is the presence of `slotData`
@@ -5728,23 +5744,23 @@ var LWC = (function (exports) {
5728
5744
  var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
5729
5745
  var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
5730
5746
  var htmlFragment = '';
5731
- for (var _i25 = 0, n = keys.length; _i25 < n; _i25++) {
5732
- switch (keys[_i25]) {
5747
+ for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
5748
+ switch (keys[_i24]) {
5733
5749
  case 0:
5734
5750
  // styleToken in existing class attr
5735
- htmlFragment += strings[_i25] + classToken;
5751
+ htmlFragment += strings[_i24] + classToken;
5736
5752
  break;
5737
5753
  case 1:
5738
5754
  // styleToken for added class attr
5739
- htmlFragment += strings[_i25] + classAttrToken;
5755
+ htmlFragment += strings[_i24] + classAttrToken;
5740
5756
  break;
5741
5757
  case 2:
5742
5758
  // styleToken as attr
5743
- htmlFragment += strings[_i25] + attrToken;
5759
+ htmlFragment += strings[_i24] + attrToken;
5744
5760
  break;
5745
5761
  case 3:
5746
5762
  // ${1}${2}
5747
- htmlFragment += strings[_i25] + classAttrToken + attrToken;
5763
+ htmlFragment += strings[_i24] + classAttrToken + attrToken;
5748
5764
  break;
5749
5765
  }
5750
5766
  }
@@ -5849,8 +5865,8 @@ var LWC = (function (exports) {
5849
5865
  }
5850
5866
  function computeHasScopedStylesInStylesheets(stylesheets) {
5851
5867
  if (hasStyles(stylesheets)) {
5852
- for (var _i26 = 0; _i26 < stylesheets.length; _i26++) {
5853
- if (isTrue(stylesheets[_i26][KEY__SCOPED_CSS])) {
5868
+ for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
5869
+ if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
5854
5870
  return true;
5855
5871
  }
5856
5872
  }
@@ -5974,6 +5990,8 @@ var LWC = (function (exports) {
5974
5990
  var tmpl = _ref4.tmpl;
5975
5991
  if (isFunction$1(Ctor)) {
5976
5992
  if (process.env.NODE_ENV !== 'production') {
5993
+ // There is no point in running this in production, because the version mismatch check relies
5994
+ // on code comments which are stripped out in production by minifiers
5977
5995
  checkVersionMismatch(Ctor, 'component');
5978
5996
  }
5979
5997
  signedTemplateMap.set(Ctor, tmpl);
@@ -6046,8 +6064,8 @@ var LWC = (function (exports) {
6046
6064
  if (process.env.NODE_ENV !== 'production') {
6047
6065
  assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
6048
6066
  }
6049
- for (var _i27 = 0; _i27 < hooks.length; ++_i27) {
6050
- var hookName = hooks[_i27];
6067
+ for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
6068
+ var hookName = hooks[_i26];
6051
6069
  if (hookName in service) {
6052
6070
  var l = Services[hookName];
6053
6071
  if (isUndefined$1(l)) {
@@ -6064,8 +6082,8 @@ var LWC = (function (exports) {
6064
6082
  var component = vm.component,
6065
6083
  def = vm.def,
6066
6084
  context = vm.context;
6067
- for (var _i28 = 0, len = cbs.length; _i28 < len; ++_i28) {
6068
- cbs[_i28].call(undefined, component, {}, def, context);
6085
+ for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
6086
+ cbs[_i27].call(undefined, component, {}, def, context);
6069
6087
  }
6070
6088
  }
6071
6089
 
@@ -6219,8 +6237,8 @@ var LWC = (function (exports) {
6219
6237
  var valid = true;
6220
6238
  var validate = function validate(arrayOrStylesheet) {
6221
6239
  if (isArray$1(arrayOrStylesheet)) {
6222
- for (var _i29 = 0; _i29 < arrayOrStylesheet.length; _i29++) {
6223
- validate(arrayOrStylesheet[_i29]);
6240
+ for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
6241
+ validate(arrayOrStylesheet[_i28]);
6224
6242
  }
6225
6243
  } else if (!isFunction$1(arrayOrStylesheet)) {
6226
6244
  // function assumed to be a stylesheet factory
@@ -6237,6 +6255,7 @@ var LWC = (function (exports) {
6237
6255
  // Validate and flatten any stylesheets defined as `static stylesheets`
6238
6256
  function computeStylesheets(vm, ctor) {
6239
6257
  if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
6258
+ warnOnStylesheetsMutation(ctor);
6240
6259
  var stylesheets = ctor.stylesheets;
6241
6260
  if (!isUndefined$1(stylesheets)) {
6242
6261
  var valid = validateComponentStylesheets(vm, stylesheets);
@@ -6249,6 +6268,22 @@ var LWC = (function (exports) {
6249
6268
  }
6250
6269
  return null;
6251
6270
  }
6271
+ function warnOnStylesheetsMutation(ctor) {
6272
+ if (process.env.NODE_ENV !== 'production') {
6273
+ var stylesheets = ctor.stylesheets;
6274
+ defineProperty(ctor, 'stylesheets', {
6275
+ enumerable: true,
6276
+ configurable: true,
6277
+ get: function get() {
6278
+ return stylesheets;
6279
+ },
6280
+ set: function set(newValue) {
6281
+ logWarnOnce("Dynamically setting the \"stylesheets\" static property on ".concat(ctor.name, " ") + 'will not affect the stylesheets injected.');
6282
+ stylesheets = newValue;
6283
+ }
6284
+ });
6285
+ }
6286
+ }
6252
6287
  function computeShadowMode(vm, renderer) {
6253
6288
  var def = vm.def;
6254
6289
  var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
@@ -6373,17 +6408,17 @@ var LWC = (function (exports) {
6373
6408
  return a.idx - b.idx;
6374
6409
  });
6375
6410
  rehydrateQueue = []; // reset to a new queue
6376
- for (var _i30 = 0, len = vms.length; _i30 < len; _i30 += 1) {
6377
- var vm = vms[_i30];
6411
+ for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
6412
+ var vm = vms[_i29];
6378
6413
  try {
6379
6414
  rehydrate(vm);
6380
6415
  } catch (error) {
6381
- if (_i30 + 1 < len) {
6416
+ if (_i29 + 1 < len) {
6382
6417
  // pieces of the queue are still pending to be rehydrated, those should have priority
6383
6418
  if (rehydrateQueue.length === 0) {
6384
6419
  addCallbackToNextTick(flushRehydrationQueue);
6385
6420
  }
6386
- ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i30 + 1));
6421
+ ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
6387
6422
  }
6388
6423
  // we need to end the measure before throwing.
6389
6424
  logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
@@ -6452,8 +6487,8 @@ var LWC = (function (exports) {
6452
6487
  var vCustomElementCollection = vm.velements;
6453
6488
  // Reporting disconnection for every child in inverse order since they are
6454
6489
  // inserted in reserved order.
6455
- for (var _i31 = vCustomElementCollection.length - 1; _i31 >= 0; _i31 -= 1) {
6456
- var elm = vCustomElementCollection[_i31].elm;
6490
+ for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
6491
+ var elm = vCustomElementCollection[_i30].elm;
6457
6492
  // There are two cases where the element could be undefined:
6458
6493
  // * when there is an error during the construction phase, and an error
6459
6494
  // boundary picks it, there is a possibility that the VCustomElement
@@ -6484,8 +6519,8 @@ var LWC = (function (exports) {
6484
6519
  * defined on its shadow.
6485
6520
  */
6486
6521
  function recursivelyDisconnectChildren(vnodes) {
6487
- for (var _i32 = 0, len = vnodes.length; _i32 < len; _i32 += 1) {
6488
- var vnode = vnodes[_i32];
6522
+ for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
6523
+ var vnode = vnodes[_i31];
6489
6524
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
6490
6525
  switch (vnode.type) {
6491
6526
  case 2 /* VNodeType.Element */:
@@ -6509,8 +6544,8 @@ var LWC = (function (exports) {
6509
6544
  var children = vm.children,
6510
6545
  renderRoot = vm.renderRoot,
6511
6546
  remove = vm.renderer.remove;
6512
- for (var _i33 = 0, len = children.length; _i33 < len; _i33++) {
6513
- var child = children[_i33];
6547
+ for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
6548
+ var child = children[_i32];
6514
6549
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6515
6550
  remove(child.elm, renderRoot);
6516
6551
  }
@@ -6600,7 +6635,7 @@ var LWC = (function (exports) {
6600
6635
  function isSyntheticShadowRootInstance(rootNode) {
6601
6636
  return rootNode !== document && isTrue(rootNode.synthetic);
6602
6637
  }
6603
- function reportViolation(source, target, attrName) {
6638
+ function reportViolation$1(source, target, attrName) {
6604
6639
  // The vm is either for the source, the target, or both. Either one or both must be using synthetic
6605
6640
  // shadow for a violation to be detected.
6606
6641
  var vm = getAssociatedVMIfPresent(source.getRootNode().host);
@@ -6611,7 +6646,10 @@ var LWC = (function (exports) {
6611
6646
  // vm should never be undefined here, but just to be safe, bail out and don't report
6612
6647
  return;
6613
6648
  }
6614
- report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
6649
+ report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
6650
+ tagName: vm.tagName,
6651
+ attributeName: attrName
6652
+ });
6615
6653
  if (process.env.NODE_ENV !== 'production') {
6616
6654
  // Avoid excessively logging to the console in the case of duplicates.
6617
6655
  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);
@@ -6632,57 +6670,57 @@ var LWC = (function (exports) {
6632
6670
  // if our id is null or empty, nobody can reference us
6633
6671
  return;
6634
6672
  }
6635
- var _iterator4 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
6636
- _step4;
6673
+ var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
6674
+ _step5;
6637
6675
  try {
6638
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
6639
- var idRefAttrName = _step4.value;
6676
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6677
+ var idRefAttrName = _step5.value;
6640
6678
  // Query all global elements with this attribute. The attribute selector syntax `~=` is for values
6641
6679
  // that reference multiple IDs, separated by whitespace.
6642
6680
  var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
6643
6681
  var sourceElements = querySelectorAll.call(document, query);
6644
- for (var _i34 = 0; _i34 < sourceElements.length; _i34++) {
6645
- var sourceElement = sourceElements[_i34];
6682
+ for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
6683
+ var sourceElement = sourceElements[_i33];
6646
6684
  var sourceRoot = sourceElement.getRootNode();
6647
6685
  if (sourceRoot !== root) {
6648
- reportViolation(sourceElement, elm, idRefAttrName);
6686
+ reportViolation$1(sourceElement, elm, idRefAttrName);
6649
6687
  break;
6650
6688
  }
6651
6689
  }
6652
6690
  }
6653
6691
  } catch (err) {
6654
- _iterator4.e(err);
6692
+ _iterator5.e(err);
6655
6693
  } finally {
6656
- _iterator4.f();
6694
+ _iterator5.f();
6657
6695
  }
6658
6696
  } else {
6659
6697
  // elm is the source, find the target
6660
6698
  var ids = parseIdRefAttributeValue(attrValue);
6661
- var _iterator5 = _createForOfIteratorHelper(ids),
6662
- _step5;
6699
+ var _iterator6 = _createForOfIteratorHelper(ids),
6700
+ _step6;
6663
6701
  try {
6664
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
6665
- var id = _step5.value;
6702
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
6703
+ var id = _step6.value;
6666
6704
  var target = getElementById.call(document, id);
6667
6705
  if (!isNull(target)) {
6668
6706
  var targetRoot = target.getRootNode();
6669
6707
  if (targetRoot !== root) {
6670
6708
  // target element's shadow root is not the same as ours
6671
- reportViolation(elm, target, attrName);
6709
+ reportViolation$1(elm, target, attrName);
6672
6710
  }
6673
6711
  }
6674
6712
  }
6675
6713
  } catch (err) {
6676
- _iterator5.e(err);
6714
+ _iterator6.e(err);
6677
6715
  } finally {
6678
- _iterator5.f();
6716
+ _iterator6.f();
6679
6717
  }
6680
6718
  }
6681
6719
  }
6682
6720
  var enabled = false;
6683
6721
  // We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
6684
6722
  // reporting is not enabled. It should also only run once
6685
- function enableDetection() {
6723
+ function enableDetection$1() {
6686
6724
  if (enabled) {
6687
6725
  return; // don't double-apply the patches
6688
6726
  }
@@ -6736,10 +6774,116 @@ var LWC = (function (exports) {
6736
6774
  if (supportsCssEscape() && isSyntheticShadowLoaded()) {
6737
6775
  // Always run detection in dev mode, so we can at least print to the console
6738
6776
  if (process.env.NODE_ENV !== 'production') {
6739
- enableDetection();
6777
+ enableDetection$1();
6740
6778
  } else {
6741
6779
  // In prod mode, only enable detection if reporting is enabled
6742
- onReportingEnabled(enableDetection);
6780
+ onReportingEnabled(enableDetection$1);
6781
+ }
6782
+ }
6783
+
6784
+ /*
6785
+ * Copyright (c) 2018, salesforce.com, inc.
6786
+ * All rights reserved.
6787
+ * SPDX-License-Identifier: MIT
6788
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6789
+ */
6790
+ //
6791
+ // The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
6792
+ // legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
6793
+ //
6794
+ // See the README for @lwc/aria-reflection
6795
+ var NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
6796
+ function isLightningElement(elm) {
6797
+ // The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
6798
+ // In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
6799
+ return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
6800
+ }
6801
+ function findVM(elm) {
6802
+ // If it's a shadow DOM component, then it has a host
6803
+ var _elm$getRootNode = elm.getRootNode(),
6804
+ host = _elm$getRootNode.host;
6805
+ var vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
6806
+ if (!isUndefined$1(vm)) {
6807
+ return vm;
6808
+ }
6809
+ // Else it might be a light DOM component. Walk up the tree trying to find the owner
6810
+ var parentElement = elm;
6811
+ while (!isNull(parentElement = parentElement.parentElement)) {
6812
+ if (isLightningElement(parentElement)) {
6813
+ var _vm = getAssociatedVMIfPresent(parentElement);
6814
+ if (!isUndefined$1(_vm)) {
6815
+ return _vm;
6816
+ }
6817
+ }
6818
+ }
6819
+ // If we return undefined, it's because the element was rendered wholly outside a LightningElement
6820
+ }
6821
+
6822
+ function checkAndReportViolation(elm, prop) {
6823
+ if (!isLightningElement(elm)) {
6824
+ var vm = findVM(elm);
6825
+ if (process.env.NODE_ENV !== 'production') {
6826
+ 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");
6827
+ }
6828
+ report(2 /* ReportingEventId.NonStandardAriaReflection */, {
6829
+ tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
6830
+ propertyName: prop
6831
+ });
6832
+ }
6833
+ }
6834
+ function enableDetection() {
6835
+ var _Element = Element,
6836
+ prototype = _Element.prototype;
6837
+ var _iterator7 = _createForOfIteratorHelper(NON_STANDARD_ARIA_PROPS),
6838
+ _step7;
6839
+ try {
6840
+ var _loop3 = function _loop3() {
6841
+ var prop = _step7.value;
6842
+ var descriptor = getOwnPropertyDescriptor$1(prototype, prop);
6843
+ // The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
6844
+ // This happens automatically because of the ordering of imports.
6845
+ if (process.env.NODE_ENV !== 'production') {
6846
+ /* istanbul ignore if */
6847
+ if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
6848
+ // should never happen
6849
+ throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
6850
+ }
6851
+ }
6852
+ // @ts-ignore
6853
+ var _get4 = descriptor.get,
6854
+ _set4 = descriptor.set;
6855
+ defineProperty(prototype, prop, {
6856
+ get: function get() {
6857
+ checkAndReportViolation(this, prop);
6858
+ return _get4.call(this);
6859
+ },
6860
+ set: function set(val) {
6861
+ checkAndReportViolation(this, prop);
6862
+ return _set4.call(this, val);
6863
+ },
6864
+ configurable: true,
6865
+ enumerable: true
6866
+ });
6867
+ };
6868
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
6869
+ _loop3();
6870
+ }
6871
+ } catch (err) {
6872
+ _iterator7.e(err);
6873
+ } finally {
6874
+ _iterator7.f();
6875
+ }
6876
+ }
6877
+ // No point in running this code if we're not in a browser, or if the global polyfill is not loaded
6878
+ {
6879
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
6880
+ // Always run detection in dev mode, so we can at least print to the console
6881
+ if (process.env.NODE_ENV !== 'production') {
6882
+ enableDetection();
6883
+ } else {
6884
+ // In prod mode, only enable detection if reporting is enabled
6885
+ onReportingEnabled(enableDetection);
6886
+ }
6743
6887
  }
6744
6888
  }
6745
6889
 
@@ -6977,8 +7121,8 @@ var LWC = (function (exports) {
6977
7121
  var nextNode = node;
6978
7122
  var anchor = null;
6979
7123
  var renderer = owner.renderer;
6980
- for (var _i35 = 0; _i35 < children.length; _i35++) {
6981
- var childVnode = children[_i35];
7124
+ for (var _i34 = 0; _i34 < children.length; _i34++) {
7125
+ var childVnode = children[_i34];
6982
7126
  if (!isNull(childVnode)) {
6983
7127
  if (nextNode) {
6984
7128
  nextNode = hydrateNode(nextNode, childVnode, renderer);
@@ -7056,8 +7200,8 @@ var LWC = (function (exports) {
7056
7200
  var nodesAreCompatible = true;
7057
7201
  // Validate attributes, though we could always recovery from those by running the update mods.
7058
7202
  // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
7059
- for (var _i36 = 0, _Object$entries = Object.entries(attrs); _i36 < _Object$entries.length; _i36++) {
7060
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i36], 2),
7203
+ for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
7204
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
7061
7205
  attrName = _Object$entries$_i[0],
7062
7206
  attrValue = _Object$entries$_i[1];
7063
7207
  var owner = vnode.owner;
@@ -7158,8 +7302,8 @@ var LWC = (function (exports) {
7158
7302
  var parsedVnodeStyle = parseStyleText(elmStyle);
7159
7303
  var expectedStyle = [];
7160
7304
  // styleMap is used when style is set to static value.
7161
- for (var _i37 = 0, n = styleDecls.length; _i37 < n; _i37++) {
7162
- var _styleDecls$_i2 = _slicedToArray(styleDecls[_i37], 3),
7305
+ for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
7306
+ var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
7163
7307
  prop = _styleDecls$_i2[0],
7164
7308
  value = _styleDecls$_i2[1],
7165
7309
  important = _styleDecls$_i2[2];
@@ -7242,12 +7386,13 @@ var LWC = (function (exports) {
7242
7386
  */
7243
7387
  // See @lwc/engine-core/src/framework/template.ts
7244
7388
  var TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7245
- // Via https://www.npmjs.com/package/object-observer
7246
- var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7247
7389
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7248
- var STYLESHEET_FUNCTION_EXPANDOS = [
7390
+ var STYLESHEET_PROPS = [
7249
7391
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
7250
7392
  '$scoped$'];
7393
+ // Via https://www.npmjs.com/package/object-observer
7394
+ var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7395
+ var mutationTrackingDisabled = false;
7251
7396
  function getOriginalArrayMethod(prop) {
7252
7397
  switch (prop) {
7253
7398
  case 'pop':
@@ -7270,42 +7415,54 @@ var LWC = (function (exports) {
7270
7415
  return ArrayCopyWithin;
7271
7416
  }
7272
7417
  }
7273
- var mutationWarningsSilenced = false;
7418
+ function reportViolation(type, eventId, prop) {
7419
+ if (process.env.NODE_ENV !== 'production') {
7420
+ 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");
7421
+ }
7422
+ report(eventId, {
7423
+ propertyName: prop
7424
+ });
7425
+ }
7426
+ function reportTemplateViolation(prop) {
7427
+ reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
7428
+ }
7429
+ function reportStylesheetViolation(prop) {
7430
+ reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
7431
+ }
7274
7432
  // Warn if the user tries to mutate a stylesheets array, e.g.:
7275
7433
  // `tmpl.stylesheets.push(someStylesheetFunction)`
7276
7434
  function warnOnArrayMutation(stylesheets) {
7277
7435
  // We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
7278
7436
  // we can at least warn when they use the most common mutation methods.
7279
- var _iterator6 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
7280
- _step6;
7437
+ var _iterator8 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
7438
+ _step8;
7281
7439
  try {
7282
- var _loop3 = function _loop3() {
7283
- var prop = _step6.value;
7440
+ var _loop4 = function _loop4() {
7441
+ var prop = _step8.value;
7284
7442
  var originalArrayMethod = getOriginalArrayMethod(prop);
7285
7443
  stylesheets[prop] = function arrayMutationWarningWrapper() {
7286
- logError("Mutating the \"stylesheets\" array on a template function " + "is deprecated and may be removed in a future version of LWC.");
7444
+ reportTemplateViolation('stylesheets');
7287
7445
  // @ts-ignore
7288
7446
  return originalArrayMethod.apply(this, arguments);
7289
7447
  };
7290
7448
  };
7291
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
7292
- _loop3();
7449
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7450
+ _loop4();
7293
7451
  }
7294
7452
  } catch (err) {
7295
- _iterator6.e(err);
7453
+ _iterator8.e(err);
7296
7454
  } finally {
7297
- _iterator6.f();
7455
+ _iterator8.f();
7298
7456
  }
7299
7457
  }
7300
7458
  // Warn if the user tries to mutate a stylesheet factory function, e.g.:
7301
7459
  // `stylesheet.$scoped$ = true`
7302
7460
  function warnOnStylesheetFunctionMutation(stylesheet) {
7303
- // We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
7304
- var _iterator7 = _createForOfIteratorHelper(STYLESHEET_FUNCTION_EXPANDOS),
7305
- _step7;
7461
+ var _iterator9 = _createForOfIteratorHelper(STYLESHEET_PROPS),
7462
+ _step9;
7306
7463
  try {
7307
- var _loop4 = function _loop4() {
7308
- var prop = _step7.value;
7464
+ var _loop5 = function _loop5() {
7465
+ var prop = _step9.value;
7309
7466
  var value = stylesheet[prop];
7310
7467
  defineProperty(stylesheet, prop, {
7311
7468
  enumerable: true,
@@ -7314,22 +7471,22 @@ var LWC = (function (exports) {
7314
7471
  return value;
7315
7472
  },
7316
7473
  set: function set(newValue) {
7317
- logError("Dynamically setting the \"".concat(prop, "\" property on a stylesheet function ") + "is deprecated and may be removed in a future version of LWC.");
7474
+ reportStylesheetViolation(prop);
7318
7475
  value = newValue;
7319
7476
  }
7320
7477
  });
7321
7478
  };
7322
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
7323
- _loop4();
7479
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
7480
+ _loop5();
7324
7481
  }
7325
7482
  } catch (err) {
7326
- _iterator7.e(err);
7483
+ _iterator9.e(err);
7327
7484
  } finally {
7328
- _iterator7.f();
7485
+ _iterator9.f();
7329
7486
  }
7330
7487
  }
7331
7488
  // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
7332
- function warnOnStylesheetsMutation(stylesheets) {
7489
+ function trackStylesheetsMutation(stylesheets) {
7333
7490
  traverseStylesheets(stylesheets, function (subStylesheets) {
7334
7491
  if (isArray$1(subStylesheets)) {
7335
7492
  warnOnArrayMutation(subStylesheets);
@@ -7347,8 +7504,8 @@ var LWC = (function (exports) {
7347
7504
  // Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
7348
7505
  function traverseStylesheets(stylesheets, callback) {
7349
7506
  callback(stylesheets);
7350
- for (var _i38 = 0; _i38 < stylesheets.length; _i38++) {
7351
- var stylesheet = stylesheets[_i38];
7507
+ for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
7508
+ var stylesheet = stylesheets[_i37];
7352
7509
  if (isArray$1(stylesheet)) {
7353
7510
  traverseStylesheets(stylesheet, callback);
7354
7511
  } else {
@@ -7356,7 +7513,80 @@ var LWC = (function (exports) {
7356
7513
  }
7357
7514
  }
7358
7515
  }
7516
+ function trackMutations(tmpl) {
7517
+ if (!isUndefined$1(tmpl.stylesheets)) {
7518
+ trackStylesheetsMutation(tmpl.stylesheets);
7519
+ }
7520
+ var _iterator10 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7521
+ _step10;
7522
+ try {
7523
+ var _loop6 = function _loop6() {
7524
+ var prop = _step10.value;
7525
+ var value = tmpl[prop];
7526
+ defineProperty(tmpl, prop, {
7527
+ enumerable: true,
7528
+ configurable: true,
7529
+ get: function get() {
7530
+ return value;
7531
+ },
7532
+ set: function set(newValue) {
7533
+ if (!mutationTrackingDisabled) {
7534
+ reportTemplateViolation(prop);
7535
+ }
7536
+ value = newValue;
7537
+ }
7538
+ });
7539
+ };
7540
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
7541
+ _loop6();
7542
+ }
7543
+ } catch (err) {
7544
+ _iterator10.e(err);
7545
+ } finally {
7546
+ _iterator10.f();
7547
+ }
7548
+ var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7549
+ defineProperty(tmpl, 'stylesheetTokens', {
7550
+ enumerable: true,
7551
+ configurable: true,
7552
+ get: originalDescriptor.get,
7553
+ set: function set(value) {
7554
+ reportTemplateViolation('stylesheetTokens');
7555
+ // Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
7556
+ mutationTrackingDisabled = true;
7557
+ originalDescriptor.set.call(this, value);
7558
+ mutationTrackingDisabled = false;
7559
+ }
7560
+ });
7561
+ }
7562
+ function addLegacyStylesheetTokensShim(tmpl) {
7563
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7564
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7565
+ defineProperty(tmpl, 'stylesheetTokens', {
7566
+ enumerable: true,
7567
+ configurable: true,
7568
+ get: function get() {
7569
+ var stylesheetToken = this.stylesheetToken;
7570
+ if (isUndefined$1(stylesheetToken)) {
7571
+ return stylesheetToken;
7572
+ }
7573
+ // Shim for the old `stylesheetTokens` property
7574
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7575
+ return {
7576
+ hostAttribute: "".concat(stylesheetToken, "-host"),
7577
+ shadowAttribute: stylesheetToken
7578
+ };
7579
+ },
7580
+ set: function set(value) {
7581
+ // If the value is null or some other exotic object, you would be broken anyway in the past
7582
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7583
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7584
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7585
+ }
7586
+ });
7587
+ }
7359
7588
  function freezeTemplate(tmpl) {
7589
+ // TODO [#2782]: remove this flag and delete the legacy behavior
7360
7590
  if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
7361
7591
  // Deep freeze the template
7362
7592
  freeze(tmpl);
@@ -7364,76 +7594,16 @@ var LWC = (function (exports) {
7364
7594
  deepFreeze(tmpl.stylesheets);
7365
7595
  }
7366
7596
  } else {
7367
- // TODO [#2782]: remove this flag and delete the legacy behavior
7368
- // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7369
- // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7370
- defineProperty(tmpl, 'stylesheetTokens', {
7371
- enumerable: true,
7372
- configurable: true,
7373
- get: function get() {
7374
- var stylesheetToken = this.stylesheetToken;
7375
- if (isUndefined$1(stylesheetToken)) {
7376
- return stylesheetToken;
7377
- }
7378
- // Shim for the old `stylesheetTokens` property
7379
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7380
- return {
7381
- hostAttribute: "".concat(stylesheetToken, "-host"),
7382
- shadowAttribute: stylesheetToken
7383
- };
7384
- },
7385
- set: function set(value) {
7386
- // If the value is null or some other exotic object, you would be broken anyway in the past
7387
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7388
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7389
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7390
- }
7391
- });
7392
- // When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
7597
+ // template is not frozen - shim, report, and warn
7598
+ // this shim should be applied in both dev and prod
7599
+ addLegacyStylesheetTokensShim(tmpl);
7600
+ // When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
7393
7601
  if (process.env.NODE_ENV !== 'production') {
7394
- if (!isUndefined$1(tmpl.stylesheets)) {
7395
- warnOnStylesheetsMutation(tmpl.stylesheets);
7396
- }
7397
- var _iterator8 = _createForOfIteratorHelper(TEMPLATE_PROPS),
7398
- _step8;
7399
- try {
7400
- var _loop5 = function _loop5() {
7401
- var prop = _step8.value;
7402
- var value = tmpl[prop];
7403
- defineProperty(tmpl, prop, {
7404
- enumerable: true,
7405
- configurable: true,
7406
- get: function get() {
7407
- return value;
7408
- },
7409
- set: function set(newValue) {
7410
- if (!mutationWarningsSilenced) {
7411
- logError("Dynamically setting the \"".concat(prop, "\" property on a template function ") + "is deprecated and may be removed in a future version of LWC.");
7412
- }
7413
- value = newValue;
7414
- }
7415
- });
7416
- };
7417
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
7418
- _loop5();
7419
- }
7420
- } catch (err) {
7421
- _iterator8.e(err);
7422
- } finally {
7423
- _iterator8.f();
7424
- }
7425
- var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7426
- defineProperty(tmpl, 'stylesheetTokens', {
7427
- enumerable: true,
7428
- configurable: true,
7429
- get: originalDescriptor.get,
7430
- set: function set(value) {
7431
- logError("Dynamically setting the \"stylesheetTokens\" property on a template function " + "is deprecated and may be removed in a future version of LWC.");
7432
- // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7433
- mutationWarningsSilenced = true;
7434
- originalDescriptor.set.call(this, value);
7435
- mutationWarningsSilenced = false;
7436
- }
7602
+ trackMutations(tmpl);
7603
+ } else {
7604
+ // In prod mode, we only track mutations if reporting is enabled
7605
+ onReportingEnabled(function () {
7606
+ trackMutations(tmpl);
7437
7607
  });
7438
7608
  }
7439
7609
  }
@@ -7461,7 +7631,7 @@ var LWC = (function (exports) {
7461
7631
  }
7462
7632
  return ctor;
7463
7633
  }
7464
- /* version: 2.35.2 */
7634
+ /* version: 2.36.0 */
7465
7635
 
7466
7636
  /*
7467
7637
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8144,17 +8314,17 @@ var LWC = (function (exports) {
8144
8314
  function flushPendingWhenDefinedCallbacks(tagName, ctor) {
8145
8315
  var resolvers = pendingWhenDefinedCallbacks.get(tagName);
8146
8316
  if (!isUndefined$1(resolvers)) {
8147
- var _iterator9 = _createForOfIteratorHelper(resolvers),
8148
- _step9;
8317
+ var _iterator11 = _createForOfIteratorHelper(resolvers),
8318
+ _step11;
8149
8319
  try {
8150
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
8151
- var resolver = _step9.value;
8320
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
8321
+ var resolver = _step11.value;
8152
8322
  resolver(ctor);
8153
8323
  }
8154
8324
  } catch (err) {
8155
- _iterator9.e(err);
8325
+ _iterator11.e(err);
8156
8326
  } finally {
8157
- _iterator9.f();
8327
+ _iterator11.f();
8158
8328
  }
8159
8329
  }
8160
8330
  pendingWhenDefinedCallbacks.delete(tagName);
@@ -8204,11 +8374,11 @@ var LWC = (function (exports) {
8204
8374
  var awaiting = awaitingUpgrade.get(tagName);
8205
8375
  if (!isUndefined$1(awaiting)) {
8206
8376
  awaitingUpgrade.delete(tagName);
8207
- var _iterator10 = _createForOfIteratorHelper(awaiting),
8208
- _step10;
8377
+ var _iterator12 = _createForOfIteratorHelper(awaiting),
8378
+ _step12;
8209
8379
  try {
8210
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
8211
- var element = _step10.value;
8380
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
8381
+ var element = _step12.value;
8212
8382
  var registeredDefinition = pendingRegistryForElement.get(element);
8213
8383
  // At this point, registeredDefinition should never be undefined because awaitingUpgrade
8214
8384
  // is only populated when we haven't run internalUpgrade yet, and we only populate
@@ -8220,9 +8390,9 @@ var LWC = (function (exports) {
8220
8390
  }
8221
8391
  }
8222
8392
  } catch (err) {
8223
- _iterator10.e(err);
8393
+ _iterator12.e(err);
8224
8394
  } finally {
8225
- _iterator10.f();
8395
+ _iterator12.f();
8226
8396
  }
8227
8397
  }
8228
8398
  // If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
@@ -8499,7 +8669,7 @@ var LWC = (function (exports) {
8499
8669
  function isNull(obj) {
8500
8670
  return obj === null;
8501
8671
  }
8502
- /** version: 2.35.2 */
8672
+ /** version: 2.36.0 */
8503
8673
 
8504
8674
  /*
8505
8675
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8558,17 +8728,17 @@ var LWC = (function (exports) {
8558
8728
  exports.createFragment = function (html) {
8559
8729
  var wrapperTags = topLevelWrappingMap[getTagName(html)];
8560
8730
  if (!isUndefined(wrapperTags)) {
8561
- var _iterator11 = _createForOfIteratorHelper(wrapperTags),
8562
- _step11;
8731
+ var _iterator13 = _createForOfIteratorHelper(wrapperTags),
8732
+ _step13;
8563
8733
  try {
8564
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
8565
- var wrapperTag = _step11.value;
8734
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
8735
+ var wrapperTag = _step13.value;
8566
8736
  html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8567
8737
  }
8568
8738
  } catch (err) {
8569
- _iterator11.e(err);
8739
+ _iterator13.e(err);
8570
8740
  } finally {
8571
- _iterator11.f();
8741
+ _iterator13.f();
8572
8742
  }
8573
8743
  }
8574
8744
  // For IE11, the document title must not be undefined, but it can be an empty string
@@ -8577,7 +8747,7 @@ var LWC = (function (exports) {
8577
8747
  doc.body.innerHTML = html;
8578
8748
  var content = doc.body;
8579
8749
  if (!isUndefined(wrapperTags)) {
8580
- for (var _i39 = 0; _i39 < wrapperTags.length; _i39++) {
8750
+ for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
8581
8751
  content = content.firstChild;
8582
8752
  }
8583
8753
  }
@@ -8770,8 +8940,8 @@ var LWC = (function (exports) {
8770
8940
  tagName: element.tagName.toLowerCase(),
8771
8941
  hydrated: true
8772
8942
  });
8773
- for (var _i40 = 0, _Object$entries2 = Object.entries(props); _i40 < _Object$entries2.length; _i40++) {
8774
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i40], 2),
8943
+ for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
8944
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
8775
8945
  key = _Object$entries2$_i[0],
8776
8946
  value = _Object$entries2$_i[1];
8777
8947
  element[key] = value;
@@ -9065,7 +9235,7 @@ var LWC = (function (exports) {
9065
9235
  });
9066
9236
  freeze(LightningElement);
9067
9237
  seal(LightningElement.prototype);
9068
- /* version: 2.35.2 */
9238
+ /* version: 2.36.0 */
9069
9239
 
9070
9240
  exports.LightningElement = LightningElement;
9071
9241
  exports.__unstable__ProfilerControl = profilerControl;