reslop 0.2.5 → 0.2.7
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/CHANGELOG.md +22 -1
- package/LICENSE +1 -1
- package/README.md +11 -11
- package/bin/reslop.js +3 -8
- package/lib/ansi.js +72 -19
- package/lib/api.js +1 -1
- package/lib/capabilities.js +8 -8
- package/lib/cli.js +61 -75
- package/lib/clipboard.js +39 -47
- package/lib/dashboard/git.js +128 -0
- package/lib/dashboard/model.js +357 -0
- package/lib/dashboard/npm.js +290 -0
- package/lib/dashboard/tree.js +278 -0
- package/lib/deps-diff.js +197 -402
- package/lib/deps.js +113 -240
- package/lib/detect.js +8 -18
- package/lib/diff/align.js +41 -113
- package/lib/diff/diff.js +12 -43
- package/lib/diff/display.js +25 -36
- package/lib/diff/edit.js +6 -20
- package/lib/diff/inline.js +76 -144
- package/lib/diff/items.js +33 -47
- package/lib/diff/parse.js +28 -56
- package/lib/diff/patch.js +12 -33
- package/lib/diff/unit.js +79 -178
- package/lib/editor.js +52 -69
- package/lib/files.js +79 -91
- package/lib/find.js +61 -0
- package/lib/git-branches.js +254 -416
- package/lib/git-deps.js +148 -272
- package/lib/git-reword-todo.js +5 -13
- package/lib/git-worktree.js +161 -214
- package/lib/git.js +21 -49
- package/lib/github.js +67 -181
- package/lib/gitlab.js +40 -90
- package/lib/highlight/bash.js +55 -177
- package/lib/highlight/core.js +155 -141
- package/lib/highlight/css.js +25 -58
- package/lib/highlight/csv.js +19 -37
- package/lib/highlight/dart.js +72 -213
- package/lib/highlight/dot.js +14 -14
- package/lib/highlight/html.js +42 -63
- package/lib/highlight/js.js +177 -506
- package/lib/highlight/json.js +17 -37
- package/lib/highlight/log.js +19 -25
- package/lib/highlight/txt.js +7 -10
- package/lib/highlight.js +17 -46
- package/lib/keys.js +75 -83
- package/lib/manifest.js +67 -126
- package/lib/npm-commands.js +120 -169
- package/lib/remote.js +140 -190
- package/lib/render/branches.js +63 -61
- package/lib/render/chrome.js +412 -347
- package/lib/render/commits.js +160 -361
- package/lib/render/dash-activity.js +212 -0
- package/lib/render/dash-blocks.js +496 -0
- package/lib/render/dash-table.js +295 -0
- package/lib/render/dashboard.js +62 -0
- package/lib/render/diff.js +123 -258
- package/lib/render/files.js +60 -86
- package/lib/render/frame.js +82 -117
- package/lib/render/notes.js +150 -210
- package/lib/render/npm.js +213 -177
- package/lib/render/packages.js +93 -0
- package/lib/render/present.js +4 -11
- package/lib/render/primitives.js +77 -172
- package/lib/render/render.js +5 -14
- package/lib/render/report.js +43 -0
- package/lib/render/repos.js +226 -0
- package/lib/render/search.js +25 -0
- package/lib/render/tiles.js +355 -0
- package/lib/render/unit.js +15 -31
- package/lib/report-model.js +110 -33
- package/lib/report-parse.js +56 -37
- package/lib/report-render.js +102 -59
- package/lib/report-run.js +87 -77
- package/lib/report-test.js +221 -99
- package/lib/report-tools.js +96 -154
- package/lib/review-merge.js +33 -41
- package/lib/review.js +69 -129
- package/lib/runs.js +225 -0
- package/lib/select.js +53 -91
- package/lib/session/accessors.js +14 -21
- package/lib/session/actions.js +189 -65
- package/lib/session/branches.js +164 -222
- package/lib/session/change-actions.js +49 -119
- package/lib/session/commit.js +298 -352
- package/lib/session/compose.js +572 -715
- package/lib/session/dashboard.js +530 -0
- package/lib/session/dispatch.js +197 -171
- package/lib/session/files-pane.js +92 -45
- package/lib/session/find.js +94 -0
- package/lib/session/items.js +6 -17
- package/lib/session/lifecycle.js +420 -466
- package/lib/session/load.js +1 -14
- package/lib/session/navigation.js +4 -2
- package/lib/session/npm.js +403 -420
- package/lib/session/ops.js +5 -13
- package/lib/session/packages.js +143 -0
- package/lib/session/pointer.js +30 -14
- package/lib/session/progress.js +39 -30
- package/lib/session/review.js +1 -3
- package/lib/session/tasks.js +277 -236
- package/lib/session/templates.js +51 -59
- package/lib/session/terminal.js +85 -132
- package/lib/session/view.js +59 -80
- package/lib/session/watch.js +201 -212
- package/lib/session/workspace.js +455 -0
- package/lib/session.js +95 -161
- package/lib/update.js +44 -111
- package/lib/utilities.js +46 -88
- package/lib/workspace.js +166 -0
- package/lib/wrap.js +29 -55
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const files = require('../files.js');
|
|
4
|
+
const { isTasksEntry, TASKS_FILE } = files;
|
|
5
|
+
const find = require('../find.js');
|
|
6
|
+
const { fileMatches } = find;
|
|
7
|
+
|
|
8
|
+
const FIND_PANES = ['files', 'diff'];
|
|
9
|
+
|
|
10
|
+
const isTypeKey = (key) =>
|
|
11
|
+
Boolean(key) && key.length === 1 && key.charCodeAt(0) >= 32;
|
|
12
|
+
|
|
13
|
+
const startFind = (ui) => {
|
|
14
|
+
if (ui.mode !== 'review') return;
|
|
15
|
+
if (!FIND_PANES.includes(ui.pane)) return;
|
|
16
|
+
ui.mode = 'find';
|
|
17
|
+
ui.nav.find = { query: '', at: 0 };
|
|
18
|
+
ui.status = '';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const stopFind = (ui) => {
|
|
22
|
+
ui.mode = 'review';
|
|
23
|
+
ui.nav.find = null;
|
|
24
|
+
ui.status = '';
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const focusMatch = (ui, hit, jump) => {
|
|
28
|
+
const entry = ui.fileList()[hit.index];
|
|
29
|
+
if (!entry) return;
|
|
30
|
+
const moved = ui.nav.fileCursor !== hit.index;
|
|
31
|
+
ui.nav.fileCursor = hit.index;
|
|
32
|
+
if (isTasksEntry(entry)) {
|
|
33
|
+
ui.nav.reviewPath = TASKS_FILE;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
ui.nav.reviewPath = entry.path;
|
|
37
|
+
if (ui.nav.pane !== 'diff') {
|
|
38
|
+
ui.nav.index = entry.firstIndex;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!moved && !jump) return;
|
|
42
|
+
ui.nav.index = entry.openIndex ?? entry.firstIndex;
|
|
43
|
+
ui.nav.scroll = 0;
|
|
44
|
+
ui.nav.clearSelection();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const showHit = (ui, jump) => {
|
|
48
|
+
const state = ui.nav.find;
|
|
49
|
+
if (!state) return;
|
|
50
|
+
const hits = fileMatches(ui.fileList(), state.query);
|
|
51
|
+
if (!hits.length) return;
|
|
52
|
+
const count = hits.length;
|
|
53
|
+
let at = state.at % count;
|
|
54
|
+
if (at < 0) at += count;
|
|
55
|
+
state.at = at;
|
|
56
|
+
focusMatch(ui, hits[at], jump);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const typeFind = (ui, key) => {
|
|
60
|
+
const state = ui.nav.find;
|
|
61
|
+
state.query += key;
|
|
62
|
+
state.at = 0;
|
|
63
|
+
showHit(ui, true);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const eraseFind = (ui) => {
|
|
67
|
+
const state = ui.nav.find;
|
|
68
|
+
if (!state.query) return void stopFind(ui);
|
|
69
|
+
state.query = state.query.slice(0, -1);
|
|
70
|
+
state.at = 0;
|
|
71
|
+
showHit(ui, true);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const moveFind = (ui, delta) => {
|
|
75
|
+
const state = ui.nav.find;
|
|
76
|
+
if (!state.query) return;
|
|
77
|
+
state.at += delta;
|
|
78
|
+
showHit(ui, false);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const onFindKey = (ui, key) => {
|
|
82
|
+
if (!ui.nav.find) {
|
|
83
|
+
ui.mode = 'review';
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (key === 'ctrl-c') return void ui.onQuit();
|
|
87
|
+
if (key === 'escape' || key === 'enter') return void stopFind(ui);
|
|
88
|
+
if (key === 'backspace') return void eraseFind(ui);
|
|
89
|
+
if (key === 'up' || key === 'left') return void moveFind(ui, -1);
|
|
90
|
+
if (key === 'down' || key === 'right') return void moveFind(ui, 1);
|
|
91
|
+
if (isTypeKey(key)) typeFind(ui, key);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
module.exports = { FIND_PANES, startFind, stopFind, onFindKey };
|
package/lib/session/items.js
CHANGED
|
@@ -29,13 +29,9 @@ const blockKey = (item) => {
|
|
|
29
29
|
if (isTaskItem(item)) return `todo:${TASKS_FILE}`;
|
|
30
30
|
const depId = depChangeKey(item);
|
|
31
31
|
if (depId) return `${rel}:dep:${depId}`;
|
|
32
|
-
if (!item.hunk) {
|
|
33
|
-
const block = item.blockId ?? '-';
|
|
34
|
-
return `${rel}:file:${block}`;
|
|
35
|
-
}
|
|
36
|
-
const oldStart = item.hunk.oldStart;
|
|
37
|
-
const newStart = item.hunk.newStart;
|
|
38
32
|
const block = item.blockId ?? '-';
|
|
33
|
+
if (!item.hunk) return `${rel}:file:${block}`;
|
|
34
|
+
const { oldStart, newStart } = item.hunk;
|
|
39
35
|
return `${rel}:${oldStart}:${newStart}:${block}`;
|
|
40
36
|
};
|
|
41
37
|
|
|
@@ -119,12 +115,10 @@ const alignLoadedItems = (prev, next) => {
|
|
|
119
115
|
const ordered = [];
|
|
120
116
|
for (const [rel, list] of groupByPath(prev)) {
|
|
121
117
|
seen.add(rel);
|
|
122
|
-
|
|
123
|
-
for (const item of aligned) ordered.push(item);
|
|
118
|
+
ordered.push(...alignGroup(list, nextGroups.get(rel) ?? []));
|
|
124
119
|
}
|
|
125
120
|
for (const [rel, list] of nextGroups) {
|
|
126
|
-
if (seen.has(rel))
|
|
127
|
-
for (const item of list) ordered.push(item);
|
|
121
|
+
if (!seen.has(rel)) ordered.push(...list);
|
|
128
122
|
}
|
|
129
123
|
return ordered;
|
|
130
124
|
};
|
|
@@ -195,8 +189,7 @@ const sameBlock = (left, right) => {
|
|
|
195
189
|
const canEditCode = (item) => {
|
|
196
190
|
if (!item || isTaskItem(item)) return false;
|
|
197
191
|
if (!item.hunk || !item.file) return false;
|
|
198
|
-
|
|
199
|
-
return true;
|
|
192
|
+
return !item.file.isBinary;
|
|
200
193
|
};
|
|
201
194
|
|
|
202
195
|
class ItemCollection {
|
|
@@ -237,11 +230,7 @@ class ItemCollection {
|
|
|
237
230
|
const replaced = this.items.map((entry) =>
|
|
238
231
|
sameBlock(entry, item) ? next : entry,
|
|
239
232
|
);
|
|
240
|
-
|
|
241
|
-
this.items = replaced;
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
this.items = refreshIndexPatches(replaced, next);
|
|
233
|
+
this.items = next.dep ? replaced : refreshIndexPatches(replaced, next);
|
|
245
234
|
}
|
|
246
235
|
}
|
|
247
236
|
|