feat: 添加 Unocss 支持,更新配置并引入新组件
All checks were successful
/ test (push) Successful in 27s

This commit is contained in:
mac-mini-2024
2024-11-22 00:25:34 +08:00
parent da85a6715d
commit 7a69e5755d
10 changed files with 1022 additions and 63 deletions

59
unocss.config.ts Normal file
View File

@ -0,0 +1,59 @@
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants'
import { defineConfig, presetUno, presetWind, transformerVariantGroup } from 'unocss';
import { classes, globals } from './formkit.config.theme';
import { fkLibrary } from './formkit.config.fkLibrary';
const familyList = [...new Set(Object.values(fkLibrary).map(lib => lib.family))].filter(f => f) as string[]
const typeList = [...new Set(Object.values(fkLibrary).map(lib => lib.type))].filter(f => f) as string[]
console.debug(`familyList :>> `, familyList);
console.debug(`typeList :>> `, typeList);
const globalsR = [...new Set(
Object.values(globals).flatMap(v => Object.keys(v))
)];
const classesR = [...new Set(
// Object.values(classes).flatMap(v => Object.keys(v))
Object.keys(classes)
.filter(k =>
familyList.some(f => k.includes(f)) ||
typeList.some(t => k.includes(t))
)
.map(k => classes[k])
.flatMap(v => Object.keys(v))
.filter(className => !className.includes('[]'))
)]
// console.debug(`classesR :>> `, classesR);
export default defineConfig({
content: {
filesystem: [
'xx.ts',
],
inline: [
'!border-none', // for: "range__inner"
classesR.join(' '),
globalsR.join(' '),
async () => {
return '';
},
],
pipeline: {
// include: [
// /xx.ts($|\?)/,
// ],
}
},
presets: [
presetUno({
dark: 'media',
}),
],
transformers: [
transformerVariantGroup(),
],
extractors: [
extractorArbitraryVariants(),
],
})