@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.
@@ -7,46 +7,6 @@ var _a;
7
7
  var __defProp$1 = Object.defineProperty;
8
8
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
9
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
10
- var InteractiveEvent = /* @__PURE__ */ ((InteractiveEvent2) => {
11
- InteractiveEvent2[InteractiveEvent2["Change"] = 0] = "Change";
12
- InteractiveEvent2[InteractiveEvent2["Submit"] = 1] = "Submit";
13
- InteractiveEvent2[InteractiveEvent2["DragStart"] = 2] = "DragStart";
14
- InteractiveEvent2[InteractiveEvent2["Drop"] = 3] = "Drop";
15
- InteractiveEvent2[InteractiveEvent2["PointerDown"] = 4] = "PointerDown";
16
- InteractiveEvent2[InteractiveEvent2["PointerUp"] = 5] = "PointerUp";
17
- InteractiveEvent2[InteractiveEvent2["Input"] = 6] = "Input";
18
- InteractiveEvent2[InteractiveEvent2["KeyDown"] = 7] = "KeyDown";
19
- InteractiveEvent2[InteractiveEvent2["KeyUp"] = 8] = "KeyUp";
20
- InteractiveEvent2[InteractiveEvent2["KeyPress"] = 9] = "KeyPress";
21
- InteractiveEvent2[InteractiveEvent2["MouseEnter"] = 10] = "MouseEnter";
22
- InteractiveEvent2[InteractiveEvent2["MouseLeave"] = 11] = "MouseLeave";
23
- InteractiveEvent2[InteractiveEvent2["MouseUp"] = 12] = "MouseUp";
24
- InteractiveEvent2[InteractiveEvent2["MouseDown"] = 13] = "MouseDown";
25
- InteractiveEvent2[InteractiveEvent2["Click"] = 14] = "Click";
26
- InteractiveEvent2[InteractiveEvent2["ContextMenu"] = 15] = "ContextMenu";
27
- InteractiveEvent2[InteractiveEvent2["DblClick"] = 16] = "DblClick";
28
- InteractiveEvent2[InteractiveEvent2["Focus"] = 17] = "Focus";
29
- InteractiveEvent2[InteractiveEvent2["Blur"] = 18] = "Blur";
30
- InteractiveEvent2[InteractiveEvent2["TouchStart"] = 19] = "TouchStart";
31
- InteractiveEvent2[InteractiveEvent2["TouchMove"] = 20] = "TouchMove";
32
- InteractiveEvent2[InteractiveEvent2["TouchEnd"] = 21] = "TouchEnd";
33
- InteractiveEvent2[InteractiveEvent2["TouchCancel"] = 22] = "TouchCancel";
34
- return InteractiveEvent2;
35
- })(InteractiveEvent || {});
36
- var interactiveTag = /* @__PURE__ */ ((interactiveTag2) => {
37
- interactiveTag2[interactiveTag2["Input"] = 0] = "Input";
38
- interactiveTag2[interactiveTag2["Button"] = 1] = "Button";
39
- interactiveTag2[interactiveTag2["A"] = 2] = "A";
40
- interactiveTag2[interactiveTag2["Select"] = 3] = "Select";
41
- interactiveTag2[interactiveTag2["Textarea"] = 4] = "Textarea";
42
- interactiveTag2[interactiveTag2["Label"] = 5] = "Label";
43
- interactiveTag2[interactiveTag2["Details"] = 6] = "Details";
44
- interactiveTag2[interactiveTag2["Summary"] = 7] = "Summary";
45
- interactiveTag2[interactiveTag2["Dialog"] = 8] = "Dialog";
46
- interactiveTag2[interactiveTag2["Video"] = 9] = "Video";
47
- interactiveTag2[interactiveTag2["Audio"] = 10] = "Audio";
48
- return interactiveTag2;
49
- })(interactiveTag || {});
50
10
  var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
51
11
  NodeType2[NodeType2["Document"] = 0] = "Document";
52
12
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
@@ -626,32 +586,93 @@ function isStyleVisible(n2) {
626
586
  function isRectVisible(rect) {
627
587
  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);
628
588
  }
629
- function getInteractiveEvents() {
630
- return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
631
- }
632
- function getInteractiveTags() {
633
- return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
634
- }
589
+ const interactiveEvents$1 = [
590
+ "change",
591
+ "submit",
592
+ "dragstart",
593
+ "drop",
594
+ "pointerdown",
595
+ "pointerup",
596
+ "input",
597
+ "keydown",
598
+ "keyup",
599
+ "keypress",
600
+ "mouseenter",
601
+ "mouseleave",
602
+ "mouseup",
603
+ "mousedown",
604
+ "click",
605
+ "contextmenu",
606
+ "dblclick",
607
+ "focus",
608
+ "blur",
609
+ "touchstart",
610
+ "touchmove",
611
+ "touchend",
612
+ "touchcancel"
613
+ ];
614
+ const interactiveTags = [
615
+ "a",
616
+ "button",
617
+ "input",
618
+ "select",
619
+ "textarea",
620
+ "label",
621
+ "details",
622
+ "summary",
623
+ "dialog",
624
+ "video",
625
+ "audio"
626
+ ];
627
+ const inlineEventAttributes$1 = [
628
+ "onclick",
629
+ "ondblclick",
630
+ "onmousedown",
631
+ "onmouseup",
632
+ "onmouseover",
633
+ "onmouseout",
634
+ "onmousemove",
635
+ "onfocus",
636
+ "onblur",
637
+ "onkeydown",
638
+ "onkeypress",
639
+ "onkeyup",
640
+ "onchange",
641
+ "oninput",
642
+ "onsubmit",
643
+ "onreset",
644
+ "onselect",
645
+ "oncontextmenu",
646
+ "ontouchstart",
647
+ "ontouchmove",
648
+ "ontouchend",
649
+ "ontouchcancel"
650
+ ];
651
+ const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
652
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
653
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
654
+ originalAddEventListener$1.call(this, type, listener, options);
655
+ if (this instanceof Element) {
656
+ const eventType = type.toLowerCase();
657
+ if (interactiveEvents$1.includes(eventType)) {
658
+ interactiveElementsRegistry$1.add(this);
659
+ }
660
+ }
661
+ };
662
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
663
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
664
+ originalRemoveEventListener$1.call(this, type, listener, options);
665
+ };
635
666
  function hasEventListeners(n2) {
636
- return getInteractiveEvents().some((eventType) => {
637
- let hasListener = false;
638
- const testListener = () => {
639
- hasListener = true;
640
- };
641
- n2.addEventListener(eventType, testListener);
642
- n2.dispatchEvent(new Event(eventType));
643
- n2.removeEventListener(eventType, testListener);
644
- return hasListener;
645
- });
667
+ return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
646
668
  }
