2023-08-02 13:28:18 +03:00
|
|
|
import process from 'node:process'
|
2023-07-28 20:29:15 +03:00
|
|
|
import type { Variant } from 'unocss'
|
2022-11-13 08:34:43 +03:00
|
|
|
import {
|
|
|
|
defineConfig,
|
|
|
|
presetAttributify,
|
|
|
|
presetIcons,
|
|
|
|
presetTypography,
|
|
|
|
presetUno,
|
|
|
|
presetWebFonts,
|
|
|
|
transformerDirectives,
|
|
|
|
transformerVariantGroup,
|
|
|
|
} from 'unocss'
|
|
|
|
|
2023-02-07 17:32:37 +03:00
|
|
|
import { variantParentMatcher } from '@unocss/preset-mini/utils'
|
|
|
|
|
2022-11-13 08:34:43 +03:00
|
|
|
export default defineConfig({
|
|
|
|
shortcuts: [
|
2022-11-23 05:16:31 +03:00
|
|
|
{
|
|
|
|
'border-base': 'border-$c-border',
|
2022-12-26 11:50:11 +03:00
|
|
|
'border-dark': 'border-$c-border-dark',
|
2022-12-03 00:38:27 +03:00
|
|
|
'border-strong': 'border-$c-text-base',
|
2022-11-27 07:48:23 +03:00
|
|
|
'border-bg-base': 'border-$c-bg-base',
|
2022-12-13 02:10:04 +03:00
|
|
|
'border-primary-light': 'border-$c-primary-light',
|
2022-11-24 11:04:53 +03:00
|
|
|
|
|
|
|
// background
|
2022-11-23 05:16:31 +03:00
|
|
|
'bg-base': 'bg-$c-bg-base',
|
2022-12-26 10:37:42 +03:00
|
|
|
'bg-border': 'bg-$c-border',
|
2022-11-23 07:20:59 +03:00
|
|
|
'bg-active': 'bg-$c-bg-active',
|
2023-01-22 23:18:03 +03:00
|
|
|
'bg-secondary': 'bg-$c-text-secondary',
|
|
|
|
'bg-secondary-light': 'bg-$c-text-secondary-light',
|
2023-01-05 02:17:30 +03:00
|
|
|
'bg-primary-light': 'bg-$c-primary-light',
|
2023-01-16 13:26:19 +03:00
|
|
|
'bg-primary-fade': 'bg-$c-primary-fade',
|
2023-01-10 12:05:59 +03:00
|
|
|
'bg-card': 'bg-$c-bg-card',
|
2022-11-24 06:42:03 +03:00
|
|
|
'bg-code': 'bg-$c-bg-code',
|
2023-01-10 08:58:07 +03:00
|
|
|
'bg-dm': 'bg-$c-bg-dm',
|
2022-11-24 11:04:53 +03:00
|
|
|
|
2022-11-27 06:54:46 +03:00
|
|
|
// text colors
|
2022-11-23 05:16:31 +03:00
|
|
|
'text-base': 'text-$c-text-base',
|
2022-11-30 07:50:29 +03:00
|
|
|
'text-code': 'text-$c-text-code',
|
2022-11-29 23:04:23 +03:00
|
|
|
'text-inverted': 'text-$c-bg-base',
|
2022-11-23 10:46:34 +03:00
|
|
|
'text-secondary': 'text-$c-text-secondary',
|
2022-11-26 23:41:18 +03:00
|
|
|
'text-secondary-light': 'text-$c-text-secondary-light',
|
2022-11-24 11:04:53 +03:00
|
|
|
|
|
|
|
// buttons
|
2022-11-27 15:37:06 +03:00
|
|
|
'btn-base': 'cursor-pointer disabled:pointer-events-none disabled:bg-$c-bg-btn-disabled disabled:text-$c-text-btn-disabled',
|
|
|
|
'btn-solid': 'btn-base px-4 py-2 rounded text-$c-text-btn bg-$c-primary hover:bg-$c-primary-active',
|
2022-11-29 23:04:23 +03:00
|
|
|
'btn-outline': 'btn-base px-4 py-2 rounded text-$c-primary border border-$c-primary hover:bg-$c-primary hover:text-inverted',
|
2022-11-24 10:53:27 +03:00
|
|
|
'btn-text': 'btn-base px-4 py-2 text-$c-primary hover:text-$c-primary-active',
|
2023-01-03 01:11:43 +03:00
|
|
|
'btn-action-icon': 'btn-base hover:bg-active rounded-full h9 w9 flex items-center justify-center disabled:bg-transparent disabled:text-$c-text-secondary',
|
2023-01-17 15:56:51 +03:00
|
|
|
'btn-danger': 'btn-base px-4 py-2 rounded text-white bg-$c-danger hover:bg-$c-danger-active',
|
2022-11-24 11:04:53 +03:00
|
|
|
|
2022-12-26 11:50:11 +03:00
|
|
|
// input
|
|
|
|
'input-base-focus': 'focus:outline-none focus:border-$c-primary',
|
|
|
|
'input-base-disabled': 'disabled:pointer-events-none disabled:bg-gray-500/5 disabled:text-gray-500/50',
|
|
|
|
'input-base': 'p2 rounded w-full bg-transparent border border-dark input-base-focus input-base-disabled',
|
|
|
|
'input-error': 'border-$c-error focus:(outline-offset-0 outline-$c-error outline-1px)',
|
|
|
|
|
2022-12-28 02:03:50 +03:00
|
|
|
'select-settings': 'p3 border border-base rounded w-full block bg-base',
|
|
|
|
|
2022-11-27 06:54:46 +03:00
|
|
|
// link
|
|
|
|
'text-link-rounded': 'focus:outline-none focus:ring-(2 primary inset) hover:bg-active rounded md:rounded-full px2 mx--2',
|
|
|
|
|
2022-11-24 11:04:53 +03:00
|
|
|
// utils
|
|
|
|
'flex-center': 'items-center justify-center',
|
|
|
|
'flex-v-center': 'items-center',
|
|
|
|
'flex-h-center': 'justify-center',
|
2023-01-12 12:40:49 +03:00
|
|
|
'bg-hover-overflow': 'relative z-0 transition-colors duration-250 after-content-empty after:(absolute inset--4px bg-transparent rounded-full z--1 transition-colors duration-250) hover:after:(bg-active)',
|
2023-01-05 02:17:30 +03:00
|
|
|
|
|
|
|
'timeline-title-style': 'text-primary text-lg font-bold',
|
2022-11-23 05:16:31 +03:00
|
|
|
},
|
2023-03-19 15:24:27 +03:00
|
|
|
[/^elk-group-hover[:-](\S+)$/, ([,r]) => `media-mouse-group-hover-${r} group-active-${r}`],
|
2022-11-13 08:34:43 +03:00
|
|
|
],
|
|
|
|
presets: [
|
2022-11-14 05:56:48 +03:00
|
|
|
presetUno({
|
|
|
|
attributifyPseudo: true,
|
|
|
|
}),
|
2022-11-13 08:34:43 +03:00
|
|
|
presetAttributify(),
|
|
|
|
presetIcons({
|
|
|
|
scale: 1.2,
|
2022-12-01 09:48:22 +03:00
|
|
|
extraProperties: {
|
2022-12-06 19:37:58 +03:00
|
|
|
'color': 'inherit',
|
|
|
|
// Avoid crushing of icons in crowded situations
|
|
|
|
'min-width': '1.2em',
|
2022-12-01 09:48:22 +03:00
|
|
|
},
|
2022-11-13 08:34:43 +03:00
|
|
|
}),
|
|
|
|
presetTypography(),
|
|
|
|
presetWebFonts({
|
2022-12-09 19:32:09 +03:00
|
|
|
provider: 'none',
|
2022-11-13 08:34:43 +03:00
|
|
|
fonts: {
|
2022-11-24 05:38:14 +03:00
|
|
|
script: 'Homemade Apple',
|
2022-11-13 08:34:43 +03:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
transformers: [
|
|
|
|
transformerDirectives(),
|
|
|
|
transformerVariantGroup(),
|
|
|
|
],
|
2022-11-13 19:05:32 +03:00
|
|
|
theme: {
|
|
|
|
colors: {
|
2022-11-23 17:21:18 +03:00
|
|
|
primary: {
|
|
|
|
DEFAULT: 'var(--c-primary)',
|
|
|
|
active: 'var(--c-primary-active)',
|
|
|
|
},
|
2023-01-17 15:56:51 +03:00
|
|
|
danger: {
|
|
|
|
DEFAULT: 'var(--c-danger)',
|
|
|
|
active: 'var(--c-danger-active)',
|
|
|
|
},
|
2022-11-13 19:05:32 +03:00
|
|
|
},
|
|
|
|
},
|
2023-01-21 17:55:20 +03:00
|
|
|
variants: [
|
2023-07-28 20:29:15 +03:00
|
|
|
...(process.env.TAURI_PLATFORM
|
|
|
|
? <Variant<any>[]>[(matcher) => {
|
|
|
|
if (!matcher.startsWith('native:'))
|
|
|
|
return
|
|
|
|
return {
|
|
|
|
matcher: matcher.slice(7),
|
|
|
|
layer: 'native',
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
: []),
|
|
|
|
...(process.env.TAURI_PLATFORM !== 'macos'
|
|
|
|
? <Variant<any>[]>[
|
|
|
|
(matcher) => {
|
|
|
|
if (!matcher.startsWith('native-mac:'))
|
|
|
|
return
|
|
|
|
return {
|
|
|
|
matcher: matcher.slice(11),
|
|
|
|
layer: 'native-mac',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]
|
|
|
|
: []
|
|
|
|
),
|
2023-02-07 17:32:37 +03:00
|
|
|
variantParentMatcher('fullscreen', '@media (display-mode: fullscreen)'),
|
2023-03-01 01:01:31 +03:00
|
|
|
variantParentMatcher('coarse-pointer', '@media (pointer: coarse)'),
|
2023-01-21 17:55:20 +03:00
|
|
|
],
|
2022-12-05 16:20:23 +03:00
|
|
|
rules: [
|
|
|
|
// scrollbar-hide
|
|
|
|
[/^scrollbar-hide$/, (_, { constructCSS }) => {
|
|
|
|
let res = constructCSS({ 'scrollbar-width': 'none' })
|
|
|
|
res += `\n${res.replace('{scrollbar-width:none;}', '::-webkit-scrollbar{display: none;}')}`
|
|
|
|
return res
|
|
|
|
}],
|
2023-04-28 20:44:58 +03:00
|
|
|
[/^h-100dvh$/, (_, { constructCSS }) => {
|
|
|
|
let res = constructCSS({ height: '100vh' })
|
|
|
|
res += `\n${res.replace('{height:100vh;}', '{height:100vh;height:100dvh;}')}`
|
|
|
|
return res
|
|
|
|
}],
|
2022-12-28 19:35:40 +03:00
|
|
|
['box-shadow-outline', { 'box-shadow': '0 0 0 1px var(--c-primary)' }],
|
2022-12-05 16:20:23 +03:00
|
|
|
],
|
2022-11-13 08:34:43 +03:00
|
|
|
})
|