epiq 0.0.3 → 0.0.5

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 (55) hide show
  1. package/dist/app.js +4 -5
  2. package/dist/board/components/Board.js +2 -2
  3. package/dist/board/components/CommandLine.js +11 -4
  4. package/dist/board/components/ContextBar.js +12 -3
  5. package/dist/board/components/Help.js +4 -4
  6. package/dist/board/components/Swimlane.d.ts +1 -0
  7. package/dist/board/components/Swimlane.js +3 -4
  8. package/dist/board/components/Swimlanes.js +8 -11
  9. package/dist/board/components/TicketListItem.js +3 -3
  10. package/dist/board/components/TicketUI.js +1 -1
  11. package/dist/board/hints/hints.d.ts +4 -4
  12. package/dist/board/hints/hints.js +7 -15
  13. package/dist/board/mock/board.js +500 -523
  14. package/dist/cli.d.ts +1 -1
  15. package/dist/cli.js +20 -61
  16. package/dist/debug-logger.d.ts +1 -1
  17. package/dist/debug-logger.js +5 -4
  18. package/dist/init-project.d.ts +1 -0
  19. package/dist/init-project.js +1 -0
  20. package/dist/navigation/actions/add-item/add-item-actions.js +21 -11
  21. package/dist/navigation/actions/board-action-map.js +3 -3
  22. package/dist/navigation/actions/default/default-action-utils.d.ts +8 -7
  23. package/dist/navigation/actions/default/default-action-utils.js +67 -17
  24. package/dist/navigation/actions/default/default-actions.js +30 -44
  25. package/dist/navigation/actions/default/navigation-action-utils.d.ts +16 -0
  26. package/dist/navigation/actions/default/navigation-action-utils.js +109 -0
  27. package/dist/navigation/actions/input/command-line-input.js +4 -4
  28. package/dist/navigation/actions/input/input-actions.js +13 -12
  29. package/dist/navigation/actions/move/move-actions-utils.d.ts +4 -5
  30. package/dist/navigation/actions/move/move-actions-utils.js +44 -31
  31. package/dist/navigation/actions/move/move-actions.js +17 -11
  32. package/dist/navigation/command-line/command-line-sequence-actions.d.ts +1 -1
  33. package/dist/navigation/command-line/command-line-sequence-actions.js +24 -11
  34. package/dist/navigation/command-line/command-line-sequence-intent.d.ts +3 -2
  35. package/dist/navigation/command-line/command-line-sequence-intent.js +13 -10
  36. package/dist/navigation/command-line/commands.d.ts +2 -0
  37. package/dist/navigation/command-line/commands.js +58 -0
  38. package/dist/navigation/keypress-listener.d.ts +1 -0
  39. package/dist/navigation/keypress-listener.js +33 -0
  40. package/dist/navigation/model/action-map.model.d.ts +4 -4
  41. package/dist/navigation/model/navigation-ctx.model.d.ts +1 -16
  42. package/dist/navigation/model/navigation-ctx.model.js +0 -1
  43. package/dist/navigation/model/navigation-tree.model.d.ts +2 -1
  44. package/dist/navigation/navigation.d.ts +3 -10
  45. package/dist/navigation/navigation.js +73 -79
  46. package/dist/navigation/state/command-line.state.d.ts +5 -0
  47. package/dist/navigation/state/command-line.state.js +21 -4
  48. package/dist/navigation/state/state.d.ts +17 -9
  49. package/dist/navigation/state/state.js +34 -35
  50. package/dist/navigation/utils/get-command-line-intent.d.ts +2 -2
  51. package/dist/navigation/utils/get-command-line-intent.js +7 -7
  52. package/dist/navigation/utils/key-intent.d.ts +5 -5
  53. package/dist/navigation/utils/key-intent.js +68 -74
  54. package/package.json +2 -2
  55. package/readme.md +54 -17
