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
@@ -335,9 +335,9 @@
335
335
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
336
336
  */
337
337
  // Increment whenever the LWC template compiler changes
338
- const LWC_VERSION = "2.35.2";
338
+ const LWC_VERSION = "2.36.0";
339
339
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
340
- /** version: 2.35.2 */
340
+ /** version: 2.36.0 */
341
341
 
342
342
  /**
343
343
  * Copyright (C) 2018 salesforce.com, inc.
@@ -416,7 +416,7 @@
416
416
  setFeatureFlag(name, value);
417
417
  }
418
418
  }
419
- /** version: 2.35.2 */
419
+ /** version: 2.36.0 */
420
420
 
421
421
  /**
422
422
  * Copyright (C) 2018 salesforce.com, inc.
@@ -480,7 +480,7 @@
480
480
  }
481
481
  }
482
482
  }
483
- /** version: 2.35.2 */
483
+ /** version: 2.36.0 */
484
484
 
485
485
  /*
486
486
  * Copyright (c) 2018, salesforce.com, inc.
@@ -546,7 +546,6 @@
546
546
  * SPDX-License-Identifier: MIT
547
547
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
548
548
  */
549
- /** Callbacks to invoke when reporting is enabled **/
550
549
  const onReportingEnabledCallbacks = [];
551
550
  /** The currently assigned reporting dispatcher. */
552
551
  let currentDispatcher$1 = noop;
@@ -604,11 +603,11 @@
604
603
  /**
605
604
  * Report to the current dispatcher, if there is one.
606
605
  * @param reportingEventId
607
- * @param vm
606
+ * @param payload - data to report
608
607
  */
