docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
---
|
||||
id: wiki-2026-0508-확장-가능한-스타일-시스템
|
||||
title: 확장 가능한 스타일 시스템
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Scalable Style System, Design Token System]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [frontend, design-system, css, design-tokens, theming]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: typescript
|
||||
framework: react
|
||||
---
|
||||
|
||||
# 확장 가능한 스타일 시스템
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 design token 의 single source of truth 의 의 distill 한 이후, 매 platform-agnostic transform 의 cascade"**. 매 2026 modern style system 의 W3C Design Tokens (DTCG) format + CSS Cascade Layers + Tailwind v4 oxide engine 의 combine — 매 token 의 JSON 의 author 한 이후, 매 web/iOS/Android/Figma 의 의 sync.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 layered architecture
|
||||
- **Layer 0 — Primitives**: raw values (`#0066ff`, `16px`, `1.5`).
|
||||
- **Layer 1 — Semantic**: role-based aliases (`color.text.primary`, `space.gutter`).
|
||||
- **Layer 2 — Component**: component-scoped (`button.bg.hover`).
|
||||
- **Layer 3 — Theme**: light/dark/brand variants 의 swap layer.
|
||||
|
||||
### 매 핵심 capability
|
||||
- **Token-driven**: 매 raw CSS literal 의 X — 매 token reference 의 only.
|
||||
- **Multi-platform export**: Style Dictionary / Terrazzo 의 web/iOS/Android/Figma 의 generate.
|
||||
- **Runtime theming**: CSS custom properties 의 cascade — 매 theme swap 의 zero-rebuild.
|
||||
- **Type safety**: 매 token name 의 TypeScript autocomplete 의 enforce.
|
||||
- **Cascade Layers**: `@layer reset, tokens, components, utilities` — 매 specificity war 의 elim.
|
||||
|
||||
### 매 응용
|
||||
1. Design system at scale (Material 3, IBM Carbon, Salesforce Lightning).
|
||||
2. Multi-brand SaaS (1 codebase, N tenants).
|
||||
3. Dark/light mode + high-contrast accessibility.
|
||||
4. Cross-platform app (web + RN) 의 shared token.
|
||||
5. AI-generated theme (LLM 의 brand color 의 variation 의 emit).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Design Tokens (DTCG format)
|
||||
```json
|
||||
// tokens/color.json — W3C Design Tokens Community Group spec
|
||||
{
|
||||
"color": {
|
||||
"brand": {
|
||||
"primary": { "$value": "#0066ff", "$type": "color" },
|
||||
"accent": { "$value": "#ff3366", "$type": "color" }
|
||||
},
|
||||
"text": {
|
||||
"primary": { "$value": "{color.gray.900}", "$type": "color" },
|
||||
"secondary": { "$value": "{color.gray.600}", "$type": "color" }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Style Dictionary build (multi-platform export)
|
||||
```javascript
|
||||
// style-dictionary.config.js
|
||||
export default {
|
||||
source: ['tokens/**/*.json'],
|
||||
platforms: {
|
||||
css: {
|
||||
transformGroup: 'css',
|
||||
buildPath: 'dist/css/',
|
||||
files: [{ destination: 'tokens.css', format: 'css/variables' }]
|
||||
},
|
||||
ts: {
|
||||
transformGroup: 'js',
|
||||
buildPath: 'dist/ts/',
|
||||
files: [{ destination: 'tokens.ts', format: 'javascript/es6' }]
|
||||
},
|
||||
ios: {
|
||||
transformGroup: 'ios-swift',
|
||||
buildPath: 'dist/ios/',
|
||||
files: [{ destination: 'Tokens.swift', format: 'ios-swift/class.swift' }]
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### CSS Cascade Layers (specificity hygiene)
|
||||
```css
|
||||
/* app.css */
|
||||
@layer reset, tokens, base, components, utilities;
|
||||
|
||||
@layer tokens {
|
||||
:root {
|
||||
--color-brand-primary: #0066ff;
|
||||
--space-md: 1rem;
|
||||
}
|
||||
[data-theme="dark"] {
|
||||
--color-text-primary: #f5f5f5;
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
.button { background: var(--color-brand-primary); padding: var(--space-md); }
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.text-center { text-align: center; }
|
||||
}
|
||||
```
|
||||
|
||||
### Tailwind v4 (oxide engine, CSS-first config)
|
||||
```css
|
||||
/* app.css — Tailwind 4.0+ */
|
||||
@import "tailwindcss";
|
||||
|
||||
@theme {
|
||||
--color-brand-primary: #0066ff;
|
||||
--spacing-gutter: 1.5rem;
|
||||
--font-display: "Inter Variable", sans-serif;
|
||||
}
|
||||
|
||||
/* 매 utility 의 자동 generate: bg-brand-primary, p-gutter, font-display */
|
||||
```
|
||||
|
||||
### Type-safe token access (TS + CSS vars)
|
||||
```typescript
|
||||
// tokens.ts — auto-generated
|
||||
export const tokens = {
|
||||
color: {
|
||||
brand: { primary: 'var(--color-brand-primary)' },
|
||||
text: { primary: 'var(--color-text-primary)' }
|
||||
},
|
||||
space: { md: 'var(--space-md)' }
|
||||
} as const;
|
||||
|
||||
// usage
|
||||
import { tokens } from './tokens';
|
||||
const Button = styled.button`
|
||||
background: ${tokens.color.brand.primary};
|
||||
padding: ${tokens.space.md};
|
||||
`;
|
||||
```
|
||||
|
||||
### Runtime theme swap
|
||||
```typescript
|
||||
function ThemeToggle() {
|
||||
const [theme, setTheme] = useState<'light' | 'dark'>('light');
|
||||
useEffect(() => {
|
||||
document.documentElement.dataset.theme = theme;
|
||||
}, [theme]);
|
||||
return <button onClick={() => setTheme(t => t === 'light' ? 'dark' : 'light')}>
|
||||
Toggle
|
||||
</button>;
|
||||
}
|
||||
// CSS: [data-theme="dark"] { --color-text-primary: #fff; }
|
||||
// 매 zero re-render — 매 CSS cascade 의 instant.
|
||||
```
|
||||
|
||||
### Component recipe (CVA pattern)
|
||||
```typescript
|
||||
import { cva } from 'class-variance-authority';
|
||||
|
||||
export const button = cva('button-base', {
|
||||
variants: {
|
||||
intent: {
|
||||
primary: 'bg-brand-primary text-white',
|
||||
secondary: 'bg-gray-100 text-gray-900',
|
||||
danger: 'bg-red-600 text-white'
|
||||
},
|
||||
size: {
|
||||
sm: 'px-2 py-1 text-sm',
|
||||
md: 'px-4 py-2',
|
||||
lg: 'px-6 py-3 text-lg'
|
||||
}
|
||||
},
|
||||
defaultVariants: { intent: 'primary', size: 'md' }
|
||||
});
|
||||
|
||||
<button className={button({ intent: 'danger', size: 'lg' })}>Delete</button>
|
||||
```
|
||||
|
||||
### Multi-tenant brand swap
|
||||
```typescript
|
||||
// 매 tenant 의 own token override
|
||||
function loadTenantTheme(tenantId: string) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = `/themes/${tenantId}.css`;
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
// /themes/acme.css → :root { --color-brand-primary: #ff8800; }
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Solo / small project | Tailwind v4 `@theme` only |
|
||||
| Multi-platform (web+iOS+Android) | DTCG tokens + Style Dictionary |
|
||||
| Multi-brand SaaS | CSS vars + tenant theme file |
|
||||
| Complex design system | DTCG + Cascade Layers + CVA |
|
||||
| Figma-synced | Tokens Studio plugin + DTCG export |
|
||||
|
||||
**기본값**: DTCG JSON + Style Dictionary + Tailwind v4 + CSS Cascade Layers.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Design-System]] · [[CSS Architecture]]
|
||||
- 변형: [[Tailwind CSS]] · [[CSS_Architecture_and_Styling|CSS-in-JS]]
|
||||
- 응용: [[Theming]] · [[Dark-Mode]]
|
||||
- Adjacent: [[Design-Tokens]] · [[Accessibility (A11y)|Accessibility]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 token rename refactor (1 source → N platform 의 propagate); 매 brand variant 의 LLM 의 generate ("매 corporate / playful / luxury 의 3 palette"); 매 a11y contrast 의 audit.
|
||||
**언제 X**: 매 final color picking 의 designer / brand 의 final call — LLM 의 raw suggestion 의 X canonical.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Magic number**: 매 raw `padding: 13px` — token 의 X.
|
||||
- **Tight component coupling**: button 의 `#0066ff` 의 hardcode — theme swap 의 die.
|
||||
- **Over-tokenization**: 매 every value 의 token — 매 friction 의 increase.
|
||||
- **Specificity war**: `!important` 의 spam — cascade layer 의 use.
|
||||
- **Ad-hoc dark mode**: 매 component 의 매 own dark logic — 매 token level 의 push.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (W3C DTCG spec; Tailwind v4 docs; Material 3 token system; Salesforce Lightning Design System).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — DTCG + Tailwind v4 + Cascade Layers patterns 추가 |
|
||||
Reference in New Issue
Block a user