import { defineConfig, presetIcons } from 'unocss'

// https://github.com/MellowCo/unocss-preset-weapp
import presetWeapp from 'unocss-preset-weapp'
import { defaultAttributes, extractorAttributify, transformerClass } from 'unocss-preset-weapp/transformer'

const { presetWeappAttributify, transformerAttributify } = extractorAttributify({
    attributes: [...defaultAttributes, 'icon'],
})

export default defineConfig({
    shortcuts: [
        {
            bg: 'bg-[#F4F5F7]',
            'border-base': 'border border-[#eee]',
            'flex-center': 'flex justify-center items-center',
        },
    ],
    presets: [
        // https://github.com/MellowCo/unocss-preset-weapp
        presetWeapp(),
        // autocomplete attributes
        presetWeappAttributify(),
        // icon
        presetIcons({
            prefix: 'icon-',
            extraProperties: {
                display: 'inline-flex',
            },
        }),
    ],
    transformers: [
        // https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerAttributify
        transformerAttributify(),

        // https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
        transformerClass(),
    ],
})
