@lwc/engine-core 5.3.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.
@@ -1,3 +1,4 @@
1
1
  import { RendererAPI } from '../renderer';
2
- import { VBaseElement } from '../vnodes';
2
+ import { VBaseElement, VStatic } from '../vnodes';
3
3
  export declare function patchAttributes(oldVnode: VBaseElement | null, vnode: VBaseElement, renderer: RendererAPI): void;
4
+ export declare function patchSlotAssignment(oldVnode: VBaseElement | VStatic | null, vnode: VBaseElement | VStatic, renderer: RendererAPI): void;
@@ -42,7 +42,7 @@ export interface RendererAPI {
42
42
  isConnected: (node: N) => boolean;
43
43
  insertStylesheet: (content: string, target?: ShadowRoot) => void;
44
44
  assertInstanceOfHTMLElement: (elm: any, msg: string) => void;
45
- createCustomElement: (tagName: string, upgradeCallback: LifecycleCallback) => E;
45
+ createCustomElement: (tagName: string, upgradeCallback: LifecycleCallback, useNativeLifecycle: boolean) => E;
46
46
  defineCustomElement: (tagName: string) => void;
47
47
  ownerDocument(elm: E): Document;
48
48
  registerContextConsumer: (element: E, adapterContextToken: string, subscriptionPayload: WireContextSubscriptionPayload) => void;
@@ -1,4 +1,3 @@
1
- import { LightningElement } from './base-lightning-element';
2
1
  export declare function unlockDomMutation(): void;
3
2
  export declare function lockDomMutation(): void;
4
3
  export declare function patchElementWithRestrictions(elm: Element, options: {
@@ -8,4 +7,3 @@ export declare function patchElementWithRestrictions(elm: Element, options: {
8
7
  }): void;
9
8
  export declare function patchShadowRootWithRestrictions(sr: ShadowRoot): void;
10
9
  export declare function patchCustomElementWithRestrictions(elm: HTMLElement): void;
11
- export declare function patchLightningElementPrototypeWithRestrictions(proto: typeof LightningElement.prototype): void;
@@ -1,10 +1,12 @@
1
1
  import { StylesheetFactory, TemplateStylesheetFactories } from './stylesheet';
2
+ import { LightningElementConstructor } from './base-lightning-element';
2
3
  type Callback = () => void;
3
4
  export declare const SPACE_CHAR = 32;
4
5
  export declare const EmptyObject: any;
5
6
  export declare const EmptyArray: never[];
6
7
  export declare function addCallbackToNextTick(callback: Callback): void;
7
8
  export declare function guid(): string;
9
+ export declare function shouldUseNativeCustomElementLifecycle(ctor: LightningElementConstructor): boolean;
8
10
  export declare function parseStyleText(cssText: string): {
9
11
  [name: string]: string;
10
12
  };
@@ -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
  }
@@ -40,6 +40,7 @@ export interface VStatic extends BaseVNode {
40
40
  readonly fragment: Element;
41
41
  readonly parts: VStaticPart[] | undefined;
42
42
  elm: Element | undefined;
43
+ slotAssignment: string | undefined;
43
44
  }
44
45
  export interface VFragment extends BaseVNode, BaseVParent {
45
46
  sel: undefined;
@@ -65,6 +66,7 @@ export interface VBaseElement extends BaseVNode, BaseVParent {
65
66
  data: VElementData;
66
67
  elm: Element | undefined;
67
68
  key: Key;
69
+ slotAssignment: string | undefined;
68
70
  }
69
71
  export interface VElement extends VBaseElement {
70
72
  type: VNodeType.Element;
@@ -93,9 +95,11 @@ export interface VElementData extends VNodeData {
93
95
  readonly external?: boolean;
94
96
  readonly ref?: string;
95
97
  readonly slotData?: any;
98
+ readonly slotAssignment?: string;
96
99
  }
97
100
  export declare function isVBaseElement(vnode: VNode): vnode is VElement | VCustomElement;
98
101
  export declare function isSameVnode(vnode1: VNode, vnode2: VNode): boolean;
99
102
  export declare function isVCustomElement(vnode: VNode | VBaseElement): vnode is VCustomElement;
100
103
  export declare function isVFragment(vnode: VNode): vnode is VFragment;
101
104
  export declare function isVScopedSlotFragment(vnode: VNode): vnode is VScopedSlotFragment;
105
+ export declare function isVStatic(vnode: VNode): vnode is VStatic;
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
 
@@ -358,6 +358,14 @@ function guid() {
358
358
  }
359
359
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
360
360
  }
361
+ function shouldUseNativeCustomElementLifecycle(ctor) {
362
+ if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
363
+ // temporary "kill switch"
364
+ return false;
365
+ }
366
+ const apiVersion = getComponentAPIVersion(ctor);
367
+ return shared.isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
368
+ }
361
369
  // Borrowed from Vue template compiler.
362
370
  // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
363
371
  const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
@@ -421,8 +429,8 @@ function isCircularModuleDependency(obj) {
421
429
  }
422
430
 
423
431
  var _a, _b;
424
- const instrumentDef = (_a = shared.globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : shared.noop;
425
- 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;
426
434
 
427
435
  /*
428
436
  * Copyright (c) 2018, salesforce.com, inc.
@@ -726,28 +734,6 @@ function getCustomElementRestrictionsDescriptors(elm) {
726
734
  }),
727
735
  };
728
736
  }
729
- function getLightningElementPrototypeRestrictionsDescriptors(proto) {
730
- assertNotProd(); // this method should never leak to prod
731
- const originalDispatchEvent = proto.dispatchEvent;
732
- return {
733
- dispatchEvent: generateDataDescriptor({
734
- value(event) {
735
- const vm = getAssociatedVM(this);
736
- if (!shared.isNull(event) && shared.isObject(event)) {
737
- const { type } = event;
738
- if (!/^[a-z][a-z0-9_]*$/.test(type)) {
739
- logError(`Invalid event type "${type}" dispatched in element ${getComponentTag(vm)}.` +
740
- ` Event name must start with a lowercase letter and followed only lowercase` +
741
- ` letters, numbers, and underscores`, vm);
742
- }
743
- }
744
- // Typescript does not like it when you treat the `arguments` object as an array
745
- // @ts-ignore type-mismatch
746
- return originalDispatchEvent.apply(this, arguments);
747
- },
748
- }),
749
- };
750
- }
751
737
  // This routine will prevent access to certain properties on a shadow root instance to guarantee
752
738
  // that all components will work fine in IE11 and other browsers without shadow dom support.
753
739
  function patchShadowRootWithRestrictions(sr) {
@@ -758,9 +744,6 @@ function patchCustomElementWithRestrictions(elm) {
758
744
  const elmProto = shared.getPrototypeOf(elm);
759
745
  shared.setPrototypeOf(elm, shared.create(elmProto, restrictionsDescriptors));
760
746
  }
761
- function patchLightningElementPrototypeWithRestrictions(proto) {
762
- shared.defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
763
- }
764
747
 
765
748
  function updateComponentValue(vm, key, newValue) {
766
749
  const { cmpFields } = vm;
@@ -1944,9 +1927,6 @@ shared.defineProperty(LightningElement, 'CustomElementConstructor', {
1944
1927
  },
1945
1928
  configurable: true,
1946
1929
  });
1947
- if (process.env.NODE_ENV !== 'production') {
1948
- patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
1949
- }
1950
1930
 
1951
1931
  function createObservedFieldPropertyDescriptor(key) {
1952
1932
  return {
@@ -3167,7 +3147,6 @@ function createComponentDef(Ctor) {
3167
3147
  logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
3168
3148
  }
3169
3149
  if (!shared.isUndefined(ctorShadowSupportMode) &&
3170
- ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
3171
3150
  ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ &&
3172
3151
  ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
3173
3152
  logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
@@ -3595,6 +3574,9 @@ function isVFragment(vnode) {
3595
3574
  function isVScopedSlotFragment(vnode) {
3596
3575
  return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
3597
3576
  }
3577
+ function isVStatic(vnode) {
3578
+ return vnode.type === 4 /* VNodeType.Static */;
3579
+ }
3598
3580
 
3599
3581
  /*
3600
3582
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3643,6 +3625,20 @@ function patchAttributes(oldVnode, vnode, renderer) {
3643
3625
  }
3644
3626
  }
3645
3627
  }
3628
+ function patchSlotAssignment(oldVnode, vnode, renderer) {
3629
+ const { slotAssignment } = vnode;
3630
+ if ((oldVnode === null || oldVnode === void 0 ? void 0 : oldVnode.slotAssignment) === slotAssignment) {
3631
+ return;
3632
+ }
3633
+ const { elm } = vnode;
3634
+ const { setAttribute, removeAttribute } = renderer;
3635
+ if (shared.isUndefined(slotAssignment) || shared.isNull(slotAssignment)) {
3636
+ removeAttribute(elm, 'slot');
3637
+ }
3638
+ else {
3639
+ setAttribute(elm, 'slot', slotAssignment);
3640
+ }
3641
+ }
3646
3642
 
3647
3643
  /*
3648
3644
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4092,6 +4088,8 @@ function mountElement(vnode, parent, anchor, renderer) {
4092
4088
  }
4093
4089
  function patchStatic(n1, n2, renderer) {
4094
4090
  const elm = (n2.elm = n1.elm);
4091
+ // slotAssignments can only apply to the top level element, never to a static part.
4092
+ patchSlotAssignment(n1, n2, renderer);
4095
4093
  // The `refs` object is blown away in every re-render, so we always need to re-apply them
4096
4094
  applyStaticParts(elm, n2, renderer, false);
4097
4095
  }
@@ -4113,11 +4111,13 @@ function mountStatic(vnode, parent, anchor, renderer) {
4113
4111
  elm[shared.KEY__SHADOW_STATIC] = true;
4114
4112
  }
4115
4113
  }
4114
+ // slotAssignments can only apply to the top level element, never to a static part.
4115
+ patchSlotAssignment(null, vnode, renderer);
4116
4116
  insertNode(elm, parent, anchor, renderer);
4117
4117
  applyStaticParts(elm, vnode, renderer, true);
4118
4118
  }
4119
4119
  function mountCustomElement(vnode, parent, anchor, renderer) {
4120
- const { sel, owner } = vnode;
4120
+ const { sel, owner, ctor } = vnode;
4121
4121
  const { createCustomElement } = renderer;
4122
4122
  /**
4123
4123
  * Note: if the upgradable constructor does not expect, or throw when we new it
@@ -4135,7 +4135,8 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
4135
4135
  // compiler may generate tagnames with uppercase letters so - for backwards
4136
4136
  // compatibility, we lower case the tagname here.
4137
4137
  const normalizedTagname = sel.toLowerCase();
4138
- const elm = createCustomElement(normalizedTagname, upgradeCallback);
4138
+ const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
4139
+ const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle);
4139
4140
  vnode.elm = elm;
4140
4141
  vnode.vm = vm;
4141
4142
  linkNodeToShadow(elm, owner, renderer);
@@ -4147,7 +4148,7 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
4147
4148
  insertNode(elm, parent, anchor, renderer);
4148
4149
  if (vm) {
4149
4150
  if (process.env.IS_BROWSER) {
4150
- if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4151
+ if (!useNativeLifecycle) {
4151
4152
  if (process.env.NODE_ENV !== 'production') {
4152
4153
  // With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
4153
4154
  // noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
@@ -4338,6 +4339,7 @@ function patchElementPropsAndAttrsAndRefs$1(oldVnode, vnode, renderer) {
4338
4339
  patchStyleAttribute(oldVnode, vnode, renderer);
4339
4340
  patchAttributes(oldVnode, vnode, renderer);
4340
4341
  patchProps(oldVnode, vnode, renderer);
4342
+ patchSlotAssignment(oldVnode, vnode, renderer);
4341
4343
  // The `refs` object is blown away in every re-render, so we always need to re-apply them
4342
4344
  applyRefs(vnode, vnode.owner);
4343
4345
  }
@@ -4491,7 +4493,7 @@ function createViewModelHook(elm, vnode, renderer) {
4491
4493
  return vm;
4492
4494
  }
4493
4495
  function allocateInSlot(vm, children, owner) {
4494
- var _a, _b;
4496
+ var _a;
4495
4497
  const { cmpSlots: { slotAssignments: oldSlotsMapping }, } = vm;
4496
4498
  const cmpSlotsMapping = shared.create(null);
4497
4499
  // Collect all slots into cmpSlotsMapping
@@ -4501,8 +4503,8 @@ function allocateInSlot(vm, children, owner) {
4501
4503
  continue;
4502
4504
  }
4503
4505
  let slotName = '';
4504
- if (isVBaseElement(vnode)) {
4505
- slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
4506
+ if (isVBaseElement(vnode) || isVStatic(vnode)) {
4507
+ slotName = (_a = vnode.slotAssignment) !== null && _a !== void 0 ? _a : '';
4506
4508
  }
4507
4509
  else if (isVScopedSlotFragment(vnode)) {
4508
4510
  slotName = vnode.slotName;
@@ -4772,6 +4774,7 @@ function st(fragment, key, parts) {
4772
4774
  fragment,
4773
4775
  owner,
4774
4776
  parts,
4777
+ slotAssignment: undefined,
4775
4778
  };
4776
4779
  return vnode;
4777
4780
  }
@@ -4816,7 +4819,7 @@ function h(sel, data, children = EmptyArray) {
4816
4819
  }
4817
4820
  });
4818
4821
  }
4819
- const { key } = data;
4822
+ const { key, slotAssignment } = data;
4820
4823
  const vnode = {
4821
4824
  type: 2 /* VNodeType.Element */,
4822
4825
  sel,
@@ -4825,6 +4828,7 @@ function h(sel, data, children = EmptyArray) {
4825
4828
  elm: undefined,
4826
4829
  key,
4827
4830
  owner: vmBeingRendered,
4831
+ slotAssignment,
4828
4832
  };
4829
4833
  return vnode;
4830
4834
  }
@@ -4849,6 +4853,8 @@ function s(slotName, data, children, slotset) {
4849
4853
  shared.assert.isTrue(shared.isObject(data), `s() 2nd argument data must be an object.`);
4850
4854
  shared.assert.isTrue(shared.isArray(children), `h() 3rd argument children must be an array.`);
4851
4855
  }
4856
+ const vmBeingRendered = getVMBeingRendered();
4857
+ const { renderMode, apiVersion } = vmBeingRendered;
4852
4858
  if (!shared.isUndefined(slotset) &&
4853
4859
  !shared.isUndefined(slotset.slotAssignments) &&
4854
4860
  !shared.isUndefined(slotset.slotAssignments[slotName]) &&
@@ -4871,7 +4877,6 @@ function s(slotName, data, children, slotset) {
4871
4877
  }
4872
4878
  // If the passed slot content is factory, evaluate it and add the produced vnodes
4873
4879
  if (assignedNodeIsScopedSlot) {
4874
- const vmBeingRenderedInception = getVMBeingRendered();
4875
4880
  // Evaluate in the scope of the slot content's owner
4876
4881
  // if a slotset is provided, there will always be an owner. The only case where owner is
4877
4882
  // undefined is for root components, but root components cannot accept slotted content
@@ -4885,20 +4890,33 @@ function s(slotName, data, children, slotset) {
4885
4890
  });
4886
4891
  }
4887
4892
  finally {
4888
- setVMBeingRendered(vmBeingRenderedInception);
4893
+ setVMBeingRendered(vmBeingRendered);
4889
4894
  }
4890
4895
  }
