@popcorn245/cornfield 0.60.0 → 0.61.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.
@@ -41,3 +41,17 @@
41
41
  .hx-run-tag { position: absolute; left: 0; top: calc(var(--r) + 4px); transform: translateX(-50%); white-space: nowrap; padding: calc(var(--corn-space-1) / 2) var(--corn-space-2); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-map-collision); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-map-collision); font-size: var(--corn-text-xs); font-weight: 700; }
42
42
  .hx-run-swatch { display: inline-block; width: 14px; height: 14px; flex: none; box-sizing: border-box; border-radius: 50%; border: var(--corn-border-strong) solid var(--corn-added); }
43
43
  .hx-run-swatch--collision { border: var(--corn-border-strong) dashed var(--corn-map-collision); }
44
+
45
+ /* The History layer (spec 0014 D3, history.js): a halo round each node the history changed; its width how often (--w), its colour how lately */
46
+ .hx-history-halos { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
47
+ .hx-history-halos[hidden] { display: none; }
48
+ .hx-history-halo { position: absolute; width: 0; height: 0; --r: 12px; --w: 2px; --halo: var(--corn-history-old); }
49
+ .hx-history-halo::before { content: ""; position: absolute; left: calc(var(--r) * -1); top: calc(var(--r) * -1); width: calc(var(--r) * 2); height: calc(var(--r) * 2); box-sizing: border-box; border-radius: 50%; border: var(--w) solid var(--halo); opacity: 0.7; }
50
+ .hx-history-halo[data-band="week"], .hx-history-swatch[data-band="week"] { --halo: var(--corn-history-week); }
51
+ .hx-history-halo[data-band="month"], .hx-history-swatch[data-band="month"] { --halo: var(--corn-history-month); }
52
+ .hx-history-halo[data-band="old"], .hx-history-swatch[data-band="old"] { --halo: var(--corn-history-old); }
53
+ .hx-history-swatch { --halo: var(--corn-text-3); display: inline-block; width: 14px; height: 14px; flex: none; box-sizing: border-box; border-radius: 50%; border: var(--corn-border-strong) solid var(--halo); }
54
+ .hx-history-swatch--wide { border-width: calc(var(--corn-border-strong) * 2); }
55
+ /* The bar while a spec is picked: what it reached, and the way back to the whole map */
56
+ .hx-history-bar { position: absolute; top: var(--corn-space-3); left: 50%; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: var(--corn-space-3); max-width: calc(100% - var(--corn-space-6)); padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-pill); font-size: var(--corn-text-sm); color: var(--corn-text); }
57
+ .hx-history-bar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -93,6 +93,7 @@ export function layerRows(inst) {
93
93
  const project = state.projectLayers.filter((l) => held.has(l.key)).map((l) => ({ key: l.key, label: l.label, desc: l.desc || '', project: true, ...projectDot(l) }));
94
94
  // A starting row a project layer has taken every node from goes (spec 0009 D7, example 3); with no project layer, every starting row stays, as it always was
95
95
  const starting = LAYER_DEFS.filter((l) => !l.overlay && (held.has(l.key) || !left.has(l.key))).map(dotted);
96
+ const halos = state.historyRow && state.historyRow(); // the History layer's row, when the config has history on (history.js): an overlay, off to start
96
97
  const badges = state.workRow && state.workRow(); // the Work layer's row, when the page has a forge and somebody is signed in (work-view.js): an overlay, off to start
97
98
  const known = new Set([...LAYER_DEFS.map((l) => l.key), ...state.projectLayers.map((l) => l.key)]);
98
99
  const extra = [];
@@ -101,7 +102,7 @@ export function layerRows(inst) {
101
102
  known.add(key);
102
103
  extra.push({ key, label: key.charAt(0).toUpperCase() + key.slice(1), color: rowColor(inst, { type: key, group: key }, NO_COLOR), desc: `Nodes of the type ${key}` });
103
104
  });
104
- return { layers: [...orderRows(project, starting, state.layerOrder), ...extra], overlays: [...LAYER_DEFS.filter((l) => l.overlay).map(dotted), ...(badges ? [badges] : [])] };
105
+ return { layers: [...orderRows(project, starting, state.layerOrder), ...extra], overlays: [...LAYER_DEFS.filter((l) => l.overlay).map(dotted), ...(badges ? [badges] : []), ...(halos ? [halos] : [])] };
105
106
  }
