@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.js CHANGED
@@ -5,46 +5,6 @@ var _a;
5
5
  var __defProp$1 = Object.defineProperty;
6
6
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
7
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
8
- var InteractiveEvent = /* @__PURE__ */ ((InteractiveEvent2) => {
9
- InteractiveEvent2[InteractiveEvent2["Change"] = 0] = "Change";
10
- InteractiveEvent2[InteractiveEvent2["Submit"] = 1] = "Submit";
11
- InteractiveEvent2[InteractiveEvent2["DragStart"] = 2] = "DragStart";
12
- InteractiveEvent2[InteractiveEvent2["Drop"] = 3] = "Drop";
13
- InteractiveEvent2[InteractiveEvent2["PointerDown"] = 4] = "PointerDown";
14
- InteractiveEvent2[InteractiveEvent2["PointerUp"] = 5] = "PointerUp";
15
- InteractiveEvent2[InteractiveEvent2["Input"] = 6] = "Input";
16
- InteractiveEvent2[InteractiveEvent2["KeyDown"] = 7] = "KeyDown";
17
- InteractiveEvent2[InteractiveEvent2["KeyUp"] = 8] = "KeyUp";
18
- InteractiveEvent2[InteractiveEvent2["KeyPress"] = 9] = "KeyPress";
19
- InteractiveEvent2[InteractiveEvent2["MouseEnter"] = 10] = "MouseEnter";
20
- InteractiveEvent2[InteractiveEvent2["MouseLeave"] = 11] = "MouseLeave";
21
- InteractiveEvent2[InteractiveEvent2["MouseUp"] = 12] = "MouseUp";
22
- InteractiveEvent2[InteractiveEvent2["MouseDown"] = 13] = "MouseDown";
23
- InteractiveEvent2[InteractiveEvent2["Click"] = 14] = "Click";
24
- InteractiveEvent2[InteractiveEvent2["ContextMenu"] = 15] = "ContextMenu";
25
- InteractiveEvent2[InteractiveEvent2["DblClick"] = 16] = "DblClick";
26
- InteractiveEvent2[InteractiveEvent2["Focus"] = 17] = "Focus";
27
- InteractiveEvent2[InteractiveEvent2["Blur"] = 18] = "Blur";
28
- InteractiveEvent2[InteractiveEvent2["TouchStart"] = 19] = "TouchStart";
29
- InteractiveEvent2[InteractiveEvent2["TouchMove"] = 20] = "TouchMove";
30
- InteractiveEvent2[InteractiveEvent2["TouchEnd"] = 21] = "TouchEnd";
31
- InteractiveEvent2[InteractiveEvent2["TouchCancel"] = 22] = "TouchCancel";
32
- return InteractiveEvent2;
33
- })(InteractiveEvent || {});
34
- var interactiveTag = /* @__PURE__ */ ((interactiveTag2) => {
35
- interactiveTag2[interactiveTag2["Input"] = 0] = "Input";
36
- interactiveTag2[interactiveTag2["Button"] = 1] = "Button";
37
- interactiveTag2[interactiveTag2["A"] = 2] = "A";
38
- interactiveTag2[interactiveTag2["Select"] = 3] = "Select";
39
- interactiveTag2[interactiveTag2["Textarea"] = 4] = "Textarea";
40
- interactiveTag2[interactiveTag2["Label"] = 5] = "Label";
41
- interactiveTag2[interactiveTag2["Details"] = 6] = "Details";
42
- interactiveTag2[interactiveTag2["Summary"] = 7] = "Summary";
43
- interactiveTag2[interactiveTag2["Dialog"] = 8] = "Dialog";
44
- interactiveTag2[interactiveTag2["Video"] = 9] = "Video";
45
- interactiveTag2[interactiveTag2["Audio"] = 10] = "Audio";
46
- return interactiveTag2;
47
- })(interactiveTag || {});
48
8
  var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
49
9
  NodeType2[NodeType2["Document"] = 0] = "Document";
