@iconify/tools 2.1.0-beta.7 → 2.1.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.
Files changed (115) hide show
  1. package/lib/colors/attribs.d.ts +2 -0
  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 +1 -1
  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/download/api/cache.cjs +28 -21
  18. package/lib/download/api/cache.mjs +28 -21
  19. package/lib/download/git/branch.cjs +1 -1
  20. package/lib/download/git/branch.mjs +1 -1
  21. package/lib/download/git/hash.cjs +1 -1
  22. package/lib/download/git/hash.mjs +1 -1
  23. package/lib/download/git/index.cjs +7 -4
  24. package/lib/download/git/index.mjs +7 -4
  25. package/lib/download/git/reset.cjs +1 -2
  26. package/lib/download/git/reset.mjs +1 -2
  27. package/lib/download/github/index.cjs +10 -7
  28. package/lib/download/github/index.mjs +10 -7
  29. package/lib/download/gitlab/hash.cjs +3 -1
  30. package/lib/download/gitlab/hash.mjs +3 -1
  31. package/lib/download/gitlab/index.cjs +9 -6
  32. package/lib/download/gitlab/index.mjs +9 -6
  33. package/lib/download/index.cjs +4 -3
  34. package/lib/download/index.mjs +4 -3
  35. package/lib/download/npm/index.cjs +12 -8
  36. package/lib/download/npm/index.mjs +12 -8
  37. package/lib/download/npm/version.cjs +4 -2
  38. package/lib/download/npm/version.mjs +4 -2
  39. package/lib/export/directory.d.ts +1 -1
  40. package/lib/export/helpers/types-version.cjs +3 -1
  41. package/lib/export/helpers/types-version.mjs +3 -1
  42. package/lib/export/icon-package.d.ts +1 -1
  43. package/lib/export/json-package.cjs +13 -3
  44. package/lib/export/json-package.d.ts +1 -1
  45. package/lib/export/json-package.mjs +13 -3
  46. package/lib/icon-set/index.cjs +20 -8
  47. package/lib/icon-set/index.d.ts +1 -1
  48. package/lib/icon-set/index.mjs +20 -8
  49. package/lib/icon-set/match.d.ts +1 -1
  50. package/lib/icon-set/merge.d.ts +1 -1
  51. package/lib/icon-set/modified.d.ts +1 -1
  52. package/lib/icon-set/props.d.ts +1 -1
  53. package/lib/icon-set/tags.cjs +97 -0
  54. package/lib/icon-set/tags.d.ts +22 -0
  55. package/lib/icon-set/tags.mjs +91 -0
  56. package/lib/icon-set/types.d.ts +1 -1
  57. package/lib/import/directory.cjs +4 -1
  58. package/lib/import/directory.d.ts +1 -1
  59. package/lib/import/directory.mjs +4 -1
  60. package/lib/import/figma/index.cjs +5 -2
  61. package/lib/import/figma/index.d.ts +1 -1
  62. package/lib/import/figma/index.mjs +5 -2
  63. package/lib/import/figma/nodes.cjs +6 -2
  64. package/lib/import/figma/nodes.d.ts +2 -2
  65. package/lib/import/figma/nodes.mjs +6 -2
  66. package/lib/import/figma/query.cjs +29 -15
  67. package/lib/import/figma/query.d.ts +1 -1
  68. package/lib/import/figma/query.mjs +29 -15
  69. package/lib/import/figma/types/nodes.d.ts +1 -1
  70. package/lib/import/figma/types/options.d.ts +1 -1
  71. package/lib/import/figma/types/result.d.ts +1 -1
  72. package/lib/index.cjs +6 -3
  73. package/lib/index.d.ts +3 -1
  74. package/lib/index.mjs +4 -3
  75. package/lib/misc/compare-dirs.cjs +3 -1
  76. package/lib/misc/compare-dirs.mjs +3 -1
  77. package/lib/misc/exec.cjs +7 -8
  78. package/lib/misc/exec.mjs +7 -8
  79. package/lib/misc/keyword.cjs +4 -1
  80. package/lib/misc/keyword.mjs +4 -1
  81. package/lib/misc/scan.cjs +3 -1
  82. package/lib/misc/scan.mjs +3 -1
  83. package/lib/optimise/flags.cjs +9 -3
  84. package/lib/optimise/flags.d.ts +1 -1
  85. package/lib/optimise/flags.mjs +9 -3
  86. package/lib/optimise/global-style.cjs +10 -3
  87. package/lib/optimise/global-style.d.ts +1 -1
  88. package/lib/optimise/global-style.mjs +10 -3
  89. package/lib/optimise/scale.d.ts +1 -1
  90. package/lib/optimise/svgo.d.ts +1 -1
  91. package/lib/svg/analyse.cjs +20 -6
  92. package/lib/svg/analyse.d.ts +1 -1
  93. package/lib/svg/analyse.mjs +20 -6
  94. package/lib/svg/cleanup/attribs.d.ts +1 -1
  95. package/lib/svg/cleanup/bad-tags.cjs +7 -2
  96. package/lib/svg/cleanup/bad-tags.d.ts +1 -1
  97. package/lib/svg/cleanup/bad-tags.mjs +7 -2
  98. package/lib/svg/cleanup/inline-style.cjs +12 -4
  99. package/lib/svg/cleanup/inline-style.d.ts +1 -1
  100. package/lib/svg/cleanup/inline-style.mjs +12 -4
  101. package/lib/svg/cleanup/root-style.d.ts +1 -1
  102. package/lib/svg/cleanup/root-svg.d.ts +1 -1
  103. package/lib/svg/cleanup/svgo-style.d.ts +1 -1
  104. package/lib/svg/cleanup.d.ts +1 -1
  105. package/lib/svg/data/attributes.cjs +0 -1
  106. package/lib/svg/data/attributes.mjs +0 -1
  107. package/lib/svg/index.cjs +12 -3
  108. package/lib/svg/index.d.ts +2 -2
  109. package/lib/svg/index.mjs +12 -3
  110. package/lib/svg/parse-style.cjs +13 -8
  111. package/lib/svg/parse-style.d.ts +1 -1
  112. package/lib/svg/parse-style.mjs +13 -8
  113. package/lib/svg/parse.d.ts +1 -1
  114. package/package.json +24 -9
  115. package/lib/types-f0980297.d.ts +0 -258
