-
Notifications
You must be signed in to change notification settings - Fork 6
/
twind.config.ts
172 lines (165 loc) · 3.96 KB
/
twind.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
/** @jsx h */
/** @type {import('twind').Configuration} */
import {
defineConfig,
presetAutoprefix,
presetExt,
presetTailwind,
presetTypography,
} from "./deps/twind.ts";
import {
accent,
accentDark,
darkColor,
neutral,
neutralDark,
yellow,
yellowDark,
blue,
blueDark,
red,
redDark,
} from "./deps/twind.ts";
export const twindConfig = defineConfig({
presets: [
presetAutoprefix(),
presetTailwind({
colors: {
neutral,
neutralDark,
accent,
accentDark,
yellow,
yellowDark,
blue,
blueDark,
red,
redDark,
},
}),
presetExt(),
presetTypography({
defaultColor: "neutral",
colors: {
body: "12",
headings: "12",
lead: "10",
links: "12",
bold: "12",
counters: "9",
bullets: "9",
quotes: "11",
captions: "11",
code: "12",
"pre-code": "12",
"pre-bg": "1",
"quote-borders": "6",
hr: "6",
"th-borders": "6",
"td-borders": "5",
},
extend: {
".lead": { "@apply": "m-0 text-base font-medium" },
a: {
"@apply": `
font-normal
no-underline
text-accent-11
hover:underline
`,
},
"a[rel~='external']": {
"@apply": `
after:content-['\\0000a↗']
after:text-xs
after:align-text-top
`,
},
"h1,h2,h3,h4,h5,h6": {
"& > .h-anchor": {
"@apply": `
-ml-9
transition-opacity
absolute my-auto top-0 bottom-0
hidden sm:flex
justify-center items-center
w-6 h-6 rounded-sm
text(base neutral-9 hover:(accent-12)) !no-underline
opacity(0 hover:100))
`,
},
"@apply":
"relative tracking-tight font-semibold -ml-4 pl-4 hover:([&>.h-anchor]:opacity-100)",
},
pre: {
"@apply":
"leading-normal text-[13px] px-3 py-2 border bg-neutral-2 border-neutral-4 rounded-sm",
},
del: { "@apply": "opacity-60" },
small: { "@apply": "text-neutral-11" },
details: { "@apply": "text-neutral-11" },
table: { "@apply": "leading-snug" },
li: {
"@apply": "my-0 pl-0",
"& > ul": { "@apply": "my-0" },
"& > ol": { "@apply": "my-0" },
},
"& dt": { "@apply": "font-semibold" },
"& dd": { "@apply": "" },
"dd + dt": { "@apply": "mt-2" },
"& *:last-child": { "@apply": "mb-0" },
".full-bleed": { "@apply": "lg:(-mx-24) xl:(-mx-32)" },
".cols-2": { "@apply": "sm:grid grid(cols-2) gap-x-4" },
".cols-3": { "@apply": "sm:grid grid(cols-3) gap-x-4" },
".cols-4": { "@apply": "grid grid(cols-2 md:cols-4) gap-x-4" },
".span-2": { "@apply": "sm:col-span-2" },
".span-3": { "@apply": "sm:col-span-3" },
},
}),
],
rules: [
[
"box",
{
"@apply": `
block
bg(transparent)
rounded
`,
"&:is(a)": {
"@apply": "text(neutral-12) hover:(bg(accent-3) text-neutral-12)",
},
},
],
[
"divide-dot",
{
"& > *:not(:last-child)::after": {
content: "'·'",
"@apply": "mx-1.5 text(neutral-8)",
},
},
],
[
"divide-slash",
{
"& > *:not(:last-child)::after": {
content: "'/'",
"@apply": "mx-1.5 text(neutral-9)",
},
},
],
[
"section-heading",
{
"@apply":
"flex gap-2 items-baseline text(xs neutral-10) uppercase font-semibold tracking-wide mb-3",
"&::after": { content: "", "@apply": "flex-1 h-px bg-neutral-4" },
},
],
],
preflight: {
a: { "@apply": "hover:text-accent-11" },
},
darkColor,
});