@khanglvm/relay 0.23.2 → 0.25.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/docs/AGENT.md +2 -2
- package/package.json +1 -1
- package/skills/relay/SKILL.md +1 -1
- package/src/mcp/boards.js +1 -1
- package/src/mcp/tools.js +51 -8
- package/src/mcp-ui/board/controls.js +83 -31
- package/src/mcp-ui/board/lifecycle.js +1 -1
- package/src/mcp-ui/board/render.js +55 -20
- package/src/mcp-ui/index.html +56 -1
- package/src/ui/annotate.css +5 -2
- package/src/ui/app/questions.js +1 -1
- package/src/ui/style.css +11 -7
package/docs/AGENT.md
CHANGED
|
@@ -146,7 +146,7 @@ Tools:
|
|
|
146
146
|
- `relay_help {topic}` or `relay_help {schema}`: a part of this guide, or the exact fields of one block or question type.
|
|
147
147
|
- `relay_ask` and `relay_show`: the old names, kept as aliases for one more minor version. Use `relay_board`.
|
|
148
148
|
|
|
149
|
-
The flow: call `relay_board`, tell the person the board is on screen, and
|
|
149
|
+
The flow: call `relay_board`, tell the person the board is on screen, then call `relay_result {boardId, wait_seconds: 600}` and call it again while it says `open`. When an agent is waiting like this, the board hands it the answers directly. Otherwise the board posts a one-line message naming the board to wake the agent, and some hosts (T3 Code) ask the person to confirm that message. Do not ask the same questions again in chat.
|
|
150
150
|
|
|
151
151
|
`rly mcp` speaks stdio to a local desktop host. `rly mcp --http [--port N] [--token-file PATH] [--allow-origin ORIGIN]` serves Streamable HTTP at `/mcp` for hosts that connect over a network. The bearer token comes from `--token-file`, `RLY_MCP_TOKEN` or `--token`; the flag shows in `ps`, so prefer the file or the variable. Boards are stored in the relay home of the machine that runs the server, so `codeFile` and local images resolve there and nowhere else, and only under the server's file roots: none over HTTP unless the operator passes `--root PATH` (repeatable) or `RLY_FILE_ROOTS`, the working directory over stdio (but not when it is `/` or the home directory, where desktop hosts often start it). `--retention-days N` (or `RLY_RETENTION_DAYS`, `off` to keep every board) sets how long unchanged boards stay in the relay home; the default is 30. A host that draws A2UI can show the whole board natively instead of the iframe. It declares the board catalog, `https://github.com/khanglvm/relay/a2ui/catalog/board/v1`, under `extensions.a2ui["1.0"].supportedCatalogIds` when it connects, or per call in `_meta.a2ui`; the call wins over the connection. `relay_view` then returns the board as A2UI messages (`application/a2ui+json`, `application/json+a2ui` is accepted when declared) and the host sends button events to `a2ui_action` with the surface's data model. The catalog is `src/a2ui/board-catalog.json`; `toA2ui(spec)` and `fromA2ui(dataModel, spec)` from `@khanglvm/relay/a2ui-board` convert in both directions, and the result matches what the web board stores. Hosts that did not declare it keep the iframe.
|
|
152
152
|
|
|
@@ -756,7 +756,7 @@ file write alone starts a new model turn.
|
|
|
756
756
|
|
|
757
757
|
| Client/surface | Recommended Relay return path |
|
|
758
758
|
|---|---|
|
|
759
|
-
| MCP App (`relay_board` with questions) | No CLI wait.
|
|
759
|
+
| MCP App (`relay_board` with questions) | No CLI wait. Keep a `relay_result` wait open; on submit it returns the answers. With no wait open, the board posts a one-line message instead. |
|
|
760
760
|
| MCP App (`relay_board`, display-only) | Present it and continue immediately; no acknowledgement is requested. |
|
|
761
761
|
| Claude Code | Run `rly wait <id> --timeout 0` as a [background Bash task](https://docs.anthropic.com/en/docs/claude-code/interactive-mode#background-bash-commands); retain its task id/output rather than opening a second board. |
|
|
762
762
|
| Gemini CLI | Run the waiter in the background and set [`tools.shell.backgroundCompletionBehavior` to `"inject"`](https://geminicli.com/docs/reference/configuration/) so completion is returned to the agent; `"notify"` only informs the chat UI. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanglvm/relay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Question boards with rich blocks (markdown, charts, mermaid, tables, code, diffs, video, sandboxed HTML), clickable local file-links, and element-level annotations for AI coding agents (Claude Code, Codex, …): ask users structured questions, present interactive visuals, collect inline comments, read answers as JSON — in a local browser board OR rendered INLINE inside the Claude & Codex apps as an MCP App (SEP-1865).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
package/skills/relay/SKILL.md
CHANGED
|
@@ -15,7 +15,7 @@ If your host app has its own way to ask the user or show results (native questio
|
|
|
15
15
|
3. Give the person the url. To get the result: `rly wait <boardId> --timeout 1800 --while-active --idle-grace 300` (blocks until submit) or `rly result <boardId>` (now). A timeout is not an answer: run `rly result` before you decide.
|
|
16
16
|
4. Read `answers`, `notes`, `comment`, `annotations` and `blockEdits` together; any of them can qualify an answer. When stdout is cut short, read the `resultFile` it names.
|
|
17
17
|
|
|
18
|
-
If Relay MCP tools are connected, call `relay_board` with the same spec (questions make it collect answers, none make it display-only) and the board renders inline.
|
|
18
|
+
If Relay MCP tools are connected, call `relay_board` with the same spec (questions make it collect answers, none make it display-only) and the board renders inline. Then call `relay_result {boardId, wait_seconds: 600}` and repeat while it says `open`: answers collected that way need no chat message, which some hosts make the person confirm; `relay_help` gives exact fields. Embed file content with `mdFile`, `codeFile` or an image block, because inline boards cannot open local file links.
|
|
19
19
|
|
|
20
20
|
## Spec in one screen
|
|
21
21
|
```json
|
package/src/mcp/boards.js
CHANGED
|
@@ -53,7 +53,7 @@ export function questionList(spec, labelMax = 80) {
|
|
|
53
53
|
export function boardResult(record, spec, mode) {
|
|
54
54
|
const title = limit(spec.title, 120);
|
|
55
55
|
const text = mode === 'ask'
|
|
56
|
-
? `Board "${title}" (${record.id}) is on screen${spec.questions.length ? ` with ${spec.questions.length} question${spec.questions.length === 1 ? '' : 's'}` : ' for the person to acknowledge'}. They answer there.
|
|
56
|
+
? `Board "${title}" (${record.id}) is on screen${spec.questions.length ? ` with ${spec.questions.length} question${spec.questions.length === 1 ? '' : 's'}` : ' for the person to acknowledge'}. They answer there. Call relay_result {boardId, wait_seconds: 600} now and again while it says open: answers collected that way arrive without a chat message the person must confirm. Do not re-ask them in chat.`
|
|
57
57
|
: `Board "${title}" (${record.id}) is on screen, display-only. Continue without waiting.`;
|
|
58
58
|
for (const labelMax of [80, 40, 20, 0]) {
|
|
59
59
|
const structuredContent = { boardId: record.id, mode, title, questions: questionList(spec, labelMax) };
|
package/src/mcp/tools.js
CHANGED
|
@@ -65,6 +65,31 @@ function oneAtATime(boardId, task) {
|
|
|
65
65
|
return run;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// Boards whose final answers a waiting relay_result call has handed to an agent,
|
|
69
|
+
// with the time. Module level because a stateless HTTP host builds a fresh server
|
|
70
|
+
// per request. relay_submit reads it to tell the board whether the agent already
|
|
71
|
+
// has the answers, so the board can skip the chat message that wakes the agent.
|
|
72
|
+
// Hosts such as T3 Code confirm every such message with the person. A wrong
|
|
73
|
+
// "delivered" strands the answers, so only a waiter whose request is still open
|
|
74
|
+
// counts, and only a pickup made after this submit began.
|
|
75
|
+
const pickedUp = new Map();
|
|
76
|
+
const PICKUP_GRACE_MS = 2500;
|
|
77
|
+
function notePickup(boardId) {
|
|
78
|
+
const now = Date.now();
|
|
79
|
+
for (const [id, at] of pickedUp) if (now - at > 60_000) pickedUp.delete(id);
|
|
80
|
+
pickedUp.set(String(boardId), now);
|
|
81
|
+
}
|
|
82
|
+
/** Waits briefly for an agent that is blocked in relay_result to collect a board submitted at `since`. */
|
|
83
|
+
async function waitForPickup(boardId, since) {
|
|
84
|
+
const picked = () => (pickedUp.get(String(boardId)) ?? -1) >= since;
|
|
85
|
+
const until = Date.now() + PICKUP_GRACE_MS;
|
|
86
|
+
while (Date.now() < until) {
|
|
87
|
+
if (picked()) return true;
|
|
88
|
+
await sleep(100);
|
|
89
|
+
}
|
|
90
|
+
return picked();
|
|
91
|
+
}
|
|
92
|
+
|
|
68
93
|
const appMeta = (visibility) => ({ ui: { resourceUri: BOARD_URI, visibility } });
|
|
69
94
|
const modelMeta = { ...appMeta(['model', 'app']), 'openai/outputTemplate': BOARD_URI };
|
|
70
95
|
|
|
@@ -109,8 +134,12 @@ function registerReadTools({ server, store }) {
|
|
|
109
134
|
for (;;) {
|
|
110
135
|
const record = await store.get(boardId);
|
|
111
136
|
if (!record) return errorResult(`relay: no board "${boardId}"`);
|
|
112
|
-
|
|
137
|
+
const aborted = Boolean(ctx?.mcpReq?.signal?.aborted);
|
|
138
|
+
if (isFinal(record) || Date.now() >= deadline || aborted) {
|
|
113
139
|
const out = resultOf(record);
|
|
140
|
+
// A disconnected client never gets this result (the SDK drops it), and a
|
|
141
|
+
// plain status read is not an agent waiting for the answers.
|
|
142
|
+
if (isFinal(record) && wait_seconds > 0 && !aborted) notePickup(boardId);
|
|
114
143
|
return json(out, { boardId, status: out.status });
|
|
115
144
|
}
|
|
116
145
|
await sleep(500);
|
|
@@ -120,7 +149,13 @@ function registerReadTools({ server, store }) {
|
|
|
120
149
|
|
|
121
150
|
function registerAppTools({ server, options, store, key }) {
|
|
122
151
|
const appTools = [];
|
|
123
|
-
|
|
152
|
+
// App tools run only from the board iframe, on the board its token opens, and
|
|
153
|
+
// only because the person looking at it typed, loaded or pressed Submit there.
|
|
154
|
+
// Hosts such as T3 Code ask before every app call not marked read-only, which
|
|
155
|
+
// turned each autosave into an approval prompt for the person's own typing.
|
|
156
|
+
// The hint says no approval is needed: nothing reaches past this board.
|
|
157
|
+
const APP_ANNOTATIONS = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
|
|
158
|
+
const appTool = (name, config, cb) => appTools.push(registerAppTool(server, name, { ...config, annotations: APP_ANNOTATIONS, _meta: { ui: { visibility: ['app'] } } }, cb));
|
|
124
159
|
|
|
125
160
|
/** The board a valid token opens, or an error result. */
|
|
126
161
|
const guard = async (args) => {
|
|
@@ -155,12 +190,20 @@ function registerAppTools({ server, options, store, key }) {
|
|
|
155
190
|
const outcome = await handleSurfaceAction(store, record, args);
|
|
156
191
|
return outcome.ok ? text('recorded') : errorResult(`relay: ${outcome.error}`);
|
|
157
192
|
}));
|
|
158
|
-
appTool(TOOL.submit, { description: 'Stores the final answers.', inputSchema: submitInput },
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
193
|
+
appTool(TOOL.submit, { description: 'Stores the final answers and says whether a waiting agent already collected them.', inputSchema: submitInput }, async (args) => {
|
|
194
|
+
let since = 0;
|
|
195
|
+
const outcome = await oneAtATime(args.boardId, async () => {
|
|
196
|
+
const { record, error } = await guard(args);
|
|
197
|
+
if (error) return { error };
|
|
198
|
+
since = Date.now();
|
|
199
|
+
return submitBoard(store, record, args.payload);
|
|
200
|
+
});
|
|
201
|
+
if (outcome.error && typeof outcome.error === 'object') return outcome.error;
|
|
202
|
+
if (!outcome.ok) return errorResult(`relay: ${outcome.error}`);
|
|
203
|
+
// Outside the board queue, so a relay_result for this board is not held up.
|
|
204
|
+
const delivered = await waitForPickup(args.boardId, since);
|
|
205
|
+
return json({ status: outcome.status, delivered }, { status: outcome.status, delivered });
|
|
206
|
+
});
|
|
164
207
|
appTool(TOOL.asset, { description: 'One chunk of a vendored library, for hosts that refuse resources/read.', inputSchema: assetInput }, ({ name, index }) => {
|
|
165
208
|
const chunk = vendorChunk(name, index);
|
|
166
209
|
return chunk ? json({ name, index, count: chunk.count }, chunk) : errorResult(`relay: no asset "${name}" chunk ${index}`);
|
|
@@ -1,4 +1,44 @@
|
|
|
1
|
-
function clearErr(qid) { if (cards[qid]) cards[qid]
|
|
1
|
+
function clearErr(qid) { if (cards[qid]) markError(cards[qid], false); }
|
|
2
|
+
/** Shows or hides a question's required error, and adds it to the group's description while it shows. */
|
|
3
|
+
function markError(card, bad) {
|
|
4
|
+
card.classList.toggle('error', bad);
|
|
5
|
+
const ids = [card.dataset.desc, bad ? card.dataset.err : ''].filter(Boolean).join(' ');
|
|
6
|
+
if (ids) card.setAttribute('aria-describedby', ids);
|
|
7
|
+
else card.removeAttribute('aria-describedby');
|
|
8
|
+
}
|
|
9
|
+
function requiredMark() {
|
|
10
|
+
return el('span', { class: 'req' }, el('span', { 'aria-hidden': 'true' }, ' *'), el('span', { class: 'sr-only' }, ' (required)'));
|
|
11
|
+
}
|
|
12
|
+
let uidSeq = 0;
|
|
13
|
+
const uid = (prefix) => prefix + '-' + (++uidSeq);
|
|
14
|
+
/**
|
|
15
|
+
* Gives a row of single-choice buttons radio semantics: each says whether it
|
|
16
|
+
* is checked, Tab enters at the chosen one (or the first), and the arrow keys
|
|
17
|
+
* move to and choose the next. Returns a function that repaints the state.
|
|
18
|
+
* The caller puts role=radiogroup and a label on the buttons' container.
|
|
19
|
+
*/
|
|
20
|
+
function radioButtons(buttons, isOn) {
|
|
21
|
+
const sync = () => {
|
|
22
|
+
const on = buttons.map((btn, i) => isOn(i));
|
|
23
|
+
const entry = Math.max(0, on.indexOf(true));
|
|
24
|
+
buttons.forEach((btn, i) => {
|
|
25
|
+
btn.setAttribute('role', 'radio');
|
|
26
|
+
btn.setAttribute('aria-checked', on[i] ? 'true' : 'false');
|
|
27
|
+
btn.classList.toggle('sel', on[i]);
|
|
28
|
+
btn.tabIndex = i === entry ? 0 : -1;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
buttons.forEach((btn, i) => btn.addEventListener('keydown', (ev) => {
|
|
32
|
+
const step = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[ev.key];
|
|
33
|
+
if (!step) return;
|
|
34
|
+
ev.preventDefault();
|
|
35
|
+
const next = buttons[(i + step + buttons.length) % buttons.length];
|
|
36
|
+
next.focus();
|
|
37
|
+
if (next.getAttribute('aria-checked') !== 'true') next.click();
|
|
38
|
+
}));
|
|
39
|
+
sync();
|
|
40
|
+
return sync;
|
|
41
|
+
}
|
|
2
42
|
|
|
3
43
|
function syncOptSel(group) {
|
|
4
44
|
for (const lab of group.querySelectorAll('label.opt')) {
|
|
@@ -49,7 +89,7 @@
|
|
|
49
89
|
}
|
|
50
90
|
if (q.other) {
|
|
51
91
|
otherRadio = el('input', { type: 'radio', name: q.id });
|
|
52
|
-
const text = el('textarea', { class: 'otherinput', rows: '2', placeholder: 'your own answer…' });
|
|
92
|
+
const text = el('textarea', { class: 'otherinput', rows: '2', placeholder: 'your own answer…', 'aria-label': 'Your own answer' });
|
|
53
93
|
text.value = (state.other[q.id] && state.other[q.id].text) || '';
|
|
54
94
|
otherRadio.checked = otherOn();
|
|
55
95
|
const ensureOther = () => state.other[q.id] || (state.other[q.id] = { on: false, text: text.value });
|
|
@@ -82,7 +122,7 @@
|
|
|
82
122
|
if (q.other) {
|
|
83
123
|
const oth = state.other[q.id];
|
|
84
124
|
const box = el('input', { type: 'checkbox' });
|
|
85
|
-
const text = el('textarea', { class: 'otherinput', rows: '2', placeholder: 'your own answer…' });
|
|
125
|
+
const text = el('textarea', { class: 'otherinput', rows: '2', placeholder: 'your own answer…', 'aria-label': 'Your own answer' });
|
|
86
126
|
box.checked = Boolean(oth && oth.on);
|
|
87
127
|
text.value = (oth && oth.text) || '';
|
|
88
128
|
const sync = () => { state.other[q.id] = { on: box.checked, text: text.value }; syncOptSel(group); clearErr(q.id); };
|
|
@@ -95,19 +135,17 @@
|
|
|
95
135
|
}
|
|
96
136
|
|
|
97
137
|
function segButtons(q, values, labels) {
|
|
98
|
-
const seg = el('div', { class: q.type === 'scale' ? 'scale' : 'seg' });
|
|
99
|
-
const buttons = [];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
for (const x of buttons) x.classList.toggle('sel', state.answers[q.id] === values[buttons.indexOf(x)]);
|
|
138
|
+
const seg = el('div', { class: q.type === 'scale' ? 'scale' : 'seg', role: 'radiogroup' });
|
|
139
|
+
const buttons = values.map((v, i) => el('button', { type: 'button' }, labels[i]));
|
|
140
|
+
const sync = radioButtons(buttons, (i) => state.answers[q.id] === values[i]);
|
|
141
|
+
buttons.forEach((btn, i) => {
|
|
142
|
+
btn.addEventListener('click', () => {
|
|
143
|
+
if (state.answers[q.id] === values[i]) delete state.answers[q.id];
|
|
144
|
+
else state.answers[q.id] = values[i];
|
|
145
|
+
sync();
|
|
107
146
|
clearErr(q.id);
|
|
108
147
|
});
|
|
109
|
-
|
|
110
|
-
seg.append(b);
|
|
148
|
+
seg.append(btn);
|
|
111
149
|
});
|
|
112
150
|
return seg;
|
|
113
151
|
}
|
|
@@ -115,7 +153,16 @@
|
|
|
115
153
|
const values = [];
|
|
116
154
|
for (let i = q.min; i <= q.max; i++) values.push(i);
|
|
117
155
|
const seg = segButtons(q, values, values.map(String));
|
|
118
|
-
|
|
156
|
+
// Up to 11 steps fit one even row on a phone; the end labels move under it
|
|
157
|
+
// so they do not squeeze the buttons. Longer scales keep the wrapping row.
|
|
158
|
+
if (values.length <= 11) {
|
|
159
|
+
const steps = '--n:' + values.length + ';--half:' + Math.ceil(values.length / 2);
|
|
160
|
+
const grid = el('div', { class: 'scale scale-fit' + (values.length >= 8 ? ' scale-long' : ''), style: steps, role: 'radiogroup' }, ...seg.children);
|
|
161
|
+
if (!q.minLabel && !q.maxLabel) return grid;
|
|
162
|
+
return el('div', {}, grid, el('div', { class: 'scale-ends', style: steps },
|
|
163
|
+
el('span', {}, q.minLabel || ''), el('span', {}, q.maxLabel || '')));
|
|
164
|
+
}
|
|
165
|
+
const row = el('div', { class: 'scale', role: 'radiogroup' });
|
|
119
166
|
if (q.minLabel) row.append(el('span', { class: 'slabel' }, q.minLabel));
|
|
120
167
|
row.append(...seg.children);
|
|
121
168
|
if (q.maxLabel) row.append(el('span', { class: 'slabel' }, q.maxLabel));
|
|
@@ -135,23 +182,22 @@
|
|
|
135
182
|
const cur = () => (state.answers[q.id] && typeof state.answers[q.id] === 'object' && !Array.isArray(state.answers[q.id])
|
|
136
183
|
? state.answers[q.id] : (state.answers[q.id] = {}));
|
|
137
184
|
for (const o of q.options) {
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
185
|
+
const labelId = uid('chk');
|
|
186
|
+
const seg = el('div', { class: 'chk-seg', role: 'radiogroup', 'aria-labelledby': labelId });
|
|
187
|
+
const buttons = q.statuses.map((st) => el('button', { type: 'button', class: 'chk-status' + (st.tone ? ' tone-' + st.tone : '') }, st.label));
|
|
188
|
+
const sync = radioButtons(buttons, (i) => cur()[o.value] === q.statuses[i].value);
|
|
189
|
+
buttons.forEach((btn, i) => {
|
|
190
|
+
btn.addEventListener('click', () => {
|
|
144
191
|
const m = cur();
|
|
145
|
-
if (m[o.value] ===
|
|
146
|
-
else m[o.value] =
|
|
147
|
-
|
|
192
|
+
if (m[o.value] === q.statuses[i].value) delete m[o.value];
|
|
193
|
+
else m[o.value] = q.statuses[i].value;
|
|
194
|
+
sync();
|
|
148
195
|
clearErr(q.id);
|
|
149
196
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
197
|
+
seg.append(btn);
|
|
198
|
+
});
|
|
153
199
|
wrap.append(el('div', { class: 'chk-row' },
|
|
154
|
-
el('div', { class: 'chk-body' }, el('div', { class: 'ol' }, o.label), o.description ? el('div', { class: 'od' }, o.description) : null),
|
|
200
|
+
el('div', { class: 'chk-body' }, el('div', { class: 'ol', id: labelId }, o.label), o.description ? el('div', { class: 'od' }, o.description) : null),
|
|
155
201
|
seg));
|
|
156
202
|
}
|
|
157
203
|
return wrap;
|
|
@@ -167,7 +213,7 @@
|
|
|
167
213
|
const refresh = () => {
|
|
168
214
|
const m = cur();
|
|
169
215
|
const sum = (q.options || []).reduce((a, o) => a + (Number(m[o.value]) || 0), 0);
|
|
170
|
-
const tail = sum > total ? ' (over by ' + (sum - total) + ')' : sum < total ? ' (' + (total - sum) + ' left)' : '
|
|
216
|
+
const tail = sum > total ? ' (over by ' + (sum - total) + ')' : sum < total ? ' (' + (total - sum) + ' left)' : ' (all assigned)';
|
|
171
217
|
sumEl.textContent = sum + ' / ' + total + unit + tail;
|
|
172
218
|
sumEl.classList.toggle('over', sum > total);
|
|
173
219
|
sumEl.classList.toggle('exact', sum === total);
|
|
@@ -193,6 +239,10 @@
|
|
|
193
239
|
refresh();
|
|
194
240
|
return wrap;
|
|
195
241
|
}
|
|
242
|
+
// Lucide chevron-up / chevron-down; the buttons carry their own aria-label.
|
|
243
|
+
const RANK_ICON = (d) => '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:block;margin:auto"><path d="' + d + '"/></svg>';
|
|
244
|
+
const RANK_ICON_UP = RANK_ICON('m18 15-6-6-6 6');
|
|
245
|
+
const RANK_ICON_DOWN = RANK_ICON('m6 9 6 6 6-6');
|
|
196
246
|
// Reorderable priority list — see the browser board's controlRank. Answer is
|
|
197
247
|
// the ordered array of option values (highest first); always a full permutation.
|
|
198
248
|
function controlRank(q) {
|
|
@@ -213,8 +263,10 @@
|
|
|
213
263
|
order.forEach((val, i) => {
|
|
214
264
|
const o = byVal.get(val);
|
|
215
265
|
if (!o) return;
|
|
216
|
-
const up = el('button', { type: 'button', class: 'rank-btn', title: 'Move up', 'aria-label': 'Move "' + o.label + '" up' }
|
|
217
|
-
const down = el('button', { type: 'button', class: 'rank-btn', title: 'Move down', 'aria-label': 'Move "' + o.label + '" down' }
|
|
266
|
+
const up = el('button', { type: 'button', class: 'rank-btn', title: 'Move up', 'aria-label': 'Move "' + o.label + '" up' });
|
|
267
|
+
const down = el('button', { type: 'button', class: 'rank-btn', title: 'Move down', 'aria-label': 'Move "' + o.label + '" down' });
|
|
268
|
+
up.innerHTML = RANK_ICON_UP;
|
|
269
|
+
down.innerHTML = RANK_ICON_DOWN;
|
|
218
270
|
up.disabled = i === 0;
|
|
219
271
|
down.disabled = i === order.length - 1;
|
|
220
272
|
up.addEventListener('click', () => move(i, i - 1));
|
|
@@ -19,10 +19,15 @@
|
|
|
19
19
|
|
|
20
20
|
QS.forEach((q, idx) => {
|
|
21
21
|
const required = q.required || !spec.allowPartial;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
// Each question is a labelled group, so a screen reader announces the
|
|
23
|
+
// question with its options; ids use the index because spec ids may hold
|
|
24
|
+
// characters that are awkward in an id reference.
|
|
25
|
+
const labelId = 'q' + idx + '-label';
|
|
26
|
+
const descId = q.description ? 'q' + idx + '-desc' : '';
|
|
27
|
+
const card = el('div', { class: 'card', role: 'group', 'aria-labelledby': labelId, 'aria-describedby': descId || null, 'data-desc': descId, 'data-err': 'q' + idx + '-err' },
|
|
28
|
+
el('div', { class: 'qnum', 'aria-hidden': 'true' }, 'Q' + (idx + 1)),
|
|
29
|
+
el('p', { class: 'qlabel', id: labelId }, q.label, required ? requiredMark() : null),
|
|
30
|
+
q.description ? el('p', { class: 'qdesc', id: descId }, q.description) : null);
|
|
26
31
|
renderBlocks(card, q.blocks || [], q.id);
|
|
27
32
|
const control = el('div', { class: 'control' });
|
|
28
33
|
if (q.type === 'single') control.append(controlSingle(q));
|
|
@@ -35,24 +40,29 @@
|
|
|
35
40
|
else if (q.type === 'allocate') control.append(controlAllocate(q));
|
|
36
41
|
else if (q.type === 'pick') control.append(window.RelayPick.control(q, state, { onChange: () => clearErr(q.id) }));
|
|
37
42
|
else control.append(controlText(q, q.type === 'textarea'));
|
|
43
|
+
// A free-text answer is named by its question, not by its placeholder.
|
|
44
|
+
const field = control.querySelector(':scope > input[type="text"], :scope > textarea');
|
|
45
|
+
if (field) field.setAttribute('aria-labelledby', labelId);
|
|
46
|
+
const radios = control.querySelector('[role="radiogroup"]:not([aria-labelledby])');
|
|
47
|
+
if (radios) radios.setAttribute('aria-labelledby', labelId);
|
|
38
48
|
card.append(control);
|
|
39
49
|
if (q.note) {
|
|
40
|
-
const noteInput = el('textarea', { class: 'qnote', rows: 2, placeholder: 'optional note about this answer…' });
|
|
50
|
+
const noteInput = el('textarea', { class: 'qnote', rows: 2, placeholder: 'optional note about this answer…', 'aria-label': 'Note about this answer' });
|
|
41
51
|
noteInput.value = typeof state.notes[q.id] === 'string' ? state.notes[q.id] : '';
|
|
42
52
|
noteInput.addEventListener('input', () => { state.notes[q.id] = noteInput.value; });
|
|
43
53
|
card.append(el('div', { class: 'qnotewrap' }, noteInput));
|
|
44
54
|
}
|
|
45
|
-
card.append(el('p', { class: 'errmsg' }, 'This question is required.'));
|
|
55
|
+
card.append(el('p', { class: 'errmsg', id: card.dataset.err }, 'This question is required.'));
|
|
46
56
|
cards[q.id] = card;
|
|
47
57
|
app.append(card);
|
|
48
58
|
});
|
|
49
59
|
|
|
50
60
|
if (spec.note && spec.responseRequired !== false) {
|
|
51
|
-
const note = el('textarea', { placeholder: 'optional note back to the agent…' });
|
|
61
|
+
const note = el('textarea', { placeholder: 'optional note back to the agent…', 'aria-labelledby': 'overall-label' });
|
|
52
62
|
note.value = state.comment || '';
|
|
53
63
|
note.addEventListener('input', () => { state.comment = note.value; });
|
|
54
|
-
app.append(el('div', { class: 'card' },
|
|
55
|
-
el('p', { class: 'qlabel' }, 'Anything else?'),
|
|
64
|
+
app.append(el('div', { class: 'card overall' },
|
|
65
|
+
el('p', { class: 'qlabel', id: 'overall-label' }, 'Anything else?'),
|
|
56
66
|
el('p', { class: 'qdesc' }, 'Free-text note returned to the agent along with your answers.'),
|
|
57
67
|
el('div', { class: 'control' }, note)));
|
|
58
68
|
}
|
|
@@ -82,10 +92,18 @@
|
|
|
82
92
|
for (const q of QS) {
|
|
83
93
|
const required = q.required || !spec.allowPartial;
|
|
84
94
|
const bad = required && (getValue(q) === undefined || (q.type === 'pick' && window.RelayPick.short(q, state.answers[q.id])));
|
|
85
|
-
cards[q.id]
|
|
95
|
+
markError(cards[q.id], bad);
|
|
86
96
|
if (bad && !firstBad) firstBad = cards[q.id];
|
|
87
97
|
}
|
|
88
|
-
if (firstBad)
|
|
98
|
+
if (firstBad) {
|
|
99
|
+
firstBad.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
100
|
+
// Focus lands on the first unanswered question, which reads its label and
|
|
101
|
+
// the error, so a keyboard or screen-reader user is not left on Submit.
|
|
102
|
+
// The answer control comes first: blocks above it may hold their own buttons.
|
|
103
|
+
const focusable = 'input:not(:disabled), textarea:not(:disabled), select:not(:disabled), button:not(:disabled), [tabindex]:not([tabindex="-1"])';
|
|
104
|
+
const target = firstBad.querySelector('.control ' + focusable.split(', ').join(', .control ')) || firstBad.querySelector(focusable);
|
|
105
|
+
if (target) target.focus({ preventScroll: true });
|
|
106
|
+
}
|
|
89
107
|
return !firstBad;
|
|
90
108
|
}
|
|
91
109
|
|
|
@@ -129,7 +147,15 @@
|
|
|
129
147
|
submitBtn.disabled = true;
|
|
130
148
|
submitBtn.textContent = 'Submitting…';
|
|
131
149
|
const data = payload();
|
|
132
|
-
const
|
|
150
|
+
const outcome = BOARD.token ? await storeSubmission(data) : { stored: false, delivered: false };
|
|
151
|
+
const stored = outcome.stored;
|
|
152
|
+
// An agent already waiting in relay_result has the answers, so no message is
|
|
153
|
+
// needed to wake it, and the host does not ask the person to confirm one.
|
|
154
|
+
if (outcome.delivered) {
|
|
155
|
+
submitted = true;
|
|
156
|
+
showDone('delivered');
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
133
159
|
const text = stored
|
|
134
160
|
? 'Relay board ' + BOARD.id + ' submitted. Read it with relay_result {"boardId":"' + BOARD.id + '"}.'
|
|
135
161
|
: summarize(data);
|
|
@@ -143,15 +169,16 @@
|
|
|
143
169
|
}
|
|
144
170
|
const messageDelivered = await sendUserMessage(content, text);
|
|
145
171
|
submitted = true;
|
|
146
|
-
showDone(messageDelivered
|
|
172
|
+
showDone(messageDelivered ? 'delivered' : stored ? 'stored' : 'local');
|
|
147
173
|
}
|
|
148
174
|
|
|
175
|
+
/** Stores the answers; `delivered` says a waiting agent already collected them. */
|
|
149
176
|
async function storeSubmission(data) {
|
|
150
177
|
try {
|
|
151
|
-
await callServerTool('relay_submit', { boardId: BOARD.id, token: BOARD.token, payload: data });
|
|
152
|
-
return true;
|
|
178
|
+
const res = await callServerTool('relay_submit', { boardId: BOARD.id, token: BOARD.token, payload: data }, 15000);
|
|
179
|
+
return { stored: true, delivered: res.delivered === true };
|
|
153
180
|
} catch {
|
|
154
|
-
return false;
|
|
181
|
+
return { stored: false, delivered: false };
|
|
155
182
|
}
|
|
156
183
|
}
|
|
157
184
|
|
|
@@ -171,17 +198,25 @@
|
|
|
171
198
|
return false;
|
|
172
199
|
}
|
|
173
200
|
|
|
174
|
-
|
|
201
|
+
// delivery: 'delivered' (the agent has the answers), 'stored' (saved, the agent
|
|
202
|
+
// still needs a nudge) or 'local' (nothing reached the server).
|
|
203
|
+
/** Lucide "check" icon for the done line. */
|
|
204
|
+
function doneMark() {
|
|
205
|
+
const mark = el('span', { class: 'mark', 'aria-hidden': 'true' });
|
|
206
|
+
mark.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="display:block"><path d="M20 6 9 17l-5-5"/></svg>';
|
|
207
|
+
return mark;
|
|
208
|
+
}
|
|
209
|
+
function showDone(delivery) {
|
|
175
210
|
// Collapse: leave fullscreen, drop the whole form for a one-line confirmation
|
|
176
211
|
// so the host shrinks the iframe to a small footprint in the transcript.
|
|
177
212
|
if (Annotate) { try { Annotate.teardown(); } catch { /* nothing to tear down */ } }
|
|
178
213
|
document.documentElement.classList.remove('mcp-fullscreen');
|
|
179
214
|
app.replaceChildren(el('div', { class: 'mcp-done' },
|
|
180
|
-
|
|
215
|
+
doneMark(),
|
|
181
216
|
el('span', { class: 'lead' }, QS.length ? 'Submitted' : 'Acknowledged'),
|
|
182
|
-
el('span', { class: 'sub' },
|
|
217
|
+
el('span', { class: 'sub' }, delivery === 'delivered'
|
|
183
218
|
? '· sent back to the agent'
|
|
184
|
-
:
|
|
219
|
+
: delivery === 'stored'
|
|
185
220
|
? '· saved; send the agent a message to continue'
|
|
186
221
|
: '· tell the agent you’ve responded')));
|
|
187
222
|
// Report the small height immediately, then again next frame / after layout
|
package/src/mcp-ui/index.html
CHANGED
|
@@ -22,9 +22,64 @@ body{ margin:0; }
|
|
|
22
22
|
.mcp-status{ font:13px/1.5 var(--sans, -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif); color:var(--muted,#8a8580); padding:18px 16px; }
|
|
23
23
|
/* post-submit: a slim one-line confirmation so the iframe collapses small */
|
|
24
24
|
.mcp-done{ display:flex; align-items:center; gap:8px; padding:11px 16px; font:14px/1.4 var(--sans, -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif); color:var(--fg,#1c1b19); }
|
|
25
|
-
.mcp-done .mark{
|
|
25
|
+
.mcp-done .mark{ display:inline-flex; color:var(--ok,#4d8a66); }
|
|
26
26
|
.mcp-done .lead{ font-weight:600; }
|
|
27
27
|
.mcp-done .sub{ color:var(--muted,#8a8580); }
|
|
28
|
+
/* Inline in a chat thread the host frames the board and caps its height, so
|
|
29
|
+
the full-page spacing would push questions behind an inner scrollbar.
|
|
30
|
+
Fullscreen keeps the roomy web layout. */
|
|
31
|
+
:root:not(.mcp-fullscreen) .wrap{ padding:
|
|
32
|
+
calc(10px + var(--mcp-safe-top, 0px))
|
|
33
|
+
calc(12px + var(--mcp-safe-right, 0px))
|
|
34
|
+
calc(10px + var(--mcp-safe-bottom, 0px))
|
|
35
|
+
calc(12px + var(--mcp-safe-left, 0px)); }
|
|
36
|
+
:root:not(.mcp-fullscreen) .qb-header h1{ font-size:1.2rem; }
|
|
37
|
+
:root:not(.mcp-fullscreen) .intro{ margin:2px 0 8px; font-size:.92rem; }
|
|
38
|
+
:root:not(.mcp-fullscreen) .card{ padding:0; margin:14px 0 0; background:none; box-shadow:none; border-radius:0; }
|
|
39
|
+
:root:not(.mcp-fullscreen) .card.error{ box-shadow:none; }
|
|
40
|
+
/* with no frame to outline, the label carries the required-question error */
|
|
41
|
+
:root:not(.mcp-fullscreen) .card.error .qlabel{ color:var(--danger); }
|
|
42
|
+
:root:not(.mcp-fullscreen) .qnum{ display:none; }
|
|
43
|
+
:root:not(.mcp-fullscreen) .qlabel{ font-size:.95rem; }
|
|
44
|
+
:root:not(.mcp-fullscreen) .control{ margin-top:8px; }
|
|
45
|
+
:root:not(.mcp-fullscreen) .opt{ padding:7px 12px; margin:5px 0; border-radius:8px; }
|
|
46
|
+
:root:not(.mcp-fullscreen) .opt input{ margin-top:3px; }
|
|
47
|
+
:root:not(.mcp-fullscreen) .opt:not(.sel) .otherbox{ display:none; }
|
|
48
|
+
/* Heights are whole lines (line-height 1.6) plus padding and border, so a
|
|
49
|
+
one-line box shows its text without clipping. Only the board's own boxes:
|
|
50
|
+
the comment popover and pick/a2ui fields keep their sizes. A textarea
|
|
51
|
+
question asks for a longer answer, so it gets two lines. */
|
|
52
|
+
:root:not(.mcp-fullscreen) .otherbox .otherinput,
|
|
53
|
+
:root:not(.mcp-fullscreen) .overall .control > textarea{ min-height:0; padding:8px 12px; height:calc(1.6em + 18px); }
|
|
54
|
+
:root:not(.mcp-fullscreen) .card:not(.overall) > .control > textarea{ min-height:0; padding:8px 12px; height:calc(3.2em + 18px); }
|
|
55
|
+
:root:not(.mcp-fullscreen) .qnotewrap{ margin-top:6px; }
|
|
56
|
+
:root:not(.mcp-fullscreen) .qnotewrap .qnote{ min-height:0; padding:6px 10px; height:calc(1.6em + 14px); }
|
|
57
|
+
:root:not(.mcp-fullscreen) .overall .qdesc{ display:none; }
|
|
58
|
+
:root:not(.mcp-fullscreen) .submitbar{ padding:12px 0 2px; }
|
|
59
|
+
:root:not(.mcp-fullscreen) .submit{ padding:8px 22px; font-size:.95rem; }
|
|
60
|
+
:root:not(.mcp-fullscreen) .scale-fit{ display:grid; grid-template-columns:repeat(var(--n),minmax(0,1fr)); gap:4px; }
|
|
61
|
+
:root:not(.mcp-fullscreen) .scale-fit button{ width:auto; height:40px; border-radius:8px; }
|
|
62
|
+
/* 8+ steps on a phone narrower than 400px: two even rows keep each step near 44px wide */
|
|
63
|
+
@media (max-width: 400px){ :root:not(.mcp-fullscreen) .scale-long{ grid-template-columns:repeat(var(--half),minmax(0,1fr)); } }
|
|
64
|
+
.scale-ends{ display:flex; justify-content:space-between; gap:12px; margin-top:4px; color:var(--muted); font-size:.8rem; }
|
|
65
|
+
/* Fullscreen keeps 44px steps, so the end labels span the buttons, not the whole column. */
|
|
66
|
+
.mcp-fullscreen .scale-fit{ display:grid; grid-template-columns:repeat(var(--n),44px); gap:8px; }
|
|
67
|
+
.mcp-fullscreen .scale-ends{ width:calc(var(--n) * 44px + (var(--n) - 1) * 8px); max-width:100%; }
|
|
68
|
+
:root:not(.mcp-fullscreen) .seg button{ padding:8px 20px; }
|
|
69
|
+
.sr-only{ position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
|
|
70
|
+
/* Touch screens (T3 and Sushi on a phone): the browser's grey tap flash is
|
|
71
|
+
replaced by each control's own pressed state; text fields use 16px, below
|
|
72
|
+
which iOS zooms the page on focus; tap targets grow toward 44px. */
|
|
73
|
+
html{ -webkit-tap-highlight-color:transparent; }
|
|
74
|
+
@media (pointer: coarse){
|
|
75
|
+
input, textarea, select, .qnotewrap .qnote, .otherbox .otherinput{ font-size:16px; }
|
|
76
|
+
/* not on a chosen button: its light text would vanish on the soft tint while pressed */
|
|
77
|
+
.opt:active, .seg button:not(.sel):active, .scale button:not(.sel):active, .chk-status:not(.sel):active, .rank-btn:active{ background:var(--accent-soft); }
|
|
78
|
+
.seg button{ min-height:44px; }
|
|
79
|
+
:root:not(.mcp-fullscreen) .scale-fit button{ height:44px; }
|
|
80
|
+
.chk-status{ min-height:40px; padding:6px 16px; }
|
|
81
|
+
.rank-btn{ width:40px; height:40px; }
|
|
82
|
+
}
|
|
28
83
|
/* in fullscreen the host fills the window — keep text to a readable column */
|
|
29
84
|
.mcp-fullscreen .wrap{ max-width:760px; margin:0 auto; }
|
|
30
85
|
/* progressive preview: shown while the agent is still streaming the spec */
|
package/src/ui/annotate.css
CHANGED
|
@@ -276,9 +276,12 @@
|
|
|
276
276
|
border-left: 1px solid var(--border);
|
|
277
277
|
box-shadow: var(--shadow-lift);
|
|
278
278
|
transform: translateX(100%);
|
|
279
|
-
|
|
279
|
+
/* Parked off-screen its shadow still bled onto the page's right edge, and its
|
|
280
|
+
controls stayed in the tab order; hide it once the slide-out ends. */
|
|
281
|
+
visibility: hidden;
|
|
282
|
+
transition: transform 240ms var(--ease), visibility 0s linear 240ms;
|
|
280
283
|
}
|
|
281
|
-
.ann-rail.open { transform: translateX(0); }
|
|
284
|
+
.ann-rail.open { transform: translateX(0); visibility: visible; transition: transform 240ms var(--ease); }
|
|
282
285
|
.ann-rail-head {
|
|
283
286
|
flex: none;
|
|
284
287
|
display: flex; align-items: center; gap: 8px;
|
package/src/ui/app/questions.js
CHANGED
|
@@ -306,7 +306,7 @@
|
|
|
306
306
|
const refresh = () => {
|
|
307
307
|
const m = cur();
|
|
308
308
|
const sum = (q.options || []).reduce((a, o) => a + (Number(m[o.value]) || 0), 0);
|
|
309
|
-
const tail = sum > total ? ` (over by ${sum - total})` : sum < total ? ` (${total - sum} left)` : '
|
|
309
|
+
const tail = sum > total ? ` (over by ${sum - total})` : sum < total ? ` (${total - sum} left)` : ' (all assigned)';
|
|
310
310
|
sumEl.textContent = `${sum} / ${total}${unit}${tail}`;
|
|
311
311
|
sumEl.classList.toggle('over', sum > total);
|
|
312
312
|
sumEl.classList.toggle('exact', sum === total);
|
package/src/ui/style.css
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--card: #ffffff;
|
|
10
10
|
--fg: #1c1b19; /* deep warm charcoal */
|
|
11
11
|
--fg-2: #57534e; /* secondary copy */
|
|
12
|
-
--muted: #
|
|
12
|
+
--muted: #6f6a64; /* captions; 5:1 on white, so small text passes WCAG AA */
|
|
13
13
|
--accent: #c2674b; /* terracotta / clay */
|
|
14
14
|
--accent-hover: #b25a40;
|
|
15
15
|
--accent-fg: #fcfaf7; /* text on accent */
|
|
@@ -164,7 +164,6 @@ h1 {
|
|
|
164
164
|
margin: 8px 0; cursor: pointer;
|
|
165
165
|
transition: border-color 150ms var(--ease), background 150ms var(--ease);
|
|
166
166
|
}
|
|
167
|
-
.opt:hover { border-color: var(--accent); }
|
|
168
167
|
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
|
|
169
168
|
.opt input { margin-top: 4px; accent-color: var(--accent); flex: none; }
|
|
170
169
|
.opt .ol { font-weight: 500; }
|
|
@@ -178,7 +177,6 @@ h1 {
|
|
|
178
177
|
margin: 8px 0;
|
|
179
178
|
transition: border-color 150ms var(--ease), background 150ms var(--ease);
|
|
180
179
|
}
|
|
181
|
-
.optwrap:hover { border-color: var(--accent); }
|
|
182
180
|
.optwrap.sel { border-color: var(--accent); background: var(--accent-soft); }
|
|
183
181
|
.optwrap > .opt { border: none; margin: 0; background: none; }
|
|
184
182
|
.optwrap > .blocks { padding: 0 14px 12px 40px; }
|
|
@@ -196,7 +194,6 @@ h1 {
|
|
|
196
194
|
transition: border-color 150ms var(--ease), background 150ms var(--ease),
|
|
197
195
|
color 150ms var(--ease), transform 200ms var(--ease), box-shadow 200ms var(--ease);
|
|
198
196
|
}
|
|
199
|
-
.seg button:hover, .scale button:hover { border-color: var(--accent); transform: translateY(-1px); }
|
|
200
197
|
.seg button.sel, .scale button.sel {
|
|
201
198
|
background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
|
|
202
199
|
}
|
|
@@ -233,7 +230,6 @@ h1 {
|
|
|
233
230
|
cursor: pointer; font-size: 14px; line-height: 1;
|
|
234
231
|
transition: border-color 150ms var(--ease);
|
|
235
232
|
}
|
|
236
|
-
.rank-btn:hover:not(:disabled) { border-color: var(--accent); }
|
|
237
233
|
.rank-btn:disabled { opacity: 0.35; cursor: default; }
|
|
238
234
|
|
|
239
235
|
/* checklist — one row per item with a Pass/Fail/N·A segmented status control */
|
|
@@ -250,7 +246,6 @@ h1 {
|
|
|
250
246
|
border: 1px solid var(--border-strong); border-radius: 8px;
|
|
251
247
|
transition: border-color 150ms var(--ease), background 150ms var(--ease), color 150ms var(--ease);
|
|
252
248
|
}
|
|
253
|
-
.chk-status:hover { border-color: var(--accent); }
|
|
254
249
|
.chk-status.sel { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
|
|
255
250
|
.chk-status.tone-ok.sel { background: var(--ok); border-color: var(--ok); color: #fff; }
|
|
256
251
|
.chk-status.tone-bad.sel { background: var(--danger); border-color: var(--danger); color: var(--danger-fg); }
|
|
@@ -310,7 +305,16 @@ textarea { min-height: 90px; resize: vertical; }
|
|
|
310
305
|
padding: 12px 30px; font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
|
|
311
306
|
transition: background 150ms var(--ease), transform 200ms var(--ease), box-shadow 200ms var(--ease);
|
|
312
307
|
}
|
|
313
|
-
|
|
308
|
+
/* Hover only where a pointer can hover: a phone applies :hover on tap and keeps
|
|
309
|
+
it, which left a tapped option outlined as if it were still chosen. */
|
|
310
|
+
@media (hover: hover) and (pointer: fine) {
|
|
311
|
+
.opt:hover, .optwrap:hover, .chk-status:hover, .rank-btn:hover:not(:disabled) { border-color: var(--accent); }
|
|
312
|
+
.seg button:hover, .scale button:hover { border-color: var(--accent); transform: translateY(-1px); }
|
|
313
|
+
.submit:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
|
|
314
|
+
}
|
|
315
|
+
/* The radio or checkbox inside an option is tiny, so the keyboard ring goes on the whole option. */
|
|
316
|
+
.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
317
|
+
.seg button:focus-visible, .scale button:focus-visible, .chk-status:focus-visible, .rank-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
314
318
|
.submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
315
319
|
.submit:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
|
|
316
320
|
.hint { color: var(--muted); font-size: 0.82rem; }
|