generated from reepolee/svelte-routify-windi-vite
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunocss.config.js
217 lines (214 loc) · 5.81 KB
/
unocss.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
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
import { transformerVariantGroup, presetTypography } from "unocss";
import { defineConfig } from "unocss/vite";
import { colors, presetWind } from "@unocss/preset-wind";
export default defineConfig({
presets: [
presetWind(),
presetTypography({
cssExtend: {
a: {
"text-decoration": "none",
},
"p > a, li > a": {
position: "relative",
display: "inline-block",
"z-index": 5,
"background-image":
"linear-gradient(var(--c-prose-accent), var(--c-prose-accent))",
"background-size": "0 2px",
"background-repeat": "no-repeat",
"background-position": "bottom left",
transition: "background-size ease-out 200ms",
},
"p > a:hover, li > a:hover": {
"background-size": "100% 2px",
},
strong: {
color: "var(--un-prose-headings)",
},
p: {
"font-family": "var(--font-serif)",
"line-height": "1.625",
},
h1: {
"text-transform": "uppercase",
"font-weight": 700,
"font-size": "1.875rem",
"background-image": `linear-gradient(to right, var(--c-prose-accent), rgba(0, 0, 0, 0))`,
"background-size": "100% 0.125rem",
"background-repeat": "no-repeat",
"background-position": "bottom",
"padding-bottom": "0.5rem",
},
h2: {
"font-size": "1.5rem",
},
h3: {
"font-size": "1.25rem",
},
h4: {
"font-size": "1.125rem",
},
"h1, h2, h3, h4, h5, h6": {
"font-family": "var(--font-heading)",
position: "relative",
},
"h1 a, h2 a, h3 a, h4 a, h5 a": {
"font-weight": 600,
},
"p > code": {
color: "var(--un-prose-headings)",
"font-family": "var(--font-monospace)",
"background-color": "var(--c-prose-alt-bg)",
"font-weight": 500,
border: "none",
},
pre: {
"font-family": "var(--font-monospace)",
padding: "1rem",
"margin-top": "1.25rem",
"overflow-x": "auto",
"scrollbar-color": "var(--un-font-)",
"border-radius": "0.375rem",
},
"pre::-webkit-scrollbar": {
"background-color": "var(--c-prose-alt-bg)",
height: "0.5rem",
"border-bottom-right-radius": "0.375rem",
"border-bottom-left-radius": "0.375rem",
cursor: "pointer",
},
"pre:hover::-webkit-scrollbar": {
"background-color": "var(--c-prose-scrollbar-bg)",
height: "0.5rem",
},
"pre::-webkit-scrollbar-thumb": {
"border-radius": "0.375rem",
cursor: "pointer",
},
"pre:hover::-webkit-scrollbar-thumb": {
"background-color": "var(--c-prose-thumb-bg)",
},
"del, del *": {
"font-style": "italic",
"text-decoration": "line-through",
},
table: {
width: "100%",
"border-radius": "0.375rem",
"background-color": "var(--c-prose-alt-bg)",
},
"table a": {
transition: "all ease-out 200ms",
"font-weight": "semibold",
"line-height": "1.625",
"font-style": "italic",
},
"table th": {
color: "var(--un-prose-links)",
"font-size": "1.125rem",
"text-transform": "uppercase",
},
"table td": {
"text-align": "left",
},
},
}),
],
transformers: [transformerVariantGroup()],
rules: [
[
/^content-\[(.*)\]$/,
([, content]) => ({ content: JSON.stringify(content) }),
],
[
/^prose-custom$/,
(_, { theme }) => ({
"--font-heading": '"Space Grotesk", sans-serif',
"--font-serif": '"IBM Plex Serif", serif',
"--font-monospace": '"IBM Plex Mono", monospace',
"--un-prose-body": theme.colors.zinc[800],
"--un-prose-links": theme.colors.rose[700],
"--un-prose-headings": theme.colors.zinc[800],
"--c-prose-accent": theme.colors.rose[600],
"--c-prose-alt-bg": theme.colors.rose[100],
"--c-prose-scrollbar-bg": theme.colors.gray[200],
"--c-prose-thumb-bg": theme.colors.gray[300],
}),
{ layer: "typography" },
],
[
/^custom-scrollbar$/,
(_, { theme }) =>
`
html {
color: ${theme.colors.rose[200]} ${theme.colors.rose[600]};
scroll-padding-top: 2rem;
}
html::-webkit-scrollbar-thumb {
background-color: ${theme.colors.rose[600]};
}
html::-webkit-scrollbar {
background-color: ${theme.colors.rose[200]};
width: 0.5rem;
}`.replace(/(\s)/g, ""),
{ layer: "default" },
],
],
shortcuts: [
[
/^btn-lg-(.*)$/,
([, c]) => {
return `bg-${c} inline-block
mt-8 px-5 py-2
text-white font-semibold no-underline font-heading text-lg tracking-wide
transition-property-transform ease-out duration-200 transform-gpu
shadow-sharp border-2 border-rose-900
hover:(-translate-y-1.5)
`;
},
],
[
/^btn-(source|demo)$/,
([, kind]) => {
const colour =
kind === "demo" ? "bg-rose-600 text-white" : "bg-white text-zinc-900";
return `${colour} border-2 border-rose-900 shadow-sharp font-heading no-underline flex items-center gap-2 py-1 px-3 transition-property-filter ease-out duration-200 hover:brightness-90`;
},
],
],
theme: {
fontFamily: {
heading: ["Space Grotesk", "sans-serif"],
serif: ["IBM Plex Serif", "serif"],
monospace: ["IBM Plex Mono", "monospace"],
},
fontSize: {
"clamped-lg": "clamp(1.25rem, calc(5vw + 1.25rem), 3rem)",
"clamped-md": "clamp(1rem, calc(5vw + 0.5rem), 1.625rem)",
"clamped-sm": "clamp(0.8rem, calc(2vw + 0.5rem), 1.125rem)",
},
width: {
clamped: "clamp(12rem, calc(20vw + 4rem), 16rem)",
},
height: {
clamped: "clamp(12rem, calc(20vw + 4rem), 16rem)",
},
boxShadow: {
sharp: `0.25rem 0.25rem 0 0 ${colors.rose[900]}`,
},
backgroundImage: {
"red-fading-line": `linear-gradient(to right, ${colors.red[500]}, rgba(0, 0, 0, 0))`,
"blue-fading-line": `linear-gradient(to right, ${colors.rose[600]}, rgba(0, 0, 0, 0))`,
},
},
preflights: [
{
getCSS: ({ theme }) => `
*::selection {
background-color: ${theme.colors.zinc[800]};
color: ${theme.colors.white};
}`,
},
],
});