647
669
  function isElementInteractive(n2) {
648
670
  var _a2;
649
- const allowedTags = getInteractiveTags();
650
671
  if (n2.nodeType === Node.ELEMENT_NODE) {
651
672
  const element = n2;
652
673
  const tagName = element.tagName.toLowerCase();
653
- if (!allowedTags.includes(tagName)) {
654
- return false;
674
+ if (interactiveTags.includes(tagName)) {
675
+ return true;
655
676
  }
656
677
  const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
657
678
  const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
@@ -663,10 +684,28 @@ function isElementInteractive(n2) {
663
684
  if (n2.nodeType === Node.TEXT_NODE) {
664
685
  const textNode = n2;
665
686
  const parentElement2 = textNode.parentElement;
666
- return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
687
+ if (parentElement2 !== null && interactiveTags.includes(parentElement2.tagName.toLowerCase())) {
688
+ return true;
689
+ }
690
+ return parentElement2 !== null && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
667
691
  }
668
692
  return false;
669
693
  }
694
+ function inspectInlineEventHandlers$1() {
695
+ const allElements = document.querySelectorAll("*");
696
+ allElements.forEach((el) => {
697
+ inlineEventAttributes$1.forEach((attr) => {
698
+ if (el.hasAttribute(attr)) {
699
+ interactiveElementsRegistry$1.add(el);
700
+ }
701
+ });
702
+ });
703
+ }
704
+ if (document.readyState === "complete" || document.readyState === "interactive") {
705
+ inspectInlineEventHandlers$1();
706
+ } else {
707
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
708
+ }
670
709
  let _id = 1;
671
710
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
672
711
  const IGNORED_NODE = -2;
@@ -5129,6 +5168,85 @@ postcss$1$1.Node;
5129
5168
  var __defProp2 = Object.defineProperty;
5130
5169
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5131
5170
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
5171
+ const interactiveEvents = [
5172
+ "change",
5173
+ "submit",
5174
+ "dragstart",
5175
+ "drop",
5176
+ "pointerdown",
5177
+ "pointerup",
5178
+ "input",
5179
+ "keydown",
5180
+ "keyup",
5181
+ "keypress",
5182
+ "mouseenter",
5183
+ "mouseleave",
5184
+ "mouseup",
5185
+ "mousedown",
5186
+ "click",
5187
+ "contextmenu",
5188
+ "dblclick",
5189
+ "focus",
5190
+ "blur",
5191
+ "touchstart",
5192
+ "touchmove",
5193
+ "touchend",
5194
+ "touchcancel"
5195
+ ];
5196
+ const inlineEventAttributes = [
5197
+ "onclick",
5198
+ "ondblclick",
5199
+ "onmousedown",
5200
+ "onmouseup",
5201
+ "onmouseover",
5202
+ "onmouseout",
5203
+ "onmousemove",
5204
+ "onfocus",
5205
+ "onblur",
5206
+ "onkeydown",
5207
+ "onkeypress",
5208
+ "onkeyup",
5209
+ "onchange",
5210
+ "oninput",
5211
+ "onsubmit",
5212
+ "onreset",
5213
+ "onselect",
5214
+ "oncontextmenu",
5215
+ "ontouchstart",
5216
+ "ontouchmove",
5217
+ "ontouchend",
5218
+ "ontouchcancel"
5219
+ ];
5220
+ const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5221
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5222
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5223
+ originalAddEventListener.call(this, type, listener, options);
5224
+ if (this instanceof Element) {
5225
+ const eventType = type.toLowerCase();
5226
+ if (interactiveEvents.includes(eventType)) {
5227
+ interactiveElementsRegistry.add(this);
5228
+ }
5229
+ }
5230
+ };
5231
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5232
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5233
+ originalRemoveEventListener.call(this, type, listener, options);
5234
+ };
5235
+ function inspectInlineEventHandlers() {
5236
+ const allElements = document.querySelectorAll("*");
5237
+ allElements.forEach((el) => {
5238
+ inlineEventAttributes.forEach((attr) => {
5239
+ if (el.hasAttribute(attr)) {
5240
+ interactiveElementsRegistry.add(el);
5241
+ }
5242
+ });
5243
+ });
5244
+ }
5245
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5246
+ inspectInlineEventHandlers();
5247
+ } else {
5248
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5249
+ }
5132
5250
  function getDefaultExportFromCjs(x2) {
5133
5251
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5134
5252
  }
@@ -9995,6 +10113,7 @@ function initMouseInteractionObserver({
9995
10113
  }) {
9996
10114
  if (sampling.mouseInteraction === false) {
9997
10115
  return () => {
10116
+ console.debug("MouseInteractionObserver: No operation needed");
9998
10117
  };
9999
10118
  }
10000
10119
  const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;