2022-11-13 06:34:43 +01:00
import {
defineConfig ,
presetAttributify ,
presetIcons ,
presetTypography ,
presetUno ,
presetWebFonts ,
transformerDirectives ,
transformerVariantGroup ,
} from 'unocss'
export default defineConfig ( {
shortcuts : [
2022-11-23 03:16:31 +01:00
{
'border-base' : 'border-$c-border' ,
2022-12-26 09:50:11 +01:00
'border-dark' : 'border-$c-border-dark' ,
2022-12-02 22:38:27 +01:00
'border-strong' : 'border-$c-text-base' ,
2022-11-27 05:48:23 +01:00
'border-bg-base' : 'border-$c-bg-base' ,
2022-12-13 00:10:04 +01:00
'border-primary-light' : 'border-$c-primary-light' ,
2022-11-24 09:04:53 +01:00
// background
2022-11-23 03:16:31 +01:00
'bg-base' : 'bg-$c-bg-base' ,
2022-12-26 08:37:42 +01:00
'bg-border' : 'bg-$c-border' ,
2022-11-23 05:20:59 +01:00
'bg-active' : 'bg-$c-bg-active' ,
2022-11-24 04:42:03 +01:00
'bg-code' : 'bg-$c-bg-code' ,
2022-12-01 08:32:07 +01:00
'bg-fade' : 'bg-$c-bg-fade' ,
2022-11-24 09:04:53 +01:00
2022-11-27 04:54:46 +01:00
// text colors
2022-11-23 03:16:31 +01:00
'text-base' : 'text-$c-text-base' ,
2022-11-30 05:50:29 +01:00
'text-code' : 'text-$c-text-code' ,
2022-11-29 21:04:23 +01:00
'text-inverted' : 'text-$c-bg-base' ,
2022-11-23 08:46:34 +01:00
'text-secondary' : 'text-$c-text-secondary' ,
2022-11-26 21:41:18 +01:00
'text-secondary-light' : 'text-$c-text-secondary-light' ,
2022-11-24 09:04:53 +01:00
// buttons
2022-11-27 13:37:06 +01: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 21:04:23 +01: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 08:53:27 +01:00
'btn-text' : 'btn-base px-4 py-2 text-$c-primary hover:text-$c-primary-active' ,
'btn-action-icon' : 'btn-base hover:bg-active rounded-full h9 w9 flex items-center justify-center' ,
2022-11-24 09:04:53 +01:00
2022-12-26 09:50:11 +01: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 00:03:50 +01:00
'select-settings' : 'p3 border border-base rounded w-full block bg-base' ,
2022-11-27 04:54:46 +01: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 09:04:53 +01:00
// utils
'flex-center' : 'items-center justify-center' ,
'flex-v-center' : 'items-center' ,
'flex-h-center' : 'justify-center' ,
2022-12-11 11:52:36 +01:00
'bg-hover-overflow' : 'relative z-0 transition-colors duration-250 after-content-empty after:(absolute inset--2px bg-transparent rounded-lg z--1 transition-colors duration-250) hover:after:(bg-active)' ,
2022-11-23 03:16:31 +01:00
} ,
2022-11-13 06:34:43 +01:00
] ,
presets : [
2022-11-14 03:56:48 +01:00
presetUno ( {
attributifyPseudo : true ,
} ) ,
2022-11-13 06:34:43 +01:00
presetAttributify ( ) ,
presetIcons ( {
scale : 1.2 ,
2022-12-01 07:48:22 +01:00
extraProperties : {
2022-12-06 17:37:58 +01:00
'color' : 'inherit' ,
// Avoid crushing of icons in crowded situations
'min-width' : '1.2em' ,
2022-12-01 07:48:22 +01:00
} ,
2022-11-13 06:34:43 +01:00
} ) ,
presetTypography ( ) ,
presetWebFonts ( {
2022-12-09 17:32:09 +01:00
provider : 'none' ,
2022-11-13 06:34:43 +01:00
fonts : {
sans : 'DM Sans' ,
serif : 'DM Serif Display' ,
mono : 'DM Mono' ,
2022-11-24 03:38:14 +01:00
script : 'Homemade Apple' ,
2022-11-13 06:34:43 +01:00
} ,
} ) ,
] ,
transformers : [
transformerDirectives ( ) ,
transformerVariantGroup ( ) ,
] ,
2022-11-13 17:05:32 +01:00
theme : {
colors : {
2022-11-23 15:21:18 +01:00
primary : {
DEFAULT : 'var(--c-primary)' ,
active : 'var(--c-primary-active)' ,
} ,
2022-11-13 17:05:32 +01:00
} ,
} ,
2022-12-05 14:20:23 +01: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
} ] ,
2022-12-28 17:35:40 +01:00
[ 'box-shadow-outline' , { 'box-shadow' : '0 0 0 1px var(--c-primary)' } ] ,
2022-12-30 15:06:48 +01:00
[ 'mobile-padding-top' , { 'padding-top' : 'calc(4rem + 1px)' } ] , // in sm screen size header is fixed (instead of sticky) and parent have this padding, to prevent flickering in iOS Safari
2022-12-30 17:25:40 +01:00
[ 'mobile-padding-top-large-header' , { 'padding-top' : 'calc(6.5rem + 1px)' } ] ,
2022-12-30 15:06:48 +01:00
[ 'mobile-padding-bottom' , { 'padding-bottom' : '3.5rem' } ] , // in sm screen size footer is fixed (instead of sticky) and parent have this padding, to prevent flickering in iOS Safari
2022-12-05 14:20:23 +01:00
] ,
2022-11-13 06:34:43 +01:00
} )