4891
4896
  else {
4897
+ // This block is for standard slots (non-scoped slots)
4898
+ let clonedVNode;
4899
+ if (renderMode === 0 /* RenderMode.Light */ &&
4900
+ shared.isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) &&
4901
+ (isVBaseElement(vnode) || isVStatic(vnode)) &&
4902
+ // We only need to copy the vnodes when the slot assignment changes, copying every time causes issues with
4903
+ // disconnected/connected callback firing.
4904
+ vnode.slotAssignment !== data.slotAssignment) {
4905
+ // When the light DOM slot assignment (slot attribute) changes we can't use the same reference
4906
+ // to the vnode because the current way the diffing algo works, it will replace the original reference
4907
+ // to the host element with a new one. This means the new element will be mounted and immediately unmounted.
4908
+ // Creating a copy of the vnode to preserve a reference to the previous host element.
4909
+ clonedVNode = Object.assign(Object.assign({}, vnode), { slotAssignment: data.slotAssignment });
4910
+ }
4892
4911
  // If the slot content is standard type, the content is static, no additional
4893
4912
  // processing needed on the vnode
4894
- shared.ArrayPush.call(newChildren, vnode);
4913
+ shared.ArrayPush.call(newChildren, clonedVNode !== null && clonedVNode !== void 0 ? clonedVNode : vnode);
4895
4914
  }
