@awesome-fe/translate
Version:
Translation utils
51 lines (50 loc) • 4.04 kB
TypeScript
import { DocumentMode, ElementLocation, Location, StartTagLocation, TreeAdapterTypeMap, TypedTreeAdapter } from 'parse5';
import { DomAttr, DomChildNode, DomComment, DomDocument, DomDocumentFragment, DomDocumentType, DomElement, DomNode, DomParentNode, DomText } from './dom-models';
export interface DomTreeAdapterTypeMap extends TreeAdapterTypeMap {
attribute: DomAttr;
childNode: DomChildNode;
commentNode: DomComment;
document: DomDocument;
documentFragment: DomDocumentFragment;
documentType: DomDocumentType;
element: DomElement;
node: DomNode;
parentNode: DomParentNode;
textNode: DomText;
}
export declare class DomTreeAdapter implements TypedTreeAdapter<DomTreeAdapterTypeMap> {
private constructor();
static create(): TypedTreeAdapter<DomTreeAdapterTypeMap>;
adoptAttributes(recipient: DomTreeAdapterTypeMap['element'], attrs: Array<DomTreeAdapterTypeMap['attribute']>): void;
appendChild(parentNode: DomTreeAdapterTypeMap['parentNode'], newNode: DomTreeAdapterTypeMap['node']): void;
createCommentNode(data: string): DomTreeAdapterTypeMap['commentNode'];
createDocument(): DomTreeAdapterTypeMap['document'];
createDocumentFragment(): DomTreeAdapterTypeMap['documentFragment'];
createElement(tagName: string, namespaceURI: string, attrs: Array<DomTreeAdapterTypeMap['attribute']>): DomTreeAdapterTypeMap['element'];
detachNode(node: DomTreeAdapterTypeMap['node']): void;
getAttrList(element: DomTreeAdapterTypeMap['element']): Array<DomTreeAdapterTypeMap['attribute']>;
getChildNodes(node: DomTreeAdapterTypeMap['parentNode']): Array<DomTreeAdapterTypeMap['childNode']>;
getCommentNodeContent(commentNode: DomTreeAdapterTypeMap['commentNode']): string;
getDocumentMode(document: DomTreeAdapterTypeMap['document']): DocumentMode;
getDocumentTypeNodeName(doctypeNode: DomTreeAdapterTypeMap['documentType']): string;
getDocumentTypeNodePublicId(doctypeNode: DomTreeAdapterTypeMap['documentType']): string;
getDocumentTypeNodeSystemId(doctypeNode: DomTreeAdapterTypeMap['documentType']): string;
getFirstChild(node: DomTreeAdapterTypeMap['parentNode']): DomTreeAdapterTypeMap['childNode'] | undefined;
getNamespaceURI(element: DomTreeAdapterTypeMap['element']): string;
getNodeSourceCodeLocation(node: DomTreeAdapterTypeMap['node']): Location | StartTagLocation | ElementLocation;
getParentNode(node: DomTreeAdapterTypeMap['childNode']): DomTreeAdapterTypeMap['parentNode'];
getTagName(element: DomTreeAdapterTypeMap['element']): string;
getTemplateContent(templateElement: DomTreeAdapterTypeMap['element']): DomTreeAdapterTypeMap['documentFragment'];
getTextNodeContent(textNode: DomTreeAdapterTypeMap['textNode']): string;
insertBefore(parentNode: DomTreeAdapterTypeMap['parentNode'], newNode: DomTreeAdapterTypeMap['node'], referenceNode: DomTreeAdapterTypeMap['node']): void;
insertText(parentNode: DomTreeAdapterTypeMap['parentNode'], text: string): void;
insertTextBefore(parentNode: DomTreeAdapterTypeMap['parentNode'], text: string, referenceNode: DomTreeAdapterTypeMap['node']): void;
isCommentNode(node: DomTreeAdapterTypeMap['node']): node is DomTreeAdapterTypeMap['commentNode'];
isDocumentTypeNode(node: DomTreeAdapterTypeMap['node']): node is DomTreeAdapterTypeMap['documentType'];
isElementNode(node: DomTreeAdapterTypeMap['node']): node is DomTreeAdapterTypeMap['element'];
isTextNode(node: DomTreeAdapterTypeMap['node']): node is DomTreeAdapterTypeMap['textNode'];
setDocumentMode(document: DomTreeAdapterTypeMap['document'], mode: DocumentMode): void;
setDocumentType(document: DomTreeAdapterTypeMap['document'], name: string, publicId: string, systemId: string): void;
setNodeSourceCodeLocation(node: DomTreeAdapterTypeMap['node'], location: Location | StartTagLocation | ElementLocation): void;
setTemplateContent(templateElement: DomTreeAdapterTypeMap['element'], contentElement: DomTreeAdapterTypeMap['documentFragment']): void;
}