@appsurify-testmap/rrweb 2.0.0-alpha.30 → 2.0.0-alpha.31

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/rrweb.cjs CHANGED
@@ -7,46 +7,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
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";
@@ -638,32 +598,94 @@ function isStyleVisible(n2) {
638
598
  function isRectVisible(rect) {
639
599
  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);
640
600
  }
641
- function getInteractiveEvents() {
642
- return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
643
- }
644
- function getInteractiveTags() {
645
- return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
646
- }
601
+ const interactiveEvents$1 = [
602
+ "change",
603
+ "submit",
604
+ "dragstart",
605
+ "drop",
606
+ "pointerdown",
607
+ "pointerup",
608
+ "input",
609
+ "keydown",
610
+ "keyup",
611
+ "keypress",
612
+ "mouseenter",
613
+ "mouseleave",
614
+ "mouseup",
615
+ "mousedown",
616
+ "click",
617
+ "contextmenu",
618
+ "dblclick",
619
+ "focus",
620
+ "blur",
621
+ "touchstart",
622
+ "touchmove",
623
+ "touchend",
624
+ "touchcancel"
625
+ ];
626
+ const interactiveTags = [
627
+ "a",
628
+ "button",
629
+ "input",
630
+ "select",
631
+ "textarea",
632
+ "label",
633
+ "details",
634
+ "summary",
635
+ "dialog",
636
+ "video",
637
+ "audio"
638
+ ];
639
+ const inlineEventAttributes$1 = [
640
+ "onclick",
641
+ "ondblclick",
642
+ "onmousedown",
643
+ "onmouseup",
644
+ "onmouseover",
645
+ "onmouseout",
646
+ "onmousemove",
647
+ "onfocus",
648
+ "onblur",
649
+ "onkeydown",
650
+ "onkeypress",
651
+ "onkeyup",
652
+ "onchange",
653
+ "oninput",
654
+ "onsubmit",
655
+ "onreset",
656
+ "onselect",
657
+ "oncontextmenu",
658
+ "ontouchstart",
659
+ "ontouchmove",
660
+ "ontouchend",
661
+ "ontouchcancel"
662
+ ];
663
+ const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
664
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
665
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
666
+ originalAddEventListener$1.call(this, type, listener, options);
667
+ if (this instanceof Element) {
668
+ const eventType = type.toLowerCase();
669
+ console.info("Event type: ", eventType);
670
+ if (interactiveEvents$1.includes(eventType)) {
671
+ interactiveElementsRegistry$1.add(this);
672
+ }
673
+ }
674
+ };
675
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
676
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
677
+ originalRemoveEventListener$1.call(this, type, listener, options);
678
+ };
647
679
  function hasEventListeners(n2) {
648
- return getInteractiveEvents().some((eventType) => {
649
- let hasListener = false;
650
- const testListener = () => {
651
- hasListener = true;
652
- };
653
- n2.addEventListener(eventType, testListener);
654
- n2.dispatchEvent(new Event(eventType));
655
- n2.removeEventListener(eventType, testListener);
656
- return hasListener;
657
- });
680
+ return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
658
681
  }
