@uniai-fe/uds-foundation 0.3.0 → 0.4.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.md +36 -0
- package/dist/data/color.d.ts +5 -0
- package/dist/data/layout.d.ts +9 -0
- package/dist/data/spacing.d.ts +6 -0
- package/dist/data/tokens.d.ts +3 -0
- package/dist/data/typography.d.ts +3 -0
- package/dist/data/typography.js +1 -1
- package/dist/helpers/index.d.ts +129 -0
- package/dist/index.css +1 -0
- package/dist/provider/ThemeProvider.d.ts +14 -2
- package/dist/types/theme-tokens.d.ts +42 -0
- package/dist/typography/fonts/types.d.ts +85 -0
- package/package.json +7 -6
- package/src/color/semantic/border.scss +1 -0
- package/src/data/color.ts +5 -0
- package/src/data/layout.ts +9 -0
- package/src/data/spacing.ts +6 -0
- package/src/data/tokens.ts +3 -0
- package/src/data/typography.ts +4 -1
- package/src/helpers/index.ts +129 -0
- package/src/index.ts +3 -0
- package/src/provider/ThemeProvider.tsx +15 -2
- package/src/provider/index.ts +3 -0
- package/src/types/index.ts +3 -0
- package/src/types/theme-tokens.ts +42 -0
- package/src/typography/fonts/index.ts +3 -0
- package/src/typography/fonts/types.ts +85 -0
package/README.md
CHANGED
|
@@ -10,6 +10,42 @@ pnpm add @uniai-fe/uds-foundation
|
|
|
10
10
|
|
|
11
11
|
## 사용법 요약
|
|
12
12
|
|
|
13
|
+
## 제공 도구 목록
|
|
14
|
+
|
|
15
|
+
- `ThemeProvider`
|
|
16
|
+
- `ThemeProviderProps`
|
|
17
|
+
- `themeTokens`
|
|
18
|
+
- `@uniai-fe/uds-foundation/helpers`
|
|
19
|
+
- `colorPrimitiveHex`
|
|
20
|
+
- `colorPrimitiveVar`
|
|
21
|
+
- `spacingPaddingPx`
|
|
22
|
+
- `spacingPaddingVar`
|
|
23
|
+
- `spacingGapPx`
|
|
24
|
+
- `spacingGapVar`
|
|
25
|
+
- `layoutBreakpointPx`
|
|
26
|
+
- `layoutBreakpointVar`
|
|
27
|
+
- `layoutSizePx`
|
|
28
|
+
- `layoutSizeVar`
|
|
29
|
+
- `layoutRadiusSizePx`
|
|
30
|
+
- `layoutRadiusSizeVar`
|
|
31
|
+
- `layoutRadiusLevelPx`
|
|
32
|
+
- `layoutRadiusLevelVar`
|
|
33
|
+
- `typographyVariants`
|
|
34
|
+
- `@uniai-fe/uds-foundation/typography/fonts`
|
|
35
|
+
- `pretendardFont`
|
|
36
|
+
- `pretendardLocalFont`
|
|
37
|
+
- `interFont`
|
|
38
|
+
- `interLocalFont`
|
|
39
|
+
- `createLocalFontOptions`
|
|
40
|
+
- `@uniai-fe/uds-foundation/types/theme-tokens`
|
|
41
|
+
- `ThemeTokens`
|
|
42
|
+
- `ThemeColorPrimitive`
|
|
43
|
+
- `ThemeColorSemanticSection`
|
|
44
|
+
- `ThemeSpacingScale`
|
|
45
|
+
- `ThemeLayoutSizes`
|
|
46
|
+
- `ThemeTypographyVariant`
|
|
47
|
+
- `ThemeTypographyCategory`
|
|
48
|
+
|
|
13
49
|
### 최근 업데이트
|
|
14
50
|
|
|
15
51
|
- `Light.tokens-v2` 기준으로 color semantic을 동기화했다. `label.standard=#3d3f43`, `border.standard.alternative=#e4e5e7`, `border.standard.assistive=#f2f2f3`로 교정했으며 `state.*`, `icon.*`, `surface.static.cool_gray_darker`를 추가했다.
|
package/dist/data/color.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { ThemeColorPrimitive, ThemeColorSemanticSection } from '../types/theme-tokens.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* Foundation Color Data; primitive color token snapshot
|
|
4
5
|
* /_context/** 추출본을 참고해 수동으로 동기화한 컬러 토큰이다.
|
|
5
6
|
* SCSS 값과 어긋나면 이 객체를 함께 수정해 문서/검증에 활용한다.
|
|
6
7
|
*/
|
|
7
8
|
declare const color_primitive: ThemeColorPrimitive;
|
|
9
|
+
/**
|
|
10
|
+
* Foundation Color Data; semantic color token snapshot
|
|
11
|
+
* canonical semantic 경로만 유지하며, CSS 하위호환 alias 변수는 SCSS 레이어에서만 함께 제공한다.
|
|
12
|
+
*/
|
|
8
13
|
declare const color_semantic: ThemeColorSemanticSection;
|
|
9
14
|
|
|
10
15
|
export { color_primitive, color_semantic };
|
package/dist/data/layout.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { ThemeTokens } from '../types/theme-tokens.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Foundation Layout Data; breakpoint token snapshot
|
|
5
|
+
*/
|
|
3
6
|
declare const layout_breakpoint: ThemeTokens["layout"]["breakpoint"];
|
|
7
|
+
/**
|
|
8
|
+
* Foundation Layout Data; layout size token snapshot
|
|
9
|
+
*/
|
|
4
10
|
declare const layout_size: ThemeTokens["layout"]["size"];
|
|
11
|
+
/**
|
|
12
|
+
* Foundation Layout Data; radius-by-size와 radius-by-level token snapshot
|
|
13
|
+
*/
|
|
5
14
|
declare const layout_radius: {
|
|
6
15
|
readonly size: {
|
|
7
16
|
readonly size_4x4: 1;
|
package/dist/data/spacing.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { ThemeSpacingScale } from '../types/theme-tokens.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Foundation Spacing Data; padding token snapshot
|
|
5
|
+
*/
|
|
3
6
|
declare const spacing_padding: ThemeSpacingScale;
|
|
7
|
+
/**
|
|
8
|
+
* Foundation Spacing Data; gap token snapshot
|
|
9
|
+
*/
|
|
4
10
|
declare const spacing_gap: ThemeSpacingScale;
|
|
5
11
|
|
|
6
12
|
export { spacing_gap, spacing_padding };
|
package/dist/data/tokens.d.ts
CHANGED
package/dist/data/typography.js
CHANGED
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,28 +1,157 @@
|
|
|
1
1
|
import { ThemeTokens, ThemeTypographyCategory } from '../types/theme-tokens.js';
|
|
2
2
|
|
|
3
3
|
declare const tokens: ThemeTokens;
|
|
4
|
+
/**
|
|
5
|
+
* Foundation Helper Types; color primitive key
|
|
6
|
+
*/
|
|
4
7
|
type ThemeColorPrimitiveKey = keyof typeof tokens.color.primitive;
|
|
8
|
+
/**
|
|
9
|
+
* Foundation Helpers; primitive color hex 조회
|
|
10
|
+
* @param {ThemeColorPrimitiveKey} key primitive color token key
|
|
11
|
+
* @returns {string} hex 색상값
|
|
12
|
+
* @example
|
|
13
|
+
* colorPrimitiveHex("blue_55");
|
|
14
|
+
*/
|
|
5
15
|
declare function colorPrimitiveHex(key: ThemeColorPrimitiveKey): string;
|
|
16
|
+
/**
|
|
17
|
+
* Foundation Helpers; primitive color CSS variable 조회
|
|
18
|
+
* @param {ThemeColorPrimitiveKey} key primitive color token key
|
|
19
|
+
* @returns {string} CSS variable 문자열
|
|
20
|
+
* @example
|
|
21
|
+
* colorPrimitiveVar("blue_55");
|
|
22
|
+
*/
|
|
6
23
|
declare function colorPrimitiveVar(key: ThemeColorPrimitiveKey): string;
|
|
24
|
+
/**
|
|
25
|
+
* Foundation Helper Types; spacing padding key
|
|
26
|
+
*/
|
|
7
27
|
type ThemeSpacingPaddingKey = keyof typeof tokens.spacing.padding;
|
|
28
|
+
/**
|
|
29
|
+
* Foundation Helper Types; spacing gap key
|
|
30
|
+
*/
|
|
8
31
|
type ThemeSpacingGapKey = keyof typeof tokens.spacing.gap;
|
|
32
|
+
/**
|
|
33
|
+
* Foundation Helpers; spacing padding px 조회
|
|
34
|
+
* @param {ThemeSpacingPaddingKey} key spacing padding token key
|
|
35
|
+
* @returns {number} px 값
|
|
36
|
+
* @example
|
|
37
|
+
* spacingPaddingPx("padding_6");
|
|
38
|
+
*/
|
|
9
39
|
declare function spacingPaddingPx(key: ThemeSpacingPaddingKey): number;
|
|
40
|
+
/**
|
|
41
|
+
* Foundation Helpers; spacing padding CSS variable 조회
|
|
42
|
+
* @param {ThemeSpacingPaddingKey} key spacing padding token key
|
|
43
|
+
* @returns {string} CSS variable 문자열
|
|
44
|
+
* @example
|
|
45
|
+
* spacingPaddingVar("padding_6");
|
|
46
|
+
*/
|
|
10
47
|
declare function spacingPaddingVar(key: ThemeSpacingPaddingKey): string;
|
|
48
|
+
/**
|
|
49
|
+
* Foundation Helpers; spacing gap px 조회
|
|
50
|
+
* @param {ThemeSpacingGapKey} key spacing gap token key
|
|
51
|
+
* @returns {number} px 값
|
|
52
|
+
* @example
|
|
53
|
+
* spacingGapPx("gap_6");
|
|
54
|
+
*/
|
|
11
55
|
declare function spacingGapPx(key: ThemeSpacingGapKey): number;
|
|
56
|
+
/**
|
|
57
|
+
* Foundation Helpers; spacing gap CSS variable 조회
|
|
58
|
+
* @param {ThemeSpacingGapKey} key spacing gap token key
|
|
59
|
+
* @returns {string} CSS variable 문자열
|
|
60
|
+
* @example
|
|
61
|
+
* spacingGapVar("gap_6");
|
|
62
|
+
*/
|
|
12
63
|
declare function spacingGapVar(key: ThemeSpacingGapKey): string;
|
|
64
|
+
/**
|
|
65
|
+
* Foundation Helper Types; layout breakpoint key
|
|
66
|
+
*/
|
|
13
67
|
type ThemeLayoutBreakpointKey = keyof typeof tokens.layout.breakpoint;
|
|
68
|
+
/**
|
|
69
|
+
* Foundation Helper Types; layout size key
|
|
70
|
+
*/
|
|
14
71
|
type ThemeLayoutSizeKey = keyof typeof tokens.layout.size;
|
|
72
|
+
/**
|
|
73
|
+
* Foundation Helper Types; layout radius size key
|
|
74
|
+
*/
|
|
15
75
|
type ThemeLayoutRadiusSizeKey = keyof typeof tokens.layout.radius.size;
|
|
76
|
+
/**
|
|
77
|
+
* Foundation Helper Types; layout radius level key
|
|
78
|
+
*/
|
|
16
79
|
type ThemeLayoutRadiusLevelKey = keyof typeof tokens.layout.radius.level;
|
|
80
|
+
/**
|
|
81
|
+
* Foundation Helpers; layout breakpoint px 조회
|
|
82
|
+
* @param {ThemeLayoutBreakpointKey} key breakpoint token key
|
|
83
|
+
* @returns {number} px 값
|
|
84
|
+
* @example
|
|
85
|
+
* layoutBreakpointPx("medium");
|
|
86
|
+
*/
|
|
17
87
|
declare function layoutBreakpointPx(key: ThemeLayoutBreakpointKey): number;
|
|
88
|
+
/**
|
|
89
|
+
* Foundation Helpers; layout breakpoint CSS variable 조회
|
|
90
|
+
* @param {ThemeLayoutBreakpointKey} key breakpoint token key
|
|
91
|
+
* @returns {string} CSS variable 문자열
|
|
92
|
+
* @example
|
|
93
|
+
* layoutBreakpointVar("medium");
|
|
94
|
+
*/
|
|
18
95
|
declare function layoutBreakpointVar(key: ThemeLayoutBreakpointKey): string;
|
|
96
|
+
/**
|
|
97
|
+
* Foundation Helpers; layout size px 조회
|
|
98
|
+
* @param {ThemeLayoutSizeKey} key size token key
|
|
99
|
+
* @returns {number} px 값
|
|
100
|
+
* @example
|
|
101
|
+
* layoutSizePx("pc_large");
|
|
102
|
+
*/
|
|
19
103
|
declare function layoutSizePx(key: ThemeLayoutSizeKey): number;
|
|
104
|
+
/**
|
|
105
|
+
* Foundation Helpers; layout size CSS variable 조회
|
|
106
|
+
* @param {ThemeLayoutSizeKey} key size token key
|
|
107
|
+
* @returns {string} CSS variable 문자열
|
|
108
|
+
* @example
|
|
109
|
+
* layoutSizeVar("pc_large");
|
|
110
|
+
*/
|
|
20
111
|
declare function layoutSizeVar(key: ThemeLayoutSizeKey): string;
|
|
112
|
+
/**
|
|
113
|
+
* Foundation Helpers; layout radius size px 조회
|
|
114
|
+
* @param {ThemeLayoutRadiusSizeKey} key radius size token key
|
|
115
|
+
* @returns {number} px 값
|
|
116
|
+
* @example
|
|
117
|
+
* layoutRadiusSizePx("size_medium");
|
|
118
|
+
*/
|
|
21
119
|
declare function layoutRadiusSizePx(key: ThemeLayoutRadiusSizeKey): number;
|
|
120
|
+
/**
|
|
121
|
+
* Foundation Helpers; layout radius size CSS variable 조회
|
|
122
|
+
* @param {ThemeLayoutRadiusSizeKey} key radius size token key
|
|
123
|
+
* @returns {string} CSS variable 문자열
|
|
124
|
+
* @example
|
|
125
|
+
* layoutRadiusSizeVar("size_medium");
|
|
126
|
+
*/
|
|
22
127
|
declare function layoutRadiusSizeVar(key: ThemeLayoutRadiusSizeKey): string;
|
|
128
|
+
/**
|
|
129
|
+
* Foundation Helpers; layout radius level px 조회
|
|
130
|
+
* @param {ThemeLayoutRadiusLevelKey} key radius level token key
|
|
131
|
+
* @returns {number} px 값
|
|
132
|
+
* @example
|
|
133
|
+
* layoutRadiusLevelPx("medium_1");
|
|
134
|
+
*/
|
|
23
135
|
declare function layoutRadiusLevelPx(key: ThemeLayoutRadiusLevelKey): number;
|
|
136
|
+
/**
|
|
137
|
+
* Foundation Helpers; layout radius level CSS variable 조회
|
|
138
|
+
* @param {ThemeLayoutRadiusLevelKey} key radius level token key
|
|
139
|
+
* @returns {string} CSS variable 문자열
|
|
140
|
+
* @example
|
|
141
|
+
* layoutRadiusLevelVar("medium_1");
|
|
142
|
+
*/
|
|
24
143
|
declare function layoutRadiusLevelVar(key: ThemeLayoutRadiusLevelKey): string;
|
|
144
|
+
/**
|
|
145
|
+
* Foundation Helper Types; typography category key
|
|
146
|
+
*/
|
|
25
147
|
type ThemeTypographyCategoryKey = keyof typeof tokens.typography;
|
|
148
|
+
/**
|
|
149
|
+
* Foundation Helpers; typography category variant 목록 조회
|
|
150
|
+
* @param {ThemeTypographyCategoryKey} category typography category key
|
|
151
|
+
* @returns {typeof tokens.typography[ThemeTypographyCategoryKey]} variant map
|
|
152
|
+
* @example
|
|
153
|
+
* typographyVariants("body");
|
|
154
|
+
*/
|
|
26
155
|
declare function typographyVariants(category: ThemeTypographyCategoryKey): ThemeTypographyCategory;
|
|
27
156
|
|
|
28
157
|
export { type ThemeColorPrimitiveKey, type ThemeLayoutBreakpointKey, type ThemeLayoutRadiusLevelKey, type ThemeLayoutRadiusSizeKey, type ThemeLayoutSizeKey, type ThemeSpacingGapKey, type ThemeSpacingPaddingKey, type ThemeTypographyCategoryKey, colorPrimitiveHex, colorPrimitiveVar, layoutBreakpointPx, layoutBreakpointVar, layoutRadiusLevelPx, layoutRadiusLevelVar, layoutRadiusSizePx, layoutRadiusSizeVar, layoutSizePx, layoutSizeVar, spacingGapPx, spacingGapVar, spacingPaddingPx, spacingPaddingVar, typographyVariants };
|
package/dist/index.css
CHANGED
|
@@ -523,6 +523,7 @@
|
|
|
523
523
|
--color-label-alternative: var(--color-cool-gray-70);
|
|
524
524
|
--color-label-assistive: var(--color-cool-gray-80);
|
|
525
525
|
--color-label-disabled: var(--color-cool-gray-80);
|
|
526
|
+
--color-border-standard: var(--color-cool-gray-90);
|
|
526
527
|
--color-border-standard-cool-gray: var(--color-cool-gray-90);
|
|
527
528
|
--color-border-standard-blue: var(--color-blue-90);
|
|
528
529
|
--color-border-strong: var(--color-cool-gray-75);
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* ThemeProvider Props; foundation theme provider 속성
|
|
6
|
+
* @property {string} [className] `.uds-theme-root`와 함께 병합할 루트 className
|
|
7
|
+
*/
|
|
4
8
|
type FoundationThemeProviderProps = {
|
|
9
|
+
/**
|
|
10
|
+
* `.uds-theme-root`와 함께 병합할 루트 className
|
|
11
|
+
*/
|
|
5
12
|
className?: string;
|
|
6
13
|
};
|
|
7
14
|
/**
|
|
8
|
-
* Foundation Theme Provider
|
|
9
|
-
*
|
|
15
|
+
* Foundation Theme Provider; CSS 변수 토큰 적용 루트 provider
|
|
16
|
+
* @component
|
|
17
|
+
* @param {PropsWithChildren<FoundationThemeProviderProps>} props
|
|
18
|
+
* @param {string} [props.className] `.uds-theme-root`와 함께 병합할 루트 className
|
|
19
|
+
* @param {React.ReactNode} props.children provider 하위 렌더 노드
|
|
20
|
+
* @example
|
|
21
|
+
* <ThemeProvider><App /></ThemeProvider>
|
|
10
22
|
*/
|
|
11
23
|
declare function ThemeProvider({ children, className, }: PropsWithChildren<FoundationThemeProviderProps>): react_jsx_runtime.JSX.Element;
|
|
12
24
|
|
|
@@ -1,16 +1,58 @@
|
|
|
1
|
+
/**
|
|
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 값
|
|
7
|
+
*/
|
|
1
8
|
interface ThemeTypographyVariant {
|
|
9
|
+
/**
|
|
10
|
+
* font-size px 값
|
|
11
|
+
*/
|
|
2
12
|
readonly size: number;
|
|
13
|
+
/**
|
|
14
|
+
* line-height 값
|
|
15
|
+
*/
|
|
3
16
|
readonly line_height: string;
|
|
17
|
+
/**
|
|
18
|
+
* letter-spacing 값
|
|
19
|
+
*/
|
|
4
20
|
readonly letter_spacing: number;
|
|
21
|
+
/**
|
|
22
|
+
* font-weight 값
|
|
23
|
+
*/
|
|
5
24
|
readonly font_weight: number;
|
|
6
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* ThemeColorPrimitive; primitive color token map
|
|
28
|
+
*/
|
|
7
29
|
type ThemeColorPrimitive = Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* ThemeColorSemanticSection; semantic color nested token map
|
|
32
|
+
* @property {string | ThemeColorSemanticSection} [token] semantic color value 또는 하위 section
|
|
33
|
+
*/
|
|
8
34
|
interface ThemeColorSemanticSection {
|
|
9
35
|
readonly [token: string]: string | ThemeColorSemanticSection;
|
|
10
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* ThemeSpacingScale; spacing scale token map
|
|
39
|
+
*/
|
|
11
40
|
type ThemeSpacingScale = Record<string, number>;
|
|
41
|
+
/**
|
|
42
|
+
* ThemeLayoutSizes; layout size token map
|
|
43
|
+
*/
|
|
12
44
|
type ThemeLayoutSizes = Record<string, number>;
|
|
45
|
+
/**
|
|
46
|
+
* ThemeTypographyCategory; typography category token map
|
|
47
|
+
*/
|
|
13
48
|
type ThemeTypographyCategory = Record<string, ThemeTypographyVariant>;
|
|
49
|
+
/**
|
|
50
|
+
* 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
|
+
*/
|
|
14
56
|
interface ThemeTokens {
|
|
15
57
|
readonly color: {
|
|
16
58
|
readonly primitive: ThemeColorPrimitive;
|
|
@@ -1,30 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThemeFontStyle; font style 축
|
|
3
|
+
* @typedef {"normal" | "italic"} ThemeFontStyle
|
|
4
|
+
*/
|
|
1
5
|
type ThemeFontStyle = "normal" | "italic";
|
|
6
|
+
/**
|
|
7
|
+
* ThemeFontDisplay; next/font display 축
|
|
8
|
+
* @typedef {"auto" | "block" | "swap" | "fallback" | "optional"} ThemeFontDisplay
|
|
9
|
+
*/
|
|
2
10
|
type ThemeFontDisplay = "auto" | "block" | "swap" | "fallback" | "optional";
|
|
11
|
+
/**
|
|
12
|
+
* ThemeFontSource; font file source 정의
|
|
13
|
+
* @property {string} filename 폰트 파일명
|
|
14
|
+
* @property {string} weight font-weight 문자열
|
|
15
|
+
* @property {ThemeFontStyle} style font-style 값
|
|
16
|
+
*/
|
|
3
17
|
interface ThemeFontSource {
|
|
18
|
+
/**
|
|
19
|
+
* 폰트 파일명
|
|
20
|
+
*/
|
|
4
21
|
filename: string;
|
|
22
|
+
/**
|
|
23
|
+
* font-weight 문자열
|
|
24
|
+
*/
|
|
5
25
|
weight: string;
|
|
26
|
+
/**
|
|
27
|
+
* font-style 값
|
|
28
|
+
*/
|
|
6
29
|
style: ThemeFontStyle;
|
|
7
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* ThemeFontDefinition; foundation font definition 구조
|
|
33
|
+
* @property {string} name 폰트 식별자
|
|
34
|
+
* @property {string} family CSS font-family 이름
|
|
35
|
+
* @property {string} cssVariable CSS variable 이름
|
|
36
|
+
* @property {string[]} fallbacks fallback font-family 목록
|
|
37
|
+
* @property {ThemeFontDisplay} [display] next/font display 정책
|
|
38
|
+
* @property {boolean} [preload] preload 여부
|
|
39
|
+
* @property {readonly ThemeFontSource[]} sources 폰트 소스 목록
|
|
40
|
+
*/
|
|
8
41
|
interface ThemeFontDefinition {
|
|
42
|
+
/**
|
|
43
|
+
* 폰트 식별자
|
|
44
|
+
*/
|
|
9
45
|
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* CSS font-family 이름
|
|
48
|
+
*/
|
|
10
49
|
family: string;
|
|
50
|
+
/**
|
|
51
|
+
* CSS variable 이름
|
|
52
|
+
*/
|
|
11
53
|
cssVariable: string;
|
|
54
|
+
/**
|
|
55
|
+
* fallback font-family 목록
|
|
56
|
+
*/
|
|
12
57
|
fallbacks: string[];
|
|
58
|
+
/**
|
|
59
|
+
* next/font display 정책
|
|
60
|
+
*/
|
|
13
61
|
display?: ThemeFontDisplay;
|
|
62
|
+
/**
|
|
63
|
+
* preload 여부
|
|
64
|
+
*/
|
|
14
65
|
preload?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 폰트 소스 목록
|
|
68
|
+
*/
|
|
15
69
|
sources: readonly ThemeFontSource[];
|
|
16
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* NextLocalFontOptions; next/font/local 입력 옵션 구조
|
|
73
|
+
* @property {string} variable CSS variable 이름
|
|
74
|
+
* @property {ThemeFontDisplay} [display] next/font display 정책
|
|
75
|
+
* @property {string[]} fallback fallback font-family 목록
|
|
76
|
+
* @property {boolean} [preload] preload 여부
|
|
77
|
+
* @property {ReadonlyArray<{ path: string; weight: string; style: ThemeFontStyle }>} src 폰트 소스 목록
|
|
78
|
+
*/
|
|
17
79
|
interface NextLocalFontOptions {
|
|
80
|
+
/**
|
|
81
|
+
* CSS variable 이름
|
|
82
|
+
*/
|
|
18
83
|
variable: string;
|
|
84
|
+
/**
|
|
85
|
+
* next/font display 정책
|
|
86
|
+
*/
|
|
19
87
|
display?: ThemeFontDisplay;
|
|
88
|
+
/**
|
|
89
|
+
* fallback font-family 목록
|
|
90
|
+
*/
|
|
20
91
|
fallback: string[];
|
|
92
|
+
/**
|
|
93
|
+
* preload 여부
|
|
94
|
+
*/
|
|
21
95
|
preload?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* 폰트 소스 목록
|
|
98
|
+
*/
|
|
22
99
|
src: ReadonlyArray<{
|
|
23
100
|
path: string;
|
|
24
101
|
weight: string;
|
|
25
102
|
style: ThemeFontStyle;
|
|
26
103
|
}>;
|
|
27
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Foundation Fonts; localFont options 변환 유틸
|
|
107
|
+
* @param {ThemeFontDefinition} font foundation font definition
|
|
108
|
+
* @param {string} metaUrl import.meta.url
|
|
109
|
+
* @returns {NextLocalFontOptions} next/font/local 옵션 객체
|
|
110
|
+
* @example
|
|
111
|
+
* createLocalFontOptions(pretendardFont, import.meta.url);
|
|
112
|
+
*/
|
|
28
113
|
declare function createLocalFontOptions(font: ThemeFontDefinition, metaUrl: string): NextLocalFontOptions;
|
|
29
114
|
|
|
30
115
|
export { type NextLocalFontOptions, type ThemeFontDefinition, type ThemeFontDisplay, type ThemeFontSource, type ThemeFontStyle, createLocalFontOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniai-fe/uds-foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "UNIAI Design System; Design Foundation Package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
-
"packageManager": "pnpm@10.
|
|
15
|
+
"packageManager": "pnpm@10.32.0",
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=24",
|
|
18
18
|
"pnpm": ">=10"
|
|
@@ -99,15 +99,16 @@
|
|
|
99
99
|
"module:build": "pnpm build",
|
|
100
100
|
"module:dev": "pnpm dev",
|
|
101
101
|
"foundation:build": "pnpm run build",
|
|
102
|
-
"foundation:dev": "pnpm run dev"
|
|
102
|
+
"foundation:dev": "pnpm run dev",
|
|
103
|
+
"publish:public": "bash ../../../scripts/npm-publish.sh"
|
|
103
104
|
},
|
|
104
105
|
"devDependencies": {
|
|
105
106
|
"@types/node": "^24.10.2",
|
|
106
|
-
"@types/react": "^19.2.
|
|
107
|
+
"@types/react": "^19.2.14",
|
|
107
108
|
"react": "^19.2.4",
|
|
108
109
|
"@uniai-fe/tsconfig": "workspace:*",
|
|
109
|
-
"autoprefixer": "^10.4.
|
|
110
|
-
"postcss": "^8.5.
|
|
110
|
+
"autoprefixer": "^10.4.27",
|
|
111
|
+
"postcss": "^8.5.8",
|
|
111
112
|
"postcss-cli": "^11.0.1",
|
|
112
113
|
"prettier": "^3.8.1",
|
|
113
114
|
"sass": "^1.97.3",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// 테마 경계선 토큰
|
|
2
2
|
@mixin foundation-color-border() {
|
|
3
|
+
--color-border-standard: var(--color-cool-gray-90); // #e4e5e7;
|
|
3
4
|
--color-border-standard-cool-gray: var(--color-cool-gray-90); // #e4e5e7;
|
|
4
5
|
--color-border-standard-blue: var(--color-blue-90); // #ccdeff;
|
|
5
6
|
--color-border-strong: var(--color-cool-gray-75); // #bcbec2;
|
package/src/data/color.ts
CHANGED
|
@@ -240,6 +240,7 @@ const color_cyan: ThemeColorPrimitive = {
|
|
|
240
240
|
} as const;
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
+
* Foundation Color Data; primitive color token snapshot
|
|
243
244
|
* /_context/** 추출본을 참고해 수동으로 동기화한 컬러 토큰이다.
|
|
244
245
|
* SCSS 값과 어긋나면 이 객체를 함께 수정해 문서/검증에 활용한다.
|
|
245
246
|
*/
|
|
@@ -261,6 +262,10 @@ export const color_primitive: ThemeColorPrimitive = {
|
|
|
261
262
|
...color_cyan,
|
|
262
263
|
};
|
|
263
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Foundation Color Data; semantic color token snapshot
|
|
267
|
+
* canonical semantic 경로만 유지하며, CSS 하위호환 alias 변수는 SCSS 레이어에서만 함께 제공한다.
|
|
268
|
+
*/
|
|
264
269
|
export const color_semantic: ThemeColorSemanticSection = {
|
|
265
270
|
primary: {
|
|
266
271
|
default: color_primitive.blue_55,
|
package/src/data/layout.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ThemeTokens } from "../types/theme-tokens";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Foundation Layout Data; breakpoint token snapshot
|
|
5
|
+
*/
|
|
3
6
|
export const layout_breakpoint: ThemeTokens["layout"]["breakpoint"] = {
|
|
4
7
|
xsmall: 0,
|
|
5
8
|
small: 768,
|
|
@@ -7,6 +10,9 @@ export const layout_breakpoint: ThemeTokens["layout"]["breakpoint"] = {
|
|
|
7
10
|
large: 1200,
|
|
8
11
|
};
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Foundation Layout Data; layout size token snapshot
|
|
15
|
+
*/
|
|
10
16
|
export const layout_size: ThemeTokens["layout"]["size"] = {
|
|
11
17
|
xxsmall: 4,
|
|
12
18
|
xsmall_1: 8,
|
|
@@ -25,6 +31,9 @@ export const layout_size: ThemeTokens["layout"]["size"] = {
|
|
|
25
31
|
xlarge_2: 120,
|
|
26
32
|
};
|
|
27
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Foundation Layout Data; radius-by-size와 radius-by-level token snapshot
|
|
36
|
+
*/
|
|
28
37
|
export const layout_radius = {
|
|
29
38
|
size: {
|
|
30
39
|
size_4x4: 1,
|
package/src/data/spacing.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ThemeSpacingScale } from "../types/theme-tokens";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Foundation Spacing Data; padding token snapshot
|
|
5
|
+
*/
|
|
3
6
|
export const spacing_padding: ThemeSpacingScale = {
|
|
4
7
|
padding_1: 2,
|
|
5
8
|
padding_2: 4,
|
|
@@ -14,6 +17,9 @@ export const spacing_padding: ThemeSpacingScale = {
|
|
|
14
17
|
padding_11: 40,
|
|
15
18
|
};
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Foundation Spacing Data; gap token snapshot
|
|
22
|
+
*/
|
|
17
23
|
export const spacing_gap: ThemeSpacingScale = {
|
|
18
24
|
gap_1: 2,
|
|
19
25
|
gap_2: 4,
|
package/src/data/tokens.ts
CHANGED
|
@@ -4,6 +4,9 @@ import { spacing_gap, spacing_padding } from "./spacing.js";
|
|
|
4
4
|
import { layout_breakpoint, layout_radius, layout_size } from "./layout.js";
|
|
5
5
|
import { typography_tokens } from "./typography.js";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Foundation Data; theme token snapshot 집계 객체
|
|
9
|
+
*/
|
|
7
10
|
export const themeTokens: ThemeTokens = {
|
|
8
11
|
color: {
|
|
9
12
|
primitive: color_primitive,
|
package/src/data/typography.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ThemeTokens } from "../types/theme-tokens";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Foundation Typography Data; typography token snapshot
|
|
5
|
+
*/
|
|
3
6
|
export const typography_tokens: ThemeTokens["typography"] = {
|
|
4
7
|
display: {
|
|
5
8
|
large: {
|
|
@@ -59,7 +62,7 @@ export const typography_tokens: ThemeTokens["typography"] = {
|
|
|
59
62
|
font_weight: 600,
|
|
60
63
|
},
|
|
61
64
|
},
|
|
62
|
-
//
|
|
65
|
+
// 변경: body scale은 최신 Figma Light tokens와 xxsmall 축을 그대로 따른다.
|
|
63
66
|
body: {
|
|
64
67
|
large: {
|
|
65
68
|
size: 19,
|
package/src/helpers/index.ts
CHANGED
|
@@ -7,77 +7,206 @@ const kebab = (value: string) => value.replace(/_/g, "-");
|
|
|
7
7
|
const dropPrefix = (value: string, prefix: string) =>
|
|
8
8
|
value.startsWith(`${prefix}_`) ? value.slice(prefix.length + 1) : value;
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Foundation Helper Types; color primitive key
|
|
12
|
+
*/
|
|
10
13
|
export type ThemeColorPrimitiveKey = keyof typeof tokens.color.primitive;
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Foundation Helpers; primitive color hex 조회
|
|
17
|
+
* @param {ThemeColorPrimitiveKey} key primitive color token key
|
|
18
|
+
* @returns {string} hex 색상값
|
|
19
|
+
* @example
|
|
20
|
+
* colorPrimitiveHex("blue_55");
|
|
21
|
+
*/
|
|
12
22
|
export function colorPrimitiveHex(key: ThemeColorPrimitiveKey): string {
|
|
13
23
|
return tokens.color.primitive[key];
|
|
14
24
|
}
|
|
15
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Foundation Helpers; primitive color CSS variable 조회
|
|
28
|
+
* @param {ThemeColorPrimitiveKey} key primitive color token key
|
|
29
|
+
* @returns {string} CSS variable 문자열
|
|
30
|
+
* @example
|
|
31
|
+
* colorPrimitiveVar("blue_55");
|
|
32
|
+
*/
|
|
16
33
|
export function colorPrimitiveVar(key: ThemeColorPrimitiveKey): string {
|
|
17
34
|
return cssVar(`color-${kebab(key)}`);
|
|
18
35
|
}
|
|
19
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Foundation Helper Types; spacing padding key
|
|
39
|
+
*/
|
|
20
40
|
export type ThemeSpacingPaddingKey = keyof typeof tokens.spacing.padding;
|
|
41
|
+
/**
|
|
42
|
+
* Foundation Helper Types; spacing gap key
|
|
43
|
+
*/
|
|
21
44
|
export type ThemeSpacingGapKey = keyof typeof tokens.spacing.gap;
|
|
22
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Foundation Helpers; spacing padding px 조회
|
|
48
|
+
* @param {ThemeSpacingPaddingKey} key spacing padding token key
|
|
49
|
+
* @returns {number} px 값
|
|
50
|
+
* @example
|
|
51
|
+
* spacingPaddingPx("padding_6");
|
|
52
|
+
*/
|
|
23
53
|
export function spacingPaddingPx(key: ThemeSpacingPaddingKey): number {
|
|
24
54
|
return tokens.spacing.padding[key];
|
|
25
55
|
}
|
|
26
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Foundation Helpers; spacing padding CSS variable 조회
|
|
59
|
+
* @param {ThemeSpacingPaddingKey} key spacing padding token key
|
|
60
|
+
* @returns {string} CSS variable 문자열
|
|
61
|
+
* @example
|
|
62
|
+
* spacingPaddingVar("padding_6");
|
|
63
|
+
*/
|
|
27
64
|
export function spacingPaddingVar(key: ThemeSpacingPaddingKey): string {
|
|
28
65
|
const suffix = kebab(dropPrefix(key, "padding"));
|
|
29
66
|
return cssVar(`spacing-padding-${suffix}`);
|
|
30
67
|
}
|
|
31
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Foundation Helpers; spacing gap px 조회
|
|
71
|
+
* @param {ThemeSpacingGapKey} key spacing gap token key
|
|
72
|
+
* @returns {number} px 값
|
|
73
|
+
* @example
|
|
74
|
+
* spacingGapPx("gap_6");
|
|
75
|
+
*/
|
|
32
76
|
export function spacingGapPx(key: ThemeSpacingGapKey): number {
|
|
33
77
|
return tokens.spacing.gap[key];
|
|
34
78
|
}
|
|
35
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Foundation Helpers; spacing gap CSS variable 조회
|
|
82
|
+
* @param {ThemeSpacingGapKey} key spacing gap token key
|
|
83
|
+
* @returns {string} CSS variable 문자열
|
|
84
|
+
* @example
|
|
85
|
+
* spacingGapVar("gap_6");
|
|
86
|
+
*/
|
|
36
87
|
export function spacingGapVar(key: ThemeSpacingGapKey): string {
|
|
37
88
|
const suffix = kebab(dropPrefix(key, "gap"));
|
|
38
89
|
return cssVar(`spacing-gap-${suffix}`);
|
|
39
90
|
}
|
|
40
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Foundation Helper Types; layout breakpoint key
|
|
94
|
+
*/
|
|
41
95
|
export type ThemeLayoutBreakpointKey = keyof typeof tokens.layout.breakpoint;
|
|
96
|
+
/**
|
|
97
|
+
* Foundation Helper Types; layout size key
|
|
98
|
+
*/
|
|
42
99
|
export type ThemeLayoutSizeKey = keyof typeof tokens.layout.size;
|
|
100
|
+
/**
|
|
101
|
+
* Foundation Helper Types; layout radius size key
|
|
102
|
+
*/
|
|
43
103
|
export type ThemeLayoutRadiusSizeKey = keyof typeof tokens.layout.radius.size;
|
|
104
|
+
/**
|
|
105
|
+
* Foundation Helper Types; layout radius level key
|
|
106
|
+
*/
|
|
44
107
|
export type ThemeLayoutRadiusLevelKey = keyof typeof tokens.layout.radius.level;
|
|
45
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Foundation Helpers; layout breakpoint px 조회
|
|
111
|
+
* @param {ThemeLayoutBreakpointKey} key breakpoint token key
|
|
112
|
+
* @returns {number} px 값
|
|
113
|
+
* @example
|
|
114
|
+
* layoutBreakpointPx("medium");
|
|
115
|
+
*/
|
|
46
116
|
export function layoutBreakpointPx(key: ThemeLayoutBreakpointKey): number {
|
|
47
117
|
return tokens.layout.breakpoint[key];
|
|
48
118
|
}
|
|
49
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Foundation Helpers; layout breakpoint CSS variable 조회
|
|
122
|
+
* @param {ThemeLayoutBreakpointKey} key breakpoint token key
|
|
123
|
+
* @returns {string} CSS variable 문자열
|
|
124
|
+
* @example
|
|
125
|
+
* layoutBreakpointVar("medium");
|
|
126
|
+
*/
|
|
50
127
|
export function layoutBreakpointVar(key: ThemeLayoutBreakpointKey): string {
|
|
51
128
|
return cssVar(`theme-breakpoint-${kebab(key)}-start`);
|
|
52
129
|
}
|
|
53
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Foundation Helpers; layout size px 조회
|
|
133
|
+
* @param {ThemeLayoutSizeKey} key size token key
|
|
134
|
+
* @returns {number} px 값
|
|
135
|
+
* @example
|
|
136
|
+
* layoutSizePx("pc_large");
|
|
137
|
+
*/
|
|
54
138
|
export function layoutSizePx(key: ThemeLayoutSizeKey): number {
|
|
55
139
|
return tokens.layout.size[key];
|
|
56
140
|
}
|
|
57
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Foundation Helpers; layout size CSS variable 조회
|
|
144
|
+
* @param {ThemeLayoutSizeKey} key size token key
|
|
145
|
+
* @returns {string} CSS variable 문자열
|
|
146
|
+
* @example
|
|
147
|
+
* layoutSizeVar("pc_large");
|
|
148
|
+
*/
|
|
58
149
|
export function layoutSizeVar(key: ThemeLayoutSizeKey): string {
|
|
59
150
|
return cssVar(`theme-size-${kebab(key)}`);
|
|
60
151
|
}
|
|
61
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Foundation Helpers; layout radius size px 조회
|
|
155
|
+
* @param {ThemeLayoutRadiusSizeKey} key radius size token key
|
|
156
|
+
* @returns {number} px 값
|
|
157
|
+
* @example
|
|
158
|
+
* layoutRadiusSizePx("size_medium");
|
|
159
|
+
*/
|
|
62
160
|
export function layoutRadiusSizePx(key: ThemeLayoutRadiusSizeKey): number {
|
|
63
161
|
return tokens.layout.radius.size[key];
|
|
64
162
|
}
|
|
65
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Foundation Helpers; layout radius size CSS variable 조회
|
|
166
|
+
* @param {ThemeLayoutRadiusSizeKey} key radius size token key
|
|
167
|
+
* @returns {string} CSS variable 문자열
|
|
168
|
+
* @example
|
|
169
|
+
* layoutRadiusSizeVar("size_medium");
|
|
170
|
+
*/
|
|
66
171
|
export function layoutRadiusSizeVar(key: ThemeLayoutRadiusSizeKey): string {
|
|
67
172
|
const suffix = kebab(dropPrefix(key, "size"));
|
|
68
173
|
return cssVar(`theme-radius-${suffix}`);
|
|
69
174
|
}
|
|
70
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Foundation Helpers; layout radius level px 조회
|
|
178
|
+
* @param {ThemeLayoutRadiusLevelKey} key radius level token key
|
|
179
|
+
* @returns {number} px 값
|
|
180
|
+
* @example
|
|
181
|
+
* layoutRadiusLevelPx("medium_1");
|
|
182
|
+
*/
|
|
71
183
|
export function layoutRadiusLevelPx(key: ThemeLayoutRadiusLevelKey): number {
|
|
72
184
|
return tokens.layout.radius.level[key];
|
|
73
185
|
}
|
|
74
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Foundation Helpers; layout radius level CSS variable 조회
|
|
189
|
+
* @param {ThemeLayoutRadiusLevelKey} key radius level token key
|
|
190
|
+
* @returns {string} CSS variable 문자열
|
|
191
|
+
* @example
|
|
192
|
+
* layoutRadiusLevelVar("medium_1");
|
|
193
|
+
*/
|
|
75
194
|
export function layoutRadiusLevelVar(key: ThemeLayoutRadiusLevelKey): string {
|
|
76
195
|
return cssVar(`theme-radius-${kebab(key)}`);
|
|
77
196
|
}
|
|
78
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Foundation Helper Types; typography category key
|
|
200
|
+
*/
|
|
79
201
|
export type ThemeTypographyCategoryKey = keyof typeof tokens.typography;
|
|
80
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Foundation Helpers; typography category variant 목록 조회
|
|
205
|
+
* @param {ThemeTypographyCategoryKey} category typography category key
|
|
206
|
+
* @returns {typeof tokens.typography[ThemeTypographyCategoryKey]} variant map
|
|
207
|
+
* @example
|
|
208
|
+
* typographyVariants("body");
|
|
209
|
+
*/
|
|
81
210
|
export function typographyVariants(category: ThemeTypographyCategoryKey) {
|
|
82
211
|
return tokens.typography[category];
|
|
83
212
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* ThemeProvider Props; foundation theme provider 속성
|
|
5
|
+
* @property {string} [className] `.uds-theme-root`와 함께 병합할 루트 className
|
|
6
|
+
*/
|
|
3
7
|
export type FoundationThemeProviderProps = {
|
|
8
|
+
/**
|
|
9
|
+
* `.uds-theme-root`와 함께 병합할 루트 className
|
|
10
|
+
*/
|
|
4
11
|
className?: string;
|
|
5
12
|
};
|
|
6
13
|
|
|
7
14
|
/**
|
|
8
|
-
* Foundation Theme Provider
|
|
9
|
-
*
|
|
15
|
+
* Foundation Theme Provider; CSS 변수 토큰 적용 루트 provider
|
|
16
|
+
* @component
|
|
17
|
+
* @param {PropsWithChildren<FoundationThemeProviderProps>} props
|
|
18
|
+
* @param {string} [props.className] `.uds-theme-root`와 함께 병합할 루트 className
|
|
19
|
+
* @param {React.ReactNode} props.children provider 하위 렌더 노드
|
|
20
|
+
* @example
|
|
21
|
+
* <ThemeProvider><App /></ThemeProvider>
|
|
10
22
|
*/
|
|
11
23
|
function ThemeProvider({
|
|
12
24
|
children,
|
|
@@ -17,6 +29,7 @@ function ThemeProvider({
|
|
|
17
29
|
classNames.push(className);
|
|
18
30
|
}
|
|
19
31
|
|
|
32
|
+
// 변경: foundation token scope를 한 곳에서 고정한다.
|
|
20
33
|
return <div className={classNames.join(" ")}>{children}</div>;
|
|
21
34
|
}
|
|
22
35
|
|
package/src/provider/index.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -1,18 +1,60 @@
|
|
|
1
|
+
/**
|
|
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 값
|
|
7
|
+
*/
|
|
1
8
|
export interface ThemeTypographyVariant {
|
|
9
|
+
/**
|
|
10
|
+
* font-size px 값
|
|
11
|
+
*/
|
|
2
12
|
readonly size: number;
|
|
13
|
+
/**
|
|
14
|
+
* line-height 값
|
|
15
|
+
*/
|
|
3
16
|
readonly line_height: string;
|
|
17
|
+
/**
|
|
18
|
+
* letter-spacing 값
|
|
19
|
+
*/
|
|
4
20
|
readonly letter_spacing: number;
|
|
21
|
+
/**
|
|
22
|
+
* font-weight 값
|
|
23
|
+
*/
|
|
5
24
|
readonly font_weight: number;
|
|
6
25
|
}
|
|
7
26
|
|
|
27
|
+
/**
|
|
28
|
+
* ThemeColorPrimitive; primitive color token map
|
|
29
|
+
*/
|
|
8
30
|
export type ThemeColorPrimitive = Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* ThemeColorSemanticSection; semantic color nested token map
|
|
33
|
+
* @property {string | ThemeColorSemanticSection} [token] semantic color value 또는 하위 section
|
|
34
|
+
*/
|
|
9
35
|
export interface ThemeColorSemanticSection {
|
|
10
36
|
readonly [token: string]: string | ThemeColorSemanticSection;
|
|
11
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* ThemeSpacingScale; spacing scale token map
|
|
40
|
+
*/
|
|
12
41
|
export type ThemeSpacingScale = Record<string, number>;
|
|
42
|
+
/**
|
|
43
|
+
* ThemeLayoutSizes; layout size token map
|
|
44
|
+
*/
|
|
13
45
|
export type ThemeLayoutSizes = Record<string, number>;
|
|
46
|
+
/**
|
|
47
|
+
* ThemeTypographyCategory; typography category token map
|
|
48
|
+
*/
|
|
14
49
|
export type ThemeTypographyCategory = Record<string, ThemeTypographyVariant>;
|
|
15
50
|
|
|
51
|
+
/**
|
|
52
|
+
* 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
|
+
*/
|
|
16
58
|
export interface ThemeTokens {
|
|
17
59
|
readonly color: {
|
|
18
60
|
readonly primitive: ThemeColorPrimitive;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThemeFontStyle; font style 축
|
|
3
|
+
* @typedef {"normal" | "italic"} ThemeFontStyle
|
|
4
|
+
*/
|
|
1
5
|
export type ThemeFontStyle = "normal" | "italic";
|
|
2
6
|
|
|
7
|
+
/**
|
|
8
|
+
* ThemeFontDisplay; next/font display 축
|
|
9
|
+
* @typedef {"auto" | "block" | "swap" | "fallback" | "optional"} ThemeFontDisplay
|
|
10
|
+
*/
|
|
3
11
|
export type ThemeFontDisplay =
|
|
4
12
|
| "auto"
|
|
5
13
|
| "block"
|
|
@@ -7,27 +15,96 @@ export type ThemeFontDisplay =
|
|
|
7
15
|
| "fallback"
|
|
8
16
|
| "optional";
|
|
9
17
|
|
|
18
|
+
/**
|
|
19
|
+
* ThemeFontSource; font file source 정의
|
|
20
|
+
* @property {string} filename 폰트 파일명
|
|
21
|
+
* @property {string} weight font-weight 문자열
|
|
22
|
+
* @property {ThemeFontStyle} style font-style 값
|
|
23
|
+
*/
|
|
10
24
|
export interface ThemeFontSource {
|
|
25
|
+
/**
|
|
26
|
+
* 폰트 파일명
|
|
27
|
+
*/
|
|
11
28
|
filename: string;
|
|
29
|
+
/**
|
|
30
|
+
* font-weight 문자열
|
|
31
|
+
*/
|
|
12
32
|
weight: string;
|
|
33
|
+
/**
|
|
34
|
+
* font-style 값
|
|
35
|
+
*/
|
|
13
36
|
style: ThemeFontStyle;
|
|
14
37
|
}
|
|
15
38
|
|
|
39
|
+
/**
|
|
40
|
+
* ThemeFontDefinition; foundation font definition 구조
|
|
41
|
+
* @property {string} name 폰트 식별자
|
|
42
|
+
* @property {string} family CSS font-family 이름
|
|
43
|
+
* @property {string} cssVariable CSS variable 이름
|
|
44
|
+
* @property {string[]} fallbacks fallback font-family 목록
|
|
45
|
+
* @property {ThemeFontDisplay} [display] next/font display 정책
|
|
46
|
+
* @property {boolean} [preload] preload 여부
|
|
47
|
+
* @property {readonly ThemeFontSource[]} sources 폰트 소스 목록
|
|
48
|
+
*/
|
|
16
49
|
export interface ThemeFontDefinition {
|
|
50
|
+
/**
|
|
51
|
+
* 폰트 식별자
|
|
52
|
+
*/
|
|
17
53
|
name: string;
|
|
54
|
+
/**
|
|
55
|
+
* CSS font-family 이름
|
|
56
|
+
*/
|
|
18
57
|
family: string;
|
|
58
|
+
/**
|
|
59
|
+
* CSS variable 이름
|
|
60
|
+
*/
|
|
19
61
|
cssVariable: string;
|
|
62
|
+
/**
|
|
63
|
+
* fallback font-family 목록
|
|
64
|
+
*/
|
|
20
65
|
fallbacks: string[];
|
|
66
|
+
/**
|
|
67
|
+
* next/font display 정책
|
|
68
|
+
*/
|
|
21
69
|
display?: ThemeFontDisplay;
|
|
70
|
+
/**
|
|
71
|
+
* preload 여부
|
|
72
|
+
*/
|
|
22
73
|
preload?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* 폰트 소스 목록
|
|
76
|
+
*/
|
|
23
77
|
sources: readonly ThemeFontSource[];
|
|
24
78
|
}
|
|
25
79
|
|
|
80
|
+
/**
|
|
81
|
+
* NextLocalFontOptions; next/font/local 입력 옵션 구조
|
|
82
|
+
* @property {string} variable CSS variable 이름
|
|
83
|
+
* @property {ThemeFontDisplay} [display] next/font display 정책
|
|
84
|
+
* @property {string[]} fallback fallback font-family 목록
|
|
85
|
+
* @property {boolean} [preload] preload 여부
|
|
86
|
+
* @property {ReadonlyArray<{ path: string; weight: string; style: ThemeFontStyle }>} src 폰트 소스 목록
|
|
87
|
+
*/
|
|
26
88
|
export interface NextLocalFontOptions {
|
|
89
|
+
/**
|
|
90
|
+
* CSS variable 이름
|
|
91
|
+
*/
|
|
27
92
|
variable: string;
|
|
93
|
+
/**
|
|
94
|
+
* next/font display 정책
|
|
95
|
+
*/
|
|
28
96
|
display?: ThemeFontDisplay;
|
|
97
|
+
/**
|
|
98
|
+
* fallback font-family 목록
|
|
99
|
+
*/
|
|
29
100
|
fallback: string[];
|
|
101
|
+
/**
|
|
102
|
+
* preload 여부
|
|
103
|
+
*/
|
|
30
104
|
preload?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* 폰트 소스 목록
|
|
107
|
+
*/
|
|
31
108
|
src: ReadonlyArray<{
|
|
32
109
|
path: string;
|
|
33
110
|
weight: string;
|
|
@@ -35,6 +112,14 @@ export interface NextLocalFontOptions {
|
|
|
35
112
|
}>;
|
|
36
113
|
}
|
|
37
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Foundation Fonts; localFont options 변환 유틸
|
|
117
|
+
* @param {ThemeFontDefinition} font foundation font definition
|
|
118
|
+
* @param {string} metaUrl import.meta.url
|
|
119
|
+
* @returns {NextLocalFontOptions} next/font/local 옵션 객체
|
|
120
|
+
* @example
|
|
121
|
+
* createLocalFontOptions(pretendardFont, import.meta.url);
|
|
122
|
+
*/
|
|
38
123
|
export function createLocalFontOptions(
|
|
39
124
|
font: ThemeFontDefinition,
|
|
40
125
|
metaUrl: string,
|