@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.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);
@@ -1680,18 +1683,28 @@ function serializeElementNode(n2, options) {
1680
1683
  }
1681
1684
  }
1682
1685
  if (needBlock) {
1683
- const { width, height, bottom, left, right, top, x: x2, y } = n2.getBoundingClientRect();
1686
+ const { width, height } = n2.getBoundingClientRect();
1684
1687
  attributes = {
1685
1688
  class: attributes.class,
1686
1689
  rr_width: `${width}px`,
1687
- rr_height: `${height}px`,
1688
- c_rr_top: `${top}px`,
1689
- c_rr_left: `${left}px`,
1690
- c_rr_bottom: `${bottom}px`,
1691
- c_rr_right: `${right}px`,
1692
- c_rr_x: `${x2}px`,
1693
- c_rr_y: `${y}px`
1690
+ rr_height: `${height}px`
1694
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
+ }
1695
1708
  }
1696
1709
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
1697
1710
  if (!n2.contentDocument) {
@@ -1778,7 +1791,8 @@ function serializeNodeWithId(n2, options) {
1778
1791
  stylesheetLoadTimeout = 5e3,
1779
1792
  keepIframeSrcFn = () => false,
1780
1793
  newlyAddedElement = false,
1781
- cssCaptured = false
1794
+ cssCaptured = false,
1795
+ captureBlockBoundingBoxes = false
1782
1796
  } = options;
1783
1797
  let { needsMask } = options;
1784
1798
  let { preserveWhiteSpace = true } = options;
@@ -1806,7 +1820,8 @@ function serializeNodeWithId(n2, options) {
1806
1820
  recordCanvas,
1807
1821
  keepIframeSrcFn,
1808
1822
  newlyAddedElement,
1809
- cssCaptured
1823
+ cssCaptured,
1824
+ captureBlockBoundingBoxes
1810
1825
  });
1811
1826
  if (!_serializedNode) {
1812
1827
  if (isDebug$1()) console.warn(n2, "not serialized");
@@ -2007,7 +2022,8 @@ function snapshot(n2, options) {
2007
2022
  iframeLoadTimeout,
2008
2023
  onStylesheetLoad,
2009
2024
  stylesheetLoadTimeout,
2010
- keepIframeSrcFn = () => false
2025
+ keepIframeSrcFn = () => false,
2026
+ captureBlockBoundingBoxes = false
2011
2027
  } = options || {};
2012
2028
  const maskInputOptions = maskAllInputs === true ? {
2013
2029
  color: true,
@@ -2068,7 +2084,8 @@ function snapshot(n2, options) {
2068
2084
  onStylesheetLoad,
2069
2085
  stylesheetLoadTimeout,
2070
2086
  keepIframeSrcFn,
2071
- newlyAddedElement: false
2087
+ newlyAddedElement: false,
2088
+ captureBlockBoundingBoxes
2072
2089
  });
2073
2090
  }
2074
2091
  function getDefaultExportFromCjs$1(x2) {
@@ -10630,6 +10647,7 @@ class MutationBuffer {
10630
10647
  __publicField(this, "canvasManager");
10631
10648
  __publicField(this, "processedNodeManager");
10632
10649
  __publicField(this, "unattachedDoc");
10650
+ __publicField(this, "captureBlockBoundingBoxes");
10633
10651
  __publicField(this, "bufId", makeid());
10634
10652
  __publicField(this, "stormBatches", []);
10635
10653
  __publicField(this, "stormInfo", null);
@@ -10769,6 +10787,7 @@ class MutationBuffer {
10769
10787
  doc: this.doc,
10770
10788
  mirror: this.mirror,
10771
10789
  blockClass: this.blockClass,
10790
+ captureBlockBoundingBoxes: this.captureBlockBoundingBoxes,
10772
10791
  blockSelector: this.blockSelector,
10773
10792
  maskTextClass: this.maskTextClass,
10774
10793
  maskTextSelector: this.maskTextSelector,
@@ -11212,7 +11231,8 @@ class MutationBuffer {
11212
11231
  "stylesheetManager",
11213
11232
  "shadowDomManager",
11214
11233
  "canvasManager",
11215
- "processedNodeManager"
11234
+ "processedNodeManager",
11235
+ "captureBlockBoundingBoxes"
11216
11236
  ].forEach((key) => {
11217
11237
  this[key] = options[key];
11218
11238
  });
@@ -13052,6 +13072,7 @@ function record(options = {}) {
13052
13072
  checkoutEveryNms,
13053
13073
  checkoutEveryNth,
13054
13074
  blockClass = "rr-block",
13075
+ captureBlockBoundingBoxes = false,
13055
13076
  blockSelector = null,
13056
13077
  ignoreClass = "rr-ignore",
13057
13078
  ignoreSelector = null,
@@ -13265,7 +13286,8 @@ function record(options = {}) {
13265
13286
  stylesheetManager,
13266
13287
  canvasManager,
13267
13288
  keepIframeSrcFn,
13268
- processedNodeManager
13289
+ processedNodeManager,
13290
+ captureBlockBoundingBoxes
13269
13291
  },
13270
13292
  mirror
13271
13293
  });
@@ -13290,6 +13312,7 @@ function record(options = {}) {
13290
13312
  const node2 = snapshot(document, {
13291
13313
  mirror,
13292
13314
  blockClass,
13315
+ captureBlockBoundingBoxes,
13293
13316
  blockSelector,
13294
13317
  maskTextClass,
13295
13318
  maskTextSelector,
@@ -13452,6 +13475,7 @@ function record(options = {}) {
13452
13475
  processedNodeManager,
13453
13476
  canvasManager,
13454
13477
  ignoreCSSAttributes,
13478
+ captureBlockBoundingBoxes,
13455
13479
  plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
13456
13480
  observer: p.observer,
13457
13481
  options: p.options,