@uniai-fe/uds-foundation 0.4.3 → 0.4.4

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/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { color_primitive, color_semantic } from './data/color.js';
7
7
  export { spacing_gap, spacing_padding } from './data/spacing.js';
8
8
  export { layout_breakpoint, layout_radius, layout_size } from './data/layout.js';
9
9
  export { typography_tokens } from './data/typography.js';
10
- export { ThemeColorPrimitive, ThemeColorSemanticSection, ThemeLayoutSizes, ThemeSpacingScale, ThemeTokens, ThemeTypographyCategory, ThemeTypographyVariant } from './types/theme-tokens.js';
10
+ export { ThemeColorPrimitive, ThemeColorSemantic, ThemeColorSemanticSection, ThemeLayoutBreakpoint, ThemeLayoutRadius, ThemeLayoutSize, ThemeLayoutSizes, ThemeSpacingGap, ThemeSpacingPadding, ThemeSpacingScale, ThemeTokens, ThemeTypography, ThemeTypographyCategory, ThemeTypographyVariant } from './types/theme-tokens.js';
11
11
  import 'react/jsx-runtime';
12
12
  import 'react';
13
13
 
@@ -1,78 +1,67 @@
1
+ import { color_primitive, color_semantic } from '../data/color.js';
2
+ import { layout_breakpoint, layout_radius, layout_size } from '../data/layout.js';
3
+ import { spacing_gap, spacing_padding } from '../data/spacing.js';
4
+ import { themeTokens } from '../data/tokens.js';
5
+ import { typography_tokens } from '../data/typography.js';
6
+
1
7
  /**
2
- * ThemeTypographyVariant; typography variant token 구조
3
- * @property {number} size font-size px 값
4
- * @property {string} line_height line-height 값
5
- * @property {number} letter_spacing letter-spacing 값
6
- * @property {number} font_weight font-weight 값
8
+ * ThemeColorPrimitive; primitive color token snapshot 타입
7
9
  */
8
- interface ThemeTypographyVariant {
9
- /**
10
- * font-size px 값
11
- */
12
- readonly size: number;
13
- /**
14
- * line-height 값
15
- */
16
- readonly line_height: string;
17
- /**
18
- * letter-spacing 값
19
- */
20
- readonly letter_spacing: number;
21
- /**
22
- * font-weight 값
23
- */
24
- readonly font_weight: number;
25
- }
10
+ type ThemeColorPrimitive = typeof color_primitive;
26
11
  /**
27
- * ThemeColorPrimitive; primitive color token map
12
+ * ThemeColorSemantic; semantic color token snapshot 타입
28
13
  */
29
- type ThemeColorPrimitive = Record<string, string>;
14
+ type ThemeColorSemantic = typeof color_semantic;
30
15
  /**
31
- * ThemeColorSemanticSection; semantic color nested token map
16
+ * ThemeColorSemanticSection; semantic color nested token map 호환 타입
32
17
  * @property {string | ThemeColorSemanticSection} [token] semantic color value 또는 하위 section
33
18
  */
34
19
  interface ThemeColorSemanticSection {
35
20
  readonly [token: string]: string | ThemeColorSemanticSection;
36
21
  }
37
22
  /**
38
- * ThemeSpacingScale; spacing scale token map
23
+ * ThemeSpacingPadding; spacing padding token snapshot 타입
24
+ */
25
+ type ThemeSpacingPadding = typeof spacing_padding;
26
+ /**
27
+ * ThemeSpacingGap; spacing gap token snapshot 타입
28
+ */
29
+ type ThemeSpacingGap = typeof spacing_gap;
30
+ /**
31
+ * ThemeSpacingScale; spacing scale token map 호환 타입
39
32
  */
40
33
  type ThemeSpacingScale = Record<string, number>;
