@gbgr/tokens 0.0.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 +60 -0
- package/dist/index.css +4 -0
- package/dist/sd.input.json +688 -0
- package/dist/theme.css +3 -0
- package/dist/theme.dark.css +75 -0
- package/dist/theme.light.css +85 -0
- package/dist/tokens.base.css +73 -0
- package/dist/tokens.d.ts +265 -0
- package/dist/tokens.json +688 -0
- package/package.json +28 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 gbgr
|
|
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
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @gbgr/tokens
|
|
2
|
+
|
|
3
|
+
GBGR Design System의 디자인 토큰을 제공하는 패키지입니다. JSON, CSS 변수, TypeScript 타입 형식으로 사용할 수 있습니다.
|
|
4
|
+
|
|
5
|
+
## 설치
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @gbgr/tokens
|
|
9
|
+
# 또는
|
|
10
|
+
npm install @gbgr/tokens
|
|
11
|
+
# 또는
|
|
12
|
+
yarn add @gbgr/tokens
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 사용법
|
|
16
|
+
|
|
17
|
+
### CSS 변수
|
|
18
|
+
|
|
19
|
+
생성된 `theme.css`를 import하여 디자인 토큰을 CSS 변수로 사용할 수 있습니다:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
// 애플리케이션의 진입점 파일 또는 전역 CSS 파일에서
|
|
23
|
+
import '@gbgr/tokens/theme.css';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
그리고 CSS에서 다음과 같이 사용할 수 있습니다:
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
.my-component {
|
|
30
|
+
color: var(--color-semantic-brand-primary);
|
|
31
|
+
margin-top: var(--spacing-4);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### JSON
|
|
36
|
+
|
|
37
|
+
원시 디자인 토큰은 JSON 파일로 제공됩니다:
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
import tokens from '@gbgr/tokens/tokens.json';
|
|
41
|
+
// tokens는 모든 디자인 토큰을 포함하는 객체입니다
|
|
42
|
+
console.log(tokens.color.semantic.brand.primary);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### TypeScript 타입
|
|
46
|
+
|
|
47
|
+
타입 안전성을 위해 TypeScript 선언 파일을 import할 수 있습니다:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import type { Tokens } from '@gbgr/tokens';
|
|
51
|
+
// Tokens 타입을 사용하여 디자인 토큰 사용에 대한 타입 체크를 수행합니다
|
|
52
|
+
const myColor: Tokens['color']['semantic']['brand']['primary']['value'] = '#ffbf00';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 언제 사용하나요?
|
|
56
|
+
|
|
57
|
+
- **JSON/TypeScript 타입이 필요한 경우**: 런타임에 토큰 값을 사용하거나 타입 체크가 필요할 때
|
|
58
|
+
- **CSS 변수만 필요하고 Reset은 불필요한 경우**: 기존 프로젝트에 토큰만 추가하거나 자체 Reset을 사용하는 경우
|
|
59
|
+
- **특정 테마 파일만 필요한 경우**: `theme.css`, `theme.light.css`, `theme.dark.css` 등 특정 파일만 import할 때
|
|
60
|
+
- **다른 패키지에서 내부적으로 사용**: 컴포넌트 라이브러리 개발 시 내부적으로 토큰 값을 참조해야 할 때
|
package/dist/index.css
ADDED