epiq 0.0.2 → 0.0.3

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 (134) hide show
  1. package/dist/app.js +11 -4
  2. package/dist/board/components/Board.js +4 -12
  3. package/dist/board/components/CommandLine.d.ts +2 -0
  4. package/dist/board/components/CommandLine.js +19 -0
  5. package/dist/{components/Help.d.ts → board/components/ContextBar.d.ts} +1 -1
  6. package/dist/board/components/ContextBar.js +8 -0
  7. package/dist/board/components/Help.js +18 -11
  8. package/dist/board/components/Swimlane.js +6 -3
  9. package/dist/board/components/Swimlanes.js +1 -1
  10. package/dist/board/components/TextInput.d.ts +6 -0
  11. package/dist/board/components/TextInput.js +9 -0
  12. package/dist/board/components/TicketListItem.js +5 -4
  13. package/dist/board/components/TicketUI.js +6 -7
  14. package/dist/board/hints/hints.d.ts +7 -0
  15. package/dist/board/hints/hints.js +29 -0
  16. package/dist/board/mock/board.js +526 -457
  17. package/dist/cli.d.ts +2 -1
  18. package/dist/cli.js +37 -14
  19. package/dist/debug-logger.d.ts +2 -0
  20. package/dist/debug-logger.js +15 -0
  21. package/dist/navigation/actions/add/add-actions.d.ts +2 -0
  22. package/dist/navigation/actions/add/add-actions.js +25 -0
  23. package/dist/navigation/actions/add/add-item-actions.d.ts +2 -0
  24. package/dist/navigation/actions/add/add-item-actions.js +25 -0
  25. package/dist/navigation/actions/add-item/add-item-actions.d.ts +3 -0
  26. package/dist/navigation/actions/add-item/add-item-actions.js +35 -0
  27. package/dist/navigation/actions/board-action-map.d.ts +10 -0
  28. package/dist/navigation/actions/board-action-map.js +12 -0
  29. package/dist/{lib/utils/default-actions.d.ts → navigation/actions/default/default-action-utils.d.ts} +2 -2
  30. package/dist/{lib/utils → navigation/actions/default}/default-action-utils.js +11 -10
  31. package/dist/navigation/actions/default/default-actions.d.ts +2 -0
  32. package/dist/navigation/actions/default/default-actions.js +78 -0
  33. package/dist/navigation/actions/input/command-line-input.d.ts +2 -0
  34. package/dist/navigation/actions/input/command-line-input.js +18 -0
  35. package/dist/navigation/actions/input/input-actions-utils.d.ts +8 -0
  36. package/dist/navigation/actions/input/input-actions-utils.js +47 -0
  37. package/dist/navigation/actions/input/input-actions.d.ts +2 -0
  38. package/dist/navigation/actions/input/input-actions.js +43 -0
  39. package/dist/navigation/actions/move/move-actions-routes.d.ts +4 -0
  40. package/dist/navigation/actions/move/move-actions-routes.js +55 -0
  41. package/dist/{lib/actions → navigation/actions/move}/move-actions-utils.d.ts +1 -1
  42. package/dist/{board/actions/move-actions.js → navigation/actions/move/move-actions-utils.js} +13 -9
  43. package/dist/navigation/actions/move/move-actions.d.ts +4 -0
  44. package/dist/navigation/actions/move/move-actions.js +53 -0
  45. package/dist/{lib/utils/default-action-utils.d.ts → navigation/actions/navigate/navigation-action-utils.d.ts} +1 -1
  46. package/dist/navigation/actions/navigate/navigation-actions.d.ts +2 -0
  47. package/dist/navigation/actions/navigate/navigation-actions.js +78 -0
  48. package/dist/navigation/command-line/command-line-actions.d.ts +2 -0
  49. package/dist/navigation/command-line/command-line-actions.js +32 -0
  50. package/dist/navigation/command-line/command-line-intent.d.ts +7 -0
  51. package/dist/navigation/command-line/command-line-intent.js +29 -0
  52. package/dist/navigation/command-line/command-line-sequence-actions.d.ts +2 -0
  53. package/dist/navigation/command-line/command-line-sequence-actions.js +31 -0
  54. package/dist/navigation/command-line/command-line-sequence-intent.d.ts +7 -0
  55. package/dist/navigation/command-line/command-line-sequence-intent.js +29 -0
  56. package/dist/navigation/model/action-map.model.d.ts +17 -5
  57. package/dist/navigation/model/action-map.model.js +2 -0
  58. package/dist/navigation/model/navigation-ctx.model.d.ts +2 -2
  59. package/dist/navigation/model/navigation-tree.model.d.ts +1 -0
  60. package/dist/navigation/navigation.d.ts +1 -1
  61. package/dist/navigation/navigation.js +48 -34
  62. package/dist/navigation/state/command-line.state.d.ts +13 -0
  63. package/dist/navigation/state/command-line.state.js +43 -0
  64. package/dist/navigation/state/state.d.ts +7 -6
  65. package/dist/navigation/state/state.js +31 -2
  66. package/dist/navigation/utils/get-command-line-intent.d.ts +3 -0
  67. package/dist/navigation/utils/get-command-line-intent.js +17 -0
  68. package/dist/navigation/utils/getKeyIntent.d.ts +5 -0
  69. package/dist/navigation/utils/getKeyIntent.js +71 -0
  70. package/dist/navigation/utils/key-intent.d.ts +19 -10
  71. package/dist/navigation/utils/key-intent.js +103 -43
  72. package/package.json +2 -2
  73. package/dist/board/actions/board-action-map.d.ts +0 -11
  74. package/dist/board/actions/board-action-map.js +0 -11
  75. package/dist/board/actions/move-actions-routes.d.ts +0 -4
  76. package/dist/board/actions/move-actions-routes.js +0 -31
  77. package/dist/board/actions/move-actions.d.ts +0 -5
  78. package/dist/board/board-action-map.d.ts +0 -9
  79. package/dist/board/board-action-map.js +0 -7
  80. package/dist/board/move-actions-routes.d.ts +0 -4
  81. package/dist/board/move-actions-routes.js +0 -31
  82. package/dist/board/move-actions.d.ts +0 -5
  83. package/dist/board/move-actions.js +0 -49
  84. package/dist/components/Board.d.ts +0 -6
  85. package/dist/components/Board.js +0 -15
  86. package/dist/components/Help.js +0 -21
  87. package/dist/components/Swimlane.d.ts +0 -8
  88. package/dist/components/Swimlane.js +0 -10
  89. package/dist/components/TicketListItem.d.ts +0 -6
  90. package/dist/components/TicketListItem.js +0 -12
  91. package/dist/lib/actions/board-action-map.d.ts +0 -9
  92. package/dist/lib/actions/board-action-map.js +0 -7
  93. package/dist/lib/actions/move-actions-utils.js +0 -43
  94. package/dist/lib/actions/move-actions.d.ts +0 -4
  95. package/dist/lib/actions/move-actions.js +0 -31
  96. package/dist/lib/board/board-action-map.d.ts +0 -9
  97. package/dist/lib/board/board-action-map.js +0 -7
  98. package/dist/lib/board/move-actions-routes.d.ts +0 -4
  99. package/dist/lib/board/move-actions-routes.js +0 -31
  100. package/dist/lib/board/move-actions.d.ts +0 -5
  101. package/dist/lib/board/move-actions.js +0 -43
  102. package/dist/lib/board-utils.d.ts +0 -7
  103. package/dist/lib/board-utils.js +0 -33
  104. package/dist/lib/default-actions-routes.d.ts +0 -4
  105. package/dist/lib/default-actions-routes.js +0 -47
  106. package/dist/lib/default-actions.d.ts +0 -4
  107. package/dist/lib/default-actions.js +0 -47
  108. package/dist/lib/navigation-context.d.ts +0 -16
  109. package/dist/lib/navigation.d.ts +0 -10
  110. package/dist/lib/navigation.js +0 -74
  111. package/dist/lib/render-utils.d.ts +0 -10
  112. package/dist/lib/render-utils.js +0 -12
  113. package/dist/lib/state.d.ts +0 -8
  114. package/dist/lib/state.js +0 -8
  115. package/dist/lib/types/action-map.model.d.ts +0 -14
  116. package/dist/lib/types/action-map.model.js +0 -4
  117. package/dist/lib/types/board.model.d.ts +0 -21
  118. package/dist/lib/types/board.model.js +0 -5
  119. package/dist/lib/types/navigation.model.d.ts +0 -9
  120. package/dist/lib/utils/array-utils.d.ts +0 -5
  121. package/dist/lib/utils/array-utils.js +0 -7
  122. package/dist/lib/utils/default-actions.js +0 -50
  123. package/dist/lib/utils/key-intent.d.ts +0 -16
  124. package/dist/lib/utils/key-intent.js +0 -65
  125. package/dist/lib/utils.d.ts +0 -10
  126. package/dist/lib/utils.js +0 -12
  127. package/dist/mock/board.d.ts +0 -2
  128. package/dist/mock/board.js +0 -139
  129. package/dist/navigation/actions/default-actions-routes.d.ts +0 -4
  130. package/dist/navigation/actions/default-actions-routes.js +0 -47
  131. package/dist/navigation/actions/default-actions.d.ts +0 -7
  132. /package/dist/navigation/actions/{default-actions.js → navigate/navigation-action-utils.js} +0 -0
  133. /package/dist/{lib/navigation-context.js → navigation/navigation-ctx.d.ts} +0 -0
  134. /package/dist/{lib/types/navigation.model.js → navigation/navigation-ctx.js} +0 -0
