@msobiecki/react-marauders-path 1.16.0 → 1.18.0
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/README.md +40 -18
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -85,8 +85,8 @@ useKey(
|
|
|
85
85
|
import { useWheel } from '@msobiecki/react-marauders-path';
|
|
86
86
|
|
|
87
87
|
function MyComponent() {
|
|
88
|
-
useWheel((event,
|
|
89
|
-
console.log(`Scrolled - X: ${
|
|
88
|
+
useWheel((event, data) => {
|
|
89
|
+
console.log(`Scrolled - X: ${data.deltaX}, Y: ${data.deltaY}`);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
return <div>Scroll to interact</div>;
|
|
@@ -99,8 +99,8 @@ function MyComponent() {
|
|
|
99
99
|
import { useSwipe } from '@msobiecki/react-marauders-path';
|
|
100
100
|
|
|
101
101
|
function MyComponent() {
|
|
102
|
-
useSwipe('left' (event,
|
|
103
|
-
console.log(`Swiped ${
|
|
102
|
+
useSwipe('left' (event, direction, data) => {
|
|
103
|
+
console.log(`Swiped ${direction} with velocity ${data.velocity}`);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
return <div>Swipe left</div>;
|
|
@@ -140,7 +140,7 @@ Hook for handling mouse wheel events with support for different delta modes and
|
|
|
140
140
|
|
|
141
141
|
**Parameters:**
|
|
142
142
|
|
|
143
|
-
- `callback: (event: WheelEvent,
|
|
143
|
+
- `callback: (event: WheelEvent, data: WheelData) => void | boolean` - Called when wheel event occurs
|
|
144
144
|
- `options?: UseWheelOptions` - Optional configuration
|
|
145
145
|
|
|
146
146
|
**Options:**
|
|
@@ -160,9 +160,9 @@ interface UseWheelOptions {
|
|
|
160
160
|
|
|
161
161
|
```typescript
|
|
162
162
|
interface WheelData {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
deltaX: number; // Delta X value
|
|
164
|
+
deltaY: number; // Delta Y value
|
|
165
|
+
deltaZ: number; // Delta Z value
|
|
166
166
|
deltaMode: number; // Delta mode value
|
|
167
167
|
}
|
|
168
168
|
```
|
|
@@ -174,7 +174,7 @@ Hook for handling touch swipe gestures with configurable distance and velocity t
|
|
|
174
174
|
**Parameters:**
|
|
175
175
|
|
|
176
176
|
- `swipe: left | right | up | down | horizontal | vertical | both` - Allowed directions to listen
|
|
177
|
-
- `callback: (event:
|
|
177
|
+
- `callback: (event: PointerEvent, direction: SwipeDirection, data: SwipeData) => void | boolean` - Called when a swipe event occurs
|
|
178
178
|
- `options?: UseSwipeOptions` - Optional configuration
|
|
179
179
|
|
|
180
180
|
**Options:**
|
|
@@ -194,7 +194,6 @@ interface UseSwipeOptions {
|
|
|
194
194
|
|
|
195
195
|
```typescript
|
|
196
196
|
interface SwipeData {
|
|
197
|
-
direction: SwipeDirection; // Resolved direction
|
|
198
197
|
deltaX: number; // Horizontal travel
|
|
199
198
|
deltaY: number; // Vertical travel
|
|
200
199
|
velocity: number; // Average speed (distance / duration)
|
|
@@ -300,14 +299,37 @@ npm lint
|
|
|
300
299
|
|
|
301
300
|
## Project Status
|
|
302
301
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
- 🚧
|
|
306
|
-
|
|
307
|
-
-
|
|
308
|
-
-
|
|
309
|
-
-
|
|
310
|
-
-
|
|
302
|
+
### High-level Gesture Hook
|
|
303
|
+
|
|
304
|
+
- 🚧 **`useGesture`** – high-level API for gesture handling
|
|
305
|
+
Supported gestures:
|
|
306
|
+
- `tap` – single tap / click
|
|
307
|
+
- `doubleTap` – quick double tap
|
|
308
|
+
- `press` / `longPress` – press and hold
|
|
309
|
+
- `swipe` – directional swipe
|
|
310
|
+
- `drag` / `pan` – track movement of finger or mouse
|
|
311
|
+
- `pinch` / `zoom` – two-finger pinch / zoom
|
|
312
|
+
|
|
313
|
+
### Low-level Gesture Hooks
|
|
314
|
+
|
|
315
|
+
- 🚧 **`useTap`** – single tap / click
|
|
316
|
+
- 🚧 **`useDoubleTap`** – quick double tap
|
|
317
|
+
- 🚧 **`usePress`** – press and hold (longPress)
|
|
318
|
+
- 🚧 **`useDrag`** – dragging elements (MouseEvent / PointerEvent / TouchEvent)
|
|
319
|
+
- 🚧 **`usePinch`** – two-finger pinch / zoom
|
|
320
|
+
|
|
321
|
+
### Pointer / Mouse Hooks (Unified)
|
|
322
|
+
|
|
323
|
+
- 🚧 **`usePointer`** – unified hook for MouseEvent, PointerEvent, and TouchEvent
|
|
324
|
+
Supported events:
|
|
325
|
+
- `pointerdown`, `pointermove`, `pointerup`, `pointerenter`, `pointerleave`, `pointercancel`
|
|
326
|
+
Filter by pointer type: `mouse` | `touch` | `pen`
|
|
327
|
+
Callback returns unified data e.g.: `x`, `y`, `button`, `type`, `isPrimary`
|
|
328
|
+
|
|
329
|
+
- 🚧 **`useMouse`** – alias for `usePointer` filtered to mouse only
|
|
330
|
+
Supported events:
|
|
331
|
+
- `mousemove`, `mousedown`, `mouseup`, `click`, `dblclick`
|
|
332
|
+
Buttons: `left`, `right`, `middle`
|
|
311
333
|
|
|
312
334
|
## License
|
|
313
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@msobiecki/react-marauders-path",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.17.1"
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@anolilab/multi-semantic-release": "^4.1.1",
|
|
26
26
|
"@commitlint/cli": "^20.4.1",
|
|
27
|
-
"@commitlint/config-conventional": "^20.4.
|
|
27
|
+
"@commitlint/config-conventional": "^20.4.2",
|
|
28
28
|
"@msobiecki/eslint-config": "^9.12.0",
|
|
29
29
|
"@semantic-release/changelog": "^6.0.3",
|
|
30
30
|
"@semantic-release/git": "^10.0.1",
|
|
31
31
|
"@testing-library/react": "^16.3.2",
|
|
32
|
-
"@types/node": "^25.
|
|
32
|
+
"@types/node": "^25.3.0",
|
|
33
33
|
"@types/react": "^19.2.14",
|
|
34
34
|
"@types/react-dom": "^19.2.3",
|
|
35
35
|
"@vitejs/plugin-react-swc": "^4.2.3",
|