Skip to content

Commit

Permalink
type: declare preset-mini Theme type
Browse files Browse the repository at this point in the history
  • Loading branch information
KeJunMao committed Nov 28, 2023
1 parent ce9b578 commit 03dc2c8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { builtInPlatforms } from '@uni-helper/uni-env'
import type { Theme } from '@unocss/preset-mini'

export const theme = {
declare module '@unocss/preset-mini' {
interface Theme {
platforms: Record<string, string>
}
}

export const theme: Theme = {
platforms: builtInPlatforms.reduce((acc, platform) => {
acc[platform] = platform
const withoutPrefix = platform.replace(/^mp-/, '')
if (withoutPrefix && withoutPrefix !== platform)
acc[withoutPrefix] = platform
return acc
}, { mp: 'mp', app: 'app', quickapp: 'quickapp' } as any),
} as any
} as const

0 comments on commit 03dc2c8

Please sign in to comment.