/
index.ts
44 lines (39 loc) · 1.26 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import type { Preset } from '@unocss/core'
import { autocompleteExtractorAttributify } from './autocomplete'
import { defaultIgnoreAttributes, extractorAttributify } from './extractor'
import type { AttributifyOptions } from './types'
import { variantAttributify } from './variant'
export * from './autocomplete'
export * from './extractor'
export * from './variant'
export * from './types'
export * from './jsx'
function presetAttributify(options: AttributifyOptions = {}): Preset {
options.strict = options.strict ?? false
options.prefix = options.prefix ?? 'un-'
options.prefixedOnly = options.prefixedOnly ?? false
options.nonValuedAttribute = options.nonValuedAttribute ?? true
options.ignoreAttributes = options.ignoreAttributes ?? defaultIgnoreAttributes
const variants = [
variantAttributify(options),
]
const extractors = [
extractorAttributify(options),
]
const autocompleteExtractors = [
autocompleteExtractorAttributify(options),
]
return {
name: '@unocss/preset-attributify',
enforce: 'post',
variants,
extractors,
options,
autocomplete: {
extractors: autocompleteExtractors,
},
extractorDefault: options.strict ? false : undefined,
}
}
export { presetAttributify }
export default presetAttributify