@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
@@ -104,7 +104,9 @@ async function cleanupGlobalStyle(svg) {
104
104
  if (!isMatch(tagName, $element)) {
105
105
  return;
106
106
  }
107
- const addedAttributes = new Set($element.attr(tempDataAttrbiute)?.split(/\s+/));
107
+ const addedAttributes = new Set(
108
+ $element.attr(tempDataAttrbiute)?.split(/\s+/)
109
+ );
108
110
  const prop = styleItem.prop;
109
111
  if ($element.attr(prop) !== void 0) {
110
112
  if (addedAttributes.has(prop)) {
@@ -113,7 +115,10 @@ async function cleanupGlobalStyle(svg) {
113
115
  }
114
116
  $element.attr(prop, styleItem.value);
115
117
  addedAttributes.add(prop);
116
- $element.attr(tempDataAttrbiute, Array.from(addedAttributes).join(" "));
118
+ $element.attr(
119
+ tempDataAttrbiute,
120
+ Array.from(addedAttributes).join(" ")
121
+ );
117
122
  containsTempAttr = true;
118
123
  });
119
124
  const classMatches = matches.filter((item) => item.type === "class").map((item) => item.value);
@@ -127,7 +132,9 @@ async function cleanupGlobalStyle(svg) {
127
132
  if (!classList) {
128
133
  return;
129
134
  }
130
- const filtered = classList.filter((item) => classMatches.indexOf(item) === -1);
135
+ const filtered = classList.filter(
136
+ (item) => classMatches.indexOf(item) === -1
137
+ );
131
138
  if (!filtered.length) {
132
139
  $element.removeAttr("class");
133
140
  } else {
@@ -1,5 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
- import '../types-6360d61e.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'svgo';
2
2
  import { SVG } from '../svg/index.js';
3
- import '../types-6360d61e.js';
3
+ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
 
6
6
  interface CleanupIDsOption {
@@ -27,7 +27,7 @@ interface SVGOptionsWithoutPlugin extends SVGOCommonOptions, CleanupIDsOption {
27
27
  plugins?: undefined;
28
28
  keepShapes?: boolean;
29
29
  }
30
- declare type SVGOOptions = SVGOOptionsWithPlugin | SVGOptionsWithoutPlugin;
30
+ type SVGOOptions = SVGOOptionsWithPlugin | SVGOptionsWithoutPlugin;
31
31
  /**
32
32
  * Run SVGO on icon
33
33
  */
@@ -75,7 +75,7 @@ interface ElementsTreeItem {
75
75
  /**
76
76
  * Elements map
77
77
  */
78
- declare type ElementsMap = Map<number, ExtendedTagElement>;
78
+ type ElementsMap = Map<number, ExtendedTagElement>;
79
79
  /**
80
80
  * Result
81
81
  */
@@ -45,7 +45,9 @@ async function analyseSVGStructure(svg, options = {}) {
45
45
  const index2 = element._index;
46
46
  const id = attribs["id"];
47
47
  if (typeof id !== "string") {
48
- const message = `Definition element ${svg_analyse_error.analyseTagError(element)} does not have id`;
48
+ const message = `Definition element ${svg_analyse_error.analyseTagError(
49
+ element
50
+ )} does not have id`;
49
51
  if (fixErrors) {
50
52
  item.removeNode = true;
51
53
  item.testChildren = false;
@@ -126,7 +128,11 @@ async function analyseSVGStructure(svg, options = {}) {
126
128
  const parentReusableElement = parentElement._reusableElement;
127
129
  if (parentReusableElement) {
128
130
  if (element._reusableElement) {
129
- throw new Error(`Reusable element ${svg_analyse_error.analyseTagError(element)} is inside another reusable element id="${parentReusableElement.id}"`);
131
+ throw new Error(
132
+ `Reusable element ${svg_analyse_error.analyseTagError(
133
+ element
134
+ )} is inside another reusable element id="${parentReusableElement.id}"`
135
+ );
130
136
  }
131
137
  element._reusableElement = parentReusableElement;
132
138
  }
@@ -154,7 +160,9 @@ async function analyseSVGStructure(svg, options = {}) {
154
160
  const href = attribs["href"] || attribs["xlink:href"];
155
161
  if (typeof href === "string") {
156
162
  if (href.slice(0, 1) !== "#") {
157
- throw new Error(`Invalid link in ${svg_analyse_error.analyseTagError(element)}`);
163
+ throw new Error(
164
+ `Invalid link in ${svg_analyse_error.analyseTagError(element)}`
165
+ );
158
166
  }
159
167
  const id = href.slice(1);
160
168
  gotElementReference(item, id, false);
@@ -194,7 +202,9 @@ async function analyseSVGStructure(svg, options = {}) {
194
202
  const parent = element.parent;
195
203
  if (parent) {
196
204
  if (parent._childElements) {
197
- parent._childElements = parent._childElements.filter((num) => num !== index2);
205
+ parent._childElements = parent._childElements.filter(
206
+ (num) => num !== index2
207
+ );
198
208
  }
199
209
  parent._belongsTo?.forEach((list) => {
200
210
  list.indexes.delete(index2);
@@ -203,7 +213,9 @@ async function analyseSVGStructure(svg, options = {}) {
203
213
  $element.remove();
204
214
  }
205
215
  if (element._linksTo) {
206
- element._linksTo = element._linksTo.filter((item2) => item2.id !== id);
216
+ element._linksTo = element._linksTo.filter(
217
+ (item2) => item2.id !== id
218
+ );
207
219
  }
208
220
  if (!element.children.length) {
209
221
  if (svg_data_tags.useTag.has(tagName)) {
@@ -229,7 +241,9 @@ async function analyseSVGStructure(svg, options = {}) {
229
241
  return false;
230
242
  });
231
243
  function hasChildItem(tree2, child, canThrow) {
232
- const item = tree2.children.find((item2) => item2.index === child.index && item2.usedAsMask === child.usedAsMask);
244
+ const item = tree2.children.find(
245
+ (item2) => item2.index === child.index && item2.usedAsMask === child.usedAsMask
246
+ );
233
247
  if (item && canThrow) {
234
248
  throw new Error("Recursion");
235
249
  }
@@ -1,6 +1,6 @@
1
1
  import { SVG } from './index.js';
2
2
  import { AnalyseSVGStructureOptions, AnalyseSVGStructureResult } from './analyse/types.js';
3
- import '../types-6360d61e.js';
3
+ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
 
6
6
  /**
@@ -41,7 +41,9 @@ async function analyseSVGStructure(svg, options = {}) {
41
41
  const index2 = element._index;
42
42
  const id = attribs["id"];
43
43
  if (typeof id !== "string") {
44
- const message = `Definition element ${analyseTagError(element)} does not have id`;
44
+ const message = `Definition element ${analyseTagError(
45
+ element
46
+ )} does not have id`;
45
47
  if (fixErrors) {
46
48
  item.removeNode = true;
47
49
  item.testChildren = false;
@@ -122,7 +124,11 @@ async function analyseSVGStructure(svg, options = {}) {
122
124
  const parentReusableElement = parentElement._reusableElement;
123
125
  if (parentReusableElement) {
124
126
  if (element._reusableElement) {
125
- throw new Error(`Reusable element ${analyseTagError(element)} is inside another reusable element id="${parentReusableElement.id}"`);
127
+ throw new Error(
128
+ `Reusable element ${analyseTagError(
129
+ element
130
+ )} is inside another reusable element id="${parentReusableElement.id}"`
131
+ );
126
132
  }
127
133
  element._reusableElement = parentReusableElement;
128
134
  }
@@ -150,7 +156,9 @@ async function analyseSVGStructure(svg, options = {}) {
150
156
  const href = attribs["href"] || attribs["xlink:href"];
151
157
  if (typeof href === "string") {
152
158
  if (href.slice(0, 1) !== "#") {
153
- throw new Error(`Invalid link in ${analyseTagError(element)}`);
159
+ throw new Error(
160
+ `Invalid link in ${analyseTagError(element)}`
161
+ );
154
162
  }
155
163
  const id = href.slice(1);
156
164
  gotElementReference(item, id, false);
@@ -190,7 +198,9 @@ async function analyseSVGStructure(svg, options = {}) {
190
198
  const parent = element.parent;
191
199
  if (parent) {
192
200
  if (parent._childElements) {
193
- parent._childElements = parent._childElements.filter((num) => num !== index2);
201
+ parent._childElements = parent._childElements.filter(
202
+ (num) => num !== index2
203
+ );
194
204
  }
195
205
  parent._belongsTo?.forEach((list) => {
196
206
  list.indexes.delete(index2);
@@ -199,7 +209,9 @@ async function analyseSVGStructure(svg, options = {}) {
199
209
  $element.remove();
200
210
  }
201
211
  if (element._linksTo) {
202
- element._linksTo = element._linksTo.filter((item2) => item2.id !== id);
212
+ element._linksTo = element._linksTo.filter(
213
+ (item2) => item2.id !== id
214
+ );
203
215
  }
204
216
  if (!element.children.length) {
205
217
  if (useTag.has(tagName)) {
@@ -225,7 +237,9 @@ async function analyseSVGStructure(svg, options = {}) {
225
237
  return false;
226
238
  });
227
239
  function hasChildItem(tree2, child, canThrow) {
228
- const item = tree2.children.find((item2) => item2.index === child.index && item2.usedAsMask === child.usedAsMask);
240
+ const item = tree2.children.find(
241
+ (item2) => item2.index === child.index && item2.usedAsMask === child.usedAsMask
242
+ );
229
243
  if (item && canThrow) {
230
244
  throw new Error("Recursion");
231
245
  }
@@ -1,5 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
- import '../../types-6360d61e.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
 
5
5
  /**
@@ -6,7 +6,10 @@ const svg_parse = require('../parse.cjs');
6
6
  const svg_data_tags = require('../data/tags.cjs');
7
7
 
8
8
  const requiredParentTags = /* @__PURE__ */ new Map();
9
- requiredParentTags.set(/* @__PURE__ */ new Set(["feComponentTransfer"]), svg_data_tags.feComponentTransferChildTag);
9
+ requiredParentTags.set(
10
+ /* @__PURE__ */ new Set(["feComponentTransfer"]),
11
+ svg_data_tags.feComponentTransferChildTag
12
+ );
10
13
  requiredParentTags.set(/* @__PURE__ */ new Set(["feMerge"]), svg_data_tags.feMergeChildTags);
11
14
  requiredParentTags.set(svg_data_tags.feLightningTags, svg_data_tags.feLightningChildTags);
12
15
  requiredParentTags.set(svg_data_tags.filterTag, svg_data_tags.filterChildTags);
@@ -40,7 +43,9 @@ async function checkBadTags(svg) {
40
43
  for (const [parents, children] of requiredParentTags) {
41
44
  if (children.has(tagName)) {
42
45
  if (!parents.has(parentTagName)) {
43
- throw new Error(`Element <${tagName}> has wrong parent element`);
46
+ throw new Error(
47
+ `Element <${tagName}> has wrong parent element`
48
+ );
44
49
  }
45
50
  return;
46
51
  }
@@ -1,5 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
- import '../../types-6360d61e.js';
2
+ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
 
5
5
  /**
@@ -2,7 +2,10 @@ import { parseSVG } from '../parse.mjs';
2
2
  import { feComponentTransferChildTag, feMergeChildTags, feLightningTags, feLightningChildTags, filterTag, filterChildTags, gradientTags, gradientChildTags, animateMotionChildTags, unsupportedTags, badTags, allValidTags } from '../data/tags.mjs';
3
3
 
4
4
  const requiredParentTags = /* @__PURE__ */ new Map();
5
- requiredParentTags.set(/* @__PURE__ */ new Set(["feComponentTransfer"]), feComponentTransferChildTag);
5
+ requiredParentTags.set(
6
+ /* @__PURE__ */ new Set(["feComponentTransfer"]),
7
+ feComponentTransferChildTag
8
+ );
6
9
  requiredParentTags.set(/* @__PURE__ */ new Set(["feMerge"]), feMergeChildTags);
7
10
  requiredParentTags.set(feLightningTags, feLightningChildTags);
8
11
  requiredParentTags.set(filterTag, filterChildTags);
@@ -36,7 +39,9 @@ async function checkBadTags(svg) {
36
39
  for (const [parents, children] of requiredParentTags) {
37
40
  if (children.has(tagName)) {
38
41
  if (!parents.has(parentTagName)) {
39
- throw new Error(`Element <${tagName}> has wrong parent element`);
42
+ throw new Error(
43
+ `Element <${tagName}> has wrong parent element`
44
+ );
40
45
  }
41
46
  return;
42
47
  }
@@ -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-6360d61e.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-6360d61e.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-6360d61e.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-6360d61e.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-6360d61e.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-6360d61e.js';
2
- export { I as IconifyIcon } from '../types-6360d61e.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-6360d61e.js';
4
+ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../misc/cheerio.js';
7
7
 
@@ -24,15 +24,15 @@ interface ParseSVGStyleCallbackItemGlobal extends ParseSVGStyleCallbackItemCommo
24
24
  prevTokens: (CSSToken | null)[];
25
25
  nextTokens: CSSToken[];
26
26
  }
27
- declare type ParseSVGStyleCallbackItem = ParseSVGStyleCallbackItemInline | ParseSVGStyleCallbackItemGlobal;
27
+ type ParseSVGStyleCallbackItem = ParseSVGStyleCallbackItemInline | ParseSVGStyleCallbackItemGlobal;
28
28
  /**
29
29
  * Result: undefined to remove item, string to change/keep item
30
30
  */
31
- declare type ParseSVGStyleCallbackResult = string | undefined;
31
+ type ParseSVGStyleCallbackResult = string | undefined;
32
32
  /**
33
33
  * Callback function
34
34
  */
35
- declare type ParseSVGStyleCallback = (item: ParseSVGStyleCallbackItem) => ParseSVGStyleCallbackResult | Promise<ParseSVGStyleCallbackResult>;
35
+ type ParseSVGStyleCallback = (item: ParseSVGStyleCallbackItem) => ParseSVGStyleCallbackResult | Promise<ParseSVGStyleCallbackResult>;
36
36
  /**
37
37
  * Parse styles in SVG
38
38
  *
@@ -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-6360d61e.js';
3
+ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
 
6
6
  /**
@@ -18,7 +18,7 @@ interface ParseSVGCallbackItem {
18
18
  /**
19
19
  * Callback function
20
20
  */
21
- declare type ParseSVGCallback = (item: ParseSVGCallbackItem) => void | Promise<void>;
21
+ type ParseSVGCallback = (item: ParseSVGCallbackItem) => void | Promise<void>;
22
22
  /**
23
23
  * Parse SVG
24
24
  *