609
- function report(reportingEventId, vm) {
608
+ function report(reportingEventId, payload) {
610
609
  if (enabled$1) {
611
- currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
610
+ currentDispatcher$1(reportingEventId, payload);
612
611
  }
613
612
  }
614
613
 
@@ -883,7 +882,7 @@
883
882
  // Make a shallow copy of an object but omit the given key
884
883
  function cloneAndOmitKey(object, keyToOmit) {
885
884
  const result = {};
886
- for (const key of Object.keys(object)) {
885
+ for (const key of keys(object)) {
887
886
  if (key !== keyToOmit) {
888
887
  result[key] = object[key];
889
888
  }
@@ -893,7 +892,7 @@
893
892
  function flattenStylesheets(stylesheets) {
894
893
  const list = [];
895
894
  for (const stylesheet of stylesheets) {
896
- if (!Array.isArray(stylesheet)) {
895
+ if (!isArray$1(stylesheet)) {
897
896
  list.push(stylesheet);
898
897
  }
899
898
  else {
@@ -3170,6 +3169,10 @@
3170
3169
  // stylesheets and templates do not have user-meaningful names, but components do
3171
3170
  const friendlyName = type === 'component' ? `${type} ${func.name}` : type;
3172
3171
  logError(`LWC WARNING: current engine is v${LWC_VERSION}, but ${friendlyName} was compiled with v${version}.\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear.`);
3172
+ report(1 /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
3173
+ compilerVersion: version,
3174
+ runtimeVersion: LWC_VERSION,
3175
+ });
3173
3176
  }
3174
3177
  }
3175
3178
  }
@@ -4905,7 +4908,12 @@
4905
4908
  } else if (isVScopedSlotFragment(vnode)) {
4906
4909
  slotName = vnode.slotName;
4907
4910
  }
4908
- const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4911
+ // Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
4912
+ // but elm.setAttribute('slot', Symbol(1)) is an error.
4913
+ // the following line also throws same error for symbols
4914
+ // Similar for Object.create(null)
4915
+ const normalizedSlotName = '' + slotName;
4916
+ const vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
4909
4917
  ArrayPush$1.call(vnodes, vnode);
4910
4918
  }
4911
4919
  vm.cmpSlots = {
@@ -5971,6 +5979,8 @@
5971
5979
  Ctor, { tmpl }) {
5972
5980
  if (isFunction$1(Ctor)) {
5973
5981
  if (process.env.NODE_ENV !== 'production') {
5982
+ // There is no point in running this in production, because the version mismatch check relies
5983
+ // on code comments which are stripped out in production by minifiers
5974
5984
  checkVersionMismatch(Ctor, 'component');
5975
5985
  }
5976
5986
  signedTemplateMap.set(Ctor, tmpl);
@@ -6236,6 +6246,7 @@
6236
6246
  // Validate and flatten any stylesheets defined as `static stylesheets`
6237
6247
  function computeStylesheets(vm, ctor) {
6238
6248
  if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
6249
+ warnOnStylesheetsMutation(ctor);
6239
6250
  const {
6240
6251
  stylesheets
6241
6252
  } = ctor;
@@ -6250,6 +6261,24 @@
6250
6261
  }
6251
6262
  return null;
6252
6263
  }
6264
+ function warnOnStylesheetsMutation(ctor) {
6265
+ if (process.env.NODE_ENV !== 'production') {
6266
+ let {
6267
+ stylesheets
6268
+ } = ctor;
6269
+ defineProperty(ctor, 'stylesheets', {
6270
+ enumerable: true,
6271
+ configurable: true,
6272
+ get() {
6273
+ return stylesheets;
6274
+ },
6275
+ set(newValue) {
6276
+ logWarnOnce(`Dynamically setting the "stylesheets" static property on ${ctor.name} ` + 'will not affect the stylesheets injected.');
6277
+ stylesheets = newValue;
6278
+ }
6279
+ });
6280
+ }
6281
+ }
6253
6282
  function computeShadowMode(vm, renderer) {
6254
6283
  const {
6255
6284
  def
@@ -6629,7 +6658,7 @@
6629
6658
  function isSyntheticShadowRootInstance(rootNode) {
6630
6659
  return rootNode !== document && isTrue(rootNode.synthetic);
6631
6660
  }
6632
- function reportViolation(source, target, attrName) {
6661
+ function reportViolation$1(source, target, attrName) {
6633
6662
  // The vm is either for the source, the target, or both. Either one or both must be using synthetic
6634
6663
  // shadow for a violation to be detected.
6635
6664
  let vm = getAssociatedVMIfPresent(source.getRootNode().host);
@@ -6640,7 +6669,10 @@
6640
6669
  // vm should never be undefined here, but just to be safe, bail out and don't report
6641
6670
  return;
6642
6671
  }
6643
- report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
6672
+ report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
6673
+ tagName: vm.tagName,
6674
+ attributeName: attrName,
6675
+ });
6644
6676
  if (process.env.NODE_ENV !== 'production') {
6645
6677
  // Avoid excessively logging to the console in the case of duplicates.
6646
6678
  logWarnOnce(`Element <${source.tagName.toLowerCase()}> uses attribute "${attrName}" to reference element ` +
@@ -6672,7 +6704,7 @@
6672
6704
  const sourceElement = sourceElements[i];
6673
6705
  const sourceRoot = sourceElement.getRootNode();
6674
6706
  if (sourceRoot !== root) {
6675
- reportViolation(sourceElement, elm, idRefAttrName);
6707
+ reportViolation$1(sourceElement, elm, idRefAttrName);
6676
6708
  break;
6677
6709
  }
6678
6710
  }
@@ -6687,7 +6719,7 @@
6687
6719
  const targetRoot = target.getRootNode();
6688
6720
  if (targetRoot !== root) {
6689
6721
  // target element's shadow root is not the same as ours
6690
- reportViolation(elm, target, attrName);
6722
+ reportViolation$1(elm, target, attrName);
6691
6723
  }
6692
6724
  }
6693
6725
  }
@@ -6696,7 +6728,7 @@
6696
6728
  let enabled = false;
6697
6729
  // We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
6698
6730
  // reporting is not enabled. It should also only run once
6699
- function enableDetection() {
6731
+ function enableDetection$1() {
6700
6732
  if (enabled) {
6701
6733
  return; // don't double-apply the patches
6702
6734
  }
@@ -6748,14 +6780,112 @@
6748
6780
  if (supportsCssEscape() && isSyntheticShadowLoaded()) {
6749
6781
  // Always run detection in dev mode, so we can at least print to the console
6750
6782
  if (process.env.NODE_ENV !== 'production') {
6751
- enableDetection();
6783
+ enableDetection$1();
6752
6784
  }
6753
6785
  else {
6754
6786
  // In prod mode, only enable detection if reporting is enabled
6755
- onReportingEnabled(enableDetection);
6787
+ onReportingEnabled(enableDetection$1);
6756
6788
  }
6757
6789
  }
6758
6790
 
6791
+ /*
6792
+ * Copyright (c) 2018, salesforce.com, inc.
6793
+ * All rights reserved.
6794
+ * SPDX-License-Identifier: MIT
6795
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6796
+ */
6797
+ //
6798
+ // The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
6799
+ // legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
6800
+ //
6801
+ // See the README for @lwc/aria-reflection
6802
+ const NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
6803
+ function isLightningElement(elm) {
6804
+ // The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
6805
+ // In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
6806
+ return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
6807
+ }
6808
+ function findVM(elm) {
6809
+ // If it's a shadow DOM component, then it has a host
6810
+ const {
6811
+ host
6812
+ } = elm.getRootNode();
6813
+ const vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
6814
+ if (!isUndefined$1(vm)) {
6815
+ return vm;
6816
+ }
6817
+ // Else it might be a light DOM component. Walk up the tree trying to find the owner
6818
+ let parentElement = elm;
6819
+ while (!isNull(parentElement = parentElement.parentElement)) {
6820
+ if (isLightningElement(parentElement)) {
6821
+ const vm = getAssociatedVMIfPresent(parentElement);
6822
+ if (!isUndefined$1(vm)) {
6823
+ return vm;
6824
+ }
6825
+ }
6826
+ }
6827
+ // If we return undefined, it's because the element was rendered wholly outside a LightningElement
6828
+ }
6829
+
6830
+ function checkAndReportViolation(elm, prop) {
6831
+ if (!isLightningElement(elm)) {
6832
+ const vm = findVM(elm);
6833
+ if (process.env.NODE_ENV !== 'production') {
6834
+ logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` + (isUndefined$1(vm) ? '' : `owned by <${vm.elm.tagName.toLowerCase()}> `) + `uses non-standard property "${prop}". This will be removed in a future version of LWC. ` + `See https://lwc.dev/guide/accessibility#deprecated-aria-reflected-properties`);
6835
+ }
6836
+ report(2 /* ReportingEventId.NonStandardAriaReflection */, {
6837
+ tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
6838
+ propertyName: prop
6839
+ });
6840
+ }
6841
+ }
6842
+ function enableDetection() {
6843
+ const {
6844
+ prototype
6845
+ } = Element;
6846
+ for (const prop of NON_STANDARD_ARIA_PROPS) {
6847
+ const descriptor = getOwnPropertyDescriptor$1(prototype, prop);
6848
+ // The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
6849
+ // This happens automatically because of the ordering of imports.
6850
+ if (process.env.NODE_ENV !== 'production') {
6851
+ /* istanbul ignore if */
6852
+ if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
6853
+ // should never happen
6854
+ throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
6855
+ }
6856
+ }
6857
+ // @ts-ignore
6858
+ const {
6859
+ get,
6860
+ set
6861
+ } = descriptor;
6862
+ defineProperty(prototype, prop, {
6863
+ get() {
6864
+ checkAndReportViolation(this, prop);
6865
+ return get.call(this);
6866
+ },
6867
+ set(val) {
6868
+ checkAndReportViolation(this, prop);
6869
+ return set.call(this, val);
6870
+ },
6871
+ configurable: true,
6872
+ enumerable: true
6873
+ });
6874
+ }
6875
+ }
6876
+ // No point in running this code if we're not in a browser, or if the global polyfill is not loaded
6877
+ {
6878
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
6879
+ // Always run detection in dev mode, so we can at least print to the console
6880
+ if (process.env.NODE_ENV !== 'production') {
6881
+ enableDetection();
6882
+ } else {
6883
+ // In prod mode, only enable detection if reporting is enabled
6884
+ onReportingEnabled(enableDetection);
6885
+ }
6886
+ }
6887
+ }
6888
+
6759
6889
  /*
6760
6890
  * Copyright (c) 2018, salesforce.com, inc.
6761
6891
  * All rights reserved.
@@ -7240,12 +7370,13 @@
7240
7370
  */
7241
7371
  // See @lwc/engine-core/src/framework/template.ts
7242
7372
  const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7243
- // Via https://www.npmjs.com/package/object-observer
7244
- const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7245
7373
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7246
- const STYLESHEET_FUNCTION_EXPANDOS = [
7374
+ const STYLESHEET_PROPS = [
7247
7375
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
7248
7376
  '$scoped$'];
7377
+ // Via https://www.npmjs.com/package/object-observer
7378
+ const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7379
+ let mutationTrackingDisabled = false;
7249
7380
  function getOriginalArrayMethod(prop) {
7250
7381
  switch (prop) {
7251
7382
  case 'pop':
@@ -7268,7 +7399,20 @@
7268
7399
  return ArrayCopyWithin;
7269
7400
  }
7270
7401
  }
7271
- let mutationWarningsSilenced = false;
7402
+ function reportViolation(type, eventId, prop) {
7403
+ if (process.env.NODE_ENV !== 'production') {
7404
+ logWarnOnce(`Mutating the "${prop}" property on a ${type} ` + `is deprecated and will be removed in a future version of LWC. ` + `See: https://lwc.dev/guide/css#deprecated-template-mutation`);
7405
+ }
7406
+ report(eventId, {
7407
+ propertyName: prop
7408
+ });
7409
+ }
7410
+ function reportTemplateViolation(prop) {
7411
+ reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
7412
+ }
7413
+ function reportStylesheetViolation(prop) {
7414
+ reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
7415
+ }
7272
7416
  // Warn if the user tries to mutate a stylesheets array, e.g.:
7273
7417
  // `tmpl.stylesheets.push(someStylesheetFunction)`
7274
7418
  function warnOnArrayMutation(stylesheets) {
@@ -7277,7 +7421,7 @@
7277
7421
  for (const prop of ARRAY_MUTATION_METHODS) {
7278
7422
  const originalArrayMethod = getOriginalArrayMethod(prop);
7279
7423
  stylesheets[prop] = function arrayMutationWarningWrapper() {
7280
- logError(`Mutating the "stylesheets" array on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7424
+ reportTemplateViolation('stylesheets');
7281
7425
  // @ts-ignore
7282
7426
  return originalArrayMethod.apply(this, arguments);
7283
7427
  };
@@ -7286,8 +7430,7 @@
7286
7430
  // Warn if the user tries to mutate a stylesheet factory function, e.g.:
7287
7431
  // `stylesheet.$scoped$ = true`
7288
7432
  function warnOnStylesheetFunctionMutation(stylesheet) {
7289
- // We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
7290
- for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
7433
+ for (const prop of STYLESHEET_PROPS) {
7291
7434
  let value = stylesheet[prop];
7292
7435
  defineProperty(stylesheet, prop, {
7293
7436
  enumerable: true,
@@ -7296,14 +7439,14 @@
7296
7439
  return value;
7297
7440
  },
7298
7441
  set(newValue) {
7299
- logError(`Dynamically setting the "${prop}" property on a stylesheet function ` + `is deprecated and may be removed in a future version of LWC.`);
7442
+ reportStylesheetViolation(prop);
7300
7443
  value = newValue;
7301
7444
  }
7302
7445
  });
7303
7446
  }
7304
7447
  }
7305
7448
  // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
7306
- function warnOnStylesheetsMutation(stylesheets) {
7449
+ function trackStylesheetsMutation(stylesheets) {
7307
7450
  traverseStylesheets(stylesheets, subStylesheets => {
7308
7451
  if (isArray$1(subStylesheets)) {
7309
7452
  warnOnArrayMutation(subStylesheets);
@@ -7330,7 +7473,70 @@
7330
7473
  }
7331
7474
  }
7332
7475
  }
7476
+ function trackMutations(tmpl) {
7477
+ if (!isUndefined$1(tmpl.stylesheets)) {
7478
+ trackStylesheetsMutation(tmpl.stylesheets);
7479
+ }
7480
+ for (const prop of TEMPLATE_PROPS) {
7481
+ let value = tmpl[prop];
7482
+ defineProperty(tmpl, prop, {
7483
+ enumerable: true,
7484
+ configurable: true,
7485
+ get() {
7486
+ return value;
7487
+ },
7488
+ set(newValue) {
7489
+ if (!mutationTrackingDisabled) {
7490
+ reportTemplateViolation(prop);
7491
+ }
7492
+ value = newValue;
7493
+ }
7494
+ });
7495
+ }
7496
+ const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7497
+ defineProperty(tmpl, 'stylesheetTokens', {
7498
+ enumerable: true,
7499
+ configurable: true,
7500
+ get: originalDescriptor.get,
7501
+ set(value) {
7502
+ reportTemplateViolation('stylesheetTokens');
7503
+ // Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
7504
+ mutationTrackingDisabled = true;
7505
+ originalDescriptor.set.call(this, value);
7506
+ mutationTrackingDisabled = false;
7507
+ }
7508
+ });
7509
+ }
7510
+ function addLegacyStylesheetTokensShim(tmpl) {
7511
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7512
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7513
+ defineProperty(tmpl, 'stylesheetTokens', {
7514
+ enumerable: true,
7515
+ configurable: true,
7516
+ get() {
7517
+ const {
7518
+ stylesheetToken
7519
+ } = this;
7520
+ if (isUndefined$1(stylesheetToken)) {
7521
+ return stylesheetToken;
7522
+ }
7523
+ // Shim for the old `stylesheetTokens` property
7524
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7525
+ return {
7526
+ hostAttribute: `${stylesheetToken}-host`,
7527
+ shadowAttribute: stylesheetToken
7528
+ };
7529
+ },
7530
+ set(value) {
7531
+ // If the value is null or some other exotic object, you would be broken anyway in the past
7532
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7533
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7534
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7535
+ }
7536
+ });
7537
+ }
7333
7538
  function freezeTemplate(tmpl) {
7539
+ // TODO [#2782]: remove this flag and delete the legacy behavior
7334
7540
  if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
7335
7541
  // Deep freeze the template
7336
7542
  freeze(tmpl);
@@ -7338,66 +7544,16 @@
7338
7544
  deepFreeze(tmpl.stylesheets);
7339
7545
  }
7340
7546
  } else {
7341
- // TODO [#2782]: remove this flag and delete the legacy behavior
7342
- // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7343
- // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7344
- defineProperty(tmpl, 'stylesheetTokens', {
7345
- enumerable: true,
7346
- configurable: true,
7347
- get() {
7348
- const {
7349
- stylesheetToken
7350
- } = this;
7351
- if (isUndefined$1(stylesheetToken)) {
7352
- return stylesheetToken;
7353
- }
7354
- // Shim for the old `stylesheetTokens` property
7355
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7356
- return {
7357
- hostAttribute: `${stylesheetToken}-host`,
7358
- shadowAttribute: stylesheetToken
7359
- };
7360
- },
7361
- set(value) {
7362
- // If the value is null or some other exotic object, you would be broken anyway in the past
7363
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7364
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7365
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7366
- }
7367
- });
7368
- // When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
7547
+ // template is not frozen - shim, report, and warn
7548
+ // this shim should be applied in both dev and prod
7549
+ addLegacyStylesheetTokensShim(tmpl);
7550
+ // When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
7369
7551
  if (process.env.NODE_ENV !== 'production') {
7370
- if (!isUndefined$1(tmpl.stylesheets)) {
7371
- warnOnStylesheetsMutation(tmpl.stylesheets);
7372
- }
7373
- for (const prop of TEMPLATE_PROPS) {
7374
- let value = tmpl[prop];
7375
- defineProperty(tmpl, prop, {
7376
- enumerable: true,
7377
- configurable: true,
7378
- get() {
7379
- return value;
7380
- },
7381
- set(newValue) {
7382
- if (!mutationWarningsSilenced) {
7383
- logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7384
- }
7385
- value = newValue;
7386
- }
7387
- });
7388
- }
7389
- const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7390
- defineProperty(tmpl, 'stylesheetTokens', {
7391
- enumerable: true,
7392
- configurable: true,
7393
- get: originalDescriptor.get,
7394
- set(value) {
7395
- logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7396
- // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7397
- mutationWarningsSilenced = true;
7398
- originalDescriptor.set.call(this, value);
7399
- mutationWarningsSilenced = false;
7400
- }
7552
+ trackMutations(tmpl);
7553
+ } else {
7554
+ // In prod mode, we only track mutations if reporting is enabled
7555
+ onReportingEnabled(() => {
7556
+ trackMutations(tmpl);
7401
7557
  });
7402
7558
  }
7403
7559
  }
@@ -7425,7 +7581,7 @@
7425
7581
  }
7426
7582
  return ctor;
7427
7583
  }
7428
- /* version: 2.35.2 */
7584
+ /* version: 2.36.0 */
7429
7585
 
7430
7586
  /*
7431
7587
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8399,7 +8555,7 @@
8399
8555
  function isNull(obj) {
8400
8556
  return obj === null;
8401
8557
  }
8402
- /** version: 2.35.2 */
8558
+ /** version: 2.36.0 */
8403
8559
 
8404
8560
  /*
8405
8561
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8960,7 +9116,7 @@
8960
9116
  });
8961
9117
  freeze(LightningElement);
8962
9118
  seal(LightningElement.prototype);
8963
- /* version: 2.35.2 */
9119
+ /* version: 2.36.0 */
8964
9120
 
8965
9121
  exports.LightningElement = LightningElement;
8966
9122
  exports.__unstable__ProfilerControl = profilerControl;