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
@@ -6,17 +6,8 @@ const QUIET_KIND = new Set(['staged', 'unstaged']);
6
6
  const pickRepoWrite = (repo, name, uiOpen) => {
7
7
  const asyncFn = repo[`${name}Async`];
8
8
  const allowAsync = uiOpen === true || ASYNC_WITHOUT_UI.includes(name);
9
- if (allowAsync && typeof asyncFn === 'function') {
10
- return {
11
- async: true,
12
- write: (top, ...args) => asyncFn(top, ...args),
13
- };
14
- }
15
- const syncFn = repo[name];
16
- return {
17
- async: false,
18
- write: (top, ...args) => syncFn(top, ...args),
19
- };
9
+ const isAsync = allowAsync && typeof asyncFn === 'function';
10
+ return { async: isAsync, write: isAsync ? asyncFn : repo[name] };
20
11
  };
21
12
 
22
13
  const showsBusy = (kind) => Boolean(kind) && !QUIET_KIND.has(kind);
@@ -86,7 +77,6 @@ class ChangeQueue {
86
77
 
87
78
  startReload() {
88
79
  const { ui } = this;
89
- if (typeof ui.reloadAfterChange !== 'function') return void ui.paint();
90
80
  this.reloading = true;
91
81
  ui.reloadAfterChange(() => {
92
82
  this.reloading = false;
@@ -231,15 +221,17 @@ class OpsRunner {
231
221
  this.finishBusy(done, after);
232
222
  }
233
223
 
234
- runWrite(name, args, kind, done, after) {
224
+ runWrite(name, args, kind, done, after, leave = null) {
235
225
  const { ui } = this;
236
226
  const picked = pickRepoWrite(ui.repo, name, ui.uiOpen);
237
227
  const write = (top) => picked.write(top, ...args);
238
228
  if (picked.async) {
229
+ if (leave) leave();
239
230
  const refresh = () => after({ doneStatus: done });
240
231
  return void this.runBusy(kind, done, write, refresh);
241
232
  }
242
233
  if (!this.runRepo(done, write)) return;
234
+ if (leave) leave();
243
235
  after({});
244
236
  if (!ui.status) ui.status = done;
245
237
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  const select = require('../select.js');
4
4
  const editClick = require('./edit-click.js');
5
+ const filesPane = require('./files-pane.js');
5
6
  const { extractText, isRange } = select;
6
7
  const keys = require('../keys.js');
7
8
  const { hitAction } = keys;
@@ -94,16 +95,21 @@ const RELEASE_TARGETS = [
94
95
  hits: 'statusHits',
95
96
  onHit: (ui, hit) => {
96
97
  if (hit.id === 'branch') return void ui.gitBranches.onBranch();
97
- ui.input.confirmChoice(hit.id);
98
+ ui.confirmChoice(hit.id);
98
99
  },
99
100
  },
101
+ {
102
+ match: (ui) => ui.pane === 'dashboard',
103
+ hits: 'fileHits',
104
+ onHit: (ui, hit) => ui.dashboard.open(hit.cursor),
105
+ },
100
106
  {
101
107
  match: (ui) => ui.pane === 'files',
102
108
  hits: 'fileHits',
103
109
  onHit: (ui, hit) => {
104
110
  const again = armDoubleClick(ui.nav, 'files', hit.cursor);
105
111
  ui.nav.fileCursor = hit.cursor;
106
- if (again) ui.filesPane.onOpenFile();
112
+ if (again) filesPane.onOpenFile(ui);
107
113
  },
108
114
  },
109
115
  {
@@ -122,7 +128,7 @@ const RELEASE_TARGETS = [
122
128
  if (ui.mode === 'compose') return;
123
129
  const again = armDoubleClick(ui.nav, 'commits', hit.cursor);
124
130
  ui.nav.commitCursor = hit.cursor;
125
- if (again) ui.filesPane.onOpenFile();
131
+ if (again) filesPane.onOpenFile(ui);
126
132
  },
127
133
  },
128
134
  {
@@ -135,11 +141,11 @@ const RELEASE_TARGETS = [
135
141
  },
136
142
  },
137
143
  {
138
- match: (ui) => ui.pane === 'diff',
144
+ match: (ui) => ui.pane === 'tasks',
139
145
  hits: 'taskHits',
140
146
  onHit: (ui, hit) => {
141
- if (hit.check) return void ui.composer.onTaskCheck(hit.cursor);
142
- ui.composer.onTaskHit(hit.cursor);
147
+ if (hit.check) return void ui.composer.tasks.onTaskCheck(hit.cursor);
148
+ ui.composer.tasks.onTaskHit(hit.cursor);
143
149
  },
144
150
  },
145
151
  {
@@ -171,14 +177,14 @@ const onRelease = (ui, event) => {
171
177
  };
172
178
 
173
179
  const POINTER_HANDLERS = {
174
- wheelUp: (ui) => ui.filesPane.onScroll(-1),
175
- wheelDown: (ui) => ui.filesPane.onScroll(1),
180
+ wheelUp: (ui) => filesPane.onScroll(ui, -1),
181
+ wheelDown: (ui) => filesPane.onScroll(ui, 1),
176
182
  press: onPress,
177
183
  drag: onDrag,
178
184
  release: onRelease,
179
185
  };
180
186
 
181
- const handle = (ui, event) => {
187
+ const handlePointer = (ui, event) => {
182
188
  const kind = event.kind;
183
189
  const handler = POINTER_HANDLERS[kind];
184
190
  if (!handler) return;
@@ -187,8 +193,4 @@ const handle = (ui, event) => {
187
193
  handler(ui, event);
188
194
  };
189
195
 
190
- const createPointer = (ui) => ({
191
- handle: (event) => handle(ui, event),
192
- });
193
-
194
- module.exports = { createPointer };
196
+ module.exports = { handlePointer };
@@ -1,32 +1,41 @@
1
1
  'use strict';
2
2
 
3
- const createProgress = (term, onTick, intervalMs) => {
4
- const active = new Set();
5
-
6
- const tick = () => {
7
- if (!active.size) return;
8
- onTick();
9
- term.later('progress', tick, intervalMs);
10
- };
11
-
12
- const start = (id) => {
13
- active.add(id);
14
- term.later('progress', tick, intervalMs);
15
- };
16
-
17
- const stop = (id) => {
18
- active.delete(id);
19
- if (active.size === 0) term.cancel('progress');
20
- };
21
-
22
- const clear = () => {
23
- active.clear();
24
- term.cancel('progress');
25
- };
26
-
27
- const size = () => active.size;
28
-
29
- return { start, stop, clear, size };
30
- };
31
-
32
- module.exports = { createProgress };
3
+ class Progress {
4
+ constructor(term, onTick, intervalMs) {
5
+ this.term = term;
6
+ this.onTick = onTick;
7
+ this.intervalMs = intervalMs;
8
+ this.active = new Set();
9
+ }
10
+
11
+ tick() {
12
+ if (!this.active.size) return;
13
+ this.onTick();
14
+ this.schedule();
15
+ }
16
+
17
+ schedule() {
18
+ this.term.later('progress', () => this.tick(), this.intervalMs);
19
+ }
20
+
21
+ start(id) {
22
+ this.active.add(id);
23
+ this.schedule();
24
+ }
25
+
26
+ stop(id) {
27
+ this.active.delete(id);
28
+ if (!this.active.size) this.term.cancel('progress');
29
+ }
30
+
31
+ clear() {
32
+ this.active.clear();
33
+ this.term.cancel('progress');
34
+ }
35
+
36
+ size() {
37
+ return this.active.size;
38
+ }
39
+ }
40
+
41
+ module.exports = { Progress };
@@ -7,9 +7,7 @@ const { loadReview, flushReview } = review;
7
7
 
8
8
  class ReviewController {
9
9
  constructor() {
10
- this.store = null;
11
- this.didResume = false;
12
- this.importedRemote = false;
10
+ this.reset();
13
11
  }
14
12
 
15
13
  reset() {