@makefully/engagefully 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,29 +1,41 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## [Unreleased]
6
-
7
- ## [0.2.0] - 2026-11-20
8
-
9
- ### Added
10
-
11
- - `ActionMap` — bind many physical controls to named logical actions (`:pressed` / `:released` / `:held`), with aggregate hold state, blur clear, optional `preventDefault`, and `autoTick`
12
- - `quantizeStick(x, y, { sectors, deadzone, forward })` — pure stick → sector helper
13
- - `focusGate({ extra })` — `enabled` predicate that skips editable focus (+ optional chrome gate)
14
-
15
- ### Changed
16
-
17
- - README quickstart centers on ActionMap + utils alongside raw Controller events
18
-
19
- ## [0.1.0] - 2026-11-20
20
-
21
- ### Added
22
-
23
- - Public `@makefully/engagefully` package metadata, MIT license, and Keep-a-Changelog
24
- - GitHub Actions `release.yml`: version-bump on `main` → npm OIDC publish + GitHub release
25
- - README quickstart for Controller + Keyboard/Gamepad
26
-
27
- ### Changed
28
-
29
- - Package name from `engagefully` to `@makefully/engagefully`
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.3.0] - 2026-12-01
8
+
9
+ ### Added
10
+
11
+ - `SpeechDevice` (experimental) — Web Speech API device: `SpeechTranscript` as `Data`, typed phrase `mappings` (`Button` / `Amount` / `Joystick` / `Dial`), hardened start/stop lifecycle (`setActive`, `start`/`stop`, `destroy`)
12
+
13
+ ## [0.2.1] - 2026-11-20
14
+
15
+ ### Fixed
16
+
17
+ - Verify npm Trusted Publisher OIDC publish from GitHub Actions `release.yml`
18
+
19
+ ## [0.2.0] - 2026-11-20
20
+
21
+ ### Added
22
+
23
+ - `ActionMap` — bind many physical controls to named logical actions (`:pressed` / `:released` / `:held`), with aggregate hold state, blur clear, optional `preventDefault`, and `autoTick`
24
+ - `quantizeStick(x, y, { sectors, deadzone, forward })` — pure stick → sector helper
25
+ - `focusGate({ extra })` — `enabled` predicate that skips editable focus (+ optional chrome gate)
26
+
27
+ ### Changed
28
+
29
+ - README quickstart centers on ActionMap + utils alongside raw Controller events
30
+
31
+ ## [0.1.0] - 2026-11-20
32
+
33
+ ### Added
34
+
35
+ - Public `@makefully/engagefully` package metadata, MIT license, and Keep-a-Changelog
36
+ - GitHub Actions `release.yml`: version-bump on `main` → npm OIDC publish + GitHub release
37
+ - README quickstart for Controller + Keyboard/Gamepad
38
+
39
+ ### Changed
40
+
41
+ - Package name from `engagefully` to `@makefully/engagefully`
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Makefully Studios
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Makefully Studios
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,91 +1,117 @@
1
- # Engagefully
2
-
3
- **Engagefully** by [Makefully](https://makefullystudios.com) turns keyboard, gamepad, pointer, and other devices into a single controller of typed actions (Button, Joystick, Pointer, …), plus a logical **ActionMap** for named game actions.
4
-
5
- > Early `0.x` API — expect breaking changes.
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install @makefully/engagefully
11
- ```
12
-
13
- Bundlers (Vite, etc.) may need the Node `events` polyfill — it is declared as a dependency of this package.
14
-
15
- ## Quickstart
16
-
17
- ```js
18
- import {
19
- Controller,
20
- ActionMap,
21
- devices,
22
- quantizeStick,
23
- focusGate,
24
- } from '@makefully/engagefully';
25
-
26
- const controller = new Controller([
27
- new devices.KeyboardDevice(),
28
- new devices.GamepadDevice(),
29
- ]);
30
-
31
- const actions = new ActionMap(controller, {
32
- take: ['Space', 'AButton'],
33
- drop: ['KeyF', 'BButton'],
34
- move: [
35
- { control: 'KeyW', data: { offset: 0 } },
36
- { control: 'KeyE', data: { offset: 1 } },
37
- ],
38
- }, {
39
- enabled: focusGate({ extra: () => helpOpen }),
40
- preventDefault: true,
41
- autoTick: true,
42
- });
43
-
44
- actions.on('take:pressed', () => { /* pickup */ });
45
- actions.on('move:pressed', (e) => { /* e.data.offset */ });
46
- actions.on('move:held', (e) => { /* each frame while held */ });
47
- actions.on('move:released', () => { /* stop chaining */ });
48
-
49
- // Stick → N sectors (game maps sector → direction):
50
- controller.on('LeftStick', (event) => {
51
- const q = quantizeStick(event.x, event.y, { sectors: 6, deadzone: 0.35 });
52
- // q?.sector → 0..5 or null in deadzone
53
- });
54
- ```
55
-
56
- ### Physical control ids
57
-
58
- | Device | Examples |
59
- |--------|----------|
60
- | Keyboard | `KeyW`, `Space`, `ArrowUp` (`event.code`) |
61
- | Gamepad | `AButton`, `BButton`, `XButton`, `YButton`, `LeftStick`, `UpDPad`, … |
62
- | Pointer | `Pointer` |
63
-
64
- You can still listen to physical ids on `Controller` directly (`KeyW:pressed`, `poll('Space')`).
65
-
66
- ### ActionMap
67
-
68
- - Many physical controls → one logical action; `:pressed` / `:released` aggregate across bindings.
69
- - Binding `data` is passed through on events (keep game-specific metadata in the game).
70
- - `held(action)` / `heldEvent(action)` / `clearHeld()` / `dispose()`.
71
- - `preventDefault: true` captures keyboard codes in the map so Space/arrows don’t scroll the page.
72
- - `enabled` (e.g. `focusGate`) ignores presses while typing or when chrome blocks input.
73
-
74
- ### Utils
75
-
76
- - **`quantizeStick(x, y, { sectors, deadzone, forward })`** → `{ sector }` or `null`
77
- - **`focusGate({ extra })`** → `() => boolean` for `ActionMap` `enabled`
78
-
79
- ## Devices
80
-
81
- **First-class:** `KeyboardDevice`, `GamepadDevice`, `PointerDevice`
82
-
83
- **Also included (experimental):** `BLEDevice`, `FabricDevice`, `PixiDevice`, `PageDevice`
84
-
85
- ## Publishing
86
-
87
- Bump `package.json` `version`, add a `## [x.y.z]` section to `CHANGELOG.md`, push `main`. CI publishes to npm (OIDC trusted publisher) and creates GitHub release `vX.Y.Z`.
88
-
89
- ## License
90
-
91
- MIT
1
+ # Engagefully
2
+
3
+ **Engagefully** by [Makefully](https://makefullystudios.com) turns keyboard, gamepad, pointer, and other devices into a single controller of typed actions (Button, Joystick, Pointer, …), plus a logical **ActionMap** for named game actions.
4
+
5
+ > Early `0.x` API — expect breaking changes.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @makefully/engagefully
11
+ ```
12
+
13
+ Bundlers (Vite, etc.) may need the Node `events` polyfill — it is declared as a dependency of this package.
14
+
15
+ ## Quickstart
16
+
17
+ ```js
18
+ import {
19
+ Controller,
20
+ ActionMap,
21
+ devices,
22
+ quantizeStick,
23
+ focusGate,
24
+ } from '@makefully/engagefully';
25
+
26
+ const controller = new Controller([
27
+ new devices.KeyboardDevice(),
28
+ new devices.GamepadDevice(),
29
+ ]);
30
+
31
+ const actions = new ActionMap(controller, {
32
+ take: ['Space', 'AButton'],
33
+ drop: ['KeyF', 'BButton'],
34
+ move: [
35
+ { control: 'KeyW', data: { offset: 0 } },
36
+ { control: 'KeyE', data: { offset: 1 } },
37
+ ],
38
+ }, {
39
+ enabled: focusGate({ extra: () => helpOpen }),
40
+ preventDefault: true,
41
+ autoTick: true,
42
+ });
43
+
44
+ actions.on('take:pressed', () => { /* pickup */ });
45
+ actions.on('move:pressed', (e) => { /* e.data.offset */ });
46
+ actions.on('move:held', (e) => { /* each frame while held */ });
47
+ actions.on('move:released', () => { /* stop chaining */ });
48
+
49
+ // Stick → N sectors (game maps sector → direction):
50
+ controller.on('LeftStick', (event) => {
51
+ const q = quantizeStick(event.x, event.y, { sectors: 6, deadzone: 0.35 });
52
+ // q?.sector → 0..5 or null in deadzone
53
+ });
54
+ ```
55
+
56
+ ### Physical control ids
57
+
58
+ | Device | Examples |
59
+ |--------|----------|
60
+ | Keyboard | `KeyW`, `Space`, `ArrowUp` (`event.code`) |
61
+ | Gamepad | `AButton`, `BButton`, `XButton`, `YButton`, `LeftStick`, `UpDPad`, … |
62
+ | Pointer | `Pointer` |
63
+ | Speech (experimental) | `SpeechTranscript` (`Data`); mapped ids e.g. `SayTake` (`Button`), `SayThrottle` (`Amount`), `SayMoveStick` (`Joystick`) |
64
+
65
+ You can still listen to physical ids on `Controller` directly (`KeyW:pressed`, `poll('Space')`).
66
+
67
+ ### SpeechDevice (experimental)
68
+
69
+ Wraps the Web Speech API. Does **not** auto-start — call `setActive(true)` / `start()` after a user gesture (mic UI stays app-owned). Chromium has the best support; recognition may use a cloud service (privacy). Requires a secure context (HTTPS / localhost).
70
+
71
+ - Final transcripts emit as `Data` on `SpeechTranscript` (`value.text`, `value.isFinal`, `value.matchedControls`).
72
+ - Phrase `mappings` emit typed controls: `Button` (momentary press/release for ActionMap), or latched `Amount` / `Joystick` / `Dial` (clear with another mapping or `releaseMs`).
73
+ - Exact utterance match only (normalized). Use `matchedControls` to skip chat when a command consumed the line.
74
+
75
+ ```js
76
+ const speech = new devices.SpeechDevice({
77
+ mappings: [
78
+ { control: 'SayTake', type: 'Button', phrases: ['take', 'grab'] },
79
+ { control: 'SayThrottle', type: 'Amount', phrases: ['slow down'], value: 0.25 },
80
+ { control: 'SayMoveStick', type: 'Joystick', phrases: ['go north'], x: 0, y: -1 },
81
+ ],
82
+ });
83
+ const controller = new Controller([speech /*, keyboard, gamepad */]);
84
+ speech.setActive(true);
85
+
86
+ controller.on('SpeechTranscript', (e) => {
87
+ if (!e.value?.isFinal || e.value.matchedControls?.length) return;
88
+ // side-channel chat / logging
89
+ });
90
+ ```
91
+
92
+ ### ActionMap
93
+
94
+ - Many physical controls → one logical action; `:pressed` / `:released` aggregate across bindings.
95
+ - Binding `data` is passed through on events (keep game-specific metadata in the game).
96
+ - `held(action)` / `heldEvent(action)` / `clearHeld()` / `dispose()`.
97
+ - `preventDefault: true` captures keyboard codes in the map so Space/arrows don’t scroll the page.
98
+ - `enabled` (e.g. `focusGate`) ignores presses while typing or when chrome blocks input.
99
+
100
+ ### Utils
101
+
102
+ - **`quantizeStick(x, y, { sectors, deadzone, forward })`** → `{ sector }` or `null`
103
+ - **`focusGate({ extra })`** → `() => boolean` for `ActionMap` `enabled`
104
+
105
+ ## Devices
106
+
107
+ **First-class:** `KeyboardDevice`, `GamepadDevice`, `PointerDevice`
108
+
109
+ **Also included (experimental):** `BLEDevice`, `FabricDevice`, `PixiDevice`, `PageDevice`, `SpeechDevice`
110
+
111
+ ## Publishing
112
+
113
+ Bump `package.json` `version`, add a `## [x.y.z]` section to `CHANGELOG.md`, push `main`. CI publishes to npm (OIDC trusted publisher) and creates GitHub release `vX.Y.Z`.
114
+
115
+ ## License
116
+
117
+ MIT