-
Notifications
You must be signed in to change notification settings - Fork 0
/
panda.config.ts
253 lines (249 loc) · 7.73 KB
/
panda.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
import { defineConfig, definePreset } from '@pandacss/dev';
import { preset as pandaPreset } from '@pandacss/preset-panda';
import { breakpoints, colors, fonts } from './src/design-token';
import { getColorDefinition } from './src/util/pandacss/get-color-definition';
import { mapColorsSemanticTokens } from './src/util/pandacss/map-colors-semantic-tokens';
const preset = definePreset({
...pandaPreset,
conditions: {
p3: '@media (color-gamut: p3)',
srgb: '@media (color-gamut: srgb)',
rec2020: '@media (color-gamut: rec2020)',
dark: "[data-theme='dark'] &",
},
theme: {
...pandaPreset.theme,
breakpoints,
tokens: {
...Object.fromEntries(Object.entries(pandaPreset.theme.tokens).filter(([key]) => key !== 'colors')),
fonts: {
sans: {
value: [
`var(${fonts['noto-sans-jp'].variable})`,
'ui-sans-serif',
'system-ui',
'-apple-system',
'BlinkMacSystemFont',
'"Segoe UI"',
'Roboto',
'"Helvetica Neue"',
'Arial',
'"Noto Sans"',
'sans-serif',
'"Apple Color Emoji"',
'"Segoe UI Emoji"',
'"Segoe UI Symbol"',
'"Noto Color Emoji"',
],
},
mono: {
value: [
`var(${fonts['fira-code'].variable})`,
'ui-monospace',
'SFMono-Regular',
'Menlo',
'Monaco',
'Consolas',
'"Liberation Mono"',
'"Courier New"',
'monospace',
],
},
},
},
semanticTokens: {
colors: {
...mapColorsSemanticTokens(colors),
pure: {
light: {
DEFAULT: {
value: '#ffffff',
},
a: {
0: {
value: '#ffffffff',
},
1: {
value: '#ffffffe6',
},
2: {
value: '#ffffffcc',
},
3: {
value: '#ffffffb3',
},
4: {
value: '#ffffff99',
},
5: {
value: '#ffffff80',
},
6: {
value: '#ffffff66',
},
7: {
value: '#ffffff4d',
},
8: {
value: '#ffffff33',
},
9: {
value: '#ffffff1a',
},
10: {
value: '#ffffff00',
},
},
},
dark: {
DEFAULT: {
value: '#000000',
},
a: {
0: {
value: '#000000ff',
},
1: {
value: '#000000e6',
},
2: {
value: '#000000cc',
},
3: {
value: '#000000b3',
},
4: {
value: '#00000099',
},
5: {
value: '#00000080',
},
6: {
value: '#00000066',
},
7: {
value: '#0000004d',
},
8: {
value: '#00000033',
},
9: {
value: '#0000001a',
},
10: {
value: '#00000000',
},
},
},
a: {
0: {
value: {
base: '{colors.pure.light.a.0}',
_dark: '{colors.pure.dark.a.0}',
},
},
1: {
value: {
base: '{colors.pure.light.a.1}',
_dark: '{colors.pure.dark.a.1}',
},
},
2: {
value: {
base: '{colors.pure.light.a.2}',
_dark: '{colors.pure.dark.a.2}',
},
},
3: {
value: {
base: '{colors.pure.light.a.3}',
_dark: '{colors.pure.dark.a.3}',
},
},
4: {
value: {
base: '{colors.pure.light.a.4}',
_dark: '{colors.pure.dark.a.4}',
},
},
5: {
value: {
base: '{colors.pure.light.a.5}',
_dark: '{colors.pure.dark.a.5}',
},
},
6: {
value: {
base: '{colors.pure.light.a.6}',
_dark: '{colors.pure.dark.a.6}',
},
},
7: {
value: {
base: '{colors.pure.light.a.7}',
_dark: '{colors.pure.dark.a.7}',
},
},
8: {
value: {
base: '{colors.pure.light.a.8}',
_dark: '{colors.pure.dark.a.8}',
},
},
9: {
value: {
base: '{colors.pure.light.a.9}',
_dark: '{colors.pure.dark.a.9}',
},
},
10: {
value: {
base: '{colors.pure.light.a.10}',
_dark: '{colors.pure.dark.a.10}',
},
},
},
},
},
},
},
utilities: {
extend: {
// NOTE: This utility accepts only tokens such as amber.light.1 and amber.dark.p.a.1,
// but not semantic tokens such as amber.1 or pure colors such as pure.light.
bgPattern: {
values: 'colors',
transform: value => {
const color = getColorDefinition(value);
if (!color) {
return undefined;
}
return {
// backgroundImage: `url("data:image/svg+xml,${encodeURIComponent(`
// <svg width="80" height="80" viewBox="0 0 1600 1600" fill="${color}" xmlns="http://www.w3.org/2000/svg">
// <path d="M248.669 157.76C250.444 155.984 250.444 153.106 248.669 151.331C246.894 149.556 244.015 149.556 242.24 151.331L200 193.572L157.76 151.331C155.984 149.556 153.106 149.556 151.331 151.331C149.556 153.106 149.556 155.984 151.331 157.76L193.572 200L151.331 242.24C149.556 244.015 149.556 246.894 151.331 248.669C153.106 250.444 155.984 250.444 157.76 248.669L200 206.428L242.24 248.669C244.015 250.444 246.894 250.444 248.669 248.669C250.444 246.894 250.444 244.015 248.669 242.24L206.428 200L248.669 157.76Z" />
// <path d="M1048.67 957.76C1050.44 955.984 1050.44 953.106 1048.67 951.331C1046.89 949.556 1044.02 949.556 1042.24 951.331L1000 993.572L957.76 951.331C955.984 949.556 953.106 949.556 951.331 951.331C949.556 953.106 949.556 955.984 951.331 957.76L993.572 1000L951.331 1042.24C949.556 1044.02 949.556 1046.89 951.331 1048.67C953.106 1050.44 955.984 1050.44 957.76 1048.67L1000 1006.43L1042.24 1048.67C1044.02 1050.44 1046.89 1050.44 1048.67 1048.67C1050.44 1046.89 1050.44 1044.02 1048.67 1042.24L1006.43 1000L1048.67 957.76Z" />
// </svg>
// `)}")`,
backgroundImage: `url("data:image/svg+xml,${encodeURIComponent(`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" fill="none" stroke="${color}" stroke-dasharray="5 3" transform="scale(1, -1)"><path d="M0 .5H31.5V32"/></svg>
`)}")`,
};
},
},
},
},
});
const config = defineConfig({
presets: [preset],
preflight: true,
minify: true,
importMap: '@/style',
outdir: './src/style',
include: ['./src/**/*.{ts,tsx}'],
watch: true,
// forceConsistentTypeExtension: true,
strictTokens: true,
jsxFramework: 'react',
});
export default config;