@lwc/engine-core 6.0.0 → 6.1.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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Copyright (C) 2023 salesforce.com, inc.
2
+ * Copyright (c) 2024 Salesforce, Inc.
3
3
  */
4
- import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isAPIFeatureEnabled, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1, globalThis as globalThis$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, freeze, isObject, KEY__SYNTHETIC_MODE, isString, assert, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, ArrayShift, ArrayUnshift, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, LOWEST_API_VERSION, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, arrayEvery, ArrayIncludes, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse } from '@lwc/shared';
4
+ import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isAPIFeatureEnabled, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, freeze, isObject, KEY__SYNTHETIC_MODE, isString, assert, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, ArrayShift, ArrayUnshift, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, LOWEST_API_VERSION, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, arrayEvery, ArrayIncludes, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse } from '@lwc/shared';
5
5
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
6
6
 
7
7
  /*
@@ -425,8 +425,8 @@ function isCircularModuleDependency(obj) {
425
425
  }
426
426
 
427
427
  var _a, _b;
428
- const instrumentDef = (_a = globalThis$1.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : noop;
429
- const instrumentInstance = (_b = globalThis$1.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : noop;
428
+ const instrumentDef = (_a = globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : noop;
429
+ const instrumentInstance = (_b = globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : noop;
430
430
 
431
431
  /*
432
432
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3143,7 +3143,6 @@ function createComponentDef(Ctor) {
3143
3143
  logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
3144
3144
  }
3145
3145
  if (!isUndefined$1(ctorShadowSupportMode) &&
3146
- ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
3147
3146
  ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ &&
3148
3147
  ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
3149
3148
  logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
@@ -5479,7 +5478,6 @@ const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
5479
5478
  });
5480
5479
  function evaluateTemplate(vm, html) {
5481
5480
  if (process.env.NODE_ENV !== 'production') {
5482
- assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
5483
5481
  // in dev-mode, we support hot swapping of templates, which means that
5484
5482
  // the component instance might be attempting to use an old version of
5485
5483
  // the template, while internally, we have a replacement for it.
@@ -5498,6 +5496,10 @@ function evaluateTemplate(vm, html) {
5498
5496
  tro.observe(() => {
5499
5497
  // Reset the cache memoizer for template when needed.
5500
5498
  if (html !== cmpTemplate) {
5499
+ // Check that the template was built by the compiler.
5500
+ if (!isTemplateRegistered(html)) {
5501
+ throw new TypeError(`Invalid template returned by the render() method on ${vm.tagName}. It must return an imported template (e.g.: \`import html from "./${vm.def.name}.html"\`), instead, it has returned: ${toString$1(html)}.`);
5502
+ }
5501
5503
  if (process.env.NODE_ENV !== 'production') {
5502
5504
  validateLightDomTemplate(html, vm);
5503
5505
  }
@@ -5509,10 +5511,6 @@ function evaluateTemplate(vm, html) {
5509
5511
  // and snabbdom just rely on the IDs.
5510
5512
  resetComponentRoot(vm);
5511
5513
  }
5512
- // Check that the template was built by the compiler.
5513
- if (!isTemplateRegistered(html)) {
5514
- throw new TypeError(`Invalid template returned by the render() method on ${vm}. It must return an imported template (e.g.: \`import html from "./${vm.def.name}.html"\`), instead, it has returned: ${toString$1(html)}.`);
5515
- }
5516
5514
  vm.cmpTemplate = html;
5517
5515
  // Create a brand new template cache for the swapped templated.
5518
5516
  context.tplCache = create(null);
@@ -5986,36 +5984,28 @@ function computeShadowMode(def, owner, renderer) {
5986
5984
  }
5987
5985
  const { isSyntheticShadowDefined } = renderer;
5988
5986
  let shadowMode;
5989
- // If ENABLE_FORCE_SHADOW_MIGRATE_MODE is true, then ShadowMode.Synthetic here will mean "force-migrate" mode.
5990
5987
  if (isSyntheticShadowDefined || lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
5991
5988
  if (def.renderMode === 0 /* RenderMode.Light */) {
5992
5989
  // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
5993
5990
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
5994
5991
  shadowMode = 0 /* ShadowMode.Native */;
5995
5992
  }
5996
- else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE ||
5997
- def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5998
- if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */ ||
5999
- def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5993
+ else if (def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5994
+ shadowMode = 0 /* ShadowMode.Native */;
5995
+ }
5996
+ else {
5997
+ const shadowAncestor = getNearestShadowAncestor(owner);
5998
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
5999
+ // Transitive support for native Shadow DOM. A component in native mode
6000
+ // transitively opts all of its descendants into native.
6000
6001
  shadowMode = 0 /* ShadowMode.Native */;
6001
6002
  }
6002
6003
  else {
6003
- const shadowAncestor = getNearestShadowAncestor(owner);
6004
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
6005
- // Transitive support for native Shadow DOM. A component in native mode
6006
- // transitively opts all of its descendants into native.
6007
- shadowMode = 0 /* ShadowMode.Native */;
6008
- }
6009
- else {
6010
- // Synthetic if neither this component nor any of its ancestors are configured
6011
- // to be native.
6012
- shadowMode = 1 /* ShadowMode.Synthetic */;
6013
- }
6004
+ // Synthetic if neither this component nor any of its ancestors are configured
6005
+ // to be native.
6006
+ shadowMode = 1 /* ShadowMode.Synthetic */;
6014
6007
  }
6015
6008
  }
6016
- else {
6017
- shadowMode = 1 /* ShadowMode.Synthetic */;
6018
- }
6019
6009
  }
6020
6010
  else {
6021
6011
  // Native if the synthetic shadow polyfill is unavailable.
@@ -6390,12 +6380,12 @@ function resetRefVNodes(vm) {
6390
6380
  // See: https://sfdc.co/synthetic-aria
6391
6381
  //
6392
6382
  // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
6393
- const getElementById = globalThis$1[KEY__NATIVE_GET_ELEMENT_BY_ID];
6394
- const querySelectorAll = globalThis$1[KEY__NATIVE_QUERY_SELECTOR_ALL];
6383
+ const getElementById = globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
6384
+ const querySelectorAll = globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
6395
6385
  // This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
6396
6386
  // so nobody else can misuse these global APIs.
6397
- delete globalThis$1[KEY__NATIVE_GET_ELEMENT_BY_ID];
6398
- delete globalThis$1[KEY__NATIVE_QUERY_SELECTOR_ALL];
6387
+ delete globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
6388
+ delete globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
6399
6389
  function isSyntheticShadowRootInstance(rootNode) {
6400
6390
  return rootNode !== document && isTrue(rootNode.synthetic);
6401
6391
  }
@@ -7404,5 +7394,5 @@ function readonly(obj) {
7404
7394
  }
7405
7395
 
7406
7396
  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 };
7407
- /** version: 6.0.0 */
7397
+ /** version: 6.1.0 */
7408
7398
  //# sourceMappingURL=index.js.map