@glimt/record 0.0.85 → 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);
@@ -1682,18 +1685,28 @@ function serializeElementNode(n2, options) {
1682
1685
  }
1683
1686
  }
1684
1687
  if (needBlock) {
1685
- const { width, height, bottom, left, right, top, x: x2, y } = n2.getBoundingClientRect();
1688
+ const { width, height } = n2.getBoundingClientRect();
1686
1689
  attributes = {
1687
1690
  class: attributes.class,
1688
1691
  rr_width: `${width}px`,
1689
- rr_height: `${height}px`,
1690
- c_rr_top: `${top}px`,
1691
- c_rr_left: `${left}px`,
1692
- c_rr_bottom: `${bottom}px`,
1693
- c_rr_right: `${right}px`,
1694
- c_rr_x: `${x2}px`,
1695
- c_rr_y: `${y}px`
1692
+ rr_height: `${height}px`
1696
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
+ }
1697
1710
  }
1698
1711
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
1699
1712
  if (!n2.contentDocument) {
@@ -1780,7 +1793,8 @@ function serializeNodeWithId(n2, options) {
1780
1793
  stylesheetLoadTimeout = 5e3,
1781
1794
  keepIframeSrcFn = () => false,
1782
1795
  newlyAddedElement = false,
1783
- cssCaptured = false
1796
+ cssCaptured = false,
1797
+ captureBlockBoundingBoxes = false
1784
1798
  } = options;
1785
1799
  let { needsMask } = options;
1786
1800
  let { preserveWhiteSpace = true } = options;
@@ -1808,7 +1822,8 @@ function serializeNodeWithId(n2, options) {
1808
1822
  recordCanvas,
1809
1823
  keepIframeSrcFn,
1810
1824
  newlyAddedElement,
1811
- cssCaptured
1825
+ cssCaptured,
1826
+ captureBlockBoundingBoxes
1812
1827
  });
1813
1828
  if (!_serializedNode) {
1814
1829
  if (isDebug$1()) console.warn(n2, "not serialized");
@@ -2009,7 +2024,8 @@ function snapshot(n2, options) {
2009
2024
  iframeLoadTimeout,
2010
2025
  onStylesheetLoad,
2011
2026
  stylesheetLoadTimeout,
2012
- keepIframeSrcFn = () => false
2027
+ keepIframeSrcFn = () => false,
2028
+ captureBlockBoundingBoxes = false
2013
2029
  } = options || {};
2014
2030
  const maskInputOptions = maskAllInputs === true ? {
2015
2031
  color: true,
@@ -2070,7 +2086,8 @@ function snapshot(n2, options) {
2070
2086
  onStylesheetLoad,
2071
2087
  stylesheetLoadTimeout,
2072
2088
  keepIframeSrcFn,
2073
- newlyAddedElement: false
2089
+ newlyAddedElement: false,
2090
+ captureBlockBoundingBoxes
2074
2091
  });
2075
2092
  }
2076
2093
  function getDefaultExportFromCjs$1(x2) {
@@ -10632,6 +10649,7 @@ class MutationBuffer {
10632
10649
  __publicField(this, "canvasManager");
10633
10650
  __publicField(this, "processedNodeManager");
10634
10651
  __publicField(this, "unattachedDoc");
10652
+ __publicField(this, "captureBlockBoundingBoxes");
10635
10653
  __publicField(this, "bufId", makeid());
10636
10654
  __publicField(this, "stormBatches", []);
10637
10655
  __publicField(this, "stormInfo", null);
@@ -10771,6 +10789,7 @@ class MutationBuffer {
10771
10789
  doc: this.doc,
10772
10790
  mirror: this.mirror,
10773
10791
  blockClass: this.blockClass,
10792
+ captureBlockBoundingBoxes: this.captureBlockBoundingBoxes,
10774
10793
  blockSelector: this.blockSelector,
10775
10794
  maskTextClass: this.maskTextClass,
10776
10795
  maskTextSelector: this.maskTextSelector,
@@ -11214,7 +11233,8 @@ class MutationBuffer {
11214
11233
  "stylesheetManager",
11215
11234
  "shadowDomManager",
11216
11235
  "canvasManager",
11217
- "processedNodeManager"
11236
+ "processedNodeManager",
11237
+ "captureBlockBoundingBoxes"
11218
11238
  ].forEach((key) => {
11219
11239
  this[key] = options[key];
11220
11240
  });
@@ -13054,6 +13074,7 @@ function record(options = {}) {
13054
13074
  checkoutEveryNms,
13055
13075
  checkoutEveryNth,
13056
13076
  blockClass = "rr-block",
13077
+ captureBlockBoundingBoxes = false,
13057
13078
  blockSelector = null,
13058
13079
  ignoreClass = "rr-ignore",
13059
13080
  ignoreSelector = null,
@@ -13267,7 +13288,8 @@ function record(options = {}) {
13267
13288
  stylesheetManager,
13268
13289
  canvasManager,
13269
13290
  keepIframeSrcFn,
13270
- processedNodeManager
13291
+ processedNodeManager,
13292
+ captureBlockBoundingBoxes
13271
13293
  },
13272
13294
  mirror
13273
13295
  });
@@ -13292,6 +13314,7 @@ function record(options = {}) {
13292
13314
  const node2 = snapshot(document, {
13293
13315
  mirror,
13294
13316
  blockClass,
13317
+ captureBlockBoundingBoxes,
13295
13318
  blockSelector,
13296
13319
  maskTextClass,
13297
13320
  maskTextSelector,
@@ -13454,6 +13477,7 @@ function record(options = {}) {
13454
13477
  processedNodeManager,
13455
13478
  canvasManager,
13456
13479
  ignoreCSSAttributes,
13480
+ captureBlockBoundingBoxes,
13457
13481
  plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
13458
13482
  observer: p.observer,
13459
13483
  options: p.options,