lwc 2.35.1 → 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 +258 -102
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +258 -102
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +286 -58
  5. package/dist/engine-dom/iife/es5/engine-dom.js +365 -202
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +412 -131
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +258 -102
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +286 -58
  11. package/dist/engine-dom/umd/es5/engine-dom.js +365 -202
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +412 -131
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +126 -79
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +126 -79
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +5 -5
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +5 -5
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +9 -9
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +7 -7
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +5 -5
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +9 -9
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +7 -7
  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
@@ -29,10 +29,10 @@ function fail(msg) {
29
29
 
30
30
  var assert = /*#__PURE__*/Object.freeze({
31
31
  __proto__: null,
32
+ fail: fail,
32
33
  invariant: invariant,
33
- isTrue: isTrue$1,
34
34
  isFalse: isFalse$1,
35
- fail: fail
35
+ isTrue: isTrue$1
36
36
  });
37
37
 
38
38
  /*
@@ -329,9 +329,9 @@ function htmlAttributeToProperty(attrName) {
329
329
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
330
330
  */
331
331
  // Increment whenever the LWC template compiler changes
332
- const LWC_VERSION = "2.35.1";
332
+ const LWC_VERSION = "2.36.0";
333
333
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
334
- /** version: 2.35.1 */
334
+ /** version: 2.36.0 */
335
335
 
336
336
  /**
337
337
  * Copyright (C) 2018 salesforce.com, inc.
@@ -410,7 +410,7 @@ function setFeatureFlagForTest(name, value) {
410
410
  setFeatureFlag(name, value);
411
411
  }
412
412
  }
413
- /** version: 2.35.1 */
413
+ /** version: 2.36.0 */
414
414
 
415
415
  /**
416
416
  * Copyright (C) 2018 salesforce.com, inc.
@@ -474,7 +474,7 @@ function applyAriaReflection(prototype = Element.prototype) {
474
474
  }
475
475
  }
476
476
  }
477
- /** version: 2.35.1 */
477
+ /** version: 2.36.0 */
478
478
 
479
479
  /*
480
480
  * Copyright (c) 2018, salesforce.com, inc.
@@ -540,7 +540,6 @@ if (process.env.NODE_ENV === 'test-karma-lwc') {
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
  const onReportingEnabledCallbacks = [];
545
544
  /** The currently assigned reporting dispatcher. */
546
545
  let currentDispatcher$1 = noop;
@@ -598,11 +597,11 @@ function onReportingEnabled(callback) {
598
597
  /**
599
598
  * Report to the current dispatcher, if there is one.
600
599
  * @param reportingEventId
601
- * @param vm
600
+ * @param payload - data to report
602
601
  */
603
- function report(reportingEventId, vm) {
602
+ function report(reportingEventId, payload) {
604
603
  if (enabled$1) {
605
- currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
604
+ currentDispatcher$1(reportingEventId, payload);
606
605
  }
607
606
  }
608
607
 
@@ -877,7 +876,7 @@ function parseStyleText(cssText) {
877
876
  // Make a shallow copy of an object but omit the given key
878
877
  function cloneAndOmitKey(object, keyToOmit) {
879
878
  const result = {};
880
- for (const key of Object.keys(object)) {
879
+ for (const key of keys(object)) {
881
880
  if (key !== keyToOmit) {
882
881
  result[key] = object[key];
883
882
  }
@@ -887,7 +886,7 @@ function cloneAndOmitKey(object, keyToOmit) {
887
886
  function flattenStylesheets(stylesheets) {
888
887
  const list = [];
889
888
  for (const stylesheet of stylesheets) {
890
- if (!Array.isArray(stylesheet)) {
889
+ if (!isArray$1(stylesheet)) {
891
890
  list.push(stylesheet);
892
891
  }
893
892
  else {
@@ -3164,6 +3163,10 @@ function checkVersionMismatch(func, type) {
3164
3163
  // stylesheets and templates do not have user-meaningful names, but components do
3165
3164
  const friendlyName = type === 'component' ? `${type} ${func.name}` : type;
3166
3165
  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.`);
3166
+ report(1 /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
3167
+ compilerVersion: version,
3168
+ runtimeVersion: LWC_VERSION,
3169
+ });
3167
3170
  }
3168
3171
  }
3169
3172
  }
@@ -4899,7 +4902,12 @@ function allocateInSlot(vm, children, owner) {
4899
4902
  } else if (isVScopedSlotFragment(vnode)) {
4900
4903
  slotName = vnode.slotName;
4901
4904
  }
4902
- const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4905
+ // Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
4906
+ // but elm.setAttribute('slot', Symbol(1)) is an error.
4907
+ // the following line also throws same error for symbols
4908
+ // Similar for Object.create(null)
4909
+ const normalizedSlotName = '' + slotName;
4910
+ const vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
4903
4911
  ArrayPush$1.call(vnodes, vnode);
4904
4912
  }
4905
4913
  vm.cmpSlots = {
@@ -5965,6 +5973,8 @@ function registerComponent(
5965
5973
  Ctor, { tmpl }) {
5966
5974
  if (isFunction$1(Ctor)) {
5967
5975
  if (process.env.NODE_ENV !== 'production') {
5976
+ // There is no point in running this in production, because the version mismatch check relies
5977
+ // on code comments which are stripped out in production by minifiers
5968
5978
  checkVersionMismatch(Ctor, 'component');
5969
5979
  }
5970
5980
  signedTemplateMap.set(Ctor, tmpl);
@@ -6230,6 +6240,7 @@ function validateComponentStylesheets(vm, stylesheets) {
6230
6240
  // Validate and flatten any stylesheets defined as `static stylesheets`
6231
6241
  function computeStylesheets(vm, ctor) {
6232
6242
  if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
6243
+ warnOnStylesheetsMutation(ctor);
6233
6244
  const {
6234
6245
  stylesheets
6235
6246
  } = ctor;
@@ -6244,6 +6255,24 @@ function computeStylesheets(vm, ctor) {
6244
6255
  }
6245
6256
  return null;
6246
6257
  }
6258
+ function warnOnStylesheetsMutation(ctor) {
6259
+ if (process.env.NODE_ENV !== 'production') {
6260
+ let {
6261
+ stylesheets
6262
+ } = ctor;
6263
+ defineProperty(ctor, 'stylesheets', {
6264
+ enumerable: true,
6265
+ configurable: true,
6266
+ get() {
6267
+ return stylesheets;
6268
+ },
6269
+ set(newValue) {
6270
+ logWarnOnce(`Dynamically setting the "stylesheets" static property on ${ctor.name} ` + 'will not affect the stylesheets injected.');
6271
+ stylesheets = newValue;
6272
+ }
6273
+ });
6274
+ }
6275
+ }
6247
6276
  function computeShadowMode(vm, renderer) {
6248
6277
  const {
6249
6278
  def
@@ -6623,7 +6652,7 @@ const querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
6623
6652
  function isSyntheticShadowRootInstance(rootNode) {
6624
6653
  return rootNode !== document && isTrue(rootNode.synthetic);
6625
6654
  }
6626
- function reportViolation(source, target, attrName) {
6655
+ function reportViolation$1(source, target, attrName) {
6627
6656
  // The vm is either for the source, the target, or both. Either one or both must be using synthetic
6628
6657
  // shadow for a violation to be detected.
6629
6658
  let vm = getAssociatedVMIfPresent(source.getRootNode().host);
@@ -6634,7 +6663,10 @@ function reportViolation(source, target, attrName) {
6634
6663
  // vm should never be undefined here, but just to be safe, bail out and don't report
6635
6664
  return;
6636
6665
  }
6637
- report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
6666
+ report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
6667
+ tagName: vm.tagName,
6668
+ attributeName: attrName,
6669
+ });
6638
6670
  if (process.env.NODE_ENV !== 'production') {
6639
6671
  // Avoid excessively logging to the console in the case of duplicates.
6640
6672
  logWarnOnce(`Element <${source.tagName.toLowerCase()}> uses attribute "${attrName}" to reference element ` +
@@ -6666,7 +6698,7 @@ function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
6666
6698
  const sourceElement = sourceElements[i];
6667
6699
  const sourceRoot = sourceElement.getRootNode();
6668
6700
  if (sourceRoot !== root) {
6669
- reportViolation(sourceElement, elm, idRefAttrName);
6701
+ reportViolation$1(sourceElement, elm, idRefAttrName);
6670
6702
  break;
6671
6703
  }
6672
6704
  }
@@ -6681,7 +6713,7 @@ function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
6681
6713
  const targetRoot = target.getRootNode();
6682
6714
  if (targetRoot !== root) {
6683
6715
  // target element's shadow root is not the same as ours
6684
- reportViolation(elm, target, attrName);
6716
+ reportViolation$1(elm, target, attrName);
6685
6717
  }
6686
6718
  }
6687
6719
  }
@@ -6690,7 +6722,7 @@ function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
6690
6722
  let enabled = false;
6691
6723
  // We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
6692
6724
  // reporting is not enabled. It should also only run once
6693
- function enableDetection() {
6725
+ function enableDetection$1() {
6694
6726
  if (enabled) {
6695
6727
  return; // don't double-apply the patches
6696
6728
  }
@@ -6742,14 +6774,112 @@ function isSyntheticShadowLoaded() {
6742
6774
  if (supportsCssEscape() && isSyntheticShadowLoaded()) {
6743
6775
  // Always run detection in dev mode, so we can at least print to the console
6744
6776
  if (process.env.NODE_ENV !== 'production') {
6745
- enableDetection();
6777
+ enableDetection$1();
6746
6778
  }
6747
6779
  else {
6748
6780
  // In prod mode, only enable detection if reporting is enabled
6749
- onReportingEnabled(enableDetection);
6781
+ onReportingEnabled(enableDetection$1);
6750
6782
  }
6751
6783
  }
6752
6784
 
6785
+ /*
6786
+ * Copyright (c) 2018, salesforce.com, inc.
6787
+ * All rights reserved.
6788
+ * SPDX-License-Identifier: MIT
6789
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6790
+ */
6791
+ //
6792
+ // The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
6793
+ // legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
6794
+ //
6795
+ // See the README for @lwc/aria-reflection
6796
+ const NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
6797
+ function isLightningElement(elm) {
6798
+ // The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
6799
+ // In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
6800
+ return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
6801
+ }
6802
+ function findVM(elm) {
6803
+ // If it's a shadow DOM component, then it has a host
6804
+ const {
6805
+ host
6806
+ } = elm.getRootNode();
6807
+ const vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
6808
+ if (!isUndefined$1(vm)) {
6809
+ return vm;
6810
+ }
6811
+ // Else it might be a light DOM component. Walk up the tree trying to find the owner
6812
+ let parentElement = elm;
6813
+ while (!isNull(parentElement = parentElement.parentElement)) {
6814
+ if (isLightningElement(parentElement)) {
6815
+ const vm = getAssociatedVMIfPresent(parentElement);
6816
+ if (!isUndefined$1(vm)) {
6817
+ return vm;
6818
+ }
6819
+ }
6820
+ }
6821
+ // If we return undefined, it's because the element was rendered wholly outside a LightningElement
6822
+ }
6823
+
6824
+ function checkAndReportViolation(elm, prop) {
6825
+ if (!isLightningElement(elm)) {
6826
+ const vm = findVM(elm);
6827
+ if (process.env.NODE_ENV !== 'production') {
6828
+ 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`);
6829
+ }
6830
+ report(2 /* ReportingEventId.NonStandardAriaReflection */, {
6831
+ tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
6832
+ propertyName: prop
6833
+ });
6834
+ }
6835
+ }
6836
+ function enableDetection() {
6837
+ const {
6838
+ prototype
6839
+ } = Element;
6840
+ for (const prop of NON_STANDARD_ARIA_PROPS) {
6841
+ const descriptor = getOwnPropertyDescriptor$1(prototype, prop);
6842
+ // The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
6843
+ // This happens automatically because of the ordering of imports.
6844
+ if (process.env.NODE_ENV !== 'production') {
6845
+ /* istanbul ignore if */
6846
+ if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
6847
+ // should never happen
6848
+ throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
6849
+ }
6850
+ }
6851
+ // @ts-ignore
6852
+ const {
6853
+ get,
6854
+ set
6855
+ } = descriptor;
6856
+ defineProperty(prototype, prop, {
6857
+ get() {
6858
+ checkAndReportViolation(this, prop);
6859
+ return get.call(this);
6860
+ },
6861
+ set(val) {
6862
+ checkAndReportViolation(this, prop);
6863
+ return set.call(this, val);
6864
+ },
6865
+ configurable: true,
6866
+ enumerable: true
6867
+ });
6868
+ }
6869
+ }
6870
+ // No point in running this code if we're not in a browser, or if the global polyfill is not loaded
6871
+ {
6872
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
6873
+ // Always run detection in dev mode, so we can at least print to the console
6874
+ if (process.env.NODE_ENV !== 'production') {
6875
+ enableDetection();
6876
+ } else {
6877
+ // In prod mode, only enable detection if reporting is enabled
6878
+ onReportingEnabled(enableDetection);
6879
+ }
6880
+ }
6881
+ }
6882
+
6753
6883
  /*
6754
6884
  * Copyright (c) 2018, salesforce.com, inc.
6755
6885
  * All rights reserved.
@@ -7234,12 +7364,13 @@ function setHooks(hooks) {
7234
7364
  */
7235
7365
  // See @lwc/engine-core/src/framework/template.ts
7236
7366
  const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7237
- // Via https://www.npmjs.com/package/object-observer
7238
- const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7239
7367
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7240
- const STYLESHEET_FUNCTION_EXPANDOS = [
7368
+ const STYLESHEET_PROPS = [
7241
7369
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
7242
7370
  '$scoped$'];
7371
+ // Via https://www.npmjs.com/package/object-observer
7372
+ const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7373
+ let mutationTrackingDisabled = false;
7243
7374
  function getOriginalArrayMethod(prop) {
7244
7375
  switch (prop) {
7245
7376
  case 'pop':
@@ -7262,7 +7393,20 @@ function getOriginalArrayMethod(prop) {
7262
7393
  return ArrayCopyWithin;
7263
7394
  }
7264
7395
  }
7265
- let mutationWarningsSilenced = false;
7396
+ function reportViolation(type, eventId, prop) {
7397
+ if (process.env.NODE_ENV !== 'production') {
7398
+ 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`);
7399
+ }
7400
+ report(eventId, {
7401
+ propertyName: prop
7402
+ });
7403
+ }
7404
+ function reportTemplateViolation(prop) {
7405
+ reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
7406
+ }
7407
+ function reportStylesheetViolation(prop) {
7408
+ reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
7409
+ }
7266
7410
  // Warn if the user tries to mutate a stylesheets array, e.g.:
7267
7411
  // `tmpl.stylesheets.push(someStylesheetFunction)`
7268
7412
  function warnOnArrayMutation(stylesheets) {
@@ -7271,7 +7415,7 @@ function warnOnArrayMutation(stylesheets) {
7271
7415
  for (const prop of ARRAY_MUTATION_METHODS) {
7272
7416
  const originalArrayMethod = getOriginalArrayMethod(prop);
7273
7417
  stylesheets[prop] = function arrayMutationWarningWrapper() {
7274
- logError(`Mutating the "stylesheets" array on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7418
+ reportTemplateViolation('stylesheets');
7275
7419
  // @ts-ignore
7276
7420
  return originalArrayMethod.apply(this, arguments);
7277
7421
  };
@@ -7280,8 +7424,7 @@ function warnOnArrayMutation(stylesheets) {
7280
7424
  // Warn if the user tries to mutate a stylesheet factory function, e.g.:
7281
7425
  // `stylesheet.$scoped$ = true`
7282
7426
  function warnOnStylesheetFunctionMutation(stylesheet) {
7283
- // We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
7284
- for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
7427
+ for (const prop of STYLESHEET_PROPS) {
7285
7428
  let value = stylesheet[prop];
7286
7429
  defineProperty(stylesheet, prop, {
7287
7430
  enumerable: true,
@@ -7290,14 +7433,14 @@ function warnOnStylesheetFunctionMutation(stylesheet) {
7290
7433
  return value;
7291
7434
  },
7292
7435
  set(newValue) {
7293
- logError(`Dynamically setting the "${prop}" property on a stylesheet function ` + `is deprecated and may be removed in a future version of LWC.`);
7436
+ reportStylesheetViolation(prop);
7294
7437
  value = newValue;
7295
7438
  }
7296
7439
  });
7297
7440
  }
7298
7441
  }
7299
7442
  // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
7300
- function warnOnStylesheetsMutation(stylesheets) {
7443
+ function trackStylesheetsMutation(stylesheets) {
7301
7444
  traverseStylesheets(stylesheets, subStylesheets => {
7302
7445
  if (isArray$1(subStylesheets)) {
7303
7446
  warnOnArrayMutation(subStylesheets);
@@ -7324,7 +7467,70 @@ function traverseStylesheets(stylesheets, callback) {
7324
7467
  }
7325
7468
  }
7326
7469
  }
7470
+ function trackMutations(tmpl) {
7471
+ if (!isUndefined$1(tmpl.stylesheets)) {
7472
+ trackStylesheetsMutation(tmpl.stylesheets);
7473
+ }
7474
+ for (const prop of TEMPLATE_PROPS) {
7475
+ let value = tmpl[prop];
7476
+ defineProperty(tmpl, prop, {
7477
+ enumerable: true,
7478
+ configurable: true,
7479
+ get() {
7480
+ return value;
7481
+ },
7482
+ set(newValue) {
7483
+ if (!mutationTrackingDisabled) {
7484
+ reportTemplateViolation(prop);
7485
+ }
7486
+ value = newValue;
7487
+ }
7488
+ });
7489
+ }
7490
+ const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7491
+ defineProperty(tmpl, 'stylesheetTokens', {
7492
+ enumerable: true,
7493
+ configurable: true,
7494
+ get: originalDescriptor.get,
7495
+ set(value) {
7496
+ reportTemplateViolation('stylesheetTokens');
7497
+ // Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
7498
+ mutationTrackingDisabled = true;
7499
+ originalDescriptor.set.call(this, value);
7500
+ mutationTrackingDisabled = false;
7501
+ }
7502
+ });
7503
+ }
7504
+ function addLegacyStylesheetTokensShim(tmpl) {
7505
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7506
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7507
+ defineProperty(tmpl, 'stylesheetTokens', {
7508
+ enumerable: true,
7509
+ configurable: true,
7510
+ get() {
7511
+ const {
7512
+ stylesheetToken
7513
+ } = this;
7514
+ if (isUndefined$1(stylesheetToken)) {
7515
+ return stylesheetToken;
7516
+ }
7517
+ // Shim for the old `stylesheetTokens` property
7518
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7519
+ return {
7520
+ hostAttribute: `${stylesheetToken}-host`,
7521
+ shadowAttribute: stylesheetToken
7522
+ };
7523
+ },
7524
+ set(value) {
7525
+ // If the value is null or some other exotic object, you would be broken anyway in the past
7526
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7527
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7528
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7529
+ }
7530
+ });
7531
+ }
7327
7532
  function freezeTemplate(tmpl) {
7533
+ // TODO [#2782]: remove this flag and delete the legacy behavior
7328
7534
  if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
7329
7535
  // Deep freeze the template
7330
7536
  freeze(tmpl);
@@ -7332,66 +7538,16 @@ function freezeTemplate(tmpl) {
7332
7538
  deepFreeze(tmpl.stylesheets);
7333
7539
  }
7334
7540
  } else {
7335
- // TODO [#2782]: remove this flag and delete the legacy behavior
7336
- // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7337
- // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7338
- defineProperty(tmpl, 'stylesheetTokens', {
7339
- enumerable: true,
7340
- configurable: true,
7341
- get() {
7342
- const {
7343
- stylesheetToken
7344
- } = this;
7345
- if (isUndefined$1(stylesheetToken)) {
7346
- return stylesheetToken;
7347
- }
7348
- // Shim for the old `stylesheetTokens` property
7349
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7350
- return {
7351
- hostAttribute: `${stylesheetToken}-host`,
7352
- shadowAttribute: stylesheetToken
7353
- };
7354
- },
7355
- set(value) {
7356
- // If the value is null or some other exotic object, you would be broken anyway in the past
7357
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7358
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7359
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7360
- }
7361
- });
7362
- // When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
7541
+ // template is not frozen - shim, report, and warn
7542
+ // this shim should be applied in both dev and prod
7543
+ addLegacyStylesheetTokensShim(tmpl);
7544
+ // When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
7363
7545
  if (process.env.NODE_ENV !== 'production') {
7364
- if (!isUndefined$1(tmpl.stylesheets)) {
7365
- warnOnStylesheetsMutation(tmpl.stylesheets);
7366
- }
7367
- for (const prop of TEMPLATE_PROPS) {
7368
- let value = tmpl[prop];
7369
- defineProperty(tmpl, prop, {
7370
- enumerable: true,
7371
- configurable: true,
7372
- get() {
7373
- return value;
7374
- },
7375
- set(newValue) {
7376
- if (!mutationWarningsSilenced) {
7377
- logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7378
- }
7379
- value = newValue;
7380
- }
7381
- });
7382
- }
7383
- const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7384
- defineProperty(tmpl, 'stylesheetTokens', {
7385
- enumerable: true,
7386
- configurable: true,
7387
- get: originalDescriptor.get,
7388
- set(value) {
7389
- logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7390
- // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7391
- mutationWarningsSilenced = true;
7392
- originalDescriptor.set.call(this, value);
7393
- mutationWarningsSilenced = false;
7394
- }
7546
+ trackMutations(tmpl);
7547
+ } else {
7548
+ // In prod mode, we only track mutations if reporting is enabled
7549
+ onReportingEnabled(() => {
7550
+ trackMutations(tmpl);
7395
7551
  });
7396
7552
  }
7397
7553
  }
@@ -7419,7 +7575,7 @@ function getComponentConstructor(elm) {
7419
7575
  }
7420
7576
  return ctor;
7421
7577
  }
7422
- /* version: 2.35.1 */
7578
+ /* version: 2.36.0 */
7423
7579
 
7424
7580
  /*
7425
7581
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7697,7 +7853,7 @@ const createCustomElementCompat = (tagName, upgradeCallback) => {
7697
7853
  const cachedConstructors = new Map();
7698
7854
  const elementsUpgradedOutsideLWC = new WeakSet();
7699
7855
  let elementBeingUpgradedByLWC = false;
7700
- // Creates a constructor that is intended to be used as a vanilla custom element, except that the upgradeCallback is
7856
+ // Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
7701
7857
  // passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
7702
7858
  // Another benefit is that only LWC can create components that actually do anything – if you do
7703
7859
  // `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
@@ -7742,7 +7898,7 @@ const createUpgradableConstructor = (connectedCallback, disconnectedCallback) =>
7742
7898
  }
7743
7899
  return UpgradableConstructor;
7744
7900
  };
7745
- const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
7901
+ const createCustomElementUsingUpgradableConstructor = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
7746
7902
  // use global custom elements registry
7747
7903
  let UpgradableConstructor = cachedConstructors.get(tagName);
7748
7904
  if (isUndefined$1(UpgradableConstructor)) {
@@ -7770,7 +7926,7 @@ const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback,
7770
7926
  */
7771
7927
  /**
7772
7928
  * Create a scoped registry, i.e. a function that can create custom elements whose tag names
7773
- * do not conflict with vanilla custom elements having the same tag name.
7929
+ * do not conflict with third-party custom elements having the same tag name.
7774
7930
  */
7775
7931
  function createScopedRegistry() {
7776
7932
  if (!hasCustomElements) {
@@ -8311,10 +8467,10 @@ function createCustomElementScoped(tagName, upgradeCallback, connectedCallback,
8311
8467
  * We have three modes for creating custom elements:
8312
8468
  *
8313
8469
  * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
8314
- * 2. "Vanilla" custom elements registry. This system actually still allows us to have two LWC components with the
8315
- * same tag name, via a simple trick: every custom element constructor we define in the registry is basically
8316
- * the same. It's essentially a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its
8317
- * constructor, which allows us to have completely customized functionality for different components.
8470
+ * 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
8471
+ * via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
8472
+ * a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
8473
+ * constructor"), which allows us to have completely customized functionality for different components.
8318
8474
  * 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
8319
8475
  * elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
8320
8476
  * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
@@ -8325,8 +8481,8 @@ if (hasCustomElements) {
8325
8481
  if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
8326
8482
  createCustomElement = createCustomElementScoped;
8327
8483
  } else {
8328
- // use global custom elements registry (vanilla)
8329
- createCustomElement = createCustomElementVanilla;
8484
+ // use the global registry, with an upgradable constructor for the defined custom element
8485
+ createCustomElement = createCustomElementUsingUpgradableConstructor;
8330
8486
  }
8331
8487
  } else {
8332
8488
  // no registry available here
@@ -8382,10 +8538,10 @@ function rendererFactory(baseRenderer) {
8382
8538
 
8383
8539
  var assert = /*#__PURE__*/Object.freeze({
8384
8540
  __proto__: null,
8541
+ fail: fail,
8385
8542
  invariant: invariant,
8386
- isTrue: isTrue$1,
8387
8543
  isFalse: isFalse$1,
8388
- fail: fail
8544
+ isTrue: isTrue$1
8389
8545
  });
8390
8546
  function isUndefined(obj) {
8391
8547
  return obj === undefined;
@@ -8393,7 +8549,7 @@ function rendererFactory(baseRenderer) {
8393
8549
  function isNull(obj) {
8394
8550
  return obj === null;
8395
8551
  }
8396
- /** version: 2.35.1 */
8552
+ /** version: 2.36.0 */
8397
8553
 
8398
8554
  /*
8399
8555
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8954,6 +9110,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
8954
9110
  });
8955
9111
  freeze(LightningElement);
8956
9112
  seal(LightningElement.prototype);
8957
- /* version: 2.35.1 */
9113
+ /* version: 2.36.0 */
8958
9114
 
8959
9115
  export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };