@unocss/preset-icons 0.31.9 → 0.31.13

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.cjs CHANGED
@@ -35,7 +35,8 @@ const preset = (options = {}) => {
35
35
  extraProperties = {},
36
36
  customizations = {},
37
37
  autoInstall = false,
38
- layer = "icons"
38
+ layer = "icons",
39
+ unit
39
40
  } = options;
40
41
  return {
41
42
  name: "@unocss/preset-icons",
@@ -60,7 +61,16 @@ const preset = (options = {}) => {
60
61
  customizations: {
61
62
  ...customizations,
62
63
  additionalProps: { ...extraProperties },
63
- trimCustomSvg: true
64
+ trimCustomSvg: true,
65
+ async iconCustomizer(collection2, icon, props) {
66
+ await customizations.iconCustomizer?.(collection2, icon, props);
67
+ if (unit) {
68
+ if (!props.width)
69
+ props.width = `${scale}${unit}`;
70
+ if (!props.height)
71
+ props.height = `${scale}${unit}`;
72
+ }
73
+ }
64
74
  },
65
75
  usedProps: {}
66
76
  };
package/dist/index.d.ts CHANGED
@@ -61,6 +61,12 @@ interface IconsOptions {
61
61
  * @default false
62
62
  */
63
63
  autoInstall?: boolean;
64
+ /**
65
+ * Custom icon unit.
66
+ *
67
+ * @default `em`
68
+ */
69
+ unit?: string;
64
70
  }
65
71
 
66
72
  declare const preset: (options?: IconsOptions) => Preset;
package/dist/index.mjs CHANGED
@@ -31,7 +31,8 @@ const preset = (options = {}) => {
31
31
  extraProperties = {},
32
32
  customizations = {},
33
33
  autoInstall = false,
34
- layer = "icons"
34
+ layer = "icons",
35
+ unit
35
36
  } = options;
36
37
  return {
37
38
  name: "@unocss/preset-icons",
@@ -56,7 +57,16 @@ const preset = (options = {}) => {
56
57
  customizations: {
57
58
  ...customizations,
58
59
  additionalProps: { ...extraProperties },
59
- trimCustomSvg: true
60
+ trimCustomSvg: true,
61
+ async iconCustomizer(collection2, icon, props) {
62
+ await customizations.iconCustomizer?.(collection2, icon, props);
63
+ if (unit) {
64
+ if (!props.width)
65
+ props.width = `${scale}${unit}`;
66
+ if (!props.height)
67
+ props.height = `${scale}${unit}`;
68
+ }
69
+ }
60
70
  },
61
71
  usedProps: {}
62
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-icons",
3
- "version": "0.31.9",
3
+ "version": "0.31.13",
4
4
  "description": "Pure CSS Icons for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -38,7 +38,7 @@
38
38
  "sideEffects": false,
39
39
  "dependencies": {
40
40
  "@iconify/utils": "^1.0.32",
41
- "@unocss/core": "0.31.9"
41
+ "@unocss/core": "0.31.13"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@iconify/types": "^1.1.0"