@becca202420/moment-token 0.0.1
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.md +104 -0
- package/build-tokens.mjs +99 -0
- package/dist/css/variables.css +7 -0
- package/dist/scss/_variables.scss +4 -0
- package/dist/tailwind/theme.css +7 -0
- package/package.json +43 -0
- package/tokens/collection.json +1 -0
- package/tokens/color---primitives.json +78 -0
- package/tokens/color---semantic.json +54 -0
- package/tokens/radius.json +22 -0
- package/tokens/spacing.json +42 -0
- package/tokens/typography.json +74 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# moment-token
|
|
2
|
+
|
|
3
|
+
moment-token
|
|
4
|
+
|
|
5
|
+
제품 UI용 디자인 토큰 모음입니다. 색상, 여백(spacing), 반경(radius), 타이포그래피(primitives)와 의미론적(semantic) 디자인 변수들을 포함합니다.
|
|
6
|
+
|
|
7
|
+
이 패키지는 웹 애플리케이션에서 사용하기 위한 생성된 CSS 변수, SCSS 변수, Tailwind v4 테마 토큰 및 원본 토큰 JSON 파일들을 내보냅니다.
|
|
8
|
+
|
|
9
|
+
## 설치
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @becca202420/moment_token
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 패키지 내보내기 (exports)
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import "@becca202420/moment-token/css";
|
|
19
|
+
import "@becca202420/moment-token/scss";
|
|
20
|
+
import "@becca202420/moment-token/tailwind";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
원본 JSON 토큰 파일을 직접 가져다 쓸 수도 있습니다:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import colors from "@becca202420/moment-token/tokens/color---semantic.json";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 제공되는 출력물
|
|
30
|
+
|
|
31
|
+
- CSS 변수: `@becca202420/moment-token/css`
|
|
32
|
+
- SCSS 변수: `@becca202420/moment-token/scss`
|
|
33
|
+
- Tailwind v4 테마: `@kbecca202420/moment-token/tailwind`
|
|
34
|
+
- 원본 토큰 파일: `@becca202420/moment-token/tokens/*`
|
|
35
|
+
|
|
36
|
+
## 사용 예시
|
|
37
|
+
|
|
38
|
+
### CSS
|
|
39
|
+
|
|
40
|
+
```css
|
|
41
|
+
@import "@becca202420/moment-token/css";
|
|
42
|
+
|
|
43
|
+
.card {
|
|
44
|
+
background: var(--color-surface-default);
|
|
45
|
+
color: var(--color-text-primary);
|
|
46
|
+
border-radius: var(--radius-md);
|
|
47
|
+
padding: var(--spacing-4);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### SCSS
|
|
52
|
+
|
|
53
|
+
```scss
|
|
54
|
+
@use "@becca202420/moment-token/scss" as *;
|
|
55
|
+
|
|
56
|
+
.card {
|
|
57
|
+
background: $color-surface-default;
|
|
58
|
+
color: $color-text-primary;
|
|
59
|
+
border-radius: $radius-md;
|
|
60
|
+
padding: $spacing-4;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Tailwind CSS
|
|
65
|
+
|
|
66
|
+
```css
|
|
67
|
+
@import "tailwindcss";
|
|
68
|
+
@import "@becca202420/moment-token/tailwind";
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Tailwind v4에서 제공하는 생성된 테마 변수를 통해 디자인 토큰을 사용할 수 있습니다.
|
|
72
|
+
|
|
73
|
+
## 포함된 토큰 그룹
|
|
74
|
+
|
|
75
|
+
- 색상 (Colors)
|
|
76
|
+
- 원시 색상(primitive)
|
|
77
|
+
- 의미적 토큰(브랜드, 표면, 텍스트, 배지 등)
|
|
78
|
+
- 여백 (Spacing)
|
|
79
|
+
- 반경 (Radius)
|
|
80
|
+
- 타이포그래피 (Typography)
|
|
81
|
+
- 폰트 크기
|
|
82
|
+
- 행간(line-height)
|
|
83
|
+
- 자간(letter-spacing)
|
|
84
|
+
- 폰트 패밀리
|
|
85
|
+
|
|
86
|
+
## 원본 및 빌드
|
|
87
|
+
|
|
88
|
+
이 패키지는 `tokens/` 디렉터리의 JSON 토큰 파일들에서 Style Dictionary를 사용해 생성됩니다.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npm run build
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
빌드 스크립트: `node build-tokens.mjs` (package.json의 `build` 스크립트 참조)
|
|
95
|
+
|
|
96
|
+
배포 전에는 `npm run build` 또는 `npm publish` 전에 자동 실행되는 `prepublishOnly` 훅이 동작합니다.
|
|
97
|
+
|
|
98
|
+
## 라이선스
|
|
99
|
+
|
|
100
|
+
MIT
|
|
101
|
+
|
|
102
|
+
## 저장소
|
|
103
|
+
|
|
104
|
+
https://github.com/becca202420/moment-token
|
package/build-tokens.mjs
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import StyleDictionary from "style-dictionary";
|
|
2
|
+
|
|
3
|
+
// Figma 동기화 산출물의 $type은 'dimension'이 아니라 'number'라서
|
|
4
|
+
// style-dictionary 내장 size/px 변환이 매치되지 않습니다. 그래서 직접 만들어 사용합니다.
|
|
5
|
+
StyleDictionary.registerTransform({
|
|
6
|
+
name: "moment/name",
|
|
7
|
+
type: "name",
|
|
8
|
+
transform: (token) => {
|
|
9
|
+
const file = token.filePath ?? "";
|
|
10
|
+
const path = token.path;
|
|
11
|
+
|
|
12
|
+
if (file.includes("color")) return ["color", ...path].join("-");
|
|
13
|
+
|
|
14
|
+
if (file.includes("spacing")) {
|
|
15
|
+
const rest = path[0].replace(/^space-/, "");
|
|
16
|
+
return ["spacing", rest].join("-");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (file.includes("radius")) return path.join("-");
|
|
20
|
+
|
|
21
|
+
if (file.includes("typography")) {
|
|
22
|
+
const [category, ...rest] = path;
|
|
23
|
+
const namespace =
|
|
24
|
+
{
|
|
25
|
+
"font-size": "font-size",
|
|
26
|
+
"line-height": "leading",
|
|
27
|
+
"letter-spacing": "tracking",
|
|
28
|
+
"font-family": "font",
|
|
29
|
+
}[category] ?? category;
|
|
30
|
+
return [namespace, ...rest].join("-");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return path.join("-");
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
StyleDictionary.registerTransform({
|
|
38
|
+
name: "moment/value",
|
|
39
|
+
type: "value",
|
|
40
|
+
filter: (token) => token.$type === "number" || token.$type === "string",
|
|
41
|
+
transform: (token) => {
|
|
42
|
+
if (token.$type === "string") return `"${token.$value}"`;
|
|
43
|
+
|
|
44
|
+
const file = token.filePath ?? "";
|
|
45
|
+
const value = Math.round(token.$value * 1000) / 1000;
|
|
46
|
+
|
|
47
|
+
if (file.includes("spacing") || file.includes("radius"))
|
|
48
|
+
return `${value}px`;
|
|
49
|
+
|
|
50
|
+
if (file.includes("typography")) {
|
|
51
|
+
const category = token.path[0];
|
|
52
|
+
if (category === "font-size") return `${value}px`;
|
|
53
|
+
if (category === "letter-spacing") return `${value}em`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return `${value}`;
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const sd = new StyleDictionary({
|
|
61
|
+
source: ["tokens/**/*.json"],
|
|
62
|
+
platforms: {
|
|
63
|
+
css: {
|
|
64
|
+
transforms: ["moment/name", "moment/value"],
|
|
65
|
+
buildPath: "dist/css/",
|
|
66
|
+
files: [
|
|
67
|
+
{
|
|
68
|
+
destination: "variables.css",
|
|
69
|
+
format: "css/variables",
|
|
70
|
+
options: { outputReferences: true },
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
scss: {
|
|
75
|
+
transforms: ["moment/name", "moment/value"],
|
|
76
|
+
buildPath: "dist/scss/",
|
|
77
|
+
files: [
|
|
78
|
+
{
|
|
79
|
+
destination: "_variables.scss",
|
|
80
|
+
format: "scss/variables",
|
|
81
|
+
options: { outputReferences: true },
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
tailwind: {
|
|
86
|
+
transforms: ["moment/name", "moment/value"],
|
|
87
|
+
buildPath: "dist/tailwind/",
|
|
88
|
+
files: [
|
|
89
|
+
{
|
|
90
|
+
destination: "theme.css",
|
|
91
|
+
format: "css/variables",
|
|
92
|
+
options: { outputReferences: true, selector: "@theme" },
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
await sd.buildAllPlatforms();
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@becca202420/moment-token",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "moment_token design tokens (CSS variables, SCSS variables, Tailwind v4 theme)",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"tokens",
|
|
8
|
+
"build-tokens.mjs"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
"./css": "./dist/css/variables.css",
|
|
12
|
+
"./scss": "./dist/scss/_variables.scss",
|
|
13
|
+
"./tailwind": "./dist/tailwind/theme.css",
|
|
14
|
+
"./tokens/*": "./tokens/*"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "node build-tokens.mjs",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/becca202420/moment-token.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"design-tokens",
|
|
29
|
+
"style-dictionary",
|
|
30
|
+
"css-variables",
|
|
31
|
+
"tailwindcss"
|
|
32
|
+
],
|
|
33
|
+
"author": "becca202420",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"type": "commonjs",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/becca202420/moment-token/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/becca202420/moment-token#readme",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"style-dictionary": "5.5.3"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"white": {
|
|
3
|
+
"$value": "#ffffff",
|
|
4
|
+
"$type": "color"
|
|
5
|
+
},
|
|
6
|
+
"charcoal-950": {
|
|
7
|
+
"$value": "#211a13",
|
|
8
|
+
"$type": "color"
|
|
9
|
+
},
|
|
10
|
+
"sand": {
|
|
11
|
+
"100": {
|
|
12
|
+
"$value": "#faf7f2",
|
|
13
|
+
"$type": "color"
|
|
14
|
+
},
|
|
15
|
+
"200": {
|
|
16
|
+
"$value": "#f1e9dc",
|
|
17
|
+
"$type": "color"
|
|
18
|
+
},
|
|
19
|
+
"300": {
|
|
20
|
+
"$value": "#e4d8c4",
|
|
21
|
+
"$type": "color"
|
|
22
|
+
},
|
|
23
|
+
"400": {
|
|
24
|
+
"$value": "#c9b79c",
|
|
25
|
+
"$type": "color"
|
|
26
|
+
},
|
|
27
|
+
"500": {
|
|
28
|
+
"$value": "#a38f72",
|
|
29
|
+
"$type": "color"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"espresso": {
|
|
33
|
+
"800": {
|
|
34
|
+
"$value": "#4a3a2c",
|
|
35
|
+
"$type": "color"
|
|
36
|
+
},
|
|
37
|
+
"900": {
|
|
38
|
+
"$value": "#2e2318",
|
|
39
|
+
"$type": "color"
|
|
40
|
+
},
|
|
41
|
+
"950": {
|
|
42
|
+
"$value": "#211a12",
|
|
43
|
+
"$type": "color"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"gray-warm": {
|
|
47
|
+
"500": {
|
|
48
|
+
"$value": "#8b8072",
|
|
49
|
+
"$type": "color"
|
|
50
|
+
},
|
|
51
|
+
"700": {
|
|
52
|
+
"$value": "#665c4f",
|
|
53
|
+
"$type": "color"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"moss": {
|
|
57
|
+
"600": {
|
|
58
|
+
"$value": "#7c8a6d",
|
|
59
|
+
"$type": "color"
|
|
60
|
+
},
|
|
61
|
+
"700": {
|
|
62
|
+
"$value": "#5f6e52",
|
|
63
|
+
"$type": "color"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"clay": {
|
|
67
|
+
"500": {
|
|
68
|
+
"$value": "#b8794f",
|
|
69
|
+
"$type": "color"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"border": {
|
|
73
|
+
"subtle": {
|
|
74
|
+
"$value": "{sand.300}",
|
|
75
|
+
"$type": "color"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"brand": {
|
|
3
|
+
"primary": {
|
|
4
|
+
"$value": "{espresso.900}",
|
|
5
|
+
"$type": "color"
|
|
6
|
+
},
|
|
7
|
+
"accent": {
|
|
8
|
+
"$value": "{moss.700}",
|
|
9
|
+
"$type": "color"
|
|
10
|
+
},
|
|
11
|
+
"accent-secondary": {
|
|
12
|
+
"$value": "{clay.500}",
|
|
13
|
+
"$type": "color"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"surface": {
|
|
17
|
+
"default": {
|
|
18
|
+
"$value": "{white}",
|
|
19
|
+
"$type": "color"
|
|
20
|
+
},
|
|
21
|
+
"subtle": {
|
|
22
|
+
"$value": "{sand.100}",
|
|
23
|
+
"$type": "color"
|
|
24
|
+
},
|
|
25
|
+
"accent": {
|
|
26
|
+
"$value": "{sand.200}",
|
|
27
|
+
"$type": "color"
|
|
28
|
+
},
|
|
29
|
+
"accent-strong": {
|
|
30
|
+
"$value": "{sand.300}",
|
|
31
|
+
"$type": "color"
|
|
32
|
+
},
|
|
33
|
+
"inverse": {
|
|
34
|
+
"$value": "{espresso.800}",
|
|
35
|
+
"$type": "color"
|
|
36
|
+
},
|
|
37
|
+
"inverse-strong": {
|
|
38
|
+
"$value": "{espresso.950}",
|
|
39
|
+
"$type": "color"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"text": {
|
|
43
|
+
"$value": "{white}",
|
|
44
|
+
"$type": "color"
|
|
45
|
+
},
|
|
46
|
+
"new-bg": {
|
|
47
|
+
"$value": "{moss.600}",
|
|
48
|
+
"$type": "color"
|
|
49
|
+
},
|
|
50
|
+
"best-bg": {
|
|
51
|
+
"$value": "{clay.500}",
|
|
52
|
+
"$type": "color"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"radius-sm": {
|
|
3
|
+
"$value": 8,
|
|
4
|
+
"$type": "number"
|
|
5
|
+
},
|
|
6
|
+
"radius-md": {
|
|
7
|
+
"$value": 16,
|
|
8
|
+
"$type": "number"
|
|
9
|
+
},
|
|
10
|
+
"radius-lg": {
|
|
11
|
+
"$value": 24,
|
|
12
|
+
"$type": "number"
|
|
13
|
+
},
|
|
14
|
+
"radius-xl": {
|
|
15
|
+
"$value": 32,
|
|
16
|
+
"$type": "number"
|
|
17
|
+
},
|
|
18
|
+
"radius-full": {
|
|
19
|
+
"$value": 999,
|
|
20
|
+
"$type": "number"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"space-1": {
|
|
3
|
+
"$value": 4,
|
|
4
|
+
"$type": "number"
|
|
5
|
+
},
|
|
6
|
+
"space-2": {
|
|
7
|
+
"$value": 8,
|
|
8
|
+
"$type": "number"
|
|
9
|
+
},
|
|
10
|
+
"space-3": {
|
|
11
|
+
"$value": 12,
|
|
12
|
+
"$type": "number"
|
|
13
|
+
},
|
|
14
|
+
"space-4": {
|
|
15
|
+
"$value": 16,
|
|
16
|
+
"$type": "number"
|
|
17
|
+
},
|
|
18
|
+
"space-5": {
|
|
19
|
+
"$value": 24,
|
|
20
|
+
"$type": "number"
|
|
21
|
+
},
|
|
22
|
+
"space-6": {
|
|
23
|
+
"$value": 32,
|
|
24
|
+
"$type": "number"
|
|
25
|
+
},
|
|
26
|
+
"space-7": {
|
|
27
|
+
"$value": 48,
|
|
28
|
+
"$type": "number"
|
|
29
|
+
},
|
|
30
|
+
"space-8": {
|
|
31
|
+
"$value": 64,
|
|
32
|
+
"$type": "number"
|
|
33
|
+
},
|
|
34
|
+
"space-9": {
|
|
35
|
+
"$value": 96,
|
|
36
|
+
"$type": "number"
|
|
37
|
+
},
|
|
38
|
+
"space-10": {
|
|
39
|
+
"$value": 128,
|
|
40
|
+
"$type": "number"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"line-height": {
|
|
3
|
+
"tight": {
|
|
4
|
+
"$value": 1.149999976158142,
|
|
5
|
+
"$type": "number"
|
|
6
|
+
},
|
|
7
|
+
"tight-sm": {
|
|
8
|
+
"$value": 1.350000023841858,
|
|
9
|
+
"$type": "number"
|
|
10
|
+
},
|
|
11
|
+
"normal": {
|
|
12
|
+
"$value": 1.600000023841858,
|
|
13
|
+
"$type": "number"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"letter-spacing": {
|
|
17
|
+
"tight": {
|
|
18
|
+
"$value": -0.009999999776482582,
|
|
19
|
+
"$type": "number"
|
|
20
|
+
},
|
|
21
|
+
"normal": {
|
|
22
|
+
"$value": 0,
|
|
23
|
+
"$type": "number"
|
|
24
|
+
},
|
|
25
|
+
"wide": {
|
|
26
|
+
"$value": 0.07999999821186066,
|
|
27
|
+
"$type": "number"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"font-sizing": {
|
|
31
|
+
"display": {
|
|
32
|
+
"$value": 48,
|
|
33
|
+
"$type": "number"
|
|
34
|
+
},
|
|
35
|
+
"h1": {
|
|
36
|
+
"$value": 36,
|
|
37
|
+
"$type": "number"
|
|
38
|
+
},
|
|
39
|
+
"h2": {
|
|
40
|
+
"$value": 28,
|
|
41
|
+
"$type": "number"
|
|
42
|
+
},
|
|
43
|
+
"h3": {
|
|
44
|
+
"$value": 20,
|
|
45
|
+
"$type": "number"
|
|
46
|
+
},
|
|
47
|
+
"body-lg": {
|
|
48
|
+
"$value": 18,
|
|
49
|
+
"$type": "number"
|
|
50
|
+
},
|
|
51
|
+
"body": {
|
|
52
|
+
"$value": 16,
|
|
53
|
+
"$type": "number"
|
|
54
|
+
},
|
|
55
|
+
"body-sm": {
|
|
56
|
+
"$value": 15,
|
|
57
|
+
"$type": "number"
|
|
58
|
+
},
|
|
59
|
+
"caption": {
|
|
60
|
+
"$value": 13,
|
|
61
|
+
"$type": "number"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"font-family": {
|
|
65
|
+
"primary": {
|
|
66
|
+
"$value": "Monrope",
|
|
67
|
+
"$type": "string"
|
|
68
|
+
},
|
|
69
|
+
"String": {
|
|
70
|
+
"$value": "Fraunces",
|
|
71
|
+
"$type": "string"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|