@charcoal-ui/tailwind-config 5.6.0 → 5.7.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/index.d.mts +1 -216
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +1 -216
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,221 +1,6 @@
|
|
|
1
|
+
import { CharcoalTheme } from "@charcoal-ui/theme";
|
|
1
2
|
import { Config } from "tailwindcss";
|
|
2
3
|
|
|
3
|
-
//#region ../foundation/src/typography.d.ts
|
|
4
|
-
interface TypographyDescriptor {
|
|
5
|
-
readonly lineHeight: number;
|
|
6
|
-
readonly fontSize: number;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region ../foundation/src/spacing.d.ts
|
|
10
|
-
declare const SPACING: {
|
|
11
|
-
readonly 0: 0;
|
|
12
|
-
readonly 4: 4;
|
|
13
|
-
readonly 8: 8;
|
|
14
|
-
readonly 16: 16;
|
|
15
|
-
readonly 24: 24;
|
|
16
|
-
readonly 40: 40;
|
|
17
|
-
readonly 64: 64;
|
|
18
|
-
readonly 104: 104;
|
|
19
|
-
readonly 168: 168;
|
|
20
|
-
readonly 272: 272;
|
|
21
|
-
readonly 440: 440;
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region ../foundation/src/border-radius.d.ts
|
|
25
|
-
declare const BORDER_RADIUS: {
|
|
26
|
-
/**
|
|
27
|
-
* 用途: 打ち消し用(モバイルのときに角丸じゃなくなる、などを表現する)
|
|
28
|
-
*/
|
|
29
|
-
readonly none: 0;
|
|
30
|
-
/**
|
|
31
|
-
* 用途: バッジ, 高さ40px以下の要素
|
|
32
|
-
*/
|
|
33
|
-
readonly 4: 4;
|
|
34
|
-
/**
|
|
35
|
-
* 用途: サムネイル
|
|
36
|
-
*/
|
|
37
|
-
readonly 8: 8;
|
|
38
|
-
/**
|
|
39
|
-
* 用途: チュートリアルツールチップ
|
|
40
|
-
*/
|
|
41
|
-
readonly 16: 16;
|
|
42
|
-
/**
|
|
43
|
-
* 用途: モーダル
|
|
44
|
-
*/
|
|
45
|
-
readonly 24: 24;
|
|
46
|
-
/**
|
|
47
|
-
* 真円 or 左右が丸まっている矩形 を作る時に用いる
|
|
48
|
-
*
|
|
49
|
-
* 用途: ボタン
|
|
50
|
-
*/
|
|
51
|
-
readonly oval: 999999;
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region ../foundation/src/color.d.ts
|
|
55
|
-
type Material = string;
|
|
56
|
-
type GradientMaterial = readonly {
|
|
57
|
-
readonly color: Material;
|
|
58
|
-
readonly ratio: number;
|
|
59
|
-
}[];
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region ../foundation/src/effect.d.ts
|
|
62
|
-
type Effect = AlphaEffect | OpacityEffect | ReplaceEffect;
|
|
63
|
-
interface BaseEffect {}
|
|
64
|
-
interface AlphaEffect extends BaseEffect {
|
|
65
|
-
readonly type: "alpha";
|
|
66
|
-
/**
|
|
67
|
-
* Color to blend with the base color using alpha blending.
|
|
68
|
-
*/
|
|
69
|
-
readonly color: string;
|
|
70
|
-
/**
|
|
71
|
-
* Multiplied with the alpha value of the effect's `color` before blending.
|
|
72
|
-
*
|
|
73
|
-
* `1` by default.
|
|
74
|
-
*/
|
|
75
|
-
readonly opacity?: number;
|
|
76
|
-
}
|
|
77
|
-
interface OpacityEffect extends BaseEffect {
|
|
78
|
-
readonly type: "opacity";
|
|
79
|
-
/**
|
|
80
|
-
* Value to multiply with the current color's alpha value.
|
|
81
|
-
*/
|
|
82
|
-
readonly opacity: number;
|
|
83
|
-
}
|
|
84
|
-
interface ReplaceEffect extends BaseEffect {
|
|
85
|
-
readonly type: "replace";
|
|
86
|
-
/**
|
|
87
|
-
* Replaces any given color with this color
|
|
88
|
-
*/
|
|
89
|
-
readonly color?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Replaces the alpha value with this opacity.
|
|
92
|
-
*
|
|
93
|
-
* Overrides the `color`'s opacity as well.
|
|
94
|
-
*/
|
|
95
|
-
readonly opacity?: number;
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region ../theme/src/abstract-theme.d.ts
|
|
99
|
-
type EffectType = "hover" | "press" | "disabled";
|
|
100
|
-
type Key = string | number | symbol;
|
|
101
|
-
type ColorStyleTheme = { [key in Key]: Material };
|
|
102
|
-
interface CharcoalAbstractTheme {
|
|
103
|
-
color: ColorStyleTheme;
|
|
104
|
-
gradientColor: { [key in Key]: GradientMaterial };
|
|
105
|
-
effect: { [key in EffectType]?: Effect };
|
|
106
|
-
elementEffect: { [key in EffectType]?: OpacityEffect };
|
|
107
|
-
spacing: { [key in Key]: number };
|
|
108
|
-
typography: {
|
|
109
|
-
size: { [key in Key]: TypographyDescriptor };
|
|
110
|
-
};
|
|
111
|
-
borderRadius: { [key in Key]: number };
|
|
112
|
-
border: { [key in Key]: {
|
|
113
|
-
color: Material;
|
|
114
|
-
} };
|
|
115
|
-
outline: { [key in Key]: {
|
|
116
|
-
color: Material;
|
|
117
|
-
weight: number;
|
|
118
|
-
} };
|
|
119
|
-
grid: {
|
|
120
|
-
unit: {
|
|
121
|
-
column: number;
|
|
122
|
-
gutter: number;
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
transition: { [key in Key]: {
|
|
126
|
-
duration: number;
|
|
127
|
-
} };
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region ../theme/src/theme.d.ts
|
|
131
|
-
interface CharcoalTheme extends CharcoalAbstractTheme {
|
|
132
|
-
readonly color: ThemeColor;
|
|
133
|
-
readonly gradientColor: ThemeColorGradient;
|
|
134
|
-
/**
|
|
135
|
-
* effect for color (background or font color)
|
|
136
|
-
*/
|
|
137
|
-
readonly effect: ThemeEffect;
|
|
138
|
-
/**
|
|
139
|
-
* effect for element its own (opacify element includes descendants)
|
|
140
|
-
*/
|
|
141
|
-
readonly elementEffect: ThemeElementEffect;
|
|
142
|
-
readonly spacing: Spacing;
|
|
143
|
-
readonly typography: {
|
|
144
|
-
readonly size: Typography;
|
|
145
|
-
};
|
|
146
|
-
readonly borderRadius: BorderRadius;
|
|
147
|
-
readonly border: {
|
|
148
|
-
readonly default: {
|
|
149
|
-
readonly color: Material;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
readonly outline: {
|
|
153
|
-
readonly default: {
|
|
154
|
-
readonly color: string;
|
|
155
|
-
readonly weight: 4;
|
|
156
|
-
};
|
|
157
|
-
readonly assertive: {
|
|
158
|
-
readonly color: string;
|
|
159
|
-
readonly weight: 4;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
readonly breakpoint: Breakpoint;
|
|
163
|
-
}
|
|
164
|
-
type ThemeColor = {
|
|
165
|
-
readonly transparent: Material;
|
|
166
|
-
readonly background1: Material;
|
|
167
|
-
readonly background2: Material;
|
|
168
|
-
readonly surface1: Material;
|
|
169
|
-
readonly surface2: Material;
|
|
170
|
-
readonly surface3: Material;
|
|
171
|
-
readonly surface4: Material;
|
|
172
|
-
readonly surface6: Material;
|
|
173
|
-
readonly surface7: Material;
|
|
174
|
-
readonly surface8: Material;
|
|
175
|
-
readonly surface9: Material;
|
|
176
|
-
readonly surface10: Material;
|
|
177
|
-
readonly link1: Material;
|
|
178
|
-
readonly link2: Material;
|
|
179
|
-
readonly text1: Material;
|
|
180
|
-
readonly text2: Material;
|
|
181
|
-
readonly text3: Material;
|
|
182
|
-
readonly text4: Material;
|
|
183
|
-
readonly text5: Material;
|
|
184
|
-
readonly icon6: Material;
|
|
185
|
-
readonly brand: Material;
|
|
186
|
-
readonly assertive: Material;
|
|
187
|
-
readonly warning: Material;
|
|
188
|
-
readonly success: Material;
|
|
189
|
-
readonly updatedItem: Material;
|
|
190
|
-
readonly border: Material;
|
|
191
|
-
};
|
|
192
|
-
type ThemeEffect = {
|
|
193
|
-
readonly hover: Effect;
|
|
194
|
-
readonly press: Effect;
|
|
195
|
-
};
|
|
196
|
-
type ThemeElementEffect = {
|
|
197
|
-
readonly disabled: OpacityEffect;
|
|
198
|
-
};
|
|
199
|
-
type ThemeColorGradient = {
|
|
200
|
-
readonly surface5: GradientMaterial;
|
|
201
|
-
readonly callToAction: GradientMaterial;
|
|
202
|
-
};
|
|
203
|
-
type Typography = {
|
|
204
|
-
readonly [12]: TypographyDescriptor;
|
|
205
|
-
readonly [14]: TypographyDescriptor;
|
|
206
|
-
readonly [16]: TypographyDescriptor;
|
|
207
|
-
readonly [20]: TypographyDescriptor;
|
|
208
|
-
readonly [32]: TypographyDescriptor;
|
|
209
|
-
};
|
|
210
|
-
type Breakpoint = {
|
|
211
|
-
readonly screen1: number;
|
|
212
|
-
readonly screen2: number;
|
|
213
|
-
readonly screen3: number;
|
|
214
|
-
readonly screen4: number;
|
|
215
|
-
};
|
|
216
|
-
type Spacing = Readonly<Record<keyof typeof SPACING, number>>;
|
|
217
|
-
type BorderRadius = Readonly<Record<keyof typeof BORDER_RADIUS, number>>;
|
|
218
|
-
//#endregion
|
|
219
4
|
//#region src/types.d.ts
|
|
220
5
|
type TailwindVersion = "v1" | "v2" | "v3";
|
|
221
6
|
interface ThemeMap {
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/tokenV2.ts","../src/index.ts"],"mappings":";;;;KAGY,eAAA;AAAA,UAEK,QAAA;EACf,OAAA,EAAS,aAAA;EAAA,oCAC2B,aAAA;EAAA,oBAChB,aAAA;AAAA;;;iBCAN,oCAAA,CAAA,GAAwC,IAAA,CACtD,MAAA;;;UCkBQ,OAAA;EACR,OAAA,GAAU,eAAA;EACV,KAAA,GAAQ,QAAA;EACR,cAAA;EACA,eAAA;EACA,OAAA;EACA,OAAA;AAAA;AAAA,iBAGc,oBAAA,CAAA;EACd,KAAA;EACA,OAAA;EACA,cAAA;EACA,eAAA;EACA,OAAA;EACA;AAAA,GACC,OAAA,GAAU,IAAA,CAAK,MAAA;AAAA,cAqIL,MAAA,EAAQ,IAAA,CAAK,MAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,221 +1,6 @@
|
|
|
1
1
|
import { Config } from "tailwindcss";
|
|
2
|
+
import { CharcoalTheme } from "@charcoal-ui/theme";
|
|
2
3
|
|
|
3
|
-
//#region ../foundation/src/typography.d.ts
|
|
4
|
-
interface TypographyDescriptor {
|
|
5
|
-
readonly lineHeight: number;
|
|
6
|
-
readonly fontSize: number;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region ../foundation/src/spacing.d.ts
|
|
10
|
-
declare const SPACING: {
|
|
11
|
-
readonly 0: 0;
|
|
12
|
-
readonly 4: 4;
|
|
13
|
-
readonly 8: 8;
|
|
14
|
-
readonly 16: 16;
|
|
15
|
-
readonly 24: 24;
|
|
16
|
-
readonly 40: 40;
|
|
17
|
-
readonly 64: 64;
|
|
18
|
-
readonly 104: 104;
|
|
19
|
-
readonly 168: 168;
|
|
20
|
-
readonly 272: 272;
|
|
21
|
-
readonly 440: 440;
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region ../foundation/src/border-radius.d.ts
|
|
25
|
-
declare const BORDER_RADIUS: {
|
|
26
|
-
/**
|
|
27
|
-
* 用途: 打ち消し用(モバイルのときに角丸じゃなくなる、などを表現する)
|
|
28
|
-
*/
|
|
29
|
-
readonly none: 0;
|
|
30
|
-
/**
|
|
31
|
-
* 用途: バッジ, 高さ40px以下の要素
|
|
32
|
-
*/
|
|
33
|
-
readonly 4: 4;
|
|
34
|
-
/**
|
|
35
|
-
* 用途: サムネイル
|
|
36
|
-
*/
|
|
37
|
-
readonly 8: 8;
|
|
38
|
-
/**
|
|
39
|
-
* 用途: チュートリアルツールチップ
|
|
40
|
-
*/
|
|
41
|
-
readonly 16: 16;
|
|
42
|
-
/**
|
|
43
|
-
* 用途: モーダル
|
|
44
|
-
*/
|
|
45
|
-
readonly 24: 24;
|
|
46
|
-
/**
|
|
47
|
-
* 真円 or 左右が丸まっている矩形 を作る時に用いる
|
|
48
|
-
*
|
|
49
|
-
* 用途: ボタン
|
|
50
|
-
*/
|
|
51
|
-
readonly oval: 999999;
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region ../foundation/src/color.d.ts
|
|
55
|
-
type Material = string;
|
|
56
|
-
type GradientMaterial = readonly {
|
|
57
|
-
readonly color: Material;
|
|
58
|
-
readonly ratio: number;
|
|
59
|
-
}[];
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region ../foundation/src/effect.d.ts
|
|
62
|
-
type Effect = AlphaEffect | OpacityEffect | ReplaceEffect;
|
|
63
|
-
interface BaseEffect {}
|
|
64
|
-
interface AlphaEffect extends BaseEffect {
|
|
65
|
-
readonly type: "alpha";
|
|
66
|
-
/**
|
|
67
|
-
* Color to blend with the base color using alpha blending.
|
|
68
|
-
*/
|
|
69
|
-
readonly color: string;
|
|
70
|
-
/**
|
|
71
|
-
* Multiplied with the alpha value of the effect's `color` before blending.
|
|
72
|
-
*
|
|
73
|
-
* `1` by default.
|
|
74
|
-
*/
|
|
75
|
-
readonly opacity?: number;
|
|
76
|
-
}
|
|
77
|
-
interface OpacityEffect extends BaseEffect {
|
|
78
|
-
readonly type: "opacity";
|
|
79
|
-
/**
|
|
80
|
-
* Value to multiply with the current color's alpha value.
|
|
81
|
-
*/
|
|
82
|
-
readonly opacity: number;
|
|
83
|
-
}
|
|
84
|
-
interface ReplaceEffect extends BaseEffect {
|
|
85
|
-
readonly type: "replace";
|
|
86
|
-
/**
|
|
87
|
-
* Replaces any given color with this color
|
|
88
|
-
*/
|
|
89
|
-
readonly color?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Replaces the alpha value with this opacity.
|
|
92
|
-
*
|
|
93
|
-
* Overrides the `color`'s opacity as well.
|
|
94
|
-
*/
|
|
95
|
-
readonly opacity?: number;
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region ../theme/src/abstract-theme.d.ts
|
|
99
|
-
type EffectType = "hover" | "press" | "disabled";
|
|
100
|
-
type Key = string | number | symbol;
|
|
101
|
-
type ColorStyleTheme = { [key in Key]: Material };
|
|
102
|
-
interface CharcoalAbstractTheme {
|
|
103
|
-
color: ColorStyleTheme;
|
|
104
|
-
gradientColor: { [key in Key]: GradientMaterial };
|
|
105
|
-
effect: { [key in EffectType]?: Effect };
|
|
106
|
-
elementEffect: { [key in EffectType]?: OpacityEffect };
|
|
107
|
-
spacing: { [key in Key]: number };
|
|
108
|
-
typography: {
|
|
109
|
-
size: { [key in Key]: TypographyDescriptor };
|
|
110
|
-
};
|
|
111
|
-
borderRadius: { [key in Key]: number };
|
|
112
|
-
border: { [key in Key]: {
|
|
113
|
-
color: Material;
|
|
114
|
-
} };
|
|
115
|
-
outline: { [key in Key]: {
|
|
116
|
-
color: Material;
|
|
117
|
-
weight: number;
|
|
118
|
-
} };
|
|
119
|
-
grid: {
|
|
120
|
-
unit: {
|
|
121
|
-
column: number;
|
|
122
|
-
gutter: number;
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
transition: { [key in Key]: {
|
|
126
|
-
duration: number;
|
|
127
|
-
} };
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region ../theme/src/theme.d.ts
|
|
131
|
-
interface CharcoalTheme extends CharcoalAbstractTheme {
|
|
132
|
-
readonly color: ThemeColor;
|
|
133
|
-
readonly gradientColor: ThemeColorGradient;
|
|
134
|
-
/**
|
|
135
|
-
* effect for color (background or font color)
|
|
136
|
-
*/
|
|
137
|
-
readonly effect: ThemeEffect;
|
|
138
|
-
/**
|
|
139
|
-
* effect for element its own (opacify element includes descendants)
|
|
140
|
-
*/
|
|
141
|
-
readonly elementEffect: ThemeElementEffect;
|
|
142
|
-
readonly spacing: Spacing;
|
|
143
|
-
readonly typography: {
|
|
144
|
-
readonly size: Typography;
|
|
145
|
-
};
|
|
146
|
-
readonly borderRadius: BorderRadius;
|
|
147
|
-
readonly border: {
|
|
148
|
-
readonly default: {
|
|
149
|
-
readonly color: Material;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
readonly outline: {
|
|
153
|
-
readonly default: {
|
|
154
|
-
readonly color: string;
|
|
155
|
-
readonly weight: 4;
|
|
156
|
-
};
|
|
157
|
-
readonly assertive: {
|
|
158
|
-
readonly color: string;
|
|
159
|
-
readonly weight: 4;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
readonly breakpoint: Breakpoint;
|
|
163
|
-
}
|
|
164
|
-
type ThemeColor = {
|
|
165
|
-
readonly transparent: Material;
|
|
166
|
-
readonly background1: Material;
|
|
167
|
-
readonly background2: Material;
|
|
168
|
-
readonly surface1: Material;
|
|
169
|
-
readonly surface2: Material;
|
|
170
|
-
readonly surface3: Material;
|
|
171
|
-
readonly surface4: Material;
|
|
172
|
-
readonly surface6: Material;
|
|
173
|
-
readonly surface7: Material;
|
|
174
|
-
readonly surface8: Material;
|
|
175
|
-
readonly surface9: Material;
|
|
176
|
-
readonly surface10: Material;
|
|
177
|
-
readonly link1: Material;
|
|
178
|
-
readonly link2: Material;
|
|
179
|
-
readonly text1: Material;
|
|
180
|
-
readonly text2: Material;
|
|
181
|
-
readonly text3: Material;
|
|
182
|
-
readonly text4: Material;
|
|
183
|
-
readonly text5: Material;
|
|
184
|
-
readonly icon6: Material;
|
|
185
|
-
readonly brand: Material;
|
|
186
|
-
readonly assertive: Material;
|
|
187
|
-
readonly warning: Material;
|
|
188
|
-
readonly success: Material;
|
|
189
|
-
readonly updatedItem: Material;
|
|
190
|
-
readonly border: Material;
|
|
191
|
-
};
|
|
192
|
-
type ThemeEffect = {
|
|
193
|
-
readonly hover: Effect;
|
|
194
|
-
readonly press: Effect;
|
|
195
|
-
};
|
|
196
|
-
type ThemeElementEffect = {
|
|
197
|
-
readonly disabled: OpacityEffect;
|
|
198
|
-
};
|
|
199
|
-
type ThemeColorGradient = {
|
|
200
|
-
readonly surface5: GradientMaterial;
|
|
201
|
-
readonly callToAction: GradientMaterial;
|
|
202
|
-
};
|
|
203
|
-
type Typography = {
|
|
204
|
-
readonly [12]: TypographyDescriptor;
|
|
205
|
-
readonly [14]: TypographyDescriptor;
|
|
206
|
-
readonly [16]: TypographyDescriptor;
|
|
207
|
-
readonly [20]: TypographyDescriptor;
|
|
208
|
-
readonly [32]: TypographyDescriptor;
|
|
209
|
-
};
|
|
210
|
-
type Breakpoint = {
|
|
211
|
-
readonly screen1: number;
|
|
212
|
-
readonly screen2: number;
|
|
213
|
-
readonly screen3: number;
|
|
214
|
-
readonly screen4: number;
|
|
215
|
-
};
|
|
216
|
-
type Spacing = Readonly<Record<keyof typeof SPACING, number>>;
|
|
217
|
-
type BorderRadius = Readonly<Record<keyof typeof BORDER_RADIUS, number>>;
|
|
218
|
-
//#endregion
|
|
219
4
|
//#region src/types.d.ts
|
|
220
5
|
type TailwindVersion = "v1" | "v2" | "v3";
|
|
221
6
|
interface ThemeMap {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/tokenV2.ts","../src/index.ts"],"mappings":";;;;KAGY,eAAA;AAAA,UAEK,QAAA;EACf,OAAA,EAAS,aAAA;EAAA,oCAC2B,aAAA;EAAA,oBAChB,aAAA;AAAA;;;iBCAN,oCAAA,CAAA,GAAwC,IAAA,CACtD,MAAA;;;UCkBQ,OAAA;EACR,OAAA,GAAU,eAAA;EACV,KAAA,GAAQ,QAAA;EACR,cAAA;EACA,eAAA;EACA,OAAA;EACA,OAAA;AAAA;AAAA,iBAGc,oBAAA,CAAA;EACd,KAAA;EACA,OAAA;EACA,cAAA;EACA,eAAA;EACA,OAAA;EACA;AAAA,GACC,OAAA,GAAU,IAAA,CAAK,MAAA;AAAA,cAqIL,MAAA,EAAQ,IAAA,CAAK,MAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
//#region
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -7,12 +7,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
return to;
|
|
18
22
|
};
|
|
@@ -22,20 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
26
|
}) : target, mod));
|
|
23
27
|
|
|
24
28
|
//#endregion
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
let
|
|
28
|
-
__charcoal_ui_theme = __toESM(__charcoal_ui_theme);
|
|
29
|
-
let __charcoal_ui_utils = require("@charcoal-ui/utils");
|
|
30
|
-
__charcoal_ui_utils = __toESM(__charcoal_ui_utils);
|
|
29
|
+
let _charcoal_ui_foundation = require("@charcoal-ui/foundation");
|
|
30
|
+
let _charcoal_ui_theme = require("@charcoal-ui/theme");
|
|
31
|
+
let _charcoal_ui_utils = require("@charcoal-ui/utils");
|
|
31
32
|
let tailwindcss_plugin_js = require("tailwindcss/plugin.js");
|
|
32
33
|
tailwindcss_plugin_js = __toESM(tailwindcss_plugin_js);
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
|
|
34
|
+
let _charcoal_ui_theme_unstable_tokens_css_variables_json = require("@charcoal-ui/theme/unstable-tokens/css-variables.json");
|
|
35
|
+
_charcoal_ui_theme_unstable_tokens_css_variables_json = __toESM(_charcoal_ui_theme_unstable_tokens_css_variables_json);
|
|
36
|
+
let _charcoal_ui_icon_files_v2_datauri = require("@charcoal-ui/icon-files/v2/datauri");
|
|
37
|
+
_charcoal_ui_icon_files_v2_datauri = __toESM(_charcoal_ui_icon_files_v2_datauri);
|
|
38
|
+
let _charcoal_ui_icon_files_v1_datauri = require("@charcoal-ui/icon-files/v1/datauri");
|
|
39
|
+
_charcoal_ui_icon_files_v1_datauri = __toESM(_charcoal_ui_icon_files_v1_datauri);
|
|
39
40
|
|
|
40
41
|
//#region src/foundation.ts
|
|
41
42
|
const GRID_COUNT = 12;
|
|
@@ -134,7 +135,7 @@ function isSingleColor(color) {
|
|
|
134
135
|
//#endregion
|
|
135
136
|
//#region src/colors/toTailwindConfig.ts
|
|
136
137
|
function colorsToTailwindConfig(version, colors, effects) {
|
|
137
|
-
const targetColors = (0,
|
|
138
|
+
const targetColors = (0, _charcoal_ui_utils.filterObject)(colors, isSingleColor);
|
|
138
139
|
const DEFAULT = getDefaultKeyName(version);
|
|
139
140
|
/**
|
|
140
141
|
* こういう感じのを吐き出す
|
|
@@ -152,22 +153,22 @@ function colorsToTailwindConfig(version, colors, effects) {
|
|
|
152
153
|
const varName = `${COLOR_PREFIX}${name}`;
|
|
153
154
|
return {
|
|
154
155
|
[DEFAULT]: `var(${varName}, ${color})`,
|
|
155
|
-
...(0,
|
|
156
|
+
...(0, _charcoal_ui_utils.mapObject)(effects, (effectName, effect) => [effectName, `var(${varName}--${effectName}, ${(0, _charcoal_ui_utils.applyEffect)(color, effect)})`])
|
|
156
157
|
};
|
|
157
158
|
}
|
|
158
|
-
return (0,
|
|
159
|
+
return (0, _charcoal_ui_utils.mapObject)(targetColors, (name, color) => [name, colorsForAllEffects(name, color)]);
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
//#endregion
|
|
162
163
|
//#region src/colors/pluginTokenV1.ts
|
|
163
164
|
function defineCssVariablesV1(themeMap) {
|
|
164
|
-
return (0,
|
|
165
|
+
return (0, _charcoal_ui_utils.mapObject)(themeMap, (key, theme) => {
|
|
165
166
|
if (key.startsWith("@media")) return [key, { ":root": defineColorVariableCSS(theme) }];
|
|
166
167
|
else return [key, defineColorVariableCSS(theme)];
|
|
167
168
|
});
|
|
168
169
|
}
|
|
169
170
|
const defineColorVariableCSS = (theme) => {
|
|
170
|
-
const borders = (0,
|
|
171
|
+
const borders = (0, _charcoal_ui_utils.mapObject)(theme.border, (name, { color }) => [withPrefixes("border", name), color]);
|
|
171
172
|
return defineThemeVariables({
|
|
172
173
|
...theme.color,
|
|
173
174
|
...borders
|
|
@@ -196,12 +197,12 @@ const isPresent = (value) => value != null;
|
|
|
196
197
|
*/
|
|
197
198
|
function defineThemeVariables(colorParams, effectParams) {
|
|
198
199
|
return function toCssObject(props) {
|
|
199
|
-
const colors = (0,
|
|
200
|
+
const colors = (0, _charcoal_ui_utils.filterObject)(colorParams, isPresent);
|
|
200
201
|
const effects = Object.entries({
|
|
201
202
|
...props.theme.effect,
|
|
202
203
|
...effectParams
|
|
203
204
|
});
|
|
204
|
-
return (0,
|
|
205
|
+
return (0, _charcoal_ui_utils.flatMapObject)(colors, (colorKey, color) => [[(0, _charcoal_ui_utils.customPropertyToken)(colorKey), color], ...effects.map(([effectKey, effect]) => [(0, _charcoal_ui_utils.customPropertyToken)(colorKey, [effectKey]), (0, _charcoal_ui_utils.applyEffect)(color, [effect])])]);
|
|
205
206
|
};
|
|
206
207
|
}
|
|
207
208
|
function withPrefixes(...parts) {
|
|
@@ -214,8 +215,8 @@ function withPrefixes(...parts) {
|
|
|
214
215
|
* --tailwind-* また --charcoal-* を生成する
|
|
215
216
|
* TODO: --tailwindをやめる
|
|
216
217
|
*/
|
|
217
|
-
function cssVariableColorPlugin(themeMap, cssVariablesV1) {
|
|
218
|
-
const { ":root": _defaultTheme
|
|
218
|
+
function cssVariableColorPlugin$1(themeMap, cssVariablesV1) {
|
|
219
|
+
const { ":root": _defaultTheme, ...otherThemes } = themeMap;
|
|
219
220
|
const definitions = defineCssVariables(otherThemes);
|
|
220
221
|
return (0, tailwindcss_plugin_js.default)(({ addBase }) => {
|
|
221
222
|
addBase(definitions);
|
|
@@ -223,29 +224,29 @@ function cssVariableColorPlugin(themeMap, cssVariablesV1) {
|
|
|
223
224
|
});
|
|
224
225
|
}
|
|
225
226
|
function defineCssVariables(themes) {
|
|
226
|
-
return (0,
|
|
227
|
+
return (0, _charcoal_ui_utils.mapObject)(themes, (selectorOrMediaQuery, theme) => {
|
|
227
228
|
const css = toCssVariables(theme);
|
|
228
229
|
if (selectorOrMediaQuery.startsWith("@media")) return [selectorOrMediaQuery, { ":root": css }];
|
|
229
230
|
else return [selectorOrMediaQuery, css];
|
|
230
231
|
});
|
|
231
232
|
}
|
|
232
233
|
function toCssVariables(theme) {
|
|
233
|
-
const colors = (0,
|
|
234
|
+
const colors = (0, _charcoal_ui_utils.filterObject)(theme.color, isSingleColor);
|
|
234
235
|
const effects = Object.entries(mergeEffect(theme));
|
|
235
|
-
return (0,
|
|
236
|
+
return (0, _charcoal_ui_utils.flatMapObject)(colors, (name, color) => {
|
|
236
237
|
const varName = `${COLOR_PREFIX}${name}`;
|
|
237
|
-
return [[varName, color], ...effects.map(([type, effect]) => [`${varName}--${type}`, (0,
|
|
238
|
+
return [[varName, color], ...effects.map(([type, effect]) => [`${varName}--${type}`, (0, _charcoal_ui_utils.applyEffect)(color, effect)])];
|
|
238
239
|
});
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
//#endregion
|
|
242
243
|
//#region src/gradient/plugin.ts
|
|
243
244
|
const VAR_PREFIX = "--tailwind-gradient-";
|
|
244
|
-
function cssVariableColorPlugin
|
|
245
|
+
function cssVariableColorPlugin(gradients, effects, selectorOrMediaQuery) {
|
|
245
246
|
const utilities = getUtilities(gradients, effects);
|
|
246
|
-
const classRules = (0,
|
|
247
|
+
const classRules = (0, _charcoal_ui_utils.mapObject)(utilities, (name) => [`.bg-${name}`, { backgroundImage: `var(${VAR_PREFIX}${name})` }]);
|
|
247
248
|
return (0, tailwindcss_plugin_js.default)(({ addBase, addUtilities }) => {
|
|
248
|
-
const css = (0,
|
|
249
|
+
const css = (0, _charcoal_ui_utils.mapKeys)(utilities, (name) => `${VAR_PREFIX}${name}`);
|
|
249
250
|
if (selectorOrMediaQuery.startsWith("@media")) addBase({ [selectorOrMediaQuery]: { ":root": css } });
|
|
250
251
|
else addBase({ [selectorOrMediaQuery]: css });
|
|
251
252
|
addUtilities(classRules, { variants: ["responsive"] });
|
|
@@ -260,13 +261,13 @@ const DIRECTIONS = {
|
|
|
260
261
|
function getUtilities(gradients, effect) {
|
|
261
262
|
const effects = Object.entries(effect);
|
|
262
263
|
const directions = Object.entries(DIRECTIONS);
|
|
263
|
-
return (0,
|
|
264
|
-
const toLinearGradient = (colors
|
|
265
|
-
const style = (0,
|
|
264
|
+
return (0, _charcoal_ui_utils.flatMapObject)(gradients, (name, colors) => directions.flatMap(([direction, className]) => {
|
|
265
|
+
const toLinearGradient = (colors) => {
|
|
266
|
+
const style = (0, _charcoal_ui_utils.gradient)(direction)(colors);
|
|
266
267
|
if (!("backgroundImage" in style)) throw new Error(`Could not generate linear-gradient() from ${name} ${direction} ${className}`);
|
|
267
268
|
return style.backgroundImage;
|
|
268
269
|
};
|
|
269
|
-
return [[createUtilityName(name, className), toLinearGradient(colors)], ...effects.map(([effectName, effect
|
|
270
|
+
return [[createUtilityName(name, className), toLinearGradient(colors)], ...effects.map(([effectName, effect]) => [createUtilityName(name, className, effectName), toLinearGradient((0, _charcoal_ui_utils.applyEffectToGradient)(effect)(colors))])];
|
|
270
271
|
}));
|
|
271
272
|
}
|
|
272
273
|
function createUtilityName(gradientName, direction, suffix = "") {
|
|
@@ -286,54 +287,53 @@ const leadingCancel = {
|
|
|
286
287
|
content: "\"\""
|
|
287
288
|
};
|
|
288
289
|
const typographyStyle = (style) => {
|
|
289
|
-
const margin = -(0,
|
|
290
|
+
const margin = -(0, _charcoal_ui_utils.halfLeading)(style);
|
|
290
291
|
return {
|
|
291
|
-
"font-size": (0,
|
|
292
|
-
"line-height": (0,
|
|
292
|
+
"font-size": (0, _charcoal_ui_utils.px)(style.fontSize),
|
|
293
|
+
"line-height": (0, _charcoal_ui_utils.px)(style.lineHeight),
|
|
293
294
|
"&::before": {
|
|
294
295
|
...leadingCancel,
|
|
295
|
-
marginTop: (0,
|
|
296
|
+
marginTop: (0, _charcoal_ui_utils.px)(margin)
|
|
296
297
|
},
|
|
297
298
|
"&::after": {
|
|
298
299
|
...leadingCancel,
|
|
299
|
-
marginBottom: (0,
|
|
300
|
+
marginBottom: (0, _charcoal_ui_utils.px)(margin)
|
|
300
301
|
}
|
|
301
302
|
};
|
|
302
303
|
};
|
|
303
304
|
const typographyPlugin = (0, tailwindcss_plugin_js.default)(({ addUtilities }) => {
|
|
304
305
|
addUtilities({
|
|
305
|
-
...(0,
|
|
306
|
+
...(0, _charcoal_ui_utils.mapObject)(_charcoal_ui_foundation.TYPOGRAPHY_SIZE, (fontSize, style) => [`.typography-${fontSize}`, typographyStyle(style)]),
|
|
306
307
|
".preserve-half-leading": {
|
|
307
308
|
"&::before": { content: "none" },
|
|
308
309
|
"&::after": { content: "none" }
|
|
309
310
|
}
|
|
310
311
|
}, { variants: ["responsive"] });
|
|
311
312
|
});
|
|
312
|
-
var plugin_default = typographyPlugin;
|
|
313
313
|
|
|
314
314
|
//#endregion
|
|
315
315
|
//#region src/tokenV2.ts
|
|
316
316
|
function unstable_createTailwindConfigTokenV2() {
|
|
317
|
-
const fontSize = Object.fromEntries(Object.entries(
|
|
318
|
-
if (typeof v === "string") return [[k, [v, { lineHeight:
|
|
317
|
+
const fontSize = Object.fromEntries(Object.entries(_charcoal_ui_theme_unstable_tokens_css_variables_json.default.text["font-size"]).flatMap(([k, v]) => {
|
|
318
|
+
if (typeof v === "string") return [[k, [v, { lineHeight: _charcoal_ui_theme_unstable_tokens_css_variables_json.default.text["line-height"][k] }]]];
|
|
319
319
|
return Object.entries(v).map(([kk, vv]) => {
|
|
320
|
-
return [[k, kk].join("-"), [vv, { lineHeight:
|
|
320
|
+
return [[k, kk].join("-"), [vv, { lineHeight: _charcoal_ui_theme_unstable_tokens_css_variables_json.default.text["line-height"][k][kk] }]];
|
|
321
321
|
});
|
|
322
322
|
}));
|
|
323
|
-
const spacing = flattenKey(
|
|
324
|
-
const colors = mapDefaultKey(
|
|
323
|
+
const spacing = flattenKey(_charcoal_ui_theme_unstable_tokens_css_variables_json.default.space, (key) => !/(gap|padding)/.test(key));
|
|
324
|
+
const colors = mapDefaultKey(_charcoal_ui_theme_unstable_tokens_css_variables_json.default.color);
|
|
325
325
|
return {
|
|
326
326
|
darkMode: "media",
|
|
327
327
|
theme: {
|
|
328
|
-
borderWidth: flattenKeyWithoutDefault({ "width-ch": flattenKey(
|
|
329
|
-
borderRadius:
|
|
328
|
+
borderWidth: flattenKeyWithoutDefault({ "width-ch": flattenKey(_charcoal_ui_theme_unstable_tokens_css_variables_json.default["border-width"]) }),
|
|
329
|
+
borderRadius: _charcoal_ui_theme_unstable_tokens_css_variables_json.default.radius,
|
|
330
330
|
borderColor: flattenKeyWithoutDefault({ ch: flattenKey(colors.border) }),
|
|
331
331
|
colors,
|
|
332
332
|
fontSize,
|
|
333
|
-
fontWeight: flattenKey({ ch:
|
|
333
|
+
fontWeight: flattenKey({ ch: _charcoal_ui_theme_unstable_tokens_css_variables_json.default.text["font-weight"] }),
|
|
334
334
|
spacing,
|
|
335
335
|
gap: spacing,
|
|
336
|
-
width:
|
|
336
|
+
width: _charcoal_ui_theme_unstable_tokens_css_variables_json.default["paragraph-width"]
|
|
337
337
|
}
|
|
338
338
|
};
|
|
339
339
|
}
|
|
@@ -359,7 +359,7 @@ const transformClassNameV1 = (fileName) => {
|
|
|
359
359
|
};
|
|
360
360
|
const createIconUtilities = ({ v2 = false }) => {
|
|
361
361
|
const newUtilities = {};
|
|
362
|
-
const icons = v2 ?
|
|
362
|
+
const icons = v2 ? _charcoal_ui_icon_files_v2_datauri.default : _charcoal_ui_icon_files_v1_datauri.default;
|
|
363
363
|
for (const [fileName, { uri, isSetCurrentcolor }] of Object.entries(icons)) {
|
|
364
364
|
const className = v2 ? transformClassNameV2(fileName) : transformClassNameV1(fileName);
|
|
365
365
|
newUtilities[className] = {
|
|
@@ -383,7 +383,7 @@ const charcoalIconsV1 = (0, tailwindcss_plugin_js.default)(({ addUtilities }) =>
|
|
|
383
383
|
|
|
384
384
|
//#endregion
|
|
385
385
|
//#region src/index.ts
|
|
386
|
-
function createTailwindConfig({ theme = { ":root":
|
|
386
|
+
function createTailwindConfig({ theme = { ":root": _charcoal_ui_theme.light }, version = "v3", cssVariablesV1 = true, unstableTokenV2 = false, iconsV2 = false, iconsV1 = false }) {
|
|
387
387
|
assertAllThemeHaveSameKeys(theme);
|
|
388
388
|
const defaultTheme = theme[":root"];
|
|
389
389
|
const effects = mergeEffect(defaultTheme);
|
|
@@ -392,11 +392,11 @@ function createTailwindConfig({ theme = { ":root": __charcoal_ui_theme.light },
|
|
|
392
392
|
return {
|
|
393
393
|
theme: {
|
|
394
394
|
screens: {
|
|
395
|
-
screen1: (0,
|
|
396
|
-
screen2: (0,
|
|
397
|
-
screen3: (0,
|
|
398
|
-
screen4: (0,
|
|
399
|
-
screen5: (0,
|
|
395
|
+
screen1: (0, _charcoal_ui_utils.px)(0),
|
|
396
|
+
screen2: (0, _charcoal_ui_utils.px)(defaultTheme.breakpoint.screen1),
|
|
397
|
+
screen3: (0, _charcoal_ui_utils.px)(defaultTheme.breakpoint.screen2),
|
|
398
|
+
screen4: (0, _charcoal_ui_utils.px)(defaultTheme.breakpoint.screen3),
|
|
399
|
+
screen5: (0, _charcoal_ui_utils.px)(defaultTheme.breakpoint.screen4)
|
|
400
400
|
},
|
|
401
401
|
colors: {
|
|
402
402
|
black: "#000",
|
|
@@ -407,11 +407,11 @@ function createTailwindConfig({ theme = { ":root": __charcoal_ui_theme.light },
|
|
|
407
407
|
...colorsV2
|
|
408
408
|
},
|
|
409
409
|
borderColor: {
|
|
410
|
-
...colorsToTailwindConfig(version, (0,
|
|
410
|
+
...colorsToTailwindConfig(version, (0, _charcoal_ui_utils.mapObject)(defaultTheme.border, (k, v) => [k, v.color]), effects),
|
|
411
411
|
...borderColorV2
|
|
412
412
|
},
|
|
413
413
|
spacing: {
|
|
414
|
-
...(0,
|
|
414
|
+
...(0, _charcoal_ui_utils.mapObject)(_charcoal_ui_foundation.SPACING, (name, pixel) => [name, (0, _charcoal_ui_utils.px)(pixel)]),
|
|
415
415
|
...spacingV2
|
|
416
416
|
},
|
|
417
417
|
width: {
|
|
@@ -421,7 +421,7 @@ function createTailwindConfig({ theme = { ":root": __charcoal_ui_theme.light },
|
|
|
421
421
|
fit: "fit-content",
|
|
422
422
|
...Array.from({ length: GRID_COUNT }, (_, i) => i + 1).reduce((styles, i) => ({
|
|
423
423
|
...styles,
|
|
424
|
-
[`col-span-${i}`]: (0,
|
|
424
|
+
[`col-span-${i}`]: (0, _charcoal_ui_utils.px)(_charcoal_ui_foundation.COLUMN_UNIT * i + _charcoal_ui_foundation.GUTTER_UNIT * (i - 1))
|
|
425
425
|
}), {}),
|
|
426
426
|
...Array.from({ length: GRID_COUNT - 1 }, (_, i) => i + 1).reduce((styles, i) => ({
|
|
427
427
|
...styles,
|
|
@@ -430,11 +430,11 @@ function createTailwindConfig({ theme = { ":root": __charcoal_ui_theme.light },
|
|
|
430
430
|
...widthV2
|
|
431
431
|
},
|
|
432
432
|
gap: {
|
|
433
|
-
fixed: (0,
|
|
433
|
+
fixed: (0, _charcoal_ui_utils.px)(_charcoal_ui_foundation.GUTTER_UNIT),
|
|
434
434
|
...gapV2
|
|
435
435
|
},
|
|
436
436
|
borderRadius: {
|
|
437
|
-
...(0,
|
|
437
|
+
...(0, _charcoal_ui_utils.mapObject)(_charcoal_ui_foundation.BORDER_RADIUS, (name, value) => [name, (0, _charcoal_ui_utils.px)(value)]),
|
|
438
438
|
...borderRadiusV2
|
|
439
439
|
},
|
|
440
440
|
transitionDuration: { [DEFAULT]: "0.2s" },
|
|
@@ -447,20 +447,19 @@ function createTailwindConfig({ theme = { ":root": __charcoal_ui_theme.light },
|
|
|
447
447
|
...getVariantOption(version),
|
|
448
448
|
corePlugins: { lineHeight: false },
|
|
449
449
|
plugins: [
|
|
450
|
-
|
|
451
|
-
cssVariableColorPlugin(theme, Boolean(cssVariablesV1)),
|
|
452
|
-
...Object.entries(theme).map(([selectorOrMediaQuery, theme
|
|
453
|
-
...iconsV2
|
|
454
|
-
...iconsV1
|
|
450
|
+
typographyPlugin,
|
|
451
|
+
cssVariableColorPlugin$1(theme, Boolean(cssVariablesV1)),
|
|
452
|
+
...Object.entries(theme).map(([selectorOrMediaQuery, theme]) => cssVariableColorPlugin(theme.gradientColor, mergeEffect(theme), selectorOrMediaQuery)),
|
|
453
|
+
...iconsV2 ? [charcoalIconsV2] : [],
|
|
454
|
+
...iconsV1 ? [charcoalIconsV1] : []
|
|
455
455
|
]
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
458
|
const config = createTailwindConfig({});
|
|
459
|
-
var src_default = config;
|
|
460
459
|
|
|
461
460
|
//#endregion
|
|
462
461
|
exports.config = config;
|
|
462
|
+
exports.default = config;
|
|
463
463
|
exports.createTailwindConfig = createTailwindConfig;
|
|
464
|
-
exports.default = src_default;
|
|
465
464
|
exports.unstable_createTailwindConfigTokenV2 = unstable_createTailwindConfigTokenV2;
|
|
466
465
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["varName: keyof CSSVariables","cssVariableColorPlugin","colors","effect","TYPOGRAPHY_SIZE","light","flattenKeys","mapDefaultKeys","newUtilities: { [key: string]: CSSRuleObject }","iconsV2","iconsV1","charcoalIconsV2: ReturnType<typeof plugin>","charcoalIconsV1: ReturnType<typeof plugin>","light","SPACING","COLUMN_UNIT","GUTTER_UNIT","BORDER_RADIUS","typographyPlugin","theme","cssVariableGradientPlugin","iconsV2","iconsV1","config: Omit<Config, 'content'>"],"sources":["../src/foundation.ts","../src/util.ts","../src/colors/utils.ts","../src/colors/toTailwindConfig.ts","../src/colors/pluginTokenV1.ts","../src/colors/plugin.ts","../src/gradient/plugin.ts","../src/typography/plugin.ts","../src/tokenV2.ts","../src/icons.ts","../src/index.ts"],"sourcesContent":["import { Effect } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\n\nexport const GRID_COUNT = 12\n\nexport function mergeEffect({\n elementEffect,\n effect,\n}: Pick<Theme, 'elementEffect' | 'effect'>): MergedEffect {\n return {\n ...elementEffect,\n ...effect,\n outline: {\n type: 'opacity',\n opacity: 0.32,\n } as Effect,\n }\n}\n\nexport type MergedEffect = Record<string, Effect>\n","import type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\n/**\n * the key \"default\" or \"DEFAULT\" has special meaning and dropped from class name\n *\n * @see https://tailwindcss.com/docs/upgrading-to-v2#update-default-theme-keys-to-default\n */\nexport function getDefaultKeyName(version: TailwindVersion) {\n switch (version) {\n case 'v3':\n case 'v2': {\n return 'DEFAULT'\n }\n\n case 'v1': {\n return 'default'\n }\n }\n}\n\nexport function getVariantOption(version: TailwindVersion): Partial<Config> {\n switch (version) {\n case 'v3': {\n // v3 以上では variants は variantOrders に改名された\n // そしてこれは上書きをしたいモチベがない\n // https://v2.tailwindcss.com/docs/configuration#variant-order\n return {}\n }\n\n case 'v2':\n case 'v1': {\n return { variants: {} }\n }\n }\n}\n\nfunction setEquals<T>(a: Set<T>, b: Set<T>) {\n return a.size === b.size && Array.from(a).every((value) => b.has(value))\n}\n\nexport function assertAllThemeHaveSameKeys(themeMap: ThemeMap): void {\n const defaultTheme = themeMap[':root']\n const expectedColorKeys = new Set(Object.keys(defaultTheme.color))\n const expectedEffectKeys = new Set(Object.keys(defaultTheme.effect))\n\n for (const [name, theme] of Object.entries(themeMap)) {\n const colorKeys = new Set(Object.keys(theme.color))\n const effectKeys = new Set(Object.keys(theme.effect))\n\n if (!setEquals(colorKeys, expectedColorKeys)) {\n throw new Error(`:root and ${name} does not have same colors.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedColorKeys))}\nGot: ${JSON.stringify(Array.from(colorKeys))}`)\n }\n\n if (!setEquals(effectKeys, expectedEffectKeys)) {\n throw new Error(`:root and ${name} does not have same effects.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedEffectKeys))}\nGot: ${JSON.stringify(Array.from(effectKeys))}`)\n }\n }\n}\n\nexport function camelToKebab(value: string) {\n return value\n .replace(/(?<small>[\\da-z]|(?=[A-Z]))(?<capital>[A-Z])/gu, '$1-$2')\n .toLowerCase()\n}\n\nexport const mapDefaultKey = <O extends object>(o: O) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(JSON.stringify(o), function reviver(k: string, v: string) {\n if (k === 'default') {\n const DefaultKey = getDefaultKeyName('v3')\n this[DefaultKey] = v\n return undefined\n }\n return v\n })\n}\n\nexport const flattenKey = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n return [(join?.(key) ?? true) ? [key, kk].join('-') : kk, vv]\n })\n }),\n )\n}\n\n/**\n * `DEFAULT` はkey名に結合しない\n */\nexport const flattenKeyWithoutDefault = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n const isDefaultKey = kk === 'DEFAULT' || kk === 'default'\n const outputKey = isDefaultKey\n ? key\n : (join?.(key) ?? true)\n ? [key, kk].join('-')\n : kk\n return [outputKey, vv]\n })\n }),\n )\n}\n","import { GradientMaterial, Material } from '@charcoal-ui/foundation'\n\nexport const COLOR_PREFIX = '--tailwind-color-'\n\nexport function isSingleColor(color: AnyColor): color is Material {\n return typeof color === 'string'\n}\n\ntype AnyColor = Material | GradientMaterial\n\nexport type AnyColorTheme = Record<string, AnyColor>\n","import { Material } from '@charcoal-ui/foundation'\nimport { applyEffect, filterObject, mapObject } from '@charcoal-ui/utils'\nimport type { Config } from 'tailwindcss'\nimport { MergedEffect } from '../foundation'\n\nimport { TailwindVersion } from '../types'\nimport { getDefaultKeyName } from '../util'\n\nimport { AnyColorTheme, COLOR_PREFIX, isSingleColor } from './utils'\n\nexport function colorsToTailwindConfig(\n version: TailwindVersion,\n colors: AnyColorTheme,\n effects: MergedEffect,\n): NonNullable<Config['theme']>['colors'] {\n const targetColors = filterObject(colors, isSingleColor)\n const DEFAULT = getDefaultKeyName(version)\n\n /**\n * こういう感じのを吐き出す\n *\n * ```js\n * {\n * DEFAULT: 'var(--tailwind-color-hoge1, #fff)',\n * hover: 'var(--tailwind-color-hoge1--hover, #eee)',\n * press: 'var(--tailwind-color-hoge1--press, #ddd)',\n * disabled: 'var(--tailwind-color-hoge1--disabled, #eee)',\n * }\n * ```\n */\n function colorsForAllEffects(name: string, color: Material) {\n const varName = `${COLOR_PREFIX}${name}`\n\n return {\n [DEFAULT]: `var(${varName}, ${color})`,\n\n ...mapObject(effects, (effectName, effect) => [\n effectName,\n `var(${varName}--${effectName}, ${applyEffect(color, effect)})`,\n ]),\n }\n }\n\n return mapObject(targetColors, (name, color) => [\n name,\n colorsForAllEffects(name, color),\n ])\n}\n","import {\n applyEffect,\n customPropertyToken,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { ThemeMap } from '../types'\nimport {\n CharcoalAbstractTheme,\n EffectType,\n Key,\n CharcoalTheme as Theme,\n} from '@charcoal-ui/theme'\n\nexport function defineCssVariablesV1(themeMap: ThemeMap) {\n // @ts-expect-error FIXME\n return mapObject(themeMap, (key, theme) => {\n if (key.startsWith('@media')) {\n return [\n key,\n {\n ':root': defineColorVariableCSS(theme),\n },\n ]\n } else {\n return [key, defineColorVariableCSS(theme)]\n }\n })\n}\n\nexport const defineColorVariableCSS = (theme: Theme) => {\n const borders = mapObject(theme.border, (name, { color }) => [\n // REVIEW: もしtheme.colorにたまたまborder-〇〇で始まる色名がいたら被りうる\n withPrefixes('border', name),\n color,\n ])\n\n const colors = defineThemeVariables({ ...theme.color, ...borders })({ theme })\n return colors\n}\n\n/**\n * Check whether a value is non-null and non-undefined\n *\n * @param value nullable\n */\nexport const isPresent = <T>(value: T): value is NonNullable<T> => value != null\n\n/**\n * 子孫要素で使われるカラーテーマの CSS Variables を上書きする\n *\n * @params colorParams - 上書きしたい色の定義( `theme.color` の一部だけ書けば良い )\n * @params effectParams - effect の定義を上書きしたい場合は渡す(必須ではない)\n *\n * @example\n * ```tsx\n * const LocalTheme = styled.div`\n * ${defineThemeVariables({ text1: '#ff0000' })}\n * // `text1` is now defined as red\n * ${theme((o) => [o.font.text1])}\n * `\n * ```\n */\nexport function defineThemeVariables(\n colorParams: Partial<CharcoalAbstractTheme['color']>,\n effectParams?: Partial<CharcoalAbstractTheme['effect']>,\n) {\n return function toCssObject(props: {\n theme: Pick<CharcoalAbstractTheme, 'effect'>\n }) {\n const colors = filterObject(colorParams, isPresent)\n\n // flatMapObject の中で毎回 Object.entries を呼ぶのは無駄なので外で呼ぶ\n const effects = Object.entries({\n ...props.theme.effect,\n ...effectParams,\n })\n\n return flatMapObject(colors, (colorKey, color) => [\n [customPropertyToken(colorKey), color],\n\n ...effects.map<[string, string]>(([effectKey, effect]) => [\n customPropertyToken(colorKey, [effectKey]),\n applyEffect(color, [effect]),\n ]),\n ])\n }\n}\n\nexport function isSupportedEffect(effect: Key): effect is EffectType {\n return ['hover', 'press', 'disabled'].includes(effect as string)\n}\n\nexport const variable = (value: string) => `var(${value})`\n\nexport function withPrefixes(...parts: string[]) {\n return parts.join('-')\n}\n","import { Material } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\nimport {\n applyEffect,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport plugin from 'tailwindcss/plugin.js'\nimport { mergeEffect } from '../foundation'\nimport { CSSVariableName, CSSVariables, Definition, ThemeMap } from '../types'\nimport { COLOR_PREFIX, isSingleColor } from './utils'\nimport { defineCssVariablesV1 } from './pluginTokenV1'\n\n/**\n * --tailwind-* また --charcoal-* を生成する\n * TODO: --tailwindをやめる\n */\nexport default function cssVariableColorPlugin(\n themeMap: ThemeMap,\n cssVariablesV1: boolean,\n): ReturnType<typeof plugin> {\n // `:root` 以外のケースで各 CSS Variable がどういう値を取るかを定義する\n const { ':root': _defaultTheme, ...otherThemes } = themeMap\n const definitions = defineCssVariables(otherThemes)\n\n return plugin(({ addBase }) => {\n addBase(definitions)\n\n // styledのTokenInjector移植(background処理除く)\n if (cssVariablesV1) {\n const cssVariablesV1 = defineCssVariablesV1(themeMap)\n // @ts-expect-error FIXME\n addBase(cssVariablesV1)\n }\n })\n}\n\nexport function defineCssVariables(themes: Omit<ThemeMap, ':root'>) {\n return mapObject(themes, (selectorOrMediaQuery, theme) => {\n const css = toCssVariables(theme)\n\n if (selectorOrMediaQuery.startsWith('@media')) {\n return [\n selectorOrMediaQuery,\n {\n ':root': css,\n },\n ]\n } else {\n return [selectorOrMediaQuery, css]\n }\n }) as Definition\n}\n\nfunction toCssVariables(theme: Theme): CSSVariables {\n const colors = filterObject(theme.color, isSingleColor)\n const effects = Object.entries(mergeEffect(theme))\n\n return flatMapObject(colors, (name, color) => {\n const varName: keyof CSSVariables = `${COLOR_PREFIX}${name}`\n\n return [\n [varName, color],\n\n ...effects.map<[CSSVariableName, Material]>(([type, effect]) => [\n `${varName}--${type}`,\n applyEffect(color, effect),\n ]),\n ]\n })\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { camelToKebab } from '../util'\nimport { GradientMaterial } from '@charcoal-ui/foundation'\nimport { ThemeColorGradient } from '@charcoal-ui/theme'\nimport {\n applyEffectToGradient,\n flatMapObject,\n gradient,\n GradientDirection,\n mapKeys,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { Values } from '../types'\nimport { MergedEffect } from '../foundation'\n\nconst VAR_PREFIX = '--tailwind-gradient-'\n\nexport default function cssVariableColorPlugin(\n gradients: ThemeColorGradient,\n effects: MergedEffect,\n selectorOrMediaQuery: string,\n) {\n const utilities = getUtilities(gradients, effects)\n\n const classRules = mapObject(utilities, (name) => [\n `.bg-${name}`,\n { backgroundImage: `var(${VAR_PREFIX}${name})` },\n ])\n\n return plugin(({ addBase, addUtilities }) => {\n const css = mapKeys(utilities, (name) => `${VAR_PREFIX}${name}`)\n if (selectorOrMediaQuery.startsWith('@media')) {\n addBase({\n [selectorOrMediaQuery]: {\n ':root': css,\n },\n })\n } else {\n addBase({\n [selectorOrMediaQuery]: css,\n })\n }\n\n addUtilities(classRules, {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n })\n })\n}\n\nconst DIRECTIONS = {\n 'to top': 'top',\n 'to bottom': 'bottom',\n 'to left': 'left',\n 'to right': 'right',\n} as const\n\n/**\n * こういう感じのやつ。この時点では `--tailwind-gradient-` のような CSS 変数名になってない\n *\n * ```js\n * {\n * 'hoge1': 'linear-gradient(to top, ...)',\n * ...\n * }\n * ```\n */\ntype Utilities = Record<string, LinearGradient>\n\ntype LinearGradient = `linear-gradient(${string})`\n\nexport function getUtilities(\n gradients: Record<string, GradientMaterial>,\n effect: MergedEffect,\n): Utilities {\n const effects = Object.entries(effect)\n const directions = Object.entries(DIRECTIONS) as [\n GradientDirection,\n Values<typeof DIRECTIONS>,\n ][]\n\n return flatMapObject(gradients, (name, colors) =>\n directions.flatMap(([direction, className]) => {\n const toLinearGradient = (colors: GradientMaterial) => {\n const style = gradient(direction)(colors)\n\n if (!('backgroundImage' in style)) {\n throw new Error(\n `Could not generate linear-gradient() from ${name} ${direction} ${className}`,\n )\n }\n\n // 本当は backgroundColor も同時に生成されるんだけど、使うにはそれ用の CSS 変数も一緒に作らないといけない\n // とりあえず background-image だけで動くのでこっちだけを利用する\n return style.backgroundImage as LinearGradient\n }\n\n return [\n // こういう感じのやつ\n // { 'hoge1': 'linear-gradient(to top, ...)' }\n [createUtilityName(name, className), toLinearGradient(colors)],\n\n // こういう感じのやつ\n // { 'hoge1--hover': 'linear-gradient(to top, ...)' }\n ...effects.map<[string, LinearGradient]>(([effectName, effect]) => [\n createUtilityName(name, className, effectName),\n toLinearGradient(applyEffectToGradient(effect)(colors)),\n ]),\n ]\n }),\n )\n}\n\nfunction createUtilityName(\n gradientName: string,\n direction: Values<typeof DIRECTIONS>,\n suffix = '',\n) {\n return [camelToKebab(gradientName), direction, suffix]\n .filter(Boolean)\n .join('-')\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { TypographyDescriptor, TYPOGRAPHY_SIZE } from '@charcoal-ui/foundation'\nimport { halfLeading, mapObject, px } from '@charcoal-ui/utils'\n\nconst leadingCancel = {\n display: 'block',\n width: 0,\n height: 0,\n content: '\"\"',\n}\n\nconst typographyStyle = (style: TypographyDescriptor) => {\n const margin = -halfLeading(style)\n\n return {\n 'font-size': px(style.fontSize),\n 'line-height': px(style.lineHeight),\n\n /**\n * cancel leading\n *\n * @see https://yuyakinoshita.com/blog/2020/01/20/line-height-crop/\n */\n '&::before': {\n ...leadingCancel,\n marginTop: px(margin),\n },\n '&::after': {\n ...leadingCancel,\n marginBottom: px(margin),\n },\n }\n}\n\nconst typographyPlugin = plugin(({ addUtilities }) => {\n const typographyClasses = mapObject(TYPOGRAPHY_SIZE, (fontSize, style) => [\n `.typography-${fontSize}`,\n typographyStyle(style),\n ])\n\n addUtilities(\n {\n ...typographyClasses,\n '.preserve-half-leading': {\n '&::before': {\n content: 'none',\n },\n '&::after': {\n content: 'none',\n },\n },\n },\n {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n },\n )\n})\n\nexport default typographyPlugin\n","import light from '@charcoal-ui/theme/unstable-tokens/css-variables.json' with { type: 'json' }\nimport type { Config } from 'tailwindcss'\nimport {\n flattenKey as flattenKeys,\n flattenKeyWithoutDefault,\n mapDefaultKey as mapDefaultKeys,\n} from './util'\n\nexport function unstable_createTailwindConfigTokenV2(): Omit<\n Config,\n 'content'\n> {\n const fontSize = Object.fromEntries(\n Object.entries(light.text['font-size']).flatMap(([k, v]) => {\n // text.fontSize.paragraph + text.lineHeight.paragraph -> text-paragraph\n if (typeof v === 'string') {\n return [\n [\n k,\n [\n v,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k] },\n ],\n ],\n ]\n }\n\n // text.fontSize.heading.s + text.lineHeight.heading.s -> text-heading-s\n return Object.entries(v as Record<string, string>).map(([kk, vv]) => {\n return [\n [k, kk].join('-'),\n [\n vv,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k][kk] },\n ],\n ]\n })\n }),\n ) as NonNullable<Config['theme']>['fontSize']\n\n // space.target.s -> p-target-s\n // space.gap.gapButtons -> p-gap-buttons\n const spacing = flattenKeys(light.space, (key) => !/(gap|padding)/.test(key))\n // color.container.default -> bg-container\n // color.container.hover -> bg-container-hover\n const colors = mapDefaultKeys(light.color)\n\n const config: Omit<Config, 'content'> = {\n darkMode: 'media',\n theme: {\n // borderWidth.m -> border-m\n // borderWidth.focus.1 -> border-focus-1\n borderWidth: flattenKeyWithoutDefault({\n 'width-ch': flattenKeys(light['border-width']), // unstable border width token\n }),\n borderRadius: light.radius,\n borderColor: flattenKeyWithoutDefault({ ch: flattenKeys(colors.border) }),\n\n colors,\n\n fontSize,\n fontWeight: flattenKeys({ ch: light.text['font-weight'] }),\n\n spacing,\n gap: spacing,\n width: light['paragraph-width'],\n },\n }\n\n return config\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport iconsV2 from '@charcoal-ui/icon-files/v2/datauri'\nimport iconsV1 from '@charcoal-ui/icon-files/v1/datauri'\nimport { CSSRuleObject } from 'tailwindcss/types/config'\n\nconst transformClassNameV2 = (fileName: string) => {\n const [size, variant, name] = fileName.split('/')\n return [\n '.icon-v2',\n name.replaceAll('.', '-'),\n ...(variant === 'regular' ? [] : [variant]),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nconst transformClassNameV1 = (fileName: string) => {\n const [size, name] = fileName.split('/')\n return [\n '.icon-v1',\n name.replaceAll('.', '-'),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nexport const createIconUtilities = ({\n v2 = false,\n}: {\n v2?: boolean\n}): {\n [key: string]: CSSRuleObject\n} => {\n const newUtilities: { [key: string]: CSSRuleObject } = {}\n const icons = v2 ? iconsV2 : iconsV1\n for (const [fileName, { uri, isSetCurrentcolor }] of Object.entries(icons)) {\n const className = v2\n ? transformClassNameV2(fileName)\n : transformClassNameV1(fileName)\n\n newUtilities[className] = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n maskImage: `url(${uri})`,\n maskSize: '100% 100%',\n background: isSetCurrentcolor ? 'currentColor' : null,\n aspectRatio: '1/1',\n }\n }\n return newUtilities\n}\n\nexport const charcoalIconsV2: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: true }))\n },\n)\n\nexport const charcoalIconsV1: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: false }))\n },\n)\n","import { GRID_COUNT, mergeEffect } from './foundation'\n\nimport type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\nimport {\n assertAllThemeHaveSameKeys,\n getDefaultKeyName,\n getVariantOption,\n} from './util'\nimport {\n COLUMN_UNIT,\n GUTTER_UNIT,\n SPACING,\n BORDER_RADIUS,\n} from '@charcoal-ui/foundation'\nimport { light } from '@charcoal-ui/theme'\nimport { mapObject, px } from '@charcoal-ui/utils'\nimport { colorsToTailwindConfig } from './colors/toTailwindConfig'\n\nimport cssVariableColorPlugin from './colors/plugin'\nimport cssVariableGradientPlugin from './gradient/plugin'\nimport typographyPlugin from './typography/plugin'\nimport { unstable_createTailwindConfigTokenV2 } from './tokenV2'\nimport { charcoalIconsV1, charcoalIconsV2 } from './icons'\nexport { unstable_createTailwindConfigTokenV2 }\n\ninterface Options {\n version?: TailwindVersion\n theme?: ThemeMap\n cssVariablesV1?: boolean\n unstableTokenV2?: boolean\n iconsV2?: boolean\n iconsV1?: boolean\n}\n\nexport function createTailwindConfig({\n theme = { ':root': light },\n version = 'v3',\n cssVariablesV1 = true,\n unstableTokenV2 = false,\n iconsV2 = false,\n iconsV1 = false,\n}: Options): Omit<Config, 'content'> {\n assertAllThemeHaveSameKeys(theme)\n\n const defaultTheme = theme[':root']\n const effects = mergeEffect(defaultTheme)\n const DEFAULT = getDefaultKeyName(version)\n\n const {\n borderWidth: borderWidthV2,\n borderRadius: borderRadiusV2,\n borderColor: borderColorV2,\n colors: colorsV2,\n fontSize: fontSizeV2,\n fontWeight: fontWeightV2,\n spacing: spacingV2,\n gap: gapV2,\n width: widthV2,\n }: Partial<NonNullable<Config['theme']>> = unstableTokenV2\n ? unstable_createTailwindConfigTokenV2().theme\n : {}\n\n return {\n theme: {\n screens: {\n screen1: px(0),\n screen2: px(defaultTheme.breakpoint.screen1),\n screen3: px(defaultTheme.breakpoint.screen2),\n screen4: px(defaultTheme.breakpoint.screen3),\n screen5: px(defaultTheme.breakpoint.screen4),\n },\n colors: {\n // @deprecated\n black: '#000',\n\n // @deprecated\n white: '#fff',\n\n transparent: 'transparent',\n current: 'currentColor',\n ...colorsToTailwindConfig(version, defaultTheme.color, effects),\n ...colorsV2,\n },\n borderColor: {\n ...colorsToTailwindConfig(\n version,\n mapObject(defaultTheme.border, (k, v) => [k, v.color]),\n effects,\n ),\n ...borderColorV2,\n },\n spacing: {\n ...mapObject(\n SPACING,\n (name, pixel) => [name, px(pixel)] as [string, string],\n ),\n ...spacingV2,\n },\n width: {\n full: '100%',\n screen: '100vw',\n auto: 'auto',\n fit: 'fit-content',\n\n /**\n * generates classes like \"w-col-span-1\"\n */\n ...Array.from({ length: GRID_COUNT }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`col-span-${i}`]: px(COLUMN_UNIT * i + GUTTER_UNIT * (i - 1)),\n }),\n {},\n ),\n\n /**\n * generates classes like \"w-1/12\" (except for 12/12, which just equals to w-full)\n */\n ...Array.from({ length: GRID_COUNT - 1 }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`${i}/${GRID_COUNT}`]: `${(i / GRID_COUNT) * 100}%`,\n }),\n {},\n ),\n ...widthV2,\n },\n gap: {\n fixed: px(GUTTER_UNIT),\n ...gapV2,\n },\n borderRadius: {\n ...mapObject(\n BORDER_RADIUS,\n (name, value) => [name, px(value)] as [string, string],\n ),\n ...borderRadiusV2,\n },\n transitionDuration: {\n [DEFAULT]: '0.2s',\n },\n ...(unstableTokenV2\n ? {\n extend: {\n borderWidth: borderWidthV2,\n fontWeight: fontWeightV2,\n fontSize: fontSizeV2,\n },\n }\n : {}),\n },\n\n ...getVariantOption(version),\n\n corePlugins: {\n lineHeight: false,\n },\n plugins: [\n typographyPlugin,\n cssVariableColorPlugin(theme, Boolean(cssVariablesV1)),\n\n ...Object.entries(theme).map(([selectorOrMediaQuery, theme]) =>\n cssVariableGradientPlugin(\n theme.gradientColor,\n mergeEffect(theme),\n selectorOrMediaQuery,\n ),\n ),\n ...(iconsV2 ? [charcoalIconsV2] : []),\n ...(iconsV1 ? [charcoalIconsV1] : []),\n ],\n }\n}\n\nexport const config: Omit<Config, 'content'> = createTailwindConfig({})\n\nexport default config\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAa,aAAa;AAE1B,SAAgB,YAAY,EAC1B,eACA,UACwD;AACxD,QAAO;EACL,GAAG;EACH,GAAG;EACH,SAAS;GACP,MAAM;GACN,SAAS;GACV;EACF;;;;;;;;;;ACRH,SAAgB,kBAAkB,SAA0B;AAC1D,SAAQ,SAAR;EACE,KAAK;EACL,KAAK,KACH,QAAO;EAGT,KAAK,KACH,QAAO;;;AAKb,SAAgB,iBAAiB,SAA2C;AAC1E,SAAQ,SAAR;EACE,KAAK,KAIH,QAAO,EAAE;EAGX,KAAK;EACL,KAAK,KACH,QAAO,EAAE,UAAU,EAAE,EAAE;;;AAK7B,SAAS,UAAa,GAAW,GAAW;AAC1C,QAAO,EAAE,SAAS,EAAE,QAAQ,MAAM,KAAK,EAAE,CAAC,OAAO,UAAU,EAAE,IAAI,MAAM,CAAC;;AAG1E,SAAgB,2BAA2B,UAA0B;CACnE,MAAM,eAAe,SAAS;CAC9B,MAAM,oBAAoB,IAAI,IAAI,OAAO,KAAK,aAAa,MAAM,CAAC;CAClE,MAAM,qBAAqB,IAAI,IAAI,OAAO,KAAK,aAAa,OAAO,CAAC;AAEpE,MAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,SAAS,EAAE;EACpD,MAAM,YA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;KACd,GAAG;MACF,GAAG,EAAE,GAAG,eAAe,GAAI,IAAI,aAAc,IAAI;KACnD,GACD,EAAE,CACH;IACD,GAAG;IACJ;GACD,KAAK;IACH,mCAAUA,qCAAY;IACtB,GAAG;IACJ;GACD,cAAc;IACZ,sCACEC,yCACC,MAAM,UAAU,CAAC,kCAAS,MAAM,CAAC,CACnC;IACD,GAAG;IACJ;GACD,oBAAoB,GACjB,UAAU,QACZ;GACD,GAAI,kBACA,EACE,QAAQ;IACN,aAAa;IACb,YAAY;IACZ,UAAU;IACX,EACF,GACD,EAAE;GACP;EAED,GAAG,iBAAiB,QAAQ;EAE5B,aAAa,EACX,YAAY,OACb;EACD,SAAS;GACPC;GACA,uBAAuB,OAAO,QAAQ,eAAe,CAAC;GAEtD,GAAG,OAAO,QAAQ,MAAM,CAAC,KAAK,CAAC,sBAAsBC,aACnDC,yBACED,QAAM,eACN,YAAYA,QAAM,EAClB,qBACD,CACF;GACD,GAAIE,YAAU,CAAC,gBAAgB,GAAG,EAAE;GACpC,GAAIC,YAAU,CAAC,gBAAgB,GAAG,EAAE;GACrC;EACF;;AAGH,MAAaC,SAAkC,qBAAqB,EAAE,CAAC;AAEvE,kBAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["cssVariableColorPlugin","TYPOGRAPHY_SIZE","light","flattenKeys","mapDefaultKeys","iconsV2","iconsV1","light","SPACING","COLUMN_UNIT","GUTTER_UNIT","BORDER_RADIUS","cssVariableColorPlugin","cssVariableGradientPlugin"],"sources":["../src/foundation.ts","../src/util.ts","../src/colors/utils.ts","../src/colors/toTailwindConfig.ts","../src/colors/pluginTokenV1.ts","../src/colors/plugin.ts","../src/gradient/plugin.ts","../src/typography/plugin.ts","../src/tokenV2.ts","../src/icons.ts","../src/index.ts"],"sourcesContent":["import { Effect } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\n\nexport const GRID_COUNT = 12\n\nexport function mergeEffect({\n elementEffect,\n effect,\n}: Pick<Theme, 'elementEffect' | 'effect'>): MergedEffect {\n return {\n ...elementEffect,\n ...effect,\n outline: {\n type: 'opacity',\n opacity: 0.32,\n } as Effect,\n }\n}\n\nexport type MergedEffect = Record<string, Effect>\n","import type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\n/**\n * the key \"default\" or \"DEFAULT\" has special meaning and dropped from class name\n *\n * @see https://tailwindcss.com/docs/upgrading-to-v2#update-default-theme-keys-to-default\n */\nexport function getDefaultKeyName(version: TailwindVersion) {\n switch (version) {\n case 'v3':\n case 'v2': {\n return 'DEFAULT'\n }\n\n case 'v1': {\n return 'default'\n }\n }\n}\n\nexport function getVariantOption(version: TailwindVersion): Partial<Config> {\n switch (version) {\n case 'v3': {\n // v3 以上では variants は variantOrders に改名された\n // そしてこれは上書きをしたいモチベがない\n // https://v2.tailwindcss.com/docs/configuration#variant-order\n return {}\n }\n\n case 'v2':\n case 'v1': {\n return { variants: {} }\n }\n }\n}\n\nfunction setEquals<T>(a: Set<T>, b: Set<T>) {\n return a.size === b.size && Array.from(a).every((value) => b.has(value))\n}\n\nexport function assertAllThemeHaveSameKeys(themeMap: ThemeMap): void {\n const defaultTheme = themeMap[':root']\n const expectedColorKeys = new Set(Object.keys(defaultTheme.color))\n const expectedEffectKeys = new Set(Object.keys(defaultTheme.effect))\n\n for (const [name, theme] of Object.entries(themeMap)) {\n const colorKeys = new Set(Object.keys(theme.color))\n const effectKeys = new Set(Object.keys(theme.effect))\n\n if (!setEquals(colorKeys, expectedColorKeys)) {\n throw new Error(`:root and ${name} does not have same colors.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedColorKeys))}\nGot: ${JSON.stringify(Array.from(colorKeys))}`)\n }\n\n if (!setEquals(effectKeys, expectedEffectKeys)) {\n throw new Error(`:root and ${name} does not have same effects.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedEffectKeys))}\nGot: ${JSON.stringify(Array.from(effectKeys))}`)\n }\n }\n}\n\nexport function camelToKebab(value: string) {\n return value\n .replace(/(?<small>[\\da-z]|(?=[A-Z]))(?<capital>[A-Z])/gu, '$1-$2')\n .toLowerCase()\n}\n\nexport const mapDefaultKey = <O extends object>(o: O) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(JSON.stringify(o), function reviver(k: string, v: string) {\n if (k === 'default') {\n const DefaultKey = getDefaultKeyName('v3')\n this[DefaultKey] = v\n return undefined\n }\n return v\n })\n}\n\nexport const flattenKey = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n return [(join?.(key) ?? true) ? [key, kk].join('-') : kk, vv]\n })\n }),\n )\n}\n\n/**\n * `DEFAULT` はkey名に結合しない\n */\nexport const flattenKeyWithoutDefault = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n const isDefaultKey = kk === 'DEFAULT' || kk === 'default'\n const outputKey = isDefaultKey\n ? key\n : (join?.(key) ?? true)\n ? [key, kk].join('-')\n : kk\n return [outputKey, vv]\n })\n }),\n )\n}\n","import { GradientMaterial, Material } from '@charcoal-ui/foundation'\n\nexport const COLOR_PREFIX = '--tailwind-color-'\n\nexport function isSingleColor(color: AnyColor): color is Material {\n return typeof color === 'string'\n}\n\ntype AnyColor = Material | GradientMaterial\n\nexport type AnyColorTheme = Record<string, AnyColor>\n","import { Material } from '@charcoal-ui/foundation'\nimport { applyEffect, filterObject, mapObject } from '@charcoal-ui/utils'\nimport type { Config } from 'tailwindcss'\nimport { MergedEffect } from '../foundation'\n\nimport { TailwindVersion } from '../types'\nimport { getDefaultKeyName } from '../util'\n\nimport { AnyColorTheme, COLOR_PREFIX, isSingleColor } from './utils'\n\nexport function colorsToTailwindConfig(\n version: TailwindVersion,\n colors: AnyColorTheme,\n effects: MergedEffect,\n): NonNullable<Config['theme']>['colors'] {\n const targetColors = filterObject(colors, isSingleColor)\n const DEFAULT = getDefaultKeyName(version)\n\n /**\n * こういう感じのを吐き出す\n *\n * ```js\n * {\n * DEFAULT: 'var(--tailwind-color-hoge1, #fff)',\n * hover: 'var(--tailwind-color-hoge1--hover, #eee)',\n * press: 'var(--tailwind-color-hoge1--press, #ddd)',\n * disabled: 'var(--tailwind-color-hoge1--disabled, #eee)',\n * }\n * ```\n */\n function colorsForAllEffects(name: string, color: Material) {\n const varName = `${COLOR_PREFIX}${name}`\n\n return {\n [DEFAULT]: `var(${varName}, ${color})`,\n\n ...mapObject(effects, (effectName, effect) => [\n effectName,\n `var(${varName}--${effectName}, ${applyEffect(color, effect)})`,\n ]),\n }\n }\n\n return mapObject(targetColors, (name, color) => [\n name,\n colorsForAllEffects(name, color),\n ])\n}\n","import {\n applyEffect,\n customPropertyToken,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { ThemeMap } from '../types'\nimport {\n CharcoalAbstractTheme,\n EffectType,\n Key,\n CharcoalTheme as Theme,\n} from '@charcoal-ui/theme'\n\nexport function defineCssVariablesV1(themeMap: ThemeMap) {\n // @ts-expect-error FIXME\n return mapObject(themeMap, (key, theme) => {\n if (key.startsWith('@media')) {\n return [\n key,\n {\n ':root': defineColorVariableCSS(theme),\n },\n ]\n } else {\n return [key, defineColorVariableCSS(theme)]\n }\n })\n}\n\nexport const defineColorVariableCSS = (theme: Theme) => {\n const borders = mapObject(theme.border, (name, { color }) => [\n // REVIEW: もしtheme.colorにたまたまborder-〇〇で始まる色名がいたら被りうる\n withPrefixes('border', name),\n color,\n ])\n\n const colors = defineThemeVariables({ ...theme.color, ...borders })({ theme })\n return colors\n}\n\n/**\n * Check whether a value is non-null and non-undefined\n *\n * @param value nullable\n */\nexport const isPresent = <T>(value: T): value is NonNullable<T> => value != null\n\n/**\n * 子孫要素で使われるカラーテーマの CSS Variables を上書きする\n *\n * @params colorParams - 上書きしたい色の定義( `theme.color` の一部だけ書けば良い )\n * @params effectParams - effect の定義を上書きしたい場合は渡す(必須ではない)\n *\n * @example\n * ```tsx\n * const LocalTheme = styled.div`\n * ${defineThemeVariables({ text1: '#ff0000' })}\n * // `text1` is now defined as red\n * ${theme((o) => [o.font.text1])}\n * `\n * ```\n */\nexport function defineThemeVariables(\n colorParams: Partial<CharcoalAbstractTheme['color']>,\n effectParams?: Partial<CharcoalAbstractTheme['effect']>,\n) {\n return function toCssObject(props: {\n theme: Pick<CharcoalAbstractTheme, 'effect'>\n }) {\n const colors = filterObject(colorParams, isPresent)\n\n // flatMapObject の中で毎回 Object.entries を呼ぶのは無駄なので外で呼ぶ\n const effects = Object.entries({\n ...props.theme.effect,\n ...effectParams,\n })\n\n return flatMapObject(colors, (colorKey, color) => [\n [customPropertyToken(colorKey), color],\n\n ...effects.map<[string, string]>(([effectKey, effect]) => [\n customPropertyToken(colorKey, [effectKey]),\n applyEffect(color, [effect]),\n ]),\n ])\n }\n}\n\nexport function isSupportedEffect(effect: Key): effect is EffectType {\n return ['hover', 'press', 'disabled'].includes(effect as string)\n}\n\nexport const variable = (value: string) => `var(${value})`\n\nexport function withPrefixes(...parts: string[]) {\n return parts.join('-')\n}\n","import { Material } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\nimport {\n applyEffect,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport plugin from 'tailwindcss/plugin.js'\nimport { mergeEffect } from '../foundation'\nimport { CSSVariableName, CSSVariables, Definition, ThemeMap } from '../types'\nimport { COLOR_PREFIX, isSingleColor } from './utils'\nimport { defineCssVariablesV1 } from './pluginTokenV1'\n\n/**\n * --tailwind-* また --charcoal-* を生成する\n * TODO: --tailwindをやめる\n */\nexport default function cssVariableColorPlugin(\n themeMap: ThemeMap,\n cssVariablesV1: boolean,\n): ReturnType<typeof plugin> {\n // `:root` 以外のケースで各 CSS Variable がどういう値を取るかを定義する\n const { ':root': _defaultTheme, ...otherThemes } = themeMap\n const definitions = defineCssVariables(otherThemes)\n\n return plugin(({ addBase }) => {\n addBase(definitions)\n\n // styledのTokenInjector移植(background処理除く)\n if (cssVariablesV1) {\n const cssVariablesV1 = defineCssVariablesV1(themeMap)\n // @ts-expect-error FIXME\n addBase(cssVariablesV1)\n }\n })\n}\n\nexport function defineCssVariables(themes: Omit<ThemeMap, ':root'>) {\n return mapObject(themes, (selectorOrMediaQuery, theme) => {\n const css = toCssVariables(theme)\n\n if (selectorOrMediaQuery.startsWith('@media')) {\n return [\n selectorOrMediaQuery,\n {\n ':root': css,\n },\n ]\n } else {\n return [selectorOrMediaQuery, css]\n }\n }) as Definition\n}\n\nfunction toCssVariables(theme: Theme): CSSVariables {\n const colors = filterObject(theme.color, isSingleColor)\n const effects = Object.entries(mergeEffect(theme))\n\n return flatMapObject(colors, (name, color) => {\n const varName: keyof CSSVariables = `${COLOR_PREFIX}${name}`\n\n return [\n [varName, color],\n\n ...effects.map<[CSSVariableName, Material]>(([type, effect]) => [\n `${varName}--${type}`,\n applyEffect(color, effect),\n ]),\n ]\n })\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { camelToKebab } from '../util'\nimport { GradientMaterial } from '@charcoal-ui/foundation'\nimport { ThemeColorGradient } from '@charcoal-ui/theme'\nimport {\n applyEffectToGradient,\n flatMapObject,\n gradient,\n GradientDirection,\n mapKeys,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { Values } from '../types'\nimport { MergedEffect } from '../foundation'\n\nconst VAR_PREFIX = '--tailwind-gradient-'\n\nexport default function cssVariableColorPlugin(\n gradients: ThemeColorGradient,\n effects: MergedEffect,\n selectorOrMediaQuery: string,\n) {\n const utilities = getUtilities(gradients, effects)\n\n const classRules = mapObject(utilities, (name) => [\n `.bg-${name}`,\n { backgroundImage: `var(${VAR_PREFIX}${name})` },\n ])\n\n return plugin(({ addBase, addUtilities }) => {\n const css = mapKeys(utilities, (name) => `${VAR_PREFIX}${name}`)\n if (selectorOrMediaQuery.startsWith('@media')) {\n addBase({\n [selectorOrMediaQuery]: {\n ':root': css,\n },\n })\n } else {\n addBase({\n [selectorOrMediaQuery]: css,\n })\n }\n\n addUtilities(classRules, {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n })\n })\n}\n\nconst DIRECTIONS = {\n 'to top': 'top',\n 'to bottom': 'bottom',\n 'to left': 'left',\n 'to right': 'right',\n} as const\n\n/**\n * こういう感じのやつ。この時点では `--tailwind-gradient-` のような CSS 変数名になってない\n *\n * ```js\n * {\n * 'hoge1': 'linear-gradient(to top, ...)',\n * ...\n * }\n * ```\n */\ntype Utilities = Record<string, LinearGradient>\n\ntype LinearGradient = `linear-gradient(${string})`\n\nexport function getUtilities(\n gradients: Record<string, GradientMaterial>,\n effect: MergedEffect,\n): Utilities {\n const effects = Object.entries(effect)\n const directions = Object.entries(DIRECTIONS) as [\n GradientDirection,\n Values<typeof DIRECTIONS>,\n ][]\n\n return flatMapObject(gradients, (name, colors) =>\n directions.flatMap(([direction, className]) => {\n const toLinearGradient = (colors: GradientMaterial) => {\n const style = gradient(direction)(colors)\n\n if (!('backgroundImage' in style)) {\n throw new Error(\n `Could not generate linear-gradient() from ${name} ${direction} ${className}`,\n )\n }\n\n // 本当は backgroundColor も同時に生成されるんだけど、使うにはそれ用の CSS 変数も一緒に作らないといけない\n // とりあえず background-image だけで動くのでこっちだけを利用する\n return style.backgroundImage as LinearGradient\n }\n\n return [\n // こういう感じのやつ\n // { 'hoge1': 'linear-gradient(to top, ...)' }\n [createUtilityName(name, className), toLinearGradient(colors)],\n\n // こういう感じのやつ\n // { 'hoge1--hover': 'linear-gradient(to top, ...)' }\n ...effects.map<[string, LinearGradient]>(([effectName, effect]) => [\n createUtilityName(name, className, effectName),\n toLinearGradient(applyEffectToGradient(effect)(colors)),\n ]),\n ]\n }),\n )\n}\n\nfunction createUtilityName(\n gradientName: string,\n direction: Values<typeof DIRECTIONS>,\n suffix = '',\n) {\n return [camelToKebab(gradientName), direction, suffix]\n .filter(Boolean)\n .join('-')\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { TypographyDescriptor, TYPOGRAPHY_SIZE } from '@charcoal-ui/foundation'\nimport { halfLeading, mapObject, px } from '@charcoal-ui/utils'\n\nconst leadingCancel = {\n display: 'block',\n width: 0,\n height: 0,\n content: '\"\"',\n}\n\nconst typographyStyle = (style: TypographyDescriptor) => {\n const margin = -halfLeading(style)\n\n return {\n 'font-size': px(style.fontSize),\n 'line-height': px(style.lineHeight),\n\n /**\n * cancel leading\n *\n * @see https://yuyakinoshita.com/blog/2020/01/20/line-height-crop/\n */\n '&::before': {\n ...leadingCancel,\n marginTop: px(margin),\n },\n '&::after': {\n ...leadingCancel,\n marginBottom: px(margin),\n },\n }\n}\n\nconst typographyPlugin = plugin(({ addUtilities }) => {\n const typographyClasses = mapObject(TYPOGRAPHY_SIZE, (fontSize, style) => [\n `.typography-${fontSize}`,\n typographyStyle(style),\n ])\n\n addUtilities(\n {\n ...typographyClasses,\n '.preserve-half-leading': {\n '&::before': {\n content: 'none',\n },\n '&::after': {\n content: 'none',\n },\n },\n },\n {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n },\n )\n})\n\nexport default typographyPlugin\n","import light from '@charcoal-ui/theme/unstable-tokens/css-variables.json' with { type: 'json' }\nimport type { Config } from 'tailwindcss'\nimport {\n flattenKey as flattenKeys,\n flattenKeyWithoutDefault,\n mapDefaultKey as mapDefaultKeys,\n} from './util'\n\nexport function unstable_createTailwindConfigTokenV2(): Omit<\n Config,\n 'content'\n> {\n const fontSize = Object.fromEntries(\n Object.entries(light.text['font-size']).flatMap(([k, v]) => {\n // text.fontSize.paragraph + text.lineHeight.paragraph -> text-paragraph\n if (typeof v === 'string') {\n return [\n [\n k,\n [\n v,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k] },\n ],\n ],\n ]\n }\n\n // text.fontSize.heading.s + text.lineHeight.heading.s -> text-heading-s\n return Object.entries(v as Record<string, string>).map(([kk, vv]) => {\n return [\n [k, kk].join('-'),\n [\n vv,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k][kk] },\n ],\n ]\n })\n }),\n ) as NonNullable<Config['theme']>['fontSize']\n\n // space.target.s -> p-target-s\n // space.gap.gapButtons -> p-gap-buttons\n const spacing = flattenKeys(light.space, (key) => !/(gap|padding)/.test(key))\n // color.container.default -> bg-container\n // color.container.hover -> bg-container-hover\n const colors = mapDefaultKeys(light.color)\n\n const config: Omit<Config, 'content'> = {\n darkMode: 'media',\n theme: {\n // borderWidth.m -> border-m\n // borderWidth.focus.1 -> border-focus-1\n borderWidth: flattenKeyWithoutDefault({\n 'width-ch': flattenKeys(light['border-width']), // unstable border width token\n }),\n borderRadius: light.radius,\n borderColor: flattenKeyWithoutDefault({ ch: flattenKeys(colors.border) }),\n\n colors,\n\n fontSize,\n fontWeight: flattenKeys({ ch: light.text['font-weight'] }),\n\n spacing,\n gap: spacing,\n width: light['paragraph-width'],\n },\n }\n\n return config\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport iconsV2 from '@charcoal-ui/icon-files/v2/datauri'\nimport iconsV1 from '@charcoal-ui/icon-files/v1/datauri'\nimport { CSSRuleObject } from 'tailwindcss/types/config'\n\nconst transformClassNameV2 = (fileName: string) => {\n const [size, variant, name] = fileName.split('/')\n return [\n '.icon-v2',\n name.replaceAll('.', '-'),\n ...(variant === 'regular' ? [] : [variant]),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nconst transformClassNameV1 = (fileName: string) => {\n const [size, name] = fileName.split('/')\n return [\n '.icon-v1',\n name.replaceAll('.', '-'),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nexport const createIconUtilities = ({\n v2 = false,\n}: {\n v2?: boolean\n}): {\n [key: string]: CSSRuleObject\n} => {\n const newUtilities: { [key: string]: CSSRuleObject } = {}\n const icons = v2 ? iconsV2 : iconsV1\n for (const [fileName, { uri, isSetCurrentcolor }] of Object.entries(icons)) {\n const className = v2\n ? transformClassNameV2(fileName)\n : transformClassNameV1(fileName)\n\n newUtilities[className] = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n maskImage: `url(${uri})`,\n maskSize: '100% 100%',\n background: isSetCurrentcolor ? 'currentColor' : null,\n aspectRatio: '1/1',\n }\n }\n return newUtilities\n}\n\nexport const charcoalIconsV2: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: true }))\n },\n)\n\nexport const charcoalIconsV1: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: false }))\n },\n)\n","import { GRID_COUNT, mergeEffect } from './foundation'\n\nimport type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\nimport {\n assertAllThemeHaveSameKeys,\n getDefaultKeyName,\n getVariantOption,\n} from './util'\nimport {\n COLUMN_UNIT,\n GUTTER_UNIT,\n SPACING,\n BORDER_RADIUS,\n} from '@charcoal-ui/foundation'\nimport { light } from '@charcoal-ui/theme'\nimport { mapObject, px } from '@charcoal-ui/utils'\nimport { colorsToTailwindConfig } from './colors/toTailwindConfig'\n\nimport cssVariableColorPlugin from './colors/plugin'\nimport cssVariableGradientPlugin from './gradient/plugin'\nimport typographyPlugin from './typography/plugin'\nimport { unstable_createTailwindConfigTokenV2 } from './tokenV2'\nimport { charcoalIconsV1, charcoalIconsV2 } from './icons'\nexport { unstable_createTailwindConfigTokenV2 }\n\ninterface Options {\n version?: TailwindVersion\n theme?: ThemeMap\n cssVariablesV1?: boolean\n unstableTokenV2?: boolean\n iconsV2?: boolean\n iconsV1?: boolean\n}\n\nexport function createTailwindConfig({\n theme = { ':root': light },\n version = 'v3',\n cssVariablesV1 = true,\n unstableTokenV2 = false,\n iconsV2 = false,\n iconsV1 = false,\n}: Options): Omit<Config, 'content'> {\n assertAllThemeHaveSameKeys(theme)\n\n const defaultTheme = theme[':root']\n const effects = mergeEffect(defaultTheme)\n const DEFAULT = getDefaultKeyName(version)\n\n const {\n borderWidth: borderWidthV2,\n borderRadius: borderRadiusV2,\n borderColor: borderColorV2,\n colors: colorsV2,\n fontSize: fontSizeV2,\n fontWeight: fontWeightV2,\n spacing: spacingV2,\n gap: gapV2,\n width: widthV2,\n }: Partial<NonNullable<Config['theme']>> = unstableTokenV2\n ? unstable_createTailwindConfigTokenV2().theme\n : {}\n\n return {\n theme: {\n screens: {\n screen1: px(0),\n screen2: px(defaultTheme.breakpoint.screen1),\n screen3: px(defaultTheme.breakpoint.screen2),\n screen4: px(defaultTheme.breakpoint.screen3),\n screen5: px(defaultTheme.breakpoint.screen4),\n },\n colors: {\n // @deprecated\n black: '#000',\n\n // @deprecated\n white: '#fff',\n\n transparent: 'transparent',\n current: 'currentColor',\n ...colorsToTailwindConfig(version, defaultTheme.color, effects),\n ...colorsV2,\n },\n borderColor: {\n ...colorsToTailwindConfig(\n version,\n mapObject(defaultTheme.border, (k, v) => [k, v.color]),\n effects,\n ),\n ...borderColorV2,\n },\n spacing: {\n ...mapObject(\n SPACING,\n (name, pixel) => [name, px(pixel)] as [string, string],\n ),\n ...spacingV2,\n },\n width: {\n full: '100%',\n screen: '100vw',\n auto: 'auto',\n fit: 'fit-content',\n\n /**\n * generates classes like \"w-col-span-1\"\n */\n ...Array.from({ length: GRID_COUNT }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`col-span-${i}`]: px(COLUMN_UNIT * i + GUTTER_UNIT * (i - 1)),\n }),\n {},\n ),\n\n /**\n * generates classes like \"w-1/12\" (except for 12/12, which just equals to w-full)\n */\n ...Array.from({ length: GRID_COUNT - 1 }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`${i}/${GRID_COUNT}`]: `${(i / GRID_COUNT) * 100}%`,\n }),\n {},\n ),\n ...widthV2,\n },\n gap: {\n fixed: px(GUTTER_UNIT),\n ...gapV2,\n },\n borderRadius: {\n ...mapObject(\n BORDER_RADIUS,\n (name, value) => [name, px(value)] as [string, string],\n ),\n ...borderRadiusV2,\n },\n transitionDuration: {\n [DEFAULT]: '0.2s',\n },\n ...(unstableTokenV2\n ? {\n extend: {\n borderWidth: borderWidthV2,\n fontWeight: fontWeightV2,\n fontSize: fontSizeV2,\n },\n }\n : {}),\n },\n\n ...getVariantOption(version),\n\n corePlugins: {\n lineHeight: false,\n },\n plugins: [\n typographyPlugin,\n cssVariableColorPlugin(theme, Boolean(cssVariablesV1)),\n\n ...Object.entries(theme).map(([selectorOrMediaQuery, theme]) =>\n cssVariableGradientPlugin(\n theme.gradientColor,\n mergeEffect(theme),\n selectorOrMediaQuery,\n ),\n ),\n ...(iconsV2 ? [charcoalIconsV2] : []),\n ...(iconsV1 ? [charcoalIconsV1] : []),\n ],\n }\n}\n\nexport const config: Omit<Config, 'content'> = createTailwindConfig({})\n\nexport default config\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAa,aAAa;AAE1B,SAAgB,YAAY,EAC1B,eACA,UACwD;AACxD,QAAO;EACL,GAAG;EACH,GAAG;EACH,SAAS;GACP,MAAM;GACN,SAAS;GACV;EACF;;;;;;;;;;ACRH,SAAgB,kBAAkB,SAA0B;AAC1D,SAAQ,SAAR;EACE,KAAK;EACL,KAAK,KACH,QAAO;EAGT,KAAK,KACH,QAAO;;;AAKb,SAAgB,iBAAiB,SAA2C;AAC1E,SAAQ,SAAR;EACE,KAAK,KAIH,QAAO,EAAE;EAGX,KAAK;EACL,KAAK,KACH,QAAO,EAAE,UAAU,EAAE,EAAE;;;AAK7B,SAAS,UAAa,GAAW,GAAW;AAC1C,QAAO,EAAE,SAAS,EAAE,QA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M;IACN,KAAK;IAKL,GAAG,MAAM,KAAK,EAAE,QAAQ,YAAY,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC,QACpD,QAAQ,OAAO;KACd,GAAG;MACF,YAAY,iCAASC,sCAAc,IAAIC,uCAAe,IAAI,GAAG;KAC/D,GACD,EAAE,CACH;IAKD,GAAG,MAAM,KAAK,EAAE,QAAQ,aAAa,GAAG,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC,QACxD,QAAQ,OAAO;KACd,GAAG;MACF,GAAG,EAAE,GAAG,eAAe,GAAI,IAAI,aAAc,IAAI;KACnD,GACD,EAAE,CACH;IACD,GAAG;IACJ;GACD,KAAK;IACH,kCAAUA,oCAAY;IACtB,GAAG;IACJ;GACD,cAAc;IACZ,qCACEC,wCACC,MAAM,UAAU,CAAC,iCAAS,MAAM,CAAC,CACnC;IACD,GAAG;IACJ;GACD,oBAAoB,GACjB,UAAU,QACZ;GACD,GAAI,kBACA,EACE,QAAQ;IACN,aAAa;IACb,YAAY;IACZ,UAAU;IACX,EACF,GACD,EAAE;GACP;EAED,GAAG,iBAAiB,QAAQ;EAE5B,aAAa,EACX,YAAY,OACb;EACD,SAAS;GACP;GACAC,yBAAuB,OAAO,QAAQ,eAAe,CAAC;GAEtD,GAAG,OAAO,QAAQ,MAAM,CAAC,KAAK,CAAC,sBAAsB,WACnDC,uBACE,MAAM,eACN,YAAY,MAAM,EAClB,qBACD,CACF;GACD,GAAI,UAAU,CAAC,gBAAgB,GAAG,EAAE;GACpC,GAAI,UAAU,CAAC,gBAAgB,GAAG,EAAE;GACrC;EACF;;AAGH,MAAa,SAAkC,qBAAqB,EAAE,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -183,8 +183,8 @@ function withPrefixes(...parts) {
|
|
|
183
183
|
* --tailwind-* また --charcoal-* を生成する
|
|
184
184
|
* TODO: --tailwindをやめる
|
|
185
185
|
*/
|
|
186
|
-
function cssVariableColorPlugin(themeMap, cssVariablesV1) {
|
|
187
|
-
const { ":root": _defaultTheme
|
|
186
|
+
function cssVariableColorPlugin$1(themeMap, cssVariablesV1) {
|
|
187
|
+
const { ":root": _defaultTheme, ...otherThemes } = themeMap;
|
|
188
188
|
const definitions = defineCssVariables(otherThemes);
|
|
189
189
|
return plugin(({ addBase }) => {
|
|
190
190
|
addBase(definitions);
|
|
@@ -210,7 +210,7 @@ function toCssVariables(theme) {
|
|
|
210
210
|
//#endregion
|
|
211
211
|
//#region src/gradient/plugin.ts
|
|
212
212
|
const VAR_PREFIX = "--tailwind-gradient-";
|
|
213
|
-
function cssVariableColorPlugin
|
|
213
|
+
function cssVariableColorPlugin(gradients, effects, selectorOrMediaQuery) {
|
|
214
214
|
const utilities = getUtilities(gradients, effects);
|
|
215
215
|
const classRules = mapObject(utilities, (name) => [`.bg-${name}`, { backgroundImage: `var(${VAR_PREFIX}${name})` }]);
|
|
216
216
|
return plugin(({ addBase, addUtilities }) => {
|
|
@@ -230,12 +230,12 @@ function getUtilities(gradients, effect) {
|
|
|
230
230
|
const effects = Object.entries(effect);
|
|
231
231
|
const directions = Object.entries(DIRECTIONS);
|
|
232
232
|
return flatMapObject(gradients, (name, colors) => directions.flatMap(([direction, className]) => {
|
|
233
|
-
const toLinearGradient = (colors
|
|
234
|
-
const style = gradient(direction)(colors
|
|
233
|
+
const toLinearGradient = (colors) => {
|
|
234
|
+
const style = gradient(direction)(colors);
|
|
235
235
|
if (!("backgroundImage" in style)) throw new Error(`Could not generate linear-gradient() from ${name} ${direction} ${className}`);
|
|
236
236
|
return style.backgroundImage;
|
|
237
237
|
};
|
|
238
|
-
return [[createUtilityName(name, className), toLinearGradient(colors)], ...effects.map(([effectName, effect
|
|
238
|
+
return [[createUtilityName(name, className), toLinearGradient(colors)], ...effects.map(([effectName, effect]) => [createUtilityName(name, className, effectName), toLinearGradient(applyEffectToGradient(effect)(colors))])];
|
|
239
239
|
}));
|
|
240
240
|
}
|
|
241
241
|
function createUtilityName(gradientName, direction, suffix = "") {
|
|
@@ -278,7 +278,6 @@ const typographyPlugin = plugin(({ addUtilities }) => {
|
|
|
278
278
|
}
|
|
279
279
|
}, { variants: ["responsive"] });
|
|
280
280
|
});
|
|
281
|
-
var plugin_default = typographyPlugin;
|
|
282
281
|
|
|
283
282
|
//#endregion
|
|
284
283
|
//#region src/tokenV2.ts
|
|
@@ -352,7 +351,7 @@ const charcoalIconsV1 = plugin(({ addUtilities }) => {
|
|
|
352
351
|
|
|
353
352
|
//#endregion
|
|
354
353
|
//#region src/index.ts
|
|
355
|
-
function createTailwindConfig({ theme = { ":root": light }, version = "v3", cssVariablesV1 = true, unstableTokenV2 = false, iconsV2
|
|
354
|
+
function createTailwindConfig({ theme = { ":root": light }, version = "v3", cssVariablesV1 = true, unstableTokenV2 = false, iconsV2 = false, iconsV1 = false }) {
|
|
356
355
|
assertAllThemeHaveSameKeys(theme);
|
|
357
356
|
const defaultTheme = theme[":root"];
|
|
358
357
|
const effects = mergeEffect(defaultTheme);
|
|
@@ -416,17 +415,16 @@ function createTailwindConfig({ theme = { ":root": light }, version = "v3", cssV
|
|
|
416
415
|
...getVariantOption(version),
|
|
417
416
|
corePlugins: { lineHeight: false },
|
|
418
417
|
plugins: [
|
|
419
|
-
|
|
420
|
-
cssVariableColorPlugin(theme, Boolean(cssVariablesV1)),
|
|
421
|
-
...Object.entries(theme).map(([selectorOrMediaQuery, theme
|
|
422
|
-
...iconsV2
|
|
423
|
-
...iconsV1
|
|
418
|
+
typographyPlugin,
|
|
419
|
+
cssVariableColorPlugin$1(theme, Boolean(cssVariablesV1)),
|
|
420
|
+
...Object.entries(theme).map(([selectorOrMediaQuery, theme]) => cssVariableColorPlugin(theme.gradientColor, mergeEffect(theme), selectorOrMediaQuery)),
|
|
421
|
+
...iconsV2 ? [charcoalIconsV2] : [],
|
|
422
|
+
...iconsV1 ? [charcoalIconsV1] : []
|
|
424
423
|
]
|
|
425
424
|
};
|
|
426
425
|
}
|
|
427
426
|
const config = createTailwindConfig({});
|
|
428
|
-
var src_default = config;
|
|
429
427
|
|
|
430
428
|
//#endregion
|
|
431
|
-
export { config,
|
|
429
|
+
export { config, config as default, createTailwindConfig, unstable_createTailwindConfigTokenV2 };
|
|
432
430
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["varName: keyof CSSVariables","cssVariableColorPlugin","colors","effect","light","flattenKeys","mapDefaultKeys","newUtilities: { [key: string]: CSSRuleObject }","charcoalIconsV2: ReturnType<typeof plugin>","charcoalIconsV1: ReturnType<typeof plugin>","typographyPlugin","theme","cssVariableGradientPlugin","iconsV2","iconsV1","config: Omit<Config, 'content'>"],"sources":["../src/foundation.ts","../src/util.ts","../src/colors/utils.ts","../src/colors/toTailwindConfig.ts","../src/colors/pluginTokenV1.ts","../src/colors/plugin.ts","../src/gradient/plugin.ts","../src/typography/plugin.ts","../src/tokenV2.ts","../src/icons.ts","../src/index.ts"],"sourcesContent":["import { Effect } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\n\nexport const GRID_COUNT = 12\n\nexport function mergeEffect({\n elementEffect,\n effect,\n}: Pick<Theme, 'elementEffect' | 'effect'>): MergedEffect {\n return {\n ...elementEffect,\n ...effect,\n outline: {\n type: 'opacity',\n opacity: 0.32,\n } as Effect,\n }\n}\n\nexport type MergedEffect = Record<string, Effect>\n","import type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\n/**\n * the key \"default\" or \"DEFAULT\" has special meaning and dropped from class name\n *\n * @see https://tailwindcss.com/docs/upgrading-to-v2#update-default-theme-keys-to-default\n */\nexport function getDefaultKeyName(version: TailwindVersion) {\n switch (version) {\n case 'v3':\n case 'v2': {\n return 'DEFAULT'\n }\n\n case 'v1': {\n return 'default'\n }\n }\n}\n\nexport function getVariantOption(version: TailwindVersion): Partial<Config> {\n switch (version) {\n case 'v3': {\n // v3 以上では variants は variantOrders に改名された\n // そしてこれは上書きをしたいモチベがない\n // https://v2.tailwindcss.com/docs/configuration#variant-order\n return {}\n }\n\n case 'v2':\n case 'v1': {\n return { variants: {} }\n }\n }\n}\n\nfunction setEquals<T>(a: Set<T>, b: Set<T>) {\n return a.size === b.size && Array.from(a).every((value) => b.has(value))\n}\n\nexport function assertAllThemeHaveSameKeys(themeMap: ThemeMap): void {\n const defaultTheme = themeMap[':root']\n const expectedColorKeys = new Set(Object.keys(defaultTheme.color))\n const expectedEffectKeys = new Set(Object.keys(defaultTheme.effect))\n\n for (const [name, theme] of Object.entries(themeMap)) {\n const colorKeys = new Set(Object.keys(theme.color))\n const effectKeys = new Set(Object.keys(theme.effect))\n\n if (!setEquals(colorKeys, expectedColorKeys)) {\n throw new Error(`:root and ${name} does not have same colors.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedColorKeys))}\nGot: ${JSON.stringify(Array.from(colorKeys))}`)\n }\n\n if (!setEquals(effectKeys, expectedEffectKeys)) {\n throw new Error(`:root and ${name} does not have same effects.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedEffectKeys))}\nGot: ${JSON.stringify(Array.from(effectKeys))}`)\n }\n }\n}\n\nexport function camelToKebab(value: string) {\n return value\n .replace(/(?<small>[\\da-z]|(?=[A-Z]))(?<capital>[A-Z])/gu, '$1-$2')\n .toLowerCase()\n}\n\nexport const mapDefaultKey = <O extends object>(o: O) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(JSON.stringify(o), function reviver(k: string, v: string) {\n if (k === 'default') {\n const DefaultKey = getDefaultKeyName('v3')\n this[DefaultKey] = v\n return undefined\n }\n return v\n })\n}\n\nexport const flattenKey = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n return [(join?.(key) ?? true) ? [key, kk].join('-') : kk, vv]\n })\n }),\n )\n}\n\n/**\n * `DEFAULT` はkey名に結合しない\n */\nexport const flattenKeyWithoutDefault = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n const isDefaultKey = kk === 'DEFAULT' || kk === 'default'\n const outputKey = isDefaultKey\n ? key\n : (join?.(key) ?? true)\n ? [key, kk].join('-')\n : kk\n return [outputKey, vv]\n })\n }),\n )\n}\n","import { GradientMaterial, Material } from '@charcoal-ui/foundation'\n\nexport const COLOR_PREFIX = '--tailwind-color-'\n\nexport function isSingleColor(color: AnyColor): color is Material {\n return typeof color === 'string'\n}\n\ntype AnyColor = Material | GradientMaterial\n\nexport type AnyColorTheme = Record<string, AnyColor>\n","import { Material } from '@charcoal-ui/foundation'\nimport { applyEffect, filterObject, mapObject } from '@charcoal-ui/utils'\nimport type { Config } from 'tailwindcss'\nimport { MergedEffect } from '../foundation'\n\nimport { TailwindVersion } from '../types'\nimport { getDefaultKeyName } from '../util'\n\nimport { AnyColorTheme, COLOR_PREFIX, isSingleColor } from './utils'\n\nexport function colorsToTailwindConfig(\n version: TailwindVersion,\n colors: AnyColorTheme,\n effects: MergedEffect,\n): NonNullable<Config['theme']>['colors'] {\n const targetColors = filterObject(colors, isSingleColor)\n const DEFAULT = getDefaultKeyName(version)\n\n /**\n * こういう感じのを吐き出す\n *\n * ```js\n * {\n * DEFAULT: 'var(--tailwind-color-hoge1, #fff)',\n * hover: 'var(--tailwind-color-hoge1--hover, #eee)',\n * press: 'var(--tailwind-color-hoge1--press, #ddd)',\n * disabled: 'var(--tailwind-color-hoge1--disabled, #eee)',\n * }\n * ```\n */\n function colorsForAllEffects(name: string, color: Material) {\n const varName = `${COLOR_PREFIX}${name}`\n\n return {\n [DEFAULT]: `var(${varName}, ${color})`,\n\n ...mapObject(effects, (effectName, effect) => [\n effectName,\n `var(${varName}--${effectName}, ${applyEffect(color, effect)})`,\n ]),\n }\n }\n\n return mapObject(targetColors, (name, color) => [\n name,\n colorsForAllEffects(name, color),\n ])\n}\n","import {\n applyEffect,\n customPropertyToken,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { ThemeMap } from '../types'\nimport {\n CharcoalAbstractTheme,\n EffectType,\n Key,\n CharcoalTheme as Theme,\n} from '@charcoal-ui/theme'\n\nexport function defineCssVariablesV1(themeMap: ThemeMap) {\n // @ts-expect-error FIXME\n return mapObject(themeMap, (key, theme) => {\n if (key.startsWith('@media')) {\n return [\n key,\n {\n ':root': defineColorVariableCSS(theme),\n },\n ]\n } else {\n return [key, defineColorVariableCSS(theme)]\n }\n })\n}\n\nexport const defineColorVariableCSS = (theme: Theme) => {\n const borders = mapObject(theme.border, (name, { color }) => [\n // REVIEW: もしtheme.colorにたまたまborder-〇〇で始まる色名がいたら被りうる\n withPrefixes('border', name),\n color,\n ])\n\n const colors = defineThemeVariables({ ...theme.color, ...borders })({ theme })\n return colors\n}\n\n/**\n * Check whether a value is non-null and non-undefined\n *\n * @param value nullable\n */\nexport const isPresent = <T>(value: T): value is NonNullable<T> => value != null\n\n/**\n * 子孫要素で使われるカラーテーマの CSS Variables を上書きする\n *\n * @params colorParams - 上書きしたい色の定義( `theme.color` の一部だけ書けば良い )\n * @params effectParams - effect の定義を上書きしたい場合は渡す(必須ではない)\n *\n * @example\n * ```tsx\n * const LocalTheme = styled.div`\n * ${defineThemeVariables({ text1: '#ff0000' })}\n * // `text1` is now defined as red\n * ${theme((o) => [o.font.text1])}\n * `\n * ```\n */\nexport function defineThemeVariables(\n colorParams: Partial<CharcoalAbstractTheme['color']>,\n effectParams?: Partial<CharcoalAbstractTheme['effect']>,\n) {\n return function toCssObject(props: {\n theme: Pick<CharcoalAbstractTheme, 'effect'>\n }) {\n const colors = filterObject(colorParams, isPresent)\n\n // flatMapObject の中で毎回 Object.entries を呼ぶのは無駄なので外で呼ぶ\n const effects = Object.entries({\n ...props.theme.effect,\n ...effectParams,\n })\n\n return flatMapObject(colors, (colorKey, color) => [\n [customPropertyToken(colorKey), color],\n\n ...effects.map<[string, string]>(([effectKey, effect]) => [\n customPropertyToken(colorKey, [effectKey]),\n applyEffect(color, [effect]),\n ]),\n ])\n }\n}\n\nexport function isSupportedEffect(effect: Key): effect is EffectType {\n return ['hover', 'press', 'disabled'].includes(effect as string)\n}\n\nexport const variable = (value: string) => `var(${value})`\n\nexport function withPrefixes(...parts: string[]) {\n return parts.join('-')\n}\n","import { Material } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\nimport {\n applyEffect,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport plugin from 'tailwindcss/plugin.js'\nimport { mergeEffect } from '../foundation'\nimport { CSSVariableName, CSSVariables, Definition, ThemeMap } from '../types'\nimport { COLOR_PREFIX, isSingleColor } from './utils'\nimport { defineCssVariablesV1 } from './pluginTokenV1'\n\n/**\n * --tailwind-* また --charcoal-* を生成する\n * TODO: --tailwindをやめる\n */\nexport default function cssVariableColorPlugin(\n themeMap: ThemeMap,\n cssVariablesV1: boolean,\n): ReturnType<typeof plugin> {\n // `:root` 以外のケースで各 CSS Variable がどういう値を取るかを定義する\n const { ':root': _defaultTheme, ...otherThemes } = themeMap\n const definitions = defineCssVariables(otherThemes)\n\n return plugin(({ addBase }) => {\n addBase(definitions)\n\n // styledのTokenInjector移植(background処理除く)\n if (cssVariablesV1) {\n const cssVariablesV1 = defineCssVariablesV1(themeMap)\n // @ts-expect-error FIXME\n addBase(cssVariablesV1)\n }\n })\n}\n\nexport function defineCssVariables(themes: Omit<ThemeMap, ':root'>) {\n return mapObject(themes, (selectorOrMediaQuery, theme) => {\n const css = toCssVariables(theme)\n\n if (selectorOrMediaQuery.startsWith('@media')) {\n return [\n selectorOrMediaQuery,\n {\n ':root': css,\n },\n ]\n } else {\n return [selectorOrMediaQuery, css]\n }\n }) as Definition\n}\n\nfunction toCssVariables(theme: Theme): CSSVariables {\n const colors = filterObject(theme.color, isSingleColor)\n const effects = Object.entries(mergeEffect(theme))\n\n return flatMapObject(colors, (name, color) => {\n const varName: keyof CSSVariables = `${COLOR_PREFIX}${name}`\n\n return [\n [varName, color],\n\n ...effects.map<[CSSVariableName, Material]>(([type, effect]) => [\n `${varName}--${type}`,\n applyEffect(color, effect),\n ]),\n ]\n })\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { camelToKebab } from '../util'\nimport { GradientMaterial } from '@charcoal-ui/foundation'\nimport { ThemeColorGradient } from '@charcoal-ui/theme'\nimport {\n applyEffectToGradient,\n flatMapObject,\n gradient,\n GradientDirection,\n mapKeys,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { Values } from '../types'\nimport { MergedEffect } from '../foundation'\n\nconst VAR_PREFIX = '--tailwind-gradient-'\n\nexport default function cssVariableColorPlugin(\n gradients: ThemeColorGradient,\n effects: MergedEffect,\n selectorOrMediaQuery: string,\n) {\n const utilities = getUtilities(gradients, effects)\n\n const classRules = mapObject(utilities, (name) => [\n `.bg-${name}`,\n { backgroundImage: `var(${VAR_PREFIX}${name})` },\n ])\n\n return plugin(({ addBase, addUtilities }) => {\n const css = mapKeys(utilities, (name) => `${VAR_PREFIX}${name}`)\n if (selectorOrMediaQuery.startsWith('@media')) {\n addBase({\n [selectorOrMediaQuery]: {\n ':root': css,\n },\n })\n } else {\n addBase({\n [selectorOrMediaQuery]: css,\n })\n }\n\n addUtilities(classRules, {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n })\n })\n}\n\nconst DIRECTIONS = {\n 'to top': 'top',\n 'to bottom': 'bottom',\n 'to left': 'left',\n 'to right': 'right',\n} as const\n\n/**\n * こういう感じのやつ。この時点では `--tailwind-gradient-` のような CSS 変数名になってない\n *\n * ```js\n * {\n * 'hoge1': 'linear-gradient(to top, ...)',\n * ...\n * }\n * ```\n */\ntype Utilities = Record<string, LinearGradient>\n\ntype LinearGradient = `linear-gradient(${string})`\n\nexport function getUtilities(\n gradients: Record<string, GradientMaterial>,\n effect: MergedEffect,\n): Utilities {\n const effects = Object.entries(effect)\n const directions = Object.entries(DIRECTIONS) as [\n GradientDirection,\n Values<typeof DIRECTIONS>,\n ][]\n\n return flatMapObject(gradients, (name, colors) =>\n directions.flatMap(([direction, className]) => {\n const toLinearGradient = (colors: GradientMaterial) => {\n const style = gradient(direction)(colors)\n\n if (!('backgroundImage' in style)) {\n throw new Error(\n `Could not generate linear-gradient() from ${name} ${direction} ${className}`,\n )\n }\n\n // 本当は backgroundColor も同時に生成されるんだけど、使うにはそれ用の CSS 変数も一緒に作らないといけない\n // とりあえず background-image だけで動くのでこっちだけを利用する\n return style.backgroundImage as LinearGradient\n }\n\n return [\n // こういう感じのやつ\n // { 'hoge1': 'linear-gradient(to top, ...)' }\n [createUtilityName(name, className), toLinearGradient(colors)],\n\n // こういう感じのやつ\n // { 'hoge1--hover': 'linear-gradient(to top, ...)' }\n ...effects.map<[string, LinearGradient]>(([effectName, effect]) => [\n createUtilityName(name, className, effectName),\n toLinearGradient(applyEffectToGradient(effect)(colors)),\n ]),\n ]\n }),\n )\n}\n\nfunction createUtilityName(\n gradientName: string,\n direction: Values<typeof DIRECTIONS>,\n suffix = '',\n) {\n return [camelToKebab(gradientName), direction, suffix]\n .filter(Boolean)\n .join('-')\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { TypographyDescriptor, TYPOGRAPHY_SIZE } from '@charcoal-ui/foundation'\nimport { halfLeading, mapObject, px } from '@charcoal-ui/utils'\n\nconst leadingCancel = {\n display: 'block',\n width: 0,\n height: 0,\n content: '\"\"',\n}\n\nconst typographyStyle = (style: TypographyDescriptor) => {\n const margin = -halfLeading(style)\n\n return {\n 'font-size': px(style.fontSize),\n 'line-height': px(style.lineHeight),\n\n /**\n * cancel leading\n *\n * @see https://yuyakinoshita.com/blog/2020/01/20/line-height-crop/\n */\n '&::before': {\n ...leadingCancel,\n marginTop: px(margin),\n },\n '&::after': {\n ...leadingCancel,\n marginBottom: px(margin),\n },\n }\n}\n\nconst typographyPlugin = plugin(({ addUtilities }) => {\n const typographyClasses = mapObject(TYPOGRAPHY_SIZE, (fontSize, style) => [\n `.typography-${fontSize}`,\n typographyStyle(style),\n ])\n\n addUtilities(\n {\n ...typographyClasses,\n '.preserve-half-leading': {\n '&::before': {\n content: 'none',\n },\n '&::after': {\n content: 'none',\n },\n },\n },\n {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n },\n )\n})\n\nexport default typographyPlugin\n","import light from '@charcoal-ui/theme/unstable-tokens/css-variables.json' with { type: 'json' }\nimport type { Config } from 'tailwindcss'\nimport {\n flattenKey as flattenKeys,\n flattenKeyWithoutDefault,\n mapDefaultKey as mapDefaultKeys,\n} from './util'\n\nexport function unstable_createTailwindConfigTokenV2(): Omit<\n Config,\n 'content'\n> {\n const fontSize = Object.fromEntries(\n Object.entries(light.text['font-size']).flatMap(([k, v]) => {\n // text.fontSize.paragraph + text.lineHeight.paragraph -> text-paragraph\n if (typeof v === 'string') {\n return [\n [\n k,\n [\n v,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k] },\n ],\n ],\n ]\n }\n\n // text.fontSize.heading.s + text.lineHeight.heading.s -> text-heading-s\n return Object.entries(v as Record<string, string>).map(([kk, vv]) => {\n return [\n [k, kk].join('-'),\n [\n vv,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k][kk] },\n ],\n ]\n })\n }),\n ) as NonNullable<Config['theme']>['fontSize']\n\n // space.target.s -> p-target-s\n // space.gap.gapButtons -> p-gap-buttons\n const spacing = flattenKeys(light.space, (key) => !/(gap|padding)/.test(key))\n // color.container.default -> bg-container\n // color.container.hover -> bg-container-hover\n const colors = mapDefaultKeys(light.color)\n\n const config: Omit<Config, 'content'> = {\n darkMode: 'media',\n theme: {\n // borderWidth.m -> border-m\n // borderWidth.focus.1 -> border-focus-1\n borderWidth: flattenKeyWithoutDefault({\n 'width-ch': flattenKeys(light['border-width']), // unstable border width token\n }),\n borderRadius: light.radius,\n borderColor: flattenKeyWithoutDefault({ ch: flattenKeys(colors.border) }),\n\n colors,\n\n fontSize,\n fontWeight: flattenKeys({ ch: light.text['font-weight'] }),\n\n spacing,\n gap: spacing,\n width: light['paragraph-width'],\n },\n }\n\n return config\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport iconsV2 from '@charcoal-ui/icon-files/v2/datauri'\nimport iconsV1 from '@charcoal-ui/icon-files/v1/datauri'\nimport { CSSRuleObject } from 'tailwindcss/types/config'\n\nconst transformClassNameV2 = (fileName: string) => {\n const [size, variant, name] = fileName.split('/')\n return [\n '.icon-v2',\n name.replaceAll('.', '-'),\n ...(variant === 'regular' ? [] : [variant]),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nconst transformClassNameV1 = (fileName: string) => {\n const [size, name] = fileName.split('/')\n return [\n '.icon-v1',\n name.replaceAll('.', '-'),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nexport const createIconUtilities = ({\n v2 = false,\n}: {\n v2?: boolean\n}): {\n [key: string]: CSSRuleObject\n} => {\n const newUtilities: { [key: string]: CSSRuleObject } = {}\n const icons = v2 ? iconsV2 : iconsV1\n for (const [fileName, { uri, isSetCurrentcolor }] of Object.entries(icons)) {\n const className = v2\n ? transformClassNameV2(fileName)\n : transformClassNameV1(fileName)\n\n newUtilities[className] = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n maskImage: `url(${uri})`,\n maskSize: '100% 100%',\n background: isSetCurrentcolor ? 'currentColor' : null,\n aspectRatio: '1/1',\n }\n }\n return newUtilities\n}\n\nexport const charcoalIconsV2: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: true }))\n },\n)\n\nexport const charcoalIconsV1: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: false }))\n },\n)\n","import { GRID_COUNT, mergeEffect } from './foundation'\n\nimport type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\nimport {\n assertAllThemeHaveSameKeys,\n getDefaultKeyName,\n getVariantOption,\n} from './util'\nimport {\n COLUMN_UNIT,\n GUTTER_UNIT,\n SPACING,\n BORDER_RADIUS,\n} from '@charcoal-ui/foundation'\nimport { light } from '@charcoal-ui/theme'\nimport { mapObject, px } from '@charcoal-ui/utils'\nimport { colorsToTailwindConfig } from './colors/toTailwindConfig'\n\nimport cssVariableColorPlugin from './colors/plugin'\nimport cssVariableGradientPlugin from './gradient/plugin'\nimport typographyPlugin from './typography/plugin'\nimport { unstable_createTailwindConfigTokenV2 } from './tokenV2'\nimport { charcoalIconsV1, charcoalIconsV2 } from './icons'\nexport { unstable_createTailwindConfigTokenV2 }\n\ninterface Options {\n version?: TailwindVersion\n theme?: ThemeMap\n cssVariablesV1?: boolean\n unstableTokenV2?: boolean\n iconsV2?: boolean\n iconsV1?: boolean\n}\n\nexport function createTailwindConfig({\n theme = { ':root': light },\n version = 'v3',\n cssVariablesV1 = true,\n unstableTokenV2 = false,\n iconsV2 = false,\n iconsV1 = false,\n}: Options): Omit<Config, 'content'> {\n assertAllThemeHaveSameKeys(theme)\n\n const defaultTheme = theme[':root']\n const effects = mergeEffect(defaultTheme)\n const DEFAULT = getDefaultKeyName(version)\n\n const {\n borderWidth: borderWidthV2,\n borderRadius: borderRadiusV2,\n borderColor: borderColorV2,\n colors: colorsV2,\n fontSize: fontSizeV2,\n fontWeight: fontWeightV2,\n spacing: spacingV2,\n gap: gapV2,\n width: widthV2,\n }: Partial<NonNullable<Config['theme']>> = unstableTokenV2\n ? unstable_createTailwindConfigTokenV2().theme\n : {}\n\n return {\n theme: {\n screens: {\n screen1: px(0),\n screen2: px(defaultTheme.breakpoint.screen1),\n screen3: px(defaultTheme.breakpoint.screen2),\n screen4: px(defaultTheme.breakpoint.screen3),\n screen5: px(defaultTheme.breakpoint.screen4),\n },\n colors: {\n // @deprecated\n black: '#000',\n\n // @deprecated\n white: '#fff',\n\n transparent: 'transparent',\n current: 'currentColor',\n ...colorsToTailwindConfig(version, defaultTheme.color, effects),\n ...colorsV2,\n },\n borderColor: {\n ...colorsToTailwindConfig(\n version,\n mapObject(defaultTheme.border, (k, v) => [k, v.color]),\n effects,\n ),\n ...borderColorV2,\n },\n spacing: {\n ...mapObject(\n SPACING,\n (name, pixel) => [name, px(pixel)] as [string, string],\n ),\n ...spacingV2,\n },\n width: {\n full: '100%',\n screen: '100vw',\n auto: 'auto',\n fit: 'fit-content',\n\n /**\n * generates classes like \"w-col-span-1\"\n */\n ...Array.from({ length: GRID_COUNT }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`col-span-${i}`]: px(COLUMN_UNIT * i + GUTTER_UNIT * (i - 1)),\n }),\n {},\n ),\n\n /**\n * generates classes like \"w-1/12\" (except for 12/12, which just equals to w-full)\n */\n ...Array.from({ length: GRID_COUNT - 1 }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`${i}/${GRID_COUNT}`]: `${(i / GRID_COUNT) * 100}%`,\n }),\n {},\n ),\n ...widthV2,\n },\n gap: {\n fixed: px(GUTTER_UNIT),\n ...gapV2,\n },\n borderRadius: {\n ...mapObject(\n BORDER_RADIUS,\n (name, value) => [name, px(value)] as [string, string],\n ),\n ...borderRadiusV2,\n },\n transitionDuration: {\n [DEFAULT]: '0.2s',\n },\n ...(unstableTokenV2\n ? {\n extend: {\n borderWidth: borderWidthV2,\n fontWeight: fontWeightV2,\n fontSize: fontSizeV2,\n },\n }\n : {}),\n },\n\n ...getVariantOption(version),\n\n corePlugins: {\n lineHeight: false,\n },\n plugins: [\n typographyPlugin,\n cssVariableColorPlugin(theme, Boolean(cssVariablesV1)),\n\n ...Object.entries(theme).map(([selectorOrMediaQuery, theme]) =>\n cssVariableGradientPlugin(\n theme.gradientColor,\n mergeEffect(theme),\n selectorOrMediaQuery,\n ),\n ),\n ...(iconsV2 ? [charcoalIconsV2] : []),\n ...(iconsV1 ? [charcoalIconsV1] : []),\n ],\n }\n}\n\nexport const config: Omit<Config, 'content'> = createTailwindConfig({})\n\nexport default config\n"],"mappings":";;;;;;;;;AAGA,MAAa,aAAa;AAE1B,SAAgB,YAAY,EAC1B,eACA,UACwD;AACxD,QAAO;EACL,GAAG;EACH,GAAG;EACH,SAAS;GACP,MAAM;GACN,SAAS;GACV;EACF;;;;;;;;;;ACRH,SAAgB,kBAAkB,SAA0B;AAC1D,SAAQ,SAAR;EACE,KAAK;EACL,KAAK,KACH,QAAO;EAGT,KAAK,KACH,QAAO;;;AAKb,SAAgB,iBAAiB,SAA2C;AAC1E,SAAQ,SAAR;EACE,KAAK,KAIH,QAAO,EAAE;EAGX,KAAK;EACL,KAAK,KACH,QAAO,EAAE,UAAU,EAAE,EAAE;;;AAK7B,SAAS,UAAa,GAAW,GAAW;AAC1C,QAAO,EAAE,SAAS,EAAE,QAAQ,MAAM,KAAK,EAAE,CAAC,OAAO,UAAU,EAAE,IAAI,MAAM,CAAC;;AAG1E,SAAgB,2BAA2B,UAA0B;CACnE,MAAM,eAAe,SAAS;CAC9B,MAAM,oBAAoB,IAAI,IAAI,OAAO,KAAK,aAAa,MAAM,CAAC;CAClE,MAAM,qBAAqB,IAAI,IAAI,OAAO,KAAK,aAAa,OAAO,CAAC;AAEpE,MAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,SAAS,EAAE;EACpD,MAAM,YAAY,IAAI,IAAI,OAAO,KAAK,MAAM,MAAM,CAAC;EACnD,MAAM,aAAa,IAAI,IAAI,OAAO,KAAK,MAAM,OAAO,CAAC;AAErD,MAAI,CAAC,UAAU,WAAW,kBAAkB,CAC1C,OAAM,IAAI,MAAM,aAAa,KAAK;;qBAEnB,KAAK,UAAU,MAAM,KAAK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AAI,IAAI,aAAc,IAAI;KACnD,GACD,EAAE,CACH;IACD,GAAG;IACJ;GACD,KAAK;IACH,OAAO,GAAG,YAAY;IACtB,GAAG;IACJ;GACD,cAAc;IACZ,GAAG,UACD,gBACC,MAAM,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CACnC;IACD,GAAG;IACJ;GACD,oBAAoB,GACjB,UAAU,QACZ;GACD,GAAI,kBACA,EACE,QAAQ;IACN,aAAa;IACb,YAAY;IACZ,UAAU;IACX,EACF,GACD,EAAE;GACP;EAED,GAAG,iBAAiB,QAAQ;EAE5B,aAAa,EACX,YAAY,OACb;EACD,SAAS;GACPC;GACA,uBAAuB,OAAO,QAAQ,eAAe,CAAC;GAEtD,GAAG,OAAO,QAAQ,MAAM,CAAC,KAAK,CAAC,sBAAsBC,aACnDC,yBACED,QAAM,eACN,YAAYA,QAAM,EAClB,qBACD,CACF;GACD,GAAIE,YAAU,CAAC,gBAAgB,GAAG,EAAE;GACpC,GAAIC,YAAU,CAAC,gBAAgB,GAAG,EAAE;GACrC;EACF;;AAGH,MAAaC,SAAkC,qBAAqB,EAAE,CAAC;AAEvE,kBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["cssVariableColorPlugin","light","flattenKeys","mapDefaultKeys","cssVariableColorPlugin","cssVariableGradientPlugin"],"sources":["../src/foundation.ts","../src/util.ts","../src/colors/utils.ts","../src/colors/toTailwindConfig.ts","../src/colors/pluginTokenV1.ts","../src/colors/plugin.ts","../src/gradient/plugin.ts","../src/typography/plugin.ts","../src/tokenV2.ts","../src/icons.ts","../src/index.ts"],"sourcesContent":["import { Effect } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\n\nexport const GRID_COUNT = 12\n\nexport function mergeEffect({\n elementEffect,\n effect,\n}: Pick<Theme, 'elementEffect' | 'effect'>): MergedEffect {\n return {\n ...elementEffect,\n ...effect,\n outline: {\n type: 'opacity',\n opacity: 0.32,\n } as Effect,\n }\n}\n\nexport type MergedEffect = Record<string, Effect>\n","import type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\n/**\n * the key \"default\" or \"DEFAULT\" has special meaning and dropped from class name\n *\n * @see https://tailwindcss.com/docs/upgrading-to-v2#update-default-theme-keys-to-default\n */\nexport function getDefaultKeyName(version: TailwindVersion) {\n switch (version) {\n case 'v3':\n case 'v2': {\n return 'DEFAULT'\n }\n\n case 'v1': {\n return 'default'\n }\n }\n}\n\nexport function getVariantOption(version: TailwindVersion): Partial<Config> {\n switch (version) {\n case 'v3': {\n // v3 以上では variants は variantOrders に改名された\n // そしてこれは上書きをしたいモチベがない\n // https://v2.tailwindcss.com/docs/configuration#variant-order\n return {}\n }\n\n case 'v2':\n case 'v1': {\n return { variants: {} }\n }\n }\n}\n\nfunction setEquals<T>(a: Set<T>, b: Set<T>) {\n return a.size === b.size && Array.from(a).every((value) => b.has(value))\n}\n\nexport function assertAllThemeHaveSameKeys(themeMap: ThemeMap): void {\n const defaultTheme = themeMap[':root']\n const expectedColorKeys = new Set(Object.keys(defaultTheme.color))\n const expectedEffectKeys = new Set(Object.keys(defaultTheme.effect))\n\n for (const [name, theme] of Object.entries(themeMap)) {\n const colorKeys = new Set(Object.keys(theme.color))\n const effectKeys = new Set(Object.keys(theme.effect))\n\n if (!setEquals(colorKeys, expectedColorKeys)) {\n throw new Error(`:root and ${name} does not have same colors.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedColorKeys))}\nGot: ${JSON.stringify(Array.from(colorKeys))}`)\n }\n\n if (!setEquals(effectKeys, expectedEffectKeys)) {\n throw new Error(`:root and ${name} does not have same effects.\n\nExpected( :root ): ${JSON.stringify(Array.from(expectedEffectKeys))}\nGot: ${JSON.stringify(Array.from(effectKeys))}`)\n }\n }\n}\n\nexport function camelToKebab(value: string) {\n return value\n .replace(/(?<small>[\\da-z]|(?=[A-Z]))(?<capital>[A-Z])/gu, '$1-$2')\n .toLowerCase()\n}\n\nexport const mapDefaultKey = <O extends object>(o: O) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(JSON.stringify(o), function reviver(k: string, v: string) {\n if (k === 'default') {\n const DefaultKey = getDefaultKeyName('v3')\n this[DefaultKey] = v\n return undefined\n }\n return v\n })\n}\n\nexport const flattenKey = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n return [(join?.(key) ?? true) ? [key, kk].join('-') : kk, vv]\n })\n }),\n )\n}\n\n/**\n * `DEFAULT` はkey名に結合しない\n */\nexport const flattenKeyWithoutDefault = <O extends object>(\n o: O,\n join?: (key: string) => boolean,\n): Record<string, unknown> => {\n return Object.fromEntries(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.entries(o).flatMap(([key, v]) => {\n if (typeof v === 'string') return [[key, v]]\n return Object.entries(v as object).map(([kk, vv]) => {\n const isDefaultKey = kk === 'DEFAULT' || kk === 'default'\n const outputKey = isDefaultKey\n ? key\n : (join?.(key) ?? true)\n ? [key, kk].join('-')\n : kk\n return [outputKey, vv]\n })\n }),\n )\n}\n","import { GradientMaterial, Material } from '@charcoal-ui/foundation'\n\nexport const COLOR_PREFIX = '--tailwind-color-'\n\nexport function isSingleColor(color: AnyColor): color is Material {\n return typeof color === 'string'\n}\n\ntype AnyColor = Material | GradientMaterial\n\nexport type AnyColorTheme = Record<string, AnyColor>\n","import { Material } from '@charcoal-ui/foundation'\nimport { applyEffect, filterObject, mapObject } from '@charcoal-ui/utils'\nimport type { Config } from 'tailwindcss'\nimport { MergedEffect } from '../foundation'\n\nimport { TailwindVersion } from '../types'\nimport { getDefaultKeyName } from '../util'\n\nimport { AnyColorTheme, COLOR_PREFIX, isSingleColor } from './utils'\n\nexport function colorsToTailwindConfig(\n version: TailwindVersion,\n colors: AnyColorTheme,\n effects: MergedEffect,\n): NonNullable<Config['theme']>['colors'] {\n const targetColors = filterObject(colors, isSingleColor)\n const DEFAULT = getDefaultKeyName(version)\n\n /**\n * こういう感じのを吐き出す\n *\n * ```js\n * {\n * DEFAULT: 'var(--tailwind-color-hoge1, #fff)',\n * hover: 'var(--tailwind-color-hoge1--hover, #eee)',\n * press: 'var(--tailwind-color-hoge1--press, #ddd)',\n * disabled: 'var(--tailwind-color-hoge1--disabled, #eee)',\n * }\n * ```\n */\n function colorsForAllEffects(name: string, color: Material) {\n const varName = `${COLOR_PREFIX}${name}`\n\n return {\n [DEFAULT]: `var(${varName}, ${color})`,\n\n ...mapObject(effects, (effectName, effect) => [\n effectName,\n `var(${varName}--${effectName}, ${applyEffect(color, effect)})`,\n ]),\n }\n }\n\n return mapObject(targetColors, (name, color) => [\n name,\n colorsForAllEffects(name, color),\n ])\n}\n","import {\n applyEffect,\n customPropertyToken,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { ThemeMap } from '../types'\nimport {\n CharcoalAbstractTheme,\n EffectType,\n Key,\n CharcoalTheme as Theme,\n} from '@charcoal-ui/theme'\n\nexport function defineCssVariablesV1(themeMap: ThemeMap) {\n // @ts-expect-error FIXME\n return mapObject(themeMap, (key, theme) => {\n if (key.startsWith('@media')) {\n return [\n key,\n {\n ':root': defineColorVariableCSS(theme),\n },\n ]\n } else {\n return [key, defineColorVariableCSS(theme)]\n }\n })\n}\n\nexport const defineColorVariableCSS = (theme: Theme) => {\n const borders = mapObject(theme.border, (name, { color }) => [\n // REVIEW: もしtheme.colorにたまたまborder-〇〇で始まる色名がいたら被りうる\n withPrefixes('border', name),\n color,\n ])\n\n const colors = defineThemeVariables({ ...theme.color, ...borders })({ theme })\n return colors\n}\n\n/**\n * Check whether a value is non-null and non-undefined\n *\n * @param value nullable\n */\nexport const isPresent = <T>(value: T): value is NonNullable<T> => value != null\n\n/**\n * 子孫要素で使われるカラーテーマの CSS Variables を上書きする\n *\n * @params colorParams - 上書きしたい色の定義( `theme.color` の一部だけ書けば良い )\n * @params effectParams - effect の定義を上書きしたい場合は渡す(必須ではない)\n *\n * @example\n * ```tsx\n * const LocalTheme = styled.div`\n * ${defineThemeVariables({ text1: '#ff0000' })}\n * // `text1` is now defined as red\n * ${theme((o) => [o.font.text1])}\n * `\n * ```\n */\nexport function defineThemeVariables(\n colorParams: Partial<CharcoalAbstractTheme['color']>,\n effectParams?: Partial<CharcoalAbstractTheme['effect']>,\n) {\n return function toCssObject(props: {\n theme: Pick<CharcoalAbstractTheme, 'effect'>\n }) {\n const colors = filterObject(colorParams, isPresent)\n\n // flatMapObject の中で毎回 Object.entries を呼ぶのは無駄なので外で呼ぶ\n const effects = Object.entries({\n ...props.theme.effect,\n ...effectParams,\n })\n\n return flatMapObject(colors, (colorKey, color) => [\n [customPropertyToken(colorKey), color],\n\n ...effects.map<[string, string]>(([effectKey, effect]) => [\n customPropertyToken(colorKey, [effectKey]),\n applyEffect(color, [effect]),\n ]),\n ])\n }\n}\n\nexport function isSupportedEffect(effect: Key): effect is EffectType {\n return ['hover', 'press', 'disabled'].includes(effect as string)\n}\n\nexport const variable = (value: string) => `var(${value})`\n\nexport function withPrefixes(...parts: string[]) {\n return parts.join('-')\n}\n","import { Material } from '@charcoal-ui/foundation'\nimport { CharcoalTheme as Theme } from '@charcoal-ui/theme'\nimport {\n applyEffect,\n filterObject,\n flatMapObject,\n mapObject,\n} from '@charcoal-ui/utils'\nimport plugin from 'tailwindcss/plugin.js'\nimport { mergeEffect } from '../foundation'\nimport { CSSVariableName, CSSVariables, Definition, ThemeMap } from '../types'\nimport { COLOR_PREFIX, isSingleColor } from './utils'\nimport { defineCssVariablesV1 } from './pluginTokenV1'\n\n/**\n * --tailwind-* また --charcoal-* を生成する\n * TODO: --tailwindをやめる\n */\nexport default function cssVariableColorPlugin(\n themeMap: ThemeMap,\n cssVariablesV1: boolean,\n): ReturnType<typeof plugin> {\n // `:root` 以外のケースで各 CSS Variable がどういう値を取るかを定義する\n const { ':root': _defaultTheme, ...otherThemes } = themeMap\n const definitions = defineCssVariables(otherThemes)\n\n return plugin(({ addBase }) => {\n addBase(definitions)\n\n // styledのTokenInjector移植(background処理除く)\n if (cssVariablesV1) {\n const cssVariablesV1 = defineCssVariablesV1(themeMap)\n // @ts-expect-error FIXME\n addBase(cssVariablesV1)\n }\n })\n}\n\nexport function defineCssVariables(themes: Omit<ThemeMap, ':root'>) {\n return mapObject(themes, (selectorOrMediaQuery, theme) => {\n const css = toCssVariables(theme)\n\n if (selectorOrMediaQuery.startsWith('@media')) {\n return [\n selectorOrMediaQuery,\n {\n ':root': css,\n },\n ]\n } else {\n return [selectorOrMediaQuery, css]\n }\n }) as Definition\n}\n\nfunction toCssVariables(theme: Theme): CSSVariables {\n const colors = filterObject(theme.color, isSingleColor)\n const effects = Object.entries(mergeEffect(theme))\n\n return flatMapObject(colors, (name, color) => {\n const varName: keyof CSSVariables = `${COLOR_PREFIX}${name}`\n\n return [\n [varName, color],\n\n ...effects.map<[CSSVariableName, Material]>(([type, effect]) => [\n `${varName}--${type}`,\n applyEffect(color, effect),\n ]),\n ]\n })\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { camelToKebab } from '../util'\nimport { GradientMaterial } from '@charcoal-ui/foundation'\nimport { ThemeColorGradient } from '@charcoal-ui/theme'\nimport {\n applyEffectToGradient,\n flatMapObject,\n gradient,\n GradientDirection,\n mapKeys,\n mapObject,\n} from '@charcoal-ui/utils'\nimport { Values } from '../types'\nimport { MergedEffect } from '../foundation'\n\nconst VAR_PREFIX = '--tailwind-gradient-'\n\nexport default function cssVariableColorPlugin(\n gradients: ThemeColorGradient,\n effects: MergedEffect,\n selectorOrMediaQuery: string,\n) {\n const utilities = getUtilities(gradients, effects)\n\n const classRules = mapObject(utilities, (name) => [\n `.bg-${name}`,\n { backgroundImage: `var(${VAR_PREFIX}${name})` },\n ])\n\n return plugin(({ addBase, addUtilities }) => {\n const css = mapKeys(utilities, (name) => `${VAR_PREFIX}${name}`)\n if (selectorOrMediaQuery.startsWith('@media')) {\n addBase({\n [selectorOrMediaQuery]: {\n ':root': css,\n },\n })\n } else {\n addBase({\n [selectorOrMediaQuery]: css,\n })\n }\n\n addUtilities(classRules, {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n })\n })\n}\n\nconst DIRECTIONS = {\n 'to top': 'top',\n 'to bottom': 'bottom',\n 'to left': 'left',\n 'to right': 'right',\n} as const\n\n/**\n * こういう感じのやつ。この時点では `--tailwind-gradient-` のような CSS 変数名になってない\n *\n * ```js\n * {\n * 'hoge1': 'linear-gradient(to top, ...)',\n * ...\n * }\n * ```\n */\ntype Utilities = Record<string, LinearGradient>\n\ntype LinearGradient = `linear-gradient(${string})`\n\nexport function getUtilities(\n gradients: Record<string, GradientMaterial>,\n effect: MergedEffect,\n): Utilities {\n const effects = Object.entries(effect)\n const directions = Object.entries(DIRECTIONS) as [\n GradientDirection,\n Values<typeof DIRECTIONS>,\n ][]\n\n return flatMapObject(gradients, (name, colors) =>\n directions.flatMap(([direction, className]) => {\n const toLinearGradient = (colors: GradientMaterial) => {\n const style = gradient(direction)(colors)\n\n if (!('backgroundImage' in style)) {\n throw new Error(\n `Could not generate linear-gradient() from ${name} ${direction} ${className}`,\n )\n }\n\n // 本当は backgroundColor も同時に生成されるんだけど、使うにはそれ用の CSS 変数も一緒に作らないといけない\n // とりあえず background-image だけで動くのでこっちだけを利用する\n return style.backgroundImage as LinearGradient\n }\n\n return [\n // こういう感じのやつ\n // { 'hoge1': 'linear-gradient(to top, ...)' }\n [createUtilityName(name, className), toLinearGradient(colors)],\n\n // こういう感じのやつ\n // { 'hoge1--hover': 'linear-gradient(to top, ...)' }\n ...effects.map<[string, LinearGradient]>(([effectName, effect]) => [\n createUtilityName(name, className, effectName),\n toLinearGradient(applyEffectToGradient(effect)(colors)),\n ]),\n ]\n }),\n )\n}\n\nfunction createUtilityName(\n gradientName: string,\n direction: Values<typeof DIRECTIONS>,\n suffix = '',\n) {\n return [camelToKebab(gradientName), direction, suffix]\n .filter(Boolean)\n .join('-')\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport { TypographyDescriptor, TYPOGRAPHY_SIZE } from '@charcoal-ui/foundation'\nimport { halfLeading, mapObject, px } from '@charcoal-ui/utils'\n\nconst leadingCancel = {\n display: 'block',\n width: 0,\n height: 0,\n content: '\"\"',\n}\n\nconst typographyStyle = (style: TypographyDescriptor) => {\n const margin = -halfLeading(style)\n\n return {\n 'font-size': px(style.fontSize),\n 'line-height': px(style.lineHeight),\n\n /**\n * cancel leading\n *\n * @see https://yuyakinoshita.com/blog/2020/01/20/line-height-crop/\n */\n '&::before': {\n ...leadingCancel,\n marginTop: px(margin),\n },\n '&::after': {\n ...leadingCancel,\n marginBottom: px(margin),\n },\n }\n}\n\nconst typographyPlugin = plugin(({ addUtilities }) => {\n const typographyClasses = mapObject(TYPOGRAPHY_SIZE, (fontSize, style) => [\n `.typography-${fontSize}`,\n typographyStyle(style),\n ])\n\n addUtilities(\n {\n ...typographyClasses,\n '.preserve-half-leading': {\n '&::before': {\n content: 'none',\n },\n '&::after': {\n content: 'none',\n },\n },\n },\n {\n // @ts-expect-error FIXME\n variants: ['responsive'],\n },\n )\n})\n\nexport default typographyPlugin\n","import light from '@charcoal-ui/theme/unstable-tokens/css-variables.json' with { type: 'json' }\nimport type { Config } from 'tailwindcss'\nimport {\n flattenKey as flattenKeys,\n flattenKeyWithoutDefault,\n mapDefaultKey as mapDefaultKeys,\n} from './util'\n\nexport function unstable_createTailwindConfigTokenV2(): Omit<\n Config,\n 'content'\n> {\n const fontSize = Object.fromEntries(\n Object.entries(light.text['font-size']).flatMap(([k, v]) => {\n // text.fontSize.paragraph + text.lineHeight.paragraph -> text-paragraph\n if (typeof v === 'string') {\n return [\n [\n k,\n [\n v,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k] },\n ],\n ],\n ]\n }\n\n // text.fontSize.heading.s + text.lineHeight.heading.s -> text-heading-s\n return Object.entries(v as Record<string, string>).map(([kk, vv]) => {\n return [\n [k, kk].join('-'),\n [\n vv,\n // @ts-expect-error k is keyof line-height\n { lineHeight: light.text['line-height'][k][kk] },\n ],\n ]\n })\n }),\n ) as NonNullable<Config['theme']>['fontSize']\n\n // space.target.s -> p-target-s\n // space.gap.gapButtons -> p-gap-buttons\n const spacing = flattenKeys(light.space, (key) => !/(gap|padding)/.test(key))\n // color.container.default -> bg-container\n // color.container.hover -> bg-container-hover\n const colors = mapDefaultKeys(light.color)\n\n const config: Omit<Config, 'content'> = {\n darkMode: 'media',\n theme: {\n // borderWidth.m -> border-m\n // borderWidth.focus.1 -> border-focus-1\n borderWidth: flattenKeyWithoutDefault({\n 'width-ch': flattenKeys(light['border-width']), // unstable border width token\n }),\n borderRadius: light.radius,\n borderColor: flattenKeyWithoutDefault({ ch: flattenKeys(colors.border) }),\n\n colors,\n\n fontSize,\n fontWeight: flattenKeys({ ch: light.text['font-weight'] }),\n\n spacing,\n gap: spacing,\n width: light['paragraph-width'],\n },\n }\n\n return config\n}\n","import plugin from 'tailwindcss/plugin.js'\nimport iconsV2 from '@charcoal-ui/icon-files/v2/datauri'\nimport iconsV1 from '@charcoal-ui/icon-files/v1/datauri'\nimport { CSSRuleObject } from 'tailwindcss/types/config'\n\nconst transformClassNameV2 = (fileName: string) => {\n const [size, variant, name] = fileName.split('/')\n return [\n '.icon-v2',\n name.replaceAll('.', '-'),\n ...(variant === 'regular' ? [] : [variant]),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nconst transformClassNameV1 = (fileName: string) => {\n const [size, name] = fileName.split('/')\n return [\n '.icon-v1',\n name.replaceAll('.', '-'),\n ...(size === '24' ? [] : [size]),\n ]\n .join('-')\n .toLowerCase()\n}\n\nexport const createIconUtilities = ({\n v2 = false,\n}: {\n v2?: boolean\n}): {\n [key: string]: CSSRuleObject\n} => {\n const newUtilities: { [key: string]: CSSRuleObject } = {}\n const icons = v2 ? iconsV2 : iconsV1\n for (const [fileName, { uri, isSetCurrentcolor }] of Object.entries(icons)) {\n const className = v2\n ? transformClassNameV2(fileName)\n : transformClassNameV1(fileName)\n\n newUtilities[className] = {\n display: 'inline-block',\n width: '1em',\n height: '1em',\n maskImage: `url(${uri})`,\n maskSize: '100% 100%',\n background: isSetCurrentcolor ? 'currentColor' : null,\n aspectRatio: '1/1',\n }\n }\n return newUtilities\n}\n\nexport const charcoalIconsV2: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: true }))\n },\n)\n\nexport const charcoalIconsV1: ReturnType<typeof plugin> = plugin(\n ({ addUtilities }) => {\n addUtilities(createIconUtilities({ v2: false }))\n },\n)\n","import { GRID_COUNT, mergeEffect } from './foundation'\n\nimport type { Config } from 'tailwindcss'\nimport { TailwindVersion, ThemeMap } from './types'\n\nimport {\n assertAllThemeHaveSameKeys,\n getDefaultKeyName,\n getVariantOption,\n} from './util'\nimport {\n COLUMN_UNIT,\n GUTTER_UNIT,\n SPACING,\n BORDER_RADIUS,\n} from '@charcoal-ui/foundation'\nimport { light } from '@charcoal-ui/theme'\nimport { mapObject, px } from '@charcoal-ui/utils'\nimport { colorsToTailwindConfig } from './colors/toTailwindConfig'\n\nimport cssVariableColorPlugin from './colors/plugin'\nimport cssVariableGradientPlugin from './gradient/plugin'\nimport typographyPlugin from './typography/plugin'\nimport { unstable_createTailwindConfigTokenV2 } from './tokenV2'\nimport { charcoalIconsV1, charcoalIconsV2 } from './icons'\nexport { unstable_createTailwindConfigTokenV2 }\n\ninterface Options {\n version?: TailwindVersion\n theme?: ThemeMap\n cssVariablesV1?: boolean\n unstableTokenV2?: boolean\n iconsV2?: boolean\n iconsV1?: boolean\n}\n\nexport function createTailwindConfig({\n theme = { ':root': light },\n version = 'v3',\n cssVariablesV1 = true,\n unstableTokenV2 = false,\n iconsV2 = false,\n iconsV1 = false,\n}: Options): Omit<Config, 'content'> {\n assertAllThemeHaveSameKeys(theme)\n\n const defaultTheme = theme[':root']\n const effects = mergeEffect(defaultTheme)\n const DEFAULT = getDefaultKeyName(version)\n\n const {\n borderWidth: borderWidthV2,\n borderRadius: borderRadiusV2,\n borderColor: borderColorV2,\n colors: colorsV2,\n fontSize: fontSizeV2,\n fontWeight: fontWeightV2,\n spacing: spacingV2,\n gap: gapV2,\n width: widthV2,\n }: Partial<NonNullable<Config['theme']>> = unstableTokenV2\n ? unstable_createTailwindConfigTokenV2().theme\n : {}\n\n return {\n theme: {\n screens: {\n screen1: px(0),\n screen2: px(defaultTheme.breakpoint.screen1),\n screen3: px(defaultTheme.breakpoint.screen2),\n screen4: px(defaultTheme.breakpoint.screen3),\n screen5: px(defaultTheme.breakpoint.screen4),\n },\n colors: {\n // @deprecated\n black: '#000',\n\n // @deprecated\n white: '#fff',\n\n transparent: 'transparent',\n current: 'currentColor',\n ...colorsToTailwindConfig(version, defaultTheme.color, effects),\n ...colorsV2,\n },\n borderColor: {\n ...colorsToTailwindConfig(\n version,\n mapObject(defaultTheme.border, (k, v) => [k, v.color]),\n effects,\n ),\n ...borderColorV2,\n },\n spacing: {\n ...mapObject(\n SPACING,\n (name, pixel) => [name, px(pixel)] as [string, string],\n ),\n ...spacingV2,\n },\n width: {\n full: '100%',\n screen: '100vw',\n auto: 'auto',\n fit: 'fit-content',\n\n /**\n * generates classes like \"w-col-span-1\"\n */\n ...Array.from({ length: GRID_COUNT }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`col-span-${i}`]: px(COLUMN_UNIT * i + GUTTER_UNIT * (i - 1)),\n }),\n {},\n ),\n\n /**\n * generates classes like \"w-1/12\" (except for 12/12, which just equals to w-full)\n */\n ...Array.from({ length: GRID_COUNT - 1 }, (_, i) => i + 1).reduce(\n (styles, i) => ({\n ...styles,\n [`${i}/${GRID_COUNT}`]: `${(i / GRID_COUNT) * 100}%`,\n }),\n {},\n ),\n ...widthV2,\n },\n gap: {\n fixed: px(GUTTER_UNIT),\n ...gapV2,\n },\n borderRadius: {\n ...mapObject(\n BORDER_RADIUS,\n (name, value) => [name, px(value)] as [string, string],\n ),\n ...borderRadiusV2,\n },\n transitionDuration: {\n [DEFAULT]: '0.2s',\n },\n ...(unstableTokenV2\n ? {\n extend: {\n borderWidth: borderWidthV2,\n fontWeight: fontWeightV2,\n fontSize: fontSizeV2,\n },\n }\n : {}),\n },\n\n ...getVariantOption(version),\n\n corePlugins: {\n lineHeight: false,\n },\n plugins: [\n typographyPlugin,\n cssVariableColorPlugin(theme, Boolean(cssVariablesV1)),\n\n ...Object.entries(theme).map(([selectorOrMediaQuery, theme]) =>\n cssVariableGradientPlugin(\n theme.gradientColor,\n mergeEffect(theme),\n selectorOrMediaQuery,\n ),\n ),\n ...(iconsV2 ? [charcoalIconsV2] : []),\n ...(iconsV1 ? [charcoalIconsV1] : []),\n ],\n }\n}\n\nexport const config: Omit<Config, 'content'> = createTailwindConfig({})\n\nexport default config\n"],"mappings":";;;;;;;;;AAGA,MAAa,aAAa;AAE1B,SAAgB,YAAY,EAC1B,eACA,UACwD;AACxD,QAAO;EACL,GAAG;EACH,GAAG;EACH,SAAS;GACP,MAAM;GACN,SAAS;GACV;EACF;;;;;;;;;;ACRH,SAAgB,kBAAkB,SAA0B;AAC1D,SAAQ,SAAR;EACE,KAAK;EACL,KAAK,KACH,QAAO;EAGT,KAAK,KACH,QAAO;;;AAKb,SAAgB,iBAAiB,SAA2C;AAC1E,SAAQ,SAAR;EACE,KAAK,KAIH,QAAO,EAAE;EAGX,KAAK;EACL,KAAK,KACH,QAAO,EAAE,UAAU,EAAE,EAAE;;;AAK7B,SAAS,UAAa,GAAW,GAAW;AAC1C,QAAO,EAAE,SAAS,EAAE,QAAQ,MAAM,KAAK,EAAE,CAAC,OAAO,UAAU,EAAE,IAAI,MAAM,CAAC;;AAG1E,SAAgB,2BAA2B,UAA0B;CACnE,MAAM,eAAe,SAAS;CAC9B,MAAM,oBAAoB,IAAI,I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;IACN,QAAQ;IACR,MAAM;IACN,KAAK;IAKL,GAAG,MAAM,KAAK,EAAE,QAAQ,YAAY,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC,QACpD,QAAQ,OAAO;KACd,GAAG;MACF,YAAY,MAAM,GAAG,cAAc,IAAI,eAAe,IAAI,GAAG;KAC/D,GACD,EAAE,CACH;IAKD,GAAG,MAAM,KAAK,EAAE,QAAQ,aAAa,GAAG,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC,QACxD,QAAQ,OAAO;KACd,GAAG;MACF,GAAG,EAAE,GAAG,eAAe,GAAI,IAAI,aAAc,IAAI;KACnD,GACD,EAAE,CACH;IACD,GAAG;IACJ;GACD,KAAK;IACH,OAAO,GAAG,YAAY;IACtB,GAAG;IACJ;GACD,cAAc;IACZ,GAAG,UACD,gBACC,MAAM,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CACnC;IACD,GAAG;IACJ;GACD,oBAAoB,GACjB,UAAU,QACZ;GACD,GAAI,kBACA,EACE,QAAQ;IACN,aAAa;IACb,YAAY;IACZ,UAAU;IACX,EACF,GACD,EAAE;GACP;EAED,GAAG,iBAAiB,QAAQ;EAE5B,aAAa,EACX,YAAY,OACb;EACD,SAAS;GACP;GACAG,yBAAuB,OAAO,QAAQ,eAAe,CAAC;GAEtD,GAAG,OAAO,QAAQ,MAAM,CAAC,KAAK,CAAC,sBAAsB,WACnDC,uBACE,MAAM,eACN,YAAY,MAAM,EAClB,qBACD,CACF;GACD,GAAI,UAAU,CAAC,gBAAgB,GAAG,EAAE;GACpC,GAAI,UAAU,CAAC,gBAAgB,GAAG,EAAE;GACrC;EACF;;AAGH,MAAa,SAAkC,qBAAqB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcoal-ui/tailwind-config",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"tailwindcss": "^3.4.17"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@charcoal-ui/foundation": "5.
|
|
30
|
-
"@charcoal-ui/
|
|
31
|
-
"@charcoal-ui/utils": "5.
|
|
32
|
-
"@charcoal-ui/
|
|
29
|
+
"@charcoal-ui/foundation": "5.7.0",
|
|
30
|
+
"@charcoal-ui/theme": "5.7.0",
|
|
31
|
+
"@charcoal-ui/utils": "5.7.0",
|
|
32
|
+
"@charcoal-ui/icon-files": "5.7.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"csstype": ">=3.0.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"gitHead": "e1ece2e43901ae667afdd5c178040607d939dcd5",
|
|
52
52
|
"scripts": {
|
|
53
|
-
"build": "tsdown
|
|
53
|
+
"build": "tsdown",
|
|
54
54
|
"typecheck": "tsc --project tsconfig.build.json --pretty --noEmit",
|
|
55
55
|
"clean": "rimraf dist .tsbuildinfo",
|
|
56
56
|
"test": "vitest run --passWithNoTests"
|