@appsurify-testmap/rrweb-record 2.0.0-alpha.30 → 2.0.0-alpha.32

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.
@@ -51,46 +51,6 @@ var _a;
51
51
  var __defProp$1 = Object.defineProperty;
52
52
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
53
53
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
54
- var InteractiveEvent = /* @__PURE__ */ ((InteractiveEvent2) => {
55
- InteractiveEvent2[InteractiveEvent2["Change"] = 0] = "Change";
56
- InteractiveEvent2[InteractiveEvent2["Submit"] = 1] = "Submit";
57
- InteractiveEvent2[InteractiveEvent2["DragStart"] = 2] = "DragStart";
58
- InteractiveEvent2[InteractiveEvent2["Drop"] = 3] = "Drop";
59
- InteractiveEvent2[InteractiveEvent2["PointerDown"] = 4] = "PointerDown";
60
- InteractiveEvent2[InteractiveEvent2["PointerUp"] = 5] = "PointerUp";
61
- InteractiveEvent2[InteractiveEvent2["Input"] = 6] = "Input";
62
- InteractiveEvent2[InteractiveEvent2["KeyDown"] = 7] = "KeyDown";
63
- InteractiveEvent2[InteractiveEvent2["KeyUp"] = 8] = "KeyUp";
64
- InteractiveEvent2[InteractiveEvent2["KeyPress"] = 9] = "KeyPress";
65
- InteractiveEvent2[InteractiveEvent2["MouseEnter"] = 10] = "MouseEnter";
66
- InteractiveEvent2[InteractiveEvent2["MouseLeave"] = 11] = "MouseLeave";
67
- InteractiveEvent2[InteractiveEvent2["MouseUp"] = 12] = "MouseUp";
68
- InteractiveEvent2[InteractiveEvent2["MouseDown"] = 13] = "MouseDown";
69
- InteractiveEvent2[InteractiveEvent2["Click"] = 14] = "Click";
70
- InteractiveEvent2[InteractiveEvent2["ContextMenu"] = 15] = "ContextMenu";
71
- InteractiveEvent2[InteractiveEvent2["DblClick"] = 16] = "DblClick";
72
- InteractiveEvent2[InteractiveEvent2["Focus"] = 17] = "Focus";
73
- InteractiveEvent2[InteractiveEvent2["Blur"] = 18] = "Blur";
74
- InteractiveEvent2[InteractiveEvent2["TouchStart"] = 19] = "TouchStart";
75
- InteractiveEvent2[InteractiveEvent2["TouchMove"] = 20] = "TouchMove";
76
- InteractiveEvent2[InteractiveEvent2["TouchEnd"] = 21] = "TouchEnd";
77
- InteractiveEvent2[InteractiveEvent2["TouchCancel"] = 22] = "TouchCancel";
78
- return InteractiveEvent2;
79
- })(InteractiveEvent || {});
80
- var interactiveTag = /* @__PURE__ */ ((interactiveTag2) => {
81
- interactiveTag2[interactiveTag2["Input"] = 0] = "Input";
82
- interactiveTag2[interactiveTag2["Button"] = 1] = "Button";
83
- interactiveTag2[interactiveTag2["A"] = 2] = "A";
84
- interactiveTag2[interactiveTag2["Select"] = 3] = "Select";
85
- interactiveTag2[interactiveTag2["Textarea"] = 4] = "Textarea";
86
- interactiveTag2[interactiveTag2["Label"] = 5] = "Label";
87
- interactiveTag2[interactiveTag2["Details"] = 6] = "Details";
88
- interactiveTag2[interactiveTag2["Summary"] = 7] = "Summary";
89
- interactiveTag2[interactiveTag2["Dialog"] = 8] = "Dialog";
90
- interactiveTag2[interactiveTag2["Video"] = 9] = "Video";
91
- interactiveTag2[interactiveTag2["Audio"] = 10] = "Audio";
92
- return interactiveTag2;
93
- })(interactiveTag || {});
94
54
  var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
