@unocss/preset-mini 0.16.4 → 0.17.2
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/default2.cjs +176 -327
- package/dist/chunks/default2.mjs +172 -320
- package/dist/chunks/default3.cjs +2 -1
- package/dist/chunks/default3.mjs +3 -2
- package/dist/chunks/pseudo.cjs +17 -0
- package/dist/chunks/pseudo.mjs +17 -1
- package/dist/chunks/utilities.cjs +143 -8
- package/dist/chunks/utilities.mjs +143 -10
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/rules.cjs +1 -4
- package/dist/rules.d.ts +2 -13
- package/dist/rules.mjs +2 -2
- package/dist/utils.cjs +2 -0
- package/dist/utils.d.ts +61 -5
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +1 -0
- package/dist/variants.d.ts +2 -1
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/default3.cjs
CHANGED
|
@@ -120,7 +120,8 @@ const variants = [
|
|
|
120
120
|
variantBreakpoints,
|
|
121
121
|
...variantCombinators,
|
|
122
122
|
pseudo.variantPseudoClasses,
|
|
123
|
-
pseudo.variantPseudoElements
|
|
123
|
+
pseudo.variantPseudoElements,
|
|
124
|
+
pseudo.partClasses
|
|
124
125
|
];
|
|
125
126
|
|
|
126
127
|
exports.variantBreakpoints = variantBreakpoints;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as variantMatcher } from './variants.mjs';
|
|
2
|
-
import { v as variantPseudoClasses, a as variantPseudoElements } from './pseudo.mjs';
|
|
2
|
+
import { v as variantPseudoClasses, a as variantPseudoElements, p as partClasses } from './pseudo.mjs';
|
|
3
3
|
|
|
4
4
|
const regexCache = {};
|
|
5
5
|
const variantBreakpoints = (matcher, _, theme) => {
|
|
@@ -118,7 +118,8 @@ const variants = [
|
|
|
118
118
|
variantBreakpoints,
|
|
119
119
|
...variantCombinators,
|
|
120
120
|
variantPseudoClasses,
|
|
121
|
-
variantPseudoElements
|
|
121
|
+
variantPseudoElements,
|
|
122
|
+
partClasses
|
|
122
123
|
];
|
|
123
124
|
|
|
124
125
|
export { variantColorsMedia as a, variantColorsClass as b, variantBreakpoints as c, variantCombinators as d, variantImportant as e, variantNegative as f, variantSpace as g, variants as v };
|
package/dist/chunks/pseudo.cjs
CHANGED
|
@@ -46,6 +46,7 @@ const PseudoElements = [
|
|
|
46
46
|
"first-line",
|
|
47
47
|
"selection"
|
|
48
48
|
];
|
|
49
|
+
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
49
50
|
const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
50
51
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
51
52
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
@@ -105,8 +106,24 @@ const variantPseudoClasses = {
|
|
|
105
106
|
},
|
|
106
107
|
multiPass: true
|
|
107
108
|
};
|
|
109
|
+
const partClasses = {
|
|
110
|
+
match: (input) => {
|
|
111
|
+
const match = input.match(PartClassesRE);
|
|
112
|
+
if (match) {
|
|
113
|
+
const part = `part(${match[2]})`;
|
|
114
|
+
return {
|
|
115
|
+
matcher: input.slice(match[1].length),
|
|
116
|
+
selector: (s, body) => {
|
|
117
|
+
return shouldAdd(body) && `${s}::${part}`;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
multiPass: true
|
|
123
|
+
};
|
|
108
124
|
|
|
109
125
|
exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
|
|
110
126
|
exports.PseudoClasses = PseudoClasses;
|
|
127
|
+
exports.partClasses = partClasses;
|
|
111
128
|
exports.variantPseudoClasses = variantPseudoClasses;
|
|
112
129
|
exports.variantPseudoElements = variantPseudoElements;
|
package/dist/chunks/pseudo.mjs
CHANGED
|
@@ -44,6 +44,7 @@ const PseudoElements = [
|
|
|
44
44
|
"first-line",
|
|
45
45
|
"selection"
|
|
46
46
|
];
|
|
47
|
+
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
47
48
|
const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
48
49
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
49
50
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
@@ -103,5 +104,20 @@ const variantPseudoClasses = {
|
|
|
103
104
|
},
|
|
104
105
|
multiPass: true
|
|
105
106
|
};
|
|
107
|
+
const partClasses = {
|
|
108
|
+
match: (input) => {
|
|
109
|
+
const match = input.match(PartClassesRE);
|
|
110
|
+
if (match) {
|
|
111
|
+
const part = `part(${match[2]})`;
|
|
112
|
+
return {
|
|
113
|
+
matcher: input.slice(match[1].length),
|
|
114
|
+
selector: (s, body) => {
|
|
115
|
+
return shouldAdd(body) && `${s}::${part}`;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
multiPass: true
|
|
121
|
+
};
|
|
106
122
|
|
|
107
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS as C, PseudoClasses as P, variantPseudoElements as a, variantPseudoClasses as v };
|
|
123
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS as C, PseudoClasses as P, variantPseudoElements as a, partClasses as p, variantPseudoClasses as v };
|
|
@@ -36,12 +36,64 @@ const xyzMap = {
|
|
|
36
36
|
"": ["-x", "-y"]
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
const cssBasicProps = [
|
|
40
|
+
"color",
|
|
41
|
+
"border-color",
|
|
42
|
+
"background-color",
|
|
43
|
+
"flex-grow",
|
|
44
|
+
"flex",
|
|
45
|
+
"flex-shrink",
|
|
46
|
+
"caret-color",
|
|
47
|
+
"font",
|
|
48
|
+
"gap",
|
|
49
|
+
"opacity",
|
|
50
|
+
"visibility",
|
|
51
|
+
"z-index",
|
|
52
|
+
"font-weight",
|
|
53
|
+
"zoom",
|
|
54
|
+
"text-shadow",
|
|
55
|
+
"transform",
|
|
56
|
+
"box-shadow"
|
|
57
|
+
];
|
|
58
|
+
const cssPositionProps = [
|
|
59
|
+
"backround-position",
|
|
60
|
+
"left",
|
|
61
|
+
"right",
|
|
62
|
+
"top",
|
|
63
|
+
"bottom",
|
|
64
|
+
"object-position"
|
|
65
|
+
];
|
|
66
|
+
const cssSizeProps = [
|
|
67
|
+
"max-height",
|
|
68
|
+
"min-height",
|
|
69
|
+
"max-width",
|
|
70
|
+
"min-width",
|
|
71
|
+
"height",
|
|
72
|
+
"width",
|
|
73
|
+
"border-width",
|
|
74
|
+
"margin",
|
|
75
|
+
"padding",
|
|
76
|
+
"outline-width",
|
|
77
|
+
"outline-offset",
|
|
78
|
+
"font-size",
|
|
79
|
+
"line-height",
|
|
80
|
+
"text-indent",
|
|
81
|
+
"vertical-align",
|
|
82
|
+
"border-spacing",
|
|
83
|
+
"letter-spacing",
|
|
84
|
+
"word-spacing"
|
|
85
|
+
];
|
|
86
|
+
const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
|
|
87
|
+
const cssProps = [
|
|
88
|
+
...cssBasicProps,
|
|
89
|
+
...cssPositionProps,
|
|
90
|
+
...cssSizeProps,
|
|
91
|
+
...cssEnhanceProps
|
|
92
|
+
];
|
|
39
93
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
40
94
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
41
95
|
const unitOnlyRE = /^(px)$/i;
|
|
42
96
|
function numberWithUnit(str) {
|
|
43
|
-
if (str === "auto" || str === "a")
|
|
44
|
-
return "auto";
|
|
45
97
|
const match = str.match(numberWithUnitRE);
|
|
46
98
|
if (!match)
|
|
47
99
|
return;
|
|
@@ -49,9 +101,11 @@ function numberWithUnit(str) {
|
|
|
49
101
|
if (unit)
|
|
50
102
|
return str;
|
|
51
103
|
}
|
|
52
|
-
function
|
|
104
|
+
function auto(str) {
|
|
53
105
|
if (str === "auto" || str === "a")
|
|
54
106
|
return "auto";
|
|
107
|
+
}
|
|
108
|
+
function rem(str) {
|
|
55
109
|
if (str.match(unitOnlyRE))
|
|
56
110
|
return `1${str}`;
|
|
57
111
|
const match = str.match(numberWithUnitRE);
|
|
@@ -122,10 +176,20 @@ function global(str) {
|
|
|
122
176
|
if (["inherit", "initial", "revert", "unset"].includes(str))
|
|
123
177
|
return str;
|
|
124
178
|
}
|
|
179
|
+
function properties(str) {
|
|
180
|
+
if (str === void 0)
|
|
181
|
+
return;
|
|
182
|
+
for (const prop of str.split(",")) {
|
|
183
|
+
if (!cssProps.includes(prop))
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
return str;
|
|
187
|
+
}
|
|
125
188
|
|
|
126
189
|
const valueHandlers = {
|
|
127
190
|
__proto__: null,
|
|
128
191
|
numberWithUnit: numberWithUnit,
|
|
192
|
+
auto: auto,
|
|
129
193
|
rem: rem,
|
|
130
194
|
px: px,
|
|
131
195
|
number: number,
|
|
@@ -134,7 +198,8 @@ const valueHandlers = {
|
|
|
134
198
|
bracket: bracket,
|
|
135
199
|
cssvar: cssvar,
|
|
136
200
|
time: time,
|
|
137
|
-
global: global
|
|
201
|
+
global: global,
|
|
202
|
+
properties: properties
|
|
138
203
|
};
|
|
139
204
|
|
|
140
205
|
const handler = core.createValueHandler(valueHandlers);
|
|
@@ -143,17 +208,87 @@ const h = handler;
|
|
|
143
208
|
function capitalize(str) {
|
|
144
209
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
145
210
|
}
|
|
146
|
-
const directionSize = (
|
|
147
|
-
const v = handler.bracket.rem.fraction.cssvar(size);
|
|
148
|
-
if (v)
|
|
149
|
-
return directionMap[direction].map((i) => [
|
|
211
|
+
const directionSize = (propertyPrefix) => ([_, direction, size]) => {
|
|
212
|
+
const v = handler.bracket.auto.rem.fraction.cssvar(size);
|
|
213
|
+
if (v !== void 0)
|
|
214
|
+
return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
215
|
+
};
|
|
216
|
+
const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
|
|
217
|
+
const parseColor = (body, theme) => {
|
|
218
|
+
const [main, opacity] = body.split(/(?:\/|:)/);
|
|
219
|
+
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
220
|
+
const [name] = colors;
|
|
221
|
+
if (!name)
|
|
222
|
+
return;
|
|
223
|
+
let color;
|
|
224
|
+
const bracket = handler.bracket(main);
|
|
225
|
+
const bracketOrMain = bracket || main;
|
|
226
|
+
if (bracketOrMain.startsWith("#"))
|
|
227
|
+
color = bracketOrMain.slice(1);
|
|
228
|
+
if (bracketOrMain.startsWith("hex-"))
|
|
229
|
+
color = bracketOrMain.slice(4);
|
|
230
|
+
color = color || bracket;
|
|
231
|
+
let no = "DEFAULT";
|
|
232
|
+
if (!color) {
|
|
233
|
+
let colorData;
|
|
234
|
+
const [scale] = colors.slice(-1);
|
|
235
|
+
if (scale.match(/^\d+$/)) {
|
|
236
|
+
no = scale;
|
|
237
|
+
colorData = getThemeColor(theme, colors.slice(0, -1));
|
|
238
|
+
} else {
|
|
239
|
+
colorData = getThemeColor(theme, colors);
|
|
240
|
+
if (!colorData) {
|
|
241
|
+
[, no = no] = colors;
|
|
242
|
+
colorData = getThemeColor(theme, [name]);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (typeof colorData === "string")
|
|
246
|
+
color = colorData;
|
|
247
|
+
else if (no && colorData)
|
|
248
|
+
color = colorData[no];
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
opacity,
|
|
252
|
+
name,
|
|
253
|
+
no,
|
|
254
|
+
color,
|
|
255
|
+
rgba: core.hex2rgba(color)
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
259
|
+
const data = parseColor(body, theme);
|
|
260
|
+
if (!data)
|
|
261
|
+
return;
|
|
262
|
+
const { opacity, color, rgba } = data;
|
|
263
|
+
if (!color)
|
|
264
|
+
return;
|
|
265
|
+
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
266
|
+
if (rgba) {
|
|
267
|
+
if (a != null && !Number.isNaN(a)) {
|
|
268
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
269
|
+
return {
|
|
270
|
+
[property]: `rgba(${rgba.join(",")})`
|
|
271
|
+
};
|
|
272
|
+
} else {
|
|
273
|
+
return {
|
|
274
|
+
[`--un-${varName}-opacity`]: 1,
|
|
275
|
+
[property]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
return {
|
|
280
|
+
[property]: color.replace("%alpha", `${a || 1}`)
|
|
281
|
+
};
|
|
282
|
+
}
|
|
150
283
|
};
|
|
151
284
|
|
|
152
285
|
exports.capitalize = capitalize;
|
|
286
|
+
exports.colorResolver = colorResolver;
|
|
153
287
|
exports.cornerMap = cornerMap;
|
|
154
288
|
exports.directionMap = directionMap;
|
|
155
289
|
exports.directionSize = directionSize;
|
|
156
290
|
exports.h = h;
|
|
157
291
|
exports.handler = handler;
|
|
292
|
+
exports.parseColor = parseColor;
|
|
158
293
|
exports.valueHandlers = valueHandlers;
|
|
159
294
|
exports.xyzMap = xyzMap;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createValueHandler } from '@unocss/core';
|
|
1
|
+
import { createValueHandler, hex2rgba } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
const directionMap = {
|
|
4
4
|
"l": ["-left"],
|
|
@@ -34,12 +34,64 @@ const xyzMap = {
|
|
|
34
34
|
"": ["-x", "-y"]
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const cssBasicProps = [
|
|
38
|
+
"color",
|
|
39
|
+
"border-color",
|
|
40
|
+
"background-color",
|
|
41
|
+
"flex-grow",
|
|
42
|
+
"flex",
|
|
43
|
+
"flex-shrink",
|
|
44
|
+
"caret-color",
|
|
45
|
+
"font",
|
|
46
|
+
"gap",
|
|
47
|
+
"opacity",
|
|
48
|
+
"visibility",
|
|
49
|
+
"z-index",
|
|
50
|
+
"font-weight",
|
|
51
|
+
"zoom",
|
|
52
|
+
"text-shadow",
|
|
53
|
+
"transform",
|
|
54
|
+
"box-shadow"
|
|
55
|
+
];
|
|
56
|
+
const cssPositionProps = [
|
|
57
|
+
"backround-position",
|
|
58
|
+
"left",
|
|
59
|
+
"right",
|
|
60
|
+
"top",
|
|
61
|
+
"bottom",
|
|
62
|
+
"object-position"
|
|
63
|
+
];
|
|
64
|
+
const cssSizeProps = [
|
|
65
|
+
"max-height",
|
|
66
|
+
"min-height",
|
|
67
|
+
"max-width",
|
|
68
|
+
"min-width",
|
|
69
|
+
"height",
|
|
70
|
+
"width",
|
|
71
|
+
"border-width",
|
|
72
|
+
"margin",
|
|
73
|
+
"padding",
|
|
74
|
+
"outline-width",
|
|
75
|
+
"outline-offset",
|
|
76
|
+
"font-size",
|
|
77
|
+
"line-height",
|
|
78
|
+
"text-indent",
|
|
79
|
+
"vertical-align",
|
|
80
|
+
"border-spacing",
|
|
81
|
+
"letter-spacing",
|
|
82
|
+
"word-spacing"
|
|
83
|
+
];
|
|
84
|
+
const cssEnhanceProps = ["stroke", "filter", "backdrop-filter", "fill", "mask", "mask-size", "mask-border", "clip-path", "clip"];
|
|
85
|
+
const cssProps = [
|
|
86
|
+
...cssBasicProps,
|
|
87
|
+
...cssPositionProps,
|
|
88
|
+
...cssSizeProps,
|
|
89
|
+
...cssEnhanceProps
|
|
90
|
+
];
|
|
37
91
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
38
92
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
39
93
|
const unitOnlyRE = /^(px)$/i;
|
|
40
94
|
function numberWithUnit(str) {
|
|
41
|
-
if (str === "auto" || str === "a")
|
|
42
|
-
return "auto";
|
|
43
95
|
const match = str.match(numberWithUnitRE);
|
|
44
96
|
if (!match)
|
|
45
97
|
return;
|
|
@@ -47,9 +99,11 @@ function numberWithUnit(str) {
|
|
|
47
99
|
if (unit)
|
|
48
100
|
return str;
|
|
49
101
|
}
|
|
50
|
-
function
|
|
102
|
+
function auto(str) {
|
|
51
103
|
if (str === "auto" || str === "a")
|
|
52
104
|
return "auto";
|
|
105
|
+
}
|
|
106
|
+
function rem(str) {
|
|
53
107
|
if (str.match(unitOnlyRE))
|
|
54
108
|
return `1${str}`;
|
|
55
109
|
const match = str.match(numberWithUnitRE);
|
|
@@ -120,10 +174,20 @@ function global(str) {
|
|
|
120
174
|
if (["inherit", "initial", "revert", "unset"].includes(str))
|
|
121
175
|
return str;
|
|
122
176
|
}
|
|
177
|
+
function properties(str) {
|
|
178
|
+
if (str === void 0)
|
|
179
|
+
return;
|
|
180
|
+
for (const prop of str.split(",")) {
|
|
181
|
+
if (!cssProps.includes(prop))
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
return str;
|
|
185
|
+
}
|
|
123
186
|
|
|
124
187
|
const valueHandlers = {
|
|
125
188
|
__proto__: null,
|
|
126
189
|
numberWithUnit: numberWithUnit,
|
|
190
|
+
auto: auto,
|
|
127
191
|
rem: rem,
|
|
128
192
|
px: px,
|
|
129
193
|
number: number,
|
|
@@ -132,7 +196,8 @@ const valueHandlers = {
|
|
|
132
196
|
bracket: bracket,
|
|
133
197
|
cssvar: cssvar,
|
|
134
198
|
time: time,
|
|
135
|
-
global: global
|
|
199
|
+
global: global,
|
|
200
|
+
properties: properties
|
|
136
201
|
};
|
|
137
202
|
|
|
138
203
|
const handler = createValueHandler(valueHandlers);
|
|
@@ -141,10 +206,78 @@ const h = handler;
|
|
|
141
206
|
function capitalize(str) {
|
|
142
207
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
143
208
|
}
|
|
144
|
-
const directionSize = (
|
|
145
|
-
const v = handler.bracket.rem.fraction.cssvar(size);
|
|
146
|
-
if (v)
|
|
147
|
-
return directionMap[direction].map((i) => [
|
|
209
|
+
const directionSize = (propertyPrefix) => ([_, direction, size]) => {
|
|
210
|
+
const v = handler.bracket.auto.rem.fraction.cssvar(size);
|
|
211
|
+
if (v !== void 0)
|
|
212
|
+
return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
213
|
+
};
|
|
214
|
+
const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
|
|
215
|
+
const parseColor = (body, theme) => {
|
|
216
|
+
const [main, opacity] = body.split(/(?:\/|:)/);
|
|
217
|
+
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
218
|
+
const [name] = colors;
|
|
219
|
+
if (!name)
|
|
220
|
+
return;
|
|
221
|
+
let color;
|
|
222
|
+
const bracket = handler.bracket(main);
|
|
223
|
+
const bracketOrMain = bracket || main;
|
|
224
|
+
if (bracketOrMain.startsWith("#"))
|
|
225
|
+
color = bracketOrMain.slice(1);
|
|
226
|
+
if (bracketOrMain.startsWith("hex-"))
|
|
227
|
+
color = bracketOrMain.slice(4);
|
|
228
|
+
color = color || bracket;
|
|
229
|
+
let no = "DEFAULT";
|
|
230
|
+
if (!color) {
|
|
231
|
+
let colorData;
|
|
232
|
+
const [scale] = colors.slice(-1);
|
|
233
|
+
if (scale.match(/^\d+$/)) {
|
|
234
|
+
no = scale;
|
|
235
|
+
colorData = getThemeColor(theme, colors.slice(0, -1));
|
|
236
|
+
} else {
|
|
237
|
+
colorData = getThemeColor(theme, colors);
|
|
238
|
+
if (!colorData) {
|
|
239
|
+
[, no = no] = colors;
|
|
240
|
+
colorData = getThemeColor(theme, [name]);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (typeof colorData === "string")
|
|
244
|
+
color = colorData;
|
|
245
|
+
else if (no && colorData)
|
|
246
|
+
color = colorData[no];
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
opacity,
|
|
250
|
+
name,
|
|
251
|
+
no,
|
|
252
|
+
color,
|
|
253
|
+
rgba: hex2rgba(color)
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
257
|
+
const data = parseColor(body, theme);
|
|
258
|
+
if (!data)
|
|
259
|
+
return;
|
|
260
|
+
const { opacity, color, rgba } = data;
|
|
261
|
+
if (!color)
|
|
262
|
+
return;
|
|
263
|
+
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
264
|
+
if (rgba) {
|
|
265
|
+
if (a != null && !Number.isNaN(a)) {
|
|
266
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
267
|
+
return {
|
|
268
|
+
[property]: `rgba(${rgba.join(",")})`
|
|
269
|
+
};
|
|
270
|
+
} else {
|
|
271
|
+
return {
|
|
272
|
+
[`--un-${varName}-opacity`]: 1,
|
|
273
|
+
[property]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-${varName}-opacity))`
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
return {
|
|
278
|
+
[property]: color.replace("%alpha", `${a || 1}`)
|
|
279
|
+
};
|
|
280
|
+
}
|
|
148
281
|
};
|
|
149
282
|
|
|
150
|
-
export {
|
|
283
|
+
export { cornerMap as a, capitalize as b, colorResolver as c, directionMap as d, directionSize as e, h as f, handler as h, parseColor as p, valueHandlers as v, xyzMap as x };
|
package/dist/index.cjs
CHANGED
|
@@ -6,8 +6,8 @@ const _default = require('./chunks/default.cjs');
|
|
|
6
6
|
const _default$1 = require('./chunks/default2.cjs');
|
|
7
7
|
const _default$2 = require('./chunks/default3.cjs');
|
|
8
8
|
const colors = require('./chunks/colors.cjs');
|
|
9
|
-
require('@unocss/core');
|
|
10
9
|
require('./chunks/utilities.cjs');
|
|
10
|
+
require('@unocss/core');
|
|
11
11
|
require('./chunks/pseudo.cjs');
|
|
12
12
|
require('./chunks/variants.cjs');
|
|
13
13
|
|
package/dist/index.mjs
CHANGED
|
@@ -3,8 +3,8 @@ export { t as theme } from './chunks/default.mjs';
|
|
|
3
3
|
import { r as rules } from './chunks/default2.mjs';
|
|
4
4
|
import { v as variants, a as variantColorsMedia, b as variantColorsClass } from './chunks/default3.mjs';
|
|
5
5
|
export { c as colors } from './chunks/colors.mjs';
|
|
6
|
-
import '@unocss/core';
|
|
7
6
|
import './chunks/utilities.mjs';
|
|
7
|
+
import '@unocss/core';
|
|
8
8
|
import './chunks/pseudo.mjs';
|
|
9
9
|
import './chunks/variants.mjs';
|
|
10
10
|
|
package/dist/rules.cjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const _default = require('./chunks/default2.cjs');
|
|
6
|
-
require('@unocss/core');
|
|
7
6
|
require('./chunks/utilities.cjs');
|
|
7
|
+
require('@unocss/core');
|
|
8
8
|
require('./chunks/pseudo.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -19,9 +19,7 @@ exports.borders = _default.borders;
|
|
|
19
19
|
exports.boxShadows = _default.boxShadows;
|
|
20
20
|
exports.boxSizing = _default.boxSizing;
|
|
21
21
|
exports.breaks = _default.breaks;
|
|
22
|
-
exports.colorResolver = _default.colorResolver;
|
|
23
22
|
exports.contents = _default.contents;
|
|
24
|
-
exports.cssProps = _default.cssProps;
|
|
25
23
|
exports.cssVariables = _default.cssVariables;
|
|
26
24
|
exports.cursors = _default.cursors;
|
|
27
25
|
exports.displays = _default.displays;
|
|
@@ -40,7 +38,6 @@ exports.orders = _default.orders;
|
|
|
40
38
|
exports.outline = _default.outline;
|
|
41
39
|
exports.overflows = _default.overflows;
|
|
42
40
|
exports.paddings = _default.paddings;
|
|
43
|
-
exports.parseColorUtil = _default.parseColorUtil;
|
|
44
41
|
exports.placeholder = _default.placeholder;
|
|
45
42
|
exports.placements = _default.placements;
|
|
46
43
|
exports.pointerEvents = _default.pointerEvents;
|
package/dist/rules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Rule
|
|
1
|
+
import { Rule } from '@unocss/core';
|
|
2
2
|
import { T as Theme } from './types-7963d0b3';
|
|
3
3
|
|
|
4
4
|
declare const verticalAligns: Rule[];
|
|
@@ -11,16 +11,6 @@ declare const willChange: Rule[];
|
|
|
11
11
|
|
|
12
12
|
declare const borders: Rule[];
|
|
13
13
|
|
|
14
|
-
declare const parseColorUtil: (body: string, theme: Theme) => {
|
|
15
|
-
opacity: string;
|
|
16
|
-
name: string;
|
|
17
|
-
no: string;
|
|
18
|
-
color: string | undefined;
|
|
19
|
-
rgba: [number, number, number, number] | [number, number, number] | undefined;
|
|
20
|
-
} | undefined;
|
|
21
|
-
declare const colorResolver: (attribute: string, varName: string) => ([, body]: string[], { theme }: RuleContext<Theme>) => {
|
|
22
|
-
[x: string]: string | number;
|
|
23
|
-
} | undefined;
|
|
24
14
|
/**
|
|
25
15
|
* @example op10 op-30 opacity-100
|
|
26
16
|
*/
|
|
@@ -71,7 +61,6 @@ declare const aspectRatio: Rule[];
|
|
|
71
61
|
declare const paddings: Rule[];
|
|
72
62
|
declare const margins: Rule[];
|
|
73
63
|
|
|
74
|
-
declare const cssProps: string[];
|
|
75
64
|
declare const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
76
65
|
declare const displays: Rule[];
|
|
77
66
|
declare const appearances: Rule[];
|
|
@@ -103,4 +92,4 @@ declare const cssVariables: Rule[];
|
|
|
103
92
|
|
|
104
93
|
declare const textDecorations: Rule[];
|
|
105
94
|
|
|
106
|
-
export { alignments, appearance, appearances, aspectRatio, bgColors, borderColors, borders, boxShadows, boxSizing, breaks,
|
|
95
|
+
export { alignments, appearance, appearances, aspectRatio, bgColors, borderColors, borders, boxShadows, boxSizing, breaks, contents, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placeholder, placements, pointerEvents, positions, questionMark, resizes, ringColors, ringOffsetColors, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
|
package/dist/rules.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '@unocss/core';
|
|
1
|
+
export { s as alignments, a as appearance, K as appearances, F as aspectRatio, e as bgColors, f as borderColors, b as borders, D as boxShadows, A as boxSizing, R as breaks, Q as contents, a2 as cssVariables, L as cursors, J as displays, i as flex, y as floats, V as fontSmoothings, U as fontStyles, Z as fonts, j as gaps, k as grids, x as insets, n as justifies, H as margins, c as opacity, q as orders, o as outline, l as overflows, G as paddings, p as placeholder, u as placements, M as pointerEvents, m as positions, B as questionMark, N as resizes, g as ringColors, h as ringOffsetColors, C as rings, r as rules, E as sizes, W as svgUtilities, _ as tabSizes, t as textAligns, d as textColors, a3 as textDecorations, $ as textIndents, S as textOverflows, a1 as textShadows, a0 as textStrokes, T as textTransforms, X as transforms, Y as transitions, O as userSelects, I as varEmpty, v as verticalAligns, P as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
|
|
3
2
|
import './chunks/utilities.mjs';
|
|
3
|
+
import '@unocss/core';
|
|
4
4
|
import './chunks/pseudo.mjs';
|
package/dist/utils.cjs
CHANGED
|
@@ -9,11 +9,13 @@ require('@unocss/core');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
exports.capitalize = utilities.capitalize;
|
|
12
|
+
exports.colorResolver = utilities.colorResolver;
|
|
12
13
|
exports.cornerMap = utilities.cornerMap;
|
|
13
14
|
exports.directionMap = utilities.directionMap;
|
|
14
15
|
exports.directionSize = utilities.directionSize;
|
|
15
16
|
exports.h = utilities.h;
|
|
16
17
|
exports.handler = utilities.handler;
|
|
18
|
+
exports.parseColor = utilities.parseColor;
|
|
17
19
|
exports.valueHandlers = utilities.valueHandlers;
|
|
18
20
|
exports.xyzMap = utilities.xyzMap;
|
|
19
21
|
exports.variantMatcher = variants.variantMatcher;
|