50
10
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
@@ -636,32 +596,93 @@ function isStyleVisible(n2) {
636
596
  function isRectVisible(rect) {
637
597
  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);
638
598
  }
639
- function getInteractiveEvents() {
640
- return Object.keys(InteractiveEvent).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
641
- }
642
- function getInteractiveTags() {
643
- return Object.keys(interactiveTag).filter((key) => isNaN(Number(key))).map((key) => key.toLowerCase().replace(/_/g, "-"));
644
- }
599
+ const interactiveEvents$1 = [
600
+ "change",
601
+ "submit",
602
+ "dragstart",
603
+ "drop",
604
+ "pointerdown",
605
+ "pointerup",
606
+ "input",
607
+ "keydown",
608
+ "keyup",
609
+ "keypress",
610
+ "mouseenter",
611
+ "mouseleave",
612
+ "mouseup",
613
+ "mousedown",
614
+ "click",
615
+ "contextmenu",
616
+ "dblclick",
617
+ "focus",
618
+ "blur",
619
+ "touchstart",
620
+ "touchmove",
621
+ "touchend",
622
+ "touchcancel"
623
+ ];
624
+ const interactiveTags = [
625
+ "a",
626
+ "button",
627
+ "input",
628
+ "select",
629
+ "textarea",
630
+ "label",
631
+ "details",
632
+ "summary",
633
+ "dialog",
634
+ "video",
635
+ "audio"
636
+ ];
637
+ const inlineEventAttributes$1 = [
638
+ "onclick",
639
+ "ondblclick",
640
+ "onmousedown",
641
+ "onmouseup",
642
+ "onmouseover",
643
+ "onmouseout",
644
+ "onmousemove",
645
+ "onfocus",
646
+ "onblur",
647
+ "onkeydown",
648
+ "onkeypress",
649
+ "onkeyup",
650
+ "onchange",
651
+ "oninput",
652
+ "onsubmit",
653
+ "onreset",
654
+ "onselect",
655
+ "oncontextmenu",
656
+ "ontouchstart",
657
+ "ontouchmove",
658
+ "ontouchend",
659
+ "ontouchcancel"
660
+ ];
661
+ const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
662
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
663
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
664
+ originalAddEventListener$1.call(this, type, listener, options);
665
+ if (this instanceof Element) {
666
+ const eventType = type.toLowerCase();
667
+ if (interactiveEvents$1.includes(eventType)) {
668
+ interactiveElementsRegistry$1.add(this);
669
+ }
670
+ }
671
+ };
672
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
673
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
674
+ originalRemoveEventListener$1.call(this, type, listener, options);
675
+ };
645
676
  function hasEventListeners(n2) {
646
- return getInteractiveEvents().some((eventType) => {
647
- let hasListener = false;
648
- const testListener = () => {
649
- hasListener = true;
650
- };
651
- n2.addEventListener(eventType, testListener);
652
- n2.dispatchEvent(new Event(eventType));
653
- n2.removeEventListener(eventType, testListener);
654
- return hasListener;
655
- });
677
+ return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
656
678
  }
