@solid-primitives/keyboard 1.0.0 → 1.0.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/LICENSE +20 -20
- package/README.md +158 -171
- package/dist/index.js +0 -2
- package/dist/server.js +0 -2
- package/package.json +79 -79
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Solid Primitives Working Group
|
|
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
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Solid Primitives Working Group
|
|
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
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,171 +1,158 @@
|
|
|
1
|
-
<p>
|
|
2
|
-
<img width="100%" src="https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=keyboard" alt="Solid Primitives keyboard">
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# @solid-primitives/keyboard
|
|
6
|
-
|
|
7
|
-
[](https://lerna.js.org/)
|
|
8
|
-
[](https://bundlephobia.com/package/@solid-primitives/keyboard)
|
|
9
|
-
[](https://www.npmjs.com/package/@solid-primitives/keyboard)
|
|
10
|
-
[ — Provides a signal with the list of currently held keys
|
|
15
|
-
- [`useCurrentlyHeldKey`](#useCurrentlyHeldKey) — Provides a signal with the currently held single key.
|
|
16
|
-
- [`useKeyDownSequence`](#useKeyDownSequence) — Provides a signal with a sequence of currently held keys, as they were pressed down and up.
|
|
17
|
-
- [`createKeyHold`](#createKeyHold) — Provides a signal indicating if provided key is currently being held down.
|
|
18
|
-
- [`createShortcut`](#createShortcut) — Creates a keyboard shotcut observer.
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @solid-primitives/keyboard
|
|
24
|
-
# or
|
|
25
|
-
yarn add @solid-primitives/keyboard
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## `useKeyDownList`
|
|
29
|
-
|
|
30
|
-
Provides a signal with the list of currently held keys, ordered from least recent to most recent.
|
|
31
|
-
|
|
32
|
-
This is a [shared root](https://github.com/solidjs-community/solid-primitives/tree/main/packages/rootless#createSharedRoot) primitive that will reuse event listeners and signals across dependents.
|
|
33
|
-
|
|
34
|
-
### How to use it
|
|
35
|
-
|
|
36
|
-
`useKeyDownList` takes no arguments, and returns a signal with the list of currently held keys, and last keydown event.
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
import { useKeyDownList } from "@solid-primitives/keyboard";
|
|
40
|
-
|
|
41
|
-
const [keys, { event }] = useKeyDownList();
|
|
42
|
-
|
|
43
|
-
createEffect(() => {
|
|
44
|
-
console.log(keys()); // => string[] — list of currently held keys
|
|
45
|
-
console.log(event()); // => KeyboardEvent | null — last keydown event
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
<For each={keys()}>
|
|
49
|
-
{key => <kbd>{key}</kdb>}
|
|
50
|
-
</For>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## `useCurrentlyHeldKey`
|
|
54
|
-
|
|
55
|
-
Provides a signal with the currently held single key. Pressing any other key at the same time will reset the signal to `null`.
|
|
56
|
-
|
|
57
|
-
This is a [shared root](https://github.com/solidjs-community/solid-primitives/tree/main/packages/rootless#createSharedRoot) primitive that will reuse event listeners and signals across dependents.
|
|
58
|
-
|
|
59
|
-
### How to use it
|
|
60
|
-
|
|
61
|
-
`useCurrentlyHeldKey` takes no arguments, and returns a signal with the currently held single key.
|
|
62
|
-
|
|
63
|
-
```tsx
|
|
64
|
-
import { useCurrentlyHeldKey } from "@solid-primitives/keyboard";
|
|
65
|
-
|
|
66
|
-
const key = useCurrentlyHeldKey();
|
|
67
|
-
|
|
68
|
-
createEffect(() => {
|
|
69
|
-
console.log(key()); // => string | null — currently held key
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## `useKeyDownSequence`
|
|
74
|
-
|
|
75
|
-
Provides a signal with a sequence of currently held keys, as they were pressed down and up.
|
|
76
|
-
|
|
77
|
-
This is a [shared root](https://github.com/solidjs-community/solid-primitives/tree/main/packages/rootless#createSharedRoot) primitive that will reuse event listeners and signals across dependents.
|
|
78
|
-
|
|
79
|
-
### How to use it
|
|
80
|
-
|
|
81
|
-
`useKeyDownSequence` takes no arguments, and returns a single signal.
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
import { useKeyDownSequence } from "@solid-primitives/keyboard";
|
|
85
|
-
|
|
86
|
-
const sequence = useKeyDownSequence();
|
|
87
|
-
|
|
88
|
-
createEffect(() => {
|
|
89
|
-
console.log(sequence()); // => string[][] — sequence of currently held keys
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// example sequence of pressing Ctrl + Shift + A
|
|
93
|
-
// [["Control"], ["Control", "Shift"], ["Control", "Shift", "A"]]
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## `createKeyHold`
|
|
97
|
-
|
|
98
|
-
Provides a `boolean` signal indicating if provided
|
|
99
|
-
|
|
100
|
-
Holding multiple keys at the same time will return `false` — holding only the specified one will return `true`.
|
|
101
|
-
|
|
102
|
-
### How to use it
|
|
103
|
-
|
|
104
|
-
`createKeyHold` takes two arguments:
|
|
105
|
-
|
|
106
|
-
- `key` keyboard key to listen for
|
|
107
|
-
- `options` additional configuration:
|
|
108
|
-
- `preventDefault` — call `e.preventDefault()` on the keyboard event, when the specified key is pressed. _(Defaults to `true`)_
|
|
109
|
-
|
|
110
|
-
```tsx
|
|
111
|
-
import { createKeyHold } from "@solid-primitives/keyboard";
|
|
112
|
-
|
|
113
|
-
const pressing = createKeyHold("Alt", { preventDefault: false });
|
|
114
|
-
|
|
115
|
-
<p>Is pressing Alt? {pressing() ? "YES" : "NO"}</p>;
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## `createShortcut`
|
|
119
|
-
|
|
120
|
-
Creates a keyboard shotcut observer. The provided callback will be called when the specified keys are pressed.
|
|
121
|
-
|
|
122
|
-
### How to use it
|
|
123
|
-
|
|
124
|
-
`createShortcut` takes three arguments:
|
|
125
|
-
|
|
126
|
-
- `keys` — list of keys to listen for
|
|
127
|
-
- `callback` — callback to call when the specified keys are pressed
|
|
128
|
-
- `options` — additional configuration:
|
|
129
|
-
- `preventDefault` — call `e.preventDefault()` on the keyboard event, when the specified key is pressed. _(Defaults to `true`)_
|
|
130
|
-
- `requireReset` — If `true`, the shortcut will only be triggered once until all of the keys stop being pressed. Disabled by default.
|
|
131
|
-
|
|
132
|
-
```tsx
|
|
133
|
-
import { createShortcut } from "@solid-primitives/keyboard";
|
|
134
|
-
|
|
135
|
-
createShortcut(
|
|
136
|
-
["Control", "Shift", "A"],
|
|
137
|
-
() => {
|
|
138
|
-
console.log("Shortcut triggered");
|
|
139
|
-
},
|
|
140
|
-
{ preventDefault: false, requireReset: true }
|
|
141
|
-
);
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Preventing default
|
|
145
|
-
|
|
146
|
-
When `preventDefault` is `true`, `e.preventDefault()` will be called not only on the keydown event that have triggered the callback, but it will **optimistically** also prevend the default behavior of every previous keydown that will have the possibility to lead to the shotcut being pressed.
|
|
147
|
-
|
|
148
|
-
E.g. when listening for `Control + Shift + A`, all three keydown events will be prevented.
|
|
149
|
-
|
|
150
|
-
##
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
1.0.0
|
|
160
|
-
|
|
161
|
-
[PR#159](https://github.com/solidjs-community/solid-primitives/pull/159)
|
|
162
|
-
|
|
163
|
-
General package refactor. The single initial `makeKeyHoldListener` primitive has been replaced by:
|
|
164
|
-
|
|
165
|
-
- `useKeyDownList`,
|
|
166
|
-
- `useCurrentlyHeldKey`,
|
|
167
|
-
- `useKeyDownSequence`,
|
|
168
|
-
- `createKeyHold`,
|
|
169
|
-
- `createShortcut`
|
|
170
|
-
|
|
171
|
-
</details>
|
|
1
|
+
<p>
|
|
2
|
+
<img width="100%" src="https://assets.solidjs.com/banner?type=Primitives&background=tiles&project=keyboard" alt="Solid Primitives keyboard">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# @solid-primitives/keyboard
|
|
6
|
+
|
|
7
|
+
[](https://lerna.js.org/)
|
|
8
|
+
[](https://bundlephobia.com/package/@solid-primitives/keyboard)
|
|
9
|
+
[](https://www.npmjs.com/package/@solid-primitives/keyboard)
|
|
10
|
+
[](https://github.com/solidjs-community/solid-primitives#contribution-process)
|
|
11
|
+
|
|
12
|
+
A library of reactive promitives helping handling user's keyboard input.
|
|
13
|
+
|
|
14
|
+
- [`useKeyDownList`](#useKeyDownList) — Provides a signal with the list of currently held keys
|
|
15
|
+
- [`useCurrentlyHeldKey`](#useCurrentlyHeldKey) — Provides a signal with the currently held single key.
|
|
16
|
+
- [`useKeyDownSequence`](#useKeyDownSequence) — Provides a signal with a sequence of currently held keys, as they were pressed down and up.
|
|
17
|
+
- [`createKeyHold`](#createKeyHold) — Provides a signal indicating if provided key is currently being held down.
|
|
18
|
+
- [`createShortcut`](#createShortcut) — Creates a keyboard shotcut observer.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @solid-primitives/keyboard
|
|
24
|
+
# or
|
|
25
|
+
yarn add @solid-primitives/keyboard
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## `useKeyDownList`
|
|
29
|
+
|
|
30
|
+
Provides a signal with the list of currently held keys, ordered from least recent to most recent.
|
|
31
|
+
|
|
32
|
+
This is a [shared root](https://github.com/solidjs-community/solid-primitives/tree/main/packages/rootless#createSharedRoot) primitive that will reuse event listeners and signals across dependents.
|
|
33
|
+
|
|
34
|
+
### How to use it
|
|
35
|
+
|
|
36
|
+
`useKeyDownList` takes no arguments, and returns a signal with the list of currently held keys, and last keydown event.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { useKeyDownList } from "@solid-primitives/keyboard";
|
|
40
|
+
|
|
41
|
+
const [keys, { event }] = useKeyDownList();
|
|
42
|
+
|
|
43
|
+
createEffect(() => {
|
|
44
|
+
console.log(keys()); // => string[] — list of currently held keys
|
|
45
|
+
console.log(event()); // => KeyboardEvent | null — last keydown event
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
<For each={keys()}>
|
|
49
|
+
{key => <kbd>{key}</kdb>}
|
|
50
|
+
</For>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## `useCurrentlyHeldKey`
|
|
54
|
+
|
|
55
|
+
Provides a signal with the currently held single key. Pressing any other key at the same time will reset the signal to `null`.
|
|
56
|
+
|
|
57
|
+
This is a [shared root](https://github.com/solidjs-community/solid-primitives/tree/main/packages/rootless#createSharedRoot) primitive that will reuse event listeners and signals across dependents.
|
|
58
|
+
|
|
59
|
+
### How to use it
|
|
60
|
+
|
|
61
|
+
`useCurrentlyHeldKey` takes no arguments, and returns a signal with the currently held single key.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { useCurrentlyHeldKey } from "@solid-primitives/keyboard";
|
|
65
|
+
|
|
66
|
+
const key = useCurrentlyHeldKey();
|
|
67
|
+
|
|
68
|
+
createEffect(() => {
|
|
69
|
+
console.log(key()); // => string | null — currently held key
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## `useKeyDownSequence`
|
|
74
|
+
|
|
75
|
+
Provides a signal with a sequence of currently held keys, as they were pressed down and up.
|
|
76
|
+
|
|
77
|
+
This is a [shared root](https://github.com/solidjs-community/solid-primitives/tree/main/packages/rootless#createSharedRoot) primitive that will reuse event listeners and signals across dependents.
|
|
78
|
+
|
|
79
|
+
### How to use it
|
|
80
|
+
|
|
81
|
+
`useKeyDownSequence` takes no arguments, and returns a single signal.
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import { useKeyDownSequence } from "@solid-primitives/keyboard";
|
|
85
|
+
|
|
86
|
+
const sequence = useKeyDownSequence();
|
|
87
|
+
|
|
88
|
+
createEffect(() => {
|
|
89
|
+
console.log(sequence()); // => string[][] — sequence of currently held keys
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// example sequence of pressing Ctrl + Shift + A
|
|
93
|
+
// [["Control"], ["Control", "Shift"], ["Control", "Shift", "A"]]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## `createKeyHold`
|
|
97
|
+
|
|
98
|
+
Provides a `boolean` signal indicating if provided key is currently being held down.
|
|
99
|
+
|
|
100
|
+
Holding multiple keys at the same time will return `false` — holding only the specified one will return `true`.
|
|
101
|
+
|
|
102
|
+
### How to use it
|
|
103
|
+
|
|
104
|
+
`createKeyHold` takes two arguments:
|
|
105
|
+
|
|
106
|
+
- `key` keyboard key to listen for
|
|
107
|
+
- `options` additional configuration:
|
|
108
|
+
- `preventDefault` — call `e.preventDefault()` on the keyboard event, when the specified key is pressed. _(Defaults to `true`)_
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { createKeyHold } from "@solid-primitives/keyboard";
|
|
112
|
+
|
|
113
|
+
const pressing = createKeyHold("Alt", { preventDefault: false });
|
|
114
|
+
|
|
115
|
+
<p>Is pressing Alt? {pressing() ? "YES" : "NO"}</p>;
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## `createShortcut`
|
|
119
|
+
|
|
120
|
+
Creates a keyboard shotcut observer. The provided callback will be called when the specified keys are pressed.
|
|
121
|
+
|
|
122
|
+
### How to use it
|
|
123
|
+
|
|
124
|
+
`createShortcut` takes three arguments:
|
|
125
|
+
|
|
126
|
+
- `keys` — list of keys to listen for
|
|
127
|
+
- `callback` — callback to call when the specified keys are pressed
|
|
128
|
+
- `options` — additional configuration:
|
|
129
|
+
- `preventDefault` — call `e.preventDefault()` on the keyboard event, when the specified key is pressed. _(Defaults to `true`)_
|
|
130
|
+
- `requireReset` — If `true`, the shortcut will only be triggered once until all of the keys stop being pressed. Disabled by default.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { createShortcut } from "@solid-primitives/keyboard";
|
|
134
|
+
|
|
135
|
+
createShortcut(
|
|
136
|
+
["Control", "Shift", "A"],
|
|
137
|
+
() => {
|
|
138
|
+
console.log("Shortcut triggered");
|
|
139
|
+
},
|
|
140
|
+
{ preventDefault: false, requireReset: true }
|
|
141
|
+
);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Preventing default
|
|
145
|
+
|
|
146
|
+
When `preventDefault` is `true`, `e.preventDefault()` will be called not only on the keydown event that have triggered the callback, but it will **optimistically** also prevend the default behavior of every previous keydown that will have the possibility to lead to the shotcut being pressed.
|
|
147
|
+
|
|
148
|
+
E.g. when listening for `Control + Shift + A`, all three keydown events will be prevented.
|
|
149
|
+
|
|
150
|
+
## DEMO
|
|
151
|
+
|
|
152
|
+
Working demo of some of the primitives in keyboard package:
|
|
153
|
+
|
|
154
|
+
https://codesandbox.io/s/solid-primitives-keyboard-demo-s2l84k?file=/index.tsx
|
|
155
|
+
|
|
156
|
+
## Changelog
|
|
157
|
+
|
|
158
|
+
See [CHANGELOG.md](./CHANGELOG.md)
|
package/dist/index.js
CHANGED
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@solid-primitives/keyboard",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A library of reactive promitives helping handling user's keyboard input.",
|
|
5
|
-
"author": "Damian Tarnwski <gthetarnav@gmail.com>",
|
|
6
|
-
"contributors": [],
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/solidjs-community/solid-primitives/tree/main/packages/keyboard#readme",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/solidjs-community/solid-primitives.git"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/solidjs-community/solid-primitives/issues"
|
|
15
|
-
},
|
|
16
|
-
"primitive": {
|
|
17
|
-
"name": "keyboard",
|
|
18
|
-
"stage":
|
|
19
|
-
"list": [
|
|
20
|
-
"useKeyDownList",
|
|
21
|
-
"useCurrentlyHeldKey",
|
|
22
|
-
"useKeyDownSequence",
|
|
23
|
-
"createKeyHold",
|
|
24
|
-
"createShortcut"
|
|
25
|
-
],
|
|
26
|
-
"category": "Inputs"
|
|
27
|
-
},
|
|
28
|
-
"private": false,
|
|
29
|
-
"sideEffects": false,
|
|
30
|
-
"type": "module",
|
|
31
|
-
"main": "./dist/server.cjs",
|
|
32
|
-
"module": "./dist/index.js",
|
|
33
|
-
"types": "./dist/index.d.ts",
|
|
34
|
-
"exports": {
|
|
35
|
-
"node": {
|
|
36
|
-
"import": "./dist/server.js",
|
|
37
|
-
"require": "./dist/server.cjs"
|
|
38
|
-
},
|
|
39
|
-
"import": "./dist/index.js",
|
|
40
|
-
"require": "./dist/index.cjs"
|
|
41
|
-
},
|
|
42
|
-
"files": [
|
|
43
|
-
"dist"
|
|
44
|
-
],
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@solid-primitives/keyboard",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A library of reactive promitives helping handling user's keyboard input.",
|
|
5
|
+
"author": "Damian Tarnwski <gthetarnav@gmail.com>",
|
|
6
|
+
"contributors": [],
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/solidjs-community/solid-primitives/tree/main/packages/keyboard#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/solidjs-community/solid-primitives.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/solidjs-community/solid-primitives/issues"
|
|
15
|
+
},
|
|
16
|
+
"primitive": {
|
|
17
|
+
"name": "keyboard",
|
|
18
|
+
"stage": 1,
|
|
19
|
+
"list": [
|
|
20
|
+
"useKeyDownList",
|
|
21
|
+
"useCurrentlyHeldKey",
|
|
22
|
+
"useKeyDownSequence",
|
|
23
|
+
"createKeyHold",
|
|
24
|
+
"createShortcut"
|
|
25
|
+
],
|
|
26
|
+
"category": "Inputs"
|
|
27
|
+
},
|
|
28
|
+
"private": false,
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"type": "module",
|
|
31
|
+
"main": "./dist/server.cjs",
|
|
32
|
+
"module": "./dist/index.js",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
"node": {
|
|
36
|
+
"import": "./dist/server.js",
|
|
37
|
+
"require": "./dist/server.cjs"
|
|
38
|
+
},
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"require": "./dist/index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
],
|
|
45
|
+
"keywords": [
|
|
46
|
+
"solid",
|
|
47
|
+
"primitives",
|
|
48
|
+
"keyboard",
|
|
49
|
+
"keystroke",
|
|
50
|
+
"hotkey"
|
|
51
|
+
],
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"jsdom": "^19.0.0",
|
|
54
|
+
"prettier": "^2.7.1",
|
|
55
|
+
"solid-js": "^1.4.8",
|
|
56
|
+
"tslib": "^2.4.0",
|
|
57
|
+
"tsup": "^6.1.3",
|
|
58
|
+
"typescript": "^4.7.4",
|
|
59
|
+
"unocss": "^0.44.7",
|
|
60
|
+
"vite": "^3.0.2",
|
|
61
|
+
"vite-plugin-solid": "^2.3.0",
|
|
62
|
+
"vitest": "^0.18.1"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"solid-js": "^1.4.0"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@solid-primitives/event-listener": "^2.2.1",
|
|
69
|
+
"@solid-primitives/rootless": "^1.1.2",
|
|
70
|
+
"@solid-primitives/utils": "^3.0.0"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"start": "vite serve dev --host",
|
|
74
|
+
"dev": "npm run start",
|
|
75
|
+
"build": "tsup",
|
|
76
|
+
"test": "vitest run test",
|
|
77
|
+
"test:watch": "vitest watch test"
|
|
78
|
+
}
|
|
79
|
+
}
|