@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.cjs CHANGED
@@ -1477,7 +1477,8 @@ function serializeNode(n2, options) {
1477
1477
  recordCanvas,
1478
1478
  keepIframeSrcFn,
1479
1479
  newlyAddedElement = false,
1480
- cssCaptured = false
1480
+ cssCaptured = false,
1481
+ captureBlockBoundingBoxes = false
1481
1482
  } = options;
1482
1483
  const rootId = getRootId(doc, mirror2);
1483
1484
  switch (n2.nodeType) {
@@ -1516,7 +1517,8 @@ function serializeNode(n2, options) {
1516
1517
  recordCanvas,
1517
1518
  keepIframeSrcFn,
1518
1519
  newlyAddedElement,
1519
- rootId
1520
+ rootId,
1521
+ captureBlockBoundingBoxes
1520
1522
  });
1521
1523
  case n2.TEXT_NODE:
1522
1524
  return serializeTextNode(n2, {
@@ -1584,7 +1586,8 @@ function serializeElementNode(n2, options) {
1584
1586
  recordCanvas,
1585
1587
  keepIframeSrcFn,
1586
1588
  newlyAddedElement = false,
1587
- rootId
1589
+ rootId,
1590
+ captureBlockBoundingBoxes = false
1588
1591
  } = options;
1589
1592
  const needBlock = _isBlockedElement(n2, blockClass, blockSelector);
1590
1593
  const tagName = getValidTagName$1(n2);
@@ -1688,6 +1691,22 @@ function serializeElementNode(n2, options) {
1688
1691
  rr_width: `${width}px`,
1689
1692
  rr_height: `${height}px`
1690
1693
  };
1694
+ } else if (captureBlockBoundingBoxes) {
1695
+ try {
1696
+ const { bottom, left, right, top, x: x2, y, width, height } = n2.getBoundingClientRect();
1697
+ attributes = {
1698
+ class: attributes.class,
1699
+ c_rr_top: `${top}px`,
1700
+ c_rr_left: `${left}px`,
1701
+ c_rr_bottom: `${bottom}px`,
1702
+ c_rr_right: `${right}px`,
1703
+ c_rr_x: `${x2}px`,
1704
+ c_rr_y: `${y}px`,
1705
+ c_rr_width: `${width}px`,
1706
+ c_rr_height: `${height}px`
1707
+ };
1708
+ } catch (e2) {
1709
+ }
1691
1710
  }
1692
1711
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
1693
1712
  if (!n2.contentDocument) {
@@ -1774,7 +1793,8 @@ function serializeNodeWithId(n2, options) {
1774
1793
  stylesheetLoadTimeout = 5e3,
1775
1794
  keepIframeSrcFn = () => false,
1776
1795
  newlyAddedElement = false,
1777
- cssCaptured = false
1796
+ cssCaptured = false,
1797
+ captureBlockBoundingBoxes = false
1778
1798
  } = options;
1779
1799
  let { needsMask } = options;
1780
1800
  let { preserveWhiteSpace = true } = options;
@@ -1802,7 +1822,8 @@ function serializeNodeWithId(n2, options) {
1802
1822
  recordCanvas,
1803
1823
  keepIframeSrcFn,
1804
1824
  newlyAddedElement,
1805
- cssCaptured
1825
+ cssCaptured,
1826
+ captureBlockBoundingBoxes
1806
1827
  });
1807
1828
  if (!_serializedNode) {
1808
1829
  if (isDebug$1()) console.warn(n2, "not serialized");
@@ -2003,7 +2024,8 @@ function snapshot(n2, options) {
2003
2024
  iframeLoadTimeout,
2004
2025
  onStylesheetLoad,
2005
2026
  stylesheetLoadTimeout,
2006
- keepIframeSrcFn = () => false
2027
+ keepIframeSrcFn = () => false,
2028
+ captureBlockBoundingBoxes = false
2007
2029
  } = options || {};
2008
2030
  const maskInputOptions = maskAllInputs === true ? {
2009
2031
  color: true,
@@ -2064,7 +2086,8 @@ function snapshot(n2, options) {
2064
2086
  onStylesheetLoad,
2065
2087
  stylesheetLoadTimeout,
2066
2088
  keepIframeSrcFn,
2067
- newlyAddedElement: false
2089
+ newlyAddedElement: false,
2090
+ captureBlockBoundingBoxes
2068
2091
  });
2069
2092
  }
2070
2093
  function getDefaultExportFromCjs$1(x2) {
@@ -10333,7 +10356,7 @@ const _MutationRateLimiter = class _MutationRateLimiter2 {
10333
10356
  __publicField(this, "exitMutTracker");
10334
10357
  __publicField(this, "interval", 50);
10335
10358
  __publicField(this, "exitInterval", 100);
10336
- __publicField(this, "mutThreshold", 350);
10359
+ __publicField(this, "mutThreshold", 250);
10337
10360
  __publicField(this, "inGlobalStorm", false);
10338
10361
  __publicField(this, "currentStormStartedAt", -1);
10339
10362
  __publicField(this, "stormTimeLimit", 5e3);
@@ -10626,11 +10649,12 @@ class MutationBuffer {
10626
10649
  __publicField(this, "canvasManager");
10627
10650
  __publicField(this, "processedNodeManager");
10628
10651
  __publicField(this, "unattachedDoc");
10652
+ __publicField(this, "captureBlockBoundingBoxes");
10629
10653
  __publicField(this, "bufId", makeid());
10630
10654
  __publicField(this, "stormBatches", []);
10631
10655
  __publicField(this, "stormInfo", null);
10632
10656
  __publicField(this, "stormSettings", {
10633
- batchSize: 250,
10657
+ batchSize: 50,
10634
10658
  //was 300
10635
10659
  timeout: 50,
10636
10660
  //was 50
@@ -10765,6 +10789,7 @@ class MutationBuffer {
10765
10789
  doc: this.doc,
10766
10790
  mirror: this.mirror,
10767
10791
  blockClass: this.blockClass,
10792
+ captureBlockBoundingBoxes: this.captureBlockBoundingBoxes,
10768
10793
  blockSelector: this.blockSelector,
10769
10794
  maskTextClass: this.maskTextClass,
10770
10795
  maskTextSelector: this.maskTextSelector,
@@ -11208,7 +11233,8 @@ class MutationBuffer {
11208
11233
  "stylesheetManager",
11209
11234
  "shadowDomManager",
11210
11235
  "canvasManager",
11211
- "processedNodeManager"
11236
+ "processedNodeManager",
11237
+ "captureBlockBoundingBoxes"
11212
11238
  ].forEach((key) => {
11213
11239
  this[key] = options[key];
11214
11240
  });
@@ -13048,6 +13074,7 @@ function record(options = {}) {
13048
13074
  checkoutEveryNms,
13049
13075
  checkoutEveryNth,
13050
13076
  blockClass = "rr-block",
13077
+ captureBlockBoundingBoxes = false,
13051
13078
  blockSelector = null,
13052
13079
  ignoreClass = "rr-ignore",
13053
13080
  ignoreSelector = null,
@@ -13261,7 +13288,8 @@ function record(options = {}) {
13261
13288
  stylesheetManager,
13262
13289
  canvasManager,
13263
13290
  keepIframeSrcFn,
13264
- processedNodeManager
13291
+ processedNodeManager,
13292
+ captureBlockBoundingBoxes
13265
13293
  },
13266
13294
  mirror
13267
13295
  });
@@ -13286,6 +13314,7 @@ function record(options = {}) {
13286
13314
  const node2 = snapshot(document, {
13287
13315
  mirror,
13288
13316
  blockClass,
13317
+ captureBlockBoundingBoxes,
13289
13318
  blockSelector,
13290
13319
  maskTextClass,
13291
13320
  maskTextSelector,
@@ -13448,6 +13477,7 @@ function record(options = {}) {
13448
13477
  processedNodeManager,
13449
13478
  canvasManager,
13450
13479
  ignoreCSSAttributes,
13480
+ captureBlockBoundingBoxes,
13451
13481
  plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
13452
13482
  observer: p.observer,
13453
13483
  options: p.options,