cornfield 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/color.js +177 -0
- package/core/config.js +2 -2
- package/core/contrast.js +599 -0
- package/core/theme.js +5 -3
- package/core/validate.js +5 -1
- package/explorer/check.js +3 -0
- package/explorer/cloud-model.js +4 -4
- package/explorer/corn-state.js +34 -0
- package/explorer/explorer.css +9 -8
- package/explorer/flows.js +1 -1
- package/explorer/forge-panel.js +36 -31
- package/explorer/house.js +4 -0
- package/explorer/index.html +103 -103
- package/explorer/layers.js +1 -1
- package/explorer/live-model.js +1 -1
- package/explorer/live.js +1 -1
- package/explorer/mockups-model.js +4 -3
- package/explorer/mockups.js +4 -0
- package/explorer/panels.js +1 -1
- package/explorer/plugins.js +2 -2
- package/explorer/proposal-model.js +1 -1
- package/explorer/proposal.js +4 -4
- package/explorer/renderer.js +1 -0
- package/explorer/review-tokens.js +2 -1
- package/explorer/review.js +2 -1
- package/explorer/runs-map.js +1 -0
- package/explorer/runs-view.js +6 -5
- package/explorer/scenario-ui.js +4 -2
- package/explorer/sheets.js +1 -0
- package/explorer/theme-model.js +6 -23
- package/explorer/tokens.css +14 -9
- package/explorer/whatif.js +22 -21
- package/package.json +1 -1
- package/server/server.js +3 -3
package/explorer/check.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import { state, escHtml } from './state.js';
|
|
26
26
|
import { toggleLayer } from './layers.js';
|
|
27
27
|
import { mapIndex, personaLabel, planChecks, runChecks, stepVerdict, verdictWords } from './check-model.js';
|
|
28
|
+
import { cornState } from './corn-state.js';
|
|
28
29
|
|
|
29
30
|
let checker = null;
|
|
30
31
|
let current = null; // { scenario, as, nodes, plan, answer, controller, onChange }
|
|
@@ -128,6 +129,7 @@ function mountControls(bar) {
|
|
|
128
129
|
const title = bar.querySelector('.hx-player-title');
|
|
129
130
|
const pill = document.createElement('span');
|
|
130
131
|
pill.className = 'hx-player-verdict';
|
|
132
|
+
pill.dataset.corn = 'state-pill';
|
|
131
133
|
pill.hidden = true;
|
|
132
134
|
if (head && title) title.after(pill); else bar.prepend(pill);
|
|
133
135
|
|
|
@@ -208,6 +210,7 @@ export function paintChecks(bar, snap) {
|
|
|
208
210
|
line.hidden = !words;
|
|
209
211
|
if (words) {
|
|
210
212
|
pill.dataset.tone = words.tone;
|
|
213
|
+
if (cornState(words.tone)) pill.dataset.cornState = cornState(words.tone); else delete pill.dataset.cornState;
|
|
211
214
|
pill.textContent = words.pill;
|
|
212
215
|
pill.title = words.line;
|
|
213
216
|
line.dataset.tone = words.tone;
|
package/explorer/cloud-model.js
CHANGED
|
@@ -95,7 +95,7 @@ export function cloudUsedBy(node, nodes, edges) {
|
|
|
95
95
|
/** More users of one kind than this, in one group, fold into a count ("42 containers") with the list behind it */
|
|
96
96
|
export const FOLD_AT = 8;
|
|
97
97
|
|
|
98
|
-
const sec = (title, body) => `<div class="hx-sec"><strong class="hx-strong">${title}</strong>${body}</div>`;
|
|
98
|
+
const sec = (title, body) => `<div class="hx-sec" data-corn="section"><strong class="hx-strong">${title}</strong>${body}</div>`;
|
|
99
99
|
const row = (color, arrow, body) => `<div class="hx-line"><span class="hx-glyph" style="--glyph:${color}">${arrow}</span><span>${body}</span></div>`;
|
|
100
100
|
const name = (label) => `<span class="hx-name">${esc(label)}</span>`;
|
|
101
101
|
|
|
@@ -116,7 +116,7 @@ function groupHtml(group) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/** The Play button (spec 0031 section 8, CLOUD-07): main.js plays outage-model.js `outageScenario` for the node */
|
|
119
|
-
const playButton = (node) => `<div class="hx-sec"><button type="button" class="hx-btn hx-cloud-play" data-action="play-outage" data-id="${esc(node.id)}">▶ Play: ${esc(String(node.label || node.id))} is down</button></div>`;
|
|
119
|
+
const playButton = (node) => `<div class="hx-sec" data-corn="section"><button type="button" class="hx-btn hx-cloud-play" data-action="play-outage" data-id="${esc(node.id)}">▶ Play: ${esc(String(node.label || node.id))} is down</button></div>`;
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* The node panel's section for a cloud node (kind `cloud`) or the public web (kind `web`): badges and plan,
|
|
@@ -128,8 +128,8 @@ export function cloudPanelHtml(node, nodes, edges) {
|
|
|
128
128
|
const label = (id) => String((byId.get(id) || { label: id }).label || id);
|
|
129
129
|
const [kind, ...roles] = cloudBadges(node);
|
|
130
130
|
const tier = node.kind === 'web' ? null : (node.plan && TIER_WORDS[node.plan.tier] ? node.plan.tier : 'unknown');
|
|
131
|
-
const badges = `<div class="hx-cloud-badges"><span class="hx-cloud-badge hx-cloud-badge--${node.kind === 'web' ? 'web' : 'kind'}">${esc(kind)}</span>`
|
|
132
|
-
+ roles.map((r) => `<span class="hx-cloud-badge">${esc(r)}</span>`).join('')
|
|
131
|
+
const badges = `<div class="hx-cloud-badges"><span class="hx-cloud-badge hx-cloud-badge--${node.kind === 'web' ? 'web' : 'kind'}" data-corn="badge">${esc(kind)}</span>`
|
|
132
|
+
+ roles.map((r) => `<span class="hx-cloud-badge" data-corn="badge">${esc(r)}</span>`).join('')
|
|
133
133
|
+ (tier ? `<span class="hx-cloud-plan hx-cloud-plan--${tier}">${esc(TIER_WORDS[tier])}</span>` : '')
|
|
134
134
|
+ '</div>'
|
|
135
135
|
+ (tier && node.plan && node.plan.note ? `<div class="hx-faint hx-cloud-plan-note">${esc(node.plan.note)}</div>` : '');
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public `data-corn-state` values (docs/theming.md, "States"): a small fixed set a theme can rely on, whatever word the
|
|
3
|
+
* forge, the runner or the model uses. A pill, a run card, a notice or a message carries one of these; a word with no
|
|
4
|
+
* public meaning (a verdict not checked yet, say) carries none.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Every value `data-corn-state` can take */
|
|
8
|
+
export const CORN_STATES = Object.freeze(['open', 'merged', 'closed', 'draft', 'queued', 'running', 'waiting', 'done', 'failed', 'stopped', 'success', 'failure']);
|
|
9
|
+
|
|
10
|
+
/** The internal words that map onto a public one: a run's status, a check's or deploy's conclusion, a mockup's review, a verdict, a notice */
|
|
11
|
+
const WORDS = Object.freeze({
|
|
12
|
+
// A run's status: it is waiting to start, it is running, it waits on someone, or it ended
|
|
13
|
+
requested: 'queued', claimed: 'queued', working: 'running', quiet: 'waiting', 'stop-requested': 'stopped',
|
|
14
|
+
// A check's or deploy's conclusion
|
|
15
|
+
neutral: 'done', skipped: 'done', cancelled: 'stopped',
|
|
16
|
+
// A mockup's review state
|
|
17
|
+
approved: 'success', unreviewed: 'waiting', changed: 'waiting', missing: 'failure',
|
|
18
|
+
// The scenario player's verdict
|
|
19
|
+
allowed: 'success', refused: 'failure', mismatch: 'failure', pending: 'running',
|
|
20
|
+
// A notice that went well, a message about a problem
|
|
21
|
+
ok: 'success', bad: 'failure',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/** The public state for an internal word, or '' when it has none */
|
|
25
|
+
export function cornState(word) {
|
|
26
|
+
const w = String(word || '');
|
|
27
|
+
return CORN_STATES.includes(w) ? w : WORDS[w] || '';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The `data-corn-state` attribute for markup (with its leading space), or nothing when the word has no public state */
|
|
31
|
+
export function cornStateAttr(word) {
|
|
32
|
+
const s = cornState(word);
|
|
33
|
+
return s ? ` data-corn-state="${s}"` : '';
|
|
34
|
+
}
|
package/explorer/explorer.css
CHANGED
|
@@ -119,7 +119,8 @@ h1, h2, h3, p { margin: 0; }
|
|
|
119
119
|
.hx-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
120
120
|
.hx-btn:focus-visible, .hx-toggle-row:focus-visible, .hx-zoom-btn:focus-visible, .hx-textbtn:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
|
|
121
121
|
.hx-btn--active, .hx-btn--active:hover { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); box-shadow: var(--corn-shadow-sm); }
|
|
122
|
-
.hx-btn--dim {
|
|
122
|
+
.hx-btn--dim { color: var(--corn-text-3); border-color: var(--corn-line-soft); } /* dimmed by its colours, not by opacity: opacity would take the text below AA */
|
|
123
|
+
.hx-btn--dim:hover { color: var(--corn-text-2); }
|
|
123
124
|
.hx-btn--quiet { font-weight: 500; color: var(--corn-text-3); }
|
|
124
125
|
.hx-btn--icon { width: 28px; height: 28px; padding: 0; justify-content: center; font-size: var(--corn-text-base); }
|
|
125
126
|
.hx-btn--preset { border-color: color-mix(in srgb, var(--corn-hue-orange) 35%, transparent); color: var(--corn-hue-orange); }
|
|
@@ -146,7 +147,7 @@ h1, h2, h3, p { margin: 0; }
|
|
|
146
147
|
transition: width 0.2s, border-color 0.2s;
|
|
147
148
|
user-select: text;
|
|
148
149
|
}
|
|
149
|
-
.hx-input:focus { width: 208px; border-color: var(--corn-
|
|
150
|
+
.hx-input:focus { width: 208px; border-color: var(--corn-focus); }
|
|
150
151
|
.hx-input::placeholder { color: var(--corn-text-3); }
|
|
151
152
|
.hx-input--wide, .hx-input--wide:focus { width: 100%; flex: 1; }
|
|
152
153
|
|
|
@@ -193,7 +194,7 @@ h1, h2, h3, p { margin: 0; }
|
|
|
193
194
|
.hx-menu-head { padding-bottom: var(--corn-space-2); border-bottom: var(--corn-border) solid var(--corn-line); margin-bottom: var(--corn-space-3); }
|
|
194
195
|
.hx-menu-links { display: flex; align-items: center; gap: var(--corn-space-3); text-transform: none; letter-spacing: 0; }
|
|
195
196
|
.hx-menu-section { padding-top: var(--corn-space-3); margin-top: var(--corn-space-3); border-top: var(--corn-border) solid var(--corn-line); }
|
|
196
|
-
.hx-note { padding: var(--corn-space-2) var(--corn-space-3); margin-bottom: var(--corn-space-3); border-radius: var(--corn-radius-sm); background:
|
|
197
|
+
.hx-note { padding: var(--corn-space-2) var(--corn-space-3); margin-bottom: var(--corn-space-3); border-radius: var(--corn-radius-sm); background: var(--corn-hue-orange-soft); color: var(--corn-hue-orange-text); font-size: var(--corn-text-xs); line-height: 1.4; }
|
|
197
198
|
.hx-textbtn { padding: calc(var(--corn-space-1) / 2) var(--corn-space-1); border: 0; border-radius: var(--corn-radius-xs); background: none; color: var(--corn-text-3); font-size: var(--corn-text-2xs); font-weight: 600; }
|
|
198
199
|
.hx-textbtn:hover { background: var(--corn-line-soft); color: var(--corn-text-2); }
|
|
199
200
|
.hx-textbtn--accent { color: var(--corn-accent-text); }
|
|
@@ -201,7 +202,7 @@ h1, h2, h3, p { margin: 0; }
|
|
|
201
202
|
.hx-toggles { display: flex; flex-direction: column; gap: var(--corn-space-1); }
|
|
202
203
|
.hx-toggle-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text); text-align: left; transition: background 0.15s; }
|
|
203
204
|
.hx-toggle-row:hover { background: var(--corn-surface-3); }
|
|
204
|
-
.hx-toggle-row.is-off { background: color-mix(in srgb, var(--corn-ground) 40%, transparent); border-color: transparent; color: var(--corn-text-3);
|
|
205
|
+
.hx-toggle-row.is-off { background: color-mix(in srgb, var(--corn-ground) 40%, transparent); border-color: transparent; color: var(--corn-text-3); } /* off: dimmed by the fill, the text-3 colour and the dot, never by opacity on text */
|
|
205
206
|
.hx-toggle-label, .hx-toggle-meta { display: flex; align-items: center; gap: var(--corn-space-3); }
|
|
206
207
|
.hx-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; transition: transform 0.15s; }
|
|
207
208
|
.hx-toggle-row.is-off .hx-dot { transform: scale(0.75); opacity: 0.4; }
|
|
@@ -327,7 +328,7 @@ h1, h2, h3, p { margin: 0; }
|
|
|
327
328
|
.hx-proposal-item { display: flex; flex-direction: column; align-items: flex-start; gap: var(--corn-space-1); width: 100%; padding: var(--corn-space-3) var(--corn-space-3); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text); text-align: left; font-size: var(--corn-text-xs); }
|
|
328
329
|
button.hx-proposal-item:hover { background: var(--corn-surface-3); }
|
|
329
330
|
button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
|
|
330
|
-
.hx-proposal-item.is-current { border-color: var(--corn-added); background: color-mix(in srgb, var(--corn-added) 12%, transparent); }
|
|
331
|
+
.hx-proposal-item.is-current { border-color: var(--corn-added-text); background: color-mix(in srgb, var(--corn-added) 12%, transparent); }
|
|
331
332
|
.hx-proposal-item.is-broken { opacity: 0.8; cursor: default; }
|
|
332
333
|
.hx-proposal-title { font-size: var(--corn-text-sm); font-weight: 600; color: var(--corn-text); overflow-wrap: anywhere; }
|
|
333
334
|
.hx-proposal-sum { color: var(--corn-text-2); line-height: 1.4; }
|
|
@@ -430,7 +431,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
430
431
|
.hx-whatif-field { display: flex; align-items: center; gap: var(--corn-space-3); color: var(--corn-text-2); }
|
|
431
432
|
.hx-whatif-field > select, .hx-whatif-field > .hx-whatif-input { flex: 1; min-width: 0; }
|
|
432
433
|
.hx-whatif-input, .hx-whatif-field select, .hx-whatif select { padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); user-select: text; }
|
|
433
|
-
.hx-whatif-input:focus, .hx-whatif-field select:focus { outline: var(--corn-focus-width) solid var(--corn-edit); outline-offset: 1px; }
|
|
434
|
+
.hx-whatif-input:focus, .hx-whatif-field select:focus { outline: var(--corn-focus-width) solid var(--corn-edit-text); outline-offset: 1px; }
|
|
434
435
|
.hx-whatif-help { margin: 0; font-size: var(--corn-text-xs); }
|
|
435
436
|
.hx-whatif-pair { margin: 0; }
|
|
436
437
|
.hx-whatif-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2); }
|
|
@@ -459,7 +460,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
459
460
|
.hx-review[hidden] { display: none; }
|
|
460
461
|
.hx-review-label { color: var(--corn-text-3); font-size: var(--corn-text-xs); }
|
|
461
462
|
.hx-review-note { width: 100%; min-height: 44px; resize: vertical; padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); line-height: 1.4; user-select: text; }
|
|
462
|
-
.hx-review-note:focus { outline: var(--corn-focus-width) solid var(--corn-added); outline-offset: 1px; }
|
|
463
|
+
.hx-review-note:focus { outline: var(--corn-focus-width) solid var(--corn-added-text); outline-offset: 1px; }
|
|
463
464
|
.hx-review-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2) var(--corn-space-3); }
|
|
464
465
|
.hx-review .hx-btn:disabled { opacity: 0.4; cursor: default; }
|
|
465
466
|
.hx-btn--approve { border-color: color-mix(in srgb, var(--corn-added) 50%, transparent); color: var(--corn-added-text); }
|
|
@@ -558,7 +559,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
558
559
|
.hx-live-token-label { display: block; margin-bottom: var(--corn-space-1); color: var(--corn-text); font-size: var(--corn-text-sm); font-weight: 600; }
|
|
559
560
|
.hx-live-token-row { display: flex; gap: var(--corn-space-2); align-items: center; margin-bottom: var(--corn-space-2); }
|
|
560
561
|
.hx-live-token-input { flex: 1; min-width: 0; padding: var(--corn-space-2) var(--corn-space-3); font-size: var(--corn-text-sm); }
|
|
561
|
-
.hx-live-token-input:focus { outline: none; border-color: var(--corn-
|
|
562
|
+
.hx-live-token-input:focus { outline: none; border-color: var(--corn-focus); }
|
|
562
563
|
.hx-live-help code { font-family: var(--corn-mono); font-size: var(--corn-text-2xs); color: var(--corn-text-2); overflow-wrap: anywhere; }
|
|
563
564
|
.hx-live-second { font-size: var(--corn-text-xs); }
|
|
564
565
|
.hx-live-buttons { display: inline-flex; gap: var(--corn-space-2); }
|
package/explorer/flows.js
CHANGED
|
@@ -149,7 +149,7 @@ export function renderFlowLegend() {
|
|
|
149
149
|
export function flowSummary(node) {
|
|
150
150
|
const flows = state.edges.filter((e) => e.kind === 'flow' && (e.from === node.id || e.to === node.id));
|
|
151
151
|
if (flows.length === 0) return '';
|
|
152
|
-
return `<div class="hx-sec"><strong class="hx-strong">Data flows:</strong>
|
|
152
|
+
return `<div class="hx-sec" data-corn="section"><strong class="hx-strong">Data flows:</strong>
|
|
153
153
|
${flows.map((e) => {
|
|
154
154
|
const out = e.from === node.id;
|
|
155
155
|
const s = FLOW_STYLES[e.flow] || FLOW_STYLES.sync;
|
package/explorer/forge-panel.js
CHANGED
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
DRAFTS_URL, notesUrl, sinceChoices, notesSummary, validTag, confirmWords, postedWords, draftRequest,
|
|
82
82
|
threadsUrl, threadUrl, issueUrl, IDEAS_URL, threadKindWords, threadMeta, litForThread, mentionsIndex, ideaRequest, ideaWords,
|
|
83
83
|
} from './forge-panel-model.js';
|
|
84
|
+
import { cornStateAttr } from './corn-state.js';
|
|
84
85
|
|
|
85
86
|
const $ = (id) => document.getElementById(id);
|
|
86
87
|
const FORGE_NAMES = { github: 'GitHub', forgejo: 'Forgejo' };
|
|
@@ -644,6 +645,7 @@ function paintIdea() {
|
|
|
644
645
|
const message = $('idea-message');
|
|
645
646
|
message.hidden = !ui.idea.message;
|
|
646
647
|
message.classList.toggle('hx-forge-msg--bad', ui.idea.bad);
|
|
648
|
+
if (ui.idea.bad) message.dataset.cornState = 'failure'; else delete message.dataset.cornState;
|
|
647
649
|
message.textContent = ui.idea.message;
|
|
648
650
|
if (ui.idea.message && ui.idea.link && safeUrl(ui.idea.link)) {
|
|
649
651
|
const link = document.createElement('a');
|
|
@@ -795,6 +797,7 @@ function paintNotes() {
|
|
|
795
797
|
const message = $('notes-message');
|
|
796
798
|
message.hidden = !n.message;
|
|
797
799
|
message.classList.toggle('hx-forge-msg--bad', n.bad);
|
|
800
|
+
if (n.bad) message.dataset.cornState = 'failure'; else delete message.dataset.cornState;
|
|
798
801
|
message.textContent = n.message;
|
|
799
802
|
if (n.message && n.link && safeUrl(n.link)) {
|
|
800
803
|
const link = document.createElement('a');
|
|
@@ -844,9 +847,9 @@ function lightsWords(deploy) {
|
|
|
844
847
|
function deployHtml(d) {
|
|
845
848
|
const link = safeUrl(d.url);
|
|
846
849
|
const out = link ? `<a class="hx-forge-out" href="${escHtml(link)}" target="_blank" rel="noreferrer" aria-label="Open deploy ${escHtml(d.name)} on ${escHtml(forgeName())} (new tab)">↗</a>` : '';
|
|
847
|
-
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-deploy="${escHtml(d.id)}" aria-pressed="${ui.deploy === d.id}">
|
|
850
|
+
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-deploy="${escHtml(d.id)}" aria-pressed="${ui.deploy === d.id}" data-corn="row">
|
|
848
851
|
<span class="hx-forge-title">${escHtml(d.name)}${d.title && d.title !== d.name ? `<span class="hx-faint"> · ${escHtml(d.title)}</span>` : ''}</span>
|
|
849
|
-
<span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}">${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}</span>
|
|
852
|
+
<span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}" data-corn="state-pill"${cornStateAttr(d.state)}>${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}</span>
|
|
850
853
|
<span class="hx-forge-labels"><span class="hx-forge-label">${escHtml(lightsWords(d))}</span></span></button>${out}</li>`;
|
|
851
854
|
}
|
|
852
855
|
|
|
@@ -858,10 +861,10 @@ function threadHtml(t) {
|
|
|
858
861
|
// The run that is about this thread, as a word (issue #104): the Agents tab's list, read for every tab, says it; the row only names its state
|
|
859
862
|
const runs = ui.runs && ui.runs.data ? ui.runs.data.runs : null;
|
|
860
863
|
const run = runOnThread(runs, t.number);
|
|
861
|
-
const runWord = run ? `<span class="hx-forge-state hx-forge-state--${runTone(run)}" data-thread-run="${escHtml(run.runId)}">${escHtml(threadRunWords(runs, t.number))}</span> ` : '';
|
|
862
|
-
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-thread="${t.number}" aria-pressed="${ui.thread === t.number}">
|
|
864
|
+
const runWord = run ? `<span class="hx-forge-state hx-forge-state--${runTone(run)}" data-thread-run="${escHtml(run.runId)}" data-corn="state-pill"${cornStateAttr(run.status)}>${escHtml(threadRunWords(runs, t.number))}</span> ` : '';
|
|
865
|
+
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-thread="${t.number}" aria-pressed="${ui.thread === t.number}" data-corn="row">
|
|
863
866
|
<span class="hx-forge-title">${escHtml(t.title)}</span>
|
|
864
|
-
<span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(t.state)}">${escHtml(t.state === 'open' ? 'Open' : 'Closed')}</span> ${runWord}<span class="hx-forge-label">${escHtml(threadKindWords(t))}</span> ${escHtml(threadMeta(t, now()))}</span>${note ? `<span class="hx-forge-meta">${escHtml(note)}</span>` : ''}</button>${out}</li>`;
|
|
867
|
+
<span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(t.state)}" data-corn="state-pill"${cornStateAttr(t.state)}>${escHtml(t.state === 'open' ? 'Open' : 'Closed')}</span> ${runWord}<span class="hx-forge-label">${escHtml(threadKindWords(t))}</span> ${escHtml(threadMeta(t, now()))}</span>${note ? `<span class="hx-forge-meta">${escHtml(note)}</span>` : ''}</button>${out}</li>`;
|
|
865
868
|
}
|
|
866
869
|
|
|
867
870
|
function itemHtml(item, before = '', after = '') {
|
|
@@ -870,10 +873,10 @@ function itemHtml(item, before = '', after = '') {
|
|
|
870
873
|
const link = safeUrl(item.url);
|
|
871
874
|
const labels = item.labels.length ? `<span class="hx-forge-labels">${item.labels.map((l) => `<span class="hx-forge-label">${escHtml(l)}</span>`).join('')}</span>` : '';
|
|
872
875
|
const inner = `<span class="hx-forge-title">${escHtml(item.title)}</span>
|
|
873
|
-
<span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(item.draft ? 'draft' : item.state)}">${escHtml(stateWords(item))}</span> ${escHtml(metaWords(item, now()))}</span>${before}${after}${labels}`;
|
|
876
|
+
<span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(item.draft ? 'draft' : item.state)}" data-corn="state-pill"${cornStateAttr(item.draft ? 'draft' : item.state)}>${escHtml(stateWords(item))}</span> ${escHtml(metaWords(item, now()))}</span>${before}${after}${labels}`;
|
|
874
877
|
const out = link ? `<a class="hx-forge-out" href="${escHtml(link)}" target="_blank" rel="noreferrer" aria-label="Open ${escHtml(item.head ? 'pull request' : 'issue')} ${item.number} on ${escHtml(forgeName())} (new tab)">↗</a>` : '';
|
|
875
878
|
if (ui.kind !== 'issues') {
|
|
876
|
-
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-pr="${item.number}" aria-pressed="${ui.selected === item.number}">${inner}</button>${out}</li>`;
|
|
879
|
+
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-pr="${item.number}" aria-pressed="${ui.selected === item.number}" data-corn="row">${inner}</button>${out}</li>`;
|
|
877
880
|
}
|
|
878
881
|
// An issue has no more to show here: its row is the link out; an open one also starts its spec (step 1 of the pipeline)
|
|
879
882
|
const spec = specBlock(item) === null
|
|
@@ -883,19 +886,19 @@ function itemHtml(item, before = '', after = '') {
|
|
|
883
886
|
? `<button type="button" class="hx-btn hx-forge-act hx-forge-startspec" data-forge-agent="issue:${item.number}" aria-label="Start an agent on issue ${item.number}">Start an agent …</button>`
|
|
884
887
|
: '';
|
|
885
888
|
return link
|
|
886
|
-
? `<li class="hx-forge-item"><a class="hx-forge-row" href="${escHtml(link)}" target="_blank" rel="noreferrer">${inner}<span class="hx-sr-only"> (opens ${escHtml(forgeName())} in a new tab)</span></a>${spec}${agent}</li>`
|
|
887
|
-
: `<li class="hx-forge-item"><div class="hx-forge-row">${inner}</div>${spec}${agent}</li>`;
|
|
889
|
+
? `<li class="hx-forge-item"><a class="hx-forge-row" href="${escHtml(link)}" target="_blank" rel="noreferrer" data-corn="row">${inner}<span class="hx-sr-only"> (opens ${escHtml(forgeName())} in a new tab)</span></a>${spec}${agent}</li>`
|
|
890
|
+
: `<li class="hx-forge-item"><div class="hx-forge-row" data-corn="row">${inner}</div>${spec}${agent}</li>`;
|
|
888
891
|
}
|
|
889
892
|
|
|
890
893
|
/** One piece of work in a group: a pull request (a row that selects it, as in the Pull requests tab) or a branch with none */
|
|
891
894
|
function workHtml(e) {
|
|
892
|
-
const mark = e.mark ? `<span class="hx-forge-agentline"><span class="hx-forge-agent" title="Agent-made: ${escHtml(markWords(e.mark))}">Agent</span><span class="hx-forge-why hx-faint">${escHtml(markWords(e.mark))}</span></span>` : '';
|
|
895
|
+
const mark = e.mark ? `<span class="hx-forge-agentline"><span class="hx-forge-agent" title="Agent-made: ${escHtml(markWords(e.mark))}" data-corn="badge">Agent</span><span class="hx-forge-why hx-faint">${escHtml(markWords(e.mark))}</span></span>` : '';
|
|
893
896
|
if (e.type === 'pull') {
|
|
894
897
|
const also = e.issues.slice(1);
|
|
895
898
|
const note = [e.proposal ? `Spec PR for ${e.proposal}` : '', also.length ? `Also closes ${also.map((n) => `#${n}`).join(', ')}` : ''].filter(Boolean);
|
|
896
899
|
return itemHtml(e.pull, mark, note.length ? `<span class="hx-forge-meta">${escHtml(note.join(' · '))}</span>` : '');
|
|
897
900
|
}
|
|
898
|
-
return `<li class="hx-forge-item"><div class="hx-forge-row hx-forge-branch"><span class="hx-forge-title"><span class="hx-sr-only">Branch </span><code class="hx-code">${escHtml(e.branch.name)}</code></span><span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--draft">Branch</span> no pull request yet</span>${mark}</div></li>`;
|
|
901
|
+
return `<li class="hx-forge-item"><div class="hx-forge-row hx-forge-branch" data-corn="row"><span class="hx-forge-title"><span class="hx-sr-only">Branch </span><code class="hx-code">${escHtml(e.branch.name)}</code></span><span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--draft" data-corn="state-pill" data-corn-state="draft">Branch</span> no pull request yet</span>${mark}</div></li>`;
|
|
899
902
|
}
|
|
900
903
|
|
|
901
904
|
/** The Agents tab's groups, each a heading and its work */
|
|
@@ -914,19 +917,19 @@ function deployDetailHtml() {
|
|
|
914
917
|
const d = ui.deployItem;
|
|
915
918
|
const lit = ui.litDeploy;
|
|
916
919
|
const url = safeUrl(d.url);
|
|
917
|
-
const head = `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${escHtml(d.name)}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-deploy">Clear</button></div>
|
|
918
|
-
<p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}">${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}${url ? ` · <a class="hx-link" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</p>`;
|
|
920
|
+
const head = `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${escHtml(d.name)}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-deploy" data-corn-kind="quiet">Clear</button></div>
|
|
921
|
+
<p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}" data-corn="state-pill"${cornStateAttr(d.state)}>${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}${url ? ` · <a class="hx-link" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</p>`;
|
|
919
922
|
const stale = ui.lists.deploys && ui.lists.deploys.stale;
|
|
920
923
|
let body;
|
|
921
924
|
if (!d.restarts.length) {
|
|
922
|
-
body = '<p class="hx-forge-notice">No node is mapped to this deploy, so nothing is lit. Say what it restarts under <code class="hx-code">deploys.restarts</code> in cornfield.config.js (docs/deploys.md).</p>';
|
|
925
|
+
body = '<p class="hx-forge-notice" data-corn="notice">No node is mapped to this deploy, so nothing is lit. Say what it restarts under <code class="hx-code">deploys.restarts</code> in cornfield.config.js (docs/deploys.md).</p>';
|
|
923
926
|
} else {
|
|
924
927
|
const rows = lit.nodes.map((n) => `<li class="hx-forge-file"><button type="button" class="hx-forge-node" data-forge-node="${escHtml(n.id)}" aria-label="Show ${escHtml(n.label)} on the map${isNodeVisible(n) ? '' : ' (its layer is off)'}">${escHtml(n.label)}${isNodeVisible(n) ? '' : ' · layer off'}</button> <span class="hx-faint">${escHtml(n.type)}</span></li>`).join('');
|
|
925
|
-
const missing = lit.missing.length ? `<p class="hx-forge-notice">${escHtml(lit.missing.join(', '))} ${lit.missing.length === 1 ? 'is' : 'are'} named in the config but not on the map.</p>` : '';
|
|
928
|
+
const missing = lit.missing.length ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(lit.missing.join(', '))} ${lit.missing.length === 1 ? 'is' : 'are'} named in the config but not on the map.</p>` : '';
|
|
926
929
|
const key = lit.nodes.length ? `<p class="hx-forge-key hx-faint"><span class="hx-mark-dot hx-mark-dot--${d.state === 'failure' ? 'removed' : 'changed'}" aria-hidden="true"></span>${d.state === 'failure' ? 'restarted by a deploy that failed' : 'restarted by this deploy'}</p>` : '';
|
|
927
930
|
body = `<h4 class="hx-forge-sub">${escHtml(`Restarted: ${plural(lit.nodes.length, 'node')} on the map`)}</h4>${key}${rows ? `<ul class="hx-forge-files">${rows}</ul>` : ''}${missing}`;
|
|
928
931
|
}
|
|
929
|
-
return `${head}${stale ? `<p class="hx-forge-notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}${body}`;
|
|
932
|
+
return `${head}${stale ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}${body}`;
|
|
930
933
|
}
|
|
931
934
|
|
|
932
935
|
/** A node button, as in a pull request's files: it selects the node on the map */
|
|
@@ -934,8 +937,8 @@ const nodeButton = (n) => `<button type="button" class="hx-forge-node" data-forg
|
|
|
934
937
|
|
|
935
938
|
/** The selected thread: read-only, its messages as written, a way to reply on the forge, and the nodes its text lights */
|
|
936
939
|
function threadDetailHtml() {
|
|
937
|
-
const head = (title) => `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${title}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-thread">Clear</button></div>`;
|
|
938
|
-
if (ui.threadError) return `${head(`Thread ${ui.thread}`)}<p class="hx-forge-notice">${escHtml(ui.threadError)}</p>`;
|
|
940
|
+
const head = (title) => `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${title}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-thread" data-corn-kind="quiet">Clear</button></div>`;
|
|
941
|
+
if (ui.threadError) return `${head(`Thread ${ui.thread}`)}<p class="hx-forge-notice" data-corn="notice">${escHtml(ui.threadError)}</p>`;
|
|
939
942
|
if (!ui.threadDetail) return `${head(`Thread ${ui.thread}`)}<p class="hx-faint">Loading its messages …</p>`;
|
|
940
943
|
const { thread: t, stale } = ui.threadDetail;
|
|
941
944
|
const lit = ui.litThread;
|
|
@@ -956,14 +959,14 @@ function threadDetailHtml() {
|
|
|
956
959
|
}).join('');
|
|
957
960
|
const key = lit.nodes.length ? `<p class="hx-forge-key hx-faint"><span class="hx-mark-dot hx-mark-dot--changed" aria-hidden="true"></span>a node this thread mentions</p>` : '';
|
|
958
961
|
return `${head(`#${t.number} ${escHtml(t.title)}`)}
|
|
959
|
-
<p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(t.state)}">${t.state === 'open' ? 'Open' : 'Closed'}</span> ${escHtml(threadKindWords(t))} · ${escHtml(threadMeta({ ...t, comments: t.messages.length - (t.kind === 'idea' ? 1 : 0) + (t.hidden || 0) }, now()))}</p>
|
|
962
|
+
<p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(t.state)}" data-corn="state-pill"${cornStateAttr(t.state)}>${t.state === 'open' ? 'Open' : 'Closed'}</span> ${escHtml(threadKindWords(t))} · ${escHtml(threadMeta({ ...t, comments: t.messages.length - (t.kind === 'idea' ? 1 : 0) + (t.hidden || 0) }, now()))}</p>
|
|
960
963
|
<p class="hx-forge-why hx-faint">Read-only here: a thread is a conversation on ${escHtml(forgeName())}, so you reply there. ${reply}</p>
|
|
961
964
|
${named.length ? `<p class="hx-forge-meta">${named.join(' · ')}</p>` : ''}
|
|
962
|
-
${stale ? `<p class="hx-forge-notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}
|
|
965
|
+
${stale ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}
|
|
963
966
|
<h4 class="hx-forge-sub">${escHtml(`Mentions: ${plural(lit.nodes.length, 'node')} on the map`)}</h4>
|
|
964
967
|
${key}
|
|
965
968
|
${lit.nodes.length ? `<span class="hx-forge-nodes hx-thread-nodes">${lit.nodes.map(nodeButton).join('')}</span>` : '<p class="hx-faint">No message mentions a node. Write [[node-id]] or [[repo/path]] in a message to point at the map.</p>'}
|
|
966
|
-
${lit.unresolved.length ? `<p class="hx-forge-notice">${escHtml(lit.unresolved.join(', '))} ${lit.unresolved.length === 1 ? 'is' : 'are'} mentioned but not on the map, so ${lit.unresolved.length === 1 ? 'it stays' : 'they stay'} text.</p>` : ''}
|
|
969
|
+
${lit.unresolved.length ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(lit.unresolved.join(', '))} ${lit.unresolved.length === 1 ? 'is' : 'are'} mentioned but not on the map, so ${lit.unresolved.length === 1 ? 'it stays' : 'they stay'} text.</p>` : ''}
|
|
967
970
|
<h4 class="hx-forge-sub">${escHtml(plural(t.messages.length, 'message'))}</h4>
|
|
968
971
|
${t.hidden ? `<p class="hx-forge-why hx-faint">${escHtml(plural(t.hidden, 'earlier message'))} not shown; they are on ${escHtml(forgeName())}.</p>` : ''}
|
|
969
972
|
<ol class="hx-thread-msgs" aria-label="Messages">${msgs}</ol>`;
|
|
@@ -973,8 +976,8 @@ function detailHtml() {
|
|
|
973
976
|
if (ui.thread !== null) return threadDetailHtml();
|
|
974
977
|
if (ui.deployItem) return deployDetailHtml();
|
|
975
978
|
if (ui.selected === null) return '';
|
|
976
|
-
const head = (title, link) => `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${title}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-pr">Clear</button></div>${link || ''}`;
|
|
977
|
-
if (ui.detailError) return `${head(`Pull request ${ui.selected}`)}<p class="hx-forge-notice">${escHtml(ui.detailError)}</p>`;
|
|
979
|
+
const head = (title, link) => `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${title}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-pr" data-corn-kind="quiet">Clear</button></div>${link || ''}`;
|
|
980
|
+
if (ui.detailError) return `${head(`Pull request ${ui.selected}`)}<p class="hx-forge-notice" data-corn="notice">${escHtml(ui.detailError)}</p>`;
|
|
978
981
|
if (!ui.detail) return `${head(`Pull request ${ui.selected}`)}<p class="hx-faint">Loading its files and checks …</p>`;
|
|
979
982
|
const { pull, checks, stale } = ui.detail;
|
|
980
983
|
const lit = ui.lit;
|
|
@@ -995,7 +998,7 @@ function detailHtml() {
|
|
|
995
998
|
? `<button type="button" class="hx-btn hx-forge-act" data-forge-rerun="${escHtml(c.id)}" aria-label="Re-run ${escHtml(c.name)}"${ui.busy ? ' disabled' : ''}>Re-run</button>`
|
|
996
999
|
: '';
|
|
997
1000
|
const whyNot = why ? `<span class="hx-faint hx-forge-lights">${escHtml(why)}</span>` : '';
|
|
998
|
-
return `<li class="hx-forge-check"><span class="hx-forge-state hx-forge-state--${escHtml(c.state)}">${escHtml(checkWords(c))}</span> ${name}${again}${lights}${whyNot}</li>`;
|
|
1001
|
+
return `<li class="hx-forge-check"><span class="hx-forge-state hx-forge-state--${escHtml(c.state)}" data-corn="state-pill"${cornStateAttr(c.state)}>${escHtml(checkWords(c))}</span> ${name}${again}${lights}${whyNot}</li>`;
|
|
999
1002
|
}).join('');
|
|
1000
1003
|
|
|
1001
1004
|
const fileRows = lit.files.map((f) => {
|
|
@@ -1009,25 +1012,25 @@ function detailHtml() {
|
|
|
1009
1012
|
const block = mergeBlock(ui.detail);
|
|
1010
1013
|
const act = block
|
|
1011
1014
|
? `<p class="hx-forge-why hx-faint">${pull.state === 'merged' ? '' : 'Cannot be landed from here. '}${escHtml(block)}</p>`
|
|
1012
|
-
: `<button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-forge-merge="${pull.number}"${ui.busy ? ' disabled' : ''}>Land it …</button><p class="hx-forge-why hx-faint">Opens a confirm step that shows what will land. Never forced, never deployed.</p>`;
|
|
1015
|
+
: `<button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-forge-merge="${pull.number}"${ui.busy ? ' disabled' : ''} data-corn-kind="approve">Land it …</button><p class="hx-forge-why hx-faint">Opens a confirm step that shows what will land. Never forced, never deployed.</p>`;
|
|
1013
1016
|
// A spec approved with `proposals.approveLands` waits for its checks: said here, with a way to stop it
|
|
1014
1017
|
const waiting = ui.landing && pull.state === 'open'
|
|
1015
|
-
? `<div class="hx-forge-step"><p class="hx-forge-notice hx-forge-notice--ok" role="status">${escHtml(landingWords(ui.landing, now()))}</p><button type="button" class="hx-btn hx-forge-act" data-forge-landing-cancel="${pull.number}"${ui.busy ? ' disabled' : ''}>Cancel</button></div>`
|
|
1018
|
+
? `<div class="hx-forge-step"><p class="hx-forge-notice hx-forge-notice--ok" role="status" data-corn="notice" data-corn-state="success">${escHtml(landingWords(ui.landing, now()))}</p><button type="button" class="hx-btn hx-forge-act" data-forge-landing-cancel="${pull.number}"${ui.busy ? ' disabled' : ''}>Cancel</button></div>`
|
|
1016
1019
|
: '';
|
|
1017
|
-
const note = ui.note ? `<p class="hx-forge-notice${ui.note.ok ? ' hx-forge-notice--ok' : ''}">${escHtml(ui.note.text)}</p>` : '';
|
|
1020
|
+
const note = ui.note ? `<p class="hx-forge-notice${ui.note.ok ? ' hx-forge-notice--ok' : ''}" data-corn="notice"${ui.note.ok ? ' data-corn-state="success"' : ''}>${escHtml(ui.note.text)}</p>` : '';
|
|
1018
1021
|
// Step 2 of the pipeline: a spec pull request with an approved proposal opens its build issue
|
|
1019
1022
|
const offers = buildOffers(ui.detail);
|
|
1020
1023
|
const build = offers.length
|
|
1021
1024
|
? `<h4 class="hx-forge-subact">Build issue</h4>${offers.map((o) => (o.offer
|
|
1022
|
-
? `<div class="hx-forge-step"><button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-forge-build="${escHtml(o.slug)}" aria-label="Open the build issue for ${escHtml(o.slug)}"${ui.busy ? ' disabled' : ''}>Open the build issue …</button><p class="hx-forge-why hx-faint"><code class="hx-code">${escHtml(o.slug)}</code> is approved. Opens a confirm step that shows the issue. Nothing is built.</p></div>`
|
|
1025
|
+
? `<div class="hx-forge-step"><button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-forge-build="${escHtml(o.slug)}" aria-label="Open the build issue for ${escHtml(o.slug)}"${ui.busy ? ' disabled' : ''} data-corn-kind="approve">Open the build issue …</button><p class="hx-forge-why hx-faint"><code class="hx-code">${escHtml(o.slug)}</code> is approved. Opens a confirm step that shows the issue. Nothing is built.</p></div>`
|
|
1023
1026
|
: `<p class="hx-forge-why hx-faint"><code class="hx-code">${escHtml(o.slug)}</code>: ${escHtml(o.why)}</p>`)).join('')}`
|
|
1024
1027
|
: '';
|
|
1025
1028
|
|
|
1026
1029
|
const key = lit.changed.size || lit.failing.size
|
|
1027
1030
|
? `<p class="hx-forge-key hx-faint"><span class="hx-mark-dot hx-mark-dot--changed" aria-hidden="true"></span>a file this pull request changes <span class="hx-mark-dot hx-mark-dot--removed" aria-hidden="true"></span>a test a failing check names</p>`
|
|
1028
1031
|
: '';
|
|
1029
|
-
return `${head(`#${pull.number} ${escHtml(pull.title)}`, `<p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(pull.draft ? 'draft' : pull.state)}">${escHtml(stateWords(pull))}</span> ${escHtml(pull.head.ref)} → ${escHtml(pull.base.ref)}${url ? ` · <a class="hx-link" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</p>`)}
|
|
1030
|
-
${stale ? `<p class="hx-forge-notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}
|
|
1032
|
+
return `${head(`#${pull.number} ${escHtml(pull.title)}`, `<p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(pull.draft ? 'draft' : pull.state)}" data-corn="state-pill"${cornStateAttr(pull.draft ? 'draft' : pull.state)}>${escHtml(stateWords(pull))}</span> ${escHtml(pull.head.ref)} → ${escHtml(pull.base.ref)}${url ? ` · <a class="hx-link" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</p>`)}
|
|
1033
|
+
${stale ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}
|
|
1031
1034
|
<h4 class="hx-forge-sub">Checks: ${escHtml(checksWords(checks))}</h4>
|
|
1032
1035
|
${checks.length ? `<ul class="hx-forge-checks">${checkRows}</ul>` : ''}
|
|
1033
1036
|
${build}
|
|
@@ -1103,6 +1106,7 @@ function draw(panel) {
|
|
|
1103
1106
|
act.hidden = !ui.actNote;
|
|
1104
1107
|
const link = ui.actNote && safeUrl(ui.actNote.url);
|
|
1105
1108
|
act.className = `hx-forge-notice${ui.actNote && ui.actNote.ok ? ' hx-forge-notice--ok' : ''}`;
|
|
1109
|
+
if (ui.actNote && ui.actNote.ok) act.dataset.cornState = 'success'; else delete act.dataset.cornState;
|
|
1106
1110
|
act.innerHTML = ui.actNote ? `${escHtml(ui.actNote.text)}${link ? ` <a class="hx-link" href="${escHtml(link)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}` : '';
|
|
1107
1111
|
}
|
|
1108
1112
|
|
|
@@ -1135,6 +1139,7 @@ function paintRuns() {
|
|
|
1135
1139
|
const words = (ui.runs && ui.runs.error) || (ui.runNote ? ui.runNote.text : '');
|
|
1136
1140
|
note.hidden = !words;
|
|
1137
1141
|
note.className = `hx-forge-notice${!(ui.runs && ui.runs.error) && ui.runNote && ui.runNote.ok ? ' hx-forge-notice--ok' : ''}`;
|
|
1142
|
+
if (!(ui.runs && ui.runs.error) && ui.runNote && ui.runNote.ok) note.dataset.cornState = 'success'; else delete note.dataset.cornState;
|
|
1138
1143
|
note.textContent = words;
|
|
1139
1144
|
paintRunner('forge-runs-runner', data);
|
|
1140
1145
|
const trig = $('forge-runs-trigger');
|
|
@@ -1299,7 +1304,7 @@ function showConfirm(what, goLabel, state) {
|
|
|
1299
1304
|
const asCode = ['Commit', 'At commit', 'Branch', 'File', 'Proposal'];
|
|
1300
1305
|
$('forge-confirm-title').textContent = what.title;
|
|
1301
1306
|
$('forge-confirm-body').innerHTML = `<dl class="hx-confirm-facts">${what.lines.map(([k, v]) => `<dt>${escHtml(k)}</dt><dd>${asCode.includes(k) ? `<code class="hx-code">${escHtml(v)}</code>` : escHtml(v)}</dd>`).join('')}</dl>
|
|
1302
|
-
${(what.checks || []).length ? `<ul class="hx-confirm-checks">${what.checks.map((c) => `<li><span class="hx-forge-state hx-forge-state--success">${escHtml(c.words)}</span> ${escHtml(c.name)}</li>`).join('')}</ul>` : ''}
|
|
1307
|
+
${(what.checks || []).length ? `<ul class="hx-confirm-checks">${what.checks.map((c) => `<li><span class="hx-forge-state hx-forge-state--success" data-corn="state-pill" data-corn-state="success">${escHtml(c.words)}</span> ${escHtml(c.name)}</li>`).join('')}</ul>` : ''}
|
|
1303
1308
|
${(what.previews || []).map((pv) => `<p class="hx-confirm-label">${escHtml(pv.label)}</p><pre class="hx-confirm-pre" tabindex="0" role="region" aria-label="${escHtml(pv.label)}">${escHtml(pv.text)}</pre>`).join('')}
|
|
1304
1309
|
<p class="hx-confirm-note">${escHtml(what.note)}</p>`;
|
|
1305
1310
|
const go = el.querySelector('[data-action="forge-confirm-go"]');
|
package/explorer/house.js
CHANGED
|
@@ -125,20 +125,24 @@ function mount() {
|
|
|
125
125
|
if (!stage || (els && els.stage === stage && stage.contains(els.under))) return;
|
|
126
126
|
const under = document.createElement('div');
|
|
127
127
|
under.className = 'hx-house-under';
|
|
128
|
+
under.dataset.corn = 'house-under';
|
|
128
129
|
under.setAttribute('aria-hidden', 'true');
|
|
129
130
|
under.inert = true;
|
|
130
131
|
under.hidden = true;
|
|
131
132
|
const map = document.createElement(hook && hook.element ? hook.element : 'div');
|
|
132
133
|
map.className = 'hx-house-plan';
|
|
134
|
+
map.dataset.corn = 'house-plan';
|
|
133
135
|
under.appendChild(map);
|
|
134
136
|
stage.insertBefore(under, stage.firstChild);
|
|
135
137
|
|
|
136
138
|
const over = document.createElement('div');
|
|
137
139
|
over.className = 'hx-house-over';
|
|
140
|
+
over.dataset.corn = 'house-over';
|
|
138
141
|
over.hidden = true;
|
|
139
142
|
|
|
140
143
|
const bar = document.createElement('div');
|
|
141
144
|
bar.className = 'hx-house-bar';
|
|
145
|
+
bar.dataset.corn = 'house-bar';
|
|
142
146
|
bar.hidden = true;
|
|
143
147
|
bar.innerHTML = '<div class="hx-house-floors glass" role="group" aria-label="Floor"></div><div class="hx-house-people" role="group" aria-label="People"></div>';
|
|
144
148
|
stage.appendChild(over);
|