@popcorn245/cornfield 0.27.0 → 0.29.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/config.js +5 -0
- package/core/strings.js +118 -0
- package/explorer/explorer.css +64 -17
- package/explorer/forge-panel.js +11 -10
- package/explorer/index.html +53 -37
- package/explorer/main.js +1 -1
- package/explorer/panels.js +3 -2
- package/explorer/plugins.js +6 -2
- package/explorer/proposal-model.js +13 -0
- package/explorer/proposal.js +68 -7
- package/explorer/review.js +69 -17
- package/explorer/runs-view.js +6 -5
- package/explorer/scenario-ui.js +26 -7
- package/explorer/sheets.js +1 -1
- package/explorer/strings.js +68 -0
- package/explorer/view.js +2 -1
- package/explorer/whatif.js +20 -3
- package/package.json +1 -1
- package/server/server.js +4 -1
package/core/config.js
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* links: [], // [{ label, href }] shown in the explorer's header
|
|
29
29
|
* theme: {}, // { css, fonts, fontHosts, names, default, icons, pixelated, contrast }: a repo's own look, CSS only (docs/config.md#theme)
|
|
30
30
|
* brand: {}, // { logo, wordmark, favicon, appName, color, background }: a repo's own logo and name, images from the repo (docs/config.md#brand)
|
|
31
|
+
* strings: {}, // { approve: 'Ship it', … }: a repo's own words for the visible labels, plain text (core/strings.js, docs/theming.md#words)
|
|
31
32
|
* proxy: {}, // { '/api/': 'http://127.0.0.1:3245' }: same-origin paths for a live source
|
|
32
33
|
* importMap: {}, // bare imports a repo-local browser module needs: { name: '/repo/path.js' }
|
|
33
34
|
* dataDir: null, // where cornfield keeps its own state (reviews; the SQLite file in v1)
|
|
@@ -44,6 +45,7 @@ import path from 'node:path';
|
|
|
44
45
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
45
46
|
import { themeProblems } from './theme.js';
|
|
46
47
|
import { brandProblems } from './brand.js';
|
|
48
|
+
import { stringsProblems } from './strings.js';
|
|
47
49
|
import { PROFILE_SOURCE, MAX_NUMBER, MAX_BRIEF_CHARS, RUN_KINDS, TRIGGER_EVENTS, CREDENTIAL_VALUE_SOURCE } from './agent-contract.js';
|
|
48
50
|
|
|
49
51
|
export { TRIGGER_EVENTS };
|
|
@@ -170,6 +172,7 @@ export const DEFAULTS = Object.freeze({
|
|
|
170
172
|
links: [],
|
|
171
173
|
theme: { css: null, fonts: [], fontHosts: [], names: {}, default: null, icons: {}, pixelated: false, contrast: 'error' },
|
|
172
174
|
brand: { logo: null, wordmark: null, favicon: null, appName: null, color: null, background: null },
|
|
175
|
+
strings: {},
|
|
173
176
|
proxy: {},
|
|
174
177
|
importMap: {},
|
|
175
178
|
dataDir: null,
|
|
@@ -344,6 +347,7 @@ export function configProblems(c) {
|
|
|
344
347
|
}
|
|
345
348
|
out.push(...themeProblems(c.theme));
|
|
346
349
|
out.push(...brandProblems(c.brand));
|
|
350
|
+
out.push(...stringsProblems(c.strings));
|
|
347
351
|
if (c.proxy !== undefined) {
|
|
348
352
|
if (!isObject(c.proxy)) out.push('"proxy" is { "/path/": "http://upstream" }.');
|
|
349
353
|
else for (const [p, t] of Object.entries(c.proxy)) {
|
|
@@ -532,6 +536,7 @@ export async function loadConfig(root, { env = process.env, file } = {}) {
|
|
|
532
536
|
};
|
|
533
537
|
config.theme = { ...structuredClone(DEFAULTS.theme), ...(raw.theme || {}) };
|
|
534
538
|
config.brand = { ...DEFAULTS.brand, ...(raw.brand || {}) };
|
|
539
|
+
config.strings = { ...(raw.strings || {}) };
|
|
535
540
|
// `threads: false` stays false; an object is read over the default
|
|
536
541
|
config.threads = raw.threads === false ? false : { ...DEFAULTS.threads, ...(raw.threads || {}) };
|
|
537
542
|
// `hookPoll: false` is `{ specs: false }`; an object is read over the default
|
package/core/strings.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/strings
|
|
3
|
+
*
|
|
4
|
+
* The words a repo may say in its own voice (`strings` in cornfield.config.js, docs/theming.md "Words"). ONE table, `STRINGS`,
|
|
5
|
+
* holds every overridable label and its default. The config check (core/config.js, so `cornfield validate`), the browser
|
|
6
|
+
* (explorer/strings.js; this file is served to it, server/server.js BROWSER_CORE) and the docs table (`stringsTable`, kept in step by
|
|
7
|
+
* a test) all read it, so the three cannot drift.
|
|
8
|
+
*
|
|
9
|
+
* A value is plain text: it reaches the page through textContent and attributes only, never as HTML, so `<b>` is shown as the
|
|
10
|
+
* characters it is. One line, at most MAX_STRING_LENGTH characters. A missing key means the default; an unknown key is refused.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Overridable label by key: the default words. Keys are camelCase; add one here and the docs test says what else to update. */
|
|
14
|
+
export const STRINGS = Object.freeze({
|
|
15
|
+
// The header
|
|
16
|
+
layers: 'Layers',
|
|
17
|
+
dataFlow: 'Data flow',
|
|
18
|
+
house: 'House',
|
|
19
|
+
proposals: 'Proposals',
|
|
20
|
+
issuesAndPrs: 'Issues & PRs',
|
|
21
|
+
searchPlaceholder: 'Search...',
|
|
22
|
+
signOut: 'Sign out',
|
|
23
|
+
poweredBy: 'powered by cornfield',
|
|
24
|
+
// The proposal bar and the review
|
|
25
|
+
before: 'Before',
|
|
26
|
+
diff: 'Diff',
|
|
27
|
+
after: 'After',
|
|
28
|
+
closeProposal: 'Close',
|
|
29
|
+
approve: 'Approve',
|
|
30
|
+
sendBack: 'Send back',
|
|
31
|
+
sendBackWithNote: 'Send back with this note',
|
|
32
|
+
reviewNoteLabel: 'Note for the drafting agent',
|
|
33
|
+
reviewNotePlaceholder: 'What should change?',
|
|
34
|
+
// The issues and pull requests panel
|
|
35
|
+
tabPulls: 'Pull requests',
|
|
36
|
+
tabIssues: 'Issues',
|
|
37
|
+
tabThreads: 'Threads',
|
|
38
|
+
tabDeploys: 'Deploys',
|
|
39
|
+
tabAgents: 'Agents',
|
|
40
|
+
tabNotes: 'Release notes',
|
|
41
|
+
newIdea: 'New idea',
|
|
42
|
+
landIt: 'Land it',
|
|
43
|
+
// Agent runs
|
|
44
|
+
startAgent: 'Start an agent',
|
|
45
|
+
askRunner: 'Ask the runner',
|
|
46
|
+
startAgain: 'Start again',
|
|
47
|
+
stop: 'Stop',
|
|
48
|
+
continueRun: 'Continue',
|
|
49
|
+
reply: 'Reply',
|
|
50
|
+
// The node panel
|
|
51
|
+
propsTitle: 'Properties & Attributes',
|
|
52
|
+
detailsTitle: 'Details',
|
|
53
|
+
openRoute: 'Open Live Route',
|
|
54
|
+
copySpec: 'Copy Spec',
|
|
55
|
+
// The hint, loading and errors
|
|
56
|
+
hintInspect: 'Tap node to inspect live spec',
|
|
57
|
+
hintDrag: 'Drag nodes to move • Double-tap to inspect',
|
|
58
|
+
hintDataFlow: 'Data flow: browser → servers → API → tables → services → outside',
|
|
59
|
+
loading: 'Loading topology.json …',
|
|
60
|
+
errorTitle: 'The map could not be loaded',
|
|
61
|
+
retry: 'Retry',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/** The longest a value may be, in characters */
|
|
65
|
+
export const MAX_STRING_LENGTH = 80;
|
|
66
|
+
|
|
67
|
+
const isObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
68
|
+
/** Whether `key` is one of the table's (an own key: `__proto__` and `toString` are not) */
|
|
69
|
+
export const isStringKey = (key) => typeof key === 'string' && Object.hasOwn(STRINGS, key);
|
|
70
|
+
/** A line break or any other control character */
|
|
71
|
+
const CONTROL = new RegExp('[\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029]');
|
|
72
|
+
/**
|
|
73
|
+
* What is wrong with one value, or null.
|
|
74
|
+
* @param {unknown} v
|
|
75
|
+
* @returns {string|null}
|
|
76
|
+
*/
|
|
77
|
+
export function stringProblem(v) {
|
|
78
|
+
if (typeof v !== 'string') return 'is text';
|
|
79
|
+
if (!v.trim()) return 'is empty (leave the key out to keep the default)';
|
|
80
|
+
if (CONTROL.test(v)) return 'is one line of plain text (no line break or control character)';
|
|
81
|
+
if ([...v].length > MAX_STRING_LENGTH) return `is at most ${MAX_STRING_LENGTH} characters`;
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* What is wrong with a `strings` value (as the config file wrote it). HTML is not a problem: it is shown as text.
|
|
87
|
+
* @param {unknown} s
|
|
88
|
+
* @returns {string[]}
|
|
89
|
+
*/
|
|
90
|
+
export function stringsProblems(s) {
|
|
91
|
+
if (s === undefined) return [];
|
|
92
|
+
if (!isObject(s)) return ['"strings" is an object of labels: { approve: \'Ship it\' }.'];
|
|
93
|
+
const out = [];
|
|
94
|
+
for (const [key, value] of Object.entries(s)) {
|
|
95
|
+
if (!isStringKey(key)) { out.push(`strings: unknown key "${key}". Known: ${Object.keys(STRINGS).join(', ')}.`); continue; }
|
|
96
|
+
const problem = stringProblem(value);
|
|
97
|
+
if (problem) out.push(`strings.${key} ${problem}.`);
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The overrides the browser is sent: known keys with a good value, nothing else (the defaults live in the browser already).
|
|
104
|
+
* @param {unknown} s
|
|
105
|
+
* @returns {Record<string, string>}
|
|
106
|
+
*/
|
|
107
|
+
export function clientStrings(s) {
|
|
108
|
+
const out = {};
|
|
109
|
+
if (!isObject(s)) return out;
|
|
110
|
+
for (const [key, value] of Object.entries(s)) if (isStringKey(key) && !stringProblem(value)) out[key] = value;
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The docs' key table (docs/theming.md "Words"), generated from STRINGS; a test fails when the docs hold anything else */
|
|
115
|
+
export function stringsTable() {
|
|
116
|
+
const cell = (v) => v.replace(/\|/g, '\\|');
|
|
117
|
+
return ['| Key | Default |', '|---|---|', ...Object.entries(STRINGS).map(([k, v]) => `| \`${k}\` | ${cell(v)} |`)].join('\n');
|
|
118
|
+
}
|
package/explorer/explorer.css
CHANGED
|
@@ -335,20 +335,16 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
335
335
|
.hx-proposal-meta { display: flex; flex-wrap: wrap; gap: calc(var(--corn-space-1) / 2) var(--corn-space-3); color: var(--corn-text-3); font-size: var(--corn-text-2xs); }
|
|
336
336
|
.hx-proposal-where { color: var(--corn-added-text); }
|
|
337
337
|
|
|
338
|
-
.hx-proposal-bar { position: absolute; top: 48px; left: 12px; width: min(
|
|
338
|
+
.hx-proposal-bar { position: absolute; top: 48px; left: 12px; width: min(960px, calc(100% - 24px)); padding: var(--corn-space-3) var(--corn-space-3); border-radius: var(--corn-radius-lg); font-size: var(--corn-text-sm); z-index: 15; user-select: text; }
|
|
339
339
|
.hx-proposal-bar.is-error { border-color: color-mix(in srgb, var(--corn-removed) 50%, transparent); }
|
|
340
340
|
.hx-proposal-message { color: var(--corn-text-2); }
|
|
341
341
|
.hx-proposal-bar.is-error .hx-proposal-message { color: var(--corn-bad); }
|
|
342
|
-
.hx-proposal-
|
|
343
|
-
.hx-proposal-name { flex: 1 1 140px; min-width: 0; font-size: var(--corn-text-md); color: var(--corn-text); overflow-wrap: anywhere; }
|
|
344
|
-
.hx-proposal-chip { padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-lg); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 55%, transparent); color: var(--corn-text-2); font-size: var(--corn-text-xs); font-variant-numeric: tabular-nums; }
|
|
345
|
-
.hx-proposal-chip:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
346
|
-
.hx-proposal-chip:focus-visible, .hx-seg-btn:focus-visible, .hx-change-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
|
|
342
|
+
.hx-proposal-chip:focus-visible, .hx-proposal-mode:focus-visible, .hx-seg-btn:focus-visible, .hx-change-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
|
|
347
343
|
.hx-proposal-summary { margin-top: var(--corn-space-2); color: var(--corn-text-2); line-height: 1.45; }
|
|
348
344
|
|
|
349
345
|
/* Before / Diff / After */
|
|
350
346
|
.hx-seg { display: inline-flex; padding: calc(var(--corn-space-1) / 2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 55%, transparent); }
|
|
351
|
-
.hx-seg-btn { padding:
|
|
347
|
+
.hx-seg-btn { height: 26px; padding: 0 var(--corn-space-4); border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-3); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
352
348
|
.hx-seg-btn:hover { color: var(--corn-text); }
|
|
353
349
|
.hx-seg-btn.is-on, .hx-seg-btn[aria-pressed="true"] { background: var(--corn-accent); color: var(--corn-text-on-accent); box-shadow: var(--corn-shadow-sm); }
|
|
354
350
|
|
|
@@ -385,11 +381,10 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
385
381
|
.hx-change em { color: var(--corn-text-3); text-decoration: none; }
|
|
386
382
|
|
|
387
383
|
/* The node panel is a 480px slide-over from 768px: the bar makes room for it */
|
|
388
|
-
@media (min-width: 768px) { .hx-stage:has(.drawer-open) .hx-proposal-bar { width: min(
|
|
384
|
+
@media (min-width: 768px) { .hx-stage:has(.drawer-open) .hx-proposal-bar { width: min(960px, calc(100% - 504px)); } }
|
|
389
385
|
|
|
390
386
|
@media (max-width: 639px) {
|
|
391
387
|
.hx-menu--proposals { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; max-width: none; }
|
|
392
|
-
.hx-seg-btn { padding: var(--corn-space-1) var(--corn-space-4); }
|
|
393
388
|
}
|
|
394
389
|
|
|
395
390
|
/* ---- scenario player (scenario-ui.js): the bar while a scenario plays, and the scenario list --------- */
|
|
@@ -410,7 +405,6 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
410
405
|
.hx-player-fill { display: block; height: 100%; width: 0; background: var(--corn-accent-text); }
|
|
411
406
|
|
|
412
407
|
.hx-scenarios { position: absolute; top: 12px; left: 12px; max-width: min(320px, calc(100% - 24px)); padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius); font-size: var(--corn-text-sm); color: var(--corn-text-2); z-index: 12; }
|
|
413
|
-
.hx-scenarios summary { cursor: pointer; font-weight: 600; }
|
|
414
408
|
.hx-scenarios-item { display: block; width: 100%; margin-top: var(--corn-space-2); padding: var(--corn-space-2) var(--corn-space-3); border: var(--corn-border) solid var(--corn-line-soft); border-radius: var(--corn-radius-sm); background: transparent; color: var(--corn-text); font-size: var(--corn-text-sm); text-align: left; cursor: pointer; }
|
|
415
409
|
.hx-scenarios-item:hover { background: color-mix(in srgb, var(--corn-accent-hover) 25%, transparent); }
|
|
416
410
|
/* With a proposal open the list is a row of its bar (scenario-ui.js mounts it there), so it opens in the bar's flow and the bar grows to hold it */
|
|
@@ -455,21 +449,75 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
455
449
|
.hx-rubber svg { display: block; overflow: visible; }
|
|
456
450
|
.hx-rubber-line { stroke: var(--corn-edit); stroke-width: 3; stroke-dasharray: 8 6; stroke-linecap: round; }
|
|
457
451
|
.hx-rubber-from, .hx-rubber-to { fill: color-mix(in srgb, var(--corn-edit) 15%, transparent); stroke: var(--corn-edit); stroke-width: 2; }
|
|
458
|
-
/*
|
|
459
|
-
|
|
460
|
-
.hx-review
|
|
452
|
+
/* The review (review.js, TOPO-12): the status line and the note that opens on Send back. It is in the toolbar, just before Send back and
|
|
453
|
+
Approve (the note's Tab goes on to them); from 768px it takes a row of its own under the toolbar, on a phone it sits under the counts */
|
|
454
|
+
.hx-review { flex: 1 0 100%; order: 1; display: flex; flex-direction: column; gap: var(--corn-space-2); }
|
|
455
|
+
.hx-review[hidden], .hx-review:not(:has(> :not([hidden]))) { display: none; }
|
|
456
|
+
.hx-review-form { display: flex; flex-direction: column; gap: var(--corn-space-2); }
|
|
457
|
+
.hx-review-form[hidden] { display: none; }
|
|
461
458
|
.hx-review-label { color: var(--corn-text-3); font-size: var(--corn-text-xs); }
|
|
462
459
|
.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; }
|
|
463
460
|
.hx-review-note:focus { outline: var(--corn-focus-width) solid var(--corn-added-text); outline-offset: 1px; }
|
|
464
461
|
.hx-review-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2) var(--corn-space-3); }
|
|
465
|
-
.hx-review .hx-btn:disabled { opacity: 0.4; cursor: default; }
|
|
466
462
|
.hx-btn--approve { border-color: color-mix(in srgb, var(--corn-added) 50%, transparent); color: var(--corn-added-text); }
|
|
467
463
|
.hx-btn--approve:hover { background: color-mix(in srgb, var(--corn-added) 20%, transparent); color: var(--corn-added-text); }
|
|
468
|
-
.hx-review-status { color: var(--corn-added-text); font-variant-numeric: tabular-nums; }
|
|
464
|
+
.hx-review-status { margin: 0; color: var(--corn-added-text); font-variant-numeric: tabular-nums; }
|
|
469
465
|
.hx-review-status[hidden], .hx-review-msg[hidden], .hx-review-line[hidden] { display: none; }
|
|
470
466
|
.hx-review-msg { margin: 0; padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-sm); background: color-mix(in srgb, var(--corn-removed) 12%, transparent); border: var(--corn-border) solid color-mix(in srgb, var(--corn-removed) 35%, transparent); color: var(--corn-bad); line-height: 1.4; }
|
|
471
467
|
.hx-review-line { margin: 0; color: var(--corn-text-2); line-height: 1.4; }
|
|
472
468
|
.hx-proposal-reviewed { color: var(--corn-added-text); }
|
|
469
|
+
/* ---- The proposal toolbar (CF-43): proposal.js, review.js, whatif.js, scenario-ui.js ----------------
|
|
470
|
+
One row from 768px: title, counts (they open the change list), Before / Diff / After, Play, Edit, then Send back,
|
|
471
|
+
Approve (the primary) and a ⋯ menu with Close. The what-if controls sit behind Edit, the scenario list behind Play,
|
|
472
|
+
and the review note opens under the row on Send back. On a phone the row is a sheet: the title, the counts with
|
|
473
|
+
the current mode (a button that opens the switcher), the note when it is open, and Send back and Approve full
|
|
474
|
+
width, each 44px tall. */
|
|
475
|
+
.hx-proposal-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-3) var(--corn-space-4); }
|
|
476
|
+
.hx-proposal-name { flex: 0 1 auto; min-width: 0; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--corn-text-base); font-weight: 650; color: var(--corn-text); }
|
|
477
|
+
.hx-proposal-counts { display: contents; }
|
|
478
|
+
.hx-proposal-chip { display: inline-flex; align-items: center; padding: var(--corn-space-1) var(--corn-space-2); border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
479
|
+
.hx-proposal-chip:hover { color: var(--corn-text); text-decoration: underline; }
|
|
480
|
+
.hx-proposal-chip .hx-mark-dot { margin: 0 var(--corn-space-2) 0 0; }
|
|
481
|
+
.hx-proposal-sep { margin: 0 var(--corn-space-2); color: var(--corn-text-3); }
|
|
482
|
+
.hx-proposal-mode { display: none; }
|
|
483
|
+
.hx-proposal-tools, .hx-proposal-actions { display: flex; align-items: center; gap: var(--corn-space-3); }
|
|
484
|
+
.hx-proposal-tools .hx-btn { height: 30px; font-size: var(--corn-text-sm); font-weight: 500; }
|
|
485
|
+
#proposal-play[aria-expanded="true"] { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
486
|
+
#proposal-edit.hx-btn--active { background: var(--corn-edit-text); border-color: var(--corn-edit); color: var(--corn-ground); }
|
|
487
|
+
.hx-proposal-actions { margin-left: auto; }
|
|
488
|
+
.hx-proposal-actions .hx-btn { height: 32px; justify-content: center; padding: 0 var(--corn-space-5); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
489
|
+
.hx-proposal-actions .hx-btn--approve, .hx-proposal-actions .hx-btn--approve:hover { background: var(--corn-accent); border-color: var(--corn-accent); color: var(--corn-text-on-accent); font-weight: 600; }
|
|
490
|
+
.hx-proposal-actions .hx-btn:disabled { opacity: 0.4; cursor: default; }
|
|
491
|
+
.hx-proposal-more { position: relative; }
|
|
492
|
+
.hx-proposal-more .hx-btn--icon { width: 32px; height: 32px; border-color: transparent; background: none; color: var(--corn-text-3); }
|
|
493
|
+
.hx-proposal-more .hx-btn--icon:hover, .hx-proposal-more .hx-btn--icon[aria-expanded="true"] { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
494
|
+
.hx-proposal-more-menu { position: absolute; top: 100%; right: 0; z-index: 20; display: flex; flex-direction: column; min-width: 160px; margin-top: var(--corn-space-2); padding: var(--corn-space-2); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); box-shadow: var(--corn-shadow); }
|
|
495
|
+
.hx-proposal-more-menu[hidden] { display: none; }
|
|
496
|
+
.hx-proposal-more-menu .hx-btn { width: 100%; height: 32px; border-color: transparent; background: none; color: var(--corn-text-2); font-size: var(--corn-text-sm); }
|
|
497
|
+
.hx-proposal-more-menu .hx-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
498
|
+
|
|
499
|
+
@media (max-width: 767px) {
|
|
500
|
+
.hx-proposal-head { display: grid; grid-template-columns: 1fr auto; gap: var(--corn-space-2) var(--corn-space-3); }
|
|
501
|
+
.hx-proposal-name { grid-column: 1 / -1; order: 1; max-width: none; }
|
|
502
|
+
.hx-proposal-counts { display: flex; grid-column: 1 / -1; order: 2; align-items: center; flex-wrap: wrap; column-gap: var(--corn-space-2); }
|
|
503
|
+
.hx-proposal-chip, .hx-proposal-mode { min-height: 44px; }
|
|
504
|
+
.hx-proposal-mode { display: inline-flex; align-items: center; gap: var(--corn-space-2); padding: 0 var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-sm); background: var(--corn-surface-2); color: var(--corn-text); font-size: var(--corn-text-sm); font-weight: 600; }
|
|
505
|
+
.hx-proposal-mode::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 var(--corn-border-strong) var(--corn-border-strong) 0; transform: translateY(-2px) rotate(45deg); }
|
|
506
|
+
.hx-proposal-mode[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
|
|
507
|
+
.hx-seg, .hx-review { grid-column: 1 / -1; order: 3; }
|
|
508
|
+
.hx-proposal-bar:not([data-mode-open="true"]) .hx-seg { display: none; }
|
|
509
|
+
.hx-seg-btn { flex: 1; height: 44px; font-size: var(--corn-text-md); }
|
|
510
|
+
.hx-proposal-actions { grid-column: 1 / -1; order: 4; display: grid; grid-template-columns: 1fr 1fr; margin-left: 0; gap: var(--corn-space-3); }
|
|
511
|
+
.hx-proposal-actions .hx-btn { height: auto; min-height: 44px; padding: var(--corn-space-2) var(--corn-space-3); white-space: normal; text-align: center; font-size: var(--corn-text-md); }
|
|
512
|
+
.hx-proposal-tools { order: 5; }
|
|
513
|
+
.hx-proposal-tools .hx-btn { height: auto; min-height: 44px; padding: 0 var(--corn-space-5); font-size: var(--corn-text-md); }
|
|
514
|
+
.hx-proposal-more { display: contents; }
|
|
515
|
+
.hx-proposal-more .hx-btn--icon { order: 6; width: 44px; height: 44px; }
|
|
516
|
+
.hx-proposal-more-menu { position: static; grid-column: 1 / -1; order: 7; box-shadow: none; }
|
|
517
|
+
.hx-proposal-more-menu .hx-btn { height: auto; min-height: 44px; font-size: var(--corn-text-md); }
|
|
518
|
+
.hx-scenarios-item, .hx-review .hx-btn, .hx-whatif .hx-btn { min-height: 44px; }
|
|
519
|
+
}
|
|
520
|
+
|
|
473
521
|
/* A proposal's mockups (mockups.js): the buttons in a node's panel and the window one opens in. A mockup is untrusted content, shown in an <img> or a sandboxed <iframe>. */
|
|
474
522
|
.hx-mockup-list { list-style: none; margin: var(--corn-space-1) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--corn-space-2); }
|
|
475
523
|
.hx-mockup-item { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-1) var(--corn-space-3); }
|
|
@@ -516,8 +564,7 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
516
564
|
.hx-proposal-bar { max-height: 50dvh; overflow-y: auto; padding: 0 var(--corn-space-4) var(--corn-space-3); }
|
|
517
565
|
.hx-proposal-bar[data-sheet-state="peek"] > :not(.hx-sheet-handle):not(#proposal-message):not(#proposal-body),
|
|
518
566
|
.hx-proposal-bar[data-sheet-state="peek"] #proposal-body > :not(.hx-proposal-head),
|
|
519
|
-
.hx-proposal-bar[data-sheet-state="peek"] .hx-proposal-head > :
|
|
520
|
-
.hx-proposal-bar[data-sheet-state="peek"] .hx-proposal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
567
|
+
.hx-proposal-bar[data-sheet-state="peek"] .hx-proposal-head > :is(.hx-proposal-tools, .hx-proposal-more, .hx-proposal-more-menu, .hx-review) { display: none; }
|
|
521
568
|
.hx-proposal-bar[data-sheet-state="expanded"] .hx-scenarios, .hx-proposal-bar[data-sheet-state="expanded"] .hx-proposal-changes, .hx-proposal-bar[data-sheet-state="expanded"] .hx-whatif-panel { max-height: none; overflow: visible; }
|
|
522
569
|
|
|
523
570
|
/* The scenario player: the title, then the step counter and its text on two lines */
|
package/explorer/forge-panel.js
CHANGED
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
threadsUrl, threadUrl, issueUrl, IDEAS_URL, threadKindWords, threadMeta, litForThread, mentionsIndex, ideaRequest, ideaWords,
|
|
83
83
|
} from './forge-panel-model.js';
|
|
84
84
|
import { cornStateAttr } from './corn-state.js';
|
|
85
|
+
import { t } from './strings.js';
|
|
85
86
|
|
|
86
87
|
const $ = (id) => document.getElementById(id);
|
|
87
88
|
const FORGE_NAMES = { github: 'GitHub', forgejo: 'Forgejo' };
|
|
@@ -883,7 +884,7 @@ function itemHtml(item, before = '', after = '') {
|
|
|
883
884
|
? `<button type="button" class="hx-btn hx-forge-act hx-forge-startspec" data-forge-spec="${item.number}" aria-label="Start a spec for issue ${item.number}"${ui.busy ? ' disabled' : ''}>Start a spec …</button>`
|
|
884
885
|
: '';
|
|
885
886
|
const agent = item.state === 'open'
|
|
886
|
-
? `<button type="button" class="hx-btn hx-forge-act hx-forge-startspec" data-forge-agent="issue:${item.number}" aria-label="
|
|
887
|
+
? `<button type="button" class="hx-btn hx-forge-act hx-forge-startspec" data-forge-agent="issue:${item.number}" aria-label="${escHtml(t('startAgent'))} on issue ${item.number}">${escHtml(t('startAgent'))} …</button>`
|
|
887
888
|
: '';
|
|
888
889
|
return link
|
|
889
890
|
? `<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>`
|
|
@@ -906,7 +907,7 @@ function groupsHtml(groups) {
|
|
|
906
907
|
return groups.map((g, i) => {
|
|
907
908
|
const link = g.issue && safeUrl(g.issue.url) ? ` <a class="hx-link hx-forge-gout" href="${escHtml(g.issue.url)}" target="_blank" rel="noreferrer" aria-label="Open issue ${g.number} on ${escHtml(forgeName())} (new tab)">↗</a>` : '';
|
|
908
909
|
const startRef = g.kind === 'issue' && g.issue && g.issue.state === 'open' ? `issue:${g.number}` : g.kind === 'proposal' ? `proposal:${g.slug}` : null;
|
|
909
|
-
const start = startRef ? ` <button type="button" class="hx-btn hx-forge-act" data-forge-agent="${escHtml(startRef)}" aria-label="
|
|
910
|
+
const start = startRef ? ` <button type="button" class="hx-btn hx-forge-act" data-forge-agent="${escHtml(startRef)}" aria-label="${escHtml(t('startAgent'))} on ${escHtml(g.kind === 'issue' ? `issue ${g.number}` : `proposal ${g.slug}`)}">${escHtml(t('startAgent'))} …</button>` : '';
|
|
910
911
|
return `<li class="hx-forge-group"><h3 class="hx-forge-gtitle" id="forge-group-${i}">${escHtml(g.title)}${link}</h3>${start}<p class="hx-forge-meta">${escHtml(groupWords(g))}</p><ul class="hx-forge-list" aria-labelledby="forge-group-${i}">${g.entries.map(workHtml).join('')}</ul></li>`;
|
|
911
912
|
}).join('');
|
|
912
913
|
}
|
|
@@ -1012,7 +1013,7 @@ function detailHtml() {
|
|
|
1012
1013
|
const block = mergeBlock(ui.detail);
|
|
1013
1014
|
const act = block
|
|
1014
1015
|
? `<p class="hx-forge-why hx-faint">${pull.state === 'merged' ? '' : 'Cannot be landed from here. '}${escHtml(block)}</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"
|
|
1016
|
+
: `<button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-forge-merge="${pull.number}"${ui.busy ? ' disabled' : ''} data-corn-kind="approve">${escHtml(t('landIt'))} …</button><p class="hx-forge-why hx-faint">Opens a confirm step that shows what will land. Never forced, never deployed.</p>`;
|
|
1016
1017
|
// A spec approved with `proposals.approveLands` waits for its checks: said here, with a way to stop it
|
|
1017
1018
|
const waiting = ui.landing && pull.state === 'open'
|
|
1018
1019
|
? `<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>`
|
|
@@ -1034,7 +1035,7 @@ function detailHtml() {
|
|
|
1034
1035
|
<h4 class="hx-forge-sub">Checks: ${escHtml(checksWords(checks))}</h4>
|
|
1035
1036
|
${checks.length ? `<ul class="hx-forge-checks">${checkRows}</ul>` : ''}
|
|
1036
1037
|
${build}
|
|
1037
|
-
<h4 class="hx-forge-subact"
|
|
1038
|
+
<h4 class="hx-forge-subact">${escHtml(t('landIt'))}</h4>
|
|
1038
1039
|
${note}
|
|
1039
1040
|
${waiting}
|
|
1040
1041
|
${act}
|
|
@@ -1322,7 +1323,7 @@ function showConfirm(what, goLabel, state) {
|
|
|
1322
1323
|
/** Opens the confirm step for landing the selected pull request: what will land, exactly */
|
|
1323
1324
|
function openConfirm(opener) {
|
|
1324
1325
|
if (!confirmEl() || ui.confirm || ui.busy || !ui.detail || mergeBlock(ui.detail)) return;
|
|
1325
|
-
showConfirm(confirmMerge(ui.detail, forgeName(), ui.config && ui.config.forge && ui.config.forge.mergeMethod), '
|
|
1326
|
+
showConfirm(confirmMerge(ui.detail, forgeName(), ui.config && ui.config.forge && ui.config.forge.mergeMethod), t('landIt'), { opener, kind: 'merge' });
|
|
1326
1327
|
}
|
|
1327
1328
|
|
|
1328
1329
|
/** What a pipeline step came to, on the panel (with a link to what it made) and through the live region */
|
|
@@ -1483,7 +1484,7 @@ async function openAgent(ref, opener, again = null, brief = null) {
|
|
|
1483
1484
|
$('agent-profile').innerHTML = option('', 'No profile', !(again && again.profile)) + shown.map((p) => option(p, p, !!again && p === again.profile)).join('');
|
|
1484
1485
|
$('agent-profile-field').hidden = !shown.length;
|
|
1485
1486
|
$('agent-profile').value = again && again.profile ? again.profile : ''; // as well as `selected`, which not every DOM honours
|
|
1486
|
-
$('agent-start-title').textContent = again ? '
|
|
1487
|
+
$('agent-start-title').textContent = again ? t('startAgain') : t('startAgent');
|
|
1487
1488
|
const note = $('agent-retry-note');
|
|
1488
1489
|
note.hidden = !again;
|
|
1489
1490
|
note.textContent = again ? retryWords(again) : '';
|
|
@@ -1497,11 +1498,11 @@ async function openAgent(ref, opener, again = null, brief = null) {
|
|
|
1497
1498
|
const go = $('agent-start-go');
|
|
1498
1499
|
go.disabled = false;
|
|
1499
1500
|
go.removeAttribute('aria-busy');
|
|
1500
|
-
go.textContent = '
|
|
1501
|
+
go.textContent = t('askRunner');
|
|
1501
1502
|
document.addEventListener('focusin', keepFocusInAgent);
|
|
1502
1503
|
agentEl().hidden = false;
|
|
1503
1504
|
$('agent-kind').focus();
|
|
1504
|
-
announce(`${again ? '
|
|
1505
|
+
announce(`${again ? t('startAgain') : t('startAgent')} on ${aboutWords(refs)}. ${confirmStartWords(refs, forgeName())}`);
|
|
1505
1506
|
}
|
|
1506
1507
|
|
|
1507
1508
|
/** "Start again" on a run that failed or was stopped. A brief the list shows cut is read whole first: the dialog never starts from part of one */
|
|
@@ -1587,7 +1588,7 @@ async function submitAgent(e) {
|
|
|
1587
1588
|
ui.agent.posting = false;
|
|
1588
1589
|
go.disabled = false;
|
|
1589
1590
|
go.removeAttribute('aria-busy');
|
|
1590
|
-
go.textContent = '
|
|
1591
|
+
go.textContent = t('askRunner');
|
|
1591
1592
|
const bad = $('agent-start-msg');
|
|
1592
1593
|
bad.textContent = `A limit is a number above zero, or blank for the config's (${wrong.join(', ')}).`;
|
|
1593
1594
|
bad.hidden = false;
|
|
@@ -1612,7 +1613,7 @@ async function submitAgent(e) {
|
|
|
1612
1613
|
}
|
|
1613
1614
|
go.disabled = false;
|
|
1614
1615
|
go.removeAttribute('aria-busy');
|
|
1615
|
-
go.textContent = '
|
|
1616
|
+
go.textContent = t('askRunner');
|
|
1616
1617
|
const msg = $('agent-start-msg');
|
|
1617
1618
|
msg.textContent = text;
|
|
1618
1619
|
msg.hidden = false;
|