@unocss/preset-icons 0.59.4 → 0.60.1
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/browser.mjs +3 -3
- package/dist/core.d.mts +12 -2
- package/dist/core.d.ts +12 -2
- package/dist/core.mjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/shared/{preset-icons.DTqACBfB.mjs → preset-icons.DyXwassn.mjs} +9 -4
- package/dist/shared/{preset-icons.birF1UOh.mjs → preset-icons.wPy4hnwF.mjs} +1 -1
- package/package.json +2 -2
package/dist/browser.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createCDNLoader } from './shared/preset-icons.
|
|
2
|
-
import { c as createPresetIcons, b as createCDNFetchLoader, l as loadIcon } from './shared/preset-icons.
|
|
3
|
-
export { a as combineLoaders, g as getEnvFlags, i as icons } from './shared/preset-icons.
|
|
1
|
+
import { c as createCDNLoader } from './shared/preset-icons.wPy4hnwF.mjs';
|
|
2
|
+
import { c as createPresetIcons, b as createCDNFetchLoader, l as loadIcon } from './shared/preset-icons.DyXwassn.mjs';
|
|
3
|
+
export { a as combineLoaders, g as getEnvFlags, i as icons } from './shared/preset-icons.DyXwassn.mjs';
|
|
4
4
|
import 'ofetch';
|
|
5
5
|
import '@unocss/core';
|
|
6
6
|
|
package/dist/core.d.mts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
|
-
import { Awaitable } from '@unocss/core';
|
|
2
|
+
import { Awaitable, CSSObject } from '@unocss/core';
|
|
3
3
|
import { CustomIconLoader, InlineCollection, IconCustomizations, UniversalIconLoader } from '@iconify/utils/lib/loader/types';
|
|
4
4
|
import { IconifyJSON } from '@iconify/types';
|
|
5
5
|
|
|
6
|
+
interface IconMeta {
|
|
7
|
+
collection: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
svg: string;
|
|
10
|
+
mode?: IconsOptions['mode'];
|
|
11
|
+
}
|
|
6
12
|
interface IconsOptions {
|
|
7
13
|
/**
|
|
8
14
|
* Scale related to the current font size (1em).
|
|
@@ -20,7 +26,7 @@ interface IconsOptions {
|
|
|
20
26
|
* @default 'auto'
|
|
21
27
|
* @see https://antfu.me/posts/icons-in-pure-css
|
|
22
28
|
*/
|
|
23
|
-
mode?: 'mask' | '
|
|
29
|
+
mode?: 'mask' | 'bg' | 'auto';
|
|
24
30
|
/**
|
|
25
31
|
* Class prefix for matching icon rules.
|
|
26
32
|
*
|
|
@@ -86,6 +92,10 @@ interface IconsOptions {
|
|
|
86
92
|
* Custom fetch function to provide the icon data.
|
|
87
93
|
*/
|
|
88
94
|
customFetch?: (url: string) => Promise<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Processor for the CSS object before stringify
|
|
97
|
+
*/
|
|
98
|
+
processor?: (cssObject: CSSObject, meta: Required<IconMeta>) => void;
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
function getDefaultExportFromCjs (x) {
|
package/dist/core.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
|
-
import { Awaitable } from '@unocss/core';
|
|
2
|
+
import { Awaitable, CSSObject } from '@unocss/core';
|
|
3
3
|
import { CustomIconLoader, InlineCollection, IconCustomizations, UniversalIconLoader } from '@iconify/utils/lib/loader/types';
|
|
4
4
|
import { IconifyJSON } from '@iconify/types';
|
|
5
5
|
|
|
6
|
+
interface IconMeta {
|
|
7
|
+
collection: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
svg: string;
|
|
10
|
+
mode?: IconsOptions['mode'];
|
|
11
|
+
}
|
|
6
12
|
interface IconsOptions {
|
|
7
13
|
/**
|
|
8
14
|
* Scale related to the current font size (1em).
|
|
@@ -20,7 +26,7 @@ interface IconsOptions {
|
|
|
20
26
|
* @default 'auto'
|
|
21
27
|
* @see https://antfu.me/posts/icons-in-pure-css
|
|
22
28
|
*/
|
|
23
|
-
mode?: 'mask' | '
|
|
29
|
+
mode?: 'mask' | 'bg' | 'auto';
|
|
24
30
|
/**
|
|
25
31
|
* Class prefix for matching icon rules.
|
|
26
32
|
*
|
|
@@ -86,6 +92,10 @@ interface IconsOptions {
|
|
|
86
92
|
* Custom fetch function to provide the icon data.
|
|
87
93
|
*/
|
|
88
94
|
customFetch?: (url: string) => Promise<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Processor for the CSS object before stringify
|
|
97
|
+
*/
|
|
98
|
+
processor?: (cssObject: CSSObject, meta: Required<IconMeta>) => void;
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
function getDefaultExportFromCjs (x) {
|
package/dist/core.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@unocss/core';
|
|
2
|
-
export { a as combineLoaders, b as createCDNFetchLoader, c as createPresetIcons, g as getEnvFlags, i as icons } from './shared/preset-icons.
|
|
2
|
+
export { a as combineLoaders, b as createCDNFetchLoader, c as createPresetIcons, g as getEnvFlags, i as icons } from './shared/preset-icons.DyXwassn.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as createCDNLoader } from './shared/preset-icons.
|
|
2
|
-
import { c as createPresetIcons, g as getEnvFlags, a as combineLoaders, l as loadIcon } from './shared/preset-icons.
|
|
3
|
-
export { b as createCDNFetchLoader, i as icons } from './shared/preset-icons.
|
|
1
|
+
import { c as createCDNLoader } from './shared/preset-icons.wPy4hnwF.mjs';
|
|
2
|
+
import { c as createPresetIcons, g as getEnvFlags, a as combineLoaders, l as loadIcon } from './shared/preset-icons.DyXwassn.mjs';
|
|
3
|
+
export { b as createCDNFetchLoader, i as icons } from './shared/preset-icons.DyXwassn.mjs';
|
|
4
4
|
import 'ofetch';
|
|
5
5
|
import '@unocss/core';
|
|
6
6
|
|
|
@@ -721,7 +721,8 @@ function createPresetIcons(lookupIconLoader) {
|
|
|
721
721
|
autoInstall = false,
|
|
722
722
|
collectionsNodeResolvePath,
|
|
723
723
|
layer = "icons",
|
|
724
|
-
unit
|
|
724
|
+
unit,
|
|
725
|
+
processor
|
|
725
726
|
} = options;
|
|
726
727
|
const flags = getEnvFlags();
|
|
727
728
|
const loaderOptions = {
|
|
@@ -755,7 +756,8 @@ function createPresetIcons(lookupIconLoader) {
|
|
|
755
756
|
layers: { icons: -30 },
|
|
756
757
|
rules: [[
|
|
757
758
|
/^([a-z0-9:_-]+)(?:\?(mask|bg|auto))?$/,
|
|
758
|
-
async (
|
|
759
|
+
async (matcher) => {
|
|
760
|
+
let [full, body, _mode = mode] = matcher;
|
|
759
761
|
let collection = "";
|
|
760
762
|
let name = "";
|
|
761
763
|
let svg;
|
|
@@ -779,11 +781,12 @@ function createPresetIcons(lookupIconLoader) {
|
|
|
779
781
|
warnOnce(`failed to load icon "${full}"`);
|
|
780
782
|
return;
|
|
781
783
|
}
|
|
784
|
+
let cssObject;
|
|
782
785
|
const url = `url("data:image/svg+xml;utf8,${encodeSvgForCss(svg)}")`;
|
|
783
786
|
if (_mode === "auto")
|
|
784
787
|
_mode = svg.includes("currentColor") ? "mask" : "bg";
|
|
785
788
|
if (_mode === "mask") {
|
|
786
|
-
|
|
789
|
+
cssObject = {
|
|
787
790
|
"--un-icon": url,
|
|
788
791
|
"-webkit-mask": "var(--un-icon) no-repeat",
|
|
789
792
|
"mask": "var(--un-icon) no-repeat",
|
|
@@ -795,13 +798,15 @@ function createPresetIcons(lookupIconLoader) {
|
|
|
795
798
|
...usedProps
|
|
796
799
|
};
|
|
797
800
|
} else {
|
|
798
|
-
|
|
801
|
+
cssObject = {
|
|
799
802
|
"background": `${url} no-repeat`,
|
|
800
803
|
"background-size": "100% 100%",
|
|
801
804
|
"background-color": "transparent",
|
|
802
805
|
...usedProps
|
|
803
806
|
};
|
|
804
807
|
}
|
|
808
|
+
processor?.(cssObject, { collection, icon: name, svg, mode: _mode });
|
|
809
|
+
return cssObject;
|
|
805
810
|
},
|
|
806
811
|
{ layer, prefix }
|
|
807
812
|
]]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $fetch } from 'ofetch';
|
|
2
|
-
import { b as createCDNFetchLoader } from './preset-icons.
|
|
2
|
+
import { b as createCDNFetchLoader } from './preset-icons.DyXwassn.mjs';
|
|
3
3
|
|
|
4
4
|
function createCDNLoader(cdnBase) {
|
|
5
5
|
return createCDNFetchLoader($fetch, cdnBase);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-icons",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.60.1",
|
|
5
5
|
"description": "Pure CSS Icons for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@iconify/utils": "^2.1.23",
|
|
57
57
|
"ofetch": "^1.3.4",
|
|
58
|
-
"@unocss/core": "0.
|
|
58
|
+
"@unocss/core": "0.60.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@iconify/types": "^2.0.0"
|