@screeb/rrweb 1.0.21 → 2.1.6-screeb.2
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.
- package/README.md +107 -48
- package/dist/assets/image-bitmap-data-url-worker-IJpC7g_b.js.map +1 -0
- package/dist/entries/assets/image-bitmap-data-url-worker-IJpC7g_b.js.map +1 -0
- package/dist/entries/rrweb-record.cjs +5001 -0
- package/dist/entries/rrweb-record.cjs.map +1 -0
- package/dist/entries/rrweb-record.js +5001 -0
- package/dist/entries/rrweb-record.js.map +1 -0
- package/dist/entries/rrweb-record.umd.cjs +5027 -0
- package/dist/entries/rrweb-record.umd.cjs.map +7 -0
- package/dist/entries/rrweb-record.umd.min.cjs +109 -0
- package/dist/entries/rrweb-record.umd.min.cjs.map +7 -0
- package/dist/entries/rrweb.d.ts +372 -0
- package/dist/rrweb.cjs +10978 -3649
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.d.cts +80 -172
- package/dist/rrweb.d.ts +80 -172
- package/dist/rrweb.js +10978 -3648
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +11965 -4779
- package/dist/rrweb.umd.cjs.map +4 -4
- package/dist/rrweb.umd.min.cjs +143 -6
- package/dist/rrweb.umd.min.cjs.map +4 -4
- package/dist/style.min.css +1 -1
- package/dist/style.min.css.map +1 -1
- package/dist/umd/rrweb-record.js +5027 -0
- package/dist/umd/rrweb-record.min.js +109 -0
- package/package.json +46 -33
- package/umd/rrweb.js +17666 -0
- package/umd/rrweb.min.js +173 -0
- package/LICENSE +0 -42
- package/dist/ts3.8/rrweb.d.ts +0 -481
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { actionWithDelay } from '@rrweb/types';
|
|
2
|
+
import { blockClass } from '@rrweb/types';
|
|
3
|
+
import { canvasMutationData } from '@rrweb/types';
|
|
4
|
+
import { DataURLOptions } from '@rrweb/types';
|
|
5
|
+
import { DeprecatedMirror } from '@rrweb/types';
|
|
6
|
+
import { Emitter } from '@rrweb/types';
|
|
7
|
+
import { EventType } from '@rrweb/types';
|
|
8
|
+
import { eventWithTime } from '@rrweb/types';
|
|
9
|
+
import { Handler } from '@rrweb/types';
|
|
10
|
+
import { hooksParam } from '@rrweb/types';
|
|
11
|
+
import { IncrementalSource } from '@rrweb/types';
|
|
12
|
+
import { KeepIframeSrcFn } from '@rrweb/types';
|
|
13
|
+
import { listenerHandler } from '@rrweb/types';
|
|
14
|
+
import { MaskInputFn } from 'rrweb-snapshot';
|
|
15
|
+
import { MaskInputOptions } from 'rrweb-snapshot';
|
|
16
|
+
import { maskTextClass } from '@rrweb/types';
|
|
17
|
+
import { MaskTextFn } from 'rrweb-snapshot';
|
|
18
|
+
import { Mirror } from 'rrweb-snapshot';
|
|
19
|
+
import { MouseInteractions } from '@rrweb/types';
|
|
20
|
+
import { PackFn } from '@rrweb/types';
|
|
21
|
+
import { playerMetaData } from '@rrweb/types';
|
|
22
|
+
import { RecordPlugin } from '@rrweb/types';
|
|
23
|
+
import { ReplayerEvents } from '@rrweb/types';
|
|
24
|
+
import { RRDocument } from 'rrdom';
|
|
25
|
+
import { RRNode } from 'rrdom';
|
|
26
|
+
import { SamplingStrategy } from '@rrweb/types';
|
|
27
|
+
import { SlimDOMOptions } from 'rrweb-snapshot';
|
|
28
|
+
import { StateMachine } from '@xstate/fsm';
|
|
29
|
+
import { UnpackFn } from '@rrweb/types';
|
|
30
|
+
|
|
31
|
+
export declare const addCustomEvent: <T>(tag: string, payload: T) => void;
|
|
32
|
+
|
|
33
|
+
export declare function canvasMutation({ event, mutation, target, imageMap, canvasEventMap, errorHandler, }: {
|
|
34
|
+
event: Parameters<Replayer['applyIncremental']>[0];
|
|
35
|
+
mutation: canvasMutationData;
|
|
36
|
+
target: HTMLCanvasElement;
|
|
37
|
+
imageMap: Replayer['imageMap'];
|
|
38
|
+
canvasEventMap: Replayer['canvasEventMap'];
|
|
39
|
+
errorHandler: Replayer['warnCanvasMutationFailed'];
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
|
|
42
|
+
declare function createPlayerService(context: PlayerContext, { getCastFn, applyEventsSynchronously, emitter }: PlayerAssets): StateMachine.Service<PlayerContext, PlayerEvent, PlayerState>;
|
|
43
|
+
|
|
44
|
+
declare function createSpeedService(context: SpeedContext): StateMachine.Service<SpeedContext, SpeedEvent, SpeedState>;
|
|
45
|
+
|
|
46
|
+
declare type ErrorHandler = (error: unknown) => void | boolean;
|
|
47
|
+
|
|
48
|
+
export { EventType }
|
|
49
|
+
|
|
50
|
+
export { eventWithTime }
|
|
51
|
+
|
|
52
|
+
export declare const freezePage: () => void;
|
|
53
|
+
|
|
54
|
+
export { IncrementalSource }
|
|
55
|
+
|
|
56
|
+
export declare let mirror: DeprecatedMirror;
|
|
57
|
+
|
|
58
|
+
export { MouseInteractions }
|
|
59
|
+
|
|
60
|
+
declare type PlayerAssets = {
|
|
61
|
+
emitter: Emitter;
|
|
62
|
+
applyEventsSynchronously(events: Array<eventWithTime>): void;
|
|
63
|
+
getCastFn(event: eventWithTime, isSync: boolean): () => void;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export declare type playerConfig = {
|
|
67
|
+
speed: number;
|
|
68
|
+
maxSpeed: number;
|
|
69
|
+
root: Element;
|
|
70
|
+
loadTimeout: number;
|
|
71
|
+
skipInactive: boolean;
|
|
72
|
+
inactivePeriodThreshold: number;
|
|
73
|
+
showWarning: boolean;
|
|
74
|
+
showDebug: boolean;
|
|
75
|
+
blockClass: string;
|
|
76
|
+
liveMode: boolean;
|
|
77
|
+
insertStyleRules: string[];
|
|
78
|
+
triggerFocus: boolean;
|
|
79
|
+
UNSAFE_replayCanvas: boolean;
|
|
80
|
+
pauseAnimation?: boolean;
|
|
81
|
+
mouseTail: boolean | {
|
|
82
|
+
duration?: number;
|
|
83
|
+
lineCap?: string;
|
|
84
|
+
lineWidth?: number;
|
|
85
|
+
strokeStyle?: string;
|
|
86
|
+
};
|
|
87
|
+
unpackFn?: UnpackFn;
|
|
88
|
+
useVirtualDom: boolean;
|
|
89
|
+
logger: {
|
|
90
|
+
log: (...args: Parameters<typeof console.log>) => void;
|
|
91
|
+
warn: (...args: Parameters<typeof console.warn>) => void;
|
|
92
|
+
};
|
|
93
|
+
plugins?: ReplayPlugin[];
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
declare type PlayerContext = {
|
|
97
|
+
events: eventWithTime[];
|
|
98
|
+
timer: Timer;
|
|
99
|
+
timeOffset: number;
|
|
100
|
+
baselineTime: number;
|
|
101
|
+
lastPlayedEvent: eventWithTime | null;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
declare type PlayerEvent = {
|
|
105
|
+
type: 'PLAY';
|
|
106
|
+
payload: {
|
|
107
|
+
timeOffset: number;
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
110
|
+
type: 'CAST_EVENT';
|
|
111
|
+
payload: {
|
|
112
|
+
event: eventWithTime;
|
|
113
|
+
};
|
|
114
|
+
} | {
|
|
115
|
+
type: 'PAUSE';
|
|
116
|
+
} | {
|
|
117
|
+
type: 'TO_LIVE';
|
|
118
|
+
payload: {
|
|
119
|
+
baselineTime?: number;
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
type: 'ADD_EVENT';
|
|
123
|
+
payload: {
|
|
124
|
+
event: eventWithTime;
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
type: 'END';
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export declare type PlayerMachineState = StateMachine.State<PlayerContext, PlayerEvent, PlayerState>;
|
|
131
|
+
|
|
132
|
+
declare type PlayerState = {
|
|
133
|
+
value: 'playing';
|
|
134
|
+
context: PlayerContext;
|
|
135
|
+
} | {
|
|
136
|
+
value: 'paused';
|
|
137
|
+
context: PlayerContext;
|
|
138
|
+
} | {
|
|
139
|
+
value: 'live';
|
|
140
|
+
context: PlayerContext;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
|
|
144
|
+
|
|
145
|
+
export declare namespace record {
|
|
146
|
+
var addCustomEvent: <T>(tag: string, payload: T) => void;
|
|
147
|
+
var freezePage: () => void;
|
|
148
|
+
var takeFullSnapshot: (isCheckout?: boolean | undefined) => void;
|
|
149
|
+
var mirror: Mirror;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export declare type recordOptions<T> = {
|
|
153
|
+
emit?: (e: T, isCheckout?: boolean) => void;
|
|
154
|
+
checkoutEveryNth?: number;
|
|
155
|
+
checkoutEveryNms?: number;
|
|
156
|
+
blockClass?: blockClass;
|
|
157
|
+
blockSelector?: string;
|
|
158
|
+
ignoreClass?: string;
|
|
159
|
+
ignoreSelector?: string;
|
|
160
|
+
maskTextClass?: maskTextClass;
|
|
161
|
+
maskTextSelector?: string;
|
|
162
|
+
maskAllInputs?: boolean;
|
|
163
|
+
maskInputOptions?: MaskInputOptions;
|
|
164
|
+
maskInputFn?: MaskInputFn;
|
|
165
|
+
maskTextFn?: MaskTextFn;
|
|
166
|
+
slimDOMOptions?: SlimDOMOptions | 'all' | true;
|
|
167
|
+
ignoreCSSAttributes?: Set<string>;
|
|
168
|
+
inlineStylesheet?: boolean;
|
|
169
|
+
hooks?: hooksParam;
|
|
170
|
+
packFn?: PackFn;
|
|
171
|
+
sampling?: SamplingStrategy;
|
|
172
|
+
dataURLOptions?: DataURLOptions;
|
|
173
|
+
recordDOM?: boolean;
|
|
174
|
+
recordCanvas?: boolean;
|
|
175
|
+
recordCrossOriginIframes?: boolean;
|
|
176
|
+
recordAfter?: 'DOMContentLoaded' | 'load';
|
|
177
|
+
userTriggeredOnInput?: boolean;
|
|
178
|
+
collectFonts?: boolean;
|
|
179
|
+
inlineImages?: boolean;
|
|
180
|
+
win?: Window;
|
|
181
|
+
plugins?: RecordPlugin[];
|
|
182
|
+
mousemoveWait?: number;
|
|
183
|
+
keepIframeSrcFn?: KeepIframeSrcFn;
|
|
184
|
+
errorHandler?: ErrorHandler;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export declare class Replayer {
|
|
188
|
+
wrapper: HTMLDivElement;
|
|
189
|
+
iframe: HTMLIFrameElement;
|
|
190
|
+
private UNSAFE_replayCanvas;
|
|
191
|
+
service: ReturnType<typeof createPlayerService>;
|
|
192
|
+
speedService: ReturnType<typeof createSpeedService>;
|
|
193
|
+
get timer(): Timer;
|
|
194
|
+
config: playerConfig;
|
|
195
|
+
usingVirtualDom: boolean;
|
|
196
|
+
virtualDom: RRDocument;
|
|
197
|
+
private mouse;
|
|
198
|
+
private mouseTail;
|
|
199
|
+
private tailPositions;
|
|
200
|
+
private mouseTailFrame;
|
|
201
|
+
private emitter;
|
|
202
|
+
private nextUserInteractionEvent;
|
|
203
|
+
private legacy_missingNodeRetryMap;
|
|
204
|
+
private cache;
|
|
205
|
+
private imageMap;
|
|
206
|
+
private canvasEventMap;
|
|
207
|
+
private mirror;
|
|
208
|
+
private styleMirror;
|
|
209
|
+
private mediaManager;
|
|
210
|
+
private firstFullSnapshot;
|
|
211
|
+
private newDocumentQueue;
|
|
212
|
+
private mousePos;
|
|
213
|
+
private touchActive;
|
|
214
|
+
private lastMouseDownEvent;
|
|
215
|
+
private lastHoveredRootNode;
|
|
216
|
+
private lastSelectionData;
|
|
217
|
+
private constructedStyleMutations;
|
|
218
|
+
private adoptedStyleSheets;
|
|
219
|
+
constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
|
|
220
|
+
on(event: string, handler: Handler): this;
|
|
221
|
+
off(event: string, handler: Handler): this;
|
|
222
|
+
setConfig(config: Partial<playerConfig>): void;
|
|
223
|
+
getMetaData(): playerMetaData;
|
|
224
|
+
getCurrentTime(): number;
|
|
225
|
+
getTimeOffset(): number;
|
|
226
|
+
getMirror(): Mirror;
|
|
227
|
+
play(timeOffset?: number): void;
|
|
228
|
+
pause(timeOffset?: number): void;
|
|
229
|
+
resume(timeOffset?: number): void;
|
|
230
|
+
destroy(): void;
|
|
231
|
+
startLive(baselineTime?: number): void;
|
|
232
|
+
addEvent(rawEvent: eventWithTime | string): void;
|
|
233
|
+
enableInteract(): void;
|
|
234
|
+
disableInteract(): void;
|
|
235
|
+
resetCache(): void;
|
|
236
|
+
private setupDom;
|
|
237
|
+
private handleResize;
|
|
238
|
+
private applyEventsSynchronously;
|
|
239
|
+
private getCastFn;
|
|
240
|
+
private rebuildFullSnapshot;
|
|
241
|
+
private insertStyleRules;
|
|
242
|
+
private attachDocumentToIframe;
|
|
243
|
+
private collectIframeAndAttachDocument;
|
|
244
|
+
private waitForStylesheetLoad;
|
|
245
|
+
private preloadAllImages;
|
|
246
|
+
private preloadImages;
|
|
247
|
+
private deserializeAndPreloadCanvasEvents;
|
|
248
|
+
private applyIncremental;
|
|
249
|
+
private applyMutation;
|
|
250
|
+
private applyScroll;
|
|
251
|
+
private applyInput;
|
|
252
|
+
private applySelection;
|
|
253
|
+
private applyStyleSheetMutation;
|
|
254
|
+
private applyStyleSheetRule;
|
|
255
|
+
private applyStyleDeclaration;
|
|
256
|
+
private applyAdoptedStyleSheet;
|
|
257
|
+
private legacy_resolveMissingNode;
|
|
258
|
+
private moveAndHover;
|
|
259
|
+
private drawMouseTail;
|
|
260
|
+
private stepMouseTail;
|
|
261
|
+
private hoverElements;
|
|
262
|
+
private isUserInteraction;
|
|
263
|
+
private backToNormal;
|
|
264
|
+
private warnNodeNotFound;
|
|
265
|
+
private warnCanvasMutationFailed;
|
|
266
|
+
private debugNodeNotFound;
|
|
267
|
+
private warn;
|
|
268
|
+
private debug;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export { ReplayerEvents }
|
|
272
|
+
|
|
273
|
+
export declare type ReplayPlugin = {
|
|
274
|
+
handler?: (event: eventWithTime, isSync: boolean, context: {
|
|
275
|
+
replayer: Replayer;
|
|
276
|
+
}) => void;
|
|
277
|
+
onBuild?: (node: Node | RRNode, context: {
|
|
278
|
+
id: number;
|
|
279
|
+
replayer: Replayer;
|
|
280
|
+
}) => void;
|
|
281
|
+
getMirror?: (mirrors: {
|
|
282
|
+
nodeMirror: Mirror;
|
|
283
|
+
}) => void;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
declare type SpeedContext = {
|
|
287
|
+
normalSpeed: playerConfig['speed'];
|
|
288
|
+
timer: Timer;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
declare type SpeedEvent = {
|
|
292
|
+
type: 'FAST_FORWARD';
|
|
293
|
+
payload: {
|
|
294
|
+
speed: playerConfig['speed'];
|
|
295
|
+
};
|
|
296
|
+
} | {
|
|
297
|
+
type: 'BACK_TO_NORMAL';
|
|
298
|
+
} | {
|
|
299
|
+
type: 'SET_SPEED';
|
|
300
|
+
payload: {
|
|
301
|
+
speed: playerConfig['speed'];
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export declare type SpeedMachineState = StateMachine.State<SpeedContext, SpeedEvent, SpeedState>;
|
|
306
|
+
|
|
307
|
+
declare type SpeedState = {
|
|
308
|
+
value: 'normal';
|
|
309
|
+
context: SpeedContext;
|
|
310
|
+
} | {
|
|
311
|
+
value: 'skipping';
|
|
312
|
+
context: SpeedContext;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export declare const takeFullSnapshot: (isCheckout?: boolean | undefined) => void;
|
|
316
|
+
|
|
317
|
+
declare class Timer {
|
|
318
|
+
timeOffset: number;
|
|
319
|
+
speed: number;
|
|
320
|
+
private actions;
|
|
321
|
+
private raf;
|
|
322
|
+
private lastTimestamp;
|
|
323
|
+
constructor(actions: actionWithDelay[] | undefined, config: {
|
|
324
|
+
speed: number;
|
|
325
|
+
});
|
|
326
|
+
addAction(action: actionWithDelay): void;
|
|
327
|
+
start(): void;
|
|
328
|
+
updateLiveTime(): void;
|
|
329
|
+
private rafCheck;
|
|
330
|
+
clear(): void;
|
|
331
|
+
setSpeed(speed: number): void;
|
|
332
|
+
isActive(): boolean;
|
|
333
|
+
private findActionIndex;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export declare namespace utils {
|
|
337
|
+
{
|
|
338
|
+
on,
|
|
339
|
+
throttle,
|
|
340
|
+
hookSetter,
|
|
341
|
+
getWindowScroll,
|
|
342
|
+
getWindowHeight,
|
|
343
|
+
getWindowWidth,
|
|
344
|
+
closestElementOfNode,
|
|
345
|
+
isBlocked,
|
|
346
|
+
isSerialized,
|
|
347
|
+
isIgnored,
|
|
348
|
+
isAncestorRemoved,
|
|
349
|
+
legacy_isTouchEvent,
|
|
350
|
+
requestAnimationFrameIn,
|
|
351
|
+
polyfill,
|
|
352
|
+
queueToResolveTrees,
|
|
353
|
+
iterateResolveTree,
|
|
354
|
+
isSerializedIframe,
|
|
355
|
+
isSerializedStylesheet,
|
|
356
|
+
getBaseDimension,
|
|
357
|
+
hasShadowRoot,
|
|
358
|
+
getNestedRule,
|
|
359
|
+
getPositionsAndIndex,
|
|
360
|
+
uniqueTextMutations,
|
|
361
|
+
getShadowHost,
|
|
362
|
+
getRootShadowHost,
|
|
363
|
+
shadowHostInDom,
|
|
364
|
+
inDom,
|
|
365
|
+
nowTimestamp,
|
|
366
|
+
mirror as _mirror,
|
|
367
|
+
AppendedIframe,
|
|
368
|
+
StyleSheetMirror
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export { }
|