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,60 +0,0 @@
|
|
|
1
|
-
export const commandDelimiter = ' ';
|
|
2
|
-
export let commandLineState = {
|
|
3
|
-
commandHistory: [],
|
|
4
|
-
value: '',
|
|
5
|
-
commandHistoryIndex: -1,
|
|
6
|
-
};
|
|
7
|
-
const listeners = new Set();
|
|
8
|
-
const notify = () => {
|
|
9
|
-
for (const l of listeners)
|
|
10
|
-
l();
|
|
11
|
-
};
|
|
12
|
-
export const subscribeCommandLineState = (listener) => {
|
|
13
|
-
listeners.add(listener);
|
|
14
|
-
return () => listeners.delete(listener);
|
|
15
|
-
};
|
|
16
|
-
// ===== Updates =====
|
|
17
|
-
export const updateCommandLineState = (cb) => {
|
|
18
|
-
const next = cb(structuredClone(commandLineState));
|
|
19
|
-
commandLineState = next;
|
|
20
|
-
notify();
|
|
21
|
-
};
|
|
22
|
-
export const updateCommandLineInput = (cb) => {
|
|
23
|
-
updateCommandLineState(state => ({
|
|
24
|
-
...state,
|
|
25
|
-
value: cb(state.value),
|
|
26
|
-
}));
|
|
27
|
-
};
|
|
28
|
-
export const updateCommandHistory = () => {
|
|
29
|
-
updateCommandLineState(state => ({
|
|
30
|
-
...state,
|
|
31
|
-
commandHistory: [state.value, ...state.commandHistory].slice(0, 20),
|
|
32
|
-
}));
|
|
33
|
-
};
|
|
34
|
-
export const getPrevCommand = () => {
|
|
35
|
-
updateCommandLineState(s => {
|
|
36
|
-
const nextIndex = Math.min(s.commandHistoryIndex + 1, s.commandHistory.length - 1);
|
|
37
|
-
return {
|
|
38
|
-
...s,
|
|
39
|
-
commandHistoryIndex: nextIndex,
|
|
40
|
-
value: s.commandHistory[nextIndex] ?? '',
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
export const getNextCommand = () => {
|
|
45
|
-
updateCommandLineState(s => {
|
|
46
|
-
// typically you want to clamp down to -1 (meaning "no selection")
|
|
47
|
-
const nextIndex = Math.max(s.commandHistoryIndex - 1, -1);
|
|
48
|
-
return {
|
|
49
|
-
...s,
|
|
50
|
-
commandHistoryIndex: nextIndex,
|
|
51
|
-
value: nextIndex === -1 ? '' : s.commandHistory[nextIndex] ?? '',
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
export const clearCommandLine = () => updateCommandLineInput(() => '');
|
|
56
|
-
export const getCommandLineInput = () => commandLineState.value;
|
|
57
|
-
export const getCommandLineArgumentValue = () => {
|
|
58
|
-
const [_, ...rest] = commandLineState.value.split(commandDelimiter);
|
|
59
|
-
return rest.join(commandDelimiter);
|
|
60
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Board } from '../../board/model/board.model.js';
|
|
2
|
-
import { ActionEntry, ModeUnion } from '../model/action-map.model.js';
|
|
3
|
-
import { NavigationTree } from '../model/navigation-tree.model.js';
|
|
4
|
-
export type AppState = {
|
|
5
|
-
readonly selectedIndex: number;
|
|
6
|
-
readonly mode: ModeUnion;
|
|
7
|
-
readonly availableActions: ActionEntry[];
|
|
8
|
-
readonly availableHints: readonly string[];
|
|
9
|
-
readonly currentNode: NavigationTree<NavigationTree>;
|
|
10
|
-
readonly breadCrumb: NavigationTree<NavigationTree>[];
|
|
11
|
-
readonly rootNode: Board;
|
|
12
|
-
};
|
|
13
|
-
export declare let appState: AppState;
|
|
14
|
-
export declare const initAppState: (board: Board) => void;
|
|
15
|
-
export declare const updateState: (cb: (oldState: typeof appState) => typeof appState, opts?: {
|
|
16
|
-
render?: boolean;
|
|
17
|
-
}) => void;
|
|
18
|
-
export declare const patchState: (patch: Partial<typeof appState>, opts?: {
|
|
19
|
-
render?: boolean;
|
|
20
|
-
}) => void;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Hints } from '../../board/hints/hints.js';
|
|
2
|
-
import { renderBoard } from '../../cli.js';
|
|
3
|
-
import { ContextualActionMap } from '../actions/board-action-map.js';
|
|
4
|
-
import { DefaultActions } from '../actions/default/default-actions.js';
|
|
5
|
-
import { inputActions } from '../actions/input/input-actions.js';
|
|
6
|
-
export let appState;
|
|
7
|
-
const derived = (state) => {
|
|
8
|
-
const { currentNode, mode } = state;
|
|
9
|
-
const availableHints = Hints[currentNode.actionContext + mode] ?? Hints[currentNode.actionContext];
|
|
10
|
-
const actionContext = currentNode?.actionContext;
|
|
11
|
-
const availableActions = [
|
|
12
|
-
...DefaultActions,
|
|
13
|
-
...ContextualActionMap[actionContext],
|
|
14
|
-
...inputActions,
|
|
15
|
-
];
|
|
16
|
-
return {
|
|
17
|
-
...state,
|
|
18
|
-
availableHints,
|
|
19
|
-
availableActions,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export const initAppState = (board) => {
|
|
23
|
-
appState = derived({
|
|
24
|
-
...appState,
|
|
25
|
-
rootNode: board,
|
|
26
|
-
breadCrumb: [board],
|
|
27
|
-
selectedIndex: 0,
|
|
28
|
-
mode: 'default',
|
|
29
|
-
currentNode: board,
|
|
30
|
-
});
|
|
31
|
-
renderBoard();
|
|
32
|
-
};
|
|
33
|
-
export const updateState = (cb, opts = { render: true }) => {
|
|
34
|
-
appState = derived(cb(appState));
|
|
35
|
-
if (opts.render)
|
|
36
|
-
renderBoard();
|
|
37
|
-
};
|
|
38
|
-
export const patchState = (patch, opts = { render: true }) => updateState(old => ({ ...old, ...patch }), opts);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Intent } from './key-intent.js';
|
|
2
|
-
import readline from 'readline';
|
|
3
|
-
export declare const getCommandLineIntent: (key: readline.Key) => Intent.Confirm | Intent.ToggleCommandLine | Intent.CaptureInput | Intent.EraseInput | Intent.GetLastCommandFromHistory | Intent.GetNextCommandFromHistory;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Intent } from './key-intent.js';
|
|
2
|
-
export const getCommandLineIntent = (key) => {
|
|
3
|
-
switch (key.name) {
|
|
4
|
-
case 'up':
|
|
5
|
-
return Intent.GetLastCommandFromHistory;
|
|
6
|
-
case 'down':
|
|
7
|
-
return Intent.GetNextCommandFromHistory;
|
|
8
|
-
case 'return':
|
|
9
|
-
return Intent.Confirm;
|
|
10
|
-
case 'backspace':
|
|
11
|
-
return Intent.EraseInput;
|
|
12
|
-
case 'escape':
|
|
13
|
-
return Intent.ToggleCommandLine;
|
|
14
|
-
default:
|
|
15
|
-
return Intent.CaptureInput;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import readline from 'readline';
|
|
2
|
-
import { ModeUnion } from '../model/action-map.model.js';
|
|
3
|
-
import { NavigateCtx } from '../model/navigation-ctx.model.js';
|
|
4
|
-
import { KeyIntent } from './key-intent.js';
|
|
5
|
-
export declare function getKeyIntent(key: readline.Key, ctx: NavigateCtx, mode: ModeUnion): KeyIntent | null;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Mode } from '../model/action-map.model.js';
|
|
2
|
-
import { KeyIntent, getDir, mapDirectionalIntent } from './key-intent.js';
|
|
3
|
-
export function getKeyIntent(key, ctx, mode) {
|
|
4
|
-
if (key.sequence === ':') {
|
|
5
|
-
return KeyIntent.ToggleCommandLine;
|
|
6
|
-
}
|
|
7
|
-
if (mode === Mode.COMMAND_LINE) {
|
|
8
|
-
switch (key.name) {
|
|
9
|
-
case 'return':
|
|
10
|
-
return KeyIntent.Confirm;
|
|
11
|
-
case 'backspace':
|
|
12
|
-
return KeyIntent.EraseInput;
|
|
13
|
-
case 'escape':
|
|
14
|
-
return KeyIntent.ToggleCommandLine;
|
|
15
|
-
default:
|
|
16
|
-
return KeyIntent.CaptureInput;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const axis = ctx.navigationNode.childrenRenderAxis;
|
|
20
|
-
const enableAcrossContainers = ctx.navigationNode.enableChildNavigationAcrossContainers;
|
|
21
|
-
if (key.name === 'escape' && mode === Mode.HELP) {
|
|
22
|
-
return KeyIntent.ToggleHelp;
|
|
23
|
-
}
|
|
24
|
-
// Hard exits
|
|
25
|
-
if (key.ctrl && key.name === 'c')
|
|
26
|
-
return KeyIntent.Exit;
|
|
27
|
-
if (key.name === 'escape')
|
|
28
|
-
return KeyIntent.Exit;
|
|
29
|
-
// Move mode
|
|
30
|
-
if (mode === Mode.MOVE) {
|
|
31
|
-
if (key.name === 'y')
|
|
32
|
-
return KeyIntent.ToggleMove;
|
|
33
|
-
const dir = getDir(key);
|
|
34
|
-
if (!dir)
|
|
35
|
-
return null;
|
|
36
|
-
return mapDirectionalIntent(dir, axis, Boolean(enableAcrossContainers), {
|
|
37
|
-
prevItem: KeyIntent.MovePreviousItem,
|
|
38
|
-
nextItem: KeyIntent.MoveNextItem,
|
|
39
|
-
prevContainer: KeyIntent.MoveToPreviousContainer,
|
|
40
|
-
nextContainer: KeyIntent.MoveToNextContainer,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
// Normal mode
|
|
44
|
-
if (key.name === 'y')
|
|
45
|
-
return KeyIntent.ToggleMove;
|
|
46
|
-
// Edit (vim-ish)
|
|
47
|
-
if (key.name === 'i')
|
|
48
|
-
return KeyIntent.Edit;
|
|
49
|
-
// Navigation (arrows + vim hjkl)
|
|
50
|
-
const dir = getDir(key);
|
|
51
|
-
if (dir) {
|
|
52
|
-
return mapDirectionalIntent(dir, axis, Boolean(enableAcrossContainers), {
|
|
53
|
-
prevItem: KeyIntent.NavPreviousItem,
|
|
54
|
-
nextItem: KeyIntent.NavNextItem,
|
|
55
|
-
prevContainer: KeyIntent.NavToPreviousContainer,
|
|
56
|
-
nextContainer: KeyIntent.NavToNextContainer,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
// Actions
|
|
60
|
-
switch (key.name) {
|
|
61
|
-
case 'a':
|
|
62
|
-
return KeyIntent.AddItem;
|
|
63
|
-
case 'return':
|
|
64
|
-
case 'e':
|
|
65
|
-
return KeyIntent.Confirm;
|
|
66
|
-
case 'q':
|
|
67
|
-
return KeyIntent.Exit;
|
|
68
|
-
default:
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import readline from 'readline';
|
|
2
|
-
import { ModeUnion } from '../model/action-map.model.js';
|
|
3
|
-
export declare enum Intent {
|
|
4
|
-
NavPreviousItem = "navPreviousItem",
|
|
5
|
-
NavNextItem = "navNextItem",
|
|
6
|
-
NavToPreviousContainer = "navToPreviousContainer",
|
|
7
|
-
NavToNextContainer = "navToNextContainer",
|
|
8
|
-
MovePreviousItem = "movePreviousItem",
|
|
9
|
-
MoveNextItem = "moveNextItem",
|
|
10
|
-
MoveToPreviousContainer = "moveToPreviousContainer",
|
|
11
|
-
MoveToNextContainer = "moveToNextContainer",
|
|
12
|
-
Confirm = "confirm",
|
|
13
|
-
Edit = "edit",
|
|
14
|
-
Exit = "exit",
|
|
15
|
-
ViewHelp = "viewHelp",
|
|
16
|
-
HideHelp = "hideHelp",
|
|
17
|
-
InitMove = "initMove",
|
|
18
|
-
ToggleCommandLine = "toggleCommandLine",
|
|
19
|
-
CaptureInput = "captureInput",
|
|
20
|
-
EraseInput = "eraseInput",
|
|
21
|
-
AddItem = "addItem",
|
|
22
|
-
GetLastCommandFromHistory = "getLastCommandFromHistory",
|
|
23
|
-
GetNextCommandFromHistory = "getNextCommandFromHistory"
|
|
24
|
-
}
|
|
25
|
-
export declare function getKeyIntent(key: readline.Key, mode: ModeUnion): Intent | null;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Mode } from '../model/action-map.model.js';
|
|
2
|
-
import { appState } from '../state/state.js';
|
|
3
|
-
import { getCommandLineIntent } from './get-command-line-intent.js';
|
|
4
|
-
export var Intent;
|
|
5
|
-
(function (Intent) {
|
|
6
|
-
Intent["NavPreviousItem"] = "navPreviousItem";
|
|
7
|
-
Intent["NavNextItem"] = "navNextItem";
|
|
8
|
-
Intent["NavToPreviousContainer"] = "navToPreviousContainer";
|
|
9
|
-
Intent["NavToNextContainer"] = "navToNextContainer";
|
|
10
|
-
Intent["MovePreviousItem"] = "movePreviousItem";
|
|
11
|
-
Intent["MoveNextItem"] = "moveNextItem";
|
|
12
|
-
Intent["MoveToPreviousContainer"] = "moveToPreviousContainer";
|
|
13
|
-
Intent["MoveToNextContainer"] = "moveToNextContainer";
|
|
14
|
-
Intent["Confirm"] = "confirm";
|
|
15
|
-
Intent["Edit"] = "edit";
|
|
16
|
-
Intent["Exit"] = "exit";
|
|
17
|
-
Intent["ViewHelp"] = "viewHelp";
|
|
18
|
-
Intent["HideHelp"] = "hideHelp";
|
|
19
|
-
Intent["InitMove"] = "initMove";
|
|
20
|
-
// Command line
|
|
21
|
-
Intent["ToggleCommandLine"] = "toggleCommandLine";
|
|
22
|
-
Intent["CaptureInput"] = "captureInput";
|
|
23
|
-
Intent["EraseInput"] = "eraseInput";
|
|
24
|
-
Intent["AddItem"] = "addItem";
|
|
25
|
-
Intent["GetLastCommandFromHistory"] = "getLastCommandFromHistory";
|
|
26
|
-
Intent["GetNextCommandFromHistory"] = "getNextCommandFromHistory";
|
|
27
|
-
})(Intent || (Intent = {}));
|
|
28
|
-
function getDir(key) {
|
|
29
|
-
switch (key.name) {
|
|
30
|
-
// arrows
|
|
31
|
-
case 'up':
|
|
32
|
-
case 'down':
|
|
33
|
-
case 'left':
|
|
34
|
-
case 'right':
|
|
35
|
-
return key.name;
|
|
36
|
-
// vim
|
|
37
|
-
case 'k':
|
|
38
|
-
return 'up';
|
|
39
|
-
case 'j':
|
|
40
|
-
return 'down';
|
|
41
|
-
case 'h':
|
|
42
|
-
return 'left';
|
|
43
|
-
case 'l':
|
|
44
|
-
return 'right';
|
|
45
|
-
default:
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function mapDirectionalIntent(axis, dir, intents) {
|
|
50
|
-
const enableAcrossContainers = appState.currentNode.enableChildNavigationAcrossContainers;
|
|
51
|
-
switch (dir) {
|
|
52
|
-
case 'up':
|
|
53
|
-
return axis === 'vertical'
|
|
54
|
-
? intents.prevItem
|
|
55
|
-
: enableAcrossContainers
|
|
56
|
-
? intents.prevContainer
|
|
57
|
-
: null;
|
|
58
|
-
case 'down':
|
|
59
|
-
return axis === 'vertical'
|
|
60
|
-
? intents.nextItem
|
|
61
|
-
: enableAcrossContainers
|
|
62
|
-
? intents.nextContainer
|
|
63
|
-
: null;
|
|
64
|
-
case 'left':
|
|
65
|
-
return axis === 'horizontal'
|
|
66
|
-
? intents.prevItem
|
|
67
|
-
: enableAcrossContainers
|
|
68
|
-
? intents.prevContainer
|
|
69
|
-
: null;
|
|
70
|
-
case 'right':
|
|
71
|
-
return axis === 'horizontal'
|
|
72
|
-
? intents.nextItem
|
|
73
|
-
: enableAcrossContainers
|
|
74
|
-
? intents.nextContainer
|
|
75
|
-
: null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export function getKeyIntent(key, mode) {
|
|
79
|
-
if (key.sequence === ':')
|
|
80
|
-
return Intent.ToggleCommandLine;
|
|
81
|
-
if (mode === Mode.COMMAND_LINE)
|
|
82
|
-
return getCommandLineIntent(key);
|
|
83
|
-
// Navigation keys
|
|
84
|
-
const dir = getDir(key);
|
|
85
|
-
if (dir) {
|
|
86
|
-
let dirMap = mode === Mode.MOVE
|
|
87
|
-
? {
|
|
88
|
-
prevItem: Intent.MovePreviousItem,
|
|
89
|
-
nextItem: Intent.MoveNextItem,
|
|
90
|
-
prevContainer: Intent.MoveToPreviousContainer,
|
|
91
|
-
nextContainer: Intent.MoveToNextContainer,
|
|
92
|
-
}
|
|
93
|
-
: {
|
|
94
|
-
prevItem: Intent.NavPreviousItem,
|
|
95
|
-
nextItem: Intent.NavNextItem,
|
|
96
|
-
prevContainer: Intent.NavToPreviousContainer,
|
|
97
|
-
nextContainer: Intent.NavToNextContainer,
|
|
98
|
-
};
|
|
99
|
-
return mapDirectionalIntent(appState.currentNode.childrenRenderAxis, dir, dirMap);
|
|
100
|
-
}
|
|
101
|
-
// Hard exit
|
|
102
|
-
if (key.ctrl && key.name === 'c')
|
|
103
|
-
return Intent.Exit;
|
|
104
|
-
// Default actions
|
|
105
|
-
switch (key.name) {
|
|
106
|
-
case 'i':
|
|
107
|
-
return Intent.Edit;
|
|
108
|
-
case 'y':
|
|
109
|
-
return Intent.InitMove;
|
|
110
|
-
case 'e':
|
|
111
|
-
case 'return':
|
|
112
|
-
return Intent.Confirm;
|
|
113
|
-
case 'q':
|
|
114
|
-
case 'escape':
|
|
115
|
-
return Intent.Exit;
|
|
116
|
-
default:
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
}
|