@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
|
@@ -16,6 +16,60 @@ function isShadowRoot(n) {
|
|
|
16
16
|
var host = (_a = n) === null || _a === void 0 ? void 0 : _a.host;
|
|
17
17
|
return Boolean(host && host.shadowRoot && host.shadowRoot === n);
|
|
18
18
|
}
|
|
19
|
+
var Mirror = (function () {
|
|
20
|
+
function Mirror() {
|
|
21
|
+
this.idNodeMap = new Map();
|
|
22
|
+
this.nodeMetaMap = new WeakMap();
|
|
23
|
+
}
|
|
24
|
+
Mirror.prototype.getId = function (n) {
|
|
25
|
+
var _a;
|
|
26
|
+
if (!n)
|
|
27
|
+
return -1;
|
|
28
|
+
var id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
|
|
29
|
+
return id !== null && id !== void 0 ? id : -1;
|
|
30
|
+
};
|
|
31
|
+
Mirror.prototype.getNode = function (id) {
|
|
32
|
+
return this.idNodeMap.get(id) || null;
|
|
33
|
+
};
|
|
34
|
+
Mirror.prototype.getIds = function () {
|
|
35
|
+
return Array.from(this.idNodeMap.keys());
|
|
36
|
+
};
|
|
37
|
+
Mirror.prototype.getMeta = function (n) {
|
|
38
|
+
return this.nodeMetaMap.get(n) || null;
|
|
39
|
+
};
|
|
40
|
+
Mirror.prototype.removeNodeFromMap = function (n) {
|
|
41
|
+
var _this = this;
|
|
42
|
+
var id = this.getId(n);
|
|
43
|
+
this.idNodeMap["delete"](id);
|
|
44
|
+
if (n.childNodes) {
|
|
45
|
+
n.childNodes.forEach(function (childNode) {
|
|
46
|
+
return _this.removeNodeFromMap(childNode);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
Mirror.prototype.has = function (id) {
|
|
51
|
+
return this.idNodeMap.has(id);
|
|
52
|
+
};
|
|
53
|
+
Mirror.prototype.hasNode = function (node) {
|
|
54
|
+
return this.nodeMetaMap.has(node);
|
|
55
|
+
};
|
|
56
|
+
Mirror.prototype.add = function (n, meta) {
|
|
57
|
+
var id = meta.id;
|
|
58
|
+
this.idNodeMap.set(id, n);
|
|
59
|
+
this.nodeMetaMap.set(n, meta);
|
|
60
|
+
};
|
|
61
|
+
Mirror.prototype.replace = function (id, n) {
|
|
62
|
+
this.idNodeMap.set(id, n);
|
|
63
|
+
};
|
|
64
|
+
Mirror.prototype.reset = function () {
|
|
65
|
+
this.idNodeMap = new Map();
|
|
66
|
+
this.nodeMetaMap = new WeakMap();
|
|
67
|
+
};
|
|
68
|
+
return Mirror;
|
|
69
|
+
}());
|
|
70
|
+
function createMirror() {
|
|
71
|
+
return new Mirror();
|
|
72
|
+
}
|
|
19
73
|
function maskInputValue(_a) {
|
|
20
74
|
var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;
|
|
21
75
|
var text = value || '';
|
|
@@ -338,12 +392,40 @@ function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
|
338
392
|
}
|
|
339
393
|
iframeEl.addEventListener('load', listener);
|
|
340
394
|
}
|
|
395
|
+
function isStylesheetLoaded(link) {
|
|
396
|
+
if (!link.getAttribute('href'))
|
|
397
|
+
return true;
|
|
398
|
+
return link.sheet !== null;
|
|
399
|
+
}
|
|
400
|
+
function onceStylesheetLoaded(link, listener, iframeLoadTimeout) {
|
|
401
|
+
var fired = false;
|
|
402
|
+
var styleSheetLoaded;
|
|
403
|
+
try {
|
|
404
|
+
styleSheetLoaded = link.sheet;
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (styleSheetLoaded)
|
|
410
|
+
return;
|
|
411
|
+
var timer = setTimeout(function () {
|
|
412
|
+
if (!fired) {
|
|
413
|
+
listener();
|
|
414
|
+
fired = true;
|
|
415
|
+
}
|
|
416
|
+
}, iframeLoadTimeout);
|
|
417
|
+
link.addEventListener('load', function () {
|
|
418
|
+
clearTimeout(timer);
|
|
419
|
+
fired = true;
|
|
420
|
+
listener();
|
|
421
|
+
});
|
|
422
|
+
}
|
|
341
423
|
function serializeNode(n, options) {
|
|
342
424
|
var _a;
|
|
343
|
-
var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
425
|
+
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
344
426
|
var rootId;
|
|
345
|
-
if (doc
|
|
346
|
-
var docId = doc
|
|
427
|
+
if (mirror.getMeta(doc)) {
|
|
428
|
+
var docId = mirror.getId(doc);
|
|
347
429
|
rootId = docId === 1 ? undefined : docId;
|
|
348
430
|
}
|
|
349
431
|
switch (n.nodeType) {
|
|
@@ -375,9 +457,10 @@ function serializeNode(n, options) {
|
|
|
375
457
|
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
376
458
|
var tagName = getValidTagName(n);
|
|
377
459
|
var attributes_1 = {};
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
460
|
+
var len = n.attributes.length;
|
|
461
|
+
for (var i = 0; i < len; i++) {
|
|
462
|
+
var attr = n.attributes[i];
|
|
463
|
+
attributes_1[attr.name] = transformAttribute(doc, tagName, attr.name, attr.value);
|
|
381
464
|
}
|
|
382
465
|
if (tagName === 'link' && inlineStylesheet) {
|
|
383
466
|
var stylesheet = Array.from(doc.styleSheets).find(function (s) {
|
|
@@ -469,7 +552,7 @@ function serializeNode(n, options) {
|
|
|
469
552
|
}
|
|
470
553
|
oldValue_1
|
|
471
554
|
? (attributes_1.crossOrigin = oldValue_1)
|
|
472
|
-
:
|
|
555
|
+
: image_1.removeAttribute('crossorigin');
|
|
473
556
|
};
|
|
474
557
|
if (image_1.complete && image_1.naturalWidth !== 0)
|
|
475
558
|
recordInlineImage();
|
|
@@ -489,7 +572,7 @@ function serializeNode(n, options) {
|
|
|
489
572
|
attributes_1.rr_scrollTop = n.scrollTop;
|
|
490
573
|
}
|
|
491
574
|
if (needBlock || (tagName === 'img' && enableStrictPrivacy)) {
|
|
492
|
-
var
|
|
575
|
+
var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
|
|
493
576
|
attributes_1 = {
|
|
494
577
|
"class": attributes_1["class"],
|
|
495
578
|
rr_width: width + "px",
|
|
@@ -664,10 +747,11 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
664
747
|
return false;
|
|
665
748
|
}
|
|
666
749
|
function serializeNodeWithId(n, options) {
|
|
667
|
-
var doc = options.doc,
|
|
668
|
-
var
|
|
750
|
+
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, onStylesheetLoad = options.onStylesheetLoad, _h = options.stylesheetLoadTimeout, stylesheetLoadTimeout = _h === void 0 ? 5000 : _h, _j = options.keepIframeSrcFn, keepIframeSrcFn = _j === void 0 ? function () { return false; } : _j, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
751
|
+
var _k = options.preserveWhiteSpace, preserveWhiteSpace = _k === void 0 ? true : _k;
|
|
669
752
|
var _serializedNode = serializeNode(n, {
|
|
670
753
|
doc: doc,
|
|
754
|
+
mirror: mirror,
|
|
671
755
|
blockClass: blockClass,
|
|
672
756
|
blockSelector: blockSelector,
|
|
673
757
|
maskTextClass: maskTextClass,
|
|
@@ -687,8 +771,8 @@ function serializeNodeWithId(n, options) {
|
|
|
687
771
|
return null;
|
|
688
772
|
}
|
|
689
773
|
var id;
|
|
690
|
-
if (
|
|
691
|
-
id = n
|
|
774
|
+
if (mirror.hasNode(n)) {
|
|
775
|
+
id = mirror.getId(n);
|
|
692
776
|
}
|
|
693
777
|
else if (slimDOMExcluded(_serializedNode, slimDOMOptions) ||
|
|
694
778
|
(!preserveWhiteSpace &&
|
|
@@ -700,12 +784,11 @@ function serializeNodeWithId(n, options) {
|
|
|
700
784
|
else {
|
|
701
785
|
id = genId();
|
|
702
786
|
}
|
|
703
|
-
var serializedNode = Object.assign(_serializedNode, { id: id });
|
|
704
|
-
n.__sn = serializedNode;
|
|
705
787
|
if (id === IGNORED_NODE) {
|
|
706
788
|
return null;
|
|
707
789
|
}
|
|
708
|
-
|
|
790
|
+
var serializedNode = Object.assign(_serializedNode, { id: id });
|
|
791
|
+
mirror.add(n, serializedNode);
|
|
709
792
|
if (onSerialize) {
|
|
710
793
|
onSerialize(n);
|
|
711
794
|
}
|
|
@@ -715,7 +798,7 @@ function serializeNodeWithId(n, options) {
|
|
|
715
798
|
if (serializedNode.needBlock && serializedNode.tagName === 'img') {
|
|
716
799
|
var clone = n.cloneNode();
|
|
717
800
|
clone.src = '';
|
|
718
|
-
|
|
801
|
+
mirror.add(clone, serializedNode);
|
|
719
802
|
}
|
|
720
803
|
delete serializedNode.needBlock;
|
|
721
804
|
if (n.shadowRoot)
|
|
@@ -725,13 +808,13 @@ function serializeNodeWithId(n, options) {
|
|
|
725
808
|
serializedNode.type === NodeType.Element) &&
|
|
726
809
|
recordChild) {
|
|
727
810
|
if (slimDOMOptions.headWhitespace &&
|
|
728
|
-
|
|
729
|
-
|
|
811
|
+
serializedNode.type === NodeType.Element &&
|
|
812
|
+
serializedNode.tagName === 'head') {
|
|
730
813
|
preserveWhiteSpace = false;
|
|
731
814
|
}
|
|
732
815
|
var bypassOptions = {
|
|
733
816
|
doc: doc,
|
|
734
|
-
|
|
817
|
+
mirror: mirror,
|
|
735
818
|
blockClass: blockClass,
|
|
736
819
|
blockSelector: blockSelector,
|
|
737
820
|
maskTextClass: maskTextClass,
|
|
@@ -749,19 +832,21 @@ function serializeNodeWithId(n, options) {
|
|
|
749
832
|
onSerialize: onSerialize,
|
|
750
833
|
onIframeLoad: onIframeLoad,
|
|
751
834
|
iframeLoadTimeout: iframeLoadTimeout,
|
|
835
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
836
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
752
837
|
keepIframeSrcFn: keepIframeSrcFn,
|
|
753
838
|
enableStrictPrivacy: enableStrictPrivacy
|
|
754
839
|
};
|
|
755
|
-
for (var _i = 0,
|
|
756
|
-
var childN =
|
|
840
|
+
for (var _i = 0, _l = Array.from(n.childNodes); _i < _l.length; _i++) {
|
|
841
|
+
var childN = _l[_i];
|
|
757
842
|
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
758
843
|
if (serializedChildNode) {
|
|
759
844
|
serializedNode.childNodes.push(serializedChildNode);
|
|
760
845
|
}
|
|
761
846
|
}
|
|
762
847
|
if (isElement(n) && n.shadowRoot) {
|
|
763
|
-
for (var
|
|
764
|
-
var childN = _m
|
|
848
|
+
for (var _m = 0, _o = Array.from(n.shadowRoot.childNodes); _m < _o.length; _m++) {
|
|
849
|
+
var childN = _o[_m];
|
|
765
850
|
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
766
851
|
if (serializedChildNode) {
|
|
767
852
|
serializedChildNode.isShadow = true;
|
|
@@ -780,7 +865,7 @@ function serializeNodeWithId(n, options) {
|
|
|
780
865
|
if (iframeDoc && onIframeLoad) {
|
|
781
866
|
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
782
867
|
doc: iframeDoc,
|
|
783
|
-
|
|
868
|
+
mirror: mirror,
|
|
784
869
|
blockClass: blockClass,
|
|
785
870
|
blockSelector: blockSelector,
|
|
786
871
|
maskTextClass: maskTextClass,
|
|
@@ -807,11 +892,47 @@ function serializeNodeWithId(n, options) {
|
|
|
807
892
|
}
|
|
808
893
|
}, iframeLoadTimeout);
|
|
809
894
|
}
|
|
895
|
+
if (serializedNode.type === NodeType.Element &&
|
|
896
|
+
serializedNode.tagName === 'link' &&
|
|
897
|
+
serializedNode.attributes.rel === 'stylesheet') {
|
|
898
|
+
onceStylesheetLoaded(n, function () {
|
|
899
|
+
if (onStylesheetLoad) {
|
|
900
|
+
var serializedLinkNode = serializeNodeWithId(n, {
|
|
901
|
+
doc: doc,
|
|
902
|
+
mirror: mirror,
|
|
903
|
+
blockClass: blockClass,
|
|
904
|
+
blockSelector: blockSelector,
|
|
905
|
+
maskTextClass: maskTextClass,
|
|
906
|
+
maskTextSelector: maskTextSelector,
|
|
907
|
+
skipChild: false,
|
|
908
|
+
inlineStylesheet: inlineStylesheet,
|
|
909
|
+
maskInputOptions: maskInputOptions,
|
|
910
|
+
maskTextFn: maskTextFn,
|
|
911
|
+
maskInputFn: maskInputFn,
|
|
912
|
+
slimDOMOptions: slimDOMOptions,
|
|
913
|
+
dataURLOptions: dataURLOptions,
|
|
914
|
+
inlineImages: inlineImages,
|
|
915
|
+
recordCanvas: recordCanvas,
|
|
916
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
917
|
+
onSerialize: onSerialize,
|
|
918
|
+
onIframeLoad: onIframeLoad,
|
|
919
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
920
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
921
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
922
|
+
enableStrictPrivacy: enableStrictPrivacy
|
|
923
|
+
});
|
|
924
|
+
if (serializedLinkNode) {
|
|
925
|
+
onStylesheetLoad(n, serializedLinkNode);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}, stylesheetLoadTimeout);
|
|
929
|
+
if (isStylesheetLoaded(n) === false)
|
|
930
|
+
return null;
|
|
931
|
+
}
|
|
810
932
|
return serializedNode;
|
|
811
933
|
}
|
|
812
934
|
function snapshot(n, options) {
|
|
813
|
-
var _a = options || {}, _b = _a.blockClass, blockClass =
|
|
814
|
-
var idNodeMap = {};
|
|
935
|
+
var _a = options || {}, _b = _a.mirror, mirror = _b === void 0 ? new Mirror() : _b, _c = _a.blockClass, blockClass = _c === void 0 ? 'highlight-block' : _c, _d = _a.blockSelector, blockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? 'highlight-mask' : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.inlineStylesheet, inlineStylesheet = _g === void 0 ? true : _g, _h = _a.inlineImages, inlineImages = _h === void 0 ? false : _h, _j = _a.recordCanvas, recordCanvas = _j === void 0 ? false : _j, _k = _a.maskAllInputs, maskAllInputs = _k === void 0 ? false : _k, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _l = _a.slimDOM, slimDOM = _l === void 0 ? false : _l, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, onStylesheetLoad = _a.onStylesheetLoad, stylesheetLoadTimeout = _a.stylesheetLoadTimeout, _m = _a.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function () { return false; } : _m, _o = _a.enableStrictPrivacy, enableStrictPrivacy = _o === void 0 ? false : _o;
|
|
815
936
|
var maskInputOptions = maskAllInputs === true
|
|
816
937
|
? {
|
|
817
938
|
color: true,
|
|
@@ -853,32 +974,30 @@ function snapshot(n, options) {
|
|
|
853
974
|
: slimDOM === false
|
|
854
975
|
? {}
|
|
855
976
|
: slimDOM;
|
|
856
|
-
return
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
idNodeMap,
|
|
881
|
-
];
|
|
977
|
+
return serializeNodeWithId(n, {
|
|
978
|
+
doc: n,
|
|
979
|
+
mirror: mirror,
|
|
980
|
+
blockClass: blockClass,
|
|
981
|
+
blockSelector: blockSelector,
|
|
982
|
+
maskTextClass: maskTextClass,
|
|
983
|
+
maskTextSelector: maskTextSelector,
|
|
984
|
+
skipChild: false,
|
|
985
|
+
inlineStylesheet: inlineStylesheet,
|
|
986
|
+
maskInputOptions: maskInputOptions,
|
|
987
|
+
maskTextFn: maskTextFn,
|
|
988
|
+
maskInputFn: maskInputFn,
|
|
989
|
+
slimDOMOptions: slimDOMOptions,
|
|
990
|
+
dataURLOptions: dataURLOptions,
|
|
991
|
+
inlineImages: inlineImages,
|
|
992
|
+
recordCanvas: recordCanvas,
|
|
993
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
994
|
+
onSerialize: onSerialize,
|
|
995
|
+
onIframeLoad: onIframeLoad,
|
|
996
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
997
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
998
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout, keepIframeSrcFn: keepIframeSrcFn,
|
|
999
|
+
enableStrictPrivacy: enableStrictPrivacy
|
|
1000
|
+
});
|
|
882
1001
|
}
|
|
883
1002
|
|
|
884
1003
|
var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
@@ -1374,7 +1493,7 @@ var HOVER_SELECTOR = /([^\\]):hover/;
|
|
|
1374
1493
|
var HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g');
|
|
1375
1494
|
function addHoverClass(cssText, cache) {
|
|
1376
1495
|
var _a;
|
|
1377
|
-
if (!((_a = window.HIG_CONFIGURATION) === null || _a === void 0 ? void 0 : _a.enableOnHoverClass)) {
|
|
1496
|
+
if (!((_a = window === null || window === void 0 ? void 0 : window.HIG_CONFIGURATION) === null || _a === void 0 ? void 0 : _a.enableOnHoverClass)) {
|
|
1378
1497
|
return cssText;
|
|
1379
1498
|
}
|
|
1380
1499
|
var cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText);
|
|
@@ -1589,13 +1708,13 @@ function buildNode(n, options) {
|
|
|
1589
1708
|
}
|
|
1590
1709
|
}
|
|
1591
1710
|
function buildNodeWithSN(n, options) {
|
|
1592
|
-
var doc = options.doc,
|
|
1711
|
+
var doc = options.doc, mirror = options.mirror, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.hackCss, hackCss = _b === void 0 ? true : _b, afterAppend = options.afterAppend, cache = options.cache;
|
|
1593
1712
|
var node = buildNode(n, { doc: doc, hackCss: hackCss, cache: cache });
|
|
1594
1713
|
if (!node) {
|
|
1595
1714
|
return null;
|
|
1596
1715
|
}
|
|
1597
1716
|
if (n.rootId) {
|
|
1598
|
-
console.assert(
|
|
1717
|
+
console.assert(mirror.getNode(n.rootId) === doc, 'Target document should have the same root id.');
|
|
1599
1718
|
}
|
|
1600
1719
|
if (n.type === NodeType.Document) {
|
|
1601
1720
|
doc.close();
|
|
@@ -1614,15 +1733,14 @@ function buildNodeWithSN(n, options) {
|
|
|
1614
1733
|
}
|
|
1615
1734
|
node = doc;
|
|
1616
1735
|
}
|
|
1617
|
-
node
|
|
1618
|
-
map[n.id] = node;
|
|
1736
|
+
mirror.add(node, n);
|
|
1619
1737
|
if ((n.type === NodeType.Document || n.type === NodeType.Element) &&
|
|
1620
1738
|
!skipChild) {
|
|
1621
1739
|
for (var _i = 0, _c = n.childNodes; _i < _c.length; _i++) {
|
|
1622
1740
|
var childN = _c[_i];
|
|
1623
1741
|
var childNode = buildNodeWithSN(childN, {
|
|
1624
1742
|
doc: doc,
|
|
1625
|
-
|
|
1743
|
+
mirror: mirror,
|
|
1626
1744
|
skipChild: false,
|
|
1627
1745
|
hackCss: hackCss,
|
|
1628
1746
|
afterAppend: afterAppend,
|
|
@@ -1645,19 +1763,20 @@ function buildNodeWithSN(n, options) {
|
|
|
1645
1763
|
}
|
|
1646
1764
|
return node;
|
|
1647
1765
|
}
|
|
1648
|
-
function visit(
|
|
1766
|
+
function visit(mirror, onVisit) {
|
|
1649
1767
|
function walk(node) {
|
|
1650
1768
|
onVisit(node);
|
|
1651
1769
|
}
|
|
1652
|
-
for (var
|
|
1653
|
-
|
|
1654
|
-
|
|
1770
|
+
for (var _i = 0, _a = mirror.getIds(); _i < _a.length; _i++) {
|
|
1771
|
+
var id = _a[_i];
|
|
1772
|
+
if (mirror.has(id)) {
|
|
1773
|
+
walk(mirror.getNode(id));
|
|
1655
1774
|
}
|
|
1656
1775
|
}
|
|
1657
1776
|
}
|
|
1658
|
-
function handleScroll(node) {
|
|
1659
|
-
var n = node
|
|
1660
|
-
if (n.type !== NodeType.Element) {
|
|
1777
|
+
function handleScroll(node, mirror) {
|
|
1778
|
+
var n = mirror.getMeta(node);
|
|
1779
|
+
if ((n === null || n === void 0 ? void 0 : n.type) !== NodeType.Element) {
|
|
1661
1780
|
return;
|
|
1662
1781
|
}
|
|
1663
1782
|
var el = node;
|
|
@@ -1675,23 +1794,22 @@ function handleScroll(node) {
|
|
|
1675
1794
|
}
|
|
1676
1795
|
}
|
|
1677
1796
|
function rebuild(n, options) {
|
|
1678
|
-
var doc = options.doc, onVisit = options.onVisit, _a = options.hackCss, hackCss = _a === void 0 ? true : _a, afterAppend = options.afterAppend, cache = options.cache;
|
|
1679
|
-
var idNodeMap = {};
|
|
1797
|
+
var doc = options.doc, onVisit = options.onVisit, _a = options.hackCss, hackCss = _a === void 0 ? true : _a, afterAppend = options.afterAppend, cache = options.cache, _b = options.mirror, mirror = _b === void 0 ? new Mirror() : _b;
|
|
1680
1798
|
var node = buildNodeWithSN(n, {
|
|
1681
1799
|
doc: doc,
|
|
1682
|
-
|
|
1800
|
+
mirror: mirror,
|
|
1683
1801
|
skipChild: false,
|
|
1684
1802
|
hackCss: hackCss,
|
|
1685
1803
|
afterAppend: afterAppend,
|
|
1686
1804
|
cache: cache
|
|
1687
1805
|
});
|
|
1688
|
-
visit(
|
|
1806
|
+
visit(mirror, function (visitedNode) {
|
|
1689
1807
|
if (onVisit) {
|
|
1690
1808
|
onVisit(visitedNode);
|
|
1691
1809
|
}
|
|
1692
|
-
handleScroll(visitedNode);
|
|
1810
|
+
handleScroll(visitedNode, mirror);
|
|
1693
1811
|
});
|
|
1694
|
-
return
|
|
1812
|
+
return node;
|
|
1695
1813
|
}
|
|
1696
1814
|
|
|
1697
|
-
export { IGNORED_NODE, NodeType, addHoverClass, buildNodeWithSN, createCache, is2DCanvasBlank, isElement, isShadowRoot, maskInputValue, needMaskingText, obfuscateText, rebuild, serializeNodeWithId, snapshot, transformAttribute };
|
|
1815
|
+
export { IGNORED_NODE, Mirror, NodeType, addHoverClass, buildNodeWithSN, createCache, createMirror, is2DCanvasBlank, isElement, isShadowRoot, maskInputValue, needMaskingText, obfuscateText, rebuild, serializeNodeWithId, snapshot, transformAttribute };
|