keystra 0.0.0-stage → 0.1.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 +27 -0
- package/LICENSE +21 -0
- package/README.md +78 -2
- package/dist/chunk-2BLQUBG7.js +816 -0
- package/dist/chunk-77GGU3AX.js +135 -0
- package/dist/chunk-KDOJARJD.js +29 -0
- package/dist/chunk-LYYUOTBP.js +125 -0
- package/dist/chunk-S5YVXIMA.js +61 -0
- package/dist/chunk-SSIKGDD4.js +255 -0
- package/dist/chunk-U7YK6PPT.js +1729 -0
- package/dist/chunk-XFNYIPOW.js +253 -0
- package/dist/chunk-ZOJRXXQN.js +308 -0
- package/dist/core.cjs +2861 -0
- package/dist/core.d.cts +41 -0
- package/dist/core.d.ts +41 -0
- package/dist/core.js +7 -0
- package/dist/engine-COPfXXTp.d.ts +229 -0
- package/dist/engine-DcbkGRgz.d.cts +229 -0
- package/dist/focus.cjs +374 -0
- package/dist/focus.d.cts +74 -0
- package/dist/focus.d.ts +74 -0
- package/dist/focus.js +2 -0
- package/dist/index-IZkcWAXP.d.cts +395 -0
- package/dist/index-IZkcWAXP.d.ts +395 -0
- package/dist/index.cjs +3745 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.global.js +1 -0
- package/dist/index.js +9 -0
- package/dist/layout-C2-n8aUI.d.ts +17 -0
- package/dist/layout-CBzD-87D.d.cts +17 -0
- package/dist/navigation.cjs +293 -0
- package/dist/navigation.d.cts +33 -0
- package/dist/navigation.d.ts +33 -0
- package/dist/navigation.js +2 -0
- package/dist/patterns.cjs +3505 -0
- package/dist/patterns.d.cts +12 -0
- package/dist/patterns.d.ts +12 -0
- package/dist/patterns.js +7 -0
- package/dist/roving-focus-CT7Dm6di.d.ts +63 -0
- package/dist/roving-focus-ZQ0v7hLe.d.cts +63 -0
- package/dist/selection.cjs +266 -0
- package/dist/selection.d.cts +43 -0
- package/dist/selection.d.ts +43 -0
- package/dist/selection.js +2 -0
- package/dist/utils-CkveVeIJ.d.cts +18 -0
- package/dist/utils-JmPZTlys.d.ts +18 -0
- package/dist/utils.cjs +195 -0
- package/dist/utils.d.cts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +2 -0
- package/package.json +147 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This project follows [Semantic Versioning](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [0.1.1] — 2026-11-02
|
|
6
|
+
|
|
7
|
+
- Shorter README, with a demo GIF and full guides in `docs/`.
|
|
8
|
+
|
|
9
|
+
## [0.1.0] — 2026-11-02
|
|
10
|
+
|
|
11
|
+
First release.
|
|
12
|
+
|
|
13
|
+
- `createKeystra()` engine: key normalization and matching, modifier chords,
|
|
14
|
+
multi-key sequences, custom key maps and event delegation.
|
|
15
|
+
- Navigation modes: sequential, vertical, horizontal, grid, directional and
|
|
16
|
+
custom strategies, with looping and disabled and hidden item skipping.
|
|
17
|
+
- Focus management: roving tabindex, `aria-activedescendant`, focus restoration
|
|
18
|
+
and nested groups.
|
|
19
|
+
- Selection: single, multiple and range modes, independent of styling.
|
|
20
|
+
- Patterns: `createTabs`, `createMenu`, `createDropdown`, `createList`,
|
|
21
|
+
`createGrid`, `createTree`, `createCommandPalette` and `createRovingFocus`.
|
|
22
|
+
- `createKeyBinding()` for document-level shortcuts, and `useKeystra()` for
|
|
23
|
+
elements that do not exist yet.
|
|
24
|
+
- Dynamic DOM support through `refresh()`, explicit registration and optional
|
|
25
|
+
mutation observation.
|
|
26
|
+
- ESM, CommonJS and script-tag builds, TypeScript declarations and deep imports
|
|
27
|
+
such as `keystra/patterns`. No runtime dependencies.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zahid Hasan
|
|
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,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Keystra
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keyboard navigation, focus and selection for any DOM UI.
|
|
4
|
+
|
|
5
|
+
- Works with vanilla JS, TypeScript and any DOM-based framework.
|
|
6
|
+
- Arrow keys, Home/End, typeahead, shortcuts and key sequences.
|
|
7
|
+
- Roving tabindex, focus restore, and single, multiple or range selection.
|
|
8
|
+
- Ready-made tabs, menus, dropdowns, lists, grids, trees and command palettes.
|
|
9
|
+
- Skips disabled and hidden items, and keeps up with DOM changes.
|
|
10
|
+
- No dependencies, and no UI or styling of its own.
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm i keystra
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<div id="actions" aria-label="Actions">
|
|
24
|
+
<button data-keystra-item>Copy</button>
|
|
25
|
+
<button data-keystra-item>Move</button>
|
|
26
|
+
<button data-keystra-item disabled>Delete</button>
|
|
27
|
+
</div>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { createKeystra } from 'keystra';
|
|
32
|
+
|
|
33
|
+
const nav = createKeystra({
|
|
34
|
+
container: '#actions',
|
|
35
|
+
loop: true,
|
|
36
|
+
onSelect: (element) => console.log('activate', element),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
nav.focusFirst();
|
|
40
|
+
|
|
41
|
+
// When the UI is removed:
|
|
42
|
+
nav.destroy();
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Arrow keys now move through the buttons and skip the disabled one, Tab leaves the group in one stop, and Enter calls `onSelect`.
|
|
46
|
+
|
|
47
|
+
## Patterns
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { createTabs } from 'keystra';
|
|
51
|
+
|
|
52
|
+
const tabs = createTabs({
|
|
53
|
+
container: '#tabs',
|
|
54
|
+
items: '[role="tab"]',
|
|
55
|
+
panels: '[role="tabpanel"]',
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Also available: `createMenu`, `createDropdown`, `createList`, `createGrid`, `createTree`, `createCommandPalette` and `createRovingFocus`. See [Patterns](docs/patterns.md).
|
|
60
|
+
|
|
61
|
+
## Shortcuts
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { createKeyBinding } from 'keystra';
|
|
65
|
+
|
|
66
|
+
const palette = createKeyBinding('Ctrl+K', () => openPalette());
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Docs
|
|
70
|
+
|
|
71
|
+
- [API](docs/api.md): options, methods, keys, selection and lifecycle.
|
|
72
|
+
- [Patterns](docs/patterns.md): each ready-made widget.
|
|
73
|
+
- [Frameworks](docs/frameworks.md): React, Vue, Svelte and Angular.
|
|
74
|
+
- [Accessibility](docs/accessibility.md): what Keystra does and what stays yours, plus browser support.
|
|
75
|
+
- [Performance](docs/performance.md): bundle size and large lists.
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|