41
34
  /**
42
- * ThemeLayoutSizes; layout size token map
35
+ * ThemeLayoutBreakpoint; layout breakpoint token snapshot 타입
36
+ */
37
+ type ThemeLayoutBreakpoint = typeof layout_breakpoint;
38
+ /**
39
+ * ThemeLayoutSize; layout size token snapshot 타입
40
+ */
41
+ type ThemeLayoutSize = typeof layout_size;
42
+ /**
43
+ * ThemeLayoutRadius; layout radius token snapshot 타입
44
+ */
45
+ type ThemeLayoutRadius = typeof layout_radius;
46
+ /**
47
+ * ThemeLayoutSizes; layout size token map 호환 타입
43
48
  */
44
49
  type ThemeLayoutSizes = Record<string, number>;
45
50
  /**
46
- * ThemeTypographyCategory; typography category token map
51
+ * ThemeTypography; typography token snapshot 타입
52
+ */
53
+ type ThemeTypography = typeof typography_tokens;
54
+ /**
55
+ * ThemeTypographyCategory; typography category token map 타입
47
56
  */
48
- type ThemeTypographyCategory = Record<string, ThemeTypographyVariant>;
57
+ type ThemeTypographyCategory = ThemeTypography[keyof ThemeTypography];
58
+ /**
59
+ * ThemeTypographyVariant; typography variant token 구조
60
+ */
61
+ type ThemeTypographyVariant = ThemeTypographyCategory[keyof ThemeTypographyCategory];
49
62
  /**
50
63
  * ThemeTokens; foundation token snapshot 전체 구조
51
- * @property {{ primitive: ThemeColorPrimitive; semantic: ThemeColorSemanticSection }} color color token 집합
52
- * @property {{ padding: ThemeSpacingScale; gap: ThemeSpacingScale }} spacing spacing token 집합
53
- * @property {{ breakpoint: Record<"xsmall" | "small" | "medium" | "large", number>; size: ThemeLayoutSizes; radius: { size: ThemeLayoutSizes; level: ThemeLayoutSizes } }} layout layout token 집합
54
- * @property {{ [category: string]: ThemeTypographyCategory }} typography typography token 집합
55
64
  */
56
- interface ThemeTokens {
57
- readonly color: {
58
- readonly primitive: ThemeColorPrimitive;
59
- readonly semantic: ThemeColorSemanticSection;
60
- };
61
- readonly spacing: {
62
- readonly padding: ThemeSpacingScale;
63
- readonly gap: ThemeSpacingScale;
64
- };
65
- readonly layout: {
66
- readonly breakpoint: Record<"xsmall" | "small" | "medium" | "large", number>;
67
- readonly size: ThemeLayoutSizes;
68
- readonly radius: {
69
- readonly size: ThemeLayoutSizes;
70
- readonly level: ThemeLayoutSizes;
71
- };
72
- };
73
- readonly typography: {
74
- readonly [category: string]: ThemeTypographyCategory;
75
- };
76
- }
65
+ type ThemeTokens = typeof themeTokens;
77
66
 
78
- export type { ThemeColorPrimitive, ThemeColorSemanticSection, ThemeLayoutSizes, ThemeSpacingScale, ThemeTokens, ThemeTypographyCategory, ThemeTypographyVariant };
67
+ export type { ThemeColorPrimitive, ThemeColorSemantic, ThemeColorSemanticSection, ThemeLayoutBreakpoint, ThemeLayoutRadius, ThemeLayoutSize, ThemeLayoutSizes, ThemeSpacingGap, ThemeSpacingPadding, ThemeSpacingScale, ThemeTokens, ThemeTypography, ThemeTypographyCategory, ThemeTypographyVariant };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/uds-foundation",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "UNIAI Design System; Design Foundation Package",
5
5
  "type": "module",
6
6
  "private": false,
