epiq 0.0.2 → 0.0.4
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/dist/app.js +10 -4
- package/dist/board/components/Board.js +4 -12
- package/dist/board/components/CommandLine.d.ts +2 -0
- package/dist/board/components/CommandLine.js +26 -0
- package/dist/{components/Help.d.ts → board/components/ContextBar.d.ts} +1 -1
- package/dist/board/components/ContextBar.js +17 -0
- package/dist/board/components/Help.js +19 -12
- package/dist/board/components/Swimlane.d.ts +1 -0
- package/dist/board/components/Swimlane.js +6 -4
- package/dist/board/components/Swimlanes.js +8 -11
- package/dist/board/components/TextInput.d.ts +6 -0
- package/dist/board/components/TextInput.js +9 -0
- package/dist/board/components/TicketListItem.js +6 -5
- package/dist/board/components/TicketUI.js +6 -7
- package/dist/board/hints/hints.d.ts +7 -0
- package/dist/board/hints/hints.js +21 -0
- package/dist/board/mock/board.js +73 -27
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +21 -39
- package/dist/debug-logger.d.ts +2 -0
- package/dist/debug-logger.js +16 -0
- package/dist/init-project.d.ts +1 -0
- package/dist/init-project.js +1 -0
- package/dist/navigation/actions/add/add-actions.d.ts +2 -0
- package/dist/navigation/actions/add/add-actions.js +25 -0
- package/dist/navigation/actions/add/add-item-actions.d.ts +2 -0
- package/dist/navigation/actions/add/add-item-actions.js +25 -0
- package/dist/navigation/actions/add-item/add-item-actions.d.ts +3 -0
- package/dist/navigation/actions/add-item/add-item-actions.js +45 -0
- package/dist/navigation/actions/board-action-map.d.ts +10 -0
- package/dist/navigation/actions/board-action-map.js +12 -0
- package/dist/navigation/actions/default/default-action-utils.d.ts +8 -0
- package/dist/navigation/actions/default/default-action-utils.js +101 -0
- package/dist/navigation/actions/default/default-actions.d.ts +2 -0
- package/dist/navigation/actions/default/default-actions.js +64 -0
- package/dist/navigation/actions/default/navigation-action-utils.d.ts +16 -0
- package/dist/navigation/actions/default/navigation-action-utils.js +109 -0
- package/dist/navigation/actions/input/command-line-input.d.ts +2 -0
- package/dist/navigation/actions/input/command-line-input.js +18 -0
- package/dist/navigation/actions/input/input-actions-utils.d.ts +8 -0
- package/dist/navigation/actions/input/input-actions-utils.js +47 -0
- package/dist/navigation/actions/input/input-actions.d.ts +2 -0
- package/dist/navigation/actions/input/input-actions.js +44 -0
- package/dist/navigation/actions/move/move-actions-routes.d.ts +4 -0
- package/dist/navigation/actions/move/move-actions-routes.js +55 -0
- package/dist/navigation/actions/move/move-actions-utils.d.ts +4 -0
- package/dist/navigation/actions/move/move-actions-utils.js +66 -0
- package/dist/navigation/actions/move/move-actions.d.ts +4 -0
- package/dist/navigation/actions/move/move-actions.js +59 -0
- package/dist/{lib/utils/default-action-utils.d.ts → navigation/actions/navigate/navigation-action-utils.d.ts} +1 -1
- package/dist/navigation/actions/navigate/navigation-actions.d.ts +2 -0
- package/dist/navigation/actions/navigate/navigation-actions.js +78 -0
- package/dist/navigation/command-line/command-line-actions.d.ts +2 -0
- package/dist/navigation/command-line/command-line-actions.js +32 -0
- package/dist/navigation/command-line/command-line-intent.d.ts +7 -0
- package/dist/navigation/command-line/command-line-intent.js +29 -0
- package/dist/navigation/command-line/command-line-sequence-actions.d.ts +2 -0
- package/dist/navigation/command-line/command-line-sequence-actions.js +44 -0
- package/dist/navigation/command-line/command-line-sequence-intent.d.ts +8 -0
- package/dist/navigation/command-line/command-line-sequence-intent.js +32 -0
- package/dist/navigation/command-line/commands.d.ts +2 -0
- package/dist/navigation/command-line/commands.js +58 -0
- package/dist/navigation/keypress-listener.d.ts +1 -0
- package/dist/navigation/keypress-listener.js +33 -0
- package/dist/navigation/model/action-map.model.d.ts +17 -5
- package/dist/navigation/model/action-map.model.js +2 -0
- package/dist/navigation/model/navigation-ctx.model.d.ts +1 -16
- package/dist/navigation/model/navigation-ctx.model.js +0 -1
- package/dist/navigation/model/navigation-tree.model.d.ts +3 -1
- package/dist/navigation/navigation.d.ts +3 -10
- package/dist/navigation/navigation.js +74 -66
- package/dist/navigation/state/command-line.state.d.ts +18 -0
- package/dist/navigation/state/command-line.state.js +60 -0
- package/dist/navigation/state/state.d.ts +18 -9
- package/dist/navigation/state/state.js +36 -8
- package/dist/navigation/utils/get-command-line-intent.d.ts +3 -0
- package/dist/navigation/utils/get-command-line-intent.js +17 -0
- package/dist/navigation/utils/getKeyIntent.d.ts +5 -0
- package/dist/navigation/utils/getKeyIntent.js +71 -0
- package/dist/navigation/utils/key-intent.d.ts +21 -12
- package/dist/navigation/utils/key-intent.js +104 -50
- package/package.json +3 -3
- package/dist/board/actions/board-action-map.d.ts +0 -11
- package/dist/board/actions/board-action-map.js +0 -11
- package/dist/board/actions/move-actions-routes.d.ts +0 -4
- package/dist/board/actions/move-actions-routes.js +0 -31
- package/dist/board/actions/move-actions.d.ts +0 -5
- package/dist/board/actions/move-actions.js +0 -49
- package/dist/board/board-action-map.d.ts +0 -9
- package/dist/board/board-action-map.js +0 -7
- package/dist/board/move-actions-routes.d.ts +0 -4
- package/dist/board/move-actions-routes.js +0 -31
- package/dist/board/move-actions.d.ts +0 -5
- package/dist/board/move-actions.js +0 -49
- package/dist/components/Board.d.ts +0 -6
- package/dist/components/Board.js +0 -15
- package/dist/components/Help.js +0 -21
- package/dist/components/Swimlane.d.ts +0 -8
- package/dist/components/Swimlane.js +0 -10
- package/dist/components/TicketListItem.d.ts +0 -6
- package/dist/components/TicketListItem.js +0 -12
- package/dist/lib/actions/board-action-map.d.ts +0 -9
- package/dist/lib/actions/board-action-map.js +0 -7
- package/dist/lib/actions/move-actions-utils.d.ts +0 -5
- package/dist/lib/actions/move-actions-utils.js +0 -43
- package/dist/lib/actions/move-actions.d.ts +0 -4
- package/dist/lib/actions/move-actions.js +0 -31
- package/dist/lib/board/board-action-map.d.ts +0 -9
- package/dist/lib/board/board-action-map.js +0 -7
- package/dist/lib/board/move-actions-routes.d.ts +0 -4
- package/dist/lib/board/move-actions-routes.js +0 -31
- package/dist/lib/board/move-actions.d.ts +0 -5
- package/dist/lib/board/move-actions.js +0 -43
- package/dist/lib/board-utils.d.ts +0 -7
- package/dist/lib/board-utils.js +0 -33
- package/dist/lib/default-actions-routes.d.ts +0 -4
- package/dist/lib/default-actions-routes.js +0 -47
- package/dist/lib/default-actions.d.ts +0 -4
- package/dist/lib/default-actions.js +0 -47
- package/dist/lib/navigation-context.d.ts +0 -16
- package/dist/lib/navigation.d.ts +0 -10
- package/dist/lib/navigation.js +0 -74
- package/dist/lib/render-utils.d.ts +0 -10
- package/dist/lib/render-utils.js +0 -12
- package/dist/lib/state.d.ts +0 -8
- package/dist/lib/state.js +0 -8
- package/dist/lib/types/action-map.model.d.ts +0 -14
- package/dist/lib/types/action-map.model.js +0 -4
- package/dist/lib/types/board.model.d.ts +0 -21
- package/dist/lib/types/board.model.js +0 -5
- package/dist/lib/types/navigation.model.d.ts +0 -9
- package/dist/lib/utils/array-utils.d.ts +0 -5
- package/dist/lib/utils/array-utils.js +0 -7
- package/dist/lib/utils/default-action-utils.js +0 -50
- package/dist/lib/utils/default-actions.d.ts +0 -7
- package/dist/lib/utils/default-actions.js +0 -50
- package/dist/lib/utils/key-intent.d.ts +0 -16
- package/dist/lib/utils/key-intent.js +0 -65
- package/dist/lib/utils.d.ts +0 -10
- package/dist/lib/utils.js +0 -12
- package/dist/mock/board.d.ts +0 -2
- package/dist/mock/board.js +0 -139
- package/dist/navigation/actions/default-actions-routes.d.ts +0 -4
- package/dist/navigation/actions/default-actions-routes.js +0 -47
- package/dist/navigation/actions/default-actions.d.ts +0 -7
- /package/dist/navigation/actions/{default-actions.js → navigate/navigation-action-utils.js} +0 -0
- /package/dist/{lib/navigation-context.js → navigation/navigation-ctx.d.ts} +0 -0
- /package/dist/{lib/types/navigation.model.js → navigation/navigation-ctx.js} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Mode } from '../../model/action-map.model.js';
|
|
2
|
+
import { getNextCommand, getPrevCommand, updateCommandLineInput, } from '../../state/command-line.state.js';
|
|
3
|
+
import { patchState } from '../../state/state.js';
|
|
4
|
+
import { Intent } from '../../utils/key-intent.js';
|
|
5
|
+
import { onConfirmCommandLineSequenceInput } from './command-line-input.js';
|
|
6
|
+
export const inputActions = [
|
|
7
|
+
{
|
|
8
|
+
intent: Intent.ViewHelp,
|
|
9
|
+
mode: Mode.DEFAULT,
|
|
10
|
+
action: () => patchState({ mode: Mode.HELP }),
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
intent: Intent.Exit,
|
|
14
|
+
mode: Mode.HELP,
|
|
15
|
+
action: () => patchState({ mode: Mode.DEFAULT }),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
intent: Intent.Confirm,
|
|
19
|
+
mode: Mode.COMMAND_LINE,
|
|
20
|
+
action: (...args) => {
|
|
21
|
+
onConfirmCommandLineSequenceInput(...args);
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
intent: Intent.CaptureInput,
|
|
26
|
+
mode: Mode.COMMAND_LINE,
|
|
27
|
+
action: (_1, _2, { sequence }) => updateCommandLineInput(s => s + sequence),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
intent: Intent.EraseInput,
|
|
31
|
+
mode: Mode.COMMAND_LINE,
|
|
32
|
+
action: () => updateCommandLineInput(s => s.slice(0, -1)),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
intent: Intent.GetLastCommandFromHistory,
|
|
36
|
+
mode: Mode.COMMAND_LINE,
|
|
37
|
+
action: () => getPrevCommand(),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
intent: Intent.GetNextCommandFromHistory,
|
|
41
|
+
mode: Mode.COMMAND_LINE,
|
|
42
|
+
action: () => getNextCommand(),
|
|
43
|
+
},
|
|
44
|
+
];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Mode } from '../../model/action-map.model.js';
|
|
2
|
+
import { setState } from '../../state/state.js';
|
|
3
|
+
import { KeyIntent } from '../../utils/key-intent.js';
|
|
4
|
+
import { moveChildNextWithinParent, moveChildPreviousWithinParent, moveChildToNextParent, moveChildToPreviousParent, } from './move-actions-utils.js';
|
|
5
|
+
export const toggleMoveMode = [
|
|
6
|
+
{
|
|
7
|
+
intent: KeyIntent.ToggleMove,
|
|
8
|
+
mode: Mode.DEFAULT,
|
|
9
|
+
description: '[Y] Toggle move/yank mode',
|
|
10
|
+
action: () => {
|
|
11
|
+
setState(state => ({
|
|
12
|
+
...state,
|
|
13
|
+
mode: Mode.MOVE,
|
|
14
|
+
}));
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
intent: KeyIntent.ToggleMove,
|
|
19
|
+
mode: Mode.MOVE,
|
|
20
|
+
action: () => {
|
|
21
|
+
setState(state => ({
|
|
22
|
+
...state,
|
|
23
|
+
mode: Mode.DEFAULT,
|
|
24
|
+
}));
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
export const moveWithinParent = [
|
|
29
|
+
{
|
|
30
|
+
mode: Mode.MOVE,
|
|
31
|
+
description: '[Y, ARROW KEYS] Move item',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
intent: KeyIntent.MovePreviousItem,
|
|
35
|
+
mode: Mode.MOVE,
|
|
36
|
+
action: moveChildPreviousWithinParent,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
intent: KeyIntent.MoveNextItem,
|
|
40
|
+
mode: Mode.MOVE,
|
|
41
|
+
action: moveChildNextWithinParent,
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
export const moveAcrossParents = [
|
|
45
|
+
{
|
|
46
|
+
intent: KeyIntent.MoveToNextContainer,
|
|
47
|
+
mode: Mode.MOVE,
|
|
48
|
+
action: moveChildToNextParent,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
intent: KeyIntent.MoveToPreviousContainer,
|
|
52
|
+
mode: Mode.MOVE,
|
|
53
|
+
action: moveChildToPreviousParent,
|
|
54
|
+
},
|
|
55
|
+
];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { appState } from '../../state/state.js';
|
|
2
|
+
import { navigator } from '../default/navigation-action-utils.js';
|
|
3
|
+
function moveItemInArray({ array, from, to, }) {
|
|
4
|
+
if (from < 0 || from >= array.length || to < 0 || to >= array.length)
|
|
5
|
+
return;
|
|
6
|
+
const [item] = array.splice(from, 1);
|
|
7
|
+
if (item)
|
|
8
|
+
array.splice(to, 0, item);
|
|
9
|
+
}
|
|
10
|
+
function moveNodeToSiblingContainer(direction) {
|
|
11
|
+
const currentNode = appState.breadCrumb.at(-1);
|
|
12
|
+
const parentNode = appState.breadCrumb.at(-2);
|
|
13
|
+
if (!currentNode || !parentNode)
|
|
14
|
+
return;
|
|
15
|
+
if (!Array.isArray(parentNode.children))
|
|
16
|
+
return;
|
|
17
|
+
const currentNodeIndex = parentNode.children.findIndex(x => x.id === currentNode.id);
|
|
18
|
+
const targetNodeIndex = currentNodeIndex + direction;
|
|
19
|
+
if (currentNodeIndex < 0 ||
|
|
20
|
+
targetNodeIndex < 0 ||
|
|
21
|
+
targetNodeIndex >= parentNode.children.length)
|
|
22
|
+
return;
|
|
23
|
+
const siblingNode = parentNode.children[targetNodeIndex];
|
|
24
|
+
if (!siblingNode)
|
|
25
|
+
return;
|
|
26
|
+
if (!Array.isArray(currentNode.children))
|
|
27
|
+
return;
|
|
28
|
+
if (!Array.isArray(siblingNode.children))
|
|
29
|
+
siblingNode.children = []; // normalize empty container
|
|
30
|
+
const currentSelectionIndex = appState.selectedIndex;
|
|
31
|
+
if (currentSelectionIndex < 0 ||
|
|
32
|
+
currentSelectionIndex >= currentNode.children.length)
|
|
33
|
+
return;
|
|
34
|
+
const [moveNode] = currentNode.children.splice(currentSelectionIndex, 1);
|
|
35
|
+
if (!moveNode)
|
|
36
|
+
return;
|
|
37
|
+
siblingNode.children.push(moveNode);
|
|
38
|
+
navigator.navigate({
|
|
39
|
+
selectedIndex: siblingNode.children.length - 1,
|
|
40
|
+
currentNode: siblingNode,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export const moveChildToNextParent = () => {
|
|
44
|
+
moveNodeToSiblingContainer(1);
|
|
45
|
+
};
|
|
46
|
+
export const moveChildToPreviousParent = () => {
|
|
47
|
+
moveNodeToSiblingContainer(-1);
|
|
48
|
+
};
|
|
49
|
+
function moveChildWithinParent(direction) {
|
|
50
|
+
const from = appState.selectedIndex;
|
|
51
|
+
const to = from + direction;
|
|
52
|
+
if (to < 0 || to >= appState.currentNode.children.length)
|
|
53
|
+
return;
|
|
54
|
+
moveItemInArray({
|
|
55
|
+
array: appState.currentNode.children,
|
|
56
|
+
from,
|
|
57
|
+
to,
|
|
58
|
+
});
|
|
59
|
+
navigator.navigate({ selectedIndex: to });
|
|
60
|
+
}
|
|
61
|
+
export const moveChildPreviousWithinParent = () => {
|
|
62
|
+
moveChildWithinParent(-1);
|
|
63
|
+
};
|
|
64
|
+
export const moveChildNextWithinParent = () => {
|
|
65
|
+
moveChildWithinParent(1);
|
|
66
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Mode } from '../../model/action-map.model.js';
|
|
2
|
+
import { patchState } from '../../state/state.js';
|
|
3
|
+
import { Intent } from '../../utils/key-intent.js';
|
|
4
|
+
import { moveChildNextWithinParent, moveChildPreviousWithinParent, moveChildToNextParent, moveChildToPreviousParent, } from './move-actions-utils.js';
|
|
5
|
+
export const toggleMoveMode = [
|
|
6
|
+
{
|
|
7
|
+
intent: Intent.Exit,
|
|
8
|
+
mode: Mode.MOVE,
|
|
9
|
+
description: '[Y] Exit yank mode',
|
|
10
|
+
action: () => {
|
|
11
|
+
patchState({
|
|
12
|
+
mode: Mode.DEFAULT,
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
intent: Intent.InitMove,
|
|
18
|
+
mode: Mode.DEFAULT,
|
|
19
|
+
description: '[Y] Toggle move/yank mode',
|
|
20
|
+
action: () => {
|
|
21
|
+
patchState({
|
|
22
|
+
mode: Mode.MOVE,
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
intent: Intent.InitMove, // Change name to toggle move?
|
|
28
|
+
mode: Mode.MOVE,
|
|
29
|
+
action: () => {
|
|
30
|
+
patchState({
|
|
31
|
+
mode: Mode.DEFAULT,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
export const moveWithinParent = [
|
|
37
|
+
{
|
|
38
|
+
intent: Intent.MovePreviousItem,
|
|
39
|
+
mode: Mode.MOVE,
|
|
40
|
+
action: moveChildPreviousWithinParent,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
intent: Intent.MoveNextItem,
|
|
44
|
+
mode: Mode.MOVE,
|
|
45
|
+
action: moveChildNextWithinParent,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
export const moveAcrossParents = [
|
|
49
|
+
{
|
|
50
|
+
intent: Intent.MoveToNextContainer,
|
|
51
|
+
mode: Mode.MOVE,
|
|
52
|
+
action: moveChildToNextParent,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
intent: Intent.MoveToPreviousContainer,
|
|
56
|
+
mode: Mode.MOVE,
|
|
57
|
+
action: moveChildToPreviousParent,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavigateCtx } from '
|
|
1
|
+
import { NavigateCtx } from '../../model/navigation-ctx.model.js';
|
|
2
2
|
export declare const navigateToNextItem: (ctx: NavigateCtx) => void;
|
|
3
3
|
export declare const navigateToPreviousItem: (ctx: NavigateCtx) => void;
|
|
4
4
|
export declare const navigateToNextContainer: (ctx: NavigateCtx) => void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Mode } from '../../model/action-map.model.js';
|
|
2
|
+
import { patchState } from '../../state/state.js';
|
|
3
|
+
import { KeyIntent } from '../../utils/key-intent.js';
|
|
4
|
+
import { enterChildNode, exitToParentNode, navigateToNextContainer, navigateToNextItem, navigateToPreviousContainer, navigateToPreviousItem, } from './navigation-action-utils.js';
|
|
5
|
+
export const DefaultActions = [
|
|
6
|
+
{
|
|
7
|
+
intent: KeyIntent.ToggleCommandLine,
|
|
8
|
+
mode: Mode.DEFAULT,
|
|
9
|
+
description: '[:] Toggle command line',
|
|
10
|
+
action: () => patchState({
|
|
11
|
+
mode: Mode.COMMAND_LINE,
|
|
12
|
+
}),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
intent: KeyIntent.ToggleCommandLine,
|
|
16
|
+
mode: Mode.COMMAND_LINE,
|
|
17
|
+
description: '[ESC] Toggle command line',
|
|
18
|
+
action: () => patchState({
|
|
19
|
+
mode: Mode.DEFAULT,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
// {
|
|
23
|
+
// intent: KeyIntent.ToggleHelp,
|
|
24
|
+
// mode: Mode.DEFAULT,
|
|
25
|
+
// description: '[F1] Toggle HELP menu',
|
|
26
|
+
// action: () =>
|
|
27
|
+
// setState(state => ({
|
|
28
|
+
// ...state,
|
|
29
|
+
// mode: Mode.HELP,
|
|
30
|
+
// })),
|
|
31
|
+
// },
|
|
32
|
+
// {
|
|
33
|
+
// intent: KeyIntent.ToggleHelp,
|
|
34
|
+
// mode: Mode.HELP,
|
|
35
|
+
// description: '[F1] Close HELP menu',
|
|
36
|
+
// action: () =>
|
|
37
|
+
// setState(state => ({
|
|
38
|
+
// ...state,
|
|
39
|
+
// mode: Mode.DEFAULT,
|
|
40
|
+
// })),
|
|
41
|
+
// },
|
|
42
|
+
{
|
|
43
|
+
intent: KeyIntent.Confirm,
|
|
44
|
+
mode: Mode.DEFAULT,
|
|
45
|
+
description: '[ENTER/E] Confirm/Enter context',
|
|
46
|
+
action: enterChildNode,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
intent: KeyIntent.Exit,
|
|
50
|
+
mode: Mode.DEFAULT,
|
|
51
|
+
description: '[ESC/Q] Exit application',
|
|
52
|
+
action: exitToParentNode,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
mode: Mode.DEFAULT,
|
|
56
|
+
description: '[ARROWS/HJKL] Navigate',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
intent: KeyIntent.NavPreviousItem,
|
|
60
|
+
mode: Mode.DEFAULT,
|
|
61
|
+
action: navigateToPreviousItem,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
intent: KeyIntent.NavNextItem,
|
|
65
|
+
mode: Mode.DEFAULT,
|
|
66
|
+
action: navigateToNextItem,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
intent: KeyIntent.NavToPreviousContainer,
|
|
70
|
+
mode: Mode.DEFAULT,
|
|
71
|
+
action: navigateToPreviousContainer,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
intent: KeyIntent.NavToNextContainer,
|
|
75
|
+
mode: Mode.DEFAULT,
|
|
76
|
+
action: navigateToNextContainer,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { addSwimlaneAction, addTicketAction, } from '../actions/add-item/add-item-actions.js';
|
|
2
|
+
import { Mode } from '../model/action-map.model.js';
|
|
3
|
+
import { patchState } from '../state/state.js';
|
|
4
|
+
import { CommandLineIntent } from './command-line-sequence-intent.js';
|
|
5
|
+
export const commandLineActions = [
|
|
6
|
+
{
|
|
7
|
+
intent: CommandLineIntent.ViewHelp,
|
|
8
|
+
mode: Mode.COMMAND_LINE,
|
|
9
|
+
action: () => {
|
|
10
|
+
patchState({
|
|
11
|
+
mode: Mode.HELP,
|
|
12
|
+
commandLineInput: '',
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
intent: CommandLineIntent.AddSwimlane,
|
|
18
|
+
mode: Mode.COMMAND_LINE,
|
|
19
|
+
action: (...args) => {
|
|
20
|
+
addSwimlaneAction(...args);
|
|
21
|
+
patchState({ commandLineInput: '', mode: Mode.DEFAULT });
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
intent: CommandLineIntent.AddTicket,
|
|
26
|
+
mode: Mode.COMMAND_LINE,
|
|
27
|
+
action: (...args) => {
|
|
28
|
+
addTicketAction(...args);
|
|
29
|
+
patchState({ commandLineInput: '', mode: Mode.DEFAULT });
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CommandLineIntent: {
|
|
2
|
+
readonly None: "none";
|
|
3
|
+
readonly AddSwimlane: "add-swimlane";
|
|
4
|
+
readonly AddTicket: "add-ticket";
|
|
5
|
+
readonly ViewHelp: "view-help";
|
|
6
|
+
};
|
|
7
|
+
export declare const getCommandLineIntent: (input: string) => (typeof CommandLineIntent)[keyof typeof CommandLineIntent];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BoardItemTypes } from '../../board/model/board.model.js';
|
|
2
|
+
import { navigationState } from '../state/state.js';
|
|
3
|
+
export const CommandLineIntent = {
|
|
4
|
+
None: 'none',
|
|
5
|
+
AddSwimlane: 'add-swimlane',
|
|
6
|
+
AddTicket: 'add-ticket',
|
|
7
|
+
ViewHelp: 'view-help',
|
|
8
|
+
};
|
|
9
|
+
export const getCommandLineIntent = (input) => {
|
|
10
|
+
const actionContext = navigationState?.currentNode?.actionContext;
|
|
11
|
+
if (!actionContext)
|
|
12
|
+
return CommandLineIntent.None;
|
|
13
|
+
switch (input) {
|
|
14
|
+
case 'help':
|
|
15
|
+
case 'he':
|
|
16
|
+
return CommandLineIntent.ViewHelp;
|
|
17
|
+
case 'add':
|
|
18
|
+
switch (actionContext) {
|
|
19
|
+
case BoardItemTypes.SWIMLANE:
|
|
20
|
+
return CommandLineIntent.AddSwimlane;
|
|
21
|
+
case BoardItemTypes.TICKET:
|
|
22
|
+
return CommandLineIntent.AddTicket;
|
|
23
|
+
default:
|
|
24
|
+
return CommandLineIntent.None;
|
|
25
|
+
}
|
|
26
|
+
default:
|
|
27
|
+
return CommandLineIntent.None;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { addSwimlaneAction, addTicketAction, } from '../actions/add-item/add-item-actions.js';
|
|
2
|
+
import { Mode } from '../model/action-map.model.js';
|
|
3
|
+
import { getCommandLineArgumentValue } from '../state/command-line.state.js';
|
|
4
|
+
import { patchState, updateState } from '../state/state.js';
|
|
5
|
+
import { CmdIntent } from './command-line-sequence-intent.js';
|
|
6
|
+
export const commands = [
|
|
7
|
+
{
|
|
8
|
+
intent: CmdIntent.ViewHelp,
|
|
9
|
+
mode: Mode.COMMAND_LINE,
|
|
10
|
+
action: () => patchState({ mode: Mode.HELP }),
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
intent: CmdIntent.AddSwimlane,
|
|
14
|
+
mode: Mode.COMMAND_LINE,
|
|
15
|
+
action: (...args) => {
|
|
16
|
+
addSwimlaneAction(...args);
|
|
17
|
+
patchState({ mode: Mode.DEFAULT });
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
intent: CmdIntent.AddTicket,
|
|
22
|
+
mode: Mode.COMMAND_LINE,
|
|
23
|
+
action: (...args) => {
|
|
24
|
+
addTicketAction(...args);
|
|
25
|
+
patchState({ mode: Mode.DEFAULT });
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
intent: CmdIntent.Rename,
|
|
30
|
+
mode: Mode.COMMAND_LINE,
|
|
31
|
+
action: () => {
|
|
32
|
+
updateState(s => ({
|
|
33
|
+
...s,
|
|
34
|
+
mode: Mode.DEFAULT,
|
|
35
|
+
currentNode: s.currentNode
|
|
36
|
+
? {
|
|
37
|
+
...s.currentNode,
|
|
38
|
+
name: getCommandLineArgumentValue(),
|
|
39
|
+
}
|
|
40
|
+
: null,
|
|
41
|
+
}));
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const CmdIntent: {
|
|
2
|
+
readonly None: "none";
|
|
3
|
+
readonly AddSwimlane: "add-swimlane";
|
|
4
|
+
readonly AddTicket: "add-ticket";
|
|
5
|
+
readonly ViewHelp: "view-help";
|
|
6
|
+
readonly Rename: "rename";
|
|
7
|
+
};
|
|
8
|
+
export declare const getCommandIntent: (command: string) => (typeof CmdIntent)[keyof typeof CmdIntent];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BoardItemTypes } from '../../board/model/board.model.js';
|
|
2
|
+
import { appState } from '../state/state.js';
|
|
3
|
+
export const CmdIntent = {
|
|
4
|
+
None: 'none',
|
|
5
|
+
AddSwimlane: 'add-swimlane',
|
|
6
|
+
AddTicket: 'add-ticket',
|
|
7
|
+
ViewHelp: 'view-help',
|
|
8
|
+
Rename: 'rename',
|
|
9
|
+
};
|
|
10
|
+
export const getCommandIntent = (command) => {
|
|
11
|
+
const actionContext = appState?.currentNode?.actionContext;
|
|
12
|
+
if (!actionContext)
|
|
13
|
+
return CmdIntent.None;
|
|
14
|
+
switch (command) {
|
|
15
|
+
case 'help':
|
|
16
|
+
case 'he':
|
|
17
|
+
return CmdIntent.ViewHelp;
|
|
18
|
+
case 'rename':
|
|
19
|
+
return CmdIntent.Rename;
|
|
20
|
+
case 'add':
|
|
21
|
+
switch (actionContext) {
|
|
22
|
+
case BoardItemTypes.SWIMLANE:
|
|
23
|
+
return CmdIntent.AddSwimlane;
|
|
24
|
+
case BoardItemTypes.TICKET:
|
|
25
|
+
return CmdIntent.AddTicket;
|
|
26
|
+
default:
|
|
27
|
+
return CmdIntent.None;
|
|
28
|
+
}
|
|
29
|
+
default:
|
|
30
|
+
return CmdIntent.None;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { addSwimlaneAction, addTicketAction, } from '../actions/add-item/add-item-actions.js';
|
|
2
|
+
import { Mode } from '../model/action-map.model.js';
|
|
3
|
+
import { getCommandLineArgumentValue } from '../state/command-line.state.js';
|
|
4
|
+
import { appState, patchState, updateState } from '../state/state.js';
|
|
5
|
+
import { CmdIntent } from './command-line-sequence-intent.js';
|
|
6
|
+
export const commands = [
|
|
7
|
+
{
|
|
8
|
+
intent: CmdIntent.ViewHelp,
|
|
9
|
+
mode: Mode.COMMAND_LINE,
|
|
10
|
+
action: () => patchState({ mode: Mode.HELP }),
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
intent: CmdIntent.AddSwimlane,
|
|
14
|
+
mode: Mode.COMMAND_LINE,
|
|
15
|
+
action: (...args) => {
|
|
16
|
+
addSwimlaneAction(...args);
|
|
17
|
+
patchState({ mode: Mode.DEFAULT });
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
intent: CmdIntent.AddTicket,
|
|
22
|
+
mode: Mode.COMMAND_LINE,
|
|
23
|
+
action: (...args) => {
|
|
24
|
+
addTicketAction(...args);
|
|
25
|
+
patchState({ mode: Mode.DEFAULT });
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
intent: CmdIntent.Rename,
|
|
30
|
+
mode: Mode.COMMAND_LINE,
|
|
31
|
+
action: () => {
|
|
32
|
+
updateState(s => {
|
|
33
|
+
// Update board on file
|
|
34
|
+
const newBoard = appState.rootNode;
|
|
35
|
+
const currentId = s.currentNode?.id;
|
|
36
|
+
if (!currentId)
|
|
37
|
+
return s;
|
|
38
|
+
const findItemInBoard = (item, id) => {
|
|
39
|
+
if (item.id === id)
|
|
40
|
+
return item;
|
|
41
|
+
return (item.children.find((child) => findItemInBoard(child, id)) ||
|
|
42
|
+
undefined);
|
|
43
|
+
};
|
|
44
|
+
const newName = getCommandLineArgumentValue();
|
|
45
|
+
const itemInBoard = findItemInBoard(newBoard, currentId);
|
|
46
|
+
if (!itemInBoard)
|
|
47
|
+
return s;
|
|
48
|
+
itemInBoard.name = newName;
|
|
49
|
+
return {
|
|
50
|
+
...s,
|
|
51
|
+
mode: Mode.DEFAULT,
|
|
52
|
+
rootNode: newBoard,
|
|
53
|
+
currentNode: itemInBoard,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initListeners(): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import readline from 'readline';
|
|
2
|
+
import { appState } from './state/state.js';
|
|
3
|
+
import { getKeyIntent } from './utils/key-intent.js';
|
|
4
|
+
import { navigator } from './actions/default/navigation-action-utils.js';
|
|
5
|
+
let currentKeypressListener;
|
|
6
|
+
const getKeyPressListener = () => {
|
|
7
|
+
return async function onKeyPress(_, key) {
|
|
8
|
+
if (key.ctrl && key.name === 'c')
|
|
9
|
+
return navigator.exit();
|
|
10
|
+
const filteredActions = appState.availableActions.filter(a => a.mode === appState.mode);
|
|
11
|
+
const actionMeta = filteredActions.find(({ intent, mode }) => getKeyIntent(key, mode) === intent);
|
|
12
|
+
if (!actionMeta?.action)
|
|
13
|
+
return;
|
|
14
|
+
try {
|
|
15
|
+
const res = actionMeta.action(navigator, actionMeta, key);
|
|
16
|
+
if (res instanceof Promise)
|
|
17
|
+
await res;
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
console.error(err);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export function initListeners() {
|
|
25
|
+
if (currentKeypressListener) {
|
|
26
|
+
process.stdin.removeListener('keypress', currentKeypressListener);
|
|
27
|
+
}
|
|
28
|
+
currentKeypressListener = getKeyPressListener();
|
|
29
|
+
readline.emitKeypressEvents(process.stdin);
|
|
30
|
+
if (process.stdin.isTTY)
|
|
31
|
+
process.stdin.setRawMode(true);
|
|
32
|
+
process.stdin.on('keypress', currentKeypressListener);
|
|
33
|
+
}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
import { Navigator } from '../actions/default/navigation-action-utils.js';
|
|
2
|
+
import readline from 'readline';
|
|
1
3
|
export declare const Mode: {
|
|
2
4
|
readonly DEFAULT: "default";
|
|
3
5
|
readonly MOVE: "move";
|
|
6
|
+
readonly HELP: "help";
|
|
7
|
+
readonly COMMAND_LINE: "command-line";
|
|
4
8
|
};
|
|
5
|
-
export type
|
|
6
|
-
export type ActionEntry
|
|
9
|
+
export type ModeUnion = (typeof Mode)[keyof typeof Mode];
|
|
10
|
+
export type ActionEntry = {
|
|
7
11
|
intent?: string;
|
|
8
|
-
mode:
|
|
12
|
+
mode: ModeUnion;
|
|
9
13
|
description?: `[${string}] ${string}`;
|
|
10
|
-
action?: (...args:
|
|
14
|
+
action?: (...args: [Navigator, ActionEntry, readline.Key]) => void | Promise<void>;
|
|
11
15
|
};
|
|
12
16
|
export type ActionMap<T extends Record<string, any[]>> = {
|
|
13
|
-
[K in keyof T]: ActionEntry
|
|
17
|
+
[K in keyof T]: ActionEntry[];
|
|
14
18
|
};
|
|
19
|
+
type CommandLineInput = {
|
|
20
|
+
value: string;
|
|
21
|
+
command: string;
|
|
22
|
+
};
|
|
23
|
+
export type CommandLineActionEntry = Omit<ActionEntry, 'action'> & {
|
|
24
|
+
action?: (...args: [Navigator, CommandLineActionEntry, CommandLineInput]) => void | Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export interface NavigateCtx {
|
|
3
|
-
_selectedIndex: number;
|
|
4
|
-
breadCrumb: Array<NavigationTree<NavigationTree>>;
|
|
5
|
-
navigationNode: NavigationTree<NavigationTree>;
|
|
6
|
-
children: NavigationTree[];
|
|
7
|
-
getSelectedIndex(): number;
|
|
8
|
-
select(index: number): void;
|
|
9
|
-
selectNone(): void;
|
|
10
|
-
reInvokeNavigate(index: number, breadCrumb: NavigationTree<NavigationTree>[]): void;
|
|
11
|
-
render(): void;
|
|
12
|
-
confirm(selected: NavigationTree<NavigationTree>): void;
|
|
13
|
-
exit(): void;
|
|
14
|
-
enterChildNode(node: NavigationTree<NavigationTree>): void;
|
|
15
|
-
enterParentNode(): void;
|
|
16
|
-
}
|
|
1
|
+
export {};
|