posthog-js 1.428.8 → 1.428.9

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.
Files changed (49) hide show
  1. package/LICENSE +64 -0
  2. package/dist/all-external-dependencies.js +1 -1
  3. package/dist/all-external-dependencies.js.map +1 -1
  4. package/dist/array.full.es5.js +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.no-external.js +1 -1
  11. package/dist/customizations.d.ts +1 -0
  12. package/dist/customizations.full.js +1 -1
  13. package/dist/customizations.js +1 -1
  14. package/dist/default-extensions.js +1 -1
  15. package/dist/extension-bundles.js +1 -1
  16. package/dist/lazy-recorder.js +1 -1
  17. package/dist/lazy-recorder.js.map +1 -1
  18. package/dist/main.d.ts +1 -0
  19. package/dist/main.js +1 -1
  20. package/dist/module.d.ts +1 -0
  21. package/dist/module.full.d.ts +1 -0
  22. package/dist/module.full.js +1 -1
  23. package/dist/module.full.js.map +1 -1
  24. package/dist/module.full.no-external.d.ts +1 -0
  25. package/dist/module.full.no-external.js +1 -1
  26. package/dist/module.full.no-external.js.map +1 -1
  27. package/dist/module.js +1 -1
  28. package/dist/module.mjs +1 -1
  29. package/dist/module.no-external.d.ts +1 -0
  30. package/dist/module.no-external.js +1 -1
  31. package/dist/module.slim.js +1 -1
  32. package/dist/module.slim.no-external.d.ts +1 -0
  33. package/dist/module.slim.no-external.js +1 -1
  34. package/dist/posthog-recorder.d.ts +577 -653
  35. package/dist/posthog-recorder.js +1 -1
  36. package/dist/posthog-recorder.js.map +1 -1
  37. package/dist/recorder.d.ts +577 -653
  38. package/dist/rrweb-plugin-console-record.d.ts +436 -500
  39. package/dist/rrweb-types.d.ts +688 -735
  40. package/dist/rrweb.d.ts +1303 -1433
  41. package/dist/src/entrypoints/rrweb-types.es.d.ts +9 -0
  42. package/dist/src/extensions/replay/types/rrweb-types.d.ts +1 -0
  43. package/lib/package.json +1 -1
  44. package/lib/src/entrypoints/rrweb-types.es.d.ts +9 -0
  45. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js +12 -2
  46. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js.map +1 -1
  47. package/lib/src/extensions/replay/types/rrweb-types.d.ts +1 -0
  48. package/lib/src/extensions/replay/types/rrweb-types.js.map +1 -1
  49. package/package.json +5 -5
