An open source design system that's fully customizable and agent ready
TypeScript
fix(CodeBlock): promote highlightMode to public API, fix perf page (#1325)
Cindy Zhang33508925d306
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/codeblock-perf/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/codeblock-perf/page.tsxindex e1c77c38d1..22a24ab8e9 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/codeblock-perf/page.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/codeblock-perf/page.tsx@@ -298,6 +298,7 @@ function PerfPanel({title={`${lineCount.toLocaleString()} lines`}hasLineNumbersmaxHeight={maxHeight}+ highlightMode={mode}/></div></XDSVStack>diff --git a/packages/core/src/CodeBlock/XDSCodeBlock.tsx b/packages/core/src/CodeBlock/XDSCodeBlock.tsxindex 72b5cecd98..c9ffdc2148 100644--- a/packages/core/src/CodeBlock/XDSCodeBlock.tsx+++ b/packages/core/src/CodeBlock/XDSCodeBlock.tsx@@ -316,15 +316,13 @@ export interface XDSCodeBlockProps extends XDSBaseProps<HTMLPreElement> {code: string,language: string,) => Array<{type: string; start: number; end: number}>;-}--/**- * Internal-only props for testing and performance tuning.- * Not part of the public API — used by the sandbox perf page.- * @internal- */-interface XDSCodeBlockInternalProps extends XDSCodeBlockProps {- /** @internal Force a specific highlighting strategy. */+ /**+ * Highlighting strategy.+ * - `'auto'` — uses CSS Custom Highlight API when available, falls back to spans+ * - `'ranges'` — force CSS Custom Highlight API (no-op if unsupported)+ * - `'spans'` — force span-based rendering+ * @default 'auto'+ */highlightMode?: 'auto' | 'ranges' | 'spans';}@@ -605,7 +603,7 @@ export function XDSCodeBlock({style,ref,...props-}: XDSCodeBlockInternalProps) {+}: XDSCodeBlockProps) {const [copied, setCopied] = useState(false);const useSpans =