@appsurify-testmap/rrweb 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.
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,93 @@ 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
+ if (interactiveEvents$1.includes(eventType)) {
670
+ interactiveElementsRegistry$1.add(this);
671
+ }
672
+ }
673
+ };
674
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
675
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
676
+ originalRemoveEventListener$1.call(this, type, listener, options);
677
+ };
647
678
  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
- });
679
+ return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
658
680
  }
659
681
  function isElementInteractive(n2) {
660
682
  var _a2;
661
- const allowedTags = getInteractiveTags();
662
683
  if (n2.nodeType === Node.ELEMENT_NODE) {
663
684
  const element = n2;
664
685
  const tagName = element.tagName.toLowerCase();
665
- if (!allowedTags.includes(tagName)) {
666
- return false;
686
+ if (interactiveTags.includes(tagName)) {
687
+ return true;
667
688
  }
668
689
  const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
669
690
  const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
@@ -675,10 +696,28 @@ function isElementInteractive(n2) {
675
696
  if (n2.nodeType === Node.TEXT_NODE) {
676
697
  const textNode = n2;
677
698
  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);
699
+ if (parentElement2 !== null && interactiveTags.includes(parentElement2.tagName.toLowerCase())) {
700
+ return true;
701
+ }
702
+ return parentElement2 !== null && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
679
703
  }
680
704
  return false;
681
705
  }
706
+ function inspectInlineEventHandlers$1() {
707
+ const allElements = document.querySelectorAll("*");
708
+ allElements.forEach((el) => {
709
+ inlineEventAttributes$1.forEach((attr) => {
710
+ if (el.hasAttribute(attr)) {
711
+ interactiveElementsRegistry$1.add(el);
712
+ }
713
+ });
714
+ });
715
+ }
716
+ if (document.readyState === "complete" || document.readyState === "interactive") {
717
+ inspectInlineEventHandlers$1();
718
+ } else {
719
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
720
+ }
682
721
  let _id = 1;
683
722
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
684
723
  const IGNORED_NODE = -2;
@@ -5620,6 +5659,85 @@ let Mirror$1 = class Mirror2 {
5620
5659
  function createMirror$1() {
5621
5660
  return new Mirror$1();
5622
5661
  }
5662
+ const interactiveEvents = [
5663
+ "change",
5664
+ "submit",
5665
+ "dragstart",
5666
+ "drop",
5667
+ "pointerdown",
5668
+ "pointerup",
5669
+ "input",
5670
+ "keydown",
5671
+ "keyup",
5672
+ "keypress",
5673
+ "mouseenter",
5674
+ "mouseleave",
5675
+ "mouseup",
5676
+ "mousedown",
5677
+ "click",
5678
+ "contextmenu",
5679
+ "dblclick",
5680
+ "focus",
5681
+ "blur",
5682
+ "touchstart",
5683
+ "touchmove",
5684
+ "touchend",
5685
+ "touchcancel"
5686
+ ];
5687
+ const inlineEventAttributes = [
5688
+ "onclick",
5689
+ "ondblclick",
5690
+ "onmousedown",
5691
+ "onmouseup",
5692
+ "onmouseover",
5693
+ "onmouseout",
5694
+ "onmousemove",
5695
+ "onfocus",
5696
+ "onblur",
5697
+ "onkeydown",
5698
+ "onkeypress",
5699
+ "onkeyup",
5700
+ "onchange",
5701
+ "oninput",
5702
+ "onsubmit",
5703
+ "onreset",
5704
+ "onselect",
5705
+ "oncontextmenu",
5706
+ "ontouchstart",
5707
+ "ontouchmove",
5708
+ "ontouchend",
5709
+ "ontouchcancel"
5710
+ ];
5711
+ const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5712
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5713
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5714
+ originalAddEventListener.call(this, type, listener, options);
5715
+ if (this instanceof Element) {
5716
+ const eventType = type.toLowerCase();
5717
+ if (interactiveEvents.includes(eventType)) {
5718
+ interactiveElementsRegistry.add(this);
5719
+ }
5720
+ }
5721
+ };
5722
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5723
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5724
+ originalRemoveEventListener.call(this, type, listener, options);
5725
+ };
5726
+ function inspectInlineEventHandlers() {
5727
+ const allElements = document.querySelectorAll("*");
5728
+ allElements.forEach((el) => {
5729
+ inlineEventAttributes.forEach((attr) => {
5730
+ if (el.hasAttribute(attr)) {
5731
+ interactiveElementsRegistry.add(el);
5732
+ }
5733
+ });
5734
+ });
5735
+ }
5736
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5737
+ inspectInlineEventHandlers();
5738
+ } else {
5739
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5740
+ }
5623
5741
  function getDefaultExportFromCjs(x2) {
5624
5742
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5625
5743
  }
@@ -11872,6 +11990,7 @@ function initMouseInteractionObserver({
11872
11990
  }) {
11873
11991
  if (sampling.mouseInteraction === false) {
11874
11992
  return () => {
11993
+ console.debug("MouseInteractionObserver: No operation needed");
11875
11994
  };
11876
11995
  }
11877
11996
  const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;