4896
4915
  }
4897
4916
  }
4898
4917
  children = newChildren;
4899
4918
  }
4900
- const vmBeingRendered = getVMBeingRendered();
4901
- const { renderMode, shadowMode, apiVersion } = vmBeingRendered;
4919
+ const { shadowMode } = vmBeingRendered;
4902
4920
  if (renderMode === 0 /* RenderMode.Light */) {
4903
4921
  // light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
4904
4922
  if (shared.isAPIFeatureEnabled(2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */, apiVersion)) {
@@ -4940,7 +4958,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
4940
4958
  });
4941
4959
  }
4942
4960
  }
4943
- const { key } = data;
4961
+ const { key, slotAssignment } = data;
4944
4962
  let elm, aChildren, vm;
4945
4963
  const vnode = {
4946
4964
  type: 3 /* VNodeType.CustomElement */,
@@ -4949,6 +4967,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
4949
4967
  children,
4950
4968
  elm,
4951
4969
  key,
4970
+ slotAssignment,
4952
4971
  ctor: Ctor,
4953
4972
  owner: vmBeingRendered,
4954
4973
  mode: 'open', // TODO [#1294]: this should be defined in Ctor
@@ -5463,7 +5482,6 @@ const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
5463
5482
  });
5464
5483
  function evaluateTemplate(vm, html) {
5465
5484
  if (process.env.NODE_ENV !== 'production') {
5466
- shared.assert.isTrue(shared.isFunction(html), `evaluateTemplate() second argument must be an imported template instead of ${shared.toString(html)}`);
5467
5485
  // in dev-mode, we support hot swapping of templates, which means that
5468
5486
  // the component instance might be attempting to use an old version of
5469
5487
  // the template, while internally, we have a replacement for it.
@@ -5482,6 +5500,10 @@ function evaluateTemplate(vm, html) {
5482
5500
  tro.observe(() => {
5483
5501
  // Reset the cache memoizer for template when needed.
5484
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
+ }
5485
5507
  if (process.env.NODE_ENV !== 'production') {
5486
5508
  validateLightDomTemplate(html, vm);
5487
5509
  }
@@ -5493,10 +5515,6 @@ function evaluateTemplate(vm, html) {
5493
5515
  // and snabbdom just rely on the IDs.
5494
5516
  resetComponentRoot(vm);
5495
5517
  }
5496
- // Check that the template was built by the compiler.
5497
- if (!isTemplateRegistered(html)) {
5498
- 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)}.`);
5499
- }
5500
5518
  vm.cmpTemplate = html;
5501
5519
  // Create a brand new template cache for the swapped templated.
5502
5520
  context.tplCache = shared.create(null);
@@ -5798,7 +5816,7 @@ function resetComponentStateWhenRemoved(vm) {
5798
5816
  // old vnode.children is removed from the DOM.
5799
5817
  function removeVM(vm) {
5800
5818
  if (process.env.NODE_ENV !== 'production') {
5801
- if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
5819
+ if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
5802
5820
  // With native lifecycle, we cannot be certain that connectedCallback was called before a component
5803
5821
  // was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
5804
5822
  // in native mode, although it will fire in synthetic mode due to appendChild triggering it.
@@ -5970,36 +5988,28 @@ function computeShadowMode(def, owner, renderer) {
5970
5988
  }
5971
5989
  const { isSyntheticShadowDefined } = renderer;
5972
5990
  let shadowMode;
5973
- // If ENABLE_FORCE_SHADOW_MIGRATE_MODE is true, then ShadowMode.Synthetic here will mean "force-migrate" mode.
5974
5991
  if (isSyntheticShadowDefined || lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
5975
5992
  if (def.renderMode === 0 /* RenderMode.Light */) {
5976
5993
  // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
5977
5994
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
5978
5995
  shadowMode = 0 /* ShadowMode.Native */;
5979
5996
  }
5980
- else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE ||
5981
- def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5982
- if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */ ||
5983
- 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.
5984
6005
  shadowMode = 0 /* ShadowMode.Native */;
5985
6006
  }
5986
6007
  else {
5987
- const shadowAncestor = getNearestShadowAncestor(owner);
5988
- if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
5989
- // Transitive support for native Shadow DOM. A component in native mode
5990
- // transitively opts all of its descendants into native.
5991
- shadowMode = 0 /* ShadowMode.Native */;
5992
- }
5993
- else {
5994
- // Synthetic if neither this component nor any of its ancestors are configured
5995
- // to be native.
5996
- shadowMode = 1 /* ShadowMode.Synthetic */;
5997
- }
6008
+ // Synthetic if neither this component nor any of its ancestors are configured
6009
+ // to be native.
6010
+ shadowMode = 1 /* ShadowMode.Synthetic */;
5998
6011
  }
5999
6012
  }
6000
- else {
6001
- shadowMode = 1 /* ShadowMode.Synthetic */;
6002
- }
6003
6013
  }
6004
6014
  else {
6005
6015
  // Native if the synthetic shadow polyfill is unavailable.
@@ -6126,7 +6136,7 @@ function runConnectedCallback(vm) {
6126
6136
  // This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
6127
6137
  // we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
6128
6138
  if (process.env.IS_BROWSER &&
6129
- !lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE &&
6139
+ !shouldUseNativeCustomElementLifecycle(vm.component.constructor) &&
6130
6140
  (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
6131
6141
  if (!vm.renderer.isConnected(vm.elm)) {
6132
6142
  if (process.env.NODE_ENV !== 'production') {
@@ -6374,12 +6384,12 @@ function resetRefVNodes(vm) {
6374
6384
  // See: https://sfdc.co/synthetic-aria
6375
6385
  //
6376
6386
  // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
6377
- const getElementById = shared.globalThis[shared.KEY__NATIVE_GET_ELEMENT_BY_ID];
6378
- 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];
6379
6389
  // This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
6380
6390
  // so nobody else can misuse these global APIs.
6381
- delete shared.globalThis[shared.KEY__NATIVE_GET_ELEMENT_BY_ID];
6382
- 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];
6383
6393
  function isSyntheticShadowRootInstance(rootNode) {
6384
6394
  return rootNode !== document && shared.isTrue(rootNode.synthetic);
6385
6395
  }
@@ -7430,5 +7440,5 @@ exports.swapTemplate = swapTemplate;
7430
7440
  exports.track = track;
7431
7441
  exports.unwrap = unwrap;
7432
7442
  exports.wire = wire;
7433
- /** version: 5.3.0 */
7443
+ /** version: 6.1.0 */
7434
7444
  //# sourceMappingURL=index.cjs.js.map