@unocss/preset-mini 0.23.0 → 0.24.3
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/README.md +1 -1
- package/dist/chunks/default.cjs +3 -0
- package/dist/chunks/default.mjs +3 -1
- package/dist/chunks/default2.cjs +119 -133
- package/dist/chunks/default2.mjs +121 -134
- package/dist/chunks/default3.cjs +9 -4
- package/dist/chunks/default3.mjs +10 -5
- package/dist/chunks/utilities.cjs +129 -112
- package/dist/chunks/utilities.mjs +128 -114
- package/dist/chunks/variants.mjs +1 -1
- package/dist/{colors-db01a23e.d.ts → colors-06de139a.d.ts} +1 -1
- package/dist/colors.d.ts +2 -2
- package/dist/{default-c46850c2.d.ts → default-595a2a04.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/rules.cjs +0 -1
- package/dist/rules.d.ts +2 -3
- package/dist/rules.mjs +1 -1
- package/dist/theme.cjs +1 -0
- package/dist/theme.d.ts +12 -5
- package/dist/theme.mjs +1 -1
- package/dist/{types-154878eb.d.ts → types-f185ef8d.d.ts} +1 -0
- package/dist/{utilities-8c324eff.d.ts → utilities-df1ea892.d.ts} +6 -5
- package/dist/utils.cjs +3 -0
- package/dist/utils.d.ts +5 -3
- package/dist/utils.mjs +2 -2
- package/dist/variants.d.ts +4 -4
- package/package.json +5 -5
package/dist/chunks/default3.cjs
CHANGED
|
@@ -58,8 +58,7 @@ const variantCombinators = [
|
|
|
58
58
|
scopeMatcher(true, "group", "&&-c &&-s"),
|
|
59
59
|
scopeMatcher(true, "parent", "&&-c>&&-s"),
|
|
60
60
|
scopeMatcher(true, "previous", "&&-c+&&-s"),
|
|
61
|
-
scopeMatcher(true, "peer", "&&-c~&&-s")
|
|
62
|
-
variants$1.variantMatcher("svg", (input) => `${input} svg`)
|
|
61
|
+
scopeMatcher(true, "peer", "&&-c~&&-s")
|
|
63
62
|
];
|
|
64
63
|
|
|
65
64
|
const variantMotions = [
|
|
@@ -197,6 +196,10 @@ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
|
197
196
|
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
198
197
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
199
198
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
199
|
+
const sortValue = (pseudo) => {
|
|
200
|
+
if (pseudo === "active")
|
|
201
|
+
return 1;
|
|
202
|
+
};
|
|
200
203
|
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
201
204
|
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
202
205
|
const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
|
|
@@ -208,7 +211,8 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
208
211
|
pseudo = `:${match[2]}(${pseudo})`;
|
|
209
212
|
return {
|
|
210
213
|
matcher: input.slice(match[0].length),
|
|
211
|
-
selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}
|
|
214
|
+
selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`,
|
|
215
|
+
sort: sortValue(match[3])
|
|
212
216
|
};
|
|
213
217
|
}
|
|
214
218
|
};
|
|
@@ -230,7 +234,8 @@ const variantPseudoClasses = {
|
|
|
230
234
|
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
231
235
|
return {
|
|
232
236
|
matcher: input.slice(match[0].length),
|
|
233
|
-
selector: (s) => `${s}${pseudo}
|
|
237
|
+
selector: (s) => `${s}${pseudo}`,
|
|
238
|
+
sort: sortValue(match[1])
|
|
234
239
|
};
|
|
235
240
|
}
|
|
236
241
|
},
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as
|
|
1
|
+
import { v as variantParentMatcher, a as variantMatcher } from './variants.mjs';
|
|
2
2
|
import { toArray, escapeRegExp } from '@unocss/core';
|
|
3
3
|
|
|
4
4
|
const regexCache = {};
|
|
@@ -56,8 +56,7 @@ const variantCombinators = [
|
|
|
56
56
|
scopeMatcher(true, "group", "&&-c &&-s"),
|
|
57
57
|
scopeMatcher(true, "parent", "&&-c>&&-s"),
|
|
58
58
|
scopeMatcher(true, "previous", "&&-c+&&-s"),
|
|
59
|
-
scopeMatcher(true, "peer", "&&-c~&&-s")
|
|
60
|
-
variantMatcher("svg", (input) => `${input} svg`)
|
|
59
|
+
scopeMatcher(true, "peer", "&&-c~&&-s")
|
|
61
60
|
];
|
|
62
61
|
|
|
63
62
|
const variantMotions = [
|
|
@@ -195,6 +194,10 @@ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
|
195
194
|
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
196
195
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
197
196
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
197
|
+
const sortValue = (pseudo) => {
|
|
198
|
+
if (pseudo === "active")
|
|
199
|
+
return 1;
|
|
200
|
+
};
|
|
198
201
|
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
199
202
|
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
200
203
|
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
@@ -206,7 +209,8 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
206
209
|
pseudo = `:${match[2]}(${pseudo})`;
|
|
207
210
|
return {
|
|
208
211
|
matcher: input.slice(match[0].length),
|
|
209
|
-
selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}
|
|
212
|
+
selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`,
|
|
213
|
+
sort: sortValue(match[3])
|
|
210
214
|
};
|
|
211
215
|
}
|
|
212
216
|
};
|
|
@@ -228,7 +232,8 @@ const variantPseudoClasses = {
|
|
|
228
232
|
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
229
233
|
return {
|
|
230
234
|
matcher: input.slice(match[0].length),
|
|
231
|
-
selector: (s) => `${s}${pseudo}
|
|
235
|
+
selector: (s) => `${s}${pseudo}`,
|
|
236
|
+
sort: sortValue(match[1])
|
|
232
237
|
};
|
|
233
238
|
}
|
|
234
239
|
},
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const core = require('@unocss/core');
|
|
4
4
|
|
|
5
|
+
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
5
6
|
function hex2rgba(hex = "") {
|
|
6
7
|
const color = parseHexColor(hex);
|
|
7
8
|
if (color != null) {
|
|
@@ -11,41 +12,32 @@ function hex2rgba(hex = "") {
|
|
|
11
12
|
return [...components, alpha];
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
function parseHexColor(str) {
|
|
15
|
-
const [, body] = str.match(/^#?([\da-f]+)$/i) || [];
|
|
16
|
-
if (!body)
|
|
17
|
-
return;
|
|
18
|
-
switch (body.length) {
|
|
19
|
-
case 3:
|
|
20
|
-
case 4:
|
|
21
|
-
const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n);
|
|
22
|
-
return {
|
|
23
|
-
type: "rgb",
|
|
24
|
-
components: digits.slice(0, 3),
|
|
25
|
-
alpha: body.length === 3 ? void 0 : Math.round(digits[3] / 255 * 100) / 100
|
|
26
|
-
};
|
|
27
|
-
case 6:
|
|
28
|
-
case 8:
|
|
29
|
-
const value = Number.parseInt(body, 16);
|
|
30
|
-
return {
|
|
31
|
-
type: "rgb",
|
|
32
|
-
components: body.length === 6 ? [value >> 16 & 255, value >> 8 & 255, value & 255] : [value >> 24 & 255, value >> 16 & 255, value >> 8 & 255],
|
|
33
|
-
alpha: body.length === 6 ? void 0 : Math.round((value & 255) / 255 * 100) / 100
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
15
|
function parseCssColor(str = "") {
|
|
38
16
|
const color = parseColor$1(str);
|
|
39
17
|
if (color == null)
|
|
40
18
|
return;
|
|
41
19
|
const { type: casedType, components, alpha } = color;
|
|
42
20
|
const type = casedType.toLowerCase();
|
|
21
|
+
if (components.length === 0)
|
|
22
|
+
return;
|
|
43
23
|
if (["rgba", "hsla"].includes(type) && alpha === void 0)
|
|
44
24
|
return;
|
|
45
|
-
if (
|
|
25
|
+
if (cssColorFunctions.includes(type) && components.length !== 3)
|
|
46
26
|
return;
|
|
47
27
|
return { type, components, alpha };
|
|
48
28
|
}
|
|
29
|
+
function colorToString(color, alphaOverride) {
|
|
30
|
+
const { components } = color;
|
|
31
|
+
let { alpha, type } = color;
|
|
32
|
+
alpha = alphaOverride ?? alpha;
|
|
33
|
+
type = type.toLowerCase();
|
|
34
|
+
if (["hsla", "hsl", "rgba", "rgb"].includes(type))
|
|
35
|
+
return `${type.replace("a", "")}a(${components.join(",")}${alpha == null ? "" : `,${alpha}`})`;
|
|
36
|
+
alpha = alpha == null ? "" : ` / ${alpha}`;
|
|
37
|
+
if (cssColorFunctions.includes(type))
|
|
38
|
+
return `${type}(${components.join(" ")}${alpha})`;
|
|
39
|
+
return `color(${type} ${components.join(" ")}${alpha})`;
|
|
40
|
+
}
|
|
49
41
|
function parseColor$1(str) {
|
|
50
42
|
if (!str)
|
|
51
43
|
return;
|
|
@@ -65,10 +57,32 @@ function parseColor$1(str) {
|
|
|
65
57
|
if (color != null)
|
|
66
58
|
return color;
|
|
67
59
|
}
|
|
60
|
+
function parseHexColor(str) {
|
|
61
|
+
const [, body] = str.match(/^#?([\da-f]+)$/i) || [];
|
|
62
|
+
if (!body)
|
|
63
|
+
return;
|
|
64
|
+
switch (body.length) {
|
|
65
|
+
case 3:
|
|
66
|
+
case 4:
|
|
67
|
+
const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n);
|
|
68
|
+
return {
|
|
69
|
+
type: "rgb",
|
|
70
|
+
components: digits.slice(0, 3),
|
|
71
|
+
alpha: body.length === 3 ? void 0 : Math.round(digits[3] / 255 * 100) / 100
|
|
72
|
+
};
|
|
73
|
+
case 6:
|
|
74
|
+
case 8:
|
|
75
|
+
const value = Number.parseInt(body, 16);
|
|
76
|
+
return {
|
|
77
|
+
type: "rgb",
|
|
78
|
+
components: body.length === 6 ? [value >> 16 & 255, value >> 8 & 255, value & 255] : [value >> 24 & 255, value >> 16 & 255, value >> 8 & 255],
|
|
79
|
+
alpha: body.length === 6 ? void 0 : Math.round((value & 255) / 255 * 100) / 100
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
68
83
|
function cssColorKeyword(str) {
|
|
69
84
|
const color = {
|
|
70
|
-
rebeccapurple: [102, 51, 153, 1]
|
|
71
|
-
transparent: [0, 0, 0, 0]
|
|
85
|
+
rebeccapurple: [102, 51, 153, 1]
|
|
72
86
|
}[str];
|
|
73
87
|
if (color != null) {
|
|
74
88
|
return {
|
|
@@ -78,54 +92,13 @@ function cssColorKeyword(str) {
|
|
|
78
92
|
};
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
|
-
function getComponent(separator, str) {
|
|
82
|
-
const component = str.trim();
|
|
83
|
-
if (component === "")
|
|
84
|
-
return;
|
|
85
|
-
const l = str.length;
|
|
86
|
-
let parenthesis = 0;
|
|
87
|
-
for (let i = 0; i < l; i++) {
|
|
88
|
-
switch (str[i]) {
|
|
89
|
-
case "(":
|
|
90
|
-
parenthesis++;
|
|
91
|
-
break;
|
|
92
|
-
case ")":
|
|
93
|
-
if (--parenthesis < 0)
|
|
94
|
-
return;
|
|
95
|
-
break;
|
|
96
|
-
case separator:
|
|
97
|
-
if (parenthesis === 0) {
|
|
98
|
-
const component2 = str.slice(0, i).trim();
|
|
99
|
-
if (component2 === "")
|
|
100
|
-
return;
|
|
101
|
-
return [
|
|
102
|
-
str.slice(0, i).trim(),
|
|
103
|
-
str.slice(i + 1).trim()
|
|
104
|
-
];
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return [
|
|
109
|
-
str.trim(),
|
|
110
|
-
""
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
95
|
function parseCssCommaColorFunction(color) {
|
|
114
96
|
const match = color.match(/^(rgb|rgba|hsl|hsla)\((.+)\)$/i);
|
|
115
97
|
if (!match)
|
|
116
98
|
return;
|
|
117
99
|
const [, type, componentString] = match;
|
|
118
|
-
const components =
|
|
119
|
-
|
|
120
|
-
for (let c = 5; c > 0 && cs !== ""; --c) {
|
|
121
|
-
const componentValue = getComponent(",", cs);
|
|
122
|
-
if (!componentValue)
|
|
123
|
-
return;
|
|
124
|
-
const [component, rest] = componentValue;
|
|
125
|
-
components.push(component);
|
|
126
|
-
cs = rest;
|
|
127
|
-
}
|
|
128
|
-
if ([3, 4].includes(components.length)) {
|
|
100
|
+
const components = getComponents(componentString, ",", 5);
|
|
101
|
+
if (components && [3, 4].includes(components.length)) {
|
|
129
102
|
return {
|
|
130
103
|
type,
|
|
131
104
|
components: components.slice(0, 3),
|
|
@@ -133,8 +106,9 @@ function parseCssCommaColorFunction(color) {
|
|
|
133
106
|
};
|
|
134
107
|
}
|
|
135
108
|
}
|
|
109
|
+
const cssColorFunctionsRe = new RegExp(`^(${cssColorFunctions.join("|")})\\((.+)\\)$`, "i");
|
|
136
110
|
function parseCssSpaceColorFunction(color) {
|
|
137
|
-
const match = color.match(
|
|
111
|
+
const match = color.match(cssColorFunctionsRe);
|
|
138
112
|
if (!match)
|
|
139
113
|
return;
|
|
140
114
|
const [, fn, componentString] = match;
|
|
@@ -163,16 +137,9 @@ function parseCssColorFunction(color) {
|
|
|
163
137
|
}
|
|
164
138
|
}
|
|
165
139
|
function parseCssSpaceColorValues(componentString) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const cc = getComponent(" ", cs);
|
|
170
|
-
if (!cc)
|
|
171
|
-
return;
|
|
172
|
-
const [component, rest] = cc;
|
|
173
|
-
components.push(component);
|
|
174
|
-
cs = rest;
|
|
175
|
-
}
|
|
140
|
+
const components = getComponents(componentString);
|
|
141
|
+
if (!components)
|
|
142
|
+
return;
|
|
176
143
|
let totalComponents = components.length;
|
|
177
144
|
if (components[totalComponents - 2] === "/") {
|
|
178
145
|
return {
|
|
@@ -180,21 +147,14 @@ function parseCssSpaceColorValues(componentString) {
|
|
|
180
147
|
alpha: components[totalComponents - 1]
|
|
181
148
|
};
|
|
182
149
|
}
|
|
183
|
-
if (components[totalComponents - 2].endsWith("/") || components[totalComponents - 1].startsWith("/")) {
|
|
150
|
+
if (components[totalComponents - 2] != null && (components[totalComponents - 2].endsWith("/") || components[totalComponents - 1].startsWith("/"))) {
|
|
184
151
|
const removed = components.splice(totalComponents - 2);
|
|
185
152
|
components.push(removed.join(" "));
|
|
186
153
|
--totalComponents;
|
|
187
154
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const cc = getComponent("/", cs);
|
|
192
|
-
if (!cc)
|
|
193
|
-
return;
|
|
194
|
-
const [component, rest] = cc;
|
|
195
|
-
withAlpha.push(component);
|
|
196
|
-
cs = rest;
|
|
197
|
-
}
|
|
155
|
+
const withAlpha = getComponents(components[totalComponents - 1], "/", 3);
|
|
156
|
+
if (!withAlpha)
|
|
157
|
+
return;
|
|
198
158
|
if (withAlpha.length === 1 || withAlpha[withAlpha.length - 1] === "")
|
|
199
159
|
return { components };
|
|
200
160
|
const alpha = withAlpha.pop();
|
|
@@ -204,6 +164,58 @@ function parseCssSpaceColorValues(componentString) {
|
|
|
204
164
|
alpha
|
|
205
165
|
};
|
|
206
166
|
}
|
|
167
|
+
function getComponent(str, separator) {
|
|
168
|
+
str = str.trim();
|
|
169
|
+
if (str === "")
|
|
170
|
+
return;
|
|
171
|
+
const l = str.length;
|
|
172
|
+
let parenthesis = 0;
|
|
173
|
+
for (let i = 0; i < l; i++) {
|
|
174
|
+
switch (str[i]) {
|
|
175
|
+
case "(":
|
|
176
|
+
parenthesis++;
|
|
177
|
+
break;
|
|
178
|
+
case ")":
|
|
179
|
+
if (--parenthesis < 0)
|
|
180
|
+
return;
|
|
181
|
+
break;
|
|
182
|
+
case separator:
|
|
183
|
+
if (parenthesis === 0) {
|
|
184
|
+
const component = str.slice(0, i).trim();
|
|
185
|
+
if (component === "")
|
|
186
|
+
return;
|
|
187
|
+
return [
|
|
188
|
+
component,
|
|
189
|
+
str.slice(i + 1).trim()
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return [
|
|
195
|
+
str,
|
|
196
|
+
""
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
function getComponents(str, separator, limit) {
|
|
200
|
+
separator = separator ?? " ";
|
|
201
|
+
if (separator.length !== 1)
|
|
202
|
+
return;
|
|
203
|
+
limit = limit ?? 10;
|
|
204
|
+
const components = [];
|
|
205
|
+
let i = 0;
|
|
206
|
+
while (str !== "") {
|
|
207
|
+
if (++i > limit)
|
|
208
|
+
return;
|
|
209
|
+
const componentPair = getComponent(str, separator);
|
|
210
|
+
if (!componentPair)
|
|
211
|
+
return;
|
|
212
|
+
const [component, rest] = componentPair;
|
|
213
|
+
components.push(component);
|
|
214
|
+
str = rest;
|
|
215
|
+
}
|
|
216
|
+
if (components.length > 0)
|
|
217
|
+
return components;
|
|
218
|
+
}
|
|
207
219
|
|
|
208
220
|
const directionMap = {
|
|
209
221
|
"l": ["-left"],
|
|
@@ -509,54 +521,59 @@ const parseColor = (body, theme) => {
|
|
|
509
521
|
else if (no && colorData)
|
|
510
522
|
color = colorData[no];
|
|
511
523
|
}
|
|
512
|
-
const rgba = hex2rgba(color);
|
|
513
|
-
const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
514
|
-
const hasAlpha = alpha != null && !Number.isNaN(alpha);
|
|
515
|
-
if (rgba) {
|
|
516
|
-
if (hasAlpha) {
|
|
517
|
-
rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
|
|
518
|
-
} else {
|
|
519
|
-
rgba.splice(3);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
524
|
return {
|
|
523
525
|
opacity,
|
|
524
526
|
name,
|
|
525
527
|
no,
|
|
526
528
|
color,
|
|
527
|
-
|
|
528
|
-
alpha:
|
|
529
|
+
cssColor: parseCssColor(color),
|
|
530
|
+
alpha: handler.bracket.cssvar.percent(opacity ?? "")
|
|
529
531
|
};
|
|
530
532
|
};
|
|
531
533
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
532
534
|
const data = parseColor(body, theme);
|
|
533
535
|
if (!data)
|
|
534
536
|
return;
|
|
535
|
-
const { alpha,
|
|
536
|
-
if (
|
|
537
|
-
return;
|
|
538
|
-
if (rgba) {
|
|
537
|
+
const { alpha, color, cssColor } = data;
|
|
538
|
+
if (cssColor) {
|
|
539
539
|
if (alpha != null) {
|
|
540
540
|
return {
|
|
541
|
-
[property]:
|
|
541
|
+
[property]: colorToString(cssColor, alpha)
|
|
542
542
|
};
|
|
543
543
|
} else {
|
|
544
544
|
return {
|
|
545
|
-
[`--un-${varName}-opacity`]:
|
|
546
|
-
[property]:
|
|
545
|
+
[`--un-${varName}-opacity`]: cssColor.alpha ?? 1,
|
|
546
|
+
[property]: colorToString(cssColor, `var(--un-${varName}-opacity)`)
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
} else {
|
|
549
|
+
} else if (color) {
|
|
550
550
|
return {
|
|
551
|
-
[property]: color.replace("%alpha", `${alpha
|
|
551
|
+
[property]: color.replace("%alpha", `${alpha ?? 1}`)
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
554
|
};
|
|
555
|
+
const colorableShadows = (shadows, colorVar) => {
|
|
556
|
+
const colored = [];
|
|
557
|
+
shadows = core.toArray(shadows);
|
|
558
|
+
for (let i = 0; i < shadows.length; i++) {
|
|
559
|
+
const components = getComponents(shadows[i], " ", 6);
|
|
560
|
+
if (!components || components.length < 3)
|
|
561
|
+
return shadows;
|
|
562
|
+
const color = parseCssColor(components.pop());
|
|
563
|
+
if (color == null)
|
|
564
|
+
return shadows;
|
|
565
|
+
colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
|
|
566
|
+
}
|
|
567
|
+
return colored;
|
|
568
|
+
};
|
|
555
569
|
|
|
556
570
|
exports.colorResolver = colorResolver;
|
|
571
|
+
exports.colorToString = colorToString;
|
|
572
|
+
exports.colorableShadows = colorableShadows;
|
|
557
573
|
exports.cornerMap = cornerMap;
|
|
558
574
|
exports.directionMap = directionMap;
|
|
559
575
|
exports.directionSize = directionSize;
|
|
576
|
+
exports.getComponents = getComponents;
|
|
560
577
|
exports.h = h;
|
|
561
578
|
exports.handler = handler;
|
|
562
579
|
exports.hex2rgba = hex2rgba;
|