@lwc/engine-core 2.7.3 → 2.7.4

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.7.3",
3
+ "version": "2.7.4",
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.7.3",
28
- "@lwc/shared": "2.7.3"
27
+ "@lwc/features": "2.7.4",
28
+ "@lwc/shared": "2.7.4"
29
29
  },
30
30
  "devDependencies": {
31
31
  "observable-membrane": "2.0.0"
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "392d6a92b3a15a24b686024f3c4d0c6bdabc2b8e"
36
+ "gitHead": "df4eda8be794fa5f7a01148c137eea4e546a0844"
37
37
  }
@@ -1,6 +1,6 @@
1
1
  import { SlotSet } from './vm';
2
- import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData } from '../3rdparty/snabbdom/types';
3
2
  import { LightningElementConstructor } from './base-lightning-element';
3
+ import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData } from './vnodes';
4
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;
@@ -1,8 +1,8 @@
1
1
  import { VM } from './vm';
2
- import { VNodes } from '../3rdparty/snabbdom/types';
3
2
  import { ReactiveObserver } from '../libs/mutation-tracker';
4
3
  import { LightningElementConstructor } from './base-lightning-element';
5
4
  import { Template } from './template';
5
+ import { VNodes } from './vnodes';
6
6
  /**
7
7
  * INTERNAL: This function can only be invoked by compiled code. The compiler
8
8
  * will prevent this function from being imported by userland code.
@@ -34,6 +34,7 @@ export interface ComponentDef {
34
34
  */
35
35
  export declare function isComponentConstructor(ctor: unknown): ctor is LightningElementConstructor;
36
36
  export declare function getComponentInternalDef(Ctor: unknown): ComponentDef;
37
+ export declare function getComponentHtmlPrototype(Ctor: unknown): HTMLElementConstructor;
37
38
  declare const enum PropDefType {
38
39
  any = "any"
39
40
  }
@@ -0,0 +1,3 @@
1
+ import { VM } from './vm';
2
+ import { VNodes } from './vnodes';
3
+ export declare function hydrateChildren(elmChildren: NodeListOf<ChildNode>, children: VNodes, vm: VM): void;
@@ -1,6 +1,6 @@
1
1
  import { VM } from './vm';
2
2
  import { LightningElement, LightningElementConstructor } from './base-lightning-element';
3
- import { VNodes } from '../3rdparty/snabbdom/types';
3
+ import { VNodes } from './vnodes';
4
4
  export declare let isInvokingRender: boolean;
5
5
  export declare let vmBeingConstructed: VM | null;
6
6
  export declare function isBeingConstructed(vm: VM): boolean;
@@ -6,7 +6,7 @@ export { default as track } from './decorators/track';
6
6
  export { default as wire } from './decorators/wire';
7
7
  export { readonly } from './readonly';
8
8
  export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
9
- export { getComponentInternalDef } from './def';
9
+ export { getComponentHtmlPrototype } from './def';
10
10
  export { createVM, connectRootElement, disconnectRootElement, getAssociatedVMIfPresent, hydrateRootElement, } from './vm';
11
11
  export { registerComponent } from './component';
12
12
  export { registerTemplate } from './secure-template';
