@tamagui/react-native-use-responder-events 2.7.7 → 3.0.0-beta.643.1
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.cjs +307 -344
- package/dist/cjs/ResponderSystem.native.cjs +357 -0
- package/dist/cjs/ResponderSystem.native.js +307 -343
- package/dist/cjs/ResponderSystem.native.js.map +1 -1
- package/dist/cjs/ResponderTouchHistoryStore.cjs +136 -149
- package/dist/cjs/ResponderTouchHistoryStore.native.cjs +217 -0
- package/dist/cjs/ResponderTouchHistoryStore.native.js +176 -189
- package/dist/cjs/ResponderTouchHistoryStore.native.js.map +1 -1
- package/dist/cjs/createResponderEvent.cjs +128 -132
- package/dist/cjs/createResponderEvent.native.cjs +147 -0
- package/dist/cjs/createResponderEvent.native.js +129 -132
- package/dist/cjs/createResponderEvent.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +21 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +40 -41
- package/dist/cjs/types.native.cjs +79 -0
- package/dist/cjs/types.native.js +40 -40
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useResponderEvents.cjs +60 -85
- package/dist/cjs/useResponderEvents.native.cjs +87 -0
- package/dist/cjs/useResponderEvents.native.js +62 -86
- package/dist/cjs/useResponderEvents.native.js.map +1 -1
- package/dist/cjs/utils.cjs +123 -135
- package/dist/cjs/utils.native.cjs +160 -0
- package/dist/cjs/utils.native.js +124 -135
- package/dist/cjs/utils.native.js.map +1 -1
- package/dist/esm/ResponderSystem.mjs +291 -326
- package/dist/esm/ResponderSystem.mjs.map +1 -1
- package/dist/esm/ResponderSystem.native.js +291 -326
- package/dist/esm/ResponderSystem.native.js.map +1 -1
- package/dist/esm/ResponderTouchHistoryStore.mjs +123 -131
- package/dist/esm/ResponderTouchHistoryStore.mjs.map +1 -1
- package/dist/esm/ResponderTouchHistoryStore.native.js +163 -172
- package/dist/esm/ResponderTouchHistoryStore.native.js.map +1 -1
- package/dist/esm/createResponderEvent.mjs +115 -114
- package/dist/esm/createResponderEvent.mjs.map +1 -1
- package/dist/esm/createResponderEvent.native.js +116 -115
- package/dist/esm/createResponderEvent.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/esm/types.mjs +7 -6
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js +7 -6
- package/dist/esm/types.native.js.map +1 -1
- package/dist/esm/useResponderEvents.mjs +45 -61
- package/dist/esm/useResponderEvents.mjs.map +1 -1
- package/dist/esm/useResponderEvents.native.js +47 -63
- package/dist/esm/useResponderEvents.native.js.map +1 -1
- package/dist/esm/utils.mjs +101 -111
- package/dist/esm/utils.mjs.map +1 -1
- package/dist/esm/utils.native.js +102 -112
- package/dist/esm/utils.native.js.map +1 -1
- package/package.json +2 -2
- package/types/ResponderTouchHistoryStore.d.ts.map +1 -1
- package/types/utils.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
|
@@ -1,204 +1,195 @@
|
|
|
1
1
|
import { isEndish, isMoveish, isStartish } from "./types.native.js";
|
|
2
|
+
|
|
2
3
|
function _class_call_check(instance, Constructor) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
if (!(instance instanceof Constructor)) {
|
|
5
|
+
throw new TypeError("Cannot call a class as a function");
|
|
6
|
+
}
|
|
6
7
|
}
|
|
7
8
|
function _defineProperties(target, props) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
for (var i = 0; i < props.length; i++) {
|
|
10
|
+
var descriptor = props[i];
|
|
11
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
12
|
+
descriptor.configurable = true;
|
|
13
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
14
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
15
|
+
}
|
|
15
16
|
}
|
|
16
17
|
function _create_class(Constructor, protoProps, staticProps) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
19
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
20
|
+
return Constructor;
|
|
20
21
|
}
|
|
21
22
|
function _define_property(obj, key, value) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
if (key in obj) {
|
|
24
|
+
Object.defineProperty(obj, key, {
|
|
25
|
+
value,
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
obj[key] = value;
|
|
32
|
+
}
|
|
33
|
+
return obj;
|
|
33
34
|
}
|
|
34
|
-
var ResponderTouchHistoryStore = /* @__PURE__ */
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
key: "touchHistory",
|
|
93
|
-
get: function get() {
|
|
94
|
-
return this._touchHistory;
|
|
95
|
-
}
|
|
96
|
-
}]);
|
|
97
|
-
return ResponderTouchHistoryStore2;
|
|
98
|
-
}();
|
|
35
|
+
var ResponderTouchHistoryStore = /* @__PURE__ */ (function() {
|
|
36
|
+
"use strict";
|
|
37
|
+
function ResponderTouchHistoryStore2() {
|
|
38
|
+
_class_call_check(this, ResponderTouchHistoryStore2);
|
|
39
|
+
_define_property(this, "_touchHistory", {
|
|
40
|
+
touchBank: [],
|
|
41
|
+
numberActiveTouches: 0,
|
|
42
|
+
indexOfSingleActiveTouch: -1,
|
|
43
|
+
mostRecentTimeStamp: 0
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
_create_class(ResponderTouchHistoryStore2, [{
|
|
47
|
+
key: "recordTouchTrack",
|
|
48
|
+
value: function recordTouchTrack(topLevelType, nativeEvent) {
|
|
49
|
+
var touchHistory = this._touchHistory;
|
|
50
|
+
if (isMoveish(topLevelType)) {
|
|
51
|
+
nativeEvent.changedTouches.forEach(function(touch) {
|
|
52
|
+
return recordTouchMove(touch, touchHistory);
|
|
53
|
+
});
|
|
54
|
+
} else if (isStartish(topLevelType)) {
|
|
55
|
+
nativeEvent.changedTouches.forEach(function(touch) {
|
|
56
|
+
return recordTouchStart(touch, touchHistory);
|
|
57
|
+
});
|
|
58
|
+
touchHistory.numberActiveTouches = nativeEvent.touches.length;
|
|
59
|
+
if (touchHistory.numberActiveTouches === 1) {
|
|
60
|
+
touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier;
|
|
61
|
+
}
|
|
62
|
+
} else if (isEndish(topLevelType)) {
|
|
63
|
+
nativeEvent.changedTouches.forEach(function(touch) {
|
|
64
|
+
return recordTouchEnd(touch, touchHistory);
|
|
65
|
+
});
|
|
66
|
+
touchHistory.numberActiveTouches = nativeEvent.touches.length;
|
|
67
|
+
if (touchHistory.numberActiveTouches === 1) {
|
|
68
|
+
var { touchBank } = touchHistory;
|
|
69
|
+
for (var i = 0; i < touchBank.length; i++) {
|
|
70
|
+
var touchTrackToCheck = touchBank[i];
|
|
71
|
+
if (touchTrackToCheck === null || touchTrackToCheck === void 0 ? void 0 : touchTrackToCheck.touchActive) {
|
|
72
|
+
touchHistory.indexOfSingleActiveTouch = i;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (process.env.NODE_ENV === "development") {
|
|
77
|
+
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
78
|
+
if (!(activeRecord === null || activeRecord === void 0 ? void 0 : activeRecord.touchActive)) {
|
|
79
|
+
console.error("Cannot find single active touch.");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "touchHistory",
|
|
87
|
+
get: function get() {
|
|
88
|
+
return this._touchHistory;
|
|
89
|
+
}
|
|
90
|
+
}]);
|
|
91
|
+
return ResponderTouchHistoryStore2;
|
|
92
|
+
})();
|
|
99
93
|
var MAX_TOUCH_BANK = 20;
|
|
100
94
|
function timestampForTouch(touch) {
|
|
101
|
-
|
|
95
|
+
return touch["timeStamp"] || touch.timestamp;
|
|
102
96
|
}
|
|
103
97
|
function createTouchRecord(touch) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
98
|
+
return {
|
|
99
|
+
touchActive: true,
|
|
100
|
+
startPageX: touch.pageX,
|
|
101
|
+
startPageY: touch.pageY,
|
|
102
|
+
startTimeStamp: timestampForTouch(touch),
|
|
103
|
+
currentPageX: touch.pageX,
|
|
104
|
+
currentPageY: touch.pageY,
|
|
105
|
+
currentTimeStamp: timestampForTouch(touch),
|
|
106
|
+
previousPageX: touch.pageX,
|
|
107
|
+
previousPageY: touch.pageY,
|
|
108
|
+
previousTimeStamp: timestampForTouch(touch)
|
|
109
|
+
};
|
|
116
110
|
}
|
|
117
111
|
function resetTouchRecord(touchRecord, touch) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
112
|
+
touchRecord.touchActive = true;
|
|
113
|
+
touchRecord.startPageX = touch.pageX;
|
|
114
|
+
touchRecord.startPageY = touch.pageY;
|
|
115
|
+
touchRecord.startTimeStamp = timestampForTouch(touch);
|
|
116
|
+
touchRecord.currentPageX = touch.pageX;
|
|
117
|
+
touchRecord.currentPageY = touch.pageY;
|
|
118
|
+
touchRecord.currentTimeStamp = timestampForTouch(touch);
|
|
119
|
+
touchRecord.previousPageX = touch.pageX;
|
|
120
|
+
touchRecord.previousPageY = touch.pageY;
|
|
121
|
+
touchRecord.previousTimeStamp = timestampForTouch(touch);
|
|
128
122
|
}
|
|
129
123
|
function getTouchIdentifier(param) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
return identifier;
|
|
124
|
+
var { identifier } = param;
|
|
125
|
+
if (identifier == null) {
|
|
126
|
+
console.error("Touch object is missing identifier.");
|
|
127
|
+
}
|
|
128
|
+
if (process.env.NODE_ENV === "development") {
|
|
129
|
+
if (identifier > MAX_TOUCH_BANK) {
|
|
130
|
+
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);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return identifier;
|
|
142
134
|
}
|
|
143
135
|
function recordTouchStart(touch, touchHistory) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
136
|
+
var identifier = getTouchIdentifier(touch);
|
|
137
|
+
var touchRecord = touchHistory.touchBank[identifier];
|
|
138
|
+
if (touchRecord) {
|
|
139
|
+
resetTouchRecord(touchRecord, touch);
|
|
140
|
+
} else {
|
|
141
|
+
touchHistory.touchBank[identifier] = createTouchRecord(touch);
|
|
142
|
+
}
|
|
143
|
+
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
152
144
|
}
|
|
153
145
|
function recordTouchMove(touch, touchHistory) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
146
|
+
var touchRecord = touchHistory.touchBank[getTouchIdentifier(touch)];
|
|
147
|
+
if (touchRecord) {
|
|
148
|
+
touchRecord.touchActive = true;
|
|
149
|
+
touchRecord.previousPageX = touchRecord.currentPageX;
|
|
150
|
+
touchRecord.previousPageY = touchRecord.currentPageY;
|
|
151
|
+
touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;
|
|
152
|
+
touchRecord.currentPageX = touch.pageX;
|
|
153
|
+
touchRecord.currentPageY = touch.pageY;
|
|
154
|
+
touchRecord.currentTimeStamp = timestampForTouch(touch);
|
|
155
|
+
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
156
|
+
} else {
|
|
157
|
+
console.warn("Cannot record touch move without a touch start.\n", `Touch Move: ${printTouch(touch)}
|
|
166
158
|
`, `Touch Bank: ${printTouchBank(touchHistory)}`);
|
|
167
|
-
|
|
159
|
+
}
|
|
168
160
|
}
|
|
169
161
|
function recordTouchEnd(touch, touchHistory) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
162
|
+
var touchRecord = touchHistory.touchBank[getTouchIdentifier(touch)];
|
|
163
|
+
if (touchRecord) {
|
|
164
|
+
touchRecord.touchActive = false;
|
|
165
|
+
touchRecord.previousPageX = touchRecord.currentPageX;
|
|
166
|
+
touchRecord.previousPageY = touchRecord.currentPageY;
|
|
167
|
+
touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;
|
|
168
|
+
touchRecord.currentPageX = touch.pageX;
|
|
169
|
+
touchRecord.currentPageY = touch.pageY;
|
|
170
|
+
touchRecord.currentTimeStamp = timestampForTouch(touch);
|
|
171
|
+
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
172
|
+
} else {
|
|
173
|
+
console.warn("Cannot record touch end without a touch start.\n", `Touch End: ${printTouch(touch)}
|
|
182
174
|
`, `Touch Bank: ${printTouchBank(touchHistory)}`);
|
|
183
|
-
|
|
175
|
+
}
|
|
184
176
|
}
|
|
185
177
|
function printTouch(touch) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
178
|
+
return JSON.stringify({
|
|
179
|
+
identifier: touch.identifier,
|
|
180
|
+
pageX: touch.pageX,
|
|
181
|
+
pageY: touch.pageY,
|
|
182
|
+
timestamp: timestampForTouch(touch)
|
|
183
|
+
});
|
|
192
184
|
}
|
|
193
185
|
function printTouchBank(touchHistory) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
return printed;
|
|
186
|
+
var { touchBank } = touchHistory;
|
|
187
|
+
var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK));
|
|
188
|
+
if (touchBank.length > MAX_TOUCH_BANK) {
|
|
189
|
+
printed += ` (original size: ${touchBank.length})`;
|
|
190
|
+
}
|
|
191
|
+
return printed;
|
|
202
192
|
}
|
|
193
|
+
|
|
203
194
|
export { ResponderTouchHistoryStore };
|
|
204
195
|
//# sourceMappingURL=ResponderTouchHistoryStore.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isEndish","isMoveish","isStartish","_class_call_check","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","protoProps","staticProps","prototype","_define_property","obj","value","ResponderTouchHistoryStore","ResponderTouchHistoryStore2","touchBank","numberActiveTouches","indexOfSingleActiveTouch","mostRecentTimeStamp","recordTouchTrack","topLevelType","nativeEvent","touchHistory","_touchHistory","changedTouches","forEach","touch","recordTouchMove","recordTouchStart","touches","identifier","recordTouchEnd","touchTrackToCheck","touchActive","process","env","NODE_ENV","activeRecord","console","error","get","MAX_TOUCH_BANK","timestampForTouch","timestamp","createTouchRecord","startPageX","pageX","startPageY","pageY","startTimeStamp","currentPageX","currentPageY","currentTimeStamp","previousPageX","previousPageY","previousTimeStamp","resetTouchRecord","touchRecord","getTouchIdentifier","param"],"sources":["../../src/ResponderTouchHistoryStore.ts"],"sourcesContent":[null],"mappings":"AAQA,SAASA,QAAA,EAAUC,SAAA,EAAWC,UAAA,QAAkB;AAEzC,SAAMC,kBAAAC,QAA2B,EAAAC,WAAA;EACtC,MAAAD,QAAA,YAAgBC,WAAA;IACd,UAAAC,SAAY;EAAA;AAAA;AACS,SAAAC,kBAAAC,MAAA,EAAAC,KAAA;EAAA,SAAAC,CAAA,MAAAA,CAAA,GAAAD,KAAA,CAAAE,MAAA,EAAAD,CAAA;IAAA,IAAAE,UAAA,GAAAH,KAAA,CAAAC,CAAA;IAIrBE,UAAA,CAAAC,UAAA,GA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6B,KAAA;EACZ,IAAA7B,UAAY;IACZQ,OAAA,CAAAC,KAAY,sCAAqC;EACjD;EACF,IAAAL,OAAO,CAAAC,GAAA,CAAAC,QAAA;IACL,IAAAN,UAAQ,GAAAW,cAAA;MACNH,OAAA,CAAAC,KAAA,iJAAAT,UAAA,EAAAW,cAAA;IAAA;EAC+B;EAAA,OAC/BX,UAAA;AAA2C;AAC7C,SACFF,iBAAAF,KAAA,EAAAJ,YAAA;EACF,IAAAQ,UAAA,GAAA4B,kBAAA,CAAAhC,KAAA;EAEA,IAAA+B,WAAS,GAAWnC,YAAsB,CAAAP,SAAA,CAAAe,UAAA;EACxC,IAAA2B,WAAY;IACVD,gBAAY,CAAAC,WAAM,EAAA/B,KAAA;EAAA,OAClB;IACAJ,YAAO,CAAMP,SAAA,CAAAe,UAAA,IAAAc,iBAAA,CAAAlB,KAAA;EAAA;EAEfJ,YAAC,CAAAJ,mBAAA,GAAAwB,iBAAA,CAAAhB,KAAA;AACH;AAEA,SAASC,eAAeA,CAAAD,KAAA,EAAAJ,YAAsB;EAC5C,IAAAmC,WAAQ,GAAUnC,YAAI,CAAAP,SAAA,CAAA2C,kBAAA,CAAAhC,KAAA;EACtB,IAAI+B,WAAU;IACdA,WAAI,CAAUxB,WAAS;IACrBwB,WAAW,CAAAJ,aAAA,GAAAI,WAAoB,CAAAP,YAAgB;IACjDO,WAAA,CAAAH,aAAA,GAAAG,WAAA,CAAAN,YAAA;IACAM,WAAO,CAAAF,iBAAA,GAAAE,WAAA,CAAAL,gBAAA;IACTK,WAAA,CAAAP,YAAA,GAAAxB,KAAA,CAAAoB,KAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ResponderTouchHistoryStore.native.js","names":[],"sources":["esm/ResponderTouchHistoryStore.native.js"],"sourcesContent":["import { isEndish, isMoveish, isStartish } from \"./types\";\nfunction _class_call_check(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nfunction _create_class(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\nfunction _define_property(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nvar ResponderTouchHistoryStore = /* @__PURE__ */ (function() {\n \"use strict\";\n function ResponderTouchHistoryStore2() {\n _class_call_check(this, ResponderTouchHistoryStore2);\n _define_property(this, \"_touchHistory\", {\n touchBank: [],\n //Array<TouchRecord>\n numberActiveTouches: 0,\n // If there is only one active touch, we remember its location. This prevents\n // us having to loop through all of the touches all the time in the most\n // common case.\n indexOfSingleActiveTouch: -1,\n mostRecentTimeStamp: 0\n });\n }\n _create_class(ResponderTouchHistoryStore2, [\n {\n key: \"recordTouchTrack\",\n value: function recordTouchTrack(topLevelType, nativeEvent) {\n var touchHistory = this._touchHistory;\n if (isMoveish(topLevelType)) {\n nativeEvent.changedTouches.forEach(function(touch) {\n return recordTouchMove(touch, touchHistory);\n });\n } else if (isStartish(topLevelType)) {\n nativeEvent.changedTouches.forEach(function(touch) {\n return recordTouchStart(touch, touchHistory);\n });\n touchHistory.numberActiveTouches = nativeEvent.touches.length;\n if (touchHistory.numberActiveTouches === 1) {\n touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier;\n }\n } else if (isEndish(topLevelType)) {\n nativeEvent.changedTouches.forEach(function(touch) {\n return recordTouchEnd(touch, touchHistory);\n });\n touchHistory.numberActiveTouches = nativeEvent.touches.length;\n if (touchHistory.numberActiveTouches === 1) {\n var { touchBank } = touchHistory;\n for (var i = 0; i < touchBank.length; i++) {\n var touchTrackToCheck = touchBank[i];\n if (touchTrackToCheck === null || touchTrackToCheck === void 0 ? void 0 : touchTrackToCheck.touchActive) {\n touchHistory.indexOfSingleActiveTouch = i;\n break;\n }\n }\n if (process.env.NODE_ENV === \"development\") {\n var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];\n if (!(activeRecord === null || activeRecord === void 0 ? void 0 : activeRecord.touchActive)) {\n console.error(\"Cannot find single active touch.\");\n }\n }\n }\n }\n }\n },\n {\n key: \"touchHistory\",\n get: function get() {\n return this._touchHistory;\n }\n }\n ]);\n return ResponderTouchHistoryStore2;\n})();\nvar MAX_TOUCH_BANK = 20;\nfunction timestampForTouch(touch) {\n return touch[\"timeStamp\"] || touch.timestamp;\n}\nfunction createTouchRecord(touch) {\n return {\n touchActive: true,\n startPageX: touch.pageX,\n startPageY: touch.pageY,\n startTimeStamp: timestampForTouch(touch),\n currentPageX: touch.pageX,\n currentPageY: touch.pageY,\n currentTimeStamp: timestampForTouch(touch),\n previousPageX: touch.pageX,\n previousPageY: touch.pageY,\n previousTimeStamp: timestampForTouch(touch)\n };\n}\nfunction resetTouchRecord(touchRecord, touch) {\n touchRecord.touchActive = true;\n touchRecord.startPageX = touch.pageX;\n touchRecord.startPageY = touch.pageY;\n touchRecord.startTimeStamp = timestampForTouch(touch);\n touchRecord.currentPageX = touch.pageX;\n touchRecord.currentPageY = touch.pageY;\n touchRecord.currentTimeStamp = timestampForTouch(touch);\n touchRecord.previousPageX = touch.pageX;\n touchRecord.previousPageY = touch.pageY;\n touchRecord.previousTimeStamp = timestampForTouch(touch);\n}\nfunction getTouchIdentifier(param) {\n var { identifier } = param;\n if (identifier == null) {\n console.error(\"Touch object is missing identifier.\");\n }\n if (process.env.NODE_ENV === \"development\") {\n if (identifier > MAX_TOUCH_BANK) {\n 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);\n }\n }\n return identifier;\n}\nfunction recordTouchStart(touch, touchHistory) {\n var identifier = getTouchIdentifier(touch);\n var touchRecord = touchHistory.touchBank[identifier];\n if (touchRecord) {\n resetTouchRecord(touchRecord, touch);\n } else {\n touchHistory.touchBank[identifier] = createTouchRecord(touch);\n }\n touchHistory.mostRecentTimeStamp = timestampForTouch(touch);\n}\nfunction recordTouchMove(touch, touchHistory) {\n var touchRecord = touchHistory.touchBank[getTouchIdentifier(touch)];\n if (touchRecord) {\n touchRecord.touchActive = true;\n touchRecord.previousPageX = touchRecord.currentPageX;\n touchRecord.previousPageY = touchRecord.currentPageY;\n touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;\n touchRecord.currentPageX = touch.pageX;\n touchRecord.currentPageY = touch.pageY;\n touchRecord.currentTimeStamp = timestampForTouch(touch);\n touchHistory.mostRecentTimeStamp = timestampForTouch(touch);\n } else {\n console.warn(\"Cannot record touch move without a touch start.\\n\", `Touch Move: ${printTouch(touch)}\n`, `Touch Bank: ${printTouchBank(touchHistory)}`);\n }\n}\nfunction recordTouchEnd(touch, touchHistory) {\n var touchRecord = touchHistory.touchBank[getTouchIdentifier(touch)];\n if (touchRecord) {\n touchRecord.touchActive = false;\n touchRecord.previousPageX = touchRecord.currentPageX;\n touchRecord.previousPageY = touchRecord.currentPageY;\n touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;\n touchRecord.currentPageX = touch.pageX;\n touchRecord.currentPageY = touch.pageY;\n touchRecord.currentTimeStamp = timestampForTouch(touch);\n touchHistory.mostRecentTimeStamp = timestampForTouch(touch);\n } else {\n console.warn(\"Cannot record touch end without a touch start.\\n\", `Touch End: ${printTouch(touch)}\n`, `Touch Bank: ${printTouchBank(touchHistory)}`);\n }\n}\nfunction printTouch(touch) {\n return JSON.stringify({\n identifier: touch.identifier,\n pageX: touch.pageX,\n pageY: touch.pageY,\n timestamp: timestampForTouch(touch)\n });\n}\nfunction printTouchBank(touchHistory) {\n var { touchBank } = touchHistory;\n var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK));\n if (touchBank.length > MAX_TOUCH_BANK) {\n printed += ` (original size: ${touchBank.length})`;\n }\n return printed;\n}\nexport {\n ResponderTouchHistoryStore\n};\n//# sourceMappingURL=ResponderTouchHistoryStore.js.map\n"],"mappings":";;;AACA,SAAS,kBAAkB,UAAU,aAAa;CAChD,IAAI,EAAE,oBAAoB,cAAc;EACtC,MAAM,IAAI,UAAU,mCAAmC;CACzD;AACF;AACA,SAAS,kBAAkB,QAAQ,OAAO;CACxC,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,IAAI,aAAa,MAAM;EACvB,WAAW,aAAa,WAAW,cAAc;EACjD,WAAW,eAAe;EAC1B,IAAI,WAAW,YAAY,WAAW,WAAW;EACjD,OAAO,eAAe,QAAQ,WAAW,KAAK,UAAU;CAC1D;AACF;AACA,SAAS,cAAc,aAAa,YAAY,aAAa;CAC3D,IAAI,YAAY,kBAAkB,YAAY,WAAW,UAAU;CACnE,IAAI,aAAa,kBAAkB,aAAa,WAAW;CAC3D,OAAO;AACT;AACA,SAAS,iBAAiB,KAAK,KAAK,OAAO;CACzC,IAAI,OAAO,KAAK;EACd,OAAO,eAAe,KAAK,KAAK;GAC9B;GACA,YAAY;GACZ,cAAc;GACd,UAAU;EACZ,CAAC;CACH,OAAO;EACL,IAAI,OAAO;CACb;CACA,OAAO;AACT;AACA,IAAI,6BAA6C,iBAAC,WAAW;CAC3D;CACA,SAAS,8BAA8B;EACrC,kBAAkB,MAAM,2BAA2B;EACnD,iBAAiB,MAAM,iBAAiB;GACtC,WAAW,CAAC;GAEZ,qBAAqB;GAIrB,0BAA0B,CAAC;GAC3B,qBAAqB;EACvB,CAAC;CACH;CACA,cAAc,6BAA6B,CACzC;EACE,KAAK;EACL,OAAO,SAAS,iBAAiB,cAAc,aAAa;GAC1D,IAAI,eAAe,KAAK;GACxB,IAAI,UAAU,YAAY,GAAG;IAC3B,YAAY,eAAe,QAAQ,SAAS,OAAO;KACjD,O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AAK,EAAE;GACpG,eAAe,eAAe,YAAY,GAAG;CAC9C;AACF;AACA,SAAS,eAAe,OAAO,cAAc;CAC3C,IAAI,cAAc,aAAa,UAAU,mBAAmB,KAAK;CACjE,IAAI,aAAa;EACf,YAAY,cAAc;EAC1B,YAAY,gBAAgB,YAAY;EACxC,YAAY,gBAAgB,YAAY;EACxC,YAAY,oBAAoB,YAAY;EAC5C,YAAY,eAAe,MAAM;EACjC,YAAY,eAAe,MAAM;EACjC,YAAY,mBAAmB,kBAAkB,KAAK;EACtD,aAAa,sBAAsB,kBAAkB,KAAK;CAC5D,OAAO;EACL,QAAQ,KAAK,oDAAoD,cAAc,WAAW,KAAK,EAAE;GAClG,eAAe,eAAe,YAAY,GAAG;CAC9C;AACF;AACA,SAAS,WAAW,OAAO;CACzB,OAAO,KAAK,UAAU;EACpB,YAAY,MAAM;EAClB,OAAO,MAAM;EACb,OAAO,MAAM;EACb,WAAW,kBAAkB,KAAK;CACpC,CAAC;AACH;AACA,SAAS,eAAe,cAAc;CACpC,IAAI,EAAE,cAAc;CACpB,IAAI,UAAU,KAAK,UAAU,UAAU,MAAM,GAAG,cAAc,CAAC;CAC/D,IAAI,UAAU,SAAS,gBAAgB;EACrC,WAAW,oBAAoB,UAAU,OAAO;CAClD;CACA,OAAO;AACT"}
|
|
@@ -1,124 +1,125 @@
|
|
|
1
1
|
import { getBoundingClientRect } from "./utils.mjs";
|
|
2
|
+
|
|
2
3
|
const emptyFunction = () => {};
|
|
3
4
|
const emptyObject = {};
|
|
4
5
|
const emptyArray = [];
|
|
5
6
|
function normalizeIdentifier(identifier) {
|
|
6
|
-
|
|
7
|
+
return identifier > 20 ? identifier % 20 : identifier;
|
|
7
8
|
}
|
|
8
9
|
function createResponderEvent(domEvent, responderTouchHistoryStore) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return responderEvent;
|
|
10
|
+
let rect;
|
|
11
|
+
let propagationWasStopped = false;
|
|
12
|
+
let changedTouches;
|
|
13
|
+
let touches;
|
|
14
|
+
const domEventChangedTouches = domEvent.changedTouches;
|
|
15
|
+
const domEventType = domEvent.type;
|
|
16
|
+
const metaKey = domEvent.metaKey === true;
|
|
17
|
+
const shiftKey = domEvent.shiftKey === true;
|
|
18
|
+
const force = domEventChangedTouches?.[0].force || 0;
|
|
19
|
+
const identifier = normalizeIdentifier(domEventChangedTouches?.[0].identifier || 0);
|
|
20
|
+
const clientX = domEventChangedTouches?.[0].clientX || domEvent.clientX;
|
|
21
|
+
const clientY = domEventChangedTouches?.[0].clientY || domEvent.clientY;
|
|
22
|
+
const pageX = domEventChangedTouches?.[0].pageX || domEvent.pageX;
|
|
23
|
+
const pageY = domEventChangedTouches?.[0].pageY || domEvent.pageY;
|
|
24
|
+
const preventDefault = typeof domEvent.preventDefault === "function" ? domEvent.preventDefault.bind(domEvent) : emptyFunction;
|
|
25
|
+
const timestamp = domEvent.timeStamp;
|
|
26
|
+
function normalizeTouches(touches2) {
|
|
27
|
+
return Array.prototype.slice.call(touches2).map((touch) => {
|
|
28
|
+
return {
|
|
29
|
+
force: touch.force,
|
|
30
|
+
identifier: normalizeIdentifier(touch.identifier),
|
|
31
|
+
get locationX() {
|
|
32
|
+
return locationX(touch.clientX);
|
|
33
|
+
},
|
|
34
|
+
get locationY() {
|
|
35
|
+
return locationY(touch.clientY);
|
|
36
|
+
},
|
|
37
|
+
pageX: touch.pageX,
|
|
38
|
+
pageY: touch.pageY,
|
|
39
|
+
target: touch.target,
|
|
40
|
+
timestamp
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (domEventChangedTouches != null) {
|
|
45
|
+
changedTouches = normalizeTouches(domEventChangedTouches);
|
|
46
|
+
touches = normalizeTouches(domEvent.touches);
|
|
47
|
+
} else {
|
|
48
|
+
const emulatedTouches = [{
|
|
49
|
+
force,
|
|
50
|
+
identifier,
|
|
51
|
+
get locationX() {
|
|
52
|
+
return locationX(clientX);
|
|
53
|
+
},
|
|
54
|
+
get locationY() {
|
|
55
|
+
return locationY(clientY);
|
|
56
|
+
},
|
|
57
|
+
pageX,
|
|
58
|
+
pageY,
|
|
59
|
+
target: domEvent.target,
|
|
60
|
+
timestamp
|
|
61
|
+
}];
|
|
62
|
+
changedTouches = emulatedTouches;
|
|
63
|
+
touches = domEventType === "mouseup" || domEventType === "dragstart" ? emptyArray : emulatedTouches;
|
|
64
|
+
}
|
|
65
|
+
const responderEvent = {
|
|
66
|
+
bubbles: true,
|
|
67
|
+
cancelable: true,
|
|
68
|
+
currentTarget: null,
|
|
69
|
+
defaultPrevented: domEvent.defaultPrevented,
|
|
70
|
+
dispatchConfig: emptyObject,
|
|
71
|
+
eventPhase: domEvent.eventPhase,
|
|
72
|
+
isDefaultPrevented() {
|
|
73
|
+
return domEvent.defaultPrevented;
|
|
74
|
+
},
|
|
75
|
+
isPropagationStopped() {
|
|
76
|
+
return propagationWasStopped;
|
|
77
|
+
},
|
|
78
|
+
isTrusted: domEvent.isTrusted,
|
|
79
|
+
nativeEvent: {
|
|
80
|
+
altKey: false,
|
|
81
|
+
ctrlKey: false,
|
|
82
|
+
metaKey,
|
|
83
|
+
shiftKey,
|
|
84
|
+
changedTouches,
|
|
85
|
+
force,
|
|
86
|
+
identifier,
|
|
87
|
+
get locationX() {
|
|
88
|
+
return locationX(clientX);
|
|
89
|
+
},
|
|
90
|
+
get locationY() {
|
|
91
|
+
return locationY(clientY);
|
|
92
|
+
},
|
|
93
|
+
pageX,
|
|
94
|
+
pageY,
|
|
95
|
+
target: domEvent.target,
|
|
96
|
+
timestamp,
|
|
97
|
+
touches,
|
|
98
|
+
type: domEventType
|
|
99
|
+
},
|
|
100
|
+
persist: emptyFunction,
|
|
101
|
+
preventDefault,
|
|
102
|
+
stopPropagation() {
|
|
103
|
+
propagationWasStopped = true;
|
|
104
|
+
},
|
|
105
|
+
target: domEvent.target,
|
|
106
|
+
timeStamp: timestamp,
|
|
107
|
+
touchHistory: responderTouchHistoryStore.touchHistory
|
|
108
|
+
};
|
|
109
|
+
function locationX(x) {
|
|
110
|
+
rect = rect || getBoundingClientRect(responderEvent.currentTarget);
|
|
111
|
+
if (rect) {
|
|
112
|
+
return x - rect.left;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function locationY(y) {
|
|
116
|
+
rect = rect || getBoundingClientRect(responderEvent.currentTarget);
|
|
117
|
+
if (rect) {
|
|
118
|
+
return y - rect.top;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return responderEvent;
|
|
122
122
|
}
|
|
123
|
+
|
|
123
124
|
export { createResponderEvent };
|
|
124
125
|
//# sourceMappingURL=createResponderEvent.mjs.map
|