@unocss/preset-mini 0.20.1 → 0.21.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/default.cjs +8 -10
- package/dist/chunks/default.mjs +8 -10
- package/dist/chunks/default2.cjs +177 -170
- package/dist/chunks/default2.mjs +178 -171
- package/dist/chunks/default3.cjs +34 -31
- package/dist/chunks/default3.mjs +32 -31
- package/dist/chunks/pseudo.cjs +38 -29
- package/dist/chunks/pseudo.mjs +38 -29
- package/dist/chunks/utilities.cjs +83 -41
- package/dist/chunks/utilities.mjs +83 -42
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/theme.d.ts +0 -10
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +8 -4
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +3 -1
- package/dist/variants.d.ts +13 -5
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
|
@@ -35,8 +35,33 @@ const xyzMap = {
|
|
|
35
35
|
"z": ["-z"],
|
|
36
36
|
"": ["-x", "-y"]
|
|
37
37
|
};
|
|
38
|
+
const basePositionMap = [
|
|
39
|
+
"top",
|
|
40
|
+
"top center",
|
|
41
|
+
"top left",
|
|
42
|
+
"top right",
|
|
43
|
+
"bottom",
|
|
44
|
+
"bottom center",
|
|
45
|
+
"bottom left",
|
|
46
|
+
"bottom right",
|
|
47
|
+
"left",
|
|
48
|
+
"left center",
|
|
49
|
+
"left top",
|
|
50
|
+
"left bottom",
|
|
51
|
+
"right",
|
|
52
|
+
"right center",
|
|
53
|
+
"right top",
|
|
54
|
+
"right bottom",
|
|
55
|
+
"center",
|
|
56
|
+
"center top",
|
|
57
|
+
"center bottom",
|
|
58
|
+
"center left",
|
|
59
|
+
"center right",
|
|
60
|
+
"center center"
|
|
61
|
+
];
|
|
62
|
+
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
38
63
|
|
|
39
|
-
const
|
|
64
|
+
const cssProps = [
|
|
40
65
|
"color",
|
|
41
66
|
"border-color",
|
|
42
67
|
"background-color",
|
|
@@ -53,17 +78,13 @@ const cssBasicProps = [
|
|
|
53
78
|
"zoom",
|
|
54
79
|
"text-shadow",
|
|
55
80
|
"transform",
|
|
56
|
-
"box-shadow"
|
|
57
|
-
];
|
|
58
|
-
const cssPositionProps = [
|
|
81
|
+
"box-shadow",
|
|
59
82
|
"backround-position",
|
|
60
83
|
"left",
|
|
61
84
|
"right",
|
|
62
85
|
"top",
|
|
63
86
|
"bottom",
|
|
64
|
-
"object-position"
|
|
65
|
-
];
|
|
66
|
-
const cssSizeProps = [
|
|
87
|
+
"object-position",
|
|
67
88
|
"max-height",
|
|
68
89
|
"min-height",
|
|
69
90
|
"max-width",
|
|
@@ -81,25 +102,31 @@ const cssSizeProps = [
|
|
|
81
102
|
"vertical-align",
|
|
82
103
|
"border-spacing",
|
|
83
104
|
"letter-spacing",
|
|
84
|
-
"word-spacing"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
"word-spacing",
|
|
106
|
+
"stroke",
|
|
107
|
+
"filter",
|
|
108
|
+
"backdrop-filter",
|
|
109
|
+
"fill",
|
|
110
|
+
"mask",
|
|
111
|
+
"mask-size",
|
|
112
|
+
"mask-border",
|
|
113
|
+
"clip-path",
|
|
114
|
+
"clip"
|
|
92
115
|
];
|
|
93
116
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
94
117
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
95
118
|
const unitOnlyRE = /^(px)$/i;
|
|
119
|
+
function round(n) {
|
|
120
|
+
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
121
|
+
}
|
|
96
122
|
function numberWithUnit(str) {
|
|
97
123
|
const match = str.match(numberWithUnitRE);
|
|
98
124
|
if (!match)
|
|
99
125
|
return;
|
|
100
|
-
const [, , unit] = match;
|
|
101
|
-
|
|
102
|
-
|
|
126
|
+
const [, n, unit] = match;
|
|
127
|
+
const num = parseFloat(n);
|
|
128
|
+
if (unit && !Number.isNaN(num))
|
|
129
|
+
return `${round(num)}${unit}`;
|
|
103
130
|
}
|
|
104
131
|
function auto(str) {
|
|
105
132
|
if (str === "auto" || str === "a")
|
|
@@ -112,11 +139,9 @@ function rem(str) {
|
|
|
112
139
|
if (!match)
|
|
113
140
|
return;
|
|
114
141
|
const [, n, unit] = match;
|
|
115
|
-
if (unit)
|
|
116
|
-
return str;
|
|
117
142
|
const num = parseFloat(n);
|
|
118
143
|
if (!Number.isNaN(num))
|
|
119
|
-
return `${num / 4}rem`;
|
|
144
|
+
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
120
145
|
}
|
|
121
146
|
function px(str) {
|
|
122
147
|
if (str.match(unitOnlyRE))
|
|
@@ -125,25 +150,23 @@ function px(str) {
|
|
|
125
150
|
if (!match)
|
|
126
151
|
return;
|
|
127
152
|
const [, n, unit] = match;
|
|
128
|
-
if (unit)
|
|
129
|
-
return str;
|
|
130
153
|
const num = parseFloat(n);
|
|
131
154
|
if (!Number.isNaN(num))
|
|
132
|
-
return `${num}px`;
|
|
155
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
133
156
|
}
|
|
134
157
|
function number(str) {
|
|
135
158
|
if (!numberRE.test(str))
|
|
136
159
|
return;
|
|
137
160
|
const num = parseFloat(str);
|
|
138
161
|
if (!Number.isNaN(num))
|
|
139
|
-
return num;
|
|
162
|
+
return round(num);
|
|
140
163
|
}
|
|
141
164
|
function percent(str) {
|
|
142
165
|
if (str.endsWith("%"))
|
|
143
166
|
str = str.slice(0, -1);
|
|
144
167
|
const num = parseFloat(str);
|
|
145
168
|
if (!Number.isNaN(num))
|
|
146
|
-
return `${num / 100}`;
|
|
169
|
+
return `${round(num / 100)}`;
|
|
147
170
|
}
|
|
148
171
|
function fraction(str) {
|
|
149
172
|
if (str === "full")
|
|
@@ -151,7 +174,7 @@ function fraction(str) {
|
|
|
151
174
|
const [left, right] = str.split("/");
|
|
152
175
|
const num = parseFloat(left) / parseFloat(right);
|
|
153
176
|
if (!Number.isNaN(num))
|
|
154
|
-
return `${num * 100}%`;
|
|
177
|
+
return `${round(num * 100)}%`;
|
|
155
178
|
}
|
|
156
179
|
function bracket(str) {
|
|
157
180
|
if (str && str[0] === "[" && str[str.length - 1] === "]") {
|
|
@@ -165,20 +188,28 @@ function cssvar(str) {
|
|
|
165
188
|
return `var(--${str.slice(1)})`;
|
|
166
189
|
}
|
|
167
190
|
function time(str) {
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
191
|
+
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
192
|
+
if (!match)
|
|
170
193
|
return;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
194
|
+
const [, n, unit] = match;
|
|
195
|
+
const num = parseFloat(n);
|
|
196
|
+
if (!Number.isNaN(num))
|
|
197
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
198
|
+
}
|
|
199
|
+
function degree(str) {
|
|
200
|
+
const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
|
|
201
|
+
if (!match)
|
|
202
|
+
return;
|
|
203
|
+
const [, n, unit] = match;
|
|
204
|
+
const num = parseFloat(n);
|
|
205
|
+
if (!Number.isNaN(num))
|
|
206
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
174
207
|
}
|
|
175
208
|
function global(str) {
|
|
176
209
|
if (["inherit", "initial", "revert", "unset"].includes(str))
|
|
177
210
|
return str;
|
|
178
211
|
}
|
|
179
212
|
function properties(str) {
|
|
180
|
-
if (str === void 0)
|
|
181
|
-
return;
|
|
182
213
|
for (const prop of str.split(",")) {
|
|
183
214
|
if (!cssProps.includes(prop))
|
|
184
215
|
return;
|
|
@@ -198,6 +229,7 @@ const valueHandlers = {
|
|
|
198
229
|
bracket: bracket,
|
|
199
230
|
cssvar: cssvar,
|
|
200
231
|
time: time,
|
|
232
|
+
degree: degree,
|
|
201
233
|
global: global,
|
|
202
234
|
properties: properties
|
|
203
235
|
};
|
|
@@ -249,37 +281,46 @@ const parseColor = (body, theme) => {
|
|
|
249
281
|
else if (no && colorData)
|
|
250
282
|
color = colorData[no];
|
|
251
283
|
}
|
|
284
|
+
const rgba = core.hex2rgba(color);
|
|
285
|
+
const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
286
|
+
const hasAlpha = alpha != null && !Number.isNaN(alpha);
|
|
287
|
+
if (rgba) {
|
|
288
|
+
if (hasAlpha) {
|
|
289
|
+
rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
|
|
290
|
+
} else {
|
|
291
|
+
rgba.splice(3);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
252
294
|
return {
|
|
253
295
|
opacity,
|
|
254
296
|
name,
|
|
255
297
|
no,
|
|
256
298
|
color,
|
|
257
|
-
rgba
|
|
299
|
+
rgba,
|
|
300
|
+
alpha: hasAlpha ? alpha : void 0
|
|
258
301
|
};
|
|
259
302
|
};
|
|
260
303
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
261
304
|
const data = parseColor(body, theme);
|
|
262
305
|
if (!data)
|
|
263
306
|
return;
|
|
264
|
-
const { opacity, color, rgba } = data;
|
|
307
|
+
const { alpha, opacity, color, rgba } = data;
|
|
265
308
|
if (!color)
|
|
266
309
|
return;
|
|
267
|
-
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
268
310
|
if (rgba) {
|
|
269
|
-
if (
|
|
270
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
311
|
+
if (alpha != null) {
|
|
271
312
|
return {
|
|
272
313
|
[property]: `rgba(${rgba.join(",")})`
|
|
273
314
|
};
|
|
274
315
|
} else {
|
|
275
316
|
return {
|
|
276
317
|
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
277
|
-
[property]: `rgba(${rgba.
|
|
318
|
+
[property]: `rgba(${rgba.join(",")},var(--un-${varName}-opacity))`
|
|
278
319
|
};
|
|
279
320
|
}
|
|
280
321
|
} else {
|
|
281
322
|
return {
|
|
282
|
-
[property]: color.replace("%alpha", `${
|
|
323
|
+
[property]: color.replace("%alpha", `${alpha || 1}`)
|
|
283
324
|
};
|
|
284
325
|
}
|
|
285
326
|
};
|
|
@@ -292,5 +333,6 @@ exports.directionSize = directionSize;
|
|
|
292
333
|
exports.h = h;
|
|
293
334
|
exports.handler = handler;
|
|
294
335
|
exports.parseColor = parseColor;
|
|
336
|
+
exports.positionMap = positionMap;
|
|
295
337
|
exports.valueHandlers = valueHandlers;
|
|
296
338
|
exports.xyzMap = xyzMap;
|
|
@@ -33,8 +33,33 @@ const xyzMap = {
|
|
|
33
33
|
"z": ["-z"],
|
|
34
34
|
"": ["-x", "-y"]
|
|
35
35
|
};
|
|
36
|
+
const basePositionMap = [
|
|
37
|
+
"top",
|
|
38
|
+
"top center",
|
|
39
|
+
"top left",
|
|
40
|
+
"top right",
|
|
41
|
+
"bottom",
|
|
42
|
+
"bottom center",
|
|
43
|
+
"bottom left",
|
|
44
|
+
"bottom right",
|
|
45
|
+
"left",
|
|
46
|
+
"left center",
|
|
47
|
+
"left top",
|
|
48
|
+
"left bottom",
|
|
49
|
+
"right",
|
|
50
|
+
"right center",
|
|
51
|
+
"right top",
|
|
52
|
+
"right bottom",
|
|
53
|
+
"center",
|
|
54
|
+
"center top",
|
|
55
|
+
"center bottom",
|
|
56
|
+
"center left",
|
|
57
|
+
"center right",
|
|
58
|
+
"center center"
|
|
59
|
+
];
|
|
60
|
+
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
36
61
|
|
|
37
|
-
const
|
|
62
|
+
const cssProps = [
|
|
38
63
|
"color",
|
|
39
64
|
"border-color",
|
|
40
65
|
"background-color",
|
|
@@ -51,17 +76,13 @@ const cssBasicProps = [
|
|
|
51
76
|
"zoom",
|
|
52
77
|
"text-shadow",
|
|
53
78
|
"transform",
|
|
54
|
-
"box-shadow"
|
|
55
|
-
];
|
|
56
|
-
const cssPositionProps = [
|
|
79
|
+
"box-shadow",
|
|
57
80
|
"backround-position",
|
|
58
81
|
"left",
|
|
59
82
|
"right",
|
|
60
83
|
"top",
|
|
61
84
|
"bottom",
|
|
62
|
-
"object-position"
|
|
63
|
-
];
|
|
64
|
-
const cssSizeProps = [
|
|
85
|
+
"object-position",
|
|
65
86
|
"max-height",
|
|
66
87
|
"min-height",
|
|
67
88
|
"max-width",
|
|
@@ -79,25 +100,31 @@ const cssSizeProps = [
|
|
|
79
100
|
"vertical-align",
|
|
80
101
|
"border-spacing",
|
|
81
102
|
"letter-spacing",
|
|
82
|
-
"word-spacing"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
103
|
+
"word-spacing",
|
|
104
|
+
"stroke",
|
|
105
|
+
"filter",
|
|
106
|
+
"backdrop-filter",
|
|
107
|
+
"fill",
|
|
108
|
+
"mask",
|
|
109
|
+
"mask-size",
|
|
110
|
+
"mask-border",
|
|
111
|
+
"clip-path",
|
|
112
|
+
"clip"
|
|
90
113
|
];
|
|
91
114
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
92
115
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
93
116
|
const unitOnlyRE = /^(px)$/i;
|
|
117
|
+
function round(n) {
|
|
118
|
+
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
119
|
+
}
|
|
94
120
|
function numberWithUnit(str) {
|
|
95
121
|
const match = str.match(numberWithUnitRE);
|
|
96
122
|
if (!match)
|
|
97
123
|
return;
|
|
98
|
-
const [, , unit] = match;
|
|
99
|
-
|
|
100
|
-
|
|
124
|
+
const [, n, unit] = match;
|
|
125
|
+
const num = parseFloat(n);
|
|
126
|
+
if (unit && !Number.isNaN(num))
|
|
127
|
+
return `${round(num)}${unit}`;
|
|
101
128
|
}
|
|
102
129
|
function auto(str) {
|
|
103
130
|
if (str === "auto" || str === "a")
|
|
@@ -110,11 +137,9 @@ function rem(str) {
|
|
|
110
137
|
if (!match)
|
|
111
138
|
return;
|
|
112
139
|
const [, n, unit] = match;
|
|
113
|
-
if (unit)
|
|
114
|
-
return str;
|
|
115
140
|
const num = parseFloat(n);
|
|
116
141
|
if (!Number.isNaN(num))
|
|
117
|
-
return `${num / 4}rem`;
|
|
142
|
+
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
118
143
|
}
|
|
119
144
|
function px(str) {
|
|
120
145
|
if (str.match(unitOnlyRE))
|
|
@@ -123,25 +148,23 @@ function px(str) {
|
|
|
123
148
|
if (!match)
|
|
124
149
|
return;
|
|
125
150
|
const [, n, unit] = match;
|
|
126
|
-
if (unit)
|
|
127
|
-
return str;
|
|
128
151
|
const num = parseFloat(n);
|
|
129
152
|
if (!Number.isNaN(num))
|
|
130
|
-
return `${num}px`;
|
|
153
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
131
154
|
}
|
|
132
155
|
function number(str) {
|
|
133
156
|
if (!numberRE.test(str))
|
|
134
157
|
return;
|
|
135
158
|
const num = parseFloat(str);
|
|
136
159
|
if (!Number.isNaN(num))
|
|
137
|
-
return num;
|
|
160
|
+
return round(num);
|
|
138
161
|
}
|
|
139
162
|
function percent(str) {
|
|
140
163
|
if (str.endsWith("%"))
|
|
141
164
|
str = str.slice(0, -1);
|
|
142
165
|
const num = parseFloat(str);
|
|
143
166
|
if (!Number.isNaN(num))
|
|
144
|
-
return `${num / 100}`;
|
|
167
|
+
return `${round(num / 100)}`;
|
|
145
168
|
}
|
|
146
169
|
function fraction(str) {
|
|
147
170
|
if (str === "full")
|
|
@@ -149,7 +172,7 @@ function fraction(str) {
|
|
|
149
172
|
const [left, right] = str.split("/");
|
|
150
173
|
const num = parseFloat(left) / parseFloat(right);
|
|
151
174
|
if (!Number.isNaN(num))
|
|
152
|
-
return `${num * 100}%`;
|
|
175
|
+
return `${round(num * 100)}%`;
|
|
153
176
|
}
|
|
154
177
|
function bracket(str) {
|
|
155
178
|
if (str && str[0] === "[" && str[str.length - 1] === "]") {
|
|
@@ -163,20 +186,28 @@ function cssvar(str) {
|
|
|
163
186
|
return `var(--${str.slice(1)})`;
|
|
164
187
|
}
|
|
165
188
|
function time(str) {
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
189
|
+
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
190
|
+
if (!match)
|
|
168
191
|
return;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
192
|
+
const [, n, unit] = match;
|
|
193
|
+
const num = parseFloat(n);
|
|
194
|
+
if (!Number.isNaN(num))
|
|
195
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
196
|
+
}
|
|
197
|
+
function degree(str) {
|
|
198
|
+
const match = str.match(/^(-?[0-9.]+)(deg)?$/i);
|
|
199
|
+
if (!match)
|
|
200
|
+
return;
|
|
201
|
+
const [, n, unit] = match;
|
|
202
|
+
const num = parseFloat(n);
|
|
203
|
+
if (!Number.isNaN(num))
|
|
204
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
172
205
|
}
|
|
173
206
|
function global(str) {
|
|
174
207
|
if (["inherit", "initial", "revert", "unset"].includes(str))
|
|
175
208
|
return str;
|
|
176
209
|
}
|
|
177
210
|
function properties(str) {
|
|
178
|
-
if (str === void 0)
|
|
179
|
-
return;
|
|
180
211
|
for (const prop of str.split(",")) {
|
|
181
212
|
if (!cssProps.includes(prop))
|
|
182
213
|
return;
|
|
@@ -196,6 +227,7 @@ const valueHandlers = {
|
|
|
196
227
|
bracket: bracket,
|
|
197
228
|
cssvar: cssvar,
|
|
198
229
|
time: time,
|
|
230
|
+
degree: degree,
|
|
199
231
|
global: global,
|
|
200
232
|
properties: properties
|
|
201
233
|
};
|
|
@@ -247,39 +279,48 @@ const parseColor = (body, theme) => {
|
|
|
247
279
|
else if (no && colorData)
|
|
248
280
|
color = colorData[no];
|
|
249
281
|
}
|
|
282
|
+
const rgba = hex2rgba(color);
|
|
283
|
+
const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
284
|
+
const hasAlpha = alpha != null && !Number.isNaN(alpha);
|
|
285
|
+
if (rgba) {
|
|
286
|
+
if (hasAlpha) {
|
|
287
|
+
rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
|
|
288
|
+
} else {
|
|
289
|
+
rgba.splice(3);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
250
292
|
return {
|
|
251
293
|
opacity,
|
|
252
294
|
name,
|
|
253
295
|
no,
|
|
254
296
|
color,
|
|
255
|
-
rgba
|
|
297
|
+
rgba,
|
|
298
|
+
alpha: hasAlpha ? alpha : void 0
|
|
256
299
|
};
|
|
257
300
|
};
|
|
258
301
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
259
302
|
const data = parseColor(body, theme);
|
|
260
303
|
if (!data)
|
|
261
304
|
return;
|
|
262
|
-
const { opacity, color, rgba } = data;
|
|
305
|
+
const { alpha, opacity, color, rgba } = data;
|
|
263
306
|
if (!color)
|
|
264
307
|
return;
|
|
265
|
-
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
266
308
|
if (rgba) {
|
|
267
|
-
if (
|
|
268
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
309
|
+
if (alpha != null) {
|
|
269
310
|
return {
|
|
270
311
|
[property]: `rgba(${rgba.join(",")})`
|
|
271
312
|
};
|
|
272
313
|
} else {
|
|
273
314
|
return {
|
|
274
315
|
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
275
|
-
[property]: `rgba(${rgba.
|
|
316
|
+
[property]: `rgba(${rgba.join(",")},var(--un-${varName}-opacity))`
|
|
276
317
|
};
|
|
277
318
|
}
|
|
278
319
|
} else {
|
|
279
320
|
return {
|
|
280
|
-
[property]: color.replace("%alpha", `${
|
|
321
|
+
[property]: color.replace("%alpha", `${alpha || 1}`)
|
|
281
322
|
};
|
|
282
323
|
}
|
|
283
324
|
};
|
|
284
325
|
|
|
285
|
-
export { cornerMap as a, capitalize as b, colorResolver as c, directionMap as d, directionSize as e,
|
|
326
|
+
export { cornerMap as a, capitalize as b, colorResolver as c, directionMap as d, directionSize as e, positionMap as f, h as g, handler as h, parseColor as p, valueHandlers as v, xyzMap as x };
|
package/dist/index.cjs
CHANGED
|
@@ -18,7 +18,7 @@ const presetMini = (options = {}) => {
|
|
|
18
18
|
name: "@unocss/preset-mini",
|
|
19
19
|
theme: _default.theme,
|
|
20
20
|
rules: _default$1.rules,
|
|
21
|
-
variants: _default$2.variants,
|
|
21
|
+
variants: _default$2.variants(options),
|
|
22
22
|
options,
|
|
23
23
|
postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
|
|
24
24
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ const presetMini = (options = {}) => {
|
|
|
15
15
|
name: "@unocss/preset-mini",
|
|
16
16
|
theme,
|
|
17
17
|
rules,
|
|
18
|
-
variants,
|
|
18
|
+
variants: variants(options),
|
|
19
19
|
options,
|
|
20
20
|
postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
|
|
21
21
|
};
|
package/dist/theme.d.ts
CHANGED
|
@@ -77,8 +77,6 @@ declare const baseSize: {
|
|
|
77
77
|
'5xl': string;
|
|
78
78
|
'6xl': string;
|
|
79
79
|
'7xl': string;
|
|
80
|
-
min: string;
|
|
81
|
-
max: string;
|
|
82
80
|
prose: string;
|
|
83
81
|
};
|
|
84
82
|
declare const width: {
|
|
@@ -94,8 +92,6 @@ declare const width: {
|
|
|
94
92
|
'5xl': string;
|
|
95
93
|
'6xl': string;
|
|
96
94
|
'7xl': string;
|
|
97
|
-
min: string;
|
|
98
|
-
max: string;
|
|
99
95
|
prose: string;
|
|
100
96
|
auto: string;
|
|
101
97
|
};
|
|
@@ -112,8 +108,6 @@ declare const maxWidth: {
|
|
|
112
108
|
'5xl': string;
|
|
113
109
|
'6xl': string;
|
|
114
110
|
'7xl': string;
|
|
115
|
-
min: string;
|
|
116
|
-
max: string;
|
|
117
111
|
prose: string;
|
|
118
112
|
none: string;
|
|
119
113
|
};
|
|
@@ -130,8 +124,6 @@ declare const height: {
|
|
|
130
124
|
'5xl': string;
|
|
131
125
|
'6xl': string;
|
|
132
126
|
'7xl': string;
|
|
133
|
-
min: string;
|
|
134
|
-
max: string;
|
|
135
127
|
prose: string;
|
|
136
128
|
auto: string;
|
|
137
129
|
};
|
|
@@ -148,8 +140,6 @@ declare const maxHeight: {
|
|
|
148
140
|
'5xl': string;
|
|
149
141
|
'6xl': string;
|
|
150
142
|
'7xl': string;
|
|
151
|
-
min: string;
|
|
152
|
-
max: string;
|
|
153
143
|
prose: string;
|
|
154
144
|
none: string;
|
|
155
145
|
};
|
package/dist/utils.cjs
CHANGED
|
@@ -16,6 +16,7 @@ exports.directionSize = utilities.directionSize;
|
|
|
16
16
|
exports.h = utilities.h;
|
|
17
17
|
exports.handler = utilities.handler;
|
|
18
18
|
exports.parseColor = utilities.parseColor;
|
|
19
|
+
exports.positionMap = utilities.positionMap;
|
|
19
20
|
exports.valueHandlers = utilities.valueHandlers;
|
|
20
21
|
exports.xyzMap = utilities.xyzMap;
|
|
21
22
|
exports.variantMatcher = variants.variantMatcher;
|
package/dist/utils.d.ts
CHANGED
|
@@ -5,17 +5,19 @@ import { T as Theme } from './types-a2d2b52f';
|
|
|
5
5
|
declare const directionMap: Record<string, string[]>;
|
|
6
6
|
declare const cornerMap: Record<string, string[]>;
|
|
7
7
|
declare const xyzMap: Record<string, string[]>;
|
|
8
|
+
declare const positionMap: Record<string, string>;
|
|
8
9
|
|
|
9
10
|
declare function numberWithUnit(str: string): string | undefined;
|
|
10
11
|
declare function auto(str: string): "auto" | undefined;
|
|
11
12
|
declare function rem(str: string): string | undefined;
|
|
12
13
|
declare function px(str: string): string | undefined;
|
|
13
|
-
declare function number(str: string):
|
|
14
|
+
declare function number(str: string): string | undefined;
|
|
14
15
|
declare function percent(str: string): string | undefined;
|
|
15
16
|
declare function fraction(str: string): string | undefined;
|
|
16
17
|
declare function bracket(str: string): string | undefined;
|
|
17
18
|
declare function cssvar(str: string): string | undefined;
|
|
18
19
|
declare function time(str: string): string | undefined;
|
|
20
|
+
declare function degree(str: string): string | undefined;
|
|
19
21
|
declare function global(str: string): string | undefined;
|
|
20
22
|
declare function properties(str: string): string | undefined;
|
|
21
23
|
|
|
@@ -29,6 +31,7 @@ declare const handlers_fraction: typeof fraction;
|
|
|
29
31
|
declare const handlers_bracket: typeof bracket;
|
|
30
32
|
declare const handlers_cssvar: typeof cssvar;
|
|
31
33
|
declare const handlers_time: typeof time;
|
|
34
|
+
declare const handlers_degree: typeof degree;
|
|
32
35
|
declare const handlers_global: typeof global;
|
|
33
36
|
declare const handlers_properties: typeof properties;
|
|
34
37
|
declare namespace handlers {
|
|
@@ -43,13 +46,14 @@ declare namespace handlers {
|
|
|
43
46
|
handlers_bracket as bracket,
|
|
44
47
|
handlers_cssvar as cssvar,
|
|
45
48
|
handlers_time as time,
|
|
49
|
+
handlers_degree as degree,
|
|
46
50
|
handlers_global as global,
|
|
47
51
|
handlers_properties as properties,
|
|
48
52
|
};
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
|
|
52
|
-
declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
|
|
55
|
+
declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
|
|
56
|
+
declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "degree" | "global" | "properties">;
|
|
53
57
|
|
|
54
58
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
|
|
55
59
|
declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
|
|
@@ -106,4 +110,4 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
|
|
|
106
110
|
*/
|
|
107
111
|
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
108
112
|
|
|
109
|
-
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
|
113
|
+
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize,
|
|
1
|
+
export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize, g as h, h as handler, p as parseColor, f as positionMap, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
|
|
2
2
|
export { v as variantMatcher, a as variantParentMatcher } from './chunks/variants.mjs';
|
|
3
3
|
import '@unocss/core';
|
package/dist/variants.cjs
CHANGED
|
@@ -13,9 +13,11 @@ exports.variantBreakpoints = _default.variantBreakpoints;
|
|
|
13
13
|
exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
|
|
14
14
|
exports.variantCombinators = _default.variantCombinators;
|
|
15
15
|
exports.variantImportant = _default.variantImportant;
|
|
16
|
+
exports.variantLanguageDirections = _default.variantLanguageDirections;
|
|
17
|
+
exports.variantMotions = _default.variantMotions;
|
|
16
18
|
exports.variantNegative = _default.variantNegative;
|
|
19
|
+
exports.variantOrientations = _default.variantOrientations;
|
|
17
20
|
exports.variantPrint = _default.variantPrint;
|
|
18
|
-
exports.variantSpace = _default.variantSpace;
|
|
19
21
|
exports.variants = _default.variants;
|
|
20
22
|
exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
21
23
|
exports.partClasses = pseudo.partClasses;
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
2
|
import { Variant, VariantFunction, VariantObject } from '@unocss/core';
|
|
3
3
|
import { T as Theme } from './types-a2d2b52f';
|
|
4
|
+
import { PresetMiniOptions } from './index';
|
|
5
|
+
import './default-958434b6';
|
|
6
|
+
import './colors-6d634692';
|
|
4
7
|
|
|
5
8
|
declare const variantBreakpoints: Variant<Theme>;
|
|
6
9
|
|
|
7
10
|
declare const variantCombinators: Variant[];
|
|
8
11
|
|
|
9
|
-
declare const variantColorsMediaOrClass:
|
|
12
|
+
declare const variantColorsMediaOrClass: (options?: PresetMiniOptions) => VariantFunction[];
|
|
10
13
|
|
|
11
|
-
declare const
|
|
14
|
+
declare const variantLanguageDirections: Variant[];
|
|
15
|
+
|
|
16
|
+
declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
|
|
12
17
|
|
|
13
18
|
declare const variantImportant: Variant;
|
|
14
19
|
declare const variantNegative: Variant;
|
|
15
|
-
|
|
20
|
+
|
|
21
|
+
declare const variantMotions: Variant[];
|
|
22
|
+
|
|
23
|
+
declare const variantOrientations: Variant[];
|
|
16
24
|
|
|
17
25
|
declare const variantPrint: (input: string) => _unocss_core.VariantHandler | undefined;
|
|
18
26
|
|
|
@@ -20,7 +28,7 @@ declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
|
20
28
|
declare const variantPseudoElements: VariantFunction;
|
|
21
29
|
declare const variantPseudoClasses: VariantObject;
|
|
22
30
|
declare const variantPseudoClassFunctions: VariantObject;
|
|
23
|
-
declare const variantTaggedPseudoClasses: VariantObject;
|
|
31
|
+
declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
|
|
24
32
|
declare const partClasses: VariantObject;
|
|
25
33
|
|
|
26
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements,
|
|
34
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantTaggedPseudoClasses, variants };
|