reslop 0.2.4 → 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.
- package/CHANGELOG.md +25 -1
- package/LICENSE +1 -1
- package/README.md +12 -13
- package/bin/reslop.js +3 -8
- package/lib/ansi.js +32 -19
- package/lib/capabilities.js +8 -12
- package/lib/cli.js +40 -74
- package/lib/clipboard.js +48 -18
- package/lib/dashboard/git.js +128 -0
- package/lib/dashboard/model.js +332 -0
- package/lib/dashboard/npm.js +193 -0
- package/lib/dashboard/tree.js +278 -0
- package/lib/deps-diff.js +196 -404
- package/lib/deps.js +240 -399
- 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 +138 -141
- 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 +90 -206
- package/lib/editor.js +98 -55
- package/lib/files.js +86 -103
- package/lib/git-branches.js +254 -416
- package/lib/git-deps.js +182 -344
- package/lib/git-reword-todo.js +5 -13
- package/lib/git-worktree.js +141 -212
- 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 +157 -132
- 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 +16 -26
- 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 +22 -35
- package/lib/highlight/txt.js +9 -22
- package/lib/highlight.js +17 -46
- package/lib/keys.js +62 -85
- package/lib/manifest.js +67 -130
- package/lib/npm-commands.js +119 -189
- package/lib/remote.js +141 -197
- package/lib/render/branches.js +66 -73
- package/lib/render/chrome.js +264 -323
- package/lib/render/commits.js +187 -500
- package/lib/render/dash-activity.js +212 -0
- package/lib/render/dash-blocks.js +245 -0
- package/lib/render/dash-table.js +290 -0
- package/lib/render/dashboard.js +62 -0
- package/lib/render/diff.js +123 -228
- package/lib/render/files.js +45 -99
- package/lib/render/frame.js +129 -183
- package/lib/render/notes.js +144 -160
- package/lib/render/npm.js +234 -112
- package/lib/render/present.js +4 -11
- package/lib/render/primitives.js +131 -170
- package/lib/render/render.js +5 -14
- package/lib/render/report.js +43 -0
- package/lib/render/tiles.js +260 -0
- package/lib/render/unit.js +15 -28
- package/lib/report-model.js +110 -33
- package/lib/report-parse.js +56 -38
- package/lib/report-render.js +102 -59
- package/lib/report-run.js +87 -78
- package/lib/report-test.js +256 -141
- package/lib/report-tools.js +96 -161
- package/lib/review-merge.js +114 -152
- package/lib/review.js +115 -189
- package/lib/runs.js +225 -0
- package/lib/select.js +89 -75
- package/lib/session/accessors.js +14 -21
- package/lib/session/actions.js +82 -63
- package/lib/session/branches.js +193 -247
- package/lib/session/change-actions.js +171 -214
- package/lib/session/commit.js +280 -342
- package/lib/session/compose.js +559 -674
- package/lib/session/dashboard.js +385 -0
- package/lib/session/dispatch.js +164 -157
- package/lib/session/edit-click.js +57 -0
- package/lib/session/files-pane.js +85 -53
- package/lib/session/items.js +73 -104
- package/lib/session/lifecycle.js +403 -541
- package/lib/session/load.js +48 -68
- package/lib/session/navigation.js +96 -87
- package/lib/session/npm.js +409 -345
- package/lib/session/ops.js +196 -63
- package/lib/session/pointer.js +23 -15
- package/lib/session/progress.js +33 -21
- package/lib/session/review.js +33 -54
- package/lib/session/tasks.js +333 -0
- package/lib/session/templates.js +51 -59
- package/lib/session/terminal.js +85 -136
- package/lib/session/unit.js +3 -4
- package/lib/session/update.js +76 -97
- package/lib/session/view.js +52 -83
- package/lib/session/watch.js +208 -204
- package/lib/session.js +112 -237
- package/lib/update.js +45 -116
- package/lib/utilities.js +67 -89
- package/lib/wrap.js +33 -44
- package/package.json +1 -1
- package/lib/session/todos.js +0 -293
package/lib/session/todos.js
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const files = require('../files.js');
|
|
4
|
-
const { isTodosEntry, TODO_FILE } = files;
|
|
5
|
-
const review = require('../review.js');
|
|
6
|
-
const { addTodo, setTodoText, setTodoDone, removeTodo, checkLabel } = review;
|
|
7
|
-
|
|
8
|
-
const TODO_TYPE_SKIP = [
|
|
9
|
-
'enter',
|
|
10
|
-
'escape',
|
|
11
|
-
'tab',
|
|
12
|
-
'backspace',
|
|
13
|
-
'delete',
|
|
14
|
-
'left',
|
|
15
|
-
'right',
|
|
16
|
-
'up',
|
|
17
|
-
'down',
|
|
18
|
-
'home',
|
|
19
|
-
'end',
|
|
20
|
-
'pageUp',
|
|
21
|
-
'pageDown',
|
|
22
|
-
'j',
|
|
23
|
-
'k',
|
|
24
|
-
'n',
|
|
25
|
-
'p',
|
|
26
|
-
'q',
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
const isTodoTypeKey = (key) => {
|
|
30
|
-
if (!key) return false;
|
|
31
|
-
if (TODO_TYPE_SKIP.includes(key)) return false;
|
|
32
|
-
if (key.startsWith('ctrl-')) return false;
|
|
33
|
-
if (key.startsWith('alt-')) return false;
|
|
34
|
-
return key.charCodeAt(0) >= 32;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const listTodos = (api) => {
|
|
38
|
-
const notes = api.review.store;
|
|
39
|
-
if (!notes) return [];
|
|
40
|
-
return notes.todos;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const isDraftCompose = (api) => {
|
|
44
|
-
const { state } = api;
|
|
45
|
-
return state.composeKind === 'todo' && state.composeTodoId === null;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const todoTexts = (api) => {
|
|
49
|
-
const nav = api.nav;
|
|
50
|
-
if (!nav.todoOpen) return [];
|
|
51
|
-
const todos = listTodos(api);
|
|
52
|
-
const texts = new Array(todos.length + 1);
|
|
53
|
-
const { state } = api;
|
|
54
|
-
const editingTodo = state.composeKind === 'todo';
|
|
55
|
-
const editingId = editingTodo ? state.composeTodoId : null;
|
|
56
|
-
for (let i = 0; i < todos.length; i++) {
|
|
57
|
-
const todo = todos[i];
|
|
58
|
-
const live = editingId === todo.id && state.editor;
|
|
59
|
-
const text = live ? state.editor.text : todo.text;
|
|
60
|
-
texts[i] = checkLabel(text, todo.done);
|
|
61
|
-
}
|
|
62
|
-
const draft = isDraftCompose(api) && state.editor ? state.editor.text : '';
|
|
63
|
-
texts[todos.length] = checkLabel(draft, false);
|
|
64
|
-
return texts;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const todoRowCount = (api) => {
|
|
68
|
-
if (!api.nav.todoOpen) return 0;
|
|
69
|
-
return listTodos(api).length + 1;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const clampedTodoFocus = (api) => {
|
|
73
|
-
const last = Math.max(0, todoRowCount(api) - 1);
|
|
74
|
-
const focus = api.nav.todoFocus;
|
|
75
|
-
if (focus < 0) return 0;
|
|
76
|
-
if (focus > last) return last;
|
|
77
|
-
return focus;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const moveTodoFocus = (api, delta) => {
|
|
81
|
-
const nav = api.nav;
|
|
82
|
-
if (!nav.todoOpen) return;
|
|
83
|
-
const n = todoRowCount(api);
|
|
84
|
-
if (!n) return;
|
|
85
|
-
const next = clampedTodoFocus(api) + delta;
|
|
86
|
-
if (next < 0) nav.todoFocus = 0;
|
|
87
|
-
else if (next >= n) nav.todoFocus = n - 1;
|
|
88
|
-
else nav.todoFocus = next;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const openTodoPage = (api) => {
|
|
92
|
-
const nav = api.nav;
|
|
93
|
-
nav.todoOpen = true;
|
|
94
|
-
nav.pane = 'diff';
|
|
95
|
-
nav.scroll = 0;
|
|
96
|
-
nav.clearSelection();
|
|
97
|
-
api.ui.syncReviewPath();
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const closeTodoPage = (api) => {
|
|
101
|
-
api.nav.todoOpen = false;
|
|
102
|
-
api.ui.syncReviewPath();
|
|
103
|
-
api.ui.syncFileCursor();
|
|
104
|
-
api.ui.lifecycle.catchUpWatch();
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const focusTodoPage = (api, todoId) => {
|
|
108
|
-
openTodoPage(api);
|
|
109
|
-
const todos = listTodos(api);
|
|
110
|
-
let focus = 0;
|
|
111
|
-
if (todoId === null) {
|
|
112
|
-
focus = todos.length;
|
|
113
|
-
} else if (todoId !== undefined) {
|
|
114
|
-
const at = todos.findIndex((todo) => todo.id === todoId);
|
|
115
|
-
if (at >= 0) focus = at;
|
|
116
|
-
else if (todos.length) focus = todos.length - 1;
|
|
117
|
-
}
|
|
118
|
-
api.nav.todoFocus = focus;
|
|
119
|
-
api.nav.scroll = 0;
|
|
120
|
-
return true;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const startDraftCompose = (api) => {
|
|
124
|
-
focusTodoPage(api, null);
|
|
125
|
-
api.open('todo', '', null);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const editFocusedTodo = (api) => {
|
|
129
|
-
if (!api.nav.todoOpen) return;
|
|
130
|
-
const todos = listTodos(api);
|
|
131
|
-
const todo = todos[clampedTodoFocus(api)];
|
|
132
|
-
if (!todo) return void startDraftCompose(api);
|
|
133
|
-
api.open('todo', todo.text, todo.id);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const editNextTodo = (api) => {
|
|
137
|
-
if (!api.nav.todoOpen) return;
|
|
138
|
-
const last = todoRowCount(api) - 1;
|
|
139
|
-
const next = clampedTodoFocus(api) + 1;
|
|
140
|
-
if (next <= last) api.nav.todoFocus = next;
|
|
141
|
-
editFocusedTodo(api);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const moveTodoCompose = (api, delta, width) => {
|
|
145
|
-
if (!api.nav.todoOpen) return;
|
|
146
|
-
const editor = api.state.editor;
|
|
147
|
-
if (editor && width) {
|
|
148
|
-
const before = editor.cursor;
|
|
149
|
-
editor.moveLine(delta, width);
|
|
150
|
-
if (editor.cursor !== before) return;
|
|
151
|
-
}
|
|
152
|
-
const last = todoRowCount(api) - 1;
|
|
153
|
-
const at = clampedTodoFocus(api);
|
|
154
|
-
let next = at + delta;
|
|
155
|
-
if (next < 0) next = 0;
|
|
156
|
-
if (next > last) next = last;
|
|
157
|
-
if (next === at) return;
|
|
158
|
-
api.commit();
|
|
159
|
-
api.ui.flushReview();
|
|
160
|
-
api.close();
|
|
161
|
-
const max = Math.max(0, todoRowCount(api) - 1);
|
|
162
|
-
api.nav.todoFocus = Math.min(next, max);
|
|
163
|
-
editFocusedTodo(api);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const typeIntoTodo = (api, key) => {
|
|
167
|
-
const nav = api.nav;
|
|
168
|
-
if (!nav.todoOpen) return false;
|
|
169
|
-
if (nav.pane !== 'diff') return false;
|
|
170
|
-
if (api.ui.mode !== 'review') return false;
|
|
171
|
-
if (!isTodoTypeKey(key)) return false;
|
|
172
|
-
editFocusedTodo(api);
|
|
173
|
-
api.state.editor.insert(key);
|
|
174
|
-
api.resetBlink();
|
|
175
|
-
return true;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const removeFocusedTodo = (api) => {
|
|
179
|
-
const nav = api.nav;
|
|
180
|
-
if (nav.pane !== 'diff' || !nav.todoOpen) return;
|
|
181
|
-
const todos = listTodos(api);
|
|
182
|
-
const todo = todos[clampedTodoFocus(api)];
|
|
183
|
-
if (!todo) return;
|
|
184
|
-
const notes = api.review.store;
|
|
185
|
-
removeTodo(notes, todo.id);
|
|
186
|
-
const left = listTodos(api);
|
|
187
|
-
if (nav.todoFocus >= left.length) {
|
|
188
|
-
nav.todoFocus = Math.max(0, left.length - 1);
|
|
189
|
-
}
|
|
190
|
-
api.ui.flushReview(true);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
const toggleFocusedTodo = (api) => {
|
|
194
|
-
const nav = api.nav;
|
|
195
|
-
if (!nav.todoOpen || nav.pane !== 'diff') return false;
|
|
196
|
-
if (api.ui.mode !== 'review') return false;
|
|
197
|
-
const todo = listTodos(api)[clampedTodoFocus(api)];
|
|
198
|
-
if (!todo) return false;
|
|
199
|
-
setTodoDone(api.review.store, todo.id, !todo.done);
|
|
200
|
-
api.ui.flushReview(true);
|
|
201
|
-
return true;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const onTodoHit = (api, cursor) => {
|
|
205
|
-
if (!api.nav.todoOpen) return;
|
|
206
|
-
const todos = listTodos(api);
|
|
207
|
-
const draft = cursor === todos.length;
|
|
208
|
-
const target = todos[cursor];
|
|
209
|
-
if (!draft && !target) return;
|
|
210
|
-
const { state } = api;
|
|
211
|
-
if (state.composeKind === 'todo') {
|
|
212
|
-
if (draft && state.composeTodoId === null) return;
|
|
213
|
-
if (target && target.id === state.composeTodoId) return;
|
|
214
|
-
api.commit();
|
|
215
|
-
api.close();
|
|
216
|
-
}
|
|
217
|
-
api.nav.todoFocus = cursor;
|
|
218
|
-
editFocusedTodo(api);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const onTodoCheck = (api, cursor) => {
|
|
222
|
-
if (!api.nav.todoOpen) return;
|
|
223
|
-
const todo = listTodos(api)[cursor];
|
|
224
|
-
if (!todo) return void onTodoHit(api, cursor);
|
|
225
|
-
const { state } = api;
|
|
226
|
-
if (state.composeKind === 'todo' && state.composeTodoId !== todo.id) {
|
|
227
|
-
api.commit();
|
|
228
|
-
api.close();
|
|
229
|
-
}
|
|
230
|
-
setTodoDone(api.review.store, todo.id, !todo.done);
|
|
231
|
-
api.nav.todoFocus = cursor;
|
|
232
|
-
api.ui.flushReview(true);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const createTodo = (api) => {
|
|
236
|
-
startDraftCompose(api);
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const onTodo = (api) => {
|
|
240
|
-
const { nav, ui } = api;
|
|
241
|
-
if (nav.pane === 'files') {
|
|
242
|
-
const entry = ui.fileCursorEntry();
|
|
243
|
-
if (entry && !isTodosEntry(entry)) {
|
|
244
|
-
nav.index = entry.openIndex ?? entry.firstIndex;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
createTodo(api);
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
const todoEditView = (api) => {
|
|
251
|
-
const { state } = api;
|
|
252
|
-
if (state.composeKind !== 'todo') return null;
|
|
253
|
-
if (!state.editor) return null;
|
|
254
|
-
return { cursor: state.editor.cursor };
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
const commitTodo = (api, text) => {
|
|
258
|
-
const notes = api.review.store;
|
|
259
|
-
const id = api.state.composeTodoId;
|
|
260
|
-
const todos = notes.todos;
|
|
261
|
-
const prev = id === null ? null : todos.find((entry) => entry.id === id);
|
|
262
|
-
if (prev) return void setTodoText(notes, id, text);
|
|
263
|
-
if (!text.trim()) return;
|
|
264
|
-
const todo = addTodo(notes, TODO_FILE, text);
|
|
265
|
-
api.state.composeTodoId = todo.id;
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const createTodoCompose = (api) => ({
|
|
269
|
-
todoTexts: () => todoTexts(api),
|
|
270
|
-
clampedTodoFocus: () => clampedTodoFocus(api),
|
|
271
|
-
todoRowCount: () => todoRowCount(api),
|
|
272
|
-
moveTodoFocus: (delta) => moveTodoFocus(api, delta),
|
|
273
|
-
openTodoPage: () => openTodoPage(api),
|
|
274
|
-
closeTodoPage: () => closeTodoPage(api),
|
|
275
|
-
startDraftCompose: () => startDraftCompose(api),
|
|
276
|
-
editFocusedTodo: () => editFocusedTodo(api),
|
|
277
|
-
editNextTodo: () => editNextTodo(api),
|
|
278
|
-
moveTodoCompose: (delta, width) => moveTodoCompose(api, delta, width),
|
|
279
|
-
typeIntoTodo: (key) => typeIntoTodo(api, key),
|
|
280
|
-
removeFocusedTodo: () => removeFocusedTodo(api),
|
|
281
|
-
onTodoHit: (cursor) => onTodoHit(api, cursor),
|
|
282
|
-
onTodoCheck: (cursor) => onTodoCheck(api, cursor),
|
|
283
|
-
toggleFocusedTodo: () => toggleFocusedTodo(api),
|
|
284
|
-
onTodo: () => onTodo(api),
|
|
285
|
-
todoEditView: () => todoEditView(api),
|
|
286
|
-
commitTodo: (text) => commitTodo(api, text),
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
module.exports = {
|
|
290
|
-
TODO_TYPE_SKIP,
|
|
291
|
-
isTodoTypeKey,
|
|
292
|
-
createTodoCompose,
|
|
293
|
-
};
|