@gyeol-ui/tokens 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +194 -2
- package/dist/index.d.ts +59 -0
- package/dist/index.js +55 -0
- package/dist/tokens.css +69 -0
- package/dist/tokens.json +92 -0
- package/package.json +53 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 gyeol-ui contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,195 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gyeol-ui/tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
gyeol-ui의 Design Token 패키지입니다.
|
|
4
|
+
|
|
5
|
+
> 🚧 아직 npm에 배포하지 않았습니다.
|
|
6
|
+
>
|
|
7
|
+
> 지금 들어 있는 토큰은 Figma에서 내보낸 것이 아니라 **손으로 쓴 임시 씨앗 토큰**입니다. 값과 이름은 Figma 플러그인이 토큰을 내보내기 시작하면 바뀔 수 있습니다. 지금은 Primitive Token(색, 간격, 모서리)과 Semantic Token만 있습니다.
|
|
8
|
+
|
|
9
|
+
## 사용법
|
|
10
|
+
|
|
11
|
+
### CSS 변수
|
|
12
|
+
|
|
13
|
+
CSS 파일 하나를 import하면 `:root`에 CSS 변수가 정의됩니다.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import "@gyeol-ui/tokens/tokens.css";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
.card {
|
|
21
|
+
padding: var(--gyeol-spacing-4);
|
|
22
|
+
border-radius: var(--gyeol-radius-md);
|
|
23
|
+
background: var(--gyeol-bg-surface);
|
|
24
|
+
color: var(--gyeol-fg-default);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
변수 이름은 `--gyeol-` 뒤에 토큰 경로를 `-`로 이은 것입니다(`spacing.4` → `--gyeol-spacing-4`).
|
|
29
|
+
|
|
30
|
+
| 범주 | 변수 | 공개 API |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| Semantic 색 | `--gyeol-bg-surface`, `--gyeol-bg-subtle`, `--gyeol-fg-default`, `--gyeol-fg-muted`, `--gyeol-border-default`, `--gyeol-bg-accent`, `--gyeol-fg-on-accent`, `--gyeol-ring-offset`, `--gyeol-alpha-90` | 예 |
|
|
33
|
+
| 간격 | `--gyeol-spacing-{1, 2, 3, 4, 6, 8}` (4px의 배수, `spacing-4` = 16px) | 예 |
|
|
34
|
+
| 모서리 | `--gyeol-radius-{sm, md, full}` | 예 |
|
|
35
|
+
| 색 | `--gyeol-color-*` | 아니요 |
|
|
36
|
+
|
|
37
|
+
`--gyeol-color-*`는 Primitive 색이라 출력은 되지만 공개 API가 아닙니다. 색에는 Semantic 변수를 쓰세요. Semantic 변수의 값은 `var(--gyeol-color-gray-900)`처럼 Primitive나 다른 Semantic 변수를 가리킵니다.
|
|
38
|
+
|
|
39
|
+
투명도가 있는 Semantic 변수는 가리키는 변수를 `color-mix()`로 투명하게 섞습니다. 가리키는 변수의 색이 Color Scheme에 따라 바뀌면 함께 바뀝니다.
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
--gyeol-alpha-90: color-mix(in srgb, var(--gyeol-bg-surface) 90%, transparent);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`alpha` 그룹은 `bg-surface`의 투명도 단계이고, 숫자는 불투명도입니다(`alpha-90` = `bg-surface`의 90%). `color-mix()`는 iOS Safari 16.2, Android WebView 111부터 쓸 수 있습니다.
|
|
46
|
+
|
|
47
|
+
### Color Scheme 고르기
|
|
48
|
+
|
|
49
|
+
Semantic 색은 Color Scheme(light/dark)에 따라 바뀝니다. 아무것도 하지 않으면 OS나 웹뷰의 설정(`prefers-color-scheme`)을 따릅니다. 웹뷰에서는 네이티브 앱의 light/dark 설정이 여기에 반영됩니다.
|
|
50
|
+
|
|
51
|
+
사이트 안에서 직접 고르려면 `<html>`에 `data-color-scheme` 속성을 붙입니다. 속성이 있으면 OS 설정보다 속성을 따릅니다.
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<html data-color-scheme="dark"> <!-- 항상 dark -->
|
|
55
|
+
<html data-color-scheme="light"> <!-- 항상 light -->
|
|
56
|
+
<html> <!-- OS 설정을 따른다 -->
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| 조건 | 적용되는 블록 |
|
|
60
|
+
|---|---|
|
|
61
|
+
| 기본 | `:root` (light) |
|
|
62
|
+
| OS 설정이 dark이고 `data-color-scheme="light"`가 아님 | `@media (prefers-color-scheme: dark) { :root:not([data-color-scheme="light"]) }` (dark) |
|
|
63
|
+
| `data-color-scheme="dark"` | `:root[data-color-scheme="dark"]` (dark) |
|
|
64
|
+
|
|
65
|
+
`data-color-scheme`은 `<html>`에서만 동작합니다. 페이지 일부(`<section>` 등)에 붙이면 아무 효과가 없고, 그 요소는 `<html>`의 Color Scheme을 그대로 따릅니다. 페이지 안에서 영역마다 Color Scheme을 다르게 하는 것은 지원하지 않습니다.
|
|
66
|
+
|
|
67
|
+
블록마다 CSS `color-scheme` 속성도 함께 정의하므로 스크롤바와 폼 컨트롤 같은 브라우저 기본 UI도 같은 Color Scheme을 따릅니다.
|
|
68
|
+
|
|
69
|
+
> **Android 웹뷰(targetSdk 32 이하)**: 이 웹뷰는 페이지에 아래 meta 태그가 없으면 `prefers-color-scheme: dark`를 무시할 수 있습니다. 앱의 targetSdk가 32 이하라면 `<head>`에 넣으세요.
|
|
70
|
+
>
|
|
71
|
+
> ```html
|
|
72
|
+
> <meta name="color-scheme" content="light dark">
|
|
73
|
+
> ```
|
|
74
|
+
|
|
75
|
+
### TS
|
|
76
|
+
|
|
77
|
+
ESM만 제공합니다. `tokens`와 `values`를 내보냅니다. 키는 토큰 경로의 이름 칸을 camelCase로 바꾼 것이고(`bg-surface` → `bgSurface`), 그룹은 중첩 객체입니다(`alpha.90` → `alpha[90]`).
|
|
78
|
+
|
|
79
|
+
#### `tokens`: CSS 변수 참조
|
|
80
|
+
|
|
81
|
+
CSS 변수를 가리키는 `var()` 문자열입니다. 인라인 스타일처럼 TS에서 CSS 값을 쓸 때 이름을 틀리지 않게 해 줍니다. 값은 CSS 변수이므로 `tokens.css`를 함께 import해야 하고, Color Scheme이 바뀌면 CSS처럼 따라 바뀝니다.
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import "@gyeol-ui/tokens/tokens.css";
|
|
85
|
+
import { tokens } from "@gyeol-ui/tokens";
|
|
86
|
+
|
|
87
|
+
tokens.bgSurface; // "var(--gyeol-bg-surface)"
|
|
88
|
+
tokens.alpha[90]; // "var(--gyeol-alpha-90)"
|
|
89
|
+
tokens.spacing[4]; // "var(--gyeol-spacing-4)"
|
|
90
|
+
tokens.radius.md; // "var(--gyeol-radius-md)"
|
|
91
|
+
|
|
92
|
+
<div style={{ background: tokens.bgSurface, padding: tokens.spacing[4] }} />;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
범위는 CSS의 공개 API와 같습니다: Semantic 색, `spacing`, `radius`. Primitive 색은 들어 있지 않습니다. 값은 리터럴 타입이라 `typeof tokens.bgSurface`는 `"var(--gyeol-bg-surface)"`입니다.
|
|
96
|
+
|
|
97
|
+
#### `values`: Color Scheme별 실제 색
|
|
98
|
+
|
|
99
|
+
CSS 밖에서 실제 색이 필요할 때 씁니다. 예를 들어 웹뷰에서 네이티브 앱의 상태바 색을 브리지로 넘길 때입니다. Semantic 색만 들어 있고, 값은 hex(`#rrggbb`)이거나, 투명도가 있으면 `rgba()`입니다.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { values } from "@gyeol-ui/tokens";
|
|
103
|
+
|
|
104
|
+
const colorScheme = matchMedia("(prefers-color-scheme: dark)").matches
|
|
105
|
+
? "dark"
|
|
106
|
+
: "light";
|
|
107
|
+
|
|
108
|
+
values[colorScheme].bgSurface; // light: "#ffffff", dark: "#09090b"
|
|
109
|
+
values.dark.alpha[90]; // "rgba(9, 9, 11, 0.9)"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
투명도가 있는 값은 토큰 원본의 `$value`에 적힌 계산된 색("alias + 투명도", 아래 "토큰 원본" 참고)입니다. `values`는 빌드할 때 정해진 문자열이라 Color Scheme이 바뀌어도 스스로 바뀌지 않습니다. 지금 Color Scheme에 맞는 쪽을 직접 고르세요.
|
|
113
|
+
|
|
114
|
+
### 공개 토큰 목록
|
|
115
|
+
|
|
116
|
+
`@gyeol-ui/tokens/tokens.json`은 어떤 토큰이 있는지 담은 목록입니다. 다른 패키지(예: Tailwind 테마)가 토큰 이름을 하드코딩하지 않고 이 목록으로 토큰을 알게 하려는 것입니다.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import publicTokens from "@gyeol-ui/tokens/tokens.json" with { type: "json" };
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
[
|
|
124
|
+
{ "path": "bg-surface", "type": "color", "cssVariable": "--gyeol-bg-surface" },
|
|
125
|
+
{ "path": "alpha.90", "type": "color", "cssVariable": "--gyeol-alpha-90" },
|
|
126
|
+
{ "path": "spacing.4", "type": "dimension", "cssVariable": "--gyeol-spacing-4" }
|
|
127
|
+
]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
| 필드 | 값 |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `path` | DTCG 경로. 그룹은 `.`으로 잇습니다(`alpha.90`) |
|
|
133
|
+
| `type` | `color` 또는 `dimension` |
|
|
134
|
+
| `cssVariable` | `tokens.css`가 정의하는 CSS 변수 이름 |
|
|
135
|
+
|
|
136
|
+
범위는 공개 API와 같습니다: Semantic 색 전부(`alpha` 그룹 포함), `spacing`, `radius`. Primitive 색은 들어 있지 않습니다.
|
|
137
|
+
|
|
138
|
+
## 토큰 원본
|
|
139
|
+
|
|
140
|
+
토큰 원본은 [`tokens/`](./tokens/) 폴더의 DTCG 2025.10 JSON입니다. Figma Variables collection의 mode 하나가 파일 하나입니다.
|
|
141
|
+
|
|
142
|
+
- `tokens/primitive.json`: Primitive collection. `color`, `spacing`, `radius` 범주 그룹에 `$type`을 선언합니다.
|
|
143
|
+
- `tokens/semantic/light.json`, `tokens/semantic/dark.json`: Semantic collection의 light, dark mode. 두 파일에 같은 이름의 토큰이 있고, 값은 `{color.gray.900}`이나 `{bg-surface}` 같은 참조이거나, 아래의 "alias + 투명도"입니다. 범주 그룹이 없으므로 `$type`은 토큰마다 적습니다.
|
|
144
|
+
- Figma의 "alias + 투명도"는 `$value`에 계산한 색(`alpha` 포함)을 적고, `$extensions`의 `gyeol.alias`에 참조 대상과 불투명도를 적습니다. CSS에는 `$value`가 아니라 `gyeol.alias`로 만든 `color-mix(in srgb, var(--gyeol-…) N%, transparent)`가 나옵니다. 참조 대상은 Primitive와 Semantic 모두 됩니다.
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
"90": {
|
|
148
|
+
"$type": "color",
|
|
149
|
+
"$value": { "colorSpace": "srgb", "components": [1, 1, 1], "alpha": 0.9 },
|
|
150
|
+
"$extensions": { "gyeol": { "alias": { "ref": "{bg-surface}", "alpha": 0.9 } } }
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- 색은 `srgb` 색 객체(`{ "colorSpace": "srgb", "components": [r, g, b] }`, 각 값은 0–1)로 쓰고, CSS에는 hex로 나옵니다. `alpha`가 있으면 `rgba()`로 나옵니다.
|
|
155
|
+
- dimension은 `{ "value": 16, "unit": "px" }`로 쓰고, CSS에는 px로 나옵니다.
|
|
156
|
+
|
|
157
|
+
### 토큰 JSON을 고칠 때 지킬 규칙
|
|
158
|
+
|
|
159
|
+
빌드는 CSS를 만들기 전에 토큰 JSON을 검사하고, 규칙을 하나라도 어기면 실패합니다. 첫 위반에서 멈추지 않고 모든 위반을 한 번에 알립니다. 줄마다 파일, 토큰 경로, 어긴 규칙의 이름, 설명이 나옵니다.
|
|
160
|
+
|
|
161
|
+
```text
|
|
162
|
+
TokenValidationError: 토큰 JSON이 규칙을 2곳에서 어겼다.
|
|
163
|
+
primitive.json color.ink [primitive-real-value] Primitive는 실제 값만 둔다. alias {color.black}를 쓸 수 없다
|
|
164
|
+
semantic/dark.json fg-muted [semantic-names-match] semantic/light.json에 있는 Semantic이 이 파일에 없다
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| 규칙 이름 | 규칙 |
|
|
168
|
+
|---|---|
|
|
169
|
+
| `primitive-real-value` | Primitive는 실제 값만 둡니다. 참조(`{…}`)와 "alias + 투명도"(`$extensions.gyeol.alias`)를 쓰지 않습니다. 색 값 자체의 `alpha`는 실제 값이므로 됩니다. |
|
|
170
|
+
| `semantic-alias` | Semantic은 모든 토큰이 Primitive나 같은 파일의 다른 Semantic을 가리키는 참조이거나, `ref`가 참조인 "alias + 투명도"입니다. |
|
|
171
|
+
| `semantic-color` | Semantic의 `$type`은 `color`만 됩니다. |
|
|
172
|
+
| `semantic-names-match` | `semantic/light.json`과 `semantic/dark.json`에 같은 이름의 토큰이 모두 있어야 합니다. 빠진 쪽 파일의 위반으로 나옵니다. |
|
|
173
|
+
| `semantic-role` | Semantic 이름(경로를 `-`로 이은 것)의 첫 조각은 Role(`bg`, `fg`, `border`, `ring-offset`) 중 하나입니다. 이름이 Role과 같거나(`ring-offset`) `Role-`로 시작해야 합니다(`bg-surface`, `fg-on-accent`). `background-muted`처럼 Role로 시작하는 다른 단어는 안 됩니다. `alpha` 그룹(`alpha.90`)만 예외입니다. Role은 색이 칠해지는 자리이고, Tailwind 테마는 Role에 따라 클래스를 정합니다. |
|
|
174
|
+
| `path-structure` | 경로는 최대 3단계입니다. Primitive는 `범주/(그룹)/이름`(2–3단계, 예: `spacing.4`, `color.gray.900`), Semantic은 `(그룹)/이름`(1–2단계, 예: `bg-surface`, `alpha.90`)입니다. |
|
|
175
|
+
| `kebab-case` | 경로의 모든 이름 칸은 kebab-case(소문자, 숫자, `-`)입니다. |
|
|
176
|
+
| `css-name-unique` | 모든 토큰의 CSS 변수 이름이 서로 달라야 합니다. `bg.surface`와 `bg-surface`는 모두 `--gyeol-bg-surface`가 되어 겹칩니다. Semantic은 Primitive와도 겹치면 안 됩니다. |
|
|
177
|
+
| `color-srgb` | 색은 `srgb` 색 객체입니다. hex 문자열이나 다른 색 공간은 안 됩니다. "alias + 투명도"의 `$value`도 검사합니다. |
|
|
178
|
+
| `dimension-px` | dimension은 `unit`이 `px`인 객체입니다. |
|
|
179
|
+
| `reference-exists` | 참조 대상 토큰이 있어야 합니다. 그룹은 토큰이 아니므로 가리킬 수 없고, Semantic은 다른 Color Scheme 파일의 Semantic을 가리킬 수 없습니다. |
|
|
180
|
+
| `reference-no-cycle` | 참조가 순환하면 안 됩니다(`fg-default` → `fg-muted` → `fg-default`). 순환에 든 토큰 중 파일에서 가장 앞의 토큰에서 나옵니다. |
|
|
181
|
+
|
|
182
|
+
파일이 없거나 JSON 문법이 틀리면 규칙 검사 전에 일반 오류로 실패합니다.
|
|
183
|
+
|
|
184
|
+
## 개발
|
|
185
|
+
|
|
186
|
+
저장소 루트에서 의존성을 설치한 뒤 이 폴더에서 실행합니다.
|
|
187
|
+
|
|
188
|
+
| 명령 | 하는 일 |
|
|
189
|
+
|---|---|
|
|
190
|
+
| `pnpm build` | Style Dictionary로 `generated/tokens.css`, `generated/index.ts`, `generated/tokens.json`을 만들고, tsdown으로 `generated/index.ts`에서 `dist/`에 ESM과 타입 선언을 만들며 `tokens.css`와 `tokens.json`을 복사한다 |
|
|
191
|
+
| `pnpm lint` | oxlint로 코드를 검사한다 |
|
|
192
|
+
| `pnpm test` | Vitest로 테스트를 실행한다 |
|
|
193
|
+
| `pnpm typecheck` | `tsc`로 타입을 검사한다 |
|
|
194
|
+
|
|
195
|
+
빌드 함수는 [`scripts/build-tokens.ts`](./scripts/build-tokens.ts)의 `buildTokens(토큰 폴더)`입니다. 먼저 [`scripts/validate-tokens.ts`](./scripts/validate-tokens.ts)로 위의 규칙을 검사하고, 위반이 있으면 모든 위반을 담은 `TokenValidationError`를 던집니다. 규칙 하나하나를 검사하는 순수 함수는 [`scripts/validate-tokens.helper.ts`](./scripts/validate-tokens.helper.ts)에 있고, 함수마다 무엇을 받아 어떤 위반을 돌려주는지는 [`scripts/validate-tokens.helper.test.ts`](./scripts/validate-tokens.helper.test.ts)에서 볼 수 있습니다. 파일을 쓰지 않고 CSS 텍스트, TS 소스, 공개 토큰 목록 JSON을 돌려주므로, 테스트는 [`scripts/fixtures/`](./scripts/fixtures/)의 fixture 토큰 폴더로 이 함수를 부릅니다. `pnpm build`는 [`scripts/build.ts`](./scripts/build.ts)에서 이 함수를 실제 `tokens/` 폴더로 실행해 결과를 git에 넣지 않는 `generated/`에 씁니다. 이어서 tsdown이 `dist/`를 비우고 `generated/index.ts`를 패키지 진입점으로 빌드한 뒤 `generated/tokens.css`와 `generated/tokens.json`을 `dist/`로 복사합니다. TS 소스를 쓰는 순수 함수 `formatTsModule`은 [`scripts/build-tokens.helper.ts`](./scripts/build-tokens.helper.ts)에 있습니다.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly, this file was auto-generated.
|
|
3
|
+
*/
|
|
4
|
+
/** CSS 변수 참조. Semantic 색과 spacing, radius를 담는다 */
|
|
5
|
+
export declare const tokens: {
|
|
6
|
+
readonly bgSurface: "var(--gyeol-bg-surface)";
|
|
7
|
+
readonly bgSubtle: "var(--gyeol-bg-subtle)";
|
|
8
|
+
readonly fgDefault: "var(--gyeol-fg-default)";
|
|
9
|
+
readonly fgMuted: "var(--gyeol-fg-muted)";
|
|
10
|
+
readonly borderDefault: "var(--gyeol-border-default)";
|
|
11
|
+
readonly bgAccent: "var(--gyeol-bg-accent)";
|
|
12
|
+
readonly fgOnAccent: "var(--gyeol-fg-on-accent)";
|
|
13
|
+
readonly ringOffset: "var(--gyeol-ring-offset)";
|
|
14
|
+
readonly alpha: {
|
|
15
|
+
readonly 90: "var(--gyeol-alpha-90)";
|
|
16
|
+
};
|
|
17
|
+
readonly spacing: {
|
|
18
|
+
readonly 1: "var(--gyeol-spacing-1)";
|
|
19
|
+
readonly 2: "var(--gyeol-spacing-2)";
|
|
20
|
+
readonly 3: "var(--gyeol-spacing-3)";
|
|
21
|
+
readonly 4: "var(--gyeol-spacing-4)";
|
|
22
|
+
readonly 6: "var(--gyeol-spacing-6)";
|
|
23
|
+
readonly 8: "var(--gyeol-spacing-8)";
|
|
24
|
+
};
|
|
25
|
+
readonly radius: {
|
|
26
|
+
readonly sm: "var(--gyeol-radius-sm)";
|
|
27
|
+
readonly md: "var(--gyeol-radius-md)";
|
|
28
|
+
readonly full: "var(--gyeol-radius-full)";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/** Color Scheme별 Semantic의 실제 색. CSS 밖(예: 상태바 색을 브리지로 넘길 때)에서 쓴다 */
|
|
32
|
+
export declare const values: {
|
|
33
|
+
readonly light: {
|
|
34
|
+
readonly bgSurface: "#ffffff";
|
|
35
|
+
readonly bgSubtle: "#fafafa";
|
|
36
|
+
readonly fgDefault: "#18181b";
|
|
37
|
+
readonly fgMuted: "#71717a";
|
|
38
|
+
readonly borderDefault: "#e4e4e7";
|
|
39
|
+
readonly bgAccent: "#2563eb";
|
|
40
|
+
readonly fgOnAccent: "#ffffff";
|
|
41
|
+
readonly ringOffset: "#ffffff";
|
|
42
|
+
readonly alpha: {
|
|
43
|
+
readonly 90: "rgba(255, 255, 255, 0.9)";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly dark: {
|
|
47
|
+
readonly bgSurface: "#09090b";
|
|
48
|
+
readonly bgSubtle: "#18181b";
|
|
49
|
+
readonly fgDefault: "#fafafa";
|
|
50
|
+
readonly fgMuted: "#a1a1aa";
|
|
51
|
+
readonly borderDefault: "rgba(255, 255, 255, 0.1)";
|
|
52
|
+
readonly bgAccent: "#93c5fd";
|
|
53
|
+
readonly fgOnAccent: "#09090b";
|
|
54
|
+
readonly ringOffset: "#09090b";
|
|
55
|
+
readonly alpha: {
|
|
56
|
+
readonly 90: "rgba(9, 9, 11, 0.9)";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// generated/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Do not edit directly, this file was auto-generated.
|
|
4
|
+
*/
|
|
5
|
+
/** CSS 변수 참조. Semantic 색과 spacing, radius를 담는다 */
|
|
6
|
+
const tokens = {
|
|
7
|
+
bgSurface: "var(--gyeol-bg-surface)",
|
|
8
|
+
bgSubtle: "var(--gyeol-bg-subtle)",
|
|
9
|
+
fgDefault: "var(--gyeol-fg-default)",
|
|
10
|
+
fgMuted: "var(--gyeol-fg-muted)",
|
|
11
|
+
borderDefault: "var(--gyeol-border-default)",
|
|
12
|
+
bgAccent: "var(--gyeol-bg-accent)",
|
|
13
|
+
fgOnAccent: "var(--gyeol-fg-on-accent)",
|
|
14
|
+
ringOffset: "var(--gyeol-ring-offset)",
|
|
15
|
+
alpha: { 90: "var(--gyeol-alpha-90)" },
|
|
16
|
+
spacing: {
|
|
17
|
+
1: "var(--gyeol-spacing-1)",
|
|
18
|
+
2: "var(--gyeol-spacing-2)",
|
|
19
|
+
3: "var(--gyeol-spacing-3)",
|
|
20
|
+
4: "var(--gyeol-spacing-4)",
|
|
21
|
+
6: "var(--gyeol-spacing-6)",
|
|
22
|
+
8: "var(--gyeol-spacing-8)"
|
|
23
|
+
},
|
|
24
|
+
radius: {
|
|
25
|
+
sm: "var(--gyeol-radius-sm)",
|
|
26
|
+
md: "var(--gyeol-radius-md)",
|
|
27
|
+
full: "var(--gyeol-radius-full)"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/** Color Scheme별 Semantic의 실제 색. CSS 밖(예: 상태바 색을 브리지로 넘길 때)에서 쓴다 */
|
|
31
|
+
const values = {
|
|
32
|
+
light: {
|
|
33
|
+
bgSurface: "#ffffff",
|
|
34
|
+
bgSubtle: "#fafafa",
|
|
35
|
+
fgDefault: "#18181b",
|
|
36
|
+
fgMuted: "#71717a",
|
|
37
|
+
borderDefault: "#e4e4e7",
|
|
38
|
+
bgAccent: "#2563eb",
|
|
39
|
+
fgOnAccent: "#ffffff",
|
|
40
|
+
ringOffset: "#ffffff",
|
|
41
|
+
alpha: { 90: "rgba(255, 255, 255, 0.9)" }
|
|
42
|
+
},
|
|
43
|
+
dark: {
|
|
44
|
+
bgSurface: "#09090b",
|
|
45
|
+
bgSubtle: "#18181b",
|
|
46
|
+
fgDefault: "#fafafa",
|
|
47
|
+
fgMuted: "#a1a1aa",
|
|
48
|
+
borderDefault: "rgba(255, 255, 255, 0.1)",
|
|
49
|
+
bgAccent: "#93c5fd",
|
|
50
|
+
fgOnAccent: "#09090b",
|
|
51
|
+
ringOffset: "#09090b",
|
|
52
|
+
alpha: { 90: "rgba(9, 9, 11, 0.9)" }
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export { tokens, values };
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly, this file was auto-generated.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--gyeol-color-white: #ffffff;
|
|
7
|
+
--gyeol-color-black: #000000;
|
|
8
|
+
--gyeol-color-gray-50: #fafafa;
|
|
9
|
+
--gyeol-color-gray-100: #f4f4f5;
|
|
10
|
+
--gyeol-color-gray-200: #e4e4e7;
|
|
11
|
+
--gyeol-color-gray-400: #a1a1aa;
|
|
12
|
+
--gyeol-color-gray-500: #71717a;
|
|
13
|
+
--gyeol-color-gray-700: #3f3f46;
|
|
14
|
+
--gyeol-color-gray-900: #18181b;
|
|
15
|
+
--gyeol-color-gray-950: #09090b;
|
|
16
|
+
--gyeol-color-blue-300: #93c5fd;
|
|
17
|
+
--gyeol-color-blue-500: #3b82f6;
|
|
18
|
+
--gyeol-color-blue-600: #2563eb;
|
|
19
|
+
--gyeol-spacing-1: 4px;
|
|
20
|
+
--gyeol-spacing-2: 8px;
|
|
21
|
+
--gyeol-spacing-3: 12px;
|
|
22
|
+
--gyeol-spacing-4: 16px;
|
|
23
|
+
--gyeol-spacing-6: 24px;
|
|
24
|
+
--gyeol-spacing-8: 32px;
|
|
25
|
+
--gyeol-radius-sm: 4px;
|
|
26
|
+
--gyeol-radius-md: 6px;
|
|
27
|
+
--gyeol-radius-full: 9999px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:root {
|
|
31
|
+
color-scheme: light;
|
|
32
|
+
--gyeol-bg-surface: var(--gyeol-color-white);
|
|
33
|
+
--gyeol-bg-subtle: var(--gyeol-color-gray-50);
|
|
34
|
+
--gyeol-fg-default: var(--gyeol-color-gray-900);
|
|
35
|
+
--gyeol-fg-muted: var(--gyeol-color-gray-500);
|
|
36
|
+
--gyeol-border-default: var(--gyeol-color-gray-200);
|
|
37
|
+
--gyeol-bg-accent: var(--gyeol-color-blue-600);
|
|
38
|
+
--gyeol-fg-on-accent: var(--gyeol-color-white);
|
|
39
|
+
--gyeol-ring-offset: var(--gyeol-bg-surface);
|
|
40
|
+
--gyeol-alpha-90: color-mix(in srgb, var(--gyeol-bg-surface) 90%, transparent);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (prefers-color-scheme: dark) {
|
|
44
|
+
:root:not([data-color-scheme="light"]) {
|
|
45
|
+
color-scheme: dark;
|
|
46
|
+
--gyeol-bg-surface: var(--gyeol-color-gray-950);
|
|
47
|
+
--gyeol-bg-subtle: var(--gyeol-color-gray-900);
|
|
48
|
+
--gyeol-fg-default: var(--gyeol-color-gray-50);
|
|
49
|
+
--gyeol-fg-muted: var(--gyeol-color-gray-400);
|
|
50
|
+
--gyeol-border-default: color-mix(in srgb, var(--gyeol-color-white) 10%, transparent);
|
|
51
|
+
--gyeol-bg-accent: var(--gyeol-color-blue-300);
|
|
52
|
+
--gyeol-fg-on-accent: var(--gyeol-color-gray-950);
|
|
53
|
+
--gyeol-ring-offset: var(--gyeol-bg-surface);
|
|
54
|
+
--gyeol-alpha-90: color-mix(in srgb, var(--gyeol-bg-surface) 90%, transparent);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:root[data-color-scheme="dark"] {
|
|
59
|
+
color-scheme: dark;
|
|
60
|
+
--gyeol-bg-surface: var(--gyeol-color-gray-950);
|
|
61
|
+
--gyeol-bg-subtle: var(--gyeol-color-gray-900);
|
|
62
|
+
--gyeol-fg-default: var(--gyeol-color-gray-50);
|
|
63
|
+
--gyeol-fg-muted: var(--gyeol-color-gray-400);
|
|
64
|
+
--gyeol-border-default: color-mix(in srgb, var(--gyeol-color-white) 10%, transparent);
|
|
65
|
+
--gyeol-bg-accent: var(--gyeol-color-blue-300);
|
|
66
|
+
--gyeol-fg-on-accent: var(--gyeol-color-gray-950);
|
|
67
|
+
--gyeol-ring-offset: var(--gyeol-bg-surface);
|
|
68
|
+
--gyeol-alpha-90: color-mix(in srgb, var(--gyeol-bg-surface) 90%, transparent);
|
|
69
|
+
}
|
package/dist/tokens.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"path": "bg-surface",
|
|
4
|
+
"type": "color",
|
|
5
|
+
"cssVariable": "--gyeol-bg-surface"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"path": "bg-subtle",
|
|
9
|
+
"type": "color",
|
|
10
|
+
"cssVariable": "--gyeol-bg-subtle"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "fg-default",
|
|
14
|
+
"type": "color",
|
|
15
|
+
"cssVariable": "--gyeol-fg-default"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "fg-muted",
|
|
19
|
+
"type": "color",
|
|
20
|
+
"cssVariable": "--gyeol-fg-muted"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "border-default",
|
|
24
|
+
"type": "color",
|
|
25
|
+
"cssVariable": "--gyeol-border-default"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "bg-accent",
|
|
29
|
+
"type": "color",
|
|
30
|
+
"cssVariable": "--gyeol-bg-accent"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "fg-on-accent",
|
|
34
|
+
"type": "color",
|
|
35
|
+
"cssVariable": "--gyeol-fg-on-accent"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"path": "ring-offset",
|
|
39
|
+
"type": "color",
|
|
40
|
+
"cssVariable": "--gyeol-ring-offset"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"path": "alpha.90",
|
|
44
|
+
"type": "color",
|
|
45
|
+
"cssVariable": "--gyeol-alpha-90"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "spacing.1",
|
|
49
|
+
"type": "dimension",
|
|
50
|
+
"cssVariable": "--gyeol-spacing-1"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"path": "spacing.2",
|
|
54
|
+
"type": "dimension",
|
|
55
|
+
"cssVariable": "--gyeol-spacing-2"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"path": "spacing.3",
|
|
59
|
+
"type": "dimension",
|
|
60
|
+
"cssVariable": "--gyeol-spacing-3"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"path": "spacing.4",
|
|
64
|
+
"type": "dimension",
|
|
65
|
+
"cssVariable": "--gyeol-spacing-4"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"path": "spacing.6",
|
|
69
|
+
"type": "dimension",
|
|
70
|
+
"cssVariable": "--gyeol-spacing-6"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"path": "spacing.8",
|
|
74
|
+
"type": "dimension",
|
|
75
|
+
"cssVariable": "--gyeol-spacing-8"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "radius.sm",
|
|
79
|
+
"type": "dimension",
|
|
80
|
+
"cssVariable": "--gyeol-radius-sm"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"path": "radius.md",
|
|
84
|
+
"type": "dimension",
|
|
85
|
+
"cssVariable": "--gyeol-radius-md"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"path": "radius.full",
|
|
89
|
+
"type": "dimension",
|
|
90
|
+
"cssVariable": "--gyeol-radius-full"
|
|
91
|
+
}
|
|
92
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gyeol-ui/tokens",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "gyeol-ui의 Design Token",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"design-system",
|
|
7
|
+
"design-tokens",
|
|
8
|
+
"css-variables",
|
|
9
|
+
"figma",
|
|
10
|
+
"gyeol-ui"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://gyeol-ui.github.io/gyeol-ui/",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/gyeol-ui/gyeol-ui/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/gyeol-ui/gyeol-ui.git",
|
|
20
|
+
"directory": "packages/tokens"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"*.css"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./tokens.css": "./dist/tokens.css",
|
|
35
|
+
"./tokens.json": "./dist/tokens.json",
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "26.6.6",
|
|
43
|
+
"change-case": "5.4.4",
|
|
44
|
+
"publint": "0.3.25",
|
|
45
|
+
"style-dictionary": "5.8.0",
|
|
46
|
+
"tsdown": "0.23.7",
|
|
47
|
+
"typescript": "7.0.2",
|
|
48
|
+
"vitest": "5.1.0"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "node scripts/build.ts && tsdown",
|
|
52
|
+
"lint": "oxlint",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"typecheck": "tsc --noEmit"
|
|
55
|
+
}
|
|
6
56
|
}
|