657
679
  function isElementInteractive(n2) {
658
680
  var _a2;
659
- const allowedTags = getInteractiveTags();
660
681
  if (n2.nodeType === Node.ELEMENT_NODE) {
661
682
  const element = n2;
662
683
  const tagName = element.tagName.toLowerCase();
663
- if (!allowedTags.includes(tagName)) {
664
- return false;
684
+ if (interactiveTags.includes(tagName)) {
685
+ return true;
665
686
  }
666
687
  const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
667
688
  const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
@@ -673,10 +694,28 @@ function isElementInteractive(n2) {
673
694
  if (n2.nodeType === Node.TEXT_NODE) {
674
695
  const textNode = n2;
675
696
  const parentElement2 = textNode.parentElement;
676
- return parentElement2 !== null && allowedTags.includes(parentElement2.tagName.toLowerCase()) && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
697
+ if (parentElement2 !== null && interactiveTags.includes(parentElement2.tagName.toLowerCase())) {
698
+ return true;
699
+ }
700
+ return parentElement2 !== null && isElementVisible(parentElement2) && ((_a2 = textNode.textContent) == null ? void 0 : _a2.trim().length) !== 0 && isElementInteractive(parentElement2);
677
701
  }
678
702
  return false;
679
703
  }
704
+ function inspectInlineEventHandlers$1() {
705
+ const allElements = document.querySelectorAll("*");
706
+ allElements.forEach((el) => {
707
+ inlineEventAttributes$1.forEach((attr) => {
708
+ if (el.hasAttribute(attr)) {
709
+ interactiveElementsRegistry$1.add(el);
710
+ }
711
+ });
712
+ });
713
+ }
714
+ if (document.readyState === "complete" || document.readyState === "interactive") {
715
+ inspectInlineEventHandlers$1();
716
+ } else {
717
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
718
+ }
680
719
  let _id = 1;
681
720
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
682
721
  const IGNORED_NODE = -2;
@@ -5618,6 +5657,85 @@ let Mirror$1 = class Mirror2 {
5618
5657
  function createMirror$1() {
5619
5658
  return new Mirror$1();
5620
5659
  }
5660
+ const interactiveEvents = [
5661
+ "change",
5662
+ "submit",
5663
+ "dragstart",
5664
+ "drop",
5665
+ "pointerdown",
5666
+ "pointerup",
5667
+ "input",
5668
+ "keydown",
5669
+ "keyup",
5670
+ "keypress",
5671
+ "mouseenter",
5672
+ "mouseleave",
5673
+ "mouseup",
5674
+ "mousedown",
5675
+ "click",
5676
+ "contextmenu",
5677
+ "dblclick",
5678
+ "focus",
5679
+ "blur",
5680
+ "touchstart",
5681
+ "touchmove",
5682
+ "touchend",
5683
+ "touchcancel"
5684
+ ];
5685
+ const inlineEventAttributes = [
5686
+ "onclick",
5687
+ "ondblclick",
5688
+ "onmousedown",
5689
+ "onmouseup",
5690
+ "onmouseover",
5691
+ "onmouseout",
5692
+ "onmousemove",
5693
+ "onfocus",
5694
+ "onblur",
5695
+ "onkeydown",
5696
+ "onkeypress",
5697
+ "onkeyup",
5698
+ "onchange",
5699
+ "oninput",
5700
+ "onsubmit",
5701
+ "onreset",
5702
+ "onselect",
5703
+ "oncontextmenu",
5704
+ "ontouchstart",
5705
+ "ontouchmove",
5706
+ "ontouchend",
5707
+ "ontouchcancel"
5708
+ ];
5709
+ const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5710
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5711
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5712
+ originalAddEventListener.call(this, type, listener, options);
5713
+ if (this instanceof Element) {
5714
+ const eventType = type.toLowerCase();
5715
+ if (interactiveEvents.includes(eventType)) {
5716
+ interactiveElementsRegistry.add(this);
5717
+ }
5718
+ }
5719
+ };
5720
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5721
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5722
+ originalRemoveEventListener.call(this, type, listener, options);
5723
+ };
5724
+ function inspectInlineEventHandlers() {
5725
+ const allElements = document.querySelectorAll("*");
5726
+ allElements.forEach((el) => {
5727
+ inlineEventAttributes.forEach((attr) => {
5728
+ if (el.hasAttribute(attr)) {
5729
+ interactiveElementsRegistry.add(el);
5730
+ }
5731
+ });
5732
+ });
5733
+ }
5734
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5735
+ inspectInlineEventHandlers();
5736
+ } else {
5737
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5738
+ }
5621
5739
  function getDefaultExportFromCjs(x2) {
5622
5740
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5623
5741
  }
@@ -11870,6 +11988,7 @@ function initMouseInteractionObserver({
11870
11988
  }) {
11871
11989
  if (sampling.mouseInteraction === false) {
11872
11990
  return () => {
11991
+ console.debug("MouseInteractionObserver: No operation needed");
11873
11992
  };
11874
11993
  }
11875
11994
  const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;