package/src/data/color.ts CHANGED
@@ -1,16 +1,11 @@
1
- import type {
2
- ThemeColorPrimitive,
3
- ThemeColorSemanticSection,
4
- } from "../types/theme-tokens";
5
-
6
- const color_common: ThemeColorPrimitive = {
1
+ const color_common = {
7
2
  // 하위호환을 위해 common_99/common_100을 함께 유지한다.
8
3
  common_99: "#fff",
9
4
  common_100: "#fff",
10
5
  common_0: "#000",
11
- } as const;
6
+ } satisfies Record<string, string>;
12
7
 
13
- const color_neutral: ThemeColorPrimitive = {
8
+ const color_neutral = {
14
9
  neutral_10: "#1a1a1a",
15
10
  neutral_20: "#333333",
16
11
  neutral_30: "#4d4d4d",
@@ -24,9 +19,9 @@ const color_neutral: ThemeColorPrimitive = {
24
19
  neutral_90: "#e6e6e6",
25
20
  neutral_95: "#f2f2f2",
26
21
  neutral_99: "#fcfcfc",
27
- } as const;
22
+ } satisfies Record<string, string>;
28
23
 
29
- const color_cool_gray: ThemeColorPrimitive = {
24
+ const color_cool_gray = {
30
25
  cool_gray_10: "#18191b",
31
26
  cool_gray_20: "#313235",
32
27
  cool_gray_25: "#3d3f43",
@@ -45,9 +40,9 @@ const color_cool_gray: ThemeColorPrimitive = {
45
40
  cool_gray_90: "#e4e5e7",
46
41
  cool_gray_95: "#f2f2f3",
47
42
  cool_gray_99: "#fcfcfd",
48
- } as const;
43
+ } satisfies Record<string, string>;
49
44
 
50
- const color_blue: ThemeColorPrimitive = {
45
+ const color_blue = {
51
46
  blue_10: "#001233",
52
47
  blue_20: "#002466",
53
48
  blue_30: "#003699",
@@ -61,9 +56,9 @@ const color_blue: ThemeColorPrimitive = {
61
56
  blue_90: "#ccdeff",
62
57
  blue_95: "#e5eeff",
63
58
  blue_99: "#fafcff",
64
- } as const;
59
+ } satisfies Record<string, string>;
65
60
 
66
- const color_purple: ThemeColorPrimitive = {
61
+ const color_purple = {
67
62
  purple_10: "#120033",
68
63
  purple_20: "#240066",
69
64
  purple_30: "#360099",
@@ -77,9 +72,9 @@ const color_purple: ThemeColorPrimitive = {
77
72
  purple_90: "#deccff",
78
73
  purple_95: "#efe5ff",
79
74
  purple_99: "#fcfaff",
80
- } as const;
75
+ } satisfies Record<string, string>;
81
76
 
82
- const color_magenta: ThemeColorPrimitive = {
77
+ const color_magenta = {
83
78
  magenta_10: "#32012e",
84
79
  magenta_20: "#64025b",
85
80
  magenta_30: "#950489",
@@ -93,9 +88,9 @@ const color_magenta: ThemeColorPrimitive = {
93
88
  magenta_90: "#fecdfa",
94
89
  magenta_95: "#fee6fc",
95
90
  magenta_99: "#fffafe",
96
- } as const;
91
+ } satisfies Record<string, string>;
97
92
 
98
- const color_pink: ThemeColorPrimitive = {
93
+ const color_pink = {
99
94
  pink_10: "#320116",
100
95
  pink_20: "#63032b",
101
96
  pink_30: "#950441",
@@ -109,9 +104,9 @@ const color_pink: ThemeColorPrimitive = {
109
104
  pink_90: "#fecde2",
110
105
  pink_95: "#fee6f0",
111
106
  pink_99: "#fffafc",
112
- } as const;
107
+ } satisfies Record<string, string>;
113
108
 
114
- const color_red: ThemeColorPrimitive = {
109
+ const color_red = {
115
110
  red_10: "#310602",
116
111
  red_20: "#610d05",
117
112
  red_30: "#921307",
@@ -125,9 +120,9 @@ const color_red: ThemeColorPrimitive = {
125
120
  red_90: "#fcd2cf",
126
121
  red_95: "#fde8e7",
127
122
  red_99: "#fffafa",
128
- } as const;
123
+ } satisfies Record<string, string>;
129
124
 
130
- const color_orange: ThemeColorPrimitive = {
125
+ const color_orange = {
131
126
  orange_10: "#331100",
132
127
  orange_20: "#662200",
133
128
  orange_30: "#993300",
@@ -141,9 +136,9 @@ const color_orange: ThemeColorPrimitive = {
141
136
  orange_90: "#ffddcc",
142
137
  orange_95: "#ffeee5",
143
138
  orange_99: "#fffcfa",
144
- } as const;
139
+ } satisfies Record<string, string>;
145
140
 
146
- const color_yellow: ThemeColorPrimitive = {
141
+ const color_yellow = {
147
142
  yellow_10: "#302903",
148
143
  yellow_20: "#615205",
149
144
  yellow_30: "#917a08",
@@ -157,9 +152,9 @@ const color_yellow: ThemeColorPrimitive = {
157
152
  yellow_90: "#fcf5cf",
158
153
  yellow_95: "#fefae7",
159
154
  yellow_99: "#fffefa",
160
- } as const;
155
+ } satisfies Record<string, string>;
161
156
 
162
- const color_lime: ThemeColorPrimitive = {
157
+ const color_lime = {
163
158
  lime_10: "#2b3300",
164
159
  lime_20: "#556600",
165
160
  lime_30: "#809900",
@@ -173,9 +168,9 @@ const color_lime: ThemeColorPrimitive = {
173
168
  lime_90: "#f7ffcc",
174
169
  lime_95: "#fbffe5",
175
170
  lime_99: "#fefffa",
176
- } as const;
171
+ } satisfies Record<string, string>;
177
172
 
178
- const color_green: ThemeColorPrimitive = {
173
+ const color_green = {
179
174
  green_10: "#062d13",
180
175
  green_20: "#0d5926",
181
176
  green_30: "#138639",
@@ -189,9 +184,9 @@ const color_green: ThemeColorPrimitive = {
189
184
  green_90: "#d2f9df",
190
185
  green_95: "#e9fcef",
191
186
  green_99: "#fbfefc",
192
- } as const;
187
+ } satisfies Record<string, string>;
193
188
 
194
- const color_bright_green: ThemeColorPrimitive = {
189
+ const color_bright_green = {
195
190
  bright_green_10: "#213003",
196
191
  bright_green_20: "#426105",
197
192
  bright_green_30: "#639108",
@@ -205,9 +200,9 @@ const color_bright_green: ThemeColorPrimitive = {
205
200
  bright_green_90: "#edfccf",
206
201
  bright_green_95: "#f6fee7",
207
202
  bright_green_99: "#fdfffa",
208
- } as const;
203
+ } satisfies Record<string, string>;
209
204
 
210
- const color_teal: ThemeColorPrimitive = {
205
+ const color_teal = {
211
206
  teal_10: "#062d20",
212
207
  teal_20: "#0d5940",
213
208
  teal_30: "#13865f",
@@ -221,9 +216,9 @@ const color_teal: ThemeColorPrimitive = {
221
216
  teal_90: "#d2f9ec",
222
217
  teal_95: "#e9fcf5",
223
218
  teal_99: "#fbfefd",
224
- } as const;
219
+ } satisfies Record<string, string>;
225
220
 
226
- const color_cyan: ThemeColorPrimitive = {
221
+ const color_cyan = {
227
222
  cyan_10: "#002f33",
228
223
  cyan_20: "#005e66",
229
224
  cyan_30: "#008c99",
@@ -237,14 +232,14 @@ const color_cyan: ThemeColorPrimitive = {
237
232
  cyan_90: "#ccfbff",
238
233
  cyan_95: "#e5fdff",
239
234
  cyan_99: "#faffff",
240
- } as const;
235
+ } satisfies Record<string, string>;
241
236
 
242
237
  /**
243
238
  * Foundation Color Data; primitive color token snapshot
244
239
  * /_context/** 추출본을 참고해 수동으로 동기화한 컬러 토큰이다.
245
240
  * SCSS 값과 어긋나면 이 객체를 함께 수정해 문서/검증에 활용한다.
246
241
  */
247
- export const color_primitive: ThemeColorPrimitive = {
242
+ export const color_primitive = {
248
243
  ...color_common,
249
244
  ...color_neutral,
250
245
  ...color_cool_gray,
@@ -260,13 +255,14 @@ export const color_primitive: ThemeColorPrimitive = {
260
255
  ...color_bright_green,
261
256
  ...color_teal,
262
257
  ...color_cyan,
263
- };
258
+ } satisfies Record<string, string>;
264
259
 
265
260
  /**
266
261
  * Foundation Color Data; semantic color token snapshot
267
262
  * canonical semantic 경로만 유지하며, CSS 하위호환 alias 변수는 SCSS 레이어에서만 함께 제공한다.
268
263
  */
269
- export const color_semantic: ThemeColorSemanticSection = {
264
+ // 변경: token object가 SOT가 되도록 별도 schema 주석 없이 실제 snapshot shape를 보존한다.
265
+ export const color_semantic = {
270
266
  primary: {
271
267
  default: color_primitive.blue_55,
272
268
  strong: color_primitive.blue_45,
@@ -1,19 +1,17 @@
1
- import type { ThemeTokens } from "../types/theme-tokens";
2
-
3
1
  /**
4
2
  * Foundation Layout Data; breakpoint token snapshot
5
3
  */
6
- export const layout_breakpoint: ThemeTokens["layout"]["breakpoint"] = {
4
+ export const layout_breakpoint = {
7
5
  xsmall: 0,
8
6
  small: 768,
9
7
  medium: 992,
10
8
  large: 1200,
11
- };
9
+ } satisfies Record<string, number>;
12
10
 
13
11
  /**
14
12
  * Foundation Layout Data; layout size token snapshot
15
13
  */
16
- export const layout_size: ThemeTokens["layout"]["size"] = {
14
+ export const layout_size = {
17
15
  xxsmall: 4,
18
16
  xsmall_1: 8,
19
17
  xsmall_2: 12,
@@ -29,7 +27,7 @@ export const layout_size: ThemeTokens["layout"]["size"] = {
29
27
  large_2: 80,
30
28
  xlarge_1: 96,
31
29
  xlarge_2: 120,
32
- };
30
+ } satisfies Record<string, number>;
33
31
 
34
32
  /**
35
33
  * Foundation Layout Data; radius-by-size와 radius-by-level token snapshot
@@ -64,4 +62,7 @@ export const layout_radius = {
64
62
  large_2: 16,
65
63
  xlarge: 16,
66
64
  },
67
- } as const;
65
+ } satisfies {
66
+ size: Record<string, number>;
67
+ level: Record<string, number>;
68
+ };
@@ -1,9 +1,7 @@
1
- import type { ThemeSpacingScale } from "../types/theme-tokens";
2
-
3
1
  /**
4
2
  * Foundation Spacing Data; padding token snapshot
5
3
  */
6
- export const spacing_padding: ThemeSpacingScale = {
4
+ export const spacing_padding = {
7
5
  padding_1: 2,
8
6
  padding_2: 4,
9
7
  padding_3: 6,
@@ -15,12 +13,12 @@ export const spacing_padding: ThemeSpacingScale = {
15
13
  padding_9: 28,
16
14
  padding_10: 32,
17
15
  padding_11: 40,
18
- };
16
+ } satisfies Record<string, number>;
19
17
 
20
18
  /**
21
19
  * Foundation Spacing Data; gap token snapshot
22
20
  */
23
- export const spacing_gap: ThemeSpacingScale = {
21
+ export const spacing_gap = {
24
22
  gap_1: 2,
25
23
  gap_2: 4,
26
24
  gap_3: 6,
@@ -36,4 +34,4 @@ export const spacing_gap: ThemeSpacingScale = {
36
34
  gap_13: 48,
37
35
  gap_14: 64,
38
36
  gap_15: 80,
39
- };
37
+ } satisfies Record<string, number>;
@@ -1,4 +1,3 @@
1
- import type { ThemeTokens } from "../types/theme-tokens";
2
1
  import { color_primitive, color_semantic } from "./color.js";
3
2
  import { spacing_gap, spacing_padding } from "./spacing.js";
4
3
  import { layout_breakpoint, layout_radius, layout_size } from "./layout.js";
@@ -7,7 +6,8 @@ import { typography_tokens } from "./typography.js";
7
6
  /**
8
7
  * Foundation Data; theme token snapshot 집계 객체
9
8
  */
10
- export const themeTokens: ThemeTokens = {
9
+ // 변경: 개별 token object snapshot을 그대로 집계해 ThemeTokens typeof로 파생되게 한다.
10
+ export const themeTokens = {
11
11
  color: {
12
12
  primitive: color_primitive,
13
13
  semantic: color_semantic,
@@ -22,4 +22,4 @@ export const themeTokens: ThemeTokens = {
22
22
  radius: layout_radius,
23
23
  },
24
24
  typography: typography_tokens,
25
- } as const;
25
+ };
@@ -1,9 +1,7 @@
1
- import type { ThemeTokens } from "../types/theme-tokens";
2
-
3
1
  /**
4
2
  * Foundation Typography Data; typography token snapshot
5
3
  */
6
- export const typography_tokens: ThemeTokens["typography"] = {
4
+ export const typography_tokens = {
7
5
  display: {
8
6
  large: {
9
7
  size: 60,
@@ -1,4 +1,13 @@
1
1
  import { themeTokens } from "../data/tokens.js";
2
+ import type {
3
+ ThemeColorPrimitive,
4
+ ThemeLayoutBreakpoint,
5
+ ThemeLayoutRadius,
6
+ ThemeLayoutSize,
7
+ ThemeSpacingGap,
8
+ ThemeSpacingPadding,
9
+ ThemeTypography,
10
+ } from "../types/theme-tokens.js";
2
11
 
3
12
  const tokens = themeTokens;
4
13
 
@@ -10,7 +19,7 @@ const dropPrefix = (value: string, prefix: string) =>
10
19
  /**
11
20
  * Foundation Helper Types; color primitive key
12
21
  */
13
- export type ThemeColorPrimitiveKey = keyof typeof tokens.color.primitive;
22
+ export type ThemeColorPrimitiveKey = keyof ThemeColorPrimitive;
14
23
 
15
24
  /**
16
25
  * Foundation Helpers; primitive color hex 조회
@@ -37,11 +46,11 @@ export function colorPrimitiveVar(key: ThemeColorPrimitiveKey): string {
37
46
  /**
38
47
  * Foundation Helper Types; spacing padding key
39
48
  */
40
- export type ThemeSpacingPaddingKey = keyof typeof tokens.spacing.padding;
49
+ export type ThemeSpacingPaddingKey = keyof ThemeSpacingPadding;
41
50
  /**
42
51
  * Foundation Helper Types; spacing gap key
43
52
  */
44
- export type ThemeSpacingGapKey = keyof typeof tokens.spacing.gap;
53
+ export type ThemeSpacingGapKey = keyof ThemeSpacingGap;
45
54
 
46
55
  /**
47
56
  * Foundation Helpers; spacing padding px 조회
@@ -92,19 +101,19 @@ export function spacingGapVar(key: ThemeSpacingGapKey): string {
92
101
  /**
93
102
  * Foundation Helper Types; layout breakpoint key
94
103
  */
95
- export type ThemeLayoutBreakpointKey = keyof typeof tokens.layout.breakpoint;
104
+ export type ThemeLayoutBreakpointKey = keyof ThemeLayoutBreakpoint;
96
105
  /**
97
106
  * Foundation Helper Types; layout size key
98
107
  */
99
- export type ThemeLayoutSizeKey = keyof typeof tokens.layout.size;
108
+ export type ThemeLayoutSizeKey = keyof ThemeLayoutSize;
100
109
  /**
101
110
  * Foundation Helper Types; layout radius size key
102
111
  */
103
- export type ThemeLayoutRadiusSizeKey = keyof typeof tokens.layout.radius.size;
112
+ export type ThemeLayoutRadiusSizeKey = keyof ThemeLayoutRadius["size"];
104
113
  /**
105
114
  * Foundation Helper Types; layout radius level key
106
115
  */
107
- export type ThemeLayoutRadiusLevelKey = keyof typeof tokens.layout.radius.level;
116
+ export type ThemeLayoutRadiusLevelKey = keyof ThemeLayoutRadius["level"];
108
117
 
109
118
  /**
110
119
  * Foundation Helpers; layout breakpoint px 조회
@@ -198,7 +207,7 @@ export function layoutRadiusLevelVar(key: ThemeLayoutRadiusLevelKey): string {
198
207
  /**
199
208
  * Foundation Helper Types; typography category key
200
209
  */
201
- export type ThemeTypographyCategoryKey = keyof typeof tokens.typography;
210
+ export type ThemeTypographyCategoryKey = keyof ThemeTypography;
202
211
 
203
212
  /**
204
213
  * Foundation Helpers; typography category variant 목록 조회
@@ -207,6 +216,8 @@ export type ThemeTypographyCategoryKey = keyof typeof tokens.typography;
207
216
  * @example
208
217
  * typographyVariants("body");
209
218
  */
210
- export function typographyVariants(category: ThemeTypographyCategoryKey) {
219
+ export function typographyVariants<T extends ThemeTypographyCategoryKey>(
220
+ category: T,
221
+ ): ThemeTypography[T] {
211
222
  return tokens.typography[category];
212
223
  }
@@ -1,81 +1,83 @@
1
+ import type { color_primitive, color_semantic } from "../data/color";
2
+ import type {
3
+ layout_breakpoint,
4
+ layout_radius,
5
+ layout_size,
6
+ } from "../data/layout";
7
+ import type { spacing_gap, spacing_padding } from "../data/spacing";
8
+ import type { themeTokens } from "../data/tokens";
9
+ import type { typography_tokens } from "../data/typography";
10
+
1
11
  /**
2
- * ThemeTypographyVariant; typography variant token 구조
3
- * @property {number} size font-size px 값
4
- * @property {string} line_height line-height 값
5
- * @property {number} letter_spacing letter-spacing 값
6
- * @property {number} font_weight font-weight 값
12
+ * ThemeColorPrimitive; primitive color token snapshot 타입
7
13
  */
8
- export interface ThemeTypographyVariant {
9
- /**
10
- * font-size px 값
11
- */
12
- readonly size: number;
13
- /**
14
- * line-height 값
15
- */
16
- readonly line_height: string;
17
- /**
18
- * letter-spacing 값
19
- */
20
- readonly letter_spacing: number;
21
- /**
22
- * font-weight 값
23
- */
24
- readonly font_weight: number;
25
- }
14
+ export type ThemeColorPrimitive = typeof color_primitive;
26
15
 
27
16
  /**
28
- * ThemeColorPrimitive; primitive color token map
17
+ * ThemeColorSemantic; semantic color token snapshot 타입
29
18
  */
30
- export type ThemeColorPrimitive = Record<string, string>;
19
+ export type ThemeColorSemantic = typeof color_semantic;
20
+
31
21
  /**
32
- * ThemeColorSemanticSection; semantic color nested token map
22
+ * ThemeColorSemanticSection; semantic color nested token map 호환 타입
33
23
  * @property {string | ThemeColorSemanticSection} [token] semantic color value 또는 하위 section
34
24
  */
35
25
  export interface ThemeColorSemanticSection {
36
26
  readonly [token: string]: string | ThemeColorSemanticSection;
37
27
  }
28
+
29
+ /**
30
+ * ThemeSpacingPadding; spacing padding token snapshot 타입
31
+ */
32
+ export type ThemeSpacingPadding = typeof spacing_padding;
33
+
38
34
  /**
39
- * ThemeSpacingScale; spacing scale token map
35
+ * ThemeSpacingGap; spacing gap token snapshot 타입
36
+ */
37
+ export type ThemeSpacingGap = typeof spacing_gap;
38
+
39
+ /**
40
+ * ThemeSpacingScale; spacing scale token map 호환 타입
40
41
  */
41
42
  export type ThemeSpacingScale = Record<string, number>;
43
+
44
+ /**
45
+ * ThemeLayoutBreakpoint; layout breakpoint token snapshot 타입
46
+ */
47
+ export type ThemeLayoutBreakpoint = typeof layout_breakpoint;
48
+
42
49
  /**
43
- * ThemeLayoutSizes; layout size token map
50
+ * ThemeLayoutSize; layout size token snapshot 타입
51
+ */
52
+ export type ThemeLayoutSize = typeof layout_size;
53
+
54
+ /**
55
+ * ThemeLayoutRadius; layout radius token snapshot 타입
56
+ */
57
+ export type ThemeLayoutRadius = typeof layout_radius;
58
+
59
+ /**
60
+ * ThemeLayoutSizes; layout size token map 호환 타입
44
61
  */
45
62
  export type ThemeLayoutSizes = Record<string, number>;
63
+
46
64
  /**
47
- * ThemeTypographyCategory; typography category token map
65
+ * ThemeTypography; typography token snapshot 타입
48
66
  */
49
- export type ThemeTypographyCategory = Record<string, ThemeTypographyVariant>;
67
+ export type ThemeTypography = typeof typography_tokens;
68
+
69
+ /**
70
+ * ThemeTypographyCategory; typography category token map 타입
71
+ */
72
+ export type ThemeTypographyCategory = ThemeTypography[keyof ThemeTypography];
73
+
74
+ /**
75
+ * ThemeTypographyVariant; typography variant token 구조
76
+ */
77
+ export type ThemeTypographyVariant =
78
+ ThemeTypographyCategory[keyof ThemeTypographyCategory];
50
79
 
51
80
  /**
52
81
  * ThemeTokens; foundation token snapshot 전체 구조
53
- * @property {{ primitive: ThemeColorPrimitive; semantic: ThemeColorSemanticSection }} color color token 집합
54
- * @property {{ padding: ThemeSpacingScale; gap: ThemeSpacingScale }} spacing spacing token 집합
55
- * @property {{ breakpoint: Record<"xsmall" | "small" | "medium" | "large", number>; size: ThemeLayoutSizes; radius: { size: ThemeLayoutSizes; level: ThemeLayoutSizes } }} layout layout token 집합
56
- * @property {{ [category: string]: ThemeTypographyCategory }} typography typography token 집합
57
82
  */
58
- export interface ThemeTokens {
59
- readonly color: {
60
- readonly primitive: ThemeColorPrimitive;
61
- readonly semantic: ThemeColorSemanticSection;
62
- };
63
- readonly spacing: {
64
- readonly padding: ThemeSpacingScale;
65
- readonly gap: ThemeSpacingScale;
66
- };
67
- readonly layout: {
68
- readonly breakpoint: Record<
69
- "xsmall" | "small" | "medium" | "large",
70
- number
71
- >;
72
- readonly size: ThemeLayoutSizes;
73
- readonly radius: {
74
- readonly size: ThemeLayoutSizes;
75
- readonly level: ThemeLayoutSizes;
76
- };
77
- };
78
- readonly typography: {
79
- readonly [category: string]: ThemeTypographyCategory;
80
- };
81
- }
83
+ export type ThemeTokens = typeof themeTokens;