aleman 1.15.0 → 1.16.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 CHANGED
@@ -1,3 +1,14 @@
1
+ 2025.09.23, v1.16.0
2
+
3
+ feature:
4
+ - 313b2c3 aleman: j/k up/down: infinite-scroll
5
+ - f7b77be aleman: menu: k: infiniteScroll
6
+
7
+ 2025.09.23, v1.15.1
8
+
9
+ fix:
10
+ - 92a0e34 aleman: menu: addons: k: jmp to bottom
11
+
1
12
  2025.09.23, v1.15.0
2
13
 
3
14
  feature:
@@ -53,7 +53,7 @@ export const splitAddons = (addons) => {
53
53
  };
54
54
  };
55
55
 
56
- export const addGlobalListeners = ({globalAddons, options, readState, writeState}) => {
56
+ export const addGlobalListeners = ({globalAddons, options, readState, writeState, document = globalThis.document}) => {
57
57
  for (const addon of globalAddons) {
58
58
  const events = maybeEvents(addon);
59
59
 
@@ -12,12 +12,15 @@ export const listener = ({state, options}) => {
12
12
  submenuIndex,
13
13
  } = state;
14
14
 
15
- const {menu} = options;
15
+ const {menu, infiniteScroll} = options;
16
16
  const n = Object.keys(menu).length - 1;
17
17
 
18
- if (!insideSubmenu && index < n)
18
+ if (infiniteScroll && index === n || !insideSubmenu && index < n)
19
19
  ++index;
20
20
 
21
+ if (infiniteScroll && index > n)
22
+ index -= n + 1;
23
+
21
24
  const submenu = getSubmenu({
22
25
  index,
23
26
  options,
@@ -0,0 +1,8 @@
1
+ <ul data-name="menu" className="menu" style="left: 0px; top: 20px;">
2
+ <li data-name="menu-item" data-menu-index="0" 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" data-menu-index="1" className="menu-item icon icon-edit">
6
+ <label data-menu-path="Edit">Edit</label>
7
+ </li>
8
+ </ul>;
@@ -0,0 +1,8 @@
1
+ <ul data-name="menu" className="menu" style="left: 0px; top: 20px;">
2
+ <li data-name="menu-item" data-menu-index="0" className="menu-item icon icon-view">
3
+ <label data-menu-path="View">View</label>
4
+ </li>
5
+ <li data-name="menu-item" data-menu-index="1" className="menu-item icon icon-edit menu-item-selected">
6
+ <label data-menu-path="Edit">Edit</label>
7
+ </li>
8
+ </ul>;
@@ -5,13 +5,15 @@ export const {filter} = down;
5
5
  export const commands = ['j'];
6
6
 
7
7
  export function listener({count, state, options}) {
8
+ const {menu, infiniteScroll} = options;
8
9
  const {
9
10
  index,
10
11
  insideSubmenu,
11
12
  submenuIndex,
12
13
  } = state;
13
14
 
14
- const menuCount = Object.keys(options.menu).length;
15
+ const menuCount = Object.keys(menu).length;
16
+
15
17
  const submenuCount = Object.keys(getSubmenu({
16
18
  index,
17
19
  options,
@@ -21,7 +23,7 @@ export function listener({count, state, options}) {
21
23
  let newSubmenuIndex = insideSubmenu ? submenuIndex + count : submenuIndex;
22
24
 
23
25
  if (newIndex > menuCount - 1)
24
- newIndex = menuCount - 1;
26
+ newIndex = infiniteScroll ? 0 : menuCount - 1;
25
27
 
26
28
  if (newSubmenuIndex > submenuCount - 1)
27
29
  newSubmenuIndex = submenuCount - 1;
@@ -0,0 +1,8 @@
1
+ <ul data-name="menu" className="menu" style="left: 0px; top: 20px;">
2
+ <li data-name="menu-item" data-menu-index="0" className="menu-item icon icon-view">
3
+ <label data-menu-path="View">View</label>
4
+ </li>
5
+ <li data-name="menu-item" data-menu-index="1" className="menu-item icon icon-edit menu-item-selected">
6
+ <label data-menu-path="Edit">Edit</label>
7
+ </li>
8
+ </ul>;
@@ -0,0 +1,8 @@
1
+ <ul data-name="menu" className="menu" style="left: 0px; top: 20px;">
2
+ <li data-name="menu-item" data-menu-index="0" 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" data-menu-index="1" className="menu-item icon icon-edit">
6
+ <label data-menu-path="Edit">Edit</label>
7
+ </li>
8
+ </ul>;
@@ -1,4 +1,4 @@
1
- <ul data-name="menu" className="menu menu-hidden">
1
+ <ul data-name="menu" className="menu" style="left: 0px; top: 20px;">
2
2
  <li data-name="menu-item" data-menu-index="0" className="menu-item icon icon-view menu-item-selected">
3
3
  <label data-menu-path="View">View</label>
4
4
  </li>
@@ -13,8 +13,10 @@ export function listener({count, state, options}) {
13
13
  let newIndex = insideSubmenu ? index : index - count + 1;
14
14
  let newSubmenuIndex = insideSubmenu ? submenuIndex - count + 1 : submenuIndex;
15
15
 
16
- if (newIndex < -1)
17
- newIndex = -1;
16
+ const {infiniteScroll} = options;
17
+
18
+ if (newIndex <= 0)
19
+ newIndex = infiniteScroll ? -1 : 0;
18
20
 
19
21
  if (newSubmenuIndex < -1)
20
22
  newSubmenuIndex = -1;
package/menu/addons/up.js CHANGED
@@ -6,7 +6,7 @@ export const preventDefault = true;
6
6
  export const filter = ({state}) => state.command === 'show';
7
7
 
8
8
  export const listener = ({state, options}) => {
9
- const {menu} = options;
9
+ const {menu, infiniteScroll} = options;
10
10
  let {
11
11
  index,
12
12
  insideSubmenu,
@@ -18,7 +18,9 @@ export const listener = ({state, options}) => {
18
18
  if (insideSubmenu && submenuIndex > 0)
19
19
  --submenuIndex;
20
20
 
21
- if (!insideSubmenu && index > 0)
21
+ if (infiniteScroll && !index)
22
+ index = count - 1;
23
+ else if (!insideSubmenu && index > 0)
22
24
  --index;
23
25
 
24
26
  if (index === -1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aleman",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout-based framework for web",