@lwc/engine-core 2.47.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
@@ -3091,6 +3091,7 @@ function getComponentDef(Ctor) {
3091
3091
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3092
3092
  */
3093
3093
  function makeHostToken(token) {
3094
+ // Note: if this ever changes, update the `cssScopeTokens` returned by `@lwc/compiler`
3094
3095
  return `${token}-host`;
3095
3096
  }
3096
3097
  function createInlineStyleVNode(content) {
@@ -4353,15 +4354,21 @@ function ssf(slotName, factory) {
4353
4354
  }
4354
4355
  // [st]atic node
4355
4356
  function st(fragment, key, data) {
4356
- return {
4357
+ const owner = getVMBeingRendered();
4358
+ const vnode = {
4357
4359
  type: 4 /* VNodeType.Static */,
4358
4360
  sel: undefined,
4359
4361
  key,
4360
4362
  elm: undefined,
4361
4363
  fragment,
4362
- owner: getVMBeingRendered(),
4364
+ owner,
4363
4365
  data,
4364
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;
4365
4372
  }
4366
4373
  // [fr]agment node
4367
4374
  function fr(key, children, stable) {
@@ -6155,7 +6162,7 @@ function hydrateRoot(vm) {
6155
6162
  hasMismatch = false;
6156
6163
  runConnectedCallback(vm);
6157
6164
  hydrateVM(vm);
6158
- if (hasMismatch) {
6165
+ if (hasMismatch && process.env.NODE_ENV !== 'production') {
6159
6166
  logError('Hydration completed with errors.', vm);
6160
6167
  }
6161
6168
  }
@@ -6227,7 +6234,9 @@ function getValidationPredicate(optOutStaticProp) {
6227
6234
  if (shared.isArray(optOutStaticProp) && shared.arrayEvery(optOutStaticProp, shared.isString)) {
6228
6235
  return (attrName) => !shared.ArrayIncludes.call(optOutStaticProp, attrName);
6229
6236
  }
6230
- 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
+ }
6231
6240
  return (_attrName) => true;
6232
6241
  }
6233
6242
  function hydrateText(node, vnode, renderer) {
@@ -6263,7 +6272,8 @@ function hydrateComment(node, vnode, renderer) {
6263
6272
  return node;
6264
6273
  }
6265
6274
  function hydrateStaticElement(elm, vnode, renderer) {
6266
- if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
6275
+ if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) ||
6276
+ !areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
6267
6277
  return handleMismatch(elm, vnode, renderer);
6268
6278
  }
6269
6279
  vnode.elm = elm;
@@ -6602,7 +6612,9 @@ function areCompatibleNodes(client, ssr, vnode, renderer) {
6602
6612
  const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
6603
6613
  clientAttrsNames.forEach((attrName) => {
6604
6614
  if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
6605
- 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
+ }
6606
6618
  isCompatibleElements = false;
6607
6619
  }
6608
6620
  });
@@ -6914,5 +6926,5 @@ exports.swapTemplate = swapTemplate;
6914
6926
  exports.track = track;
6915
6927
  exports.unwrap = unwrap;
6916
6928
  exports.wire = wire;
6917
- /** version: 2.47.0 */
6929
+ /** version: 2.49.0 */
6918
6930
  //# sourceMappingURL=index.cjs.js.map