package/dist/app.js CHANGED
@@ -4,7 +4,7 @@ import { BoardUI } from './board/components/Board.js';
4
4
  import { ContextBar } from './board/components/ContextBar.js';
5
5
  import { HelpUI } from './board/components/Help.js';
6
6
  import { Mode } from './navigation/model/action-map.model.js';
7
- import { navigationState } from './navigation/state/state.js';
7
+ import { appState } from './navigation/state/state.js';
8
8
  export default function App({ board }) {
9
9
  const width = process.stdout.columns || 120;
10
10
  const swimlaneMaxWidth = Math.floor(process.stdout.columns / 3);
@@ -12,8 +12,7 @@ export default function App({ board }) {
12
12
  const renderedWidth = swimlaneDynamicWidth * board.children.length;
13
13
  const swimlaneWidth = Math.min(renderedWidth, swimlaneMaxWidth);
14
14
  return (React.createElement(Box, { flexDirection: "column" },
15
- !(navigationState.mode === Mode.HELP) && (React.createElement(React.Fragment, null,
16
- React.createElement(BoardUI, { board: board, swimlaneWidth: swimlaneWidth }),
17
- React.createElement(ContextBar, { width: width }))),
18
- navigationState.mode === Mode.HELP && React.createElement(HelpUI, { width: renderedWidth })));
15
+ !(appState.mode === Mode.HELP) && (React.createElement(BoardUI, { board: board, swimlaneWidth: swimlaneWidth })),
16
+ appState.mode === Mode.HELP && React.createElement(HelpUI, { width: renderedWidth }),
17
+ React.createElement(ContextBar, { width: width })));
19
18
  }
@@ -1,11 +1,11 @@
1
1
  import { Box, Text } from 'ink';
2
2
  import React from 'react';
3
- import { navigationState } from '../../navigation/state/state.js';
3
+ import { appState } from '../../navigation/state/state.js';
4
4
  import { BoardContentUI } from './Swimlanes.js';
5
5
  export const BoardUI = ({ board, swimlaneWidth, }) => {
6
6
  return (React.createElement(Box, { flexDirection: "column" },
7
7
  React.createElement(Box, { paddingLeft: 1 },
8
- React.createElement(Text, null, navigationState.breadCrumb.map(b => ' > ' + b.name))),
8
+ React.createElement(Text, null, appState.breadCrumb.map(b => ' > ' + b.name))),
9
9
  React.createElement(Box, { flexDirection: "row" },
10
10
  React.createElement(BoardContentUI, { items: board.children, width: swimlaneWidth }))));
11
11
  };
@@ -1,13 +1,20 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { Box, Text } from 'ink';
3
- import { getCommandLineInput } from '../../navigation/state/command-line.state.js';
3
+ import { getCommandLineInput, subscribeCommandLineState, } from '../../navigation/state/command-line.state.js';
4
4
  const roleColors = {
5
5
  command: 'cyan',
6
6
  argument: 'white',
7
7
  };
