feat(V2-1c): packages/ui 추출 — DS 컴포넌트 + theme + theme-vars 분리

packages/ui (@d3ro/ui) 신규:
- src/theme.ts (d3roPalette/d3roTypo/d3roShadow/d3roRadius SSOT)
- src/theme-vars.ts (팝업/main 프로세스용 CSS 변수 맵)
- src/components/ds/ (CrtDisplay, InstrumentPanel, Led, MetalCard,
  MetalDial, PhosphorText, PhysicalButton, ScreenPanel, ButtonGroup)
- src/index.ts barrel
- subpath exports: ./theme, ./theme-vars, ./components/ds
- React/MUI/Emotion은 peerDependencies로 선언
- @d3ro/core만 직접 의존성

apps/desktop/src/shared/ 디렉토리 완전 제거:
- theme-vars가 마지막 남은 파일이었음
- tsconfig include에서 src/shared/**/* 제거

일괄 치환 (renderer 전역):
- ../theme, ../../theme, ./theme → @d3ro/ui/theme
- ../components/ds, ../../components/ds, ./ds, ../ds → @d3ro/ui/components/ds
- ../ds/<Component>, ../../ds/<Component> → @d3ro/ui/components/ds
  (세부 파일 import는 barrel로 통합)
- @shared/theme-vars → @d3ro/ui/theme-vars (WindowManager)

apps/desktop 설정:
- package.json: @d3ro/ui: '*' dep 추가
- tsconfig.node/web.json: @shared/* paths 완전 제거, @d3ro/ui,
  @d3ro/ui/* paths 추가
- electron.vite.config.ts: @shared alias 제거, @d3ro/ui alias 추가,
  externalize exclude에 @d3ro/ui 추가
- vitest.config.ts: alias 교체

DS 컴포넌트 내부의 '../../theme' 상대 경로는 packages/ui 구조에서
동일하게 해결되어 그대로 유효.

검증: typecheck + build + dev 런타임 모두 통과.
This commit is contained in:
yunchan8804 2026-04-08 14:50:33 +09:00
parent 3b0eb3393b
commit a041f1b6a9
56 changed files with 191 additions and 76 deletions

View file

@ -0,0 +1,30 @@
// src/renderer/components/ds/ButtonGroup.tsx
// 시안 A: 인셋 버튼 클러스터 — 레퍼런스의 .button-group 패턴
// 물리 버튼들을 인셋 패널 안에 배치하여 그룹화
import { Box } from '@mui/material'
import { d3roPalette, d3roShadow, d3roRadius } from '../../theme'
interface ButtonGroupProps {
children: React.ReactNode
/** 가로 배치 (기본 세로) */
horizontal?: boolean
}
export function ButtonGroup({ children, horizontal = false }: ButtonGroupProps): React.ReactElement {
return (
<Box
sx={{
bgcolor: d3roPalette.bg.inset,
p: '6px',
borderRadius: d3roRadius.inner,
boxShadow: d3roShadow.inset,
display: 'flex',
flexDirection: horizontal ? 'row' : 'column',
gap: '6px',
}}
>
{children}
</Box>
)
}

View file

