@lwc/engine-core 2.48.0 → 2.49.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,6 +1,6 @@
1
1
  import { StylesheetFactory, TemplateStylesheetFactories } from './stylesheet';
2
2
  import { VM } from './vm';
3
- import { VBaseElement } from './vnodes';
3
+ import { VBaseElement, VStatic } from './vnodes';
4
4
  type Callback = () => void;
5
5
  export declare const SPACE_CHAR = 32;
6
6
  export declare const EmptyObject: any;
@@ -16,6 +16,6 @@ export declare function cloneAndOmitKey(object: {
16
16
  [key: string]: any;
17
17
  };
18
18
  export declare function flattenStylesheets(stylesheets: TemplateStylesheetFactories): StylesheetFactory[];
19
- export declare function setRefVNode(vm: VM, ref: string, vnode: VBaseElement): void;
19
+ export declare function setRefVNode(vm: VM, ref: string, vnode: VBaseElement | VStatic): void;
20
20
  export declare function assertNotProd(): void;
21
21
  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 } from './vnodes';
6
+ import { VNodes, VCustomElement, VNode, VBaseElement, VStatic } from './vnodes';
7
7
  import { TemplateStylesheetFactories } from './stylesheet';
8
8
  type ShadowRootMode = 'open' | 'closed';
9
9
  export interface TemplateCache {
@@ -55,7 +55,7 @@ export interface Context {
55
55
  wiredDisconnecting: Array<() => void>;
56
56
  }
57
57
  export type RefVNodes = {
58
- [name: string]: VBaseElement;
58
+ [name: string]: VBaseElement | VStatic;
59
59
  };
60
60
  export interface VM<N = HostNode, E = HostElement> {
61
61
  /** The host element */
@@ -27,13 +27,14 @@ export interface VScopedSlotFragment extends BaseVNode {
27
27
  type: VNodeType.ScopedSlotFragment;
28
28
  slotName: unknown;
29
29
  }
30
- export type VStaticElementData = Pick<VNodeData, 'on'>;
30
+ export type VStaticElementData = Pick<VElementData, 'on' | 'ref'>;
31
31
  export interface VStatic extends BaseVNode {
32
32
  readonly type: VNodeType.Static;
33
33
  readonly sel: undefined;
34
34
  readonly key: Key;
35
35
  readonly fragment: Element;
36
36
  readonly data: VStaticElementData | undefined;
37
+ elm: Element | undefined;
37
38
  }
38
39
  export interface VFragment extends BaseVNode, BaseVParent {
39
40
  sel: undefined;
package/dist/index.cjs.js CHANGED
@@ -4354,15 +4354,21 @@ function ssf(slotName, factory) {
4354
4354
  }
4355
4355
  // [st]atic node
4356
4356
  function st(fragment, key, data) {
4357
- return {
4357
+ const owner = getVMBeingRendered();
4358
+ const vnode = {
4358
4359
  type: 4 /* VNodeType.Static */,
4359
4360
  sel: undefined,
4360
4361
  key,
4361
4362
  elm: undefined,
4362
4363
  fragment,
4363
- owner: getVMBeingRendered(),
4364
+ owner,
4364
4365
  data,
4365
4366
  };
4367
+ const ref = data === null || data === void 0 ? void 0 : data.ref;
4368
+ if (!shared.isUndefined(ref)) {
4369
+ setRefVNode(owner, ref, vnode);
4370
+ }
4371
+ return vnode;
4366
4372
  }
4367
4373
  // [fr]agment node
4368
4374
  function fr(key, children, stable) {
@@ -6156,7 +6162,7 @@ function hydrateRoot(vm) {
6156
6162
  hasMismatch = false;
6157
6163
  runConnectedCallback(vm);
6158
6164
  hydrateVM(vm);
6159
- if (hasMismatch) {
6165
+ if (hasMismatch && process.env.NODE_ENV !== 'production') {
6160
6166
  logError('Hydration completed with errors.', vm);
6161
6167
  }
6162
6168
  }
@@ -6228,7 +6234,9 @@ function getValidationPredicate(optOutStaticProp) {
6228
6234
  if (shared.isArray(optOutStaticProp) && shared.arrayEvery(optOutStaticProp, shared.isString)) {
6229
6235
  return (attrName) => !shared.ArrayIncludes.call(optOutStaticProp, attrName);
6230
6236
  }
6231
- logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
6237
+ if (process.env.NODE_ENV !== 'production') {
6238
+ logWarn('Validation opt out must be `true` or an array of attributes that should not be validated.');
6239
+ }
6232
6240
  return (_attrName) => true;
6233
6241
  }
6234
6242
  function hydrateText(node, vnode, renderer) {
@@ -6264,7 +6272,8 @@ function hydrateComment(node, vnode, renderer) {
6264
6272
  return node;
6265
6273
  }
6266
6274
  function hydrateStaticElement(elm, vnode, renderer) {
6267
- if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
6275
+ if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) ||
6276
+ !areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
6268
6277
  return handleMismatch(elm, vnode, renderer);
6269
6278
  }
6270
6279
  vnode.elm = elm;
@@ -6603,7 +6612,9 @@ function areCompatibleNodes(client, ssr, vnode, renderer) {
6603
6612
  const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
6604
6613
  clientAttrsNames.forEach((attrName) => {
6605
6614
  if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
6606
- logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
6615
+ if (process.env.NODE_ENV !== 'production') {
6616
+ logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
6617
+ }
6607
6618
  isCompatibleElements = false;
6608
6619
  }
6609
6620
  });
@@ -6915,5 +6926,5 @@ exports.swapTemplate = swapTemplate;
6915
6926
  exports.track = track;
6916
6927
  exports.unwrap = unwrap;
6917
6928
  exports.wire = wire;
6918
- /** version: 2.48.0 */
6929
+ /** version: 2.49.0 */
6919
6930
  //# sourceMappingURL=index.cjs.js.map