From c727b669d77a9b087067884f6cb616898b05fae9 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sat, 15 Nov 2025 22:50:21 +0800 Subject: [PATCH] [+] uno --- bun.lock | 8 ++++ package.json | 6 ++- uno.config.ts | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 uno.config.ts diff --git a/bun.lock b/bun.lock index 69e47f9..9e0b8e3 100644 --- a/bun.lock +++ b/bun.lock @@ -6,7 +6,11 @@ "name": "kashi-dash", "dependencies": { "@neteasecloudmusicapienhanced/api": "^4.29.17", + "@unocss/core": "^66.5.6", + "@unocss/extractor-svelte": "^66.5.6", + "@unocss/preset-icons": "^66.5.6", "openai": "^6.9.0", + "unocss-preset-animations": "^1.3.0", }, "devDependencies": { "@eslint/compat": "^1.4.0", @@ -265,6 +269,8 @@ "@unocss/extractor-arbitrary-variants": ["@unocss/extractor-arbitrary-variants@66.5.6", "", { "dependencies": { "@unocss/core": "66.5.6" } }, "sha512-QAzpkX5UPjTeRbA7eed+mVPGNkwnMrIgfmlV9l8GVXHJCEnroRkzDVOPv1G9bKw1T82+NjBeZT9VnbZOmpLXQA=="], + "@unocss/extractor-svelte": ["@unocss/extractor-svelte@66.5.6", "", {}, "sha512-Vd2WxAVlb8XEKtR/w3aRLHdkQUZhSv4gca5YoP7QPRyIEgDbS8wSW2tECLZ1TCufn9EtdKAbVqyOLsmcj9s1Ng=="], + "@unocss/inspector": ["@unocss/inspector@66.5.6", "", { "dependencies": { "@unocss/core": "66.5.6", "@unocss/rule-utils": "66.5.6", "colorette": "^2.0.20", "gzip-size": "^6.0.0", "sirv": "^3.0.2", "vue-flow-layout": "^0.2.0" } }, "sha512-9N2TunEhxHCcy4KPck/hUoctYeWCgLxHamTDn1eRCk3WavIS7l3v5wIcWUcMVXjXOJ0U2Y+w6jp/wQhA4kln/Q=="], "@unocss/postcss": ["@unocss/postcss@66.5.6", "", { "dependencies": { "@unocss/config": "66.5.6", "@unocss/core": "66.5.6", "@unocss/rule-utils": "66.5.6", "css-tree": "^3.1.0", "postcss": "^8.5.6", "tinyglobby": "^0.2.15" } }, "sha512-l+k0qYbkmag6v2g3DQ0lSiJV5UmQcQA9b0Fd/0+P9Vtqwi0o7x1Fx4lNdRZMYMZCW3o4mTTGxew/tr3xnig1GA=="], @@ -925,6 +931,8 @@ "unocss": ["unocss@66.5.6", "", { "dependencies": { "@unocss/astro": "66.5.6", "@unocss/cli": "66.5.6", "@unocss/core": "66.5.6", "@unocss/postcss": "66.5.6", "@unocss/preset-attributify": "66.5.6", "@unocss/preset-icons": "66.5.6", "@unocss/preset-mini": "66.5.6", "@unocss/preset-tagify": "66.5.6", "@unocss/preset-typography": "66.5.6", "@unocss/preset-uno": "66.5.6", "@unocss/preset-web-fonts": "66.5.6", "@unocss/preset-wind": "66.5.6", "@unocss/preset-wind3": "66.5.6", "@unocss/preset-wind4": "66.5.6", "@unocss/transformer-attributify-jsx": "66.5.6", "@unocss/transformer-compile-class": "66.5.6", "@unocss/transformer-directives": "66.5.6", "@unocss/transformer-variant-group": "66.5.6", "@unocss/vite": "66.5.6" }, "peerDependencies": { "@unocss/webpack": "66.5.6", "vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 || ^7.0.0-0" }, "optionalPeers": ["@unocss/webpack", "vite"] }, "sha512-8ix8Cl09LNd1QdC2b22FJ5WbyBaNZ2Q0oJ3yhjj2AEe75A8pMBpb8Khd01b4coRillEzuBNBIP+fIpeot0/8EQ=="], + "unocss-preset-animations": ["unocss-preset-animations@1.3.0", "", { "peerDependencies": { "@unocss/preset-wind3": ">=0.56.0 < 101", "unocss": ">=0.56.0 < 101" }, "optionalPeers": ["@unocss/preset-wind3"] }, "sha512-NLsBzPB98Jc8b6+t8nwLItI12ZE/48IZVccZ2uA2owLoeAvhRaDoRvs6eLcJfIUZfRycL25xxOeQoOBMo1p/aw=="], + "unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="], "unplugin-utils": ["unplugin-utils@0.3.1", "", { "dependencies": { "pathe": "^2.0.3", "picomatch": "^4.0.3" } }, "sha512-5lWVjgi6vuHhJ526bI4nlCOmkCIF3nnfXkCMDeMJrtdvxTs6ZFCM8oNufGTsDbKv/tJ/xj8RpvXjRuPBZJuJog=="], diff --git a/package.json b/package.json index 9c6fd08..85edcbc 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,10 @@ }, "dependencies": { "@neteasecloudmusicapienhanced/api": "^4.29.17", - "openai": "^6.9.0" + "@unocss/core": "^66.5.6", + "@unocss/extractor-svelte": "^66.5.6", + "@unocss/preset-icons": "^66.5.6", + "openai": "^6.9.0", + "unocss-preset-animations": "^1.3.0" } } diff --git a/uno.config.ts b/uno.config.ts new file mode 100644 index 0000000..20311ce --- /dev/null +++ b/uno.config.ts @@ -0,0 +1,115 @@ +// https://github.com/Menci/Marina/blob/main/apps/web/uno.config.ts +import { createLocalFontProcessor } from '@unocss/preset-web-fonts/local'; +import { defineConfig, presetWind3, presetAttributify, presetIcons, presetTypography, presetWebFonts, transformerDirectives } from 'unocss'; +import presetAnimations from 'unocss-preset-animations'; + +function createColorSchemeConfig(hueBaseVariable: string, hueOffset = 0) { + const calcBaseChroma = `(0.18 + (cos((var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) * 3.14159265 / 180) * 0.04))`; + + const shades = { + 50: `color-mix(in oklch, oklch(95% calc(${calcBaseChroma} * 0.3) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha) 30%, oklch(100% 0 360 / %alpha))`, + 100: `color-mix(in oklch, oklch(95% calc(${calcBaseChroma} * 0.5) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha) 80%, oklch(100% 0 360 / %alpha))`, + 200: `oklch(90% calc(${calcBaseChroma} * 0.6) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 300: `oklch(85% calc(${calcBaseChroma} * 0.75) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 400: `oklch(74% calc(${calcBaseChroma}) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 450: `oklch(68% calc(${calcBaseChroma}) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 500: `oklch(62% calc(${calcBaseChroma} * 0.9) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 600: `oklch(54% calc(${calcBaseChroma} * 1.15) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 700: `oklch(49% calc(${calcBaseChroma} * 1.1) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 800: `oklch(42% calc(${calcBaseChroma} * 0.85) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 900: `oklch(37% calc(${calcBaseChroma} * 0.7) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 950: `oklch(29% calc(${calcBaseChroma} * 0.5) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + 970: `oklch(20% calc(${calcBaseChroma} * 0.3) calc(var(--theme-colors-${hueBaseVariable}) + ${hueOffset}) / %alpha)`, + } as const; + + return { + ...shades, + DEFAULT: `color-mix(in oklch, ${shades[500]}, ${shades[600]} var(--is-dark))`, + foreground: shades[100], + }; +} + +export default defineConfig({ + presets: [ + presetWind3(), + presetAnimations(), + presetAttributify(), + presetTypography(), + presetIcons({ + scale: 1.2, + warn: true, + }), + presetWebFonts({ + fonts: { + sans: { + name: 'Normalized Quicksand', + provider: 'none', + }, + mono: { + name: 'Maple Mono', + provider: 'fontsource', + }, + }, + processors: createLocalFontProcessor({ + cacheDir: 'node_modules/.cache/unocss/fonts', + fontAssetsDir: 'public/assets/fonts/cache', + fontServeBaseUrl: '/assets/fonts/cache', + }), + }), + ], + // By default, `.ts` and `.js` files are NOT extracted. + // If you want to extract them, use the following configuration. + // It's necessary to add the following configuration if you use shadcn-vue or shadcn-svelte. + content: { + pipeline: { + include: [ + // the default + /\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/, + // include js/ts files + '(components|src)/**/*.{js,ts,vue}', + '**/shadcn-ui/**/*.{vue,js,ts}', + '**/ui/**/*.{vue,js,ts}', + ], + }, + }, + theme: { + spacing: { + 4: '1rem', + }, + colors: { + primary: createColorSchemeConfig('hue-primary'), + destructive: createColorSchemeConfig('hue-destructive'), + warning: createColorSchemeConfig('hue-warning'), + success: createColorSchemeConfig('hue-success'), + }, + borderRadius: { + xs: 'calc(var(--radius) - 6px)', + }, + fontFamily: { + jp: ['"ヒラギノ角ゴ Pro W3"', 'メイリオ', 'Meiryo', '"MS Pゴシック"', '"MS P Gothic"', 'sans-serif'] + } + }, + extendTheme: theme => ({ + ...theme, + breakpoints: { + ...theme.breakpoints, + '3xl': '1792px', + }, + }), + rules: [ + [/^dir-([a-zA-Z0-9-]+)$/, ([, dir]) => ({ + direction: dir, + })], + [/^my-([a-zA-Z0-9-]+)-([a-zA-Z0-9-.]+)$/, ([, varname, varval]) => ({ + [`--my-${varname}`]: varval + })] + ], + shortcuts: { + 'form-error': 'text-3.5 font-medium text-destructive', + 'form-warning': 'text-3.5 font-medium text-warning', + 'form-info': 'text-3.5 font-medium text-muted-foreground', + }, + transformers: [ + transformerDirectives(), + ], +}); \ No newline at end of file