reslop 0.2.5 → 0.2.6

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 (105) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/LICENSE +1 -1
  3. package/README.md +11 -11
  4. package/bin/reslop.js +3 -8
  5. package/lib/ansi.js +32 -19
  6. package/lib/capabilities.js +8 -8
  7. package/lib/cli.js +40 -74
  8. package/lib/clipboard.js +39 -47
  9. package/lib/dashboard/git.js +128 -0
  10. package/lib/dashboard/model.js +332 -0
  11. package/lib/dashboard/npm.js +193 -0
  12. package/lib/dashboard/tree.js +278 -0
  13. package/lib/deps-diff.js +197 -402
  14. package/lib/deps.js +113 -240
  15. package/lib/detect.js +8 -18
  16. package/lib/diff/align.js +41 -113
  17. package/lib/diff/diff.js +12 -43
  18. package/lib/diff/display.js +25 -36
  19. package/lib/diff/edit.js +6 -20
  20. package/lib/diff/inline.js +76 -144
  21. package/lib/diff/items.js +33 -47
  22. package/lib/diff/parse.js +28 -56
  23. package/lib/diff/patch.js +12 -33
  24. package/lib/diff/unit.js +79 -178
  25. package/lib/editor.js +52 -69
  26. package/lib/files.js +71 -89
  27. package/lib/git-branches.js +254 -416
  28. package/lib/git-deps.js +147 -272
  29. package/lib/git-reword-todo.js +5 -13
  30. package/lib/git-worktree.js +141 -212
  31. package/lib/git.js +21 -49
  32. package/lib/github.js +67 -181
  33. package/lib/gitlab.js +40 -90
  34. package/lib/highlight/bash.js +55 -177
  35. package/lib/highlight/core.js +155 -141
  36. package/lib/highlight/css.js +25 -58
  37. package/lib/highlight/csv.js +19 -37
  38. package/lib/highlight/dart.js +72 -213
  39. package/lib/highlight/dot.js +14 -14
  40. package/lib/highlight/html.js +42 -63
  41. package/lib/highlight/js.js +177 -506
  42. package/lib/highlight/json.js +17 -37
  43. package/lib/highlight/log.js +19 -25
  44. package/lib/highlight/txt.js +7 -10
  45. package/lib/highlight.js +17 -46
  46. package/lib/keys.js +49 -82
  47. package/lib/manifest.js +67 -126
  48. package/lib/npm-commands.js +120 -169
  49. package/lib/remote.js +140 -190
  50. package/lib/render/branches.js +63 -61
  51. package/lib/render/chrome.js +220 -333
  52. package/lib/render/commits.js +160 -361
  53. package/lib/render/dash-activity.js +212 -0
  54. package/lib/render/dash-blocks.js +245 -0
  55. package/lib/render/dash-table.js +290 -0
  56. package/lib/render/dashboard.js +62 -0
  57. package/lib/render/diff.js +123 -258
  58. package/lib/render/files.js +40 -85
  59. package/lib/render/frame.js +78 -117
  60. package/lib/render/notes.js +139 -210
  61. package/lib/render/npm.js +213 -177
  62. package/lib/render/present.js +4 -11
  63. package/lib/render/primitives.js +72 -174
  64. package/lib/render/render.js +5 -14
  65. package/lib/render/report.js +43 -0
  66. package/lib/render/tiles.js +260 -0
  67. package/lib/render/unit.js +15 -31
  68. package/lib/report-model.js +110 -33
  69. package/lib/report-parse.js +56 -37
  70. package/lib/report-render.js +102 -59
  71. package/lib/report-run.js +87 -77
  72. package/lib/report-test.js +221 -99
  73. package/lib/report-tools.js +96 -154
  74. package/lib/review-merge.js +33 -41
  75. package/lib/review.js +68 -129
  76. package/lib/runs.js +225 -0
  77. package/lib/select.js +53 -91
  78. package/lib/session/accessors.js +14 -21
  79. package/lib/session/actions.js +61 -43
  80. package/lib/session/branches.js +166 -222
  81. package/lib/session/change-actions.js +49 -119
  82. package/lib/session/commit.js +274 -355
  83. package/lib/session/compose.js +556 -714
  84. package/lib/session/dashboard.js +385 -0
  85. package/lib/session/dispatch.js +162 -170
  86. package/lib/session/files-pane.js +76 -44
  87. package/lib/session/items.js +6 -17
  88. package/lib/session/lifecycle.js +393 -466
  89. package/lib/session/load.js +1 -14
  90. package/lib/session/navigation.js +2 -2
  91. package/lib/session/npm.js +403 -420
  92. package/lib/session/ops.js +5 -13
  93. package/lib/session/pointer.js +16 -14
  94. package/lib/session/progress.js +39 -30
  95. package/lib/session/review.js +1 -3
  96. package/lib/session/tasks.js +276 -235
  97. package/lib/session/templates.js +51 -59
  98. package/lib/session/terminal.js +85 -132
  99. package/lib/session/view.js +47 -81
  100. package/lib/session/watch.js +196 -212
  101. package/lib/session.js +81 -161
  102. package/lib/update.js +44 -111
  103. package/lib/utilities.js +46 -88
  104. package/lib/wrap.js +29 -55
  105. package/package.json +1 -1
