@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.
@@ -1510,7 +1510,8 @@ function serializeNode(n2, options) {
1510
1510
  recordCanvas,
1511
1511
  keepIframeSrcFn,
1512
1512
  newlyAddedElement = false,
1513
- cssCaptured = false
1513
+ cssCaptured = false,
1514
+ captureBlockBoundingBoxes = false
1514
1515
  } = options;
1515
1516
  const rootId = getRootId(doc, mirror2);
1516
1517
  switch (n2.nodeType) {
@@ -1549,7 +1550,8 @@ function serializeNode(n2, options) {
1549
1550
  recordCanvas,
1550
1551
  keepIframeSrcFn,
1551
1552
  newlyAddedElement,
1552
- rootId
1553
+ rootId,
1554
+ captureBlockBoundingBoxes
1553
1555
  });
1554
1556
  case n2.TEXT_NODE:
1555
1557
  return serializeTextNode(n2, {
@@ -1617,7 +1619,8 @@ function serializeElementNode(n2, options) {
1617
1619
  recordCanvas,
1618
1620
  keepIframeSrcFn,
1619
1621
  newlyAddedElement = false,
1620
- rootId
1622
+ rootId,
1623
+ captureBlockBoundingBoxes = false
1621
1624
  } = options;
1622
1625
  const needBlock = _isBlockedElement(n2, blockClass, blockSelector);
1623
1626
  const tagName = getValidTagName$1(n2);
@@ -1721,6 +1724,22 @@ function serializeElementNode(n2, options) {
1721
1724
  rr_width: `${width}px`,
1722
1725
  rr_height: `${height}px`
1723
1726
  };
1727
+ } else if (captureBlockBoundingBoxes) {
1728
+ try {
1729
+ const { bottom, left, right, top, x: x2, y, width, height } = n2.getBoundingClientRect();
1730
+ attributes = {
1731
+ class: attributes.class,
1732
+ c_rr_top: `${top}px`,
1733
+ c_rr_left: `${left}px`,
1734
+ c_rr_bottom: `${bottom}px`,
1735
+ c_rr_right: `${right}px`,
1736
+ c_rr_x: `${x2}px`,
1737
+ c_rr_y: `${y}px`,
1738
+ c_rr_width: `${width}px`,
1739
+ c_rr_height: `${height}px`
1740
+ };
1741
+ } catch (e2) {
1742
+ }
1724
1743
  }
1725
1744
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
1726
1745
  if (!n2.contentDocument) {
@@ -1807,7 +1826,8 @@ function serializeNodeWithId(n2, options) {
1807
1826
  stylesheetLoadTimeout = 5e3,
1808
1827
  keepIframeSrcFn = () => false,
1809
1828
  newlyAddedElement = false,
1810
- cssCaptured = false
1829
+ cssCaptured = false,
1830
+ captureBlockBoundingBoxes = false
1811
1831
  } = options;
1812
1832
  let { needsMask } = options;
1813
1833
  let { preserveWhiteSpace = true } = options;
@@ -1835,7 +1855,8 @@ function serializeNodeWithId(n2, options) {
1835
1855
  recordCanvas,
1836
1856
  keepIframeSrcFn,
1837
1857
  newlyAddedElement,
1838
- cssCaptured
1858
+ cssCaptured,
1859
+ captureBlockBoundingBoxes
1839
1860
  });
1840
1861
  if (!_serializedNode) {
1841
1862
  if (isDebug$1()) console.warn(n2, "not serialized");
@@ -2036,7 +2057,8 @@ function snapshot(n2, options) {
2036
2057
  iframeLoadTimeout,
2037
2058
  onStylesheetLoad,
2038
2059
  stylesheetLoadTimeout,
2039
- keepIframeSrcFn = () => false
2060
+ keepIframeSrcFn = () => false,
2061
+ captureBlockBoundingBoxes = false
2040
2062
  } = options || {};
2041
2063
  const maskInputOptions = maskAllInputs === true ? {
2042
2064
  color: true,
@@ -2097,7 +2119,8 @@ function snapshot(n2, options) {
2097
2119
  onStylesheetLoad,
2098
2120
  stylesheetLoadTimeout,
2099
2121
  keepIframeSrcFn,
2100
- newlyAddedElement: false
2122
+ newlyAddedElement: false,
2123
+ captureBlockBoundingBoxes
2101
2124
  });
2102
2125
  }
2103
2126
  function getDefaultExportFromCjs$1(x2) {
@@ -10375,7 +10398,7 @@ const _MutationRateLimiter = class _MutationRateLimiter2 {
10375
10398
  __publicField(this, "exitMutTracker");
10376
10399
  __publicField(this, "interval", 50);
10377
10400
  __publicField(this, "exitInterval", 100);
10378
- __publicField(this, "mutThreshold", 350);
10401
+ __publicField(this, "mutThreshold", 250);
10379
10402
  __publicField(this, "inGlobalStorm", false);
10380
10403
  __publicField(this, "currentStormStartedAt", -1);
10381
10404
  __publicField(this, "stormTimeLimit", 5e3);
@@ -10668,11 +10691,12 @@ class MutationBuffer {
10668
10691
  __publicField(this, "canvasManager");
10669
10692
  __publicField(this, "processedNodeManager");
10670
10693
  __publicField(this, "unattachedDoc");
10694
+ __publicField(this, "captureBlockBoundingBoxes");
10671
10695
  __publicField(this, "bufId", makeid());
10672
10696
  __publicField(this, "stormBatches", []);
10673
10697
  __publicField(this, "stormInfo", null);
10674
10698
  __publicField(this, "stormSettings", {
10675
- batchSize: 250,
10699
+ batchSize: 50,
10676
10700
  //was 300
10677
10701
  timeout: 50,
10678
10702
  //was 50
@@ -10807,6 +10831,7 @@ class MutationBuffer {
10807
10831
  doc: this.doc,
10808
10832
  mirror: this.mirror,
10809
10833
  blockClass: this.blockClass,
10834
+ captureBlockBoundingBoxes: this.captureBlockBoundingBoxes,
10810
10835
  blockSelector: this.blockSelector,
10811
10836
  maskTextClass: this.maskTextClass,
10812
10837
  maskTextSelector: this.maskTextSelector,
@@ -11250,7 +11275,8 @@ class MutationBuffer {
11250
11275
  "stylesheetManager",
11251
11276
  "shadowDomManager",
11252
11277
  "canvasManager",
11253
- "processedNodeManager"
11278
+ "processedNodeManager",
11279
+ "captureBlockBoundingBoxes"
11254
11280
  ].forEach((key) => {
11255
11281
  this[key] = options[key];
11256
11282
  });
@@ -13086,6 +13112,7 @@ function record(options = {}) {
13086
13112
  checkoutEveryNms,
13087
13113
  checkoutEveryNth,
13088
13114
  blockClass = "rr-block",
13115
+ captureBlockBoundingBoxes = false,
13089
13116
  blockSelector = null,
13090
13117
  ignoreClass = "rr-ignore",
13091
13118
  ignoreSelector = null,
@@ -13296,7 +13323,8 @@ function record(options = {}) {
13296
13323
  stylesheetManager,
13297
13324
  canvasManager,
13298
13325
  keepIframeSrcFn,
13299
- processedNodeManager
13326
+ processedNodeManager,
13327
+ captureBlockBoundingBoxes
13300
13328
  },
13301
13329
  mirror
13302
13330
  });
@@ -13321,6 +13349,7 @@ function record(options = {}) {
13321
13349
  const node2 = snapshot(document, {
13322
13350
  mirror,
13323
13351
  blockClass,
13352
+ captureBlockBoundingBoxes,
13324
13353
  blockSelector,
13325
13354
  maskTextClass,
13326
13355
  maskTextSelector,
@@ -13474,6 +13503,7 @@ function record(options = {}) {
13474
13503
  processedNodeManager,
13475
13504
  canvasManager,
13476
13505
  ignoreCSSAttributes,
13506
+ captureBlockBoundingBoxes,
13477
13507
  plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
13478
13508
  observer: p.observer,
13479
13509
  options: p.options,