aleman 2.0.0 → 2.0.2
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 +19 -0
- package/README.md +2 -2
- package/aleman/render.js +2 -2
- package/aleman/vim.js +1 -0
- package/menu/addons/left.js +2 -0
- package/menu/importmap.js +1 -1
- package/menu/rules/build-menu/index.js +1 -0
- package/menu/rules/set-position/index.js +9 -2
- package/menu/rules/submenu/index.js +5 -1
- package/nemo/addons/down/down.js +2 -40
- package/nemo/addons/index.js +3 -1
- package/nemo/addons/up.js +3 -37
- package/nemo/addons/up.json +5 -0
- package/nemo/rules/build-menu/index.js +5 -3
- package/nemo/rules/set-position/index.js +9 -2
- package/nemo/rules/submenu/index.js +5 -1
- package/nemo/state/parse-state.js +1 -0
- package/nemo/state/state.js +4 -1
- package/package.json +8 -9
package/ChangeLog
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
2026.05.20, v2.0.2
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 7f9bf78 aleman: montag v2.0.1
|
|
5
|
+
- 2d9be72 aleman: supertape v13.2.0
|
|
6
|
+
|
|
7
|
+
2026.04.04, v2.0.1
|
|
8
|
+
|
|
9
|
+
fix:
|
|
10
|
+
- 514ce5b aleman: left: filter
|
|
11
|
+
|
|
12
|
+
feature:
|
|
13
|
+
- 74339b8 aleman: putout v42.4.2
|
|
14
|
+
- 36c6aa4 aleman: madrun v13.0.1
|
|
15
|
+
- bb8206b aleman: eslint-plugin-putout v31.1.2
|
|
16
|
+
- 41dc50e aleman: eslint v10.2.0
|
|
17
|
+
- ac383b2 aleman: superc8 v12.3.1
|
|
18
|
+
- 3b703e8 nemo: up/down: use updateState
|
|
19
|
+
|
|
1
20
|
2026.01.25, v2.0.0
|
|
2
21
|
|
|
3
22
|
feature:
|
package/README.md
CHANGED
|
@@ -27,12 +27,12 @@ Aleman supports two main concepts:
|
|
|
27
27
|
- ✅ addons - events;
|
|
28
28
|
- ✅ rules - 🐊**Putout** rules that changes HTML;
|
|
29
29
|
|
|
30
|
-
All interaction with DOM made using rules, and we interact not with DOM directly, but with JSX AST.
|
|
30
|
+
All interaction with DOM made by using the rules, and we interact not with DOM directly, but with JSX AST.
|
|
31
31
|
It makes testing simple, states predictable and independent.
|
|
32
32
|
|
|
33
33
|
### Addons
|
|
34
34
|
|
|
35
|
-
Addon responsible for UI and
|
|
35
|
+
Addon responsible for UI and interaction with outer world: clicks, fetches and everything like this.
|
|
36
36
|
Aleman supports next types of addons:
|
|
37
37
|
|
|
38
38
|
- ✅ [Global](#globals);
|
package/aleman/render.js
CHANGED
|
@@ -25,7 +25,7 @@ export const createRender = (html, {options, rules, type}) => {
|
|
|
25
25
|
}];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const places = findPlaces(ast,
|
|
28
|
+
const places = findPlaces(ast, {
|
|
29
29
|
rules: currentRules,
|
|
30
30
|
plugins,
|
|
31
31
|
});
|
|
@@ -37,7 +37,7 @@ export const createRender = (html, {options, rules, type}) => {
|
|
|
37
37
|
places,
|
|
38
38
|
];
|
|
39
39
|
|
|
40
|
-
transform(ast,
|
|
40
|
+
transform(ast, {
|
|
41
41
|
rules: currentRules,
|
|
42
42
|
plugins,
|
|
43
43
|
});
|
package/aleman/vim.js
CHANGED
package/menu/addons/left.js
CHANGED
package/menu/importmap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const importmap = {
|
|
2
2
|
imports: {
|
|
3
|
-
'putout': 'https://esm.sh/@putout/bundle@5.
|
|
3
|
+
'putout': 'https://esm.sh/@putout/bundle@5.4.1',
|
|
4
4
|
'@putout/processor-html': 'https://esm.sh/@putout/processor-html',
|
|
5
5
|
'fullstore': 'https://esm.sh/fullstore',
|
|
6
6
|
'jessy': 'https://esm.sh/jessy',
|
|
@@ -31,8 +31,15 @@ export const fix = ({path, attr, x, y}) => {
|
|
|
31
31
|
|
|
32
32
|
export const traverse = ({options, push}) => ({
|
|
33
33
|
JSXElement(path) {
|
|
34
|
-
const {
|
|
35
|
-
|
|
34
|
+
const {
|
|
35
|
+
name = 'menu',
|
|
36
|
+
position = {},
|
|
37
|
+
} = options;
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
x = 0,
|
|
41
|
+
y = 20,
|
|
42
|
+
} = position;
|
|
36
43
|
|
|
37
44
|
if (!hasDataName(path, name))
|
|
38
45
|
return;
|
|
@@ -32,7 +32,11 @@ export const traverse = ({options, push}) => ({
|
|
|
32
32
|
if (!isJSXElement(path.parentPath))
|
|
33
33
|
return;
|
|
34
34
|
|
|
35
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
insideSubmenu = true,
|
|
37
|
+
submenuIndex = 1,
|
|
38
|
+
} = options;
|
|
39
|
+
|
|
36
40
|
const parentMenu = path.parentPath.parentPath.parentPath;
|
|
37
41
|
|
|
38
42
|
if (!isJSXElement(parentMenu))
|
package/nemo/addons/down/down.js
CHANGED
|
@@ -1,44 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {updateState} from '../../state/state.js';
|
|
2
2
|
|
|
3
3
|
export const keys = ['ArrowDown'];
|
|
4
4
|
export const preventDefault = true;
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
export const listener = ({state, options}) => {
|
|
9
|
-
let {
|
|
10
|
-
index,
|
|
11
|
-
insideSubmenu,
|
|
12
|
-
submenuIndex,
|
|
13
|
-
} = state;
|
|
14
|
-
|
|
15
|
-
const {menu, infiniteScroll} = options;
|
|
16
|
-
const n = Object.keys(menu).length - 1;
|
|
17
|
-
|
|
18
|
-
if (!insideSubmenu && (infiniteScroll && index === n || index < n))
|
|
19
|
-
++index;
|
|
20
|
-
|
|
21
|
-
if (!insideSubmenu && infiniteScroll && index > n)
|
|
22
|
-
index -= n + 1;
|
|
23
|
-
|
|
24
|
-
const submenu = getSubmenu({
|
|
25
|
-
index,
|
|
26
|
-
options,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const submenuCount = Object.keys(submenu).length - 1;
|
|
30
|
-
|
|
31
|
-
if (insideSubmenu)
|
|
32
|
-
if (submenuIndex < submenuCount)
|
|
33
|
-
++submenuIndex;
|
|
34
|
-
else if (infiniteScroll && submenuIndex === submenuCount)
|
|
35
|
-
submenuIndex = 0;
|
|
36
|
-
|
|
37
|
-
const showSubmenu = submenuCount > -1;
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
index,
|
|
41
|
-
submenuIndex,
|
|
42
|
-
showSubmenu,
|
|
43
|
-
};
|
|
44
|
-
};
|
|
6
|
+
export const listener = ({state, options}) => updateState('down', state, options);
|
package/nemo/addons/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as click from './click/click.js';
|
|
2
2
|
import * as escape from './escape/escape.js';
|
|
3
3
|
import * as down from './down/down.js';
|
|
4
|
-
import * as up from './up.js';
|
|
5
4
|
import * as enter from './enter/enter.js';
|
|
6
5
|
import * as left from './left.js';
|
|
7
6
|
import * as right from './right.js';
|
|
@@ -9,6 +8,9 @@ import * as shiftG from './shift-g/shift-g.js';
|
|
|
9
8
|
import * as gg from './gg/gg.js';
|
|
10
9
|
import * as j from './j/j.js';
|
|
11
10
|
import * as k from './k/k.js';
|
|
11
|
+
import up from './up.json' with {
|
|
12
|
+
type: 'json',
|
|
13
|
+
};
|
|
12
14
|
|
|
13
15
|
export const addons = [
|
|
14
16
|
click,
|
package/nemo/addons/up.js
CHANGED
|
@@ -1,42 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {updateState} from '../state/state.js';
|
|
2
2
|
|
|
3
3
|
export const keys = ['ArrowUp'];
|
|
4
4
|
|
|
5
5
|
export const preventDefault = true;
|
|
6
|
-
export const
|
|
6
|
+
export const action = 'up';
|
|
7
7
|
|
|
8
|
-
export const listener = ({state, options}) =>
|
|
9
|
-
const {menu, infiniteScroll} = options;
|
|
10
|
-
let {
|
|
11
|
-
index,
|
|
12
|
-
insideSubmenu,
|
|
13
|
-
submenuIndex,
|
|
14
|
-
} = state;
|
|
15
|
-
|
|
16
|
-
const count = Object.keys(menu).length;
|
|
17
|
-
|
|
18
|
-
if (insideSubmenu && submenuIndex > 0)
|
|
19
|
-
--submenuIndex;
|
|
20
|
-
|
|
21
|
-
if (infiniteScroll && !index)
|
|
22
|
-
index = count - 1;
|
|
23
|
-
else if (!insideSubmenu && index > 0)
|
|
24
|
-
--index;
|
|
25
|
-
|
|
26
|
-
if (index === -1)
|
|
27
|
-
index = count - 1;
|
|
28
|
-
|
|
29
|
-
const submenu = getSubmenu({
|
|
30
|
-
index,
|
|
31
|
-
options,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const submenuCount = Object.keys(submenu).length;
|
|
35
|
-
const showSubmenu = submenuCount > 0;
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
index,
|
|
39
|
-
submenuIndex,
|
|
40
|
-
showSubmenu,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
8
|
+
export const listener = ({state, options}) => updateState('up', state, options);
|
|
@@ -80,10 +80,12 @@ function createMenu(menu) {
|
|
|
80
80
|
export const fix = ({path, menu}) => {
|
|
81
81
|
path.node.children = createMenu(menu);
|
|
82
82
|
|
|
83
|
-
if (menu.show)
|
|
83
|
+
if (menu.show) {
|
|
84
84
|
removeClassName(path, 'menu-hidden');
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
addClassName(path, 'menu-hidden');
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
export const traverse = ({options, push}) => ({
|
|
@@ -31,8 +31,15 @@ export const fix = ({path, attr, x, y}) => {
|
|
|
31
31
|
|
|
32
32
|
export const traverse = ({options, push}) => ({
|
|
33
33
|
JSXElement(path) {
|
|
34
|
-
const {
|
|
35
|
-
|
|
34
|
+
const {
|
|
35
|
+
name = 'menu',
|
|
36
|
+
position = {},
|
|
37
|
+
} = options;
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
x = 0,
|
|
41
|
+
y = 20,
|
|
42
|
+
} = position;
|
|
36
43
|
|
|
37
44
|
if (!hasDataName(path, name))
|
|
38
45
|
return;
|
|
@@ -32,7 +32,11 @@ export const traverse = ({options, push}) => ({
|
|
|
32
32
|
if (!isJSXElement(path.parentPath))
|
|
33
33
|
return;
|
|
34
34
|
|
|
35
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
insideSubmenu = true,
|
|
37
|
+
submenuIndex = 1,
|
|
38
|
+
} = options;
|
|
39
|
+
|
|
36
40
|
const parentMenu = path.parentPath.parentPath.parentPath;
|
|
37
41
|
|
|
38
42
|
if (!isJSXElement(parentMenu))
|
package/nemo/state/state.js
CHANGED
|
@@ -43,7 +43,10 @@ function createMenuItems(menu, path = '') {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export const updateState = (command, state, options = {}) => {
|
|
46
|
-
const {
|
|
46
|
+
const {
|
|
47
|
+
count = 1,
|
|
48
|
+
infiniteScroll = state.infiniteScroll,
|
|
49
|
+
} = options;
|
|
47
50
|
|
|
48
51
|
for (let i = 0; i < count; i++) {
|
|
49
52
|
if (command === 'down') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aleman",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout-based framework for web",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"html-escaper": "^3.0.3",
|
|
34
34
|
"jessy": "^5.0.0",
|
|
35
35
|
"once": "^1.4.0",
|
|
36
|
-
"putout": "^
|
|
36
|
+
"putout": "^42.4.2",
|
|
37
37
|
"try-to-catch": "^4.0.3"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
@@ -45,15 +45,14 @@
|
|
|
45
45
|
],
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@putout/test": "^15.1.0",
|
|
48
|
-
"
|
|
49
|
-
"eslint": "^
|
|
50
|
-
"eslint-plugin-n": "^17.0.0",
|
|
51
|
-
"eslint-plugin-putout": "^30.0.1",
|
|
48
|
+
"eslint": "^10.2.0",
|
|
49
|
+
"eslint-plugin-putout": "^31.1.2",
|
|
52
50
|
"just-kebab-case": "^4.2.0",
|
|
53
|
-
"madrun": "^
|
|
54
|
-
"montag": "^
|
|
51
|
+
"madrun": "^13.0.1",
|
|
52
|
+
"montag": "^2.0.1",
|
|
55
53
|
"nodemon": "^3.0.1",
|
|
56
|
-
"
|
|
54
|
+
"superc8": "^12.3.1",
|
|
55
|
+
"supertape": "^13.2.0",
|
|
57
56
|
"try-catch": "^4.0.7"
|
|
58
57
|
},
|
|
59
58
|
"license": "MIT",
|