@unocss/preset-mini 0.20.1 → 0.20.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 +5 -7
- package/dist/chunks/default2.mjs +5 -7
- package/dist/chunks/default3.cjs +22 -1
- package/dist/chunks/default3.mjs +20 -2
- package/dist/chunks/pseudo.cjs +18 -14
- package/dist/chunks/pseudo.mjs +18 -14
- package/dist/chunks/utilities.cjs +16 -7
- package/dist/chunks/utilities.mjs +16 -7
- package/dist/variants.cjs +3 -0
- package/dist/variants.d.ts +7 -1
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/default2.cjs
CHANGED
|
@@ -68,13 +68,11 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
68
68
|
const data = utilities.parseColor(body, theme);
|
|
69
69
|
if (!data)
|
|
70
70
|
return;
|
|
71
|
-
const { opacity, color, rgba } = data;
|
|
71
|
+
const { alpha, opacity, color, rgba } = data;
|
|
72
72
|
if (!color)
|
|
73
73
|
return;
|
|
74
|
-
const a = opacity ? opacity[0] === "[" ? utilities.handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
75
74
|
if (rgba) {
|
|
76
|
-
if (
|
|
77
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
75
|
+
if (alpha != null) {
|
|
78
76
|
return {
|
|
79
77
|
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
80
78
|
};
|
|
@@ -82,19 +80,19 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
82
80
|
if (direction === "") {
|
|
83
81
|
return {
|
|
84
82
|
"--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
|
|
85
|
-
[`border${direction}-color`]: `rgba(${rgba.
|
|
83
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
|
|
86
84
|
};
|
|
87
85
|
} else {
|
|
88
86
|
return {
|
|
89
87
|
"--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
|
|
90
88
|
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
91
|
-
[`border${direction}-color`]: `rgba(${rgba.
|
|
89
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
|
|
92
90
|
};
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
} else {
|
|
96
94
|
return {
|
|
97
|
-
[`border${direction}-color`]: color.replace("%alpha", `${
|
|
95
|
+
[`border${direction}-color`]: color.replace("%alpha", `${alpha || 1}`)
|
|
98
96
|
};
|
|
99
97
|
}
|
|
100
98
|
};
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -66,13 +66,11 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
66
66
|
const data = parseColor(body, theme);
|
|
67
67
|
if (!data)
|
|
68
68
|
return;
|
|
69
|
-
const { opacity, color, rgba } = data;
|
|
69
|
+
const { alpha, opacity, color, rgba } = data;
|
|
70
70
|
if (!color)
|
|
71
71
|
return;
|
|
72
|
-
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
73
72
|
if (rgba) {
|
|
74
|
-
if (
|
|
75
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
73
|
+
if (alpha != null) {
|
|
76
74
|
return {
|
|
77
75
|
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
78
76
|
};
|
|
@@ -80,19 +78,19 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
80
78
|
if (direction === "") {
|
|
81
79
|
return {
|
|
82
80
|
"--un-border-opacity": (opacity && handler.cssvar(opacity)) ?? 1,
|
|
83
|
-
[`border${direction}-color`]: `rgba(${rgba.
|
|
81
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
|
|
84
82
|
};
|
|
85
83
|
} else {
|
|
86
84
|
return {
|
|
87
85
|
"--un-border-opacity": (opacity && handler.cssvar(opacity)) ?? 1,
|
|
88
86
|
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
89
|
-
[`border${direction}-color`]: `rgba(${rgba.
|
|
87
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
} else {
|
|
94
92
|
return {
|
|
95
|
-
[`border${direction}-color`]: color.replace("%alpha", `${
|
|
93
|
+
[`border${direction}-color`]: color.replace("%alpha", `${alpha || 1}`)
|
|
96
94
|
};
|
|
97
95
|
}
|
|
98
96
|
};
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -65,6 +65,11 @@ const variantColorsMediaOrClass = [
|
|
|
65
65
|
}
|
|
66
66
|
];
|
|
67
67
|
|
|
68
|
+
const variantLanguageDirections = [
|
|
69
|
+
variants$1.variantMatcher("rtl", (input) => `[dir="rtl"] $$ ${input}`),
|
|
70
|
+
variants$1.variantMatcher("ltr", (input) => `[dir="ltr"] $$ ${input}`)
|
|
71
|
+
];
|
|
72
|
+
|
|
68
73
|
const variantImportant = {
|
|
69
74
|
match(matcher) {
|
|
70
75
|
if (matcher.startsWith("!")) {
|
|
@@ -109,6 +114,16 @@ const variantSpace = (matcher) => {
|
|
|
109
114
|
}
|
|
110
115
|
};
|
|
111
116
|
|
|
117
|
+
const variantMotions = [
|
|
118
|
+
variants$1.variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
|
|
119
|
+
variants$1.variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
const variantOrientations = [
|
|
123
|
+
variants$1.variantParentMatcher("landscape", "@media (orientation: landscape)"),
|
|
124
|
+
variants$1.variantParentMatcher("portrait", "@media (orientation: portrait)")
|
|
125
|
+
];
|
|
126
|
+
|
|
112
127
|
const variantPrint = variants$1.variantParentMatcher("print", "@media print");
|
|
113
128
|
|
|
114
129
|
const variants = [
|
|
@@ -116,6 +131,8 @@ const variants = [
|
|
|
116
131
|
variantNegative,
|
|
117
132
|
variantImportant,
|
|
118
133
|
variantPrint,
|
|
134
|
+
...variantOrientations,
|
|
135
|
+
...variantMotions,
|
|
119
136
|
variantBreakpoints,
|
|
120
137
|
...variantCombinators,
|
|
121
138
|
pseudo.variantPseudoClasses,
|
|
@@ -123,14 +140,18 @@ const variants = [
|
|
|
123
140
|
pseudo.variantTaggedPseudoClasses,
|
|
124
141
|
pseudo.variantPseudoElements,
|
|
125
142
|
pseudo.partClasses,
|
|
126
|
-
...variantColorsMediaOrClass
|
|
143
|
+
...variantColorsMediaOrClass,
|
|
144
|
+
...variantLanguageDirections
|
|
127
145
|
];
|
|
128
146
|
|
|
129
147
|
exports.variantBreakpoints = variantBreakpoints;
|
|
130
148
|
exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
|
|
131
149
|
exports.variantCombinators = variantCombinators;
|
|
132
150
|
exports.variantImportant = variantImportant;
|
|
151
|
+
exports.variantLanguageDirections = variantLanguageDirections;
|
|
152
|
+
exports.variantMotions = variantMotions;
|
|
133
153
|
exports.variantNegative = variantNegative;
|
|
154
|
+
exports.variantOrientations = variantOrientations;
|
|
134
155
|
exports.variantPrint = variantPrint;
|
|
135
156
|
exports.variantSpace = variantSpace;
|
|
136
157
|
exports.variants = variants;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -63,6 +63,11 @@ const variantColorsMediaOrClass = [
|
|
|
63
63
|
}
|
|
64
64
|
];
|
|
65
65
|
|
|
66
|
+
const variantLanguageDirections = [
|
|
67
|
+
variantMatcher("rtl", (input) => `[dir="rtl"] $$ ${input}`),
|
|
68
|
+
variantMatcher("ltr", (input) => `[dir="ltr"] $$ ${input}`)
|
|
69
|
+
];
|
|
70
|
+
|
|
66
71
|
const variantImportant = {
|
|
67
72
|
match(matcher) {
|
|
68
73
|
if (matcher.startsWith("!")) {
|
|
@@ -107,6 +112,16 @@ const variantSpace = (matcher) => {
|
|
|
107
112
|
}
|
|
108
113
|
};
|
|
109
114
|
|
|
115
|
+
const variantMotions = [
|
|
116
|
+
variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
|
|
117
|
+
variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
const variantOrientations = [
|
|
121
|
+
variantParentMatcher("landscape", "@media (orientation: landscape)"),
|
|
122
|
+
variantParentMatcher("portrait", "@media (orientation: portrait)")
|
|
123
|
+
];
|
|
124
|
+
|
|
110
125
|
const variantPrint = variantParentMatcher("print", "@media print");
|
|
111
126
|
|
|
112
127
|
const variants = [
|
|
@@ -114,6 +129,8 @@ const variants = [
|
|
|
114
129
|
variantNegative,
|
|
115
130
|
variantImportant,
|
|
116
131
|
variantPrint,
|
|
132
|
+
...variantOrientations,
|
|
133
|
+
...variantMotions,
|
|
117
134
|
variantBreakpoints,
|
|
118
135
|
...variantCombinators,
|
|
119
136
|
variantPseudoClasses,
|
|
@@ -121,7 +138,8 @@ const variants = [
|
|
|
121
138
|
variantTaggedPseudoClasses,
|
|
122
139
|
variantPseudoElements,
|
|
123
140
|
partClasses,
|
|
124
|
-
...variantColorsMediaOrClass
|
|
141
|
+
...variantColorsMediaOrClass,
|
|
142
|
+
...variantLanguageDirections
|
|
125
143
|
];
|
|
126
144
|
|
|
127
|
-
export { variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c,
|
|
145
|
+
export { variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantLanguageDirections as d, variantImportant as e, variantNegative as f, variantSpace as g, variantMotions as h, variantOrientations as i, variantPrint as j, variants as v };
|
package/dist/chunks/pseudo.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const PseudoClasses = Object.fromEntries([
|
|
|
8
8
|
"link",
|
|
9
9
|
"visited",
|
|
10
10
|
"target",
|
|
11
|
+
["open", "[open]"],
|
|
11
12
|
"hover",
|
|
12
13
|
"active",
|
|
13
14
|
"focus-visible",
|
|
@@ -24,18 +25,20 @@ const PseudoClasses = Object.fromEntries([
|
|
|
24
25
|
"indeterminate",
|
|
25
26
|
"valid",
|
|
26
27
|
"invalid",
|
|
28
|
+
"in-range",
|
|
29
|
+
"out-of-range",
|
|
27
30
|
"required",
|
|
28
31
|
"optional",
|
|
29
32
|
"root",
|
|
30
33
|
"empty",
|
|
31
|
-
["even-of-type", "nth-of-type(even)"],
|
|
32
|
-
["even", "nth-child(even)"],
|
|
33
|
-
["odd-of-type", "nth-of-type(odd)"],
|
|
34
|
-
["odd", "nth-child(odd)"],
|
|
34
|
+
["even-of-type", ":nth-of-type(even)"],
|
|
35
|
+
["even", ":nth-child(even)"],
|
|
36
|
+
["odd-of-type", ":nth-of-type(odd)"],
|
|
37
|
+
["odd", ":nth-child(odd)"],
|
|
35
38
|
"first-of-type",
|
|
36
|
-
["first", "first-child"],
|
|
39
|
+
["first", ":first-child"],
|
|
37
40
|
"last-of-type",
|
|
38
|
-
["last", "last-child"],
|
|
41
|
+
["last", ":last-child"],
|
|
39
42
|
"only-child",
|
|
40
43
|
"only-of-type"
|
|
41
44
|
].map(core.toArray));
|
|
@@ -45,7 +48,8 @@ const PseudoElements = [
|
|
|
45
48
|
"after",
|
|
46
49
|
"first-letter",
|
|
47
50
|
"first-line",
|
|
48
|
-
"selection"
|
|
51
|
+
"selection",
|
|
52
|
+
"marker"
|
|
49
53
|
];
|
|
50
54
|
const PseudoClassFunctions = [
|
|
51
55
|
"not",
|
|
@@ -68,13 +72,13 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
68
72
|
return (input) => {
|
|
69
73
|
const match = input.match(re);
|
|
70
74
|
if (match) {
|
|
71
|
-
let pseudo = PseudoClasses[match[3]] || match[3]
|
|
75
|
+
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
72
76
|
if (match[2])
|
|
73
|
-
pseudo =
|
|
77
|
+
pseudo = `:${match[2]}(${pseudo})`;
|
|
74
78
|
return {
|
|
75
79
|
matcher: input.slice(match[1].length + tag.length + 2),
|
|
76
80
|
selector: (s, body) => {
|
|
77
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}
|
|
81
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
78
82
|
}
|
|
79
83
|
};
|
|
80
84
|
}
|
|
@@ -93,10 +97,10 @@ const variantPseudoClasses = {
|
|
|
93
97
|
match: (input) => {
|
|
94
98
|
const match = input.match(PseudoClassesRE);
|
|
95
99
|
if (match) {
|
|
96
|
-
const pseudo = PseudoClasses[match[1]] || match[1]
|
|
100
|
+
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
97
101
|
return {
|
|
98
102
|
matcher: input.slice(match[1].length + 1),
|
|
99
|
-
selector: (s, body) => shouldAdd(body) && `${s}
|
|
103
|
+
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
106
|
},
|
|
@@ -107,10 +111,10 @@ const variantPseudoClassFunctions = {
|
|
|
107
111
|
const match = input.match(PseudoClassFunctionsRE);
|
|
108
112
|
if (match) {
|
|
109
113
|
const fn = match[1];
|
|
110
|
-
const pseudo = PseudoClasses[match[2]] || match[2]
|
|
114
|
+
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
111
115
|
return {
|
|
112
116
|
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
113
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(
|
|
117
|
+
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
120
|
},
|
package/dist/chunks/pseudo.mjs
CHANGED
|
@@ -6,6 +6,7 @@ const PseudoClasses = Object.fromEntries([
|
|
|
6
6
|
"link",
|
|
7
7
|
"visited",
|
|
8
8
|
"target",
|
|
9
|
+
["open", "[open]"],
|
|
9
10
|
"hover",
|
|
10
11
|
"active",
|
|
11
12
|
"focus-visible",
|
|
@@ -22,18 +23,20 @@ const PseudoClasses = Object.fromEntries([
|
|
|
22
23
|
"indeterminate",
|
|
23
24
|
"valid",
|
|
24
25
|
"invalid",
|
|
26
|
+
"in-range",
|
|
27
|
+
"out-of-range",
|
|
25
28
|
"required",
|
|
26
29
|
"optional",
|
|
27
30
|
"root",
|
|
28
31
|
"empty",
|
|
29
|
-
["even-of-type", "nth-of-type(even)"],
|
|
30
|
-
["even", "nth-child(even)"],
|
|
31
|
-
["odd-of-type", "nth-of-type(odd)"],
|
|
32
|
-
["odd", "nth-child(odd)"],
|
|
32
|
+
["even-of-type", ":nth-of-type(even)"],
|
|
33
|
+
["even", ":nth-child(even)"],
|
|
34
|
+
["odd-of-type", ":nth-of-type(odd)"],
|
|
35
|
+
["odd", ":nth-child(odd)"],
|
|
33
36
|
"first-of-type",
|
|
34
|
-
["first", "first-child"],
|
|
37
|
+
["first", ":first-child"],
|
|
35
38
|
"last-of-type",
|
|
36
|
-
["last", "last-child"],
|
|
39
|
+
["last", ":last-child"],
|
|
37
40
|
"only-child",
|
|
38
41
|
"only-of-type"
|
|
39
42
|
].map(toArray));
|
|
@@ -43,7 +46,8 @@ const PseudoElements = [
|
|
|
43
46
|
"after",
|
|
44
47
|
"first-letter",
|
|
45
48
|
"first-line",
|
|
46
|
-
"selection"
|
|
49
|
+
"selection",
|
|
50
|
+
"marker"
|
|
47
51
|
];
|
|
48
52
|
const PseudoClassFunctions = [
|
|
49
53
|
"not",
|
|
@@ -66,13 +70,13 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
66
70
|
return (input) => {
|
|
67
71
|
const match = input.match(re);
|
|
68
72
|
if (match) {
|
|
69
|
-
let pseudo = PseudoClasses[match[3]] || match[3]
|
|
73
|
+
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
70
74
|
if (match[2])
|
|
71
|
-
pseudo =
|
|
75
|
+
pseudo = `:${match[2]}(${pseudo})`;
|
|
72
76
|
return {
|
|
73
77
|
matcher: input.slice(match[1].length + tag.length + 2),
|
|
74
78
|
selector: (s, body) => {
|
|
75
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}
|
|
79
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
82
|
}
|
|
@@ -91,10 +95,10 @@ const variantPseudoClasses = {
|
|
|
91
95
|
match: (input) => {
|
|
92
96
|
const match = input.match(PseudoClassesRE);
|
|
93
97
|
if (match) {
|
|
94
|
-
const pseudo = PseudoClasses[match[1]] || match[1]
|
|
98
|
+
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
95
99
|
return {
|
|
96
100
|
matcher: input.slice(match[1].length + 1),
|
|
97
|
-
selector: (s, body) => shouldAdd(body) && `${s}
|
|
101
|
+
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
104
|
},
|
|
@@ -105,10 +109,10 @@ const variantPseudoClassFunctions = {
|
|
|
105
109
|
const match = input.match(PseudoClassFunctionsRE);
|
|
106
110
|
if (match) {
|
|
107
111
|
const fn = match[1];
|
|
108
|
-
const pseudo = PseudoClasses[match[2]] || match[2]
|
|
112
|
+
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
109
113
|
return {
|
|
110
114
|
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
111
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(
|
|
115
|
+
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
112
116
|
};
|
|
113
117
|
}
|
|
114
118
|
},
|
|
@@ -249,37 +249,46 @@ const parseColor = (body, theme) => {
|
|
|
249
249
|
else if (no && colorData)
|
|
250
250
|
color = colorData[no];
|
|
251
251
|
}
|
|
252
|
+
const rgba = core.hex2rgba(color);
|
|
253
|
+
const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
254
|
+
const hasAlpha = alpha != null && !Number.isNaN(alpha);
|
|
255
|
+
if (rgba) {
|
|
256
|
+
if (hasAlpha) {
|
|
257
|
+
rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
|
|
258
|
+
} else {
|
|
259
|
+
rgba.splice(3);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
252
262
|
return {
|
|
253
263
|
opacity,
|
|
254
264
|
name,
|
|
255
265
|
no,
|
|
256
266
|
color,
|
|
257
|
-
rgba
|
|
267
|
+
rgba,
|
|
268
|
+
alpha: hasAlpha ? alpha : void 0
|
|
258
269
|
};
|
|
259
270
|
};
|
|
260
271
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
261
272
|
const data = parseColor(body, theme);
|
|
262
273
|
if (!data)
|
|
263
274
|
return;
|
|
264
|
-
const { opacity, color, rgba } = data;
|
|
275
|
+
const { alpha, opacity, color, rgba } = data;
|
|
265
276
|
if (!color)
|
|
266
277
|
return;
|
|
267
|
-
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
268
278
|
if (rgba) {
|
|
269
|
-
if (
|
|
270
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
279
|
+
if (alpha != null) {
|
|
271
280
|
return {
|
|
272
281
|
[property]: `rgba(${rgba.join(",")})`
|
|
273
282
|
};
|
|
274
283
|
} else {
|
|
275
284
|
return {
|
|
276
285
|
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
277
|
-
[property]: `rgba(${rgba.
|
|
286
|
+
[property]: `rgba(${rgba.join(",")},var(--un-${varName}-opacity))`
|
|
278
287
|
};
|
|
279
288
|
}
|
|
280
289
|
} else {
|
|
281
290
|
return {
|
|
282
|
-
[property]: color.replace("%alpha", `${
|
|
291
|
+
[property]: color.replace("%alpha", `${alpha || 1}`)
|
|
283
292
|
};
|
|
284
293
|
}
|
|
285
294
|
};
|
|
@@ -247,37 +247,46 @@ const parseColor = (body, theme) => {
|
|
|
247
247
|
else if (no && colorData)
|
|
248
248
|
color = colorData[no];
|
|
249
249
|
}
|
|
250
|
+
const rgba = hex2rgba(color);
|
|
251
|
+
const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
252
|
+
const hasAlpha = alpha != null && !Number.isNaN(alpha);
|
|
253
|
+
if (rgba) {
|
|
254
|
+
if (hasAlpha) {
|
|
255
|
+
rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
|
|
256
|
+
} else {
|
|
257
|
+
rgba.splice(3);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
250
260
|
return {
|
|
251
261
|
opacity,
|
|
252
262
|
name,
|
|
253
263
|
no,
|
|
254
264
|
color,
|
|
255
|
-
rgba
|
|
265
|
+
rgba,
|
|
266
|
+
alpha: hasAlpha ? alpha : void 0
|
|
256
267
|
};
|
|
257
268
|
};
|
|
258
269
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
259
270
|
const data = parseColor(body, theme);
|
|
260
271
|
if (!data)
|
|
261
272
|
return;
|
|
262
|
-
const { opacity, color, rgba } = data;
|
|
273
|
+
const { alpha, opacity, color, rgba } = data;
|
|
263
274
|
if (!color)
|
|
264
275
|
return;
|
|
265
|
-
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
266
276
|
if (rgba) {
|
|
267
|
-
if (
|
|
268
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
277
|
+
if (alpha != null) {
|
|
269
278
|
return {
|
|
270
279
|
[property]: `rgba(${rgba.join(",")})`
|
|
271
280
|
};
|
|
272
281
|
} else {
|
|
273
282
|
return {
|
|
274
283
|
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
275
|
-
[property]: `rgba(${rgba.
|
|
284
|
+
[property]: `rgba(${rgba.join(",")},var(--un-${varName}-opacity))`
|
|
276
285
|
};
|
|
277
286
|
}
|
|
278
287
|
} else {
|
|
279
288
|
return {
|
|
280
|
-
[property]: color.replace("%alpha", `${
|
|
289
|
+
[property]: color.replace("%alpha", `${alpha || 1}`)
|
|
281
290
|
};
|
|
282
291
|
}
|
|
283
292
|
};
|
package/dist/variants.cjs
CHANGED
|
@@ -13,7 +13,10 @@ 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
21
|
exports.variantSpace = _default.variantSpace;
|
|
19
22
|
exports.variants = _default.variants;
|
package/dist/variants.d.ts
CHANGED
|
@@ -8,12 +8,18 @@ declare const variantCombinators: Variant[];
|
|
|
8
8
|
|
|
9
9
|
declare const variantColorsMediaOrClass: Variant[];
|
|
10
10
|
|
|
11
|
+
declare const variantLanguageDirections: Variant[];
|
|
12
|
+
|
|
11
13
|
declare const variants: Variant<Theme>[];
|
|
12
14
|
|
|
13
15
|
declare const variantImportant: Variant;
|
|
14
16
|
declare const variantNegative: Variant;
|
|
15
17
|
declare const variantSpace: Variant;
|
|
16
18
|
|
|
19
|
+
declare const variantMotions: Variant[];
|
|
20
|
+
|
|
21
|
+
declare const variantOrientations: Variant[];
|
|
22
|
+
|
|
17
23
|
declare const variantPrint: (input: string) => _unocss_core.VariantHandler | undefined;
|
|
18
24
|
|
|
19
25
|
declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
@@ -23,4 +29,4 @@ declare const variantPseudoClassFunctions: VariantObject;
|
|
|
23
29
|
declare const variantTaggedPseudoClasses: VariantObject;
|
|
24
30
|
declare const partClasses: VariantObject;
|
|
25
31
|
|
|
26
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
|
|
32
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators,
|
|
1
|
+
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections, h as variantMotions, f as variantNegative, i as variantOrientations, j as variantPrint, g as variantSpace, v as variants } from './chunks/default3.mjs';
|
|
2
2
|
export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
|
|
3
3
|
import './chunks/variants.mjs';
|
|
4
4
|
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.20.
|
|
64
|
+
"@unocss/core": "0.20.2"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|