@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.
@@ -30,7 +30,6 @@ export declare const enum ShadowMode {
30
30
  Synthetic = 1
31
31
  }
32
32
  export declare const enum ShadowSupportMode {
33
- Any = "any",
34
33
  Default = "reset",
35
34
  Native = "native"
36
35
  }
package/dist/index.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (C) 2023 salesforce.com, inc.
2
+ * Copyright (c) 2024 Salesforce, Inc.
3
3
  */
4
4
  'use strict';
5
5
 
@@ -429,8 +429,8 @@ function isCircularModuleDependency(obj) {
429
429
  }
430
430
 
431
431
  var _a, _b;
432
- const instrumentDef = (_a = shared.globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : shared.noop;
433
- const instrumentInstance = (_b = shared.globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : shared.noop;
432
+ const instrumentDef = (_a = globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : shared.noop;
433
+ const instrumentInstance = (_b = globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : shared.noop;
434
434
 
435
435
  /*
436
436
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3147,7 +3147,6 @@ function createComponentDef(Ctor) {
3147
3147
  logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
3148
3148
  }
3149
3149
  if (!shared.isUndefined(ctorShadowSupportMode) &&
3150
- ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
3151
3150
  ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ &&
3152
3151
  ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
3153
3152
  logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
@@ -5483,7 +5482,6 @@ const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
5483
5482
  });
5484
5483
  function evaluateTemplate(vm, html) {
5485
5484
  if (process.env.NODE_ENV !== 'production') {
5486
- shared.assert.isTrue(shared.isFunction(html), `evaluateTemplate() second argument must be an imported template instead of ${shared.toString(html)}`);
5487
5485
  // in dev-mode, we support hot swapping of templates, which means that
5488
5486
  // the component instance might be attempting to use an old version of
5489
5487
  // the template, while internally, we have a replacement for it.
@@ -5502,6 +5500,10 @@ function evaluateTemplate(vm, html) {
5502
5500
  tro.observe(() => {
5503
5501
  // Reset the cache memoizer for template when needed.
5504
5502
  if (html !== cmpTemplate) {
5503
+ // Check that the template was built by the compiler.
5504
+ if (!isTemplateRegistered(html)) {
5505
+ 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: ${shared.toString(html)}.`);
5506
+ }
5505
5507
  if (process.env.NODE_ENV !== 'production') {
5506
5508
  validateLightDomTemplate(html, vm);
5507
5509
  }
@@ -5513,10 +5515,6 @@ function evaluateTemplate(vm, html) {
5513
5515
  // and snabbdom just rely on the IDs.
5514
5516
  resetComponentRoot(vm);
5515
5517
  }
5516
- // Check that the template was built by the compiler.
5517
- if (!isTemplateRegistered(html)) {
5518
- 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: ${shared.toString(html)}.`);
5519
- }
5520
5518
  vm.cmpTemplate = html;
5521
5519
  // Create a brand new template cache for the swapped templated.
5522
5520
  context.tplCache = shared.create(null);
@@ -5990,36 +5988,28 @@ function computeShadowMode(def, owner, renderer) {
5990
5988
  }
5991
5989
  const { isSyntheticShadowDefined } = renderer;
5992
5990
  let shadowMode;
5993
- // If ENABLE_FORCE_SHADOW_MIGRATE_MODE is true, then ShadowMode.Synthetic here will mean "force-migrate" mode.
5994
5991
  if (isSyntheticShadowDefined || lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
5995
5992
  if (def.renderMode === 0 /* RenderMode.Light */) {
5996
5993
  // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
5997
5994
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
5998
5995
  shadowMode = 0 /* ShadowMode.Native */;
5999
5996
  }
6000
- else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE ||
6001
- def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
6002
- if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */ ||
6003
- def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5997
+ else if (def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5998
+ shadowMode = 0 /* ShadowMode.Native */;
5999
+ }
6000
+ else {
6001
+ const shadowAncestor = getNearestShadowAncestor(owner);
6002
+ if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
6003
+ // Transitive support for native Shadow DOM. A component in native mode
6004
+ // transitively opts all of its descendants into native.
6004
6005
  shadowMode = 0 /* ShadowMode.Native */;
6005
6006
  }
6006
6007
  else {
6007
- const shadowAncestor = getNearestShadowAncestor(owner);
6008
- if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
6009
- // Transitive support for native Shadow DOM. A component in native mode
6010
- // transitively opts all of its descendants into native.
6011
- shadowMode = 0 /* ShadowMode.Native */;
6012
- }
6013
- else {
6014
- // Synthetic if neither this component nor any of its ancestors are configured
6015
- // to be native.
6016
- shadowMode = 1 /* ShadowMode.Synthetic */;
6017
- }
6008
+ // Synthetic if neither this component nor any of its ancestors are configured
6009
+ // to be native.
6010
+ shadowMode = 1 /* ShadowMode.Synthetic */;
6018
6011
  }
6019
6012
  }
6020
- else {
6021
- shadowMode = 1 /* ShadowMode.Synthetic */;
6022
- }
6023
6013
  }
6024
6014
  else {
6025
6015
  // Native if the synthetic shadow polyfill is unavailable.
@@ -6394,12 +6384,12 @@ function resetRefVNodes(vm) {
6394
6384
  // See: https://sfdc.co/synthetic-aria
6395
6385
  //
6396
6386
  // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
6397
- const getElementById = shared.globalThis[shared.KEY__NATIVE_GET_ELEMENT_BY_ID];
6398
- const querySelectorAll = shared.globalThis[shared.KEY__NATIVE_QUERY_SELECTOR_ALL];
6387
+ const getElementById = globalThis[shared.KEY__NATIVE_GET_ELEMENT_BY_ID];
6388
+ const querySelectorAll = globalThis[shared.KEY__NATIVE_QUERY_SELECTOR_ALL];
6399
6389
  // This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
6400
6390
  // so nobody else can misuse these global APIs.
6401
- delete shared.globalThis[shared.KEY__NATIVE_GET_ELEMENT_BY_ID];
6402
- delete shared.globalThis[shared.KEY__NATIVE_QUERY_SELECTOR_ALL];
6391
+ delete globalThis[shared.KEY__NATIVE_GET_ELEMENT_BY_ID];
6392
+ delete globalThis[shared.KEY__NATIVE_QUERY_SELECTOR_ALL];
6403
6393
  function isSyntheticShadowRootInstance(rootNode) {
6404
6394
  return rootNode !== document && shared.isTrue(rootNode.synthetic);
6405
6395
  }
@@ -7450,5 +7440,5 @@ exports.swapTemplate = swapTemplate;
7450
7440
  exports.track = track;
7451
7441
  exports.unwrap = unwrap;
7452
7442
  exports.wire = wire;
7453
- /** version: 6.0.0 */
7443
+ /** version: 6.1.0 */
7454
7444
  //# sourceMappingURL=index.cjs.js.map