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
@@ -32,10 +32,10 @@ var LWC = (function (exports) {
32
32
 
33
33
  var assert = /*#__PURE__*/Object.freeze({
34
34
  __proto__: null,
35
+ fail: fail,
35
36
  invariant: invariant,
36
- isTrue: isTrue$1,
37
37
  isFalse: isFalse$1,
38
- fail: fail
38
+ isTrue: isTrue$1
39
39
  });
40
40
 
41
41
  /*
@@ -332,9 +332,9 @@ var LWC = (function (exports) {
332
332
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
333
333
  */
334
334
  // Increment whenever the LWC template compiler changes
335
- const LWC_VERSION = "2.35.1";
335
+ const LWC_VERSION = "2.36.0";
336
336
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
337
- /** version: 2.35.1 */
337
+ /** version: 2.36.0 */
338
338
 
339
339
  /**
340
340
  * Copyright (C) 2018 salesforce.com, inc.
@@ -413,7 +413,7 @@ var LWC = (function (exports) {
413
413
  setFeatureFlag(name, value);
414
414
  }
415
415
  }
416
- /** version: 2.35.1 */
416
+ /** version: 2.36.0 */
417
417
 
418
418
  /**
419
419
  * Copyright (C) 2018 salesforce.com, inc.
@@ -477,7 +477,7 @@ var LWC = (function (exports) {
477
477
  }
478
478
  }
479
479
  }
480
- /** version: 2.35.1 */
480
+ /** version: 2.36.0 */
481
481
 
482
482
  /*
483
483
  * Copyright (c) 2018, salesforce.com, inc.
@@ -543,7 +543,6 @@ var LWC = (function (exports) {
543
543
  * SPDX-License-Identifier: MIT
544
544
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
545
545
  */
546
- /** Callbacks to invoke when reporting is enabled **/
547
546
  const onReportingEnabledCallbacks = [];
548
547
  /** The currently assigned reporting dispatcher. */
549
548
  let currentDispatcher$1 = noop;
@@ -601,11 +600,11 @@ var LWC = (function (exports) {
601
600
  /**
602
601
  * Report to the current dispatcher, if there is one.
603
602
  * @param reportingEventId
604
- * @param vm
603
+ * @param payload - data to report
605
604
  */
606
- function report(reportingEventId, vm) {
605
+ function report(reportingEventId, payload) {
607
606
  if (enabled$1) {
608
- currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
607
+ currentDispatcher$1(reportingEventId, payload);
609
608
  }
610
609
  }
611
610
 
@@ -880,7 +879,7 @@ var LWC = (function (exports) {
880
879
  // Make a shallow copy of an object but omit the given key
881
880
  function cloneAndOmitKey(object, keyToOmit) {
882
881
  const result = {};
883
- for (const key of Object.keys(object)) {
882
+ for (const key of keys(object)) {
884
883
  if (key !== keyToOmit) {
885
884
  result[key] = object[key];
886
885
  }
@@ -890,7 +889,7 @@ var LWC = (function (exports) {
890
889
  function flattenStylesheets(stylesheets) {
891
890
  const list = [];
892
891
  for (const stylesheet of stylesheets) {
893
- if (!Array.isArray(stylesheet)) {
892
+ if (!isArray$1(stylesheet)) {
894
893
  list.push(stylesheet);
895
894
  }
896
895
  else {
@@ -3167,6 +3166,10 @@ var LWC = (function (exports) {
3167
3166
  // stylesheets and templates do not have user-meaningful names, but components do
3168
3167
  const friendlyName = type === 'component' ? `${type} ${func.name}` : type;
3169
3168
  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.`);
3169
+ report(1 /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
3170
+ compilerVersion: version,
3171
+ runtimeVersion: LWC_VERSION,
3172
+ });
3170
3173
  }
3171
3174
  }
3172
3175
  }
@@ -4902,7 +4905,12 @@ var LWC = (function (exports) {
4902
4905
  } else if (isVScopedSlotFragment(vnode)) {
4903
4906
  slotName = vnode.slotName;
4904
4907
  }
4905
- const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4908
+ // Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
4909
+ // but elm.setAttribute('slot', Symbol(1)) is an error.
4910
+ // the following line also throws same error for symbols
4911
+ // Similar for Object.create(null)
4912
+ const normalizedSlotName = '' + slotName;
4913
+ const vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
4906
4914
  ArrayPush$1.call(vnodes, vnode);
4907
4915
  }
4908
4916
  vm.cmpSlots = {
@@ -5968,6 +5976,8 @@ var LWC = (function (exports) {
5968
5976
  Ctor, { tmpl }) {
5969
5977
  if (isFunction$1(Ctor)) {
5970
5978
  if (process.env.NODE_ENV !== 'production') {
5979
+ // There is no point in running this in production, because the version mismatch check relies
5980
+ // on code comments which are stripped out in production by minifiers
5971
5981
  checkVersionMismatch(Ctor, 'component');
5972
5982
  }
5973
5983
  signedTemplateMap.set(Ctor, tmpl);
@@ -6233,6 +6243,7 @@ var LWC = (function (exports) {
6233
6243
  // Validate and flatten any stylesheets defined as `static stylesheets`
6234
6244
  function computeStylesheets(vm, ctor) {
6235
6245
  if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
6246
+ warnOnStylesheetsMutation(ctor);
6236
6247
  const {
6237
6248
  stylesheets
6238
6249
  } = ctor;
@@ -6247,6 +6258,24 @@ var LWC = (function (exports) {
6247
6258
  }
6248
6259
  return null;
6249
6260
  }
6261
+ function warnOnStylesheetsMutation(ctor) {
6262
+ if (process.env.NODE_ENV !== 'production') {
6263
+ let {
6264
+ stylesheets
6265
+ } = ctor;
6266
+ defineProperty(ctor, 'stylesheets', {
6267
+ enumerable: true,
6268
+ configurable: true,
6269
+ get() {
6270
+ return stylesheets;
6271
+ },
6272
+ set(newValue) {
6273
+ logWarnOnce(`Dynamically setting the "stylesheets" static property on ${ctor.name} ` + 'will not affect the stylesheets injected.');
6274
+ stylesheets = newValue;
6275
+ }
6276
+ });
6277
+ }
6278
+ }
6250
6279
  function computeShadowMode(vm, renderer) {
6251
6280
  const {
6252
6281
  def
@@ -6626,7 +6655,7 @@ var LWC = (function (exports) {
6626
6655
  function isSyntheticShadowRootInstance(rootNode) {
6627
6656
  return rootNode !== document && isTrue(rootNode.synthetic);
6628
6657
  }
6629
- function reportViolation(source, target, attrName) {
6658
+ function reportViolation$1(source, target, attrName) {
6630
6659
  // The vm is either for the source, the target, or both. Either one or both must be using synthetic
6631
6660
  // shadow for a violation to be detected.
6632
6661
  let vm = getAssociatedVMIfPresent(source.getRootNode().host);
@@ -6637,7 +6666,10 @@ var LWC = (function (exports) {
6637
6666
  // vm should never be undefined here, but just to be safe, bail out and don't report
6638
6667
  return;
6639
6668
  }
6640
- report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
6669
+ report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
6670
+ tagName: vm.tagName,
6671
+ attributeName: attrName,
6672
+ });
6641
6673
  if (process.env.NODE_ENV !== 'production') {
6642
6674
  // Avoid excessively logging to the console in the case of duplicates.
6643
6675
  logWarnOnce(`Element <${source.tagName.toLowerCase()}> uses attribute "${attrName}" to reference element ` +
@@ -6669,7 +6701,7 @@ var LWC = (function (exports) {
6669
6701
  const sourceElement = sourceElements[i];
6670
6702
  const sourceRoot = sourceElement.getRootNode();
6671
6703
  if (sourceRoot !== root) {
6672
- reportViolation(sourceElement, elm, idRefAttrName);
6704
+ reportViolation$1(sourceElement, elm, idRefAttrName);
6673
6705
  break;
6674
6706
  }
6675
6707
  }
@@ -6684,7 +6716,7 @@ var LWC = (function (exports) {
6684
6716
  const targetRoot = target.getRootNode();
6685
6717
  if (targetRoot !== root) {
6686
6718
  // target element's shadow root is not the same as ours
6687
- reportViolation(elm, target, attrName);
6719
+ reportViolation$1(elm, target, attrName);
6688
6720
  }
6689
6721
  }
6690
6722
  }
@@ -6693,7 +6725,7 @@ var LWC = (function (exports) {
6693
6725
  let enabled = false;
6694
6726
  // We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
6695
6727
  // reporting is not enabled. It should also only run once
6696
- function enableDetection() {
6728
+ function enableDetection$1() {
6697
6729
  if (enabled) {
6698
6730
  return; // don't double-apply the patches
6699
6731
  }
@@ -6745,14 +6777,112 @@ var LWC = (function (exports) {
6745
6777
  if (supportsCssEscape() && isSyntheticShadowLoaded()) {
6746
6778
  // Always run detection in dev mode, so we can at least print to the console
6747
6779
  if (process.env.NODE_ENV !== 'production') {
6748
- enableDetection();
6780
+ enableDetection$1();
6749
6781
  }
6750
6782
  else {
6751
6783
  // In prod mode, only enable detection if reporting is enabled
6752
- onReportingEnabled(enableDetection);
6784
+ onReportingEnabled(enableDetection$1);
6753
6785
  }
6754
6786
  }
6755
6787
 
6788
+ /*
6789
+ * Copyright (c) 2018, salesforce.com, inc.
6790
+ * All rights reserved.
6791
+ * SPDX-License-Identifier: MIT
6792
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6793
+ */
6794
+ //
6795
+ // The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
6796
+ // legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
6797
+ //
6798
+ // See the README for @lwc/aria-reflection
6799
+ const NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
6800
+ function isLightningElement(elm) {
6801
+ // The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
6802
+ // In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
6803
+ return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
6804
+ }
6805
+ function findVM(elm) {
6806
+ // If it's a shadow DOM component, then it has a host
6807
+ const {
6808
+ host
6809
+ } = elm.getRootNode();
6810
+ const vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
6811
+ if (!isUndefined$1(vm)) {
6812
+ return vm;
6813
+ }
6814
+ // Else it might be a light DOM component. Walk up the tree trying to find the owner
6815
+ let parentElement = elm;
6816
+ while (!isNull(parentElement = parentElement.parentElement)) {
6817
+ if (isLightningElement(parentElement)) {
6818
+ const vm = getAssociatedVMIfPresent(parentElement);
6819
+ if (!isUndefined$1(vm)) {
6820
+ return vm;
6821
+ }
6822
+ }
6823
+ }
6824
+ // If we return undefined, it's because the element was rendered wholly outside a LightningElement
6825
+ }
6826
+
6827
+ function checkAndReportViolation(elm, prop) {
6828
+ if (!isLightningElement(elm)) {
6829
+ const vm = findVM(elm);
6830
+ if (process.env.NODE_ENV !== 'production') {
6831
+ 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`);
6832
+ }
6833
+ report(2 /* ReportingEventId.NonStandardAriaReflection */, {
6834
+ tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
6835
+ propertyName: prop
6836
+ });
6837
+ }
6838
+ }
6839
+ function enableDetection() {
6840
+ const {
6841
+ prototype
6842
+ } = Element;
6843
+ for (const prop of NON_STANDARD_ARIA_PROPS) {
6844
+ const descriptor = getOwnPropertyDescriptor$1(prototype, prop);
6845
+ // The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
6846
+ // This happens automatically because of the ordering of imports.
6847
+ if (process.env.NODE_ENV !== 'production') {
6848
+ /* istanbul ignore if */
6849
+ if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
6850
+ // should never happen
6851
+ throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
6852
+ }
6853
+ }
6854
+ // @ts-ignore
6855
+ const {
6856
+ get,
6857
+ set
6858
+ } = descriptor;
6859
+ defineProperty(prototype, prop, {
6860
+ get() {
6861
+ checkAndReportViolation(this, prop);
6862
+ return get.call(this);
6863
+ },
6864
+ set(val) {
6865
+ checkAndReportViolation(this, prop);
6866
+ return set.call(this, val);
6867
+ },
6868
+ configurable: true,
6869
+ enumerable: true
6870
+ });
6871
+ }
6872
+ }
6873
+ // No point in running this code if we're not in a browser, or if the global polyfill is not loaded
6874
+ {
6875
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
6876
+ // Always run detection in dev mode, so we can at least print to the console
6877
+ if (process.env.NODE_ENV !== 'production') {
6878
+ enableDetection();
6879
+ } else {
6880
+ // In prod mode, only enable detection if reporting is enabled
6881
+ onReportingEnabled(enableDetection);
6882
+ }
6883
+ }
6884
+ }
6885
+
6756
6886
  /*
6757
6887
  * Copyright (c) 2018, salesforce.com, inc.
6758
6888
  * All rights reserved.
@@ -7237,12 +7367,13 @@ var LWC = (function (exports) {
7237
7367
  */
7238
7368
  // See @lwc/engine-core/src/framework/template.ts
7239
7369
  const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
7240
- // Via https://www.npmjs.com/package/object-observer
7241
- const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7242
7370
  // Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
7243
- const STYLESHEET_FUNCTION_EXPANDOS = [
7371
+ const STYLESHEET_PROPS = [
7244
7372
  // SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
7245
7373
  '$scoped$'];
7374
+ // Via https://www.npmjs.com/package/object-observer
7375
+ const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
7376
+ let mutationTrackingDisabled = false;
7246
7377
  function getOriginalArrayMethod(prop) {
7247
7378
  switch (prop) {
7248
7379
  case 'pop':
@@ -7265,7 +7396,20 @@ var LWC = (function (exports) {
7265
7396
  return ArrayCopyWithin;
7266
7397
  }
7267
7398
  }
7268
- let mutationWarningsSilenced = false;
7399
+ function reportViolation(type, eventId, prop) {
7400
+ if (process.env.NODE_ENV !== 'production') {
7401
+ 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`);
7402
+ }
7403
+ report(eventId, {
7404
+ propertyName: prop
7405
+ });
7406
+ }
7407
+ function reportTemplateViolation(prop) {
7408
+ reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
7409
+ }
7410
+ function reportStylesheetViolation(prop) {
7411
+ reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
7412
+ }
7269
7413
  // Warn if the user tries to mutate a stylesheets array, e.g.:
7270
7414
  // `tmpl.stylesheets.push(someStylesheetFunction)`
7271
7415
  function warnOnArrayMutation(stylesheets) {
@@ -7274,7 +7418,7 @@ var LWC = (function (exports) {
7274
7418
  for (const prop of ARRAY_MUTATION_METHODS) {
7275
7419
  const originalArrayMethod = getOriginalArrayMethod(prop);
7276
7420
  stylesheets[prop] = function arrayMutationWarningWrapper() {
7277
- logError(`Mutating the "stylesheets" array on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7421
+ reportTemplateViolation('stylesheets');
7278
7422
  // @ts-ignore
7279
7423
  return originalArrayMethod.apply(this, arguments);
7280
7424
  };
@@ -7283,8 +7427,7 @@ var LWC = (function (exports) {
7283
7427
  // Warn if the user tries to mutate a stylesheet factory function, e.g.:
7284
7428
  // `stylesheet.$scoped$ = true`
7285
7429
  function warnOnStylesheetFunctionMutation(stylesheet) {
7286
- // We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
7287
- for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
7430
+ for (const prop of STYLESHEET_PROPS) {
7288
7431
  let value = stylesheet[prop];
7289
7432
  defineProperty(stylesheet, prop, {
7290
7433
  enumerable: true,
@@ -7293,14 +7436,14 @@ var LWC = (function (exports) {
7293
7436
  return value;
7294
7437
  },
7295
7438
  set(newValue) {
7296
- logError(`Dynamically setting the "${prop}" property on a stylesheet function ` + `is deprecated and may be removed in a future version of LWC.`);
7439
+ reportStylesheetViolation(prop);
7297
7440
  value = newValue;
7298
7441
  }
7299
7442
  });
7300
7443
  }
7301
7444
  }
7302
7445
  // Warn on either array or stylesheet (function) mutation, in a deeply-nested array
7303
- function warnOnStylesheetsMutation(stylesheets) {
7446
+ function trackStylesheetsMutation(stylesheets) {
7304
7447
  traverseStylesheets(stylesheets, subStylesheets => {
7305
7448
  if (isArray$1(subStylesheets)) {
7306
7449
  warnOnArrayMutation(subStylesheets);
@@ -7327,7 +7470,70 @@ var LWC = (function (exports) {
7327
7470
  }
7328
7471
  }
7329
7472
  }
7473
+ function trackMutations(tmpl) {
7474
+ if (!isUndefined$1(tmpl.stylesheets)) {
7475
+ trackStylesheetsMutation(tmpl.stylesheets);
7476
+ }
7477
+ for (const prop of TEMPLATE_PROPS) {
7478
+ let value = tmpl[prop];
7479
+ defineProperty(tmpl, prop, {
7480
+ enumerable: true,
7481
+ configurable: true,
7482
+ get() {
7483
+ return value;
7484
+ },
7485
+ set(newValue) {
7486
+ if (!mutationTrackingDisabled) {
7487
+ reportTemplateViolation(prop);
7488
+ }
7489
+ value = newValue;
7490
+ }
7491
+ });
7492
+ }
7493
+ const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7494
+ defineProperty(tmpl, 'stylesheetTokens', {
7495
+ enumerable: true,
7496
+ configurable: true,
7497
+ get: originalDescriptor.get,
7498
+ set(value) {
7499
+ reportTemplateViolation('stylesheetTokens');
7500
+ // Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
7501
+ mutationTrackingDisabled = true;
7502
+ originalDescriptor.set.call(this, value);
7503
+ mutationTrackingDisabled = false;
7504
+ }
7505
+ });
7506
+ }
7507
+ function addLegacyStylesheetTokensShim(tmpl) {
7508
+ // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7509
+ // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7510
+ defineProperty(tmpl, 'stylesheetTokens', {
7511
+ enumerable: true,
7512
+ configurable: true,
7513
+ get() {
7514
+ const {
7515
+ stylesheetToken
7516
+ } = this;
7517
+ if (isUndefined$1(stylesheetToken)) {
7518
+ return stylesheetToken;
7519
+ }
7520
+ // Shim for the old `stylesheetTokens` property
7521
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7522
+ return {
7523
+ hostAttribute: `${stylesheetToken}-host`,
7524
+ shadowAttribute: stylesheetToken
7525
+ };
7526
+ },
7527
+ set(value) {
7528
+ // If the value is null or some other exotic object, you would be broken anyway in the past
7529
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7530
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7531
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7532
+ }
7533
+ });
7534
+ }
7330
7535
  function freezeTemplate(tmpl) {
7536
+ // TODO [#2782]: remove this flag and delete the legacy behavior
7331
7537
  if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
7332
7538
  // Deep freeze the template
7333
7539
  freeze(tmpl);
@@ -7335,66 +7541,16 @@ var LWC = (function (exports) {
7335
7541
  deepFreeze(tmpl.stylesheets);
7336
7542
  }
7337
7543
  } else {
7338
- // TODO [#2782]: remove this flag and delete the legacy behavior
7339
- // When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
7340
- // is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
7341
- defineProperty(tmpl, 'stylesheetTokens', {
7342
- enumerable: true,
7343
- configurable: true,
7344
- get() {
7345
- const {
7346
- stylesheetToken
7347
- } = this;
7348
- if (isUndefined$1(stylesheetToken)) {
7349
- return stylesheetToken;
7350
- }
7351
- // Shim for the old `stylesheetTokens` property
7352
- // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
7353
- return {
7354
- hostAttribute: `${stylesheetToken}-host`,
7355
- shadowAttribute: stylesheetToken
7356
- };
7357
- },
7358
- set(value) {
7359
- // If the value is null or some other exotic object, you would be broken anyway in the past
7360
- // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
7361
- // However it may be undefined in newer versions of LWC, so we need to guard against that case.
7362
- this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
7363
- }
7364
- });
7365
- // When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
7544
+ // template is not frozen - shim, report, and warn
7545
+ // this shim should be applied in both dev and prod
7546
+ addLegacyStylesheetTokensShim(tmpl);
7547
+ // When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
7366
7548
  if (process.env.NODE_ENV !== 'production') {
7367
- if (!isUndefined$1(tmpl.stylesheets)) {
7368
- warnOnStylesheetsMutation(tmpl.stylesheets);
7369
- }
7370
- for (const prop of TEMPLATE_PROPS) {
7371
- let value = tmpl[prop];
7372
- defineProperty(tmpl, prop, {
7373
- enumerable: true,
7374
- configurable: true,
7375
- get() {
7376
- return value;
7377
- },
7378
- set(newValue) {
7379
- if (!mutationWarningsSilenced) {
7380
- logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7381
- }
7382
- value = newValue;
7383
- }
7384
- });
7385
- }
7386
- const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
7387
- defineProperty(tmpl, 'stylesheetTokens', {
7388
- enumerable: true,
7389
- configurable: true,
7390
- get: originalDescriptor.get,
7391
- set(value) {
7392
- logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
7393
- // Avoid logging twice (for both stylesheetToken and stylesheetTokens)
7394
- mutationWarningsSilenced = true;
7395
- originalDescriptor.set.call(this, value);
7396
- mutationWarningsSilenced = false;
7397
- }
7549
+ trackMutations(tmpl);
7550
+ } else {
7551
+ // In prod mode, we only track mutations if reporting is enabled
7552
+ onReportingEnabled(() => {
7553
+ trackMutations(tmpl);
7398
7554
  });
7399
7555
  }
7400
7556
  }
@@ -7422,7 +7578,7 @@ var LWC = (function (exports) {
7422
7578
  }
7423
7579
  return ctor;
7424
7580
  }
7425
- /* version: 2.35.1 */
7581
+ /* version: 2.36.0 */
7426
7582
 
7427
7583
  /*
7428
7584
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7700,7 +7856,7 @@ var LWC = (function (exports) {
7700
7856
  const cachedConstructors = new Map();
7701
7857
  const elementsUpgradedOutsideLWC = new WeakSet();
7702
7858
  let elementBeingUpgradedByLWC = false;
7703
- // Creates a constructor that is intended to be used as a vanilla custom element, except that the upgradeCallback is
7859
+ // Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
7704
7860
  // passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
7705
7861
  // Another benefit is that only LWC can create components that actually do anything – if you do
7706
7862
  // `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
@@ -7745,7 +7901,7 @@ var LWC = (function (exports) {
7745
7901
  }
7746
7902
  return UpgradableConstructor;
7747
7903
  };
7748
- const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
7904
+ const createCustomElementUsingUpgradableConstructor = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
7749
7905
  // use global custom elements registry
7750
7906
  let UpgradableConstructor = cachedConstructors.get(tagName);
7751
7907
  if (isUndefined$1(UpgradableConstructor)) {
@@ -7773,7 +7929,7 @@ var LWC = (function (exports) {
7773
7929
  */
7774
7930
  /**
7775
7931
  * Create a scoped registry, i.e. a function that can create custom elements whose tag names
7776
- * do not conflict with vanilla custom elements having the same tag name.
7932
+ * do not conflict with third-party custom elements having the same tag name.
7777
7933
  */
7778
7934
  function createScopedRegistry() {
7779
7935
  if (!hasCustomElements) {
@@ -8314,10 +8470,10 @@ var LWC = (function (exports) {
8314
8470
  * We have three modes for creating custom elements:
8315
8471
  *
8316
8472
  * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
8317
- * 2. "Vanilla" custom elements registry. This system actually still allows us to have two LWC components with the
8318
- * same tag name, via a simple trick: every custom element constructor we define in the registry is basically
8319
- * the same. It's essentially a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its
8320
- * constructor, which allows us to have completely customized functionality for different components.
8473
+ * 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
8474
+ * via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
8475
+ * a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
8476
+ * constructor"), which allows us to have completely customized functionality for different components.
8321
8477
  * 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
8322
8478
  * elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
8323
8479
  * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
@@ -8328,8 +8484,8 @@ var LWC = (function (exports) {
8328
8484
  if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
8329
8485
  createCustomElement = createCustomElementScoped;
8330
8486
  } else {
8331
- // use global custom elements registry (vanilla)
8332
- createCustomElement = createCustomElementVanilla;
8487
+ // use the global registry, with an upgradable constructor for the defined custom element
8488
+ createCustomElement = createCustomElementUsingUpgradableConstructor;
8333
8489
  }
8334
8490
  } else {
8335
8491
  // no registry available here
@@ -8385,10 +8541,10 @@ var LWC = (function (exports) {
8385
8541
 
8386
8542
  var assert = /*#__PURE__*/Object.freeze({
8387
8543
  __proto__: null,
8544
+ fail: fail,
8388
8545
  invariant: invariant,
8389
- isTrue: isTrue$1,
8390
8546
  isFalse: isFalse$1,
8391
- fail: fail
8547
+ isTrue: isTrue$1
8392
8548
  });
8393
8549
  function isUndefined(obj) {
8394
8550
  return obj === undefined;
@@ -8396,7 +8552,7 @@ var LWC = (function (exports) {
8396
8552
  function isNull(obj) {
8397
8553
  return obj === null;
8398
8554
  }
8399
- /** version: 2.35.1 */
8555
+ /** version: 2.36.0 */
8400
8556
 
8401
8557
  /*
8402
8558
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8957,7 +9113,7 @@ var LWC = (function (exports) {
8957
9113
  });
8958
9114
  freeze(LightningElement);
8959
9115
  seal(LightningElement.prototype);
8960
- /* version: 2.35.1 */
9116
+ /* version: 2.36.0 */
8961
9117
 
8962
9118
  exports.LightningElement = LightningElement;
8963
9119
  exports.__unstable__ProfilerControl = profilerControl;