@lwc/engine-core 2.37.2 → 2.38.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,3 +1,4 @@
1
+ import type { WireContextSubscriptionPayload } from './wiring';
1
2
  export type HostNode = any;
2
3
  export type HostElement = any;
3
4
  type N = HostNode;
@@ -41,5 +42,7 @@ export interface RendererAPI {
41
42
  insertStylesheet: (content: string, target?: ShadowRoot) => void;
42
43
  assertInstanceOfHTMLElement: (elm: any, msg: string) => void;
43
44
  createCustomElement: (tagName: string, upgradeCallback: LifecycleCallback, connectedCallback?: LifecycleCallback, disconnectedCallback?: LifecycleCallback) => E;
45
+ ownerDocument(elm: E): Document;
46
+ registerContextConsumer: (element: E, adapterContextToken: string, subscriptionPayload: WireContextSubscriptionPayload) => void;
44
47
  }
45
48
  export {};
@@ -68,7 +68,7 @@ export interface VCustomElement extends VBaseElement {
68
68
  }
69
69
  export interface VNodeData {
70
70
  readonly props?: Readonly<Record<string, any>>;
71
- readonly attrs?: Readonly<Record<string, string | number | boolean>>;
71
+ readonly attrs?: Readonly<Record<string, string | number | boolean | null | undefined>>;
72
72
  readonly className?: string;
73
73
  readonly style?: string;
74
74
  readonly classMap?: Readonly<Record<string, boolean>>;
@@ -0,0 +1,4 @@
1
+ import { VM } from '../vm';
2
+ import { ContextProvider, ContextValue, RegisterContextProviderFn, WireAdapterConstructor, WireDef } from './types';
3
+ export declare function createContextProviderWithRegister(adapter: WireAdapterConstructor, registerContextProvider: RegisterContextProviderFn): ContextProvider;
4
+ export declare function createContextWatcher(vm: VM, wireDef: WireDef, callbackWhenContextIsReady: (newContext: ContextValue) => void): void;
@@ -0,0 +1,3 @@
1
+ export { createContextProviderWithRegister, createContextWatcher } from './context';
2
+ export { ConfigCallback, ConfigValue, ContextValue, DataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './types';
3
+ export { connectWireAdapters, disconnectWireAdapters, installWireAdapters, storeWiredFieldMeta, storeWiredMethodMeta, } from './wiring';
@@ -0,0 +1,49 @@
1
+ import type { LightningElement } from '../base-lightning-element';
2
+ import type { HostElement } from '../renderer';
3
+ export type DataCallback = (value: any) => void;
4
+ export type ConfigValue = Record<string, any>;
5
+ export type WireAdapterSchemaValue = 'optional' | 'required';
6
+ export type ContextValue = Record<string, any>;
7
+ export interface WireAdapter {
8
+ update(config: ConfigValue, context?: ContextValue): void;
9
+ connect(): void;
10
+ disconnect(): void;
11
+ }
12
+ export interface WireAdapterConstructor {
13
+ new (callback: DataCallback): WireAdapter;
14
+ configSchema?: Record<string, WireAdapterSchemaValue>;
15
+ contextSchema?: Record<string, WireAdapterSchemaValue>;
16
+ }
17
+ export interface WireDef {
18
+ method?: (data: any) => void;
19
+ adapter: WireAdapterConstructor;
20
+ dynamic: string[];
21
+ configCallback: ConfigCallback;
22
+ }
23
+ export interface WireMethodDef extends WireDef {
24
+ method: (data: any) => void;
25
+ }
26
+ export interface WireFieldDef extends WireDef {
27
+ method?: undefined;
28
+ }
29
+ export type ConfigCallback = (component: LightningElement) => ConfigValue;
30
+ export interface WireDebugInfo {
31
+ data?: any;
32
+ config?: ConfigValue;
33
+ context?: ContextValue;
34
+ wasDataProvisionedForConfig: boolean;
35
+ }
36
+ export type WireContextSubscriptionCallback = (subscriptionPayload: WireContextSubscriptionPayload) => void;
37
+ export interface WireContextSubscriptionPayload {
38
+ setNewContext(newContext: ContextValue): void;
39
+ setDisconnectedCallback(disconnectCallback: () => void): void;
40
+ }
41
+ export interface ContextConsumer {
42
+ provide(newContext: ContextValue): void;
43
+ }
44
+ export interface ContextProviderOptions {
45
+ consumerConnectedCallback: (consumer: ContextConsumer) => void;
46
+ consumerDisconnectedCallback?: (consumer: ContextConsumer) => void;
47
+ }
48
+ export type ContextProvider = (elmOrComponent: EventTarget, options: ContextProviderOptions) => void;
49
+ export type RegisterContextProviderFn = (element: HostElement, adapterContextToken: string, onContextSubscription: WireContextSubscriptionCallback) => void;
@@ -0,0 +1,7 @@
1
+ import { VM } from '../vm';
2
+ import type { ConfigCallback, WireAdapterConstructor } from './types';
3
+ export declare function storeWiredMethodMeta(descriptor: PropertyDescriptor, adapter: WireAdapterConstructor, configCallback: ConfigCallback, dynamic: string[]): void;
4
+ export declare function storeWiredFieldMeta(descriptor: PropertyDescriptor, adapter: WireAdapterConstructor, configCallback: ConfigCallback, dynamic: string[]): void;
5
+ export declare function installWireAdapters(vm: VM): void;
6
+ export declare function connectWireAdapters(vm: VM): void;
7
+ export declare function disconnectWireAdapters(vm: VM): void;
@@ -1,10 +0,0 @@
1
- import { WireAdapterConstructor, ContextValue } from './wiring';
2
- interface ContextConsumer {
3
- provide(newContext: ContextValue): void;
4
- }
5
- interface ContextProviderOptions {
6
- consumerConnectedCallback: (consumer: ContextConsumer) => void;
7
- consumerDisconnectedCallback?: (consumer: ContextConsumer) => void;
8
- }
9
- export declare function createContextProvider(adapter: WireAdapterConstructor): (elm: EventTarget, options: ContextProviderOptions) => void;
10
- export {};
@@ -1,34 +0,0 @@
1
- import { LightningElement } from './base-lightning-element';
2
- import { VM } from './vm';
3
- interface WireContextInternalEventPayload {
4
- setNewContext(newContext: ContextValue): void;
5
- setDisconnectedCallback(disconnectCallback: () => void): void;
6
- }
7
- export declare class WireContextRegistrationEvent extends CustomEvent<undefined> {
8
- readonly setNewContext: (newContext: ContextValue) => void;
9
- readonly setDisconnectedCallback: (disconnectCallback: () => void) => void;
10
- constructor(adapterToken: string, { setNewContext, setDisconnectedCallback }: WireContextInternalEventPayload);
11
- }
12
- export type DataCallback = (value: any) => void;
13
- export type ConfigValue = Record<string, any>;
14
- export interface WireAdapter {
15
- update(config: ConfigValue, context?: ContextValue): void;
16
- connect(): void;
17
- disconnect(): void;
18
- }
19
- export type WireAdapterSchemaValue = 'optional' | 'required';
20
- export declare function getAdapterToken(adapter: WireAdapterConstructor): string | undefined;
21
- export declare function setAdapterToken(adapter: WireAdapterConstructor, token: string): void;
22
- export type ContextValue = Record<string, any>;
23
- export type ConfigCallback = (component: LightningElement) => ConfigValue;
24
- export interface WireAdapterConstructor {
25
- new (callback: DataCallback): WireAdapter;
26
- configSchema?: Record<string, WireAdapterSchemaValue>;
27
- contextSchema?: Record<string, WireAdapterSchemaValue>;
28
- }
29
- export declare function storeWiredMethodMeta(descriptor: PropertyDescriptor, adapter: WireAdapterConstructor, configCallback: ConfigCallback, dynamic: string[]): void;
30
- export declare function storeWiredFieldMeta(descriptor: PropertyDescriptor, adapter: WireAdapterConstructor, configCallback: ConfigCallback, dynamic: string[]): void;
31
- export declare function installWireAdapters(vm: VM): void;
32
- export declare function connectWireAdapters(vm: VM): void;
33
- export declare function disconnectWireAdapters(vm: VM): void;
34
- export {};