8
8
  export const CommandLine = () => {
9
- const input = getCommandLineInput();
10
- // Split only on the FIRST space
9
+ const [input, setInput] = useState(getCommandLineInput());
10
+ useEffect(() => {
11
+ const unsubscribe = subscribeCommandLineState(() => {
12
+ setInput(getCommandLineInput());
13
+ });
14
+ return () => {
15
+ unsubscribe();
16
+ };
17
+ }, []);
11
18
  const [command, ...rest] = input.split(' ');
12
19
  const argument = rest.join(' ');
13
20
  return (React.createElement(Box, null,
@@ -1,8 +1,17 @@
1
1
  import { Box, Text } from 'ink';
2
2
  import React from 'react';
3
3
  import { Mode } from '../../navigation/model/action-map.model.js';
4
- import { navigationState } from '../../navigation/state/state.js';
4
+ import { appState } from '../../navigation/state/state.js';
5
5
  import { CommandLine } from './CommandLine.js';
6
6
  export const ContextBar = ({ width }) => (React.createElement(Box, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, borderColor: "gray", borderStyle: "round", width: width },
7
- React.createElement(Box, null, navigationState.mode === Mode.COMMAND_LINE ? (React.createElement(Box, null,
8
- React.createElement(CommandLine, null))) : (React.createElement(Text, null, navigationState.availableHints.join(' '))))));
7
+ React.createElement(Box, null, appState.mode === Mode.COMMAND_LINE ? (React.createElement(CommandLine, null)) : (React.createElement(Box, { flexDirection: "row", gap: 2 },
8
+ React.createElement(Text, null, "\uD83D\uDCA1"),
9
+ appState.availableHints.map((x, index) => {
10
+ const [command, ...rest] = x.split(' ');
11
+ const argument = rest.join(' ');
12
+ return (React.createElement(Box, { key: index },
13
+ React.createElement(Text, { color: "cyan" }, command),
14
+ argument && (React.createElement(React.Fragment, null,
15
+ React.createElement(Text, null, " "),
16
+ React.createElement(Text, { color: "gray" }, argument)))));
17
+ }))))));
@@ -1,16 +1,16 @@
1
1
  import { Box, Text } from 'ink';
2
- import { navigationState } from '../../navigation/state/state.js';
2
+ import { appState } from '../../navigation/state/state.js';
3
3
  import React from 'react';
4
4
  import { Mode } from '../../navigation/model/action-map.model.js';
