forked from themeselection/flyonui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
47 lines (42 loc) · 1.36 KB
/
index.js
File metadata and controls
47 lines (42 loc) · 1.36 KB
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
45
46
47
import { version } from './package.json'
import { pluginOptionsHandler } from './functions/pluginOptionsHandler.js'
import { plugin } from './functions/plugin.js'
import variables from './functions/variables.js'
import themesObject from './theme/object.js'
import { base, components, utilities } from './imports.js'
export default plugin.withOptions(
options => {
return ({ addBase, addComponents, addUtilities }) => {
const { include, exclude, prefix = '' } = pluginOptionsHandler(options, addBase, themesObject, version)
const shouldIncludeItem = name => {
if (include && exclude) {
return include.includes(name) && !exclude.includes(name)
}
if (include) {
return include.includes(name)
}
if (exclude) {
return !exclude.includes(name)
}
return true
}
Object.entries(base).forEach(([name, item]) => {
if (!shouldIncludeItem(name)) return
item({ addBase, prefix })
})
Object.entries(components).forEach(([name, item]) => {
if (!shouldIncludeItem(name)) return
item({ addComponents, prefix })
})
Object.entries(utilities).forEach(([name, item]) => {
if (!shouldIncludeItem(name)) return
item({ addUtilities, prefix })
})
}
},
() => ({
theme: {
extend: variables
}
})
)