feat(ui): flat "quiet instrument" token v4 with a single raw-value SSOT

- Add theme-raw.ts (no MUI/DOM deps) as the one source of theme values.
  Each theme declares only surfaces, 3-tier text, borders, accent and
  overlay shadow; legacy glass/gradient/glow/crt keys are derived as
  flat values so existing call sites lose effects without edits.
- Tertiary text now clears 4.5:1 on every surface in all six themes
  (label/inactive/dimLabel/muted alias it). Filled buttons use
  accent.solid + accent.ink (5.17:1 on dark/light, was 3.68:1).
- theme-vars.ts derives popup CSS from the same raw values instead of a
  hand copy, and defines the previously undefined --d3-overlay-strong
  and --d3-accent-glow-dim.
- MUI: no ripple, global focus-visible ring and reduced-motion rule,
  flat Card, status colors per theme, shape radius 16 -> 6.
- DS: flatten MetalCard/DoubleBezelCard/ScreenPanel/TiltCard, tone-based
  PhysicalButton (500 weight, no lift), TactileBadge with zero tracking
  and keyboard support, glow-free Led/StatRing, idle wave amplitude 0.
- PhosphorText drops mono/uppercase variants: mono has no Hangul glyphs,
  which spaced out Korean labels.
- design.md: record the 2026-09-28 redesign brief, audit, IA and tokens.
This commit is contained in:
Yun Chan 2026-09-28 18:26:03 +09:00
parent c3367bc611
commit 2428ede03d
15 changed files with 969 additions and 1515 deletions

View file