@@ -1,507 +1,443 @@
1
- declare type addedNodeMutation = {
2
- parentId: number;
3
- previousId?: number | null;
4
- nextId: number | null;
5
- node: serializedNodeWithId;
6
- };
7
-
8
- declare type adoptedStyleSheetData = {
9
- source: IncrementalSource.AdoptedStyleSheet;
10
- } & adoptedStyleSheetParam;
11
-
12
- declare type adoptedStyleSheetParam = {
13
- id: number;
14
- styles?: {
15
- styleId: number;
16
- rules: styleSheetAddRule[];
17
- }[];
18
- styleIds: number[];
19
- };
20
-
21
- declare type attributeMutation = {
22
- id: number;
23
- attributes: {
24
- [key: string]: string | styleOMValue | null;
25
- };
26
- };
27
-
28
- declare type attributes = cssTextKeyAttr & {
29
- [key: string]: string | number | true | null;
30
- };
31
-
32
- declare enum CanvasContext {
33
- '2D' = 0,
34
- WebGL = 1,
35
- WebGL2 = 2
36
- }
37
-
38
- declare type canvasMutationCommand = {
39
- property: string;
40
- args: Array<unknown>;
41
- setter?: true;
42
- };
43
-
44
- declare type canvasMutationData = {
45
- source: IncrementalSource.CanvasMutation;
46
- } & canvasMutationParam;
47
-
48
- declare type canvasMutationParam = {
49
- id: number;
50
- type: CanvasContext;
51
- commands: canvasMutationCommand[];
52
- displayWidth?: number;
53
- displayHeight?: number;
54
- } | ({
55
- id: number;
56
- type: CanvasContext;
57
- displayWidth?: number;
58
- displayHeight?: number;
59
- } & canvasMutationCommand);
60
-
61
- declare type cdataNode = {
62
- type: NodeType.CDATA;
63
- textContent: '';
64
- };
65
-
66
- declare type commentNode = {
67
- type: NodeType.Comment;
68
- textContent: string;
69
- };
70
-
71
- declare type cssTextKeyAttr = {
72
- _cssText?: string;
73
- };
74
-
75
- declare type customElementData = {
76
- source: IncrementalSource.CustomElement;
77
- } & customElementParam;
78
-
79
- declare type customElementParam = {
80
- define?: {
81
- name: string;
82
- };
83
- };
84
-
85
- declare type customEvent<T = unknown> = {
86
- type: EventType.Custom;
87
- data: {
88
- tag: string;
89
- payload: T;
90
- };
91
- };
92
-
93
- declare type documentNode = {
94
- type: NodeType.Document;
95
- childNodes: serializedNodeWithId[];
96
- compatMode?: string;
97
- };
98
-
99
- declare type documentTypeNode = {
100
- type: NodeType.DocumentType;
101
- name: string;
102
- publicId: string;
103
- systemId: string;
104
- };
105
-
106
- declare type domContentLoadedEvent = {
107
- type: EventType.DomContentLoaded;
108
- data: unknown;
109
- };
110
-
111
- declare type elementNode = {
112
- type: NodeType.Element;
113
- tagName: string;
114
- attributes: attributes;
115
- childNodes: serializedNodeWithId[];
116
- isSVG?: true;
117
- needBlock?: boolean;
118
- isCustom?: true;
119
- };
120
-
121
- declare enum EventType {
122
- DomContentLoaded = 0,
123
- Load = 1,
124
- FullSnapshot = 2,
125
- IncrementalSnapshot = 3,
126
- Meta = 4,
127
- Custom = 5,
128
- Plugin = 6
129
- }
130
-
131
- declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
132
-
133
- declare type eventWithTime = eventWithoutTime & {
134
- timestamp: number;
135
- delay?: number;
136
- };
137
-
138
- declare type fontData = {
139
- source: IncrementalSource.Font;
140
- } & fontParam;
141
-
142
- declare type fontParam = {
143
- family: string;
144
- fontSource: string;
145
- buffer: boolean;
146
- descriptors?: FontFaceDescriptors;
147
- };
148
-
149
- declare type fullSnapshotEvent = {
150
- type: EventType.FullSnapshot;
151
- data: {
152
- node: serializedNodeWithId;
153
- initialOffset: {
154
- top: number;
155
- left: number;
156
- };
157
- };
158
- };
159
-
160
- declare interface ICrossOriginIframeMirror {
161
- getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
162
- getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
163
- getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
164
- getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
165
- reset(iframe?: HTMLIFrameElement): void;
166
- }
167
-
168
- declare interface IMirror<TNode> {
169
- getId(n: TNode | undefined | null): number;
170
- getNode(id: number): TNode | null;
171
- getIds(): number[];
172
- getMeta(n: TNode): serializedNodeWithId | null;
173
- removeNodeFromMap(n: TNode): void;
174
- has(id: number): boolean;
175
- hasNode(node: TNode): boolean;
176
- add(n: TNode, meta: serializedNodeWithId): void;
177
- replace(id: number, n: TNode): void;
178
- reset(): void;
179
- }
180
-
181
- declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
182
-
183
- declare type incrementalSnapshotEvent = {
184
- type: EventType.IncrementalSnapshot;
185
- data: incrementalData;
186
- };
187
-
188
- declare enum IncrementalSource {
189
- Mutation = 0,
190
- MouseMove = 1,
191
- MouseInteraction = 2,
192
- Scroll = 3,
193
- ViewportResize = 4,
194
- Input = 5,
195
- TouchMove = 6,
196
- MediaInteraction = 7,
197
- StyleSheetRule = 8,
198
- CanvasMutation = 9,
199
- Font = 10,
200
- Log = 11,
201
- Drag = 12,
202
- StyleDeclaration = 13,
203
- Selection = 14,
204
- AdoptedStyleSheet = 15,
205
- CustomElement = 16
206
- }
207
-
208
- declare type inputData = {
209
- source: IncrementalSource.Input;
210
- id: number;
211
- } & inputValue;
212
-
213
- declare type inputValue = {
214
- text: string;
215
- isChecked: boolean;
216
- userTriggered?: boolean;
217
- };
218
-
219
- declare type IWindow = Window & typeof globalThis;
220
-
221
- declare type listenerHandler = () => void;
222
-
223
- declare type loadedEvent = {
224
- type: EventType.Load;
225
- data: unknown;
226
- };
227
-
228
- declare type mediaInteractionData = {
229
- source: IncrementalSource.MediaInteraction;
230
- } & mediaInteractionParam;
231
-
232
- declare type mediaInteractionParam = {
233
- type: MediaInteractions;
234
- id: number;
235
- currentTime?: number;
236
- volume?: number;
237
- muted?: boolean;
238
- loop?: boolean;
239
- playbackRate?: number;
240
- };
241
-
242
- declare enum MediaInteractions {
243
- Play = 0,
244
- Pause = 1,
245
- Seeked = 2,
246
- VolumeChange = 3,
247
- RateChange = 4
248
- }
249
-
250
- declare type metaEvent = {
251
- type: EventType.Meta;
252
- data: {
253
- href: string;
254
- width: number;
255
- height: number;
256
- };
257
- };
258
-
259
- declare type mouseInteractionData = {
260
- source: IncrementalSource.MouseInteraction;
261
- } & mouseInteractionParam;
262
-
263
- declare type mouseInteractionParam = {
264
- type: MouseInteractions;
265
- id: number;
266
- x?: number;
267
- y?: number;
268
- pointerType?: PointerTypes;
269
- };
270
-
271
- declare enum MouseInteractions {
272
- MouseUp = 0,
273
- MouseDown = 1,
274
- Click = 2,
275
- ContextMenu = 3,
276
- DblClick = 4,
277
- Focus = 5,
278
- Blur = 6,
279
- TouchStart = 7,
280
- TouchMove_Departed = 8,
281
- TouchEnd = 9,
282
- TouchCancel = 10
283
- }
284
-
285
- declare type mousemoveData = {
286
- source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
287
- positions: mousePosition[];
288
- };
289
-
290
- declare type mousePosition = {
291
- x: number;
292
- y: number;
293
- id: number;
294
- timeOffset: number;
295
- };
296
-
297
- declare type mutationCallbackParam = {
298
- texts: textMutation[];
299
- attributes: attributeMutation[];
300
- removes: removedNodeMutation[];
301
- adds: addedNodeMutation[];
302
- isAttachIframe?: true;
303
- };
304
-
305
- declare type mutationData = {
306
- source: IncrementalSource.Mutation;
307
- } & mutationCallbackParam;
308
-
309
- declare enum NodeType {
310
- Document = 0,
311
- DocumentType = 1,
312
- Element = 2,
313
- Text = 3,
314
- CDATA = 4,
315
- Comment = 5
316
- }
317
-
318
- declare type pluginEvent<T = unknown> = {
319
- type: EventType.Plugin;
320
- data: {
321
- plugin: string;
322
- payload: T;
323
- };
324
- };
325
-
326
- declare enum PointerTypes {
327
- Mouse = 0,
328
- Pen = 1,
329
- Touch = 2
330
- }
331
-
332
- declare type RecordPlugin<TOptions = unknown> = {
333
- name: string;
334
- observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
335
- eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
336
- getMirror?: (mirrors: {
337
- nodeMirror: IMirror<Node>;
338
- crossOriginIframeMirror: ICrossOriginIframeMirror;
339
- crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
340
- }) => void;
341
- options: TOptions;
342
- };
343
-
344
- declare type removedNodeMutation = {
345
- parentId: number;
346
- id: number;
347
- isShadow?: boolean;
348
- };
349
-
350
- declare type scrollData = {
351
- source: IncrementalSource.Scroll;
352
- } & scrollPosition;
353
-
354
- declare type scrollPosition = {
355
- id: number;
356
- x: number;
357
- y: number;
358
- };
359
-
360
- declare type selectionData = {
361
- source: IncrementalSource.Selection;
362
- } & selectionParam;
363
-
364
- declare type selectionParam = {
365
- ranges: Array<SelectionRange>;
366
- };
367
-
368
- declare type SelectionRange = {
369
- start: number;
370
- startOffset: number;
371
- end: number;
372
- endOffset: number;
373
- };
374
-
375
- declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
376
- rootId?: number;
377
- isShadowHost?: boolean;
378
- isShadow?: boolean;
379
- };
380
-
381
- declare type serializedNodeWithId = serializedNode & {
382
- id: number;
383
- };
384
-
385
- declare type styleDeclarationData = {
386
- source: IncrementalSource.StyleDeclaration;
387
- } & styleDeclarationParam;
388
-
389
- declare type styleDeclarationParam = {
390
- id?: number;
391
- styleId?: number;
392
- index: number[];
393
- set?: {
394
- property: string;
395
- value: string | null;
396
- priority: string | undefined;
397
- };
398
- remove?: {
399
- property: string;
400
- };
401
- };
402
-
403
- declare type styleOMValue = {
404
- [key: string]: styleValueWithPriority | string | false;
405
- };
406
-
407
- declare type styleSheetAddRule = {
408
- rule: string;
409
- index?: number | number[];
410
- };
411
-
412
- declare type styleSheetDeleteRule = {
413
- index: number | number[];
414
- };
415
-
416
- declare type styleSheetRuleData = {
417
- source: IncrementalSource.StyleSheetRule;
418
- } & styleSheetRuleParam;
419
-
420
- declare type styleSheetRuleParam = {
421
- id?: number;
422
- styleId?: number;
423
- removes?: styleSheetDeleteRule[];
424
- adds?: styleSheetAddRule[];
425
- replace?: string;
426
- replaceSync?: string;
427
- };
428
-
429
- declare type styleValueWithPriority = [string, string];
430
-
431
- declare type textMutation = {
432
- id: number;
433
- value: string | null;
434
- };
435
-
436
- declare type textNode = {
437
- type: NodeType.Text;
438
- textContent: string;
439
- isStyle?: true;
440
- };
441
-
442
- declare type viewportResizeData = {
443
- source: IncrementalSource.ViewportResize;
444
- } & viewportResizeDimension;
445
-
446
- declare type viewportResizeDimension = {
447
- width: number;
448
- height: number;
449
- };
450
-
451
-
452
-
1
+ //#region src/index.d.ts
2
+ declare enum EventType {
3
+ DomContentLoaded = 0,
4
+ Load = 1,
5
+ FullSnapshot = 2,
6
+ IncrementalSnapshot = 3,
7
+ Meta = 4,
8
+ Custom = 5,
9
+ Plugin = 6
10
+ }
11
+ type domContentLoadedEvent = {
12
+ type: EventType.DomContentLoaded;
13
+ data: unknown;
14
+ };
15
+ type loadedEvent = {
16
+ type: EventType.Load;
17
+ data: unknown;
18
+ };
19
+ type fullSnapshotEvent = {
20
+ type: EventType.FullSnapshot;
21
+ data: {
22
+ node: serializedNodeWithId;
23
+ initialOffset: {
24
+ top: number;
25
+ left: number;
26
+ };
27
+ };
28
+ };
29
+ type incrementalSnapshotEvent = {
30
+ type: EventType.IncrementalSnapshot;
31
+ data: incrementalData;
32
+ };
33
+ type metaEvent = {
34
+ type: EventType.Meta;
35
+ data: {
36
+ href: string;
37
+ width: number;
38
+ height: number;
39
+ };
40
+ };
41
+ type customEvent<T = unknown> = {
42
+ type: EventType.Custom;
43
+ data: {
44
+ tag: string;
45
+ payload: T;
46
+ };
47
+ };
48
+ type pluginEvent<T = unknown> = {
49
+ type: EventType.Plugin;
50
+ data: {
51
+ plugin: string;
52
+ payload: T;
53
+ };
54
+ };
55
+ declare enum IncrementalSource {
56
+ Mutation = 0,
57
+ MouseMove = 1,
58
+ MouseInteraction = 2,
59
+ Scroll = 3,
60
+ ViewportResize = 4,
61
+ Input = 5,
62
+ TouchMove = 6,
63
+ MediaInteraction = 7,
64
+ StyleSheetRule = 8,
65
+ CanvasMutation = 9,
66
+ Font = 10,
67
+ Log = 11,
68
+ Drag = 12,
69
+ StyleDeclaration = 13,
70
+ Selection = 14,
71
+ AdoptedStyleSheet = 15,
72
+ CustomElement = 16
73
+ }
74
+ type mutationData = {
75
+ source: IncrementalSource.Mutation;
76
+ } & mutationCallbackParam;
77
+ type mousemoveData = {
78
+ source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
79
+ positions: mousePosition[];
80
+ };
81
+ type mouseInteractionData = {
82
+ source: IncrementalSource.MouseInteraction;
83
+ } & mouseInteractionParam;
84
+ type scrollData = {
85
+ source: IncrementalSource.Scroll;
86
+ } & scrollPosition;
87
+ type viewportResizeData = {
88
+ source: IncrementalSource.ViewportResize;
89
+ } & viewportResizeDimension;
90
+ type inputData = {
91
+ source: IncrementalSource.Input;
92
+ id: number;
93
+ } & inputValue;
94
+ type mediaInteractionData = {
95
+ source: IncrementalSource.MediaInteraction;
96
+ } & mediaInteractionParam;
97
+ type styleSheetRuleData = {
98
+ source: IncrementalSource.StyleSheetRule;
99
+ } & styleSheetRuleParam;
100
+ type styleDeclarationData = {
101
+ source: IncrementalSource.StyleDeclaration;
102
+ } & styleDeclarationParam;
103
+ type canvasMutationData = {
104
+ source: IncrementalSource.CanvasMutation;
105
+ } & canvasMutationParam;
106
+ type fontData = {
107
+ source: IncrementalSource.Font;
108
+ } & fontParam;
109
+ type selectionData = {
110
+ source: IncrementalSource.Selection;
111
+ } & selectionParam;
112
+ type adoptedStyleSheetData = {
113
+ source: IncrementalSource.AdoptedStyleSheet;
114
+ } & adoptedStyleSheetParam;
115
+ type customElementData = {
116
+ source: IncrementalSource.CustomElement;
117
+ } & customElementParam;
118
+ type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
119
+ type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
120
+ type eventWithTime = eventWithoutTime & {
121
+ timestamp: number;
122
+ delay?: number;
123
+ };
124
+ interface ICrossOriginIframeMirror {
125
+ getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
126
+ getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
127
+ getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
128
+ getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
129
+ reset(iframe?: HTMLIFrameElement): void;
130
+ }
131
+ type RecordPlugin<TOptions = unknown> = {
132
+ name: string;
133
+ observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
134
+ eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
135
+ getMirror?: (mirrors: {
136
+ nodeMirror: IMirror<Node>;
137
+ crossOriginIframeMirror: ICrossOriginIframeMirror;
138
+ crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
139
+ }) => void;
140
+ options: TOptions;
141
+ };
142
+ type textMutation = {
143
+ id: number;
144
+ value: string | null;
145
+ };
146
+ type styleOMValue = {
147
+ [key: string]: styleValueWithPriority | string | false;
148
+ };
149
+ type styleValueWithPriority = [string, string];
150
+ type attributeMutation = {
151
+ id: number;
152
+ attributes: {
153
+ [key: string]: string | styleOMValue | null;
154
+ };
155
+ };
156
+ type removedNodeMutation = {
157
+ parentId: number;
158
+ id: number;
159
+ isShadow?: boolean;
160
+ };
161
+ type addedNodeMutation = {
162
+ parentId: number;
163
+ previousId?: number | null;
164
+ nextId: number | null;
165
+ node: serializedNodeWithId;
166
+ };
167
+ type mutationCallbackParam = {
168
+ texts: textMutation[];
169
+ attributes: attributeMutation[];
170
+ removes: removedNodeMutation[];
171
+ adds: addedNodeMutation[];
172
+ isAttachIframe?: true;
173
+ };
174
+ type mousePosition = {
175
+ x: number;
176
+ y: number;
177
+ id: number;
178
+ timeOffset: number;
179
+ };
180
+ declare enum MouseInteractions {
181
+ MouseUp = 0,
182
+ MouseDown = 1,
183
+ Click = 2,
184
+ ContextMenu = 3,
185
+ DblClick = 4,
186
+ Focus = 5,
187
+ Blur = 6,
188
+ TouchStart = 7,
189
+ TouchMove_Departed = 8,
190
+ TouchEnd = 9,
191
+ TouchCancel = 10
192
+ }
193
+ declare enum PointerTypes {
194
+ Mouse = 0,
195
+ Pen = 1,
196
+ Touch = 2
197
+ }
198
+ declare enum CanvasContext {
199
+ "2D" = 0,
200
+ WebGL = 1,
201
+ WebGL2 = 2
202
+ }
203
+ type mouseInteractionParam = {
204
+ type: MouseInteractions;
205
+ id: number;
206
+ x?: number;
207
+ y?: number;
208
+ pointerType?: PointerTypes;
209
+ };
210
+ type scrollPosition = {
211
+ id: number;
212
+ x: number;
213
+ y: number;
214
+ };
215
+ type styleSheetAddRule = {
216
+ rule: string;
217
+ index?: number | number[];
218
+ };
219
+ type styleSheetDeleteRule = {
220
+ index: number | number[];
221
+ };
222
+ type styleSheetRuleParam = {
223
+ id?: number;
224
+ styleId?: number;
225
+ removes?: styleSheetDeleteRule[];
226
+ adds?: styleSheetAddRule[];
227
+ replace?: string;
228
+ replaceSync?: string;
229
+ };
230
+ type adoptedStyleSheetParam = {
231
+ id: number;
232
+ styles?: {
233
+ styleId: number;
234
+ rules: styleSheetAddRule[];
235
+ }[];
236
+ styleIds: number[];
237
+ };
238
+ type styleDeclarationParam = {
239
+ id?: number;
240
+ styleId?: number;
241
+ index: number[];
242
+ set?: {
243
+ property: string;
244
+ value: string | null;
245
+ priority: string | undefined;
246
+ };
247
+ remove?: {
248
+ property: string;
249
+ };
250
+ };
251
+ type canvasMutationCommand = {
252
+ property: string;
253
+ args: Array<unknown>;
254
+ setter?: true;
255
+ };
256
+ type canvasMutationParam = {
257
+ id: number;
258
+ type: CanvasContext;
259
+ commands: canvasMutationCommand[];
260
+ displayWidth?: number;
261
+ displayHeight?: number;
262
+ } | ({
263
+ id: number;
264
+ type: CanvasContext;
265
+ displayWidth?: number;
266
+ displayHeight?: number;
267
+ } & canvasMutationCommand);
268
+ type fontParam = {
269
+ family: string;
270
+ fontSource: string;
271
+ buffer: boolean;
272
+ descriptors?: FontFaceDescriptors;
273
+ };
274
+ type viewportResizeDimension = {
275
+ width: number;
276
+ height: number;
277
+ };
278
+ type inputValue = {
279
+ text: string;
280
+ isChecked: boolean;
281
+ userTriggered?: boolean;
282
+ };
283
+ declare enum MediaInteractions {
284
+ Play = 0,
285
+ Pause = 1,
286
+ Seeked = 2,
287
+ VolumeChange = 3,
288
+ RateChange = 4
289
+ }
290
+ type mediaInteractionParam = {
291
+ type: MediaInteractions;
292
+ id: number;
293
+ currentTime?: number;
294
+ volume?: number;
295
+ muted?: boolean;
296
+ loop?: boolean;
297
+ playbackRate?: number;
298
+ };
299
+ type SelectionRange = {
300
+ start: number;
301
+ startOffset: number;
302
+ end: number;
303
+ endOffset: number;
304
+ };
305
+ type selectionParam = {
306
+ ranges: Array<SelectionRange>;
307
+ };
308
+ type customElementParam = {
309
+ define?: {
310
+ name: string;
311
+ };
312
+ };
313
+ type listenerHandler = () => void;
453
314
  declare global {
454
- interface Window {
455
- FontFace: typeof FontFace;
456
- }
315
+ interface Window {
316
+ FontFace: typeof FontFace;
317
+ }
318
+ }
319
+ type IWindow = Window & typeof globalThis;
320
+ declare enum NodeType {
321
+ Document = 0,
322
+ DocumentType = 1,
323
+ Element = 2,
324
+ Text = 3,
325
+ CDATA = 4,
326
+ Comment = 5
327
+ }
328
+ type documentNode = {
329
+ type: NodeType.Document;
330
+ childNodes: serializedNodeWithId[];
331
+ compatMode?: string;
332
+ };
333
+ type documentTypeNode = {
334
+ type: NodeType.DocumentType;
335
+ name: string;
336
+ publicId: string;
337
+ systemId: string;
338
+ };
339
+ type cssTextKeyAttr = {
340
+ _cssText?: string;
341
+ };
342
+ type attributes = cssTextKeyAttr & {
343
+ [key: string]: string | number | true | null;
344
+ };
345
+ type elementNode = {
346
+ type: NodeType.Element;
347
+ tagName: string;
348
+ attributes: attributes;
349
+ childNodes: serializedNodeWithId[];
350
+ isSVG?: true;
351
+ needBlock?: boolean;
352
+ isCustom?: true;
353
+ };
354
+ type textNode = {
355
+ type: NodeType.Text;
356
+ textContent: string;
357
+ /**
358
+ * @deprecated styles are now always snapshotted against parent <style> element
359
+ * style mutations can still happen via an added textNode, but they don't need this attribute for correct replay
360
+ */
361
+ isStyle?: true;
362
+ };
363
+ type cdataNode = {
364
+ type: NodeType.CDATA;
365
+ textContent: "";
366
+ };
367
+ type commentNode = {
368
+ type: NodeType.Comment;
369
+ textContent: string;
370
+ };
371
+ type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
372
+ rootId?: number;
373
+ isShadowHost?: boolean;
374
+ isShadow?: boolean;
375
+ };
376
+ type serializedNodeWithId = serializedNode & {
377
+ id: number;
378
+ };
379
+ interface IMirror<TNode> {
380
+ getId(n: TNode | undefined | null): number;
381
+ getNode(id: number): TNode | null;
382
+ getIds(): number[];
383
+ getMeta(n: TNode): serializedNodeWithId | null;
384
+ removeNodeFromMap(n: TNode): void;
385
+ has(id: number): boolean;
386
+ hasNode(node: TNode): boolean;
387
+ add(n: TNode, meta: serializedNodeWithId): void;
388
+ replace(id: number, n: TNode): void;
389
+ reset(): void;
457
390
  }
