@khanglvm/relay 0.16.0 → 0.17.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/README.md +20 -1
- package/docs/AGENT.md +45 -37
- package/package.json +1 -1
- package/skills/relay/SKILL.md +125 -592
- package/src/cli.js +20 -66
- package/src/file-preview.js +61 -0
- package/src/server.js +18 -5
- package/src/ui/annotate.js +12 -4
- package/src/ui/blocks.css +88 -5
- package/src/ui/blocks.js +297 -61
package/src/cli.js
CHANGED
|
@@ -1066,72 +1066,26 @@ function stampSkillVersion() {
|
|
|
1066
1066
|
// AGENTS.md, …). A skill is only a tier-1 hint that agents can ignore; these
|
|
1067
1067
|
// rules, appended to the instructions the agent always reads, enforce usage.
|
|
1068
1068
|
// Printed to stdout so `rly skill rules >> CLAUDE.md` is the whole install.
|
|
1069
|
-
const SKILL_RULES = `## relay —
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
mode too**; reserve \`ExitPlanMode\` for the final plan-approval gate only.
|
|
1090
|
-
- **Codex-specific browser-board pattern:** Codex does not have a normal,
|
|
1091
|
-
user-facing "wake this agent turn from a browser submit" command. In Codex,
|
|
1092
|
-
keep the waiter in the foreground until the user submits:
|
|
1093
|
-
\`rly ask --file spec.json --detach\` then
|
|
1094
|
-
\`rly wait <boardId> --timeout 86400 --while-active --idle-grace 3600\`.
|
|
1095
|
-
If wait exits with \`wait-timeout\`, immediately run \`rly result <boardId>\`;
|
|
1096
|
-
if it is still open and the user may continue, run \`rly wait\` again. Do not
|
|
1097
|
-
use \`--on-result\` as the primary Codex return path; normal Codex CLI sessions
|
|
1098
|
-
do not expose a portable inbound API that wakes the current agent turn.
|
|
1099
|
-
Detached boards are durable: a board timeout hands the agent a \`timeout\`
|
|
1100
|
-
result but keeps the same URL/port serving until Submit or \`rly stop\`. Do
|
|
1101
|
-
not create a new board just because a wait timed out.
|
|
1102
|
-
- **No response needed** → \`rly show --file spec.json --display-only\`. It
|
|
1103
|
-
returns immediately and shows no note, comments, or Submit/Acknowledge action.
|
|
1104
|
-
In MCP App mode, \`relay_show\` is display-only by default; \`relay_ask\` is the
|
|
1105
|
-
response-bearing tool.
|
|
1106
|
-
- **A plan, structure, architecture, data, or prototype** → a relay board with
|
|
1107
|
-
diagram/chart/table/code/image/html blocks — never ASCII diagrams or walls of prose.
|
|
1108
|
-
- **"Show me the diff / git diff / these changes"** → \`rly diff\` (runs git diff →
|
|
1109
|
-
a diff board), or render diff text in a \`diff\` block — never paste a raw diff.
|
|
1110
|
-
- **Git pick/cherry-pick/conflict decisions** → \`rly git pick\`, \`rly git cherry-pick\`,
|
|
1111
|
-
or \`rly git conflict [files]\`. Conflict boards can also be authored with a
|
|
1112
|
-
\`git-conflict\` block from inline \`content\` or a local \`file\`/\`path\`; user
|
|
1113
|
-
hunk choices come back in \`result.blockEdits[blockId]\` with resolved content.
|
|
1114
|
-
- Point the user at a file with a clickable local path in a markdown block; embed a
|
|
1115
|
-
screen recording with a \`video\` block; when answer choices are visual, give each
|
|
1116
|
-
option its own visual (\`options[].blocks\`) so the user picks by looking.
|
|
1117
|
-
- Same-Wi-Fi sharing is locked by default. When the user wants another device to
|
|
1118
|
-
review or co-fill a running board, manage explicit links with \`rly share <id>\`:
|
|
1119
|
-
\`--role review\` creates an answer/comment link whose submissions are reference-only
|
|
1120
|
-
side reviews (\`rly result\` exposes them but they never complete \`rly wait\`),
|
|
1121
|
-
\`--role collab\` creates an owner-authorized edit/comment/final-submit link,
|
|
1122
|
-
\`--role read\` creates a view-only link, and \`--revoke\` disables active links. Active
|
|
1123
|
-
share links are durable across same-port \`rly reopen\`/\`rly rescue\` until
|
|
1124
|
-
revoked.
|
|
1125
|
-
- **There's a purpose-built component for most content — use the MOST SPECIFIC one,
|
|
1126
|
-
never plain prose when a block fits.** Blocks: \`table\` (sortable/filterable/CSV,
|
|
1127
|
-
load from .csv/.json), \`chart\`, \`kpi\` (stat cards), \`mermaid\`/\`graphviz\`/\`plantuml\`,
|
|
1128
|
-
\`code\`, \`diff\`, \`git-conflict\`, \`image\` (hold+drag area crops; +\`pins\` for points), \`compare\` (before/after with side-aware area crops), \`video\`, \`pdf\`, \`palette\`,
|
|
1129
|
-
\`typography\`, \`html\`. Question types: \`single\`/\`multi\`/\`yesno\`/\`scale\`/\`color\`/
|
|
1130
|
-
\`text\`/\`textarea\` plus \`rank\` (prioritize), \`allocate\` (split a budget), \`checklist\`
|
|
1131
|
-
(per-item sign-off). For a business user, reach for \`kpi\`+\`chart\`+\`table\` and
|
|
1132
|
-
\`rank\`/\`allocate\`/\`checklist\`; full menu + fields: \`rly agent\` and \`rly schema\`.
|
|
1133
|
-
- Read the result JSON from stdout; treat \`comment\` and \`annotations\` as
|
|
1134
|
-
first-class feedback. Full guide: \`rly agent\`.`;
|
|
1069
|
+
const SKILL_RULES = `## relay — visual boards and structured feedback
|
|
1070
|
+
|
|
1071
|
+
- Use Relay for files, visuals, plans, diffs, and multiple related questions.
|
|
1072
|
+
Keep brief answers and progress updates in chat; follow existing user authorization.
|
|
1073
|
+
- Show without feedback: \`rly show --file spec.json --display-only\` (no waiter).
|
|
1074
|
+
Collect input: \`rly ask --file spec.json --detach\`, then keep
|
|
1075
|
+
\`rly wait <boardId> --timeout 1800 --while-active --idle-grace 300\` in the
|
|
1076
|
+
foreground. If it times out, read \`rly result <boardId>\` before continuing.
|
|
1077
|
+
- Use the most specific block: table/chart/kpi for data, image/compare for visuals,
|
|
1078
|
+
code/diff for source, mermaid for flows, markdown for prose, html for custom UI.
|
|
1079
|
+
\`rly view\`, \`rly diff\`, and \`rly git\` are shortcuts; visual options use \`options[].blocks\`.
|
|
1080
|
+
- Browser file links such as \`[source](/absolute/app.js:98)\` open supported files
|
|
1081
|
+
in a modal and highlight source lines. Unsupported files offer Open in app.
|
|
1082
|
+
For inline MCP or shared reviewers, embed file content as blocks instead.
|
|
1083
|
+
- Reconnect existing boards by ID with \`rly rescue\` / \`rly reopen\`; update
|
|
1084
|
+
content with \`rly update\`. Preserve the original port and saved input.
|
|
1085
|
+
- Read answers, notes, comment, annotations, and blockEdits together. Use the
|
|
1086
|
+
returned resultFile when stdout is truncated; a timeout is not an answer.
|
|
1087
|
+
- Full skill: \`rly skill path\`; fields: \`rly schema\`; advanced recipes and
|
|
1088
|
+
sharing permissions: \`rly agent\`. Load details only when needed.`;
|
|
1135
1089
|
|
|
1136
1090
|
function cmdSkill(rest) {
|
|
1137
1091
|
const sub = rest[0];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { normalizeSpec } from './spec.js';
|
|
4
|
+
|
|
5
|
+
const TEXT_LIMIT = 1024 * 1024;
|
|
6
|
+
const MEDIA = {
|
|
7
|
+
'.png': ['image', 'image/png'], '.jpg': ['image', 'image/jpeg'], '.jpeg': ['image', 'image/jpeg'],
|
|
8
|
+
'.gif': ['image', 'image/gif'], '.webp': ['image', 'image/webp'], '.avif': ['image', 'image/avif'],
|
|
9
|
+
'.svg': ['image', 'image/svg+xml'], '.ico': ['image', 'image/x-icon'],
|
|
10
|
+
'.pdf': ['pdf', 'application/pdf'],
|
|
11
|
+
'.mp4': ['video', 'video/mp4'], '.webm': ['video', 'video/webm'], '.ogv': ['video', 'video/ogg'],
|
|
12
|
+
'.mov': ['video', 'video/quicktime'], '.m4v': ['video', 'video/mp4'],
|
|
13
|
+
'.mp3': ['audio', 'audio/mpeg'], '.wav': ['audio', 'audio/wav'], '.ogg': ['audio', 'audio/ogg'],
|
|
14
|
+
'.m4a': ['audio', 'audio/mp4'], '.flac': ['audio', 'audio/flac'],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Source citations use :line[:column] or #Lline[-Lend]. Strip before resolving
|
|
18
|
+
// and allowlisting; the browser never chooses an unrelated filesystem target.
|
|
19
|
+
export function splitFileReference(raw) {
|
|
20
|
+
const value = String(raw || '').trim();
|
|
21
|
+
const match = value.match(/(?::([1-9]\d*)(?::([1-9]\d*))?|#L([1-9]\d*)(?:-L?([1-9]\d*))?)$/);
|
|
22
|
+
if (!match) return { path: value, line: null, endLine: null };
|
|
23
|
+
const line = Number(match[1] || match[3]);
|
|
24
|
+
return { path: value.slice(0, match.index), line, endLine: Math.max(line, Number(match[4]) || line) };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function mediaType(target) {
|
|
28
|
+
return MEDIA[path.extname(target).toLowerCase()] || null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function filePreview(target, stat, reference) {
|
|
32
|
+
const base = { name: path.basename(target), size: stat.size, line: reference.line, endLine: reference.endLine };
|
|
33
|
+
const unavailable = (reason) => ({ ...base, kind: 'unsupported', reason });
|
|
34
|
+
if (!stat.isFile()) return unavailable('Directories cannot be previewed. Open this location in an app.');
|
|
35
|
+
const media = mediaType(target);
|
|
36
|
+
if (media) return { ...base, kind: media[0], mime: media[1] };
|
|
37
|
+
if (stat.size > TEXT_LIMIT) return unavailable('Text previews are limited to 1 MiB. Open this file in an app.');
|
|
38
|
+
// Read at most the limit + 1 even if a file grows between stat and read.
|
|
39
|
+
const fd = fs.openSync(target, 'r');
|
|
40
|
+
let bytes;
|
|
41
|
+
try {
|
|
42
|
+
const buffer = Buffer.alloc(TEXT_LIMIT + 1);
|
|
43
|
+
bytes = buffer.subarray(0, fs.readSync(fd, buffer, 0, buffer.length, 0));
|
|
44
|
+
} finally { fs.closeSync(fd); }
|
|
45
|
+
if (bytes.length > TEXT_LIMIT) return unavailable('Text previews are limited to 1 MiB. Open this file in an app.');
|
|
46
|
+
let text;
|
|
47
|
+
try { text = new TextDecoder('utf-8', { fatal: true }).decode(bytes); }
|
|
48
|
+
catch { return unavailable('This file is binary or uses an unsupported text encoding. Open it in an app.'); }
|
|
49
|
+
if (/[\x00-\x08\x0e-\x1f]/.test(text)) return unavailable('This binary file cannot be previewed. Open it in an app.');
|
|
50
|
+
if (text.split('\n').length > 20000) return unavailable('This file has too many lines to preview. Open it in an app.');
|
|
51
|
+
const ext = path.extname(target).slice(1).toLowerCase();
|
|
52
|
+
const lang = ({ js: 'javascript', mjs: 'javascript', cjs: 'javascript', ts: 'typescript', py: 'python', sh: 'bash' })[ext] || ext;
|
|
53
|
+
let kind = /^(md|markdown|mdown)$/.test(ext) ? 'markdown' : /^(html|htm)$/.test(ext) ? 'html' : 'code';
|
|
54
|
+
if (!reference.line && /^(csv|tsv)$/.test(ext)) {
|
|
55
|
+
try {
|
|
56
|
+
const block = normalizeSpec({ blocks: [{ type: 'table', rowsFile: target, sortable: true, filterable: true }] }).blocks[0];
|
|
57
|
+
return { ...base, kind: 'table', block, text, lang };
|
|
58
|
+
} catch { /* malformed tables remain readable as source */ }
|
|
59
|
+
}
|
|
60
|
+
return { ...base, kind, text, lang };
|
|
61
|
+
}
|
package/src/server.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from './store.js';
|
|
18
18
|
import { openUrl } from './open.js';
|
|
19
19
|
import { assertSpecReady } from './spec.js';
|
|
20
|
+
import { splitFileReference, filePreview, mediaType } from './file-preview.js';
|
|
20
21
|
|
|
21
22
|
const UI_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), 'ui');
|
|
22
23
|
const PKG_ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
@@ -492,7 +493,7 @@ function looksLikeLocalPath(s) {
|
|
|
492
493
|
// Expands ~ / file:// and resolves a (possibly relative) path to an absolute,
|
|
493
494
|
// normalized one against the board's authoring cwd. null on a malformed URL.
|
|
494
495
|
function resolveLocalPath(raw, baseCwd) {
|
|
495
|
-
let p =
|
|
496
|
+
let p = splitFileReference(raw).path;
|
|
496
497
|
if (!p) return null;
|
|
497
498
|
if (/^file:\/\//i.test(p)) {
|
|
498
499
|
try {
|
|
@@ -547,6 +548,7 @@ function buildOpenAllowlist(spec, baseCwd) {
|
|
|
547
548
|
// Same-origin fetches send no Origin or our own; a foreign Origin is a
|
|
548
549
|
// cross-site POST and must not be allowed to open a local file.
|
|
549
550
|
function sameOrigin(req, port, extraHosts = []) {
|
|
551
|
+
if (req.headers['sec-fetch-site'] === 'cross-site') return false;
|
|
550
552
|
const origin = req.headers.origin;
|
|
551
553
|
if (!origin) return true;
|
|
552
554
|
try {
|
|
@@ -1070,13 +1072,14 @@ export async function runBoard({ id, port = 0, open = true, timeoutSec = 86400,
|
|
|
1070
1072
|
savePref({ fontScale: body.fontScale });
|
|
1071
1073
|
}
|
|
1072
1074
|
sendJson(res, 200, { ok: true });
|
|
1073
|
-
} else if (req.method === 'POST' &&
|
|
1074
|
-
|
|
1075
|
-
//
|
|
1075
|
+
} else if ((req.method === 'POST' && ['/api/open', '/api/file-preview'].includes(pathname)) ||
|
|
1076
|
+
(['GET', 'HEAD'].includes(req.method) && pathname === '/api/file-content')) {
|
|
1077
|
+
// Preview, stream, or open only a board-referenced local file. All three
|
|
1078
|
+
// paths share the same origin, role, and reference allowlist checks.
|
|
1076
1079
|
if (!sameOrigin(req, actualPort, [advertisedHost])) return sendJson(res, 403, { error: 'cross-origin requests cannot open files' });
|
|
1077
1080
|
const access = accessFor(req, reqUrl);
|
|
1078
1081
|
if (access.role !== 'owner' && access.role !== 'collab') return sendJson(res, 403, { error: 'this share cannot open local files' });
|
|
1079
|
-
const body = JSON.parse((await readBody(req)) || '{}');
|
|
1082
|
+
const body = req.method === 'POST' ? JSON.parse((await readBody(req)) || '{}') : { path: reqUrl.searchParams.get('path') };
|
|
1080
1083
|
const raw = typeof body.path === 'string' ? body.path : '';
|
|
1081
1084
|
if (!raw.trim()) return sendJson(res, 400, { error: 'missing "path"' });
|
|
1082
1085
|
const baseCwd = record.cwd || process.cwd();
|
|
@@ -1092,6 +1095,16 @@ export async function runBoard({ id, port = 0, open = true, timeoutSec = 86400,
|
|
|
1092
1095
|
stat = null;
|
|
1093
1096
|
}
|
|
1094
1097
|
if (!stat) return sendJson(res, 404, { error: 'file not found', path: target });
|
|
1098
|
+
if (pathname === '/api/file-preview') {
|
|
1099
|
+
return sendJson(res, 200, { ok: true, ...filePreview(target, stat, splitFileReference(raw)) });
|
|
1100
|
+
}
|
|
1101
|
+
if (pathname === '/api/file-content') {
|
|
1102
|
+
const media = mediaType(target);
|
|
1103
|
+
if (!stat.isFile() || !media) return sendJson(res, 415, { error: 'this file type cannot be streamed' });
|
|
1104
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
1105
|
+
res.setHeader('Content-Security-Policy', "sandbox; default-src 'none'");
|
|
1106
|
+
return streamFile(req, res, target, media[1]);
|
|
1107
|
+
}
|
|
1095
1108
|
if (!openUrl(target)) return sendJson(res, 500, { error: 'could not open the file' });
|
|
1096
1109
|
sendJson(res, 200, { ok: true, path: target, name: path.basename(target) });
|
|
1097
1110
|
} else if (req.method === 'POST' && pathname === '/api/draft') {
|
package/src/ui/annotate.js
CHANGED
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
let pinEntry = null;
|
|
116
116
|
let popOpen = false;
|
|
117
117
|
let popSave = null;
|
|
118
|
+
let popCloseHook = null;
|
|
118
119
|
let popAnchorEl = null;
|
|
119
120
|
let popPositionFrame = 0;
|
|
120
121
|
const commentDrafts = new Map();
|
|
@@ -523,15 +524,20 @@
|
|
|
523
524
|
popPositionFrame = requestAnimationFrame(positionPopover);
|
|
524
525
|
}
|
|
525
526
|
|
|
526
|
-
function closePopover() {
|
|
527
|
+
function closePopover(reason = 'dismissed') {
|
|
527
528
|
if (!popOpen) return;
|
|
529
|
+
const closeHook = popCloseHook;
|
|
528
530
|
popOpen = false;
|
|
529
531
|
popSave = null;
|
|
532
|
+
popCloseHook = null;
|
|
530
533
|
popAnchorEl = null;
|
|
531
534
|
if (popPositionFrame) cancelAnimationFrame(popPositionFrame);
|
|
532
535
|
popPositionFrame = 0;
|
|
533
536
|
dom.pop.style.display = 'none';
|
|
534
537
|
dom.pop.replaceChildren();
|
|
538
|
+
if (closeHook) {
|
|
539
|
+
try { closeHook(reason); } catch (_) { /* lifecycle hooks are best-effort */ }
|
|
540
|
+
}
|
|
535
541
|
}
|
|
536
542
|
|
|
537
543
|
// ---------- delete a comment (with confirm) ----------
|
|
@@ -589,11 +595,12 @@
|
|
|
589
595
|
// add-comment dialog.
|
|
590
596
|
if (!permissions.add && !hasExisting) return;
|
|
591
597
|
closePopover();
|
|
598
|
+
popCloseHook = typeof info.onClose === 'function' ? info.onClose : null;
|
|
592
599
|
hidePin();
|
|
593
600
|
const pop = dom.pop;
|
|
594
601
|
// Header: target label + an explicit CLOSE button, so × always means "close".
|
|
595
602
|
const popClose = el('button', { class: 'ann-pop-close', type: 'button', title: 'Close', 'aria-label': 'Close' }, '×');
|
|
596
|
-
popClose.addEventListener('click', closePopover);
|
|
603
|
+
popClose.addEventListener('click', () => closePopover('dismissed'));
|
|
597
604
|
pop.replaceChildren(el('div', { class: 'ann-pop-head' }, el('div', { class: 'ann-pop-label' }, humanize(info.target)), popClose));
|
|
598
605
|
|
|
599
606
|
// Existing comments on this exact target, rendered as threads: author
|
|
@@ -679,12 +686,13 @@
|
|
|
679
686
|
const text = ta.value.trim();
|
|
680
687
|
if (text) addAnnotation(info, text);
|
|
681
688
|
commentDrafts.delete(draftKey);
|
|
682
|
-
closePopover();
|
|
689
|
+
if (text) closePopover('saved');
|
|
690
|
+
else closePopover('empty');
|
|
683
691
|
};
|
|
684
692
|
save.addEventListener('click', () => popSave && popSave());
|
|
685
693
|
cancel.addEventListener('click', () => {
|
|
686
694
|
commentDrafts.delete(draftKey);
|
|
687
|
-
closePopover();
|
|
695
|
+
closePopover('cancelled');
|
|
688
696
|
});
|
|
689
697
|
if (permissions.add) pop.append(ta, el('div', { class: 'ann-pop-actions' }, save, cancel));
|
|
690
698
|
|
package/src/ui/blocks.css
CHANGED
|
@@ -4,6 +4,54 @@
|
|
|
4
4
|
.blk { margin: 14px 0 0; }
|
|
5
5
|
.blk:first-child { margin-top: 0; }
|
|
6
6
|
|
|
7
|
+
/* File previews keep the board's scroll position and use native modal focus. */
|
|
8
|
+
.rly-file-dialog {
|
|
9
|
+
width: min(1180px, calc(100vw - 32px));
|
|
10
|
+
height: min(900px, calc(100dvh - 32px));
|
|
11
|
+
max-width: none;
|
|
12
|
+
max-height: none;
|
|
13
|
+
padding: 0;
|
|
14
|
+
border: 1px solid var(--border);
|
|
15
|
+
border-radius: 14px;
|
|
16
|
+
background: var(--bg);
|
|
17
|
+
color: var(--fg);
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
.rly-file-dialog[open] { display: flex; flex-direction: column; }
|
|
21
|
+
.rly-file-dialog::backdrop { background: rgb(0 0 0 / 55%); }
|
|
22
|
+
.rly-file-header { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
|
|
23
|
+
.rly-file-heading { flex: 1; min-width: 0; }
|
|
24
|
+
.rly-file-heading h2 { margin: 0 0 5px; font: 600 1rem var(--sans); overflow-wrap: anywhere; }
|
|
25
|
+
.rly-file-location { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
|
|
26
|
+
.rly-file-actions { display: flex; gap: 8px; flex-wrap: wrap; }
|
|
27
|
+
.rly-file-actions .btn {
|
|
28
|
+
white-space: nowrap; padding: 8px 12px; min-height: 36px;
|
|
29
|
+
font: 500 0.85rem var(--sans); color: var(--fg);
|
|
30
|
+
background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
.rly-file-actions .btn:hover { background: var(--accent-soft); border-color: var(--accent); }
|
|
33
|
+
.rly-file-actions .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
34
|
+
.rly-file-actions .btn:disabled { opacity: 0.5; cursor: default; }
|
|
35
|
+
.rly-file-body { flex: 1; min-height: 0; overflow: auto; padding: 20px; }
|
|
36
|
+
.rly-file-body > .blk-markdown { max-width: 75ch; margin: 0 auto; }
|
|
37
|
+
.rly-file-body .blk-tools { display: none; }
|
|
38
|
+
.rly-file-source { font: 0.85rem/1.6 var(--mono, monospace); width: max-content; min-width: 100%; }
|
|
39
|
+
.rly-file-line { display: flex; white-space: pre; min-height: 1.6em; }
|
|
40
|
+
.rly-file-line-number { flex: 0 0 5ch; padding-right: 2ch; text-align: right; color: var(--muted); user-select: none; }
|
|
41
|
+
.rly-file-line.is-target { background: var(--accent-soft, var(--bg-sunken)); outline: 1px solid var(--accent); outline-offset: -1px; }
|
|
42
|
+
.rly-file-media { display: block; max-width: 100%; margin: 0 auto; }
|
|
43
|
+
.rly-file-image { object-fit: contain; max-height: 100%; }
|
|
44
|
+
.rly-file-frame, .rly-file-pdf { width: 100%; height: 100%; min-height: 300px; border: 0; background: white; }
|
|
45
|
+
.rly-file-video { max-height: 100%; }
|
|
46
|
+
.rly-file-audio { width: min(100%, 600px); }
|
|
47
|
+
@media (max-width: 600px) {
|
|
48
|
+
.rly-file-dialog { width: calc(100vw - 12px); height: calc(100dvh - 12px); border-radius: 10px; }
|
|
49
|
+
.rly-file-header { padding: 12px; flex-wrap: wrap; gap: 12px; }
|
|
50
|
+
.rly-file-heading { flex-basis: 100%; }
|
|
51
|
+
.rly-file-body { padding: 12px; }
|
|
52
|
+
.rly-file-actions .btn { min-height: 44px; }
|
|
53
|
+
}
|
|
54
|
+
|
|
7
55
|
/* ---------- shared error card ---------- */
|
|
8
56
|
.blk-error {
|
|
9
57
|
color: var(--muted);
|
|
@@ -140,15 +188,19 @@
|
|
|
140
188
|
}
|
|
141
189
|
/* subtle tinter colors via theme vars only */
|
|
142
190
|
.blk-pre .tok-kw,
|
|
191
|
+
.rly-file-source .tok-kw,
|
|
143
192
|
.blk-difftable .tok-kw,
|
|
144
193
|
.blk-markdown .md .tok-kw { color: var(--accent); }
|
|
145
194
|
.blk-pre .tok-str,
|
|
195
|
+
.rly-file-source .tok-str,
|
|
146
196
|
.blk-difftable .tok-str,
|
|
147
197
|
.blk-markdown .md .tok-str { color: var(--ok); }
|
|
148
198
|
.blk-pre .tok-com,
|
|
199
|
+
.rly-file-source .tok-com,
|
|
149
200
|
.blk-difftable .tok-com,
|
|
150
201
|
.blk-markdown .md .tok-com { color: var(--muted); font-style: italic; }
|
|
151
202
|
.blk-pre .tok-num,
|
|
203
|
+
.rly-file-source .tok-num,
|
|
152
204
|
.blk-difftable .tok-num,
|
|
153
205
|
.blk-markdown .md .tok-num { color: var(--fg-2); }
|
|
154
206
|
|
|
@@ -651,6 +703,8 @@
|
|
|
651
703
|
width: 100%;
|
|
652
704
|
max-width: none;
|
|
653
705
|
height: auto;
|
|
706
|
+
-webkit-user-drag: none;
|
|
707
|
+
user-select: none;
|
|
654
708
|
border-radius: 6px;
|
|
655
709
|
object-fit: contain;
|
|
656
710
|
object-position: left top;
|
|
@@ -757,6 +811,9 @@ body.blk-full-open { overflow: hidden; }
|
|
|
757
811
|
dragging. During an active drag the inner svg/img/canvas ignore the pointer
|
|
758
812
|
so hover pins/cursors don't flicker and the whole surface shows "grabbing". */
|
|
759
813
|
.blk-pannable { cursor: grab; }
|
|
814
|
+
.blk-has-regions.blk-pannable { cursor: crosshair; }
|
|
815
|
+
body.blk-space-pan .blk-has-regions.blk-pannable,
|
|
816
|
+
body.blk-space-pan .blk-has-regions.blk-pannable * { cursor: grab !important; }
|
|
760
817
|
.blk-panning { cursor: grabbing; user-select: none; }
|
|
761
818
|
.blk-panning svg,
|
|
762
819
|
.blk-panning img,
|
|
@@ -789,6 +846,19 @@ body.blk-full-open { overflow: hidden; }
|
|
|
789
846
|
background: var(--accent); border-color: var(--accent); color: var(--accent-fg);
|
|
790
847
|
}
|
|
791
848
|
.blk-tools .tool-comment.has-comment:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
|
|
849
|
+
.blk-tools .tool-region {
|
|
850
|
+
display: inline-flex; align-items: center; gap: 5px;
|
|
851
|
+
}
|
|
852
|
+
.blk-tools .tool-region svg { display: block; }
|
|
853
|
+
.blk-tools .tool-region.is-active {
|
|
854
|
+
background: var(--accent); border-color: var(--accent); color: var(--accent-fg);
|
|
855
|
+
}
|
|
856
|
+
.blk-tools .tool-region.is-active:hover {
|
|
857
|
+
background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg);
|
|
858
|
+
}
|
|
859
|
+
@media (max-width: 520px) {
|
|
860
|
+
.blk-tools .tool-region-label { display: none; }
|
|
861
|
+
}
|
|
792
862
|
|
|
793
863
|
/* code blocks reuse the viewer toolbar (comment + full-screen); the pre keeps
|
|
794
864
|
its own card, the wrapper only hosts the toolbar strip */
|
|
@@ -847,7 +917,7 @@ body.blk-full-open { overflow: hidden; }
|
|
|
847
917
|
.cmp-frame {
|
|
848
918
|
position: relative; overflow: hidden; user-select: none; touch-action: none;
|
|
849
919
|
border: 1px solid var(--border); border-radius: 12px; line-height: 0;
|
|
850
|
-
cursor:
|
|
920
|
+
cursor: crosshair;
|
|
851
921
|
}
|
|
852
922
|
.cmp-img { display: block; width: 100%; height: auto; }
|
|
853
923
|
.cmp-before { position: absolute; inset: 0; width: 50%; overflow: hidden; }
|
|
@@ -855,6 +925,7 @@ body.blk-full-open { overflow: hidden; }
|
|
|
855
925
|
.cmp-handle {
|
|
856
926
|
position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
|
|
857
927
|
background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); transform: translateX(-1px);
|
|
928
|
+
cursor: ew-resize;
|
|
858
929
|
}
|
|
859
930
|
.cmp-handle-grip {
|
|
860
931
|
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
|
|
@@ -941,17 +1012,29 @@ body.blk-full-open { overflow: hidden; }
|
|
|
941
1012
|
padding: 0;
|
|
942
1013
|
min-width: 10px;
|
|
943
1014
|
min-height: 10px;
|
|
1015
|
+
appearance: none;
|
|
944
1016
|
}
|
|
945
|
-
.blk-imgregion
|
|
946
|
-
content: attr(data-count);
|
|
1017
|
+
.blk-imgregion-badge {
|
|
947
1018
|
position: absolute; top: -11px; right: -11px;
|
|
948
|
-
min-width:
|
|
949
|
-
display:
|
|
1019
|
+
min-width: 24px; height: 22px; padding: 0 6px;
|
|
1020
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 3px;
|
|
950
1021
|
border: 2px solid #fff; border-radius: 999px;
|
|
951
1022
|
background: var(--accent); color: #fff;
|
|
952
1023
|
font: 600 0.68rem/1 var(--sans);
|
|
953
1024
|
box-shadow: 0 1px 4px rgba(0,0,0,0.3);
|
|
1025
|
+
pointer-events: none;
|
|
954
1026
|
}
|
|
1027
|
+
.blk-imgregion-badge svg { width: 10px; height: 10px; }
|
|
1028
|
+
.blk-imgregion-count { min-width: 0.7em; text-align: center; }
|
|
1029
|
+
.blk-imgregion-provisional {
|
|
1030
|
+
z-index: 8;
|
|
1031
|
+
border-style: dashed;
|
|
1032
|
+
background: color-mix(in srgb, var(--card) 34%, var(--accent) 20%);
|
|
1033
|
+
}
|
|
1034
|
+
.blk-imgregion-provisional .blk-imgregion-badge { opacity: 0.9; }
|
|
1035
|
+
.blk-region-mode,
|
|
1036
|
+
.blk-region-mode * { cursor: crosshair !important; }
|
|
1037
|
+
.blk-region-mode { touch-action: none; }
|
|
955
1038
|
.blk-region-arming { cursor: crosshair !important; }
|
|
956
1039
|
.blk-region-selecting { cursor: crosshair !important; touch-action: none; }
|
|
957
1040
|
.blk-region-status {
|