cornfield 0.36.0 → 0.37.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.
@@ -17,6 +17,7 @@ import { panIntoView } from './camera.js';
17
17
  import { liveSection, hydrateLivePhotos } from './live.js';
18
18
  import { cloudPanelHtml } from './cloud-model.js';
19
19
  import { t } from './strings.js';
20
+ import { markStateAttr, markState } from './corn-state.js';
20
21
  import { fileUrl } from './file-url.js';
21
22
  import { capped, toggleCapped } from './capped.js';
22
23
  import { dismissHint } from './hint.js';
@@ -61,7 +62,7 @@ function dataSummary(node) {
61
62
 
62
63
  if (node.type === 'app') {
63
64
  const served = node.deployed
64
- ? line(`${/^https?:\/\//.test(node.url) ? `<a class="hx-link" href="${escHtml(node.url)}" target="_blank" rel="noreferrer">${escHtml(node.url)}</a>` : code(node.url)} → ${(node.upstreams || []).map(code).join(' ')}${node.stack ? ` <span class="hx-faint">[${escHtml(node.stack)}]</span>` : ''}`)
65
+ ? line(`${/^https?:\/\//.test(node.url) ? `<a data-corn="text-link" class="hx-link" href="${escHtml(node.url)}" target="_blank" rel="noreferrer">${escHtml(node.url)}</a>` : code(node.url)} → ${(node.upstreams || []).map(code).join(' ')}${node.stack ? ` <span class="hx-faint">[${escHtml(node.stack)}]</span>` : ''}`)
65
66
  : line('Not deployed by any stack in this repo');
66
67
  const runsOn = state.edges.filter((e) => e.kind === 'runs-on' && e.from === node.id)
67
68
  .map((e) => line(`${nm(e.to)}${(e.mappings || []).map((m) => `<div class="hx-faint">${code(m.host)} → ${code(m.upstream)}${m.service ? ` = ${code(m.service)}` : ''}</div>`).join('')}`));
@@ -158,7 +159,7 @@ function threadsSection(node) {
158
159
  if (!index) return '';
159
160
  const threads = index.for(node.id);
160
161
  // "Start a thread about this" shows whenever threads are on and a maintainer is signed in (the panel only sets `start` then)
161
- const start = index.start ? `<button type="button" class="hx-btn hx-btn--quiet hx-textact" data-thread-start="${escHtml(node.id)}" aria-label="Start a thread about this: opens the New idea form for ${escHtml(index.forge())}, with this node mentioned">Start a thread about this</button>` : '';
162
+ const start = index.start ? `<button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet hx-textact" data-thread-start="${escHtml(node.id)}" aria-label="Start a thread about this: opens the New idea form for ${escHtml(index.forge())}, with this node mentioned">Start a thread about this</button>` : '';
162
163
  if (!threads || !threads.length) return start;
163
164
  const rows = threads.map((th) => {
164
165
  const count = Number(th.comments) || 0;
@@ -214,7 +215,7 @@ function diffSection(node) {
214
215
  if (kind === 'changed') {
215
216
  for (const r of fieldRows(node)) rows.push(row(r.field, `<span class="hx-change-before">${escHtml(r.before) || '<em>nothing</em>'}</span> <span aria-hidden="true">→</span><span class="hx-sr-only"> became </span> <span class="hx-change-after">${escHtml(r.after) || '<em>nothing</em>'}</span>`));
216
217
  }
217
- return `<div class="hx-sec-block" data-proposal-mark="${escHtml(node.mark)}" data-corn="section"><h3 class="hx-sec-title">In this proposal</h3>${node.why ? `<p class="hx-why">${escHtml(node.why)}</p>` : ''}<div class="hx-diff hx-diff--${escHtml(kind)}">${rows.join('')}</div></div>`;
218
+ return `<div class="hx-sec-block" data-proposal-mark="${escHtml(node.mark)}" data-corn="section"><h3 class="hx-sec-title">In this proposal</h3>${node.why ? `<p class="hx-why">${escHtml(node.why)}</p>` : ''}<div class="hx-diff hx-diff--${escHtml(kind)}" data-corn="diff-block"${markStateAttr(node.mark)}>${rows.join('')}</div></div>`;
218
219
  }
219
220
 
220
221
  // ---------------------------------------------------------------------------
@@ -246,6 +247,8 @@ export async function selectNode(node) {
246
247
  const pill = diffPillWords(node);
247
248
  $('drawer-diff').textContent = pill;
248
249
  $('drawer-diff').hidden = !pill;
250
+ const pillState = markState(pill ? node.mark : ''); // added, changed, removed or edit
251
+ if (pillState) $('drawer-diff').dataset.cornState = pillState; else delete $('drawer-diff').dataset.cornState;
249
252
  const lead = $('drawer-description');
250
253
  lead.textContent = node.desc || '';
251
254
  lead.hidden = !node.desc;
@@ -270,6 +273,7 @@ export async function selectNode(node) {
270
273
  if (route) openBtn.href = node.url; else openBtn.removeAttribute('href');
271
274
  openBtn.hidden = !route;
272
275
  openBtn.className = file ? 'hx-btn hx-btn--quiet hx-foot-btn' : 'hx-open';
276
+ if (file) openBtn.dataset.cornKind = 'quiet'; else openBtn.dataset.cornKind = 'primary'; // the route is the primary action when there is no file
273
277
  openBtn.textContent = `${t('openRoute')} ↗`;
274
278
  fileBtn.textContent = `${t('openFile')} ↗`;
275
279
  const run = $('drawer-run-btn');
@@ -93,7 +93,7 @@ function paintFooter(doc, config) {
93
93
  if (!foot) return;
94
94
  const words = [t('poweredBy'), typeof config.version === 'string' ? config.version : ''].filter(Boolean).join(' ');
95
95
  const home = config.brand && typeof config.brand.poweredBy === 'string' && /^https:\/\//.test(config.brand.poweredBy) ? config.brand.poweredBy : '';
96
- foot.innerHTML = home ? `<a href="${escHtml(home)}" target="_blank" rel="noreferrer">${escHtml(words)}</a>` : escHtml(words);
96
+ foot.innerHTML = home ? `<a data-corn="text-link" href="${escHtml(home)}" target="_blank" rel="noreferrer">${escHtml(words)}</a>` : escHtml(words);
97
97
  }
98
98
 
99
99
  const FORGE_NAMES = { github: 'GitHub', forgejo: 'Forgejo' };
@@ -19,6 +19,7 @@
19
19
  */
20
20
 
21
21
  import { escHtml } from './state.js';
22
+ import { markStateAttr } from './corn-state.js';
22
23
 
23
24
  export const PROPOSAL_VIEWS = ['before', 'diff', 'after'];
24
25
 
@@ -207,10 +208,10 @@ export function proposalPanelHtml(item) {
207
208
  if (!hasMark(item)) return '';
208
209
  const rows = fieldRows(item);
209
210
  const body = rows.map((r) => (item.mark === 'changed'
210
- ? `<div class="hx-change"><span class="hx-change-field">${escHtml(r.field)}</span><span class="hx-change-before">${escHtml(r.before) || '<em>nothing</em>'}</span><span class="hx-change-arrow" aria-hidden="true">→</span><span class="hx-change-after">${escHtml(r.after) || '<em>nothing</em>'}</span></div>`
211
- : `<div class="hx-change"><span class="hx-change-field">${escHtml(r.field)}</span><span class="hx-change-after">${escHtml(r.after)}</span></div>`)).join('');
211
+ ? `<div class="hx-change" data-corn="field-change"><span class="hx-change-field">${escHtml(r.field)}</span><span class="hx-change-before">${escHtml(r.before) || '<em>nothing</em>'}</span><span class="hx-change-arrow" aria-hidden="true">→</span><span class="hx-change-after">${escHtml(r.after) || '<em>nothing</em>'}</span></div>`
212
+ : `<div class="hx-change" data-corn="field-change"><span class="hx-change-field">${escHtml(r.field)}</span><span class="hx-change-after">${escHtml(r.after)}</span></div>`)).join('');
212
213
  return `<div class="hx-sec hx-proposal-sec hx-proposal-sec--${escHtml(item.mark)}" data-proposal-mark="${escHtml(item.mark)}" data-corn="section">
213
- <strong class="hx-strong"><span class="hx-mark-dot hx-mark-dot--${escHtml(item.mark)}"></span>${escHtml(item.mark === 'edit' ? `${item.editOp === 'removed' ? 'Removed' : 'Added'} by your edit` : `${MARK_WORDS[item.mark] || item.mark} by this proposal`)}</strong>
214
+ <strong class="hx-strong"><span class="hx-mark-dot hx-mark-dot--${escHtml(item.mark)}" data-corn="mark-dot"${markStateAttr(item.mark)}></span>${escHtml(item.mark === 'edit' ? `${item.editOp === 'removed' ? 'Removed' : 'Added'} by your edit` : `${MARK_WORDS[item.mark] || item.mark} by this proposal`)}</strong>
214
215
  ${item.why ? `<div class="hx-why">${escHtml(item.why)}</div>` : ''}
215
216
  ${body}
216
217
  </div>`;
@@ -35,6 +35,7 @@ import { reviewWords } from './review-model.js';
35
35
  import { collapseSheet, visibleMapRect, isPhone } from './sheets.js';
36
36
  import { announce } from './keyboard.js';
37
37
  import { t } from './strings.js';
38
+ import { markStateAttr } from './corn-state.js';
38
39
  import { isOffline } from './connection.js';
39
40
 
40
41
  const $ = (id) => document.getElementById(id);
@@ -361,7 +362,7 @@ export function renderBar() {
361
362
 
362
363
  const counts = summarize(p);
363
364
  const chip = $('proposal-chip');
364
- chip.innerHTML = barCounts(counts).map((c) => `${c.mark ? `<span class="hx-mark-dot hx-mark-dot--${c.mark}" aria-hidden="true"></span>` : ''}${escHtml(c.text)}`).join('<span class="hx-proposal-sep" aria-hidden="true"> · </span>');
365
+ chip.innerHTML = barCounts(counts).map((c) => `${c.mark ? `<span class="hx-mark-dot hx-mark-dot--${c.mark}" data-corn="mark-dot"${markStateAttr(c.mark)} aria-hidden="true"></span>` : ''}${escHtml(c.text)}`).join('<span class="hx-proposal-sep" aria-hidden="true"> · </span>');
365
366
  chip.title = 'Click for the list of changes.';
366
367
  $('proposal-mode').textContent = t(state.proposalView);
367
368
 
@@ -391,10 +392,10 @@ function renderChanges() {
391
392
  const rows = [];
392
393
  for (const mark of [...MARKS, 'edit']) {
393
394
  for (const n of state.nodes.filter((x) => x.mark === mark)) {
394
- rows.push(`<button type="button" class="hx-change-row" data-action="proposal-focus" data-kind="node" data-key="${escHtml(n.id)}" data-corn="row"><span class="hx-mark-dot hx-mark-dot--${mark}"></span><span class="hx-change-what">${escHtml(MARK_WORDS[mark])}</span><span class="hx-name">${escHtml(n.label)}</span><span class="hx-faint">${escHtml(n.type)}</span></button>`);
395
+ rows.push(`<button type="button" class="hx-change-row" data-action="proposal-focus" data-kind="node" data-key="${escHtml(n.id)}" data-corn="row"><span class="hx-mark-dot hx-mark-dot--${mark}" data-corn="mark-dot"${markStateAttr(mark)}></span><span class="hx-change-what">${escHtml(MARK_WORDS[mark])}</span><span class="hx-name">${escHtml(n.label)}</span><span class="hx-faint">${escHtml(n.type)}</span></button>`);
395
396
  }
396
397
  for (const e of state.edges.filter((x) => x.mark === mark && said.has(edgeKey(x)))) {
397
- rows.push(`<button type="button" class="hx-change-row" data-action="proposal-focus" data-kind="edge" data-key="${escHtml(edgeKey(e))}" data-corn="row"><span class="hx-mark-dot hx-mark-dot--${mark}"></span><span class="hx-change-what">${escHtml(MARK_WORDS[mark])}</span><span class="hx-name">${escHtml(nameOf(e.from))} → ${escHtml(nameOf(e.to))}</span><span class="hx-faint">${escHtml(e.kind || 'ownership')}</span></button>`);
398
+ rows.push(`<button type="button" class="hx-change-row" data-action="proposal-focus" data-kind="edge" data-key="${escHtml(edgeKey(e))}" data-corn="row"><span class="hx-mark-dot hx-mark-dot--${mark}" data-corn="mark-dot"${markStateAttr(mark)}></span><span class="hx-change-what">${escHtml(MARK_WORDS[mark])}</span><span class="hx-name">${escHtml(nameOf(e.from))} → ${escHtml(nameOf(e.to))}</span><span class="hx-faint">${escHtml(e.kind || 'ownership')}</span></button>`);
398
399
  }
399
400
  }
400
401
  list.innerHTML = rows.join('') || '<p class="hx-faint">This proposal changes nothing on the map.</p>';
@@ -537,7 +538,7 @@ function renderMenu(loading = false) {
537
538
  else if (!listing || listing.length === 0) body = '<p class="hx-faint hx-proposal-empty">No proposals</p>';
538
539
  else body = `<div class="hx-proposal-list" role="list">${listing.map((e) => `<div role="listitem">${proposalRowHtml(e, current)}</div>`).join('')}</div>`;
539
540
  const forge = forgeProblem && !listingProblem ? `<p class="hx-error-text hx-proposal-empty">The spec PRs could not be listed: ${escHtml(forgeProblem)}</p>` : '';
540
- menu.innerHTML = `<div class="hx-menu-title hx-menu-head"><span>${escHtml(t('proposals'))}</span></div>${forge}${body}`;
541
+ menu.innerHTML = `<div class="hx-menu-title hx-menu-head" data-corn="menu-title"><span>${escHtml(t('proposals'))}</span></div>${forge}${body}`;
541
542
  }
542
543
 
543
544
  // ---------------------------------------------------------------------------
@@ -573,7 +574,7 @@ export function markedEdgeAt(x, y, tolerance) {
573
574
  export function showEdgePanel(edge) {
574
575
  closeDrawer(); // clears a node selection and any panel still loading
575
576
  state.selectedEdge = edge;
576
- const row = (label, value) => (value ? `<div class="hx-fact"><div class="hx-fact-k">${escHtml(label)}</div><div class="hx-fact-v">${escHtml(value)}</div></div>` : '');
577
+ const row = (label, value) => (value ? `<div class="hx-fact" data-corn="section"><div class="hx-fact-k">${escHtml(label)}</div><div class="hx-fact-v">${escHtml(value)}</div></div>` : '');
577
578
  const facts = row('Kind', kindOf(edge)) + row('Flow', edge.flow) + row('Label', edge.label) + row('Reads', Array.isArray(edge.keys) ? edge.keys.join(', ') : '');
578
579
 
579
580
  $('drawer-title').textContent = `${nameOf(edge.from)} → ${nameOf(edge.to)}`;
@@ -585,8 +586,8 @@ export function showEdgePanel(edge) {
585
586
  $('drawer-description').hidden = true;
586
587
  $('drawer-meta-list').innerHTML = `${facts ? `<div class="hx-facts">${facts}</div>` : ''}
587
588
  <div class="hx-facts">
588
- <div class="hx-fact"><div class="hx-fact-k">From</div><div class="hx-fact-v"><button type="button" class="hx-linkbtn" data-action="select-node" data-id="${escHtml(edge.from)}">${escHtml(nameOf(edge.from))}</button></div></div>
589
- <div class="hx-fact"><div class="hx-fact-k">To</div><div class="hx-fact-v"><button type="button" class="hx-linkbtn" data-action="select-node" data-id="${escHtml(edge.to)}">${escHtml(nameOf(edge.to))}</button></div></div>
589
+ <div class="hx-fact" data-corn="section"><div class="hx-fact-k">From</div><div class="hx-fact-v"><button data-corn="node-link" type="button" class="hx-linkbtn" data-action="select-node" data-id="${escHtml(edge.from)}">${escHtml(nameOf(edge.from))}</button></div></div>
590
+ <div class="hx-fact" data-corn="section"><div class="hx-fact-k">To</div><div class="hx-fact-v"><button data-corn="node-link" type="button" class="hx-linkbtn" data-action="select-node" data-id="${escHtml(edge.to)}">${escHtml(nameOf(edge.to))}</button></div></div>
590
591
  </div>${proposalPanelHtml(edge)}`;
591
592
  $('drawer-open-btn').hidden = true;
592
593
  $('drawer-file-btn').hidden = true;
@@ -73,8 +73,8 @@ function mount() {
73
73
  root.innerHTML = `
74
74
  <p class="hx-review-status" data-review-status hidden><span data-review-verdict role="status"></span><span data-review-when></span></p>
75
75
  <div class="hx-review-form" id="review-form" data-review-form hidden>
76
- <label class="hx-review-label" for="review-note"></label>
77
- <textarea id="review-note" class="hx-review-note" rows="2" maxlength="20000"></textarea>
76
+ <label class="hx-review-label" for="review-note" data-corn="review-label"></label>
77
+ <textarea data-corn="review-note" id="review-note" class="hx-review-note" rows="2" maxlength="20000"></textarea>
78
78
  <div class="hx-review-row">
79
79
  <button type="button" class="hx-btn hx-btn--quiet" data-review-cancel data-corn-kind="quiet">Cancel</button>
80
80
  </div>
@@ -31,7 +31,7 @@ import { t } from './strings.js';
31
31
  */
32
32
 
33
33
  /** A link that opens a new tab, said so for a screen reader */
34
- const link = (ctx, href, text, after = '') => (ctx.safeUrl(href) ? `<a class="hx-link" href="${ctx.esc(href)}" target="_blank" rel="noreferrer">${ctx.esc(text)} <span class="hx-sr-only">(new tab)</span></a>${after}` : '');
34
+ const link = (ctx, href, text, after = '') => (ctx.safeUrl(href) ? `<a data-corn="text-link" class="hx-link" href="${ctx.esc(href)}" target="_blank" rel="noreferrer">${ctx.esc(text)} <span class="hx-sr-only">(new tab)</span></a>${after}` : '');
35
35
 
36
36
  /** The address of a branch on the forge, or null */
37
37
  function branchUrl(ctx, branch) {
@@ -55,7 +55,7 @@ function linksHtml(ctx, run) {
55
55
  /** A run id that is another run of the list is a button that takes you to it; otherwise it is plain text */
56
56
  function runLink(ctx, runId, all) {
57
57
  const there = (all || []).find((r) => r.runId === runId);
58
- return there ? `<button type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(runId)}" title="Go to this run">${ctx.esc(runName(there))}</button>` : 'an earlier run';
58
+ return there ? `<button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(runId)}" title="Go to this run">${ctx.esc(runName(there))}</button>` : 'an earlier run';
59
59
  }
60
60
 
61
61
  /** Which run this one starts again, and which start it again */
@@ -69,7 +69,7 @@ function timelineHtml(ctx, run, all) {
69
69
  const items = (run.timeline || []).map((e) => {
70
70
  const w = timelineWords(e);
71
71
  const other = (e.kind === 'retry-of' || e.kind === 'retried-by') && e.ref ? (all || []).find((r) => r.runId === e.ref) : null;
72
- const goto = other ? ` <button type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(e.ref)}" aria-label="Go to it: ${ctx.esc(runName(other))}">Go to it</button>` : '';
72
+ const goto = other ? ` <button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(e.ref)}" aria-label="Go to it: ${ctx.esc(runName(other))}">Go to it</button>` : '';
73
73
  return `<li><time datetime="${ctx.esc(e.at)}" title="${ctx.esc(e.at)}">${ctx.esc(relativeTime(e.at, ctx.now) || e.at)}</time>${ctx.esc(w.what.replace(/run-[0-9A-Za-z]{26}/g, (id) => { const o = (all || []).find((r) => r.runId === id); return o ? runName(o) : 'an earlier run'; }))}${goto}${w.note ? `<span class="hx-run-note">${ctx.esc(w.note)}</span>` : ''}</li>`;
74
74
  });
75
75
  return `<ol class="hx-run-timeline" id="run-tl-${ctx.esc(run.runId)}" aria-label="Timeline of ${ctx.esc(runName(run))}, oldest first">${items.join('')}</ol>`;
@@ -94,11 +94,11 @@ function answerHtml(ctx, run) {
94
94
  const name = ctx.esc(runName(run, ctx.now));
95
95
  const off = ctx.busy ? ' disabled' : '';
96
96
  const reply = ctx.replies && ctx.replies.get(run.runId) || '';
97
- return `${run.answer ? answeredHtml(ctx, run) : ''}<div class="hx-run-actions" role="group" aria-label="Answer: ${name}">
98
- <button type="button" class="hx-btn hx-forge-act" data-run-answer="continue" data-run-id="${id}" aria-label="${ctx.esc(t('continueRun'))}: ${name}"${off}>${ctx.esc(t('continueRun'))}</button>
97
+ return `${run.answer ? answeredHtml(ctx, run) : ''}<div class="hx-run-actions" data-corn="run-actions" role="group" aria-label="Answer: ${name}">
98
+ <button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-answer="continue" data-run-id="${id}" aria-label="${ctx.esc(t('continueRun'))}: ${name}"${off}>${ctx.esc(t('continueRun'))}</button>
99
99
  <button type="button" class="hx-btn hx-forge-act" data-run-answer="stop" data-run-id="${id}" aria-label="${ctx.esc(t('stop'))}: ${name}"${off} data-corn-kind="danger">${ctx.esc(t('stop'))}</button></div>
100
- <label class="hx-forge-field" data-corn="field">Reply to ${ctx.esc(`${run.kind} on ${aboutWords(run.refs)}`)}<input type="text" class="hx-forge-input" data-run-reply="${id}" value="${ctx.esc(reply)}" maxlength="4000" autocomplete="off" /></label>
101
- <div class="hx-run-actions"><button type="button" class="hx-btn hx-forge-act" data-run-answer="reply" data-run-id="${id}" aria-label="${ctx.esc(t('reply'))}: ${name}"${off}>${ctx.esc(t('reply'))}</button></div>`;
100
+ <label class="hx-forge-field" data-corn="field">Reply to ${ctx.esc(`${run.kind} on ${aboutWords(run.refs)}`)}<input data-corn="control" type="text" class="hx-forge-input" data-run-reply="${id}" value="${ctx.esc(reply)}" maxlength="4000" autocomplete="off" /></label>
101
+ <div class="hx-run-actions" data-corn="run-actions"><button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-answer="reply" data-run-id="${id}" aria-label="${ctx.esc(t('reply'))}: ${name}"${off}>${ctx.esc(t('reply'))}</button></div>`;
102
102
  }
103
103
 
104
104
  /**
@@ -110,8 +110,8 @@ function unsentHtml(ctx, run) {
110
110
  if (!reply) return '';
111
111
  const id = ctx.esc(run.runId);
112
112
  return `<p class="hx-forge-why" data-corn="message" data-corn-state="failure">This run is now ${ctx.esc(statusWords(run).toLowerCase())} and no longer waits for a reply, so what you typed was not sent. It is kept here to copy.</p>
113
- <label class="hx-forge-field" data-corn="field">Your reply, not sent<input type="text" class="hx-forge-input" data-run-reply="${id}" value="${ctx.esc(reply)}" maxlength="4000" autocomplete="off" /></label>
114
- <div class="hx-run-actions"><button type="button" class="hx-btn hx-forge-act" data-run-discard="${id}" aria-label="Discard: your reply to ${ctx.esc(runName(run, ctx.now))}">Discard</button></div>`;
113
+ <label class="hx-forge-field" data-corn="field">Your reply, not sent<input data-corn="control" type="text" class="hx-forge-input" data-run-reply="${id}" value="${ctx.esc(reply)}" maxlength="4000" autocomplete="off" /></label>
114
+ <div class="hx-run-actions" data-corn="run-actions"><button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-discard="${id}" aria-label="Discard: your reply to ${ctx.esc(runName(run, ctx.now))}">Discard</button></div>`;
115
115
  }
116
116
 
117
117
  /** The totals as plain lines (see `totalsLines`), escaped; '' when there are none */
@@ -129,6 +129,14 @@ export function loadingRowsHtml(n = 3) {
129
129
  return Array.from({ length: n }, () => '<li class="hx-forge-skeleton" data-corn="skeleton" aria-hidden="true"><span></span><span></span></li>').join('');
130
130
  }
131
131
 
132
+ /**
133
+ * Placeholder lines for the runner line and the totals above the runs while they load (issue #192): each is one `hx-forge-meta` line high, as the
134
+ * line it stands for, so the list under them does not move when the data arrives.
135
+ */
136
+ export function loadingLinesHtml(n = 1) {
137
+ return Array.from({ length: n }, () => '<p class="hx-forge-meta hx-forge-skeleton-line" data-corn="skeleton" aria-hidden="true"><span></span></p>').join('');
138
+ }
139
+
132
140
  /** One run */
133
141
  export function runHtml(ctx, run, all) {
134
142
  const lit = ctx.selected === run.runId;
@@ -138,7 +146,7 @@ export function runHtml(ctx, run, all) {
138
146
  const note = run.report && run.report.note ? `<p class="hx-forge-meta">Runner: ${ctx.esc(run.report.note)}</p>` : '';
139
147
  const answering = canAnswer(run);
140
148
  const off = ctx.busy ? ' disabled' : '';
141
- const retry = canRetry(run) ? `<button type="button" class="hx-btn hx-forge-act" data-forge-retry="${ctx.esc(run.runId)}" aria-label="${ctx.esc(t('startAgain'))}: ${name}"${off}>${ctx.esc(t('startAgain'))}</button>` : '';
149
+ const retry = canRetry(run) ? `<button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-forge-retry="${ctx.esc(run.runId)}" aria-label="${ctx.esc(t('startAgain'))}: ${name}"${off}>${ctx.esc(t('startAgain'))}</button>` : '';
142
150
  const stop = canStop(run) && !answering ? `<button type="button" class="hx-btn hx-forge-act" data-forge-stop="${ctx.esc(run.runId)}" aria-label="${ctx.esc(t('stop'))}: ${name}"${off} data-corn-kind="danger">${ctx.esc(t('stop'))}</button>` : '';
143
151
  const names = nodeLabels(run.nodes, ctx.nodes);
144
152
  const collision = collisionWords(run, all, ctx.nodes);
@@ -158,9 +166,9 @@ export function runHtml(ctx, run, all) {
158
166
  ${retryHtml(ctx, run, all)}
159
167
  ${links ? `<p class="hx-forge-meta">${links}</p>` : ''}
160
168
  ${answering ? `${answerHtml(ctx, run)}${result}` : unsentHtml(ctx, run)}${run.answer && !answering ? answeredHtml(ctx, run) : ''}
161
- <div class="hx-run-actions">${stop}${retry}
162
- <button type="button" class="hx-btn hx-forge-act" data-run-select="${ctx.esc(run.runId)}" aria-pressed="${lit}" aria-label="${lightWords}: ${name}"${noNodes ? ` disabled title="No node on the map yet, so there is nothing to light" aria-describedby="run-nodes-${ctx.esc(run.runId)}"` : ''}>${lightWords}</button>
163
- <button type="button" class="hx-btn hx-forge-act" data-run-timeline="${ctx.esc(run.runId)}" aria-expanded="${open}" aria-controls="run-tl-${ctx.esc(run.runId)}">Timeline (${count})</button></div>
169
+ <div class="hx-run-actions" data-corn="run-actions">${stop}${retry}
170
+ <button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-select="${ctx.esc(run.runId)}" aria-pressed="${lit}" aria-label="${lightWords}: ${name}"${noNodes ? ` disabled title="No node on the map yet, so there is nothing to light" aria-describedby="run-nodes-${ctx.esc(run.runId)}"` : ''}>${lightWords}</button>
171
+ <button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-timeline="${ctx.esc(run.runId)}" aria-expanded="${open}" aria-controls="run-tl-${ctx.esc(run.runId)}">Timeline (${count})</button></div>
164
172
  ${answering ? '' : result}
165
173
  ${open ? timelineHtml(ctx, run, all) : ''}</li>`;
166
174
  }
@@ -225,16 +225,16 @@ function showBar(speed) {
225
225
  bar.innerHTML = `
226
226
  <div class="hx-player-head">
227
227
  <span class="hx-player-title"></span>
228
- <select class="hx-player-speed" data-action="scenario-speed" aria-label="Time for each step" title="Time for each step">${SPEED_CHOICES.map((c) => `<option value="${c.value}">${c.label}</option>`).join('')}</select>
228
+ <select data-corn="control" class="hx-player-speed" data-action="scenario-speed" aria-label="Time for each step" title="Time for each step">${SPEED_CHOICES.map((c) => `<option value="${c.value}">${c.label}</option>`).join('')}</select>
229
229
  <button type="button" class="hx-close" data-action="scenario-close" aria-label="Close the scenario" data-corn-kind="icon">✕</button>
230
230
  </div>
231
231
  <p class="hx-player-text" aria-live="polite"><span class="hx-player-count" data-corn="count"></span> · <span class="hx-player-step"></span></p>
232
232
  <div class="hx-player-controls">
233
- <button type="button" class="hx-btn" data-action="scenario-prev" data-peek-ok>◀ Previous</button>
233
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-action="scenario-prev" data-peek-ok>◀ Previous</button>
234
234
  <button type="button" class="hx-btn hx-btn--active" data-action="scenario-toggle" data-peek-ok data-corn-kind="primary"></button>
235
- <button type="button" class="hx-btn" data-action="scenario-next" data-peek-ok>Next ▶</button>
235
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-action="scenario-next" data-peek-ok>Next ▶</button>
236
236
  </div>
237
- <div class="hx-player-track" aria-hidden="true"><span class="hx-player-fill"></span></div>`;
237
+ <div class="hx-player-track" data-corn="scenario-track" aria-hidden="true"><span class="hx-player-fill" data-corn="scenario-fill"></span></div>`;
238
238
  bar.addEventListener('click', (e) => {
239
239
  const button = e.target.closest('[data-action]');
240
240
  if (button) act(button.dataset.action);
@@ -402,6 +402,7 @@ export function refreshList() {
402
402
  list = document.createElement('div');
403
403
  list.id = 'proposal-scenarios';
404
404
  list.className = 'hx-scenarios glass';
405
+ list.dataset.corn = 'scenario-list';
405
406
  list.dataset.key = key;
406
407
  list.hidden = !!document.getElementById('proposal-play') && (!wasOpen || scenarios.length < 2); // behind Play when the toolbar has one
407
408
  scenarios.forEach((s) => {
@@ -135,7 +135,7 @@ export function registerSheet(id, el) {
135
135
  handle.type = 'button';
136
136
  handle.className = 'hx-sheet-handle';
137
137
  handle.dataset.corn = 'sheet-handle';
138
- handle.innerHTML = '<span></span>';
138
+ handle.innerHTML = '<span data-corn="sheet-grip"></span>';
139
139
  el.prepend(handle);
140
140
  }
141
141
  bindHandle(id, handle);
@@ -238,21 +238,21 @@ function mount() {
238
238
  root.dataset.corn = 'whatif';
239
239
  root.setAttribute('aria-label', 'Try a change');
240
240
  root.innerHTML = `
241
- <div class="hx-whatif-row" role="toolbar" aria-label="Try a change">
242
- <button type="button" class="hx-btn" data-whatif="add-node" title="Add a node to this proposal">Add a node</button>
243
- <button type="button" class="hx-btn" data-whatif="draw-edge" aria-pressed="false" title="Drag from one node to another on the map">Draw an edge</button>
244
- <button type="button" class="hx-btn" data-whatif="undo" title="Undo (Ctrl+Z)">Undo</button>
245
- <button type="button" class="hx-btn" data-whatif="redo" title="Redo (Ctrl+Shift+Z)">Redo</button>
246
- <button type="button" class="hx-btn" data-whatif="edits" aria-expanded="false"></button>
247
- <button type="button" class="hx-btn" data-whatif="steps" aria-expanded="false" title="Add, reword, reorder or delete the steps of a scenario">Steps</button>
241
+ <div class="hx-whatif-row" data-corn="whatif-toolbar" role="toolbar" aria-label="Try a change">
242
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="add-node" title="Add a node to this proposal">Add a node</button>
243
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="draw-edge" aria-pressed="false" title="Drag from one node to another on the map">Draw an edge</button>
244
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="undo" title="Undo (Ctrl+Z)">Undo</button>
245
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="redo" title="Redo (Ctrl+Shift+Z)">Redo</button>
246
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="edits" aria-expanded="false"></button>
247
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="steps" aria-expanded="false" title="Add, reword, reorder or delete the steps of a scenario">Steps</button>
248
248
  </div>
249
249
  <p class="hx-whatif-hint" data-hint hidden>Drag from one node to another. Escape cancels.</p>
250
250
  <p class="hx-whatif-msg" data-msg="toolbar" role="status" hidden data-corn="message"></p>
251
251
  <p class="hx-whatif-notice" data-notice role="status" hidden data-corn="notice"></p>
252
- <div class="hx-whatif-panel" data-panel="confirm" hidden></div>
253
- <div class="hx-whatif-panel" data-panel="form" hidden></div>
254
- <div class="hx-whatif-panel" data-panel="edits" hidden></div>
255
- <div class="hx-whatif-panel" data-panel="steps" hidden></div>`;
252
+ <div class="hx-whatif-panel" data-corn="whatif-panel" data-panel="confirm" hidden></div>
253
+ <div class="hx-whatif-panel" data-corn="whatif-panel" data-panel="form" hidden></div>
254
+ <div class="hx-whatif-panel" data-corn="whatif-panel" data-panel="edits" hidden></div>
255
+ <div class="hx-whatif-panel" data-corn="whatif-panel" data-panel="steps" hidden></div>`;
256
256
  root.hidden = true;
257
257
  body.appendChild(root);
258
258
  const edit = $('proposal-edit');
@@ -339,8 +339,8 @@ function paintConfirm() {
339
339
  box.innerHTML = `
340
340
  <p><strong class="hx-strong">Close this proposal?</strong> You have ${n === 1 ? '1 edit' : `${n} edits`} on it. They stay in this browser and come back when you open it again, unless you throw them away.</p>
341
341
  <div class="hx-whatif-actions">
342
- <button type="button" class="hx-btn hx-btn--active" data-whatif="close-keep">Close and keep my edits</button>
343
- <button type="button" class="hx-btn" data-whatif="close-discard">Close and throw them away</button>
342
+ <button data-corn-kind="primary" type="button" class="hx-btn hx-btn--active" data-whatif="close-keep">Close and keep my edits</button>
343
+ <button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="close-discard">Close and throw them away</button>
344
344
  <button type="button" class="hx-btn hx-btn--quiet" data-whatif="close-cancel" data-corn-kind="quiet">Keep editing</button>
345
345
  </div>`;
346
346
  }
@@ -375,13 +375,13 @@ function paintForm() {
375
375
  box.innerHTML = `
376
376
  <form class="hx-whatif-form" data-form="node" autocomplete="off">
377
377
  <strong class="hx-strong">Add a node</strong>
378
- <label class="hx-whatif-field" data-corn="field">Type <select name="nodeType">${typeOptions('page')}</select></label>
379
- <label class="hx-whatif-field" data-corn="field">Label <input name="label" class="hx-whatif-input" placeholder="/meals" required></label>
380
- <label class="hx-whatif-field" data-corn="field">Parent <select name="parent">${options.join('')}</select></label>
378
+ <label class="hx-whatif-field" data-corn="field">Type <select data-corn="control" name="nodeType">${typeOptions('page')}</select></label>
379
+ <label class="hx-whatif-field" data-corn="field">Label <input data-corn="control" name="label" class="hx-whatif-input" placeholder="/meals" required></label>
380
+ <label class="hx-whatif-field" data-corn="field">Parent <select data-corn="control" name="parent">${options.join('')}</select></label>
381
381
  <p class="hx-faint hx-whatif-help">Click a node on the map to make it the parent. A page label starts with a slash, like /meals.</p>
382
- <label class="hx-whatif-field" data-corn="field">Description <input name="desc" class="hx-whatif-input" placeholder="Optional"></label>
382
+ <label class="hx-whatif-field" data-corn="field">Description <input data-corn="control" name="desc" class="hx-whatif-input" placeholder="Optional"></label>
383
383
  <div class="hx-whatif-actions">
384
- <button type="submit" class="hx-btn hx-btn--active">Add node</button>
384
+ <button data-corn-kind="primary" type="submit" class="hx-btn hx-btn--active">Add node</button>
385
385
  <button type="button" class="hx-btn hx-btn--quiet" data-whatif="cancel-form" data-corn-kind="quiet">Cancel</button>
386
386
  </div>
387
387
  <p class="hx-whatif-msg" data-msg="form" role="alert" hidden data-corn="message"></p>
@@ -397,11 +397,11 @@ function paintForm() {
397
397
  <form class="hx-whatif-form" data-form="edge" autocomplete="off">
398
398
  <strong class="hx-strong">Draw an edge</strong>
399
399
  <p class="hx-whatif-pair"><span class="hx-name">${escHtml(nameOf(form.from))}</span> → <span class="hx-name">${escHtml(nameOf(form.to))}</span></p>
400
- <label class="hx-whatif-field" data-corn="field">Kind <select name="kind">${M.EDGE_CHOICES.map((c) => `<option value="${escHtml(c.value)}"${c.value === suggested ? ' selected' : ''}>${escHtml(c.label)}</option>`).join('')}</select></label>
401
- <label class="hx-whatif-field" data-flow-field hidden data-corn="field">Flow <select name="flow">${M.FLOW_KINDS.map((f) => `<option value="${escHtml(f)}">${escHtml(f)}</option>`).join('')}</select></label>
402
- <label class="hx-whatif-field" data-corn="field">Label <input name="label" class="hx-whatif-input" placeholder="Optional"></label>
400
+ <label class="hx-whatif-field" data-corn="field">Kind <select data-corn="control" name="kind">${M.EDGE_CHOICES.map((c) => `<option value="${escHtml(c.value)}"${c.value === suggested ? ' selected' : ''}>${escHtml(c.label)}</option>`).join('')}</select></label>
401
+ <label class="hx-whatif-field" data-flow-field hidden data-corn="field">Flow <select data-corn="control" name="flow">${M.FLOW_KINDS.map((f) => `<option value="${escHtml(f)}">${escHtml(f)}</option>`).join('')}</select></label>
402
+ <label class="hx-whatif-field" data-corn="field">Label <input data-corn="control" name="label" class="hx-whatif-input" placeholder="Optional"></label>
403
403
  <div class="hx-whatif-actions">
404
- <button type="submit" class="hx-btn hx-btn--active">Add edge</button>
404
+ <button data-corn-kind="primary" type="submit" class="hx-btn hx-btn--active">Add edge</button>
405
405
  <button type="button" class="hx-btn hx-btn--quiet" data-whatif="cancel-form" data-corn-kind="quiet">Cancel</button>
406
406
  </div>
407
407
  <p class="hx-whatif-msg" data-msg="form" role="alert" hidden data-corn="message"></p>
@@ -462,7 +462,7 @@ function paintEdits() {
462
462
  nameOf,
463
463
  scenarioTitle: (id) => (scenariosOf(effective).find((s) => s.id === id) || { title: id }).title,
464
464
  };
465
- const rows = state.whatIf.edits.map((edit, i) => `<li class="hx-whatif-edit"><span class="hx-mark-dot hx-mark-dot--edit"></span><span class="hx-whatif-edit-text">${escHtml(M.describeEdit(edit, words))}</span><button type="button" class="hx-textbtn" data-whatif="remove-edit" data-index="${i}" aria-label="Remove this edit: ${escHtml(M.describeEdit(edit, words))}">Remove</button></li>`);
465
+ const rows = state.whatIf.edits.map((edit, i) => `<li class="hx-whatif-edit"><span class="hx-mark-dot hx-mark-dot--edit" data-corn="mark-dot" data-corn-state="edit"></span><span class="hx-whatif-edit-text">${escHtml(M.describeEdit(edit, words))}</span><button data-corn-kind="quiet" type="button" class="hx-textbtn" data-whatif="remove-edit" data-index="${i}" aria-label="Remove this edit: ${escHtml(M.describeEdit(edit, words))}">Remove</button></li>`);
466
466
  box.innerHTML = rows.length
467
467
  ? `<ol class="hx-whatif-list">${rows.join('')}</ol><p class="hx-whatif-msg" data-msg="edits" role="status" hidden data-corn="message"></p>`
468
468
  : '<p class="hx-faint">No edits yet. Add a node, draw an edge or change a step, and it appears here.</p>';
@@ -486,27 +486,27 @@ function paintSteps() {
486
486
 
487
487
  const rows = steps.map((s, i) => `
488
488
  <li class="hx-whatif-step${i === playing ? ' is-current' : ''}" data-step="${i}">
489
- <button type="button" class="hx-whatif-num" data-whatif="go-step" data-index="${i}" title="Show this step on the map" aria-label="Show step ${i + 1} on the map">${i + 1}</button>
489
+ <button data-corn="step-number" type="button" class="hx-whatif-num" data-whatif="go-step" data-index="${i}" title="Show this step on the map" aria-label="Show step ${i + 1} on the map">${i + 1}</button>
490
490
  <span class="hx-whatif-stepbody">
491
- <input class="hx-whatif-input" data-step-text="${i}" value="${escHtml(s.text || '')}" aria-label="Step ${i + 1}: what happens">
491
+ <input data-corn="control" class="hx-whatif-input" data-step-text="${i}" value="${escHtml(s.text || '')}" aria-label="Step ${i + 1}: what happens">
492
492
  <span class="hx-faint hx-whatif-target">${escHtml(target(s))}</span>
493
493
  </span>
494
- <button type="button" class="hx-textbtn" data-whatif="step-up" data-index="${i}" aria-label="Move step ${i + 1} up"${i === 0 ? ' disabled' : ''}>↑</button>
495
- <button type="button" class="hx-textbtn" data-whatif="step-down" data-index="${i}" aria-label="Move step ${i + 1} down"${i === steps.length - 1 ? ' disabled' : ''}>↓</button>
496
- <button type="button" class="hx-textbtn" data-whatif="step-delete" data-index="${i}" aria-label="Delete step ${i + 1}">✕</button>
494
+ <button data-corn-kind="quiet" type="button" class="hx-textbtn" data-whatif="step-up" data-index="${i}" aria-label="Move step ${i + 1} up"${i === 0 ? ' disabled' : ''}>↑</button>
495
+ <button data-corn-kind="quiet" type="button" class="hx-textbtn" data-whatif="step-down" data-index="${i}" aria-label="Move step ${i + 1} down"${i === steps.length - 1 ? ' disabled' : ''}>↓</button>
496
+ <button data-corn-kind="quiet" type="button" class="hx-textbtn" data-whatif="step-delete" data-index="${i}" aria-label="Delete step ${i + 1}">✕</button>
497
497
  </li>`);
498
498
 
499
499
  box.innerHTML = `
500
500
  <div class="hx-whatif-form">
501
501
  <div class="hx-whatif-actions">
502
- <label class="hx-whatif-field" data-corn="field">Scenario <select data-scenario-select>${scenarios.map((s) => `<option value="${escHtml(s.id)}"${s.id === ui.scenarioId ? ' selected' : ''}>${escHtml(s.title)}</option>`).join('')}<option value="${NEW}"${ui.scenarioId === NEW ? ' selected' : ''}>New scenario…</option></select></label>
503
- ${scenario ? '<button type="button" class="hx-btn" data-whatif="play-scenario">Play</button>' : ''}
502
+ <label class="hx-whatif-field" data-corn="field">Scenario <select data-corn="control" data-scenario-select>${scenarios.map((s) => `<option value="${escHtml(s.id)}"${s.id === ui.scenarioId ? ' selected' : ''}>${escHtml(s.title)}</option>`).join('')}<option value="${NEW}"${ui.scenarioId === NEW ? ' selected' : ''}>New scenario…</option></select></label>
503
+ ${scenario ? '<button data-corn-kind="secondary" type="button" class="hx-btn" data-whatif="play-scenario">Play</button>' : ''}
504
504
  </div>
505
505
  ${rows.length ? `<ol class="hx-whatif-list hx-whatif-steps">${rows.join('')}</ol>` : '<p class="hx-faint">No steps yet.</p>'}
506
506
  <form class="hx-whatif-addstep" data-form="step" autocomplete="off">
507
- ${ui.scenarioId === NEW ? `<label class="hx-whatif-field" data-corn="field">Title <input name="title" class="hx-whatif-input" placeholder="Add a meal" value="${escHtml(ui.titleDraft)}"></label>` : ''}
508
- <label class="hx-whatif-field" data-corn="field">New step <input name="text" class="hx-whatif-input" placeholder="What happens here?" value="${escHtml(ui.stepDraft)}"></label>
509
- <button type="submit" class="hx-btn hx-btn--active" data-step-add>Add step</button>
507
+ ${ui.scenarioId === NEW ? `<label class="hx-whatif-field" data-corn="field">Title <input data-corn="control" name="title" class="hx-whatif-input" placeholder="Add a meal" value="${escHtml(ui.titleDraft)}"></label>` : ''}
508
+ <label class="hx-whatif-field" data-corn="field">New step <input data-corn="control" name="text" class="hx-whatif-input" placeholder="What happens here?" value="${escHtml(ui.stepDraft)}"></label>
509
+ <button data-corn-kind="primary" type="submit" class="hx-btn hx-btn--active" data-step-add>Add step</button>
510
510
  <span class="hx-faint hx-whatif-pointing" data-step-target></span>
511
511
  </form>
512
512
  <p class="hx-whatif-msg" data-msg="steps" role="alert" hidden data-corn="message"></p>
@@ -541,6 +541,7 @@ function mountDrawerBox() {
541
541
  drawerBox = document.createElement('div');
542
542
  drawerBox.id = 'whatif-drawer';
543
543
  drawerBox.className = 'hx-block hx-whatif-drawer';
544
+ drawerBox.dataset.corn = 'whatif-node';
544
545
  drawerBox.hidden = true;
545
546
  drawerBox.tabIndex = -1; // holds the focus while it is painted again (paintDrawer)
546
547
  block.after(drawerBox); // under the facts, the mockups and the threads: the node comes first, the tools to edit it after
@@ -569,8 +570,8 @@ function edgeToHtml(n) {
569
570
  .slice(0, EDGE_TO_MAX);
570
571
  if (!others.length) return '';
571
572
  return `<div class="hx-whatif-edgeto">
572
- <label class="hx-whatif-field" data-corn="field">Edge to <select data-edge-to>${others.map((o) => `<option value="${escHtml(o.id)}">${escHtml(o.label)} (${escHtml(o.type)})</option>`).join('')}</select></label>
573
- <button type="button" class="hx-btn hx-btn--quiet" data-whatif="edge-to" data-from="${escHtml(n.id)}" title="Draw an edge from this node to the one picked, without dragging">Draw an edge</button>
573
+ <label class="hx-whatif-field" data-corn="field">Edge to <select data-corn="control" data-edge-to>${others.map((o) => `<option value="${escHtml(o.id)}">${escHtml(o.label)} (${escHtml(o.type)})</option>`).join('')}</select></label>
574
+ <button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet" data-whatif="edge-to" data-from="${escHtml(n.id)}" title="Draw an edge from this node to the one picked, without dragging">Draw an edge</button>
574
575
  </div>`;
575
576
  }
576
577
 
@@ -602,9 +603,9 @@ function fillDrawer(box) {
602
603
  if (kindOfMark(e) === 'removed' && e.mark !== 'edit') { box.hidden = true; return; } // the proposal's own removal: not for an edit to undo
603
604
  if (e.mark === 'edit' && e.editOp === 'removed') {
604
605
  const i = removalIndex('remove-edge', (x) => edgeKey(x) === key);
605
- box.innerHTML = `${title}<p class="hx-faint">You removed this edge.</p><button type="button" class="hx-btn hx-btn--quiet" data-whatif="bring-back" data-index="${i}"${i < 0 ? ' disabled' : ''}>Bring it back</button>${message}`;
606
+ box.innerHTML = `${title}<p class="hx-faint">You removed this edge.</p><button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet" data-whatif="bring-back" data-index="${i}"${i < 0 ? ' disabled' : ''}>Bring it back</button>${message}`;
606
607
  } else {
607
- box.innerHTML = `${title}<button type="button" class="hx-btn hx-btn--quiet" data-whatif="remove-edge" data-from="${escHtml(e.from)}" data-to="${escHtml(e.to)}" data-kind="${escHtml(e.kind || '')}" data-flow="${escHtml(e.flow || '')}" title="Take this edge out of the proposal's map">Remove in this proposal</button>${message}`;
608
+ box.innerHTML = `${title}<button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet" data-whatif="remove-edge" data-from="${escHtml(e.from)}" data-to="${escHtml(e.to)}" data-kind="${escHtml(e.kind || '')}" data-flow="${escHtml(e.flow || '')}" title="Take this edge out of the proposal's map">Remove in this proposal</button>${message}`;
608
609
  }
609
610
  paintMessages();
610
611
  return;
@@ -614,18 +615,18 @@ function fillDrawer(box) {
614
615
  if (n.mark === 'removed') { box.hidden = true; return; } // the proposal's own removal
615
616
  if (n.mark === 'edit' && n.editOp === 'removed') {
616
617
  const i = removalIndex('remove-node', (x) => x.id === n.id);
617
- box.innerHTML = `${title}<p class="hx-faint">You removed this node.</p><button type="button" class="hx-btn hx-btn--quiet" data-whatif="bring-back" data-index="${i}"${i < 0 ? ' disabled' : ''}>Bring it back</button>${message}`;
618
+ box.innerHTML = `${title}<p class="hx-faint">You removed this node.</p><button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet" data-whatif="bring-back" data-index="${i}"${i < 0 ? ' disabled' : ''}>Bring it back</button>${message}`;
618
619
  paintMessages();
619
620
  return;
620
621
  }
621
622
  const edges = state.edges.filter((e) => (e.from === n.id || e.to === n.id) && kindOfMark(e) !== 'removed');
622
623
  const shown = edges.slice(0, 30);
623
- const rows = shown.map((e) => `<li class="hx-whatif-edit"><span class="hx-whatif-edit-text">${escHtml(edgeName(e))} <span class="hx-faint">${escHtml(e.kind === 'flow' ? `flow, ${e.flow}` : e.kind || 'ownership')}</span></span><button type="button" class="hx-textbtn" data-whatif="remove-edge" data-from="${escHtml(e.from)}" data-to="${escHtml(e.to)}" data-kind="${escHtml(e.kind || '')}" data-flow="${escHtml(e.flow || '')}" aria-label="Remove the edge ${escHtml(edgeName(e))}">Remove</button></li>`);
624
+ const rows = shown.map((e) => `<li class="hx-whatif-edit"><span class="hx-whatif-edit-text">${escHtml(edgeName(e))} <span class="hx-faint">${escHtml(e.kind === 'flow' ? `flow, ${e.flow}` : e.kind || 'ownership')}</span></span><button data-corn-kind="quiet" type="button" class="hx-textbtn" data-whatif="remove-edge" data-from="${escHtml(e.from)}" data-to="${escHtml(e.to)}" data-kind="${escHtml(e.kind || '')}" data-flow="${escHtml(e.flow || '')}" aria-label="Remove the edge ${escHtml(edgeName(e))}">Remove</button></li>`);
624
625
  const help = n.mark === 'edit' || n.mark === 'added' ? 'Takes it out of this proposal, with whatever hangs on it.' : 'Shows the map without it.';
625
626
  box.innerHTML = `${title}
626
- <button type="button" class="hx-btn hx-btn--quiet" data-whatif="remove-node" data-id="${escHtml(n.id)}" title="${escHtml(help)}">Remove in this proposal</button>
627
+ <button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet" data-whatif="remove-node" data-id="${escHtml(n.id)}" title="${escHtml(help)}">Remove in this proposal</button>
627
628
  ${edgeToHtml(n)}
628
- ${edges.length ? `<details class="hx-whatif-edges"><summary>Its edges (${edges.length})</summary><ul class="hx-whatif-list">${rows.join('')}</ul>${edges.length > shown.length ? `<p class="hx-faint">and ${edges.length - shown.length} more</p>` : ''}</details>` : ''}
629
+ ${edges.length ? `<details class="hx-whatif-edges"><summary data-corn="summary">Its edges (${edges.length})</summary><ul class="hx-whatif-list">${rows.join('')}</ul>${edges.length > shown.length ? `<p class="hx-faint">and ${edges.length - shown.length} more</p>` : ''}</details>` : ''}
629
630
  ${message}`;
630
631
  paintMessages();
631
632
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cornfield",
3
- "version": "0.36.0",
3
+ "version": "0.37.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)",