5
5
  export const HelpUI = ({ width }) => (React.createElement(Box, { flexDirection: "column", marginTop: 3, borderColor: "gray", borderStyle: "round", width: width, minHeight: 19 },
6
- React.createElement(Box, { flexDirection: "column", width: width }, navigationState.mode === Mode.HELP
6
+ React.createElement(Box, { flexDirection: "column", width: width }, appState.mode === Mode.HELP
7
7
  ? [
8
8
  {
9
9
  action: '',
10
10
  description: '[COMMAND] DESCRIPTION',
11
- mode: navigationState.mode,
11
+ mode: appState.mode,
12
12
  },
13
- ...navigationState.availableActions,
13
+ ...appState.availableActions,
14
14
  ]
15
15
  .filter(action => Boolean(action.description))
16
16
  // .filter(x => x.mode === navigationState.mode)
@@ -3,6 +3,7 @@ import { Swimlane } from '../model/board.model.js';
3
3
  type Props = {
4
4
  item: Swimlane;
5
5
  width: number;
6
+ isSelected: boolean;
6
7
  };
7
8
  export declare const SwimlaneUI: React.FC<Props>;
8
9
  export {};
@@ -2,10 +2,9 @@ import { Box, Text } from 'ink';
2
2
  import React from 'react';
3
3
  import { ScrollBoxUI } from './ScrollBox.js';
4
4
  import { TicketListItemUI } from './TicketListItem.js';
5
- import { navigationState } from '../../navigation/state/state.js';
6
- export const SwimlaneUI = ({ item, width }) => {
7
- const color = navigationState.currentNode?.id === item.id ? 'cyan' : 'gray';
8
- return (React.createElement(Box, { flexDirection: "column", width: width, borderStyle: "round", borderColor: item.isSelected ? 'cyan' : 'gray', paddingRight: 1, paddingLeft: 1, minHeight: 15, height: 20 },
5
+ export const SwimlaneUI = ({ item, isSelected, width }) => {
6
+ const color = isSelected ? 'cyan' : 'gray';
7
+ return (React.createElement(Box, { flexDirection: "column", width: width, borderStyle: "round", borderColor: 'gray', paddingRight: 1, paddingLeft: 1, minHeight: 15, height: 20 },
9
8
  React.createElement(Box, { borderStyle: "round", borderColor: color, justifyContent: "center" },
10
9
  React.createElement(Text, { bold: true }, item.name)),
11
10
  React.createElement(Box, { padding: 1 },
@@ -1,20 +1,17 @@
1
1
  import React from 'react';
2
2
  import { Box } from 'ink';
3
- import { navigationState } from '../../navigation/state/state.js';
3
+ import { appState } from '../../navigation/state/state.js';
4
4
  import { BoardItemTypes } from '../model/board.model.js';
5
5
  import { SwimlaneUI } from './Swimlane.js';
6
6
  import { TicketUI } from './TicketUI.js';
7
7
  export const BoardContentUI = ({ items, width }) => {
8
- const actionContext = navigationState?.currentNode?.actionContext;
9
- const isSwimlaneContext = [
10
- undefined,
11
- BoardItemTypes.BOARD,
12
- BoardItemTypes.SWIMLANE,
13
- BoardItemTypes.TICKET_LIST_ITEM,
14
- ].includes(actionContext);
15
- const isTicketContext = actionContext === BoardItemTypes.TICKET;
8
+ const actionContext = appState.currentNode.actionContext;
9
+ const isTicketContext = actionContext === BoardItemTypes.TICKET_LIST_ITEM;
10
+ const isSwimlaneContext = actionContext === BoardItemTypes.BOARD ||
11
+ actionContext === BoardItemTypes.SWIMLANE;
16
12
  return (React.createElement(Box, { flexDirection: "row" },
17
13
  isSwimlaneContext &&
18
- items.map((lane, index) => (React.createElement(SwimlaneUI, { key: index, width: width, item: lane }))),
19
- isTicketContext && navigationState.currentNode && (React.createElement(TicketUI, { width: width * items.length, item: navigationState.breadCrumb[navigationState.breadCrumb.length - 1] }))));
14
+ items.map((lane, index) => (React.createElement(SwimlaneUI, { key: index, width: width, isSelected: appState.currentNode.actionContext === 'BOARD' &&
15
+ appState.selectedIndex === index, item: lane }))),
16
+ isTicketContext && appState.currentNode && (React.createElement(TicketUI, { width: width * items.length, item: appState.breadCrumb[appState.breadCrumb.length - 1] }))));
20
17
  };
@@ -1,13 +1,13 @@
1
1
  import { Box, Text } from 'ink';
2
2
  import React from 'react';
3
3
  import { Mode } from '../../navigation/model/action-map.model.js';
4
- import { navigationState } from '../../navigation/state/state.js';
4
+ import { appState } from '../../navigation/state/state.js';
5
5
  const truncateWithEllipsis = (str, width) => str.length >= width ? str.slice(0, width - 3) + '...' : str;
6
6
  export const TicketListItemUI = ({ width, ticket }) => (React.createElement(Box, { borderBottom: true },
7
- React.createElement(Text, { color: ticket.isSelected && navigationState.mode === Mode.MOVE
7
+ React.createElement(Text, { color: ticket.isSelected && appState.mode === Mode.MOVE
8
8
  ? 'cyan'
9
9
  : ticket.isSelected
10
10
  ? 'cyan'
11
- : navigationState.mode === Mode.MOVE
11
+ : appState.mode === Mode.MOVE
12
12
  ? 'gray'
13
13
  : 'white' }, truncateWithEllipsis(ticket.name, width - 6))));
@@ -1,6 +1,6 @@
1
1
  import { Box, Text } from 'ink';
2
2
  import React from 'react';
3
- export const TicketUI = ({ item, width }) => (React.createElement(Box, { flexDirection: "column", padding: 1, paddingLeft: 2, borderStyle: "round", width: width, minHeight: 16, borderColor: "gray" }, item.children.map(child => (React.createElement(Box, { key: child.id, flexDirection: "row", borderStyle: 'round', borderColor: child.isSelected ? 'cyan' : 'gray', paddingLeft: 1 },
3
+ export const TicketUI = ({ item, width }) => (React.createElement(Box, { flexDirection: "column", padding: 1, paddingLeft: 2, borderStyle: "round", width: width, minHeight: 20, borderColor: "gray" }, item.children.map(child => (React.createElement(Box, { key: child.id, flexDirection: "row", borderStyle: 'round', borderColor: child.isSelected ? 'cyan' : 'gray', paddingLeft: 1 },
4
4
  React.createElement(Box, { width: 30 },
5
5
  React.createElement(Text, { color: "cyan" },
6
6
  child.name,
@@ -1,7 +1,7 @@
1
1
  export declare const Hints: {
2
- readonly [x: string]: readonly [] | readonly [":h Help", "hjkl: move between swimlanes", "e: enter swimlane", "q: exit"] | readonly ["hjkl: move between tickets", "e: view ticket details", "i: edit", "y: select for yank/move", "q: exit"] | readonly ["q: exit", "I: edit field"] | readonly ["hjkl: move selection", "y: confirm move/yank", "q: exit"];
2
+ readonly [x: string]: readonly [] | readonly [":h Help", "hjkl: navigate", "enter: confirm"] | readonly ["q: exit"] | readonly ["i: edit", "y: yank/move"] | readonly ["q: exit", "i: edit"] | readonly ["hjkl: move selection", "e/enter: confirm move/yank", "q: exit"] | readonly ["hjkl: move selection", "e/enter: confirm move/yank", "y: confirm move/yank", "q: exit"];
3
3
  readonly BOARD: readonly [];
4
- readonly SWIMLANE: readonly [":h Help", "hjkl: move between swimlanes", "e: enter swimlane", "q: exit"];
5
- readonly TICKET_LIST_ITEM: readonly ["hjkl: move between tickets", "e: view ticket details", "i: edit", "y: select for yank/move", "q: exit"];
6
- readonly TICKET: readonly ["q: exit", "I: edit field"];
4
+ readonly SWIMLANE: readonly [":h Help", "hjkl: navigate", "enter: confirm"];
5
+ readonly TICKET_LIST_ITEM: readonly ["i: edit", "y: yank/move"];
6
+ readonly TICKET: readonly ["q: exit", "i: edit"];
7
7
  };
@@ -2,27 +2,19 @@ import { Mode } from '../../navigation/model/action-map.model.js';
2
2
  import { BoardItemTypes } from '../model/board.model.js';
3
3
  export const Hints = {
4
4
  [BoardItemTypes.BOARD]: [],
5
- [BoardItemTypes.SWIMLANE]: [
6
- ':h Help',
7
- 'hjkl: move between swimlanes',
8
- 'e: enter swimlane',
9
- 'q: exit',
10
- ],
11
- [BoardItemTypes.TICKET_LIST_ITEM]: [
12
- 'hjkl: move between tickets',
13
- 'e: view ticket details',
14
- 'i: edit',
15
- 'y: select for yank/move',
16
- 'q: exit',
17
- ],
18
- [BoardItemTypes.TICKET]: ['q: exit', 'I: edit field'],
5
+ [BoardItemTypes.SWIMLANE]: [':h Help', 'hjkl: navigate', 'enter: confirm'],
6
+ [BoardItemTypes.TICKET_LIST_ITEM + Mode.HELP]: ['q: exit'],
7
+ [BoardItemTypes.SWIMLANE + Mode.HELP]: ['q: exit'],
8
+ [BoardItemTypes.TICKET_LIST_ITEM]: ['i: edit', 'y: yank/move'],
9
+ [BoardItemTypes.TICKET]: ['q: exit', 'i: edit'],
19
10
  [BoardItemTypes.SWIMLANE + Mode.MOVE]: [
20
11
  'hjkl: move selection',
21
- 'y: confirm move/yank',
12
+ 'e/enter: confirm move/yank',
22
13
  'q: exit',
23
14
  ],
24
15
  [BoardItemTypes.TICKET_LIST_ITEM + Mode.MOVE]: [
25
16
  'hjkl: move selection',
17
+ 'e/enter: confirm move/yank',
26
18
  'y: confirm move/yank',
27
19
  'q: exit',
28
20
  ],