106
107
 
107
108
  // ---------------------------------------------------------------------------
@@ -141,6 +142,7 @@ export function setProjectLayers(inst, raw) {
141
142
  for (const l of LAYER_DEFS) defaults[l.key] = !STARTS_OFF.has(l.key);
142
143
  for (const l of cfg.add) defaults[l.key] = true;
143
144
  defaults['work-badges'] = false;
145
+ defaults['history-halos'] = false; // the History layer (history-model.js HISTORY_LAYER)
144
146
  for (const k of cfg.off) defaults[k] = false;
145
147
  state.layerDefaults = defaults;
146
148
  const mem = memoryOf(inst);
@@ -10,6 +10,10 @@
10
10
  * trailHtml(commit, ctx) a commit's trail: `Spec 0012 → Issue #283 → PR #284 → 0281cba`, a gap dashed (`no spec`, `no issue`)
11
11
  * historySectionHtml(node, ctx) the node panel's History section
12
12
  * specReach(history, spec) the nodes a spec's commits touched, and how many commits named it
13
+ * heatOf(history, at) the History layer (spec 0014 D3): per node, how often it changed and how lately, as of a commit
14
+ * haloWidth(count, max) a halo's width on screen (px) for how often its node changed
15
+ * historyRowOf(status, heat) the Layers menu's row under Overlays
16
+ * specBarHtml(pick, ctx) the bar on the map while a spec is picked: `Spec 0012 · Work as a view: 6 commits, 72 nodes`
13
17
  */
14
18
 
15
19
  import { escapeHtml as esc } from '../core/text.js';
@@ -176,3 +180,69 @@ export function specReach(history, spec) {
176
180
  }
177
181
  return { nodes, commits };
178
182
  }