@ -0,0 +1,298 @@
// src/renderer/components/ds/CrtDisplay.tsx
// 시안 A: CRT 디스플레이 — WebGL 셰이더 (스캔라인, 비네팅, 노이즈, 글리치, 파형)
import { useRef, useEffect, useCallback } from 'react'
import { Box } from '@mui/material'
import { useTheme } from '@mui/material/styles'
import { d3roPalette, d3roFontMono, d3roShadow } from '../../theme'
// ── WebGL 유틸 ─────────────────────────────────────────
function createShader(gl: WebGLRenderingContext, type: number, source: string): WebGLShader | null {
const shader = gl.createShader(type)
if (!shader) return null
gl.shaderSource(shader, source)
gl.compileShader(shader)
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
gl.deleteShader(shader)
return null
}
return shader
}
function createProgram(gl: WebGLRenderingContext, vsSource: string, fsSource: string): WebGLProgram | null {
const vs = createShader(gl, gl.VERTEX_SHADER, vsSource)
const fs = createShader(gl, gl.FRAGMENT_SHADER, fsSource)
if (!vs || !fs) return null
const prog = gl.createProgram()
if (!prog) return null
gl.attachShader(prog, vs)
gl.attachShader(prog, fs)
gl.linkProgram(prog)
return prog
}
const VERTEX_SHADER = `
attribute vec2 position;
varying vec2 vUv;
void main() {
gl_Position = vec4(position, 0.0, 1.0);
vUv = position * 0.5 + 0.5;
}
`
const FRAGMENT_SHADER = `
precision highp float;
varying vec2 vUv;
uniform float u_time;
uniform float u_glitch;
uniform float u_amp;
uniform float u_freq;
float random(vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123); }
void main() {
vec2 uv = vUv;
// Glitch displacement
if (u_glitch > 0.0) {
float gOffset = (random(vec2(uv.y * 5.0, u_time)) - 0.5) * u_glitch * 0.1;
uv.x += gOffset;
}
// Base phosphor background
vec3 color = vec3(0.02, 0.015, 0.01);
// Background Grid
float gridX = step(0.98, fract(uv.x * 15.0));
float gridY = step(0.98, fract(uv.y * 10.0));
color += vec3(0.1, 0.04, 0.02) * max(gridX, gridY) * (1.0 - u_glitch);
// Oscilloscope Waveform
float t = u_time * 0.5 + u_glitch * random(uv) * 0.1;
float waveY = sin((uv.x * u_freq) + t) * u_amp;
float waveDist = abs((uv.y - 0.5) - waveY);
float lineThick = 0.005 + (u_glitch * 0.02);
float waveGlow = smoothstep(lineThick * 4.0, 0.0, waveDist);
float waveCore = smoothstep(lineThick, 0.0, waveDist);
// Amber wave (#f25b29)
vec3 waveColor = vec3(0.95, 0.35, 0.16);
color += waveColor * waveCore;
color += waveColor * 0.4 * waveGlow;
// Scanlines
float scanline = sin(uv.y * 800.0 - u_time * 10.0) * 0.04;
color -= scanline;
// Noise
float noise = random(uv + u_time) * 0.08;
color += noise;
// Vignette
float dist = distance(vUv, vec2(0.5));
float vig = smoothstep(0.8, 0.4, dist);
color *= vig;
// Edge darkening
color *= smoothstep(0.0, 0.02, vUv.x) * smoothstep(1.0, 0.98, vUv.x);
color *= smoothstep(0.0, 0.05, vUv.y) * smoothstep(1.0, 0.95, vUv.y);
gl_FragColor = vec4(color, 1.0);
}
`
const QUAD = new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
// ── Props ──────────────────────────────────────────────
interface CrtDisplayProps {
/** 파형 진폭 (0.0 ~ 1.0) */
amplitude?: number
/** 파형 주파수 */
frequency?: number
/** 글리치 트리거 (변경 시 글리치 발생) */
glitchTrigger?: number
/** 실시간 오디오 레벨 (0.0~1.0) — 파형 진폭에 반영 */
audioLevel?: number
/** 오버레이 콘텐츠 (인광 텍스트 등) */
children?: React.ReactNode
/** 높이 (기본 280px) */
height?: number | string
}
export function CrtDisplay({
amplitude = 0.1,
frequency = 8.0,
glitchTrigger = 0,
audioLevel = 0,
children,
height = 280,
}: CrtDisplayProps): React.ReactElement {
const theme = useTheme()
const isLight = theme.palette.mode === 'light'
const canvasRef = useRef<HTMLCanvasElement>(null)
const glRef = useRef<{
gl: WebGLRenderingContext
uTime: WebGLUniformLocation | null
uGlitch: WebGLUniformLocation | null
uAmp: WebGLUniformLocation | null
uFreq: WebGLUniformLocation | null
} | null>(null)
const animRef = useRef<number>(0)
const startTimeRef = useRef(Date.now())
const glitchRef = useRef(0)
const ampRef = useRef(amplitude)
const freqRef = useRef(frequency)
const audioLevelRef = useRef(audioLevel)
const currentAmpRef = useRef(amplitude)
const currentFreqRef = useRef(frequency)
// amplitude/frequency/audioLevel 변경 추적
useEffect(() => {
ampRef.current = amplitude
freqRef.current = frequency
}, [amplitude, frequency])
useEffect(() => {
audioLevelRef.current = audioLevel
}, [audioLevel])
// 글리치 트리거
useEffect(() => {
if (glitchTrigger > 0) {
glitchRef.current = 1.0
}
}, [glitchTrigger])
const render = useCallback(() => {
const ctx = glRef.current
if (!ctx) return
const { gl, uTime, uGlitch, uAmp, uFreq } = ctx
// audioLevel → amplitude 반영: 기본 amplitude + 오디오 레벨로 증폭
const targetAmp = ampRef.current + audioLevelRef.current * 0.35
// Smoothing
currentAmpRef.current += (targetAmp - currentAmpRef.current) * 0.15
currentFreqRef.current += (freqRef.current - currentFreqRef.current) * 0.1
glitchRef.current *= 0.85
gl.uniform1f(uTime, (Date.now() - startTimeRef.current) / 1000)
gl.uniform1f(uGlitch, glitchRef.current)
gl.uniform1f(uAmp, currentAmpRef.current)
gl.uniform1f(uFreq, currentFreqRef.current)
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4)
animRef.current = requestAnimationFrame(render)
}, [])
useEffect(() => {
const canvas = canvasRef.current
if (!canvas) return
const gl = canvas.getContext('webgl', { alpha: true })
if (!gl) return
canvas.width = canvas.clientWidth * 2
canvas.height = canvas.clientHeight * 2
gl.viewport(0, 0, canvas.width, canvas.height)
const prog = createProgram(gl, VERTEX_SHADER, FRAGMENT_SHADER)
if (!prog) return
gl.useProgram(prog)
const buffer = gl.createBuffer()
gl.bindBuffer(gl.ARRAY_BUFFER, buffer)
gl.bufferData(gl.ARRAY_BUFFER, QUAD, gl.STATIC_DRAW)
const posLoc = gl.getAttribLocation(prog, 'position')
gl.enableVertexAttribArray(posLoc)
gl.vertexAttribPointer(posLoc, 2, gl.FLOAT, false, 0, 0)
glRef.current = {
gl,
uTime: gl.getUniformLocation(prog, 'u_time'),
uGlitch: gl.getUniformLocation(prog, 'u_glitch'),
uAmp: gl.getUniformLocation(prog, 'u_amp'),
uFreq: gl.getUniformLocation(prog, 'u_freq'),
}
startTimeRef.current = Date.now()
animRef.current = requestAnimationFrame(render)
return () => {
cancelAnimationFrame(animRef.current)
}
}, [render])
return (
<Box
sx={{
position: 'relative',
height,
bgcolor: d3roPalette.bg.crtBezel,
borderRadius: '8px',
boxShadow: d3roShadow.insetDeep,
overflow: 'hidden',
}}
>
{/* Glass surface */}
<Box
sx={{
position: 'absolute',
inset: '2px',
borderRadius: '6px',
bgcolor: d3roPalette.bg.crtGlass,
overflow: 'hidden',
boxShadow: d3roShadow.screenGlow,
}}
>
<canvas
ref={canvasRef}
style={{
position: 'absolute',
inset: 0,
width: '100%',
height: '100%',
// 라이트 모드에서 WebGL 셰이더(다크 전용)를 반전하여 밝은 배경에 어울리게 조정
...(isLight && { filter: 'invert(0.88) hue-rotate(180deg)', opacity: 0.9 }),
}}
/>
{/* Glass reflection */}
<Box
sx={{
position: 'absolute',
top: 0, left: 0, right: 0, bottom: '50%',
background: isLight
? 'linear-gradient(180deg, rgba(255,255,255,0.30) 0%, rgba(255,255,255,0) 100%)'
: 'linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%)',
pointerEvents: 'none',
zIndex: 10,
}}
/>
</Box>
{/* Content overlay (phosphor text) */}
<Box
sx={{
position: 'absolute',
inset: '16px',
zIndex: 2,
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-between',
color: d3roPalette.accent.amber,
textShadow: '0 0 6px rgba(242, 91, 41, 0.4)',
pointerEvents: 'none',
fontFamily: d3roFontMono,
}}
>
{children}
</Box>
</Box>
)
}

