@lwc/engine-core 2.8.0 → 2.11.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.8.0",
3
+ "version": "2.11.0",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "types/"
25
25
  ],
26
26
  "dependencies": {
27
- "@lwc/features": "2.8.0",
28
- "@lwc/shared": "2.8.0"
27
+ "@lwc/features": "2.11.0",
28
+ "@lwc/shared": "2.11.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "observable-membrane": "2.0.0"
@@ -1,7 +1,7 @@
1
1
  import { SlotSet } from './vm';
2
2
  import { LightningElementConstructor } from './base-lightning-element';
3
3
  import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData } from './vnodes';
4
- declare function h(sel: string, data: VElementData, children: VNodes): VElement;
4
+ declare function h(sel: string, data: VElementData, children?: VNodes): VElement;
5
5
  declare function ti(value: any): number;
6
6
  declare function s(slotName: string, data: VElementData, children: VNodes, slotset: SlotSet | undefined): VElement | VNodes;
7
7
  declare function c(sel: string, Ctor: LightningElementConstructor, data: VElementData, children?: VNodes): VCustomElement;
@@ -9,7 +9,7 @@ declare function i(iterable: Iterable<any>, factory: (value: any, index: number,
9
9
  /**
10
10
  * [f]lattening
11
11
  */
12
- declare function f(items: any[]): any[];
12
+ declare function f(items: Readonly<Array<Readonly<Array<VNodes>> | VNodes>>): VNodes;
13
13
  declare function t(text: string): VText;
14
14
  declare function co(text: string): VComment;
15
15
  declare function d(value: any): string;
@@ -0,0 +1,11 @@
1
+ import { Template } from './template';
2
+ import { StylesheetFactory } from './stylesheet';
3
+ import { LightningElementConstructor } from './base-lightning-element';
4
+ /**
5
+ * Validate a template, stylesheet, or component to make sure that its compiled version matches
6
+ * the version used by the LWC engine at runtime. Note that this only works in dev mode because
7
+ * it relies on code comments, which are stripped in production due to minification.
8
+ */
9
+ export declare function checkVersionMismatch(func: Template, type: 'template'): void;
10
+ export declare function checkVersionMismatch(func: StylesheetFactory, type: 'stylesheet'): void;
11
+ export declare function checkVersionMismatch(func: LightningElementConstructor, type: 'component'): void;
@@ -1,3 +1,3 @@
1
1
  import { VM } from './vm';
2
2
  import { VNodes } from './vnodes';
3
- export declare function hydrateChildren(elmChildren: NodeListOf<ChildNode>, children: VNodes, vm: VM): void;
3
+ export declare function hydrateChildren(elmChildren: NodeList, children: VNodes, vm: VM): void;
@@ -1,9 +1,5 @@
1
1
  import { VM } from './vm';
2
- import { VNodes, VCustomElement, VElement, VText, VComment, Hooks } from './vnodes';
3
- export declare const TextHook: Hooks<VText>;
4
- export declare const CommentHook: Hooks<VComment>;
5
- export declare const ElementHook: Hooks<VElement>;
6
- export declare const CustomElementHook: Hooks<VCustomElement>;
7
- export declare function patchChildren(parent: ParentNode, oldCh: VNodes, newCh: VNodes): void;
2
+ import { VNodes, VCustomElement } from './vnodes';
3
+ export declare function patchChildren(c1: VNodes, c2: VNodes, parent: ParentNode): void;
8
4
  export declare function allocateChildren(vnode: VCustomElement, vm: VM): void;
9
5
  export declare function markAsDynamicChildren(children: VNodes): void;
@@ -1,7 +1,7 @@
1
1
  import { RenderAPI } from './api';
2
2
  import { SlotSet, TemplateCache, VM } from './vm';
3
3
  import { TemplateStylesheetFactories } from './stylesheet';
4
- import { VNode, VNodes } from './vnodes';
4
+ import { VNodes } from './vnodes';
5
5
  export interface Template {
6
6
  (api: RenderAPI, cmp: object, slotSet: SlotSet, cache: TemplateCache): VNodes;
7
7
  /** The list of slot names used in the template. */
@@ -16,4 +16,4 @@ export interface Template {
16
16
  export declare let isUpdatingTemplate: boolean;
17
17
  export declare function getVMBeingRendered(): VM | null;
18
18
  export declare function setVMBeingRendered(vm: VM | null): void;
19
- export declare function evaluateTemplate(vm: VM, html: Template): Array<VNode | null>;
19
+ export declare function evaluateTemplate(vm: VM, html: Template): VNodes;
@@ -1,3 +1,4 @@
1
+ import { StylesheetFactory, TemplateStylesheetFactories } from './stylesheet';
1
2
  declare type Callback = () => void;
2
3
  export declare const SPACE_CHAR = 32;
3
4
  export declare const EmptyObject: any;
@@ -7,4 +8,10 @@ export declare function guid(): string;
7
8
  export declare function parseStyleText(cssText: string): {
8
9
  [name: string]: string;
9
10
  };
11
+ export declare function cloneAndOmitKey(object: {
12
+ [key: string]: any;
13
+ }, keyToOmit: string): {
14
+ [key: string]: any;
15
+ };
16
+ export declare function flattenStylesheets(stylesheets: TemplateStylesheetFactories): StylesheetFactory[];
10
17
  export {};
@@ -8,13 +8,12 @@ export declare const enum VNodeType {
8
8
  }
9
9
  export declare type VNode = VText | VComment | VElement | VCustomElement;
10
10
  export declare type VParentElement = VElement | VCustomElement;
11
- export declare type VNodes = Array<VNode | null>;
11
+ export declare type VNodes = Readonly<Array<VNode | null>>;
12
12
  export interface BaseVNode {
13
13
  type: VNodeType;
14
14
  elm: Node | undefined;
15
15
  sel: string | undefined;
16
16
  key: Key | undefined;
17
- hook: Hooks<any>;
18
17
  owner: VM;
19
18
  }
20
19
  export interface VText extends BaseVNode {
@@ -43,28 +42,22 @@ export interface VCustomElement extends VBaseElement {
43
42
  type: VNodeType.CustomElement;
44
43
  mode: 'closed' | 'open';
45
44
  ctor: any;
46
- aChildren?: VNodes;
45
+ aChildren: VNodes | undefined;
46
+ vm: VM | undefined;
47
47
  }
48
48
  export interface VNodeData {
49
- props?: Record<string, any>;
50
- attrs?: Record<string, string | number | boolean>;
51
- className?: string;
52
- style?: string;
53
- classMap?: Record<string, boolean>;
54
- styleDecls?: Array<[string, string, boolean]>;
55
- context?: Record<string, Record<string, any>>;
56
- on?: Record<string, (event: Event) => any>;
57
- svg?: boolean;
49
+ readonly props?: Readonly<Record<string, any>>;
50
+ readonly attrs?: Readonly<Record<string, string | number | boolean>>;
51
+ readonly className?: string;
52
+ readonly style?: string;
53
+ readonly classMap?: Readonly<Record<string, boolean>>;
54
+ readonly styleDecls?: Readonly<Array<[string, string, boolean]>>;
55
+ readonly context?: Readonly<Record<string, Readonly<Record<string, any>>>>;
56
+ readonly on?: Readonly<Record<string, (event: Event) => any>>;
57
+ readonly svg?: boolean;
58
58
  }
59
59
  export interface VElementData extends VNodeData {
60
- key: Key;
61
- }
62
- export interface Hooks<N extends VNode> {
63
- create: (vNode: N) => void;
64
- insert: (vNode: N, parentNode: Node, referenceNode: Node | null) => void;
65
- move: (vNode: N, parentNode: Node, referenceNode: Node | null) => void;
66
- update: (oldVNode: N, vNode: N) => void;
67
- remove: (vNode: N, parentNode: Node) => void;
60
+ readonly key: Key;
68
61
  }
69
62
  export declare function isVBaseElement(vnode: VNode): vnode is VElement | VCustomElement;
70
63
  export declare function isSameVnode(vnode1: VNode, vnode2: VNode): boolean;
@@ -108,7 +108,7 @@ export declare function setIsConnected(isConnectedImpl: isConnectedFunc): void;
108
108
  declare type insertGlobalStylesheetFunc = (content: string) => void;
109
109
  export declare let insertGlobalStylesheet: insertGlobalStylesheetFunc;
110
110
  export declare function setInsertGlobalStylesheet(insertGlobalStylesheetImpl: insertGlobalStylesheetFunc): void;
111
- declare type insertStylesheetFunc = (content: string, target: N) => void;
111
+ declare type insertStylesheetFunc = (content: string, target: ShadowRoot) => void;
112
112
  export declare let insertStylesheet: insertStylesheetFunc;
113
113
  export declare function setInsertStylesheet(insertStylesheetImpl: insertStylesheetFunc): void;
114
114
  declare type assertInstanceOfHTMLElementFunc = (elm: any, msg: string) => void;