@tamagui/react-native-use-responder-events 1.111.8 → 1.111.9

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.
@@ -1,92 +0,0 @@
1
- var keyName = "__reactResponderId",
2
- canUseDOM = !!(typeof window < "u" && window.document && window.document.createElement),
3
- getBoundingClientRect = function (node) {
4
- if (node && node.nodeType === 1 && node.getBoundingClientRect) return node.getBoundingClientRect();
5
- };
6
- function getEventPath(domEvent) {
7
- if (domEvent.type === "selectionchange") {
8
- var _window_getSelection,
9
- target = (_window_getSelection = window.getSelection()) === null || _window_getSelection === void 0 ? void 0 : _window_getSelection.anchorNode;
10
- return composedPathFallback(target);
11
- }
12
- var path = domEvent.composedPath != null ? domEvent.composedPath() : composedPathFallback(domEvent.target);
13
- return path;
14
- }
15
- function composedPathFallback(target) {
16
- for (var path = []; target != null && target !== document.body;) path.push(target), target = target.parentNode;
17
- return path;
18
- }
19
- function getResponderId(node) {
20
- return node != null ? node[keyName] : null;
21
- }
22
- function setResponderId(node, id) {
23
- node != null && (node[keyName] = id);
24
- }
25
- function getResponderPaths(domEvent) {
26
- for (var idPath = [], nodePath = [], eventPath = getEventPath(domEvent), i = 0; i < eventPath.length; i++) {
27
- var node = eventPath[i],
28
- id = getResponderId(node);
29
- id != null && (idPath.push(id), nodePath.push(node));
30
- }
31
- return {
32
- idPath,
33
- nodePath
34
- };
35
- }
36
- function getLowestCommonAncestor(pathA, pathB) {
37
- var pathALength = pathA.length,
38
- pathBLength = pathB.length;
39
- if (
40
- // If either path is empty
41
- pathALength === 0 || pathBLength === 0 ||
42
- // If the last elements aren't the same there can't be a common ancestor
43
- // that is connected to the responder system
44
- pathA[pathALength - 1] !== pathB[pathBLength - 1]) return null;
45
- var itemA = pathA[0],
46
- indexA = 0,
47
- itemB = pathB[0],
48
- indexB = 0;
49
- pathALength - pathBLength > 0 && (indexA = pathALength - pathBLength, itemA = pathA[indexA], pathALength = pathBLength), pathBLength - pathALength > 0 && (indexB = pathBLength - pathALength, itemB = pathB[indexB], pathBLength = pathALength);
50
- for (var depth = pathALength; depth--;) {
51
- if (itemA === itemB) return itemA;
52
- itemA = pathA[indexA++], itemB = pathB[indexB++];
53
- }
54
- return null;
55
- }
56
- function hasTargetTouches(target, touches) {
57
- if (!touches || touches.length === 0) return !1;
58
- for (var i = 0; i < touches.length; i++) {
59
- var node = touches[i].target;
60
- if (node != null && target.contains(node)) return !0;
61
- }
62
- return !1;
63
- }
64
- function hasValidSelection(domEvent) {
65
- return domEvent.type === "selectionchange" ? isSelectionValid() : domEvent.type === "select";
66
- }
67
- function isPrimaryPointerDown(domEvent) {
68
- var {
69
- altKey,
70
- button,
71
- buttons,
72
- ctrlKey,
73
- type
74
- } = domEvent,
75
- isTouch = type === "touchstart" || type === "touchmove",
76
- isPrimaryMouseDown = type === "mousedown" && (button === 0 || buttons === 1),
77
- isPrimaryMouseMove = type === "mousemove" && buttons === 1,
78
- noModifiers = altKey === !1 && ctrlKey === !1;
79
- return !!(isTouch || isPrimaryMouseDown && noModifiers || isPrimaryMouseMove && noModifiers);
80
- }
81
- function isSelectionValid() {
82
- var selection = window.getSelection();
83
- if (!selection) return !1;
84
- var string = selection.toString(),
85
- anchorNode = selection.anchorNode,
86
- focusNode = selection.focusNode,
87
- isTextNode = anchorNode && anchorNode.nodeType === window.Node.TEXT_NODE || focusNode && focusNode.nodeType === window.Node.TEXT_NODE;
88
- return string.length >= 1 && string !== `
89
- ` && !!isTextNode;
90
- }
91
- export { canUseDOM, getBoundingClientRect, getLowestCommonAncestor, getResponderPaths, hasTargetTouches, hasValidSelection, isPrimaryPointerDown, isSelectionValid, setResponderId };
92
- //# sourceMappingURL=utils.native.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["keyName","canUseDOM","window","document","createElement","getBoundingClientRect","node","nodeType","getEventPath","domEvent","type","_window_getSelection","target","getSelection","anchorNode","composedPathFallback","path","composedPath","body","push","parentNode","getResponderId","setResponderId","id","getResponderPaths","idPath","nodePath","eventPath","i","length","getLowestCommonAncestor","pathA","pathB","pathALength","pathBLength","itemA","indexA","itemB","indexB","depth","hasTargetTouches","touches","contains","hasValidSelection","isSelectionValid","isPrimaryPointerDown","altKey","button","buttons","ctrlKey","isTouch","isPrimaryMouseDown","isPrimaryMouseMove","noModifiers","selection","string","toString","focusNode","isTextNode","Node","TEXT_NODE"],"sources":["../../src/utils.ts"],"sourcesContent":[null],"mappings":"AAMA,IAAAA,OAAM,uBAAU;EAAAC,SAEH,MAAa,OACxBC,MAAO,MAAW,IAAAA,MAClB,CAAAC,QAAO,IAAAD,MACP,CAAAC,QAAO,CAAAC,aAAS;EAAAC,qBAGL,YAAAA,CAAyBC,IAA6C;IACjF,IAAKA,IAAA,IACDA,IAAA,CAAKC,QAAA,KAAa,KAClBD,IAAA,CAAKD,qBAAA,EACP,OAAOC,IAAA,CAAKD,qBAAA,CAAsB;EAEtC;AAEA,SAASG,aAAaC,QAAA,EAA2B;EAI/C,IAAIA,QAAA,CAASC,IAAA,KAAS,mBAAmB;IACvC,IAAAC,oBAAsB;MAAAC,MAAA,GAAa,CAAAD,oBAAG,GAAAT,MAAA,CAAAW,YAAA,gBAAAF,oBAAA,uBAAAA,oBAAA,CAAAG,UAAA;IACtC,OAAOC,oBAAA,CAAqBH,MAAM;EACpC;EAKA,IAAAI,IAHE,GAAAP,QAAS,CAAAQ,YAAgB,QACrB,GAAAR,QAAS,CAAAQ,YAAa,CACtB,IAAAF,oBAAqB,CAAAN,QAAS,CAAAG,MAAM;EAE5C,OAAAI,IAAA;AAEA;AACE,SAAMD,oBAAeA,CAAAH,MAAA;EACrB,SAAOI,IAAA,KAAU,EAAAJ,MAAQ,YAAWA,MAAA,KAAST,QAAA,CAAAe,IAAA,GAC3CF,IAAA,CAAKG,IAAA,CAAKP,MAAM,GAChBA,MAAA,GAASA,MAAA,CAAOQ,UAAA;EAElB,OAAOJ,IAAA;AACT;AAKA,SAASK,eAAef,IAAA,EAA0B;EAChD,OAA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