@highlight-run/rrweb 2.0.1 → 2.0.6
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/dist/plugins/console-record.js +12 -655
- package/dist/plugins/console-record.min.js +12 -15
- package/dist/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.js +4 -293
- package/dist/plugins/console-replay.min.js +4 -15
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/plugins/sequential-id-record.js +1 -33
- package/dist/plugins/sequential-id-record.min.js +1 -1
- package/dist/plugins/sequential-id-record.min.js.map +1 -1
- package/dist/plugins/sequential-id-replay.js +1 -37
- package/dist/plugins/sequential-id-replay.min.js +1 -1
- package/dist/plugins/sequential-id-replay.min.js.map +1 -1
- package/dist/record/rrweb-record-pack.js +3 -747
- package/dist/record/rrweb-record-pack.min.js +3 -15
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +4 -3318
- package/dist/record/rrweb-record.min.js +4 -15
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.css +1 -0
- package/dist/replay/rrweb-replay-unpack.js +5 -4614
- package/dist/replay/rrweb-replay-unpack.min.js +5 -17
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.css +1 -0
- package/dist/replay/rrweb-replay.js +5 -4204
- package/dist/replay/rrweb-replay.min.js +5 -17
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.css +1 -0
- package/dist/rrweb-all.js +16 -8696
- package/dist/rrweb-all.min.js +16 -17
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.css +1 -0
- package/dist/rrweb.js +6 -7282
- package/dist/rrweb.min.js +6 -17
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/rrweb/_virtual/image-bitmap-data-url-worker.js +6 -0
- package/es/rrweb/all.css +1 -0
- package/es/rrweb/ext/mitt/dist/mitt.es.js +1 -1
- package/es/rrweb/ext/tslib/tslib.es6.js +38 -0
- package/es/rrweb/packages/rrdom/es/virtual-dom.js +1099 -0
- package/es/rrweb/packages/rrweb/src/index.js +6 -4
- package/es/rrweb/packages/rrweb/src/packer/base.js +1 -1
- package/es/rrweb/packages/rrweb/src/packer/pack.js +4 -5
- package/es/rrweb/packages/rrweb/src/packer/unpack.js +24 -24
- package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +175 -176
- package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +109 -128
- package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +125 -138
- package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +88 -105
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +19 -20
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +25 -25
- package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +29 -30
- package/es/rrweb/packages/rrweb/src/record/index.js +348 -373
- package/es/rrweb/packages/rrweb/src/record/mutation.js +487 -528
- package/es/rrweb/packages/rrweb/src/record/observer.js +584 -659
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +44 -73
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +166 -87
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +21 -26
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +119 -112
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +53 -72
- package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +38 -40
- package/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js +31 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +27 -23
- package/es/rrweb/packages/rrweb/src/replay/canvas/deserialize-args.js +67 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +37 -29
- package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +58 -120
- package/es/rrweb/packages/rrweb/src/replay/index.js +1545 -1854
- package/es/rrweb/packages/rrweb/src/replay/machine.js +275 -315
- package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +216 -218
- package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +7 -7
- package/es/rrweb/packages/rrweb/src/replay/timer.js +87 -91
- package/es/rrweb/packages/rrweb/src/types.js +72 -72
- package/es/rrweb/packages/rrweb/src/utils.js +312 -506
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +190 -72
- package/lib/plugins/console-record.js +469 -627
- package/lib/plugins/console-replay.js +198 -268
- package/lib/plugins/sequential-id-record.js +19 -20
- package/lib/plugins/sequential-id-replay.js +25 -25
- package/lib/record/rrweb-record-pack.js +184 -139
- package/lib/record/rrweb-record.js +2467 -2425
- package/lib/replay/rrweb-replay-unpack.css +1 -0
- package/lib/replay/rrweb-replay-unpack.js +3798 -3344
- package/lib/replay/rrweb-replay.css +1 -0
- package/lib/replay/rrweb-replay.js +3743 -3289
- package/lib/rrweb-all.css +1 -0
- package/lib/rrweb-all.js +6721 -6249
- package/lib/rrweb.css +1 -0
- package/lib/rrweb.js +6151 -5632
- package/package.json +14 -13
- package/typings/packer/base.d.ts +1 -1
- package/typings/plugins/console/record/index.d.ts +1 -1
- package/typings/plugins/console/record/stringify.d.ts +1 -1
- package/typings/plugins/sequential-id/record/index.d.ts +1 -1
- package/typings/plugins/sequential-id/replay/index.d.ts +1 -1
- package/typings/record/iframe-manager.d.ts +3 -3
- package/typings/record/index.d.ts +1 -1
- package/typings/record/mutation.d.ts +2 -1
- package/typings/record/observers/canvas/2d.d.ts +2 -1
- package/typings/record/observers/canvas/canvas-manager.d.ts +5 -2
- package/typings/record/observers/canvas/canvas.d.ts +1 -1
- package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
- package/typings/record/observers/canvas/webgl.d.ts +2 -1
- package/typings/record/shadow-dom-manager.d.ts +2 -1
- package/typings/record/stylesheet-manager.d.ts +12 -0
- package/typings/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
- package/typings/replay/canvas/2d.d.ts +3 -3
- package/typings/replay/canvas/deserialize-args.d.ts +7 -0
- package/typings/replay/canvas/index.d.ts +4 -3
- package/typings/replay/canvas/webgl.d.ts +3 -5
- package/typings/replay/index.d.ts +7 -10
- package/typings/types.d.ts +45 -17
- package/typings/utils.d.ts +17 -44
- package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +0 -78
- package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +0 -121
- package/typings/replay/virtual-styles.d.ts +0 -43
|
@@ -1,509 +1,315 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IncrementalSource } from './types.js';
|
|
3
|
-
import { IGNORED_NODE, isShadowRoot, NodeType } from '../../rrweb-snapshot/es/rrweb-snapshot.js';
|
|
1
|
+
import { IGNORED_NODE, isShadowRoot } from '../../rrweb-snapshot/es/rrweb-snapshot.js';
|
|
4
2
|
|
|
5
|
-
function on(type, fn, target) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
target.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
(
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return
|
|
169
|
-
}
|
|
170
|
-
function
|
|
171
|
-
if (
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
treeNode.texts.push(mutation);
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
this.textMutations.push(mutation);
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
TreeIndex.prototype.attribute = function (mutation) {
|
|
322
|
-
var treeNode = this.indexes.get(mutation.id);
|
|
323
|
-
if (treeNode) {
|
|
324
|
-
treeNode.attributes.push(mutation);
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
this.attributeMutations.push(mutation);
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
TreeIndex.prototype.scroll = function (d) {
|
|
331
|
-
this.scrollMap.set(d.id, d);
|
|
332
|
-
};
|
|
333
|
-
TreeIndex.prototype.input = function (d) {
|
|
334
|
-
this.inputMap.set(d.id, d);
|
|
335
|
-
};
|
|
336
|
-
TreeIndex.prototype.flush = function () {
|
|
337
|
-
var e_1, _a, e_2, _b;
|
|
338
|
-
var _this = this;
|
|
339
|
-
var _c = this, tree = _c.tree, removeNodeMutations = _c.removeNodeMutations, textMutations = _c.textMutations, attributeMutations = _c.attributeMutations;
|
|
340
|
-
var batchMutationData = {
|
|
341
|
-
source: IncrementalSource.Mutation,
|
|
342
|
-
removes: removeNodeMutations,
|
|
343
|
-
texts: textMutations,
|
|
344
|
-
attributes: attributeMutations,
|
|
345
|
-
adds: [],
|
|
346
|
-
};
|
|
347
|
-
var walk = function (treeNode, removed) {
|
|
348
|
-
if (removed) {
|
|
349
|
-
_this.removeIdSet.add(treeNode.id);
|
|
350
|
-
}
|
|
351
|
-
batchMutationData.texts = batchMutationData.texts
|
|
352
|
-
.concat(removed ? [] : treeNode.texts)
|
|
353
|
-
.filter(function (m) { return !_this.removeIdSet.has(m.id); });
|
|
354
|
-
batchMutationData.attributes = batchMutationData.attributes
|
|
355
|
-
.concat(removed ? [] : treeNode.attributes)
|
|
356
|
-
.filter(function (m) { return !_this.removeIdSet.has(m.id); });
|
|
357
|
-
if (!_this.removeIdSet.has(treeNode.id) &&
|
|
358
|
-
!_this.removeIdSet.has(treeNode.mutation.parentId) &&
|
|
359
|
-
!removed) {
|
|
360
|
-
batchMutationData.adds.push(treeNode.mutation);
|
|
361
|
-
if (treeNode.children) {
|
|
362
|
-
Object.values(treeNode.children).forEach(function (n) { return walk(n, false); });
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
Object.values(treeNode.children).forEach(function (n) { return walk(n, true); });
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
Object.values(tree).forEach(function (n) { return walk(n, false); });
|
|
370
|
-
try {
|
|
371
|
-
for (var _d = __values(this.scrollMap.keys()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
372
|
-
var id = _e.value;
|
|
373
|
-
if (this.removeIdSet.has(id)) {
|
|
374
|
-
this.scrollMap.delete(id);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
379
|
-
finally {
|
|
380
|
-
try {
|
|
381
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
382
|
-
}
|
|
383
|
-
finally { if (e_1) throw e_1.error; }
|
|
384
|
-
}
|
|
385
|
-
try {
|
|
386
|
-
for (var _f = __values(this.inputMap.keys()), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
387
|
-
var id = _g.value;
|
|
388
|
-
if (this.removeIdSet.has(id)) {
|
|
389
|
-
this.inputMap.delete(id);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
394
|
-
finally {
|
|
395
|
-
try {
|
|
396
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
397
|
-
}
|
|
398
|
-
finally { if (e_2) throw e_2.error; }
|
|
399
|
-
}
|
|
400
|
-
var scrollMap = new Map(this.scrollMap);
|
|
401
|
-
var inputMap = new Map(this.inputMap);
|
|
402
|
-
this.reset();
|
|
403
|
-
return {
|
|
404
|
-
mutationData: batchMutationData,
|
|
405
|
-
scrollMap: scrollMap,
|
|
406
|
-
inputMap: inputMap,
|
|
407
|
-
};
|
|
408
|
-
};
|
|
409
|
-
TreeIndex.prototype.reset = function () {
|
|
410
|
-
this.tree = [];
|
|
411
|
-
this.indexes = new Map();
|
|
412
|
-
this.removeNodeMutations = [];
|
|
413
|
-
this.textMutations = [];
|
|
414
|
-
this.attributeMutations = [];
|
|
415
|
-
this.removeIdSet = new Set();
|
|
416
|
-
this.scrollMap = new Map();
|
|
417
|
-
this.inputMap = new Map();
|
|
418
|
-
};
|
|
419
|
-
TreeIndex.prototype.idRemoved = function (id) {
|
|
420
|
-
return this.removeIdSet.has(id);
|
|
421
|
-
};
|
|
422
|
-
return TreeIndex;
|
|
423
|
-
}());
|
|
424
|
-
function queueToResolveTrees(queue) {
|
|
425
|
-
var e_3, _a;
|
|
426
|
-
var queueNodeMap = {};
|
|
427
|
-
var putIntoMap = function (m, parent) {
|
|
428
|
-
var nodeInTree = {
|
|
429
|
-
value: m,
|
|
430
|
-
parent: parent,
|
|
431
|
-
children: [],
|
|
432
|
-
};
|
|
433
|
-
queueNodeMap[m.node.id] = nodeInTree;
|
|
434
|
-
return nodeInTree;
|
|
435
|
-
};
|
|
436
|
-
var queueNodeTrees = [];
|
|
437
|
-
try {
|
|
438
|
-
for (var queue_1 = __values(queue), queue_1_1 = queue_1.next(); !queue_1_1.done; queue_1_1 = queue_1.next()) {
|
|
439
|
-
var mutation = queue_1_1.value;
|
|
440
|
-
var nextId = mutation.nextId, parentId = mutation.parentId;
|
|
441
|
-
if (nextId && nextId in queueNodeMap) {
|
|
442
|
-
var nextInTree = queueNodeMap[nextId];
|
|
443
|
-
if (nextInTree.parent) {
|
|
444
|
-
var idx = nextInTree.parent.children.indexOf(nextInTree);
|
|
445
|
-
nextInTree.parent.children.splice(idx, 0, putIntoMap(mutation, nextInTree.parent));
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
var idx = queueNodeTrees.indexOf(nextInTree);
|
|
449
|
-
queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));
|
|
450
|
-
}
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
if (parentId in queueNodeMap) {
|
|
454
|
-
var parentInTree = queueNodeMap[parentId];
|
|
455
|
-
parentInTree.children.push(putIntoMap(mutation, parentInTree));
|
|
456
|
-
continue;
|
|
457
|
-
}
|
|
458
|
-
queueNodeTrees.push(putIntoMap(mutation, null));
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
462
|
-
finally {
|
|
463
|
-
try {
|
|
464
|
-
if (queue_1_1 && !queue_1_1.done && (_a = queue_1.return)) _a.call(queue_1);
|
|
465
|
-
}
|
|
466
|
-
finally { if (e_3) throw e_3.error; }
|
|
467
|
-
}
|
|
468
|
-
return queueNodeTrees;
|
|
469
|
-
}
|
|
470
|
-
function iterateResolveTree(tree, cb) {
|
|
471
|
-
cb(tree.value);
|
|
472
|
-
for (var i = tree.children.length - 1; i >= 0; i--) {
|
|
473
|
-
iterateResolveTree(tree.children[i], cb);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
function isIframeINode(node) {
|
|
477
|
-
if ('__sn' in node) {
|
|
478
|
-
return (node.__sn.type === NodeType.Element && node.__sn.tagName === 'iframe');
|
|
479
|
-
}
|
|
480
|
-
return false;
|
|
481
|
-
}
|
|
482
|
-
function getBaseDimension(node, rootIframe) {
|
|
483
|
-
var _a, _b;
|
|
484
|
-
var frameElement = (_b = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) === null || _b === void 0 ? void 0 : _b.frameElement;
|
|
485
|
-
if (!frameElement || frameElement === rootIframe) {
|
|
486
|
-
return {
|
|
487
|
-
x: 0,
|
|
488
|
-
y: 0,
|
|
489
|
-
relativeScale: 1,
|
|
490
|
-
absoluteScale: 1,
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
var frameDimension = frameElement.getBoundingClientRect();
|
|
494
|
-
var frameBaseDimension = getBaseDimension(frameElement, rootIframe);
|
|
495
|
-
var relativeScale = frameDimension.height / frameElement.clientHeight;
|
|
496
|
-
return {
|
|
497
|
-
x: frameDimension.x * frameBaseDimension.relativeScale +
|
|
498
|
-
frameBaseDimension.x,
|
|
499
|
-
y: frameDimension.y * frameBaseDimension.relativeScale +
|
|
500
|
-
frameBaseDimension.y,
|
|
501
|
-
relativeScale: relativeScale,
|
|
502
|
-
absoluteScale: frameBaseDimension.absoluteScale * relativeScale,
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
function hasShadowRoot(n) {
|
|
506
|
-
return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
|
|
3
|
+
function on(type, fn, target = document) {
|
|
4
|
+
const options = { capture: true, passive: true };
|
|
5
|
+
target.addEventListener(type, fn, options);
|
|
6
|
+
return () => target.removeEventListener(type, fn, options);
|
|
7
|
+
}
|
|
8
|
+
const DEPARTED_MIRROR_ACCESS_WARNING = 'Please stop import mirror directly. Instead of that,' +
|
|
9
|
+
'\r\n' +
|
|
10
|
+
'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +
|
|
11
|
+
'\r\n' +
|
|
12
|
+
'or you can use record.mirror to access the mirror instance during recording.';
|
|
13
|
+
let _mirror = {
|
|
14
|
+
map: {},
|
|
15
|
+
getId() {
|
|
16
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
17
|
+
return -1;
|
|
18
|
+
},
|
|
19
|
+
getNode() {
|
|
20
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
21
|
+
return null;
|
|
22
|
+
},
|
|
23
|
+
removeNodeFromMap() {
|
|
24
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
25
|
+
},
|
|
26
|
+
has() {
|
|
27
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
28
|
+
return false;
|
|
29
|
+
},
|
|
30
|
+
reset() {
|
|
31
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
|
|
35
|
+
_mirror = new Proxy(_mirror, {
|
|
36
|
+
get(target, prop, receiver) {
|
|
37
|
+
if (prop === 'map') {
|
|
38
|
+
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
39
|
+
}
|
|
40
|
+
return Reflect.get(target, prop, receiver);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function throttle(func, wait, options = {}) {
|
|
45
|
+
let timeout = null;
|
|
46
|
+
let previous = 0;
|
|
47
|
+
return function (arg) {
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
if (!previous && options.leading === false) {
|
|
50
|
+
previous = now;
|
|
51
|
+
}
|
|
52
|
+
const remaining = wait - (now - previous);
|
|
53
|
+
const context = this;
|
|
54
|
+
const args = arguments;
|
|
55
|
+
if (remaining <= 0 || remaining > wait) {
|
|
56
|
+
if (timeout) {
|
|
57
|
+
clearTimeout(timeout);
|
|
58
|
+
timeout = null;
|
|
59
|
+
}
|
|
60
|
+
previous = now;
|
|
61
|
+
func.apply(context, args);
|
|
62
|
+
}
|
|
63
|
+
else if (!timeout && options.trailing !== false) {
|
|
64
|
+
timeout = setTimeout(() => {
|
|
65
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
66
|
+
timeout = null;
|
|
67
|
+
func.apply(context, args);
|
|
68
|
+
}, remaining);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function hookSetter(target, key, d, isRevoked, win = window) {
|
|
73
|
+
const original = win.Object.getOwnPropertyDescriptor(target, key);
|
|
74
|
+
win.Object.defineProperty(target, key, isRevoked
|
|
75
|
+
? d
|
|
76
|
+
: {
|
|
77
|
+
set(value) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
d.set.call(this, value);
|
|
80
|
+
}, 0);
|
|
81
|
+
if (original && original.set) {
|
|
82
|
+
original.set.call(this, value);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
return () => hookSetter(target, key, original || {}, true);
|
|
87
|
+
}
|
|
88
|
+
function patch(source, name, replacement) {
|
|
89
|
+
try {
|
|
90
|
+
if (!(name in source)) {
|
|
91
|
+
return () => { };
|
|
92
|
+
}
|
|
93
|
+
const original = source[name];
|
|
94
|
+
const wrapped = replacement(original);
|
|
95
|
+
if (typeof wrapped === 'function') {
|
|
96
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
97
|
+
Object.defineProperties(wrapped, {
|
|
98
|
+
__rrweb_original__: {
|
|
99
|
+
enumerable: false,
|
|
100
|
+
value: original,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
source[name] = wrapped;
|
|
105
|
+
return () => {
|
|
106
|
+
source[name] = original;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
catch (_a) {
|
|
110
|
+
return () => { };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function getWindowHeight() {
|
|
114
|
+
return (window.innerHeight ||
|
|
115
|
+
(document.documentElement && document.documentElement.clientHeight) ||
|
|
116
|
+
(document.body && document.body.clientHeight));
|
|
117
|
+
}
|
|
118
|
+
function getWindowWidth() {
|
|
119
|
+
return (window.innerWidth ||
|
|
120
|
+
(document.documentElement && document.documentElement.clientWidth) ||
|
|
121
|
+
(document.body && document.body.clientWidth));
|
|
122
|
+
}
|
|
123
|
+
const isCanvasNode = (node) => {
|
|
124
|
+
try {
|
|
125
|
+
if (node instanceof HTMLElement) {
|
|
126
|
+
return node.tagName === 'CANVAS';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (_a) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
};
|
|
134
|
+
function isBlocked(node, blockClass) {
|
|
135
|
+
if (!node) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (node.nodeType === node.ELEMENT_NODE) {
|
|
139
|
+
let needBlock = false;
|
|
140
|
+
if (typeof blockClass === 'string') {
|
|
141
|
+
if (node.closest !== undefined) {
|
|
142
|
+
return node.closest('.' + blockClass) !== null;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
needBlock = node.classList.contains(blockClass);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
node.classList.forEach((className) => {
|
|
150
|
+
if (blockClass.test(className)) {
|
|
151
|
+
needBlock = true;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return needBlock || isBlocked(node.parentNode, blockClass);
|
|
156
|
+
}
|
|
157
|
+
if (node.nodeType === node.TEXT_NODE) {
|
|
158
|
+
return isBlocked(node.parentNode, blockClass);
|
|
159
|
+
}
|
|
160
|
+
return isBlocked(node.parentNode, blockClass);
|
|
161
|
+
}
|
|
162
|
+
function isSerialized(n, mirror) {
|
|
163
|
+
return mirror.getId(n) !== -1;
|
|
164
|
+
}
|
|
165
|
+
function isIgnored(n, mirror) {
|
|
166
|
+
return mirror.getId(n) === IGNORED_NODE;
|
|
167
|
+
}
|
|
168
|
+
function isAncestorRemoved(target, mirror) {
|
|
169
|
+
if (isShadowRoot(target)) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
const id = mirror.getId(target);
|
|
173
|
+
if (!mirror.has(id)) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
if (target.parentNode &&
|
|
177
|
+
target.parentNode.nodeType === target.DOCUMENT_NODE) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
if (!target.parentNode) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
return isAncestorRemoved(target.parentNode, mirror);
|
|
184
|
+
}
|
|
185
|
+
function isTouchEvent(event) {
|
|
186
|
+
return Boolean(event.changedTouches);
|
|
187
|
+
}
|
|
188
|
+
function polyfill(win = window) {
|
|
189
|
+
if ('NodeList' in win && !win.NodeList.prototype.forEach) {
|
|
190
|
+
win.NodeList.prototype.forEach = Array.prototype
|
|
191
|
+
.forEach;
|
|
192
|
+
}
|
|
193
|
+
if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {
|
|
194
|
+
win.DOMTokenList.prototype.forEach = Array.prototype
|
|
195
|
+
.forEach;
|
|
196
|
+
}
|
|
197
|
+
if (!Node.prototype.contains) {
|
|
198
|
+
Node.prototype.contains = function contains(node) {
|
|
199
|
+
if (!(0 in arguments)) {
|
|
200
|
+
throw new TypeError('1 argument is required');
|
|
201
|
+
}
|
|
202
|
+
do {
|
|
203
|
+
if (this === node) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
} while ((node = node && node.parentNode));
|
|
207
|
+
return false;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function queueToResolveTrees(queue) {
|
|
212
|
+
const queueNodeMap = {};
|
|
213
|
+
const putIntoMap = (m, parent) => {
|
|
214
|
+
const nodeInTree = {
|
|
215
|
+
value: m,
|
|
216
|
+
parent,
|
|
217
|
+
children: [],
|
|
218
|
+
};
|
|
219
|
+
queueNodeMap[m.node.id] = nodeInTree;
|
|
220
|
+
return nodeInTree;
|
|
221
|
+
};
|
|
222
|
+
const queueNodeTrees = [];
|
|
223
|
+
for (const mutation of queue) {
|
|
224
|
+
const { nextId, parentId } = mutation;
|
|
225
|
+
if (nextId && nextId in queueNodeMap) {
|
|
226
|
+
const nextInTree = queueNodeMap[nextId];
|
|
227
|
+
if (nextInTree.parent) {
|
|
228
|
+
const idx = nextInTree.parent.children.indexOf(nextInTree);
|
|
229
|
+
nextInTree.parent.children.splice(idx, 0, putIntoMap(mutation, nextInTree.parent));
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
const idx = queueNodeTrees.indexOf(nextInTree);
|
|
233
|
+
queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));
|
|
234
|
+
}
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (parentId in queueNodeMap) {
|
|
238
|
+
const parentInTree = queueNodeMap[parentId];
|
|
239
|
+
parentInTree.children.push(putIntoMap(mutation, parentInTree));
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
queueNodeTrees.push(putIntoMap(mutation, null));
|
|
243
|
+
}
|
|
244
|
+
return queueNodeTrees;
|
|
245
|
+
}
|
|
246
|
+
function iterateResolveTree(tree, cb) {
|
|
247
|
+
cb(tree.value);
|
|
248
|
+
for (let i = tree.children.length - 1; i >= 0; i--) {
|
|
249
|
+
iterateResolveTree(tree.children[i], cb);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function isSerializedIframe(n, mirror) {
|
|
253
|
+
return Boolean(n.nodeName === 'IFRAME' && mirror.getMeta(n));
|
|
254
|
+
}
|
|
255
|
+
function isSerializedStylesheet(n, mirror) {
|
|
256
|
+
return Boolean(n.nodeName === 'LINK' &&
|
|
257
|
+
n.nodeType === n.ELEMENT_NODE &&
|
|
258
|
+
n.getAttribute &&
|
|
259
|
+
n.getAttribute('rel') === 'stylesheet' &&
|
|
260
|
+
mirror.getMeta(n));
|
|
261
|
+
}
|
|
262
|
+
function getBaseDimension(node, rootIframe) {
|
|
263
|
+
var _a, _b;
|
|
264
|
+
const frameElement = (_b = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) === null || _b === void 0 ? void 0 : _b.frameElement;
|
|
265
|
+
if (!frameElement || frameElement === rootIframe) {
|
|
266
|
+
return {
|
|
267
|
+
x: 0,
|
|
268
|
+
y: 0,
|
|
269
|
+
relativeScale: 1,
|
|
270
|
+
absoluteScale: 1,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
const frameDimension = frameElement.getBoundingClientRect();
|
|
274
|
+
const frameBaseDimension = getBaseDimension(frameElement, rootIframe);
|
|
275
|
+
const relativeScale = frameDimension.height / frameElement.clientHeight;
|
|
276
|
+
return {
|
|
277
|
+
x: frameDimension.x * frameBaseDimension.relativeScale +
|
|
278
|
+
frameBaseDimension.x,
|
|
279
|
+
y: frameDimension.y * frameBaseDimension.relativeScale +
|
|
280
|
+
frameBaseDimension.y,
|
|
281
|
+
relativeScale,
|
|
282
|
+
absoluteScale: frameBaseDimension.absoluteScale * relativeScale,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function hasShadowRoot(n) {
|
|
286
|
+
return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
|
|
287
|
+
}
|
|
288
|
+
function getNestedRule(rules, position) {
|
|
289
|
+
const rule = rules[position[0]];
|
|
290
|
+
if (position.length === 1) {
|
|
291
|
+
return rule;
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
return getNestedRule(rule.cssRules[position[1]].cssRules, position.slice(2));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function getPositionsAndIndex(nestedIndex) {
|
|
298
|
+
const positions = [...nestedIndex];
|
|
299
|
+
const index = positions.pop();
|
|
300
|
+
return { positions, index };
|
|
301
|
+
}
|
|
302
|
+
function uniqueTextMutations(mutations) {
|
|
303
|
+
const idSet = new Set();
|
|
304
|
+
const uniqueMutations = [];
|
|
305
|
+
for (let i = mutations.length; i--;) {
|
|
306
|
+
const mutation = mutations[i];
|
|
307
|
+
if (!idSet.has(mutation.id)) {
|
|
308
|
+
uniqueMutations.push(mutation);
|
|
309
|
+
idSet.add(mutation.id);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return uniqueMutations;
|
|
507
313
|
}
|
|
508
314
|
|
|
509
|
-
export {
|
|
315
|
+
export { _mirror, getBaseDimension, getNestedRule, getPositionsAndIndex, getWindowHeight, getWindowWidth, hasShadowRoot, hookSetter, isAncestorRemoved, isBlocked, isCanvasNode, isIgnored, isSerialized, isSerializedIframe, isSerializedStylesheet, isTouchEvent, iterateResolveTree, on, patch, polyfill, queueToResolveTrees, throttle, uniqueTextMutations };
|