@lwc/engine-core 2.7.2 → 2.9.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.7.2",
3
+ "version": "2.9.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.7.2",
28
- "@lwc/shared": "2.7.2"
27
+ "@lwc/features": "2.9.0",
28
+ "@lwc/shared": "2.9.0"
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": "f668a3ad36bbebbaa33a5863408a45bf4185d218"
36
+ "gitHead": "94040389ab8fc717b8753e503f659489480a327d"
37
37
  }
@@ -1,7 +1,7 @@
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';
4
- declare function h(sel: string, data: VElementData, children: VNodes): VElement;
3
+ import { VNode, VNodes, VElement, VText, VCustomElement, VComment, VElementData } from './vnodes';
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;
@@ -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,7 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- declare function updateAttrs(oldVnode: VElement, vnode: VElement): void;
3
- declare const _default: {
4
- create: (vnode: VElement) => void;
5
- update: typeof updateAttrs;
6
- };
7
- export default _default;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchAttributes(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,7 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- declare function updateClassAttribute(oldVnode: VElement, vnode: VElement): void;
3
- declare const _default: {
4
- create: (vnode: VElement) => void;
5
- update: typeof updateClassAttribute;
6
- };
7
- export default _default;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchClassAttribute(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,7 +1,2 @@
1
- import { VNode } from '../../3rdparty/snabbdom/types';
2
- declare function updateStyleAttribute(oldVnode: VNode, vnode: VNode): void;
3
- declare const _default: {
4
- create: (vnode: VNode) => void;
5
- update: typeof updateStyleAttribute;
6
- };
7
- export default _default;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchStyleAttribute(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,14 +1,2 @@
1
- import { VNode } from '../../3rdparty/snabbdom/types';
2
- interface VNodeEventListener extends EventListener {
3
- vnode?: VNode;
4
- }
5
- interface InteractiveVNode extends VNode {
6
- listener: VNodeEventListener | undefined;
7
- }
8
- declare function updateAllEventListeners(oldVnode: InteractiveVNode, vnode: InteractiveVNode): void;
9
- declare function createAllEventListeners(vnode: VNode): void;
10
- declare const _default: {
11
- update: typeof updateAllEventListeners;
12
- create: typeof createAllEventListeners;
13
- };
14
- export default _default;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function applyEventListeners(vnode: VBaseElement): void;
@@ -1,7 +1,2 @@
1
- import { VElement } from '../../3rdparty/snabbdom/types';
2
- declare function update(oldVnode: VElement, vnode: VElement): void;
3
- declare const _default: {
4
- create: (vnode: VElement) => void;
5
- update: typeof update;
6
- };
7
- export default _default;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function patchProps(oldVnode: VBaseElement | null, vnode: VBaseElement): void;
@@ -1,6 +1,2 @@
1
- import { VNode } from '../../3rdparty/snabbdom/types';
2
- declare function createClassAttribute(vnode: VNode): void;
3
- declare const _default: {
4
- create: typeof createClassAttribute;
5
- };
6
- export default _default;
1
+ import { VBaseElement } from '../vnodes';
2
+ export declare function applyStaticClassAttribute(vnode: VBaseElement): void;
@@ -1,6 +1,2 @@
1
- import { VNode } from '../../3rdparty/snabbdom/types';
2
- declare function createStyleAttribute(vnode: VNode): void;
3
- declare const _default: {
4
- create: typeof createStyleAttribute;
5
- };
6
- export default _default;
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 { 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;
@@ -7,4 +7,9 @@ export declare function guid(): string;
7
7
  export declare function parseStyleText(cssText: string): {
8
8
  [name: string]: string;
9
9
  };
10
+ export declare function cloneAndOmitKey(object: {
11
+ [key: string]: any;
12
+ }, keyToOmit: string): {
13
+ [key: string]: any;
14
+ };
10
15
  export {};
@@ -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;
@@ -133,8 +139,6 @@ export declare function getAssociatedVMIfPresent(obj: VMAssociable): VM | undefi
133
139
  export declare function runConnectedCallback(vm: VM): void;
134
140
  export declare function resetComponentRoot(vm: VM): void;
135
141
  export declare function scheduleRehydration(vm: VM): void;
136
- export declare function allocateInSlot(vm: VM, children: VNodes): void;
137
142
  export declare function runWithBoundaryProtection(vm: VM, owner: VM | null, pre: () => void, job: () => void, post: () => void): void;
138
143
  export declare function forceRehydration(vm: VM): void;
139
- export declare function getRenderRoot(vm: VM): ShadowRoot | HostElement;
140
144
  export {};
@@ -0,0 +1,70 @@
1
+ import { VM } from './vm';
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
+ export declare type VNodes = Readonly<Array<VNode | null>>;
12
+ export interface BaseVNode {
13
+ type: VNodeType;
14
+ elm: Node | undefined;
15
+ sel: string | undefined;
16
+ key: Key | undefined;
17
+ hook: Hooks<any>;
18
+ owner: VM;
19
+ }
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 {
33
+ sel: string;
34
+ data: VElementData;
35
+ children: VNodes;
36
+ elm: Element | undefined;
37
+ key: Key;
38
+ }
39
+ export interface VElement extends VBaseElement {
40
+ type: VNodeType.Element;
41
+ }
42
+ export interface VCustomElement extends VBaseElement {
43
+ type: VNodeType.CustomElement;
44
+ mode: 'closed' | 'open';
45
+ ctor: any;
46
+ aChildren?: VNodes;
47
+ }
48
+ export interface VNodeData {
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
+ }
59
+ export interface VElementData extends VNodeData {
60
+ readonly 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;
68
+ }
69
+ export declare function isVBaseElement(vnode: VNode): vnode is VElement | VCustomElement;
70
+ export declare function isSameVnode(vnode1: VNode, vnode2: VNode): boolean;
package/LICENSE DELETED
@@ -1,10 +0,0 @@
1
- MIT LICENSE
2
-
3
- Copyright (c) 2018, Salesforce.com, Inc.
4
- All rights reserved.
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
-
8
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -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,70 +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 { VM } from '../../framework/vm';
10
- export declare type Key = string | number;
11
- export declare type VNodes = Array<VNode | null>;
12
- export interface VNode {
13
- sel: string | undefined;
14
- data: VNodeData;
15
- children: VNodes | undefined;
16
- elm: Node | undefined;
17
- parentElm?: Element;
18
- text: string | undefined;
19
- key: Key | undefined;
20
- hook: Hooks<any>;
21
- owner: VM;
22
- }
23
- export interface VElement extends VNode {
24
- sel: string;
25
- data: VElementData;
26
- children: VNodes;
27
- elm: Element | undefined;
28
- text: undefined;
29
- key: Key;
30
- }
31
- export interface VCustomElement extends VElement {
32
- mode: 'closed' | 'open';
33
- ctor: any;
34
- aChildren?: VNodes;
35
- }
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
- export interface VNodeData {
50
- props?: Record<string, any>;
51
- attrs?: Record<string, string | number | boolean>;
52
- className?: string;
53
- style?: string;
54
- classMap?: Record<string, boolean>;
55
- styleDecls?: Array<[string, string, boolean]>;
56
- context?: Record<string, Record<string, any>>;
57
- on?: Record<string, Function>;
58
- svg?: boolean;
59
- }
60
- export interface VElementData extends VNodeData {
61
- key: Key;
62
- }
63
- export interface Hooks<N extends VNode> {
64
- create: (vNode: N) => void;
65
- insert: (vNode: N, parentNode: Node, referenceNode: Node | null) => void;
66
- move: (vNode: N, parentNode: Node, referenceNode: Node | null) => void;
67
- update: (oldVNode: N, vNode: N) => void;
68
- remove: (vNode: N, parentNode: Node) => void;
69
- hydrate: (vNode: N, node: Node) => void;
70
- }
@@ -1,22 +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 createElmHook(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 updateElmHook(oldVnode: VElement, vnode: VElement): void;
13
- export declare function updateChildrenHook(oldVnode: VElement, vnode: VElement): void;
14
- export declare function allocateChildrenHook(vnode: VCustomElement, vm: VM): void;
15
- export declare function createViewModelHook(elm: HTMLElement, vnode: VCustomElement): void;
16
- export declare function createCustomElmHook(vnode: VCustomElement): void;
17
- export declare function createChildrenHook(vnode: VElement): void;
18
- export declare function hydrateChildrenHook(elmChildren: NodeListOf<ChildNode>, children: VNodes, vm?: VM): void;
19
- export declare function updateCustomElmHook(oldVnode: VCustomElement, vnode: VCustomElement): void;
20
- export declare function removeElmHook(vnode: VElement): void;
21
- export declare function markAsDynamicChildren(children: VNodes): void;
22
- export declare function hasDynamicChildren(children: VNodes): boolean;