@lwc/engine-core 3.5.0 → 3.7.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,8 +1,9 @@
1
1
  import { SlotSet } from './vm';
2
2
  import { LightningElementConstructor } from './base-lightning-element';
3
- import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData, VStatic, Key, VFragment, VScopedSlotFragment, VStaticElementData } from './vnodes';
3
+ import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData, VStatic, Key, VFragment, VScopedSlotFragment, VStaticPart, VStaticPartData } from './vnodes';
4
+ declare function sp(partId: number, data: VStaticPartData): VStaticPart;
4
5
  declare function ssf(slotName: unknown, factory: (value: any, key: any) => VFragment): VScopedSlotFragment;
5
- declare function st(fragment: Element, key: Key, data?: VStaticElementData): VStatic;
6
+ declare function st(fragment: Element, key: Key, parts?: VStaticPart[]): VStatic;
6
7
  declare function fr(key: Key, children: VNodes, stable: 0 | 1): VFragment;
7
8
  declare function h(sel: string, data: VElementData, children?: VNodes): VElement;
8
9
  declare function ti(value: any): number;
@@ -56,6 +57,7 @@ declare const api: Readonly<{
56
57
  shc: typeof shc;
57
58
  ssf: typeof ssf;
58
59
  ddc: typeof ddc;
60
+ sp: typeof sp;
59
61
  }>;
60
62
  export default api;
61
63
  export type RenderAPI = typeof api;
@@ -3,5 +3,5 @@ export interface HTMLElementConstructor {
3
3
  prototype: HTMLElement;
4
4
  new (): HTMLElement;
5
5
  }
6
- export declare function HTMLBridgeElementFactory(SuperClass: HTMLElementConstructor, publicProperties: string[], methods: string[], observedFields: string[], proto: LightningElement | null): HTMLElementConstructor;
6
+ export declare function HTMLBridgeElementFactory(SuperClass: HTMLElementConstructor, publicProperties: string[], methods: string[], observedFields: string[], proto: LightningElement | null, hasCustomSuperClass: boolean): HTMLElementConstructor;
7
7
  export declare const BaseBridgeElement: HTMLElementConstructor;
@@ -1,3 +1,3 @@
1
1
  import { RendererAPI } from '../renderer';
