three-gamepad-controls 0.21.0 → 0.23.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 CHANGED
@@ -1,15 +1,17 @@
1
1
  # Three.js Gamepad Controls
2
2
 
3
+ ![Three.js Gamepad Controls logo featuring a white gamepad with black geometric outlines above the wordmark.](assets/logo.svg "Three.js Gamepad Controls logo")
4
+
3
5
  Gamepad support for [Three.js](https://threejs.org) controls, built on top of [Web Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API).
4
6
 
5
7
  > [!WARNING]
6
8
  > This library has not reached version 1.0.0 and should not yet be considered stable. Until 1.0.0, minor releases may include breaking changes.
7
9
 
8
- ## Architecture
10
+ ## 🏗️ Architecture
9
11
 
10
12
  ![Layered architecture showing the shared gamepad input foundation branching into direct application input and Three.js control integrations.](./assets/architecture-diagram.webp "Three.js Gamepad Controls layered architecture")
11
13
 
12
- The library is organized around a shared input foundation that handles gamepad selection, polling, button states, axes, sticks, haptics, and standard mappings. Applications can consume this input directly for gameplay, menus, and custom interactions, or use `GamepadControls` and its ready-made or custom wrappers to integrate gamepads with Three.js controls.
14
+ The library is organized around `GamepadInput`, which owns the internal gamepad manager for selection and polling, exposes buttons, axes, sticks, haptics, and standard mappings, and processes stick reads through ordered, reusable, stateless pipelines. Applications can consume it directly for gameplay, menus, and custom interactions, or use `GamepadControls` and its ready-made or custom wrappers to integrate with Three.js. Each wrapper action resolves its own axes and pipeline.
13
15
 
14
16
  ## 📦 Installation
15
17
 
@@ -56,6 +58,13 @@ bun add three three-gamepad-controls
56
58
  bun add -d @types/three # optional: for TypeScript projects
57
59
  ```
58
60
 
61
+ ## 🔗 Compatibility
62
+
63
+ | Three.js | Three.js Gamepad Controls |
64
+ | --- | --- |
65
+ | `~0.184.0` | `<=0.22.0` |
66
+ | `~0.185.0` | `0.23.0` |
67
+
59
68
  ## 📖 Documentation
60
69
 
61
70
  - [Core](./docs/core.md) — The fundamental building blocks.
@@ -73,3 +82,7 @@ bun add -d @types/three # optional: for TypeScript projects
73
82
  - [GamepadPointerLockControls](./docs/gamepad-pointer-lock-controls.md) — Gamepad support for `PointerLockControls`.
74
83
  - [GamepadTrackballControls](./docs/gamepad-trackball-controls.md) — Gamepad support for `TrackballControls`.
75
84
  - [GamepadTransformControls](./docs/gamepad-transform-controls.md) — Gamepad support for `TransformControls`.
85
+
86
+ ## 📄 License
87
+
88
+ Licensed under the [MIT License](./LICENSE).
@@ -71,7 +71,7 @@ type GamepadDeadzoneOptions = {
71
71
  rescale?: boolean;
72
72
  };
73
73
  /**
74
- * Options for {@link GamepadStickPipeline.curve}.
74
+ * Options for {@link GamepadStickPipeline.responseCurve}.
75
75
  */
76
76
  type GamepadResponseCurveOptions = {
77
77
  /**
@@ -97,11 +97,11 @@ type GamepadStickPipeline = GamepadStickProcessor & {
97
97
  /**
98
98
  * Appends an axial or radial response curve.
99
99
  *
100
- * @param curve - Curve used to transform normalized magnitudes.
100
+ * @param curve - Response curve used to transform normalized magnitudes.
101
101
  * @param options - Optional response curve configuration.
102
102
  * @returns New pipeline containing the response curve.
103
103
  */
104
- curve(curve: GamepadResponseCurve, options?: GamepadResponseCurveOptions): GamepadStickPipeline;
104
+ responseCurve(curve: GamepadResponseCurve, options?: GamepadResponseCurveOptions): GamepadStickPipeline;
105
105
  /**
106
106
  * Appends component inversion.
107
107
  *
@@ -58,13 +58,13 @@ const rescaleGamepadDeadzoneMagnitude = (magnitude, threshold) => {
58
58
  return Math.min((magnitude - threshold) / (1 - threshold), 1);
59
59
  };
60
60
  /**
61
- * Applies a built-in curve to a normalized magnitude.
61
+ * Applies a built-in response curve to a normalized magnitude.
62
62
  *
63
63
  * Magnitudes above `1` remain unchanged so response curves do not implicitly
64
64
  * clamp or normalize custom processor output.
65
65
  *
66
66
  * @param magnitude - Non-negative component or vector magnitude.
67
- * @param curve - Curve to apply.
67
+ * @param curve - Response curve to apply.
68
68
  * @returns Curved magnitude.
69
69
  */
70
70
  const applyGamepadResponseCurve = (magnitude, curve) => {
@@ -96,7 +96,7 @@ const createDeadzoneProcessor = (threshold, mode, rescale) => {
96
96
  /**
97
97
  * Creates an axial or radial response curve processor.
98
98
  *
99
- * @param curve - Curve applied to normalized magnitudes.
99
+ * @param curve - Response curve applied to normalized magnitudes.
100
100
  * @param mode - Whether to process components or vector magnitude.
101
101
  * @returns Frozen response curve processor.
102
102
  */
@@ -150,7 +150,7 @@ const createPipeline = (mode, processors) => {
150
150
  deadzone(threshold = DEFAULT_GAMEPAD_DEADZONE_THRESHOLD, options) {
151
151
  return append(createDeadzoneProcessor(threshold, options?.mode ?? mode, options?.rescale ?? false));
152
152
  },
153
- curve(curve, options) {
153
+ responseCurve(curve, options) {
154
154
  return append(createResponseCurveProcessor(curve, options?.mode ?? mode));
155
155
  },
156
156
  invert(axis) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "three-gamepad-controls",
3
3
  "description": "Gamepad support for Three.js controls.",
4
- "version": "0.21.0",
4
+ "version": "0.23.0",
5
5
  "homepage": "https://github.com/luckasnix/three-gamepad-controls#readme",
6
6
  "author": {
7
7
  "name": "Kasnix",
@@ -46,23 +46,23 @@
46
46
  }
47
47
  },
48
48
  "devDependencies": {
49
- "@biomejs/biome": "2.5.6",
50
- "@commitlint/cli": "21.2.1",
51
- "@commitlint/config-conventional": "21.2.0",
49
+ "@biomejs/biome": "2.5.11",
50
+ "@commitlint/cli": "21.2.2",
51
+ "@commitlint/config-conventional": "21.2.2",
52
52
  "@commitlint/types": "21.2.0",
53
53
  "@types/node": "24.13.3",
54
- "@types/three": "0.184.0",
55
- "@vitest/coverage-v8": "4.1.10",
54
+ "@types/three": "0.185.0",
55
+ "@vitest/coverage-v8": "5.0.0",
56
56
  "husky": "9.1.7",
57
57
  "jsdom": "29.1.1",
58
- "three": "0.184.0",
58
+ "three": "0.185.0",
59
59
  "tsdown": "0.22.14",
60
60
  "typescript": "7.0.2",
61
- "vitest": "4.1.10"
61
+ "vitest": "5.0.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "@types/three": ">=0.184.0",
65
- "three": ">=0.184.0"
64
+ "@types/three": "~0.185.0",
65
+ "three": "~0.185.0"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsc && tsdown",