@@ -1,2 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- export declare function patchAttributes(oldVnode: VElement | null, vnode: VElement): void;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchAttributes(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,2 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- export declare function patchClassAttribute(oldVnode: VElement | null, vnode: VElement): void;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchClassAttribute(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,2 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- export declare function patchStyleAttribute(oldVnode: VElement | null, vnode: VElement): void;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchStyleAttribute(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,2 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- export declare function applyEventListeners(vnode: VElement): void;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function applyEventListeners(vnode: VBaseElement): void;
@@ -1,2 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- export declare function patchProps(oldVnode: VElement | null, vnode: VElement): void;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchProps(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,2 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- export declare function applyStaticClassAttribute(vnode: VElement): void;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function applyStaticClassAttribute(vnode: VBaseElement): void;
@@ -1,2 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- export declare function applyStaticStyleAttribute(vnode: VElement): void;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function applyStaticStyleAttribute(vnode: VBaseElement): void;
@@ -0,0 +1,9 @@
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;
8
+ export declare function allocateChildren(vnode: VCustomElement, vm: VM): void;
9
+ export declare function markAsDynamicChildren(children: VNodes): void;
@@ -1,6 +1,6 @@
1
- import { VNodeData } from '../3rdparty/snabbdom/types';
2
1
  import { ComponentDef } from './def';
3
2
  import { VM, Context } from './vm';
3
+ import { VNodeData } from './vnodes';
4
4
  declare type ServiceCallback = (component: object, data: VNodeData, def: ComponentDef, context: Context) => void;
5
5
  interface ServiceDef {
6
6
  connected?: ServiceCallback;
@@ -1,6 +1,6 @@
1
- import { VNode } from '../3rdparty/snabbdom/types';
2
1
  import { VM } from './vm';
3
2
  import { Template } from './template';
3
+ import { VNode } from './vnodes';
4
4
  /**
5
5
  * Function producing style based on a host and a shadow selector. This function is invoked by
6
6
  * the engine with different values depending on the mode that the component is running on.
@@ -1,7 +1,7 @@
1
- import { VNode, VNodes } from '../3rdparty/snabbdom/types';
2
1
  import { RenderAPI } from './api';
3
2
  import { SlotSet, TemplateCache, VM } from './vm';
4
3
  import { TemplateStylesheetFactories } from './stylesheet';
4
+ import { VNode, 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. */
@@ -1,10 +1,10 @@
1
1
  import type { HostNode, HostElement } from '../renderer';
2
2
  import { Template } from './template';
3
3
  import { ComponentDef } from './def';
4
- import { LightningElement } from './base-lightning-element';
4
+ import { LightningElement, LightningElementConstructor } from './base-lightning-element';
5
5
  import { ReactiveObserver } from './mutation-tracker';
6
6
  import { AccessorReactiveObserver } from './decorators/api';
7
- import { VNodes, VCustomElement, VNode } from '../3rdparty/snabbdom/types';
7
+ import { VNodes, VCustomElement, VNode } from './vnodes';
8
8
  declare type ShadowRootMode = 'open' | 'closed';
9
9
  export interface TemplateCache {
10
10
  [key: string]: any;
@@ -29,6 +29,9 @@ export declare const enum ShadowSupportMode {
29
29
  Any = "any",
30
30
  Default = "reset"
31
31
  }
32
+ export declare const enum LwcDomMode {
33
+ Manual = "manual"
34
+ }
32
35
  export interface Context {
33
36
  /** The string used for synthetic shadow DOM and light DOM style scoping. */
34
37
  stylesheetToken: string | undefined;
@@ -96,7 +99,10 @@ export interface VM<N = HostNode, E = HostElement> {
96
99
  /** The component instance. */
97
100
  component: LightningElement;
98
101
  /** The custom element shadow root. */
99
- cmpRoot: ShadowRoot | null;
102
+ shadowRoot: ShadowRoot | null;
103
+ /** The component render root. If the component is a shadow DOM component, it is its shadow
104
+ * root. If the component is a light DOM component it the element itself. */
105
+ renderRoot: ShadowRoot | HostElement;
100
106
  /** The template reactive observer. */
101
107
  tro: ReactiveObserver;
102
108
  /** The accessor reactive observers. Is only used when the ENABLE_REACTIVE_SETTER feature flag
@@ -122,7 +128,7 @@ export declare function disconnectRootElement(elm: any): void;
122
128
  export declare function appendVM(vm: VM): void;
123
129
  export declare function hydrateVM(vm: VM): void;
124
130
  export declare function removeVM(vm: VM): void;
125
- export declare function createVM<HostNode, HostElement>(elm: HostElement, def: ComponentDef, options: {
131
+ export declare function createVM<HostNode, HostElement>(elm: HostElement, ctor: LightningElementConstructor, options: {
126
132
  mode: ShadowRootMode;
127
133
  owner: VM<HostNode, HostElement> | null;
128
134
  tagName: string;
@@ -135,5 +141,4 @@ export declare function resetComponentRoot(vm: VM): void;
135
141
  export declare function scheduleRehydration(vm: VM): void;
136
142
  export declare function runWithBoundaryProtection(vm: VM, owner: VM | null, pre: () => void, job: () => void, post: () => void): void;
137
143
  export declare function forceRehydration(vm: VM): void;
138
- export declare function getRenderRoot(vm: VM): ShadowRoot | HostElement;
139
144
  export {};
@@ -1,51 +1,50 @@
1
- /**
2
- @license
3
- Copyright (c) 2015 Simon Friis Vindum.
4
- This code may only be used under the MIT License found at
5
- https://github.com/snabbdom/snabbdom/blob/master/LICENSE
6
- Code distributed by Snabbdom as part of the Snabbdom project at
7
- https://github.com/snabbdom/snabbdom/
8
- */
9
- import { VM } from '../../framework/vm';
1
+ import { VM } from './vm';
10
2
  export declare type Key = string | number;
3
+ export declare const enum VNodeType {
4
+ Text = 0,
5
+ Comment = 1,
6
+ Element = 2,
7
+ CustomElement = 3
8
+ }
9
+ export declare type VNode = VText | VComment | VElement | VCustomElement;
10
+ export declare type VParentElement = VElement | VCustomElement;
11
11
  export declare type VNodes = Array<VNode | null>;
12
- export interface VNode {
13
- sel: string | undefined;
14
- data: VNodeData;
15
- children: VNodes | undefined;
12
+ export interface BaseVNode {
13
+ type: VNodeType;
16
14
  elm: Node | undefined;
17
- parentElm?: Element;
18
- text: string | undefined;
15
+ sel: string | undefined;
19
16
  key: Key | undefined;
20
17
  hook: Hooks<any>;
21
18
  owner: VM;
22
19
  }
23
- export interface VElement extends VNode {
20
+ export interface VText extends BaseVNode {
21
+ type: VNodeType.Text;
22
+ sel: undefined;
23
+ text: string;
24
+ key: undefined;
25
+ }
26
+ export interface VComment extends BaseVNode {
27
+ type: VNodeType.Comment;
28
+ sel: undefined;
29
+ text: string;
30
+ key: undefined;
31
+ }
32
+ export interface VBaseElement extends BaseVNode {
24
33
  sel: string;
25
34
  data: VElementData;
26
35
  children: VNodes;
27
36
  elm: Element | undefined;
28
- text: undefined;
29
37
  key: Key;
30
38
  }
31
- export interface VCustomElement extends VElement {
39
+ export interface VElement extends VBaseElement {
40
+ type: VNodeType.Element;
41
+ }
42
+ export interface VCustomElement extends VBaseElement {
43
+ type: VNodeType.CustomElement;
32
44
  mode: 'closed' | 'open';
33
45
  ctor: any;
34
46
  aChildren?: VNodes;
35
47
  }
36
- export interface VText extends VNode {
37
- sel: undefined;
38
- children: undefined;
39
- elm: Node | undefined;
40
- text: string;
41
- key: undefined;
42
- }
43
- export interface VComment extends VNode {
44
- sel: undefined;
45
- children: undefined;
46
- text: string;
47
- key: undefined;
48
- }
49
48
  export interface VNodeData {
50
49
  props?: Record<string, any>;
51
50
  attrs?: Record<string, string | number | boolean>;
@@ -66,5 +65,6 @@ export interface Hooks<N extends VNode> {
66
65
  move: (vNode: N, parentNode: Node, referenceNode: Node | null) => void;
67
66
  update: (oldVNode: N, vNode: N) => void;
68
67
  remove: (vNode: N, parentNode: Node) => void;
69
- hydrate: (vNode: N, node: Node) => void;
70
68
  }
69
+ export declare function isVBaseElement(vnode: VNode): vnode is VElement | VCustomElement;
70
+ export declare function isSameVnode(vnode1: VNode, vnode2: VNode): boolean;
@@ -1,11 +0,0 @@
1
- /**
2
- @license
3
- Copyright (c) 2015 Simon Friis Vindum.
4
- This code may only be used under the MIT License found at
5
- https://github.com/snabbdom/snabbdom/blob/master/LICENSE
6
- Code distributed by Snabbdom as part of the Snabbdom project at
7
- https://github.com/snabbdom/snabbdom/
8
- */
9
- import { VNodes } from './types';
10
- export declare function updateDynamicChildren(parentElm: Node, oldCh: VNodes, newCh: VNodes): void;
11
- export declare function updateStaticChildren(parentElm: Node, oldCh: VNodes, newCh: VNodes): void;
@@ -1,18 +0,0 @@
1
- import { VM } from './vm';
2
- import { VNode, VCustomElement, VElement, VNodes } from '../3rdparty/snabbdom/types';
3
- export declare function updateNodeHook(oldVnode: VNode, vnode: VNode): void;
4
- export declare function insertNodeHook(vnode: VNode, parentNode: Node, referenceNode: Node | null): void;
5
- export declare function removeNodeHook(vnode: VNode, parentNode: Node): void;
6
- export declare function patchElementPropsAndAttrs(oldVnode: VElement | null, vnode: VElement): void;
7
- export declare const enum LWCDOMMode {
8
- manual = "manual"
9
- }
10
- export declare function hydrateElmHook(vnode: VElement): void;
11
- export declare function fallbackElmHook(elm: Element, vnode: VElement): void;
12
- export declare function patchChildren(parent: ParentNode, oldCh: VNodes, newCh: VNodes): void;
13
- export declare function allocateChildrenHook(vnode: VCustomElement, vm: VM): void;
14
- export declare function createViewModelHook(elm: HTMLElement, vnode: VCustomElement): void;
15
- export declare function createChildrenHook(vnode: VElement): void;
16
- export declare function hydrateChildrenHook(elmChildren: NodeListOf<ChildNode>, children: VNodes, vm?: VM): void;
17
- export declare function removeElmHook(vnode: VElement): void;
18
- export declare function markAsDynamicChildren(children: VNodes): void;