Repository navigation
feat(apollo-wind): compact density for the chat primitives - #1403
Draft
BenGSchulz wants to merge 1 commit into
Draft
BenGSchulz wants to merge 1 commit into
BenGSchulz wants to merge 1 commit into
Conversation
Material's spacing.compactMode shrinks the chat's type and spacing, and the Wind chat marks compact mode with data-density="compact" on its root. The chat primitives now follow that attribute on any ancestor, with no prop plumbing. Root-level sizes read CSS variables whose fallbacks are today's values (gap-(--markdown-gap,0.75rem) and so on), and an in-data-[density=compact] variant sets the variables. A host className on the root replaces the variable-reading class, so it wins in both densities, and the default computed styles are unchanged. Nested elements (headings, lists, the thinking icon, avatar offsets) use the variant directly. - Markdown: body, lists and tables 14px to 12px, each heading one step down. Wind's own choices: an 18px line (Material uses 16px; this keeps the comfortable ratio) and tighter block, list and quote spacing (Material keeps 24px). - CodeBlock: source 13px on 20.8px to 12px on 18px, as Material's compact code renders, through two variables since the Prism style is inline. The header stays, as in Material. Code blocks in a ToolCall shrink too, which Material's do not. - Message and Bubble: text 14px to 12px, gaps between a group's messages and a message's parts halved, avatar offsets adjusted. Bubble padding stays, as in Material. - ThinkingIndicator and Citation: the sm look when no size is given. - Sources: items 14px to 12px. - ChatComposer: compact under any compact ancestor when no density prop is given; the prop wins. Only that ancestor's attribute is watched. MessageActions, ToolCall, DisclosureTree and Attachment are otherwise unchanged: Material's compact mode does not touch their counterparts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Dependency License Review
License distribution
Excluded packages
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MST-16573, part of the Wind chat epic MST-16172. Stacked on #1402 (chat primitive gaps), which is stacked on #1400 (math fences). This is the last PR of the apollo-wind stack.
Material's
spacing.compactModeshrinks the chat's type and spacing. The Wind chat marks compact mode withdata-density="compact"on its root. The apollo-wind chat primitives now follow that attribute on any ancestor, with no prop plumbing.Mechanism and contract
in-data-[density=compact]:variant, which compiles to:where(*[data-density="compact"]) &(checked with Tailwind 4.1.17, the build's version, and 4.3.0, the test runner's).gap-(--markdown-gap,0.75rem) text-(length:--markdown-font-size,0.875rem) leading-(--markdown-leading,1.625), and the compact variant only sets the variables (in-data-[density=compact]:[--markdown-gap:0.5rem]). A host class such asgap-1replaces the variable-reading class throughcn()(tailwind-merge groups them; tested), so the compact value has nothing to change. The Wind chat'sMessageContent className="gap-0"andMarkdown className="gap-1 text-xs leading-4"keep working.densityprop it is compact under any compact ancestor, like the CSS variant. Only that ancestor's attribute is watched; an ancestor that gains the attribute later is picked up on the next render. The prop wins.smlook in compact only when nosizeis given.Material to Wind mapping
smpill (10px), no size givendensitypropTicket claims corrected
The brief asked for a shorter code block header and smaller copy button, reduced bubble padding, smaller MessageActions controls, and possibly smaller ToolCall, DisclosureTree and Attachment gaps. Material's compact mode does none of these:
compactMode; only the code font changes.compactMode; only the type and the two message gaps change.3xs, notmd, and Material's action bar ignores compact mode.compactMode.So these stay unchanged.
Wind-only choices
What the Wind chat needs to do
Nothing for compact beyond the
data-densityattribute it already sets on its root. It may drop thedensityprop it passes to the composer.Stories
compactarg (off by default, so the default canvas is unchanged) that setsdata-density="compact"on the panel and lets the footer composer take its density from the panel.Markdown/CompactDensity(default and compact side by side, with a wide table and a long code line) andCodeBlock/CompactDensity.Tests
:where(*[data-density="compact"]).gap-1 text-xs leading-4on Markdown andgap-0on MessageContent replace the variable-reading classes inside a compact ancestor.gap-(--x,…),text-(length:--x,…),leading-(--x,…)andh-(--x,…)with their plain counterparts.comfortable, and the prop wins.tsc --noEmit, the full apollo-wind suite andpnpm --filter @uipath/apollo-wind build.🤖 Generated with Claude Code