659
682
  function isElementInteractive(n2) {
660
683
  var _a2;
661
- const allowedTags = getInteractiveTags();
662
684
  if (n2.nodeType === Node.ELEMENT_NODE) {
663
685
  const element = n2;
664
686
  const tagName = element.tagName.toLowerCase();
665
- if (!allowedTags.includes(tagName)) {
666
- return false;
687
+ if (interactiveTags.includes(tagName)) {
688
+ return true;
667
689
  }
668
690
  const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
669
691
  const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
@@ -675,10 +697,28 @@ function isElementInteractive(n2) {
675
697
  if (n2.nodeType === Node.TEXT_NODE) {
676
698
  const textNode = n2;
677
699
  const parentElement2 = textNode.parentElement;
678
- return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
700
+ if (parentElement2 !== null && interactiveTags.includes(parentElement2.tagName.toLowerCase())) {
701
+ return true;
702
+ }
703
+ return parentElement2 !== null && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
679
704
  }
680
705
  return false;
681
706
  }
707
+ function inspectInlineEventHandlers$1() {
708
+ const allElements = document.querySelectorAll("*");
709
+ allElements.forEach((el) => {
710
+ inlineEventAttributes$1.forEach((attr) => {
711
+ if (el.hasAttribute(attr)) {
712
+ interactiveElementsRegistry$1.add(el);
713
+ }
714
+ });
715
+ });
716
+ }
717
+ if (document.readyState === "complete" || document.readyState === "interactive") {
718
+ inspectInlineEventHandlers$1();
719
+ } else {
720
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
721
+ }
682
722
  let _id = 1;
683
723
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
684
724
  const IGNORED_NODE = -2;
@@ -5620,6 +5660,86 @@ let Mirror$1 = class Mirror2 {
5620
5660
  function createMirror$1() {
5621
5661
  return new Mirror$1();
5622
5662
  }
5663
+ const interactiveEvents = [
5664
+ "change",
5665
+ "submit",
5666
+ "dragstart",
5667
+ "drop",
5668
+ "pointerdown",
5669
+ "pointerup",
5670
+ "input",
5671
+ "keydown",
5672
+ "keyup",
5673
+ "keypress",
5674
+ "mouseenter",
5675
+ "mouseleave",
5676
+ "mouseup",
5677
+ "mousedown",
5678
+ "click",
5679
+ "contextmenu",
5680
+ "dblclick",
5681
+ "focus",
5682
+ "blur",
5683
+ "touchstart",
5684
+ "touchmove",
5685
+ "touchend",
5686
+ "touchcancel"
5687
+ ];
5688
+ const inlineEventAttributes = [
5689
+ "onclick",
5690
+ "ondblclick",
5691
+ "onmousedown",
5692
+ "onmouseup",
5693
+ "onmouseover",
5694
+ "onmouseout",
5695
+ "onmousemove",
5696
+ "onfocus",
5697
+ "onblur",
5698
+ "onkeydown",
5699
+ "onkeypress",
5700
+ "onkeyup",
5701
+ "onchange",
5702
+ "oninput",
5703
+ "onsubmit",
5704
+ "onreset",
5705
+ "onselect",
5706
+ "oncontextmenu",
5707
+ "ontouchstart",
5708
+ "ontouchmove",
5709
+ "ontouchend",
5710
+ "ontouchcancel"
5711
+ ];
5712
+ const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5713
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5714
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5715
+ originalAddEventListener.call(this, type, listener, options);
5716
+ if (this instanceof Element) {
5717
+ const eventType = type.toLowerCase();
5718
+ console.info("Event type: ", eventType);
5719
+ if (interactiveEvents.includes(eventType)) {
5720
+ interactiveElementsRegistry.add(this);
5721
+ }
5722
+ }
5723
+ };
5724
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5725
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5726
+ originalRemoveEventListener.call(this, type, listener, options);
5727
+ };
5728
+ function inspectInlineEventHandlers() {
5729
+ const allElements = document.querySelectorAll("*");
5730
+ allElements.forEach((el) => {
5731
+ inlineEventAttributes.forEach((attr) => {
5732
+ if (el.hasAttribute(attr)) {
5733
+ interactiveElementsRegistry.add(el);
5734
+ }
5735
+ });
5736
+ });
5737
+ }
5738
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5739
+ inspectInlineEventHandlers();
5740
+ } else {
5741
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5742
+ }
5623
5743
  function getDefaultExportFromCjs(x2) {
5624
5744
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5625
5745
  }
@@ -11872,6 +11992,7 @@ function initMouseInteractionObserver({
11872
11992
  }) {
11873
11993
  if (sampling.mouseInteraction === false) {
11874
11994
  return () => {
11995
+ console.debug("MouseInteractionObserver: No operation needed");
11875
11996
  };
11876
11997
  }
11877
11998
  const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;