183
+
184
+ /** The History layer's key in the Layers menu and `state.activeLayers` (spec 0014 D3): an overlay, off to start */
185
+ export const HISTORY_LAYER = 'history-halos';
186
+ /** The most halos drawn at once */
187
+ export const MAX_HALOS = 600;
188
+ /** How lately a node changed, as of the timeline's commit: within a week, within a month (30 days), or before */
189
+ export const HALO_BANDS = Object.freeze(['week', 'month', 'old']);
190
+ const DAY_MS = 86_400_000;
191
+ const bandOf = (days) => (days <= 7 ? 'week' : days <= 30 ? 'month' : 'old');
192
+
193
+ /**
194
+ * Each node's heat as of a commit: how many commits up to it changed the node, the last of them, and how many days before the commit that was.
195
+ * The age is counted from the commit's own date, not today's, so a replay reads as it did then.
196
+ * @param {{ commits: { date: string }[], nodes: Record<string, { commits: number[] }> } | null} history
197
+ * @param {number | null} [at] a commit's index; the newest when it is left out or out of range
198
+ * @returns {{ at: number, nodes: Map<string, { count: number, last: number, days: number, band: 'week' | 'month' | 'old' }>, max: number }}
199
+ */
200
+ export function heatOf(history, at = null) {
201
+ const commits = (history && history.commits) || [];
202
+ const nodes = new Map();
203
+ if (!commits.length) return { at: -1, nodes, max: 0 };
204
+ const i = Number.isInteger(at) && at >= 0 && at < commits.length ? at : commits.length - 1;
205
+ const now = Date.parse(commits[i].date);
206
+ let max = 0;
207
+ for (const [id, e] of Object.entries(history.nodes || {})) {
208
+ let count = 0;
209
+ let last = -1;
210
+ for (const k of (e && e.commits) || []) { if (k > i) break; count++; last = k; }
211
+ if (!count) continue;
212
+ const days = Math.max(0, (now - Date.parse(commits[last].date)) / DAY_MS);
213
+ nodes.set(id, { count, last, days, band: bandOf(days) });
214
+ if (count > max) max = count;
215
+ }
216
+ return { at: i, nodes, max };
217
+ }
218
+
219
+ /** A halo's width on screen (px): from 1.5 for a node changed once to 6 for the most changed on the map (by the square root, so a few busy nodes do not flatten the rest) */
220
+ export const haloWidth = (count, max) => (max > 0 && count > 0 ? Math.round((1.5 + 4.5 * Math.sqrt(Math.min(count, max) / max)) * 10) / 10 : 0);
221
+
222
+ /**
223
+ * The Layers menu's row for the History layer: its count in words while the history is read.
224
+ * @param {'idle' | 'loading' | 'ready' | 'error'} status
225
+ * @param {{ nodes: Map<string, unknown> } | null} heat
226
+ * @param {string} color the dot's colour
227
+ */
228
+ export function historyRowOf(status, heat, color) {
229
+ const n = heat ? heat.nodes.size : 0;
230
+ const countText = status === 'ready' ? `${n} ${n === 1 ? 'node' : 'nodes'}` : status === 'loading' ? 'reading…' : status === 'error' ? 'not read' : 'not read yet';
231
+ return { key: HISTORY_LAYER, label: 'History', color, overlay: true, countText, desc: 'A halo round each node the history changed: the wider, the more often; pink this week, violet this month, grey before. Picking a spec in a node\'s History lights what it reached.' };
232
+ }
233
+
234
+ /**
235
+ * The bar on the map while a spec is picked (spec 0014 D3): the spec, a link to its file on the forge when there is one, what it reached, and how to show the whole map again.
236
+ * @param {{ spec: string, nodes: Set<string>, commits: number }} pick
237
+ * @param {{ links: ReturnType<typeof forgeLinks>, specs: ReturnType<typeof specFiles> }} ctx
238
+ */
239
+ export function specBarHtml(pick, { links, specs }) {
240
+ const spec = specs && specs.get(pick.spec);
241
+ const href = spec && links ? links.file(spec.file) : null;
242
+ const name = href ? `<a class="hx-link" data-corn="text-link" href="${esc(href)}" target="_blank" rel="noreferrer">Spec ${esc(pick.spec)}</a>` : `<b>Spec ${esc(pick.spec)}</b>`;
243
+ const label = spec ? ` · ${esc(spec.label)}` : '';
244
+ const c = pick.commits;
245
+ const n = pick.nodes.size;
246
+ return `<span class="hx-history-bar-text">${name}${label}: ${c} ${c === 1 ? 'commit' : 'commits'}, ${n} ${n === 1 ? 'node' : 'nodes'}</span>`
247
+ + `<button type="button" class="hx-btn hx-btn--quiet hx-textact" data-corn-kind="quiet" data-history-unpick>Show the whole map</button>`;
248
+ }
@@ -3,7 +3,12 @@
3
3
  *
4
4
  * A node's history on an instance (spec 0014 D2): reads `GET /api/history` (core/history.js) once, the first time the node panel asks, and
5
5
  * answers the panel's History section; picking a spec lights every node its commits touched (`state.historyPick`, which scene.js dims around).
