-
Notifications
You must be signed in to change notification settings - Fork 690
/
tailwind.config.ts
83 lines (73 loc) · 2.61 KB
/
tailwind.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
import plugin from "tailwindcss/plugin"
import resolveConfig from "tailwindcss/resolveConfig"
import { baseConfig } from "./configs/tailwind.base.config"
export default resolveConfig({
...baseConfig,
content: [
"./apps/renderer/src/**/*.{ts,tsx}",
"./apps/web/src/**/*.{ts,tsx}",
"./apps/renderer/index.html",
"./apps/web/index.html",
"./packages/**/*.{ts,tsx}",
],
theme: {
...baseConfig.theme,
extend: {
...baseConfig.theme?.extend,
spacing: {
"safe-inset-top": "var(--fo-window-padding-top, 0)",
"margin-macos-traffic-light-x": "var(--fo-macos-traffic-light-width, 0)",
"margin-macos-traffic-light-y": "var(--fo-macos-traffic-light-height, 0)",
},
},
},
plugins: [
...baseConfig.plugins,
plugin(({ addVariant }) => {
addVariant("f-motion-reduce", '[data-motion-reduce="true"] &')
addVariant("group-motion-reduce", ':merge(.group)[data-motion-reduce="true"] &')
addVariant("peer-motion-reduce", ':merge(.peer)[data-motion-reduce="true"] ~ &')
addVariant("zen-mode-macos", ":where(html[data-zen-mode='true'][data-os='macOS']) &")
addVariant("zen-mode-windows", ":where(html[data-zen-mode='true'][data-os='Windows']) &")
addVariant("zen-mode", ":where(html[data-zen-mode='true']) &")
addVariant("macos", ":where(html[data-os='macOS']) &")
addVariant("windows", ":where(html[data-os='Windows']) &")
}),
plugin(({ addUtilities, matchUtilities, theme }) => {
addUtilities({
".safe-inset-top": {
top: "var(--fo-window-padding-top, 0)",
},
})
const safeInsetTopVariants = {}
for (let i = 1; i <= 16; i++) {
safeInsetTopVariants[`.safe-inset-top-${i}`] = {
top: `calc(var(--fo-window-padding-top, 0px) + ${theme(`spacing.${i}`)})`,
}
}
addUtilities(safeInsetTopVariants)
// left macos traffic light
const leftMacosTrafficLightVariants = {}
addUtilities({
".left-macos-traffic-light": {
left: "var(--fo-macos-traffic-light-width, 0)",
},
})
for (let i = 1; i <= 16; i++) {
leftMacosTrafficLightVariants[`.left-macos-traffic-light-${i}`] = {
left: `calc(var(--fo-macos-traffic-light-width, 0px) + ${theme(`spacing.${i}`)})`,
}
}
addUtilities(leftMacosTrafficLightVariants)
// Add arbitrary value support
matchUtilities(
{
"safe-inset-top": (value) => ({
top: `calc(var(--fo-window-padding-top, 0px) + ${value})`,
}),
},
{ values: theme("spacing") },
)
}),
],
})