@react-aria/interactions 3.0.0-nightly.2238 → 3.0.0-nightly.2241
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/import.mjs +146 -143
- package/dist/main.js +145 -142
- package/dist/main.js.map +1 -1
- package/dist/module.js +146 -143
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/PressResponder.tsx +1 -0
- package/src/useInteractOutside.ts +25 -22
- package/src/useMove.ts +43 -41
- package/src/usePress.ts +112 -103
- package/src/utils.ts +7 -5
package/dist/import.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, isIOS as $bx7SL$isIOS, runAfterTransition as $bx7SL$runAfterTransition, useLayoutEffect as $bx7SL$useLayoutEffect, isMac as $bx7SL$isMac, useEvent as $bx7SL$useEvent, useDescription as $bx7SL$useDescription} from "@react-aria/utils";
|
|
1
|
+
import {mergeProps as $bx7SL$mergeProps, useSyncRef as $bx7SL$useSyncRef, useGlobalListeners as $bx7SL$useGlobalListeners, useEffectEvent as $bx7SL$useEffectEvent, isVirtualClick as $bx7SL$isVirtualClick, focusWithoutScrolling as $bx7SL$focusWithoutScrolling, isVirtualPointerEvent as $bx7SL$isVirtualPointerEvent, isIOS as $bx7SL$isIOS, runAfterTransition as $bx7SL$runAfterTransition, useLayoutEffect as $bx7SL$useLayoutEffect, isMac as $bx7SL$isMac, useEvent as $bx7SL$useEvent, useDescription as $bx7SL$useDescription} from "@react-aria/utils";
|
|
2
2
|
import $bx7SL$react, {useRef as $bx7SL$useRef, useContext as $bx7SL$useContext, useState as $bx7SL$useState, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback} from "react";
|
|
3
3
|
import {useIsSSR as $bx7SL$useIsSSR} from "@react-aria/ssr";
|
|
4
4
|
|
|
@@ -131,16 +131,6 @@ function $f6c31cce2adf654f$var$usePressResponderContext(props) {
|
|
|
131
131
|
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
132
132
|
let { onPress: onPress , onPressChange: onPressChange , onPressStart: onPressStart , onPressEnd: onPressEnd , onPressUp: onPressUp , isDisabled: isDisabled , isPressed: isPressedProp , preventFocusOnPress: preventFocusOnPress , shouldCancelOnPointerExit: shouldCancelOnPointerExit , allowTextSelectionOnPress: allowTextSelectionOnPress , // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
133
133
|
ref: _ , ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
|
|
134
|
-
let propsRef = (0, $bx7SL$useRef)(null);
|
|
135
|
-
propsRef.current = {
|
|
136
|
-
onPress: onPress,
|
|
137
|
-
onPressChange: onPressChange,
|
|
138
|
-
onPressStart: onPressStart,
|
|
139
|
-
onPressEnd: onPressEnd,
|
|
140
|
-
onPressUp: onPressUp,
|
|
141
|
-
isDisabled: isDisabled,
|
|
142
|
-
shouldCancelOnPointerExit: shouldCancelOnPointerExit
|
|
143
|
-
};
|
|
144
134
|
let [isPressed, setPressed] = (0, $bx7SL$useState)(false);
|
|
145
135
|
let ref = (0, $bx7SL$useRef)({
|
|
146
136
|
isPressed: false,
|
|
@@ -153,74 +143,77 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
153
143
|
pointerType: null
|
|
154
144
|
});
|
|
155
145
|
let { addGlobalListener: addGlobalListener , removeAllGlobalListeners: removeAllGlobalListeners } = (0, $bx7SL$useGlobalListeners)();
|
|
146
|
+
let triggerPressStart = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
|
147
|
+
let state = ref.current;
|
|
148
|
+
if (isDisabled || state.didFirePressStart) return;
|
|
149
|
+
if (onPressStart) onPressStart({
|
|
150
|
+
type: "pressstart",
|
|
151
|
+
pointerType: pointerType,
|
|
152
|
+
target: originalEvent.currentTarget,
|
|
153
|
+
shiftKey: originalEvent.shiftKey,
|
|
154
|
+
metaKey: originalEvent.metaKey,
|
|
155
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
156
|
+
altKey: originalEvent.altKey
|
|
157
|
+
});
|
|
158
|
+
if (onPressChange) onPressChange(true);
|
|
159
|
+
state.didFirePressStart = true;
|
|
160
|
+
setPressed(true);
|
|
161
|
+
});
|
|
162
|
+
let triggerPressEnd = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType, wasPressed = true)=>{
|
|
163
|
+
let state = ref.current;
|
|
164
|
+
if (!state.didFirePressStart) return;
|
|
165
|
+
state.ignoreClickAfterPress = true;
|
|
166
|
+
state.didFirePressStart = false;
|
|
167
|
+
if (onPressEnd) onPressEnd({
|
|
168
|
+
type: "pressend",
|
|
169
|
+
pointerType: pointerType,
|
|
170
|
+
target: originalEvent.currentTarget,
|
|
171
|
+
shiftKey: originalEvent.shiftKey,
|
|
172
|
+
metaKey: originalEvent.metaKey,
|
|
173
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
174
|
+
altKey: originalEvent.altKey
|
|
175
|
+
});
|
|
176
|
+
if (onPressChange) onPressChange(false);
|
|
177
|
+
setPressed(false);
|
|
178
|
+
if (onPress && wasPressed && !isDisabled) onPress({
|
|
179
|
+
type: "press",
|
|
180
|
+
pointerType: pointerType,
|
|
181
|
+
target: originalEvent.currentTarget,
|
|
182
|
+
shiftKey: originalEvent.shiftKey,
|
|
183
|
+
metaKey: originalEvent.metaKey,
|
|
184
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
185
|
+
altKey: originalEvent.altKey
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
let triggerPressUp = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
|
189
|
+
if (isDisabled) return;
|
|
190
|
+
if (onPressUp) onPressUp({
|
|
191
|
+
type: "pressup",
|
|
192
|
+
pointerType: pointerType,
|
|
193
|
+
target: originalEvent.currentTarget,
|
|
194
|
+
shiftKey: originalEvent.shiftKey,
|
|
195
|
+
metaKey: originalEvent.metaKey,
|
|
196
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
197
|
+
altKey: originalEvent.altKey
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
let cancel = (0, $bx7SL$useEffectEvent)((e)=>{
|
|
201
|
+
let state = ref.current;
|
|
202
|
+
if (state.isPressed) {
|
|
203
|
+
if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
204
|
+
state.isPressed = false;
|
|
205
|
+
state.isOverTarget = false;
|
|
206
|
+
state.activePointerId = null;
|
|
207
|
+
state.pointerType = null;
|
|
208
|
+
removeAllGlobalListeners();
|
|
209
|
+
if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
let cancelOnPointerExit = (0, $bx7SL$useEffectEvent)((e)=>{
|
|
213
|
+
if (shouldCancelOnPointerExit) cancel(e);
|
|
214
|
+
});
|
|
156
215
|
let pressProps = (0, $bx7SL$useMemo)(()=>{
|
|
157
216
|
let state = ref.current;
|
|
158
|
-
let triggerPressStart = (originalEvent, pointerType)=>{
|
|
159
|
-
let { onPressStart: onPressStart , onPressChange: onPressChange , isDisabled: isDisabled } = propsRef.current;
|
|
160
|
-
if (isDisabled || state.didFirePressStart) return;
|
|
161
|
-
if (onPressStart) onPressStart({
|
|
162
|
-
type: "pressstart",
|
|
163
|
-
pointerType: pointerType,
|
|
164
|
-
target: originalEvent.currentTarget,
|
|
165
|
-
shiftKey: originalEvent.shiftKey,
|
|
166
|
-
metaKey: originalEvent.metaKey,
|
|
167
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
168
|
-
altKey: originalEvent.altKey
|
|
169
|
-
});
|
|
170
|
-
if (onPressChange) onPressChange(true);
|
|
171
|
-
state.didFirePressStart = true;
|
|
172
|
-
setPressed(true);
|
|
173
|
-
};
|
|
174
|
-
let triggerPressEnd = (originalEvent, pointerType, wasPressed = true)=>{
|
|
175
|
-
let { onPressEnd: onPressEnd , onPressChange: onPressChange , onPress: onPress , isDisabled: isDisabled } = propsRef.current;
|
|
176
|
-
if (!state.didFirePressStart) return;
|
|
177
|
-
state.ignoreClickAfterPress = true;
|
|
178
|
-
state.didFirePressStart = false;
|
|
179
|
-
if (onPressEnd) onPressEnd({
|
|
180
|
-
type: "pressend",
|
|
181
|
-
pointerType: pointerType,
|
|
182
|
-
target: originalEvent.currentTarget,
|
|
183
|
-
shiftKey: originalEvent.shiftKey,
|
|
184
|
-
metaKey: originalEvent.metaKey,
|
|
185
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
186
|
-
altKey: originalEvent.altKey
|
|
187
|
-
});
|
|
188
|
-
if (onPressChange) onPressChange(false);
|
|
189
|
-
setPressed(false);
|
|
190
|
-
if (onPress && wasPressed && !isDisabled) onPress({
|
|
191
|
-
type: "press",
|
|
192
|
-
pointerType: pointerType,
|
|
193
|
-
target: originalEvent.currentTarget,
|
|
194
|
-
shiftKey: originalEvent.shiftKey,
|
|
195
|
-
metaKey: originalEvent.metaKey,
|
|
196
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
197
|
-
altKey: originalEvent.altKey
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
let triggerPressUp = (originalEvent, pointerType)=>{
|
|
201
|
-
let { onPressUp: onPressUp , isDisabled: isDisabled } = propsRef.current;
|
|
202
|
-
if (isDisabled) return;
|
|
203
|
-
if (onPressUp) onPressUp({
|
|
204
|
-
type: "pressup",
|
|
205
|
-
pointerType: pointerType,
|
|
206
|
-
target: originalEvent.currentTarget,
|
|
207
|
-
shiftKey: originalEvent.shiftKey,
|
|
208
|
-
metaKey: originalEvent.metaKey,
|
|
209
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
210
|
-
altKey: originalEvent.altKey
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
let cancel = (e)=>{
|
|
214
|
-
if (state.isPressed) {
|
|
215
|
-
if (state.isOverTarget) triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
216
|
-
state.isPressed = false;
|
|
217
|
-
state.isOverTarget = false;
|
|
218
|
-
state.activePointerId = null;
|
|
219
|
-
state.pointerType = null;
|
|
220
|
-
removeAllGlobalListeners();
|
|
221
|
-
if (!allowTextSelectionOnPress) (0, $14c0b72509d70225$export$b0d6fa1ab32e3295)(state.target);
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
217
|
let pressProps = {
|
|
225
218
|
onKeyDown (e) {
|
|
226
219
|
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target)) {
|
|
@@ -338,7 +331,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
338
331
|
} else if (state.isOverTarget) {
|
|
339
332
|
state.isOverTarget = false;
|
|
340
333
|
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
341
|
-
|
|
334
|
+
cancelOnPointerExit(e);
|
|
342
335
|
}
|
|
343
336
|
};
|
|
344
337
|
let onPointerUp = (e)=>{
|
|
@@ -392,7 +385,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
392
385
|
if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
|
|
393
386
|
state.isOverTarget = false;
|
|
394
387
|
triggerPressEnd(e, state.pointerType, false);
|
|
395
|
-
|
|
388
|
+
cancelOnPointerExit(e);
|
|
396
389
|
}
|
|
397
390
|
};
|
|
398
391
|
pressProps.onMouseUp = (e)=>{
|
|
@@ -443,7 +436,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
443
436
|
} else if (state.isOverTarget) {
|
|
444
437
|
state.isOverTarget = false;
|
|
445
438
|
triggerPressEnd(e, state.pointerType, false);
|
|
446
|
-
|
|
439
|
+
cancelOnPointerExit(e);
|
|
447
440
|
}
|
|
448
441
|
};
|
|
449
442
|
pressProps.onTouchEnd = (e)=>{
|
|
@@ -487,7 +480,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
487
480
|
isDisabled,
|
|
488
481
|
preventFocusOnPress,
|
|
489
482
|
removeAllGlobalListeners,
|
|
490
|
-
allowTextSelectionOnPress
|
|
483
|
+
allowTextSelectionOnPress,
|
|
484
|
+
cancel,
|
|
485
|
+
cancelOnPointerExit,
|
|
486
|
+
triggerPressEnd,
|
|
487
|
+
triggerPressStart,
|
|
488
|
+
triggerPressUp
|
|
491
489
|
]);
|
|
492
490
|
// Remove user-select: none in case component unmounts immediately after pressStart
|
|
493
491
|
// eslint-disable-next-line arrow-body-style
|
|
@@ -631,7 +629,10 @@ const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $bx7SL$react
|
|
|
631
629
|
});
|
|
632
630
|
(0, $bx7SL$useSyncRef)(prevContext, ref);
|
|
633
631
|
(0, $bx7SL$useEffect)(()=>{
|
|
634
|
-
if (!isRegistered.current)
|
|
632
|
+
if (!isRegistered.current) {
|
|
633
|
+
console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
|
634
|
+
isRegistered.current = true; // only warn once in strict mode.
|
|
635
|
+
}
|
|
635
636
|
}, []);
|
|
636
637
|
return /*#__PURE__*/ (0, $bx7SL$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
|
637
638
|
value: context
|
|
@@ -699,10 +700,8 @@ class $8a9cb279dc87e130$export$905e7fc544a71f36 {
|
|
|
699
700
|
function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
700
701
|
let stateRef = (0, $bx7SL$useRef)({
|
|
701
702
|
isFocused: false,
|
|
702
|
-
onBlur: onBlur,
|
|
703
703
|
observer: null
|
|
704
704
|
});
|
|
705
|
-
stateRef.current.onBlur = onBlur;
|
|
706
705
|
// Clean up MutationObserver on unmount. See below.
|
|
707
706
|
// eslint-disable-next-line arrow-body-style
|
|
708
707
|
(0, $bx7SL$useLayoutEffect)(()=>{
|
|
@@ -714,6 +713,9 @@ function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
|
714
713
|
}
|
|
715
714
|
};
|
|
716
715
|
}, []);
|
|
716
|
+
let dispatchBlur = (0, $bx7SL$useEffectEvent)((e)=>{
|
|
717
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
718
|
+
});
|
|
717
719
|
// This function is called during a React onFocus event.
|
|
718
720
|
return (0, $bx7SL$useCallback)((e)=>{
|
|
719
721
|
// React does not fire onBlur when an element is disabled. https://github.com/facebook/react/issues/9142
|
|
@@ -724,10 +726,9 @@ function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
|
724
726
|
stateRef.current.isFocused = true;
|
|
725
727
|
let target = e.target;
|
|
726
728
|
let onBlurHandler = (e)=>{
|
|
727
|
-
var // For backward compatibility, dispatch a (fake) React synthetic event.
|
|
728
|
-
_stateRef_current, _stateRef_current_onBlur;
|
|
729
729
|
stateRef.current.isFocused = false;
|
|
730
|
-
if (target.disabled)
|
|
730
|
+
if (target.disabled) // For backward compatibility, dispatch a (fake) React synthetic event.
|
|
731
|
+
dispatchBlur(new $8a9cb279dc87e130$export$905e7fc544a71f36("blur", e));
|
|
731
732
|
// We no longer need the MutationObserver once the target is blurred.
|
|
732
733
|
if (stateRef.current.observer) {
|
|
733
734
|
stateRef.current.observer.disconnect();
|
|
@@ -753,7 +754,9 @@ function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
|
753
754
|
]
|
|
754
755
|
});
|
|
755
756
|
}
|
|
756
|
-
}, [
|
|
757
|
+
}, [
|
|
758
|
+
dispatchBlur
|
|
759
|
+
]);
|
|
757
760
|
}
|
|
758
761
|
|
|
759
762
|
|
|
@@ -1176,29 +1179,29 @@ function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
|
|
1176
1179
|
// NOTICE file in the root directory of this source tree.
|
|
1177
1180
|
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
|
1178
1181
|
|
|
1182
|
+
|
|
1179
1183
|
function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
|
|
1180
1184
|
let { ref: ref , onInteractOutside: onInteractOutside , isDisabled: isDisabled , onInteractOutsideStart: onInteractOutsideStart } = props;
|
|
1181
1185
|
let stateRef = (0, $bx7SL$useRef)({
|
|
1182
1186
|
isPointerDown: false,
|
|
1183
|
-
ignoreEmulatedMouseEvents: false
|
|
1184
|
-
|
|
1185
|
-
|
|
1187
|
+
ignoreEmulatedMouseEvents: false
|
|
1188
|
+
});
|
|
1189
|
+
let onPointerDown = (0, $bx7SL$useEffectEvent)((e)=>{
|
|
1190
|
+
if (onInteractOutside && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) {
|
|
1191
|
+
if (onInteractOutsideStart) onInteractOutsideStart(e);
|
|
1192
|
+
stateRef.current.isPointerDown = true;
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
let triggerInteractOutside = (0, $bx7SL$useEffectEvent)((e)=>{
|
|
1196
|
+
if (onInteractOutside) onInteractOutside(e);
|
|
1186
1197
|
});
|
|
1187
|
-
let state = stateRef.current;
|
|
1188
|
-
state.onInteractOutside = onInteractOutside;
|
|
1189
|
-
state.onInteractOutsideStart = onInteractOutsideStart;
|
|
1190
1198
|
(0, $bx7SL$useEffect)(()=>{
|
|
1199
|
+
let state = stateRef.current;
|
|
1191
1200
|
if (isDisabled) return;
|
|
1192
|
-
let onPointerDown = (e)=>{
|
|
1193
|
-
if ($e0b6e0b68ec7f50f$var$isValidEvent(e, ref) && state.onInteractOutside) {
|
|
1194
|
-
if (state.onInteractOutsideStart) state.onInteractOutsideStart(e);
|
|
1195
|
-
state.isPointerDown = true;
|
|
1196
|
-
}
|
|
1197
|
-
};
|
|
1198
1201
|
// Use pointer events if available. Otherwise, fall back to mouse and touch events.
|
|
1199
1202
|
if (typeof PointerEvent !== "undefined") {
|
|
1200
1203
|
let onPointerUp = (e)=>{
|
|
1201
|
-
if (state.isPointerDown &&
|
|
1204
|
+
if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
|
1202
1205
|
state.isPointerDown = false;
|
|
1203
1206
|
};
|
|
1204
1207
|
// changing these to capture phase fixed combobox
|
|
@@ -1211,12 +1214,12 @@ function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
|
|
|
1211
1214
|
} else {
|
|
1212
1215
|
let onMouseUp = (e)=>{
|
|
1213
1216
|
if (state.ignoreEmulatedMouseEvents) state.ignoreEmulatedMouseEvents = false;
|
|
1214
|
-
else if (state.isPointerDown &&
|
|
1217
|
+
else if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
|
1215
1218
|
state.isPointerDown = false;
|
|
1216
1219
|
};
|
|
1217
1220
|
let onTouchEnd = (e)=>{
|
|
1218
1221
|
state.ignoreEmulatedMouseEvents = true;
|
|
1219
|
-
if (state.
|
|
1222
|
+
if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e, ref)) triggerInteractOutside(e);
|
|
1220
1223
|
state.isPointerDown = false;
|
|
1221
1224
|
};
|
|
1222
1225
|
document.addEventListener("mousedown", onPointerDown, true);
|
|
@@ -1232,8 +1235,9 @@ function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
|
|
|
1232
1235
|
}
|
|
1233
1236
|
}, [
|
|
1234
1237
|
ref,
|
|
1235
|
-
|
|
1236
|
-
|
|
1238
|
+
isDisabled,
|
|
1239
|
+
onPointerDown,
|
|
1240
|
+
triggerInteractOutside
|
|
1237
1241
|
]);
|
|
1238
1242
|
}
|
|
1239
1243
|
function $e0b6e0b68ec7f50f$var$isValidEvent(event, ref) {
|
|
@@ -1325,46 +1329,46 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
|
1325
1329
|
id: null
|
|
1326
1330
|
});
|
|
1327
1331
|
let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $bx7SL$useGlobalListeners)();
|
|
1328
|
-
let
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
let move = (originalEvent, pointerType, deltaX, deltaY)=>{
|
|
1335
|
-
if (deltaX === 0 && deltaY === 0) return;
|
|
1336
|
-
if (!state.current.didMove) {
|
|
1337
|
-
state.current.didMove = true;
|
|
1338
|
-
onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
|
|
1339
|
-
type: "movestart",
|
|
1340
|
-
pointerType: pointerType,
|
|
1341
|
-
shiftKey: originalEvent.shiftKey,
|
|
1342
|
-
metaKey: originalEvent.metaKey,
|
|
1343
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
1344
|
-
altKey: originalEvent.altKey
|
|
1345
|
-
});
|
|
1346
|
-
}
|
|
1347
|
-
onMove({
|
|
1348
|
-
type: "move",
|
|
1349
|
-
pointerType: pointerType,
|
|
1350
|
-
deltaX: deltaX,
|
|
1351
|
-
deltaY: deltaY,
|
|
1352
|
-
shiftKey: originalEvent.shiftKey,
|
|
1353
|
-
metaKey: originalEvent.metaKey,
|
|
1354
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
1355
|
-
altKey: originalEvent.altKey
|
|
1356
|
-
});
|
|
1357
|
-
};
|
|
1358
|
-
let end = (originalEvent, pointerType)=>{
|
|
1359
|
-
(0, $14c0b72509d70225$export$b0d6fa1ab32e3295)();
|
|
1360
|
-
if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
|
|
1361
|
-
type: "moveend",
|
|
1332
|
+
let move = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType, deltaX, deltaY)=>{
|
|
1333
|
+
if (deltaX === 0 && deltaY === 0) return;
|
|
1334
|
+
if (!state.current.didMove) {
|
|
1335
|
+
state.current.didMove = true;
|
|
1336
|
+
onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
|
|
1337
|
+
type: "movestart",
|
|
1362
1338
|
pointerType: pointerType,
|
|
1363
1339
|
shiftKey: originalEvent.shiftKey,
|
|
1364
1340
|
metaKey: originalEvent.metaKey,
|
|
1365
1341
|
ctrlKey: originalEvent.ctrlKey,
|
|
1366
1342
|
altKey: originalEvent.altKey
|
|
1367
1343
|
});
|
|
1344
|
+
}
|
|
1345
|
+
onMove({
|
|
1346
|
+
type: "move",
|
|
1347
|
+
pointerType: pointerType,
|
|
1348
|
+
deltaX: deltaX,
|
|
1349
|
+
deltaY: deltaY,
|
|
1350
|
+
shiftKey: originalEvent.shiftKey,
|
|
1351
|
+
metaKey: originalEvent.metaKey,
|
|
1352
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
1353
|
+
altKey: originalEvent.altKey
|
|
1354
|
+
});
|
|
1355
|
+
});
|
|
1356
|
+
let end = (0, $bx7SL$useEffectEvent)((originalEvent, pointerType)=>{
|
|
1357
|
+
(0, $14c0b72509d70225$export$b0d6fa1ab32e3295)();
|
|
1358
|
+
if (state.current.didMove) onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
|
|
1359
|
+
type: "moveend",
|
|
1360
|
+
pointerType: pointerType,
|
|
1361
|
+
shiftKey: originalEvent.shiftKey,
|
|
1362
|
+
metaKey: originalEvent.metaKey,
|
|
1363
|
+
ctrlKey: originalEvent.ctrlKey,
|
|
1364
|
+
altKey: originalEvent.altKey
|
|
1365
|
+
});
|
|
1366
|
+
});
|
|
1367
|
+
let moveProps = (0, $bx7SL$useMemo)(()=>{
|
|
1368
|
+
let moveProps = {};
|
|
1369
|
+
let start = ()=>{
|
|
1370
|
+
(0, $14c0b72509d70225$export$16a4697467175487)();
|
|
1371
|
+
state.current.didMove = false;
|
|
1368
1372
|
};
|
|
1369
1373
|
if (typeof PointerEvent === "undefined") {
|
|
1370
1374
|
let onMouseMove = (e)=>{
|
|
@@ -1512,11 +1516,10 @@ function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
|
|
|
1512
1516
|
return moveProps;
|
|
1513
1517
|
}, [
|
|
1514
1518
|
state,
|
|
1515
|
-
onMoveStart,
|
|
1516
|
-
onMove,
|
|
1517
|
-
onMoveEnd,
|
|
1518
1519
|
addGlobalListener,
|
|
1519
|
-
removeGlobalListener
|
|
1520
|
+
removeGlobalListener,
|
|
1521
|
+
move,
|
|
1522
|
+
end
|
|
1520
1523
|
]);
|
|
1521
1524
|
return {
|
|
1522
1525
|
moveProps: moveProps
|