95
55
  NodeType2[NodeType2["Document"] = 0] = "Document";
96
56
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
@@ -671,32 +631,93 @@ function isStyleVisible(n2) {
671
631
  function isRectVisible(rect) {
672
632
  return rect.width > 0 && rect.height > 0 && rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
673
633
  }
674
- function getInteractiveEvents() {
675
- return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
676
- }
677
- function getInteractiveTags() {
678
- return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
679
- }
634
+ const interactiveEvents$1 = [
635
+ "change",
636
+ "submit",
637
+ "dragstart",
638
+ "drop",
639
+ "pointerdown",
640
+ "pointerup",
641
+ "input",
642
+ "keydown",
643
+ "keyup",
644
+ "keypress",
645
+ "mouseenter",
646
+ "mouseleave",
647
+ "mouseup",
648
+ "mousedown",
649
+ "click",
650
+ "contextmenu",
651
+ "dblclick",
652
+ "focus",
653
+ "blur",
654
+ "touchstart",
655
+ "touchmove",
656
+ "touchend",
657
+ "touchcancel"
658
+ ];
659
+ const interactiveTags = [
660
+ "a",
661
+ "button",
662
+ "input",
663
+ "select",
664
+ "textarea",
665
+ "label",
666
+ "details",
667
+ "summary",
668
+ "dialog",
669
+ "video",
670
+ "audio"
671
+ ];
672
+ const inlineEventAttributes$1 = [
673
+ "onclick",
674
+ "ondblclick",
675
+ "onmousedown",
676
+ "onmouseup",
677
+ "onmouseover",
678
+ "onmouseout",
679
+ "onmousemove",
680
+ "onfocus",
681
+ "onblur",
682
+ "onkeydown",
683
+ "onkeypress",
684
+ "onkeyup",
685
+ "onchange",
686
+ "oninput",
687
+ "onsubmit",
688
+ "onreset",
689
+ "onselect",
690
+ "oncontextmenu",
691
+ "ontouchstart",
692
+ "ontouchmove",
693
+ "ontouchend",
694
+ "ontouchcancel"
695
+ ];
696
+ const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
697
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
698
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
699
+ originalAddEventListener$1.call(this, type, listener, options);
700
+ if (this instanceof Element) {
701
+ const eventType = type.toLowerCase();
702
+ if (interactiveEvents$1.includes(eventType)) {
703
+ interactiveElementsRegistry$1.add(this);
704
+ }
705
+ }
706
+ };
707
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
708
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
709
+ originalRemoveEventListener$1.call(this, type, listener, options);
710
+ };
680
711
  function hasEventListeners(n2) {
681
- return getInteractiveEvents().some((eventType) => {
682
- let hasListener = false;
683
- const testListener = () => {
684
- hasListener = true;
685
- };
686
- n2.addEventListener(eventType, testListener);
687
- n2.dispatchEvent(new Event(eventType));
688
- n2.removeEventListener(eventType, testListener);
689
- return hasListener;
690
- });
712
+ return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
691
713
  }