2
- import { VBaseElement, VStatic } from '../vnodes';
3
- export declare function applyEventListeners(vnode: VBaseElement | VStatic, renderer: RendererAPI): void;
2
+ import { VBaseElement, VStaticPart } from '../vnodes';
3
+ export declare function applyEventListeners(vnode: VBaseElement | VStaticPart, renderer: RendererAPI): void;
@@ -0,0 +1,3 @@
1
+ import { VM } from '../vm';
2
+ import { VBaseElement, VStaticPart } from '../vnodes';
3
+ export declare function applyRefs(vnode: VBaseElement | VStaticPart, owner: VM): void;
@@ -0,0 +1,10 @@
1
+ import { VStatic } from '../vnodes';
2
+ import { RendererAPI } from '../renderer';
3
+ /**
4
+ * Given an array of static parts, do all the mounting required for these parts.
5
+ *
6
+ * @param root - the root element
7
+ * @param vnode - the parent VStatic
8
+ * @param renderer - the renderer to use
9
+ */
10
+ export declare function applyStaticParts(root: Element, vnode: VStatic, renderer: RendererAPI): void;
@@ -14,6 +14,7 @@ export interface RendererAPI {
14
14
  createText: (content: string) => N;
15
15
  createComment: (content: string) => N;
16
16
  nextSibling: (node: N) => N | null;
17
+ previousSibling: (node: N) => N | null;
17
18
  attachShadow: (element: E, options: ShadowRootInit) => N;
18
19
  getProperty: (node: N, key: string) => any;
19
20
  setProperty: (node: N, key: string, value: any) => void;
@@ -1,6 +1,4 @@
1
1
  import { StylesheetFactory, TemplateStylesheetFactories } from './stylesheet';
2
- import { VM } from './vm';
3
- import { VBaseElement, VStatic } from './vnodes';
4
2
  type Callback = () => void;
5
3
  export declare const SPACE_CHAR = 32;
6
4
  export declare const EmptyObject: any;
@@ -16,6 +14,5 @@ export declare function cloneAndOmitKey(object: {
16
14
  [key: string]: any;
17
15
  };
18
16
  export declare function flattenStylesheets(stylesheets: TemplateStylesheetFactories): StylesheetFactory[];
19
- export declare function setRefVNode(vm: VM, ref: string, vnode: VBaseElement | VStatic): void;
20
17
  export declare function assertNotProd(): void;
21
18
  export {};
@@ -3,7 +3,7 @@ import { Template } from './template';
3
3
  import { ComponentDef } from './def';
4
4
  import { LightningElement, LightningElementConstructor } from './base-lightning-element';
5
5
  import { ReactiveObserver } from './mutation-tracker';
6
- import { VNodes, VCustomElement, VNode, VBaseElement, VStatic } from './vnodes';
6
+ import { VNodes, VCustomElement, VNode, VBaseElement, VStaticPart } from './vnodes';
7
7
  import { TemplateStylesheetFactories } from './stylesheet';
8
8
  type ShadowRootMode = 'open' | 'closed';
9
9
  export interface TemplateCache {
@@ -30,7 +30,8 @@ export declare const enum ShadowMode {
30
30
  }
31
31
  export declare const enum ShadowSupportMode {
32
32
  Any = "any",
33
- Default = "reset"
33
+ Default = "reset",
34
+ Native = "native"
34
35
  }
35
36
  export declare const enum LwcDomMode {
36
37
  Manual = "manual"
@@ -61,7 +62,7 @@ export interface Context {
61
62
  wiredDisconnecting: Array<() => void>;
62
63
  }
63
64
  export type RefVNodes = {
64
- [name: string]: VBaseElement | VStatic;
65
+ [name: string]: VBaseElement | VStaticPart;
65
66
  };
66
67
  export interface VM<N = HostNode, E = HostElement> {
67
68
  /** The host element */
@@ -27,13 +27,18 @@ export interface VScopedSlotFragment extends BaseVNode {
27
27
  type: VNodeType.ScopedSlotFragment;
28
28
  slotName: unknown;
29
29
  }
30
- export type VStaticElementData = Pick<VElementData, 'on' | 'ref'>;
30
+ export interface VStaticPart {
31
+ readonly partId: number;
32
+ readonly data: VStaticPartData;
33
+ elm: Element | undefined;
34
+ }
35
+ export type VStaticPartData = Pick<VElementData, 'on' | 'ref'>;
31
36
  export interface VStatic extends BaseVNode {
32
37
  readonly type: VNodeType.Static;
33
38
  readonly sel: undefined;
34
39
  readonly key: Key;
35
40
  readonly fragment: Element;
36
- readonly data: VStaticElementData | undefined;
41
+ readonly parts: VStaticPart[] | undefined;
37
42
  elm: Element | undefined;
38
43
  }
39
44
  export interface VFragment extends BaseVNode, BaseVParent {
package/dist/index.cjs.js CHANGED
@@ -392,20 +392,6 @@ function flattenStylesheets(stylesheets) {
392
392
  }
393
393
  return list;
394
394
  }
395
- // Set a ref (lwc:ref) on a VM, from a template API
396
- function setRefVNode(vm, ref, vnode) {
397
- if (process.env.NODE_ENV !== 'production' && shared.isUndefined(vm.refVNodes)) {
398
- throw new Error('refVNodes must be defined when setting a ref');
399
- }
400
- // If this method is called, then vm.refVNodes is set as the template has refs.
401
- // If not, then something went wrong and we threw an error above.
402
- const refVNodes = vm.refVNodes;
403
- // In cases of conflict (two elements with the same ref), prefer, the last one,
404
- // in depth-first traversal order.
405
- if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
406
- refVNodes[ref] = vnode;
407
- }
408
- }
409
395
  // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
410
396
  function assertNotProd() {
411
397
  /* istanbul ignore if */
@@ -2624,7 +2610,7 @@ function createAccessorThatWarns(propName) {
2624
2610
  configurable: true,
2625
2611
  };
2626
2612
  }
2627
- function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto) {
2613
+ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
2628
2614
  const HTMLBridgeElement = class extends SuperClass {
2629
2615
  };
2630
2616
  // generating the hash table for attributes to avoid duplicate fields and facilitate validation
@@ -2635,7 +2621,8 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
2635
2621
  const descriptors = shared.create(null);
2636
2622
  // present a hint message so that developers are aware that they have not decorated property with @api
2637
2623
  if (process.env.NODE_ENV !== 'production') {
2638
- if (!shared.isUndefined(proto) && !shared.isNull(proto)) {
2624
+ // TODO [#3761]: enable for components that don't extend from LightningElement
2625
+ if (!shared.isUndefined(proto) && !shared.isNull(proto) && !hasCustomSuperClass) {
2639
2626
  const nonPublicPropertiesToWarnOn = new Set([
2640
2627
  // getters, setters, and methods
2641
2628
  ...shared.keys(shared.getOwnPropertyDescriptors(proto)),
@@ -2716,7 +2703,7 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
2716
2703
  shared.defineProperties(HTMLBridgeElement.prototype, descriptors);
2717
2704
  return HTMLBridgeElement;
2718
2705
  }
2719
- const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, shared.getOwnPropertyNames(HTMLElementOriginalDescriptors), [], [], null);
2706
+ const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, shared.getOwnPropertyNames(HTMLElementOriginalDescriptors), [], [], null, false);
2720
2707
  if (process.env.IS_BROWSER) {
2721
2708
  // This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
2722
2709
  // so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
@@ -3026,7 +3013,8 @@ function createComponentDef(Ctor) {
3026
3013
  }
3027
3014
  if (!shared.isUndefined(ctorShadowSupportMode) &&
3028
3015
  ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
3029
- ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */) {
3016
+ ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ &&
3017
+ ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
3030
3018
  logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
3031
3019
  }
3032
3020
  if (!shared.isUndefined(ctorRenderMode) &&
@@ -3040,8 +3028,9 @@ function createComponentDef(Ctor) {
3040
3028
  const proto = Ctor.prototype;
3041
3029
  let { connectedCallback, disconnectedCallback, renderedCallback, errorCallback, formAssociatedCallback, formResetCallback, formDisabledCallback, formStateRestoreCallback, render, } = proto;
3042
3030
  const superProto = getCtorProto(Ctor);
3043
- const superDef = superProto !== LightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
3044
- const bridge = HTMLBridgeElementFactory(superDef.bridge, shared.keys(apiFields), shared.keys(apiMethods), shared.keys(observedFields), proto);
3031
+ const hasCustomSuperClass = superProto !== LightningElement;
3032
+ const superDef = hasCustomSuperClass ? getComponentInternalDef(superProto) : lightingElementDef;
3033
+ const bridge = HTMLBridgeElementFactory(superDef.bridge, shared.keys(apiFields), shared.keys(apiMethods), shared.keys(observedFields), proto, hasCustomSuperClass);
3045
3034
  const props = shared.assign(shared.create(null), superDef.props, apiFields);
3046
3035
  const propsConfig = shared.assign(shared.create(null), superDef.propsConfig, apiFieldsConfig);
3047
3036
  const methods = shared.assign(shared.create(null), superDef.methods, apiMethods);
@@ -3699,6 +3688,106 @@ function applyStaticStyleAttribute(vnode, renderer) {
3699
3688
  }
3700
3689
  }
3701
3690
 
3691
+ /*
3692
+ * Copyright (c) 2023, salesforce.com, inc.
3693
+ * All rights reserved.
3694
+ * SPDX-License-Identifier: MIT
3695
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3696
+ */
3697
+ // Set a ref (lwc:ref) on a VM, from a template API
3698
+ function applyRefs(vnode, owner) {
3699
+ const { data } = vnode;
3700
+ const { ref } = data;
3701
+ if (shared.isUndefined(ref)) {
3702
+ return;
3703
+ }
3704
+ if (process.env.NODE_ENV !== 'production' && shared.isUndefined(owner.refVNodes)) {
3705
+ throw new Error('refVNodes must be defined when setting a ref');
3706
+ }
3707
+ // If this method is called, then vm.refVNodes is set as the template has refs.
3708
+ // If not, then something went wrong and we threw an error above.
3709
+ const refVNodes = owner.refVNodes;
3710
+ // In cases of conflict (two elements with the same ref), prefer the last one,
3711
+ // in depth-first traversal order. This happens automatically due to how we render
3712
+ refVNodes[ref] = vnode;
3713
+ }
3714
+
3715
+ /*
3716
+ * Copyright (c) 2023, salesforce.com, inc.
3717
+ * All rights reserved.
3718
+ * SPDX-License-Identifier: MIT
3719
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3720
+ */
3721
+ function traverseAndSetElements(root, parts, renderer) {
3722
+ const numParts = parts.length;
3723
+ // Optimization given that, in most cases, there will be one part, and it's just the root
3724
+ if (numParts === 1) {
3725
+ const firstPart = parts[0];
3726
+ if (firstPart.partId === 0) {
3727
+ // 0 means the root node
3728
+ firstPart.elm = root;
3729
+ return;
3730
+ }
3731
+ }
3732
+ const partIdsToParts = new Map();
3733
+ for (const staticPart of parts) {
3734
+ partIdsToParts.set(staticPart.partId, staticPart);
3735
+ }
3736
+ let numFoundParts = 0;
3737
+ const { previousSibling, getLastChild } = renderer;
3738
+ const stack = [root];
3739
+ let partId = -1;
3740
+ // Depth-first traversal. We assign a partId to each element, which is an integer based on traversal order.
3741
+ while (stack.length > 0) {
3742
+ const elm = shared.ArrayShift.call(stack);
3743
+ partId++;
3744
+ const part = partIdsToParts.get(partId);
3745
+ if (!shared.isUndefined(part)) {
3746
+ part.elm = elm;
3747
+ if (++numFoundParts === numParts) {
3748
+ return; // perf optimization - stop traversing once we've found everything we need
3749
+ }
3750
+ }
3751
+ // For depth-first traversal, prepend to the stack in reverse order
3752
+ // Note that we traverse using `*Child`/`*Sibling` rather than `children` because the browser uses a linked
3753
+ // list under the hood to represent the DOM tree, so it's faster to do this than to create an underlying array
3754
+ // by calling `children`.
3755
+ let child = getLastChild(elm);
3756
+ while (!shared.isNull(child)) {
3757
+ shared.ArrayUnshift.call(stack, child);
3758
+ child = previousSibling(child);
3759
+ }
3760
+ }
3761
+ if (process.env.NODE_ENV !== 'production') {
3762
+ shared.assert.isTrue(numFoundParts === numParts, `Should have found all parts by now. Found ${numFoundParts}, needed ${numParts}.`);
3763
+ }
3764
+ }
3765
+ /**
3766
+ * Given an array of static parts, do all the mounting required for these parts.
3767
+ *
3768
+ * @param root - the root element
3769
+ * @param vnode - the parent VStatic
3770
+ * @param renderer - the renderer to use
3771
+ */
3772
+ function applyStaticParts(root, vnode, renderer) {
3773
+ // On the server, we don't support ref (because it relies on renderedCallback), nor do we
3774
+ // support event listeners (no interactivity), so traversing parts makes no sense
3775
+ if (!process.env.IS_BROWSER) {
3776
+ return;
3777
+ }
3778
+ const { parts, owner } = vnode;
3779
+ if (shared.isUndefined(parts)) {
3780
+ return;
3781
+ }
3782
+ traverseAndSetElements(root, parts, renderer); // this adds `part.elm` to each `part`
3783
+ for (const part of parts) {
3784
+ // Event listeners are only applied once when mounting, so they are allowed for static vnodes
3785
+ applyEventListeners(part, renderer);
3786
+ // Refs are allowed as well
3787
+ applyRefs(part, owner);
3788
+ }
3789
+ }
3790
+
3702
3791
  /*
3703
3792
  * Copyright (c) 2018, salesforce.com, inc.
3704
3793
  * All rights reserved.
@@ -3835,13 +3924,13 @@ function mountElement(vnode, parent, anchor, renderer) {
3835
3924
  applyStyleScoping(elm, owner, renderer);
3836
3925
  applyDomManual(elm, vnode);
3837
3926
  applyElementRestrictions(elm, vnode);
3838
- patchElementPropsAndAttrs$1(null, vnode, renderer);
3927
+ patchElementPropsAndAttrsAndRefs$1(null, vnode, renderer);
3839
3928
  insertNode(elm, parent, anchor, renderer);
3840
3929
  mountVNodes(vnode.children, elm, renderer, null);
3841
3930
  }
3842
3931
  function patchElement(n1, n2, renderer) {
3843
3932
  const elm = (n2.elm = n1.elm);
3844
- patchElementPropsAndAttrs$1(n1, n2, renderer);
3933
+ patchElementPropsAndAttrsAndRefs$1(n1, n2, renderer);
3845
3934
  patchChildren(n1.children, n2.children, elm, renderer);
3846
3935
  }
3847
3936
  function mountStatic(vnode, parent, anchor, renderer) {
@@ -3858,8 +3947,7 @@ function mountStatic(vnode, parent, anchor, renderer) {
3858
3947
  }
3859
3948
  }
3860
3949
  insertNode(elm, parent, anchor, renderer);
3861
- // Event listeners are only applied once when mounting, so they are allowed for static vnodes
3862
- applyEventListeners(vnode, renderer);
3950
+ applyStaticParts(elm, vnode, renderer);
3863
3951
  }
3864
3952
  function mountCustomElement(vnode, parent, anchor, renderer) {
3865
3953
  const { sel, owner } = vnode;
@@ -3914,7 +4002,7 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3914
4002
  if (vm) {
3915
4003
  allocateChildren(vnode, vm);
3916
4004
  }
3917
- patchElementPropsAndAttrs$1(null, vnode, renderer);
4005
+ patchElementPropsAndAttrsAndRefs$1(null, vnode, renderer);
3918
4006
  insertNode(elm, parent, anchor, renderer);
3919
4007
  if (vm) {
3920
4008
  if (process.env.IS_BROWSER) {
@@ -3951,7 +4039,7 @@ function patchCustomElement(n1, n2, parent, renderer) {
3951
4039
  // Otherwise patch the existing component with new props/attrs/etc.
3952
4040
  const elm = (n2.elm = n1.elm);
3953
4041
  const vm = (n2.vm = n1.vm);
3954
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4042
+ patchElementPropsAndAttrsAndRefs$1(n1, n2, renderer);
3955
4043
  if (!shared.isUndefined(vm)) {
3956
4044
  // in fallback mode, the allocation will always set children to
3957
4045
  // empty and delegate the real allocation to the slot elements
@@ -4098,7 +4186,7 @@ function removeNode(node, parent, renderer) {
4098
4186
  lockDomMutation();
4099
4187
  }
4100
4188
  }
4101
- function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4189
+ function patchElementPropsAndAttrsAndRefs$1(oldVnode, vnode, renderer) {
4102
4190
  if (shared.isNull(oldVnode)) {
4103
4191
  applyEventListeners(vnode, renderer);
4104
4192
  applyStaticClassAttribute(vnode, renderer);
@@ -4110,6 +4198,8 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4110
4198
  patchStyleAttribute(oldVnode, vnode, renderer);
4111
4199
  patchAttributes(oldVnode, vnode, renderer);
4112
4200
  patchProps(oldVnode, vnode, renderer);
4201
+ // The `refs` object is blown away in every re-render, so we always need to re-apply them
4202
+ applyRefs(vnode, vnode.owner);
4113
4203
  }
4114
4204
  function applyStyleScoping(elm, owner, renderer) {
4115
4205
  const { getClassList } = renderer;
@@ -4511,6 +4601,14 @@ const SymbolIterator = Symbol.iterator;
4511
4601
  function addVNodeToChildLWC(vnode) {
4512
4602
  shared.ArrayPush.call(getVMBeingRendered().velements, vnode);
4513
4603
  }
4604
+ // [s]tatic [p]art
4605
+ function sp(partId, data) {
4606
+ return {
4607
+ partId,
4608
+ data,
4609
+ elm: undefined, // elm is defined later
4610
+ };
4611
+ }
4514
4612
  // [s]coped [s]lot [f]actory
4515
4613
  function ssf(slotName, factory) {
4516
4614
  return {
@@ -4524,7 +4622,7 @@ function ssf(slotName, factory) {
4524
4622
  };
4525
4623
  }
4526
4624
  // [st]atic node
4527
- function st(fragment, key, data) {
4625
+ function st(fragment, key, parts) {
4528
4626
  const owner = getVMBeingRendered();
4529
4627
  const vnode = {
4530
4628
  type: 4 /* VNodeType.Static */,
@@ -4533,12 +4631,8 @@ function st(fragment, key, data) {
4533
4631
  elm: undefined,
4534
4632
  fragment,
4535
4633
  owner,
4536
- data,
4634
+ parts,
4537
4635
  };
4538
- const ref = data === null || data === void 0 ? void 0 : data.ref;
4539
- if (!shared.isUndefined(ref)) {
4540
- setRefVNode(owner, ref, vnode);
4541
- }
4542
4636
  return vnode;
4543
4637
  }
4544
4638
  // [fr]agment node
@@ -4580,7 +4674,7 @@ function h(sel, data, children = EmptyArray) {
4580
4674
  }
4581
4675
  });
4582
4676
  }
4583
- const { key, ref } = data;
4677
+ const { key } = data;
4584
4678
  const vnode = {
4585
4679
  type: 2 /* VNodeType.Element */,
4586
4680
  sel,
@@ -4590,9 +4684,6 @@ function h(sel, data, children = EmptyArray) {
4590
4684
  key,
4591
4685
  owner: vmBeingRendered,
4592
4686
  };
4593
- if (!shared.isUndefined(ref)) {
4594
- setRefVNode(vmBeingRendered, ref, vnode);
4595
- }
4596
4687
  return vnode;
4597
4688
  }
4598
4689
  // [t]ab[i]ndex function
@@ -4701,7 +4792,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
4701
4792
  });
4702
4793
  }
4703
4794
  }
