@unocss/preset-icons 0.12.2 → 0.12.7
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.
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils.ts
|
|
2
2
|
var isNode = typeof process < "u" && typeof process.stdout < "u";
|
|
3
|
-
var warned = new Set();
|
|
4
|
-
function warnOnce(msg) {
|
|
5
|
-
if (warned.has(msg))
|
|
6
|
-
return;
|
|
7
|
-
console.warn(msg);
|
|
8
|
-
warned.add(msg);
|
|
9
|
-
}
|
|
10
3
|
function encodeSvg(svg) {
|
|
11
4
|
return svg.replace("<svg", ~svg.indexOf("xmlns") ? "<svg" : '<svg xmlns="http://www.w3.org/2000/svg"').replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/{/g, "%7B").replace(/}/g, "%7D").replace(/</g, "%3C").replace(/>/g, "%3E");
|
|
12
5
|
}
|
|
@@ -14,5 +7,4 @@ function encodeSvg(svg) {
|
|
|
14
7
|
|
|
15
8
|
|
|
16
9
|
|
|
17
|
-
|
|
18
|
-
exports.isNode = isNode; exports.warnOnce = warnOnce; exports.encodeSvg = encodeSvg;
|
|
10
|
+
exports.isNode = isNode; exports.encodeSvg = encodeSvg;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
// src/utils.ts
|
|
2
2
|
var isNode = typeof process < "u" && typeof process.stdout < "u";
|
|
3
|
-
var warned = new Set();
|
|
4
|
-
function warnOnce(msg) {
|
|
5
|
-
if (warned.has(msg))
|
|
6
|
-
return;
|
|
7
|
-
console.warn(msg);
|
|
8
|
-
warned.add(msg);
|
|
9
|
-
}
|
|
10
3
|
function encodeSvg(svg) {
|
|
11
4
|
return svg.replace("<svg", ~svg.indexOf("xmlns") ? "<svg" : '<svg xmlns="http://www.w3.org/2000/svg"').replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/{/g, "%7B").replace(/}/g, "%7D").replace(/</g, "%3C").replace(/>/g, "%3E");
|
|
12
5
|
}
|
|
13
6
|
|
|
14
7
|
export {
|
|
15
8
|
isNode,
|
|
16
|
-
warnOnce,
|
|
17
9
|
encodeSvg
|
|
18
10
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
var _chunkRYT3GRM7js = require('./chunk-RYT3GRM7.js');
|
|
4
|
+
var _chunkBS7EEF5Tjs = require('./chunk-BS7EEF5T.js');
|
|
6
5
|
|
|
7
6
|
// src/index.ts
|
|
7
|
+
var _core = require('@unocss/core');
|
|
8
8
|
var _build = require('@iconify/utils/lib/svg/build');
|
|
9
9
|
var _customisations = require('@iconify/utils/lib/customisations');
|
|
10
10
|
var _geticon = require('@iconify/utils/lib/icon-set/get-icon');
|
|
@@ -13,7 +13,7 @@ async function searchForIcon(collection, id, collections, scale) {
|
|
|
13
13
|
let iconSet = collections[collection];
|
|
14
14
|
if (typeof iconSet === "function")
|
|
15
15
|
iconSet = await iconSet();
|
|
16
|
-
if (!iconSet &&
|
|
16
|
+
if (!iconSet && _chunkBS7EEF5Tjs.isNode) {
|
|
17
17
|
const { loadCollectionFromFS } = await Promise.resolve().then(() => require("./fs.js"));
|
|
18
18
|
iconSet = await loadCollectionFromFS(collection);
|
|
19
19
|
}
|
|
@@ -65,13 +65,13 @@ var preset = ({
|
|
|
65
65
|
}
|
|
66
66
|
if (!svg) {
|
|
67
67
|
if (warn)
|
|
68
|
-
|
|
68
|
+
_core.warnOnce.call(void 0, `failed to load icon "${full}"`);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
let _mode = mode;
|
|
72
72
|
if (_mode === "auto")
|
|
73
73
|
_mode = svg.includes("currentColor") ? "mask" : "background-img";
|
|
74
|
-
const url = `url("data:image/svg+xml;utf8,${
|
|
74
|
+
const url = `url("data:image/svg+xml;utf8,${_chunkBS7EEF5Tjs.encodeSvg.call(void 0, svg)}")`;
|
|
75
75
|
if (_mode === "mask") {
|
|
76
76
|
return {
|
|
77
77
|
"--un-icon": url,
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeSvg,
|
|
3
|
-
isNode
|
|
4
|
-
|
|
5
|
-
} from "./chunk-USGLYGPO.mjs";
|
|
3
|
+
isNode
|
|
4
|
+
} from "./chunk-IMDMXLHC.mjs";
|
|
6
5
|
|
|
7
6
|
// src/index.ts
|
|
7
|
+
import { warnOnce } from "@unocss/core";
|
|
8
8
|
import { iconToSVG } from "@iconify/utils/lib/svg/build";
|
|
9
9
|
import { defaults as DefaultIconCustomizations } from "@iconify/utils/lib/customisations";
|
|
10
10
|
import { getIconData } from "@iconify/utils/lib/icon-set/get-icon";
|
|
@@ -65,7 +65,7 @@ var preset = ({
|
|
|
65
65
|
}
|
|
66
66
|
if (!svg) {
|
|
67
67
|
if (warn)
|
|
68
|
-
warnOnce(`
|
|
68
|
+
warnOnce(`failed to load icon "${full}"`);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
let _mode = mode;
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _chunkBS7EEF5Tjs = require('./chunk-BS7EEF5T.js');
|
|
4
5
|
|
|
5
|
-
var _chunkRYT3GRM7js = require('./chunk-RYT3GRM7.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.encodeSvg = _chunkRYT3GRM7js.encodeSvg; exports.isNode = _chunkRYT3GRM7js.isNode; exports.warnOnce = _chunkRYT3GRM7js.warnOnce;
|
|
8
|
+
exports.encodeSvg = _chunkBS7EEF5Tjs.encodeSvg; exports.isNode = _chunkBS7EEF5Tjs.isNode;
|
package/dist/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-icons",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.7",
|
|
4
4
|
"description": "Pure CSS Icons for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"require": "./dist/index.js",
|
|
28
|
-
"import": "./dist/index.mjs"
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"types": "./dist/index.d.ts"
|
|
29
30
|
},
|
|
30
31
|
"./fs": {
|
|
31
32
|
"require": "./dist/fs.js",
|
|
32
|
-
"import": "./dist/fs.mjs"
|
|
33
|
+
"import": "./dist/fs.mjs",
|
|
34
|
+
"types": "./dist/fs.d.ts"
|
|
33
35
|
}
|
|
34
36
|
},
|
|
35
37
|
"main": "dist/index.js",
|
|
@@ -40,12 +42,12 @@
|
|
|
40
42
|
"*.css"
|
|
41
43
|
],
|
|
42
44
|
"dependencies": {
|
|
43
|
-
"@iconify/utils": "^1.0.
|
|
44
|
-
"@unocss/core": "0.12.
|
|
45
|
+
"@iconify/utils": "^1.0.19",
|
|
46
|
+
"@unocss/core": "0.12.7",
|
|
45
47
|
"local-pkg": "^0.4.0"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
|
-
"@iconify/types": "^1.0.
|
|
50
|
+
"@iconify/types": "^1.0.12"
|
|
49
51
|
},
|
|
50
52
|
"scripts": {
|
|
51
53
|
"build": "tsup",
|