@glimt/record 0.0.84 → 0.0.86

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/record.js CHANGED
@@ -1475,7 +1475,8 @@ function serializeNode(n2, options) {
1475
1475
  recordCanvas,
1476
1476
  keepIframeSrcFn,
1477
1477
  newlyAddedElement = false,
1478
- cssCaptured = false
1478
+ cssCaptured = false,
1479
+ captureBlockBoundingBoxes = false
1479
1480
  } = options;
1480
1481
  const rootId = getRootId(doc, mirror2);
1481
1482
  switch (n2.nodeType) {
@@ -1514,7 +1515,8 @@ function serializeNode(n2, options) {
1514
1515
  recordCanvas,
1515
1516
  keepIframeSrcFn,
1516
1517
  newlyAddedElement,
1517
- rootId
1518
+ rootId,
1519
+ captureBlockBoundingBoxes
1518
1520
  });
1519
1521
  case n2.TEXT_NODE:
1520
1522
  return serializeTextNode(n2, {
@@ -1582,7 +1584,8 @@ function serializeElementNode(n2, options) {
1582
1584
  recordCanvas,
1583
1585
  keepIframeSrcFn,
1584
1586
  newlyAddedElement = false,
1585
- rootId
1587
+ rootId,
1588
+ captureBlockBoundingBoxes = false
1586
1589
  } = options;
1587
1590
  const needBlock = _isBlockedElement(n2, blockClass, blockSelector);
1588
1591
  const tagName = getValidTagName$1(n2);
@@ -1686,6 +1689,22 @@ function serializeElementNode(n2, options) {
1686
1689
  rr_width: `${width}px`,
1687
1690
  rr_height: `${height}px`
1688
1691
  };
1692
+ } else if (captureBlockBoundingBoxes) {
1693
+ try {
1694
+ const { bottom, left, right, top, x: x2, y, width, height } = n2.getBoundingClientRect();
1695
+ attributes = {
1696
+ class: attributes.class,
1697
+ c_rr_top: `${top}px`,
1698
+ c_rr_left: `${left}px`,
1699
+ c_rr_bottom: `${bottom}px`,
1700
+ c_rr_right: `${right}px`,
1701
+ c_rr_x: `${x2}px`,
1702
+ c_rr_y: `${y}px`,
1703
+ c_rr_width: `${width}px`,
1704
+ c_rr_height: `${height}px`
1705
+ };
1706
+ } catch (e2) {
1707
+ }
1689
1708
  }
1690
1709
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
1691
1710
  if (!n2.contentDocument) {
@@ -1772,7 +1791,8 @@ function serializeNodeWithId(n2, options) {
1772
1791
  stylesheetLoadTimeout = 5e3,
1773
1792
  keepIframeSrcFn = () => false,
1774
1793
  newlyAddedElement = false,
1775
- cssCaptured = false
1794
+ cssCaptured = false,
1795
+ captureBlockBoundingBoxes = false
1776
1796
  } = options;
1777
1797
  let { needsMask } = options;
1778
1798
  let { preserveWhiteSpace = true } = options;
@@ -1800,7 +1820,8 @@ function serializeNodeWithId(n2, options) {
1800
1820
  recordCanvas,
1801
1821
  keepIframeSrcFn,
1802
1822
  newlyAddedElement,
1803
- cssCaptured
1823
+ cssCaptured,
1824
+ captureBlockBoundingBoxes
1804
1825
  });
1805
1826
  if (!_serializedNode) {
1806
1827
  if (isDebug$1()) console.warn(n2, "not serialized");
@@ -2001,7 +2022,8 @@ function snapshot(n2, options) {
2001
2022
  iframeLoadTimeout,
2002
2023
  onStylesheetLoad,
2003
2024
  stylesheetLoadTimeout,
2004
- keepIframeSrcFn = () => false
2025
+ keepIframeSrcFn = () => false,
2026
+ captureBlockBoundingBoxes = false
2005
2027
  } = options || {};
2006
2028
  const maskInputOptions = maskAllInputs === true ? {
2007
2029
  color: true,
@@ -2062,7 +2084,8 @@ function snapshot(n2, options) {
2062
2084
  onStylesheetLoad,
2063
2085
  stylesheetLoadTimeout,
2064
2086
  keepIframeSrcFn,
2065
- newlyAddedElement: false
2087
+ newlyAddedElement: false,
2088
+ captureBlockBoundingBoxes
2066
2089
  });
2067
2090
  }
2068
2091
  function getDefaultExportFromCjs$1(x2) {
@@ -10331,7 +10354,7 @@ const _MutationRateLimiter = class _MutationRateLimiter2 {
10331
10354
  __publicField(this, "exitMutTracker");
10332
10355
  __publicField(this, "interval", 50);
10333
10356
  __publicField(this, "exitInterval", 100);
10334
- __publicField(this, "mutThreshold", 350);
10357
+ __publicField(this, "mutThreshold", 250);
10335
10358
  __publicField(this, "inGlobalStorm", false);
10336
10359
  __publicField(this, "currentStormStartedAt", -1);
10337
10360
  __publicField(this, "stormTimeLimit", 5e3);
@@ -10624,11 +10647,12 @@ class MutationBuffer {
10624
10647
  __publicField(this, "canvasManager");
10625
10648
  __publicField(this, "processedNodeManager");
10626
10649
  __publicField(this, "unattachedDoc");
10650
+ __publicField(this, "captureBlockBoundingBoxes");
10627
10651
  __publicField(this, "bufId", makeid());
10628
10652
  __publicField(this, "stormBatches", []);
10629
10653
  __publicField(this, "stormInfo", null);
10630
10654
  __publicField(this, "stormSettings", {
10631
- batchSize: 250,
10655
+ batchSize: 50,
10632
10656
  //was 300
10633
10657
  timeout: 50,
10634
10658
  //was 50
@@ -10763,6 +10787,7 @@ class MutationBuffer {
10763
10787
  doc: this.doc,
10764
10788
  mirror: this.mirror,
10765
10789
  blockClass: this.blockClass,
10790
+ captureBlockBoundingBoxes: this.captureBlockBoundingBoxes,
10766
10791
  blockSelector: this.blockSelector,
10767
10792
  maskTextClass: this.maskTextClass,
10768
10793
  maskTextSelector: this.maskTextSelector,
@@ -11206,7 +11231,8 @@ class MutationBuffer {
11206
11231
  "stylesheetManager",
11207
11232
  "shadowDomManager",
11208
11233
  "canvasManager",
11209
- "processedNodeManager"
11234
+ "processedNodeManager",
11235
+ "captureBlockBoundingBoxes"
11210
11236
  ].forEach((key) => {
11211
11237
  this[key] = options[key];
11212
11238
  });
@@ -13046,6 +13072,7 @@ function record(options = {}) {
13046
13072
  checkoutEveryNms,
13047
13073
  checkoutEveryNth,
13048
13074
  blockClass = "rr-block",
13075
+ captureBlockBoundingBoxes = false,
13049
13076
  blockSelector = null,
13050
13077
  ignoreClass = "rr-ignore",
13051
13078
  ignoreSelector = null,
@@ -13259,7 +13286,8 @@ function record(options = {}) {
13259
13286
  stylesheetManager,
13260
13287
  canvasManager,
13261
13288
  keepIframeSrcFn,
13262
- processedNodeManager
13289
+ processedNodeManager,
13290
+ captureBlockBoundingBoxes
13263
13291
  },
13264
13292
  mirror
13265
13293
  });
@@ -13284,6 +13312,7 @@ function record(options = {}) {
13284
13312
  const node2 = snapshot(document, {
13285
13313
  mirror,
13286
13314
  blockClass,
13315
+ captureBlockBoundingBoxes,
13287
13316
  blockSelector,
13288
13317
  maskTextClass,
13289
13318
  maskTextSelector,
@@ -13446,6 +13475,7 @@ function record(options = {}) {
13446
13475
  processedNodeManager,
13447
13476
  canvasManager,
13448
13477
  ignoreCSSAttributes,
13478
+ captureBlockBoundingBoxes,
13449
13479
  plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
13450
13480
  observer: p.observer,
13451
13481
  options: p.options,