4704
- const { key, ref } = data;
4795
+ const { key } = data;
4705
4796
  let elm, aChildren, vm;
4706
4797
  const vnode = {
4707
4798
  type: 3 /* VNodeType.CustomElement */,
@@ -4717,9 +4808,6 @@ function c(sel, Ctor, data, children = EmptyArray) {
4717
4808
  vm,
4718
4809
  };
4719
4810
  addVNodeToChildLWC(vnode);
4720
- if (!shared.isUndefined(ref)) {
4721
- setRefVNode(vmBeingRendered, ref, vnode);
4722
- }
4723
4811
  return vnode;
4724
4812
  }
4725
4813
  // [i]terable node
@@ -5010,6 +5098,7 @@ const api = shared.freeze({
5010
5098
  shc,
5011
5099
  ssf,
5012
5100
  ddc,
5101
+ sp,
5013
5102
  });
5014
5103
 
5015
5104
  /*
@@ -5724,8 +5813,10 @@ function computeShadowMode(def, owner, renderer) {
5724
5813
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
5725
5814
  shadowMode = 0 /* ShadowMode.Native */;
5726
5815
  }
5727
- else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
5728
- if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
5816
+ else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE ||
5817
+ def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5818
+ if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */ ||
5819
+ def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
5729
5820
  shadowMode = 0 /* ShadowMode.Native */;