@@ -0,0 +1,71 @@
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,16 +1,25 @@
1
1
  import readline from 'readline';
2
+ import { ModeUnion } from '../model/action-map.model.js';
2
3
  import { NavigateCtx } from '../model/navigation-ctx.model.js';
3
4
  export declare enum KeyIntent {
4
- NavPreviousItem = "nav-previous-item",
5
- NavNextItem = "nav-next-item",
6
- NavToPreviousContainer = "nav-to-previous-container",
7
- NavToNextContainer = "nav-to-next-container",
8
- MovePreviousItem = "move-previous-item",
9
- MoveNextItem = "move-next-item",
10
- MoveToPreviousContainer = "move-to-previous-container",
11
- MoveToNextContainer = "move-to-next-container",
5
+ NavPreviousItem = "navPreviousItem",
6
+ NavNextItem = "navNextItem",
7
+ NavToPreviousContainer = "navToPreviousContainer",
8
+ NavToNextContainer = "navToNextContainer",
9
+ MovePreviousItem = "movePreviousItem",
10
+ MoveNextItem = "moveNextItem",
11
+ MoveToPreviousContainer = "moveToPreviousContainer",
12
+ MoveToNextContainer = "moveToNextContainer",
12
13
  Confirm = "confirm",
14
+ Edit = "edit",
13
15
  Exit = "exit",
14
- ToggleHelp = "toggle-help"
16
+ ToggleHelp = "toggleHelp",
17
+ ToggleMove = "toggleMove",
18
+ ToggleCommandLine = "toggleCommandLine",
19
+ CaptureInput = "captureInput",
20
+ EraseInput = "eraseInput",
21
+ AddItem = "addItem",
22
+ GetLastCommandFromHistory = "getLastCommandFromHistory",
23
+ GetNextCommandFromHistory = "getNextCommandFromHistory"
15
24
  }
