@iconify/tools 2.1.0 → 2.1.2

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.
Files changed (123) hide show
  1. package/lib/colors/attribs.d.ts +4 -4
  2. package/lib/colors/detect.cjs +68 -0
  3. package/lib/colors/detect.d.ts +15 -0
  4. package/lib/colors/detect.mjs +64 -0
  5. package/lib/colors/parse.cjs +31 -7
  6. package/lib/colors/parse.d.ts +5 -5
  7. package/lib/colors/parse.mjs +31 -7
  8. package/lib/colors/validate.cjs +9 -3
  9. package/lib/colors/validate.d.ts +1 -1
  10. package/lib/colors/validate.mjs +9 -3
  11. package/lib/css/parser/error.cjs +1 -1
  12. package/lib/css/parser/error.mjs +1 -1
  13. package/lib/css/parser/strings.cjs +10 -2
  14. package/lib/css/parser/strings.mjs +10 -2
  15. package/lib/css/parser/tokens.cjs +133 -109
  16. package/lib/css/parser/tokens.mjs +133 -109
  17. package/lib/css/parser/types.d.ts +4 -4
  18. package/lib/download/api/cache.cjs +28 -21
  19. package/lib/download/api/cache.mjs +28 -21
  20. package/lib/download/git/branch.cjs +1 -1
  21. package/lib/download/git/branch.mjs +1 -1
  22. package/lib/download/git/hash.cjs +1 -1
  23. package/lib/download/git/hash.mjs +1 -1
  24. package/lib/download/git/index.cjs +7 -4
  25. package/lib/download/git/index.mjs +7 -4
  26. package/lib/download/git/reset.cjs +1 -2
  27. package/lib/download/git/reset.mjs +1 -2
  28. package/lib/download/github/index.cjs +10 -7
  29. package/lib/download/github/index.mjs +10 -7
  30. package/lib/download/gitlab/hash.cjs +3 -1
  31. package/lib/download/gitlab/hash.mjs +3 -1
  32. package/lib/download/gitlab/index.cjs +9 -6
  33. package/lib/download/gitlab/index.mjs +9 -6
  34. package/lib/download/index.cjs +4 -3
  35. package/lib/download/index.d.ts +4 -4
  36. package/lib/download/index.mjs +4 -3
  37. package/lib/download/npm/index.cjs +12 -8
  38. package/lib/download/npm/index.mjs +12 -8
  39. package/lib/download/npm/version.cjs +4 -2
  40. package/lib/download/npm/version.mjs +4 -2
  41. package/lib/download/types/modified.d.ts +1 -1
  42. package/lib/download/types/sources.d.ts +1 -1
  43. package/lib/export/directory.d.ts +1 -1
  44. package/lib/export/helpers/types-version.cjs +3 -1
  45. package/lib/export/helpers/types-version.mjs +3 -1
  46. package/lib/export/icon-package.d.ts +1 -1
  47. package/lib/export/json-package.cjs +13 -3
  48. package/lib/export/json-package.d.ts +1 -1
  49. package/lib/export/json-package.mjs +13 -3
  50. package/lib/icon-set/index.cjs +20 -8
  51. package/lib/icon-set/index.d.ts +1 -1
  52. package/lib/icon-set/index.mjs +20 -8
  53. package/lib/icon-set/match.d.ts +1 -1
  54. package/lib/icon-set/merge.d.ts +1 -1
  55. package/lib/icon-set/modified.d.ts +1 -1
  56. package/lib/icon-set/props.d.ts +1 -1
  57. package/lib/icon-set/tags.cjs +97 -0
  58. package/lib/icon-set/tags.d.ts +22 -0
  59. package/lib/icon-set/tags.mjs +91 -0
  60. package/lib/icon-set/types.d.ts +8 -8
  61. package/lib/import/directory.cjs +4 -1
  62. package/lib/import/directory.d.ts +3 -3
  63. package/lib/import/directory.mjs +4 -1
  64. package/lib/import/figma/index.cjs +5 -2
  65. package/lib/import/figma/index.d.ts +1 -1
  66. package/lib/import/figma/index.mjs +5 -2
  67. package/lib/import/figma/nodes.cjs +6 -2
  68. package/lib/import/figma/nodes.d.ts +2 -2
  69. package/lib/import/figma/nodes.mjs +6 -2
  70. package/lib/import/figma/query.cjs +29 -15
  71. package/lib/import/figma/query.d.ts +1 -1
  72. package/lib/import/figma/query.mjs +29 -15
  73. package/lib/import/figma/types/api.d.ts +1 -1
  74. package/lib/import/figma/types/nodes.d.ts +6 -6
  75. package/lib/import/figma/types/options.d.ts +2 -2
  76. package/lib/import/figma/types/result.d.ts +1 -1
  77. package/lib/index.cjs +6 -3
  78. package/lib/index.d.ts +3 -1
  79. package/lib/index.mjs +4 -3
  80. package/lib/misc/cheerio.d.ts +2 -2
  81. package/lib/misc/compare-dirs.cjs +3 -1
  82. package/lib/misc/compare-dirs.mjs +3 -1
  83. package/lib/misc/exec.cjs +7 -8
  84. package/lib/misc/exec.mjs +7 -8
  85. package/lib/misc/keyword.cjs +4 -1
  86. package/lib/misc/keyword.mjs +4 -1
  87. package/lib/misc/scan.cjs +3 -1
  88. package/lib/misc/scan.d.ts +5 -5
  89. package/lib/misc/scan.mjs +3 -1
  90. package/lib/optimise/flags.cjs +9 -3
  91. package/lib/optimise/flags.d.ts +1 -1
  92. package/lib/optimise/flags.mjs +9 -3
  93. package/lib/optimise/global-style.cjs +10 -3
  94. package/lib/optimise/global-style.d.ts +1 -1
  95. package/lib/optimise/global-style.mjs +10 -3
  96. package/lib/optimise/scale.d.ts +1 -1
  97. package/lib/optimise/svgo.d.ts +2 -2
  98. package/lib/svg/analyse/types.d.ts +1 -1
  99. package/lib/svg/analyse.cjs +20 -6
  100. package/lib/svg/analyse.d.ts +1 -1
  101. package/lib/svg/analyse.mjs +20 -6
  102. package/lib/svg/cleanup/attribs.d.ts +1 -1
  103. package/lib/svg/cleanup/bad-tags.cjs +7 -2
  104. package/lib/svg/cleanup/bad-tags.d.ts +1 -1
  105. package/lib/svg/cleanup/bad-tags.mjs +7 -2
  106. package/lib/svg/cleanup/inline-style.cjs +12 -4
  107. package/lib/svg/cleanup/inline-style.d.ts +1 -1
  108. package/lib/svg/cleanup/inline-style.mjs +12 -4
  109. package/lib/svg/cleanup/root-style.d.ts +1 -1
  110. package/lib/svg/cleanup/root-svg.d.ts +1 -1
  111. package/lib/svg/cleanup/svgo-style.d.ts +1 -1
  112. package/lib/svg/cleanup.d.ts +1 -1
  113. package/lib/svg/data/attributes.cjs +0 -1
  114. package/lib/svg/data/attributes.mjs +0 -1
  115. package/lib/svg/index.cjs +12 -3
  116. package/lib/svg/index.d.ts +2 -2
  117. package/lib/svg/index.mjs +12 -3
  118. package/lib/svg/parse-style.cjs +13 -8
  119. package/lib/svg/parse-style.d.ts +4 -4
  120. package/lib/svg/parse-style.mjs +13 -8
  121. package/lib/svg/parse.d.ts +2 -2
  122. package/package.json +209 -100
  123. package/lib/types-6360d61e.d.ts +0 -261
