@lwc/engine-server
Version:
Renders LWC components in a server environment.
74 lines (73 loc) • 4.32 kB
TypeScript
import { LifecycleCallback } from '@lwc/engine-core';
import { HostNode, HostElement, HostChildNode } from './types';
import { registerContextConsumer } from './context';
declare function createElement(tagName: string, namespace?: string): HostElement;
type N = HostNode;
type E = HostElement;
declare function insert(node: N, parent: E, anchor: N | null): void;
declare function remove(node: N, parent: E): void;
declare function cloneNode(node: HostChildNode): HostChildNode;
declare function createFragment(html: string): HostChildNode;
declare function createText(content: string): HostNode;
declare function createComment(content: string): HostNode;
declare function nextSibling(node: N): HostNode | null;
declare function previousSibling(node: N): HostNode | null;
declare function attachShadow(element: E, config: ShadowRootInit): any;
declare function getProperty(node: N, key: string): any;
declare function setProperty(node: N, key: string, value: any): void;
declare function setText(node: N, content: string): void;
declare function getAttribute(element: E, name: string, namespace?: string | null): string | null;
declare function setAttribute(element: E, name: string, value: string, namespace?: string | null): void;
declare function removeAttribute(element: E, name: string, namespace?: string | null): void;
declare function getClassList(element: E): DOMTokenList;
declare function setCSSStyleProperty(element: E, name: string, value: string, important: boolean): void;
declare function isConnected(node: HostNode): boolean;
declare function getTagName(elm: HostElement): string;
type CreateElementAndUpgrade = (upgradeCallback: LifecycleCallback) => HostElement;
declare function getUpgradableElement(tagName: string, _isFormAssociated?: boolean): CreateElementAndUpgrade;
declare function createCustomElement(tagName: string, upgradeCallback: LifecycleCallback, _useNativeLifecycle: boolean, _isFormAssociated: boolean): HostElement;
export declare const renderer: {
isSyntheticShadowDefined: boolean;
insert: typeof insert;
remove: typeof remove;
cloneNode: typeof cloneNode;
createFragment: typeof createFragment;
createElement: typeof createElement;
createText: typeof createText;
createComment: typeof createComment;
createCustomElement: typeof createCustomElement;
nextSibling: typeof nextSibling;
previousSibling: typeof previousSibling;
attachShadow: typeof attachShadow;
getProperty: typeof getProperty;
setProperty: typeof setProperty;
setText: typeof setText;
getAttribute: typeof getAttribute;
setAttribute: typeof setAttribute;
removeAttribute: typeof removeAttribute;
addEventListener: (target: HostNode, type: string, callback: EventListener, options?: AddEventListenerOptions | boolean) => void;
removeEventListener: (target: HostNode, type: string, callback: EventListener, options?: AddEventListenerOptions | boolean) => void;
dispatchEvent: (target: any, event: Event) => boolean;
getClassList: typeof getClassList;
setCSSStyleProperty: typeof setCSSStyleProperty;
getBoundingClientRect: (element: HostElement) => DOMRect;
querySelector: (element: HostElement, selectors: string) => Element | null;
querySelectorAll: (element: HostElement, selectors: string) => NodeList;
getElementsByTagName: (element: HostElement, tagNameOrWildCard: string) => HTMLCollection;
getElementsByClassName: (element: HostElement, names: string) => HTMLCollection;
getChildren: (element: HostElement) => HTMLCollection;
getChildNodes: (element: HostElement) => NodeList;
getFirstChild: (element: HostElement) => HostNode | null;
getFirstElementChild: (element: HostElement) => HostElement | null;
getLastChild: (element: HostElement) => HostNode | null;
getLastElementChild: (element: HostElement) => HostElement | null;
getTagName: typeof getTagName;
isConnected: typeof isConnected;
insertStylesheet: (content: string, target: any) => void;
assertInstanceOfHTMLElement: (elm: any, msg: string) => void;
ownerDocument: (element: HostElement) => Document;
registerContextConsumer: typeof registerContextConsumer;
attachInternals: (elm: HTMLElement) => ElementInternals;
defineCustomElement: typeof getUpgradableElement;
};
export {};