@@ -24,9 +24,13 @@ async function cleanupInlineStyle(svg) {
24
24
  const newStyle = /* @__PURE__ */ Object.create(null);
25
25
  const checkRule = (prop, value) => {
26
26
  function warn() {
27
- console.warn(`Removing unexpected style on "${tagName}": ${prop}`);
27
+ console.warn(
28
+ `Removing unexpected style on "${tagName}": ${prop}`
29
+ );
28
30
  }
29
- if (svg_data_attributes.badAttributes.has(prop) || svg_data_attributes.tagSpecificNonPresentationalAttributes[tagName]?.has(prop)) {
31
+ if (svg_data_attributes.badAttributes.has(prop) || svg_data_attributes.tagSpecificNonPresentationalAttributes[tagName]?.has(
32
+ prop
33
+ )) {
30
34
  return;
31
35
  }
32
36
  if (svg_data_attributes.tagSpecificAnimatedAttributes[tagName]?.has(prop) || svg_data_attributes.tagSpecificPresentationalAttributes[tagName]?.has(prop)) {
@@ -38,12 +42,16 @@ async function cleanupInlineStyle(svg) {
38
42
  return;
39
43
  }
40
44
  if (svg_data_attributes.insideClipPathAttributes.has(prop)) {
41
- if (item.parents.find((item2) => item2.tagName === "clipPath")) {
45
+ if (item.parents.find(
46
+ (item2) => item2.tagName === "clipPath"
47
+ )) {
42
48
  $element.attr(prop, value);
43
49
  }
44
50
  return;
45
51
  }
46
- if (svg_data_attributes.badSoftwareAttributes.has(prop) || svg_data_attributes.badAttributePrefixes.has(prop.split("-").shift())) {
52
+ if (svg_data_attributes.badSoftwareAttributes.has(prop) || svg_data_attributes.badAttributePrefixes.has(
53
+ prop.split("-").shift()
54
+ )) {
47
55
  return;
48
56
  }
49
57
  if (prop.slice(0, 1) === "-") {
@@ -1,5 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
- import '../../types-f0980297.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
 
5
5
  /**
@@ -20,9 +20,13 @@ async function cleanupInlineStyle(svg) {
20
20
  const newStyle = /* @__PURE__ */ Object.create(null);
21
21
  const checkRule = (prop, value) => {
22
22
  function warn() {
23
- console.warn(`Removing unexpected style on "${tagName}": ${prop}`);
23
+ console.warn(
24
+ `Removing unexpected style on "${tagName}": ${prop}`
25
+ );
24
26
  }
25
- if (badAttributes.has(prop) || tagSpecificNonPresentationalAttributes[tagName]?.has(prop)) {
27
+ if (badAttributes.has(prop) || tagSpecificNonPresentationalAttributes[tagName]?.has(
28
+ prop
29
+ )) {
26
30
  return;
27
31
  }
28
32
  if (tagSpecificAnimatedAttributes[tagName]?.has(prop) || tagSpecificPresentationalAttributes[tagName]?.has(prop)) {
@@ -34,12 +38,16 @@ async function cleanupInlineStyle(svg) {
34
38
  return;
35
39
  }
36
40
  if (insideClipPathAttributes.has(prop)) {
37
- if (item.parents.find((item2) => item2.tagName === "clipPath")) {
41
+ if (item.parents.find(
42
+ (item2) => item2.tagName === "clipPath"
43
+ )) {
38
44
  $element.attr(prop, value);
39
45
  }
40
46
  return;
41
47
  }
42
- if (badSoftwareAttributes.has(prop) || badAttributePrefixes.has(prop.split("-").shift())) {
48
+ if (badSoftwareAttributes.has(prop) || badAttributePrefixes.has(
49
+ prop.split("-").shift()
50
+ )) {
43
51
  return;
44
52
  }
45
53
  if (prop.slice(0, 1) === "-") {
@@ -1,6 +1,6 @@
1
1
  import { SVG } from '../index.js';
2
2
  import { parseSVGStyle } from '../parse-style.js';
3
- import '../../types-f0980297.js';
3
+ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import '../../css/parser/types.js';
6
6
  import '../parse.js';
@@ -1,5 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
- import '../../types-f0980297.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
- import '../../types-f0980297.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { SVG } from './index.js';
2
- import '../types-f0980297.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
 
5
5
  /**
@@ -26,7 +26,6 @@ const junkSVGAttributes = /* @__PURE__ */ new Set([
26
26
  "zoomAndPan"
27
27
  ]);
28
28
  const badSoftwareAttributes = /* @__PURE__ */ new Set([
29
- "color-interpolation-filters",
30
29
  "isolation",
31
30
  "enable-background",
32
31
  "overflow",
@@ -22,7 +22,6 @@ const junkSVGAttributes = /* @__PURE__ */ new Set([
22
22
  "zoomAndPan"
23
23
  ]);
24
24
  const badSoftwareAttributes = /* @__PURE__ */ new Set([
25
- "color-interpolation-filters",
26
25
  "isolation",
27
26
  "enable-background",
28
27
  "overflow",
package/lib/svg/index.cjs CHANGED
@@ -29,7 +29,10 @@ class SVG {
29
29
  const $root = this.$svg(":root");
30
30
  const box = this.viewBox;
31
31
  if ($root.attr("viewBox") === void 0) {
32
- $root.attr("viewBox", `${box.left} ${box.top} ${box.width} ${box.height}`);
32
+ $root.attr(
33
+ "viewBox",
34
+ `${box.left} ${box.top} ${box.width} ${box.height}`
35
+ );
33
36
  }
34
37
  if ($root.attr("width") === void 0) {
35
38
  $root.attr("width", box.width.toString());
@@ -50,7 +53,9 @@ class SVG {
50
53
  case "fill":
51
54
  case "stroke":
52
55
  case "opacity":
53
- throw new Error(`Cannot use getBody() on icon that was not cleaned up with cleanupSVGRoot(). Icon has attribute ${key}="${attribs[key]}"`);
56
+ throw new Error(
57
+ `Cannot use getBody() on icon that was not cleaned up with cleanupSVGRoot(). Icon has attribute ${key}="${attribs[key]}"`
58
+ );
54
59
  }
55
60
  }
56
61
  return utils.trimSVG(this.$svg("svg").html());
@@ -78,7 +83,11 @@ class SVG {
78
83
  remove("<!--", "-->", "");
79
84
  remove("<?xml", "?>", "");
80
85
  remove("<!DOCTYPE svg", "<svg", "<svg");
81
- remove('xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"', "", "");
86
+ remove(
87
+ 'xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"',
88
+ "",
89
+ ""
90
+ );
82
91
  remove('xml:space="preserve"', "", "");
83
92
  content = content.replace(/<g>\s*<\/g>/g, "");
84
93
  this.$svg = cheerio__default.load(content.trim(), {
@@ -1,5 +1,5 @@
1
- import { I as IconifyIcon } from '../types-f0980297.js';
2
- export { I as IconifyIcon } from '../types-f0980297.js';
1
+ import { IconifyIcon } from '@iconify/types';
2
+ export { IconifyIcon } from '@iconify/types';
3
3
  import { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
4
4
  export { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
5
5
 
package/lib/svg/index.mjs CHANGED
@@ -21,7 +21,10 @@ class SVG {
21
21
  const $root = this.$svg(":root");
22
22
  const box = this.viewBox;
23
23
  if ($root.attr("viewBox") === void 0) {
24
- $root.attr("viewBox", `${box.left} ${box.top} ${box.width} ${box.height}`);
24
+ $root.attr(
25
+ "viewBox",
26
+ `${box.left} ${box.top} ${box.width} ${box.height}`
27
+ );
25
28
  }
26
29
  if ($root.attr("width") === void 0) {
27
30
  $root.attr("width", box.width.toString());
@@ -42,7 +45,9 @@ class SVG {
42
45
  case "fill":
43
46
  case "stroke":
44
47
  case "opacity":
45
- throw new Error(`Cannot use getBody() on icon that was not cleaned up with cleanupSVGRoot(). Icon has attribute ${key}="${attribs[key]}"`);
48
+ throw new Error(
49
+ `Cannot use getBody() on icon that was not cleaned up with cleanupSVGRoot(). Icon has attribute ${key}="${attribs[key]}"`
50
+ );
46
51
  }
47
52
  }
48
53
  return trimSVG(this.$svg("svg").html());
@@ -70,7 +75,11 @@ class SVG {
70
75
  remove("<!--", "-->", "");
71
76
  remove("<?xml", "?>", "");
72
77
  remove("<!DOCTYPE svg", "<svg", "<svg");
73
- remove('xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"', "", "");
78
+ remove(
79
+ 'xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"',
80
+ "",
81
+ ""
82
+ );
74
83
  remove('xml:space="preserve"', "", "");
75
84
  content = content.replace(/<g>\s*<\/g>/g, "");
76
85
  this.$svg = cheerio.load(content.trim(), {
@@ -51,14 +51,17 @@ async function parseSVGStyle(svg, callback) {
51
51
  value,
52
52
  token,
53
53
  selectorTokens,
54
- selectors: selectorTokens.reduce((prev, current) => {
55
- switch (current.type) {
56
- case "selector": {
57
- return prev.concat(current.selectors);
54
+ selectors: selectorTokens.reduce(
55
+ (prev, current) => {
56
+ switch (current.type) {
57
+ case "selector": {
58
+ return prev.concat(current.selectors);
59
+ }
58
60
  }
59
- }
60
- return prev;
61
- }, []),
61
+ return prev;
62
+ },
63
+ []
64
+ ),
62
65
  prevTokens: newTokens,
63
66
  nextTokens: tokens.slice(i + 1)
64
67
  });
@@ -78,7 +81,9 @@ async function parseSVGStyle(svg, callback) {
78
81
  if (!changed2) {
79
82
  return;
80
83
  }
81
- const tree = css_parser_tree.tokensTree(newTokens.filter((token) => token !== null));
84
+ const tree = css_parser_tree.tokensTree(
85
+ newTokens.filter((token) => token !== null)
86
+ );
82
87
  if (!tree.length) {
83
88
  $element.remove();
84
89
  return;
@@ -1,7 +1,7 @@
1
1
  import { SVG } from './index.js';
2
2
  import { CSSRuleToken, CSSToken } from '../css/parser/types.js';
3
3
  import { ParseSVGCallbackItem } from './parse.js';
4
- import '../types-f0980297.js';
4
+ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../misc/cheerio.js';
7
7
 
@@ -47,14 +47,17 @@ async function parseSVGStyle(svg, callback) {
47
47
  value,
48
48
  token,
49
49
  selectorTokens,
50
- selectors: selectorTokens.reduce((prev, current) => {
51
- switch (current.type) {
52
- case "selector": {
53
- return prev.concat(current.selectors);
50
+ selectors: selectorTokens.reduce(
51
+ (prev, current) => {
52
+ switch (current.type) {
53
+ case "selector": {
54
+ return prev.concat(current.selectors);
55
+ }
54
56
  }
55
- }
56
- return prev;
57
- }, []),
57
+ return prev;
58
+ },
59
+ []
60
+ ),
58
61
  prevTokens: newTokens,
59
62
  nextTokens: tokens.slice(i + 1)
60
63
  });
@@ -74,7 +77,9 @@ async function parseSVGStyle(svg, callback) {
74
77
  if (!changed2) {
75
78
  return;
76
79
  }
77
- const tree = tokensTree(newTokens.filter((token) => token !== null));
80
+ const tree = tokensTree(
81
+ newTokens.filter((token) => token !== null)
82
+ );
78
83
  if (!tree.length) {
79
84
  $element.remove();
80
85
  return;
@@ -1,6 +1,6 @@
1
1
  import { CheerioElement, WrappedCheerioElement } from '../misc/cheerio.js';
2
2
  import { SVG } from './index.js';
3
- import '../types-f0980297.js';
3
+ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
 
6
6
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "description": "Collection of functions for cleaning up and parsing SVG for Iconify project",
5
5
  "author": "Vjacheslav Trushkin",
6
- "version": "2.1.0-beta.7",
6
+ "version": "2.1.1",
7
7
  "license": "MIT",
8
8
  "bugs": "https://github.com/iconify/tools/issues",
9
9
  "homepage": "https://github.com/iconify/tools",
@@ -25,19 +25,22 @@
25
25
  "test": "npm run test:jest-cjs && npm run test:jest-esm && npm run test:jasmine"
26
26
  },
27
27
  "dependencies": {
28
- "@iconify/utils": "^2.0.0-beta.4",
29
- "@types/cheerio": "^0.22.30",
30
- "@types/node-fetch": "^2.5.12",
31
- "@types/svgo": "^2.6.0",
32
- "@types/tar": "^6.1.0",
33
- "cheerio": "^1.0.0-rc.10",
28
+ "@iconify/utils": "^2.0.1",
29
+ "@types/cheerio": "^0.22.31",
30
+ "@types/node-fetch": "^2.6.2",
31
+ "@types/svgo": "^2.6.4",
32
+ "@types/tar": "^6.1.3",
33
+ "cheerio": "^1.0.0-rc.12",
34
34
  "extract-zip": "^2.0.1",
35
- "local-pkg": "^0.4.1",
35
+ "local-pkg": "^0.4.2",
36
36
  "node-fetch": "^2.6.7",
37
- "pathe": "^0.2.0",
37
+ "pathe": "^0.3.9",
38
38
  "svgo": "^2.8.0",
39
39
  "tar": "^6.1.11"
40
40
  },
41
+ "peerDependencies": {
42
+ "@iconify/types": "*"
43
+ },
41
44
  "exports": {
42
45
  "./*": "./*",
43
46
  ".": {
@@ -48,6 +51,10 @@
48
51
  "require": "./lib/colors/attribs.cjs",
49
52
  "import": "./lib/colors/attribs.mjs"
50
53
  },
54
+ "./lib/colors/detect": {
55
+ "require": "./lib/colors/detect.cjs",
56
+ "import": "./lib/colors/detect.mjs"
57
+ },
51
58
  "./lib/colors/parse": {
52
59
  "require": "./lib/colors/parse.cjs",
53
60
  "import": "./lib/colors/parse.mjs"
@@ -248,6 +255,10 @@
248
255
  "require": "./lib/icon-set/props.cjs",
249
256
  "import": "./lib/icon-set/props.mjs"
250
257
  },
258
+ "./lib/icon-set/tags": {
259
+ "require": "./lib/icon-set/tags.cjs",
260
+ "import": "./lib/icon-set/tags.mjs"
261
+ },
251
262
  "./lib/icon-set/types": {
252
263
  "require": "./lib/icon-set/types.cjs",
253
264
  "import": "./lib/icon-set/types.mjs"
@@ -403,6 +414,10 @@
403
414
  "./lib/svg/parse-style": {
404
415
  "require": "./lib/svg/parse-style.cjs",
405
416
  "import": "./lib/svg/parse-style.mjs"
417
+ },
418
+ "./lib/tests/load": {
419
+ "require": "./lib/tests/load.cjs",
420
+ "import": "./lib/tests/load.mjs"
406
421
  }
407
422
  }
408
423
  }
@@ -1,258 +0,0 @@
1
- /**
2
- * Icon dimensions.
3
- *
4
- * Used in:
5
- * icon (as is)
6
- * alias (overwrite icon's properties)
7
- * root of JSON file (default values)
8
- */
9
- interface IconifyDimenisons {
10
- // Left position of viewBox.
11
- // Defaults to 0.
12
- left?: number;
13
-
14
- // Top position of viewBox.
15
- // Defaults to 0.
16
- top?: number;
17
-
18
- // Width of viewBox.
19
- // Defaults to 16.
20
- width?: number;
21
-
22
- // Height of viewBox.
23
- // Defaults to 16.
24
- height?: number;
25
- }
26
-
27
- /**
28
- * Icon transformations.
29
- *
30
- * Used in:
31
- * icon (as is)
32
- * alias (merged with icon's properties)
33
- */
34
- interface IconifyTransformations {
35
- // Number of 90 degrees rotations.
36
- // 0 = 0, 1 = 90deg and so on.
37
- // Defaults to 0.
38
- // When merged (such as alias + icon), result is icon.rotation + alias.rotation.
39
- rotate?: number;
40
-
41
- // Horizontal flip.
42
- // Defaults to false.
43
- // When merged, result is icon.hFlip !== alias.hFlip
44
- hFlip?: boolean;
45
-
46
- // Vertical flip. (see hFlip comments)
47
- vFlip?: boolean;
48
- }
49
-
50
- /**
51
- * Combination of dimensions and transformations.
52
- */
53
- interface IconifyOptional
54
- extends IconifyDimenisons,
55
- IconifyTransformations {
56
- //
57
- }
58
-
59
- /**
60
- * Alias.
61
- */
62
- interface IconifyAlias extends IconifyOptional {
63
- // Parent icon index without prefix, required.
64
- parent: string;
65
-
66
- // IconifyOptional properties.
67
- // Alias should have only properties that it overrides.
68
- // Transformations are merged, not overridden. See IconifyTransformations comments.
69
- }
70
-
71
- /**
72
- * Icon.
73
- */
74
- interface IconifyIcon extends IconifyOptional {
75
- // Icon body: <path d="..." />, required.
76
- body: string;
77
-
78
- // IconifyOptional properties.
79
- // If property is missing in JSON file, look in root object for default value.
80
- }
81
-
82
- /**
83
- * Icon with optional parameters that are provided by API and affect only search
84
- */
85
- interface APIIconAttributes {
86
- // True if icon is hidden.
87
- // Used in icon sets to keep icons that no longer exist, but should still be accessible
88
- // from API, preventing websites from breaking when icon is removed by developer.
89
- hidden?: boolean;
90
- }
91
-
92
- interface ExtendedIconifyIcon extends IconifyIcon, APIIconAttributes {}
93
- interface ExtendedIconifyAlias extends IconifyAlias, APIIconAttributes {}
94
-
95
- /**
96
- * "icons" field of JSON file.
97
- */
98
- interface IconifyIcons {
99
- // Index is name of icon, without prefix. Value is ExtendedIconifyIcon object.
100
- [index: string]: ExtendedIconifyIcon;
101
- }
102
-
103
- /**
104
- * "aliases" field of JSON file.
105
- */
106
- interface IconifyAliases {
107
- // Index is name of icon, without prefix. Value is ExtendedIconifyAlias object.
108
- [index: string]: ExtendedIconifyAlias;
109
- }
110
-
111
- /**
112
- * Icon set information block.
113
- */
114
- interface IconifyInfo {
115
- // Icon set name.
116
- name: string;
117
-
118
- // Total number of icons.
119
- total?: number;
120
-
121
- // Version string.
122
- version?: string;
123
-
124
- // Author information.
125
- author: {
126
- // Author name.
127
- name: string;
128
-
129
- // Link to author's website or icon set website.
130
- url?: string;
131
- };
132
-
133
- // License
134
- license: {
135
- // Human readable license.
136
- title: string;
137
-
138
- // SPDX license identifier.
139
- spdx?: string;
140
-
141
- // License URL.
142
- url?: string;
143
- };
144
-
145
- // Array of icons that should be used for samples in icon sets list.
146
- samples?: string[];
147
-
148
- // Icon grid: number or array of numbers.
149
- height?: number | number[];
150
-
151
- // Display height for samples: 16 - 24
152
- displayHeight?: number;
153
-
154
- // Category on Iconify collections list.
155
- category?: string;
156
-
157
- // Palette status. True if icons have predefined color scheme, false if icons use currentColor.
158
- // Ideally, icon set should not mix icons with and without palette to simplify search.
159
- palette?: boolean;
160
-
161
- // If true, icon set should not appear in icon sets list.
162
- hidden?: boolean;
163
- }
164
-
165
- /**
166
- * Optional themes, old format.
167
- *
168
- * Deprecated because format is unnecessary complicated. Key is meaningless, suffixes and prefixes are mixed together.
169
- */
170
- interface LegacyIconifyThemes {
171
- // Key is unique string.
172
- [index: string]: {
173
- // Theme title.
174
- title: string;
175
-
176
- // Icon prefix or suffix, including dash. All icons that start with prefix and end with suffix belong to theme.
177
- prefix?: string; // Example: 'baseline-'
178
- suffix?: string; // Example: '-filled'
179
- };
180
- }
181
-
182
- /**
183
- * Characters used in font.
184
- */
185
- interface IconifyChars {
186
- // Index is character, such as "f000".
187
- // Value is icon name.
188
- [index: string]: string;
189
- }
190
-
191
- /**
192
- * Icon categories
193
- */
194
- interface IconifyCategories {
195
- // Index is category title, such as "Weather".
196
- // Value is array of icons that belong to that category.
197
- // Each icon can belong to multiple categories or no categories.
198
- [index: string]: string[];
199
- }
200
-
201
- /**
202
- * Meta data stored in JSON file, used for browsing icon set.
203
- */
204
- interface IconifyMetaData {
205
- // Icon set information block. Used for public icon sets, can be skipped for private icon sets.
206
- info?: IconifyInfo;
207
-
208
- // Characters used in font. Used for searching by character for icon sets imported from font, exporting icon set to font.
209
- chars?: IconifyChars;
210
-
211
- // Categories. Used for filtering icons.
212
- categories?: IconifyCategories;
213
-
214
- // Optional themes (old format).
215
- themes?: LegacyIconifyThemes;
216
-
217
- // Optional themes (new format). Key is prefix or suffix, value is title.
218
- prefixes?: Record<string, string>;
219
- suffixes?: Record<string, string>;
220
- }
221
-
222
- /**
223
- * JSON structure, contains only icon data
224
- */
225
- interface IconifyJSONIconsData extends IconifyDimenisons {
226
- // Prefix for icons in JSON file, required.
227
- prefix: string;
228
-
229
- // API provider, optional.
230
- provider?: string;
231
-
232
- // List of icons, required.
233
- icons: IconifyIcons;
234
-
235
- // Optional aliases.
236
- aliases?: IconifyAliases;
237
-
238
- // IconifyDimenisons properties that are used as default viewbox for icons when icon is missing value.
239
- // If viewbox exists in both icon and root, use value from icon.
240
- // This is used to reduce duplication.
241
- }
242
-
243
- /**
244
- * JSON structure.
245
- *
246
- * All optional values can exist in root of JSON file, used as defaults.
247
- */
248
- interface IconifyJSON extends IconifyJSONIconsData, IconifyMetaData {
249
- // Last modification time of icons. Unix time stamp in seconds.
250
- // Time is calculated only for icon data, ignoring metadata.
251
- // Used to invalidate icons cache in components.
252
- lastModified?: number;
253
-
254
- // Optional list of missing icons. Returned by Iconify API when querying for icons that do not exist.
255
- not_found?: string[];
256
- }
257
-
258
- export { ExtendedIconifyIcon as E, IconifyIcon as I, IconifyInfo as a, IconifyJSON as b, ExtendedIconifyAlias as c, IconifyOptional as d };