458
391
 
459
- declare const getRecordConsolePlugin: (options?: LogRecordOptions) => RecordPlugin;
460
-
461
- declare type LogData = {
462
- level: LogLevel;
463
- trace: string[];
464
- payload: string[];
465
- };
466
-
467
- declare type Logger = {
468
- assert?: typeof console.assert;
469
- clear?: typeof console.clear;
470
- count?: typeof console.count;
471
- countReset?: typeof console.countReset;
472
- debug?: typeof console.debug;
473
- dir?: typeof console.dir;
474
- dirxml?: typeof console.dirxml;
475
- error?: typeof console.error;
476
- group?: typeof console.group;
477
- groupCollapsed?: typeof console.groupCollapsed;
478
- groupEnd?: () => void;
479
- info?: typeof console.info;
480
- log?: typeof console.log;
481
- table?: typeof console.table;
482
- time?: typeof console.time;
483
- timeEnd?: typeof console.timeEnd;
484
- timeLog?: typeof console.timeLog;
485
- trace?: typeof console.trace;
486
- warn?: typeof console.warn;
487
- };
488
-
489
- declare type LogLevel = keyof Logger;
490
-
491
- declare type LogRecordOptions = {
492
- level?: LogLevel[];
493
- lengthThreshold?: number;
494
- stringifyOptions?: StringifyOptions;
495
- logger?: Logger | 'console';
496
- };
497
-
498
- declare const PLUGIN_NAME = "rrweb/console@1";
499
-
500
- declare type StringifyOptions = {
501
- stringLengthLimit?: number;
502
- numOfKeysLimit: number;
503
- depthOfLimit: number;
392
+ //#region src/index.d.ts
393
+ type StringifyOptions = {
394
+ stringLengthLimit?: number;
395
+ /**
396
+ * limit of number of keys in an object
397
+ * if an object contains more keys than this limit, we would call its toString function directly
398
+ */
399
+ numOfKeysLimit: number;
400
+ /**
401
+ * limit number of depth in an object
402
+ * if an object is too deep, toString process may cause browser OOM
403
+ */
404
+ depthOfLimit: number;
405
+ };
406
+ type LogRecordOptions = {
407
+ level?: LogLevel[];
408
+ lengthThreshold?: number;
409
+ stringifyOptions?: StringifyOptions;
410
+ logger?: Logger | "console";
411
+ };
412
+ type LogData = {
413
+ level: LogLevel;
414
+ trace: string[];
415
+ payload: string[];
416
+ };
417
+ type Logger = {
418
+ assert?: typeof console.assert;
419
+ clear?: typeof console.clear;
420
+ count?: typeof console.count;
421
+ countReset?: typeof console.countReset;
422
+ debug?: typeof console.debug;
423
+ dir?: typeof console.dir;
424
+ dirxml?: typeof console.dirxml;
425
+ error?: typeof console.error;
426
+ group?: typeof console.group;
427
+ groupCollapsed?: typeof console.groupCollapsed;
428
+ groupEnd?: () => void;
429
+ info?: typeof console.info;
430
+ log?: typeof console.log;
431
+ table?: typeof console.table;
432
+ time?: typeof console.time;
433
+ timeEnd?: typeof console.timeEnd;
434
+ timeLog?: typeof console.timeLog;
435
+ trace?: typeof console.trace;
436
+ warn?: typeof console.warn;
504
437
  };
438
+ type LogLevel = keyof Logger;
439
+ declare const PLUGIN_NAME = "rrweb/console@1";
440
+ declare const getRecordConsolePlugin: (options?: LogRecordOptions) => RecordPlugin;
505
441
 
506
442
  export { PLUGIN_NAME, getRecordConsolePlugin };
507
443
  export type { LogData, LogLevel, Logger, StringifyOptions };