@@ -15,7 +15,9 @@ const exportTypes = {
15
15
  metadata: "IconifyMetaData",
16
16
  chars: "IconifyChars"
17
17
  };
18
- const iconsKeys = ["aliases", "lastModified"].concat(Object.keys(defaults.defaultIconDimensions));
18
+ const iconsKeys = ["aliases", "lastModified"].concat(
19
+ Object.keys(defaults.defaultIconDimensions)
20
+ );
19
21
  const metadataKeys = [
20
22
  "categories",
21
23
  "themes",
@@ -111,7 +113,11 @@ async function exportJSONPackage(iconSet, options) {
111
113
  const mjsContent = mjsImports.concat([""], mjsConsts, [
112
114
  `export { ${mjsExports.join(", ")} };`
113
115
  ]);
114
- await fs.promises.writeFile(dir + "/index.mjs", mjsContent.join("\n") + "\n", "utf8");
116
+ await fs.promises.writeFile(
117
+ dir + "/index.mjs",
118
+ mjsContent.join("\n") + "\n",
119
+ "utf8"
120
+ );
115
121
  files.add("index.mjs");
116
122
  const usedTypes = Object.values(exportTypes);
117
123
  const typesData = [
@@ -120,7 +126,11 @@ async function exportJSONPackage(iconSet, options) {
120
126
  `export { ${usedTypes.join(", ")} };`,
121
127
  ""
122
128
  ].concat(dtsContent);
123
- await fs.promises.writeFile(dir + "/index.d.ts", typesData.join("\n") + "\n", "utf8");
129
+ await fs.promises.writeFile(
130
+ dir + "/index.d.ts",
131
+ typesData.join("\n") + "\n",
132
+ "utf8"
133
+ );
124
134
  files.add("index.d.ts");
125
135
  await export_helpers_customFiles.exportCustomFiles(dir, options, files);
126
136
  await misc_writeJson.writeJSONFile(dir + "/package.json", packageJSON);
@@ -1,7 +1,7 @@
1
1
  import { IconSet } from '../icon-set/index.js';
2
2
  import { ExportTargetOptions } from './helpers/prepare.js';
3
3
  import { ExportOptionsWithCustomFiles } from './helpers/custom-files.js';
4
- import '../types-6360d61e.js';
4
+ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../icon-set/types.js';
7
7
  import '../svg/index.js';
@@ -11,7 +11,9 @@ const exportTypes = {
11
11
  metadata: "IconifyMetaData",
12
12
  chars: "IconifyChars"
13
13
  };
14
- const iconsKeys = ["aliases", "lastModified"].concat(Object.keys(defaultIconDimensions));
14
+ const iconsKeys = ["aliases", "lastModified"].concat(
15
+ Object.keys(defaultIconDimensions)
16
+ );
15
17
  const metadataKeys = [
16
18
  "categories",
17
19
  "themes",
@@ -107,7 +109,11 @@ async function exportJSONPackage(iconSet, options) {
107
109
  const mjsContent = mjsImports.concat([""], mjsConsts, [
108
110
  `export { ${mjsExports.join(", ")} };`
109
111
  ]);
110
- await promises.writeFile(dir + "/index.mjs", mjsContent.join("\n") + "\n", "utf8");
112
+ await promises.writeFile(
113
+ dir + "/index.mjs",
114
+ mjsContent.join("\n") + "\n",
115
+ "utf8"
116
+ );
111
117
  files.add("index.mjs");
112
118
  const usedTypes = Object.values(exportTypes);
113
119
  const typesData = [
@@ -116,7 +122,11 @@ async function exportJSONPackage(iconSet, options) {
116
122
  `export { ${usedTypes.join(", ")} };`,
117
123
  ""
118
124
  ].concat(dtsContent);
119
- await promises.writeFile(dir + "/index.d.ts", typesData.join("\n") + "\n", "utf8");
125
+ await promises.writeFile(
126
+ dir + "/index.d.ts",
127
+ typesData.join("\n") + "\n",
128
+ "utf8"
129
+ );
120
130
  files.add("index.d.ts");
121
131
  await exportCustomFiles(dir, options, files);
122
132
  await writeJSONFile(dir + "/package.json", packageJSON);
@@ -14,7 +14,9 @@ require('cheerio');
14
14
 
15
15
  const themeKeys = ["prefixes", "suffixes"];
16
16
  function sortThemeKeys(keys) {
17
- return keys.sort((a, b) => a.length === b.length ? a.localeCompare(b) : b.length - a.length);
17
+ return keys.sort(
18
+ (a, b) => a.length === b.length ? a.localeCompare(b) : b.length - a.length
19
+ );
18
20
  }
19
21
  class IconSet {
20
22
  constructor(data) {
@@ -30,10 +32,14 @@ class IconSet {
30
32
  const entry = {
31
33
  type: "icon",
32
34
  body: item.body,
33
- props: iconSet_props.filterProps({
34
- ...defaultProps,
35
- ...item
36
- }, iconSet_props.defaultCommonProps, true),
35
+ props: iconSet_props.filterProps(
36
+ {
37
+ ...defaultProps,
38
+ ...item
39
+ },
40
+ iconSet_props.defaultCommonProps,
41
+ true
42
+ ),
37
43
  chars: /* @__PURE__ */ new Set(),
38
44
  categories: /* @__PURE__ */ new Set()
39
45
  };
@@ -205,7 +211,9 @@ class IconSet {
205
211
  return null;
206
212
  }
207
213
  const result = build.iconToSVG(item, customisations);
208
- const attributes = Object.keys(result.attributes).map((key) => ` ${key}="${result.attributes[key]}"`).join("");
214
+ const attributes = Object.keys(result.attributes).map(
215
+ (key) => ` ${key}="${result.attributes[key]}"`
216
+ ).join("");
209
217
  return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"${attributes}>${result.body}</svg>`;
210
218
  }
211
219
  toSVG(name) {
@@ -262,7 +270,9 @@ class IconSet {
262
270
  if (Object.keys(aliases).length) {
263
271
  result.aliases = aliases;
264
272
  }
265
- const chars = this.chars(Object.keys(icons).concat(Object.keys(aliases)));
273
+ const chars = this.chars(
274
+ Object.keys(icons).concat(Object.keys(aliases))
275
+ );
266
276
  if (Object.keys(chars).length) {
267
277
  result.chars = chars;
268
278
  }
@@ -342,7 +352,9 @@ class IconSet {
342
352
  }).length;
343
353
  }
344
354
  findCategory(title, add) {
345
- const categoryItem = Array.from(this.categories).find((item) => item.title === title);
355
+ const categoryItem = Array.from(this.categories).find(
356
+ (item) => item.title === title
357
+ );
346
358
  if (categoryItem) {
347
359
  return categoryItem;
348
360
  }
@@ -1,4 +1,4 @@
1
- import { a as IconifyInfo, b as IconifyJSON } from '../types-6360d61e.js';
1
+ import { IconifyInfo, IconifyJSON } from '@iconify/types';
2
2
  import { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
3
3
  import { IconSetIconEntry, IconCategory, IconSetIconType, IconSetAsyncForEachCallback, ResolvedIconifyIcon, CommonIconProps, CheckThemeResult } from './types.js';
4
4
  import { SVG } from '../svg/index.js';
@@ -10,7 +10,9 @@ import 'cheerio';
10
10
 
11
11
  const themeKeys = ["prefixes", "suffixes"];
12
12
  function sortThemeKeys(keys) {
13
- return keys.sort((a, b) => a.length === b.length ? a.localeCompare(b) : b.length - a.length);
13
+ return keys.sort(
14
+ (a, b) => a.length === b.length ? a.localeCompare(b) : b.length - a.length
15
+ );
14
16
  }
15
17
  class IconSet {
16
18
  constructor(data) {
@@ -26,10 +28,14 @@ class IconSet {
26
28
  const entry = {
27
29
  type: "icon",
28
30
  body: item.body,
29
- props: filterProps({
30
- ...defaultProps,
31
- ...item
32
- }, defaultCommonProps, true),
31
+ props: filterProps(
32
+ {
33
+ ...defaultProps,
34
+ ...item
35
+ },
36
+ defaultCommonProps,
37
+ true
38
+ ),
33
39
  chars: /* @__PURE__ */ new Set(),
34
40
  categories: /* @__PURE__ */ new Set()
35
41
  };
@@ -201,7 +207,9 @@ class IconSet {
201
207
  return null;
202
208
  }
203
209
  const result = iconToSVG(item, customisations);
204
- const attributes = Object.keys(result.attributes).map((key) => ` ${key}="${result.attributes[key]}"`).join("");
210
+ const attributes = Object.keys(result.attributes).map(
211
+ (key) => ` ${key}="${result.attributes[key]}"`
212
+ ).join("");
205
213
  return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"${attributes}>${result.body}</svg>`;
206
214
  }
207
215
  toSVG(name) {
@@ -258,7 +266,9 @@ class IconSet {
258
266
  if (Object.keys(aliases).length) {
259
267
  result.aliases = aliases;
260
268
  }
261
- const chars = this.chars(Object.keys(icons).concat(Object.keys(aliases)));
269
+ const chars = this.chars(
270
+ Object.keys(icons).concat(Object.keys(aliases))
271
+ );
262
272
  if (Object.keys(chars).length) {
263
273
  result.chars = chars;
264
274
  }
@@ -338,7 +348,9 @@ class IconSet {
338
348
  }).length;
339
349
  }
340
350
  findCategory(title, add) {
341
- const categoryItem = Array.from(this.categories).find((item) => item.title === title);
351
+ const categoryItem = Array.from(this.categories).find(
352
+ (item) => item.title === title
353
+ );
342
354
  if (categoryItem) {
343
355
  return categoryItem;
344
356
  }
@@ -1,6 +1,6 @@
1
1
  import { FullIconifyIcon } from '@iconify/utils/lib/icon/defaults';
2
2
  import { IconSet } from './index.js';
3
- import '../types-6360d61e.js';
3
+ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import './types.js';
6
6
  import '../svg/index.js';
@@ -1,5 +1,5 @@
1
1
  import { IconSet } from './index.js';
2
- import '../types-6360d61e.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
@@ -1,5 +1,5 @@
1
1
  import { IconSet } from './index.js';
2
- import '../types-6360d61e.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
@@ -1,5 +1,5 @@
1
1
  import { CommonIconProps } from './types.js';
2
- import '../types-6360d61e.js';
2
+ import '@iconify/types';
3
3
 
4
4
  /**
5
5
  * Common properties for icon and alias
@@ -0,0 +1,97 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const defaults = require('@iconify/utils/lib/icon/defaults');
6
+ const colors_detect = require('../colors/detect.cjs');
7
+ require('../colors/parse.cjs');
8
+ require('@iconify/utils/lib/colors');
9
+ require('../svg/data/tags.cjs');
10
+ require('../svg/parse-style.cjs');
11
+ require('../css/parse.cjs');
12
+ require('../css/parser/tokens.cjs');
13
+ require('../css/parser/error.cjs');
14
+ require('../css/parser/strings.cjs');
15
+ require('../css/parser/text.cjs');
16
+ require('../css/parser/export.cjs');
17
+ require('../css/parser/tree.cjs');
18
+ require('../svg/parse.cjs');
19
+ require('../colors/attribs.cjs');
20
+ require('../svg/data/attributes.cjs');
21
+ require('../svg/analyse.cjs');
22
+ require('../svg/analyse/error.cjs');
23
+
24
+ const paletteTags = {
25
+ monotone: "Monotone",
26
+ palette: "Has Colors"
27
+ };
28
+ const sizeTags = {
29
+ square: "Square",
30
+ gridPrefix: "Grid: ",
31
+ heightPrefix: "Height: "
32
+ };
33
+ async function addTagsToIconSet(iconSet, customTags) {
34
+ const info = iconSet.info;
35
+ const tags = [];
36
+ const iconNames = Object.keys(iconSet.entries).filter((key) => {
37
+ const item = iconSet.entries[key];
38
+ if (item.type !== "icon") {
39
+ return false;
40
+ }
41
+ if (item.props.hidden) {
42
+ return false;
43
+ }
44
+ return true;
45
+ });
46
+ if (iconNames.length) {
47
+ let hasPalette = info?.palette;
48
+ if (hasPalette === void 0) {
49
+ hasPalette = await colors_detect.detectIconSetPalette(iconSet);
50
+ }
51
+ if (hasPalette === true) {
52
+ tags.push(paletteTags.palette);
53
+ }
54
+ if (hasPalette === false) {
55
+ tags.push(paletteTags.monotone);
56
+ }
57
+ let isSquare = true;
58
+ let height;
59
+ for (let i = 0; i < iconNames.length; i++) {
60
+ const icon = iconSet.entries[iconNames[i]];
61
+ if (icon.type !== "icon") {
62
+ continue;
63
+ }
64
+ const iconProps = icon.props;
65
+ const iconWidth = iconProps.width || defaults.defaultIconDimensions.width;
66
+ const iconHeight = iconProps.height || defaults.defaultIconDimensions.height;
67
+ if (isSquare && iconWidth !== iconHeight) {
68
+ isSquare = false;
69
+ }
70
+ if (height === void 0) {
71
+ height = iconHeight;
72
+ } else if (height && iconHeight !== height) {
73
+ height = null;
74
+ }
75
+ if (!height && !isSquare) {
76
+ break;
77
+ }
78
+ }
79
+ if (height && Math.round(height) === height) {
80
+ tags.push(
81
+ (isSquare ? sizeTags.gridPrefix : sizeTags.heightPrefix) + height.toString()
82
+ );
83
+ }
84
+ if (isSquare) {
85
+ tags.push(sizeTags.square);
86
+ }
87
+ }
88
+ const result = tags.concat(customTags || []);
89
+ if (info) {
90
+ info.tags = result;
91
+ }
92
+ return result;
93
+ }
94
+
95
+ exports.addTagsToIconSet = addTagsToIconSet;
96
+ exports.paletteTags = paletteTags;
97
+ exports.sizeTags = sizeTags;
@@ -0,0 +1,22 @@
1
+ import { IconSet } from './index.js';
2
+ import '@iconify/types';
3
+ import '@iconify/utils/lib/customisations/defaults';
4
+ import './types.js';
5
+ import '../svg/index.js';
6
+ import '@iconify/utils/lib/icon-set/tree';
7
+
8
+ declare const paletteTags: {
9
+ monotone: string;
10
+ palette: string;
11
+ };
12
+ declare const sizeTags: {
13
+ square: string;
14
+ gridPrefix: string;
15
+ heightPrefix: string;
16
+ };
17
+ /**
18
+ * Add tags to icon set
19
+ */
20
+ declare function addTagsToIconSet(iconSet: IconSet, customTags?: string[]): Promise<string[]>;
21
+
22
+ export { addTagsToIconSet, paletteTags, sizeTags };
@@ -0,0 +1,91 @@
1
+ import { defaultIconDimensions } from '@iconify/utils/lib/icon/defaults';
2
+ import { detectIconSetPalette } from '../colors/detect.mjs';
3
+ import '../colors/parse.mjs';
4
+ import '@iconify/utils/lib/colors';
5
+ import '../svg/data/tags.mjs';
6
+ import '../svg/parse-style.mjs';
7
+ import '../css/parse.mjs';
8
+ import '../css/parser/tokens.mjs';
9
+ import '../css/parser/error.mjs';
10
+ import '../css/parser/strings.mjs';
11
+ import '../css/parser/text.mjs';
12
+ import '../css/parser/export.mjs';
13
+ import '../css/parser/tree.mjs';
14
+ import '../svg/parse.mjs';
15
+ import '../colors/attribs.mjs';
16
+ import '../svg/data/attributes.mjs';
17
+ import '../svg/analyse.mjs';
18
+ import '../svg/analyse/error.mjs';
19
+
20
+ const paletteTags = {
21
+ monotone: "Monotone",
22
+ palette: "Has Colors"
23
+ };
24
+ const sizeTags = {
25
+ square: "Square",
26
+ gridPrefix: "Grid: ",
27
+ heightPrefix: "Height: "
28
+ };
29
+ async function addTagsToIconSet(iconSet, customTags) {
30
+ const info = iconSet.info;
31
+ const tags = [];
32
+ const iconNames = Object.keys(iconSet.entries).filter((key) => {
33
+ const item = iconSet.entries[key];
34
+ if (item.type !== "icon") {
35
+ return false;
36
+ }
37
+ if (item.props.hidden) {
38
+ return false;
39
+ }
40
+ return true;
41
+ });
42
+ if (iconNames.length) {
43
+ let hasPalette = info?.palette;
44
+ if (hasPalette === void 0) {
45
+ hasPalette = await detectIconSetPalette(iconSet);
46
+ }
47
+ if (hasPalette === true) {
48
+ tags.push(paletteTags.palette);
49
+ }
50
+ if (hasPalette === false) {
51
+ tags.push(paletteTags.monotone);
52
+ }
53
+ let isSquare = true;
54
+ let height;
55
+ for (let i = 0; i < iconNames.length; i++) {
56
+ const icon = iconSet.entries[iconNames[i]];
57
+ if (icon.type !== "icon") {
58
+ continue;
59
+ }
60
+ const iconProps = icon.props;
61
+ const iconWidth = iconProps.width || defaultIconDimensions.width;
62
+ const iconHeight = iconProps.height || defaultIconDimensions.height;
63
+ if (isSquare && iconWidth !== iconHeight) {
64
+ isSquare = false;
65
+ }
66
+ if (height === void 0) {
67
+ height = iconHeight;
68
+ } else if (height && iconHeight !== height) {
69
+ height = null;
70
+ }
71
+ if (!height && !isSquare) {
72
+ break;
73
+ }
74
+ }
75
+ if (height && Math.round(height) === height) {
76
+ tags.push(
77
+ (isSquare ? sizeTags.gridPrefix : sizeTags.heightPrefix) + height.toString()
78
+ );
79
+ }
80
+ if (isSquare) {
81
+ tags.push(sizeTags.square);
82
+ }
83
+ }
84
+ const result = tags.concat(customTags || []);
85
+ if (info) {
86
+ info.tags = result;
87
+ }
88
+ return result;
89
+ }
90
+
91
+ export { addTagsToIconSet, paletteTags, sizeTags };
@@ -1,4 +1,4 @@
1
- import { E as ExtendedIconifyIcon, c as ExtendedIconifyAlias, d as IconifyOptional, I as IconifyIcon } from '../types-6360d61e.js';
1
+ import { ExtendedIconifyIcon, ExtendedIconifyAlias, IconifyOptional, IconifyIcon } from '@iconify/types';
2
2
 
3
3
  /**
4
4
  * Category item
@@ -10,14 +10,14 @@ interface IconCategory {
10
10
  /**
11
11
  * Get common properties: IconifyOptional + APIIconAttributes
12
12
  */
13
- declare type CommonProps<A, B> = {
13
+ type CommonProps<A, B> = {
14
14
  [K in keyof A & keyof B]?: A[K] extends B[K] ? A[K] : never;
15
15
  };
16
- declare type CommonIconProps = CommonProps<ExtendedIconifyIcon, ExtendedIconifyAlias>;
16
+ type CommonIconProps = CommonProps<ExtendedIconifyIcon, ExtendedIconifyAlias>;
17
17
  /**
18
18
  * Exclude IconifyOptional from CommonIconProps
19
19
  */
20
- declare type ExtraIconProps = Omit<CommonIconProps, keyof IconifyOptional>;
20
+ type ExtraIconProps = Omit<CommonIconProps, keyof IconifyOptional>;
21
21
  /**
22
22
  * Partials
23
23
  */
@@ -49,8 +49,8 @@ interface IconSetIconVariation extends IconWithPropsData, IconParentData {
49
49
  /**
50
50
  * All icon types
51
51
  */
52
- declare type IconSetIconEntry = IconSetIcon | IconSetIconAlias | IconSetIconVariation;
53
- declare type IconSetIconType = IconSetIconEntry['type'];
52
+ type IconSetIconEntry = IconSetIcon | IconSetIconAlias | IconSetIconVariation;
53
+ type IconSetIconType = IconSetIconEntry['type'];
54
54
  /**
55
55
  * Full icon with extra stuff
56
56
  */
@@ -68,7 +68,7 @@ interface CheckThemeResult {
68
68
  *
69
69
  * Return false to stop loop
70
70
  */
71
- declare type IconSetAsyncForEachCallbackResult = void | false;
72
- declare type IconSetAsyncForEachCallback = (name: string, type: IconSetIconEntry['type']) => Promise<IconSetAsyncForEachCallbackResult> | IconSetAsyncForEachCallbackResult;
71
+ type IconSetAsyncForEachCallbackResult = void | false;
72
+ type IconSetAsyncForEachCallback = (name: string, type: IconSetIconEntry['type']) => Promise<IconSetAsyncForEachCallbackResult> | IconSetAsyncForEachCallbackResult;
73
73
 
74
74
  export { CheckThemeResult, CommonIconProps, ExtraIconProps, IconCategory, IconParentData, IconSetAsyncForEachCallback, IconSetIcon, IconSetIconAlias, IconSetIconEntry, IconSetIconType, IconSetIconVariation, IconWithCategories, IconWithChars, IconWithPropsData, ResolvedIconifyIcon };
@@ -61,7 +61,10 @@ async function importDirectory(path, options = {}) {
61
61
  continue;
62
62
  }
63
63
  try {
64
- const content = await fs.promises.readFile(file.path + file.subdir + file.file + file.ext, "utf8");
64
+ const content = await fs.promises.readFile(
65
+ file.path + file.subdir + file.file + file.ext,
66
+ "utf8"
67
+ );
65
68
  const svg = new svg_index.SVG(content);
66
69
  await svg_cleanup.cleanupSVG(svg);
67
70
  iconSet.fromSVG(keyword, svg);
@@ -1,5 +1,5 @@
1
1
  import { IconSet } from '../icon-set/index.js';
2
- import '../types-6360d61e.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import '../icon-set/types.js';
5
5
  import '../svg/index.js';
@@ -23,8 +23,8 @@ interface ImportDirectoryFileEntry {
23
23
  *
24
24
  * Callback can be asynchronous
25
25
  */
26
- declare type ImportDirectoryKeywordCallbackResult = string | undefined;
27
- declare type ImportDirectoryKeywordCallback = (file: ImportDirectoryFileEntry, defaultKeyword: string, iconSet: IconSet) => ImportDirectoryKeywordCallbackResult | Promise<ImportDirectoryKeywordCallbackResult>;
26
+ type ImportDirectoryKeywordCallbackResult = string | undefined;
27
+ type ImportDirectoryKeywordCallback = (file: ImportDirectoryFileEntry, defaultKeyword: string, iconSet: IconSet) => ImportDirectoryKeywordCallbackResult | Promise<ImportDirectoryKeywordCallbackResult>;
28
28
  /**
29
29
  * Options
30
30
  */
@@ -57,7 +57,10 @@ async function importDirectory(path, options = {}) {
57
57
  continue;
58
58
  }
59
59
  try {
60
- const content = await promises.readFile(file.path + file.subdir + file.file + file.ext, "utf8");
60
+ const content = await promises.readFile(
61
+ file.path + file.subdir + file.file + file.ext,
62
+ "utf8"
63
+ );
61
64
  const svg = new SVG(content);
62
65
  await cleanupSVG(svg);
63
66
  iconSet.fromSVG(keyword, svg);
@@ -50,12 +50,15 @@ async function importFromFigma(options) {
50
50
  ttl: options.cacheSVGTTL || 60 * 60 * 24 * 30,
51
51
  dir: options.cacheDir
52
52
  } : void 0;
53
- const document = await import_figma_query.figmaFilesQuery(options, cacheOptions);
53
+ const document = await import_figma_query.figmaFilesQuery(
54
+ options,
55
+ cacheOptions
56
+ );
54
57
  if (document === "not_modified") {
55
58
  return document;
56
59
  }
57
60
  options.version = document.version;
58
- const nodes = await import_figma_nodes.getFigmaIconNodes(document, options);
61
+ const nodes = import_figma_nodes.getFigmaIconNodes(document, options);
59
62
  await import_figma_query.figmaImagesQuery(options, nodes, cacheOptions);
60
63
  await import_figma_query.figmaDownloadImages(nodes, cacheSVGOptions);
61
64
  const iconSet = iconSet_index.blankIconSet(options.prefix);
@@ -2,7 +2,7 @@ import { DocumentNotModified } from '../../download/types/modified.js';
2
2
  import { FigmaIfModifiedSinceOption, FigmaImportOptions } from './types/options.js';
3
3
  import { FigmaImportResult } from './types/result.js';
4
4
  import '../../icon-set/index.js';
5
- import '../../types-6360d61e.js';
5
+ import '@iconify/types';
6
6
  import '@iconify/utils/lib/customisations/defaults';
7
7
  import '../../icon-set/types.js';
8
8
  import '../../svg/index.js';
@@ -46,12 +46,15 @@ async function importFromFigma(options) {
46
46
  ttl: options.cacheSVGTTL || 60 * 60 * 24 * 30,
47
47
  dir: options.cacheDir
48
48
  } : void 0;
49
- const document = await figmaFilesQuery(options, cacheOptions);
49
+ const document = await figmaFilesQuery(
50
+ options,
51
+ cacheOptions
52
+ );
50
53
  if (document === "not_modified") {
51
54
  return document;
52
55
  }
53
56
  options.version = document.version;
54
- const nodes = await getFigmaIconNodes(document, options);
57
+ const nodes = getFigmaIconNodes(document, options);
55
58
  await figmaImagesQuery(options, nodes, cacheOptions);
56
59
  await figmaDownloadImages(nodes, cacheSVGOptions);
57
60
  const iconSet = blankIconSet(options.prefix);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- async function getFigmaIconNodes(document, options) {
5
+ function getFigmaIconNodes(document, options) {
6
6
  const nodes = {
7
7
  icons: /* @__PURE__ */ Object.create(null)
8
8
  };
@@ -23,7 +23,11 @@ async function getFigmaIconNodes(document, options) {
23
23
  height: box.height,
24
24
  parents
25
25
  };
26
- const keyword = options.iconNameForNode(item, nodes, document);
26
+ const keyword = options.iconNameForNode(
27
+ item,
28
+ nodes,
29
+ document
30
+ );
27
31
  if (typeof keyword === "string") {
28
32
  found++;
29
33
  nodes.icons[node.id] = {
@@ -2,7 +2,7 @@ import { FigmaDocument } from './types/api.js';
2
2
  import { FigmaGetIconNodesOptions } from './types/options.js';
3
3
  import { FigmaNodesImportResult } from './types/result.js';
4
4
  import '../../icon-set/index.js';
5
- import '../../types-6360d61e.js';
5
+ import '@iconify/types';
6
6
  import '@iconify/utils/lib/customisations/defaults';
7
7
  import '../../icon-set/types.js';
8
8
  import '../../svg/index.js';
@@ -12,6 +12,6 @@ import './types/nodes.js';
12
12
  /**
13
13
  * Get node ids for icons
14
14
  */
15
- declare function getFigmaIconNodes(document: FigmaDocument, options: FigmaGetIconNodesOptions): Promise<FigmaNodesImportResult>;
15
+ declare function getFigmaIconNodes(document: FigmaDocument, options: FigmaGetIconNodesOptions): FigmaNodesImportResult;
16
16
 
17
17
  export { getFigmaIconNodes };
@@ -1,4 +1,4 @@
1
- async function getFigmaIconNodes(document, options) {
1
+ function getFigmaIconNodes(document, options) {
2
2
  const nodes = {
3
3
  icons: /* @__PURE__ */ Object.create(null)
4
4
  };
@@ -19,7 +19,11 @@ async function getFigmaIconNodes(document, options) {
19
19
  height: box.height,
20
20
  parents
21
21
  };
22
- const keyword = options.iconNameForNode(item, nodes, document);
22
+ const keyword = options.iconNameForNode(
23
+ item,
24
+ nodes,
25
+ document
26
+ );
23
27
  if (typeof keyword === "string") {
24
28
  found++;
25
29
  nodes.icons[node.id] = {