@ -1,27 +1,25 @@
'use client'
// packages/ui/src/components/ds/DoubleBezelCard.tsx
// High-End Agency / Awwwards-Tier Double-Bezel (Doppelrand) Enclosure Component
// Outer Shell: Precision machined tray with outer radius & ambient hairline
// Inner Core: Floating glass plate with concentric inner radius, specular highlight & blur
// v4 "조용한 계기": 이중 베젤을 걷어낸 단일 카드. 이름과 props 는 호환을 위해 유지한다.
// bezelPadding 은 무시된다(바깥 틀이 없다). interactive 는 선·배경 변화만 — 떠오르지 않는다.
import React from 'react'
import { Box, type BoxProps } from '@mui/material'
import { d3roPalette, d3roShadow, d3roRadius } from '../../theme'
import { d3roPalette, d3roRadius, d3roTransition } from '../../theme'
export interface DoubleBezelCardProps extends Omit<BoxProps, 'component'> {
/** Outer padding between tray and core (default: 6px) */
/** @deprecated v4: 바깥 틀이 없어 쓰이지 않는다 */
bezelPadding?: number | string
/** Whether the card shows an interactive lift / glow on hover */
/** 누를 수 있는 카드 — hover 시 선과 배경만 바뀐다 */
interactive?: boolean
/** Inner core padding (default: 3 / 24px) */
/** 안쪽 여백 (기본 3 = 24px) */
innerPadding?: number | string
/** Content to render inside the inner core */
children?: React.ReactNode
}
export function DoubleBezelCard({
bezelPadding = '6px',
bezelPadding: _bezelPadding,
interactive = false,
innerPadding = 3,
children,
@ -33,69 +31,21 @@ export function DoubleBezelCard({
{...boxProps}
sx={{
position: 'relative',
borderRadius: d3roRadius.doubleBezelOuter,
p: bezelPadding,
bgcolor: d3roPalette.glass.raised,
border: `1px solid ${d3roPalette.glass.hairline}`,
boxShadow: interactive ? d3roShadow.card : 'none',
transition: 'transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease',
borderRadius: d3roRadius.card,
p: innerPadding,
bgcolor: d3roPalette.bg.card,
border: `1px solid ${d3roPalette.border.default}`,
transition: d3roTransition('border-color', 'background-color'),
...(interactive
? {
cursor: 'pointer',
'&:hover': {
borderColor: d3roPalette.glass.hairlineStrong,
boxShadow: d3roShadow.glowCardHover,
transform: 'translateY(-2px)',
'& .d3-inner-core': {
bgcolor: d3roPalette.bg.cardHover,
},
},
'&:active': {
transform: 'translateY(0px) scale(0.99)',
},
'&:hover': { borderColor: d3roPalette.border.strong, bgcolor: d3roPalette.bg.cardHover },
}
: {}),
...sx,
}}
>
{/* Inner Core Container */}
<Box
className="d3-inner-core"
sx={{
position: 'relative',
borderRadius: d3roRadius.doubleBezelInner,
bgcolor: d3roPalette.glass.surface,
backdropFilter: `blur(${d3roPalette.glass.blur})`,
boxShadow: `${d3roShadow.inset}, ${d3roShadow.glowCard}`,
p: innerPadding,
overflow: 'hidden',
transition: 'background-color 0.25s ease',
// Top Sheen + Specular highlight
'&::before': {
content: '""',
position: 'absolute',
inset: 0,
borderRadius: 'inherit',
background: d3roPalette.glass.sheen,
pointerEvents: 'none',
},
// 1px Gradient Hairline Rim
'&::after': {
content: '""',
position: 'absolute',
inset: 0,
borderRadius: 'inherit',
padding: '1px',
background: d3roPalette.glass.borderGradient,
WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
WebkitMaskComposite: 'xor',
maskComposite: 'exclude',
pointerEvents: 'none',
},
}}
>
<Box sx={{ position: 'relative', zIndex: 1 }}>{children}</Box>
</Box>
{children}
</Box>
)
}

View file

@ -47,11 +47,11 @@ function seeded(i: number): number {
export function GradientWave({
audioLevel = 0,
idleAmplitude = 0.25,
idleAmplitude = 0,
speed = 1,
barWidth = 3,
barGap = 3,
glow = 8,
glow = 0,
height = '100%',
}: GradientWaveProps): React.ReactElement {
const canvasRef = useRef<HTMLCanvasElement>(null)

View file

@ -1,23 +1,23 @@
'use client'
// src/renderer/components/ds/Led.tsx
// v2 "Midnight Glass": 상태 도트 — 소프트 글로우, 활성 시 pulse
// (레퍼런스의 "● READY" / "● 시스템 정상" 인디케이터)
// packages/ui/src/components/ds/Led.tsx
// v4 "조용한 계기": 상태 점. 번짐(글로우) 없음. 색만으로 상태를 말하지 않는다 — 옆에 글자를 둔다.
// pulse 는 진행 중(녹음·연결 중)에만. 감소 모션에서는 전역 규칙으로 멈춘다.
import { Box } from '@mui/material'
import { d3roPalette } from '../../theme'
type LedColor = 'amber' | 'green' | 'red' | 'orange' | 'blue' | 'purple' | 'off'
const LED_COLORS: Record<LedColor, { bg: string; glow: string }> = {
// 'amber'는 v1 호환 별칭 — 현재 테마의 프라이머리 액센트 색으로 렌더
amber: { bg: d3roPalette.accent.main, glow: d3roPalette.accent.glow },
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 },
blue: { bg: d3roPalette.tag.blue, glow: d3roPalette.tag.blueGlow },
purple: { bg: d3roPalette.tag.purple, glow: d3roPalette.tag.purpleGlow },
off: { bg: d3roPalette.led.off, glow: 'transparent' },
const LED_COLORS: Record<LedColor, string> = {
// 'amber'는 v1 호환 별칭 — 현재 테마의 액센트
amber: d3roPalette.accent.main,
green: d3roPalette.status.success,
red: d3roPalette.status.danger,
orange: d3roPalette.status.warning,
blue: d3roPalette.accent.main,
purple: d3roPalette.tag.purple,
off: d3roPalette.text.disabled,
}
interface LedProps {
@ -27,25 +27,23 @@ interface LedProps {
}
export function Led({ color = 'off', pulse = false, size = 8 }: LedProps): React.ReactElement {
const c = LED_COLORS[color]
const isActive = color !== 'off'
return (
<Box
aria-hidden
sx={{
width: size,
height: size,
borderRadius: '50%',
bgcolor: c.bg,
bgcolor: LED_COLORS[color],
flexShrink: 0,
boxShadow: isActive ? `0 0 ${size * 1.2}px ${c.glow}` : 'none',
transition: 'all 0.15s ease',
...(pulse && isActive
? {
animation: 'led-pulse 1.6s ease-in-out infinite',
'@keyframes led-pulse': {
'0%, 100%': { opacity: 1 },
'50%': { opacity: 0.45 },
'50%': { opacity: 0.4 },
},
}
: {}),

View file

@ -1,15 +1,14 @@
'use client'
// packages/ui/src/components/ds/MetalCard.tsx
// v2 "Midnight Glass": 글래스모피즘 카드 —
// 그라디언트 헤어라인 보더(좌상단 발광 → 우하단 소멸) + 앰비언트 글로우 + 상단 시인.
// 보더는 mask 링 기법(::after) — 반투명 표면 위에서도 정확한 1px 그라디언트 링.
// v4 "조용한 계기": 평평한 카드 — 표면 한 단 + 1px 선. 그림자·블러·광택 없음.
// inset: 카드 안의 한 단 들어간 영역 (카드 안의 카드가 아니라 우묵한 판).
import { Box, type BoxProps } from '@mui/material'
import { d3roPalette, d3roShadow, d3roRadius } from '../../theme'
import { d3roPalette, d3roRadius, d3roTransition } from '../../theme'
interface MetalCardProps extends Omit<BoxProps, 'component'> {
/** 카드 내부의 상승 표면 (카드 안의 카드) */
/** 카드 내부의 우묵한 영역 */
inset?: boolean
}
@ -24,41 +23,11 @@ export function MetalCard({
{...boxProps}
sx={{
position: 'relative',
bgcolor: inset ? d3roPalette.glass.raised : d3roPalette.glass.surface,
backdropFilter: `blur(${d3roPalette.glass.blur})`,
bgcolor: inset ? d3roPalette.bg.inset : d3roPalette.bg.card,
borderRadius: inset ? d3roRadius.inner : d3roRadius.card,
border: inset ? `1px solid ${d3roPalette.glass.hairline}` : 'none',
boxShadow: inset ? 'none' : d3roShadow.glowCard,
border: `1px solid ${inset ? d3roPalette.border.subtle : d3roPalette.border.default}`,
p: inset ? 2 : 3,
overflow: 'hidden',
transition: 'box-shadow 0.25s ease',
// 상단 시인 + 앰비언트 라디얼 (theme sheen 토큰이 레이어 결합)
'&::before': inset
? {}
: {
content: '""',
position: 'absolute',
inset: 0,
borderRadius: 'inherit',
background: d3roPalette.glass.sheen,
pointerEvents: 'none',
},
// 그라디언트 헤어라인 링 — padding 1px + mask exclude로 링만 남김
'&::after': inset
? {}
: {
content: '""',
position: 'absolute',
inset: 0,
borderRadius: 'inherit',
padding: '1px',
background: d3roPalette.glass.borderGradient,
WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
WebkitMaskComposite: 'xor',
maskComposite: 'exclude',
pointerEvents: 'none',
},
'&:hover': inset ? {} : { boxShadow: d3roShadow.glowCardHover },
transition: d3roTransition('border-color', 'background-color'),
...sx,
}}
>

View file

@ -1,11 +1,13 @@
'use client'
// src/renderer/components/ds/PhosphorText.tsx
// v2 "Midnight Glass": 클린 타이포그래피 — 산세리프(Pretendard) 기반.
// 헤드라인/수치는 프라이머리 화이트, 메타/라벨류만 모노+대문자 유지.
// packages/ui/src/components/ds/PhosphorText.tsx
// v4 "조용한 계기": 타이포 변형 13종 — 전부 산세리프(Pretendard), 대문자 변환 없음.
// 위계는 크기와 명도(text 3단)로 만든다. 한글 라벨에 모노·양수 자간을 쓰지 않는다
// (모노 폰트에 한글 글리프가 없어 "누 름 유 지"처럼 벌어졌다 — 2026-09-28 실측).
// 수치는 tabular-nums 로 흔들리지 않게.
import { Typography, type TypographyProps } from '@mui/material'
import { d3roPalette, d3roFontSans, d3roFontMono, d3roTypo } from '../../theme'
import { d3roPalette, d3roFontSans, d3roTypo } from '../../theme'
type PhosphorVariant =
| 'hero' | 'title' | 'value' | 'heading'
@ -19,24 +21,30 @@ interface VariantDef {
fontWeight: number
letterSpacing: string
lineHeight: number
textTransform?: 'uppercase' | 'none'
mono?: boolean
}
const def = (key: keyof typeof d3roTypo, color: string): VariantDef => ({
fontSize: d3roTypo[key].size,
fontWeight: d3roTypo[key].weight,
letterSpacing: d3roTypo[key].spacing,
lineHeight: d3roTypo[key].line,
color,
})
const VARIANTS: Record<PhosphorVariant, VariantDef> = {
hero: { fontSize: d3roTypo.hero.size, color: d3roPalette.text.primary, fontWeight: d3roTypo.hero.weight, letterSpacing: d3roTypo.hero.spacing, lineHeight: d3roTypo.hero.line },
title: { fontSize: d3roTypo.title.size, color: d3roPalette.text.primary, fontWeight: d3roTypo.title.weight, letterSpacing: d3roTypo.title.spacing, lineHeight: d3roTypo.title.line },
value: { fontSize: d3roTypo.value.size, color: d3roPalette.text.primary, fontWeight: d3roTypo.value.weight, letterSpacing: d3roTypo.value.spacing, lineHeight: d3roTypo.value.line },
heading: { fontSize: d3roTypo.heading.size, color: d3roPalette.text.primary, fontWeight: d3roTypo.heading.weight, letterSpacing: d3roTypo.heading.spacing, lineHeight: d3roTypo.heading.line },
body: { fontSize: d3roTypo.body.size, color: d3roPalette.text.secondary, fontWeight: d3roTypo.body.weight, letterSpacing: d3roTypo.body.spacing, lineHeight: d3roTypo.body.line },
compact: { fontSize: d3roTypo.compact.size, color: d3roPalette.text.primary, fontWeight: d3roTypo.compact.weight, letterSpacing: d3roTypo.compact.spacing, lineHeight: d3roTypo.compact.line },
small: { fontSize: d3roTypo.small.size, color: d3roPalette.text.inactive, fontWeight: d3roTypo.small.weight, letterSpacing: d3roTypo.small.spacing, lineHeight: d3roTypo.small.line },
meta: { fontSize: d3roTypo.meta.size, color: d3roPalette.text.inactive, fontWeight: d3roTypo.meta.weight, letterSpacing: d3roTypo.meta.spacing, lineHeight: d3roTypo.meta.line, textTransform: 'uppercase', mono: true },
label: { fontSize: d3roTypo.label.size, color: d3roPalette.text.label, fontWeight: d3roTypo.label.weight, letterSpacing: d3roTypo.label.spacing, lineHeight: d3roTypo.label.line, textTransform: 'uppercase' },
dim: { fontSize: d3roTypo.label.size, color: d3roPalette.text.inactive, fontWeight: d3roTypo.body.weight, letterSpacing: d3roTypo.label.spacing, lineHeight: d3roTypo.label.line },
engrave: { fontSize: d3roTypo.engrave.size, color: d3roPalette.text.dimLabel, fontWeight: d3roTypo.engrave.weight, letterSpacing: d3roTypo.engrave.spacing, lineHeight: d3roTypo.engrave.line, textTransform: 'uppercase', mono: true },
micro: { fontSize: d3roTypo.micro.size, color: d3roPalette.text.dimLabel, fontWeight: d3roTypo.micro.weight, letterSpacing: d3roTypo.micro.spacing, lineHeight: d3roTypo.micro.line, textTransform: 'uppercase', mono: true },
nano: { fontSize: d3roTypo.nano.size, color: d3roPalette.text.inactive, fontWeight: d3roTypo.nano.weight, letterSpacing: d3roTypo.nano.spacing, lineHeight: d3roTypo.nano.line, textTransform: 'uppercase', mono: true },
hero: def('hero', d3roPalette.text.primary),
title: def('title', d3roPalette.text.primary),
value: def('value', d3roPalette.text.primary),
heading: def('heading', d3roPalette.text.primary),
body: def('body', d3roPalette.text.secondary),
compact: def('compact', d3roPalette.text.primary),
small: def('small', d3roPalette.text.tertiary),
meta: def('meta', d3roPalette.text.tertiary),
label: def('label', d3roPalette.text.tertiary),
dim: { ...def('label', d3roPalette.text.tertiary), fontWeight: d3roTypo.body.weight },
engrave: def('engrave', d3roPalette.text.tertiary),
micro: def('micro', d3roPalette.text.tertiary),
nano: def('nano', d3roPalette.text.tertiary),
}
interface PhosphorTextProps extends Omit<TypographyProps, 'variant'> {
@ -51,14 +59,14 @@ export function PhosphorText({ variant = 'value', component = 'span', sx, ...pro
component={component}
{...props}
sx={{
fontFamily: v.mono ? d3roFontMono : d3roFontSans,
fontFamily: d3roFontSans,
fontSize: v.fontSize,
fontWeight: v.fontWeight,
color: v.color,
letterSpacing: v.letterSpacing,
lineHeight: v.lineHeight,
fontVariantNumeric: 'tabular-nums',
textTransform: v.textTransform ?? 'none',
textTransform: 'none',
...sx,
}}
/>

View file

@ -1,21 +1,68 @@
'use client'
// packages/ui/src/components/ds/PhysicalButton.tsx
// High-End Tactile Button with Button-in-Button Trailing Icon & Spring Physics
// v4 "조용한 계기": 버튼 한 종류, 톤 다섯. 채움은 accent 톤 하나뿐이고 나머지는 선과 글자로 구분한다.
// 움직임은 색 변화뿐 — 떠오르거나 튀지 않는다.
import React from 'react'
import { Button, Box, type ButtonProps } from '@mui/material'
import { d3roPalette, d3roFontSans, d3roShadow, d3roRadius, d3roTypo } from '../../theme'
import { d3roPalette, d3roFontSans, d3roRadius, d3roTypo, d3roControl, d3roTransition } from '../../theme'
export interface PhysicalButtonProps extends Omit<ButtonProps, 'variant'> {
/** Active selected state (renders primary accent gradient) */
/** 선택된 상태 (accent 톤으로 렌더) */
selected?: boolean
/** Visual button tone */
/** 시각 톤 */
tone?: 'accent' | 'glass' | 'danger' | 'success' | 'ghost'
/** Trailing icon rendered in a nested circular capsule (Button-in-Button pattern) */
/** 글자 뒤 아이콘 */
trailingIcon?: React.ReactNode
}
interface ToneStyle {
bg: string
bgHover: string
color: string
colorHover: string
border: string
}
const TONES: Record<'accent' | 'glass' | 'danger' | 'success' | 'ghost', ToneStyle> = {
accent: {
bg: d3roPalette.accent.solid,
bgHover: d3roPalette.accent.solidHover,
color: d3roPalette.accent.ink,
colorHover: d3roPalette.accent.ink,
border: 'transparent',
},
glass: {
bg: 'transparent',
bgHover: d3roPalette.surface.overlaySoft,
color: d3roPalette.text.primary,
colorHover: d3roPalette.text.primary,
border: d3roPalette.border.strong,
},
danger: {
bg: 'transparent',
bgHover: d3roPalette.status.dangerBg,
color: d3roPalette.status.danger,
colorHover: d3roPalette.status.danger,
border: d3roPalette.border.strong,
},
success: {
bg: 'transparent',
bgHover: d3roPalette.status.successBg,
color: d3roPalette.status.success,
colorHover: d3roPalette.status.success,
border: d3roPalette.border.strong,
},
ghost: {
bg: 'transparent',
bgHover: d3roPalette.surface.overlaySoft,
color: d3roPalette.text.secondary,
colorHover: d3roPalette.text.primary,
border: 'transparent',
},
}
export function PhysicalButton({
selected = false,
tone = 'glass',
@ -24,71 +71,34 @@ export function PhysicalButton({
sx,
...props
}: PhysicalButtonProps): React.ReactElement {
const isAccent = selected || tone === 'accent'
const isDanger = tone === 'danger'
const isSuccess = tone === 'success'
let bg: string = d3roPalette.glass.raised
let bgImage: string = 'none'
let textColor: string = d3roPalette.text.primary
let borderColor: string = d3roPalette.glass.hairline
let shadow: string = 'none'
if (isAccent) {
bg = 'transparent'
bgImage = d3roPalette.gradient.accent
textColor = d3roPalette.text.inverse
borderColor = 'transparent'
shadow = d3roShadow.glowAccent
} else if (isDanger) {
bg = d3roPalette.tag.redBg
textColor = d3roPalette.tag.red
borderColor = d3roPalette.tag.redGlow
} else if (isSuccess) {
bg = d3roPalette.tag.greenBg
textColor = d3roPalette.tag.green
borderColor = d3roPalette.tag.greenGlow
}
const t = TONES[selected ? 'accent' : tone]
return (
<Button
{...props}
sx={{
height: 40,
px: trailingIcon ? 2 : 2.5,
bgcolor: bg,
backgroundImage: bgImage,
border: `1px solid ${borderColor}`,
height: d3roControl.h,
px: 1.75,
bgcolor: t.bg,
backgroundImage: 'none',
border: `1px solid ${t.border}`,
borderRadius: d3roRadius.button,
color: textColor,
color: t.color,
fontFamily: d3roFontSans,
fontSize: d3roTypo.compact.size,
fontWeight: 600,
cursor: 'pointer',
boxShadow: shadow,
fontWeight: 500,
boxShadow: 'none',
textTransform: 'none',
letterSpacing: '0.01em',
letterSpacing: 0,
minWidth: 0,
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
gap: 1.25,
transition: 'all 0.2s cubic-bezier(0.16, 1, 0.3, 1)',
'&:hover': {
bgcolor: isAccent ? undefined : d3roPalette.bg.cardHover,
borderColor: isAccent ? 'transparent' : d3roPalette.glass.hairlineStrong,
color: isAccent ? d3roPalette.text.inverse : d3roPalette.text.primary,
filter: isAccent ? 'brightness(1.08)' : 'none',
boxShadow: isAccent ? d3roShadow.glowAccent : d3roShadow.card,
transform: 'translateY(-1px)',
'& .d3-button-trailing-icon': {
transform: 'translateX(2px)',
},
},
'&:active': {
transform: 'translateY(0) scale(0.98)',
filter: 'brightness(0.95)',
},
gap: 1,
whiteSpace: 'nowrap',
transition: d3roTransition('background-color', 'color', 'border-color'),
'&:hover': { bgcolor: t.bgHover, color: t.colorHover, boxShadow: 'none' },
'&.Mui-disabled': { opacity: 0.5, color: t.color, borderColor: t.border },
...sx,
}}
>
@ -97,21 +107,10 @@ export function PhysicalButton({
</Box>
{trailingIcon && (
<Box
component="span"
aria-hidden
className="d3-button-trailing-icon"
sx={{
width: 24,
height: 24,
borderRadius: '50%',
bgcolor: isAccent ? 'var(--d3-overlay-strong)' : d3roPalette.bg.inset,
border: `1px solid ${isAccent ? 'var(--d3-overlay-strong)' : d3roPalette.border.subtle}`,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: isAccent ? d3roPalette.text.inverse : d3roPalette.text.secondary,
transition: 'transform 0.2s ease',
flexShrink: 0,
'& svg': { width: 14, height: 14 },
}}
sx={{ display: 'inline-flex', alignItems: 'center', opacity: 0.8, '& svg': { width: 14, height: 14 } }}
>
{trailingIcon}
</Box>

View file

@ -1,8 +1,7 @@
'use client'
// src/renderer/components/ds/ScreenPanel.tsx
// v2 "Midnight Glass": 딥 글래스 패널 — 카드 내부의 어두운 정보 표시 영역
// (레퍼런스의 히어로 카드 내부 / "현재 백엔드" 내부 패널 패턴)
// packages/ui/src/components/ds/ScreenPanel.tsx
// v4 "조용한 계기": 카드 안의 우묵한 표시 영역 — 한 단 어두운 판 + 1px 선. 광택 없음.
import { Box } from '@mui/material'
import { d3roPalette, d3roRadius } from '../../theme'
@ -18,34 +17,17 @@ export function ScreenPanel({ children, height }: ScreenPanelProps): React.React
<Box
sx={{
position: 'relative',
bgcolor: d3roPalette.bg.crtGlass,
bgcolor: d3roPalette.bg.inset,
borderRadius: d3roRadius.inner,
border: `1px solid ${d3roPalette.glass.hairline}`,
border: `1px solid ${d3roPalette.border.subtle}`,
overflow: 'hidden',
height,
// 상단 시인
'&::after': {
content: '""',
position: 'absolute',
inset: 0,
background: d3roPalette.glass.sheen,
pointerEvents: 'none',
zIndex: 1,
},
p: 2,
display: 'flex',
flexDirection: 'column',
}}
>
<Box
sx={{
position: 'relative',
zIndex: 2,
p: 2,
height: '100%',
display: 'flex',
flexDirection: 'column',
}}
>
{children}
</Box>
{children}
</Box>
)
}

View file

@ -1,66 +1,41 @@
'use client'
// src/renderer/components/ds/StatRing.tsx
// v2 신규: 컬러 그라디언트 링 아이콘 — 스탯 타일의 원형 링 (레퍼런스 4타일 패턴)
// packages/ui/src/components/ds/StatRing.tsx
// v4 "조용한 계기": 아이콘 자리. 다색 원뿔 그라디언트 링·글로우를 걷어내고 1px 원 + 한 색 아이콘으로.
// color 는 호환용 — accent 만 강조색, 나머지는 모두 보조 텍스트색(색으로 항목을 구분하지 않는다).
import { Box } from '@mui/material'
import { d3roPalette } from '../../theme'
type RingColor = 'blue' | 'purple' | 'green' | 'orange' | 'red' | 'accent'
const RING_COLORS: Record<RingColor, { from: string; to: string; glow: string; icon: string }> = {
blue: { from: 'var(--d3-gradient-wave1)', to: 'var(--d3-gradient-wave2)', glow: d3roPalette.tag.blueBg, icon: d3roPalette.tag.blue },
purple: { from: 'var(--d3-gradient-wave3)', to: 'var(--d3-gradient-wave4)', glow: d3roPalette.tag.purpleBg, icon: d3roPalette.tag.purple },
green: { from: d3roPalette.tag.green, to: d3roPalette.tag.green, glow: d3roPalette.tag.greenGlow, icon: d3roPalette.tag.green },
orange: { from: d3roPalette.tag.orange, to: d3roPalette.tag.orange, glow: d3roPalette.tag.orangeGlow, icon: d3roPalette.tag.orange },
red: { from: d3roPalette.tag.red, to: d3roPalette.tag.red, glow: d3roPalette.tag.redGlow, icon: d3roPalette.tag.red },
accent: { from: 'var(--d3-accent-light)', to: 'var(--d3-accent-dark)', glow: 'var(--d3-accent-dim)', icon: d3roPalette.accent.light },
}
interface StatRingProps {
/** 링 색 (기본 blue) */
color?: RingColor
/** 외경 px (기본 56) */
size?: number
/** 링 두께 px (기본 2) */
/** @deprecated v4: 선은 1px 고정 */
thickness?: number
/** 중앙 아이콘/콘텐츠 */
children?: React.ReactNode
}
export function StatRing({
color = 'blue',
size = 56,
thickness = 2,
children,
}: StatRingProps): React.ReactElement {
const c = RING_COLORS[color]
export function StatRing({ color = 'blue', size = 56, children }: StatRingProps): React.ReactElement {
return (
<Box
aria-hidden
sx={{
width: size,
height: size,
borderRadius: '50%',
p: `${thickness}px`,
background: `conic-gradient(from 210deg, ${c.from}, ${c.to}, ${c.from})`,
boxShadow: `0 0 ${size / 3.5}px ${c.glow}`,
border: `1px solid ${d3roPalette.border.default}`,
bgcolor: d3roPalette.bg.inset,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: color === 'accent' ? d3roPalette.accent.light : d3roPalette.text.secondary,
flexShrink: 0,
}}
>
<Box
sx={{
width: '100%',
height: '100%',
borderRadius: '50%',
bgcolor: d3roPalette.bg.crtGlass,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
color: c.icon,
}}
>
{children}
</Box>
{children}
</Box>
)
}

View file

@ -1,28 +1,37 @@
'use client'
// packages/ui/src/components/ds/TactileBadge.tsx
// Hardware-grade telemetry badge / pill chip with optional LED bead and keycap rendering
// v4 "조용한 계기": 작은 상태 표지. 채움은 옅게, 글자는 상태 역할색(테마 반응, 대비 유지).
// 한글이 들어가므로 자간 0, 웨이트 500. mono 는 라틴 수치·키 이름에만.
import React from 'react'
import { Box, type BoxProps } from '@mui/material'
import { Led } from './Led'
import { d3roPalette, d3roFontSans, d3roFontMono, d3roRadius, typoSx } from '../../theme'
import { d3roPalette, d3roFontSans, d3roFontMono, d3roRadius, d3roTransition, d3roFocusRing } from '../../theme'
export interface TactileBadgeProps extends Omit<BoxProps, 'component'> {
/** Optional LED indicator color */
/** 앞에 붙는 상태 점 */
ledColor?: 'green' | 'amber' | 'red' | 'blue' | 'orange' | 'purple' | 'off'
/** Whether the LED should pulse */
/** 상태 점 깜빡임 (감소 모션에서는 멈춘다) */
ledPulse?: boolean
/** Semantic tone for border and background */
/** 의미 톤 */
tone?: 'default' | 'accent' | 'success' | 'warning' | 'error' | 'mono'
/** Whether to use monospace font */
/** 라틴 수치·키 이름일 때만 */
mono?: boolean
/** Interactive clickable chip */
/** 누를 수 있는 칩 */
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void
/** Content to display */
children?: React.ReactNode
}
const TONES = {
default: { color: d3roPalette.text.secondary, bg: 'transparent', border: d3roPalette.border.default },
accent: { color: d3roPalette.accent.light, bg: d3roPalette.accent.dim, border: 'transparent' },
success: { color: d3roPalette.status.success, bg: d3roPalette.status.successBg, border: 'transparent' },
warning: { color: d3roPalette.status.warning, bg: d3roPalette.status.warningBg, border: 'transparent' },
error: { color: d3roPalette.status.danger, bg: d3roPalette.status.dangerBg, border: 'transparent' },
mono: { color: d3roPalette.text.primary, bg: d3roPalette.bg.inset, border: d3roPalette.border.default },
} as const
export function TactileBadge({
ledColor,
ledPulse = false,
@ -34,73 +43,47 @@ export function TactileBadge({
...boxProps
}: TactileBadgeProps): React.ReactElement {
const isClickable = Boolean(onClick)
let textColor: string = d3roPalette.text.secondary
let borderColor: string = d3roPalette.glass.hairlineStrong
let bgColor: string = d3roPalette.glass.raised
switch (tone) {
case 'accent':
textColor = d3roPalette.accent.light
borderColor = d3roPalette.accent.dim
bgColor = d3roPalette.accent.dim
break
case 'success':
textColor = d3roPalette.tag.green
borderColor = d3roPalette.tag.greenBg
bgColor = d3roPalette.tag.greenBg
break
case 'warning':
textColor = d3roPalette.tag.orange
borderColor = d3roPalette.tag.orangeBg
bgColor = d3roPalette.tag.orangeBg
break
case 'error':
textColor = d3roPalette.tag.red
borderColor = d3roPalette.tag.redBg
bgColor = d3roPalette.tag.redBg
break
case 'mono':
textColor = d3roPalette.text.primary
borderColor = d3roPalette.border.default
bgColor = d3roPalette.bg.inset
break
}
const t = TONES[tone]
return (
<Box
{...boxProps}
onClick={onClick}
{...(isClickable
? {
role: 'button',
tabIndex: 0,
onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
e.currentTarget.click()
}
},
}
: {})}
sx={{
display: 'inline-flex',
alignItems: 'center',
gap: 0.85,
px: 1.25,
py: 0.45,
borderRadius: d3roRadius.badge,
border: `1px solid ${borderColor}`,
bgcolor: bgColor,
color: textColor,
...typoSx('meta'),
gap: 0.75,
px: 1,
height: 22,
borderRadius: d3roRadius.small,
border: `1px solid ${t.border}`,
bgcolor: t.bg,
color: t.color,
fontFamily: mono ? d3roFontMono : d3roFontSans,
fontSize: '11px',
fontWeight: 600,
letterSpacing: '0.04em',
textTransform: 'none',
fontWeight: 500,
lineHeight: 1,
letterSpacing: 0,
fontVariantNumeric: 'tabular-nums',
whiteSpace: 'nowrap',
cursor: isClickable ? 'pointer' : 'default',
transition: 'all 0.15s cubic-bezier(0.16, 1, 0.3, 1)',
transition: d3roTransition('border-color', 'color'),
...(isClickable
? {
'&:hover': {
borderColor: d3roPalette.accent.main,
color: d3roPalette.text.primary,
filter: 'brightness(1.15)',
transform: 'translateY(-1px)',
},
'&:active': {
transform: 'translateY(0) scale(0.97)',
},
'&:hover': { borderColor: d3roPalette.border.strong, color: d3roPalette.text.primary },
'&:focus-visible': d3roFocusRing,
}
: {}),
...sx,

View file

@ -1,175 +1,20 @@
'use client'
// packages/ui/src/components/ds/TiltCard.tsx
// v2 "Midnight Glass": 3D 틸트 + 커서 추종 빛 반사(specular highlight) 카드.
// MetalCard의 글래스 표면(동일 토큰)에 마우스 추적 3D 기울임 + 커서 위치에서
// 빛이 반사되는 듯한 스페큘러 하이라이트를 더한다. 라이브러리 없이 네이티브
// pointer 이벤트 + CSS 변수로 구현(리렌더 0). prefers-reduced-motion 완전 존중.
//
// 구조: 루트 Box(transform/perspective/표면/blur/링/시인/overflow) +
// ::before(앰비언트 시인) + ::after(그라디언트 헤어라인 링) +
// 자식 span.d3-tilt-spotlight(커서 추종 스페큘러, z1) + 자식 콘텐츠(z2).
// v4 "조용한 계기": 3D 틸트·커서 반사를 걷어냈다. 이름과 props 는 호환용 — 평평한 MetalCard 로 렌더한다.
// 근거: 하루 종일 켜 두는 도구에서 커서를 따라 기우는 카드는 정보가 아니라 소음이다(design.md 2026-09-28).
import { useCallback, useEffect, useRef } from 'react'
import { Box, type BoxProps } from '@mui/material'
import { d3roPalette, d3roShadow, d3roRadius } from '../../theme'
import { type BoxProps } from '@mui/material'
import { MetalCard } from './MetalCard'
interface TiltCardProps extends Omit<BoxProps, 'component'> {
/** 최대 기울기 각도(deg). 히어로 8, 작은 타일 6 권장. */
/** @deprecated v4: 틸트 없음 */
maxTilt?: number
/** 커서 추종 스페큘러 하이라이트(빛 반사) 표시 여부. */
/** @deprecated v4: 반사 없음 */
spotlight?: boolean
/** 카드 콘텐츠 */
children?: React.ReactNode
}
/**
* 3D 틸트 + 스페큘러 상호작용 엔진.
* React state를 쓰지 않고 ref의 CSS 변수를 직접 갱신해 60fps 합성.
* prefers-reduced-motion 시 틸트/추종을 모두 비활성화한다.
*/
function useTiltCard(maxTilt: number) {
const ref = useRef<HTMLDivElement>(null)
const reduceRef = useRef(false)
// OS 설정 변경(런타임 토글)에도 즉시 반응하도록 구독.
useEffect(() => {
if (typeof window === 'undefined' || !('matchMedia' in window)) return
const mq = window.matchMedia('(prefers-reduced-motion: reduce)')
reduceRef.current = mq.matches
const handler = (e: MediaQueryListEvent): void => {
reduceRef.current = e.matches
}
mq.addEventListener('change', handler)
return () => mq.removeEventListener('change', handler)
}, [])
const onPointerMove = useCallback(
(e: React.PointerEvent<HTMLDivElement>): void => {
if (reduceRef.current) return
const el = ref.current
if (!el) return
const rect = el.getBoundingClientRect()
const px = (e.clientX - rect.left) / rect.width // 0..1
const py = (e.clientY - rect.top) / rect.height // 0..1
// rotateY: 좌우 / rotateX: 상하(반전 → 커서 쪽으로 기울임)
el.style.setProperty('--d3-tilt-ry', `${((px - 0.5) * 2 * maxTilt).toFixed(2)}deg`)
el.style.setProperty('--d3-tilt-rx', `${(-(py - 0.5) * 2 * maxTilt).toFixed(2)}deg`)
el.style.setProperty('--d3-tilt-mx', `${(px * 100).toFixed(1)}%`)
el.style.setProperty('--d3-tilt-my', `${(py * 100).toFixed(1)}%`)
el.setAttribute('data-tilting', 'true')
},
[maxTilt],
)
const onPointerLeave = useCallback((): void => {
const el = ref.current
if (!el) return
// 변수를 중립으로 리셋한 뒤 data 속성 제거 → 복귀 트랜지션 동작.
// (리셋하지 않으면 마지막 각도에 고정됨)
el.style.setProperty('--d3-tilt-rx', '0deg')
el.style.setProperty('--d3-tilt-ry', '0deg')
el.style.setProperty('--d3-tilt-mx', '50%')
el.style.setProperty('--d3-tilt-my', '50%')
el.removeAttribute('data-tilting')
}, [])
return { ref, onPointerMove, onPointerLeave }
}
export function TiltCard({
children,
maxTilt = 8,
spotlight = true,
onPointerMove,
onPointerLeave,
sx,
...boxProps
}: TiltCardProps): React.ReactElement {
const tilt = useTiltCard(maxTilt)
return (
<Box
ref={tilt.ref}
{...boxProps}
onPointerMove={(e) => {
onPointerMove?.(e)
tilt.onPointerMove(e)
}}
onPointerLeave={(e) => {
onPointerLeave?.(e)
tilt.onPointerLeave()
}}
sx={{
position: 'relative',
bgcolor: d3roPalette.glass.surface,
backdropFilter: `blur(${d3roPalette.glass.blur})`,
borderRadius: d3roRadius.card,
boxShadow: d3roShadow.glowCard,
p: 3,
overflow: 'hidden',
// perspective() 단일 요소 틸트. 항상 non-none → 안정적 스태킹 컨텍스트.
transform:
'perspective(900px) rotateX(var(--d3-tilt-rx,0deg)) rotateY(var(--d3-tilt-ry,0deg))',
transition: 'transform 0.5s cubic-bezier(0.16,1,0.3,1), box-shadow 0.25s ease',
// 앰비언트 시인 (정적) — MetalCard와 동일
'&::before': {
content: '""',
position: 'absolute',
inset: 0,
borderRadius: 'inherit',
background: d3roPalette.glass.sheen,
pointerEvents: 'none',
},
// 그라디언트 헤어라인 링 (mask 링 기법) — MetalCard와 동일
'&::after': {
content: '""',
position: 'absolute',
inset: 0,
borderRadius: 'inherit',
padding: '1px',
background: d3roPalette.glass.borderGradient,
WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
WebkitMaskComposite: 'xor',
maskComposite: 'exclude',
pointerEvents: 'none',
},
'&:hover': { boxShadow: d3roShadow.glowCardHover },
// 트래킹 중: transform 트랜지션 제거(즉시 반응) + 합성 레이어 승격
'&[data-tilting="true"]': {
transition: 'box-shadow 0.25s ease',
willChange: 'transform',
},
// 스페큘러 reveal (Emotion이 plain class를 리라이트하지 않으므로 리터럴 className 사용)
'&:hover .d3-tilt-spotlight': { opacity: 1 },
// reduced-motion: 틸트·트랜지션·추종 모두 정지
'@media (prefers-reduced-motion: reduce)': {
transition: 'none',
transform: 'none',
'& .d3-tilt-spotlight': { transition: 'none' },
},
...sx,
}}
>
{spotlight && (
<Box
component="span"
className="d3-tilt-spotlight"
aria-hidden
sx={{
position: 'absolute',
inset: 0,
borderRadius: 'inherit',
pointerEvents: 'none',
zIndex: 1,
opacity: 0,
transition: 'opacity 0.25s ease',
mixBlendMode: 'screen',
background: `radial-gradient(circle 200px at var(--d3-tilt-mx,50%) var(--d3-tilt-my,50%), ${d3roPalette.glass.specular}, transparent 70%)`,
}}
/>
)}
<Box sx={{ position: 'relative', zIndex: 2 }}>{children}</Box>
</Box>
)
export function TiltCard({ maxTilt: _maxTilt, spotlight: _spotlight, children, ...rest }: TiltCardProps): React.ReactElement {
return <MetalCard {...rest}>{children}</MetalCard>
}