web: render stage-turn markdown in the artifact viewer
The full-screen viewer now opens markdown/text artifacts (text/markdown, text/plain, .md/.markdown/.txt) through the resolved artifact URL and renders them with the page's own DOM markdown renderer, with an honest failure message and an external fallback. ArrowLeft/ArrowRight page the shared media+document list, and a backdrop click closes the viewer while panel clicks do not. The run gallery and per-visit artifacts present input.md, memory.md and output.md as ordinary Document tiles with a drawn glyph and open the viewer. Adds isMarkdownArtifact/isViewerArtifact with unit coverage, deterministic viewer fixtures, and ui-smoke assertions/captures for rendered markdown, keyboard paging, the honest 404 and backdrop dismissal.
This commit is contained in:
@@ -422,3 +422,88 @@
|
||||
}
|
||||
.rename-input:focus { outline: none; border-color: var(--accent); }
|
||||
.rename-save { border-color: var(--accent); color: var(--accent); font-weight: 600; }
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
Artifact viewer (R8): the dim backdrop and its one panel, the rendered
|
||||
markdown document body and the markdown's document tile. The gallery/viewer
|
||||
wiring lives in views/runDetail.js and views/dialogs.js; every server string
|
||||
is still set with textContent.
|
||||
--------------------------------------------------------------------------- */
|
||||
|
||||
/* The tile treats a markdown/text file as an ordinary document: a small drawn
|
||||
page glyph above the existing uppercase "Document" kind label, never a media
|
||||
poster. The glyph is CSS, so it needs no emoji font; the extra top padding
|
||||
keeps it clear of the absolutely positioned Copy link / Share actions. */
|
||||
.artifact-document-tile { padding-top: 34px; }
|
||||
.artifact-doc-glyph {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 22px;
|
||||
border: 1.5px solid var(--muted);
|
||||
border-radius: 2px;
|
||||
}
|
||||
.artifact-doc-glyph::before,
|
||||
.artifact-doc-glyph::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 3px;
|
||||
right: 3px;
|
||||
height: 1.5px;
|
||||
background: var(--muted);
|
||||
}
|
||||
.artifact-doc-glyph::before { top: 6px; }
|
||||
.artifact-doc-glyph::after { top: 11px; }
|
||||
|
||||
.artifact-viewer {
|
||||
z-index: 60;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
background: rgba(0, 0, 0, 0.78);
|
||||
}
|
||||
.viewer-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-s);
|
||||
width: min(1100px, 100%);
|
||||
max-height: 100%;
|
||||
min-height: 0;
|
||||
padding: 16px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
|
||||
outline: none;
|
||||
}
|
||||
.viewer-panel:focus { outline: none; }
|
||||
|
||||
/* Markdown/text needs the full board to scroll: a readable column, not a
|
||||
centred image. The shared md-* classes keep the app's chat typography. */
|
||||
.viewer-board-document {
|
||||
display: block;
|
||||
overflow-y: auto;
|
||||
padding: 18px 20px;
|
||||
background: var(--surface-2);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
}
|
||||
.viewer-markdown {
|
||||
width: 100%;
|
||||
max-width: 78ch;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.viewer-markdown .md-code-block { max-width: 100%; }
|
||||
.viewer-markdown .md-pre { overflow-x: auto; }
|
||||
.viewer-markdown .md-table { display: block; overflow-x: auto; }
|
||||
|
||||
.viewer-loading { padding: 24px; text-align: center; }
|
||||
.viewer-error { display: grid; gap: 10px; padding: 12px 4px; }
|
||||
.viewer-error-message { color: var(--bad); line-height: 1.5; }
|
||||
.viewer-external { color: var(--accent); justify-self: start; }
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.artifact-viewer { padding: 10px; }
|
||||
.viewer-panel { padding: 10px; border-radius: 10px; }
|
||||
.viewer-board-document { padding: 12px; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user