@betterbugs/rrweb-snapshot 2.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,240 @@
1
+ import { DataURLOptions } from '@betterbugs/types';
2
+ import { IMirror } from '@betterbugs/types';
3
+ import { serializedElementNodeWithId } from '@betterbugs/types';
4
+ import { serializedNode } from '@betterbugs/types';
5
+ import { serializedNodeWithId } from '@betterbugs/types';
6
+
7
+ export declare function absolutifyURLs(cssText: string | null, href: string): string;
8
+
9
+ export declare function adaptCssForReplay(cssText: string, cache: BuildCache): string;
10
+
11
+ export declare type BuildCache = {
12
+ stylesWithHoverClass: Map<string, string>;
13
+ };
14
+
15
+ export declare function buildNodeWithSN(n: serializedNodeWithId, options: {
16
+ doc: Document;
17
+ mirror: Mirror;
18
+ skipChild?: boolean;
19
+ hackCss: boolean;
20
+ afterAppend?: (n: Node, id: number) => unknown;
21
+ cache: BuildCache;
22
+ }): Node | null;
23
+
24
+ export declare function classMatchesRegex(node: Node | null, regex: RegExp, checkAncestors: boolean): boolean;
25
+
26
+ export declare function cleanupSnapshot(): void;
27
+
28
+ export declare function createCache(): BuildCache;
29
+
30
+ export declare function createMirror(): Mirror;
31
+
32
+ declare interface CSSImportRule_2 extends CSSRule {
33
+ readonly href: string;
34
+ readonly layerName: string | null;
35
+ readonly media: MediaList;
36
+ readonly styleSheet: CSSStyleSheet;
37
+ readonly supportsText?: string | null;
38
+ }
39
+
40
+ export declare type DialogAttributes = {
41
+ open: string;
42
+ rr_open_mode: 'modal' | 'non-modal';
43
+ };
44
+
45
+ export declare function escapeImportStatement(rule: CSSImportRule_2): string;
46
+
47
+ export declare function extractFileExtension(path: string, baseURL?: string): string | null;
48
+
49
+ export declare function fixSafariColons(cssStringified: string): string;
50
+
51
+ export declare function genId(): number;
52
+
53
+ export declare function getInputType(element: HTMLElement): Lowercase<string> | null;
54
+
55
+ export declare interface ICanvas extends HTMLCanvasElement {
56
+ __context: string;
57
+ }
58
+
59
+ export declare type idNodeMap = Map<number, Node>;
60
+
61
+ export declare function ignoreAttribute(tagName: string, name: string, _value: unknown): boolean;
62
+
63
+ export declare const IGNORED_NODE = -2;
64
+
65
+ export declare function is2DCanvasBlank(canvas: HTMLCanvasElement): boolean;
66
+
67
+ export declare function isCSSImportRule(rule: CSSRule): rule is CSSImportRule_2;
68
+
69
+ export declare function isCSSStyleRule(rule: CSSRule): rule is CSSStyleRule;
70
+
71
+ export declare function isElement(n: Node): n is Element;
72
+
73
+ export declare function isNativeShadowDom(shadowRoot: ShadowRoot): boolean;
74
+
75
+ export declare function isNodeMetaEqual(a: serializedNode, b: serializedNode): boolean;
76
+
77
+ export declare function isShadowRoot(n: Node): n is ShadowRoot;
78
+
79
+ export declare type KeepIframeSrcFn = (src: string) => boolean;
80
+
81
+ export declare function markCssSplits(cssText: string, style: HTMLStyleElement): string;
82
+
83
+ export declare type MaskInputFn = (text: string, element: HTMLElement) => string;
84
+
85
+ export declare type MaskInputOptions = Partial<{
86
+ color: boolean;
87
+ date: boolean;
88
+ 'datetime-local': boolean;
89
+ email: boolean;
90
+ month: boolean;
91
+ number: boolean;
92
+ range: boolean;
93
+ search: boolean;
94
+ tel: boolean;
95
+ text: boolean;
96
+ time: boolean;
97
+ url: boolean;
98
+ week: boolean;
99
+ textarea: boolean;
100
+ select: boolean;
101
+ password: boolean;
102
+ }>;
103
+
104
+ export declare function maskInputValue({ element, maskInputOptions, tagName, type, value, maskInputFn, }: {
105
+ element: HTMLElement;
106
+ maskInputOptions: MaskInputOptions;
107
+ tagName: string;
108
+ type: string | null;
109
+ value: string | null;
110
+ maskInputFn?: MaskInputFn;
111
+ }): string;
112
+
113
+ export declare type MaskTextFn = (text: string, element: HTMLElement | null) => string;
114
+
115
+ export declare class Mirror implements IMirror<Node> {
116
+ private idNodeMap;
117
+ private nodeMetaMap;
118
+ getId(n: Node | undefined | null): number;
119
+ getNode(id: number): Node | null;
120
+ getIds(): number[];
121
+ getMeta(n: Node): serializedNodeWithId | null;
122
+ removeNodeFromMap(n: Node): void;
123
+ has(id: number): boolean;
124
+ hasNode(node: Node): boolean;
125
+ add(n: Node, meta: serializedNodeWithId): void;
126
+ replace(id: number, n: Node): void;
127
+ reset(): void;
128
+ }
129
+
130
+ export declare function needMaskingText(node: Node, maskTextClass: string | RegExp, maskTextSelector: string | null, checkAncestors: boolean): boolean;
131
+
132
+ export declare type nodeMetaMap = WeakMap<Node, serializedNodeWithId>;
133
+
134
+ export declare function normalizeCssString(cssText: string, _testNoPxNorm?: boolean): string;
135
+
136
+ export declare function rebuild(n: serializedNodeWithId, options: {
137
+ doc: Document;
138
+ onVisit?: (node: Node) => unknown;
139
+ hackCss?: boolean;
140
+ afterAppend?: (n: Node, id: number) => unknown;
141
+ cache: BuildCache;
142
+ mirror: Mirror;
143
+ }): Node | null;
144
+
145
+ export declare function serializeNodeWithId(n: Node, options: {
146
+ doc: Document;
147
+ mirror: Mirror;
148
+ blockClass: string | RegExp;
149
+ blockSelector: string | null;
150
+ maskTextClass: string | RegExp;
151
+ maskTextSelector: string | null;
152
+ skipChild: boolean;
153
+ inlineStylesheet: boolean;
154
+ newlyAddedElement?: boolean;
155
+ maskInputOptions?: MaskInputOptions;
156
+ needsMask?: boolean;
157
+ maskTextFn: MaskTextFn | undefined;
158
+ maskInputFn: MaskInputFn | undefined;
159
+ slimDOMOptions: SlimDOMOptions;
160
+ dataURLOptions?: DataURLOptions;
161
+ keepIframeSrcFn?: KeepIframeSrcFn;
162
+ inlineImages?: boolean;
163
+ recordCanvas?: boolean;
164
+ preserveWhiteSpace?: boolean;
165
+ onSerialize?: (n: Node) => unknown;
166
+ onIframeLoad?: (iframeNode: HTMLIFrameElement, node: serializedElementNodeWithId) => unknown;
167
+ iframeLoadTimeout?: number;
168
+ onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId) => unknown;
169
+ stylesheetLoadTimeout?: number;
170
+ cssCaptured?: boolean;
171
+ }): serializedNodeWithId | null;
172
+
173
+ export declare function slimDOMDefaults(_slimDOMOptions: SlimDOMOptions | 'all' | true | false | undefined): Partial<{
174
+ script: boolean;
175
+ comment: boolean;
176
+ headFavicon: boolean;
177
+ headWhitespace: boolean;
178
+ headMetaDescKeywords: boolean;
179
+ headMetaSocial: boolean;
180
+ headMetaRobots: boolean;
181
+ headMetaHttpEquiv: boolean;
182
+ headMetaAuthorship: boolean;
183
+ headMetaVerification: boolean;
184
+ headTitleMutations: boolean;
185
+ }>;
186
+
187
+ export declare type SlimDOMOptions = Partial<{
188
+ script: boolean;
189
+ comment: boolean;
190
+ headFavicon: boolean;
191
+ headWhitespace: boolean;
192
+ headMetaDescKeywords: boolean;
193
+ headMetaSocial: boolean;
194
+ headMetaRobots: boolean;
195
+ headMetaHttpEquiv: boolean;
196
+ headMetaAuthorship: boolean;
197
+ headMetaVerification: boolean;
198
+ headTitleMutations: boolean;
199
+ }>;
200
+
201
+ export declare function snapshot(n: Document, options?: {
202
+ mirror?: Mirror;
203
+ blockClass?: string | RegExp;
204
+ blockSelector?: string | null;
205
+ maskTextClass?: string | RegExp;
206
+ maskTextSelector?: string | null;
207
+ inlineStylesheet?: boolean;
208
+ maskAllInputs?: boolean | MaskInputOptions;
209
+ maskTextFn?: MaskTextFn;
210
+ maskInputFn?: MaskInputFn;
211
+ slimDOM?: 'all' | boolean | SlimDOMOptions;
212
+ dataURLOptions?: DataURLOptions;
213
+ inlineImages?: boolean;
214
+ recordCanvas?: boolean;
215
+ preserveWhiteSpace?: boolean;
216
+ onSerialize?: (n: Node) => unknown;
217
+ onIframeLoad?: (iframeNode: HTMLIFrameElement, node: serializedElementNodeWithId) => unknown;
218
+ iframeLoadTimeout?: number;
219
+ onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId) => unknown;
220
+ stylesheetLoadTimeout?: number;
221
+ keepIframeSrcFn?: KeepIframeSrcFn;
222
+ }): serializedNodeWithId | null;
223
+
224
+ export declare function splitCssText(cssText: string, style: HTMLStyleElement, _testNoPxNorm?: boolean): string[];
225
+
226
+ export declare function stringifyRule(rule: CSSRule, sheetHref: string | null): string;
227
+
228
+ export declare function stringifyStylesheet(s: CSSStyleSheet): string | null;
229
+
230
+ export declare type tagMap = {
231
+ [key: string]: string;
232
+ };
233
+
234
+ export declare function toLowerCase<T extends string>(str: T): Lowercase<T>;
235
+
236
+ export declare function transformAttribute(doc: Document, tagName: Lowercase<string>, name: Lowercase<string>, value: string | null): string | null;
237
+
238
+ export declare function visitSnapshot(node: serializedNodeWithId, onVisit: (node: serializedNodeWithId) => unknown): void;
239
+
240
+ export { }