@tide-tds/foundation 0.1.0 → 0.2.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/dist/cli.js +699 -0
- package/dist/color-css.d.ts +46 -0
- package/dist/color-css.js +105 -0
- package/dist/color-family.d.ts +54 -0
- package/dist/color-family.js +112 -0
- package/dist/color-name.d.ts +40 -0
- package/dist/color-name.js +61 -0
- package/dist/color-slot.d.ts +80 -0
- package/dist/color-slot.js +90 -0
- package/dist/color.d.ts +4 -4
- package/dist/contrast.d.ts +28 -2
- package/dist/contrast.js +40 -1
- package/dist/index.d.ts +3 -2
- package/dist/internal.d.ts +6 -3
- package/dist/internal.js +6 -3
- package/dist/semantic.d.ts +148 -246
- package/dist/semantic.js +102 -243
- package/dist/tailwind-merge.js +34 -14
- package/dist/tailwind.css +9 -0
- package/dist/tokens.css +359 -89
- package/package.json +8 -1
package/dist/contrast.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { semanticHex } from "./semantic.js";
|
|
2
|
+
|
|
1
3
|
// src/contrast.ts
|
|
2
4
|
const surfaces = [
|
|
3
5
|
"bg-canvas",
|
|
@@ -66,6 +68,43 @@ const contrastExclusions = [
|
|
|
66
68
|
reason: "modal 뒤를 가리는 반투명 막이다. 위에 글자를 두지 않는다."
|
|
67
69
|
}
|
|
68
70
|
];
|
|
71
|
+
/**
|
|
72
|
+
* 색 이름 하나의 대비 쌍 규칙.
|
|
73
|
+
* @internal `@tide-tds/foundation/internal` 전용. 앱 개발자용 공개 계약이 아니다(문서 앱·빌드 스크립트·테스트용).
|
|
74
|
+
*/
|
|
75
|
+
const colorContrastRules = [
|
|
76
|
+
...[...surfaces, ...subtleStates].map((background) => ({
|
|
77
|
+
foreground: "text",
|
|
78
|
+
background,
|
|
79
|
+
minRatio: 4.5
|
|
80
|
+
})),
|
|
81
|
+
...solidStates.map((background) => ({
|
|
82
|
+
foreground: "on-solid",
|
|
83
|
+
background,
|
|
84
|
+
minRatio: 4.5
|
|
85
|
+
})),
|
|
86
|
+
...surfaces.map((background) => ({
|
|
87
|
+
foreground: "border",
|
|
88
|
+
background,
|
|
89
|
+
minRatio: 3
|
|
90
|
+
}))
|
|
91
|
+
];
|
|
92
|
+
/**
|
|
93
|
+
* 색 이름 하나의 슬롯 hex로 대비 쌍 규칙을 light·dark에서 검사한다. 표면 층은 Tide Token 값을 쓴다.
|
|
94
|
+
* @internal `@tide-tds/foundation/internal` 전용. 앱 개발자용 공개 계약이 아니다(문서 앱·빌드 스크립트·테스트용).
|
|
95
|
+
*/
|
|
96
|
+
function checkColorContrast(slotHex) {
|
|
97
|
+
return ["light", "dark"].flatMap((theme) => colorContrastRules.map((rule) => {
|
|
98
|
+
const background = rule.background.startsWith("bg-") ? semanticHex(rule.background, theme) : slotHex[theme][rule.background];
|
|
99
|
+
const ratio = contrastRatio(slotHex[theme][rule.foreground], background);
|
|
100
|
+
return {
|
|
101
|
+
...rule,
|
|
102
|
+
theme,
|
|
103
|
+
ratio,
|
|
104
|
+
pass: ratio >= rule.minRatio
|
|
105
|
+
};
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
69
108
|
/** WCAG 2.x 상대 휘도. `#rrggbb`만 받는다. */
|
|
70
109
|
function relativeLuminance(hex) {
|
|
71
110
|
const match = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex);
|
|
@@ -87,4 +126,4 @@ function contrastRatio(foreground, background) {
|
|
|
87
126
|
return (Math.max(a, b) + .05) / (Math.min(a, b) + .05);
|
|
88
127
|
}
|
|
89
128
|
|
|
90
|
-
export { contrastExclusions, contrastPairs, contrastRatio };
|
|
129
|
+
export { checkColorContrast, colorContrastRules, contrastExclusions, contrastPairs, contrastRatio };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColorFamily, ColorStep, PrimitiveColorName, color } from "./color.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ColorSlot } from "./color-slot.js";
|
|
3
|
+
import { AlphaColor, Color, ColorFamilyName, ColorFamilyRegistry, Role, RoleRegistry, SemanticColorName, SemanticColorValue, SemanticNamespace, ThemeName, ThemedColor, TideRole, semantic, semanticPrefix } from "./semantic.js";
|
|
3
4
|
import { ContrastExclusion, ContrastPair, contrastPairs } from "./contrast.js";
|
|
4
5
|
import { FontFamilyName, FontSizeStep, FontWeightName, TextStyleName, TextStyleValue, fontFamily, fontSize, fontWeight, textStyle } from "./typography.js";
|
|
5
6
|
import { RadiusName, ShadowLayer, ShadowName, focusRing, radius, shadow } from "./shape.js";
|
|
6
7
|
import { DurationName, EasingName, duration, easing } from "./motion.js";
|
|
7
8
|
import { ZIndexName, zIndex } from "./stacking.js";
|
|
8
|
-
export { type AlphaColor, type ColorFamily, type ColorStep, type ContrastExclusion, type ContrastPair, type DurationName, type EasingName, type FontFamilyName, type FontSizeStep, type FontWeightName, type PrimitiveColorName, type RadiusName, type Role, type SemanticColorName, type SemanticColorValue, type SemanticNamespace, type ShadowLayer, type ShadowName, type TextStyleName, type TextStyleValue, type ThemeName, type ThemedColor, type ZIndexName, color, contrastPairs, duration, easing, focusRing, fontFamily, fontSize, fontWeight, radius, semantic, semanticPrefix, shadow, textStyle, zIndex };
|
|
9
|
+
export { type AlphaColor, type Color, type ColorFamily, type ColorFamilyName, type ColorFamilyRegistry, type ColorSlot, type ColorStep, type ContrastExclusion, type ContrastPair, type DurationName, type EasingName, type FontFamilyName, type FontSizeStep, type FontWeightName, type PrimitiveColorName, type RadiusName, type Role, type RoleRegistry, type SemanticColorName, type SemanticColorValue, type SemanticNamespace, type ShadowLayer, type ShadowName, type TextStyleName, type TextStyleValue, type ThemeName, type ThemedColor, type TideRole, type ZIndexName, color, contrastPairs, duration, easing, focusRing, fontFamily, fontSize, fontWeight, radius, semantic, semanticPrefix, shadow, textStyle, zIndex };
|
package/dist/internal.d.ts
CHANGED
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
7
|
import { primitiveHex } from "./color.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { BackgroundSlot, SlotOverrides, SlotRule, SlotStep, colorSlots, familyOverrides, familySlotSteps, resolveSlotSteps, slotPrimitive, slotRule } from "./color-slot.js";
|
|
9
|
+
import { colorValueHex, roleFamily, roleOverrides, roleSharedSlots, semanticEntries, semanticHex, shadowColor } from "./semantic.js";
|
|
10
|
+
import { TideColor, colorFamilyNames, colorSlotHex, colorSlotValues, isRole, roleNames, roleSlotToken, tideColorNames } from "./color-name.js";
|
|
11
|
+
import { AccentUtility, accentDefaultDeclarations, accentUtilities, accentVar, dataColorRule, familyThemeDeclarations, familyVar, primitiveVar, roleAliasCss, semanticVar, tideFamilyThemeDeclarations } from "./color-css.js";
|
|
12
|
+
import { ColorContrastResult, ColorContrastRule, checkColorContrast, colorContrastRules, contrastExclusions, contrastRatio } from "./contrast.js";
|
|
10
13
|
import { fontFamilyCss } from "./typography.js";
|
|
11
14
|
import { shadowCss } from "./shape.js";
|
|
12
|
-
export { colorValueHex, contrastExclusions, contrastRatio, fontFamilyCss, primitiveHex, roleFamily, semanticEntries, semanticHex, shadowColor, shadowCss };
|
|
15
|
+
export { type AccentUtility, type BackgroundSlot, type ColorContrastResult, type ColorContrastRule, type SlotOverrides, type SlotRule, type SlotStep, type TideColor, accentDefaultDeclarations, accentUtilities, accentVar, checkColorContrast, colorContrastRules, colorFamilyNames, colorSlotHex, colorSlotValues, colorSlots, colorValueHex, contrastExclusions, contrastRatio, dataColorRule, familyOverrides, familySlotSteps, familyThemeDeclarations, familyVar, fontFamilyCss, isRole, primitiveHex, primitiveVar, resolveSlotSteps, roleAliasCss, roleFamily, roleNames, roleOverrides, roleSharedSlots, roleSlotToken, semanticEntries, semanticHex, semanticVar, shadowColor, shadowCss, slotPrimitive, slotRule, tideColorNames, tideFamilyThemeDeclarations };
|
package/dist/internal.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { primitiveHex } from "./color.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { colorSlots, familyOverrides, familySlotSteps, resolveSlotSteps, slotPrimitive, slotRule } from "./color-slot.js";
|
|
3
|
+
import { colorValueHex, roleFamily, roleOverrides, roleSharedSlots, semanticEntries, semanticHex, shadowColor } from "./semantic.js";
|
|
4
|
+
import { colorFamilyNames, colorSlotHex, colorSlotValues, isRole, roleNames, roleSlotToken, tideColorNames } from "./color-name.js";
|
|
5
|
+
import { accentDefaultDeclarations, accentUtilities, accentVar, dataColorRule, familyThemeDeclarations, familyVar, primitiveVar, roleAliasCss, semanticVar, tideFamilyThemeDeclarations } from "./color-css.js";
|
|
6
|
+
import { checkColorContrast, colorContrastRules, contrastExclusions, contrastRatio } from "./contrast.js";
|
|
4
7
|
import { fontFamilyCss } from "./typography.js";
|
|
5
8
|
import { shadowCss } from "./shape.js";
|
|
6
9
|
|
|
7
|
-
export { colorValueHex, contrastExclusions, contrastRatio, fontFamilyCss, primitiveHex, roleFamily, semanticEntries, semanticHex, shadowColor, shadowCss };
|
|
10
|
+
export { accentDefaultDeclarations, accentUtilities, accentVar, checkColorContrast, colorContrastRules, colorFamilyNames, colorSlotHex, colorSlotValues, colorSlots, colorValueHex, contrastExclusions, contrastRatio, dataColorRule, familyOverrides, familySlotSteps, familyThemeDeclarations, familyVar, fontFamilyCss, isRole, primitiveHex, primitiveVar, resolveSlotSteps, roleAliasCss, roleFamily, roleNames, roleOverrides, roleSharedSlots, roleSlotToken, semanticEntries, semanticHex, semanticVar, shadowColor, shadowCss, slotPrimitive, slotRule, tideColorNames, tideFamilyThemeDeclarations };
|
package/dist/semantic.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PrimitiveColorName } from "./color.js";
|
|
1
|
+
import { ColorFamily, PrimitiveColorName } from "./color.js";
|
|
2
|
+
import { BackgroundSlot, ColorSlot, familyOverrides, slotRule } from "./color-slot.js";
|
|
2
3
|
/** Theme 이름 */
|
|
3
4
|
export type ThemeName = "light" | "dark";
|
|
4
5
|
/** Primitive에 투명도를 더한 색. overlay와 shadow 색에만 쓰고, CSS에는 8자리 hex로 나간다. */
|
|
@@ -16,8 +17,11 @@ export interface ThemedColor {
|
|
|
16
17
|
readonly light: SemanticColorValue;
|
|
17
18
|
readonly dark: SemanticColorValue;
|
|
18
19
|
}
|
|
19
|
-
/**
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Tide가 정한 Role 6개. 앱이 `RoleRegistry`에 더한 Role은 들어 있지 않다.
|
|
22
|
+
* Tide 안의 계산(Semantic Token 이름, 대비 쌍)은 이 타입을 쓴다. 앱 Role에는 Role Token이 생기지 않기 때문이다.
|
|
23
|
+
*/
|
|
24
|
+
export type TideRole = "neutral" | "primary" | "success" | "warning" | "danger" | "info";
|
|
21
25
|
/**
|
|
22
26
|
* Role이 참조하는 Primitive 계열.
|
|
23
27
|
* @internal `@tide-tds/foundation/internal` 전용. 앱 개발자용 공개 계약이 아니다(문서 앱·빌드 스크립트·테스트용).
|
|
@@ -30,257 +34,154 @@ export declare const roleFamily: {
|
|
|
30
34
|
readonly danger: "red";
|
|
31
35
|
readonly info: "cyan";
|
|
32
36
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
41
|
-
readonly dark: "gray-950";
|
|
42
|
-
};
|
|
43
|
-
readonly raised: {
|
|
44
|
-
readonly light: "white";
|
|
45
|
-
readonly dark: "gray-900";
|
|
46
|
-
};
|
|
47
|
-
readonly disabled: {
|
|
48
|
-
readonly light: "gray-100";
|
|
49
|
-
readonly dark: "gray-900";
|
|
50
|
-
};
|
|
51
|
-
readonly overlay: {
|
|
52
|
-
readonly light: {
|
|
53
|
-
readonly primitive: "gray-950";
|
|
54
|
-
readonly alpha: 0.5;
|
|
55
|
-
};
|
|
56
|
-
readonly dark: {
|
|
57
|
-
readonly primitive: "gray-950";
|
|
58
|
-
readonly alpha: 0.7;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
readonly "neutral-solid": {
|
|
62
|
-
readonly light: "gray-600";
|
|
63
|
-
readonly dark: "gray-600";
|
|
64
|
-
};
|
|
65
|
-
readonly "neutral-solid-hover": {
|
|
66
|
-
readonly light: "gray-700";
|
|
67
|
-
readonly dark: "gray-700";
|
|
68
|
-
};
|
|
69
|
-
readonly "neutral-solid-active": {
|
|
70
|
-
readonly light: "gray-800";
|
|
71
|
-
readonly dark: "gray-800";
|
|
72
|
-
};
|
|
73
|
-
readonly "neutral-subtle": {
|
|
74
|
-
readonly light: "gray-50";
|
|
75
|
-
readonly dark: "gray-900";
|
|
76
|
-
};
|
|
77
|
-
readonly "neutral-subtle-hover": {
|
|
78
|
-
readonly light: "gray-100";
|
|
79
|
-
readonly dark: "gray-800";
|
|
80
|
-
};
|
|
81
|
-
readonly "neutral-subtle-active": {
|
|
82
|
-
readonly light: "gray-200";
|
|
83
|
-
readonly dark: "gray-700";
|
|
84
|
-
};
|
|
85
|
-
readonly "primary-solid": {
|
|
86
|
-
readonly light: "blue-600";
|
|
87
|
-
readonly dark: "blue-600";
|
|
88
|
-
};
|
|
89
|
-
readonly "primary-solid-hover": {
|
|
90
|
-
readonly light: "blue-700";
|
|
91
|
-
readonly dark: "blue-700";
|
|
92
|
-
};
|
|
93
|
-
readonly "primary-solid-active": {
|
|
94
|
-
readonly light: "blue-800";
|
|
95
|
-
readonly dark: "blue-800";
|
|
96
|
-
};
|
|
97
|
-
readonly "primary-subtle": {
|
|
98
|
-
readonly light: "blue-50";
|
|
99
|
-
readonly dark: "blue-950";
|
|
100
|
-
};
|
|
101
|
-
readonly "primary-subtle-hover": {
|
|
102
|
-
readonly light: "blue-100";
|
|
103
|
-
readonly dark: "blue-900";
|
|
104
|
-
};
|
|
105
|
-
readonly "primary-subtle-active": {
|
|
106
|
-
readonly light: "blue-200";
|
|
107
|
-
readonly dark: "blue-800";
|
|
108
|
-
};
|
|
109
|
-
readonly "success-solid": {
|
|
110
|
-
readonly light: "green-600";
|
|
111
|
-
readonly dark: "green-600";
|
|
112
|
-
};
|
|
113
|
-
readonly "success-solid-hover": {
|
|
114
|
-
readonly light: "green-700";
|
|
115
|
-
readonly dark: "green-700";
|
|
116
|
-
};
|
|
117
|
-
readonly "success-solid-active": {
|
|
118
|
-
readonly light: "green-800";
|
|
119
|
-
readonly dark: "green-800";
|
|
120
|
-
};
|
|
121
|
-
readonly "success-subtle": {
|
|
122
|
-
readonly light: "green-50";
|
|
123
|
-
readonly dark: "green-950";
|
|
124
|
-
};
|
|
125
|
-
readonly "success-subtle-hover": {
|
|
126
|
-
readonly light: "green-100";
|
|
127
|
-
readonly dark: "green-900";
|
|
128
|
-
};
|
|
129
|
-
readonly "success-subtle-active": {
|
|
130
|
-
readonly light: "green-200";
|
|
131
|
-
readonly dark: "green-800";
|
|
132
|
-
};
|
|
133
|
-
readonly "warning-solid": {
|
|
134
|
-
readonly light: "amber-600";
|
|
135
|
-
readonly dark: "amber-600";
|
|
136
|
-
};
|
|
137
|
-
readonly "warning-solid-hover": {
|
|
138
|
-
readonly light: "amber-700";
|
|
139
|
-
readonly dark: "amber-700";
|
|
140
|
-
};
|
|
141
|
-
readonly "warning-solid-active": {
|
|
142
|
-
readonly light: "amber-800";
|
|
143
|
-
readonly dark: "amber-800";
|
|
144
|
-
};
|
|
145
|
-
readonly "warning-subtle": {
|
|
146
|
-
readonly light: "amber-50";
|
|
147
|
-
readonly dark: "amber-950";
|
|
148
|
-
};
|
|
149
|
-
readonly "warning-subtle-hover": {
|
|
150
|
-
readonly light: "amber-100";
|
|
151
|
-
readonly dark: "amber-900";
|
|
152
|
-
};
|
|
153
|
-
readonly "warning-subtle-active": {
|
|
154
|
-
readonly light: "amber-200";
|
|
155
|
-
readonly dark: "amber-800";
|
|
156
|
-
};
|
|
157
|
-
readonly "danger-solid": {
|
|
158
|
-
readonly light: "red-600";
|
|
159
|
-
readonly dark: "red-600";
|
|
160
|
-
};
|
|
161
|
-
readonly "danger-solid-hover": {
|
|
162
|
-
readonly light: "red-700";
|
|
163
|
-
readonly dark: "red-700";
|
|
164
|
-
};
|
|
165
|
-
readonly "danger-solid-active": {
|
|
166
|
-
readonly light: "red-800";
|
|
167
|
-
readonly dark: "red-800";
|
|
168
|
-
};
|
|
169
|
-
readonly "danger-subtle": {
|
|
170
|
-
readonly light: "red-50";
|
|
171
|
-
readonly dark: "red-950";
|
|
172
|
-
};
|
|
173
|
-
readonly "danger-subtle-hover": {
|
|
174
|
-
readonly light: "red-100";
|
|
175
|
-
readonly dark: "red-900";
|
|
176
|
-
};
|
|
177
|
-
readonly "danger-subtle-active": {
|
|
178
|
-
readonly light: "red-200";
|
|
179
|
-
readonly dark: "red-800";
|
|
180
|
-
};
|
|
181
|
-
readonly "info-solid": {
|
|
182
|
-
readonly light: "cyan-600";
|
|
183
|
-
readonly dark: "cyan-600";
|
|
184
|
-
};
|
|
185
|
-
readonly "info-solid-hover": {
|
|
186
|
-
readonly light: "cyan-700";
|
|
187
|
-
readonly dark: "cyan-700";
|
|
188
|
-
};
|
|
189
|
-
readonly "info-solid-active": {
|
|
190
|
-
readonly light: "cyan-800";
|
|
191
|
-
readonly dark: "cyan-800";
|
|
192
|
-
};
|
|
193
|
-
readonly "info-subtle": {
|
|
194
|
-
readonly light: "cyan-50";
|
|
195
|
-
readonly dark: "cyan-950";
|
|
37
|
+
/**
|
|
38
|
+
* Role별로 계열 규칙에서 덮어쓸 값.
|
|
39
|
+
* @internal `@tide-tds/foundation/internal` 전용. 앱 개발자용 공개 계약이 아니다(문서 앱·빌드 스크립트·테스트용).
|
|
40
|
+
*/
|
|
41
|
+
export declare const roleOverrides: {
|
|
42
|
+
readonly neutral: {
|
|
43
|
+
readonly subtle: {
|
|
44
|
+
readonly dark: 900;
|
|
196
45
|
};
|
|
197
|
-
readonly "
|
|
198
|
-
readonly
|
|
199
|
-
readonly dark: "cyan-900";
|
|
46
|
+
readonly "subtle-hover": {
|
|
47
|
+
readonly dark: 800;
|
|
200
48
|
};
|
|
201
|
-
readonly "
|
|
202
|
-
readonly
|
|
203
|
-
readonly dark: "cyan-800";
|
|
49
|
+
readonly "subtle-active": {
|
|
50
|
+
readonly dark: 700;
|
|
204
51
|
};
|
|
205
52
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
readonly disabled: {
|
|
216
|
-
readonly light: "gray-400";
|
|
217
|
-
readonly dark: "gray-600";
|
|
218
|
-
};
|
|
219
|
-
readonly "on-solid": {
|
|
220
|
-
readonly light: "white";
|
|
221
|
-
readonly dark: "white";
|
|
222
|
-
};
|
|
223
|
-
readonly primary: {
|
|
224
|
-
readonly light: "blue-800";
|
|
225
|
-
readonly dark: "blue-200";
|
|
226
|
-
};
|
|
227
|
-
readonly success: {
|
|
228
|
-
readonly light: "green-800";
|
|
229
|
-
readonly dark: "green-200";
|
|
230
|
-
};
|
|
231
|
-
readonly warning: {
|
|
232
|
-
readonly light: "amber-800";
|
|
233
|
-
readonly dark: "amber-200";
|
|
234
|
-
};
|
|
235
|
-
readonly danger: {
|
|
236
|
-
readonly light: "red-800";
|
|
237
|
-
readonly dark: "red-200";
|
|
238
|
-
};
|
|
239
|
-
readonly info: {
|
|
240
|
-
readonly light: "cyan-800";
|
|
241
|
-
readonly dark: "cyan-200";
|
|
242
|
-
};
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* 역할 Token 대신 공통 Semantic Token을 쓰는 Role 슬롯. on-solid는 모든 Role이 `text-on-solid`를 쓴다.
|
|
56
|
+
* @internal `@tide-tds/foundation/internal` 전용. 앱 개발자용 공개 계약이 아니다(문서 앱·빌드 스크립트·테스트용).
|
|
57
|
+
*/
|
|
58
|
+
export declare const roleSharedSlots: {
|
|
59
|
+
readonly neutral: {
|
|
60
|
+
readonly text: "text-default";
|
|
61
|
+
readonly border: "border-strong";
|
|
243
62
|
};
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Role 목록. Tide Role 6개가 들어 있고, 앱은 module augmentation으로 자기 Role(예: `brand`)을 더한다.
|
|
66
|
+
* 앱 Role의 색은 `@tide-tds/foundation/color-family`의 `defineColorFamily`와 `tide-color build`로 만든다.
|
|
67
|
+
*
|
|
68
|
+
* ```ts
|
|
69
|
+
* declare module "@tide-tds/components" {
|
|
70
|
+
* interface RoleRegistry {
|
|
71
|
+
* brand: true;
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export interface RoleRegistry extends Record<TideRole, true> {}
|
|
77
|
+
/**
|
|
78
|
+
* Role. 뜻이 있는 색이다. 행동·의미 Component의 `color`로 고르고, `data-color` 속성으로 accent 슬롯에 꽂는다.
|
|
79
|
+
* Tide Role 6개와 앱이 `RoleRegistry`에 더한 Role이다.
|
|
80
|
+
*/
|
|
81
|
+
export type Role = keyof RoleRegistry;
|
|
82
|
+
/**
|
|
83
|
+
* 색 계열 목록. Tide 색 계열 6개가 들어 있고, 앱은 module augmentation으로 장식용 계열을 더한다.
|
|
84
|
+
* Tide가 Primitive 계열을 더하면 이 목록도 함께 넓어진다.
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* declare module "@tide-tds/components" {
|
|
88
|
+
* interface ColorFamilyRegistry {
|
|
89
|
+
* brand: true;
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export interface ColorFamilyRegistry extends Record<ColorFamily, true> {}
|
|
95
|
+
/**
|
|
96
|
+
* 색 계열 이름. 뜻이 없는 색이라 장식·분류 Component가 쓴다.
|
|
97
|
+
* Tide 색 계열(`ColorFamily`)과 앱이 `ColorFamilyRegistry`에 더한 계열이다.
|
|
98
|
+
*/
|
|
99
|
+
export type ColorFamilyName = keyof ColorFamilyRegistry;
|
|
100
|
+
/** 색 이름(Color). `data-color` 속성이 받는 모든 이름이다(Role과 색 계열). */
|
|
101
|
+
export type Color = Role | ColorFamilyName;
|
|
102
|
+
type Lookup<Table, K1, K2, K3, Fallback> = K1 extends keyof Table ? K2 extends keyof Table[K1] ? K3 extends keyof Table[K1][K2] ? Table[K1][K2][K3] : Fallback : Fallback : Fallback;
|
|
103
|
+
type FamilyStep<Family, Slot extends ColorSlot, Theme extends ThemeName> = Lookup<typeof familyOverrides, Family, Slot, Theme, (typeof slotRule)[Slot][Theme]>;
|
|
104
|
+
type RoleStep<Name extends TideRole, Slot extends ColorSlot, Theme extends ThemeName> = Lookup<typeof roleOverrides, Name, Slot, Theme, FamilyStep<(typeof roleFamily)[Name], Slot, Theme>>;
|
|
105
|
+
type StepName<Family extends string, Step> = Step extends number ? `${Family}-${Step}` : Step;
|
|
106
|
+
type RoleSlotColor<Name extends TideRole, Slot extends ColorSlot> = {
|
|
107
|
+
readonly light: StepName<(typeof roleFamily)[Name], RoleStep<Name, Slot, "light">>;
|
|
108
|
+
readonly dark: StepName<(typeof roleFamily)[Name], RoleStep<Name, Slot, "dark">>;
|
|
109
|
+
};
|
|
110
|
+
/** 역할 text·border Token이 있는 Role(neutral 제외) */
|
|
111
|
+
type AccentRole = Exclude<TideRole, keyof typeof roleSharedSlots>;
|
|
112
|
+
type RoleBackgroundTokens = { readonly [Key in `${TideRole}-${BackgroundSlot}`]: Key extends `${infer Name extends TideRole}-${infer Slot extends BackgroundSlot}` ? RoleSlotColor<Name, Slot> : never; };
|
|
113
|
+
type RoleSlotTokens<Slot extends "text" | "border"> = { readonly [Name in AccentRole]: RoleSlotColor<Name, Slot>; };
|
|
114
|
+
declare const commonBackground: {
|
|
115
|
+
readonly canvas: {
|
|
116
|
+
readonly light: "white";
|
|
117
|
+
readonly dark: "gray-950";
|
|
118
|
+
};
|
|
119
|
+
readonly surface: {
|
|
120
|
+
readonly light: "white";
|
|
121
|
+
readonly dark: "gray-950";
|
|
122
|
+
};
|
|
123
|
+
readonly raised: {
|
|
124
|
+
readonly light: "white";
|
|
125
|
+
readonly dark: "gray-900";
|
|
126
|
+
};
|
|
127
|
+
readonly disabled: {
|
|
128
|
+
readonly light: "gray-100";
|
|
129
|
+
readonly dark: "gray-900";
|
|
130
|
+
};
|
|
131
|
+
readonly overlay: {
|
|
132
|
+
readonly light: {
|
|
133
|
+
readonly primitive: "gray-950";
|
|
134
|
+
readonly alpha: 0.5;
|
|
272
135
|
};
|
|
273
|
-
readonly
|
|
274
|
-
readonly
|
|
275
|
-
readonly
|
|
136
|
+
readonly dark: {
|
|
137
|
+
readonly primitive: "gray-950";
|
|
138
|
+
readonly alpha: 0.7;
|
|
276
139
|
};
|
|
277
140
|
};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
141
|
+
};
|
|
142
|
+
declare const commonText: {
|
|
143
|
+
readonly default: {
|
|
144
|
+
readonly light: "gray-900";
|
|
145
|
+
readonly dark: "gray-50";
|
|
283
146
|
};
|
|
147
|
+
readonly muted: {
|
|
148
|
+
readonly light: "gray-600";
|
|
149
|
+
readonly dark: "gray-300";
|
|
150
|
+
};
|
|
151
|
+
readonly disabled: {
|
|
152
|
+
readonly light: "gray-400";
|
|
153
|
+
readonly dark: "gray-600";
|
|
154
|
+
};
|
|
155
|
+
readonly "on-solid": {
|
|
156
|
+
readonly light: "white";
|
|
157
|
+
readonly dark: "white";
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
declare const commonBorder: {
|
|
161
|
+
readonly default: {
|
|
162
|
+
readonly light: "gray-200";
|
|
163
|
+
readonly dark: "gray-800";
|
|
164
|
+
};
|
|
165
|
+
readonly strong: {
|
|
166
|
+
readonly light: "gray-500";
|
|
167
|
+
readonly dark: "gray-400";
|
|
168
|
+
};
|
|
169
|
+
readonly raised: {
|
|
170
|
+
readonly light: "transparent";
|
|
171
|
+
readonly dark: "gray-800";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
declare const commonOutline: {
|
|
175
|
+
readonly focus: {
|
|
176
|
+
readonly light: "blue-600";
|
|
177
|
+
readonly dark: "blue-400";
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export declare const semantic: {
|
|
181
|
+
readonly background: typeof commonBackground & RoleBackgroundTokens;
|
|
182
|
+
readonly text: typeof commonText & RoleSlotTokens<"text">;
|
|
183
|
+
readonly border: typeof commonBorder & RoleSlotTokens<"border">;
|
|
184
|
+
readonly outline: typeof commonOutline;
|
|
284
185
|
};
|
|
285
186
|
/** Semantic namespace와 Utility class 접두사 */
|
|
286
187
|
export type SemanticNamespace = "background" | "text" | "border" | "outline";
|
|
@@ -325,4 +226,5 @@ export declare function colorValueHex(value: SemanticColorValue): string;
|
|
|
325
226
|
* Semantic Token이 Theme에서 가리키는 hex.
|
|
326
227
|
* @internal `@tide-tds/foundation/internal` 전용. 앱 개발자용 공개 계약이 아니다(문서 앱·빌드 스크립트·테스트용).
|
|
327
228
|
*/
|
|
328
|
-
export declare function semanticHex(name: SemanticColorName, theme: ThemeName): string;
|
|
229
|
+
export declare function semanticHex(name: SemanticColorName, theme: ThemeName): string;
|
|
230
|
+
export {};
|