cornfield 0.36.1 → 0.38.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/strings.js +10 -0
- package/explorer/capped.js +1 -1
- package/explorer/check.js +3 -2
- package/explorer/cloud-model.js +1 -1
- package/explorer/corn-state.js +22 -2
- package/explorer/explorer.css +63 -0
- package/explorer/flows.js +5 -5
- package/explorer/forge-panel.js +207 -46
- package/explorer/house.js +6 -6
- package/explorer/index.html +101 -95
- package/explorer/layers.js +4 -4
- package/explorer/live-model.js +1 -1
- package/explorer/live.js +8 -5
- package/explorer/mockups-model.js +1 -1
- package/explorer/mockups.js +2 -0
- package/explorer/panels.js +9 -4
- package/explorer/plugins.js +1 -1
- package/explorer/proposal-model.js +21 -15
- package/explorer/proposal.js +10 -8
- package/explorer/review.js +3 -2
- package/explorer/runs-view.js +20 -17
- package/explorer/scenario-ui.js +5 -4
- package/explorer/sheet-model.js +67 -19
- package/explorer/sheets.js +140 -14
- package/explorer/waiting-line.js +57 -0
- package/explorer/waiting-model.js +287 -0
- package/explorer/waiting-view.js +37 -0
- package/explorer/whatif.js +42 -41
- package/package.json +1 -1
- package/server/forge-forgejo.js +1 -1
- package/server/forge-github.js +1 -1
- package/server/forge.js +1 -1
- package/server/proposal-pulls.js +93 -2
- package/server/proposals.js +4 -2
- package/server/reviews.js +5 -4
- package/server/submit-review.js +2 -1
package/core/strings.js
CHANGED
|
@@ -40,6 +40,16 @@ export const STRINGS = Object.freeze({
|
|
|
40
40
|
tabThreads: 'Threads',
|
|
41
41
|
tabRuns: 'Runs',
|
|
42
42
|
tabDeploys: 'Deploys',
|
|
43
|
+
// What is waiting on you (spec 0010): the badge, the Specs groups, the Runs groups, the answer
|
|
44
|
+
waitingOnYou: 'waiting on you',
|
|
45
|
+
toDecide: 'To decide',
|
|
46
|
+
withAgent: 'With the agent',
|
|
47
|
+
approvedGroup: 'Approved',
|
|
48
|
+
drafts: 'Drafts',
|
|
49
|
+
needsYou: 'Needs you',
|
|
50
|
+
inMotion: 'In motion',
|
|
51
|
+
finished: 'Finished',
|
|
52
|
+
answer: 'Answer',
|
|
43
53
|
newIdea: 'New idea',
|
|
44
54
|
landIt: 'Land it',
|
|
45
55
|
// Agent runs
|
package/explorer/capped.js
CHANGED
|
@@ -17,7 +17,7 @@ export function capped(items) {
|
|
|
17
17
|
if (items.length <= CAP + 1) return items.join(''); // "and 1 more" saves nothing
|
|
18
18
|
const id = `hx-more-${++counter}`;
|
|
19
19
|
const rest = items.length - CAP;
|
|
20
|
-
return `${items.slice(0, CAP).join('')}<div class="hx-more" id="${id}" hidden>${items.slice(CAP).join('')}</div><button type="button" class="hx-btn hx-btn--quiet hx-textact hx-more-btn" data-more="${id}" data-rest="${rest}" aria-expanded="false" aria-controls="${id}">and ${rest} more</button>`;
|
|
20
|
+
return `${items.slice(0, CAP).join('')}<div class="hx-more" id="${id}" hidden>${items.slice(CAP).join('')}</div><button data-corn="more" data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet hx-textact hx-more-btn" data-more="${id}" data-rest="${rest}" aria-expanded="false" aria-controls="${id}">and ${rest} more</button>`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/** Opens or folds the list a "more" button belongs to; true when the click was one */
|
package/explorer/check.js
CHANGED
|
@@ -135,6 +135,7 @@ function mountControls(bar) {
|
|
|
135
135
|
|
|
136
136
|
const line = document.createElement('p');
|
|
137
137
|
line.className = 'hx-player-check';
|
|
138
|
+
line.dataset.corn = 'scenario-check';
|
|
138
139
|
line.setAttribute('aria-live', 'polite');
|
|
139
140
|
line.hidden = true;
|
|
140
141
|
const text = bar.querySelector('.hx-player-text');
|
|
@@ -143,8 +144,8 @@ function mountControls(bar) {
|
|
|
143
144
|
const row = document.createElement('div');
|
|
144
145
|
row.className = 'hx-player-as';
|
|
145
146
|
row.innerHTML = `
|
|
146
|
-
<label class="hx-player-as-label">As <select class="hx-player-speed hx-player-as-menu" data-check="as" aria-label="Act every step as"></select></label>
|
|
147
|
-
<button type="button" class="hx-btn" data-check="recheck">Check again</button>
|
|
147
|
+
<label class="hx-player-as-label">As <select data-corn="control" class="hx-player-speed hx-player-as-menu" data-check="as" aria-label="Act every step as"></select></label>
|
|
148
|
+
<button data-corn-kind="secondary" type="button" class="hx-btn" data-check="recheck">Check again</button>
|
|
148
149
|
<span class="hx-player-as-sum hx-faint"></span>`;
|
|
149
150
|
const controls = bar.querySelector('.hx-player-controls');
|
|
150
151
|
if (controls) controls.after(row); else bar.appendChild(row);
|
package/explorer/cloud-model.js
CHANGED
|
@@ -102,7 +102,7 @@ function userRow(item, mixed) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/** The Play button (spec 0031 section 8, CLOUD-07): main.js plays outage-model.js `outageScenario` for the node. A quiet button under the facts. */
|
|
105
|
-
const playButton = (node) => `<button type="button" class="hx-btn hx-btn--quiet hx-cloud-play" data-action="play-outage" data-id="${esc(node.id)}">Play: ${esc(String(node.label || node.id))} is down</button>`;
|
|
105
|
+
const playButton = (node) => `<button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet hx-cloud-play" data-action="play-outage" data-id="${esc(node.id)}">Play: ${esc(String(node.label || node.id))} is down</button>`;
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* The node panel's facts for a cloud node (kind `cloud`) or the public web (kind `web`), in the node panel's key/value
|
package/explorer/corn-state.js
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/** Every value `data-corn-state` can take */
|
|
8
|
-
export const CORN_STATES = Object.freeze(['open', 'merged', 'closed', 'draft', 'queued', 'running', 'requested', 'claimed', 'working', 'waiting', 'done', 'failed', 'stopped', 'success', 'failure']);
|
|
8
|
+
export const CORN_STATES = Object.freeze(['open', 'merged', 'closed', 'draft', 'queued', 'running', 'requested', 'claimed', 'working', 'waiting', 'done', 'failed', 'stopped', 'success', 'failure', 'added', 'changed', 'removed', 'edit', 'sent-back']);
|
|
9
|
+
|
|
10
|
+
/** The four marks of a proposal's diff (the map's rings, the panel's pill and dots): a mark is not a status, so `changed` here is a change a proposal makes, never a mockup that changed */
|
|
11
|
+
export const MARK_STATES = Object.freeze(['added', 'changed', 'removed', 'edit']);
|
|
9
12
|
|
|
10
13
|
/** The seven states of an agent run, in the order of its life: each has its own `data-corn-state`, colour token (`--corn-run-<state>`) and icon */
|
|
11
14
|
export const RUN_STATES = Object.freeze(['requested', 'claimed', 'working', 'waiting', 'done', 'failed', 'stopped']);
|
|
@@ -23,12 +26,27 @@ const WORDS = Object.freeze({
|
|
|
23
26
|
allowed: 'success', refused: 'failure', mismatch: 'failure', pending: 'running',
|
|
24
27
|
// A notice that went well, a message about a problem
|
|
25
28
|
ok: 'success', bad: 'failure',
|
|
29
|
+
// The live layer's chip: fresh, as of a while ago, off, unavailable, loading
|
|
30
|
+
stale: 'waiting', off: 'stopped', error: 'failure', idle: 'running',
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
/** The public state for an internal word, or '' when it has none */
|
|
29
34
|
export function cornState(word) {
|
|
30
35
|
const w = String(word || '');
|
|
31
|
-
|
|
36
|
+
// The table first: `changed` is a mockup that changed since it was reviewed (waiting) here, and only a proposal's mark in markState()
|
|
37
|
+
return WORDS[w] || (CORN_STATES.includes(w) && !MARK_STATES.includes(w) ? w : '');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The public state of a proposal mark (`added`, `changed`, `removed` or `edit`), or '' for anything else, `none` included */
|
|
41
|
+
export function markState(mark) {
|
|
42
|
+
const m = String(mark || '');
|
|
43
|
+
return MARK_STATES.includes(m) ? m : '';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The `data-corn-state` attribute of a proposal mark for markup (with its leading space), or nothing when it has none */
|
|
47
|
+
export function markStateAttr(mark) {
|
|
48
|
+
const s = markState(mark);
|
|
49
|
+
return s ? ` data-corn-state="${s}"` : '';
|
|
32
50
|
}
|
|
33
51
|
|
|
34
52
|
/** The `data-corn-state` attribute for markup (with its leading space), or nothing when the word has no public state */
|
|
@@ -57,6 +75,8 @@ const ICONS = Object.freeze({
|
|
|
57
75
|
neutral: '<path d="M2.4 6h7.2"/>',
|
|
58
76
|
skipped: '<path d="M2.4 6h7.2"/>',
|
|
59
77
|
cancelled: '<circle cx="6" cy="6" r="4.2"/><path d="M3 9L9 3"/>',
|
|
78
|
+
// A spec sent back: an arrow that turns back (spec 0010)
|
|
79
|
+
'sent-back': '<path d="M4.6 2.2L2 4.8l2.6 2.6"/><path d="M2.2 4.8H7a2.8 2.8 0 0 1 0 5.6H4.6"/>',
|
|
60
80
|
});
|
|
61
81
|
|
|
62
82
|
/** The icon for a state word (a public `data-corn-state` value, or an internal word such as a check's `neutral`), as an inline SVG; '' when it has none */
|
package/explorer/explorer.css
CHANGED
|
@@ -1155,3 +1155,66 @@ a.hx-proposal-source:focus-visible { outline: var(--corn-focus-width) solid var(
|
|
|
1155
1155
|
.hx-offline { position: fixed; top: 64px; /* below the header */ left: 50%; transform: translateX(-50%); z-index: 70; max-width: min(560px, calc(100% - 32px)); margin: 0; padding: var(--corn-space-2) var(--corn-space-4); border: var(--corn-border-strong) solid var(--corn-warn); border-radius: var(--corn-radius); background: var(--corn-surface-1); color: var(--corn-text); box-shadow: var(--corn-shadow); line-height: 1.5; }
|
|
1156
1156
|
.hx-offline[hidden] { display: none; }
|
|
1157
1157
|
.hx-offline[data-corn-state="success"] { border-color: var(--corn-ok); }
|
|
1158
|
+
|
|
1159
|
+
/* ==========================================================================
|
|
1160
|
+
What is waiting on you (spec 0010): the one number's badge, the Specs groups, each row's review state, the search, the Runs headings
|
|
1161
|
+
========================================================================== */
|
|
1162
|
+
|
|
1163
|
+
/* The badge: filled, in the waiting colour the solid waiting pill already uses, so one number looks the same on the Work button and on the tabs */
|
|
1164
|
+
.hx-waiting-badge, .hx-forge-count--waiting { border-radius: var(--corn-radius-pill); background: var(--corn-run-waiting); color: var(--corn-run-waiting-ink); font-weight: 700; }
|
|
1165
|
+
.hx-waiting-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em; padding: 0 var(--corn-space-1); font-family: var(--corn-font-num); font-variant-numeric: tabular-nums; font-size: var(--corn-text-xs); line-height: 1; }
|
|
1166
|
+
.hx-waiting-badge[hidden] { display: none; }
|
|
1167
|
+
/* On a tab the badge keeps the count's own width (the tab does not move when a count becomes a badge): its fill reaches past the digits into the tab's own
|
|
1168
|
+
right padding, by a margin that gives the room back (content-box, so the padding is added to the count's 2ch and the margin takes exactly that away
|
|
1169
|
+
again), and keeps the tab's gap from its word on the left */
|
|
1170
|
+
.hx-forge-tab .hx-forge-count.hx-forge-count--waiting, .hx-forge-tab[aria-pressed="true"] .hx-forge-count.hx-forge-count--waiting { box-sizing: content-box; padding: 0 var(--corn-space-1); margin: 0 calc(var(--corn-space-1) * -2) 0 0; text-align: center; background: var(--corn-run-waiting); color: var(--corn-run-waiting-ink); }
|
|
1171
|
+
.hx-work .hx-waiting-badge { margin-right: calc(var(--corn-space-2) * -1); }
|
|
1172
|
+
|
|
1173
|
+
/* A group of the Specs list: its header says who must act and how many; Drafts past ten rows fold behind it */
|
|
1174
|
+
.hx-spec-group > .hx-forge-list { margin: 0; padding: 0; }
|
|
1175
|
+
.hx-spec-group > .hx-forge-list[hidden] { display: none; }
|
|
1176
|
+
.hx-forge-gtoggle { display: inline-flex; align-items: center; gap: var(--corn-space-2); min-height: 24px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
1177
|
+
.hx-forge-gtoggle::before { content: '\25B8'; font-size: var(--corn-text-xs); }
|
|
1178
|
+
.hx-forge-gtoggle[aria-expanded="true"]::before { content: '\25BE'; }
|
|
1179
|
+
.hx-forge-gtoggle:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
|
|
1180
|
+
/* A Runs heading is an item of the flat list, so a run's card (and a reply typed in it) is never moved into a section */
|
|
1181
|
+
.hx-run-heading { list-style: none; margin: var(--corn-space-3) 0 var(--corn-space-1); }
|
|
1182
|
+
.hx-run-heading:first-child { margin-top: 0; }
|
|
1183
|
+
/* A spec sent back is not a colour alone: a dashed edge and a turning arrow, and its words */
|
|
1184
|
+
.hx-forge-state--sent-back { color: var(--corn-run-stopped); border-style: dashed; }
|
|
1185
|
+
.hx-forge-reviewed { color: var(--corn-text-2); }
|
|
1186
|
+
.hx-forge-unread { margin: var(--corn-space-1) 0 0; color: var(--corn-bad); overflow-wrap: anywhere; }
|
|
1187
|
+
.hx-forge-specsearch { margin: 0 0 var(--corn-space-2); }
|
|
1188
|
+
.hx-forge-specsearch[hidden] { display: none; }
|
|
1189
|
+
.hx-forge-specsearch .hx-forge-field { width: 100%; }
|
|
1190
|
+
@media (max-width: 767px) {
|
|
1191
|
+
.hx-forge-gtoggle { min-height: 44px; }
|
|
1192
|
+
.hx-forge-unread .hx-btn { min-height: 44px; }
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/* The proposal bar's line when a run waits on the open proposal (spec 0010 D2): one line under the buttons, in the waiting colour's own mark (a left edge and its words), then Answer */
|
|
1196
|
+
.hx-waiting-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2) var(--corn-space-3); margin: var(--corn-space-2) 0 0; padding: var(--corn-space-1) var(--corn-space-3); border-left: calc(var(--corn-border-strong) * 2) solid var(--corn-run-waiting); border-radius: var(--corn-radius-sm); background: var(--corn-surface-2); color: var(--corn-text); line-height: 1.4; overflow-wrap: anywhere; }
|
|
1197
|
+
.hx-waiting-line[hidden] { display: none; }
|
|
1198
|
+
@media (max-width: 767px) { .hx-waiting-line .hx-btn { min-height: 44px; min-width: 44px; } }
|
|
1199
|
+
|
|
1200
|
+
/* ==========================================================================
|
|
1201
|
+
Sheets on a phone (spec 0010 D7): two at most, one expanded, a stub for the other, and the map keeps 35% of the screen
|
|
1202
|
+
========================================================================== */
|
|
1203
|
+
.hx-sheet-stub { display: none; }
|
|
1204
|
+
@media (max-width: 767px) {
|
|
1205
|
+
/* The node panel and Work take turns: the one displaced is hidden, not closed (its node stays selected) */
|
|
1206
|
+
.hx-dock > .hx-sheet[data-sheet-away] { display: none; }
|
|
1207
|
+
/* A stub: one 44px row with the sheet's title and its badge; a tap expands it, and the expanded one folds to a stub in its place */
|
|
1208
|
+
.hx-dock > .hx-sheet[data-sheet-state="stub"] { min-height: 44px; max-height: 44px; padding-top: 0; padding-bottom: 0; overflow: hidden; }
|
|
1209
|
+
.hx-dock > .hx-sheet[data-sheet-state="stub"] > :not(.hx-sheet-stub) { display: none !important; }
|
|
1210
|
+
.hx-sheet-stub { display: flex; align-items: center; gap: var(--corn-space-3); width: 100%; min-height: 44px; padding: 0 var(--corn-space-1); border: 0; background: none; color: var(--corn-text); font: inherit; font-weight: 600; text-align: left; }
|
|
1211
|
+
.hx-sheet-stub[hidden] { display: none; }
|
|
1212
|
+
.hx-sheet-stub:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-width) * -1); border-radius: var(--corn-radius); }
|
|
1213
|
+
.hx-sheet-stub-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1214
|
+
}
|
|
1215
|
+
/* An expanded sheet is capped so the map keeps 35% of the screen: sheets.js writes `--hx-sheet-cap` (the screen less the map's share, less a stub). Not in a short
|
|
1216
|
+
window (400% zoom), where an open sheet may take the window. */
|
|
1217
|
+
@media (max-width: 767px) and (min-height: 481px) {
|
|
1218
|
+
.hx-dock > .hx-proposal-bar[data-sheet-state="expanded"], .hx-dock > .hx-player[data-sheet-state="expanded"] { max-height: min(var(--hx-sheet-cap, 50dvh), 50dvh); }
|
|
1219
|
+
.hx-dock > .hx-drawer[data-sheet-state="expanded"], .hx-dock > .hx-forge[data-sheet-state="expanded"] { max-height: min(var(--hx-sheet-cap, 60dvh), 60dvh); }
|
|
1220
|
+
}
|
package/explorer/flows.js
CHANGED
|
@@ -137,13 +137,13 @@ export function renderFlowLegend() {
|
|
|
137
137
|
el.hidden = false;
|
|
138
138
|
const row = (swatch, text) => `<div class="hx-legend-row"><span class="hx-legend-swatch">${swatch}</span><span>${text}</span></div>`;
|
|
139
139
|
el.innerHTML = `
|
|
140
|
-
<div class="hx-menu-section">
|
|
141
|
-
<div class="hx-menu-title">
|
|
140
|
+
<div class="hx-menu-section" data-corn="menu-section">
|
|
141
|
+
<div class="hx-menu-title" data-corn="menu-title">
|
|
142
142
|
<span>Data Flow</span>
|
|
143
143
|
</div>
|
|
144
|
-
${Object.values(FLOW_STYLES).map((s) => row(`<span class="hx-swatch-line" style="background:${themed(s.color, state.theme)}"></span>`, s.label)).join('')}
|
|
145
|
-
${row('<span class="hx-swatch-line hx-swatch-solid"></span>', '<span class="hx-faint">Solid: live today</span>')}
|
|
146
|
-
${row('<span class="hx-swatch-line hx-swatch-dashed"></span>', '<span class="hx-faint">Dashed: proposed</span>')}
|
|
144
|
+
${Object.values(FLOW_STYLES).map((s) => row(`<span data-corn="swatch" class="hx-swatch-line" style="background:${themed(s.color, state.theme)}"></span>`, s.label)).join('')}
|
|
145
|
+
${row('<span data-corn="swatch" class="hx-swatch-line hx-swatch-solid"></span>', '<span class="hx-faint">Solid: live today</span>')}
|
|
146
|
+
${row('<span data-corn="swatch" class="hx-swatch-line hx-swatch-dashed"></span>', '<span class="hx-faint">Dashed: proposed</span>')}
|
|
147
147
|
</div>`;
|
|
148
148
|
}
|
|
149
149
|
|