aleman 1.0.16 → 1.1.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.
Files changed (95) hide show
  1. package/aleman/add-listeners.js +94 -0
  2. package/aleman/index.js +44 -0
  3. package/aleman/render.js +58 -0
  4. package/aleman/state.js +78 -0
  5. package/example/index.html +1 -0
  6. package/example/index.js +8 -0
  7. package/index-buttons.html +2 -2
  8. package/index.html +2 -3
  9. package/menu/addons/click.js +6 -0
  10. package/menu/addons/context-menu.js +13 -0
  11. package/menu/addons/down.js +16 -0
  12. package/menu/addons/enter.js +16 -0
  13. package/menu/addons/escape.js +6 -0
  14. package/menu/addons/f9.js +9 -0
  15. package/menu/addons/index.js +21 -0
  16. package/menu/addons/item-click.js +16 -0
  17. package/menu/addons/mouse-enter.js +5 -0
  18. package/menu/addons/up.js +12 -0
  19. package/menu/hydrate-menu.js +22 -0
  20. package/menu/importmap.json +9 -0
  21. package/menu/menu.js +40 -23
  22. package/{lib → menu}/rules/index.js +4 -10
  23. package/{lib → menu}/rules/select/fixture/select-fix.js +1 -1
  24. package/{lib → menu}/rules/select/index.js +29 -5
  25. package/menu/rules/set-position/fixture/no-style.js +2 -0
  26. package/menu/rules/set-position/fixture/set-position-fix.js +2 -0
  27. package/{lib → menu}/rules/set-position/index.js +29 -4
  28. package/{lib → menu}/rules/unselect-all/index.js +6 -1
  29. package/menu/state.js +15 -0
  30. package/package.json +3 -6
  31. package/lib/addons/additional/fixture/start-click-fix.html +0 -0
  32. package/lib/addons/additional/fixture/start-click.html +0 -1
  33. package/lib/addons/additional/fixture/stop-click-fix.html +0 -0
  34. package/lib/addons/additional/fixture/stop-click.html +0 -1
  35. package/lib/addons/additional/input-change.js +0 -39
  36. package/lib/addons/additional/start-click.js +0 -7
  37. package/lib/addons/additional/stop-click.js +0 -7
  38. package/lib/addons/menu-item-click.js +0 -27
  39. package/lib/addons/menu-mouse-over.js +0 -6
  40. package/lib/addons/show-menu-click.js +0 -12
  41. package/lib/aleman/add-listeners.js +0 -116
  42. package/lib/aleman/aleman.js +0 -47
  43. package/lib/aleman/load.js +0 -5
  44. package/lib/aleman/render.js +0 -107
  45. package/lib/globals/menu/click.js +0 -21
  46. package/lib/globals/menu/context-menu.js +0 -18
  47. package/lib/globals/menu/down.js +0 -21
  48. package/lib/globals/menu/enter.js +0 -33
  49. package/lib/globals/menu/escape.js +0 -19
  50. package/lib/globals/menu/f9.js +0 -27
  51. package/lib/globals/menu/menu.js +0 -34
  52. package/lib/globals/menu/up.js +0 -19
  53. package/lib/globals/menu.js +0 -17
  54. package/lib/main.js +0 -35
  55. package/lib/menu/menu.js +0 -4
  56. package/lib/rules/README.md +0 -10
  57. package/lib/rules/remove-button/fixture/remove-button-fix.js +0 -2
  58. package/lib/rules/remove-button/fixture/remove-button.js +0 -2
  59. package/lib/rules/remove-button/index.js +0 -27
  60. package/lib/rules/set-value/fixture/data-name.js +0 -1
  61. package/lib/rules/set-value/fixture/no-data-name.js +0 -1
  62. package/lib/rules/set-value/fixture/not-label.js +0 -1
  63. package/lib/rules/set-value/fixture/set-value-fix.js +0 -1
  64. package/lib/rules/set-value/fixture/set-value.js +0 -1
  65. package/lib/rules/set-value/index.js +0 -34
  66. package/lib/rules/unselect/fixture/no-data-name.js +0 -4
  67. package/lib/rules/unselect/fixture/no-parent.js +0 -2
  68. package/lib/rules/unselect/fixture/unselect-fix.js +0 -8
  69. package/lib/rules/unselect/fixture/unselect.js +0 -8
  70. package/lib/rules/unselect/index.js +0 -39
  71. package/menu/index.html +0 -4
  72. package/menu/main.js +0 -29
  73. /package/{lib → menu}/rules/build-menu/fixture/build-menu-fix.js +0 -0
  74. /package/{lib → menu}/rules/build-menu/fixture/build-menu.js +0 -0
  75. /package/{lib → menu}/rules/build-menu/fixture/built.js +0 -0
  76. /package/{lib → menu}/rules/build-menu/index.js +0 -0
  77. /package/{lib → menu}/rules/check-data-name.js +0 -0
  78. /package/{lib → menu}/rules/menu/fixture/hide-menu-fix.js +0 -0
  79. /package/{lib → menu}/rules/menu/fixture/hide-menu.js +0 -0
  80. /package/{lib → menu}/rules/menu/fixture/no-menu.js +0 -0
  81. /package/{lib → menu}/rules/menu/fixture/show-menu-fix.js +0 -0
  82. /package/{lib → menu}/rules/menu/fixture/show-menu.js +0 -0
  83. /package/{lib → menu}/rules/menu/index.js +0 -0
  84. /package/{lib → menu}/rules/select/fixture/no-data-name.js +0 -0
  85. /package/{lib → menu}/rules/select/fixture/no-next.js +0 -0
  86. /package/{lib → menu}/rules/select/fixture/no-parent.js +0 -0
  87. /package/{lib → menu}/rules/select/fixture/select.js +0 -0
  88. /package/{lib → menu}/rules/select/fixture/wrong-data-name.js +0 -0
  89. /package/{lib/rules/set-position/fixture/set-position-fix.js → menu/rules/set-position/fixture/no-style-fix.js} +0 -0
  90. /package/{lib → menu}/rules/set-position/fixture/not-menu.js +0 -0
  91. /package/{lib → menu}/rules/set-position/fixture/set-position.js +0 -0
  92. /package/{lib → menu}/rules/unselect-all/fixture/no-data-name.js +0 -0
  93. /package/{lib → menu}/rules/unselect-all/fixture/no-parent.js +0 -0
  94. /package/{lib → menu}/rules/unselect-all/fixture/unselect-all-fix.js +0 -0
  95. /package/{lib → menu}/rules/unselect-all/fixture/unselect-all.js +0 -0