5730
5821
  }
5731
5822
  else {
@@ -6470,7 +6561,7 @@ function hydrateStaticElement(elm, vnode, renderer) {
6470
6561
  return handleMismatch(elm, vnode, renderer);
6471
6562
  }
6472
6563
  vnode.elm = elm;
6473
- applyEventListeners(vnode, renderer);
6564
+ applyStaticParts(elm, vnode, renderer);
6474
6565
  return elm;
6475
6566
  }
6476
6567
  function hydrateFragment(elm, vnode, renderer) {
@@ -6504,7 +6595,7 @@ function hydrateElement(elm, vnode, renderer) {
6504
6595
  }
6505
6596
  }
6506
6597
  }
6507
- patchElementPropsAndAttrs(vnode, renderer);
6598
+ patchElementPropsAndAttrsAndRefs(vnode, renderer);
6508
6599
  if (!isDomManual) {
6509
6600
  const { getFirstChild } = renderer;
6510
6601
  hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
@@ -6537,7 +6628,7 @@ function hydrateCustomElement(elm, vnode, renderer) {
6537
6628
  vnode.elm = elm;
6538
6629
  vnode.vm = vm;
6539
6630
  allocateChildren(vnode, vm);
6540
- patchElementPropsAndAttrs(vnode, renderer);
6631
+ patchElementPropsAndAttrsAndRefs(vnode, renderer);
6541
6632
  // Insert hook section:
6542
6633
  if (process.env.NODE_ENV !== 'production') {
6543
6634
  shared.assert.isTrue(vm.state === 0 /* VMState.created */, `${vm} cannot be recycled.`);
@@ -6602,9 +6693,11 @@ function handleMismatch(node, vnode, renderer) {
6602
6693
  removeNode(node, parentNode, renderer);
6603
6694
  return vnode.elm;
6604
6695
  }
6605
- function patchElementPropsAndAttrs(vnode, renderer) {
6696
+ function patchElementPropsAndAttrsAndRefs(vnode, renderer) {
6606
6697
  applyEventListeners(vnode, renderer);
6607
6698
  patchProps(null, vnode, renderer);
6699
+ // The `refs` object is blown away in every re-render, so we always need to re-apply them
6700
+ applyRefs(vnode, vnode.owner);
6608
6701
  }
6609
6702
  function hasCorrectNodeType(vnode, node, nodeType, renderer) {
6610
6703
  const { getProperty } = renderer;
@@ -7125,5 +7218,5 @@ exports.swapTemplate = swapTemplate;
7125
7218
  exports.track = track;
7126
7219
  exports.unwrap = unwrap;
7127
7220
  exports.wire = wire;
7128
- /** version: 3.5.0 */
7221
+ /** version: 3.7.0 */
7129
7222
  //# sourceMappingURL=index.cjs.js.map