From ea3b0f92f0ea11d1cb48d6ad46ca0c947dcec3a6 Mon Sep 17 00:00:00 2001 From: Atai Barkai Date: Sat, 5 Dec 2026 07:37:13 -0800 Subject: [PATCH 1/9] Prototype: artifacts drawn in the app's current look A document is set by the typeset rules a reply uses, on white paper (the card level) instead of the panel's slate. Its tables are part of the page: no grey box, no inner box, no height cap, muted heading row, hairline rows, Copy/Download/Full screen on hover. A table in a card runs to the card's edges under a pale heading strip; sort arrows show on hover. Card titles lose the line under them. A sheet's heading row and row numbers lose their fill. Co-Authored-By: Claude Opus 5.5 --- .../components/artifacts/kinds/document.tsx | 12 +++-- .../components/artifacts/kinds/markdown.tsx | 46 +++++++++++++++-- app/src/components/artifacts/kinds/sheet.tsx | 10 ++-- app/src/components/artifacts/kinds/table.tsx | 13 +++-- app/src/components/artifacts/kinds/theme.tsx | 7 ++- app/src/components/gallery/frame.tsx | 2 +- app/src/lib/markdown-table.tsx | 51 +++++++++++++++++++ app/src/styles.css | 46 +++++++++++++++++ 8 files changed, 168 insertions(+), 19 deletions(-) diff --git a/app/src/components/artifacts/kinds/document.tsx b/app/src/components/artifacts/kinds/document.tsx index 8fd43c269f..1c7cfda482 100644 --- a/app/src/components/artifacts/kinds/document.tsx +++ b/app/src/components/artifacts/kinds/document.tsx @@ -5,10 +5,10 @@ import { type DocumentDirective, splitDocument, } from "@openbot/shared/artifacts/kinds"; -import { IconAlertTriangle } from "@/components/icons"; import type { ReactNode } from "react"; import { MetricsCard, NoticeCard } from "@/components/gallery/cards"; import { QuoteCard } from "@/components/gallery/quote"; +import { IconAlertTriangle } from "@/components/icons"; import { cn } from "@/lib/utils"; import { ArtifactChart } from "./chart"; import { MermaidDiagram } from "./diagram"; @@ -27,7 +27,7 @@ import type { KindViewProps } from "./types"; */ function Prose({ children }: { children: string }) { - return {children}; + return {children}; } function Unreadable({ name, line }: { name: string; line: number }) { @@ -170,12 +170,16 @@ export function DocumentView({ } return (
( + Tag: Tag, +) { + return function Bare({ + node: _node, + ...props + }: ComponentProps & { node?: unknown }) { + const Element = Tag as "td"; + return )} />; + }; +} + +/** + * A document's words, set as a page: the typeset rules a Bot's reply is set by (`typeset.css`, tuned + * for a document by `.typeset-document` in styles.css), with headings, lists and tables drawn bare + * so those rules reach them, and a table drawn as part of the page (`DocumentTable`). + */ +const DOCUMENT_COMPONENTS = { + ...replyMarkdownComponents, + table: DocumentTable, + thead: bareTablePart("thead"), + tbody: bareTablePart("tbody"), + tr: bareTablePart("tr"), + th: bareTablePart("th"), + td: bareTablePart("td"), +}; + +export const DOCUMENT_TYPESET_CLASS = "typeset typeset-reply typeset-document"; + export function ArtifactMarkdown({ children, className, + page = false, }: { children: string | undefined; className?: string; + /** Set as a document's page (typeset), rather than as a card's or a slide's words. */ + page?: boolean; }) { const medium = useArtifactMedium(); const onPaper = medium === "print"; @@ -53,7 +88,7 @@ export function ArtifactMarkdown({ }, [text]); const components = useMemo( () => ({ - ...markdownComponents, + ...(page ? DOCUMENT_COMPONENTS : markdownComponents), img: ({ src, alt }: ComponentProps<"img">) => ( ), }), - [sources, onPaper], + [sources, onPaper, page], ); useMathsOnPaper(onPaper ? text : ""); if (!children) return null; return ( Row @@ -173,7 +173,7 @@ function SheetGrid({ sheet }: { sheet: SheetTab }) { : undefined } className={cn( - "sticky top-0 border-r border-b border-border bg-muted p-0 text-xs font-medium text-muted-foreground", + "sticky top-0 border-r border-b border-border bg-background p-0 text-xs font-medium text-muted-foreground", index < frozen ? "z-30" : "z-20", )} key={column.key} @@ -182,7 +182,7 @@ function SheetGrid({ sheet }: { sheet: SheetTab }) { > - ) : null} - - ) : null} - - ) : null} - {grid} - - +
+ {content.description || (filters.length > 0 && !onPaper) ? ( +
+ {content.description ? ( +

+ {content.description} +

+ ) : ( + + )} + {filters.length > 0 && !onPaper ? ( +
+ {filters.map((filter) => ( + + setState((current) => ({ + ...current, + [filter.id]: value, + })) + } + value={state[filter.id] ?? ALL} + /> + ))} + {filtered ? ( + + ) : null} +
+ ) : null} +
+ ) : null} + {grid} +
+ + ); } diff --git a/app/src/components/artifacts/kinds/document.tsx b/app/src/components/artifacts/kinds/document.tsx index 1c7cfda482..757762cedc 100644 --- a/app/src/components/artifacts/kinds/document.tsx +++ b/app/src/components/artifacts/kinds/document.tsx @@ -7,6 +7,7 @@ import { } from "@openbot/shared/artifacts/kinds"; import type { ReactNode } from "react"; import { MetricsCard, NoticeCard } from "@/components/gallery/cards"; +import { UnboxedFrames } from "@/components/gallery/frame"; import { QuoteCard } from "@/components/gallery/quote"; import { IconAlertTriangle } from "@/components/icons"; import { cn } from "@/lib/utils"; @@ -170,10 +171,9 @@ export function DocumentView({ } return ( @@ -185,7 +185,9 @@ export function DocumentView({ data-kind="document" data-mode="view" > - + + +
); diff --git a/app/src/components/artifacts/kinds/table.tsx b/app/src/components/artifacts/kinds/table.tsx index 070ca358e1..7ba6682ca2 100644 --- a/app/src/components/artifacts/kinds/table.tsx +++ b/app/src/components/artifacts/kinds/table.tsx @@ -1,7 +1,7 @@ import { compareKeys, sortKey } from "@openbot/shared/artifacts/format"; import type { CellValue, Column } from "@openbot/shared/artifacts/kinds"; -import { useState } from "react"; -import { GalleryFrame } from "@/components/gallery/frame"; +import { useContext, useState } from "react"; +import { GalleryFrame, UnboxedFrames } from "@/components/gallery/frame"; import { IconArrowDown, IconArrowsSort, IconArrowUp } from "@/components/icons"; import { Table, @@ -92,6 +92,7 @@ export function ArtifactTable({ }) { const [sort, setSort] = useState(null); const onPaper = useArtifactMedium() === "print"; + const unboxed = useContext(UnboxedFrames); const ordered = sortRows( rows.map((cells, position) => ({ cells, position })), columns, @@ -104,7 +105,11 @@ export function ArtifactTable({ "flex flex-col overflow-hidden", // In its card the table runs to the card's edges, its heading row a strip across it. framed && + !unboxed && "-mx-4 -mb-3 [&_td:first-child]:pl-4 [&_td:last-child]:pr-4 [&_th:first-child>*]:pl-4 [&_th:last-child>*]:pr-4", + // Unboxed, it is drawn as a document's table: no strip, its first column in line with the title. + unboxed && + "[&_td:first-child]:pl-0 [&_td:last-child]:pr-0 [&_th:first-child>*]:pl-0 [&_th:last-child>*]:pr-0", !framed && className, )} data-slot="artifact-table" @@ -115,7 +120,7 @@ export function ArtifactTable({ className={size === "large" ? "text-lg" : undefined} containerClassName="min-h-0 flex-1" > - + {columns.map((column, index) => { const align = alignOf(column); diff --git a/app/src/components/artifacts/kinds/theme.tsx b/app/src/components/artifacts/kinds/theme.tsx index e60b37728f..c5078fcf53 100644 --- a/app/src/components/artifacts/kinds/theme.tsx +++ b/app/src/components/artifacts/kinds/theme.tsx @@ -108,7 +108,6 @@ export function ArtifactThemeScope({ theme, className, surfaceClassName, - paperClassName, children, style, }: { @@ -119,10 +118,6 @@ export function ArtifactThemeScope({ * dashboard or a document then sits on its own ground, not the app's. */ surfaceClassName?: string; - /** - * Classes for when it doesn't: the ground OpenBot gives it, such as a document's paper. - */ - paperClassName?: string; children: ReactNode; style?: CSSProperties; }) { @@ -135,7 +130,7 @@ export function ArtifactThemeScope({

diff --git a/app/src/components/gallery/frame.tsx b/app/src/components/gallery/frame.tsx index d1b20fe44b..2ad2e9b426 100644 --- a/app/src/components/gallery/frame.tsx +++ b/app/src/components/gallery/frame.tsx @@ -1,6 +1,14 @@ -import type { ReactNode } from "react"; +import { createContext, type ReactNode, useContext } from "react"; import { cn } from "@/lib/utils"; +/** + * Inside an artifact a frame draws no card: its title over its content, set apart by space alone. + * An artifact is already one thing on its own page, and a card around each part of it was a box in a + * box: a dashboard of ten parts drew ten edges. In a conversation a frame stays a card, which marks + * it off from the words around it. + */ +export const UnboxedFrames = createContext(false); + export function GalleryFrame({ title, caption, @@ -20,16 +28,24 @@ export function GalleryFrame({ pendingTitle?: boolean; children: ReactNode; }) { + const unboxed = useContext(UnboxedFrames); return (

{(title || action || pendingTitle) && ( -
+
{title ? (

{title}

@@ -45,7 +61,7 @@ export function GalleryFrame({ {action ?
{action}
: null}
)} -
{children}
+
{children}
); } From 4faeea2d7ce11f2284f6bc7d9d2a1b5461ede6c5 Mon Sep 17 00:00:00 2001 From: Atai Barkai Date: Sat, 5 Dec 2026 08:01:03 -0800 Subject: [PATCH 3/9] One light table everywhere a Bot draws one; print and thumbnails follow The light table a conversation's reply drew was styles scoped to the reply ([data-reply-prose]), over Streamdown's framed table: everywhere else (a document, a card, a dashboard's words) kept the grey box, the inner box and the filled heading row. The look now lives in the component: MarkdownTable draws no box, MarkdownTableHead no fill, its edges flush and its figures in even widths, and a heading wraps rather than pushing a column out of sight. The code block's rules apply to every Bot's words, not only a reply's. Documents use the reply's components, with every row shown. The gallery's showTable draws the same table: no inner box, no fill, no stripes, a sort arrow on hover or when sorted; the sort hint is said to a screen reader. On paper a document and a dashboard keep the print page's margins; a dashboard prints on white, and a document's table rows stay whole. Thumbnails draw a dashboard's parts unboxed, as the view does. Co-Authored-By: Claude Opus 5.5 --- app/src/artifact-print/print.css | 3 +- app/src/artifact-print/renderers/registry.tsx | 7 +- .../components/artifacts/kinds/dashboard.tsx | 14 ++- .../components/artifacts/kinds/document.tsx | 18 ++- .../components/artifacts/kinds/markdown.tsx | 32 +----- app/src/components/gallery/table.tsx | 42 +++---- app/src/lib/markdown-table.tsx | 101 +++++++---------- app/src/lib/markdown.tsx | 7 +- app/src/styles.css | 104 +++--------------- 9 files changed, 109 insertions(+), 219 deletions(-) diff --git a/app/src/artifact-print/print.css b/app/src/artifact-print/print.css index d82054525a..93f8b8b91a 100644 --- a/app/src/artifact-print/print.css +++ b/app/src/artifact-print/print.css @@ -132,7 +132,8 @@ thead { @apply px-3 py-2; } -.print-markdown [data-streamdown="table-row"] { +.print-markdown [data-streamdown="table-row"], +.print-markdown.typeset-document tr { break-inside: avoid; } diff --git a/app/src/artifact-print/renderers/registry.tsx b/app/src/artifact-print/renderers/registry.tsx index de6b738afb..5f4e7fa637 100644 --- a/app/src/artifact-print/renderers/registry.tsx +++ b/app/src/artifact-print/renderers/registry.tsx @@ -1,5 +1,4 @@ import type { DashboardFilter } from "@openbot/shared/artifacts/kinds"; -import { IconFilter } from "@/components/icons"; import type { ComponentType } from "react"; import { ArtifactThemeScope, @@ -11,6 +10,7 @@ import { SlideCanvas, } from "@/components/artifacts/kinds"; import { HEADING_FONT } from "@/components/artifacts/kinds/theme"; +import { IconFilter } from "@/components/icons"; import { DASHBOARD_WIDTH, type PrintableContentByKind, @@ -92,10 +92,7 @@ export function filterLine( function PrintDashboard({ title, content }: PrintRendererProps<"dashboard">) { const filters = filterLine(content.filters); return ( - +

- -
{grid}
-
- + + + +
{grid}
+
+
+
); } return ( diff --git a/app/src/components/artifacts/kinds/document.tsx b/app/src/components/artifacts/kinds/document.tsx index 757762cedc..f357d452c4 100644 --- a/app/src/components/artifacts/kinds/document.tsx +++ b/app/src/components/artifacts/kinds/document.tsx @@ -14,6 +14,7 @@ import { cn } from "@/lib/utils"; import { ArtifactChart } from "./chart"; import { MermaidDiagram } from "./diagram"; import { ArtifactMarkdown } from "./markdown"; +import { useArtifactMedium } from "./medium"; import { changeTone, metricText } from "./metric"; import { ArtifactTable } from "./table"; import { ArtifactThemeScope, mergeThemes } from "./theme"; @@ -158,12 +159,15 @@ export function DocumentView({ mode, }: KindViewProps) { const merged = mergeThemes(content.theme, theme); + const onPaper = useArtifactMedium() === "print"; if (mode === "thumbnail") { return (
- + + +
@@ -171,10 +175,14 @@ export function DocumentView({ } return (
( - Tag: Tag, -) { - return function Bare({ - node: _node, - ...props - }: ComponentProps & { node?: unknown }) { - const Element = Tag as "td"; - return )} />; - }; -} - /** * A document's words, set as a page: the typeset rules a Bot's reply is set by (`typeset.css`, tuned - * for a document by `.typeset-document` in styles.css), with headings, lists and tables drawn bare - * so those rules reach them, and a table drawn as part of the page (`DocumentTable`). + * for a document by `.typeset-document` in styles.css), with headings and lists drawn bare so those + * rules reach them, and tables and code as a reply draws them. */ -const DOCUMENT_COMPONENTS = { - ...replyMarkdownComponents, - table: DocumentTable, - thead: bareTablePart("thead"), - tbody: bareTablePart("tbody"), - tr: bareTablePart("tr"), - th: bareTablePart("th"), - td: bareTablePart("td"), -}; - export const DOCUMENT_TYPESET_CLASS = "typeset typeset-reply typeset-document"; export function ArtifactMarkdown({ @@ -88,7 +64,7 @@ export function ArtifactMarkdown({ }, [text]); const components = useMemo( () => ({ - ...(page ? DOCUMENT_COMPONENTS : markdownComponents), + ...(page ? replyMarkdownComponents : markdownComponents), img: ({ src, alt }: ComponentProps<"img">) => ( + {byPosition( Array.from({ length: columns }, (_, position) => position), ).map(({ item: position, key }) => ( @@ -112,20 +106,16 @@ export function DataTable(props: Record) { >
Drawing the table… -
+
- + {PLACEHOLDER_ROWS.map((row) => ( ))}
-
); @@ -168,17 +158,17 @@ export function DataTable(props: Record) { )}
- +
- + {byPosition(columns).map(({ item: column, key }, index) => ( {ordered.map((row) => ( - + {byPosition(columns).map(({ key }, index) => (
{title}. Select a column heading to sort.
) { >
) {
{rows.length > 1 ? ( -

+ // Said to a screen reader; on screen the arrow shows the sort. +

{sort ? `Sorted by ${columns[sort.column]}, ${sort.ascending ? "ascending" : "descending"}.` : "Select a column heading to sort."}

- ) : streaming ? ( -
) : null} ); diff --git a/app/src/lib/markdown-table.tsx b/app/src/lib/markdown-table.tsx index 6531906fbf..06c0253c39 100644 --- a/app/src/lib/markdown-table.tsx +++ b/app/src/lib/markdown-table.tsx @@ -25,9 +25,15 @@ import { cn } from "@/lib/utils"; * alone: asked for a table of links, a person downloaded `| Release | OpenBot release notes |` and * lost every address in it (reported on 1.2.0-rc.4). Streamdown 2.8.1, its newest release, still * reads the text only, and its controls take no way to say how a cell is written out. So the table - * is drawn here: the same wrapper, buttons, menus, icons and fullscreen view, class for class, with - * a link written as `[words](address)` in Markdown and as `words (address)` in CSV and TSV. Its - * body cells sit at the top of their row, where Streamdown's sit in the middle (`CELLS_AT_TOP`). + * is drawn here: the same buttons, menus, icons and fullscreen view, class for class, with a link + * written as `[words](address)` in Markdown and as `words (address)` in CSV and TSV. Its body cells + * sit at the top of their row, where Streamdown's sit in the middle (`CELLS_AT_TOP`). + * + * OUR LOOK, NOT STREAMDOWN'S. Streamdown frames a table in a box inside a box and fills its heading + * row. Here it is part of the words around it, wherever they are drawn (a reply, a document, a card): + * no box and no fill (`MarkdownTableHead`), lines between the rows, the first and last columns in + * line with the text, figures in even widths. A conversation's reply drew it so with styles of its + * own while every other place kept Streamdown's box; the look now lives here, once. * * Everything else follows Streamdown's own table: the `controls` and `tableMaxHeight` a caller * gives Streamdown, the buttons held while a reply is still arriving, and the copy's rich form, @@ -240,7 +246,7 @@ function useMenu() { * icons ignore). */ const BUTTON = - "cursor-pointer rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"; + "inline-grid min-h-7 min-w-7 cursor-pointer place-items-center rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:opacity-50"; const MENU = "absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"; const MENU_ITEM = @@ -255,6 +261,17 @@ const MENU_ITEM = */ const CELLS_AT_TOP = "[&_td]:align-top"; +/** The first and last columns line up with the words above and below the table. */ +const FLUSH_EDGES = + "[&_:is(th,td):first-child]:pl-0 [&_:is(th,td):last-child]:pr-0"; + +/* + * A heading wraps when the table runs out of room, sitting on the line under it. Streamdown keeps a + * heading on one line, so one long heading pushed its column out of sight: a document's table of + * three wordy columns lost its third to a sideways scroll. + */ +const HEADINGS_WRAP = "[&_th]:whitespace-normal [&_th]:align-bottom"; + function Icon({ d, ...props }: SVGProps & { d: string }) { return ( & { node?: unknown }) { + return ( + + ); +} + export function MarkdownTable({ children, className, @@ -609,10 +637,7 @@ export function MarkdownTable({ const showFullscreen = shows(controls, "fullscreen"); return ( -
+
{showCopy || showDownload || showFullscreen ? (
); } - -/** - * A table in a document artifact: drawn as part of the page, not as a box on it. - * - * WHY NOT THE CHAT'S. A reply's table sits in a framed box (a grey ground, a bordered inner box, its - * buttons always above it, its rows cut to `tableMaxHeight`), which marks it off inside a message. - * In a document that box was the heaviest thing on the page: every table a box in a box, its rows - * cut off mid-sentence and a column pushed out of sight. A document's table is set by the typeset - * rules the document's words use: no fill, a hairline under the heading row and between rows, the - * first column in line with the text, every row shown. Copy, Download and Full screen are the same - * buttons as the chat's, over the heading row's end while the pointer is on the table or focus is - * in it, and always on a screen with no pointer. - */ -export function DocumentTable({ - children, - className, - node: _node, - ...props -}: ComponentProps<"table"> & { node?: unknown }) { - const { controls } = useContext(StreamdownContext); - const showCopy = shows(controls, "copy"); - const showDownload = shows(controls, "download"); - const showFullscreen = shows(controls, "fullscreen"); - return ( -
- {showCopy || showDownload || showFullscreen ? ( -
- {showCopy ? : null} - {showDownload ? : null} - {showFullscreen ? ( - - {children} - - ) : null} -
- ) : null} -
-
- {children} -
-
-
- ); -} diff --git a/app/src/lib/markdown.tsx b/app/src/lib/markdown.tsx index e461776ebc..88f06f3a61 100644 --- a/app/src/lib/markdown.tsx +++ b/app/src/lib/markdown.tsx @@ -25,7 +25,11 @@ import { } from "@/components/icons"; import { attachmentAddress } from "@/lib/channels/attachments"; import { apiUrl } from "@/lib/embed/config"; -import { MarkdownTable, TABLE_EXPORT_SKIP } from "@/lib/markdown-table"; +import { + MarkdownTable, + MarkdownTableHead, + TABLE_EXPORT_SKIP, +} from "@/lib/markdown-table"; import { hasMaths, withMathDelimiters } from "@/lib/maths"; import { NO_SLACK_NAMES, @@ -357,6 +361,7 @@ function FileLink({ export const markdownComponents = { // Streamdown's table, whose Copy and Download keep the table's links (`lib/markdown-table.tsx`). table: MarkdownTable, + thead: MarkdownTableHead, a: ({ href, children, ...rest }: ComponentProps<"a">) => { const path = inAppPath(href); const file = path === null ? null : fileAddress(path); diff --git a/app/src/styles.css b/app/src/styles.css index ecd6c58467..6d0c03d0da 100644 --- a/app/src/styles.css +++ b/app/src/styles.css @@ -159,9 +159,7 @@ /* * A document artifact, set by the same rules as a reply (`.typeset-reply`), as a page rather than a - * message: a title the size of a page's, and tables drawn as part of the text (`DocumentTable`). A - * heading row is the muted words the app's own tables head their columns with, and wraps rather than - * pushing a column out of sight; rows are split by hairlines, and nothing is filled. + * message: headings on a page's scale. */ @layer components { .typeset-document :where(h1) { @@ -179,28 +177,6 @@ font-size: 1.125em; margin-block-start: 1.75em; } - - .typeset-document :where(thead th) { - font-size: 0.875em; - font-weight: 500; - color: var(--typeset-muted); - white-space: normal; - vertical-align: bottom; - /* The body's 1em, measured in this smaller type, so a heading lines up with its column. */ - padding: 0 calc(1em / 0.875) 0.6em; - } - - .typeset-document :where(tbody :is(td, th)) { - padding: 0.7em 1em; - } - - .typeset-document :where(th:first-child, td:first-child) { - padding-inline-start: 0; - } - - .typeset-document :where(th:last-child, td:last-child) { - padding-inline-end: 0; - } } /* @@ -214,16 +190,20 @@ } } -/* Embedded code and tables keep to one surface in a conversation's reply. */ -[data-reply-prose] [data-streamdown="code-block"] { +/* + * A code block in a Bot's words, wherever they are drawn (a reply, a document, a card): one surface, + * its body on the block's own ground and its buttons in the header, not a box in a box. Streamdown + * draws the block and its parts; these keep its look to ours. A table's look is its own component's + * (`lib/markdown-table.tsx`). + */ +[data-streamdown="code-block"] { background: var(--card); gap: 0; padding: 0; } -[data-reply-prose] [data-streamdown="code-block-header"], -[data-reply-prose] - [data-streamdown="code-block"] +[data-streamdown="code-block-header"], +[data-streamdown="code-block"] > div:has(> [data-streamdown="code-block-actions"]) { height: 2.5rem; padding-inline: 0.75rem; @@ -231,18 +211,17 @@ /* Streamdown positions its sticky toolbar over a padded header. Match the header * height here so the toolbar stays centered when the outer padding is removed. */ -[data-reply-prose] - [data-streamdown="code-block"] - > div:has(> [data-streamdown="code-block-actions"]) { +[data-streamdown="code-block"] +> div:has(> [data-streamdown="code-block-actions"]) { margin-block-start: -2.5rem; } -[data-reply-prose] [data-streamdown="code-block-body"] { +[data-streamdown="code-block-body"] { background: transparent; border: 0; } -[data-reply-prose] [data-streamdown="code-block-actions"] { +[data-streamdown="code-block-actions"] { background: var(--card); border: 0; gap: 0.25rem; @@ -250,67 +229,18 @@ backdrop-filter: none; } -[data-reply-prose] [data-streamdown="table-wrapper"] { - min-width: 0; - gap: 0; - border: 0; - background: transparent; - padding: 0; -} - -[data-reply-prose] [data-streamdown="table-wrapper"] > div:has(> table) { - border: 0; - border-radius: 0; - background: transparent; -} - -[data-reply-prose] [data-streamdown="table-header"] { - background: transparent; -} - -[data-reply-prose] [data-slot="markdown-table-actions"] + div th { - padding-block-start: 0.125rem; -} - -[data-reply-prose] - :is( - [data-streamdown="code-block-actions"], - [data-slot="markdown-table-actions"] - ) - button:has(> svg) { +[data-streamdown="code-block-actions"] button:has(> svg) { display: inline-grid; min-width: 1.75rem; min-height: 1.75rem; place-items: center; } -/* Figures in a reply's table line up down their column. */ -[data-reply-prose] [data-streamdown="table"] { - font-variant-numeric: tabular-nums; -} - -[data-reply-prose] [data-streamdown="table"] :is(th, td):first-child { - padding-inline-start: 0; -} - -[data-reply-prose] [data-streamdown="table"] :is(th, td):last-child { - padding-inline-end: 0; -} - -[data-reply-prose] - :is([data-streamdown="code-block-actions"], [data-streamdown="table-wrapper"]) - button { +[data-streamdown="code-block-actions"] button { border-radius: var(--radius-md); } -:is( - [data-reply-actions], - [data-reply-prose] - :is( - [data-streamdown="code-block-actions"], - [data-streamdown="table-wrapper"] - ) - ) +:is([data-reply-actions], [data-streamdown="code-block-actions"]) button:focus-visible { outline: 2px solid var(--ring); } From b31d8466949fc9bdb02da6c53e44755a173ebe01 Mon Sep 17 00:00:00 2001 From: Atai Barkai Date: Sat, 5 Dec 2026 08:03:02 -0800 Subject: [PATCH 4/9] Print a document as the screen draws it The print page loaded neither shadcn/typeset nor the app's tuning of it, so a document's headings printed as body text once its words were set by typeset. The rules that set a Bot's Markdown (the reply's and document's typeset tuning, Streamdown's code block) move to bot-markdown.css, which the app and the print page both import. On paper a document's table breaks between rows, not before the table, and prints without the heading fill print.css used to give it. Co-Authored-By: Claude Opus 5.5 --- app/src/artifact-print/print.css | 20 +--- app/src/bot-markdown.css | 155 +++++++++++++++++++++++++++++++ app/src/styles.css | 147 +---------------------------- 3 files changed, 165 insertions(+), 157 deletions(-) create mode 100644 app/src/bot-markdown.css diff --git a/app/src/artifact-print/print.css b/app/src/artifact-print/print.css index 93f8b8b91a..ca9c8314ea 100644 --- a/app/src/artifact-print/print.css +++ b/app/src/artifact-print/print.css @@ -6,6 +6,9 @@ @import "shadcn/tailwind.css"; @import "@fontsource-variable/figtree"; @import "../theme.css"; +/* A document's words are set as on screen: typeset, tuned as the app tunes it. */ +@import "../typeset.css"; +@import "../bot-markdown.css"; /* Streamdown draws the Markdown; Tailwind only ships classes it can see used (see styles.css). */ @source "../../node_modules/streamdown/dist/*.js"; @@ -119,21 +122,8 @@ thead { display: none; } -/* A Markdown table reads like a component table (renderers/table.tsx), a row never split. */ -.print-markdown [data-streamdown="table-header"] { - @apply bg-muted/50; -} - -.print-markdown [data-streamdown="table-header-cell"] { - @apply px-3 py-2 text-xs font-medium text-muted-foreground; -} - -.print-markdown [data-streamdown="table-cell"] { - @apply px-3 py-2; -} - -.print-markdown [data-streamdown="table-row"], -.print-markdown.typeset-document tr { +/* A Markdown table on paper is drawn as on screen (lib/markdown-table.tsx), a row never split. */ +.print-markdown [data-streamdown="table-row"] { break-inside: avoid; } diff --git a/app/src/bot-markdown.css b/app/src/bot-markdown.css new file mode 100644 index 0000000000..45e8b1b1f8 --- /dev/null +++ b/app/src/bot-markdown.css @@ -0,0 +1,155 @@ +/* + * How a Bot's Markdown is set wherever it is drawn: a conversation's reply, a document artifact on + * screen and on paper (artifact-print/print.css imports this too). Read after typeset.css. + */ + +/* + * A Bot's reply in a conversation, set by shadcn/typeset (`replyMarkdownComponents` in + * lib/markdown.tsx draws the prose bare so typeset reaches it). Tuned for a chat column: the + * conversation's size, the one its messages and the composer use, on every window (typeset would set + * it 1.125 times larger on a narrow one, an article's choice that a phone's chat does not need), the + * leading and paragraph spacing of a long read, and headings on the chat's own smaller scale rather + * than an article's. + */ +@layer components { + .typeset-reply { + --typeset-size: var(--text-conversation); + --typeset-leading: 1.7; + --typeset-flow: 1em; + font-size: var(--typeset-size); + } + + .typeset-reply :where(h1) { + font-size: 1.35em; + } + + .typeset-reply :where(h2) { + font-size: 1.2em; + } + + .typeset-reply :where(h3) { + font-size: 1.08em; + } + + /* + * Blocks Streamdown draws as components of its own, which typeset does not know: the same space + * above as a paragraph. + */ + .typeset-reply + > :where( + [data-streamdown="code-block"], + [data-streamdown="table-wrapper"], + [data-streamdown="mermaid-block"], + .katex-display + ) { + margin-block-start: var(--typeset-flow); + } + + /* + * Streamdown's code block is a component with its own `pre`, and typeset's code rules (a muted + * ground, padding, a smaller size) would set what its utilities leave unset. Inside one, code is + * drawn as if typeset were not there. + */ + .typeset-reply + :is([data-streamdown="code-block"], [data-streamdown="mermaid-block"]) + :is(pre, code) { + all: revert-layer; + } +} + +/* + * A document artifact, set by the same rules as a reply (`.typeset-reply`), as a page rather than a + * message: headings on a page's scale. + */ +@layer components { + .typeset-document :where(h1) { + font-size: 1.75em; + line-height: 1.25; + letter-spacing: -0.01em; + } + + .typeset-document :where(h2) { + font-size: 1.3em; + margin-block-start: 2em; + } + + .typeset-document :where(h3) { + font-size: 1.125em; + margin-block-start: 1.75em; + } + + /* + * On paper a table may break between its rows (each row stays whole: print.css). Typeset keeps a + * table on one page, so a long one left the page before it all but empty. + */ + @media print { + .typeset-document :where(table) { + break-inside: auto; + } + } +} + +/* + * Streamdown spaces a reply's blocks with `space-y-4` and the like, utilities, which outrank typeset. + * The blocks' margins go back to what the layers below give them: typeset's, and the block rule just + * above. A first block still starts flush (Streamdown's `[&>*:first-child]:mt-0` is more specific). + */ +@layer utilities { + .typeset-reply > * { + margin-block: revert-layer; + } +} + +/* + * A code block in a Bot's words, wherever they are drawn (a reply, a document, a card): one surface, + * its body on the block's own ground and its buttons in the header, not a box in a box. Streamdown + * draws the block and its parts; these keep its look to ours. A table's look is its own component's + * (`lib/markdown-table.tsx`). + */ +[data-streamdown="code-block"] { + background: var(--card); + gap: 0; + padding: 0; +} + +[data-streamdown="code-block-header"], +[data-streamdown="code-block"] + > div:has(> [data-streamdown="code-block-actions"]) { + height: 2.5rem; + padding-inline: 0.75rem; +} + +/* Streamdown positions its sticky toolbar over a padded header. Match the header + * height here so the toolbar stays centered when the outer padding is removed. */ +[data-streamdown="code-block"] +> div:has(> [data-streamdown="code-block-actions"]) { + margin-block-start: -2.5rem; +} + +[data-streamdown="code-block-body"] { + background: transparent; + border: 0; +} + +[data-streamdown="code-block-actions"] { + background: var(--card); + border: 0; + gap: 0.25rem; + padding: 0; + backdrop-filter: none; +} + +[data-streamdown="code-block-actions"] button:has(> svg) { + display: inline-grid; + min-width: 1.75rem; + min-height: 1.75rem; + place-items: center; +} + +[data-streamdown="code-block-actions"] button { + border-radius: var(--radius-md); +} + +[data-streamdown="code-block-actions"] button:focus-visible { + outline: 2px solid var(--ring); +} diff --git a/app/src/styles.css b/app/src/styles.css index 6d0c03d0da..309691402f 100644 --- a/app/src/styles.css +++ b/app/src/styles.css @@ -7,11 +7,12 @@ @import "./theme.css"; @import "./skins/skins.css"; /* - * shadcn/typeset, for a Bot's reply in a conversation: shadcn's file as published at - * https://ui.shadcn.com/typeset.css. Replace it whole with a newer copy and never edit it; the - * conversation's tuning is `.typeset-reply` below. + * shadcn/typeset, for a Bot's words in a conversation and in a document: shadcn's file as published + * at https://ui.shadcn.com/typeset.css. Replace it whole with a newer copy and never edit it; our + * tuning of it, and of Streamdown's code block, is bot-markdown.css, which the print page shares. */ @import "./typeset.css"; +@import "./bot-markdown.css"; /* * Streamdown draws a Bot's prose, and Tailwind only ships classes it can see used. Its markup lives @@ -103,145 +104,7 @@ } } -/* - * A Bot's reply in a conversation, set by shadcn/typeset (`replyMarkdownComponents` in - * lib/markdown.tsx draws the prose bare so typeset reaches it). Tuned for a chat column: the - * conversation's size, the one its messages and the composer use, on every window (typeset would set - * it 1.125 times larger on a narrow one, an article's choice that a phone's chat does not need), the - * leading and paragraph spacing of a long read, and headings on the chat's own smaller scale rather - * than an article's. - */ -@layer components { - .typeset-reply { - --typeset-size: var(--text-conversation); - --typeset-leading: 1.7; - --typeset-flow: 1em; - font-size: var(--typeset-size); - } - - .typeset-reply :where(h1) { - font-size: 1.35em; - } - - .typeset-reply :where(h2) { - font-size: 1.2em; - } - - .typeset-reply :where(h3) { - font-size: 1.08em; - } - - /* - * Blocks Streamdown draws as components of its own, which typeset does not know: the same space - * above as a paragraph. - */ - .typeset-reply - > :where( - [data-streamdown="code-block"], - [data-streamdown="table-wrapper"], - [data-streamdown="mermaid-block"], - .katex-display - ) { - margin-block-start: var(--typeset-flow); - } - - /* - * Streamdown's code block is a component with its own `pre`, and typeset's code rules (a muted - * ground, padding, a smaller size) would set what its utilities leave unset. Inside one, code is - * drawn as if typeset were not there. - */ - .typeset-reply - :is([data-streamdown="code-block"], [data-streamdown="mermaid-block"]) - :is(pre, code) { - all: revert-layer; - } -} - -/* - * A document artifact, set by the same rules as a reply (`.typeset-reply`), as a page rather than a - * message: headings on a page's scale. - */ -@layer components { - .typeset-document :where(h1) { - font-size: 1.75em; - line-height: 1.25; - letter-spacing: -0.01em; - } - - .typeset-document :where(h2) { - font-size: 1.3em; - margin-block-start: 2em; - } - - .typeset-document :where(h3) { - font-size: 1.125em; - margin-block-start: 1.75em; - } -} - -/* - * Streamdown spaces a reply's blocks with `space-y-4` and the like, utilities, which outrank typeset. - * The blocks' margins go back to what the layers below give them: typeset's, and the block rule just - * above. A first block still starts flush (Streamdown's `[&>*:first-child]:mt-0` is more specific). - */ -@layer utilities { - .typeset-reply > * { - margin-block: revert-layer; - } -} - -/* - * A code block in a Bot's words, wherever they are drawn (a reply, a document, a card): one surface, - * its body on the block's own ground and its buttons in the header, not a box in a box. Streamdown - * draws the block and its parts; these keep its look to ours. A table's look is its own component's - * (`lib/markdown-table.tsx`). - */ -[data-streamdown="code-block"] { - background: var(--card); - gap: 0; - padding: 0; -} - -[data-streamdown="code-block-header"], -[data-streamdown="code-block"] - > div:has(> [data-streamdown="code-block-actions"]) { - height: 2.5rem; - padding-inline: 0.75rem; -} - -/* Streamdown positions its sticky toolbar over a padded header. Match the header - * height here so the toolbar stays centered when the outer padding is removed. */ -[data-streamdown="code-block"] -> div:has(> [data-streamdown="code-block-actions"]) { - margin-block-start: -2.5rem; -} - -[data-streamdown="code-block-body"] { - background: transparent; - border: 0; -} - -[data-streamdown="code-block-actions"] { - background: var(--card); - border: 0; - gap: 0.25rem; - padding: 0; - backdrop-filter: none; -} - -[data-streamdown="code-block-actions"] button:has(> svg) { - display: inline-grid; - min-width: 1.75rem; - min-height: 1.75rem; - place-items: center; -} - -[data-streamdown="code-block-actions"] button { - border-radius: var(--radius-md); -} - -:is([data-reply-actions], [data-streamdown="code-block-actions"]) - button:focus-visible { +[data-reply-actions] button:focus-visible { outline: 2px solid var(--ring); } From 31f957187514ec72c5950f442cb44c5160ef539d Mon Sep 17 00:00:00 2001 From: Atai Barkai Date: Sat, 5 Dec 2026 08:03:20 -0800 Subject: [PATCH 5/9] Drop the reply's data-reply-prose mark, which nothing reads now Co-Authored-By: Claude Opus 5.5 --- app/src/components/channels/chat-transcript.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/channels/chat-transcript.tsx b/app/src/components/channels/chat-transcript.tsx index 583662c2c6..931217caa6 100644 --- a/app/src/components/channels/chat-transcript.tsx +++ b/app/src/components/channels/chat-transcript.tsx @@ -1364,7 +1364,7 @@ const TranscriptMessage = memo(function TranscriptMessage({ * closing token arrives, so the answer visibly rewrites itself as it lands. This * closes them for the duration. */ -
+
{report ? ( /* * A task the Bot handed out, saying how it went: its words, framed with the From 3522be3f368d3534bd1cbc7c749873c891f5f004 Mon Sep 17 00:00:00 2001 From: Atai Barkai Date: Sat, 5 Dec 2026 08:13:37 -0800 Subject: [PATCH 6/9] Comments panel test: the empty state is one line now Co-Authored-By: Claude Opus 5.5 --- app/tests/artifact-comments-panel.test.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/tests/artifact-comments-panel.test.tsx b/app/tests/artifact-comments-panel.test.tsx index 97f6686692..ecda58b5fa 100644 --- a/app/tests/artifact-comments-panel.test.tsx +++ b/app/tests/artifact-comments-panel.test.tsx @@ -164,7 +164,11 @@ async function draw(props: Partial = {}) { test("with no threads it says how the first one arrives, and a comment is left on the version on screen", async () => { const { view, person } = await draw(); - expect(await view.findByText("No comments yet")).toBeTruthy(); + expect( + await view.findByText( + "No comments yet. Select something in the artifact to comment on it.", + ), + ).toBeTruthy(); await person.type(view.getByLabelText("New comment"), "Looks good"); await person.click(view.getByRole("button", { name: "Comment" })); await waitFor(() => expect(writes).toHaveLength(1)); @@ -317,7 +321,7 @@ test("Send to Bot sends to the artifact's Bot by default or to one picked, and s test("a thread that failed says so, and the panel reads again when the socket says comments changed", async () => { threads = []; const { view } = await draw(); - await view.findByText("No comments yet"); + await view.findByText(/^No comments yet\./); threads = [ thread({ botRequest: { From e6739addc3d492b26658a5999fe64a57dd7c6d5b Mon Sep 17 00:00:00 2001 From: Atai Barkai Date: Sat, 5 Dec 2026 08:15:16 -0800 Subject: [PATCH 7/9] Dashboard: gaps that fit a phone, roomy on a wide screen A 12-column grid with 40px between columns needs 440px for its gaps alone, so at 390px a dashboard's figures scrolled sideways. The gaps are 16px and 32px until the dashboard is wide (@3xl), then 40px and 48px. Co-Authored-By: Claude Opus 5.5 --- app/src/components/artifacts/kinds/dashboard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/artifacts/kinds/dashboard.tsx b/app/src/components/artifacts/kinds/dashboard.tsx index 3308a1ccde..d32a89f4fc 100644 --- a/app/src/components/artifacts/kinds/dashboard.tsx +++ b/app/src/components/artifacts/kinds/dashboard.tsx @@ -265,7 +265,7 @@ export function DashboardView({ const grid = (
{widgets.map((widget) => { From 946c39f86ef6faa2df2d8a5f7213e7ffb894caab Mon Sep 17 00:00:00 2001 From: Atai Barkai Date: Sat, 5 Dec 2026 08:57:09 -0800 Subject: [PATCH 8/9] Table full screen in the same look; the look test compares with it The full-screen table drew Streamdown's bordered table; it now has the inline table's look, and its Exit button the size of Copy and Download. table-export-browser compared OpenBot's table pixel for pixel with Streamdown's own; it now compares it with Streamdown's table in OpenBot's look, the styles a reply laid over it before the look moved into the component (OPENBOT_LOOK in the fixture), inline and full screen. Co-Authored-By: Claude Opus 5.5 --- app/src/lib/markdown-table.tsx | 6 ++-- app/tests/table-export-browser.fixture.tsx | 35 +++++++++++++++++----- app/tests/table-export-browser.test.tsx | 7 +++-- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/app/src/lib/markdown-table.tsx b/app/src/lib/markdown-table.tsx index 06c0253c39..122441a32d 100644 --- a/app/src/lib/markdown-table.tsx +++ b/app/src/lib/markdown-table.tsx @@ -531,7 +531,7 @@ function Fullscreen({ {showCopy ? : null} {showDownload ? : null}