@popcorn245/cornfield 0.55.0 → 0.57.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.
Files changed (60) hide show
  1. package/core/contrast.js +12 -1
  2. package/core/schema.js +6 -0
  3. package/core/strings.js +1 -2
  4. package/explorer/css/account.css +1 -1
  5. package/explorer/css/changes.css +1 -1
  6. package/explorer/css/dialogs.css +1 -1
  7. package/explorer/css/node-panel.css +1 -1
  8. package/explorer/css/page.css +0 -8
  9. package/explorer/css/sheets.css +1 -1
  10. package/explorer/css/work.css +9 -30
  11. package/explorer/deep-link.js +11 -24
  12. package/explorer/engine/hint.js +2 -2
  13. package/explorer/engine/keyboard.js +1 -1
  14. package/explorer/engine/layers.js +4 -2
  15. package/explorer/engine/map-rect.js +2 -2
  16. package/explorer/engine/map-style.js +4 -1
  17. package/explorer/engine/proposal.js +3 -3
  18. package/explorer/engine/sheets.js +3 -3
  19. package/explorer/focus-room.js +1 -1
  20. package/explorer/forge-panel-model.js +2 -36
  21. package/explorer/forge-panel.js +4 -9
  22. package/explorer/index.html +2 -11
  23. package/explorer/instance-state.js +0 -6
  24. package/explorer/instance.js +15 -9
  25. package/explorer/page-pieces.js +1 -1
  26. package/explorer/page.js +5 -4
  27. package/explorer/pieces/decision.js +3 -3
  28. package/explorer/pieces/layers.js +1 -1
  29. package/explorer/pieces/node-panel.js +38 -14
  30. package/explorer/pieces/proposal.js +6 -6
  31. package/explorer/pieces/review.js +2 -2
  32. package/explorer/pieces/work-agent.js +3 -2
  33. package/explorer/pieces/work-common.js +14 -15
  34. package/explorer/pieces/work-confirm.js +11 -10
  35. package/explorer/pieces/work-data.js +24 -31
  36. package/explorer/pieces/work-deploys.js +42 -41
  37. package/explorer/pieces/work-issues.js +32 -29
  38. package/explorer/pieces/work-list.js +406 -0
  39. package/explorer/pieces/work-markup.js +9 -14
  40. package/explorer/pieces/work-notes.js +0 -1
  41. package/explorer/pieces/work-paint.js +74 -62
  42. package/explorer/pieces/work-prs.js +25 -66
  43. package/explorer/pieces/work-runs.js +47 -57
  44. package/explorer/pieces/work-specs.js +19 -2
  45. package/explorer/pieces/work-threads.js +28 -48
  46. package/explorer/pieces/work.js +38 -40
  47. package/explorer/proposal-model.js +6 -6
  48. package/explorer/proposal.js +1 -1
  49. package/explorer/runs-view.js +10 -18
  50. package/explorer/scene.js +1 -3
  51. package/explorer/sheets.js +1 -1
  52. package/explorer/tokens.css +6 -2
  53. package/explorer/waiting-view.js +3 -3
  54. package/explorer/work-badge-model.js +161 -0
  55. package/explorer/work-badges.js +143 -0
  56. package/explorer/work-model.js +80 -39
  57. package/explorer/work-view.css +11 -4
  58. package/explorer/work-view.js +193 -68
  59. package/package.json +1 -1
  60. package/explorer/pieces/work-events.js +0 -285
@@ -15,9 +15,10 @@
15
15
  */
16
16
 
17
17
  import { NODE_THEMES } from '../core/schema.js';
18
- import { WORK_KINDS, WORK_THEMES, workType } from '../core/schema.js';
18
+ import { WORK_KINDS, WORK_THEMES, WORK_EDGE_THEMES, workType } from '../core/schema.js';
19
19
  import { relativeTime } from './review-model.js';
20
- import { SPEC_STATE_WORDS } from './waiting-model.js';
20
+ import { SPEC_STATE_WORDS, specStateOf } from './waiting-model.js';
21
+ import { runName, canAnswer } from './runs-model.js';
21
22
  import { cornState } from './corn-state.js';
