@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.
@@ -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);
@@ -1715,18 +1718,28 @@ function serializeElementNode(n2, options) {
1715
1718
  }
1716
1719
  }
1717
1720
  if (needBlock) {
1718
- const { width, height, bottom, left, right, top, x: x2, y } = n2.getBoundingClientRect();
1721
+ const { width, height } = n2.getBoundingClientRect();
1719
1722
  attributes = {
1720
1723
  class: attributes.class,
1721
1724
  rr_width: `${width}px`,
1722
- rr_height: `${height}px`,
1723
- c_rr_top: `${top}px`,
1724
- c_rr_left: `${left}px`,
1725
- c_rr_bottom: `${bottom}px`,
1726
- c_rr_right: `${right}px`,
1727
- c_rr_x: `${x2}px`,
1728
- c_rr_y: `${y}px`
1725
+ rr_height: `${height}px`
1729
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
+ }
1730
1743
  }
1731
1744
  if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
1732
1745
  if (!n2.contentDocument) {
@@ -1813,7 +1826,8 @@ function serializeNodeWithId(n2, options) {
1813
1826
  stylesheetLoadTimeout = 5e3,
1814
1827
  keepIframeSrcFn = () => false,
1815
1828
  newlyAddedElement = false,
1816
- cssCaptured = false
1829
+ cssCaptured = false,
1830
+ captureBlockBoundingBoxes = false
1817
1831
  } = options;
1818
1832
  let { needsMask } = options;
1819
1833
  let { preserveWhiteSpace = true } = options;
@@ -1841,7 +1855,8 @@ function serializeNodeWithId(n2, options) {
1841
1855
  recordCanvas,
1842
1856
  keepIframeSrcFn,
1843
1857
  newlyAddedElement,
1844
- cssCaptured
1858
+ cssCaptured,
1859
+ captureBlockBoundingBoxes
1845
1860
  });
1846
1861
  if (!_serializedNode) {
1847
1862
  if (isDebug$1()) console.warn(n2, "not serialized");
@@ -2042,7 +2057,8 @@ function snapshot(n2, options) {
2042
2057
  iframeLoadTimeout,
2043
2058
  onStylesheetLoad,
2044
2059
  stylesheetLoadTimeout,
2045
- keepIframeSrcFn = () => false
2060
+ keepIframeSrcFn = () => false,
2061
+ captureBlockBoundingBoxes = false
2046
2062
  } = options || {};
2047
2063
  const maskInputOptions = maskAllInputs === true ? {
2048
2064
  color: true,
@@ -2103,7 +2119,8 @@ function snapshot(n2, options) {
2103
2119
  onStylesheetLoad,
2104
2120
  stylesheetLoadTimeout,
2105
2121
  keepIframeSrcFn,
2106
- newlyAddedElement: false
2122
+ newlyAddedElement: false,
2123
+ captureBlockBoundingBoxes
2107
2124
  });
2108
2125
  }
2109
2126
  function getDefaultExportFromCjs$1(x2) {
@@ -10674,6 +10691,7 @@ class MutationBuffer {
10674
10691
  __publicField(this, "canvasManager");
10675
10692
  __publicField(this, "processedNodeManager");
10676
10693
  __publicField(this, "unattachedDoc");
10694
+ __publicField(this, "captureBlockBoundingBoxes");
10677
10695
  __publicField(this, "bufId", makeid());
10678
10696
  __publicField(this, "stormBatches", []);
10679
10697
  __publicField(this, "stormInfo", null);
@@ -10813,6 +10831,7 @@ class MutationBuffer {
10813
10831
  doc: this.doc,
10814
10832
  mirror: this.mirror,
10815
10833
  blockClass: this.blockClass,
10834
+ captureBlockBoundingBoxes: this.captureBlockBoundingBoxes,
10816
10835
  blockSelector: this.blockSelector,
10817
10836
  maskTextClass: this.maskTextClass,
10818
10837
  maskTextSelector: this.maskTextSelector,
@@ -11256,7 +11275,8 @@ class MutationBuffer {
11256
11275
  "stylesheetManager",
11257
11276
  "shadowDomManager",
11258
11277
  "canvasManager",
11259
- "processedNodeManager"
11278
+ "processedNodeManager",
11279
+ "captureBlockBoundingBoxes"
11260
11280
  ].forEach((key) => {
11261
11281
  this[key] = options[key];
11262
11282
  });
@@ -13092,6 +13112,7 @@ function record(options = {}) {
13092
13112
  checkoutEveryNms,
13093
13113
  checkoutEveryNth,
13094
13114
  blockClass = "rr-block",
13115
+ captureBlockBoundingBoxes = false,
13095
13116
  blockSelector = null,
13096
13117
  ignoreClass = "rr-ignore",
13097
13118
  ignoreSelector = null,
@@ -13302,7 +13323,8 @@ function record(options = {}) {
13302
13323
  stylesheetManager,
13303
13324
  canvasManager,
13304
13325
  keepIframeSrcFn,
13305
- processedNodeManager
13326
+ processedNodeManager,
13327
+ captureBlockBoundingBoxes
13306
13328
  },
13307
13329
  mirror
13308
13330
  });
@@ -13327,6 +13349,7 @@ function record(options = {}) {
13327
13349
  const node2 = snapshot(document, {
13328
13350
  mirror,
13329
13351
  blockClass,
13352
+ captureBlockBoundingBoxes,
13330
13353
  blockSelector,
13331
13354
  maskTextClass,
13332
13355
  maskTextSelector,
@@ -13480,6 +13503,7 @@ function record(options = {}) {
13480
13503
  processedNodeManager,
13481
13504
  canvasManager,
13482
13505
  ignoreCSSAttributes,
13506
+ captureBlockBoundingBoxes,
13483
13507
  plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
13484
13508
  observer: p.observer,
13485
13509
  options: p.options,