6
- * Nothing is fetched while the config says `history: false`, and the panel then has no History section.
6
+ * Nothing is fetched while the config says `history: false`, and the panel then has no History section, the Layers menu no History row.
7
+ *
8
+ * The History layer (spec 0014 D3): a row under Overlays, off to start and remembered like the others. While it is on, each node the history changed
9
+ * wears a halo, its width how often and its colour how lately (as of the timeline's commit, `state.historyAt`, else the newest). A DOM layer over the map,
10
+ * like the runs' marks, decoration for the eye (`aria-hidden`): the words are the node panel's History section. While a spec is picked a bar on the map
11
+ * names it, what it reached, and how to show the whole map again.
7
12
  *
8
13
  * initHistory(inst, config) once, with the client config (`history`, `forge`); returns how to stop
9
14
  *
@@ -12,11 +17,14 @@
12
17
  * history:pick spec | null (emit) light what that spec reached, or nothing; picking the lit spec again ends it
13
18
  * history:all (none) (emit) the section lists every commit, not only the newest
14
19
  * history:changed (none) (emitted) the read ended, or a pick changed: the open panel draws its History section again
20
+ * history:legend { active } (emitted) the History layer is drawn: the Layers menu shows its legend
15
21
  */
16
22
 
17
23
  import { credentialed } from './engine/connection.js';
18
24
  import { announce } from './engine/keyboard.js';
19
- import { forgeLinks, historySectionHtml, specFiles, specReach } from './history-model.js';
25
+ import { onLayersChange, redrawLayers } from './engine/layers.js';
26
+ import { layerOn } from './layer-model.js';
27
+ import { HISTORY_LAYER, MAX_HALOS, forgeLinks, haloWidth, heatOf, historyRowOf, historySectionHtml, specBarHtml, specFiles, specReach } from './history-model.js';
20
28
 
21
29
  /** Where the server answers the history (server/server.js) */
22
30
  export const HISTORY_PATH = '/api/history';
@@ -27,10 +35,108 @@ export const HISTORY_PATH = '/api/history';
27
35
  * @returns {() => void}
28
36
  */
29
37
  export function initHistory(inst, config) {
38
+ /** The dot of the Layers menu's row: this week's halo colour, as the theme has it */
39
+ const haloColor = () => {
40
+ const root = inst.doc && inst.doc.documentElement;
41
+ const view = inst.doc && inst.doc.defaultView;
42
+ const v = root && view && view.getComputedStyle ? view.getComputedStyle(root).getPropertyValue('--corn-history-week').trim() : '';
43
+ return v || 'currentColor';
44
+ };
30
45
  const { state } = inst;
31
46
  const on = !!(config && config.history === true);
32
47
  const mem = { status: on ? 'idle' : 'off', history: null, error: '', all: false, node: null, links: forgeLinks(config && config.forge), specs: null };
33
48
  const stops = [];
49
+ const halos = new Map(); // the halo elements by node id, kept between frames
50
+ let heat = null; // heatOf, for the history and the commit it was worked out for
51
+ let placed = '';
52
+ let layerEl = null;
53
+ let barEl = null;
54
+
55
+ const stage = () => (state.canvas && state.canvas.parentElement) || null;
56
+ // Off until the layers have their defaults (a layer with no entry reads as on), and never in the Work view
57
+ const haloOn = () => mem.status !== 'off' && !state.workRows && Object.hasOwn(state.layerDefaults || {}, HISTORY_LAYER) && layerOn(state, HISTORY_LAYER);
58
+ const heatNow = () => {
59
+ if (mem.status !== 'ready') return null;
60
+ const at = Number.isInteger(state.historyAt) ? state.historyAt : null;
61
+ if (!heat || heat.of !== mem.history || heat.asked !== at) heat = { of: mem.history, asked: at, ...heatOf(mem.history, at) };
62
+ return heat;
63
+ };
64
+
65
+ function clearHalos() {
66
+ for (const el of halos.values()) el.remove();
67
+ halos.clear();
68
+ placed = '';
69
+ if (layerEl) layerEl.hidden = true;
70
+ }
71
+
72
+ /** Puts a halo on each node the history changed, at the camera: only their place changes on a pan */
73
+ function syncHalos(scene, camera) {
74
+ const h = haloOn() ? heatNow() : null;
75
+ if (!h || !h.nodes.size) { if (halos.size || (layerEl && !layerEl.hidden)) clearHalos(); return; }
76
+ const key = `${scene.version}|${camera.x}|${camera.y}|${camera.zoom}|${h.at}`;
77
+ if (key === placed && layerEl && layerEl.isConnected) return;
78
+ const host = stage();
79
+ if (!host) return;
80
+ if (!layerEl || !layerEl.isConnected) {
81
+ layerEl = inst.doc.createElement('div');
82
+ layerEl.className = 'hx-history-halos';
83
+ layerEl.setAttribute('aria-hidden', 'true');
84
+ host.append(layerEl);
85
+ halos.clear();
86
+ }
87
+ placed = key;
88
+ layerEl.hidden = false;
89
+ const seen = new Set();
90
+ for (const node of scene.nodes) {
91
+ if (seen.size >= MAX_HALOS) break;
92
+ const it = h.nodes.get(node.id);
93
+ if (!it || !(node.alpha > 0.2)) continue;
94
+ seen.add(node.id);
95
+ let el = halos.get(node.id);
96
+ if (!el) {
97
+ el = inst.doc.createElement('span');
98
+ el.className = 'hx-history-halo';
99
+ el.dataset.node = node.id;
100
+ layerEl.append(el);
101
+ halos.set(node.id, el);
102
+ }
103
+ const w = haloWidth(it.count, h.max);
104
+ el.dataset.band = it.band;
105
+ el.style.left = `${(node.x * camera.zoom + camera.x).toFixed(1)}px`;
106
+ el.style.top = `${(node.y * camera.zoom + camera.y).toFixed(1)}px`;
107
+ el.style.setProperty('--r', `${(Math.max(6, node.r * camera.zoom) + 3 + w / 2).toFixed(1)}px`);
108
+ el.style.setProperty('--w', `${w}px`);
109
+ }
110
+ for (const [id, el] of halos) if (!seen.has(id)) { el.remove(); halos.delete(id); }
111
+ }
112
+
113
+ /** The bar on the map while a spec is picked */
114
+ function paintBar() {
115
+ const pickNow = state.historyPick;
116
+ if (!pickNow) { if (barEl) { barEl.remove(); barEl = null; } return; }
117
+ const host = stage();
118
+ if (!host) return;
119
+ if (!barEl || !barEl.isConnected) {
120
+ barEl = inst.doc.createElement('div');
121
+ barEl.className = 'hx-history-bar glass';
122
+ barEl.setAttribute('role', 'group');
123
+ barEl.setAttribute('aria-label', 'Picked spec');
124
+ barEl.addEventListener('click', (e) => { if (e.target.closest('[data-history-unpick]')) pick(null); });
125
+ host.append(barEl);
126
+ }
127
+ if (!mem.specs) mem.specs = specFiles(state.nodes);
128
+ barEl.innerHTML = specBarHtml(pickNow, { links: mem.links, specs: mem.specs });
129
+ }
130
+
131
+ /** The layer went on or off, or the read ended: the row's count, the legend and the halos follow */
132
+ function layerChanged() {
133
+ const on = haloOn();
134
+ if (on && mem.status === 'idle') load();
135
+ inst.emit('history:legend', { active: on && mem.status === 'ready' });
136
+ if (!on) clearHalos();
137
+ placed = '';
138
+ if (inst.map) inst.map.render();
139
+ }
34
140
 
35
141
  async function load() {
36
142
  if (mem.status !== 'idle') return;
@@ -46,6 +152,8 @@ export function initHistory(inst, config) {
46
152
  mem.error = inst.offline() ? 'You are offline, so the history could not be read.' : String(err && err.message ? err.message : err);
47
153
  }
48
154
  inst.emit('history:changed');
155
+ redrawLayers(inst); // the row's count
156
+ layerChanged();
49
157
  }
50
158
 
51
159
  function pick(spec) {
@@ -55,14 +163,24 @@ export function initHistory(inst, config) {
55
163
  announce(inst, 'Showing the whole map again');
56
164
  } else {
57
165
  const { nodes, commits } = specReach(mem.history, spec);
58
- state.historyPick = { spec, nodes };
166
+ state.historyPick = { spec, nodes, commits };
59
167
  announce(inst, `Spec ${spec}: ${commits} ${commits === 1 ? 'commit' : 'commits'} reached ${nodes.size} ${nodes.size === 1 ? 'node' : 'nodes'}; the rest is dimmed`);
60
168
  }
61
169
  inst.touchScene();
170
+ paintBar();
62
171
  if (inst.map) inst.map.render();
63
172
  inst.emit('history:changed');
64
173
  }
65
174
 
175
+ if (mem.status !== 'off') {
176
+ // The Layers menu's row under Overlays (engine/layers.js `layerRows`), in the colour of this week's halo
177
+ state.historyRow = () => historyRowOf(mem.status, mem.status === 'ready' ? heatNow() : null, haloColor());
178
+ stops.push(onLayersChange(inst, layerChanged));
179
+ if (inst.map) stops.push(inst.map.onPaint((scene, camera) => syncHalos(scene, camera)));
180
+ stops.push(inst.on('history:at', () => { placed = ''; if (inst.map) inst.map.render(); redrawLayers(inst); }));
181
+ if (haloOn()) layerChanged();
182
+ }
183
+
66
184
  stops.push(inst.on('history:section', (node) => {
67
185
  if (mem.status === 'off' || !node || typeof node.id !== 'string') return undefined;
68
186
  if (mem.node !== node.id) { mem.node = node.id; mem.all = false; } // "Show all" is for the node it was pressed on
@@ -74,5 +192,12 @@ export function initHistory(inst, config) {
74
192
  // A selection cleared (the bare map, Escape, Close) ends a pick too: nothing on screen would say why the map is dim
75
193
  stops.push(inst.on('selection', () => { if (!state.selectedNode && state.historyPick) pick(null); }));
76
194
  stops.push(inst.on('history:all', () => { mem.all = true; inst.emit('history:changed'); }));
77
- return () => { stops.forEach((s) => s()); if (state.historyPick) { state.historyPick = null; inst.touchScene(); } };
195
+ return () => {
196
+ stops.forEach((s) => s());
197
+ clearHalos();
198
+ if (layerEl) layerEl.remove();
199
+ if (barEl) barEl.remove();
200
+ state.historyRow = null;
201
+ if (state.historyPick) { state.historyPick = null; inst.touchScene(); }
202
+ };
78
203
  }
@@ -87,6 +87,13 @@
87
87
  <div class="hx-legend-row"><span class="hx-run-swatch hx-run-swatch--flight" aria-hidden="true"></span><span>In flight: a pulsing ring (still under reduced motion)</span></div>
88
88
  <div class="hx-legend-row"><span class="hx-run-swatch hx-run-swatch--collision" aria-hidden="true"></span><span>Collision: dashed ring, ⚠ and the words, where two open runs change one node</span></div>
89
89
  </div>
90
+ <div class="hx-menu-section" data-corn="menu-section" part="menu-section" hidden>
91
+ <div class="hx-menu-title" data-corn="menu-title" part="menu-title"><span>History</span></div>
92
+ <div class="hx-legend-row"><span class="hx-history-swatch hx-history-swatch--wide" aria-hidden="true"></span><span>A wider halo: changed more often</span></div>
93
+ <div class="hx-legend-row"><span class="hx-history-swatch" data-band="week" aria-hidden="true"></span><span>Changed this week</span></div>
94
+ <div class="hx-legend-row"><span class="hx-history-swatch" data-band="month" aria-hidden="true"></span><span>Changed this month</span></div>
95
+ <div class="hx-legend-row"><span class="hx-history-swatch" data-band="old" aria-hidden="true"></span><span>Not for over a month (as of the timeline's commit)</span></div>
96
+ </div>
90
97
  <div class="hx-menu-section" data-corn="menu-section" part="menu-section" hidden>
91
98
  <div class="hx-menu-title" data-corn="menu-title" part="menu-title"><span>Proposal marks</span></div>
92
99
  <div class="hx-legend-row"><span class="hx-mark-dot hx-mark-dot--added" data-corn="mark-dot" part="mark-dot" data-corn-state="added"></span><span>Added: dashed ring</span></div>
@@ -45,6 +45,8 @@ export function createState() {
45
45
  searchQuery: '',
46
46
  /** The spec picked in a node's History (history.js, spec 0014 D3): `{ spec, nodes }`, the nodes its commits touched, lit while the rest dims; or null */
47
47
  historyPick: null,
48
+ historyAt: null, // the timeline's commit (spec 0014 D1), an index into the history; null is the newest
49
+ historyRow: null, // the History layer's row in the Layers menu (history.js), while the config has history on
48
50
  /** The id of the search match the stepping is on (search.js), or null: the map draws its halo and places its label first of the matches */
49
51
  searchCurrent: null,
50
52
  /** The id of the node the pointer is on (input.js): a node with no label is named by a chip while it is */
@@ -61,6 +61,13 @@ export const markup = () => ({
61
61
  <div class="hx-legend-row"><span class="hx-run-swatch hx-run-swatch--flight" aria-hidden="true"></span><span>In flight: a pulsing ring (still under reduced motion)</span></div>
62
62
  <div class="hx-legend-row"><span class="hx-run-swatch hx-run-swatch--collision" aria-hidden="true"></span><span>Collision: dashed ring, ⚠ and the words, where two open runs change one node</span></div>
63
63
  </div>
64
+ <div id="history-legend" class="hx-menu-section" data-corn="menu-section" hidden>
65
+ <div class="hx-menu-title" data-corn="menu-title"><span>History</span></div>
66
+ <div class="hx-legend-row"><span class="hx-history-swatch hx-history-swatch--wide" aria-hidden="true"></span><span>A wider halo: changed more often</span></div>
67
+ <div class="hx-legend-row"><span class="hx-history-swatch" data-band="week" aria-hidden="true"></span><span>Changed this week</span></div>
68
+ <div class="hx-legend-row"><span class="hx-history-swatch" data-band="month" aria-hidden="true"></span><span>Changed this month</span></div>
69
+ <div class="hx-legend-row"><span class="hx-history-swatch" data-band="old" aria-hidden="true"></span><span>Not for over a month (as of the timeline's commit)</span></div>
70
+ </div>
64
71
  <div id="proposal-legend" class="hx-menu-section" data-corn="menu-section" hidden>
65
72
  <div class="hx-menu-title" data-corn="menu-title"><span>Proposal marks</span></div>
66
73
  <div class="hx-legend-row"><span class="hx-mark-dot hx-mark-dot--added" data-corn="mark-dot" data-corn-state="added"></span><span>Added: dashed ring</span></div>
@@ -316,7 +323,8 @@ export function mount(root, inst, options = {}) {
316
323
  scope.on('layers:redraw', renderLayerToggles);
317
324
  scope.on('theme', renderLayerToggles); // the dots and the legends are drawn in the theme's colours
318
325
  scope.on('view', syncView);
319
- scope.on('runs:map', ({ active }) => { const legend = own('runs-legend'); if (legend) legend.hidden = !active; }); // runs are on the map (the Work list): the legend says what each mark is
326
+ scope.on('runs:map', ({ active }) => { const legend = own('runs-legend'); if (legend) legend.hidden = !active; });
327
+ scope.on('history:legend', ({ active }) => { const legend = own('history-legend'); if (legend) legend.hidden = !active; }); // the History layer is drawn (history.js): what a halo's width and colour say // runs are on the map (the Work list): the legend says what each mark is
320
328
  // The marks legend is there while a proposal is open (the proposal's bar says so: engine/proposal.js)
321
329
  const showLegend = (open) => { const legend = own('proposal-legend'); if (legend) legend.hidden = !open; };
322
330
  scope.on('proposal:draw', ({ open }) => showLegend(open));
@@ -203,6 +203,10 @@
203
203
  --corn-work-edge-work: auto;
204
204
  --corn-work-edge-code: auto;
205
205
  --corn-work-edge-adds: auto;
206
+ /* The History layer (spec 0014 D3): a node's halo, by how lately it changed as of the timeline's commit */
207
+ --corn-history-week: #f472b6;
208
+ --corn-history-month: #a78bfa;
209
+ --corn-history-old: #94a3b8;
206
210
  /* Node fill by group */
207
211
  --corn-map-group-app: auto;
208
212
  --corn-map-group-pkg: auto;
@@ -256,6 +260,9 @@
256
260
  --corn-info: #03679e;
257
261
 
258
262
  --corn-added: #197c6f;
263
+ --corn-history-week: #be185d;
264
+ --corn-history-month: #6d28d9;
265
+ --corn-history-old: #64748b;
259
266
  --corn-changed: #8f6703;
260
267
  --corn-removed: #e20b0b;
261
268
  --corn-edit: #6839f6;
@@ -305,6 +312,9 @@
305
312
  --corn-info: #03679e;
306
313
 
307
314
  --corn-added: #197c6f;
315
+ --corn-history-week: #be185d;
316
+ --corn-history-month: #6d28d9;
317
+ --corn-history-old: #64748b;
308
318
  --corn-changed: #8f6703;
309
319
  --corn-removed: #e20b0b;
310
320
  --corn-edit: #6839f6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcorn245/cornfield",
3
- "version": "0.60.0",
3
+ "version": "0.61.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)",