-
Notifications
You must be signed in to change notification settings - Fork 0
/
uno.config.ts
169 lines (164 loc) · 4.84 KB
/
uno.config.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/* eslint-disable no-param-reassign */
/* eslint-disable import/no-extraneous-dependencies */
import {
defineConfig,
presetAttributify,
presetIcons,
presetTypography,
presetUno,
presetWebFonts,
presetWind,
transformerDirectives,
transformerVariantGroup,
} from 'unocss'
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
import { getBreakpointWithPX } from './src/enums/breakpointEnum'
export default defineConfig({
content: {
pipeline: {
include: [
/src\/(.+\/)*.+\.(vue|html|jsx|tsx|ts|js|json)$/,
/public\/(.+\/)*.+\.html$/,
/index.html$/,
],
exclude: ['node_modules', '.git'],
},
},
shortcuts: [
[
'app-ease-spin',
'animate-name-spin-rotate animate-count-infinite animate-ease-[cubic-bezier(0.37,0.35,0.35,0.97)]',
],
[
'app-layout-header-anction-icon',
'cursor-pointer h-full px-2.5 flex justify-between items-center hover:bg-$hover-color',
],
[
'app-mtabs-anction-btn-wrapper',
'flex-1 border-l border-$app-border-color cursor-pointer transition-property-colors ease-in-out-300 flex-jc-ac text-$app-text-color',
],
['app-mtabs-anction-btn', 'op60 group-hover:op100 text-18px'],
],
theme: {
breakpoints: getBreakpointWithPX,
screen: getBreakpointWithPX,
fontFamily: {
segoe: [
'Segoe UI',
'Roboto',
'Helvetica Neue',
'Arial',
'Noto Sans',
'sans-serif',
],
},
outline: {
primary: ['2px solid var(--app-primary-color)', '0px'],
},
},
rules: [
[
/^flex((-(js|je|jc|jb|ja|jev|as|ae|ac|ab|ast|row|rowr|col|colr)){1,3})$/,
([, keyStr]) => {
return {
display: 'flex',
...Object.fromEntries(
keyStr
.split('-')
.slice(1)
.map((item) => {
return handleShortKeys(item)
})
),
}
},
],
[
/^ease-(?:(in|out|in-out)-)(\d+)$/,
([, timingFun, duration]) => {
return {
'transition-timing-function': `var(--app-bezier${
['in', 'out'].includes(timingFun) ? `-${timingFun}` : ''
})`,
'transition-duration': `${duration}ms`,
}
},
],
],
presets: [
presetUno(),
presetAttributify({
prefix: 'u:',
prefixedOnly: false,
}),
presetWind(),
presetIcons({
warn: true,
// mode: 'background-img',
collections: {
own: FileSystemIconLoader('src/assets/icons', (svg) =>
svg.replace(/^<svg /, '<svg fill="currentColor" ')
),
},
extraProperties: {
display: 'inline-block',
'vertical-align': 'middle',
},
customizations: {
customize(props) {
props.width = '1em'
props.height = '1em'
return props
},
},
}),
presetTypography(),
presetWebFonts({
fonts: {
'dm-sans': 'DM Sans',
'dm-serif': 'DM Serif Display',
},
}),
],
transformers: [transformerDirectives(), transformerVariantGroup()],
})
// eslint-disable-next-line complexity
function handleShortKeys(key: string): string[] {
const J = 'justify-content'
const A = 'align-items'
const D = 'flex-direction'
switch (key) {
case 'js':
return [J, 'flex-start']
case 'je':
return [J, 'flex-end']
case 'jc':
return [J, 'center']
case 'jb':
return [J, 'space-between']
case 'ja':
return [J, 'space-around']
case 'jev':
return [J, 'space-evenly']
case 'as':
return [A, 'flex-start']
case 'ae':
return [A, 'flex-end']
case 'ac':
return [A, 'center']
case 'ab':
return [A, 'baseline']
case 'ast':
return [A, 'stretch']
case 'row':
return [D, 'row']
case 'rowr':
return [D, 'row-reverse']
case 'col':
return [D, 'column']
case 'colr':
return [D, 'column-reverse']
default:
return []
}
}