692
714
  function isElementInteractive(n2) {
693
715
  var _a2;
694
- const allowedTags = getInteractiveTags();
695
716
  if (n2.nodeType === Node.ELEMENT_NODE) {
696
717
  const element = n2;
697
718
  const tagName = element.tagName.toLowerCase();
698
- if (!allowedTags.includes(tagName)) {
699
- return false;
719
+ if (interactiveTags.includes(tagName)) {
720
+ return true;
700
721
  }
701
722
  const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
702
723
  const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
@@ -708,10 +729,28 @@ function isElementInteractive(n2) {
708
729
  if (n2.nodeType === Node.TEXT_NODE) {
709
730
  const textNode = n2;
710
731
  const parentElement2 = textNode.parentElement;
711
- return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
732
+ if (parentElement2 !== null && interactiveTags.includes(parentElement2.tagName.toLowerCase())) {
733
+ return true;
734
+ }
735
+ return parentElement2 !== null && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
712
736
  }
713
737
  return false;
714
738
  }
739
+ function inspectInlineEventHandlers$1() {
740
+ const allElements = document.querySelectorAll("*");
741
+ allElements.forEach((el) => {
742
+ inlineEventAttributes$1.forEach((attr) => {
743
+ if (el.hasAttribute(attr)) {
744
+ interactiveElementsRegistry$1.add(el);
745
+ }
746
+ });
747
+ });
748
+ }
749
+ if (document.readyState === "complete" || document.readyState === "interactive") {
750
+ inspectInlineEventHandlers$1();
751
+ } else {
752
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
753
+ }
715
754
  let _id = 1;
716
755
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
717
756
  const IGNORED_NODE = -2;
@@ -5178,6 +5217,85 @@ postcss$1$1.Node;
5178
5217
  var __defProp22 = Object.defineProperty;
5179
5218
  var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5180
5219
  var __publicField2 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
5220
+ const interactiveEvents = [
5221
+ "change",
5222
+ "submit",
5223
+ "dragstart",
5224
+ "drop",
5225
+ "pointerdown",
5226
+ "pointerup",
5227
+ "input",
5228
+ "keydown",
5229
+ "keyup",
5230
+ "keypress",
5231
+ "mouseenter",
5232
+ "mouseleave",
5233
+ "mouseup",
5234
+ "mousedown",
5235
+ "click",
5236
+ "contextmenu",
5237
+ "dblclick",
5238
+ "focus",
5239
+ "blur",
5240
+ "touchstart",
5241
+ "touchmove",
5242
+ "touchend",
5243
+ "touchcancel"
5244
+ ];
5245
+ const inlineEventAttributes = [
5246
+ "onclick",
5247
+ "ondblclick",
5248
+ "onmousedown",
5249
+ "onmouseup",
5250
+ "onmouseover",
5251
+ "onmouseout",
5252
+ "onmousemove",
5253
+ "onfocus",
5254
+ "onblur",
5255
+ "onkeydown",
5256
+ "onkeypress",
5257
+ "onkeyup",
5258
+ "onchange",
5259
+ "oninput",
5260
+ "onsubmit",
5261
+ "onreset",
5262
+ "onselect",
5263
+ "oncontextmenu",
5264
+ "ontouchstart",
5265
+ "ontouchmove",
5266
+ "ontouchend",
5267
+ "ontouchcancel"
5268
+ ];
5269
+ const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5270
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5271
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5272
+ originalAddEventListener.call(this, type, listener, options);
5273
+ if (this instanceof Element) {
5274
+ const eventType = type.toLowerCase();
5275
+ if (interactiveEvents.includes(eventType)) {
5276
+ interactiveElementsRegistry.add(this);
5277
+ }
5278
+ }
5279
+ };
5280
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5281
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5282
+ originalRemoveEventListener.call(this, type, listener, options);
5283
+ };
5284
+ function inspectInlineEventHandlers() {
5285
+ const allElements = document.querySelectorAll("*");
5286
+ allElements.forEach((el) => {
5287
+ inlineEventAttributes.forEach((attr) => {
5288
+ if (el.hasAttribute(attr)) {
5289
+ interactiveElementsRegistry.add(el);
5290
+ }
5291
+ });
5292
+ });
5293
+ }
5294
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5295
+ inspectInlineEventHandlers();
5296
+ } else {
5297
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5298
+ }
5181
5299
  function getDefaultExportFromCjs(x2) {
5182
5300
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5183
5301
  }
@@ -10049,6 +10167,7 @@ function initMouseInteractionObserver({
10049
10167
  }) {
10050
10168
  if (sampling.mouseInteraction === false) {
10051
10169
  return () => {
10170
+ console.debug("MouseInteractionObserver: No operation needed");
10052
10171
  };
10053
10172
  }
10054
10173
  const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;