-
Notifications
You must be signed in to change notification settings - Fork 0
/
uno.config.js
98 lines (95 loc) · 2.59 KB
/
uno.config.js
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
import { defineConfig, transformerVariantGroup, presetUno } from 'unocss';
import { presetIcons } from '@unocss/preset-icons';
import extractorSvelte from '@unocss/extractor-svelte';
import { colors } from '@unocss/preset-mini';
function range(size, startAt = 0) {
return Array.from(Array(size).keys()).map((i) => i + startAt);
}
const uno = presetUno();
export default defineConfig({
presets: [
uno,
presetIcons({
extraProperties: {
display: 'inline-block',
},
}),
],
transformers: [transformerVariantGroup()],
extractors: [extractorSvelte],
safelist: [
...range(20).map((i) => `gap-${i}`),
...range(20).map((i) => `gap-x-${i}`),
...range(20).map((i) => `gap-y-${i}`),
...['center', 'stretch', 'baseline', 'start', 'end'].map(
(v) => `items-${v}`,
),
],
variants: [
{
match: (matcher) => {
if (!matcher.startsWith('hover:')) return matcher;
return {
matcher: matcher.slice(6),
parent: '@media (hover) and (pointer: fine)',
selector: (s) => `${s}:hover:not(:active)`,
};
},
order: -1,
},
],
theme: {
fontFamily: {
sans: `"Inter Variable", ${uno.theme.fontFamily.sans}`,
},
colors: {
brand: colors.blue,
surface: colors.white,
typo: colors.gray,
success: colors.green,
brandDark: colors.sky,
surfaceDark: colors.gray[800],
typoDark: colors.gray[200],
},
},
shortcuts: {
'grid-calc': 'gap-[1px] grid-cols-calc grid-rows-calc grid-areas-calc',
'outline-brand':
'outline-none focus-visible:outline-brand-600 @dark:focus-visible:outline-brand-dark-400',
'outline-brand-within':
'outline-none focus-within:outline-brand-600 @dark:focus-within:outline-brand-dark-400',
},
rules: [
[
/^bg-image-\$([a-z][a-z-]*)$/,
([, varName]) => ({ 'background-image': `var(--${varName})` }),
],
[
/^grid-area-\$([a-z][a-z-]*)$/,
([, varName]) => ({ 'grid-area': `var(--${varName})` }),
],
[/^grid-area-\[([^\]]+)\]$/, ([, area]) => ({ 'grid-area': area })],
[
'grid-cols-calc',
{ 'grid-template-columns': 'repeat(4, minmax(calc(25% - 1px), 4rem))' },
],
[
'grid-rows-calc',
{
'grid-template-rows': 'repeat(6, minmax(calc((100% - 6px) / 6), 4rem))',
},
],
[
'grid-areas-calc',
{
'grid-template-areas': `
'output output output output'
'reset reset divide times'
'b7 b8 b9 minus'
'b4 b5 b6 plus'
'b1 b2 b3 eq'
'b0 b0 dot eq'`,
},
],
],
});