asharyu-design-token 2.0.4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +222 -0
- package/README.ko.md +222 -0
- package/README.md +222 -135
- package/README.zh-TW.md +222 -0
- package/SKILL.md +91 -0
- package/dist/{src/color → color}/semanticValue.d.ts +1 -1
- package/dist/elevation/index.d.ts +19 -0
- package/dist/figma-variables.json +624 -0
- package/dist/font/index.d.ts +64 -0
- package/dist/index.css +106 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.ts +603 -0
- package/dist/index.js +104 -4
- package/dist/radius/index.d.ts +20 -0
- package/dist/spacing/index.d.ts +24 -0
- package/dist/tokens.json +1393 -0
- package/dist/zIndex/index.d.ts +30 -0
- package/package.json +61 -42
- package/dist/src/color/index.d.ts +0 -0
- package/dist/src/color/value.d.ts +0 -21
- package/dist/src/font/index.d.ts +0 -12
- package/dist/src/index.d.ts +0 -297
- package/dist/src/prev/value.d.ts +0 -21
- /package/dist/{src/color → color}/colorValue.d.ts +0 -0
- /package/dist/{src/font → font}/value.d.ts +0 -0
- /package/dist/{src/interaction → interaction}/index.d.ts +0 -0
- /package/dist/{src/motion → motion}/index.d.ts +0 -0
- /package/dist/{src/stroke → stroke}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,135 +1,222 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
npm
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
1
|
+
# asharyu-design-token
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**A Design Token System Inspired by Yin-Yang, Wu Xing, and Korean Traditional Ink & Wash Aesthetics.**
|
|
6
|
+
*음양오행(陰陽五行)과 수묵·담채화의 미학을 담은 디자인 토큰 시스템*
|
|
7
|
+
|
|
8
|
+
[English](README.md) | [한국어](README.ko.md) | [繁體中文](README.zh-TW.md) | [日本語](README.ja.md)
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/asharyu-design-token)
|
|
11
|
+
[](https://github.com/yoonjonglyu/asharyu-design/blob/main/LICENSE)
|
|
12
|
+
[-success?style=flat-square&color=ACC4A6)](https://www.w3.org/WAI/WCAG21/quickref/)
|
|
13
|
+
[](https://tokens.studio/)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📖 Table of Contents
|
|
20
|
+
1. [Installation](#1-installation)
|
|
21
|
+
2. [Quick Start](#2-quick-start)
|
|
22
|
+
3. [Design Philosophy](#3-design-philosophy)
|
|
23
|
+
4. [Token Specifications & CSS Variables](#4-token-specifications--css-variables)
|
|
24
|
+
5. [🎨 Figma Integration](#5--figma-integration)
|
|
25
|
+
6. [🤖 AI Agent Integration](#6--ai-agent-integration)
|
|
26
|
+
7. [Accessibility & Testing](#7-accessibility--testing)
|
|
27
|
+
8. [License](#8-license)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 1. Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# npm
|
|
35
|
+
npm install asharyu-design-token
|
|
36
|
+
|
|
37
|
+
# pnpm
|
|
38
|
+
pnpm add asharyu-design-token
|
|
39
|
+
|
|
40
|
+
# yarn
|
|
41
|
+
yarn add asharyu-design-token
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 2. Quick Start
|
|
47
|
+
|
|
48
|
+
### 1) Load Global CSS Variables
|
|
49
|
+
Import the compiled stylesheet at your application's entry point (`index.tsx`, `App.tsx`, or main CSS):
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import 'asharyu-design-token/index.css';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2) Use with CSS-in-JS (Emotion / Styled-Components)
|
|
56
|
+
Import the typed `tokens` bridge object for full TypeScript autocompletion and CSS variable references:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import styled from '@emotion/styled';
|
|
60
|
+
import { tokens } from 'asharyu-design-token';
|
|
61
|
+
|
|
62
|
+
const AsharyuCard = styled.div`
|
|
63
|
+
background-color: ${tokens.color.semantic.surface.primary};
|
|
64
|
+
border: ${tokens.stroke.weight.sharp} solid ${tokens.color.semantic.stroke};
|
|
65
|
+
border-radius: ${tokens.radius.gentle};
|
|
66
|
+
padding: ${tokens.spacing.void};
|
|
67
|
+
box-shadow: ${tokens.elevation.damMuk};
|
|
68
|
+
transition: ${tokens.interaction.flow.sangSaeng};
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
border-width: ${tokens.stroke.weight.fine};
|
|
72
|
+
box-shadow: ${tokens.elevation.jungMuk};
|
|
73
|
+
transform: translateY(-2px);
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3) Yin-Yang (Light / Dark) Theme Switching
|
|
79
|
+
Switch themes instantaneously via the `data-theme` attribute:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- Light Mode (Yang 陽) : Default -->
|
|
83
|
+
<html data-theme="light"> ... </html>
|
|
84
|
+
|
|
85
|
+
<!-- Dark Mode (Yin 陰) -->
|
|
86
|
+
<html data-theme="dark"> ... </html>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 3. Design Philosophy
|
|
92
|
+
|
|
93
|
+
**asharyu** translates Eastern cosmological principles—**Yin-Yang (陰陽)**, **Wu Xing (五行, Five Elements)**, and the ink gradation of **Sumuk-damchae (수묵·담채화)**—into a rigorous, logic-driven digital design system.
|
|
94
|
+
|
|
95
|
+
1. **Sharpness (예리함 / 묵선)**: Precise, razor-sharp 0.5px ink strokes (`--asharyu-stroke-weight-sharp`) define clear information boundaries.
|
|
96
|
+
2. **Void (여백 / 한지의 숨구멍)**: Breathing room (`--asharyu-spacing-void`) reflects the aesthetic of Hanji paper, avoiding cramped layouts.
|
|
97
|
+
3. **Nong-dam Elevation (농담의 깊이)**: Replaces artificial shadows with the natural depth of ink diffusion (Dam-muk, Jung-muk, Nong-muk).
|
|
98
|
+
4. **Ki-un Motion (기운생동)**: Animations are choreographed according to Sang-saeng (相生, harmonic flow) and Sang-geuk (相剋, decisive feedback).
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 4. Token Specifications & CSS Variables
|
|
103
|
+
|
|
104
|
+
### ① Color Tokens
|
|
105
|
+
|
|
106
|
+
#### Wu Xing (五行) — Primary Action & Surface
|
|
107
|
+
| Element | Semantic Role | Usage | CSS Variable |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| **Yang / Yin (Theme)** | Background & Text | Hanji white / Deep abyssal ink | `--asharyu-color-semantic-background`, `-text` |
|
|
110
|
+
| **Wood (木, 목)** | `Action` | Primary action, buttons, links | `--asharyu-color-semantic-action-primary` |
|
|
111
|
+
| **Fire (火, 화)** | `Danger` | Danger, alert, destructive actions | `--asharyu-color-semantic-danger-primary` |
|
|
112
|
+
| **Earth (土, 토)** | `Surface` | Cards, container surfaces, resting areas | `--asharyu-color-semantic-surface-primary` |
|
|
113
|
+
| **Metal (金, 금)** | `Border` | Borders, dividers, structured edges | `--asharyu-color-semantic-border-primary` |
|
|
114
|
+
| **Water (水, 수)** | `Info` | Navigation, auxiliary information, flow | `--asharyu-color-semantic-info-primary` |
|
|
115
|
+
|
|
116
|
+
#### Five Intermediate Colors (五間色, 오간색) — Secondary Status & Feedback
|
|
117
|
+
| Color | Semantic Role | Formulation | CSS Variable |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| **Nok (綠, 녹)** | `Success` | Wood + Earth | `--asharyu-color-semantic-status-success-primary` |
|
|
120
|
+
| **Hong (紅, 홍)** | `Alert-Hover` | Fire + Metal | `--asharyu-color-semantic-status-alert-hover-primary` |
|
|
121
|
+
| **Byeok (碧, 벽)** | `Focus` | Wood + Metal | `--asharyu-color-semantic-status-action-focus-primary` |
|
|
122
|
+
| **Yu (硫黃, 유황)** | `Warning / Sub-Surface` | Earth + Water | `--asharyu-color-semantic-status-sub-surface-primary` |
|
|
123
|
+
| **Ja (紫, 자)** | `Special / Active` | Fire + Water | `--asharyu-color-semantic-status-info-active-primary` |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### ② Spacing & Void
|
|
128
|
+
|
|
129
|
+
| Key | CSS Variable | Rem | Px | Concept & Usage |
|
|
130
|
+
|---|---|---|---|---|
|
|
131
|
+
| `compact` | `--asharyu-spacing-compact` | `0.25rem` | 4px | Instant: icon spacing, tag padding |
|
|
132
|
+
| `fine` | `--asharyu-spacing-fine` | `0.5rem` | 8px | Fine: inline element spacing |
|
|
133
|
+
| `moderate` | `--asharyu-spacing-moderate` | `0.75rem` | 12px | Near: form controls & list items |
|
|
134
|
+
| `base` | `--asharyu-spacing-base` | `1rem` | 16px | Regular: standard card padding |
|
|
135
|
+
| `void` | `--asharyu-spacing-void` | `1.5rem` | 24px | **Void: breathing space (standard component margin)** |
|
|
136
|
+
| `wide` | `--asharyu-spacing-wide` | `2rem` | 32px | Distant: section inner grouping |
|
|
137
|
+
| `spacious` | `--asharyu-spacing-spacious` | `3rem` | 48px | Spacious: inter-section gap |
|
|
138
|
+
| `vast` | `--asharyu-spacing-vast` | `4rem` | 64px | Vast: page-level margins |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### ③ Radius (Curvature)
|
|
143
|
+
|
|
144
|
+
- `--asharyu-radius-sharp`: `0px` (Sword's edge, crisp orthogonal corners)
|
|
145
|
+
- `--asharyu-radius-delicate`: `0.25rem` (4px, understated curves for tags)
|
|
146
|
+
- `--asharyu-radius-gentle`: `0.5rem` (8px, warm organic curvature for cards)
|
|
147
|
+
- `--asharyu-radius-smooth`: `0.75rem` (12px, flowing curves for dialogs)
|
|
148
|
+
- `--asharyu-radius-prominent`: `1rem` (16px, large surface rounding)
|
|
149
|
+
- `--asharyu-radius-full`: `9999px` (Taegeuk, circular avatars & pills)
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### ④ Nong-dam Elevation & Shadows
|
|
154
|
+
|
|
155
|
+
Depth tokens that dynamically respond to Yin-Yang (Light/Dark) themes via ink diffusion:
|
|
156
|
+
- `--asharyu-elevation-none`: Flat surface
|
|
157
|
+
- `--asharyu-elevation-dam-muk`: **Dam-muk (淡墨, Light Ink)** — card hover, dropdowns
|
|
158
|
+
- `--asharyu-elevation-jung-muk`: **Jung-muk (中墨, Medium Ink)** — popovers, floating boards
|
|
159
|
+
- `--asharyu-elevation-nong-muk`: **Nong-muk (濃墨, Dark Ink)** — modal dialogs
|
|
160
|
+
- `--asharyu-elevation-guk-muk`: **Guk-muk (極墨, Deepest Ink)** — floating toasts & critical alerts
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### ⑤ Typography
|
|
165
|
+
|
|
166
|
+
- **Families**:
|
|
167
|
+
- `--asharyu-font-family-serif`: Lyrical Hanji 바탕/명조 (`Gowun Batang`, `Noto Serif KR`)
|
|
168
|
+
- `--asharyu-font-family-sans`: Modern readable sans-serif (`Pretendard`, system-ui)
|
|
169
|
+
- `--asharyu-font-family-mono`: Monospace for code & numbers (`JetBrains Mono`, monospace)
|
|
170
|
+
- **Weights**:
|
|
171
|
+
- `--asharyu-font-weight-light` (300 / Dam), `--asharyu-font-weight-regular` (400 / Sang), `--asharyu-font-weight-semibold` (600 / Nong), `--asharyu-font-weight-bold` (700 / Pil)
|
|
172
|
+
- **Line Heights**:
|
|
173
|
+
- `--asharyu-font-line-height-tight` (1.25), `--asharyu-font-line-height-normal` (1.5), `--asharyu-font-line-height-relaxed` (1.75)
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 5. 🎨 Figma Integration
|
|
178
|
+
|
|
179
|
+
`asharyu-design-token` automatically generates and exports design token files ready for Figma:
|
|
180
|
+
|
|
181
|
+
### Method A: Tokens Studio for Figma (Recommended)
|
|
182
|
+
1. Open the **Tokens Studio for Figma** plugin in Figma.
|
|
183
|
+
2. Under `Settings` > `Sync Providers`, select **GitHub** or choose **Load from local file**.
|
|
184
|
+
3. Select **`node_modules/asharyu-design-token/dist/tokens.json`**.
|
|
185
|
+
4. The `global`, `light`, and `dark` token sets will be loaded with colors, spacing, radius, typography, and shadows fully synchronized.
|
|
186
|
+
|
|
187
|
+
### Method B: Native Figma Variables
|
|
188
|
+
1. Use **`node_modules/asharyu-design-token/dist/figma-variables.json`**.
|
|
189
|
+
2. Import via Figma Variables REST API or a variable import plugin to create `Color (Raw)`, `Color (Semantic)` (with Light/Dark modes), and `Spacing & Radius` collections.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 6. 🤖 AI Agent Integration
|
|
194
|
+
|
|
195
|
+
When pair-programming with AI agents (**Google Antigravity**, **Cursor**, **Claude Code**, **GitHub Copilot**), you can guide the model to follow the Asharyu design system:
|
|
196
|
+
|
|
197
|
+
### 1) Antigravity Workspace Integration
|
|
198
|
+
The package provides a built-in skill at `.agents/skills/asharyu-design-system/` and a workspace rule at `.agents/rules/asharyu-design-system.md` to ensure zero token drift.
|
|
199
|
+
|
|
200
|
+
### 2) Direct Prompt Guide Reference
|
|
201
|
+
You can inject the included prompt guide directly into your AI prompt:
|
|
202
|
+
```
|
|
203
|
+
node_modules/asharyu-design-token/SKILL.md
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 7. Accessibility & Testing
|
|
209
|
+
|
|
210
|
+
- **WCAG 2.1 AAA Compliant**:
|
|
211
|
+
- Light mode text-on-background contrast: **18.52 : 1** (far exceeds the 7.0:1 AAA standard)
|
|
212
|
+
- Dark mode text-on-background contrast: **18.52 : 1** (far exceeds the 7.0:1 AAA standard)
|
|
213
|
+
- **Interactive Boundaries & Focus**:
|
|
214
|
+
- State lines (`action.sharp`, `danger.sharp`) meet WCAG 2.1 AA (≥ 4.5:1).
|
|
215
|
+
- **Automated Validation Suite**:
|
|
216
|
+
- `pnpm test` verifies token integrity, CSS variable parity, and WCAG contrast ratios with 100% test coverage.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 8. License
|
|
221
|
+
|
|
222
|
+
This project is licensed under the [Apache 2.0 License](https://github.com/yoonjonglyu/asharyu-design/blob/main/LICENSE).
|
package/README.zh-TW.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# asharyu-design-token
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**融合陰陽五行與水墨·淡彩畫美學的設計權杖(Design Token)系統**
|
|
6
|
+
*A Design Token System Inspired by Yin-Yang, Wu Xing, and Korean Traditional Ink & Wash Aesthetics.*
|
|
7
|
+
|
|
8
|
+
[English](README.md) | [한국어](README.ko.md) | [繁體中文](README.zh-TW.md) | [日本語](README.ja.md)
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/asharyu-design-token)
|
|
11
|
+
[](https://github.com/yoonjonglyu/asharyu-design/blob/main/LICENSE)
|
|
12
|
+
[-success?style=flat-square&color=ACC4A6)](https://www.w3.org/WAI/WCAG21/quickref/)
|
|
13
|
+
[](https://tokens.studio/)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📖 目錄
|
|
20
|
+
1. [安裝 (Installation)](#1-安裝-installation)
|
|
21
|
+
2. [快速入門 (Quick Start)](#2-快速入門-quick-start)
|
|
22
|
+
3. [核心美學與設計哲學 (Design Philosophy)](#3-核心美學與設計哲學-design-philosophy)
|
|
23
|
+
4. [Token 規範與 CSS 變數 (Token Specifications)](#4-token-規範與-css-變數-token-specifications)
|
|
24
|
+
5. [🎨 Figma 設計權杖整合 (Figma Integration)](#5--figma-設計權杖整合-figma-integration)
|
|
25
|
+
6. [🤖 AI Agent 整合 (Agent & Skill Integration)](#6--ai-agent-整合-agent--skill-integration)
|
|
26
|
+
7. [無障礙與品質驗證 (Accessibility)](#7-無障礙與品質驗證-accessibility)
|
|
27
|
+
8. [授權條款 (License)](#8-授權條款-license)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 1. 安裝 (Installation)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# npm
|
|
35
|
+
npm install asharyu-design-token
|
|
36
|
+
|
|
37
|
+
# pnpm
|
|
38
|
+
pnpm add asharyu-design-token
|
|
39
|
+
|
|
40
|
+
# yarn
|
|
41
|
+
yarn add asharyu-design-token
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 2. 快速入門 (Quick Start)
|
|
47
|
+
|
|
48
|
+
### 1) 載入全域 CSS 變數
|
|
49
|
+
在專案的入口檔案(如 `index.tsx`, `App.tsx` 或全域 CSS)中引入樣式表:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import 'asharyu-design-token/index.css';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2) 在 CSS-in-JS (Emotion / Styled-Components) 中使用
|
|
56
|
+
匯入具備完整 TypeScript 型別提示的 `tokens` 物件,安全引用 CSS 變數:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import styled from '@emotion/styled';
|
|
60
|
+
import { tokens } from 'asharyu-design-token';
|
|
61
|
+
|
|
62
|
+
const AsharyuCard = styled.div`
|
|
63
|
+
background-color: ${tokens.color.semantic.surface.primary};
|
|
64
|
+
border: ${tokens.stroke.weight.sharp} solid ${tokens.color.semantic.stroke};
|
|
65
|
+
border-radius: ${tokens.radius.gentle};
|
|
66
|
+
padding: ${tokens.spacing.void};
|
|
67
|
+
box-shadow: ${tokens.elevation.damMuk};
|
|
68
|
+
transition: ${tokens.interaction.flow.sangSaeng};
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
border-width: ${tokens.stroke.weight.fine};
|
|
72
|
+
box-shadow: ${tokens.elevation.jungMuk};
|
|
73
|
+
transform: translateY(-2px);
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3) 陰陽(深色 / 淺色)主題切換
|
|
79
|
+
透過 `data-theme` 屬性即可瞬間切換全域主題:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- 陽(淺色模式): 預設值 -->
|
|
83
|
+
<html data-theme="light"> ... </html>
|
|
84
|
+
|
|
85
|
+
<!-- 陰(深色模式) -->
|
|
86
|
+
<html data-theme="dark"> ... </html>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 3. 核心美學與設計哲學 (Design Philosophy)
|
|
92
|
+
|
|
93
|
+
**asharyu** 並非單憑主觀感官,而是將東方傳統的**陰陽(Yin-Yang)**、**五行(Wu Xing)**以及水墨淡彩畫的**筆觸與濃淡(Nong-dam)**轉化為嚴謹、邏輯化的數位介面規範。
|
|
94
|
+
|
|
95
|
+
1. **銳利之墨線 (Sharpness)**:以如刀裁般鮮明的 0.5px 墨線(`--asharyu-stroke-weight-sharp`)定義清晰的資訊界線。
|
|
96
|
+
2. **宣紙之留白 (Void)**:注重呼吸空間(`--asharyu-spacing-void`),展現傳統紙張的留白意境,避免擁擠堆砌。
|
|
97
|
+
3. **濃淡層次 (Nong-dam Elevation)**:捨棄生硬的人工投影,以水墨暈染的濃淡(淡墨、中墨、濃墨、極墨)呈現溫潤而深邃的空間感。
|
|
98
|
+
4. **氣韻生動動效 (Ki-un Motion)**:動畫遵循五行之相生(順暢柔和之流動)與相剋(銳利決斷之回饋)邏輯。
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 4. Token 規範與 CSS 變數 (Token Specifications)
|
|
103
|
+
|
|
104
|
+
### ① 色彩 (Color Tokens)
|
|
105
|
+
|
|
106
|
+
#### 五行 (五行) — 主要操作與容器表面 (Primary Semantic)
|
|
107
|
+
| 元素 | 語意功能 | 主要用途 | 代表 CSS 變數 |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| **陽 / 陰 (Theme)** | 背景與正文文字 | 宣紙米白、深淵墨黑 | `--asharyu-color-semantic-background`, `-text` |
|
|
110
|
+
| **木 (Wood)** | `Action` | 主要操作、按鈕、重要連結 | `--asharyu-color-semantic-action-primary` |
|
|
111
|
+
| **火 (Fire)** | `Danger` | 警告、錯誤、破壞性操作 | `--asharyu-color-semantic-danger-primary` |
|
|
112
|
+
| **土 (Earth)** | `Surface` | 卡片底色、面板容器、休憩空間 | `--asharyu-color-semantic-surface-primary` |
|
|
113
|
+
| **金 (Metal)** | `Border` | 邊界線、分隔線、堅固輪廓 | `--asharyu-color-semantic-border-primary` |
|
|
114
|
+
| **水 (Water)** | `Info` | 導覽、輔助資訊、流動指引 | `--asharyu-color-semantic-info-primary` |
|
|
115
|
+
|
|
116
|
+
#### 五間色 (五間色) — 次要狀態與互動回饋 (Secondary Status)
|
|
117
|
+
| 間色 | 語意功能 | 配方關係 | 代表 CSS 變數 |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| **綠 (Nok)** | `Success` | 木 + 土 | `--asharyu-color-semantic-status-success-primary` |
|
|
120
|
+
| **紅 (Hong)** | `Alert-Hover` | 火 + 金 | `--asharyu-color-semantic-status-alert-hover-primary` |
|
|
121
|
+
| **碧 (Byeok)** | `Focus` | 木 + 金 | `--asharyu-color-semantic-status-action-focus-primary` |
|
|
122
|
+
| **硫黃 (Yu)** | `Warning / Sub-Surface` | 土 + 水 | `--asharyu-color-semantic-status-sub-surface-primary` |
|
|
123
|
+
| **紫 (Ja)** | `Special / Active` | 火 + 水 | `--asharyu-color-semantic-status-info-active-primary` |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### ② 留白與間距 (Spacing & Void)
|
|
128
|
+
|
|
129
|
+
| 鍵名 | CSS 變數 | 單位 (rem) | 單位 (px) | 用途與意境 |
|
|
130
|
+
|---|---|---|---|---|
|
|
131
|
+
| `compact` | `--asharyu-spacing-compact` | `0.25rem` | 4px | 剎那:圖示間隔、標籤內距 |
|
|
132
|
+
| `fine` | `--asharyu-spacing-fine` | `0.5rem` | 8px | 細目:行內元件間距 |
|
|
133
|
+
| `moderate` | `--asharyu-spacing-moderate` | `0.75rem` | 12px | 近距:表單控制項與清單 |
|
|
134
|
+
| `base` | `--asharyu-spacing-base` | `1rem` | 16px | 平常:標準卡片內距 |
|
|
135
|
+
| `void` | `--asharyu-spacing-void` | `1.5rem` | 24px | **留白:宣紙之呼吸(標準元件留白)** |
|
|
136
|
+
| `wide` | `--asharyu-spacing-wide` | `2rem` | 32px | 深遠:區塊群組間距 |
|
|
137
|
+
| `spacious` | `--asharyu-spacing-spacious` | `3rem` | 48px | 大留白:大區塊間隔 |
|
|
138
|
+
| `vast` | `--asharyu-spacing-vast` | `4rem` | 64px | 廣漠:頁面層級留白 |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### ③ 圓角曲率 (Radius)
|
|
143
|
+
|
|
144
|
+
- `--asharyu-radius-sharp`: `0px`(劍鋒銳角,俐落直角)
|
|
145
|
+
- `--asharyu-radius-delicate`: `0.25rem`(4px,微斂圓角)
|
|
146
|
+
- `--asharyu-radius-gentle`: `0.5rem`(8px,溫和自然曲率)
|
|
147
|
+
- `--asharyu-radius-smooth`: `0.75rem`(12px,流暢圓弧)
|
|
148
|
+
- `--asharyu-radius-prominent`: `1rem`(16px,大容器圓角)
|
|
149
|
+
- `--asharyu-radius-full`: `9999px`(太極,圓形頭像與膠囊按鈕)
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### ④ 濃淡陰影 (Elevation & Depth)
|
|
154
|
+
|
|
155
|
+
依據水墨暈染濃淡,在深淺模式中自動感應的立體深淺 Token:
|
|
156
|
+
- `--asharyu-elevation-none`: 平面無陰影
|
|
157
|
+
- `--asharyu-elevation-dam-muk`: **淡墨 (Dam-muk)** — 卡片懸停、下拉選單
|
|
158
|
+
- `--asharyu-elevation-jung-muk`: **中墨 (Jung-muk)** — 浮動面板、氣泡提示
|
|
159
|
+
- `--asharyu-elevation-nong-muk`: **濃墨 (Nong-muk)** — 對話方塊(Modal)
|
|
160
|
+
- `--asharyu-elevation-guk-muk`: **極墨 (Guk-muk)** — 最上層浮動通知(Toast)
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### ⑤ 字體排印 (Typography)
|
|
165
|
+
|
|
166
|
+
- **字系 (Font Family)**:
|
|
167
|
+
- `--asharyu-font-family-serif`: 展現宣紙纖維感的明體 / 楷體 (`Gowun Batang`, `Noto Serif KR`)
|
|
168
|
+
- `--asharyu-font-family-sans`: 現代清晰之無襯線黑體 (`Pretendard`, system-ui)
|
|
169
|
+
- `--asharyu-font-family-mono`: 程式碼等寬字型 (`JetBrains Mono`, monospace)
|
|
170
|
+
- **筆壓字重 (Font Weight)**:
|
|
171
|
+
- `--asharyu-font-weight-light`(300/淡)、`regular`(400/常)、`semibold`(600/濃)、`bold`(700/筆)
|
|
172
|
+
- **行高 (Line Height)**:
|
|
173
|
+
- `--asharyu-font-line-height-tight`(1.25)、`normal`(1.5)、`relaxed`(1.75)
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 5. 🎨 Figma 設計權杖整合 (Figma Integration)
|
|
178
|
+
|
|
179
|
+
`asharyu-design-token` 在建置時會自動生成可直接匯入 Figma 的權杖檔案:
|
|
180
|
+
|
|
181
|
+
### 方法 A:使用 Tokens Studio for Figma 外掛(推薦)
|
|
182
|
+
1. 在 Figma 中開啟 **Tokens Studio for Figma** 外掛。
|
|
183
|
+
2. 於 `Settings` > `Sync Providers` 選擇 **GitHub** 或選擇 **Load from local file**。
|
|
184
|
+
3. 選取 **`node_modules/asharyu-design-token/dist/tokens.json`**。
|
|
185
|
+
4. 即可載入 `global`, `light`, `dark` 權杖集,將色彩、留白、圓角、陰影完整套用至 Figma 設計稿。
|
|
186
|
+
|
|
187
|
+
### 方法 B:原生 Figma Variables
|
|
188
|
+
1. 使用 **`node_modules/asharyu-design-token/dist/figma-variables.json`**。
|
|
189
|
+
2. 透過 Figma Variables REST API 或匯入外掛,一鍵生成 `Color (Raw)`, `Color (Semantic)`(含 Light/Dark 模式)及 `Spacing & Radius` 變數集合。
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 6. 🤖 AI Agent 整合 (Agent & Skill Integration)
|
|
194
|
+
|
|
195
|
+
與 **Antigravity**, **Cursor**, **Claude Code**, **GitHub Copilot** 等 AI 助手結伴程式設計時,可自動載入 Asharyu 設計系統規範:
|
|
196
|
+
|
|
197
|
+
### 1) Antigravity 工作區支援
|
|
198
|
+
本套件內建 `.agents/skills/asharyu-design-system/` 技能與 `.agents/rules/asharyu-design-system.md` 規則,確保 AI 生成程式碼時不發生樣式偏移。
|
|
199
|
+
|
|
200
|
+
### 2) 直接引用提示詞指南
|
|
201
|
+
可直接將隨附的提示指南注入 AI 系統提示中:
|
|
202
|
+
```
|
|
203
|
+
node_modules/asharyu-design-token/SKILL.md
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 7. 無障礙與品質驗證 (Accessibility)
|
|
209
|
+
|
|
210
|
+
- **符合 WCAG 2.1 AAA 級規範**:
|
|
211
|
+
- 淺色模式文字對比度:**18.52 : 1**(遠高於 7.0:1 之 AAA 標準)
|
|
212
|
+
- 深色模式文字對比度:**18.52 : 1**(遠高於 7.0:1 之 AAA 標準)
|
|
213
|
+
- **UI 邊界線與焦點圈**:
|
|
214
|
+
- 狀態線條均達到 WCAG 2.1 AA 規範(≥ 4.5:1)。
|
|
215
|
+
- **自動化測試覆蓋**:
|
|
216
|
+
- 每次建置皆執行自動化測試,確保 Token 結構、CSS 變數一致性與對比度達成率達 100%。
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 8. 授權條款 (License)
|
|
221
|
+
|
|
222
|
+
本專案採用 [Apache 2.0 授權條款](https://github.com/yoonjonglyu/asharyu-design/blob/main/LICENSE)。
|