-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.mjs
59 lines (55 loc) · 1.42 KB
/
index.mjs
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
48
49
50
51
52
53
54
55
56
57
58
59
import docHeader from './doc-header.mjs'
import theme from './theme.mjs'
import typography from './typography.mjs'
import cursor from './cursor.mjs'
import layout from './layout.mjs'
import margin from './margin.mjs'
import padding from './padding.mjs'
import overflow from './overflow.mjs'
import visibility from './visibility.mjs'
import objectFit from './object-fit.mjs'
import objectPosition from './object-position.mjs'
import outline from './outline.mjs'
import opacity from './opacity.mjs'
import media from './media.mjs'
import userSelect from './user-select.mjs'
import debug from './debug.mjs'
export default function enhanceStyles (props) {
try {
const config = JSON.parse(props)
const { queries={} } = config
let output = docHeader()
output += theme(config)
output += styles({config})
Object.keys(queries)
.map(
function (query) {
output += media(queries[query], styles({config, query}))
}
)
return output
} catch(err) {
throw err
}
}
function styles (state={}) {
const { config={}, query='' } = state
const label = query
? `-${query}`
: ''
return /*css*/`
${typography({config, label})}
${layout({config, label})}
${margin({config, label})}
${padding({config, label})}
${overflow(label)}
${visibility(label)}
${objectFit(label)}
${objectPosition(label)}
${outline(label)}
${opacity(label)}
${cursor(label)}
${userSelect(label)}
${debug()}
`
}