@web-widget/web-widget
Version:
Web front-end application container
182 lines (177 loc) • 5.21 kB
TypeScript
import { S as SerializableObject, W as WebWidgetRendererConstructor } from './types-BWmo5MxR.js';
export { L as Loader, a as WebWidgetElementProps, c as WebWidgetRendererInterface, b as WebWidgetRendererOptions } from './types-BWmo5MxR.js';
import { ClientWidgetModule, Meta, ClientWidgetRenderContext } from '@web-widget/helpers';
export * from '@web-widget/helpers';
type Timeouts = Record<string, number>;
type PerformanceMarkDetail = {
name: string;
import: string;
};
declare const INNER_HTML_PLACEHOLDER = "<!--web-widget:placeholder-->";
/**
* Web Widget Container
* @event {Event} statuschange
* @event {WebWidgetUpdateEvent} update
*/
declare class HTMLWebWidgetElement extends HTMLElement {
#private;
constructor();
/**
* WidgetModule loader.
* @default null
*/
get loader(): (() => Promise<ClientWidgetModule>) | null;
set loader(value: (() => Promise<ClientWidgetModule>) | null);
/**
* WidgetModule base.
*/
get base(): string;
set base(value: string);
/**
* WidgetModule data.
* @deprecated Use `contextData` instead.
*/
get data(): SerializableObject | null;
set data(value: SerializableObject);
/**
* WidgetModule data.
*/
get contextData(): SerializableObject | null;
set contextData(value: SerializableObject);
/**
* WidgetModule meta.
*/
get contextMeta(): Meta | null;
set contextMeta(value: Meta);
/**
* WidgetModule context.
*/
get context(): ClientWidgetRenderContext | Record<string, unknown> | null;
set context(value: ClientWidgetRenderContext | Record<string, unknown>);
/**
* Whether the module is inactive.
*/
get inactive(): boolean;
set inactive(value: boolean);
/**
* Hydration mode.
* @default false
*/
get recovering(): boolean;
set recovering(value: boolean);
/**
* Indicates how the browser should load the module.
* @default "eager"
*/
get loading(): string;
set loading(value: 'eager' | 'lazy' | 'idle');
/**
* WidgetModule container status.
* @default "initial"
*/
get status(): string;
/**
* WidgetModule module url.
* @default ""
*/
get import(): string;
set import(value: string);
/**
* WidgetModule render target.
* @default "shadow"
*/
get renderTarget(): 'light' | 'shadow';
set renderTarget(value: 'light' | 'shadow');
/**
* WidgetModule timeouts.
*/
get timeouts(): Timeouts;
set timeouts(value: Timeouts);
set innerHTML(value: string);
/**
* Hook: Create the module's context.
*/
createContext(): ClientWidgetRenderContext;
/**
* Hook: Create the module's render node.
*/
createContainer(): Element | DocumentFragment;
/**
* Hook: Create Create the module's loader.
*/
createLoader(): () => Promise<ClientWidgetModule>;
/**
* Trigger the loading of the module.
*/
load(): Promise<void>;
/**
* Trigger the bootstrapping of the module.
*/
bootstrap(): Promise<void>;
/**
* Trigger the mounting of the module.
*/
mount(): Promise<void>;
/**
* Trigger the updating of the module.
*/
update(context?: object): Promise<void>;
/**
* Trigger the unmounting of the module.
*/
unmount(): Promise<void>;
/**
* Trigger the unloading of the module.
*/
unload(): Promise<void>;
connectedCallback(): void;
disconnectedCallback(): void;
attributeChangedCallback(name: string): void;
destroyedCallback(): void;
static get observedAttributes(): string[];
static get timeouts(): Timeouts;
static set timeouts(value: Timeouts);
static INITIAL: string;
static LOADING: string;
static LOADED: string;
static BOOTSTRAPPING: string;
static BOOTSTRAPPED: string;
static MOUNTING: string;
static MOUNTED: string;
static UPDATING: string;
static UNMOUNTING: string;
static UNLOADING: string;
static LOAD_ERROR: string;
static BOOTSTRAP_ERROR: string;
static MOUNT_ERROR: string;
static UPDATE_ERROR: string;
static UNMOUNT_ERROR: string;
static UNLOAD_ERROR: string;
}
declare global {
interface Window {
HTMLWebWidgetElement: typeof HTMLWebWidgetElement;
}
interface WebWidgetAttributes extends HTMLWebWidgetElement {
contextdata: string;
contextmeta: string;
}
interface HTMLElementTagNameMap {
'web-widget': HTMLWebWidgetElement;
}
namespace JSX {
interface IntrinsicElements {
'web-widget': WebWidgetAttributes;
}
}
}
interface Options extends EventInit {
value: Record<string, any> | null;
}
declare class WebWidgetUpdateEvent extends Event {
#private;
constructor(type: string, init?: Options);
get value(): Record<string, any> | null;
}
declare const WebWidgetRenderer: WebWidgetRendererConstructor;
export { HTMLWebWidgetElement, INNER_HTML_PLACEHOLDER, type PerformanceMarkDetail, SerializableObject, WebWidgetRenderer, WebWidgetRendererConstructor, WebWidgetUpdateEvent };