@lwc/engine-core 6.1.1 → 6.2.1

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.
@@ -12,6 +12,7 @@ declare function c(sel: string, Ctor: LightningElementConstructor, data: VElemen
12
12
  declare function i(iterable: Iterable<any>, factory: (value: any, index: number, first: boolean, last: boolean) => VNodes | VNode): VNodes;
13
13
  /**
14
14
  * [f]lattening
15
+ * @param items
15
16
  */
16
17
  declare function f(items: Readonly<Array<Readonly<Array<VNodes>> | VNodes>>): VNodes;
17
18
  declare function t(text: string): VText;
@@ -25,15 +26,23 @@ declare function fid(url: string | undefined | null): string | null | undefined;
25
26
  * [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
26
27
  *
27
28
  * TODO [#3331]: remove usage of lwc:dynamic in 246
29
+ * @param sel
30
+ * @param Ctor
31
+ * @param data
32
+ * @param children
28
33
  */
29
34
  declare function ddc(sel: string, Ctor: LightningElementConstructor | null | undefined, data: VElementData, children?: VNodes): VCustomElement | null;
30
35
  /**
31
36
  * [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
37
+ * @param Ctor
38
+ * @param data
39
+ * @param children
32
40
  */
33
41
  declare function dc(Ctor: LightningElementConstructor | null | undefined, data: VElementData, children?: VNodes): VCustomElement | null;
34
42
  export type SanitizeHtmlContentHook = (content: unknown) => string;
35
43
  /**
36
44
  * Sets the sanitizeHtmlContentHook.
45
+ * @param newHookImpl
37
46
  */
38
47
  export declare function setSanitizeHtmlContentHook(newHookImpl: SanitizeHtmlContentHook): void;
39
48
  declare function shc(content: unknown): string;
@@ -21,7 +21,9 @@ export interface LightningElementConstructor {
21
21
  shadowSupportMode?: ShadowSupportMode;
22
22
  stylesheets: TemplateStylesheetFactories;
23
23
  }
24
- type HTMLElementTheGoodParts = Pick<Object, 'toString'> & Pick<HTMLElement, 'accessKey' | 'addEventListener' | 'attachInternals' | 'children' | 'childNodes' | 'classList' | 'dir' | 'dispatchEvent' | 'draggable' | 'firstChild' | 'firstElementChild' | 'getAttribute' | 'getAttributeNS' | 'getBoundingClientRect' | 'getElementsByClassName' | 'getElementsByTagName' | 'hasAttribute' | 'hasAttributeNS' | 'hidden' | 'id' | 'isConnected' | 'lang' | 'lastChild' | 'lastElementChild' | 'ownerDocument' | 'querySelector' | 'querySelectorAll' | 'removeAttribute' | 'removeAttributeNS' | 'removeEventListener' | 'setAttribute' | 'setAttributeNS' | 'spellcheck' | 'tabIndex' | 'tagName' | 'title'>;
24
+ type HTMLElementTheGoodParts = {
25
+ toString: () => string;
26
+ } & Pick<HTMLElement, 'accessKey' | 'addEventListener' | 'attachInternals' | 'children' | 'childNodes' | 'classList' | 'dir' | 'dispatchEvent' | 'draggable' | 'firstChild' | 'firstElementChild' | 'getAttribute' | 'getAttributeNS' | 'getBoundingClientRect' | 'getElementsByClassName' | 'getElementsByTagName' | 'hasAttribute' | 'hasAttributeNS' | 'hidden' | 'id' | 'isConnected' | 'lang' | 'lastChild' | 'lastElementChild' | 'ownerDocument' | 'querySelector' | 'querySelectorAll' | 'removeAttribute' | 'removeAttributeNS' | 'removeEventListener' | 'setAttribute' | 'setAttributeNS' | 'spellcheck' | 'tabIndex' | 'tagName' | 'title'>;
25
27
  type RefNodes = {
26
28
  [name: string]: Element;
27
29
  };
@@ -41,7 +43,7 @@ export interface LightningElement extends HTMLElementTheGoodParts, AccessibleEle
41
43
  /**
42
44
  * This class is the base class for any LWC element.
43
45
  * Some elements directly extends this class, others implement it via inheritance.
44
- **/
46
+ */
45
47
  export declare const LightningElement: LightningElementConstructor;
46
48
  export declare const lightningBasedDescriptors: PropertyDescriptorMap;
47
49
  export {};
@@ -5,6 +5,8 @@ import { LightningElementConstructor } from './base-lightning-element';
5
5
  * Validate a template, stylesheet, or component to make sure that its compiled version matches
6
6
  * the version used by the LWC engine at runtime. Note that this only works in dev mode because
7
7
  * it relies on code comments, which are stripped in production due to minification.
8
+ * @param func
9
+ * @param type
8
10
  */
9
11
  export declare function checkVersionMismatch(func: Template, type: 'template'): void;
10
12
  export declare function checkVersionMismatch(func: StylesheetFactory, type: 'stylesheet'): void;
@@ -12,12 +12,15 @@ type ComponentConstructorMetadata = {
12
12
  /**
13
13
  * INTERNAL: This function can only be invoked by compiled code. The compiler
14
14
  * will prevent this function from being imported by userland code.
15
+ * @param Ctor
16
+ * @param metadata
15
17
  */
16
18
  export declare function registerComponent(Ctor: any, metadata: ComponentConstructorMetadata): any;
17
19
  export declare function getComponentRegisteredTemplate(Ctor: LightningElementConstructor): Template | undefined;
18
20
  export declare function getComponentRegisteredName(Ctor: LightningElementConstructor): string | undefined;
19
21
  export declare function getComponentAPIVersion(Ctor: LightningElementConstructor): APIVersion;
20
22
  export declare function getTemplateReactiveObserver(vm: VM): ReactiveObserver;
23
+ export declare function resetTemplateObserverAndUnsubscribe(vm: VM): void;
21
24
  export declare function renderComponent(vm: VM): VNodes;
22
25
  export declare function markComponentAsDirty(vm: VM): void;
23
26
  export declare function getWrappedComponentsListener(vm: VM, listener: EventListener): EventListener;
@@ -1,7 +1,10 @@
1
1
  /**
2
- * @api decorator to mark public fields and public methods in
2
+ * The @api decorator marks public fields and public methods in
3
3
  * LWC Components. This function implements the internals of this
4
4
  * decorator.
5
+ * @param target
6
+ * @param propertyKey
7
+ * @param descriptor
5
8
  */
6
9
  export default function api(target: any, propertyKey: string, descriptor: PropertyDescriptor): void;
7
10
  export declare function createPublicPropertyDescriptor(key: string): PropertyDescriptor;
@@ -30,6 +30,8 @@ interface RegisterDecoratorMeta {
30
30
  /**
31
31
  * INTERNAL: This function can only be invoked by compiled code. The compiler
32
32
  * will prevent this function from being imported by user-land code.
33
+ * @param Ctor
34
+ * @param meta
33
35
  */
34
36
  export declare function registerDecorators(Ctor: LightningElementConstructor, meta: RegisterDecoratorMeta): LightningElementConstructor;
35
37
  interface DecoratorMeta {
@@ -1,7 +1,10 @@
1
1
  /**
2
- * @track decorator function to mark field value as reactive in
2
+ * The @track decorator function marks field values as reactive in
3
3
  * LWC Components. This function can also be invoked directly
4
4
  * with any value to obtain the trackable version of the value.
5
+ * @param target
6
+ * @param propertyKey
7
+ * @param descriptor
5
8
  */
6
9
  export default function track(target: any, propertyKey: string, descriptor: PropertyDescriptor): any;
7
10
  export declare function internalTrackDecorator(key: string): PropertyDescriptor;
@@ -1,8 +1,10 @@
1
1
  import { WireAdapterConstructor } from '../wiring';
2
2
  /**
3
- * @wire decorator to wire fields and methods to a wire adapter in
3
+ * The @wire decorator wires fields and methods to a wire adapter in
4
4
  * LWC Components. This function implements the internals of this
5
5
  * decorator.
6
+ * @param _adapter
7
+ * @param _config
6
8
  */
7
9
  export default function wire(_adapter: WireAdapterConstructor, _config?: Record<string, any>): PropertyDecorator | MethodDecorator;
8
10
  export declare function internalWireFieldDecorator(key: string): PropertyDescriptor;
@@ -36,6 +36,7 @@ export interface ComponentDef {
36
36
  /**
37
37
  * EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
38
38
  * subject to change or being removed.
39
+ * @param ctor
39
40
  */
40
41
  export declare function isComponentConstructor(ctor: unknown): ctor is LightningElementConstructor;
41
42
  export declare function getComponentInternalDef(Ctor: unknown): ComponentDef;
@@ -58,6 +59,7 @@ interface PublicComponentDef {
58
59
  /**
59
60
  * EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
60
61
  * subject to change or being removed.
62
+ * @param Ctor
61
63
  */
62
64
  export declare function getComponentDef(Ctor: any): PublicComponentDef;
63
65
  export {};
@@ -2,5 +2,6 @@ import { LightningElement } from './base-lightning-element';
2
2
  /**
3
3
  * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
4
4
  * This API is subject to change or being removed.
5
+ * @param elm
5
6
  */
6
7
  export declare function getComponentConstructor(elm: HTMLElement): typeof LightningElement | null;
@@ -2,6 +2,7 @@
2
2
  * EXPERIMENTAL: This function implements an unwrap mechanism that
3
3
  * works for observable membrane objects. This API is subject to
4
4
  * change or being removed.
5
+ * @param value
5
6
  */
6
7
  export declare function unwrap(value: any): any;
7
8
  export declare function getReadOnlyProxy(value: any): any;
@@ -2,10 +2,14 @@ import { VStatic } from '../vnodes';
2
2
  import { RendererAPI } from '../renderer';
3
3
  /**
4
4
  * Given an array of static parts, do all the mounting required for these parts.
5
- *
6
- * @param root - the root element
7
- * @param vnode - the parent VStatic
8
- * @param renderer - the renderer to use
9
- * @param mount - true this is a first (mount) render as opposed to a subsequent (patch) render
5
+ * @param root the root element
6
+ * @param vnode the parent VStatic
7
+ * @param renderer the renderer to use
10
8
  */
11
- export declare function applyStaticParts(root: Element, vnode: VStatic, renderer: RendererAPI, mount: boolean): void;
9
+ export declare function mountStaticParts(root: Element, vnode: VStatic, renderer: RendererAPI): void;
10
+ /**
11
+ * Mounts elements to the newly generated VStatic node
12
+ * @param n1 the previous VStatic vnode
13
+ * @param n2 the current VStatic vnode
14
+ */
15
+ export declare function patchStaticParts(n1: VStatic, n2: VStatic): void;
@@ -1,6 +1,7 @@
1
1
  import { CallbackFunction, ReactiveObserver } from '../libs/mutation-tracker';
2
2
  import { VM } from './vm';
3
3
  export declare function componentValueMutated(vm: VM, key: PropertyKey): void;
4
- export declare function componentValueObserved(vm: VM, key: PropertyKey): void;
4
+ export declare function componentValueObserved(vm: VM, key: PropertyKey, target?: any): void;
5
5
  export declare function createReactiveObserver(callback: CallbackFunction): ReactiveObserver;
6
6
  export * from '../libs/mutation-tracker';
7
+ export * from '../libs/signal-tracker';
@@ -2,5 +2,6 @@
2
2
  * EXPERIMENTAL: This function allows you to create a reactive readonly
3
3
  * membrane around any object value. This API is subject to change or
4
4
  * being removed.
5
+ * @param obj
5
6
  */
6
7
  export declare function readonly(obj: any): any;
@@ -1,4 +1,4 @@
1
- import { ShadowMode } from './vm';
1
+ import { ShadowMode, ShadowSupportMode } from './vm';
2
2
  export declare const enum ReportingEventId {
3
3
  CrossRootAriaInSyntheticShadow = "CrossRootAriaInSyntheticShadow",
4
4
  CompilerRuntimeVersionMismatch = "CompilerRuntimeVersionMismatch",
@@ -6,7 +6,8 @@ export declare const enum ReportingEventId {
6
6
  TemplateMutation = "TemplateMutation",
7
7
  StylesheetMutation = "StylesheetMutation",
8
8
  ConnectedCallbackWhileDisconnected = "ConnectedCallbackWhileDisconnected",
9
- ShadowModeUsage = "ShadowModeUsage"
9
+ ShadowModeUsage = "ShadowModeUsage",
10
+ ShadowSupportModeUsage = "ShadowSupportModeUsage"
10
11
  }
11
12
  export interface BasePayload {
12
13
  tagName?: string;
@@ -34,6 +35,9 @@ export interface ConnectedCallbackWhileDisconnectedPayload extends BasePayload {
34
35
  export interface ShadowModeUsagePayload extends BasePayload {
35
36
  mode: ShadowMode;
36
37
  }
38
+ export interface ShadowSupportModeUsagePayload extends BasePayload {
39
+ mode: ShadowSupportMode;
40
+ }
37
41
  export type ReportingPayloadMapping = {
38
42
  [ReportingEventId.CrossRootAriaInSyntheticShadow]: CrossRootAriaInSyntheticShadowPayload;
39
43
  [ReportingEventId.CompilerRuntimeVersionMismatch]: CompilerRuntimeVersionMismatchPayload;
@@ -42,15 +46,15 @@ export type ReportingPayloadMapping = {
42
46
  [ReportingEventId.StylesheetMutation]: StylesheetMutationPayload;
43
47
  [ReportingEventId.ConnectedCallbackWhileDisconnected]: ConnectedCallbackWhileDisconnectedPayload;
44
48
  [ReportingEventId.ShadowModeUsage]: ShadowModeUsagePayload;
49
+ [ReportingEventId.ShadowSupportModeUsage]: ShadowSupportModeUsagePayload;
45
50
  };
46
51
  export type ReportingDispatcher<T extends ReportingEventId = ReportingEventId> = (reportingEventId: T, payload: ReportingPayloadMapping[T]) => void;
47
- /** Callbacks to invoke when reporting is enabled **/
52
+ /** Callbacks to invoke when reporting is enabled */
48
53
  type OnReportingEnabledCallback = () => void;
49
54
  export declare const reportingControl: {
50
55
  /**
51
56
  * Attach a new reporting control (aka dispatcher).
52
- *
53
- * @param dispatcher - reporting control
57
+ * @param dispatcher reporting control
54
58
  */
55
59
  attachDispatcher(dispatcher: ReportingDispatcher): void;
56
60
  /**
@@ -67,7 +71,7 @@ export declare function onReportingEnabled(callback: OnReportingEnabledCallback)
67
71
  /**
68
72
  * Report to the current dispatcher, if there is one.
69
73
  * @param reportingEventId
70
- * @param payload - data to report
74
+ * @param payload data to report
71
75
  */
72
76
  export declare function report<T extends ReportingEventId>(reportingEventId: T, payload: ReportingPayloadMapping[T]): void;
73
77
  /**
@@ -4,10 +4,15 @@ export declare function isTemplateRegistered(tpl: Template): boolean;
4
4
  /**
5
5
  * INTERNAL: This function can only be invoked by compiled code. The compiler
6
6
  * will prevent this function from being imported by userland code.
7
+ * @param tpl
7
8
  */
8
9
  export declare function registerTemplate(tpl: Template): Template;
9
10
  /**
10
11
  * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
11
12
  * libraries to sanitize vulnerable attributes.
13
+ * @param tagName
14
+ * @param namespaceUri
15
+ * @param attrName
16
+ * @param attrValue
12
17
  */
13
18
  export declare function sanitizeAttribute(tagName: string, namespaceUri: string, attrName: string, attrValue: any): string;
@@ -8,8 +8,8 @@ import { VCustomElement, VNode } from './vnodes';
8
8
  export type StylesheetFactory = (stylesheetToken: string | undefined, useActualHostSelector: boolean, useNativeDirPseudoclass: boolean) => string;
9
9
  /**
10
10
  * The list of stylesheets associated with a template. Each entry is either a StylesheetFactory or a
11
- * TemplateStylesheetFactory a given stylesheet depends on other external stylesheets (via the
12
- * @import CSS declaration).
11
+ * TemplateStylesheetFactory a given stylesheet depends on other external stylesheets (via
12
+ * the @import CSS declaration).
13
13
  */
14
14
  export type TemplateStylesheetFactories = Array<StylesheetFactory | TemplateStylesheetFactories>;
15
15
  export declare function updateStylesheetToken(vm: VM, template: Template, legacy: boolean): void;
@@ -18,6 +18,8 @@ export declare function getStylesheetsContent(vm: VM, template: Template): strin
18
18
  * If the component that is currently being rendered uses scoped styles,
19
19
  * this returns the unique token for that scoped stylesheet. Otherwise
20
20
  * it returns null.
21
+ * @param owner
22
+ * @param legacy
21
23
  */
22
24
  export declare function getScopeTokenClass(owner: VM, legacy: boolean): string | null;
23
25
  /**
@@ -25,6 +27,7 @@ export declare function getScopeTokenClass(owner: VM, legacy: boolean): string |
25
27
  * exists. Otherwise it returns null.
26
28
  *
27
29
  * A host style token is applied to the component if scoped styles are used.
30
+ * @param vnode
28
31
  */
29
32
  export declare function getStylesheetTokenHost(vnode: VCustomElement): string | null;
30
33
  export declare function createStylesheet(vm: VM, stylesheets: string[]): VNode[] | null;
@@ -54,8 +54,10 @@ export interface Context {
54
54
  hasScopedStyles: boolean | undefined;
55
55
  /** The VNodes injected in all the shadow trees to apply the associated component stylesheets. */
56
56
  styleVNodes: VNode[] | null;
57
- /** Object used by the template function to store information that can be reused between
58
- * different render cycle of the same template. */
57
+ /**
58
+ * Object used by the template function to store information that can be reused between
59
+ * different render cycle of the same template.
60
+ */
59
61
  tplCache: TemplateCache;
60
62
  /** List of wire hooks that are invoked when the component gets connected. */
61
63
  wiredConnecting: Array<() => void>;
@@ -94,16 +96,20 @@ export interface VM<N = HostNode, E = HostElement> {
94
96
  children: VNodes;
95
97
  /** The list of adopted children VNodes. */
96
98
  aChildren: VNodes;
97
- /** The list of custom elements VNodes currently rendered in the shadow tree. We keep track of
99
+ /**
100
+ * The list of custom elements VNodes currently rendered in the shadow tree. We keep track of
98
101
  * those elements to efficiently unmount them when the parent component is disconnected without
99
- * having to traverse the VNode tree. */
102
+ * having to traverse the VNode tree.
103
+ */
100
104
  velements: VCustomElement[];
101
105
  /** The component public properties. */
102
106
  cmpProps: {
103
107
  [name: string]: any;
104
108
  };
105
- /** Contains information about the mapping between the slot names and the slotted VNodes, and
106
- * the owner of the slot content. */
109
+ /**
110
+ * Contains information about the mapping between the slot names and the slotted VNodes, and
111
+ * the owner of the slot content.
112
+ */
107
113
  cmpSlots: SlotSet;
108
114
  /** The component internal reactive properties. */
109
115
  cmpFields: {
@@ -121,28 +127,39 @@ export interface VM<N = HostNode, E = HostElement> {
121
127
  component: LightningElement;
122
128
  /** The custom element shadow root. */
123
129
  shadowRoot: ShadowRoot | null;
124
- /** The component render root. If the component is a shadow DOM component, it is its shadow
125
- * root. If the component is a light DOM component it the element itself. */
130
+ /**
131
+ * The component render root. If the component is a shadow DOM component, it is its shadow
132
+ * root. If the component is a light DOM component it the element itself.
133
+ */
126
134
  renderRoot: ShadowRoot | HostElement;
127
135
  /** The template reactive observer. */
128
136
  tro: ReactiveObserver;
129
- /** Hook invoked whenever a property is accessed on the host element. This hook is used by
130
- * Locker only. */
137
+ /**
138
+ * Hook invoked whenever a property is accessed on the host element. This hook is used by
139
+ * Locker only.
140
+ */
131
141
  setHook: (cmp: LightningElement, prop: PropertyKey, newValue: any) => void;
132
- /** Hook invoked whenever a property is set on the host element. This hook is used by Locker
133
- * only. */
142
+ /**
143
+ * Hook invoked whenever a property is set on the host element. This hook is used by Locker
144
+ * only.
145
+ */
134
146
  getHook: (cmp: LightningElement, prop: PropertyKey) => any;
135
- /** Hook invoked whenever a method is called on the component (life-cycle hooks, public
136
- * properties and event handlers). This hook is used by Locker. */
147
+ /**
148
+ * Hook invoked whenever a method is called on the component (life-cycle hooks, public
149
+ * properties and event handlers). This hook is used by Locker.
150
+ */
137
151
  callHook: (cmp: LightningElement | undefined, fn: (...args: any[]) => any, args?: any[]) => any;
138
152
  /**
139
- * Renderer API */
153
+ * Renderer API
154
+ */
140
155
  renderer: RendererAPI;
141
156
  /**
142
- * Debug info bag. Stores useful debug information about the component. */
157
+ * Debug info bag. Stores useful debug information about the component.
158
+ */
143
159
  debugInfo?: Record<string, any>;
144
160
  /**
145
- * Any stylesheets associated with the component */
161
+ * Any stylesheets associated with the component
162
+ */
146
163
  stylesheets: TemplateStylesheetFactories | null;
147
164
  /**
148
165
  * API version associated with this VM