22
23
  import { escapeHtml as esc } from '../core/text.js';
23
24
  import { safeUrl } from './pieces/work-common.js';
@@ -105,6 +106,52 @@ export function termsOf(item) {
105
106
  /** A node the graph names that the map does not hold: a planned one, by its type (an unknown type reads as a page) */
106
107
  const plannedType = (type) => (typeof type === 'string' && Object.hasOwn(NODE_THEMES, type) ? type : 'page');
107
108
 
109
+ /**
110
+ * The node of a piece of work: what the scene draws and the node panel shows for it. `item` is a node of the server's graph, or an old piece of work made
111
+ * by `oldItem` (older than the graph's 14 days, or past its caps: the Work list reaches it, and the node panel shows it by the same path, `old: true`).
112
+ */
113
+ export function workNode(item, degree = 0) {
114
+ const theme = WORK_THEMES[item.kind];
115
+ const title = text(item.title) || tagOf(item);
116
+ const draft = isDraft(item);
117
+ return {
118
+ id: item.id, type: workType(item.kind), work: item.kind, shape: theme.shape, label: item.kind === 'deploy' ? `Deploy · ${clip(title, LABEL_CHARS)}` : `${tagOf(item)} · ${clip(title, LABEL_CHARS)}`,
119
+ title, item, r: theme.r, color: theme.color, letters: theme.letters, terms: termsOf(item), groupName: draft ? DRAFT_LAYER_WORDS : LAYER_WORDS[item.kind],
120
+ draft, waiting: item.waiting === true, updated: text(item.updated), stage: text(item.stage), degree, x: 0, y: 0,
121
+ };
122
+ }
123
+
124
+ /** What the Work list holds that the graph does not: a node for it, drawn nowhere (`old`), for the node panel */
125
+ export const oldNode = (item) => ({ ...workNode(item), old: true });
126
+
127
+ /**
128
+ * A piece of work the graph does not hold (older than its 14 days, or past its caps), as a node of the graph would give it, made from what the Work list read
129
+ * of it: a pull request or an issue of the lists, a thread, a run of the runs list, a deploy, a proposal of the specs list. Null for a kind or a shape it cannot read.
130
+ * Every word of it is the forge's: the panel escapes it, and `url` is an http(s) link or nothing.
131
+ * @param {string} kind pull | issue | thread | run | deploy | proposal
132
+ * @param {object} src the list's own item
133
+ */
134
+ export function oldItem(kind, src) {
135
+ if (!src || typeof src !== 'object') return null;
136
+ const who = (a) => (a && typeof a.login === 'string' ? a.login : null);
137
+ const base = { kind, title: text(src.title), url: safeUrl(src.url), updated: text(src.updatedAt) || text(src.createdAt), waiting: false };
138
+ const num = Number.isInteger(src.number) ? src.number : null;
139
+ switch (kind) {
140
+ case 'pull': return num === null ? null : { ...base, id: `pull:${num}`, stage: 'build', state: text(src.state), open: src.state === 'open', number: num, draft: src.draft === true, author: who(src.author) };
141
+ case 'issue': return num === null ? null : { ...base, id: `issue:${num}`, stage: 'talk', state: text(src.state), open: src.state === 'open', number: num, author: who(src.author) };
142
+ case 'thread': return num === null ? null : { ...base, id: `thread:${num}`, stage: 'talk', state: text(src.state), open: src.state === 'open', number: num, threadKind: text(src.kind), author: who(src.author) };
143
+ case 'run': return typeof src.runId === 'string' ? { ...base, id: `run:${src.runId}`, stage: 'build', title: runName(src), state: text(src.status), open: src.open === true, waiting: canAnswer(src), runId: src.runId, number: null, url: safeUrl(src.report && src.report.url) || safeUrl(src.comment && src.comment.url) || safeUrl(src.pull && src.pull.url), updated: text(src.lastActivity) || text(src.requestedAt), runKind: text(src.kind), requestedBy: src.requestedBy ?? null } : null;
144
+ case 'deploy': return typeof src.id === 'string' ? { ...base, id: `deploy:${src.id}`, stage: 'ship', title: text(src.title) || text(src.name), state: text(src.state), open: src.state === 'queued' || src.state === 'running', deployId: src.id, number: null, updated: text(src.updatedAt) || text(src.createdAt), name: text(src.name), branch: text(src.branch), sha: text(src.sha), author: who(src.actor) } : null;
145
+ case 'proposal': {
146
+ if (typeof src.slug !== 'string') return null;
147
+ const { state, counted } = specStateOf(src);
148
+ const pull = src.pull && Number.isInteger(src.pull.number) ? src.pull : null;
149
+ return { ...base, id: `proposal:${src.slug}`, stage: 'decide', title: text(src.title) || src.slug, state, open: true, waiting: counted, slug: src.slug, number: pull ? pull.number : null, url: safeUrl(pull && pull.url), updated: text(pull && (pull.updatedAt || pull.createdAt)), draft: state === 'local', author: who(pull && pull.author), source: text(src.source) };
150
+ }
151
+ default: return null;
152
+ }
153
+ }
154
+
108
155
  /**
109
156
  * The scene of the Work view.
110
157
  * @param {{ nodes?: object[], edges?: { from: string, to: string, rel: string }[] } | null} graph the server's answer
@@ -142,16 +189,7 @@ export function workScene(graph, mapNodes) {
142
189
  const degree = new Map();
143
190
  for (const e of edges) { degree.set(e.from, (degree.get(e.from) || 0) + 1); degree.set(e.to, (degree.get(e.to) || 0) + 1); }
144
191
  const nodes = [];
145
- for (const item of work.values()) {
146
- const theme = WORK_THEMES[item.kind];
147
- const title = text(item.title) || tagOf(item);
148
- const draft = isDraft(item);
149
- nodes.push({
150
- id: item.id, type: workType(item.kind), work: item.kind, shape: theme.shape, label: item.kind === 'deploy' ? `Deploy · ${clip(title, LABEL_CHARS)}` : `${tagOf(item)} · ${clip(title, LABEL_CHARS)}`,
151
- title, item, r: theme.r, color: theme.color, letters: theme.letters, terms: termsOf(item), groupName: draft ? DRAFT_LAYER_WORDS : LAYER_WORDS[item.kind],
152
- draft, waiting: item.waiting === true, updated: text(item.updated), stage: text(item.stage), degree: degree.get(item.id) || 0, x: 0, y: 0,
153
- });
154
- }
192
+ for (const item of work.values()) nodes.push(workNode(item, degree.get(item.id) || 0));
155
193
  let code = 0;
156
194
  for (const [id, by] of touched) {
157
195
  const base = onMap.get(id);
@@ -165,8 +203,6 @@ export function workScene(graph, mapNodes) {
165
203
  const waiting = nodes.filter((n) => n.waiting).length;
166
204
  return { nodes, edges, counts: { work: work.size, code, waiting } };
167
205
  }
168
- /** The colours of the lines of the Work view: a work-to-work link, a link to code, and what a proposal adds */
169
- const WORK_EDGE_COLORS = { work: '#818cf8', code: '#cbd5e1', adds: '#2dd4bf' };
170
206
 
171
207
  /**
172
208
  * One line of the Work view for the scene (spec 0012 D2, D3): a work-to-work link solid, `mentions` dotted, `adds` dashed; the word of its rel beside a lit one. The scene calls it
@@ -178,10 +214,12 @@ const WORK_EDGE_COLORS = { work: '#818cf8', code: '#cbd5e1', adds: '#2dd4bf' };
178
214
  * @param {boolean} focused whether a node is selected
179
215
  * @param {string} key the line's key
180
216
  * @param {{ PROPOSED_DASH: number[], USAGE_DASH: number[] }} dashes the map's two dash patterns
217
+ * @param {Partial<Record<'work' | 'code' | 'adds', string>>} [colors] what the theme's `--corn-work-edge-<name>` tokens say (`state.workEdgeColors`); a name it does not set is drawn in its default (core/schema.js WORK_EDGE_THEMES)
181
218
  */
182
- export function workEdge(edge, source, target, connected, focused, key, dashes) {
219
+ export function workEdge(edge, source, target, connected, focused, key, dashes, colors) {
183
220
  const lit = focused && connected;
184
- const color = WORK_EDGE_COLORS[edge.kind === 'adds' ? 'adds' : edge.tone === 'work' ? 'work' : 'code'];
221
+ const name = edge.kind === 'adds' ? 'adds' : edge.tone === 'work' ? 'work' : 'code';
222
+ const color = (colors && colors[name]) || WORK_EDGE_THEMES[name];
185
223
  const faded = source.dim === true && target.dim === true; // "Waiting on you" is on and neither end waits
186
224
  return {
187
225
  key, from: edge.from, to: edge.to, kind: edge.kind,
@@ -435,15 +473,15 @@ export function pillStateOf(item) {
435
473
  return PILL_OF[item.state] || (item.open ? 'open' : 'closed');
436
474
  }
437
475
 
438
- /** What the page says of what comes next, under the connections: what the action in the Work panel will do (the actions move here in step 3) */
476
+ /** What the node panel says of what comes next, above the actions: what each will do */
439
477
  export function saysOf(item) {
440
478
  switch (item.kind) {
441
- case 'proposal': return item.waiting ? 'This waits on you. Open it in the Work panel to open the review, approve or send it back.' : 'Open it in the Work panel for the review.';
442
- case 'pull': return item.state === 'open' ? 'Open it in the Work panel to merge when the checks pass, or run the failed ones again.' : 'Nothing waits on you.';
443
- case 'issue': return item.open ? 'Open it in the Work panel to start an agent on it.' : 'Nothing waits on you.';
444
- case 'run': return item.waiting ? 'This waits on your answer. Open it in the Work panel to answer, continue or stop it.' : item.open ? 'Open it in the Work panel to follow it or stop it.' : 'Nothing waits on you.';
445
- case 'thread': return 'Open it in the Work panel to read it and reply.';
446
- default: return 'Open it in the Work panel for its logs, or to run it again.';
479
+ case 'proposal': return item.waiting ? 'This waits on you. Review opens it over the map (Before, Diff, After); there you approve it or send it back.' : 'Review opens it over the map (Before, Diff, After).';
480
+ case 'pull': return item.state === 'open' ? 'Land it merges this pull request at the head shown, once every check has passed; a failed check can be run again.' : 'Nothing waits on you.';
481
+ case 'issue': return item.open ? 'Start an agent asks a runner to work on this issue; a confirm step shows what will be asked.' : 'Nothing waits on you.';
482
+ case 'run': return item.waiting ? 'This waits on your answer: reply, continue or stop it.' : item.open ? 'You can stop it while it works.' : 'Nothing waits on you.';
483
+ case 'thread': return 'A thread is a conversation on the forge: read it here, and reply there.';
484
+ default: return 'Its logs are on the forge; here is what it restarted.';
447
485
  }
448
486
  }
449
487
 
@@ -483,20 +521,26 @@ const dotOf = (kind, color) => { const c = typeof color === 'function' ? color(k
483
521
  const linkButton = (l) => `<button type="button" class="hx-linkbtn" data-corn="node-link" data-action="select-node" data-id="${esc(l.id)}">${esc(l.label)}</button>`;
484
522
 
485
523
  /**
486
- * The node panel's markup for a piece of work (`panelOf`'s answer): its state, what it is connected to (each a button that selects that node), the checks of a pull request,
487
- * the words saying what the action will do, "Open in Work" (the actions move to the node panel in step 3), and a link to the forge when the address is a web one.
524
+ * The node panel's markup for a piece of work (`panelOf`'s answer): its state, what it is connected to (each a button that selects that node), the words saying what the
525
+ * actions will do, the place the actions go (`forge-detail`: the Work piece fills it, pieces/work-paint.js `paintDetail`: Land it, the checks, a run's answer field, Start an agent ...),
526
+ * and a link to the forge when the address is a web one and the actions do not carry it.
488
527
  * @param {ReturnType<typeof panelOf>} p
489
528
  * @param {object} node
490
- * @param {{ color?: (kind: string) => string, checks?: string }} [opts] `color`: a kind's colour as the map draws it; `checks`: the words of a pull request's checks
529
+ * @param {{ color?: (kind: string) => string }} [opts] `color`: a kind's colour as the map draws it
491
530
  */
492
- export function workPanelHtml(p, node, { color = () => '', checks = '' } = {}) {
531
+ export function workPanelHtml(p, node, { color = () => '' } = {}) {
493
532
  const url = safeUrl(p.url);
494
- const links = p.links.length
495
- ? `<div class="hx-fact" data-corn="section"><div class="hx-fact-k">Connected</div><div class="hx-fact-v"><ul class="hx-work-links" data-corn="work-links">${p.links.map((l) => `<li data-corn="work-link"><span class="hx-work-rel">${esc(l.rel)}</span>${dotOf(l.work, color)}${linkButton(l)}${l.planned ? ' <span class="hx-faint">planned</span>' : ''}</li>`).join('')}</ul></div></div>`
496
- : '<div class="hx-fact" data-corn="section"><div class="hx-fact-k">Connected</div><div class="hx-fact-v hx-faint">Nothing it is linked to is drawn.</div></div>';
497
- const checked = node.item.kind === 'pull' ? `<div class="hx-fact" data-corn="section"><div class="hx-fact-k">Checks</div><div class="hx-fact-v" id="work-checks" data-corn="work-checks">${esc(checks)}</div></div>` : '';
498
- const actions = `<div class="hx-work-actions" data-corn="work-actions"><p class="hx-faint">${esc(p.says)}</p><button type="button" class="hx-btn hx-btn--primary hx-foot-btn" data-corn-kind="primary" data-work-action="open-in-work" data-id="${esc(node.id)}">Open in Work</button>${url ? `<a class="hx-btn hx-btn--quiet hx-foot-btn" data-corn-kind="quiet" data-corn="open-link" href="${esc(url)}" target="_blank" rel="noreferrer">Open on the forge ↗</a>` : ''}</div>`;
499
- return `<div class="hx-work-head" data-corn="work-head"><p class="hx-work-pills" data-corn="work-pills">${p.pills.map(pill).join(' ')}</p><p class="hx-faint">${esc(p.tag)}${p.meta ? ` · ${esc(p.meta)}` : ''}</p></div>${links}${checked}${actions}`;
533
+ const kind = node.item.kind;
534
+ const links = node.old
535
+ ? '<div class="hx-fact" data-corn="section"><div class="hx-fact-k">Connected</div><div class="hx-fact-v hx-faint">Its links are not drawn here: it is older than the 14 days the map of work covers, or past its limits.</div></div>'
536
+ : p.links.length
537
+ ? `<div class="hx-fact" data-corn="section"><div class="hx-fact-k">Connected</div><div class="hx-fact-v"><ul class="hx-work-links" data-corn="work-links">${p.links.map((l) => `<li data-corn="work-link"><span class="hx-work-rel">${esc(l.rel)}</span>${dotOf(l.work, color)}${linkButton(l)}${l.planned ? ' <span class="hx-faint">planned</span>' : ''}</li>`).join('')}</ul></div></div>`
538
+ : '<div class="hx-fact" data-corn="section"><div class="hx-fact-k">Connected</div><div class="hx-fact-v hx-faint">Nothing it is linked to is drawn.</div></div>';
539
+ // A pull request's (a spec's too) and a deploy's own actions carry their link to the forge; the others get it here
540
+ const specPull = kind === 'proposal' && Number.isInteger(node.item.number); // its pull request's actions carry the link
541
+ const out = url && kind !== 'pull' && kind !== 'deploy' && !specPull ? `<a class="hx-btn hx-btn--quiet hx-foot-btn" data-corn-kind="quiet" data-corn="open-link" href="${esc(url)}" target="_blank" rel="noreferrer">Open on the forge ↗</a>` : '';
542
+ const actions = `<div class="hx-work-actions" data-corn="work-actions"><p class="hx-faint">${esc(p.says)}</p><section id="forge-detail" class="hx-forge-detail" data-corn="work-detail" aria-label="Actions" data-work-kind="${esc(kind)}" data-work-ref="${esc(node.id)}"></section>${out}</div>`;
543
+ return `<div class="hx-work-head" data-corn="work-head"><p class="hx-work-pills" data-corn="work-pills">${p.pills.map(pill).join(' ')}</p><p class="hx-faint">${esc(p.tag)}${p.meta ? ` · ${esc(p.meta)}` : ''}</p></div>${links}${actions}`;
500
544
  }
501
545
 
502
546
  /** The node panel's section for a node of code in the Work view: the work that touches it, and "Show on the map" (a planned node is not on the map yet) */
@@ -520,9 +564,6 @@ export function touchedBy(node, nodes, edges) {
520
564
  return out.sort((a, b) => Number(b.waiting) - Number(a.waiting) || a.label.localeCompare(b.label));
521
565
  }
522
566
 
523
- /** The checks line of a pull request, from `GET /api/forge/pulls/<n>`'s `checks` ("1 failed, 1 still running", "All 3 passed", "No checks") */
524
- export { checksWords } from './forge-panel-model.js';
525
-
526
567
  // ---------------------------------------------------------------------------
527
568
  // The keyboard (N and P step through the lanes; an arrow goes to the nearest node that way)
528
569
  // ---------------------------------------------------------------------------
@@ -580,7 +621,7 @@ export function workAddress(search) {
580
621
  return params.get('view') === 'work' ? { view: true } : null;
581
622
  }
582
623
 
583
- /** The id of the node an address names, among the nodes of the view, or null (a spec by its number, `0100`, or by its whole slug) */
624
+ /** The id of the node an address or a row of the Work list names, among the nodes of the view, or null (a spec by its number, `0100`, or by its whole slug; a deploy by its id) */
584
625
  export function nodeForAddress(ask, nodes) {
585
626
  if (!ask || !ask.kind) return null;
586
627
  const mine = nodes.filter((n) => n.work === ask.kind);
@@ -588,7 +629,7 @@ export function nodeForAddress(ask, nodes) {
588
629
  if (ask.kind === 'issue' && !mine.some((n) => String(n.item.number) === ask.key)) { const idea = nodes.find((n) => n.work === 'thread' && String(n.item.number) === ask.key); if (idea) return idea.id; } // an idea is an issue on the forge, drawn as a thread
589
630
  const hit = ask.kind === 'proposal'
590
631
  ? mine.find((n) => n.item.slug === ask.key) || mine.find((n) => specNumber(text(n.item.slug)) === ask.key)
591
- : ask.kind === 'run' ? mine.find((n) => n.item.runId === ask.key) : mine.find((n) => String(n.item.number) === ask.key);
632
+ : ask.kind === 'run' ? mine.find((n) => n.item.runId === ask.key) : ask.kind === 'deploy' ? mine.find((n) => n.item.deployId === ask.key) : mine.find((n) => String(n.item.number) === ask.key);
592
633
  return hit ? hit.id : null;
593
634
  }
594
635
 
@@ -616,7 +657,7 @@ export function openedWords({ work, code, waiting }) {
616
657
  // ---------------------------------------------------------------------------
617
658
 
618
659
  /** What the Work view keeps on the state (`state.work`): the answer, the scene made of it, the layers, the toggle, and the map it stands in for while it is open */
619
- export const newWorkState = () => ({ status: 'idle', graph: null, nodes: [], edges: [], lanes: [], counts: { work: 0, code: 0, waiting: 0 }, problems: [], layers: startLayers(), waiting: false, saved: null, bounds: null, fit: null, order: [], updating: false, stale: '', lastError: '' });
660
+ export const newWorkState = () => ({ status: 'idle', graph: null, nodes: [], edges: [], lanes: [], counts: { work: 0, code: 0, waiting: 0 }, problems: [], badges: new Map(), layers: startLayers(), waiting: false, saved: null, bounds: null, fit: null, order: [], updating: false, stale: '', lastError: '' });
620
661
 
621
662
  /** Makes the scene of an answer (`workScene`), keeps the node a selection named, and sets the filters; the layout is `applyWorkLayout`'s */
622
663
  export function setWorkGraph(state, graph, mapNodes) {
@@ -1,9 +1,10 @@
1
- /* The Work view (explorer/work-view.js, spec 0012): the toggle at the top left of the stage, the line of what could not be read, and the node panel's work detail. */
1
+ /* The Work view (explorer/work-view.js, spec 0012): the toggles at the top left of the stage (All work, Waiting on you, List), the line of what could not be read, and the node panel's work detail. */
2
2
  .hx-work-bar { position: absolute; z-index: 4; left: var(--corn-space-4); top: var(--corn-space-4); display: flex; gap: var(--corn-space-2); }
3
3
  .hx-work-bar { align-items: center; }
4
4
  .hx-work-bar[hidden] { display: none; }
5
5
  .hx-work-chip { box-sizing: border-box; min-height: 2rem; padding: 0 var(--corn-space-4); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); color: var(--corn-text-2); font-family: inherit; font-size: var(--corn-text-xs); font-weight: 600; cursor: pointer; }
6
- .hx-work-chip[aria-pressed="true"] { background: var(--corn-accent); border-color: var(--corn-accent); color: var(--corn-text-on-accent); }
6
+ .hx-work-chip[aria-pressed="true"], .hx-work-chip[aria-expanded="true"] { background: var(--corn-accent); border-color: var(--corn-accent); color: var(--corn-text-on-accent); }
7
+ .hx-work-chip[hidden] { display: none; }
7
8
  .hx-work-chip:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
8
9
  .hx-work-note { position: absolute; z-index: 3; left: var(--corn-space-4); bottom: var(--corn-space-4); max-width: min(32rem, calc(100% - var(--corn-space-8))); margin: 0; padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius); background: var(--corn-surface-1); color: var(--corn-text-2); font-size: var(--corn-text-xs); }
9
10
  .hx-work-note[hidden] { display: none; }
@@ -44,8 +45,14 @@
44
45
  .hx-stage.is-work .hx-hint { display: none; } /* the toggles' row is where the hint would sit */
45
46
  .hx-work-skeleton { grid-template-columns: 1fr; grid-auto-rows: min-content; top: calc(var(--corn-space-4) + var(--hx-control-h) * 2 + var(--corn-space-6)); overflow: hidden; }
46
47
  .hx-work-skel-lane i:nth-of-type(n + 3) { display: none; }
47
- /* The header's own Work button (the panel, until step 3 of spec 0012 retires it) is not on a phone: the view switch's Work carries the badge */
48
- .hx-work[data-corn="forge-button"] { display: none; }
49
48
  }
50
49
  /* The Layers menu in the Work view lists the Work view's rows; the map's keys (its kinds of line, the cloud's, the runs' and the proposal marks') are about the map */
51
50
  body:has(.hx-stage.is-work) .hx-layers :is([data-corn="legend-key"], [data-corn="menu-section"]) { display: none; }
51
+ /* The Work layer on the Map view (explorer/work-badges.js, spec 0012 D4): a small pill over each node open work touches, in screen space so it reads at any zoom. The kind's colour is the border (`--hx-badge`, set from
52
+ `--corn-work-<kind>`), the words are the page's own text on its own surface, so the pill reads on any theme and the kind is said in words (`PR #27`), never by colour alone.
53
+ Its line is as high as the font's own box (a "p" or a "y" is not cut), and the placing keeps the room the pill takes (work-badges.js measures it). Decoration for the eye (aria-hidden):
54
+ the keyboard's words and the node panel's "Open work" say the rest. The runs' pulse (runs-map.js) is a layer of its own and is not changed. */
55
+ .hx-work-badges { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
56
+ .hx-work-badges[hidden] { display: none; }
57
+ .hx-work-badge { position: absolute; box-sizing: border-box; display: inline-block; max-width: 14rem; padding: 0 var(--corn-space-1); border: var(--corn-border-strong) solid var(--hx-badge, var(--corn-line)); border-radius: var(--corn-radius-pill); background: color-mix(in srgb, var(--corn-surface-1) 92%, transparent); color: var(--corn-text); font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translateX(-50%); }
58
+ .hx-work-badge.is-waiting { border-width: calc(var(--corn-border-strong) + var(--corn-border)); }