refactor(webui): unify code and diff highlighting (#6412)
* refactor(webui): unify code and diff highlighting Replace Prism with shared Highlights tokens and Pierre read-only diffs, retaining rare grammars through lazy Shiki and preserving source, copy, preview and diff controls. Restore single-session Composer ownership inside the conversation column while retaining the shared multi-pane footer. Keep the measured large-diff scroll regression explicit during review. * fix(webui): contain highlighting errors and retain diff selections Refs NAN-343 * test(webui): align pane fixtures after main rebase * chore(webui): update highlighting dependencies Keep grammar fallback coverage on a language that still requires Shiki, and align reading-size assertions with main.
This commit is contained in:
1 parent
f5c359476b
commit
3a37269f3f
44 files changed
+2261
-1072
No files matched your search
+27
-32
@@ -987,11 +987,6 @@
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* Prism's Markdown table tokens must not pick up Tailwind's table layout. */
|
||||
.not-prose pre .token.table {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Markdown table cells retain whole-word minimum widths. The renderer's
|
||||
overflow-x:auto wrapper contains tables wider than the preview or chat. */
|
||||
|
||||
@@ -1877,35 +1872,35 @@
|
||||
to { transform: translateX(100%); }
|
||||
}
|
||||
|
||||
/* Prism classes are generated at runtime, outside Tailwind's source inventory. */
|
||||
.code-content {
|
||||
--code-foreground: hsl(var(--foreground));
|
||||
--code-background: hsl(var(--background));
|
||||
color: hsl(var(--foreground));
|
||||
}
|
||||
/* Flattened JSX tokens retain the ancestor tag class; let inner token types win. */
|
||||
.code-content .token.tag {
|
||||
color: var(--code-property);
|
||||
|
||||
.nanobot-file-diff {
|
||||
--code-foreground: hsl(var(--foreground));
|
||||
--code-background: hsl(var(--background));
|
||||
display: block;
|
||||
min-width: 0;
|
||||
--diffs-font-size: var(--text-code-dense-size);
|
||||
--diffs-line-height: calc(var(--text-code-dense-size) * 1.6);
|
||||
--diffs-gap-block: 0px;
|
||||
--diffs-bg-context-override: transparent;
|
||||
--diffs-bg-context-gutter-override: transparent;
|
||||
--diffs-bg-addition-override: var(--diff-added);
|
||||
--diffs-bg-addition-number-override: var(--diff-added);
|
||||
--diffs-bg-deletion-override: var(--diff-deleted);
|
||||
--diffs-bg-deletion-number-override: var(--diff-deleted);
|
||||
--diffs-addition-color-override: var(--diff-added-foreground);
|
||||
--diffs-deletion-color-override: var(--diff-deleted-foreground);
|
||||
--diffs-fg-number-override: hsl(var(--muted-foreground));
|
||||
--diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--diff-added-foreground) 15%, transparent);
|
||||
--diffs-bg-deletion-emphasis-override: color-mix(in srgb, var(--diff-deleted-foreground) 15%, transparent);
|
||||
}
|
||||
.code-content :is(.token.comment, .token.prolog, .token.doctype, .token.cdata, .linenumber) {
|
||||
color: var(--code-comment);
|
||||
}
|
||||
.code-content .token.comment {
|
||||
font-style: italic;
|
||||
}
|
||||
.code-content :is(.token.string, .token.char, .token.attr-value, .token.regex, .token.inserted) {
|
||||
color: var(--code-string);
|
||||
}
|
||||
.code-content :is(.token.keyword, .token.selector, .token.important, .token.atrule) {
|
||||
color: var(--code-keyword);
|
||||
}
|
||||
.code-content :is(.token.function, .token.operator, .token.entity, .token.url) {
|
||||
color: var(--code-function);
|
||||
}
|
||||
.code-content :is(.token.number, .token.boolean, .token.constant, .token.symbol, .token.attr-name, .token.class-name, .token.builtin, .token.property, .token.deleted) {
|
||||
color: var(--code-property);
|
||||
}
|
||||
.code-content :is(.token.bold, .token.important) {
|
||||
font-weight: 600;
|
||||
}
|
||||
.code-content .token.italic {
|
||||
font-style: italic;
|
||||
|
||||
.nanobot-diff-gap {
|
||||
height: 26px;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
Reference in new issue
Block a user