aleman 1.1.18 → 1.1.20

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.
@@ -1 +1,3 @@
1
- <ul data-name="menu" className='menu menu-hidden'><li></li><li></li></ul>;
1
+ <sction data-name="aleman-hydrate-hello">
2
+ <ul data-name="menu" className='menu menu-hidden'><li></li><li></li></ul>;
3
+ </sction>;
@@ -1 +1,3 @@
1
- <ul data-name="menu" className="menu"><li></li><li></li></ul>;
1
+ <sction data-name="aleman-hydrate-hello">
2
+ <ul data-name="menu" className="menu"><li></li><li></li></ul>;
3
+ </sction>;
@@ -1,4 +1,7 @@
1
- import {operator} from 'putout';
1
+ import {operator, types} from 'putout';
2
+ import {checkDataName} from '../check-data-name.js';
3
+
4
+ const {isJSXElement} = types;
2
5
 
3
6
  const {setLiteralValue} = operator;
4
7
 
@@ -22,20 +25,11 @@ export const fix = ({path, command}) => {
22
25
 
23
26
  export const traverse = ({push, options}) => ({
24
27
  JSXOpeningElement(path) {
25
- const {name: menuName, command} = options;
28
+ const {name, command} = options;
26
29
  const attributes = path.get('attributes');
27
30
 
28
- for (const attr of attributes) {
29
- const {name, value} = attr.node;
30
-
31
- if (name.name !== 'data-name')
32
- continue;
33
-
34
- if (value.value !== menuName)
35
- return;
36
-
37
- break;
38
- }
31
+ if (!checkDataName(path.parentPath, name))
32
+ return false;
39
33
 
40
34
  for (const attr of attributes) {
41
35
  const {name, value} = attr.node;
@@ -57,3 +51,4 @@ export const traverse = ({push, options}) => ({
57
51
  }
58
52
  },
59
53
  });
54
+
@@ -1,4 +1,5 @@
1
1
  import {operator, types} from 'putout';
2
+ import {checkDataName} from '../check-data-name.js';
2
3
 
3
4
  const {isJSXElement} = types;
4
5
  const {setLiteralValue} = operator;
@@ -15,15 +16,15 @@ export const fix = ({path, prev, next}) => {
15
16
 
16
17
  export const traverse = ({options, push}) => ({
17
18
  JSXOpeningElement(path) {
19
+ const {name = 'menu', index = 1} = options;
20
+
18
21
  if (path.node.name.name !== 'li')
19
22
  return;
20
23
 
21
- const {index = 1} = options;
22
-
23
24
  if (!isJSXElement(path.parentPath.parentPath))
24
25
  return;
25
26
 
26
- if (!checkDataName(path.parentPath.parentPath))
27
+ if (!checkDataName(path.parentPath.parentPath, name))
27
28
  return;
28
29
 
29
30
  const children = path.parentPath
@@ -56,19 +57,6 @@ export const traverse = ({options, push}) => ({
56
57
  },
57
58
  });
58
59
 
59
- function checkDataName(path) {
60
- const attributes = path.get('openingElement.attributes');
61
-
62
- for (const attr of attributes) {
63
- const {name, value} = attr.node;
64
-
65
- if (name.name === 'data-name')
66
- return value.value === 'menu';
67
- }
68
-
69
- return false;
70
- }
71
-
72
60
  function unselect(path) {
73
61
  if (!path)
74
62
  return;
@@ -83,3 +71,4 @@ function unselect(path) {
83
71
  setLiteralValue(value, value.value.replace(' menu-item-selected', ''));
84
72
  }
85
73
  }
74
+
@@ -29,10 +29,10 @@ export const fix = ({path, attr, left, top}) => {
29
29
 
30
30
  export const traverse = ({options, push}) => ({
31
31
  JSXOpeningElement(path) {
32
- const {position = {}} = options;
32
+ const {name = 'menu', position = {}} = options;
33
33
  const {left = 0, top = 20} = position;
34
34
 
35
- if (!checkDataName(path.parentPath, 'menu'))
35
+ if (!checkDataName(path.parentPath, name))
36
36
  return;
37
37
 
38
38
  for (const attr of path.node.attributes) {
@@ -26,7 +26,7 @@ export const traverse = ({push, options}) => ({
26
26
  if (!isJSXElement(path.parentPath.parentPath))
27
27
  return;
28
28
 
29
- if (!checkDataName(path.parentPath.parentPath))
29
+ if (!checkDataName(path.parentPath.parentPath, name))
30
30
  return;
31
31
 
32
32
  const children = path.parentPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aleman",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout-based framework for web",