export enum NodeType { Document = 'DOCUMENT', DocumentType = 'DOCUMENT_TYPE', Element = 'ELEMENT', Text = 'TEXT', CDATA = 'CDATA', Comment = 'COMMENT' } export type DocumentNode = { type: NodeType.Document; childNodes: SerializedNodeWithId[]; compatMode?: string; }; export type DocumentTypeNode = { type: NodeType.DocumentType; name: string; publicId: string; systemId: string; }; export type Attributes = { [key: string]: string | number | boolean; }; export type ElementNode = { type: NodeType.Element; tagName: string; attributes: Attributes; childNodes: SerializedNodeWithId[]; isSVG?: true; needBlock?: boolean; }; export type TextNode = { type: NodeType.Text; textContent?: string; isStyle?: true; }; export type CdataNode = { type: NodeType.CDATA; textContent: ''; }; export type CommentNode = { type: NodeType.Comment; textContent: string; }; export type XPath = `/${string}`; /** * A increasing integer value that will be used to select a component re-mounted during a dom capture replay. * * see {@link EVOLV_SESSION_NODE_ID_DATA_KEY} */ export type SnapshotNodeId = string; /** * A xpath value to try and generate consistent ids for elements across sessions */ export type InteractionId = XPath; export type SerializedNode = ( | DocumentNode | DocumentTypeNode | ElementNode | TextNode | CdataNode | CommentNode ) & { rootId?: SnapshotNodeId; }; export type SerializedNodeWithId = SerializedNode & { id: SnapshotNodeId }; export interface IMirror { getId(n: TNode | undefined | null): SnapshotNodeId; getNode(id: SnapshotNodeId): TNode | null; getIds(): SnapshotNodeId[]; getMeta(n: TNode): SerializedNodeWithId | null; removeNodeFromMap(n: TNode): void; has(id: SnapshotNodeId): boolean; hasNode(node: TNode): boolean; add(n: TNode, meta: SerializedNodeWithId): void; replace(id: SnapshotNodeId, n: TNode): void; reset(): void; } export type TagMap = { [key: string]: string; };