@msobiecki/react-marauders-path 1.20.0 → 1.22.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.
Files changed (2) hide show
  1. package/README.md +13 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,10 +8,10 @@ A lightweight, type-safe React library for handling keyboard, wheel, swipe, and
8
8
 
9
9
  ## Features
10
10
 
11
- - 🎮 **Keyboard Event Handling** - Simple API for detecting single keys, key combinations, and sequences
12
- - 🎡 **Wheel Event Handling** - Mouse wheel scrolling with delta tracking and batching support
13
- - 🖐️ **Swipe Gesture Handling** - Touch swipe detection with distance and velocity thresholds
14
- - 🖱️ **Drag Event Handling** - Pointer drag tracking with movement and delta data
11
+ - 🎮 **Keyboard Event Handling** - Detect single keys, key combinations and sequences with configurable timing thresholds
12
+ - 🎡 **Wheel Event Handling** - Track wheel, delta values with optional `requestAnimationFrame` batching for smoother updates
13
+ - 🖐️ **Swipe Gesture Handling** - Detect directional swipes with configurable distance and velocity with pointer type filtering
14
+ - 🖱️ **Drag Event Handling** - Track movement, delta values, duration, start/end positions with pointer type filtering and optional `requestAnimationFrame` batching for smoother updates
15
15
 
16
16
  ## Installation
17
17
 
@@ -23,7 +23,7 @@ npm install @msobiecki/react-marauders-path
23
23
 
24
24
  ### Key Event Hook
25
25
 
26
- #### Single Key Schema
26
+ #### Single Key Pattern
27
27
 
28
28
  ```typescript
29
29
  import { useKey } from '@msobiecki/react-marauders-path';
@@ -37,7 +37,7 @@ function MyComponent() {
37
37
  }
38
38
  ```
39
39
 
40
- #### Multiple Patterns of Single Key Schema
40
+ #### Multiple Single Key Patterns
41
41
 
42
42
  ```typescript
43
43
  useKey(["a", "b", "c"], (event, key) => {
@@ -45,7 +45,7 @@ useKey(["a", "b", "c"], (event, key) => {
45
45
  });
46
46
  ```
47
47
 
48
- #### Combination Key Schema
48
+ #### Key Combination Pattern
49
49
 
50
50
  ```typescript
51
51
  useKey("a+b", (event, key) => {
@@ -53,7 +53,7 @@ useKey("a+b", (event, key) => {
53
53
  });
54
54
  ```
55
55
 
56
- #### Multiple Patterns of Combination Key Schema
56
+ #### Multiple Key Combination Patterns
57
57
 
58
58
  ```typescript
59
59
  useKey(["a+b", "c+d"], (event, key) => {
@@ -61,7 +61,7 @@ useKey(["a+b", "c+d"], (event, key) => {
61
61
  });
62
62
  ```
63
63
 
64
- #### Sequential Key Schema
64
+ #### Key Sequence Pattern
65
65
 
66
66
  ```typescript
67
67
  useKey("ArrowUp ArrowUp ArrowDown ArrowDown", (event, key) => {
@@ -69,7 +69,7 @@ useKey("ArrowUp ArrowUp ArrowDown ArrowDown", (event, key) => {
69
69
  });
70
70
  ```
71
71
 
72
- #### Multiple Patterns of Sequential Key Schema
72
+ #### Multiple Key Sequence Patterns
73
73
 
74
74
  ```typescript
75
75
  useKey(
@@ -100,7 +100,7 @@ function MyComponent() {
100
100
  import { useSwipe } from '@msobiecki/react-marauders-path';
101
101
 
102
102
  function MyComponent() {
103
- useSwipe('left' (event, direction, data) => {
103
+ useSwipe('left', (event, direction, data) => {
104
104
  console.log(`Swiped ${direction} with velocity ${data.velocity}`);
105
105
  });
106
106
 
@@ -196,6 +196,7 @@ Hook for handling touch swipe gestures with configurable distance and velocity t
196
196
 
197
197
  ```typescript
198
198
  interface UseSwipeOptions {
199
+ eventPointerTypes?: Array<"touch" | "mouse" | "pen">; // Default: ["touch", "mouse", "pen"]
199
200
  eventCapture?: boolean; // Default: false
200
201
  eventOnce?: boolean; // Default: false
201
202
  eventStopImmediatePropagation?: boolean; // Default: false
@@ -348,7 +349,7 @@ npm run dev
348
349
  ### Lint
349
350
 
350
351
  ```bash
351
- npm lint
352
+ npm run lint
352
353
  ```
353
354
 
354
355
  ## Project Status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@msobiecki/react-marauders-path",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.17.1"