| 1 | import extractorMdc from '@unocss/extractor-mdc' |
| 2 | import { variantMatcher } from '@unocss/preset-mini/utils' |
| 3 | import { |
| 4 | defineConfig, |
| 5 | presetAttributify, |
| 6 | presetTypography, |
| 7 | presetWind3, |
| 8 | transformerDirectives, |
| 9 | transformerVariantGroup, |
| 10 | } from 'unocss' |
| 11 | |
| 12 | export default defineConfig({ |
| 13 | safelist: [ |
| 14 | '!opacity-0', |
| 15 | 'prose', |
| 16 | // See https://github.com/slidevjs/slidev/issues/1705 |
| 17 | 'grid-rows-[1fr_max-content]', |
| 18 | 'grid-cols-[1fr_max-content]', |
| 19 | ], |
| 20 | shortcuts: { |
| 21 | 'bg-main': 'bg-white dark:bg-[#121212]', |
| 22 | 'bg-active': 'bg-gray-400/10', |
| 23 | 'border-main': 'border-gray/20', |
| 24 | 'text-main': 'text-[#181818] dark:text-[#ddd]', |
| 25 | 'text-primary': 'color-$slidev-theme-primary', |
| 26 | 'bg-primary': 'bg-$slidev-theme-primary', |
| 27 | 'border-primary': 'border-$slidev-theme-primary', |
| 28 | 'abs-tl': 'absolute top-0 left-0', |
| 29 | 'abs-tr': 'absolute top-0 right-0', |
| 30 | 'abs-b': 'absolute bottom-0 left-0 right-0', |
| 31 | 'abs-bl': 'absolute bottom-0 left-0', |
| 32 | 'abs-br': 'absolute bottom-0 right-0', |
| 33 | |
| 34 | 'z-drawing': 'z-10', |
| 35 | 'z-camera': 'z-15', |
| 36 | 'z-dragging': 'z-18', |
| 37 | 'z-menu': 'z-20', |
| 38 | 'z-label': 'z-40', |
| 39 | 'z-nav': 'z-50', |
| 40 | 'z-context-menu': 'z-60', |
| 41 | 'z-modal': 'z-70', |
| 42 | 'z-focus-indicator': 'z-200', |
| 43 | |
| 44 | 'slidev-glass-effect': 'shadow-xl backdrop-blur-8 border border-main bg-main bg-opacity-75!', |
| 45 | }, |
| 46 | // Slidev Specific Variants, probably extrat to a preset later |
| 47 | variants: [ |
| 48 | // `forward:` and `backward:` variant to selectively apply styles based on the direction of the slide |
| 49 | // For example, `forward:text-red` will only apply to the slides that are navigated forward |
| 50 | variantMatcher('forward', input => ({ prefix: `.slidev-nav-go-forward ${input.prefix}` })), |
| 51 | variantMatcher('backward', input => ({ prefix: `.slidev-nav-go-backward ${input.prefix}` })), |
| 52 | ], |
| 53 | presets: [ |
| 54 | presetWind3(), |
| 55 | presetAttributify(), |
| 56 | presetTypography(), |
| 57 | /* Preset Icons is added in ../node/setups/unocss.ts */ |
| 58 | ], |
| 59 | transformers: [ |
| 60 | transformerDirectives({ enforce: 'pre' }), |
| 61 | transformerVariantGroup(), |
| 62 | ], |
| 63 | extractors: [ |
| 64 | extractorMdc(), |
| 65 | ], |
| 66 | }) |
| 67 |