aleman 1.1.21 → 1.1.23

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.
@@ -13,8 +13,8 @@ export const listener = ({event, state, options}) => {
13
13
  return {
14
14
  command: 'show',
15
15
  position: {
16
- left: event.clientX,
17
- top: event.clientY - 14,
16
+ x: event.clientX,
17
+ y: event.clientY - 14,
18
18
  },
19
19
  };
20
20
  };
@@ -1,8 +1,6 @@
1
- import {operator, types} from 'putout';
1
+ import {operator} from 'putout';
2
2
  import {checkDataName} from '../check-data-name.js';
3
3
 
4
- const {isJSXElement} = types;
5
-
6
4
  const {setLiteralValue} = operator;
7
5
 
8
6
  export const report = ({command}) => {
@@ -51,4 +49,3 @@ export const traverse = ({push, options}) => ({
51
49
  }
52
50
  },
53
51
  });
54
-
@@ -71,4 +71,3 @@ function unselect(path) {
71
71
  setLiteralValue(value, value.value.replace(' menu-item-selected', ''));
72
72
  }
73
73
  }
74
-
@@ -11,8 +11,8 @@ const {setLiteralValue} = operator;
11
11
 
12
12
  export const report = () => `Set position`;
13
13
 
14
- export const fix = ({path, attr, left, top}) => {
15
- const style = `left: ${left}px; top: ${top}px;`;
14
+ export const fix = ({path, attr, x, y}) => {
15
+ const style = `left: ${x}px; top: ${y}px;`;
16
16
 
17
17
  if (attr) {
18
18
  setLiteralValue(attr.value, style);
@@ -30,7 +30,7 @@ export const fix = ({path, attr, left, top}) => {
30
30
  export const traverse = ({options, push}) => ({
31
31
  JSXOpeningElement(path) {
32
32
  const {name = 'menu', position = {}} = options;
33
- const {left = 0, top = 20} = position;
33
+ const {x = 0, y = 20} = position;
34
34
 
35
35
  if (!checkDataName(path.parentPath, name))
36
36
  return;
@@ -39,24 +39,24 @@ export const traverse = ({options, push}) => ({
39
39
  if (attr.name.name !== 'style')
40
40
  continue;
41
41
 
42
- const [x, y] = parsePosition(attr.value.value);
42
+ const [x1, y1] = parsePosition(attr.value.value);
43
43
 
44
- if (x === left && y === top)
44
+ if (x === x1 && y === y1)
45
45
  return;
46
46
 
47
47
  push({
48
48
  path,
49
49
  attr,
50
- left,
51
- top,
50
+ x,
51
+ y,
52
52
  });
53
53
  return;
54
54
  }
55
55
 
56
56
  push({
57
57
  path,
58
- left,
59
- top,
58
+ x,
59
+ y,
60
60
  });
61
61
  },
62
62
  });
@@ -15,7 +15,7 @@ export const fix = ({path}) => {
15
15
 
16
16
  export const traverse = ({push, options}) => ({
17
17
  JSXOpeningElement(path) {
18
- const {index} = options;
18
+ const {index, name} = options;
19
19
 
20
20
  if (index !== -1)
21
21
  return;
package/menu/state.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const {keys} = Object;
2
2
 
3
3
  export const initState = ({menu, name = 'menu'}) => {
4
- const count = keys(menu);
4
+ const count = keys(menu).length;
5
5
 
6
6
  return {
7
7
  name,
@@ -9,8 +9,8 @@ export const initState = ({menu, name = 'menu'}) => {
9
9
  index: -1,
10
10
  count,
11
11
  position: {
12
- left: 0,
13
- top: 20,
12
+ x: 0,
13
+ y: 20,
14
14
  },
15
15
  };
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aleman",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout-based framework for web",