@unocss/preset-mini 0.44.4 → 0.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/colors.cjs +704 -333
- package/dist/chunks/colors.mjs +680 -333
- package/dist/chunks/colors2.cjs +333 -688
- package/dist/chunks/colors2.mjs +333 -664
- package/dist/chunks/decoration.cjs +770 -0
- package/dist/chunks/decoration.mjs +724 -0
- package/dist/chunks/default.cjs +291 -280
- package/dist/chunks/default.mjs +278 -256
- package/dist/chunks/default2.cjs +276 -753
- package/dist/chunks/default2.mjs +252 -715
- package/dist/chunks/default3.cjs +2 -2
- package/dist/chunks/default3.mjs +2 -2
- package/dist/colors.cjs +1 -1
- package/dist/colors.mjs +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/rules.cjs +48 -48
- package/dist/rules.mjs +3 -3
- package/dist/theme.cjs +4 -4
- package/dist/theme.mjs +4 -4
- package/dist/utils.cjs +1 -1
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +1 -1
- package/dist/variants.d.ts +1 -1
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunks/transform.cjs +0 -298
- package/dist/chunks/transform.mjs +0 -277
package/dist/chunks/colors2.mjs
CHANGED
|
@@ -1,668 +1,337 @@
|
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
1
|
+
const colors = {
|
|
2
|
+
inherit: "inherit",
|
|
3
|
+
current: "currentColor",
|
|
4
|
+
transparent: "transparent",
|
|
5
|
+
black: "#000",
|
|
6
|
+
white: "#fff",
|
|
7
|
+
rose: {
|
|
8
|
+
50: "#fff1f2",
|
|
9
|
+
100: "#ffe4e6",
|
|
10
|
+
200: "#fecdd3",
|
|
11
|
+
300: "#fda4af",
|
|
12
|
+
400: "#fb7185",
|
|
13
|
+
500: "#f43f5e",
|
|
14
|
+
600: "#e11d48",
|
|
15
|
+
700: "#be123c",
|
|
16
|
+
800: "#9f1239",
|
|
17
|
+
900: "#881337"
|
|
18
|
+
},
|
|
19
|
+
pink: {
|
|
20
|
+
50: "#fdf2f8",
|
|
21
|
+
100: "#fce7f3",
|
|
22
|
+
200: "#fbcfe8",
|
|
23
|
+
300: "#f9a8d4",
|
|
24
|
+
400: "#f472b6",
|
|
25
|
+
500: "#ec4899",
|
|
26
|
+
600: "#db2777",
|
|
27
|
+
700: "#be185d",
|
|
28
|
+
800: "#9d174d",
|
|
29
|
+
900: "#831843"
|
|
30
|
+
},
|
|
31
|
+
fuchsia: {
|
|
32
|
+
50: "#fdf4ff",
|
|
33
|
+
100: "#fae8ff",
|
|
34
|
+
200: "#f5d0fe",
|
|
35
|
+
300: "#f0abfc",
|
|
36
|
+
400: "#e879f9",
|
|
37
|
+
500: "#d946ef",
|
|
38
|
+
600: "#c026d3",
|
|
39
|
+
700: "#a21caf",
|
|
40
|
+
800: "#86198f",
|
|
41
|
+
900: "#701a75"
|
|
42
|
+
},
|
|
43
|
+
purple: {
|
|
44
|
+
50: "#faf5ff",
|
|
45
|
+
100: "#f3e8ff",
|
|
46
|
+
200: "#e9d5ff",
|
|
47
|
+
300: "#d8b4fe",
|
|
48
|
+
400: "#c084fc",
|
|
49
|
+
500: "#a855f7",
|
|
50
|
+
600: "#9333ea",
|
|
51
|
+
700: "#7e22ce",
|
|
52
|
+
800: "#6b21a8",
|
|
53
|
+
900: "#581c87"
|
|
54
|
+
},
|
|
55
|
+
violet: {
|
|
56
|
+
50: "#f5f3ff",
|
|
57
|
+
100: "#ede9fe",
|
|
58
|
+
200: "#ddd6fe",
|
|
59
|
+
300: "#c4b5fd",
|
|
60
|
+
400: "#a78bfa",
|
|
61
|
+
500: "#8b5cf6",
|
|
62
|
+
600: "#7c3aed",
|
|
63
|
+
700: "#6d28d9",
|
|
64
|
+
800: "#5b21b6",
|
|
65
|
+
900: "#4c1d95"
|
|
66
|
+
},
|
|
67
|
+
indigo: {
|
|
68
|
+
50: "#eef2ff",
|
|
69
|
+
100: "#e0e7ff",
|
|
70
|
+
200: "#c7d2fe",
|
|
71
|
+
300: "#a5b4fc",
|
|
72
|
+
400: "#818cf8",
|
|
73
|
+
500: "#6366f1",
|
|
74
|
+
600: "#4f46e5",
|
|
75
|
+
700: "#4338ca",
|
|
76
|
+
800: "#3730a3",
|
|
77
|
+
900: "#312e81"
|
|
78
|
+
},
|
|
79
|
+
blue: {
|
|
80
|
+
50: "#eff6ff",
|
|
81
|
+
100: "#dbeafe",
|
|
82
|
+
200: "#bfdbfe",
|
|
83
|
+
300: "#93c5fd",
|
|
84
|
+
400: "#60a5fa",
|
|
85
|
+
500: "#3b82f6",
|
|
86
|
+
600: "#2563eb",
|
|
87
|
+
700: "#1d4ed8",
|
|
88
|
+
800: "#1e40af",
|
|
89
|
+
900: "#1e3a8a"
|
|
90
|
+
},
|
|
91
|
+
sky: {
|
|
92
|
+
50: "#f0f9ff",
|
|
93
|
+
100: "#e0f2fe",
|
|
94
|
+
200: "#bae6fd",
|
|
95
|
+
300: "#7dd3fc",
|
|
96
|
+
400: "#38bdf8",
|
|
97
|
+
500: "#0ea5e9",
|
|
98
|
+
600: "#0284c7",
|
|
99
|
+
700: "#0369a1",
|
|
100
|
+
800: "#075985",
|
|
101
|
+
900: "#0c4a6e"
|
|
102
|
+
},
|
|
103
|
+
cyan: {
|
|
104
|
+
50: "#ecfeff",
|
|
105
|
+
100: "#cffafe",
|
|
106
|
+
200: "#a5f3fc",
|
|
107
|
+
300: "#67e8f9",
|
|
108
|
+
400: "#22d3ee",
|
|
109
|
+
500: "#06b6d4",
|
|
110
|
+
600: "#0891b2",
|
|
111
|
+
700: "#0e7490",
|
|
112
|
+
800: "#155e75",
|
|
113
|
+
900: "#164e63"
|
|
114
|
+
},
|
|
115
|
+
teal: {
|
|
116
|
+
50: "#f0fdfa",
|
|
117
|
+
100: "#ccfbf1",
|
|
118
|
+
200: "#99f6e4",
|
|
119
|
+
300: "#5eead4",
|
|
120
|
+
400: "#2dd4bf",
|
|
121
|
+
500: "#14b8a6",
|
|
122
|
+
600: "#0d9488",
|
|
123
|
+
700: "#0f766e",
|
|
124
|
+
800: "#115e59",
|
|
125
|
+
900: "#134e4a"
|
|
126
|
+
},
|
|
127
|
+
emerald: {
|
|
128
|
+
50: "#ecfdf5",
|
|
129
|
+
100: "#d1fae5",
|
|
130
|
+
200: "#a7f3d0",
|
|
131
|
+
300: "#6ee7b7",
|
|
132
|
+
400: "#34d399",
|
|
133
|
+
500: "#10b981",
|
|
134
|
+
600: "#059669",
|
|
135
|
+
700: "#047857",
|
|
136
|
+
800: "#065f46",
|
|
137
|
+
900: "#064e3b"
|
|
138
|
+
},
|
|
139
|
+
green: {
|
|
140
|
+
50: "#f0fdf4",
|
|
141
|
+
100: "#dcfce7",
|
|
142
|
+
200: "#bbf7d0",
|
|
143
|
+
300: "#86efac",
|
|
144
|
+
400: "#4ade80",
|
|
145
|
+
500: "#22c55e",
|
|
146
|
+
600: "#16a34a",
|
|
147
|
+
700: "#15803d",
|
|
148
|
+
800: "#166534",
|
|
149
|
+
900: "#14532d"
|
|
150
|
+
},
|
|
151
|
+
lime: {
|
|
152
|
+
50: "#f7fee7",
|
|
153
|
+
100: "#ecfccb",
|
|
154
|
+
200: "#d9f99d",
|
|
155
|
+
300: "#bef264",
|
|
156
|
+
400: "#a3e635",
|
|
157
|
+
500: "#84cc16",
|
|
158
|
+
600: "#65a30d",
|
|
159
|
+
700: "#4d7c0f",
|
|
160
|
+
800: "#3f6212",
|
|
161
|
+
900: "#365314"
|
|
162
|
+
},
|
|
163
|
+
yellow: {
|
|
164
|
+
50: "#fefce8",
|
|
165
|
+
100: "#fef9c3",
|
|
166
|
+
200: "#fef08a",
|
|
167
|
+
300: "#fde047",
|
|
168
|
+
400: "#facc15",
|
|
169
|
+
500: "#eab308",
|
|
170
|
+
600: "#ca8a04",
|
|
171
|
+
700: "#a16207",
|
|
172
|
+
800: "#854d0e",
|
|
173
|
+
900: "#713f12"
|
|
174
|
+
},
|
|
175
|
+
amber: {
|
|
176
|
+
50: "#fffbeb",
|
|
177
|
+
100: "#fef3c7",
|
|
178
|
+
200: "#fde68a",
|
|
179
|
+
300: "#fcd34d",
|
|
180
|
+
400: "#fbbf24",
|
|
181
|
+
500: "#f59e0b",
|
|
182
|
+
600: "#d97706",
|
|
183
|
+
700: "#b45309",
|
|
184
|
+
800: "#92400e",
|
|
185
|
+
900: "#78350f"
|
|
186
|
+
},
|
|
187
|
+
orange: {
|
|
188
|
+
50: "#fff7ed",
|
|
189
|
+
100: "#ffedd5",
|
|
190
|
+
200: "#fed7aa",
|
|
191
|
+
300: "#fdba74",
|
|
192
|
+
400: "#fb923c",
|
|
193
|
+
500: "#f97316",
|
|
194
|
+
600: "#ea580c",
|
|
195
|
+
700: "#c2410c",
|
|
196
|
+
800: "#9a3412",
|
|
197
|
+
900: "#7c2d12"
|
|
198
|
+
},
|
|
199
|
+
red: {
|
|
200
|
+
50: "#fef2f2",
|
|
201
|
+
100: "#fee2e2",
|
|
202
|
+
200: "#fecaca",
|
|
203
|
+
300: "#fca5a5",
|
|
204
|
+
400: "#f87171",
|
|
205
|
+
500: "#ef4444",
|
|
206
|
+
600: "#dc2626",
|
|
207
|
+
700: "#b91c1c",
|
|
208
|
+
800: "#991b1b",
|
|
209
|
+
900: "#7f1d1d"
|
|
210
|
+
},
|
|
211
|
+
gray: {
|
|
212
|
+
50: "#f9fafb",
|
|
213
|
+
100: "#f3f4f6",
|
|
214
|
+
200: "#e5e7eb",
|
|
215
|
+
300: "#d1d5db",
|
|
216
|
+
400: "#9ca3af",
|
|
217
|
+
500: "#6b7280",
|
|
218
|
+
600: "#4b5563",
|
|
219
|
+
700: "#374151",
|
|
220
|
+
800: "#1f2937",
|
|
221
|
+
900: "#111827"
|
|
222
|
+
},
|
|
223
|
+
slate: {
|
|
224
|
+
50: "#f8fafc",
|
|
225
|
+
100: "#f1f5f9",
|
|
226
|
+
200: "#e2e8f0",
|
|
227
|
+
300: "#cbd5e1",
|
|
228
|
+
400: "#94a3b8",
|
|
229
|
+
500: "#64748b",
|
|
230
|
+
600: "#475569",
|
|
231
|
+
700: "#334155",
|
|
232
|
+
800: "#1e293b",
|
|
233
|
+
900: "#0f172a"
|
|
234
|
+
},
|
|
235
|
+
zinc: {
|
|
236
|
+
50: "#fafafa",
|
|
237
|
+
100: "#f4f4f5",
|
|
238
|
+
200: "#e4e4e7",
|
|
239
|
+
300: "#d4d4d8",
|
|
240
|
+
400: "#a1a1aa",
|
|
241
|
+
500: "#71717a",
|
|
242
|
+
600: "#52525b",
|
|
243
|
+
700: "#3f3f46",
|
|
244
|
+
800: "#27272a",
|
|
245
|
+
900: "#18181b"
|
|
246
|
+
},
|
|
247
|
+
neutral: {
|
|
248
|
+
50: "#fafafa",
|
|
249
|
+
100: "#f5f5f5",
|
|
250
|
+
200: "#e5e5e5",
|
|
251
|
+
300: "#d4d4d4",
|
|
252
|
+
400: "#a3a3a3",
|
|
253
|
+
500: "#737373",
|
|
254
|
+
600: "#525252",
|
|
255
|
+
700: "#404040",
|
|
256
|
+
800: "#262626",
|
|
257
|
+
900: "#171717"
|
|
258
|
+
},
|
|
259
|
+
stone: {
|
|
260
|
+
50: "#fafaf9",
|
|
261
|
+
100: "#f5f5f4",
|
|
262
|
+
200: "#e7e5e4",
|
|
263
|
+
300: "#d6d3d1",
|
|
264
|
+
400: "#a8a29e",
|
|
265
|
+
500: "#78716c",
|
|
266
|
+
600: "#57534e",
|
|
267
|
+
700: "#44403c",
|
|
268
|
+
800: "#292524",
|
|
269
|
+
900: "#1c1917"
|
|
270
|
+
},
|
|
271
|
+
light: {
|
|
272
|
+
50: "#fdfdfd",
|
|
273
|
+
100: "#fcfcfc",
|
|
274
|
+
200: "#fafafa",
|
|
275
|
+
300: "#f8f9fa",
|
|
276
|
+
400: "#f6f6f6",
|
|
277
|
+
500: "#f2f2f2",
|
|
278
|
+
600: "#f1f3f5",
|
|
279
|
+
700: "#e9ecef",
|
|
280
|
+
800: "#dee2e6",
|
|
281
|
+
900: "#dde1e3"
|
|
282
|
+
},
|
|
283
|
+
dark: {
|
|
284
|
+
50: "#4a4a4a",
|
|
285
|
+
100: "#3c3c3c",
|
|
286
|
+
200: "#323232",
|
|
287
|
+
300: "#2d2d2d",
|
|
288
|
+
400: "#222222",
|
|
289
|
+
500: "#1f1f1f",
|
|
290
|
+
600: "#1c1c1e",
|
|
291
|
+
700: "#1b1b1b",
|
|
292
|
+
800: "#181818",
|
|
293
|
+
900: "#0f0f0f"
|
|
294
|
+
},
|
|
295
|
+
get lightblue() {
|
|
296
|
+
return this.sky;
|
|
297
|
+
},
|
|
298
|
+
get lightBlue() {
|
|
299
|
+
return this.sky;
|
|
300
|
+
},
|
|
301
|
+
get warmgray() {
|
|
302
|
+
return this.stone;
|
|
303
|
+
},
|
|
304
|
+
get warmGray() {
|
|
305
|
+
return this.stone;
|
|
306
|
+
},
|
|
307
|
+
get truegray() {
|
|
308
|
+
return this.neutral;
|
|
309
|
+
},
|
|
310
|
+
get trueGray() {
|
|
311
|
+
return this.neutral;
|
|
312
|
+
},
|
|
313
|
+
get coolgray() {
|
|
314
|
+
return this.gray;
|
|
315
|
+
},
|
|
316
|
+
get coolGray() {
|
|
317
|
+
return this.gray;
|
|
318
|
+
},
|
|
319
|
+
get bluegray() {
|
|
320
|
+
return this.slate;
|
|
321
|
+
},
|
|
322
|
+
get blueGray() {
|
|
323
|
+
return this.slate;
|
|
228
324
|
}
|
|
229
|
-
}
|
|
230
|
-
function bracket(str) {
|
|
231
|
-
return bracketWithType(str);
|
|
232
|
-
}
|
|
233
|
-
function bracketOfColor(str) {
|
|
234
|
-
return bracketWithType(str, "color");
|
|
235
|
-
}
|
|
236
|
-
function bracketOfLength(str) {
|
|
237
|
-
return bracketWithType(str, "length");
|
|
238
|
-
}
|
|
239
|
-
function bracketOfPosition(str) {
|
|
240
|
-
return bracketWithType(str, "position");
|
|
241
|
-
}
|
|
242
|
-
function cssvar(str) {
|
|
243
|
-
if (str.match(/^\$\S/))
|
|
244
|
-
return `var(--${escapeSelector(str.slice(1))})`;
|
|
245
|
-
}
|
|
246
|
-
function time(str) {
|
|
247
|
-
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
248
|
-
if (!match)
|
|
249
|
-
return;
|
|
250
|
-
const [, n, unit] = match;
|
|
251
|
-
const num = parseFloat(n);
|
|
252
|
-
if (!Number.isNaN(num))
|
|
253
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
254
|
-
}
|
|
255
|
-
function degree(str) {
|
|
256
|
-
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
|
|
257
|
-
if (!match)
|
|
258
|
-
return;
|
|
259
|
-
const [, n, unit] = match;
|
|
260
|
-
const num = parseFloat(n);
|
|
261
|
-
if (!Number.isNaN(num))
|
|
262
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
263
|
-
}
|
|
264
|
-
function global(str) {
|
|
265
|
-
if (globalKeywords.includes(str))
|
|
266
|
-
return str;
|
|
267
|
-
}
|
|
268
|
-
function properties(str) {
|
|
269
|
-
if (str.split(",").every((prop) => cssProps.includes(prop)))
|
|
270
|
-
return str;
|
|
271
|
-
}
|
|
272
|
-
function position(str) {
|
|
273
|
-
if (["top", "left", "right", "bottom", "center"].includes(str))
|
|
274
|
-
return str;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
const valueHandlers = {
|
|
278
|
-
__proto__: null,
|
|
279
|
-
numberWithUnit: numberWithUnit,
|
|
280
|
-
auto: auto,
|
|
281
|
-
rem: rem,
|
|
282
|
-
px: px,
|
|
283
|
-
number: number,
|
|
284
|
-
percent: percent,
|
|
285
|
-
fraction: fraction,
|
|
286
|
-
bracket: bracket,
|
|
287
|
-
bracketOfColor: bracketOfColor,
|
|
288
|
-
bracketOfLength: bracketOfLength,
|
|
289
|
-
bracketOfPosition: bracketOfPosition,
|
|
290
|
-
cssvar: cssvar,
|
|
291
|
-
time: time,
|
|
292
|
-
degree: degree,
|
|
293
|
-
global: global,
|
|
294
|
-
properties: properties,
|
|
295
|
-
position: position
|
|
296
325
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (v != null)
|
|
306
|
-
return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
function getThemeColor(theme, colors) {
|
|
310
|
-
let obj = theme.colors;
|
|
311
|
-
let index = -1;
|
|
312
|
-
for (const c of colors) {
|
|
313
|
-
index += 1;
|
|
314
|
-
if (obj && typeof obj !== "string") {
|
|
315
|
-
const camel = colors.slice(index).join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase());
|
|
316
|
-
if (obj[camel])
|
|
317
|
-
return obj[camel];
|
|
318
|
-
if (obj[c]) {
|
|
319
|
-
obj = obj[c];
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return void 0;
|
|
324
|
-
}
|
|
325
|
-
return obj;
|
|
326
|
-
}
|
|
327
|
-
function parseColor$1(body, theme) {
|
|
328
|
-
const split = body.split(/(?:\/|:)/);
|
|
329
|
-
let main, opacity;
|
|
330
|
-
if (split[0] === "[color") {
|
|
331
|
-
main = split.slice(0, 2).join(":");
|
|
332
|
-
opacity = split[2];
|
|
333
|
-
} else {
|
|
334
|
-
[main, opacity] = split;
|
|
335
|
-
}
|
|
336
|
-
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
337
|
-
const [name] = colors;
|
|
338
|
-
if (!name)
|
|
339
|
-
return;
|
|
340
|
-
let color;
|
|
341
|
-
const bracket = handler.bracketOfColor(main);
|
|
342
|
-
const bracketOrMain = bracket || main;
|
|
343
|
-
if (bracketOrMain.startsWith("#"))
|
|
344
|
-
color = bracketOrMain;
|
|
345
|
-
else if (bracketOrMain.startsWith("hex-"))
|
|
346
|
-
color = `#${bracketOrMain.slice(4)}`;
|
|
347
|
-
else if (main.startsWith("$"))
|
|
348
|
-
color = handler.cssvar(main);
|
|
349
|
-
color = color || bracket;
|
|
350
|
-
let no = "DEFAULT";
|
|
351
|
-
if (!color) {
|
|
352
|
-
let colorData;
|
|
353
|
-
const [scale] = colors.slice(-1);
|
|
354
|
-
if (scale.match(/^\d+$/)) {
|
|
355
|
-
no = scale;
|
|
356
|
-
colorData = getThemeColor(theme, colors.slice(0, -1));
|
|
357
|
-
if (!colorData || typeof colorData === "string")
|
|
358
|
-
color = void 0;
|
|
359
|
-
else
|
|
360
|
-
color = colorData[no];
|
|
361
|
-
} else {
|
|
362
|
-
colorData = getThemeColor(theme, colors);
|
|
363
|
-
if (!colorData && colors.length <= 2) {
|
|
364
|
-
[, no = no] = colors;
|
|
365
|
-
colorData = getThemeColor(theme, [name]);
|
|
366
|
-
}
|
|
367
|
-
if (typeof colorData === "string")
|
|
368
|
-
color = colorData;
|
|
369
|
-
else if (no && colorData)
|
|
370
|
-
color = colorData[no];
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
return {
|
|
374
|
-
opacity,
|
|
375
|
-
name,
|
|
376
|
-
no,
|
|
377
|
-
color,
|
|
378
|
-
cssColor: parseCssColor(color),
|
|
379
|
-
alpha: handler.bracket.cssvar.percent(opacity ?? "")
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
function colorResolver(property, varName, shouldPass) {
|
|
383
|
-
return ([, body], { theme }) => {
|
|
384
|
-
const data = parseColor$1(body, theme);
|
|
385
|
-
if (!data)
|
|
386
|
-
return;
|
|
387
|
-
const { alpha, color, cssColor } = data;
|
|
388
|
-
const css = {};
|
|
389
|
-
if (cssColor) {
|
|
390
|
-
if (alpha != null) {
|
|
391
|
-
css[property] = colorToString(cssColor, alpha);
|
|
392
|
-
} else {
|
|
393
|
-
css[`--un-${varName}-opacity`] = colorOpacityToString(cssColor);
|
|
394
|
-
css[property] = colorToString(cssColor, `var(--un-${varName}-opacity)`);
|
|
395
|
-
}
|
|
396
|
-
} else if (color) {
|
|
397
|
-
css[property] = colorToString(color, alpha);
|
|
398
|
-
}
|
|
399
|
-
if (shouldPass?.(css) !== false)
|
|
400
|
-
return css;
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
function colorableShadows(shadows, colorVar) {
|
|
404
|
-
const colored = [];
|
|
405
|
-
shadows = toArray(shadows);
|
|
406
|
-
for (let i = 0; i < shadows.length; i++) {
|
|
407
|
-
const components = getComponents(shadows[i], " ", 6);
|
|
408
|
-
if (!components || components.length < 3)
|
|
409
|
-
return shadows;
|
|
410
|
-
const color = parseCssColor(components.pop());
|
|
411
|
-
if (color == null)
|
|
412
|
-
return shadows;
|
|
413
|
-
colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
|
|
414
|
-
}
|
|
415
|
-
return colored;
|
|
416
|
-
}
|
|
417
|
-
function hasParseableColor(color, theme) {
|
|
418
|
-
return color != null && !!parseColor$1(color, theme)?.color;
|
|
419
|
-
}
|
|
420
|
-
function resolveBreakpoints({ theme, generator }) {
|
|
421
|
-
let breakpoints;
|
|
422
|
-
if (generator.userConfig && generator.userConfig.theme)
|
|
423
|
-
breakpoints = generator.userConfig.theme.breakpoints;
|
|
424
|
-
if (!breakpoints)
|
|
425
|
-
breakpoints = theme.breakpoints;
|
|
426
|
-
return breakpoints;
|
|
427
|
-
}
|
|
428
|
-
function resolveVerticalBreakpoints({ theme, generator }) {
|
|
429
|
-
let verticalBreakpoints;
|
|
430
|
-
if (generator.userConfig && generator.userConfig.theme)
|
|
431
|
-
verticalBreakpoints = generator.userConfig.theme.verticalBreakpoints;
|
|
432
|
-
if (!verticalBreakpoints)
|
|
433
|
-
verticalBreakpoints = theme.verticalBreakpoints;
|
|
434
|
-
return verticalBreakpoints;
|
|
435
|
-
}
|
|
436
|
-
function makeGlobalStaticRules(prefix, property) {
|
|
437
|
-
return globalKeywords.map((keyword) => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }]);
|
|
438
|
-
}
|
|
439
|
-
function getComponent(str, open, close, separator) {
|
|
440
|
-
if (str === "")
|
|
441
|
-
return;
|
|
442
|
-
const l = str.length;
|
|
443
|
-
let parenthesis = 0;
|
|
444
|
-
for (let i = 0; i < l; i++) {
|
|
445
|
-
switch (str[i]) {
|
|
446
|
-
case open:
|
|
447
|
-
parenthesis++;
|
|
448
|
-
break;
|
|
449
|
-
case close:
|
|
450
|
-
if (--parenthesis < 0)
|
|
451
|
-
return;
|
|
452
|
-
break;
|
|
453
|
-
case separator:
|
|
454
|
-
if (parenthesis === 0) {
|
|
455
|
-
if (i === 0 || i === l - 1)
|
|
456
|
-
return;
|
|
457
|
-
return [
|
|
458
|
-
str.slice(0, i),
|
|
459
|
-
str.slice(i + 1)
|
|
460
|
-
];
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return [
|
|
465
|
-
str,
|
|
466
|
-
""
|
|
467
|
-
];
|
|
468
|
-
}
|
|
469
|
-
function getComponents(str, separator, limit) {
|
|
470
|
-
if (separator.length !== 1)
|
|
471
|
-
return;
|
|
472
|
-
limit = limit ?? 10;
|
|
473
|
-
const components = [];
|
|
474
|
-
let i = 0;
|
|
475
|
-
while (str !== "") {
|
|
476
|
-
if (++i > limit)
|
|
477
|
-
return;
|
|
478
|
-
const componentPair = getComponent(str, "(", ")", separator);
|
|
479
|
-
if (!componentPair)
|
|
480
|
-
return;
|
|
481
|
-
const [component, rest] = componentPair;
|
|
482
|
-
components.push(component);
|
|
483
|
-
str = rest;
|
|
484
|
-
}
|
|
485
|
-
if (components.length > 0)
|
|
486
|
-
return components;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
490
|
-
const alphaPlaceholders = ["%alpha", "<alpha-value>"];
|
|
491
|
-
const alphaPlaceholdersRE = new RegExp(alphaPlaceholders.map((v) => escapeRegExp(v)).join("|"));
|
|
492
|
-
function hex2rgba(hex = "") {
|
|
493
|
-
const color = parseHexColor(hex);
|
|
494
|
-
if (color != null) {
|
|
495
|
-
const { components, alpha } = color;
|
|
496
|
-
if (alpha == null)
|
|
497
|
-
return components;
|
|
498
|
-
return [...components, alpha];
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
function parseCssColor(str = "") {
|
|
502
|
-
const color = parseColor(str);
|
|
503
|
-
if (color == null || color === false)
|
|
504
|
-
return;
|
|
505
|
-
const { type: casedType, components, alpha } = color;
|
|
506
|
-
const type = casedType.toLowerCase();
|
|
507
|
-
if (components.length === 0)
|
|
508
|
-
return;
|
|
509
|
-
if (["rgba", "hsla"].includes(type) && alpha == null)
|
|
510
|
-
return;
|
|
511
|
-
if (cssColorFunctions.includes(type) && ![1, 3].includes(components.length))
|
|
512
|
-
return;
|
|
513
|
-
return {
|
|
514
|
-
type,
|
|
515
|
-
components: components.map((c) => typeof c === "string" ? c.trim() : c),
|
|
516
|
-
alpha: typeof alpha === "string" ? alpha.trim() : alpha
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function colorOpacityToString(color) {
|
|
520
|
-
const alpha = color.alpha ?? 1;
|
|
521
|
-
return typeof alpha === "string" && alphaPlaceholders.includes(alpha) ? 1 : alpha;
|
|
522
|
-
}
|
|
523
|
-
function colorToString(color, alphaOverride) {
|
|
524
|
-
if (typeof color === "string")
|
|
525
|
-
return color.replace(alphaPlaceholdersRE, `${alphaOverride ?? 1}`);
|
|
526
|
-
const { components } = color;
|
|
527
|
-
let { alpha, type } = color;
|
|
528
|
-
alpha = alphaOverride ?? alpha;
|
|
529
|
-
type = type.toLowerCase();
|
|
530
|
-
if (["hsla", "hsl", "rgba", "rgb"].includes(type))
|
|
531
|
-
return `${type.replace("a", "")}a(${components.join(",")}${alpha == null ? "" : `,${alpha}`})`;
|
|
532
|
-
alpha = alpha == null ? "" : ` / ${alpha}`;
|
|
533
|
-
if (cssColorFunctions.includes(type))
|
|
534
|
-
return `${type}(${components.join(" ")}${alpha})`;
|
|
535
|
-
return `color(${type} ${components.join(" ")}${alpha})`;
|
|
536
|
-
}
|
|
537
|
-
function parseColor(str) {
|
|
538
|
-
if (!str)
|
|
539
|
-
return;
|
|
540
|
-
let color = parseHexColor(str);
|
|
541
|
-
if (color != null)
|
|
542
|
-
return color;
|
|
543
|
-
color = cssColorKeyword(str);
|
|
544
|
-
if (color != null)
|
|
545
|
-
return color;
|
|
546
|
-
color = parseCssCommaColorFunction(str);
|
|
547
|
-
if (color != null)
|
|
548
|
-
return color;
|
|
549
|
-
color = parseCssSpaceColorFunction(str);
|
|
550
|
-
if (color != null)
|
|
551
|
-
return color;
|
|
552
|
-
color = parseCssColorFunction(str);
|
|
553
|
-
if (color != null)
|
|
554
|
-
return color;
|
|
555
|
-
}
|
|
556
|
-
function parseHexColor(str) {
|
|
557
|
-
const [, body] = str.match(/^#([\da-f]+)$/i) || [];
|
|
558
|
-
if (!body)
|
|
559
|
-
return;
|
|
560
|
-
switch (body.length) {
|
|
561
|
-
case 3:
|
|
562
|
-
case 4:
|
|
563
|
-
const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n);
|
|
564
|
-
return {
|
|
565
|
-
type: "rgb",
|
|
566
|
-
components: digits.slice(0, 3),
|
|
567
|
-
alpha: body.length === 3 ? void 0 : Math.round(digits[3] / 255 * 100) / 100
|
|
568
|
-
};
|
|
569
|
-
case 6:
|
|
570
|
-
case 8:
|
|
571
|
-
const value = Number.parseInt(body, 16);
|
|
572
|
-
return {
|
|
573
|
-
type: "rgb",
|
|
574
|
-
components: body.length === 6 ? [value >> 16 & 255, value >> 8 & 255, value & 255] : [value >> 24 & 255, value >> 16 & 255, value >> 8 & 255],
|
|
575
|
-
alpha: body.length === 6 ? void 0 : Math.round((value & 255) / 255 * 100) / 100
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
function cssColorKeyword(str) {
|
|
580
|
-
const color = {
|
|
581
|
-
rebeccapurple: [102, 51, 153, 1]
|
|
582
|
-
}[str];
|
|
583
|
-
if (color != null) {
|
|
584
|
-
return {
|
|
585
|
-
type: "rgb",
|
|
586
|
-
components: color.slice(0, 3),
|
|
587
|
-
alpha: color[3]
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
function parseCssCommaColorFunction(color) {
|
|
592
|
-
const match = color.match(/^(rgb|rgba|hsl|hsla)\((.+)\)$/i);
|
|
593
|
-
if (!match)
|
|
594
|
-
return;
|
|
595
|
-
const [, type, componentString] = match;
|
|
596
|
-
const components = getComponents(componentString, ",", 5);
|
|
597
|
-
if (components) {
|
|
598
|
-
if ([3, 4].includes(components.length)) {
|
|
599
|
-
return {
|
|
600
|
-
type,
|
|
601
|
-
components: components.slice(0, 3),
|
|
602
|
-
alpha: components[3]
|
|
603
|
-
};
|
|
604
|
-
} else if (components.length !== 1) {
|
|
605
|
-
return false;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
const cssColorFunctionsRe = new RegExp(`^(${cssColorFunctions.join("|")})\\((.+)\\)$`, "i");
|
|
610
|
-
function parseCssSpaceColorFunction(color) {
|
|
611
|
-
const match = color.match(cssColorFunctionsRe);
|
|
612
|
-
if (!match)
|
|
613
|
-
return;
|
|
614
|
-
const [, fn, componentString] = match;
|
|
615
|
-
const parsed = parseCssSpaceColorValues(`${fn} ${componentString}`);
|
|
616
|
-
if (parsed) {
|
|
617
|
-
const { alpha, components: [type, ...components] } = parsed;
|
|
618
|
-
return {
|
|
619
|
-
type,
|
|
620
|
-
components,
|
|
621
|
-
alpha
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
function parseCssColorFunction(color) {
|
|
626
|
-
const match = color.match(/^color\((.+)\)$/);
|
|
627
|
-
if (!match)
|
|
628
|
-
return;
|
|
629
|
-
const parsed = parseCssSpaceColorValues(match[1]);
|
|
630
|
-
if (parsed) {
|
|
631
|
-
const { alpha, components: [type, ...components] } = parsed;
|
|
632
|
-
return {
|
|
633
|
-
type,
|
|
634
|
-
components,
|
|
635
|
-
alpha
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
function parseCssSpaceColorValues(componentString) {
|
|
640
|
-
const components = getComponents(componentString, " ");
|
|
641
|
-
if (!components)
|
|
642
|
-
return;
|
|
643
|
-
let totalComponents = components.length;
|
|
644
|
-
if (components[totalComponents - 2] === "/") {
|
|
645
|
-
return {
|
|
646
|
-
components: components.slice(0, totalComponents - 2),
|
|
647
|
-
alpha: components[totalComponents - 1]
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
if (components[totalComponents - 2] != null && (components[totalComponents - 2].endsWith("/") || components[totalComponents - 1].startsWith("/"))) {
|
|
651
|
-
const removed = components.splice(totalComponents - 2);
|
|
652
|
-
components.push(removed.join(" "));
|
|
653
|
-
--totalComponents;
|
|
326
|
+
Object.values(colors).forEach((color) => {
|
|
327
|
+
if (typeof color !== "string") {
|
|
328
|
+
color.DEFAULT = color.DEFAULT || color[400];
|
|
329
|
+
Object.keys(color).forEach((key) => {
|
|
330
|
+
const short = +key / 100;
|
|
331
|
+
if (short === Math.round(short))
|
|
332
|
+
color[short] = color[key];
|
|
333
|
+
});
|
|
654
334
|
}
|
|
655
|
-
|
|
656
|
-
if (!withAlpha)
|
|
657
|
-
return;
|
|
658
|
-
if (withAlpha.length === 1 || withAlpha[withAlpha.length - 1] === "")
|
|
659
|
-
return { components };
|
|
660
|
-
const alpha = withAlpha.pop();
|
|
661
|
-
components[totalComponents - 1] = withAlpha.join("/");
|
|
662
|
-
return {
|
|
663
|
-
components,
|
|
664
|
-
alpha
|
|
665
|
-
};
|
|
666
|
-
}
|
|
335
|
+
});
|
|
667
336
|
|
|
668
|
-
export {
|
|
337
|
+
export { colors as c };
|