// 忽略ts
// @ts-nocheck
import { defineConfig, presetIcons, presetUno, presetAttributify } from 'unocss'
import UnocssIcons from '@unocss/preset-icons'
import presetRemToPx from '@unocss/preset-rem-to-px'

export default defineConfig({
  theme: {
    colors: {
      primary: '#00DD99',
      success: '#2AC2B5',
      warning: '#F59211',
      danger: '#DF2525',
    },
  },
  presets: [
    presetUno(),
    presetAttributify(),
    presetIcons({
      // 图标默认样式
      extraProperties: {
        display: 'inline-block',
        height: '1em',
        width: '1em',
      },
      /* options */
    }),
    UnocssIcons(),
    // @ts-ignore
    presetRemToPx({ baseFontSize: 4 }), // 1rem = 4px
  ],
  rules: [
    [/^c-(\w+)$/, ([, d]) => ({ color: `#${d}` })],
    [/^fs-(\d+)$/, ([, d]) => ({ 'font-size': `${d}px` })],
    [
      /^c-(.*)$/,
      ([, c], { theme }) => {
        if (theme.colors[c]) return { color: theme.colors[c] }
      },
    ],
    // ['c-primary', { color: '#2AC2B5' }],
  ],
  shortcuts: {
    // 快捷方式到多个实用程序
    'page-top-bar': 'fs-24 font-bold c-2c2c2c px-30 h-60 lh-60 bg-white mb-10 rounded-4',
  },
})