@@ -1,34 +0,0 @@
1
- import {menu} from '../../menu/menu.js';
2
-
3
- export const filter = ({state}) => {
4
- const {command} = state['menu-toggler'];
5
- return command !== 'hide';
6
- };
7
-
8
- export const select = ({render, index}) => {
9
- render('unselect', {
10
- index: index - 1,
11
- });
12
-
13
- render('select', {
14
- index,
15
- });
16
- };
17
-
18
- export function hideMenu({render, state}) {
19
- state['menu-toggler'].command = 'hide';
20
- render(['menu', 'unselect-all'], {
21
- index: -1,
22
- command: 'hide',
23
- });
24
- }
25
-
26
- export function showMenu({render, state, left, top}) {
27
- state['menu-toggler'].command = 'show';
28
- render(['build-menu', 'menu'], {
29
- command: 'show',
30
- menu,
31
- left,
32
- top,
33
- });
34
- }
@@ -1,19 +0,0 @@
1
- import {select} from './menu.js';
2
-
3
- export const key = 'ArrowUp';
4
-
5
- export {filter} from './menu.js';
6
- export const listener = ({render, element}) => {
7
- let index = element.index ?? -1;
8
-
9
- if (index === -1)
10
- return;
11
-
12
- if (index)
13
- --index;
14
-
15
- select({
16
- render,
17
- index,
18
- });
19
- };
@@ -1,17 +0,0 @@
1
- import * as enter from './menu/enter.js';
2
- import * as escape from './menu/escape.js';
3
- import * as f9 from './menu/f9.js';
4
- import * as up from './menu/up.js';
5
- import * as down from './menu/down.js';
6
- import * as click from './menu/click.js';
7
- import * as contextMenu from './menu/context-menu.js';
8
-
9
- export default [
10
- enter,
11
- escape,
12
- f9,
13
- up,
14
- down,
15
- click,
16
- contextMenu,
17
- ];
package/lib/main.js DELETED
@@ -1,35 +0,0 @@
1
- import * as start from './addons/additional/start-click.js';
2
- import * as stop from './addons/additional/stop-click.js';
3
- import * as inputChange from './addons/additional/input-change.js';
4
- import * as menuClick from './addons/show-menu-click.js';
5
- import * as menuItemClick from './addons/menu-item-click.js';
6
- import * as menuMouseOver from './addons/menu-mouse-over.js';
7
- import menu from './globals/menu.js';
8
- import {hydrate} from './aleman/aleman.js';
9
- import {rules} from './rules/index.js';
10
-
11
- export function hydrateMenu() {
12
- const addons = [
13
- start,
14
- stop,
15
- inputChange,
16
- menuClick,
17
- menuItemClick,
18
- menuMouseOver,
19
- ];
20
-
21
- const globals = [...menu];
22
-
23
- const state = {
24
- 'menu-toggler': {
25
- command: 'hide',
26
- },
27
- };
28
-
29
- hydrate({
30
- state,
31
- rules,
32
- addons,
33
- globals,
34
- });
35
- }
package/lib/menu/menu.js DELETED
@@ -1,4 +0,0 @@
1
- export const menu = {
2
- hello: () => alert('hello'),
3
- world: () => alert('world'),
4
- };
@@ -1,10 +0,0 @@
1
- # HTML
2
-
3
- - ✅[`set-value`](https://putout.cloudcmd.io/#/gist/29850822bca99f83dbea1b17fda61904/6cdec0ef8c1903cbc9b9df6dfcde6056b8165386);
4
- - ✅[`remove-button`](https://putout.cloudcmd.io/#/gist/fa2b037a629306cbd43cf42c457c08b9/0cac9c986141d69f9747538816e66b14c4cbd256);
5
- - ✅[`show-menu`](https://putout.cloudcmd.io/#/gist/884fd40c07b94951de1a9ce99afab015/21d4881b44955b1426f80e87c76b7ad86eeea464);
6
- - ✅[`select`](https://putout.cloudcmd.io/#/gist/10891aa58ff2ecfa1728ed19aeb2e3f2/ce536fb0b414faefbae5d0c8a094517beb1c606e);
7
- - ✅[`unselect`](https://putout.cloudcmd.io/#/gist/aa6006f83aebcb70362a65b3349f8ddd/df1a06b94ccce3134b2246892702bf63dff79145);
8
- - ✅[`unselect-all`](https://putout.cloudcmd.io/#/gist/ca24f199f508cccb34b11baf726eba83/96f08fa91331ac6265d9f5ff48692c9d4ad1b98b);
9
- - ✅[`build-menu`](https://putout.cloudcmd.io/#/gist/329dccd5fdc7f8b220be79af405dc9bb/b56df53f52bbe2a300ede38a96d1d2242e60679f);
10
- - ✅[`set-position`](https://putout.cloudcmd.io/#/gist/215bb4654a27f15235f3e380a3035138/7f4af88aaa4863be4f1b8a90b9f0f4b1cf4744a0);
@@ -1,2 +0,0 @@
1
- <button data-name="start">hello</button>;
2
- <button data-name="stop">hello</button>;
@@ -1,2 +0,0 @@
1
- <button data-name="start">hello</button>;
2
- <button data-name="stop">hello</button>;
@@ -1,27 +0,0 @@
1
- export const report = () => `Remove button`;
2
-
3
- export const match = ({options}) => ({
4
- '<button __jsx_attributes>__a</button>': (vars, path) => {
5
- const defaultName = options.name || '';
6
- const name = getName(path);
7
-
8
- return name === defaultName;
9
- },
10
- });
11
-
12
- export const replace = () => ({
13
- '<button __jsx_attributes>__a</button>': '',
14
- });
15
-
16
- function getName(path) {
17
- const {attributes} = path.node.openingElement;
18
-
19
- for (const {name, value} of attributes) {
20
- if (name.name !== 'data-name')
21
- continue;
22
-
23
- return value.value;
24
- }
25
-
26
- return '';
27
- }
@@ -1 +0,0 @@
1
- <label data-name="hello">x</label>;
@@ -1 +0,0 @@
1
- <label className="hello">x</label>;
@@ -1 +0,0 @@
1
- <section data-name="x">x</section>;
@@ -1 +0,0 @@
1
- <label data-name="x">hello</label>;
@@ -1 +0,0 @@
1
- <label data-name="x">x</label>;
@@ -1,34 +0,0 @@
1
- export const report = () => `Use 'if condition' instead of 'ternary expression'`;
2
-
3
- export const match = ({options}) => {
4
- const {name} = options;
5
-
6
- return {
7
- '<__a __jsx_attributes>__b</__a>': check(name),
8
- '<__a __jsx_attributes></__a>': check(name),
9
- };
10
- };
11
-
12
- const check = (dataName) => ({__a, __jsx_attributes}) => {
13
- if (__a.name !== 'label')
14
- return false;
15
-
16
- for (const {name, value} of __jsx_attributes) {
17
- if (name.name !== 'data-name')
18
- continue;
19
-
20
- if (value.value === dataName)
21
- return true;
22
- }
23
-
24
- return false;
25
- };
26
-
27
- export const replace = ({options}) => {
28
- const {value = 'hello', escape = (a) => a} = options;
29
-
30
- return {
31
- '<__a __jsx_attributes>__b</__a>': `<__a __jsx_attributes>${escape(value)}</__a>`,
32
- '<__a __jsx_attributes></__a>': `<__a __jsx_attributes>${escape(value)}</__a>`,
33
- };
34
- };
@@ -1,4 +0,0 @@
1
- <ul className="hello">
2
- <li className="menu menu-hidden">
3
- </li>
4
- </ul>;
@@ -1,2 +0,0 @@
1
- <li className="menu menu-hidden">
2
- </li>;
@@ -1,8 +0,0 @@
1
- <ul data-name="menu" class="menu menu-hidden">
2
- <li data-name="menu-item" className='menu-item icon icon-view'>
3
- <label data-menu-path="View">View</label>
4
- </li>
5
- <li data-name="menu-item" className="menu-item icon icon-edit">
6
- <label data-menu-path="Edit">Edit</label>
7
- </li>
8
- </ul>;
@@ -1,8 +0,0 @@
1
- <ul data-name="menu" class="menu menu-hidden">
2
- <li data-name="menu-item" className="menu-item icon icon-view menu-item-selected">
3
- <label data-menu-path="View">View</label>
4
- </li>
5
- <li data-name="menu-item" className="menu-item icon icon-edit">
6
- <label data-menu-path="Edit">Edit</label>
7
- </li>
8
- </ul>;
@@ -1,39 +0,0 @@
1
- import {operator, types} from 'putout';
2
- import {checkDataName} from '../check-data-name.js';
3
-
4
- const {isJSXElement} = types;
5
- const {setLiteralValue} = operator;
6
-
7
- export const report = () => `Select next item`;
8
-
9
- export const fix = ({path}) => {
10
- const {value} = path.node;
11
- const newValue = value.value.replace(/\s?menu-item-selected/, '');
12
-
13
- setLiteralValue(value, newValue);
14
- };
15
-
16
- export const traverse = ({push}) => ({
17
- JSXOpeningElement(path) {
18
- if (path.node.name.name !== 'li')
19
- return;
20
-
21
- if (!isJSXElement(path.parentPath.parentPath))
22
- return;
23
-
24
- if (!checkDataName(path.parentPath.parentPath))
25
- return;
26
-
27
- for (const attr of path.get('attributes')) {
28
- const {name, value} = attr.node;
29
-
30
- if (name.name !== 'className')
31
- continue;
32
-
33
- if (value.value.includes('menu-item-selected'))
34
- push({
35
- path: attr,
36
- });
37
- }
38
- },
39
- });
package/menu/index.html DELETED
@@ -1,4 +0,0 @@
1
- <script type="module">
2
- import {createMenu} from "./menu.js";
3
- await createMenu()
4
- </script>
package/menu/main.js DELETED
@@ -1,29 +0,0 @@
1
- import * as menuClick from '../lib//addons/show-menu-click.js';
2
- import * as menuItemClick from '../lib/addons/menu-item-click.js';
3
- import * as menuMouseOver from '../lib/addons/menu-mouse-over.js';
4
- import menu from '../lib//globals/menu.js';
5
- import {hydrate} from '../lib/aleman/aleman.js';
6
- import {rules} from '../lib/rules/index.js';
7
-
8
- export function hydrateMenu() {
9
- const addons = [
10
- menuClick,
11
- menuItemClick,
12
- menuMouseOver,
13
- ];
14
-
15
- const globals = [...menu];
16
-
17
- const state = {
18
- 'menu-toggler': {
19
- command: 'hide',
20
- },
21
- };
22
-
23
- hydrate({
24
- state,
25
- rules,
26
- addons,
27
- globals,
28
- });
29
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes