cornfield 0.50.1 → 0.51.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/explorer/camera-frame.js +82 -0
- package/explorer/camera.js +7 -73
- package/explorer/check-model.js +3 -44
- package/explorer/cloud-model.js +2 -101
- package/explorer/cloud-panel.js +107 -0
- package/explorer/css/review.css +2 -0
- package/explorer/engine/connection.js +4 -1
- package/explorer/engine/map-rect.js +97 -0
- package/explorer/engine/player.js +2 -1
- package/explorer/engine/proposal.js +28 -7
- package/explorer/engine/server-load.js +64 -0
- package/explorer/engine/sheets.js +4 -86
- package/explorer/engine/source-address.js +58 -0
- package/explorer/engine/source.js +16 -45
- package/explorer/engine/theme-sheet.js +23 -1
- package/explorer/engine/topology.js +1 -1
- package/explorer/instance.js +3 -1
- package/explorer/layer-model.js +1 -1
- package/explorer/outage-model.js +6 -76
- package/explorer/outage-scenario.js +83 -0
- package/explorer/pieces/node-panel.js +4 -3
- package/explorer/pieces/review-source.js +84 -0
- package/explorer/pieces/review.js +145 -12
- package/explorer/pieces/scope.js +23 -54
- package/explorer/pieces/status.js +5 -1
- package/explorer/proposal-marks.js +220 -0
- package/explorer/proposal-model.js +23 -211
- package/explorer/scenario.js +2 -1
- package/explorer/scene.js +2 -2
- package/explorer/selection-model.js +2 -42
- package/explorer/selection-view.js +1 -1
- package/explorer/selection-words.js +52 -0
- package/explorer/verdict-paint.js +51 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/verdict-paint
|
|
3
|
+
*
|
|
4
|
+
* A checked step's verdict on the map (spec 0005): the colours (`VERDICT_COLOR`) and `paintVerdict(scene, scn)`, which scene.js calls on a built
|
|
5
|
+
* scene. The checks themselves (what a step asks, the batches, the words) are check-model.js's, which re-exports these: a map alone imports this
|
|
6
|
+
* module and does not carry them (the components' size budget, spec 0011 D11). Pure: no DOM, no state.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The colours a checked step is drawn in, on its node or its edge. The red is brighter than a `writes`
|
|
11
|
+
* edge's own (#f87171), so a refused write reads as refused, not as a write.
|
|
12
|
+
*/
|
|
13
|
+
export const VERDICT_COLOR = { allowed: '#4ade80', refused: '#ff2d55', mismatch: '#fbbf24' };
|
|
14
|
+
const VERDICT_GLOW = 18;
|
|
15
|
+
const VERDICT_EDGE_WIDTH = 4.5;
|
|
16
|
+
|
|
17
|
+
/** Whether a drawn edge is the one a step names: same ends and kind (and flow); no kind = an ownership or usage link (scene.js's rule) */
|
|
18
|
+
function isStepEdge(drawn, step) {
|
|
19
|
+
if (drawn.from !== step.from || drawn.to !== step.to) return false;
|
|
20
|
+
if (!step.kind) return drawn.kind === 'ownership' || drawn.kind === 'usage';
|
|
21
|
+
return drawn.kind === step.kind && (!step.flow || drawn.key.split('|')[2] === step.flow);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Colours the current step of a playing scenario by its verdict, in a built scene (after
|
|
26
|
+
* `emphasiseScenario`): red refused, green allowed, amber when `expect` disagrees; a step that was not
|
|
27
|
+
* checked keeps its colours. A refused edge's packet stops halfway: the write does not go through.
|
|
28
|
+
* Changes only `color`, `glow`, `glowColor`, `width` and the packet: never `mark`.
|
|
29
|
+
* @param {object} scene
|
|
30
|
+
* @param {{ done?: boolean, current: { node?: string, edge?: object }, verdict?: Verdict }} scn the player's snapshot, with the verdict check.js put on it
|
|
31
|
+
*/
|
|
32
|
+
export function paintVerdict(scene, scn) {
|
|
33
|
+
const v = scn && scn.verdict;
|
|
34
|
+
if (!v || scn.done) return;
|
|
35
|
+
const color = v.mismatch ? VERDICT_COLOR.mismatch : VERDICT_COLOR[v.state];
|
|
36
|
+
if (!color) return;
|
|
37
|
+
const { node, edge } = scn.current;
|
|
38
|
+
if (node !== undefined) {
|
|
39
|
+
const n = scene.nodes.find((x) => x.id === node);
|
|
40
|
+
if (n) { n.color = color; n.glow = Math.max(n.glow || 0, VERDICT_GLOW); }
|
|
41
|
+
} else if (edge) {
|
|
42
|
+
scene.edges.forEach((e) => {
|
|
43
|
+
if (!isStepEdge(e, edge)) return;
|
|
44
|
+
e.color = color;
|
|
45
|
+
e.glowColor = color;
|
|
46
|
+
e.glow = Math.max(e.glow || 0, VERDICT_GLOW);
|
|
47
|
+
e.width = Math.max(e.width || 0, VERDICT_EDGE_WIDTH);
|
|
48
|
+
if (e.packet) e.packet = v.state === 'refused' && !v.mismatch ? { ...e.packet, color, glowColor: color, speed: 0, phase: 0.5 } : { ...e.packet, glowColor: color };
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cornfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.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)",
|