@popcorn245/cornfield 0.34.2 → 0.35.0
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/core/contrast.js +65 -1
- package/core/proposal.js +10 -3
- package/explorer/check.js +6 -1
- package/explorer/connection.js +62 -0
- package/explorer/corn-state.js +34 -2
- package/explorer/diff-marks.js +35 -0
- package/explorer/explorer.css +78 -5
- package/explorer/feedback.js +49 -0
- package/explorer/focusables.js +35 -0
- package/explorer/forge-panel-model.js +41 -7
- package/explorer/forge-panel.js +226 -70
- package/explorer/index.html +7 -3
- package/explorer/mockups.js +3 -9
- package/explorer/panels.js +10 -4
- package/explorer/plugins.js +11 -2
- package/explorer/proposal-model.js +61 -8
- package/explorer/proposal.js +42 -14
- package/explorer/renderer-canvas2d.js +23 -5
- package/explorer/review-model.js +8 -3
- package/explorer/review-tokens.js +2 -7
- package/explorer/review.js +56 -11
- package/explorer/runs-model.js +42 -18
- package/explorer/runs-view.js +58 -20
- package/explorer/scenario-ui.js +7 -3
- package/explorer/scene.js +8 -7
- package/explorer/theme-model.js +13 -6
- package/explorer/tokens.css +20 -10
- package/explorer/whatif.js +10 -3
- package/package.json +1 -1
- package/server/forge-http.js +1 -1
- package/server/proposals.js +1 -1
package/explorer/whatif.js
CHANGED
|
@@ -25,6 +25,7 @@ import { render, isNodeVisible } from './render.js';
|
|
|
25
25
|
import { hooks, rebuildProposalMap, closeProposal } from './proposal.js';
|
|
26
26
|
import { getPlayer, playScenario, stopScenario, tickScenario } from './scenario-ui.js';
|
|
27
27
|
import { kindOfMark } from './proposal-model.js';
|
|
28
|
+
import { announce } from './keyboard.js';
|
|
28
29
|
import { edgeKey } from '../core/proposal.js';
|
|
29
30
|
import * as M from './whatif-model.js';
|
|
30
31
|
|
|
@@ -197,15 +198,21 @@ function doIntent(intent, where) {
|
|
|
197
198
|
|
|
198
199
|
export function undoEdit() {
|
|
199
200
|
if (!state.proposal || !M.canUndo(state.whatIf)) return false;
|
|
200
|
-
|
|
201
|
+
const edit = state.whatIf.edits[state.whatIf.edits.length - 1];
|
|
202
|
+
return step(M.undo(state.whatIf), edit, 'Undid');
|
|
201
203
|
}
|
|
202
204
|
export function redoEdit() {
|
|
203
205
|
if (!state.proposal || !M.canRedo(state.whatIf)) return false;
|
|
204
|
-
|
|
206
|
+
const edit = state.whatIf.undone[state.whatIf.undone.length - 1];
|
|
207
|
+
return step(M.redo(state.whatIf), edit, 'Redid');
|
|
205
208
|
}
|
|
206
|
-
|
|
209
|
+
/** Applies an undo or a redo, and says which edit it was ("Undid: Added the service “X”"); names are read where the node exists (before for an add, after for a remove) */
|
|
210
|
+
function step(whatIf, edit, verb) {
|
|
207
211
|
clearMessages();
|
|
212
|
+
const words = () => M.describeEdit(edit, { nameOf, scenarioTitle: (id) => (scenariosOf(state.effectiveProposal || state.proposal).find((s) => s.id === id) || { title: id }).title });
|
|
213
|
+
const before = words();
|
|
208
214
|
apply({ whatIf, effective: M.evaluate(base(), state.proposal, whatIf.edits).effective });
|
|
215
|
+
announce(`${verb}: ${/^remove/.test(edit.op) ? words() : before}`);
|
|
209
216
|
return true;
|
|
210
217
|
}
|
|
211
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popcorn245/cornfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "A self-hostable dev dashboard with the topology map at its centre: proposals on the map, scenarios, outages and what-if edits, for any repo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "popcorn245 (https://github.com/popcorn245)",
|
package/server/forge-http.js
CHANGED
|
@@ -149,7 +149,7 @@ export function errorFor(forge, status, body, rate, what) {
|
|
|
149
149
|
if (status >= 300 && status < 400) return new ForgeError(`${forge} says ${what} has moved; check forge.repo in cornfield.config.js.`, { ...at, code: 'not-found' });
|
|
150
150
|
if (status === 401) return new ForgeError(`${forge} did not accept the sign-in; sign in again.`, { ...at, code: 'unauthorized' });
|
|
151
151
|
if (status === 403) return new ForgeError(`${forge} does not let this sign-in do that to ${what}.${theirs}`, { ...at, code: 'forbidden' });
|
|
152
|
-
if (status === 404) return new ForgeError(`${forge}
|
|
152
|
+
if (status === 404) return new ForgeError(`${forge} could not find ${what}, or this sign-in cannot see it.`, { ...at, code: 'not-found' });
|
|
153
153
|
if (status === 405 || status === 409) return new ForgeError(`${forge} refused: ${what} cannot be changed that way now.${theirs}`, { ...at, code: 'conflict' });
|
|
154
154
|
if (status === 400 || status === 422) return new ForgeError(`${forge} did not accept the request for ${what}.${theirs}`, { ...at, code: 'invalid' });
|
|
155
155
|
return new ForgeError(`${forge} could not answer for ${what} (HTTP ${status}); try again in a minute.`, { ...at, code: 'unavailable' });
|
package/server/proposals.js
CHANGED
|
@@ -168,7 +168,7 @@ function describeProposal(slug, source, proposal, topology) {
|
|
|
168
168
|
summary: object ? text(proposal.summary) : '',
|
|
169
169
|
spec: object && typeof proposal.spec === 'string' ? proposal.spec : null,
|
|
170
170
|
source,
|
|
171
|
-
counts: summarize(proposal),
|
|
171
|
+
counts: summarize(proposal), // the totals, and `nodes` and `edges` apart, so the list can say what it counts
|
|
172
172
|
errors: topology ? proposalProblems(topology, proposal).errors.length : null,
|
|
173
173
|
};
|
|
174
174
|
}
|