@tamagui/react-native-use-responder-events 1.89.26 → 1.89.27-1708112217600
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/cjs/ResponderSystem.native.js +89 -90
- package/dist/cjs/ResponderSystem.native.js.map +3 -3
- package/dist/cjs/ResponderTouchHistoryStore.js +31 -31
- package/dist/cjs/ResponderTouchHistoryStore.js.map +1 -1
- package/dist/cjs/ResponderTouchHistoryStore.native.js +86 -65
- package/dist/cjs/ResponderTouchHistoryStore.native.js.map +3 -3
- package/dist/cjs/createResponderEvent.native.js +23 -23
- package/dist/cjs/createResponderEvent.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/cjs/types.native.js +1 -1
- package/dist/cjs/types.native.js.map +3 -3
- package/dist/cjs/useResponderEvents.native.js +16 -17
- package/dist/cjs/useResponderEvents.native.js.map +3 -3
- package/dist/cjs/utils.native.js +19 -19
- package/dist/cjs/utils.native.js.map +3 -3
- package/dist/esm/ResponderSystem.native.js +91 -105
- package/dist/esm/ResponderSystem.native.js.map +3 -3
- package/dist/esm/ResponderTouchHistoryStore.js +31 -31
- package/dist/esm/ResponderTouchHistoryStore.js.map +1 -1
- package/dist/esm/ResponderTouchHistoryStore.mjs +28 -28
- package/dist/esm/ResponderTouchHistoryStore.native.js +86 -65
- package/dist/esm/ResponderTouchHistoryStore.native.js.map +3 -3
- package/dist/esm/createResponderEvent.native.js +23 -22
- package/dist/esm/createResponderEvent.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/types.native.js +1 -1
- package/dist/esm/types.native.js.map +3 -3
- package/dist/esm/useResponderEvents.native.js +16 -17
- package/dist/esm/useResponderEvents.native.js.map +3 -3
- package/dist/esm/utils.native.js +19 -19
- package/dist/esm/utils.native.js.map +3 -3
- package/package.json +2 -2
- package/src/ResponderTouchHistoryStore.ts +50 -50
- package/types/ResponderTouchHistoryStore.d.ts +10 -10
- package/types/ResponderTouchHistoryStore.d.ts.map +1 -1
|
@@ -30,144 +30,143 @@ __export(ResponderSystem_exports, {
|
|
|
30
30
|
terminateResponder: () => terminateResponder
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(ResponderSystem_exports);
|
|
33
|
-
var import_createResponderEvent = __toESM(require("./createResponderEvent")), import_ResponderTouchHistoryStore = require("./ResponderTouchHistoryStore"), import_types = require("./types"), import_utils = require("./utils"), import_utils2 = require("./utils")
|
|
34
|
-
const emptyObject = {}, startRegistration = [
|
|
33
|
+
var import_createResponderEvent = __toESM(require("./createResponderEvent")), import_ResponderTouchHistoryStore = require("./ResponderTouchHistoryStore"), import_types = require("./types"), import_utils = require("./utils"), import_utils2 = require("./utils"), emptyObject = {}, startRegistration = [
|
|
35
34
|
"onStartShouldSetResponderCapture",
|
|
36
35
|
"onStartShouldSetResponder",
|
|
37
|
-
{
|
|
36
|
+
{
|
|
37
|
+
bubbles: !0
|
|
38
|
+
}
|
|
38
39
|
], moveRegistration = [
|
|
39
40
|
"onMoveShouldSetResponderCapture",
|
|
40
41
|
"onMoveShouldSetResponder",
|
|
41
|
-
{
|
|
42
|
+
{
|
|
43
|
+
bubbles: !0
|
|
44
|
+
}
|
|
42
45
|
], scrollRegistration = [
|
|
43
46
|
"onScrollShouldSetResponderCapture",
|
|
44
47
|
"onScrollShouldSetResponder",
|
|
45
|
-
{
|
|
48
|
+
{
|
|
49
|
+
bubbles: !1
|
|
50
|
+
}
|
|
46
51
|
], shouldSetResponderEvents = {
|
|
47
52
|
touchstart: startRegistration,
|
|
48
53
|
mousedown: startRegistration,
|
|
49
54
|
touchmove: moveRegistration,
|
|
50
55
|
mousemove: moveRegistration,
|
|
51
56
|
scroll: scrollRegistration
|
|
52
|
-
}, emptyResponder = {
|
|
53
|
-
|
|
57
|
+
}, emptyResponder = {
|
|
58
|
+
id: null,
|
|
59
|
+
idPath: null,
|
|
60
|
+
node: null
|
|
61
|
+
}, responderListenersMap = /* @__PURE__ */ new Map(), isEmulatingMouseEvents = !1, trackedTouchCount = 0, currentResponder = {
|
|
54
62
|
id: null,
|
|
55
63
|
node: null,
|
|
56
64
|
idPath: null
|
|
57
|
-
};
|
|
58
|
-
const responderTouchHistoryStore = new import_ResponderTouchHistoryStore.ResponderTouchHistoryStore();
|
|
65
|
+
}, responderTouchHistoryStore = new import_ResponderTouchHistoryStore.ResponderTouchHistoryStore();
|
|
59
66
|
function changeCurrentResponder(responder) {
|
|
60
67
|
currentResponder = responder;
|
|
61
68
|
}
|
|
62
69
|
function getResponderConfig(id) {
|
|
63
|
-
|
|
70
|
+
var config = responderListenersMap.get(id);
|
|
64
71
|
return config ?? emptyObject;
|
|
65
72
|
}
|
|
66
73
|
function eventListener(domEvent) {
|
|
67
|
-
|
|
74
|
+
var eventType = domEvent.type, eventTarget = domEvent.target;
|
|
68
75
|
if (eventType === "touchstart" && (isEmulatingMouseEvents = !0), (eventType === "touchmove" || trackedTouchCount > 1) && (isEmulatingMouseEvents = !1), // Ignore browser emulated mouse events
|
|
69
|
-
eventType === "mousedown" && isEmulatingMouseEvents || eventType === "mousemove" && isEmulatingMouseEvents || // Ignore mousemove if a mousedown didn't occur first
|
|
70
|
-
eventType === "mousemove" && trackedTouchCount < 1)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const isStartEvent = (0, import_types.isStartish)(eventType) && (0, import_utils2.isPrimaryPointerDown)(domEvent), isMoveEvent = (0, import_types.isMoveish)(eventType), isEndEvent = (0, import_types.isEndish)(eventType), isScrollEvent = (0, import_types.isScroll)(eventType), isSelectionChangeEvent = (0, import_types.isSelectionChange)(eventType), responderEvent = (0, import_createResponderEvent.default)(domEvent, responderTouchHistoryStore);
|
|
77
|
-
(isStartEvent || isMoveEvent || isEndEvent) && (domEvent.touches ? trackedTouchCount = domEvent.touches.length : isStartEvent ? trackedTouchCount = 1 : isEndEvent && (trackedTouchCount = 0), responderTouchHistoryStore.recordTouchTrack(
|
|
78
|
-
eventType,
|
|
79
|
-
responderEvent.nativeEvent
|
|
80
|
-
));
|
|
81
|
-
let eventPaths = (0, import_utils2.getResponderPaths)(domEvent), wasNegotiated = !1, wantsResponder;
|
|
82
|
-
if (isStartEvent || isMoveEvent || isScrollEvent && trackedTouchCount > 0) {
|
|
83
|
-
const currentResponderIdPath = currentResponder.idPath, eventIdPath = eventPaths.idPath;
|
|
84
|
-
if (currentResponderIdPath != null && eventIdPath != null) {
|
|
85
|
-
const lowestCommonAncestor = (0, import_utils2.getLowestCommonAncestor)(
|
|
86
|
-
currentResponderIdPath,
|
|
87
|
-
eventIdPath
|
|
88
|
-
);
|
|
89
|
-
if (lowestCommonAncestor != null) {
|
|
90
|
-
const index = eventIdPath.indexOf(lowestCommonAncestor) + (lowestCommonAncestor === currentResponder.id ? 1 : 0);
|
|
91
|
-
eventPaths = {
|
|
92
|
-
idPath: eventIdPath.slice(index),
|
|
93
|
-
nodePath: eventPaths.nodePath.slice(index)
|
|
94
|
-
};
|
|
95
|
-
} else
|
|
96
|
-
eventPaths = null;
|
|
76
|
+
!(eventType === "mousedown" && isEmulatingMouseEvents || eventType === "mousemove" && isEmulatingMouseEvents || // Ignore mousemove if a mousedown didn't occur first
|
|
77
|
+
eventType === "mousemove" && trackedTouchCount < 1)) {
|
|
78
|
+
if (isEmulatingMouseEvents && eventType === "mouseup") {
|
|
79
|
+
trackedTouchCount === 0 && (isEmulatingMouseEvents = !1);
|
|
80
|
+
return;
|
|
97
81
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
82
|
+
var isStartEvent = (0, import_types.isStartish)(eventType) && (0, import_utils2.isPrimaryPointerDown)(domEvent), isMoveEvent = (0, import_types.isMoveish)(eventType), isEndEvent = (0, import_types.isEndish)(eventType), isScrollEvent = (0, import_types.isScroll)(eventType), isSelectionChangeEvent = (0, import_types.isSelectionChange)(eventType), responderEvent = (0, import_createResponderEvent.default)(domEvent, responderTouchHistoryStore);
|
|
83
|
+
(isStartEvent || isMoveEvent || isEndEvent) && (domEvent.touches ? trackedTouchCount = domEvent.touches.length : isStartEvent ? trackedTouchCount = 1 : isEndEvent && (trackedTouchCount = 0), responderTouchHistoryStore.recordTouchTrack(eventType, responderEvent.nativeEvent));
|
|
84
|
+
var eventPaths = (0, import_utils2.getResponderPaths)(domEvent), wasNegotiated = !1, wantsResponder;
|
|
85
|
+
if (isStartEvent || isMoveEvent || isScrollEvent && trackedTouchCount > 0) {
|
|
86
|
+
var currentResponderIdPath = currentResponder.idPath, eventIdPath = eventPaths.idPath;
|
|
87
|
+
if (currentResponderIdPath != null && eventIdPath != null) {
|
|
88
|
+
var lowestCommonAncestor = (0, import_utils2.getLowestCommonAncestor)(currentResponderIdPath, eventIdPath);
|
|
89
|
+
if (lowestCommonAncestor != null) {
|
|
90
|
+
var indexOfLowestCommonAncestor = eventIdPath.indexOf(lowestCommonAncestor), index = indexOfLowestCommonAncestor + (lowestCommonAncestor === currentResponder.id ? 1 : 0);
|
|
91
|
+
eventPaths = {
|
|
92
|
+
idPath: eventIdPath.slice(index),
|
|
93
|
+
nodePath: eventPaths.nodePath.slice(index)
|
|
94
|
+
};
|
|
95
|
+
} else
|
|
96
|
+
eventPaths = null;
|
|
97
|
+
}
|
|
98
|
+
eventPaths != null && (wantsResponder = findWantsResponder(eventPaths, domEvent, responderEvent), wantsResponder != null && (attemptTransfer(responderEvent, wantsResponder), wasNegotiated = !0));
|
|
99
|
+
}
|
|
100
|
+
if (currentResponder.id != null && currentResponder.node != null) {
|
|
101
|
+
var id = currentResponder.id, node = currentResponder.node, _getResponderConfig = getResponderConfig(id), onResponderStart = _getResponderConfig.onResponderStart, onResponderMove = _getResponderConfig.onResponderMove, onResponderEnd = _getResponderConfig.onResponderEnd, onResponderRelease = _getResponderConfig.onResponderRelease, onResponderTerminate = _getResponderConfig.onResponderTerminate, onResponderTerminationRequest = _getResponderConfig.onResponderTerminationRequest;
|
|
102
|
+
if (responderEvent.bubbles = !1, responderEvent.cancelable = !1, responderEvent.currentTarget = node, isStartEvent)
|
|
103
|
+
onResponderStart != null && (responderEvent.dispatchConfig.registrationName = "onResponderStart", onResponderStart(responderEvent));
|
|
104
|
+
else if (isMoveEvent)
|
|
105
|
+
onResponderMove != null && (responderEvent.dispatchConfig.registrationName = "onResponderMove", onResponderMove(responderEvent));
|
|
106
|
+
else {
|
|
107
|
+
var isTerminateEvent = (0, import_types.isCancelish)(eventType) || // native context menu
|
|
108
|
+
eventType === "contextmenu" || // window blur
|
|
109
|
+
eventType === "blur" && eventTarget === window || // responder (or ancestors) blur
|
|
110
|
+
eventType === "blur" && eventTarget.contains(node) && domEvent.relatedTarget !== node || // native scroll without using a pointer
|
|
111
|
+
isScrollEvent && trackedTouchCount === 0 || // native scroll on node that is parent of the responder (allow siblings to scroll)
|
|
112
|
+
isScrollEvent && eventTarget.contains(node) && eventTarget !== node || // native select/selectionchange on node
|
|
113
|
+
isSelectionChangeEvent && (0, import_utils2.hasValidSelection)(domEvent), isReleaseEvent = isEndEvent && !isTerminateEvent && !(0, import_utils2.hasTargetTouches)(node, domEvent.touches);
|
|
114
|
+
if (isEndEvent && onResponderEnd != null && (responderEvent.dispatchConfig.registrationName = "onResponderEnd", onResponderEnd(responderEvent)), isReleaseEvent && (onResponderRelease != null && (responderEvent.dispatchConfig.registrationName = "onResponderRelease", onResponderRelease(responderEvent)), changeCurrentResponder(emptyResponder)), isTerminateEvent) {
|
|
115
|
+
var shouldTerminate = !0;
|
|
116
|
+
(eventType === "contextmenu" || eventType === "scroll" || eventType === "selectionchange") && (wasNegotiated ? shouldTerminate = !1 : onResponderTerminationRequest != null && (responderEvent.dispatchConfig.registrationName = "onResponderTerminationRequest", onResponderTerminationRequest(responderEvent) === !1 && (shouldTerminate = !1))), shouldTerminate && (onResponderTerminate != null && (responderEvent.dispatchConfig.registrationName = "onResponderTerminate", onResponderTerminate(responderEvent)), changeCurrentResponder(emptyResponder), isEmulatingMouseEvents = !1, trackedTouchCount = 0);
|
|
117
|
+
}
|
|
124
118
|
}
|
|
125
119
|
}
|
|
126
120
|
}
|
|
127
121
|
}
|
|
128
122
|
function findWantsResponder(eventPaths, domEvent, responderEvent) {
|
|
129
|
-
|
|
123
|
+
var shouldSetCallbacks = shouldSetResponderEvents[domEvent.type];
|
|
130
124
|
if (shouldSetCallbacks != null) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (shouldSetCallback != null && (responderEvent.currentTarget =
|
|
134
|
-
|
|
135
|
-
return {
|
|
125
|
+
for (var idPath = eventPaths.idPath, nodePath = eventPaths.nodePath, shouldSetCallbackCaptureName = shouldSetCallbacks[0], shouldSetCallbackBubbleName = shouldSetCallbacks[1], bubbles = shouldSetCallbacks[2].bubbles, check = function(id3, node3, callbackName) {
|
|
126
|
+
var config = getResponderConfig(id3), shouldSetCallback = config[callbackName];
|
|
127
|
+
if (shouldSetCallback != null && (responderEvent.currentTarget = node3, shouldSetCallback(responderEvent) === !0)) {
|
|
128
|
+
var prunedIdPath = idPath.slice(idPath.indexOf(id3));
|
|
129
|
+
return {
|
|
130
|
+
id: id3,
|
|
131
|
+
node: node3,
|
|
132
|
+
idPath: prunedIdPath
|
|
133
|
+
};
|
|
136
134
|
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const id = idPath[i], node = nodePath[i], result = check(id, node, shouldSetCallbackCaptureName);
|
|
135
|
+
}, i = idPath.length - 1; i >= 0; i--) {
|
|
136
|
+
var id = idPath[i], node = nodePath[i], result = check(id, node, shouldSetCallbackCaptureName);
|
|
140
137
|
if (result != null)
|
|
141
138
|
return result;
|
|
142
139
|
if (responderEvent.isPropagationStopped() === !0)
|
|
143
140
|
return;
|
|
144
141
|
}
|
|
145
142
|
if (bubbles)
|
|
146
|
-
for (
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
return
|
|
143
|
+
for (var i1 = 0; i1 < idPath.length; i1++) {
|
|
144
|
+
var id1 = idPath[i1], node1 = nodePath[i1], result1 = check(id1, node1, shouldSetCallbackBubbleName);
|
|
145
|
+
if (result1 != null)
|
|
146
|
+
return result1;
|
|
150
147
|
if (responderEvent.isPropagationStopped() === !0)
|
|
151
148
|
return;
|
|
152
149
|
}
|
|
153
150
|
else {
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
return check(
|
|
151
|
+
var id2 = idPath[0], node2 = nodePath[0], target = domEvent.target;
|
|
152
|
+
if (target === node2)
|
|
153
|
+
return check(id2, node2, shouldSetCallbackBubbleName);
|
|
157
154
|
}
|
|
158
155
|
}
|
|
159
156
|
}
|
|
160
157
|
function attemptTransfer(responderEvent, wantsResponder) {
|
|
161
|
-
|
|
158
|
+
var currentId = currentResponder.id, currentNode = currentResponder.node, id = wantsResponder.id, node = wantsResponder.node, _getResponderConfig = getResponderConfig(id), onResponderGrant = _getResponderConfig.onResponderGrant, onResponderReject = _getResponderConfig.onResponderReject;
|
|
162
159
|
if (responderEvent.bubbles = !1, responderEvent.cancelable = !1, responderEvent.currentTarget = node, currentId == null)
|
|
163
160
|
onResponderGrant != null && (responderEvent.currentTarget = node, responderEvent.dispatchConfig.registrationName = "onResponderGrant", onResponderGrant(responderEvent)), changeCurrentResponder(wantsResponder);
|
|
164
161
|
else {
|
|
165
|
-
|
|
166
|
-
let allowTransfer = !0;
|
|
162
|
+
var _getResponderConfig1 = getResponderConfig(currentId), onResponderTerminate = _getResponderConfig1.onResponderTerminate, onResponderTerminationRequest = _getResponderConfig1.onResponderTerminationRequest, allowTransfer = !0;
|
|
167
163
|
onResponderTerminationRequest != null && (responderEvent.currentTarget = currentNode, responderEvent.dispatchConfig.registrationName = "onResponderTerminationRequest", onResponderTerminationRequest(responderEvent) === !1 && (allowTransfer = !1)), allowTransfer ? (onResponderTerminate != null && (responderEvent.currentTarget = currentNode, responderEvent.dispatchConfig.registrationName = "onResponderTerminate", onResponderTerminate(responderEvent)), onResponderGrant != null && (responderEvent.currentTarget = node, responderEvent.dispatchConfig.registrationName = "onResponderGrant", onResponderGrant(responderEvent)), changeCurrentResponder(wantsResponder)) : onResponderReject != null && (responderEvent.currentTarget = node, responderEvent.dispatchConfig.registrationName = "onResponderReject", onResponderReject(responderEvent));
|
|
168
164
|
}
|
|
169
165
|
}
|
|
170
|
-
|
|
166
|
+
var documentEventsCapturePhase = [
|
|
167
|
+
"blur",
|
|
168
|
+
"scroll"
|
|
169
|
+
], documentEventsBubblePhase = [
|
|
171
170
|
// mouse
|
|
172
171
|
"mousedown",
|
|
173
172
|
"mousemove",
|
|
@@ -184,9 +183,9 @@ const documentEventsCapturePhase = ["blur", "scroll"], documentEventsBubblePhase
|
|
|
184
183
|
"selectionchange"
|
|
185
184
|
], isTamaguiResponderActive = Symbol();
|
|
186
185
|
function attachListeners() {
|
|
187
|
-
import_utils.canUseDOM && !window[isTamaguiResponderActive] && (window.addEventListener("blur", eventListener), documentEventsBubblePhase.forEach((eventType)
|
|
186
|
+
import_utils.canUseDOM && !window[isTamaguiResponderActive] && (window.addEventListener("blur", eventListener), documentEventsBubblePhase.forEach(function(eventType) {
|
|
188
187
|
document.addEventListener(eventType, eventListener);
|
|
189
|
-
}), documentEventsCapturePhase.forEach((eventType)
|
|
188
|
+
}), documentEventsCapturePhase.forEach(function(eventType) {
|
|
190
189
|
document.addEventListener(eventType, eventListener, !0);
|
|
191
190
|
}), window[isTamaguiResponderActive] = !0);
|
|
192
191
|
}
|
|
@@ -197,11 +196,11 @@ function removeNode(id) {
|
|
|
197
196
|
currentResponder.id === id && terminateResponder(), responderListenersMap.has(id) && responderListenersMap.delete(id);
|
|
198
197
|
}
|
|
199
198
|
function terminateResponder() {
|
|
200
|
-
|
|
199
|
+
var id = currentResponder.id, node = currentResponder.node;
|
|
201
200
|
if (id != null && node != null) {
|
|
202
|
-
|
|
201
|
+
var onResponderTerminate = getResponderConfig(id).onResponderTerminate;
|
|
203
202
|
if (onResponderTerminate != null) {
|
|
204
|
-
|
|
203
|
+
var event = (0, import_createResponderEvent.default)({}, responderTouchHistoryStore);
|
|
205
204
|
event.currentTarget = node, onResponderTerminate(event);
|
|
206
205
|
}
|
|
207
206
|
changeCurrentResponder(emptyResponder);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/ResponderSystem.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA
|
|
5
|
-
"names": ["import_utils", "createResponderEvent"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/react-native-use-responder-events/src/ResponderSystem.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;AAOA,kCAAiC,4CACjC,oCAA2C,yCAC3C,eAOO,oBACP,eAA0B,oBAC1BA,gBAOO,oBA4CDC,cAAc,CAAC,GAIfC,oBAAoB;EACxB;EACA;EACA;IAAEC,SAAS;EAAK;GAEZC,mBAAmB;EACvB;EACA;EACA;IAAED,SAAS;EAAK;GAEZE,qBAAqB;EACzB;EACA;EACA;IAAEF,SAAS;EAAM;GAEbG,2BAA2B;EAC/BC,YAAYL;EACZM,WAAWN;EACXO,WAAWL;EACXM,WAAWN;EACXO,QAAQN;AACV,GAEMO,iBAAiB;EAAEC,IAAI;EAAMC,QAAQ;EAAMC,MAAM;AAAK,GACtDC,wBAAwB,oBAAIC,IAAAA,GAE9BC,yBAAyB,IACzBC,oBAAoB,GACpBC,mBAAsC;EACxCP,IAAI;EACJE,MAAM;EACND,QAAQ;AACV,GACMO,6BAA6B,IAAIC,6DAAAA;AAEvC,SAASC,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1BoG,mBAAAA,GAEEjG,sBAAsBkG,IAAIrG,EAAAA,KAC5BG,sBAAsBmG,OAAOtG,EAAAA;AAEjC;AAOO,SAASoG,qBAAAA;AACd,MAAQpG,KAAaO,iBAAbP,IAAIE,OAASK,iBAATL;AACZ,MAAIF,MAAM,QAAQE,QAAQ,MAAM;AAC9B,QAAQuD,uBAAyB7C,mBAAmBZ,EAAAA,EAA5CyD;AACR,QAAIA,wBAAwB,MAAM;AAChC,UAAM8C,YAAQtE,4BAAAA,SAAqB,CAAC,GAAGzB,0BAAAA;AACvC+F,YAAM3C,gBAAgB1D,MACtBuD,qBAAqB8C,KAAAA;IACvB;AACA7F,2BAAuBX,cAAAA;EACzB;AACAM,2BAAyB,IACzBC,oBAAoB;AACtB;AAMO,SAASkG,mBAAAA;AACd,SAAOjG,iBAAiBL;AAC1B;",
|
|
5
|
+
"names": ["import_utils", "emptyObject", "startRegistration", "bubbles", "moveRegistration", "scrollRegistration", "shouldSetResponderEvents", "touchstart", "mousedown", "touchmove", "mousemove", "scroll", "emptyResponder", "id", "idPath", "node", "responderListenersMap", "Map", "isEmulatingMouseEvents", "trackedTouchCount", "currentResponder", "responderTouchHistoryStore", "ResponderTouchHistoryStore", "changeCurrentResponder", "responder", "getResponderConfig", "config", "get", "eventListener", "domEvent", "eventType", "type", "eventTarget", "target", "isStartEvent", "isStartish", "isPrimaryPointerDown", "isMoveEvent", "isMoveish", "isEndEvent", "isEndish", "isScrollEvent", "isScroll", "isSelectionChangeEvent", "isSelectionChange", "responderEvent", "createResponderEvent", "touches", "length", "recordTouchTrack", "nativeEvent", "eventPaths", "getResponderPaths", "wasNegotiated", "wantsResponder", "currentResponderIdPath", "eventIdPath", "lowestCommonAncestor", "getLowestCommonAncestor", "indexOfLowestCommonAncestor", "indexOf", "index", "slice", "nodePath", "findWantsResponder", "attemptTransfer", "onResponderStart", "onResponderMove", "onResponderEnd", "onResponderRelease", "onResponderTerminate", "onResponderTerminationRequest", "cancelable", "currentTarget", "dispatchConfig", "registrationName", "isTerminateEvent", "isCancelish", "window", "contains", "relatedTarget", "hasValidSelection", "isReleaseEvent", "hasTargetTouches", "shouldTerminate", "shouldSetCallbacks", "shouldSetCallbackCaptureName", "shouldSetCallbackBubbleName", "check", "callbackName", "shouldSetCallback", "prunedIdPath", "i", "result", "isPropagationStopped", "currentId", "currentNode", "onResponderGrant", "onResponderReject", "allowTransfer", "documentEventsCapturePhase", "documentEventsBubblePhase", "isTamaguiResponderActive", "Symbol", "attachListeners", "canUseDOM", "addEventListener", "forEach", "document", "addNode", "setResponderId", "set", "removeNode", "terminateResponder", "has", "delete", "event", "getResponderNode"]
|
|
6
6
|
}
|
|
@@ -18,6 +18,37 @@ __export(ResponderTouchHistoryStore_exports, {
|
|
|
18
18
|
});
|
|
19
19
|
module.exports = __toCommonJS(ResponderTouchHistoryStore_exports);
|
|
20
20
|
var import_types = require("./types");
|
|
21
|
+
class ResponderTouchHistoryStore {
|
|
22
|
+
_touchHistory = {
|
|
23
|
+
touchBank: [],
|
|
24
|
+
//Array<TouchRecord>
|
|
25
|
+
numberActiveTouches: 0,
|
|
26
|
+
// If there is only one active touch, we remember its location. This prevents
|
|
27
|
+
// us having to loop through all of the touches all the time in the most
|
|
28
|
+
// common case.
|
|
29
|
+
indexOfSingleActiveTouch: -1,
|
|
30
|
+
mostRecentTimeStamp: 0
|
|
31
|
+
};
|
|
32
|
+
recordTouchTrack(topLevelType, nativeEvent) {
|
|
33
|
+
const touchHistory = this._touchHistory;
|
|
34
|
+
if ((0, import_types.isMoveish)(topLevelType))
|
|
35
|
+
nativeEvent.changedTouches.forEach((touch) => recordTouchMove(touch, touchHistory));
|
|
36
|
+
else if ((0, import_types.isStartish)(topLevelType))
|
|
37
|
+
nativeEvent.changedTouches.forEach((touch) => recordTouchStart(touch, touchHistory)), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1 && (touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier);
|
|
38
|
+
else if ((0, import_types.isEndish)(topLevelType) && (nativeEvent.changedTouches.forEach((touch) => recordTouchEnd(touch, touchHistory)), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1)) {
|
|
39
|
+
const { touchBank } = touchHistory;
|
|
40
|
+
for (let i = 0; i < touchBank.length; i++)
|
|
41
|
+
if (touchBank[i]?.touchActive) {
|
|
42
|
+
touchHistory.indexOfSingleActiveTouch = i;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
process.env.NODE_ENV === "development" && (touchBank[touchHistory.indexOfSingleActiveTouch]?.touchActive || console.error("Cannot find single active touch."));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
get touchHistory() {
|
|
49
|
+
return this._touchHistory;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
21
52
|
const MAX_TOUCH_BANK = 20;
|
|
22
53
|
function timestampForTouch(touch) {
|
|
23
54
|
return touch.timeStamp || touch.timestamp;
|
|
@@ -83,35 +114,4 @@ function printTouchBank(touchHistory) {
|
|
|
83
114
|
let printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK));
|
|
84
115
|
return touchBank.length > MAX_TOUCH_BANK && (printed += ` (original size: ${touchBank.length})`), printed;
|
|
85
116
|
}
|
|
86
|
-
class ResponderTouchHistoryStore {
|
|
87
|
-
_touchHistory = {
|
|
88
|
-
touchBank: [],
|
|
89
|
-
//Array<TouchRecord>
|
|
90
|
-
numberActiveTouches: 0,
|
|
91
|
-
// If there is only one active touch, we remember its location. This prevents
|
|
92
|
-
// us having to loop through all of the touches all the time in the most
|
|
93
|
-
// common case.
|
|
94
|
-
indexOfSingleActiveTouch: -1,
|
|
95
|
-
mostRecentTimeStamp: 0
|
|
96
|
-
};
|
|
97
|
-
recordTouchTrack(topLevelType, nativeEvent) {
|
|
98
|
-
const touchHistory = this._touchHistory;
|
|
99
|
-
if ((0, import_types.isMoveish)(topLevelType))
|
|
100
|
-
nativeEvent.changedTouches.forEach((touch) => recordTouchMove(touch, touchHistory));
|
|
101
|
-
else if ((0, import_types.isStartish)(topLevelType))
|
|
102
|
-
nativeEvent.changedTouches.forEach((touch) => recordTouchStart(touch, touchHistory)), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1 && (touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier);
|
|
103
|
-
else if ((0, import_types.isEndish)(topLevelType) && (nativeEvent.changedTouches.forEach((touch) => recordTouchEnd(touch, touchHistory)), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1)) {
|
|
104
|
-
const { touchBank } = touchHistory;
|
|
105
|
-
for (let i = 0; i < touchBank.length; i++)
|
|
106
|
-
if (touchBank[i]?.touchActive) {
|
|
107
|
-
touchHistory.indexOfSingleActiveTouch = i;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
process.env.NODE_ENV === "development" && (touchBank[touchHistory.indexOfSingleActiveTouch]?.touchActive || console.error("Cannot find single active touch."));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
get touchHistory() {
|
|
114
|
-
return this._touchHistory;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
117
|
//# sourceMappingURL=ResponderTouchHistoryStore.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ResponderTouchHistoryStore.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,mBAAgD;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,mBAAgD;AAEzC,MAAM,2BAA2B;AAAA,EACtC,gBAAgB;AAAA,IACd,WAAW,CAAC;AAAA;AAAA,IACZ,qBAAqB;AAAA;AAAA;AAAA;AAAA,IAIrB,0BAA0B;AAAA,IAC1B,qBAAqB;AAAA,EACvB;AAAA,EAEA,i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B,KAAK,CAAC;AACpE,EAAI,eACF,YAAY,cAAc,IAC1B,YAAY,gBAAgB,YAAY,cACxC,YAAY,gBAAgB,YAAY,cACxC,YAAY,oBAAoB,YAAY,kBAC5C,YAAY,eAAe,MAAM,OACjC,YAAY,eAAe,MAAM,OACjC,YAAY,mBAAmB,kBAAkB,KAAK,GACtD,aAAa,sBAAsB,kBAAkB,KAAK,KAE1D,QAAQ;AAAA,IACN;AAAA;AAAA,IACA,cAAc,WAAW,KAAK,CAAC;AAAA;AAAA,IAC/B,eAAe,eAAe,YAAY,CAAC;AAAA,EAC7C;AAEJ;AAEA,SAAS,WAAW,OAAsB;AACxC,SAAO,KAAK,UAAU;AAAA,IACpB,YAAY,MAAM;AAAA,IAClB,OAAO,MAAM;AAAA,IACb,OAAO,MAAM;AAAA,IACb,WAAW,kBAAkB,KAAK;AAAA,EACpC,CAAC;AACH;AAEA,SAAS,eAAe,cAAsB;AAC5C,QAAM,EAAE,UAAU,IAAI;AACtB,MAAI,UAAU,KAAK,UAAU,UAAU,MAAM,GAAG,cAAc,CAAC;AAC/D,SAAI,UAAU,SAAS,mBACrB,WAAW,oBAAoB,UAAU,MAAM,MAE1C;AACT;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -19,7 +19,78 @@ __export(ResponderTouchHistoryStore_exports, {
|
|
|
19
19
|
});
|
|
20
20
|
module.exports = __toCommonJS(ResponderTouchHistoryStore_exports);
|
|
21
21
|
var import_types = require("./types");
|
|
22
|
-
|
|
22
|
+
function _class_call_check(instance, Constructor) {
|
|
23
|
+
if (!(instance instanceof Constructor))
|
|
24
|
+
throw new TypeError("Cannot call a class as a function");
|
|
25
|
+
}
|
|
26
|
+
function _defineProperties(target, props) {
|
|
27
|
+
for (var i = 0; i < props.length; i++) {
|
|
28
|
+
var descriptor = props[i];
|
|
29
|
+
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
33
|
+
return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
|
|
34
|
+
}
|
|
35
|
+
function _define_property(obj, key, value) {
|
|
36
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
37
|
+
value,
|
|
38
|
+
enumerable: !0,
|
|
39
|
+
configurable: !0,
|
|
40
|
+
writable: !0
|
|
41
|
+
}) : obj[key] = value, obj;
|
|
42
|
+
}
|
|
43
|
+
var ResponderTouchHistoryStore = /* @__PURE__ */ function() {
|
|
44
|
+
"use strict";
|
|
45
|
+
function ResponderTouchHistoryStore2() {
|
|
46
|
+
_class_call_check(this, ResponderTouchHistoryStore2), _define_property(this, "_touchHistory", {
|
|
47
|
+
touchBank: [],
|
|
48
|
+
numberActiveTouches: 0,
|
|
49
|
+
// If there is only one active touch, we remember its location. This prevents
|
|
50
|
+
// us having to loop through all of the touches all the time in the most
|
|
51
|
+
// common case.
|
|
52
|
+
indexOfSingleActiveTouch: -1,
|
|
53
|
+
mostRecentTimeStamp: 0
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return _create_class(ResponderTouchHistoryStore2, [
|
|
57
|
+
{
|
|
58
|
+
key: "recordTouchTrack",
|
|
59
|
+
value: function(topLevelType, nativeEvent) {
|
|
60
|
+
var touchHistory = this._touchHistory;
|
|
61
|
+
if ((0, import_types.isMoveish)(topLevelType))
|
|
62
|
+
nativeEvent.changedTouches.forEach(function(touch) {
|
|
63
|
+
return recordTouchMove(touch, touchHistory);
|
|
64
|
+
});
|
|
65
|
+
else if ((0, import_types.isStartish)(topLevelType))
|
|
66
|
+
nativeEvent.changedTouches.forEach(function(touch) {
|
|
67
|
+
return recordTouchStart(touch, touchHistory);
|
|
68
|
+
}), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1 && (touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier);
|
|
69
|
+
else if ((0, import_types.isEndish)(topLevelType) && (nativeEvent.changedTouches.forEach(function(touch) {
|
|
70
|
+
return recordTouchEnd(touch, touchHistory);
|
|
71
|
+
}), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1)) {
|
|
72
|
+
for (var touchBank = touchHistory.touchBank, i = 0; i < touchBank.length; i++) {
|
|
73
|
+
var touchTrackToCheck = touchBank[i];
|
|
74
|
+
if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
|
|
75
|
+
touchHistory.indexOfSingleActiveTouch = i;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (process.env.NODE_ENV === "development") {
|
|
80
|
+
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
81
|
+
activeRecord != null && activeRecord.touchActive || console.error("Cannot find single active touch.");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: "touchHistory",
|
|
88
|
+
get: function() {
|
|
89
|
+
return this._touchHistory;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]), ResponderTouchHistoryStore2;
|
|
93
|
+
}(), MAX_TOUCH_BANK = 20;
|
|
23
94
|
function timestampForTouch(touch) {
|
|
24
95
|
return touch.timeStamp || touch.timestamp;
|
|
25
96
|
}
|
|
@@ -40,36 +111,25 @@ function createTouchRecord(touch) {
|
|
|
40
111
|
function resetTouchRecord(touchRecord, touch) {
|
|
41
112
|
touchRecord.touchActive = !0, touchRecord.startPageX = touch.pageX, touchRecord.startPageY = touch.pageY, touchRecord.startTimeStamp = timestampForTouch(touch), touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchRecord.previousPageX = touch.pageX, touchRecord.previousPageY = touch.pageY, touchRecord.previousTimeStamp = timestampForTouch(touch);
|
|
42
113
|
}
|
|
43
|
-
function getTouchIdentifier(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
identifier,
|
|
47
|
-
MAX_TOUCH_BANK
|
|
48
|
-
), identifier;
|
|
114
|
+
function getTouchIdentifier(param) {
|
|
115
|
+
var identifier = param.identifier;
|
|
116
|
+
return identifier == null && console.error("Touch object is missing identifier."), process.env.NODE_ENV === "development" && identifier > MAX_TOUCH_BANK && console.error("Touch identifier %s is greater than maximum supported %s which causes performance issues backfilling array locations for all of the indices.", identifier, MAX_TOUCH_BANK), identifier;
|
|
49
117
|
}
|
|
50
118
|
function recordTouchStart(touch, touchHistory) {
|
|
51
|
-
|
|
119
|
+
var identifier = getTouchIdentifier(touch), touchRecord = touchHistory.touchBank[identifier];
|
|
52
120
|
touchRecord ? resetTouchRecord(touchRecord, touch) : touchHistory.touchBank[identifier] = createTouchRecord(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
53
121
|
}
|
|
54
122
|
function recordTouchMove(touch, touchHistory) {
|
|
55
|
-
|
|
56
|
-
touchRecord ? (touchRecord.touchActive = !0, touchRecord.previousPageX = touchRecord.currentPageX, touchRecord.previousPageY = touchRecord.currentPageY, touchRecord.previousTimeStamp = touchRecord.currentTimeStamp, touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch)) : console.warn(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`Touch Move: ${printTouch(touch)}
|
|
60
|
-
`,
|
|
61
|
-
`Touch Bank: ${printTouchBank(touchHistory)}`
|
|
62
|
-
);
|
|
123
|
+
var touchRecord = touchHistory.touchBank[getTouchIdentifier(touch)];
|
|
124
|
+
touchRecord ? (touchRecord.touchActive = !0, touchRecord.previousPageX = touchRecord.currentPageX, touchRecord.previousPageY = touchRecord.currentPageY, touchRecord.previousTimeStamp = touchRecord.currentTimeStamp, touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch)) : console.warn(`Cannot record touch move without a touch start.
|
|
125
|
+
`, "Touch Move: ".concat(printTouch(touch), `
|
|
126
|
+
`), "Touch Bank: ".concat(printTouchBank(touchHistory)));
|
|
63
127
|
}
|
|
64
128
|
function recordTouchEnd(touch, touchHistory) {
|
|
65
|
-
|
|
66
|
-
touchRecord ? (touchRecord.touchActive = !1, touchRecord.previousPageX = touchRecord.currentPageX, touchRecord.previousPageY = touchRecord.currentPageY, touchRecord.previousTimeStamp = touchRecord.currentTimeStamp, touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch)) : console.warn(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`Touch End: ${printTouch(touch)}
|
|
70
|
-
`,
|
|
71
|
-
`Touch Bank: ${printTouchBank(touchHistory)}`
|
|
72
|
-
);
|
|
129
|
+
var touchRecord = touchHistory.touchBank[getTouchIdentifier(touch)];
|
|
130
|
+
touchRecord ? (touchRecord.touchActive = !1, touchRecord.previousPageX = touchRecord.currentPageX, touchRecord.previousPageY = touchRecord.currentPageY, touchRecord.previousTimeStamp = touchRecord.currentTimeStamp, touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch)) : console.warn(`Cannot record touch end without a touch start.
|
|
131
|
+
`, "Touch End: ".concat(printTouch(touch), `
|
|
132
|
+
`), "Touch Bank: ".concat(printTouchBank(touchHistory)));
|
|
73
133
|
}
|
|
74
134
|
function printTouch(touch) {
|
|
75
135
|
return JSON.stringify({
|
|
@@ -80,47 +140,8 @@ function printTouch(touch) {
|
|
|
80
140
|
});
|
|
81
141
|
}
|
|
82
142
|
function printTouchBank(touchHistory) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return touchBank.length > MAX_TOUCH_BANK && (printed += ` (original size: ${touchBank.length})`), printed;
|
|
86
|
-
}
|
|
87
|
-
class ResponderTouchHistoryStore {
|
|
88
|
-
constructor() {
|
|
89
|
-
this._touchHistory = {
|
|
90
|
-
touchBank: [],
|
|
91
|
-
//Array<TouchRecord>
|
|
92
|
-
numberActiveTouches: 0,
|
|
93
|
-
// If there is only one active touch, we remember its location. This prevents
|
|
94
|
-
// us having to loop through all of the touches all the time in the most
|
|
95
|
-
// common case.
|
|
96
|
-
indexOfSingleActiveTouch: -1,
|
|
97
|
-
mostRecentTimeStamp: 0
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
recordTouchTrack(topLevelType, nativeEvent) {
|
|
101
|
-
const touchHistory = this._touchHistory;
|
|
102
|
-
if ((0, import_types.isMoveish)(topLevelType))
|
|
103
|
-
nativeEvent.changedTouches.forEach((touch) => recordTouchMove(touch, touchHistory));
|
|
104
|
-
else if ((0, import_types.isStartish)(topLevelType))
|
|
105
|
-
nativeEvent.changedTouches.forEach((touch) => recordTouchStart(touch, touchHistory)), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1 && (touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier);
|
|
106
|
-
else if ((0, import_types.isEndish)(topLevelType) && (nativeEvent.changedTouches.forEach((touch) => recordTouchEnd(touch, touchHistory)), touchHistory.numberActiveTouches = nativeEvent.touches.length, touchHistory.numberActiveTouches === 1)) {
|
|
107
|
-
const { touchBank } = touchHistory;
|
|
108
|
-
for (let i = 0; i < touchBank.length; i++) {
|
|
109
|
-
const touchTrackToCheck = touchBank[i];
|
|
110
|
-
if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
|
|
111
|
-
touchHistory.indexOfSingleActiveTouch = i;
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (process.env.NODE_ENV === "development") {
|
|
116
|
-
const activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
117
|
-
activeRecord != null && activeRecord.touchActive || console.error("Cannot find single active touch.");
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
get touchHistory() {
|
|
122
|
-
return this._touchHistory;
|
|
123
|
-
}
|
|
143
|
+
var touchBank = touchHistory.touchBank, printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK));
|
|
144
|
+
return touchBank.length > MAX_TOUCH_BANK && (printed += " (original size: ".concat(touchBank.length, ")")), printed;
|
|
124
145
|
}
|
|
125
146
|
// Annotate the CommonJS export names for ESM import in node:
|
|
126
147
|
0 && (module.exports = {
|