
import { defineConfig, presetAttributify, transformerDirectives, transformerVariantGroup,presetUno } from 'unocss'

import { presetApplet, presetRemRpx, transformerApplet, transformerAttributify } from 'unocss-applet'



const isApplet = process.env?.UNI_PLATFORM?.startsWith('mp') ?? false
const presets = []
const transformers = []

if (isApplet) {
  // presets.push(presetUno())
  presets.push(presetApplet())
  presets.push(presetRemRpx())
  transformers.push(transformerAttributify({ ignoreAttributes: ['block'] }))
  transformers.push(transformerApplet())
}
else {
  // presets.push(presetUno())
  presets.push(presetApplet())
  presets.push(presetAttributify())
  presets.push(presetRemRpx({ mode: 'rpx2rem' }))
}

export default defineConfig({
  shortcuts: {
    'flex-center':'flex items-center justify-center',
  },
  theme:{
    colors: {
      primary: '#ee2c37',

    },
    spacing: {
        'base':'30rpx'
    }
  },
  presets: presets,
  transformers: [transformerDirectives(), transformerVariantGroup(), ...transformers],
  rules: [
    [
      'p-safe',
      {
        padding: 'env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)',
      },
    ],
    ['pt-safe', { 'padding-top': 'env(safe-area-inset-top)' }],
    ['pb-safe', { 'padding-bottom': 'env(safe-area-inset-bottom)' }],
  ],
})