package/lib/select.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  const ansi = require('./ansi.js');
4
-
5
- const { ESC, RESET, THEME, seq, stripAnsi, graphemes, graphemeWidth } = ansi;
6
- const { visibleWidth } = ansi;
4
+ const { ESC, RESET, THEME, seq, fg, bg, stripAnsi, visibleWidth } = ansi;
5
+ const { graphemes, graphemeWidth, firstGrapheme } = ansi;
7
6
 
8
7
  const CSI_FINAL = /[@-~]/;
8
+ const TRUECOLOR = 2;
9
9
 
10
10
  const isRange = (sel) => {
11
11
  if (!sel || !sel.start || !sel.end) return false;
@@ -13,21 +13,16 @@ const isRange = (sel) => {
13
13
  };
14
14
 
15
15
  const ordered = (sel) => {
16
- const start = sel.start;
17
- const end = sel.end;
18
- if (start.y < end.y) return { first: start, last: end };
19
- if (start.y > end.y) return { first: end, last: start };
20
- if (start.x <= end.x) return { first: start, last: end };
21
- return { first: end, last: start };
16
+ const { start, end } = sel;
17
+ const forward = start.y < end.y || (start.y === end.y && start.x <= end.x);
18
+ return forward ? { first: start, last: end } : { first: end, last: start };
22
19
  };
23
20
 
24
21
  const slicePlain = (plain, fromCol, toCol) => {
25
- const parts = graphemes(plain);
26
22
  let col = 0;
27
23
  let out = '';
28
- for (const ch of parts) {
29
- const w = graphemeWidth(ch, col);
30
- const next = col + w;
24
+ for (const ch of graphemes(plain)) {
25
+ const next = col + graphemeWidth(ch, col);
31
26
  if (next > fromCol && col < toCol) out += ch;
32
27
  col = next;
33
28
  if (col >= toCol) break;
@@ -39,10 +34,8 @@ const lineRange = (rowIndex, sel) => {
39
34
  const { first, last } = ordered(sel);
40
35
  const y = rowIndex + 1;
41
36
  if (y < first.y || y > last.y) return null;
42
- let from = 0;
43
- let to = Infinity;
44
- if (y === first.y) from = first.x - 1;
45
- if (y === last.y) to = last.x;
37
+ const from = y === first.y ? first.x - 1 : 0;
38
+ const to = y === last.y ? last.x : Infinity;
46
39
  if (to <= from) return null;
47
40
  return { from, to };
48
41
  };
@@ -61,11 +54,10 @@ const extractText = (rows, sel) => {
61
54
  return lines.join('\n');
62
55
  };
63
56
 
64
- const consumeCsi = (line, i) => {
57
+ const csiEnd = (line, i) => {
65
58
  let j = i + 2;
66
59
  while (j < line.length && !CSI_FINAL.test(line[j])) j += 1;
67
- if (j < line.length) j += 1;
68
- return j;
60
+ return j < line.length ? j + 1 : j;
69
61
  };
70
62
 
71
63
  const parseParams = (body) => {
@@ -74,45 +66,30 @@ const parseParams = (body) => {
74
66
  };
75
67
 
76
68
  const applyRgb = (state, field, params, i) => {
77
- const TRUECOLOR = 2;
78
69
  const isTruecolor = params[i + 1] === TRUECOLOR;
79
- const hasRgb = isTruecolor && i + 4 < params.length;
80
- if (!hasRgb) return 1;
70
+ if (!isTruecolor || i + 4 >= params.length) return 1;
81
71
  state[field] = [params[i + 2], params[i + 3], params[i + 4]];
82
72
  return 5;
83
73
  };
84
74
 
85
- const SGR = {
86
- 0: (state) => {
87
- state.fg = null;
88
- state.bg = null;
89
- return 1;
90
- },
91
- 38: (state, params, i) => applyRgb(state, 'fg', params, i),
92
- 48: (state, params, i) => applyRgb(state, 'bg', params, i),
93
- 39: (state) => {
94
- state.fg = null;
95
- return 1;
96
- },
97
- 49: (state) => {
98
- state.bg = null;
99
- return 1;
100
- },
101
- };
102
-
103
75
  const applySgr = (params, state) => {
104
76
  let i = 0;
105
77
  while (i < params.length) {
106
- const apply = SGR[params[i]];
107
- i += apply ? apply(state, params, i) : 1;
78
+ const code = params[i];
79
+ if (code === 38) {
80
+ i += applyRgb(state, 'fg', params, i);
81
+ continue;
82
+ }
83
+ if (code === 48) {
84
+ i += applyRgb(state, 'bg', params, i);
85
+ continue;
86
+ }
87
+ if (code === 0 || code === 39) state.fg = null;
88
+ if (code === 0 || code === 49) state.bg = null;
89
+ i += 1;
108
90
  }
109
91
  };
110
92
 
111
- const nextGrapheme = (line, index) => {
112
- const parts = graphemes(line.slice(index));
113
- return parts[0] ?? '';
114
- };
115
-
116
93
  const parseCells = (line) => {
117
94
  const cells = [];
118
95
  const state = { fg: null, bg: null };
@@ -120,24 +97,21 @@ const parseCells = (line) => {
120
97
  let i = 0;
121
98
  while (i < line.length) {
122
99
  if (line[i] === ESC && line[i + 1] === '[') {
123
- const n = consumeCsi(line, i);
124
- if (line[n - 1] === 'm') {
125
- const body = line.slice(i + 2, n - 1);
126
- applySgr(parseParams(body), state);
100
+ const end = csiEnd(line, i);
101
+ if (line[end - 1] === 'm') {
102
+ applySgr(parseParams(line.slice(i + 2, end - 1)), state);
127
103
  }
128
- i = n;
104
+ i = end;
129
105
  continue;
130
106
  }
131
107
  if (line[i] === ESC) {
132
108
  i += 1;
133
109
  continue;
134
110
  }
135
- const ch = nextGrapheme(line, i);
111
+ const ch = firstGrapheme(line.slice(i));
136
112
  if (!ch) break;
137
113
  const width = graphemeWidth(ch, col);
138
- const fg = state.fg;
139
- const bg = state.bg;
140
- cells.push({ ch, fg, bg, col, width });
114
+ cells.push({ ch, fg: state.fg, bg: state.bg, col, width });
141
115
  col += width;
142
116
  i += ch.length;
143
117
  }
@@ -146,10 +120,10 @@ const parseCells = (line) => {
146
120
 
147
121
  const rgbKey = (rgb) => (rgb ? `${rgb[0]},${rgb[1]},${rgb[2]}` : '');
148
122
 
149
- const styleSeq = (fg, bg) => {
150
- if (fg && bg) return RESET + seq(fg, bg);
151
- if (fg) return RESET + ansi.fg(fg);
152
- if (bg) return RESET + ansi.bg(bg);
123
+ const styleSeq = (fgRgb, bgRgb) => {
124
+ if (fgRgb && bgRgb) return RESET + seq(fgRgb, bgRgb);
125
+ if (fgRgb) return RESET + fg(fgRgb);
126
+ if (bgRgb) return RESET + bg(bgRgb);
153
127
  return RESET;
154
128
  };
155
129
 
@@ -160,17 +134,15 @@ const overlayRange = (line, fromCol, toCol) => {
160
134
  let out = '';
161
135
  let last = null;
162
136
  for (const cell of cells) {
163
- const next = cell.col + cell.width;
164
- const hit = next > fromCol && cell.col < toCol;
165
- let fg = cell.fg;
166
- let bg = cell.bg;
167
- if (hit) {
168
- fg = cell.bg ?? THEME.ctxBg;
169
- bg = cell.fg ?? THEME.ctxFg;
137
+ let cellFg = cell.fg;
138
+ let cellBg = cell.bg;
139
+ if (cell.col + cell.width > fromCol && cell.col < toCol) {
140
+ cellFg = cell.bg ?? THEME.ctxBg;
141
+ cellBg = cell.fg ?? THEME.ctxFg;
170
142
  }
171
- const key = `${rgbKey(fg)}|${rgbKey(bg)}`;
143
+ const key = `${rgbKey(cellFg)}|${rgbKey(cellBg)}`;
172
144
  if (key !== last) {
173
- out += styleSeq(fg, bg);
145
+ out += styleSeq(cellFg, cellBg);
174
146
  last = key;
175
147
  }
176
148
  out += cell.ch;
@@ -178,35 +150,29 @@ const overlayRange = (line, fromCol, toCol) => {
178
150
  return out;
179
151
  };
180
152
 
181
- const selectionOf = (source) => {
153
+ const editorSelection = (view) => {
154
+ const source = view?.compose || view?.codeOverlay;
182
155
  if (!source || typeof source.anchor !== 'number') return null;
183
156
  const cursor = source.cursor ?? 0;
184
157
  if (source.anchor === cursor) return null;
185
158
  return { anchor: source.anchor, cursor };
186
159
  };
187
160
 
188
- const editorSelection = (view) => {
189
- if (!view) return null;
190
- if (view.compose) return selectionOf(view.compose);
191
- return selectionOf(view.codeOverlay);
192
- };
193
-
194
161
  const spanCols = (hit, lo, hi) => {
195
162
  const start = hit.start ?? 0;
196
163
  const from = Math.max(lo, start);
197
164
  const to = Math.min(hi, hit.limit ?? start);
198
165
  if (to <= from) return null;
199
166
  const text = hit.text ?? '';
200
- const head = Math.max(0, from - start);
201
- const tail = Math.max(0, to - start);
202
- const c0 = visibleWidth(text.slice(0, head));
203
- const c1 = visibleWidth(text.slice(0, tail));
167
+ const c0 = visibleWidth(text.slice(0, Math.max(0, from - start)));
168
+ const c1 = visibleWidth(text.slice(0, Math.max(0, to - start)));
204
169
  const scroll = hit.scroll ?? 0;
205
- const room = Math.max(0, (hit.x1 ?? hit.textX ?? 1) - (hit.textX ?? 1));
170
+ const textX = hit.textX ?? 1;
171
+ const room = Math.max(0, (hit.x1 ?? textX) - textX);
206
172
  const vis0 = Math.max(c0, scroll);
207
173
  const vis1 = Math.min(c1, scroll + room);
208
174
  if (vis1 <= vis0) return null;
209
- const origin = (hit.textX ?? 1) - 1;
175
+ const origin = textX - 1;
210
176
  return { from: origin + vis0 - scroll, to: origin + vis1 - scroll };
211
177
  };
212
178
 
@@ -220,9 +186,8 @@ const markEditorSelection = (rows, view, hits, color) => {
220
186
  for (const hit of hits) {
221
187
  if (!hit.live || !hit.y) continue;
222
188
  const range = spanCols(hit, lo, hi);
223
- if (!range) continue;
224
189
  const i = hit.y - 1;
225
- if (i < 0 || i >= next.length) continue;
190
+ if (!range || i < 0 || i >= next.length) continue;
226
191
  next[i] = overlayRange(next[i], range.from, range.to);
227
192
  }
228
193
  return next;
@@ -230,13 +195,10 @@ const markEditorSelection = (rows, view, hits, color) => {
230
195
 
231
196
  const overlayRows = (rows, sel) => {
232
197
  if (!isRange(sel)) return rows;
233
- const { length } = rows;
234
- const next = new Array(length);
235
- for (let i = 0; i < length; i++) {
198
+ return rows.map((row, i) => {
236
199
  const range = lineRange(i, sel);
237
- next[i] = range ? overlayRange(rows[i], range.from, range.to) : rows[i];
238
- }
239
- return next;
200
+ return range ? overlayRange(row, range.from, range.to) : row;
201
+ });
240
202
  };
241
203
 
242
204
  module.exports = {
@@ -1,33 +1,26 @@
1
1
  'use strict';
2
2
 
3
- const bindAlias = (target, name, get, set) => {
4
- const desc = { configurable: true, enumerable: true, get };
5
- if (set) desc.set = set;
6
- Object.defineProperty(target, name, desc);
7
- };
8
-
9
3
  const bindAccessors = (target, owner, names) => {
10
4
  for (const name of names) {
11
- const get = () => owner[name];
12
- const set = (value) => {
13
- owner[name] = value;
14
- };
15
- bindAlias(target, name, get, set);
5
+ Object.defineProperty(target, name, {
6
+ configurable: true,
7
+ enumerable: true,
8
+ get: () => owner[name],
9
+ set: (value) => {
10
+ owner[name] = value;
11
+ },
12
+ });
16
13
  }
17
14
  };
18
15
 
19
16
  const bindGetters = (target, owner, names) => {
20
17
  for (const name of names) {
21
- bindAlias(target, name, () => owner[name]);
18
+ Object.defineProperty(target, name, {
19
+ configurable: true,
20
+ enumerable: true,
21
+ get: () => owner[name],
22
+ });
22
23
  }
23
24
  };
24
25
 
25
- const stateView = (state, methods, writable = [], readonly = []) => {
26
- const descriptors = Object.getOwnPropertyDescriptors(methods);
27
- const view = Object.defineProperties({}, descriptors);
28
- bindAccessors(view, state, writable);
29
- bindGetters(view, state, readonly);
30
- return view;
31
- };
32
-
33
- module.exports = { bindAccessors, bindGetters, bindAlias, stateView };
26
+ module.exports = { bindAccessors, bindGetters };
@@ -24,50 +24,75 @@ const ACTION_IDS = Object.keys(ACTIONS);
24
24
 
25
25
  const BRANCH_ACTIONS = {
26
26
  newBranch: ['n'],
27
- rebase: ['r'],
28
- drop: ['d'],
27
+ rebase: ['e'],
28
+ drop: ['delete'],
29
29
  pull: ['p'],
30
30
  push: ['s'],
31
31
  };
32
32
 
33
33
  const COMMIT_ACTIONS = {
34
34
  amend: ['a'],
35
- apply: ['a'],
36
- reword: ['r'],
37
- fixup: ['f'],
38
- drop: ['d'],
35
+ apply: ['p'],
36
+ reword: ['e'],
37
+ fixup: ['x'],
38
+ drop: ['delete'],
39
39
  view: ['v'],
40
- pull: ['p'],
41
- push: ['s'],
42
40
  };
43
41
 
44
42
  const NPM_ACTIONS = {
45
43
  npm: ['n'],
46
44
  npmEdit: ['e'],
47
- npmNew: ['n'],
48
- npmDrop: ['d'],
49
- npmLogs: ['c'],
45
+ npmNew: ['i'],
46
+ npmDrop: ['delete'],
47
+ npmLogs: ['l'],
50
48
  npmStop: ['escape'],
51
49
  npmVerbose: ['v'],
52
50
  npmRerun: ['r'],
53
51
  };
54
52
 
53
+ const DASH_ACTIONS = {
54
+ dashFiles: ['f'],
55
+ dashDiffs: ['d'],
56
+ dashTasks: ['t'],
57
+ dashBranches: ['b'],
58
+ dashCommits: ['c'],
59
+ dashRun: ['r'],
60
+ dashNpm: ['n'],
61
+ };
62
+ const DASH_IDS = Object.keys(DASH_ACTIONS);
63
+ const DASH_BLOCKS = {
64
+ dashFiles: 'files',
65
+ dashDiffs: 'diffs',
66
+ dashCommits: 'commits',
67
+ dashBranches: 'branches',
68
+ dashNpm: 'npm',
69
+ dashRun: 'run',
70
+ dashTasks: 'tasks',
71
+ };
72
+ const DASH_ALLOWED = [...DASH_IDS, 'quit', 'theme'];
73
+ const DASH_HIDDEN = ACTION_IDS.filter((id) => id !== 'quit');
74
+
55
75
  const ACTION_HOT = {
56
76
  prev: '←',
57
77
  next: '→',
78
+ drop: 'del',
79
+ npmDrop: 'del',
58
80
  npmStop: 'esc',
59
81
  };
60
82
 
61
83
  const ACTION_LABEL = {
84
+ ...DASH_BLOCKS,
62
85
  revert: 'drop',
63
86
  check: 'x',
64
87
  layout: 'mode',
65
88
  tasks: 'tasks',
66
89
  view: 'view',
67
90
  code: 'edit',
91
+ reword: 'edit',
92
+ drop: 'delete',
68
93
  newBranch: 'new',
69
94
  npmEdit: 'edit',
70
- npmNew: 'new',
95
+ npmNew: 'insert',
71
96
  npmDrop: 'delete',
72
97
  npmLogs: 'cleanup',
73
98
  npmStop: 'esc',
@@ -86,9 +111,8 @@ const DIFF_DISABLED = [
86
111
  'push',
87
112
  'file',
88
113
  'diff',
89
- 'ignore',
90
114
  ];
91
- const UNIT_DISABLED = [...DIFF_DISABLED, 'layout'];
115
+ const UNIT_DISABLED = [...DIFF_DISABLED, 'layout', 'ignore'];
92
116
  const FILES_DISABLED = ['layout', 'feedback', 'code'];
93
117
  const FILES_HIDDEN = [
94
118
  ...FILES_DISABLED,
@@ -98,6 +122,8 @@ const FILES_HIDDEN = [
98
122
  'commit',
99
123
  'file',
100
124
  'diff',
125
+ 'tasks',
126
+ 'branch',
101
127
  ];
102
128
  const FILES_GIT_DISABLED = ['add', 'unstage', 'revert', 'ignore'];
103
129
  const FILES_TASKS_DISABLED = [...FILES_GIT_DISABLED, ...FILES_DISABLED];
@@ -188,7 +214,7 @@ const disabledActions = (pane, item) => {
188
214
  return [...COMMITS_DISABLED, ...commitWriteDisabled(item)];
189
215
  }
190
216
  if (pane === 'npm') return NPM_DISABLED;
191
- if (onTodos) return TASKS_DISABLED;
217
+ if (pane === 'tasks' || onTodos) return TASKS_DISABLED;
192
218
  return [...DIFF_DISABLED, ...diffGitDisabled(item)];
193
219
  };
194
220
 
@@ -223,25 +249,26 @@ const keysForActions = (actions) => {
223
249
  };
224
250
 
225
251
  const PANE_ONLY = ['branch', 'file', 'diff'];
226
- const FILES_KEYS = keysForActions({
227
- branch: ACTIONS.branch,
228
- pull: BRANCH_ACTIONS.pull,
229
- push: BRANCH_ACTIONS.push,
230
- npm: NPM_ACTIONS.npm,
231
- });
252
+ const REVIEW_DROP = { d: 'revert' };
232
253
  const BRANCH_KEYS = keysForActions(BRANCH_ACTIONS);
233
- const COMMIT_KEYS = keysForActions(COMMIT_ACTIONS);
254
+ const COMMIT_KEYS = { ...keysForActions(COMMIT_ACTIONS), c: 'commit' };
234
255
  const NPM_KEYS = {
235
256
  e: 'npmEdit',
236
- n: 'npmNew',
237
- d: 'npmDrop',
238
- c: 'npmLogs',
257
+ i: 'npmNew',
258
+ delete: 'npmDrop',
259
+ l: 'npmLogs',
239
260
  };
261
+ const DASH_KEYS = keysForActions(DASH_ACTIONS);
262
+ const SCREEN_KEYS = DASH_KEYS;
240
263
  const PANE_KEYS = {
241
- files: FILES_KEYS,
264
+ dashboard: DASH_KEYS,
265
+ files: REVIEW_DROP,
266
+ diff: REVIEW_DROP,
267
+ unit: REVIEW_DROP,
242
268
  branches: BRANCH_KEYS,
243
269
  commits: COMMIT_KEYS,
244
270
  npm: NPM_KEYS,
271
+ tasks: { delete: 'drop' },
245
272
  };
246
273
 
247
274
  const KEY_TO_ACTION = {
@@ -254,16 +281,13 @@ const KEY_TO_ACTION = {
254
281
  ...HIDDEN_KEYS,
255
282
  };
256
283
 
257
- const actionFromKey = (key, pane, fileScope) => {
284
+ const actionFromKey = (key, pane) => {
258
285
  if (LIST_PANES.includes(pane) && (key === 'left' || key === 'right')) {
259
286
  return null;
260
287
  }
261
288
  const paneKeys = PANE_KEYS[pane];
262
289
  if (paneKeys && paneKeys[key]) return paneKeys[key];
263
- if (pane === 'files') {
264
- if (key === 'f' && fileScope !== 'file') return 'file';
265
- if (key === 'd' && fileScope === 'file') return 'diff';
266
- }
290
+ if (pane && SCREEN_KEYS[key]) return SCREEN_KEYS[key];
267
291
  return KEY_TO_ACTION[key] ?? null;
268
292
  };
269
293
 
@@ -272,11 +296,10 @@ const actionKeys = (id) =>
272
296
  BRANCH_ACTIONS[id] ??
273
297
  COMMIT_ACTIONS[id] ??
274
298
  NPM_ACTIONS[id] ??
299
+ DASH_ACTIONS[id] ??
275
300
  [];
276
301
 
277
- const actionHot = (id) => ACTION_HOT[id] ?? actionKeys(id)[0];
278
-
279
- const actionLetter = actionHot;
302
+ const actionLetter = (id) => ACTION_HOT[id] ?? actionKeys(id)[0];
280
303
 
281
304
  const buttonWord = (id) => {
282
305
  const word = ACTION_LABEL[id] ?? ACTION_HOT[id] ?? id;
@@ -344,13 +367,6 @@ const confirmKey = (mode, key) => {
344
367
  return spec.keys[norm] ?? null;
345
368
  };
346
369
 
347
- const applyConfirm = (mode, key, handlers) => {
348
- const action = confirmKey(mode, key);
349
- if (!action) return;
350
- const handler = handlers[action];
351
- if (handler) handler();
352
- };
353
-
354
370
  const confirmPrefix = (spec, view) => {
355
371
  if (typeof spec.prefix === 'function') return spec.prefix(view);
356
372
  return spec.prefix ?? '';
@@ -361,6 +377,10 @@ const promptFromChoices = (choices) =>
361
377
 
362
378
  module.exports = {
363
379
  LIST_PANES,
380
+ DASH_IDS,
381
+ DASH_BLOCKS,
382
+ DASH_ALLOWED,
383
+ DASH_HIDDEN,
364
384
  ACTIONS,
365
385
  ACTION_IDS,
366
386
  BRANCH_ACTIONS,
@@ -381,13 +401,11 @@ module.exports = {
381
401
  commitGitDisabled,
382
402
  isFixupCommit,
383
403
  actionFromKey,
384
- actionHot,
385
404
  actionLetter,
386
405
  buttonWord,
387
406
  CONFIRM,
388
407
  CONFIRM_MODE,
389
408
  confirmKey,
390
- applyConfirm,
391
409
  confirmPrefix,
392
410
  promptFromChoices,
393
411
  };