aleman 1.8.0 → 1.9.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 +5 -0
- package/README.md +11 -9
- package/aleman/vim.js +6 -2
- package/menu/README.md +13 -0
- package/menu/addons/gg.js +4 -2
- package/menu/addons/j.js +0 -1
- package/menu/addons/k.js +0 -1
- package/menu/addons/shift-g.js +1 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -23,8 +23,9 @@ bun i aleman
|
|
|
23
23
|
## Rules and Addons
|
|
24
24
|
|
|
25
25
|
Aleman supports two main concepts:
|
|
26
|
-
|
|
27
|
-
- ✅
|
|
26
|
+
|
|
27
|
+
- ✅ addons - events;
|
|
28
|
+
- ✅ rules - 🐊**Putout** rules that changes HTML;
|
|
28
29
|
|
|
29
30
|
All interaction with DOM made using rules, and we interact not with DOM directly, but with JSX AST.
|
|
30
31
|
It makes testing simple, states predictable and independent.
|
|
@@ -34,16 +35,17 @@ It makes testing simple, states predictable and independent.
|
|
|
34
35
|
Addon responsible for UI and interfaction with outer world: clicks, fetches and everything like this.
|
|
35
36
|
Aleman supports next types of addons:
|
|
36
37
|
|
|
37
|
-
- Global
|
|
38
|
-
- Events
|
|
39
|
-
- Keys
|
|
40
|
-
- Vim
|
|
38
|
+
- ✅ [Global](#globals);
|
|
39
|
+
- ✅ [Events](#events);
|
|
40
|
+
- ✅ [Keys](#keys);
|
|
41
|
+
- ✅ [Vim](#vim);
|
|
41
42
|
|
|
42
43
|
When you need to filter out events according to `state` use `filter`:
|
|
43
44
|
|
|
44
45
|
```js
|
|
45
46
|
export const filter = ({state}) => state.command === 'show';
|
|
46
47
|
```
|
|
48
|
+
|
|
47
49
|
#### Global
|
|
48
50
|
|
|
49
51
|
Any browser event you need to listen globally:
|
|
@@ -63,7 +65,7 @@ export const listener = () => ({
|
|
|
63
65
|
Any browser event you need to listen according to element with `data-name="hello":
|
|
64
66
|
|
|
65
67
|
```js
|
|
66
|
-
export const name = 'hello'
|
|
68
|
+
export const name = 'hello';
|
|
67
69
|
export const events = ['click'];
|
|
68
70
|
export const listener = () => ({
|
|
69
71
|
command: 'hide',
|
|
@@ -84,7 +86,7 @@ export const listener = ({state, options}) => {
|
|
|
84
86
|
command: 'hide',
|
|
85
87
|
showSubmenu: false,
|
|
86
88
|
index: -1,
|
|
87
|
-
}
|
|
89
|
+
};
|
|
88
90
|
};
|
|
89
91
|
```
|
|
90
92
|
|
|
@@ -101,7 +103,7 @@ export function listener({state, options}) {
|
|
|
101
103
|
index,
|
|
102
104
|
submenuIndex,
|
|
103
105
|
} = state;
|
|
104
|
-
|
|
106
|
+
|
|
105
107
|
const newState = {
|
|
106
108
|
...state,
|
|
107
109
|
index: insideSubmenu ? index : 1,
|
package/aleman/vim.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
const isNumber = (a) => !Number.isNaN(a) && typeof a === 'number';
|
|
2
2
|
|
|
3
|
-
export const createVimParser = (buffer = []) => (
|
|
4
|
-
|
|
3
|
+
export const createVimParser = (buffer = []) => ({key}) => {
|
|
4
|
+
if (key === '^')
|
|
5
|
+
return ['^'];
|
|
6
|
+
|
|
7
|
+
if (key === '$')
|
|
8
|
+
return ['$'];
|
|
5
9
|
|
|
6
10
|
if (!buffer.length && key === 'g') {
|
|
7
11
|
buffer.push('g');
|
package/menu/README.md
CHANGED
|
@@ -11,6 +11,19 @@
|
|
|
11
11
|
- ✅[`submenu`](https://putout.cloudcmd.io/#/gist/b0a3b64d14f3497869a345e7e438d66e/feb671c4a59a555ff408af92fab602bae3a94e2f);
|
|
12
12
|
- ✅[`hide-submenu`](https://putout.cloudcmd.io/#/gist/fdf6cf60a7fdfa2bae64279eda2ab023/ce0d5e24dc5e0b3436b7e87585c62e8a5132a9ab);
|
|
13
13
|
|
|
14
|
+
## Hot Keys
|
|
15
|
+
|
|
16
|
+
| Key | Operation |
|
|
17
|
+
|:-------------|:------------------------|
|
|
18
|
+
| `F9` | open |
|
|
19
|
+
| `Esc` | close |
|
|
20
|
+
| `Up`, `j` | move cursor up |
|
|
21
|
+
| `Down`, `k` | move cursor down |
|
|
22
|
+
| `Left`, `h` | close submenu |
|
|
23
|
+
| `Right`, `l` | open submenu |
|
|
24
|
+
| `G` or `$` | navigate to bottom file |
|
|
25
|
+
| `gg` or `^` | navigate to top file |
|
|
26
|
+
|
|
14
27
|
## License
|
|
15
28
|
|
|
16
29
|
MIT
|
package/menu/addons/gg.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as up from './up.js';
|
|
2
2
|
|
|
3
3
|
export const {filter} = up;
|
|
4
|
-
export const commands = [
|
|
4
|
+
export const commands = [
|
|
5
|
+
'gg',
|
|
6
|
+
'^',
|
|
7
|
+
];
|
|
5
8
|
|
|
6
9
|
export function listener({state, options}) {
|
|
7
10
|
const {
|
|
@@ -21,4 +24,3 @@ export function listener({state, options}) {
|
|
|
21
24
|
options,
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
|
-
|
package/menu/addons/j.js
CHANGED
package/menu/addons/k.js
CHANGED
package/menu/addons/shift-g.js
CHANGED