Replace hardcoded slate-* classes with theme-aware sb-* utilities

WaveformViewer, SchematicViewer, and SimulationLog now use CSS
variable-backed utility classes (bg-sb-surface, text-sb-muted,
border-sb-border, etc.) instead of hardcoded Tailwind slate colors.
Light mode embed theme now works through the variable system rather
than brute-force class overrides in embed-theme.css.
This commit is contained in:
Ryan Malloy 2026-03-05 19:26:23 -07:00
parent c86bb6e9f0
commit a2b76539da
4 changed files with 19 additions and 47 deletions

View File

@ -192,20 +192,20 @@ export function SchematicViewer({ svg, componentMap, onValueChange }: SchematicV
); );
return ( return (
<div className={cn('relative', isFullscreen && 'fixed inset-0 z-50 bg-slate-950 flex flex-col')}> <div className={cn('relative', isFullscreen && 'fixed inset-0 z-50 bg-sb-bg flex flex-col')}>
{/* Toolbar */} {/* Toolbar */}
<div className="flex items-center gap-1 px-3 py-1.5 border-b border-slate-700/50 bg-slate-800/50"> <div className="flex items-center gap-1 px-3 py-1.5 border-b border-sb-border/50 bg-sb-cell/50">
<button <button
onClick={zoomOut} onClick={zoomOut}
disabled={zoomIndex === 0} disabled={zoomIndex === 0}
className="p-1 rounded text-slate-400 hover:text-slate-200 hover:bg-slate-700/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors" className="p-1 rounded text-sb-muted hover:text-sb-text hover:bg-sb-border/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors"
title="Zoom out" title="Zoom out"
> >
<ZoomOut className="w-3.5 h-3.5" /> <ZoomOut className="w-3.5 h-3.5" />
</button> </button>
<button <button
onClick={fitToWidth} onClick={fitToWidth}
className="text-xs text-slate-500 hover:text-slate-300 tabular-nums w-10 text-center transition-colors" className="text-xs text-sb-muted hover:text-sb-text tabular-nums w-10 text-center transition-colors"
title="Reset to 100%" title="Reset to 100%"
> >
{Math.round(zoom * 100)}% {Math.round(zoom * 100)}%
@ -213,14 +213,14 @@ export function SchematicViewer({ svg, componentMap, onValueChange }: SchematicV
<button <button
onClick={zoomIn} onClick={zoomIn}
disabled={zoomIndex === ZOOM_STEPS.length - 1} disabled={zoomIndex === ZOOM_STEPS.length - 1}
className="p-1 rounded text-slate-400 hover:text-slate-200 hover:bg-slate-700/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors" className="p-1 rounded text-sb-muted hover:text-sb-text hover:bg-sb-border/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors"
title="Zoom in" title="Zoom in"
> >
<ZoomIn className="w-3.5 h-3.5" /> <ZoomIn className="w-3.5 h-3.5" />
</button> </button>
<button <button
onClick={toggleFullscreen} onClick={toggleFullscreen}
className="p-1 rounded text-slate-400 hover:text-slate-200 hover:bg-slate-700/50 transition-colors" className="p-1 rounded text-sb-muted hover:text-sb-text hover:bg-sb-border/50 transition-colors"
title={isFullscreen ? 'Exit fullscreen (Esc)' : 'Fullscreen'} title={isFullscreen ? 'Exit fullscreen (Esc)' : 'Fullscreen'}
> >
{isFullscreen ? ( {isFullscreen ? (
@ -231,13 +231,13 @@ export function SchematicViewer({ svg, componentMap, onValueChange }: SchematicV
</button> </button>
<div className="flex-1" /> <div className="flex-1" />
{componentMap && Object.keys(componentMap).length > 0 && ( {componentMap && Object.keys(componentMap).length > 0 && (
<span className="text-[10px] text-slate-600 mr-2"> <span className="text-[10px] text-sb-muted mr-2">
click values to edit click values to edit
</span> </span>
)} )}
<button <button
onClick={downloadSvg} onClick={downloadSvg}
className="flex items-center gap-1 px-2 py-1 rounded text-xs text-slate-400 hover:text-slate-200 hover:bg-slate-700/50 transition-colors" className="flex items-center gap-1 px-2 py-1 rounded text-xs text-sb-muted hover:text-sb-text hover:bg-sb-border/50 transition-colors"
title="Download SVG" title="Download SVG"
> >
<Download className="w-3.5 h-3.5" /> <Download className="w-3.5 h-3.5" />

View File

@ -16,7 +16,7 @@ function highlightLine(line: string): { text: string; className: string } {
if (lower.includes('warning') || lower.includes('warn')) { if (lower.includes('warning') || lower.includes('warn')) {
return { text: line, className: 'text-amber-400' }; return { text: line, className: 'text-amber-400' };
} }
return { text: line, className: 'text-slate-400' }; return { text: line, className: 'text-sb-muted' };
} }
export function SimulationLog({ export function SimulationLog({
@ -33,9 +33,9 @@ export function SimulationLog({
const lines = log.split('\n').filter((l) => l.trim().length > 0); const lines = log.split('\n').filter((l) => l.trim().length > 0);
return ( return (
<div className="border-t border-slate-700/50"> <div className="border-t border-sb-border/50">
<button <button
className="flex items-center gap-2 w-full px-3 py-2 text-xs text-slate-500 hover:text-slate-400 transition-colors" className="flex items-center gap-2 w-full px-3 py-2 text-xs text-sb-muted hover:text-sb-text transition-colors"
onClick={() => setOpen(!open)} onClick={() => setOpen(!open)}
> >
{open ? ( {open ? (

View File

@ -290,7 +290,7 @@ export function WaveformViewer({ waveform, className }: WaveformViewerProps) {
className={cn( className={cn(
'relative', 'relative',
className, className,
isFullscreen && 'fixed inset-0 z-50 bg-slate-900 flex flex-col', isFullscreen && 'fixed inset-0 z-50 bg-sb-surface flex flex-col',
)} )}
> >
{/* Control buttons */} {/* Control buttons */}
@ -299,14 +299,14 @@ export function WaveformViewer({ waveform, className }: WaveformViewerProps) {
className={cn( className={cn(
'flex items-center gap-1 z-10', 'flex items-center gap-1 z-10',
isFullscreen isFullscreen
? 'px-4 py-2 justify-end border-b border-slate-700/50' ? 'px-4 py-2 justify-end border-b border-sb-border/50'
: 'absolute top-1 right-1', : 'absolute top-1 right-1',
)} )}
> >
<button <button
type="button" type="button"
onClick={toggleFullscreen} onClick={toggleFullscreen}
className="p-1 rounded text-slate-400 hover:text-slate-200 hover:bg-slate-700/50 transition-colors" className="p-1 rounded text-sb-muted hover:text-sb-text hover:bg-sb-border/50 transition-colors"
title={isFullscreen ? 'Exit fullscreen (Esc)' : 'Fullscreen'} title={isFullscreen ? 'Exit fullscreen (Esc)' : 'Fullscreen'}
> >
{isFullscreen ? ( {isFullscreen ? (
@ -318,7 +318,7 @@ export function WaveformViewer({ waveform, className }: WaveformViewerProps) {
<button <button
type="button" type="button"
onClick={toggleScope} onClick={toggleScope}
className="p-1 rounded hover:bg-slate-700/50 transition-colors" className="p-1 rounded hover:bg-sb-border/50 transition-colors"
aria-label={scopeMode ? 'Exit oscilloscope view' : 'Switch to oscilloscope view'} aria-label={scopeMode ? 'Exit oscilloscope view' : 'Switch to oscilloscope view'}
title={scopeMode ? 'Standard view' : 'Oscilloscope view'} title={scopeMode ? 'Standard view' : 'Oscilloscope view'}
> >
@ -330,7 +330,7 @@ export function WaveformViewer({ waveform, className }: WaveformViewerProps) {
{/* Plot area */} {/* Plot area */}
<div className={cn(isFullscreen && 'flex-1 min-h-0 px-4 pb-4')}> <div className={cn(isFullscreen && 'flex-1 min-h-0 px-4 pb-4')}>
{isEmpty ? ( {isEmpty ? (
<div className="text-slate-500 text-sm py-4 text-center"> <div className="text-sb-muted text-sm py-4 text-center">
No waveform data to display. No waveform data to display.
</div> </div>
) : scopeMode ? ( ) : scopeMode ? (

View File

@ -116,34 +116,6 @@ html.light ::-webkit-scrollbar-thumb:hover {
background: #94a3b8; background: #94a3b8;
} }
/* Shared component overrides for light embed mode. /* Previous workaround overrides for hardcoded slate utilities removed
Targets hardcoded Tailwind slate utilities in SchematicViewer WaveformViewer, SchematicViewer, and SimulationLog now use
and SimulationLog without modifying the shared components. */ theme-aware sb-* utility classes directly. */
html.light .border-slate-700\/50 {
border-color: #e2e8f0;
}
html.light .bg-slate-800\/50 {
background-color: rgba(241, 245, 249, 0.8);
}
html.light .text-slate-400 {
color: #64748b;
}
html.light .text-slate-500 {
color: #64748b;
}
html.light .text-slate-600 {
color: #475569;
}
html.light .hover\:text-slate-200:hover {
color: #1e293b;
}
html.light .hover\:bg-slate-700\/50:hover {
background-color: rgba(226, 232, 240, 0.5);
}