Hangar/frontend-new/windi.config.ts

119 lines
3.6 KiB
TypeScript
Raw Normal View History

2022-02-13 18:56:14 +08:00
import { defineConfig } from "vite-plugin-windicss";
import colors from "windicss/colors";
import typography from "windicss/plugin/typography";
2022-04-04 01:21:34 +08:00
import plugin from "windicss/plugin";
2022-02-13 02:24:05 +08:00
export default defineConfig({
2022-02-13 18:56:14 +08:00
darkMode: "class",
2022-05-24 22:42:50 +08:00
safelist: "order-last button-primary button-secondary button-red button-transparent",
2022-02-13 02:24:05 +08:00
attributify: true,
2022-04-04 01:21:34 +08:00
plugins: [
typography(),
plugin(({ addVariant }) => {
addVariant("error", ({ style }) => {
return style.parent(".error");
});
addVariant("filled", ({ style }) => {
return style.parent(".filled");
});
addVariant("input-focused", ({ style }) => {
return style.wrapSelector((s) => "input:focus ~ " + s);
});
addVariant("input-focus-visible", ({ style }) => {
return style.wrapSelector((s) => "input:focus-visible ~ " + s);
});
addVariant("select-focused", ({ style }) => {
return style.wrapSelector((s) => "select:focus ~ " + s);
});
}),
],
2022-02-13 02:24:05 +08:00
theme: {
2022-05-24 00:12:17 +08:00
colors: {
transparent: "transparent",
current: "currentColor",
primary: {
0: "#E6EDFD", // old primary-50
50: "#CCDCFB",
100: "#99B8F6", // old primary-70
200: "#6695F2",
300: "#3371ED",
400: "#004EE9", // old primary-100
500: "#003EBA",
600: "#002F8C",
700: "#001F5D",
800: "#00102F",
900: "#000817",
},
2022-05-28 23:44:52 +08:00
lightBlue: colors.lightBlue,
blue: colors.blue,
lime: colors.lime,
slate: colors.slate,
2022-05-24 00:12:17 +08:00
red: colors.red,
gray: colors.zinc,
2022-05-24 22:42:50 +08:00
secondary: colors.slate,
2022-05-24 00:12:17 +08:00
white: colors.zinc[50],
black: colors.zinc[900],
},
2022-02-13 02:24:05 +08:00
extend: {
typography: {
DEFAULT: {
css: {
2022-02-13 18:56:14 +08:00
maxWidth: "65ch",
color: "inherit",
lineHeight: "1.6em",
2022-02-13 02:24:05 +08:00
a: {
2022-02-13 18:56:14 +08:00
color: "inherit",
opacity: 0.75,
fontWeight: "500",
textDecoration: "underline",
"&:hover": {
2022-02-13 02:24:05 +08:00
opacity: 1,
color: colors.teal[600],
},
},
2022-02-13 18:56:14 +08:00
b: { color: "inherit" },
strong: { color: "inherit" },
em: { color: "inherit" },
h1: {
color: "inherit",
fontWeight: "600",
marginBottom: "0.6em",
},
h2: {
color: "inherit",
fontWeight: "600",
marginTop: "inherit",
marginBottom: "0.6em",
},
h3: {
color: "inherit",
marginTop: "inherit",
marginBottom: "0.6em",
},
h4: {
color: "inherit",
marginTop: "inherit",
marginBottom: "0.6em",
},
2022-02-13 18:56:14 +08:00
code: { color: "inherit" },
li: {
marginTop: "0.2em",
marginBottom: "0.2em",
},
2022-02-13 02:24:05 +08:00
},
},
},
},
},
shortcuts: {
2022-05-24 22:42:50 +08:00
"background-body": "bg-gray-100 dark:bg-gray-900",
"background-default": "bg-gray-50 dark:bg-gray-800",
"color-primary": "text-primary-400 dark:text-primary-200",
"border-top-primary": "border-solid border-t-4 border-t-primary-400",
2022-05-24 22:42:50 +08:00
"button-primary": "bg-primary-400 enabled:hover:bg-primary-300",
"button-secondary": "bg-secondary-500 enabled:hover:(bg-secondary-400 dark:bg-secondary-600)",
"button-transparent": "bg-transparent enabled:hover:(bg-primary-400/15 text-primary-400 dark:text-primary-100)",
"button-red": "bg-red-500 dark:bg-red-600 enabled:hover:(bg-red-400 dark:bg-red-500)",
},
2022-02-13 18:56:14 +08:00
});