epiq 0.0.5 → 0.1.1
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/cli.js +398 -33
- package/package.json +26 -11
- package/readme.md +1 -1
- package/dist/app.d.ts +0 -5
- package/dist/app.js +0 -18
- package/dist/board/components/Board.d.ts +0 -6
- package/dist/board/components/Board.js +0 -11
- package/dist/board/components/CommandLine.d.ts +0 -2
- package/dist/board/components/CommandLine.js +0 -26
- package/dist/board/components/ContextBar.d.ts +0 -4
- package/dist/board/components/ContextBar.js +0 -17
- package/dist/board/components/Help.d.ts +0 -4
- package/dist/board/components/Help.js +0 -28
- package/dist/board/components/Logo.d.ts +0 -2
- package/dist/board/components/Logo.js +0 -21
- package/dist/board/components/ScrollBox.d.ts +0 -9
- package/dist/board/components/ScrollBox.js +0 -22
- package/dist/board/components/Swimlane.d.ts +0 -9
- package/dist/board/components/Swimlane.js +0 -12
- package/dist/board/components/Swimlanes.d.ts +0 -8
- package/dist/board/components/Swimlanes.js +0 -17
- package/dist/board/components/TextInput.d.ts +0 -6
- package/dist/board/components/TextInput.js +0 -9
- package/dist/board/components/TicketListItem.d.ts +0 -6
- package/dist/board/components/TicketListItem.js +0 -13
- package/dist/board/components/TicketUI.d.ts +0 -8
- package/dist/board/components/TicketUI.js +0 -8
- package/dist/board/hints/hints.d.ts +0 -7
- package/dist/board/hints/hints.js +0 -21
- package/dist/board/mock/board.d.ts +0 -2
- package/dist/board/mock/board.js +0 -520
- package/dist/board/model/board.model.d.ts +0 -26
- package/dist/board/model/board.model.js +0 -6
- package/dist/board/render/color.d.ts +0 -7
- package/dist/board/render/color.js +0 -21
- package/dist/cli.d.ts +0 -3
- package/dist/debug-logger.d.ts +0 -2
- package/dist/debug-logger.js +0 -16
- package/dist/init-project.d.ts +0 -1
- package/dist/init-project.js +0 -1
- package/dist/navigation/actions/add/add-actions.d.ts +0 -2
- package/dist/navigation/actions/add/add-actions.js +0 -25
- package/dist/navigation/actions/add/add-item-actions.d.ts +0 -2
- package/dist/navigation/actions/add/add-item-actions.js +0 -25
- package/dist/navigation/actions/add-item/add-item-actions.d.ts +0 -3
- package/dist/navigation/actions/add-item/add-item-actions.js +0 -45
- package/dist/navigation/actions/board-action-map.d.ts +0 -10
- package/dist/navigation/actions/board-action-map.js +0 -12
- package/dist/navigation/actions/default/default-action-utils.d.ts +0 -8
- package/dist/navigation/actions/default/default-action-utils.js +0 -101
- package/dist/navigation/actions/default/default-actions.d.ts +0 -2
- package/dist/navigation/actions/default/default-actions.js +0 -64
- package/dist/navigation/actions/default/navigation-action-utils.d.ts +0 -16
- package/dist/navigation/actions/default/navigation-action-utils.js +0 -109
- package/dist/navigation/actions/input/command-line-input.d.ts +0 -2
- package/dist/navigation/actions/input/command-line-input.js +0 -18
- package/dist/navigation/actions/input/input-actions-utils.d.ts +0 -8
- package/dist/navigation/actions/input/input-actions-utils.js +0 -47
- package/dist/navigation/actions/input/input-actions.d.ts +0 -2
- package/dist/navigation/actions/input/input-actions.js +0 -44
- package/dist/navigation/actions/move/move-actions-routes.d.ts +0 -4
- package/dist/navigation/actions/move/move-actions-routes.js +0 -55
- package/dist/navigation/actions/move/move-actions-utils.d.ts +0 -4
- package/dist/navigation/actions/move/move-actions-utils.js +0 -66
- package/dist/navigation/actions/move/move-actions.d.ts +0 -4
- package/dist/navigation/actions/move/move-actions.js +0 -59
- package/dist/navigation/actions/navigate/navigation-action-utils.d.ts +0 -7
- package/dist/navigation/actions/navigate/navigation-action-utils.js +0 -48
- package/dist/navigation/actions/navigate/navigation-actions.d.ts +0 -2
- package/dist/navigation/actions/navigate/navigation-actions.js +0 -78
- package/dist/navigation/command-line/command-line-actions.d.ts +0 -2
- package/dist/navigation/command-line/command-line-actions.js +0 -32
- package/dist/navigation/command-line/command-line-intent.d.ts +0 -7
- package/dist/navigation/command-line/command-line-intent.js +0 -29
- package/dist/navigation/command-line/command-line-sequence-actions.d.ts +0 -2
- package/dist/navigation/command-line/command-line-sequence-actions.js +0 -44
- package/dist/navigation/command-line/command-line-sequence-intent.d.ts +0 -8
- package/dist/navigation/command-line/command-line-sequence-intent.js +0 -32
- package/dist/navigation/command-line/commands.d.ts +0 -2
- package/dist/navigation/command-line/commands.js +0 -58
- package/dist/navigation/keypress-listener.d.ts +0 -1
- package/dist/navigation/keypress-listener.js +0 -33
- package/dist/navigation/model/action-map.model.d.ts +0 -26
- package/dist/navigation/model/action-map.model.js +0 -6
- package/dist/navigation/model/navigation-ctx.model.d.ts +0 -1
- package/dist/navigation/model/navigation-ctx.model.js +0 -1
- package/dist/navigation/model/navigation-tree.model.d.ts +0 -11
- package/dist/navigation/model/navigation-tree.model.js +0 -1
- package/dist/navigation/navigation-ctx.d.ts +0 -1
- package/dist/navigation/navigation-ctx.js +0 -1
- package/dist/navigation/navigation.d.ts +0 -3
- package/dist/navigation/navigation.js +0 -82
- package/dist/navigation/state/command-line.state.d.ts +0 -18
- package/dist/navigation/state/command-line.state.js +0 -60
- package/dist/navigation/state/state.d.ts +0 -20
- package/dist/navigation/state/state.js +0 -38
- package/dist/navigation/utils/get-command-line-intent.d.ts +0 -3
- package/dist/navigation/utils/get-command-line-intent.js +0 -17
- package/dist/navigation/utils/getKeyIntent.d.ts +0 -5
- package/dist/navigation/utils/getKeyIntent.js +0 -71
- package/dist/navigation/utils/key-intent.d.ts +0 -25
- package/dist/navigation/utils/key-intent.js +0 -119
|
@@ -1,59 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import { NavigateCtx } from '../../model/navigation-ctx.model.js';
|
|
2
|
-
export declare const navigateToNextItem: (ctx: NavigateCtx) => void;
|
|
3
|
-
export declare const navigateToPreviousItem: (ctx: NavigateCtx) => void;
|
|
4
|
-
export declare const navigateToNextContainer: (ctx: NavigateCtx) => void;
|
|
5
|
-
export declare const navigateToPreviousContainer: (ctx: NavigateCtx) => void;
|
|
6
|
-
export declare const enterChildNode: (ctx: NavigateCtx) => void;
|
|
7
|
-
export declare const exitToParentNode: (ctx: NavigateCtx) => void;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const navigateByOffset = (ctx, offset) => {
|
|
2
|
-
const len = ctx.children.length;
|
|
3
|
-
const newIndex = (ctx.getSelectedIndex() + offset + len) % len;
|
|
4
|
-
ctx.select(newIndex);
|
|
5
|
-
};
|
|
6
|
-
export const navigateToNextItem = (ctx) => navigateByOffset(ctx, 1);
|
|
7
|
-
export const navigateToPreviousItem = (ctx) => navigateByOffset(ctx, -1);
|
|
8
|
-
const navigateToSiblingContainer = (ctx, direction) => {
|
|
9
|
-
if (!ctx.navigationNode.enableChildNavigationAcrossContainers)
|
|
10
|
-
return;
|
|
11
|
-
const parent = ctx.breadCrumb.at(-1);
|
|
12
|
-
const grandParent = ctx.breadCrumb.at(-2);
|
|
13
|
-
if (!parent || !grandParent)
|
|
14
|
-
return;
|
|
15
|
-
const parentIndex = grandParent.children.findIndex(x => x.id === parent.id);
|
|
16
|
-
const sliced = direction === -1
|
|
17
|
-
? grandParent.children.toSpliced(parentIndex).toReversed()
|
|
18
|
-
: grandParent.children.slice(parentIndex + 1);
|
|
19
|
-
const nextSibling = sliced.find(x => x.children.length);
|
|
20
|
-
if (!nextSibling?.children?.length)
|
|
21
|
-
return;
|
|
22
|
-
const prevIndex = ctx.getSelectedIndex();
|
|
23
|
-
const boundedIndex = Math.min(prevIndex, nextSibling.children.length - 1);
|
|
24
|
-
ctx.selectNone();
|
|
25
|
-
ctx.reInvokeNavigate(boundedIndex, [
|
|
26
|
-
...ctx.breadCrumb.slice(0, -1),
|
|
27
|
-
nextSibling,
|
|
28
|
-
]);
|
|
29
|
-
};
|
|
30
|
-
export const navigateToNextContainer = (ctx) => navigateToSiblingContainer(ctx, 1);
|
|
31
|
-
export const navigateToPreviousContainer = (ctx) => navigateToSiblingContainer(ctx, -1);
|
|
32
|
-
export const enterChildNode = (ctx) => {
|
|
33
|
-
const current = ctx.navigationNode.children[ctx._selectedIndex];
|
|
34
|
-
if (!current)
|
|
35
|
-
return;
|
|
36
|
-
if (!current.children?.length) {
|
|
37
|
-
ctx.confirm(current);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
ctx.select(-1);
|
|
41
|
-
ctx.enterChildNode(current);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
export const exitToParentNode = (ctx) => {
|
|
45
|
-
if (ctx.breadCrumb.length >= 2) {
|
|
46
|
-
ctx.enterParentNode();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
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
|
-
];
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
];
|
|
@@ -1,7 +0,0 @@
|
|
|
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];
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
];
|
|
@@ -1,8 +0,0 @@
|
|
|
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];
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function initListeners(): void;
|
|
@@ -1,33 +0,0 @@
|
|
|
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,26 +0,0 @@
|
|
|
1
|
-
import { Navigator } from '../actions/default/navigation-action-utils.js';
|
|
2
|
-
import readline from 'readline';
|
|
3
|
-
export declare const Mode: {
|
|
4
|
-
readonly DEFAULT: "default";
|
|
5
|
-
readonly MOVE: "move";
|
|
6
|
-
readonly HELP: "help";
|
|
7
|
-
readonly COMMAND_LINE: "command-line";
|
|
8
|
-
};
|
|
9
|
-
export type ModeUnion = (typeof Mode)[keyof typeof Mode];
|
|
10
|
-
export type ActionEntry = {
|
|
11
|
-
intent?: string;
|
|
12
|
-
mode: ModeUnion;
|
|
13
|
-
description?: `[${string}] ${string}`;
|
|
14
|
-
action?: (...args: [Navigator, ActionEntry, readline.Key]) => void | Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
export type ActionMap<T extends Record<string, any[]>> = {
|
|
17
|
-
[K in keyof T]: ActionEntry[];
|
|
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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BoardItemTypes } from '../../board/model/board.model.js';
|
|
2
|
-
export type NavigationTree<TMeta = Record<string, unknown>> = {
|
|
3
|
-
id: string;
|
|
4
|
-
isSelected: boolean;
|
|
5
|
-
childrenRenderAxis: 'vertical' | 'horizontal';
|
|
6
|
-
name: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
children: NavigationTree<unknown>[];
|
|
9
|
-
actionContext: (typeof BoardItemTypes)[keyof typeof BoardItemTypes];
|
|
10
|
-
enableChildNavigationAcrossContainers?: boolean;
|
|
11
|
-
} & TMeta;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import readline from 'readline';
|
|
2
|
-
import { appState, patchState, updateState } from './state/state.js';
|
|
3
|
-
import { getKeyIntent } from './utils/key-intent.js';
|
|
4
|
-
let currentKeypressListener;
|
|
5
|
-
export const navigationUtils = {
|
|
6
|
-
updateSelection: (idx) => {
|
|
7
|
-
updateState(oldState => {
|
|
8
|
-
const currentNode = oldState.breadCrumb.at(-1) ?? oldState.breadCrumb[0];
|
|
9
|
-
if (!currentNode)
|
|
10
|
-
return oldState;
|
|
11
|
-
currentNode.children?.forEach((child, i) => (child.isSelected = i === idx));
|
|
12
|
-
return {
|
|
13
|
-
...oldState,
|
|
14
|
-
selectedIndex: idx,
|
|
15
|
-
currentNode: currentNode, // keep currentNode in sync
|
|
16
|
-
breadCrumb: [...oldState.breadCrumb], // keep reference fresh if you rely on it
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
selectNone() {
|
|
21
|
-
this.updateSelection(-1);
|
|
22
|
-
},
|
|
23
|
-
confirm(sel) {
|
|
24
|
-
console.log(sel);
|
|
25
|
-
},
|
|
26
|
-
exit() {
|
|
27
|
-
process.exit(0);
|
|
28
|
-
},
|
|
29
|
-
enterChildNode(childNode) {
|
|
30
|
-
patchState({
|
|
31
|
-
breadCrumb: [...appState.breadCrumb, childNode],
|
|
32
|
-
currentNode: childNode,
|
|
33
|
-
selectedIndex: 0,
|
|
34
|
-
});
|
|
35
|
-
this.updateSelection(0);
|
|
36
|
-
},
|
|
37
|
-
enterParentNode() {
|
|
38
|
-
const crumb = appState.breadCrumb;
|
|
39
|
-
if (crumb.length < 2)
|
|
40
|
-
return;
|
|
41
|
-
const newCrumb = crumb.slice(0, -1);
|
|
42
|
-
const parentLevelNode = newCrumb.at(-1);
|
|
43
|
-
// find old parent index inside grandparent
|
|
44
|
-
const grandParent = newCrumb.at(-2);
|
|
45
|
-
const parentIndex = grandParent?.children?.findIndex(x => x.id === parentLevelNode.id) ?? 0;
|
|
46
|
-
patchState({
|
|
47
|
-
breadCrumb: newCrumb,
|
|
48
|
-
currentNode: parentLevelNode,
|
|
49
|
-
selectedIndex: parentIndex,
|
|
50
|
-
});
|
|
51
|
-
this.updateSelection(parentIndex);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
const getKeyPressListener = () => {
|
|
55
|
-
navigationUtils.updateSelection(appState.selectedIndex ?? 0);
|
|
56
|
-
return async function onKeyPress(_, key) {
|
|
57
|
-
if (key.ctrl && key.name === 'c')
|
|
58
|
-
return navigationUtils.exit();
|
|
59
|
-
const filteredActions = appState.availableActions.filter(a => a.mode === appState.mode);
|
|
60
|
-
const actionMeta = filteredActions.find(({ intent, mode }) => getKeyIntent(key, mode) === intent);
|
|
61
|
-
if (!actionMeta?.action)
|
|
62
|
-
return;
|
|
63
|
-
try {
|
|
64
|
-
const res = actionMeta.action(navigationUtils, actionMeta, key);
|
|
65
|
-
if (res instanceof Promise)
|
|
66
|
-
await res;
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
console.error(err);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
export function initListeners() {
|
|
74
|
-
if (currentKeypressListener) {
|
|
75
|
-
process.stdin.removeListener('keypress', currentKeypressListener);
|
|
76
|
-
}
|
|
77
|
-
currentKeypressListener = getKeyPressListener();
|
|
78
|
-
readline.emitKeypressEvents(process.stdin);
|
|
79
|
-
if (process.stdin.isTTY)
|
|
80
|
-
process.stdin.setRawMode(true);
|
|
81
|
-
process.stdin.on('keypress', currentKeypressListener);
|
|
82
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const commandDelimiter = " ";
|
|
2
|
-
export type CommandLineState = {
|
|
3
|
-
value: string;
|
|
4
|
-
commandHistory: string[];
|
|
5
|
-
commandHistoryIndex: number;
|
|
6
|
-
};
|
|
7
|
-
export declare let commandLineState: CommandLineState;
|
|
8
|
-
type Listener = () => void;
|
|
9
|
-
export declare const subscribeCommandLineState: (listener: Listener) => () => boolean;
|
|
10
|
-
export declare const updateCommandLineState: (cb: (old: CommandLineState) => CommandLineState) => void;
|
|
11
|
-
export declare const updateCommandLineInput: (cb: (previous: string) => string) => void;
|
|
12
|
-
export declare const updateCommandHistory: () => void;
|
|
13
|
-
export declare const getPrevCommand: () => void;
|
|
14
|
-
export declare const getNextCommand: () => void;
|
|
15
|
-
export declare const clearCommandLine: () => void;
|
|
16
|
-
export declare const getCommandLineInput: () => string;
|
|
17
|
-
export declare const getCommandLineArgumentValue: () => string;
|
|
18
|
-
export {};
|