@lwc/engine-core 6.3.1 → 6.3.2

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.
package/dist/index.js CHANGED
@@ -522,6 +522,18 @@ function applyTemporaryCompilerV5SlotFix(data) {
522
522
  }
523
523
  return data;
524
524
  }
525
+ function shouldBeFormAssociated(Ctor) {
526
+ const ctorFormAssociated = Boolean(Ctor.formAssociated);
527
+ const apiVersion = getComponentAPIVersion(Ctor);
528
+ const apiFeatureEnabled = isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion);
529
+ if (process.env.NODE_ENV !== 'production' && ctorFormAssociated && !apiFeatureEnabled) {
530
+ const tagName = getComponentRegisteredName(Ctor);
531
+ logWarnOnce(`Component <${tagName}> set static formAssociated to true, but form ` +
532
+ `association is not enabled because the API version is ${apiVersion}. To enable form association, ` +
533
+ `update the LWC component API version to 61 or above. https://lwc.dev/guide/versioning`);
534
+ }
535
+ return ctorFormAssociated && apiFeatureEnabled;
536
+ }
525
537
 
526
538
  /*
527
539
  * Copyright (c) 2020, salesforce.com, inc.
@@ -1757,8 +1769,10 @@ LightningElement.prototype = {
1757
1769
  attachInternals() {
1758
1770
  const vm = getAssociatedVM(this);
1759
1771
  const { elm, apiVersion, renderer: { attachInternals }, } = vm;
1760
- if (!isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS */, apiVersion)) {
1761
- throw new Error(`The attachInternals API is only supported in API version 61 and above. To use this API please update the LWC component API version.`);
1772
+ if (!isAPIFeatureEnabled(8 /* APIFeature.ENABLE_ELEMENT_INTERNALS_AND_FACE */, apiVersion)) {
1773
+ throw new Error(`The attachInternals API is only supported in API version 61 and above. ` +
1774
+ `The current version is ${apiVersion}. ` +
1775
+ `To use this API, update the LWC component API version. https://lwc.dev/guide/versioning`);
1762
1776
  }
1763
1777
  if (vm.shadowMode === 1 /* ShadowMode.Synthetic */) {
1764
1778
  throw new Error('attachInternals API is not supported in synthetic shadow.');
@@ -2001,11 +2015,10 @@ function createObservedFieldPropertyDescriptor(key) {
2001
2015
  */
2002
2016
  const AdapterToTokenMap = new Map();
2003
2017
  function createContextProviderWithRegister(adapter, registerContextProvider) {
2004
- let adapterContextToken = AdapterToTokenMap.get(adapter);
2005
- if (!isUndefined$1(adapterContextToken)) {
2018
+ if (AdapterToTokenMap.has(adapter)) {
2006
2019
  throw new Error(`Adapter already has a context provider.`);
2007
2020
  }
2008
- adapterContextToken = guid();
2021
+ const adapterContextToken = guid();
2009
2022
  AdapterToTokenMap.set(adapter, adapterContextToken);
2010
2023
  const providers = new WeakSet();
2011
2024
  return (elmOrComponent, options) => {
@@ -4237,7 +4250,7 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
4237
4250
  // compatibility, we lower case the tagname here.
4238
4251
  const normalizedTagname = sel.toLowerCase();
4239
4252
  const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
4240
- const isFormAssociated = Boolean(ctor.formAssociated);
4253
+ const isFormAssociated = shouldBeFormAssociated(ctor);
4241
4254
  const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle, isFormAssociated);
4242
4255
  vnode.elm = elm;
4243
4256
  vnode.vm = vm;
@@ -6967,7 +6980,8 @@ function hydrateCustomElement(elm, vnode, renderer) {
6967
6980
  }
6968
6981
  const { sel, mode, ctor, owner } = vnode;
6969
6982
  const { defineCustomElement, getTagName } = renderer;
6970
- defineCustomElement(StringToLowerCase.call(getTagName(elm)), Boolean(ctor.formAssociated));
6983
+ const isFormAssociated = shouldBeFormAssociated(ctor);
6984
+ defineCustomElement(StringToLowerCase.call(getTagName(elm)), isFormAssociated);
6971
6985
  const vm = createVM(elm, ctor, renderer, {
6972
6986
  mode,
6973
6987
  owner,
@@ -7544,6 +7558,6 @@ function readonly(obj) {
7544
7558
  return getReadOnlyProxy(obj);
7545
7559
  }
7546
7560
 
7547
- export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7548
- /** version: 6.3.1 */
7561
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7562
+ /** version: 6.3.2 */
7549
7563
  //# sourceMappingURL=index.js.map