From 40cf712cfd133a2f293bf86386bbefc076c41178 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] update typings --- typings/index.d.ts | 4 ++-- typings/snapshot.d.ts | 7 ++++--- typings/types.d.ts | 12 ++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index b871ef01..d436c211 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,4 +1,4 @@ -import snapshot, { serializeNodeWithId, transformAttribute, visitSnapshot } from './snapshot'; +import snapshot, { serializeNodeWithId, transformAttribute, visitSnapshot, IGNORED_NODE } from './snapshot'; import rebuild, { buildNodeWithSN, addHoverClass } from './rebuild'; export * from './types'; -export { snapshot, serializeNodeWithId, rebuild, buildNodeWithSN, addHoverClass, transformAttribute, visitSnapshot, }; +export { snapshot, serializeNodeWithId, rebuild, buildNodeWithSN, addHoverClass, transformAttribute, visitSnapshot, IGNORED_NODE, }; diff --git a/typings/snapshot.d.ts b/typings/snapshot.d.ts index 46982a64..163ee0c7 100644 --- a/typings/snapshot.d.ts +++ b/typings/snapshot.d.ts @@ -1,8 +1,9 @@ -import { serializedNodeWithId, INode, idNodeMap, MaskInputOptions } from './types'; +import { serializedNodeWithId, INode, idNodeMap, MaskInputOptions, SlimDOMOptions } from './types'; +export declare const IGNORED_NODE = -2; export declare function absoluteToStylesheet(cssText: string | null, href: string): string; export declare function absoluteToDoc(doc: Document, attributeValue: string): string; export declare function transformAttribute(doc: Document, name: string, value: string): string; -export declare function serializeNodeWithId(n: Node | INode, doc: Document, map: idNodeMap, blockClass: string | RegExp, skipChild?: boolean, inlineStylesheet?: boolean, maskInputOptions?: MaskInputOptions, recordCanvas?: boolean): serializedNodeWithId | null; -declare function snapshot(n: Document, blockClass: string | RegExp | undefined, inlineStylesheet: boolean | undefined, maskAllInputsOrOptions: boolean | MaskInputOptions, recordCanvas?: boolean): [serializedNodeWithId | null, idNodeMap]; +export declare function serializeNodeWithId(n: Node | INode, doc: Document, map: idNodeMap, blockClass: string | RegExp, skipChild?: boolean, inlineStylesheet?: boolean, maskInputOptions?: MaskInputOptions, slimDOMOptions?: SlimDOMOptions, recordCanvas?: boolean, preserveWhiteSpace?: boolean): serializedNodeWithId | null; +declare function snapshot(n: Document, blockClass: string | RegExp | undefined, inlineStylesheet: boolean | undefined, maskAllInputsOrOptions: boolean | MaskInputOptions, slimDOMSensibleOrOptions: boolean | SlimDOMOptions, recordCanvas?: boolean): [serializedNodeWithId | null, idNodeMap]; export declare function visitSnapshot(node: serializedNodeWithId, onVisit: (node: serializedNodeWithId) => unknown): void; export default snapshot; diff --git a/typings/types.d.ts b/typings/types.d.ts index 90271c14..256abba5 100644 --- a/typings/types.d.ts +++ b/typings/types.d.ts @@ -70,3 +70,15 @@ export declare type MaskInputOptions = Partial<{ textarea: boolean; select: boolean; }>; +export declare type SlimDOMOptions = Partial<{ + script: boolean; + comment: boolean; + headFavicon: boolean; + headWhitespace: boolean; + headMetaDescKeywords: boolean; + headMetaSocial: boolean; + headMetaRobots: boolean; + headMetaHttpEquiv: boolean; + headMetaAuthorship: boolean; + headMetaVerification: boolean; +}>;