@opentui/keymap 0.0.0-20260423-76a94f40
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/LICENSE +21 -0
- package/README.md +54 -0
- package/addons/index.js +4390 -0
- package/addons/opentui/index.js +4712 -0
- package/html.js +4151 -0
- package/index.js +3631 -0
- package/opentui.js +3996 -0
- package/package.json +85 -0
- package/react/index.js +151 -0
- package/solid/index.js +119 -0
- package/src/addons/index.d.ts +1 -0
- package/src/addons/opentui/base-layout.d.ts +7 -0
- package/src/addons/opentui/edit-buffer-bindings.d.ts +38 -0
- package/src/addons/opentui/index.d.ts +4 -0
- package/src/addons/universal/aliases.d.ts +7 -0
- package/src/addons/universal/backspace-pops-pending-sequence.d.ts +13 -0
- package/src/addons/universal/comma-bindings.d.ts +6 -0
- package/src/addons/universal/dead-bindings.d.ts +6 -0
- package/src/addons/universal/default-parser.d.ts +16 -0
- package/src/addons/universal/emacs-bindings.d.ts +5 -0
- package/src/addons/universal/enabled.d.ts +16 -0
- package/src/addons/universal/escape-clears-pending-sequence.d.ts +14 -0
- package/src/addons/universal/ex-commands.d.ts +16 -0
- package/src/addons/universal/index.d.ts +21 -0
- package/src/addons/universal/leader.d.ts +9 -0
- package/src/addons/universal/metadata.d.ts +6 -0
- package/src/addons/universal/timed-leader.d.ts +12 -0
- package/src/addons/universal/unresolved-commands.d.ts +6 -0
- package/src/html.d.ts +21 -0
- package/src/index.d.ts +3 -0
- package/src/keymap-benchmark.d.ts +1 -0
- package/src/keymap.d.ts +73 -0
- package/src/lib/emitter.d.ts +13 -0
- package/src/lib/registry.d.ts +28 -0
- package/src/opentui.d.ts +7 -0
- package/src/react/index.d.ts +42 -0
- package/src/schema.d.ts +3 -0
- package/src/services/activation.d.ts +44 -0
- package/src/services/command-catalog.d.ts +49 -0
- package/src/services/command-executor.d.ts +22 -0
- package/src/services/compiler.d.ts +21 -0
- package/src/services/conditions.d.ts +20 -0
- package/src/services/dispatch.d.ts +34 -0
- package/src/services/environment.d.ts +25 -0
- package/src/services/keys.d.ts +18 -0
- package/src/services/layers.d.ts +34 -0
- package/src/services/notify.d.ts +18 -0
- package/src/services/primitives/active-layers.d.ts +5 -0
- package/src/services/primitives/binding-inputs.d.ts +4 -0
- package/src/services/primitives/field-invariants.d.ts +3 -0
- package/src/services/runtime.d.ts +15 -0
- package/src/services/state.d.ts +102 -0
- package/src/services/values.d.ts +7 -0
- package/src/solid/index.d.ts +45 -0
- package/src/types.d.ts +497 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 opentui
|
|
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
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @opentui/keymap
|
|
2
|
+
|
|
3
|
+
Keymap package for OpenTUI and browser-based UIs.
|
|
4
|
+
|
|
5
|
+
It provides a shared keymap core, adapter-specific entrypoints for HTML and OpenTUI, and framework providers/hooks for React and Solid.
|
|
6
|
+
|
|
7
|
+
The core `Keymap` is intentionally bare. Create a keymap, install the addons you want, then pass that configured instance to your app.
|
|
8
|
+
|
|
9
|
+
Use the HTML entrypoint for DOM-based hosts and the OpenTUI entrypoint for terminal renderers. The React and Solid entrypoints consume a pre-created OpenTUI keymap through context.
|
|
10
|
+
|
|
11
|
+
Entry points:
|
|
12
|
+
|
|
13
|
+
- `@opentui/keymap`: core keymap API
|
|
14
|
+
- `@opentui/keymap/addons`: universal addons
|
|
15
|
+
- `@opentui/keymap/addons/opentui`: universal addons plus OpenTUI-specific addons
|
|
16
|
+
- `@opentui/keymap/html`: core API plus the HTML adapter
|
|
17
|
+
- `@opentui/keymap/opentui`: core API plus the OpenTUI adapter
|
|
18
|
+
- `@opentui/keymap/react`: React provider and hooks for a pre-created OpenTUI keymap
|
|
19
|
+
- `@opentui/keymap/solid`: Solid provider and hooks for a pre-created OpenTUI keymap
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { registerDefaultKeys } from "@opentui/keymap/addons"
|
|
25
|
+
import { createOpenTuiKeymap } from "@opentui/keymap/opentui"
|
|
26
|
+
import { KeymapProvider } from "@opentui/keymap/react"
|
|
27
|
+
|
|
28
|
+
const keymap = createOpenTuiKeymap(renderer)
|
|
29
|
+
registerDefaultKeys(keymap)
|
|
30
|
+
|
|
31
|
+
createRoot(renderer).render(
|
|
32
|
+
<KeymapProvider keymap={keymap}>
|
|
33
|
+
<App />
|
|
34
|
+
</KeymapProvider>,
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
bun install @opentui/keymap
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bun run build
|
|
48
|
+
bun run test
|
|
49
|
+
bun src/keymap-benchmark.ts
|
|
50
|
+
bun run serve:keymap-html
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- `bun src/keymap-benchmark.ts` runs the benchmark suite from `src/keymap-benchmark.ts`.
|
|
54
|
+
- `bun run serve:keymap-html` builds the package and serves the HTML demo locally.
|