View file

@ -0,0 +1,82 @@
// src/renderer/components/ds/InstrumentPanel.tsx
// 시안 A: 메탈 섀시 컨테이너 — 노이즈 텍스처, 각인 텍스트, 물리적 존재감
import { Box, Typography } from '@mui/material'
import { useTheme } from '@mui/material/styles'
import { d3roPalette, d3roFontMono, d3roShadow, d3roRadius, d3roTypo } from '../../theme'
interface InstrumentPanelProps {
children: React.ReactNode
/** 상단 좌측 각인 */
engravingLeft?: string
/** 상단 우측 각인 */
engravingRight?: string
/** 하단 중앙 각인 */
engravingBottom?: string
}
export function InstrumentPanel({
children,
engravingLeft = 'D3RO-VOICE SYS.',
engravingRight = 'MOD-01 / TERMINAL',
engravingBottom = 'LOCAL AI VOICE ASSISTANT',
}: InstrumentPanelProps): React.ReactElement {
return (
<Box
sx={{
position: 'relative',
bgcolor: d3roPalette.bg.chassis,
borderRadius: d3roRadius.outer,
p: 3,
boxShadow: d3roShadow.chassis,
// 메탈 노이즈는 CSS로 시뮬레이션
'&::before': {
content: '""',
position: 'absolute',
inset: 0,
borderRadius: d3roRadius.outer,
backgroundImage: `url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,
opacity: 0.04,
mixBlendMode: 'overlay',
pointerEvents: 'none',
zIndex: 1,
},
}}
>
{/* 각인 텍스트 */}
<Engraving sx={{ top: 12, left: 24 }}>{engravingLeft}</Engraving>
<Engraving sx={{ top: 12, right: 24 }}>{engravingRight}</Engraving>
<Engraving sx={{ bottom: 12, left: '50%', transform: 'translateX(-50%)' }}>{engravingBottom}</Engraving>
{/* 콘텐츠 (z-index 5로 노이즈 위) */}
<Box sx={{ position: 'relative', zIndex: 5 }}>
{children}
</Box>
</Box>
)
}
function Engraving({ children, sx }: { children: string; sx: Record<string, unknown> }): React.ReactElement {
const theme = useTheme()
const isLight = theme.palette.mode === 'light'
return (
<Typography
sx={{
position: 'absolute',
fontSize: d3roTypo.engrave.size,
letterSpacing: d3roTypo.engrave.spacing,
color: d3roPalette.text.engraving,
textShadow: isLight
? '0 -1px 0 rgba(0,0,0,0.1)'
: '0 1px 0 rgba(255,255,255,0.08)',
fontWeight: 700,
fontFamily: d3roFontMono,
zIndex: 2,
userSelect: 'none',
...sx,
}}
>
{children}
</Typography>
)
}

View file

@ -0,0 +1,51 @@
// src/renderer/components/ds/Led.tsx
// 시안 A: LED 인디케이터 — 물리적 LED, 활성 시 glow + pulse
import { Box } from '@mui/material'
import { d3roPalette } from '../../theme'
type LedColor = 'amber' | 'green' | 'red' | 'orange' | 'off'
const LED_COLORS: Record<LedColor, { bg: string; glow: string }> = {
amber: { bg: d3roPalette.accent.amber, glow: d3roPalette.accent.amberGlow },
green: { bg: d3roPalette.tag.green, glow: d3roPalette.tag.greenGlow },
red: { bg: d3roPalette.tag.red, glow: d3roPalette.tag.redGlow },
orange: { bg: d3roPalette.tag.orange, glow: d3roPalette.tag.orangeGlow },
off: { bg: d3roPalette.led.off, glow: 'transparent' },
}
interface LedProps {
color?: LedColor
pulse?: boolean
size?: number
}
export function Led({ color = 'off', pulse = false, size = 8 }: LedProps): React.ReactElement {
const c = LED_COLORS[color]
const isActive = color !== 'off'
return (
<Box
sx={{
width: size,
height: size,
borderRadius: '50%',
bgcolor: c.bg,
flexShrink: 0,
boxShadow: isActive
? `inset 0 1px 2px rgba(255,255,255,0.5), 0 0 10px ${c.glow}`
: 'inset 0 1px 3px rgba(0,0,0,0.9), 0 1px 0 rgba(255,255,255,0.05)',
transition: 'all 0.1s',
...(pulse && isActive
? {
animation: 'led-pulse 1.5s ease-in-out infinite',
'@keyframes led-pulse': {
'0%, 100%': { opacity: 1 },
'50%': { opacity: 0.5 },
},
}
: {}),
}}
/>
)
}

View file

@ -0,0 +1,30 @@
// src/renderer/components/ds/MetalCard.tsx
// 시안 A+B 융합: 메탈 카드 컨테이너 — 섀시 느낌의 인셋 패널
// 토큰 적용: d3roShadow, d3roRadius
import { Box } from '@mui/material'
import { d3roPalette, d3roShadow, d3roRadius } from '../../theme'
interface MetalCardProps {
children: React.ReactNode
inset?: boolean
}
export function MetalCard({ children, inset = false }: MetalCardProps): React.ReactElement {
return (
<Box
sx={{
bgcolor: inset ? d3roPalette.bg.inset : d3roPalette.bg.card,
borderRadius: inset ? d3roRadius.inner : d3roRadius.card,
borderTop: inset ? 'none' : `1px solid ${d3roPalette.border.subtle}`,
boxShadow: inset ? d3roShadow.inset : d3roShadow.card,
p: inset ? '6px' : 3,
overflow: 'hidden',
transition: 'background-color 0.2s ease',
'&:hover': inset ? {} : { bgcolor: d3roPalette.bg.cardHover },
}}
>
{children}
</Box>
)
}

View file

@ -0,0 +1,134 @@
// src/renderer/components/ds/MetalDial.tsx
// 시안 A: 메탈 다이얼 — 정밀기기 회전 노브, 동심원 그루브, 금속 광택, LED 인디케이터
// 보강: 레퍼런스의 conic-gradient 정적 라이팅 + 방향성 그림자 추가
import { Box } from '@mui/material'
import { d3roPalette, d3roFontMono, d3roTypo, d3roShadow } from '../../theme'
import { PhosphorText } from './PhosphorText'
interface MetalDialProps {
/** 0.0 ~ 1.0 값 (다이얼 위치) */
value?: number
/** 라벨 텍스트 */
label?: string
/** 크기 (px) */
size?: number
/** LED 인디케이터 색상 */
ledColor?: string
}
export function MetalDial({
value = 0,
label,
size = 120,
ledColor = d3roPalette.accent.amber,
}: MetalDialProps): React.ReactElement {
const rotation = value * 270 - 135 // -135° ~ +135° 범위
const knobSize = size - 12 // 웰 패딩
return (
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1.5 }}>
{/* 다이얼 웰 (inset well) */}
<Box
sx={{
width: size,
height: size,
borderRadius: '50%',
bgcolor: d3roPalette.bg.crtBezel,
boxShadow: `
inset 0 3px 8px rgba(0,0,0,0.8),
inset 0 -1px 2px rgba(255,255,255,0.08),
0 1px 1px rgba(255,255,255,0.05)
`,
position: 'relative',
p: '6px',
}}
>
{/* 노브 회전체 (동심원 그루브) */}
<Box
sx={{
width: knobSize,
height: knobSize,
borderRadius: '50%',
position: 'absolute',
top: 6,
left: 6,
background: `
repeating-radial-gradient(
circle at 50% 50%,
${d3roPalette.text.disabled} 0px,
${d3roPalette.text.disabled} 1px,
${d3roPalette.text.label} 1.5px,
${d3roPalette.text.label} 2.5px
)
`,
transform: `rotate(${rotation}deg)`,
transition: 'transform 0.2s ease-out',
}}
>
{/* 포인터 인디케이터 점 */}
<Box
sx={{
position: 'absolute',
top: 10,
left: '50%',
transform: 'translateX(-50%)',
width: 8,
height: 8,
borderRadius: '50%',
bgcolor: d3roPalette.bg.crtBezel,
boxShadow: 'inset 0 2px 4px rgba(0,0,0,0.8)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
'&::after': {
content: '""',
width: 4,
height: 4,
borderRadius: '50%',
bgcolor: ledColor,
},
}}
/>
</Box>
{/* 정적 금속 광택 오버레이 (노브와 별개, 회전 안 함) */}
<Box
sx={{
position: 'absolute',
inset: '6px',
borderRadius: '50%',
pointerEvents: 'none',
// 레퍼런스의 핵심: directional light + conic reflections
background: `
linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 40%, rgba(0,0,0,0.6) 100%),
conic-gradient(from 180deg at 50% 50%,
rgba(255,255,255,0) 0deg,
rgba(255,255,255,0.4) 45deg,
rgba(255,255,255,0) 90deg,
rgba(255,255,255,0.2) 180deg,
rgba(255,255,255,0) 270deg,
rgba(255,255,255,0.4) 315deg,
rgba(255,255,255,0) 360deg
)
`,
mixBlendMode: 'overlay',
// 방향성 그림자: 좌상 하이라이트 + 우하 쉐이드
boxShadow: `
-4px -4px 8px rgba(255,255,255,0.3),
12px 16px 20px rgba(0,0,0,0.7),
inset 0 2px 3px rgba(255,255,255,0.8)
`,
}}
/>
</Box>
{/* 라벨 */}
{label && (
<PhosphorText variant="label" sx={{ color: d3roPalette.text.inactive }}>
{label}
</PhosphorText>
)}
</Box>
)
}

View file

@ -0,0 +1,68 @@
// src/renderer/components/ds/PhosphorText.tsx
// 시안 A: 인광 텍스트 — 앰버 glow, 모노 폰트, CRT 느낌
// 확장: title/stat/body/compact/meta/engrave/micro/nano 변형 추가
import { Typography, type TypographyProps } from '@mui/material'
import { d3roPalette, d3roFontMono, d3roTypo } from '../../theme'
type PhosphorVariant =
| 'hero' | 'title' | 'value' | 'heading'
| 'body' | 'compact' | 'small'
| 'meta' | 'label' | 'dim'
| 'engrave' | 'micro' | 'nano'
interface VariantDef {
fontSize: string
color: string
glow: string
fontWeight: number
letterSpacing: string
lineHeight: number
textTransform?: 'uppercase' | 'none'
}
const amberGlowStrong = `0 0 8px ${d3roPalette.accent.amberGlow}`
const amberGlowMedium = `0 0 6px rgba(242, 91, 41, 0.4)`
const amberGlowSoft = `0 0 4px rgba(242, 91, 41, 0.3)`
const VARIANTS: Record<PhosphorVariant, VariantDef> = {
hero: { fontSize: d3roTypo.hero.size, color: d3roPalette.accent.amber, glow: amberGlowStrong, fontWeight: d3roTypo.hero.weight, letterSpacing: d3roTypo.hero.spacing, lineHeight: d3roTypo.hero.line },
title: { fontSize: d3roTypo.title.size, color: d3roPalette.accent.amber, glow: amberGlowMedium, fontWeight: d3roTypo.title.weight, letterSpacing: d3roTypo.title.spacing, lineHeight: d3roTypo.title.line },
value: { fontSize: d3roTypo.value.size, color: d3roPalette.accent.amber, glow: amberGlowSoft, fontWeight: d3roTypo.value.weight, letterSpacing: d3roTypo.value.spacing, lineHeight: d3roTypo.value.line },
heading: { fontSize: d3roTypo.heading.size, color: d3roPalette.text.primary, glow: 'none', fontWeight: d3roTypo.heading.weight, letterSpacing: d3roTypo.heading.spacing, lineHeight: d3roTypo.heading.line },
body: { fontSize: d3roTypo.body.size, color: d3roPalette.text.secondary, glow: 'none', fontWeight: d3roTypo.body.weight, letterSpacing: d3roTypo.body.spacing, lineHeight: d3roTypo.body.line },
compact: { fontSize: d3roTypo.compact.size, color: d3roPalette.text.primary, glow: 'none', fontWeight: d3roTypo.compact.weight, letterSpacing: d3roTypo.compact.spacing, lineHeight: d3roTypo.compact.line },
small: { fontSize: d3roTypo.small.size, color: d3roPalette.text.inactive, glow: 'none', fontWeight: d3roTypo.small.weight, letterSpacing: d3roTypo.small.spacing, lineHeight: d3roTypo.small.line },
meta: { fontSize: d3roTypo.meta.size, color: d3roPalette.text.inactive, glow: 'none', fontWeight: d3roTypo.meta.weight, letterSpacing: d3roTypo.meta.spacing, lineHeight: d3roTypo.meta.line, textTransform: 'uppercase' },
label: { fontSize: d3roTypo.label.size, color: d3roPalette.text.dimLabel, glow: 'none', fontWeight: d3roTypo.label.weight, letterSpacing: d3roTypo.label.spacing, lineHeight: d3roTypo.label.line, textTransform: 'uppercase' },
dim: { fontSize: d3roTypo.label.size, color: d3roPalette.text.inactive, glow: 'none', fontWeight: d3roTypo.body.weight, letterSpacing: d3roTypo.label.spacing, lineHeight: d3roTypo.label.line },
engrave: { fontSize: d3roTypo.engrave.size, color: d3roPalette.text.engraving, glow: 'none', fontWeight: d3roTypo.engrave.weight, letterSpacing: d3roTypo.engrave.spacing, lineHeight: d3roTypo.engrave.line, textTransform: 'uppercase' },
micro: { fontSize: d3roTypo.micro.size, color: d3roPalette.text.dimLabel, glow: 'none', fontWeight: d3roTypo.micro.weight, letterSpacing: d3roTypo.micro.spacing, lineHeight: d3roTypo.micro.line, textTransform: 'uppercase' },
nano: { fontSize: d3roTypo.nano.size, color: d3roPalette.text.inactive, glow: 'none', fontWeight: d3roTypo.nano.weight, letterSpacing: d3roTypo.nano.spacing, lineHeight: d3roTypo.nano.line, textTransform: 'uppercase' },
}
interface PhosphorTextProps extends Omit<TypographyProps, 'variant'> {
variant?: PhosphorVariant
}
export function PhosphorText({ variant = 'value', sx, ...props }: PhosphorTextProps): React.ReactElement {
const v = VARIANTS[variant]
return (
<Typography
{...props}
sx={{
fontFamily: d3roFontMono,
fontSize: v.fontSize,
fontWeight: v.fontWeight,
color: v.color,
textShadow: v.glow !== 'none' ? v.glow : 'none',
letterSpacing: v.letterSpacing,
lineHeight: v.lineHeight,
fontVariantNumeric: 'tabular-nums',
textTransform: v.textTransform ?? 'none',
...sx,
}}
/>
)
}

View file

@ -0,0 +1,43 @@
// src/renderer/components/ds/PhysicalButton.tsx
// 시안 A: 물리 버튼 — 돌출 그림자, 눌림 피드백, 선택 상태
// 토큰 적용: d3roShadow, d3roRadius, d3roTypo
import { Button, type ButtonProps } from '@mui/material'
import { d3roPalette, d3roFontMono, d3roShadow, d3roRadius, d3roTypo } from '../../theme'
interface PhysicalButtonProps extends Omit<ButtonProps, 'variant'> {
selected?: boolean
}
export function PhysicalButton({ selected = false, sx, ...props }: PhysicalButtonProps): React.ReactElement {
return (
<Button
{...props}
sx={{
height: 44,
bgcolor: selected ? d3roPalette.bg.crtBezel : d3roPalette.bg.chassis,
border: 'none',
borderRadius: d3roRadius.small,
color: selected ? d3roPalette.accent.amber : d3roPalette.text.inactive,
fontFamily: d3roFontMono,
fontSize: d3roTypo.small.size,
fontWeight: d3roTypo.small.weight,
cursor: 'pointer',
boxShadow: selected ? d3roShadow.buttonPressed : d3roShadow.buttonRaised,
transform: selected ? 'translateY(1px)' : 'none',
transition: 'all 0.05s linear',
'&:active': {
transform: 'translateY(2px)',
boxShadow: d3roShadow.buttonActive,
},
'&:hover': {
bgcolor: selected ? d3roPalette.bg.crtBezel : d3roPalette.bg.cardHover,
},
textTransform: 'uppercase',
letterSpacing: d3roTypo.label.spacing,
minWidth: 0,
...sx,
}}
/>
)
}

View file

@ -0,0 +1,69 @@
// src/renderer/components/ds/ScreenPanel.tsx
// 시안 A: CRT 없는 순수 스크린 패널 — 인셋 베젤 + 글래스 반사 + 인광 텍스트용
// 레퍼런스의 .display-module > .screen-glass 패턴
import { Box } from '@mui/material'
import { useTheme } from '@mui/material/styles'
import { d3roPalette, d3roShadow } from '../../theme'
interface ScreenPanelProps {
children: React.ReactNode
/** 전체 높이 (px 또는 CSS 값) */
height?: number | string
}
export function ScreenPanel({ children, height }: ScreenPanelProps): React.ReactElement {
const theme = useTheme()
const isLight = theme.palette.mode === 'light'
return (
<Box
sx={{
position: 'relative',
bgcolor: d3roPalette.bg.crtBezel,
borderRadius: '12px',
boxShadow: d3roShadow.insetDeep,
overflow: 'hidden',
height,
}}
>
{/* 글래스 배경 */}
<Box
sx={{
position: 'absolute',
inset: '2px',
borderRadius: '10px',
bgcolor: d3roPalette.bg.crtGlass,
boxShadow: d3roShadow.screenGlow,
// 상단 반사 (레퍼런스의 .screen-glass::after)
'&::after': {
content: '""',
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: '50%',
background: isLight
? 'linear-gradient(180deg, rgba(255,255,255,0.40) 0%, rgba(255,255,255,0) 100%)'
: 'linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%)',
pointerEvents: 'none',
zIndex: 10,
},
}}
/>
{/* 콘텐츠 오버레이 */}
<Box
sx={{
position: 'relative',
zIndex: 2,
p: 2,
height: '100%',
display: 'flex',
flexDirection: 'column',
}}
>
{children}
</Box>
</Box>
)
}

View file

@ -0,0 +1,12 @@
// src/renderer/components/ds/index.ts
// 디자인 시스템 컴포넌트 SSOT barrel export
export { CrtDisplay } from './CrtDisplay'
export { InstrumentPanel } from './InstrumentPanel'
export { Led } from './Led'
export { PhysicalButton } from './PhysicalButton'
export { MetalCard } from './MetalCard'
export { PhosphorText } from './PhosphorText'
export { MetalDial } from './MetalDial'
export { ScreenPanel } from './ScreenPanel'
export { ButtonGroup } from './ButtonGroup'