react-sway 0.3.1 → 0.4.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/CHANGELOG.md +19 -0
- package/LICENSE +21 -0
- package/README.md +196 -48
- package/dist/ReactSway.d.ts +46 -4
- package/dist/edge-hover-velocity.d.ts +30 -0
- package/dist/index.cjs +428 -161
- package/dist/index.d.ts +2 -1
- package/dist/index.js +428 -163
- package/dist/wheel-input.d.ts +14 -0
- package/package.json +20 -15
- package/src/ReactSway.tsx +0 -914
- package/src/index.ts +0 -5
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes wheel-device deltas and decides whether Sway owns a gesture.
|
|
3
|
+
*/
|
|
4
|
+
/** Defines whether Sway consumes axis-aligned gestures or every wheel event. */
|
|
5
|
+
export type SwayWheelMode = 'axis' | 'capture';
|
|
6
|
+
type WheelDeltaAxis = 'x' | 'y';
|
|
7
|
+
/** Converts line, page, modern pixel, and legacy wheel deltas to pixels. */
|
|
8
|
+
export declare function normalizeWheelDelta(event: globalThis.WheelEvent, container: HTMLElement, axis: WheelDeltaAxis): number;
|
|
9
|
+
/**
|
|
10
|
+
* Returns Sway's signed pixel delta, or null when native scroll chaining owns
|
|
11
|
+
* the gesture. This partial function is the wheel-ownership boundary.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getOwnedWheelDelta(event: globalThis.WheelEvent, container: HTMLElement, isHorizontal: boolean, wheelMode: SwayWheelMode): number | null;
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -7,27 +7,31 @@
|
|
|
7
7
|
"url": "https://github.com/lafittemehdy/sway/issues"
|
|
8
8
|
},
|
|
9
9
|
"description": "A React component for smooth infinite scrolling, designed for creating engaging, continuous content streams with minimal configuration.",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
10
18
|
"devDependencies": {
|
|
11
|
-
"@emnapi/core": "^1.11.1",
|
|
12
|
-
"@emnapi/runtime": "^1.11.1",
|
|
13
19
|
"@testing-library/jest-dom": "^6.9.1",
|
|
14
20
|
"@testing-library/react": "^16.3.2",
|
|
15
21
|
"@types/react": "^19.2.17",
|
|
16
22
|
"@types/react-dom": "^19.2.3",
|
|
17
|
-
"
|
|
18
|
-
"eslint": "^10.6.0",
|
|
23
|
+
"eslint": "^10.7.0",
|
|
19
24
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
20
25
|
"jsdom": "^29.1.1",
|
|
21
26
|
"react": "^19.2.7",
|
|
22
27
|
"react-dom": "^19.2.7",
|
|
23
28
|
"typescript": "^6.0.3",
|
|
24
|
-
"vite": "^8.1.
|
|
25
|
-
"vitest": "^4.1.
|
|
29
|
+
"vite": "^8.1.5",
|
|
30
|
+
"vitest": "^4.1.10"
|
|
26
31
|
},
|
|
27
32
|
"files": [
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"!src/__tests__"
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"dist"
|
|
31
35
|
],
|
|
32
36
|
"homepage": "https://github.com/lafittemehdy/sway#readme",
|
|
33
37
|
"keywords": [
|
|
@@ -44,12 +48,12 @@
|
|
|
44
48
|
"ui-component"
|
|
45
49
|
],
|
|
46
50
|
"license": "MIT",
|
|
47
|
-
"main": "dist/index.cjs",
|
|
48
|
-
"module": "dist/index.js",
|
|
51
|
+
"main": "./dist/index.cjs",
|
|
52
|
+
"module": "./dist/index.js",
|
|
49
53
|
"name": "react-sway",
|
|
50
54
|
"peerDependencies": {
|
|
51
|
-
"react": ">=
|
|
52
|
-
"react-dom": ">=
|
|
55
|
+
"react": ">=17.0.0",
|
|
56
|
+
"react-dom": ">=17.0.0"
|
|
53
57
|
},
|
|
54
58
|
"publishConfig": {
|
|
55
59
|
"access": "public",
|
|
@@ -59,6 +63,7 @@
|
|
|
59
63
|
"type": "git",
|
|
60
64
|
"url": "git+https://github.com/lafittemehdy/sway.git"
|
|
61
65
|
},
|
|
66
|
+
"sideEffects": false,
|
|
62
67
|
"scripts": {
|
|
63
68
|
"build": "vite build --config vite.config.ts && tsc -p tsconfig.build.json",
|
|
64
69
|
"dev": "vite build --config vite.config.ts --watch",
|
|
@@ -68,6 +73,6 @@
|
|
|
68
73
|
"test:watch": "vitest"
|
|
69
74
|
},
|
|
70
75
|
"type": "module",
|
|
71
|
-
"types": "dist/index.d.ts",
|
|
72
|
-
"version": "0.
|
|
76
|
+
"types": "./dist/index.d.ts",
|
|
77
|
+
"version": "0.4.1"
|
|
73
78
|
}
|