16
- export declare function getKeyIntent(key: readline.Key, ctx: NavigateCtx): KeyIntent | null;
25
+ export declare function getKeyIntent(key: readline.Key, ctx: NavigateCtx, mode: ModeUnion): KeyIntent | null;
@@ -1,63 +1,123 @@
1
+ import { Mode } from '../model/action-map.model.js';
2
+ import { getCommandLineIntent } from './get-command-line-intent.js';
1
3
  export var KeyIntent;
2
4
  (function (KeyIntent) {
3
- KeyIntent["NavPreviousItem"] = "nav-previous-item";
4
- KeyIntent["NavNextItem"] = "nav-next-item";
5
- KeyIntent["NavToPreviousContainer"] = "nav-to-previous-container";
6
- KeyIntent["NavToNextContainer"] = "nav-to-next-container";
7
- KeyIntent["MovePreviousItem"] = "move-previous-item";
8
- KeyIntent["MoveNextItem"] = "move-next-item";
9
- KeyIntent["MoveToPreviousContainer"] = "move-to-previous-container";
10
- KeyIntent["MoveToNextContainer"] = "move-to-next-container";
5
+ KeyIntent["NavPreviousItem"] = "navPreviousItem";
6
+ KeyIntent["NavNextItem"] = "navNextItem";
7
+ KeyIntent["NavToPreviousContainer"] = "navToPreviousContainer";
8
+ KeyIntent["NavToNextContainer"] = "navToNextContainer";
9
+ KeyIntent["MovePreviousItem"] = "movePreviousItem";
10
+ KeyIntent["MoveNextItem"] = "moveNextItem";
11
+ KeyIntent["MoveToPreviousContainer"] = "moveToPreviousContainer";
12
+ KeyIntent["MoveToNextContainer"] = "moveToNextContainer";
11
13
  KeyIntent["Confirm"] = "confirm";
14
+ KeyIntent["Edit"] = "edit";
12
15
  KeyIntent["Exit"] = "exit";
13
- KeyIntent["ToggleHelp"] = "toggle-help";
16
+ KeyIntent["ToggleHelp"] = "toggleHelp";
17
+ KeyIntent["ToggleMove"] = "toggleMove";
18
+ KeyIntent["ToggleCommandLine"] = "toggleCommandLine";
19
+ KeyIntent["CaptureInput"] = "captureInput";
20
+ KeyIntent["EraseInput"] = "eraseInput";
21
+ KeyIntent["AddItem"] = "addItem";
22
+ KeyIntent["GetLastCommandFromHistory"] = "getLastCommandFromHistory";
23
+ KeyIntent["GetNextCommandFromHistory"] = "getNextCommandFromHistory";
14
24
  })(KeyIntent || (KeyIntent = {}));
