@unocss/transformer-directives 0.65.1 → 0.65.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/dist/index.mjs +12 -7
- package/package.json +7 -6
package/dist/index.mjs
CHANGED
|
@@ -101,6 +101,7 @@ async function transformIconString(uno, icon, color) {
|
|
|
101
101
|
collections: customCollections,
|
|
102
102
|
customizations = {},
|
|
103
103
|
autoInstall = false,
|
|
104
|
+
iconifyCollectionsNames,
|
|
104
105
|
collectionsNodeResolvePath,
|
|
105
106
|
unit
|
|
106
107
|
} = presetIcons.options;
|
|
@@ -131,7 +132,12 @@ async function transformIconString(uno, icon, color) {
|
|
|
131
132
|
for (const p of toArray(prefix)) {
|
|
132
133
|
if (icon.startsWith(p)) {
|
|
133
134
|
icon = icon.slice(p.length);
|
|
134
|
-
const parsed = await api.parseIconWithLoader(
|
|
135
|
+
const parsed = await api.parseIconWithLoader(
|
|
136
|
+
icon,
|
|
137
|
+
loader,
|
|
138
|
+
loaderOptions,
|
|
139
|
+
iconifyCollectionsNames
|
|
140
|
+
);
|
|
135
141
|
if (parsed)
|
|
136
142
|
return `url("data:image/svg+xml;utf8,${color ? api.encodeSvgForCss(parsed.svg).replace(/currentcolor/gi, color) : api.encodeSvgForCss(parsed.svg)}")`;
|
|
137
143
|
}
|
|
@@ -172,7 +178,7 @@ const screenRuleRE = /(@screen [^{]+)(.+)/g;
|
|
|
172
178
|
function handleScreen({ code, uno }, node) {
|
|
173
179
|
let breakpointName = "";
|
|
174
180
|
let prefix = "";
|
|
175
|
-
if (node.
|
|
181
|
+
if (node.prelude?.type === "Raw")
|
|
176
182
|
breakpointName = node.prelude.value.trim();
|
|
177
183
|
if (!breakpointName)
|
|
178
184
|
return;
|
|
@@ -197,8 +203,7 @@ function handleScreen({ code, uno }, node) {
|
|
|
197
203
|
return `@media (max-width: ${calcMaxWidthBySize(size)})`;
|
|
198
204
|
else if (prefix2 === "at")
|
|
199
205
|
return `@media (min-width: ${size})${variantEntries[idx + 1] ? ` and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})` : ""}`;
|
|
200
|
-
else
|
|
201
|
-
throw new Error(`breakpoint variant not supported: ${prefix2}`);
|
|
206
|
+
else throw new Error(`breakpoint variant not supported: ${prefix2}`);
|
|
202
207
|
}
|
|
203
208
|
return `@media (min-width: ${size})`;
|
|
204
209
|
};
|
|
@@ -258,11 +263,11 @@ async function transformDirectives(code, uno, options, filename, originalCode, o
|
|
|
258
263
|
offset
|
|
259
264
|
};
|
|
260
265
|
const processNode = async (node, _item, _list) => {
|
|
261
|
-
if (hasScreen && node.type === "Atrule")
|
|
266
|
+
if (hasScreen && node.type === "Atrule" && node.name === "screen")
|
|
262
267
|
handleScreen(ctx, node);
|
|
263
|
-
if (node.type === "Function")
|
|
268
|
+
else if (node.type === "Function")
|
|
264
269
|
await handleFunction(ctx, node);
|
|
265
|
-
if (hasApply && node.type === "Rule")
|
|
270
|
+
else if (hasApply && node.type === "Rule")
|
|
266
271
|
await handleApply(ctx, node);
|
|
267
272
|
};
|
|
268
273
|
walk(ast, (...args) => stack.push(processNode(...args)));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-directives",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.65.
|
|
4
|
+
"version": "0.65.3",
|
|
5
5
|
"description": "UnoCSS transformer for `@apply` directive",
|
|
6
6
|
"author": "hannoeru <me@hanlee.co>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"css-tree": "^3.0
|
|
36
|
-
"@unocss/core": "0.65.
|
|
37
|
-
"@unocss/rule-utils": "0.65.
|
|
35
|
+
"css-tree": "^3.1.0",
|
|
36
|
+
"@unocss/core": "0.65.3",
|
|
37
|
+
"@unocss/rule-utils": "0.65.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"magic-string": "^0.30.
|
|
40
|
+
"magic-string": "^0.30.17"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|
|
44
|
-
"stub": "unbuild --stub"
|
|
44
|
+
"stub": "unbuild --stub",
|
|
45
|
+
"test:attw": "attw --pack --config-path ../../.attw-esm-only.json"
|
|
45
46
|
}
|
|
46
47
|
}
|