-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
36 lines (34 loc) · 1.25 KB
/
index.js
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
import { flatten } from 'flat'
import plugin from 'tailwindcss/plugin'
const normalizeValues = (config) => Object.fromEntries(
Object.entries(flatten(config, { delimiter: '-', maxDepth: 2 })).sort(([a], [b]) => a === 'DEFAULT' ? -1 : 1)
)
export default plugin(({ matchUtilities, theme }) => {
matchUtilities(
{ 'text-fill': (value) => ({ '-webkit-text-fill-color': value }) },
{ values: normalizeValues(theme('textFillColor', theme('borderColor'))), type: ['color'] },
)
matchUtilities(
{ 'text-stroke': (value) => ({ '-webkit-text-stroke-color': value }) },
{ values: normalizeValues(theme('textStrokeColor', theme('borderColor'))), type: ['color'] },
)
matchUtilities(
{ 'text-stroke': (value) => ({ '-webkit-text-stroke-width': value }) },
{ values: normalizeValues(theme('textStrokeWidth', theme('borderWidth'))), type: ['length'] },
)
matchUtilities(
{ 'paint': (value) => ({ paintOrder: value }) },
{ values: normalizeValues(theme('paintOrder')) },
)
}, {
theme: {
paintOrder: {
'fsm': 'fill stroke markers',
'fms': 'fill markers stroke',
'sfm': 'stroke fill markers',
'smf': 'stroke markers fill',
'mfs': 'markers fill stroke',
'msf': 'markers stroke fill',
},
},
})