15
- export function getKeyIntent(key, ctx) {
16
- const axis = ctx.navigationNode.childrenRenderAxis;
17
- if (key.shift) {
18
- switch (key.name) {
19
- case 'up':
20
- return axis === 'vertical' ? KeyIntent.MovePreviousItem : null;
21
- case 'down':
22
- return axis === 'vertical' ? KeyIntent.MoveNextItem : null;
23
- case 'left':
24
- return axis === 'horizontal'
25
- ? KeyIntent.MovePreviousItem
26
- : ctx.navigationNode.enableChildNavigationAcrossContainers
27
- ? KeyIntent.MoveToPreviousContainer
28
- : null;
29
- case 'right':
30
- return axis === 'horizontal'
31
- ? KeyIntent.MoveNextItem
32
- : ctx.navigationNode.enableChildNavigationAcrossContainers
33
- ? KeyIntent.MoveToNextContainer
34
- : null;
35
- default:
36
- return null;
37
- }
38
- }
25
+ function getDir(key) {
39
26
  switch (key.name) {
27
+ // arrows
28
+ case 'up':
29
+ case 'down':
30
+ case 'left':
31
+ case 'right':
32
+ return key.name;
33
+ // vim
34
+ case 'k':
35
+ return 'up';
36
+ case 'j':
37
+ return 'down';
40
38
  case 'h':
41
- return KeyIntent.ToggleHelp;
39
+ return 'left';
40
+ case 'l':
41
+ return 'right';
42
+ default:
43
+ return null;
44
+ }
45
+ }
46
+ function mapDirectionalIntent(dir, axis, enableAcrossContainers, intents) {
47
+ switch (dir) {
42
48
  case 'up':
43
- return axis === 'vertical' ? KeyIntent.NavPreviousItem : null;
49
+ return axis === 'vertical' ? intents.prevItem : null;
44
50
  case 'down':
45
- return axis === 'vertical' ? KeyIntent.NavNextItem : null;
51
+ return axis === 'vertical' ? intents.nextItem : null;
46
52
  case 'left':
47
53
  return axis === 'horizontal'
48
- ? KeyIntent.NavPreviousItem
49
- : ctx.navigationNode.enableChildNavigationAcrossContainers
50
- ? KeyIntent.NavToPreviousContainer
54
+ ? intents.prevItem
55
+ : enableAcrossContainers
56
+ ? intents.prevContainer
51
57
  : null;
52
58
  case 'right':
53
59
  return axis === 'horizontal'
54
- ? KeyIntent.NavNextItem
55
- : ctx.navigationNode.enableChildNavigationAcrossContainers
56
- ? KeyIntent.NavToNextContainer
60
+ ? intents.nextItem
61
+ : enableAcrossContainers
62
+ ? intents.nextContainer
57
63
  : null;
64
+ }
65
+ }
66
+ export function getKeyIntent(key, ctx, mode) {
67
+ if (key.sequence === ':') {
68
+ return KeyIntent.ToggleCommandLine;
69
+ }
70
+ if (mode === Mode.COMMAND_LINE) {
71
+ return getCommandLineIntent(key);
72
+ }
73
+ const axis = ctx.navigationNode.childrenRenderAxis;
74
+ const enableAcrossContainers = ctx.navigationNode.enableChildNavigationAcrossContainers;
75
+ if (key.name === 'escape' && mode === Mode.HELP) {
76
+ return KeyIntent.ToggleHelp;
77
+ }
78
+ // Hard exits
79
+ if (key.ctrl && key.name === 'c')
80
+ return KeyIntent.Exit;
81
+ if (key.name === 'escape')
82
+ return KeyIntent.Exit;
83
+ // Move mode
84
+ if (mode === Mode.MOVE) {
85
+ if (key.name === 'y')
86
+ return KeyIntent.ToggleMove;
87
+ const dir = getDir(key);
88
+ if (!dir)
89
+ return null;
90
+ return mapDirectionalIntent(dir, axis, Boolean(enableAcrossContainers), {
91
+ prevItem: KeyIntent.MovePreviousItem,
92
+ nextItem: KeyIntent.MoveNextItem,
93
+ prevContainer: KeyIntent.MoveToPreviousContainer,
94
+ nextContainer: KeyIntent.MoveToNextContainer,
95
+ });
96
+ }
97
+ // Normal mode
98
+ if (key.name === 'y')
99
+ return KeyIntent.ToggleMove;
100
+ // Edit (vim-ish)
101
+ if (key.name === 'i')
102
+ return KeyIntent.Edit;
103
+ // Navigation (arrows + vim hjkl)
104
+ const dir = getDir(key);
105
+ if (dir) {
106
+ return mapDirectionalIntent(dir, axis, Boolean(enableAcrossContainers), {
107
+ prevItem: KeyIntent.NavPreviousItem,
108
+ nextItem: KeyIntent.NavNextItem,
109
+ prevContainer: KeyIntent.NavToPreviousContainer,
110
+ nextContainer: KeyIntent.NavToNextContainer,
111
+ });
112
+ }
113
+ // Actions
114
+ switch (key.name) {
115
+ case 'a':
116
+ return KeyIntent.AddItem;
58
117
  case 'return':
59
- return KeyIntent.Confirm;
60
118
  case 'e':
119
+ return KeyIntent.Confirm;
120
+ case 'q':
61
121
  return KeyIntent.Exit;
62
122
  default:
63
123
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epiq",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "license": "MIT",
5
5
  "bin": "dist/cli.js",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "build": "tsc",
13
13
  "dev": "tsc --watch",
14
14
  "test": "prettier --check . && xo && ava",
15
- "execute": "node dist/cli.js"
15
+ "start": "node dist/cli.js"
16
16
  },
17
17
  "files": [
18
18
  "dist"
@@ -1,11 +0,0 @@
1
- import { ActionMap } from '../../navigation/model/action-map.model.js';
2
- import { NavigateCtx } from '../../navigation/model/navigation-ctx.model.js';
3
- import { BoardItemTypes } from '../model/board.model.js';
4
- type BoardActionMap = ActionMap<{
5
- [BoardItemTypes.BOARD]: [NavigateCtx];
6
- [BoardItemTypes.SWIMLANE]: [NavigateCtx];
7
- [BoardItemTypes.TICKET_LIST_ITEM]: [NavigateCtx];
8
- [BoardItemTypes.TICKET]: [NavigateCtx];
9
- }>;
10
- export declare const BoardActions: BoardActionMap;
11
- export {};
@@ -1,11 +0,0 @@
1
- import { BoardItemTypes } from '../model/board.model.js';
2
- import { moveAcrossParents, moveWithinParent } from './move-actions-routes.js';
3
- export const BoardActions = {
4
- [BoardItemTypes.BOARD]: [],
5
- [BoardItemTypes.SWIMLANE]: [...moveWithinParent],
6
- [BoardItemTypes.TICKET_LIST_ITEM]: [
7
- ...moveWithinParent,
8
- ...moveAcrossParents,
9
- ],
10
- [BoardItemTypes.TICKET]: [],
11
- };
@@ -1,4 +0,0 @@
1
- import { ActionEntry } from '../../navigation/model/action-map.model.js';
2
- import { NavigateCtx } from '../../navigation/model/navigation-ctx.model.js';
3
- export declare const moveWithinParent: ActionEntry<[NavigateCtx]>[];
4
- export declare const moveAcrossParents: ActionEntry<[NavigateCtx]>[];
@@ -1,31 +0,0 @@
1
- import { Mode } from '../../navigation/model/action-map.model.js';
2
- import { KeyIntent } from '../../navigation/utils/key-intent.js';
3
- import { moveChildNextWithinParent, moveChildPreviousWithinParent, moveChildToNextParent, moveChildToPreviousParent, } from './move-actions.js';
4
- export const moveWithinParent = [
5
- {
6
- mode: Mode.DEFAULT,
7
- description: '[SHIFT + ARROW KEYS] Move item',
8
- },
9
- {
10
- intent: KeyIntent.MovePreviousItem,
11
- mode: Mode.DEFAULT,
12
- action: moveChildPreviousWithinParent,
13
- },
14
- {
15
- intent: KeyIntent.MoveNextItem,
16
- mode: Mode.DEFAULT,
17
- action: moveChildNextWithinParent,
18
- },
19
- ];
20
- export const moveAcrossParents = [
21
- {
22
- intent: KeyIntent.MoveToNextContainer,
23
- mode: Mode.DEFAULT,
24
- action: moveChildToNextParent,
25
- },
26
- {
27
- intent: KeyIntent.MoveToPreviousContainer,
28
- mode: Mode.DEFAULT,
29
- action: moveChildToPreviousParent,
30
- },
31
- ];
@@ -1,5 +0,0 @@
1
- import { NavigateCtx } from '../../navigation/model/navigation-ctx.model.js';
2
- export declare const moveChildToNextParent: (ctx: NavigateCtx) => void;
3
- export declare const moveChildToPreviousParent: (ctx: NavigateCtx) => void;
4
- export declare const moveChildPreviousWithinParent: (ctx: NavigateCtx) => void;
5
- export declare const moveChildNextWithinParent: (ctx: NavigateCtx) => void;
@@ -1,9 +0,0 @@
1
- import { ActionMap } from '../navigation/model/action-map.model.js';
2
- import { NavigateCtx } from '../navigation/model/navigation-ctx.model.js';
3
- type BoardActionMap = ActionMap<{
4
- BOARD: [NavigateCtx];
5
- SWIMLANE: [NavigateCtx];
6
- TICKET: [NavigateCtx];
7
- }>;
8
- export declare const BoardActions: BoardActionMap;
9
- export {};
@@ -1,7 +0,0 @@
1
- import { BoardItemTypes } from './model/board.model.js';
2
- import { moveAcrossParents, moveWithinParent, } from './actions/move-actions-routes.js';
3
- export const BoardActions = {
4
- [BoardItemTypes.BOARD]: [],
5
- [BoardItemTypes.SWIMLANE]: [...moveWithinParent],
6
- [BoardItemTypes.TICKET]: [...moveWithinParent, ...moveAcrossParents],
7
- };
@@ -1,4 +0,0 @@
1
- import { ActionEntry } from '../navigation/model/action-map.model.js';
2
- import { NavigateCtx } from '../navigation/model/navigation-ctx.model.js';
3
- export declare const moveWithinParent: ActionEntry<[NavigateCtx]>[];
4
- export declare const moveAcrossParents: ActionEntry<[NavigateCtx]>[];
@@ -1,31 +0,0 @@
1
- import { Mode } from '../navigation/model/action-map.model.js';
2
- import { KeyIntent } from '../navigation/utils/key-intent.js';
3
- import { moveChildNextWithinParent, moveChildPreviousWithinParent, moveChildToNextParent, moveChildToPreviousParent, } from './move-actions.js';
4
- export const moveWithinParent = [
5
- {
6
- mode: Mode.DEFAULT,
7
- description: '[SHIFT + ARROW KEYS] Move item',
8
- },
9
- {
10
- intent: KeyIntent.MovePreviousItem,
11
- mode: Mode.DEFAULT,
12
- action: moveChildPreviousWithinParent,
13
- },
14
- {
15
- intent: KeyIntent.MoveNextItem,
16
- mode: Mode.DEFAULT,
17
- action: moveChildNextWithinParent,
18
- },
19
- ];
20
- export const moveAcrossParents = [
21
- {
22
- intent: KeyIntent.MoveToNextContainer,
23
- mode: Mode.DEFAULT,
24
- action: moveChildToNextParent,
25
- },
26
- {
27
- intent: KeyIntent.MoveToPreviousContainer,
28
- mode: Mode.DEFAULT,
29
- action: moveChildToPreviousParent,
30
- },
31
- ];
@@ -1,5 +0,0 @@
1
- import { NavigateCtx } from '../navigation/model/navigation-ctx.model.js';
2
- export declare const moveChildToNextParent: (ctx: NavigateCtx) => void;
3
- export declare const moveChildToPreviousParent: (ctx: NavigateCtx) => void;
4
- export declare const moveChildPreviousWithinParent: (ctx: NavigateCtx) => void;
5
- export declare const moveChildNextWithinParent: (ctx: NavigateCtx) => void;
@@ -1,49 +0,0 @@
1
- function moveItemInArray({ array, from, to, }) {
2
- if (from < 0 || from >= array.length || to < 0 || to >= array.length)
3
- return;
4
- const [item] = array.splice(from, 1);
5
- if (item)
6
- array.splice(to, 0, item);
7
- }
8
- function moveNodeToSiblingContainer(ctx, direction) {
9
- const ancestors = ctx.breadCrumb;
10
- const parent = ancestors.at(-1);
11
- const grandParent = ancestors.at(-2);
12
- if (!parent || !grandParent)
13
- return;
14
- const parentIndex = grandParent.children.findIndex(x => x.id === parent.id);
15
- const targetIndex = parentIndex + direction;
16
- if (parentIndex < 0 ||
17
- targetIndex < 0 ||
18
- targetIndex >= grandParent.children.length)
19
- return;
20
- const sibling = grandParent.children[targetIndex];
21
- if (!sibling)
22
- return;
23
- if (!sibling?.children?.length && !Array.isArray(sibling.children))
24
- return;
25
- const currentIndex = ctx._selectedIndex;
26
- if (currentIndex < 0 || currentIndex >= parent.children.length)
27
- return;
28
- const [node] = parent.children.splice(currentIndex, 1);
29
- sibling.children.push(node);
30
- const newBreadCrumb = [...ctx.breadCrumb.slice(0, -1), sibling];
31
- const newIndex = sibling.children.length - 1;
32
- ctx.reInvokeNavigate(newIndex, newBreadCrumb);
33
- }
34
- export const moveChildToNextParent = (ctx) => moveNodeToSiblingContainer(ctx, 1);
35
- export const moveChildToPreviousParent = (ctx) => moveNodeToSiblingContainer(ctx, -1);
36
- function moveChildWithinParent(ctx, direction) {
37
- const from = ctx._selectedIndex;
38
- const to = from + direction;
39
- if (to < 0 || to >= ctx.navigationNode.children.length)
40
- return;
41
- moveItemInArray({
42
- array: ctx.navigationNode.children,
43
- from,
44
- to,
45
- });
46
- ctx.select(to);
47
- }
48
- export const moveChildPreviousWithinParent = (ctx) => moveChildWithinParent(ctx, -1);
49
- export const moveChildNextWithinParent = (ctx) => moveChildWithinParent(ctx, 1);
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { Board } from '../lib/types/board.model.js';
3
- export declare const BoardUI: React.FC<{
4
- board: Board;
5
- swimlaneWidth: number;
6
- }>;
@@ -1,15 +0,0 @@
1
- import { Box, Text, useApp, useInput } from 'ink';
2
- import React from 'react';
3
- import { SwimlaneUI } from './Swimlane.js';
4
- export const BoardUI = ({ board, swimlaneWidth, }) => {
5
- const { exit } = useApp();
6
- useInput((input, key) => {
7
- if (key.escape || input === 'q') {
8
- exit();
9
- }
10
- });
11
- return (React.createElement(Box, { flexDirection: "column" },
12
- React.createElement(Text, null, board.name.toUpperCase()),
13
- React.createElement(Box, { flexDirection: "row" },
14
- React.createElement(SwimlaneUI, { items: board.children, width: swimlaneWidth }))));
15
- };
@@ -1,21 +0,0 @@
1
- import { Box, Text } from 'ink';
2
- import { navigationState } from '../lib/state.js';
3
- import React from 'react';
4
- export const HelpUI = ({ width }) => (React.createElement(Box, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, borderColor: "gray", borderStyle: "round", width: width },
5
- React.createElement(Box, null,
6
- React.createElement(Text, { color: "gray" }, "Toggle help with \"H\"")),
7
- navigationState.viewHelp
8
- ? navigationState.availableActions
9
- .filter(action => Boolean(action.description))
10
- .filter(x => x.mode === navigationState.mode)
11
- .map((action, index) => {
12
- const [leftRaw, rightRaw] = action.description.split(']');
13
- const left = leftRaw?.replace('[', '');
14
- const right = rightRaw?.trim(); // no extra space
15
- return (React.createElement(Box, { paddingLeft: 1, key: index, flexDirection: "row" },
16
- React.createElement(Box, { width: 20 },
17
- React.createElement(Text, { color: "gray" }, right)),
18
- React.createElement(Box, { flexGrow: 1 },
19
- React.createElement(Text, { color: "gray" }, left))));
20
- })
21
- : null));
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { Swimlane } from '../lib/types/board.model.js';
3
- type Props = {
4
- items: Swimlane[];
5
- width: number;
6
- };
7
- export declare const SwimlaneUI: React.FC<Props>;
8
- export {};
@@ -1,10 +0,0 @@
1
- import { Box, Text } from 'ink';
2
- import React from 'react';
3
- import { TicketListItemUI } from './TicketListItem.js';
4
- export const SwimlaneUI = ({ items, width }) => {
5
- return (React.createElement(Box, { flexDirection: "row" }, items.map((lane, index) => (React.createElement(React.Fragment, { key: index },
6
- React.createElement(Box, { flexDirection: "column", width: width, borderStyle: "round", borderColor: lane.isSelected ? 'green' : 'gray', paddingRight: 1, paddingLeft: 1, paddingBottom: 1, minHeight: 15 },
7
- React.createElement(Box, { borderStyle: "round", borderColor: 'gray', justifyContent: "center" },
8
- React.createElement(Text, { bold: true }, lane.name)),
9
- lane.children.map((ticket, index) => (React.createElement(TicketListItemUI, { key: index, width: width, ticket: ticket })))))))));
10
- };
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { Ticket } from '../lib/types/board.model.js';
3
- export declare const TicketListItemUI: React.FC<{
4
- width: number;
5
- ticket: Ticket;
6
- }>;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { Box, Text } from 'ink';
3
- import { navigationState } from '../lib/state.js';
4
- const truncateWithEllipsis = (str, width) => str.length >= width ? str.slice(0, width - 3) + '...' : str;
5
- export const TicketListItemUI = ({ width, ticket: { name, id, isSelected }, }) => (React.createElement(Box, { borderBottom: true },
6
- React.createElement(Text, { color: isSelected && navigationState.mode === 'move'
7
- ? 'white'
8
- : isSelected
9
- ? 'green'
10
- : navigationState.mode === 'move'
11
- ? 'gray'
12
- : 'white' }, truncateWithEllipsis(id + ' - ' + name, width - 5))));
@@ -1,9 +0,0 @@
1
- import { NavigateCtx } from '../navigation-context.js';
2
- import { ActionMap } from '../types/action-map.model.js';
3
- type BoardActionMap = ActionMap<{
4
- BOARD: [NavigateCtx];
5
- SWIMLANE: [NavigateCtx];
6
- TICKET: [NavigateCtx];
7
- }>;
8
- export declare const BoardActions: BoardActionMap;
9
- export {};
@@ -1,7 +0,0 @@
1
- import { BoardItemTypes } from '../types/board.model.js';
2
- import { moveAcrossParents, moveWithinParent } from './move-actions.js';
3
- export const BoardActions = {
4
- [BoardItemTypes.BOARD]: [],
5
- [BoardItemTypes.SWIMLANE]: [...moveWithinParent],
6
- [BoardItemTypes.TICKET]: [...moveWithinParent, ...moveAcrossParents],
7
- };
@@ -1,43 +0,0 @@
1
- import { moveItemInArray } from '../utils/array-utils.js';
2
- function moveNodeToSiblingContainer(ctx, direction) {
3
- const ancestors = ctx.breadCrumb;
4
- const parent = ancestors.at(-1);
5
- const grandParent = ancestors.at(-2);
6
- if (!parent || !grandParent)
7
- return;
8
- const parentIndex = grandParent.children.findIndex(x => x.id === parent.id);
9
- const targetIndex = parentIndex + direction;
10
- if (parentIndex < 0 ||
11
- targetIndex < 0 ||
12
- targetIndex >= grandParent.children.length)
13
- return;
14
- const sibling = grandParent.children[targetIndex];
15
- if (!sibling)
16
- return;
17
- if (!sibling?.children?.length && !Array.isArray(sibling.children))
18
- return;
19
- const currentIndex = ctx._selectedIndex;
20
- if (currentIndex < 0 || currentIndex >= parent.children.length)
21
- return;
22
- const [node] = parent.children.splice(currentIndex, 1);
23
- sibling.children.push(node);
24
- const newBreadCrumb = [...ctx.breadCrumb.slice(0, -1), sibling];
25
- const newIndex = sibling.children.length - 1;
26
- ctx.reInvokeNavigate(newIndex, newBreadCrumb);
27
- }
28
- export const moveChildToNextParent = (ctx) => moveNodeToSiblingContainer(ctx, 1);
29
- export const moveChildToPreviousParent = (ctx) => moveNodeToSiblingContainer(ctx, -1);
30
- function moveChildWithinParent(ctx, direction) {
31
- const from = ctx._selectedIndex;
32
- const to = from + direction;
33
- if (to < 0 || to >= ctx.navigationNode.children.length)
34
- return;
35
- moveItemInArray({
36
- array: ctx.navigationNode.children,
37
- from,
38
- to,
39
- });
40
- ctx.select(to);
41
- }
42
- export const moveChildPreviousWithinParent = (ctx) => moveChildWithinParent(ctx, -1);
43
- export const moveChildNextWithinParent = (ctx) => moveChildWithinParent(ctx, 1);
@@ -1,4 +0,0 @@
1
- import { NavigateCtx } from '../navigation-context.js';
2
- import { ActionEntry } from '../types/action-map.model.js';
3
- export declare const moveWithinParent: ActionEntry<[NavigateCtx]>[];
4
- export declare const moveAcrossParents: ActionEntry<[NavigateCtx]>[];