@iconify/tools 3.0.5 → 4.0.0-dev.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 (55) hide show
  1. package/lib/colors/detect.d.ts +1 -0
  2. package/lib/colors/parse.d.ts +1 -0
  3. package/lib/colors/validate.d.ts +1 -0
  4. package/lib/export/directory.d.ts +1 -0
  5. package/lib/export/icon-package.d.ts +1 -0
  6. package/lib/export/json-package.d.ts +1 -0
  7. package/lib/icon-set/index.cjs +1 -1
  8. package/lib/icon-set/index.d.ts +2 -1
  9. package/lib/icon-set/index.mjs +1 -1
  10. package/lib/icon-set/match.d.ts +1 -0
  11. package/lib/icon-set/merge.d.ts +1 -0
  12. package/lib/icon-set/modified.d.ts +1 -0
  13. package/lib/icon-set/tags.d.ts +1 -0
  14. package/lib/import/directory.d.ts +1 -0
  15. package/lib/import/figma/index.d.ts +1 -0
  16. package/lib/import/figma/nodes.d.ts +1 -0
  17. package/lib/import/figma/query.d.ts +1 -0
  18. package/lib/import/figma/types/nodes.d.ts +1 -0
  19. package/lib/import/figma/types/options.d.ts +1 -0
  20. package/lib/import/figma/types/result.d.ts +1 -0
  21. package/lib/index.cjs +4 -0
  22. package/lib/index.d.ts +3 -0
  23. package/lib/index.mjs +2 -0
  24. package/lib/misc/cheerio.d.ts +4 -2
  25. package/lib/optimise/figma.cjs +175 -0
  26. package/lib/optimise/figma.d.ts +11 -0
  27. package/lib/optimise/figma.mjs +173 -0
  28. package/lib/optimise/flags.d.ts +1 -0
  29. package/lib/optimise/global-style.d.ts +1 -0
  30. package/lib/optimise/mask.cjs +110 -0
  31. package/lib/optimise/mask.d.ts +24 -0
  32. package/lib/optimise/mask.mjs +108 -0
  33. package/lib/optimise/origin.d.ts +1 -0
  34. package/lib/optimise/scale.d.ts +1 -0
  35. package/lib/optimise/svgo.d.ts +1 -0
  36. package/lib/svg/analyse/error.d.ts +1 -0
  37. package/lib/svg/analyse/types.d.ts +3 -1
  38. package/lib/svg/analyse.d.ts +1 -0
  39. package/lib/svg/cleanup/attribs.d.ts +1 -0
  40. package/lib/svg/cleanup/bad-tags.d.ts +1 -0
  41. package/lib/svg/cleanup/inline-style.d.ts +1 -0
  42. package/lib/svg/cleanup/root-style.d.ts +1 -0
  43. package/lib/svg/cleanup/root-svg.cjs +3 -3
  44. package/lib/svg/cleanup/root-svg.d.ts +1 -0
  45. package/lib/svg/cleanup/root-svg.mjs +3 -3
  46. package/lib/svg/cleanup/svgo-style.d.ts +1 -0
  47. package/lib/svg/cleanup.d.ts +1 -0
  48. package/lib/svg/index.cjs +13 -3
  49. package/lib/svg/index.d.ts +2 -1
  50. package/lib/svg/index.mjs +1 -1
  51. package/lib/svg/parse-style.d.ts +1 -0
  52. package/lib/svg/parse.cjs +2 -2
  53. package/lib/svg/parse.d.ts +1 -0
  54. package/lib/svg/parse.mjs +2 -2
  55. package/package.json +25 -13
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import '../icon-set/types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
@@ -2,6 +2,7 @@ import { Color } from '@iconify/utils/lib/colors/types';
2
2
  import { SVG } from '../svg/index.js';
3
3
  import { ColorAttributes } from './attribs.js';
4
4
  import { ElementsTreeItem, AnalyseSVGStructureResult, ExtendedTagElement, AnalyseSVGStructureOptions } from '../svg/analyse/types.js';
5
+ import 'cheerio';
5
6
  import '@iconify/types';
6
7
  import '@iconify/utils/lib/customisations/defaults';
7
8
 
@@ -1,5 +1,6 @@
1
1
  import { SVG } from '../svg/index.js';
2
2
  import { ParseColorsOptions, FindColorsResult, ParseColorsSyncOptions } from './parse.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
  import '@iconify/utils/lib/colors/types';
@@ -4,6 +4,7 @@ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import '../icon-set/types.js';
6
6
  import '../svg/index.js';
7
+ import 'cheerio';
7
8
  import '@iconify/utils/lib/icon-set/tree';
8
9
 
9
10
  /**
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../icon-set/types.js';
7
7
  import '../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
 
10
11
  /**
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../icon-set/types.js';
7
7
  import '../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
 
10
11
  /**
@@ -512,7 +512,7 @@ class IconSet {
512
512
  return count;
513
513
  }
514
514
  /**
515
- * Remove icon
515
+ * Rename icon
516
516
  */
517
517
  rename(oldName, newName) {
518
518
  const entries = this.entries;
@@ -3,6 +3,7 @@ import { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/def
3
3
  import { IconSetIconEntry, IconCategory, IconSetIconType, IconSetAsyncForEachCallback, IconSetSyncForEachCallback, ResolvedIconifyIcon, CommonIconProps, CheckThemeResult } from './types.js';
4
4
  import { SVG } from '../svg/index.js';
5
5
  import { ParentIconsTree } from '@iconify/utils/lib/icon-set/tree';
6
+ import 'cheerio';
6
7
 
7
8
  /**
8
9
  * Sort theme keys: long keys first
@@ -117,7 +118,7 @@ declare class IconSet {
117
118
  */
118
119
  remove(name: string, removeDependencies?: boolean | string): number;
119
120
  /**
120
- * Remove icon
121
+ * Rename icon
121
122
  */
122
123
  rename(oldName: string, newName: string): boolean;
123
124
  /**
@@ -510,7 +510,7 @@ class IconSet {
510
510
  return count;
511
511
  }
512
512
  /**
513
- * Remove icon
513
+ * Rename icon
514
514
  */
515
515
  rename(oldName, newName) {
516
516
  const entries = this.entries;
@@ -4,6 +4,7 @@ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import './types.js';
6
6
  import '../svg/index.js';
7
+ import 'cheerio';
7
8
  import '@iconify/utils/lib/icon-set/tree';
8
9
 
9
10
  /**
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  declare const paletteTags: {
@@ -4,6 +4,7 @@ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import '../icon-set/types.js';
6
6
  import '../svg/index.js';
7
+ import 'cheerio';
7
8
  import '@iconify/utils/lib/icon-set/tree';
8
9
  import '../svg/cleanup/bad-tags.js';
9
10
 
@@ -6,6 +6,7 @@ import '@iconify/types';
6
6
  import '@iconify/utils/lib/customisations/defaults';
7
7
  import '../../icon-set/types.js';
8
8
  import '../../svg/index.js';
9
+ import 'cheerio';
9
10
  import '@iconify/utils/lib/icon-set/tree';
10
11
  import './types/nodes.js';
11
12
  import './types/api.js';
@@ -6,6 +6,7 @@ import '@iconify/types';
6
6
  import '@iconify/utils/lib/customisations/defaults';
7
7
  import '../../icon-set/types.js';
8
8
  import '../../svg/index.js';
9
+ import 'cheerio';
9
10
  import '@iconify/utils/lib/icon-set/tree';
10
11
  import './types/nodes.js';
11
12
 
@@ -8,6 +8,7 @@ import '@iconify/types';
8
8
  import '@iconify/utils/lib/customisations/defaults';
9
9
  import '../../icon-set/types.js';
10
10
  import '../../svg/index.js';
11
+ import 'cheerio';
11
12
  import '@iconify/utils/lib/icon-set/tree';
12
13
  import './types/nodes.js';
13
14
 
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../../../icon-set/types.js';
7
7
  import '../../../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
 
10
11
  type FigmaImportParentNodeType = 'CANVAS' | 'FRAME' | 'GROUP' | 'SECTION';
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../../../icon-set/types.js';
7
7
  import '../../../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
  import './api.js';
10
11
 
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import '../../../icon-set/types.js';
5
5
  import '../../../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
package/lib/index.cjs CHANGED
@@ -32,8 +32,10 @@ const colors_parse = require('./colors/parse.cjs');
32
32
  const colors_validate = require('./colors/validate.cjs');
33
33
  const colors_detect = require('./colors/detect.cjs');
34
34
  const optimise_svgo = require('./optimise/svgo.cjs');
35
+ const optimise_figma = require('./optimise/figma.cjs');
35
36
  const optimise_flags = require('./optimise/flags.cjs');
36
37
  const optimise_origin = require('./optimise/origin.cjs');
38
+ const optimise_mask = require('./optimise/mask.cjs');
37
39
  const optimise_scale = require('./optimise/scale.cjs');
38
40
  const optimise_globalStyle = require('./optimise/global-style.cjs');
39
41
  const export_directory = require('./export/directory.cjs');
@@ -130,8 +132,10 @@ exports.validateColors = colors_validate.validateColors;
130
132
  exports.validateColorsSync = colors_validate.validateColorsSync;
131
133
  exports.detectIconSetPalette = colors_detect.detectIconSetPalette;
132
134
  exports.runSVGO = optimise_svgo.runSVGO;
135
+ exports.removeFigmaClipPathFromSVG = optimise_figma.removeFigmaClipPathFromSVG;
133
136
  exports.deOptimisePaths = optimise_flags.deOptimisePaths;
134
137
  exports.resetSVGOrigin = optimise_origin.resetSVGOrigin;
138
+ exports.convertSVGToMask = optimise_mask.convertSVGToMask;
135
139
  exports.scaleSVG = optimise_scale.scaleSVG;
136
140
  exports.cleanupGlobalStyle = optimise_globalStyle.cleanupGlobalStyle;
137
141
  exports.exportToDirectory = export_directory.exportToDirectory;
package/lib/index.d.ts CHANGED
@@ -30,8 +30,10 @@ export { isEmptyColor, parseColors, parseColorsSync } from './colors/parse.js';
30
30
  export { validateColors, validateColorsSync } from './colors/validate.js';
31
31
  export { detectIconSetPalette } from './colors/detect.js';
32
32
  export { runSVGO } from './optimise/svgo.js';
33
+ export { removeFigmaClipPathFromSVG } from './optimise/figma.js';
33
34
  export { deOptimisePaths } from './optimise/flags.js';
34
35
  export { resetSVGOrigin } from './optimise/origin.js';
36
+ export { convertSVGToMask } from './optimise/mask.js';
35
37
  export { scaleSVG } from './optimise/scale.js';
36
38
  export { cleanupGlobalStyle } from './optimise/global-style.js';
37
39
  export { exportToDirectory } from './export/directory.js';
@@ -47,6 +49,7 @@ export { execAsync } from './misc/exec.js';
47
49
  export { cleanupIconKeyword } from './misc/keyword.js';
48
50
  export { bumpVersion } from './misc/bump-version.js';
49
51
  export { sendAPIQuery } from './download/api/index.js';
52
+ import 'cheerio';
50
53
  import '@iconify/types';
51
54
  import '@iconify/utils/lib/customisations/defaults';
52
55
  import './misc/cheerio.js';
package/lib/index.mjs CHANGED
@@ -30,8 +30,10 @@ export { isEmptyColor, parseColors, parseColorsSync } from './colors/parse.mjs';
30
30
  export { validateColors, validateColorsSync } from './colors/validate.mjs';
31
31
  export { detectIconSetPalette } from './colors/detect.mjs';
32
32
  export { runSVGO } from './optimise/svgo.mjs';
33
+ export { removeFigmaClipPathFromSVG } from './optimise/figma.mjs';
33
34
  export { deOptimisePaths } from './optimise/flags.mjs';
34
35
  export { resetSVGOrigin } from './optimise/origin.mjs';
36
+ export { convertSVGToMask } from './optimise/mask.mjs';
35
37
  export { scaleSVG } from './optimise/scale.mjs';
36
38
  export { cleanupGlobalStyle } from './optimise/global-style.mjs';
37
39
  export { exportToDirectory } from './export/directory.mjs';
@@ -1,7 +1,9 @@
1
+ import * as cheerio from 'cheerio';
2
+
1
3
  /**
2
4
  * Shortcuts for Cheerio elements
3
5
  */
4
- type CheerioElement = cheerio.TagElement;
5
- type WrappedCheerioElement = cheerio.Cheerio;
6
+ type CheerioElement = cheerio.Element;
7
+ type WrappedCheerioElement = cheerio.Cheerio<cheerio.Element>;
6
8
 
7
9
  export { CheerioElement, WrappedCheerioElement };
@@ -0,0 +1,175 @@
1
+ 'use strict';
2
+
3
+ const svg_data_tags = require('../svg/data/tags.cjs');
4
+
5
+ function isTinyNumber(value, limit) {
6
+ const num = parseInt(value);
7
+ return !isNaN(num) && Math.abs(num) < limit;
8
+ }
9
+ function checkClipPathNode(clipNode, expectedWidth, expectedHeight) {
10
+ for (const attr in clipNode.attribs) {
11
+ if (attr !== "id") {
12
+ return false;
13
+ }
14
+ }
15
+ const children = clipNode.children.filter((node) => node.type !== "text");
16
+ if (children.length !== 1) {
17
+ return false;
18
+ }
19
+ const childNode = children[0];
20
+ if (childNode.type !== "tag" || childNode.children.length) {
21
+ return false;
22
+ }
23
+ const attribs = {
24
+ ...childNode.attribs
25
+ };
26
+ delete attribs["fill"];
27
+ const fill = (childNode.attribs["fill"] ?? "").toLowerCase();
28
+ if (fill !== "white" && fill !== "#fff" && fill !== "#ffffff") {
29
+ console.warn(
30
+ "Unxepected fill on clip path:",
31
+ childNode.attribs["fill"]
32
+ );
33
+ return false;
34
+ }
35
+ switch (childNode.tagName) {
36
+ case "rect": {
37
+ const width = parseInt(childNode.attribs["width"]);
38
+ const height = parseInt(childNode.attribs["height"]);
39
+ if (width !== expectedWidth || height !== expectedHeight) {
40
+ console.warn("Invalid size of clip path");
41
+ return false;
42
+ }
43
+ delete attribs["width"];
44
+ delete attribs["height"];
45
+ break;
46
+ }
47
+ default:
48
+ console.warn(
49
+ "Unexpected tag in Figma clip path:",
50
+ childNode.tagName
51
+ );
52
+ return false;
53
+ }
54
+ Object.keys(attribs).forEach((attr) => {
55
+ const value = attribs[attr];
56
+ switch (attr) {
57
+ case "transform": {
58
+ const translateStart = "translate(";
59
+ const translateEnd = ")";
60
+ if (value.startsWith(translateStart) && value.endsWith(translateEnd)) {
61
+ const translateParts = value.slice(translateStart.length, 0 - translateEnd.length).split(/\s+/);
62
+ const limit = Math.min(expectedWidth, expectedHeight) / 1e3;
63
+ if (translateParts.length === 2 && isTinyNumber(translateParts[0], limit) && isTinyNumber(translateParts[1], limit)) {
64
+ delete attribs[attr];
65
+ }
66
+ }
67
+ }
68
+ }
69
+ });
70
+ return {
71
+ node: clipNode,
72
+ attribs
73
+ };
74
+ }
75
+ const urlStart = "url(#";
76
+ const urlEnd = ")";
77
+ function removeFigmaClipPathFromSVG(svg) {
78
+ const cheerio2 = svg.$svg;
79
+ const $root = svg.$svg(":root");
80
+ const children = $root.children();
81
+ const backup = svg.toString();
82
+ const shapesToClip = [];
83
+ let clipID;
84
+ for (let i = 0; i < children.length; i++) {
85
+ const node = children[i];
86
+ if (node.type === "tag") {
87
+ const tagName = node.tagName;
88
+ if (!svg_data_tags.defsTag.has(tagName) && !svg_data_tags.maskTags.has(tagName) && !svg_data_tags.symbolTag.has(tagName)) {
89
+ const clipPath2 = node.attribs["clip-path"];
90
+ if (!clipPath2 || !clipPath2.startsWith(urlStart) || !clipPath2.endsWith(urlEnd)) {
91
+ return false;
92
+ }
93
+ const id = clipPath2.slice(urlStart.length, 0 - urlEnd.length);
94
+ if (typeof clipID === "string" && clipID !== id) {
95
+ return false;
96
+ }
97
+ clipID = id;
98
+ shapesToClip.push(node);
99
+ }
100
+ }
101
+ }
102
+ if (typeof clipID !== "string") {
103
+ return false;
104
+ }
105
+ const checkClipPath = (node) => {
106
+ const id = node.attribs["id"];
107
+ if (id !== clipID) {
108
+ return;
109
+ }
110
+ const result = checkClipPathNode(
111
+ node,
112
+ svg.viewBox.width,
113
+ svg.viewBox.height
114
+ );
115
+ cheerio2(node).remove();
116
+ return result;
117
+ };
118
+ const findClipPath = () => {
119
+ for (let i = 0; i < children.length; i++) {
120
+ const node = children[i];
121
+ if (node.type === "tag") {
122
+ const tagName = node.tagName;
123
+ if (svg_data_tags.defsTag.has(tagName)) {
124
+ const defsChildren = node.children;
125
+ for (let j = 0; j < defsChildren.length; j++) {
126
+ const childNode = defsChildren[j];
127
+ if (childNode.type === "tag" && childNode.tagName === "clipPath") {
128
+ const result = checkClipPath(childNode);
129
+ if (result !== void 0) {
130
+ const validChildren = node.children.filter(
131
+ (test) => {
132
+ if (test.type === "text") {
133
+ return false;
134
+ }
135
+ return true;
136
+ }
137
+ );
138
+ if (!validChildren.length) {
139
+ cheerio2(node).remove();
140
+ }
141
+ return result;
142
+ }
143
+ }
144
+ }
145
+ }
146
+ if (tagName === "clipPath") {
147
+ const result = checkClipPath(node);
148
+ if (result !== void 0) {
149
+ return result;
150
+ }
151
+ }
152
+ }
153
+ }
154
+ };
155
+ const clipPath = findClipPath();
156
+ if (!clipPath) {
157
+ svg.load(backup);
158
+ return false;
159
+ }
160
+ const attribs = clipPath.attribs;
161
+ for (let i = 0; i < shapesToClip.length; i++) {
162
+ const node = shapesToClip[i];
163
+ cheerio2(node).removeAttr("clip-path");
164
+ for (const attr in attribs) {
165
+ if (node.attribs[attr] !== void 0) {
166
+ svg.load(backup);
167
+ return false;
168
+ }
169
+ cheerio2(node).attr(attr, attribs[attr]);
170
+ }
171
+ }
172
+ return true;
173
+ }
174
+
175
+ exports.removeFigmaClipPathFromSVG = removeFigmaClipPathFromSVG;
@@ -0,0 +1,11 @@
1
+ import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
3
+ import '@iconify/types';
4
+ import '@iconify/utils/lib/customisations/defaults';
5
+
6
+ /**
7
+ * Removes clip path from SVG, which Figma adds to icons that might have overflowing elements
8
+ */
9
+ declare function removeFigmaClipPathFromSVG(svg: SVG): boolean;
10
+
11
+ export { removeFigmaClipPathFromSVG };
@@ -0,0 +1,173 @@
1
+ import { defsTag, maskTags, symbolTag } from '../svg/data/tags.mjs';
2
+
3
+ function isTinyNumber(value, limit) {
4
+ const num = parseInt(value);
5
+ return !isNaN(num) && Math.abs(num) < limit;
6
+ }
7
+ function checkClipPathNode(clipNode, expectedWidth, expectedHeight) {
8
+ for (const attr in clipNode.attribs) {
9
+ if (attr !== "id") {
10
+ return false;
11
+ }
12
+ }
13
+ const children = clipNode.children.filter((node) => node.type !== "text");
14
+ if (children.length !== 1) {
15
+ return false;
16
+ }
17
+ const childNode = children[0];
18
+ if (childNode.type !== "tag" || childNode.children.length) {
19
+ return false;
20
+ }
21
+ const attribs = {
22
+ ...childNode.attribs
23
+ };
24
+ delete attribs["fill"];
25
+ const fill = (childNode.attribs["fill"] ?? "").toLowerCase();
26
+ if (fill !== "white" && fill !== "#fff" && fill !== "#ffffff") {
27
+ console.warn(
28
+ "Unxepected fill on clip path:",
29
+ childNode.attribs["fill"]
30
+ );
31
+ return false;
32
+ }
33
+ switch (childNode.tagName) {
34
+ case "rect": {
35
+ const width = parseInt(childNode.attribs["width"]);
36
+ const height = parseInt(childNode.attribs["height"]);
37
+ if (width !== expectedWidth || height !== expectedHeight) {
38
+ console.warn("Invalid size of clip path");
39
+ return false;
40
+ }
41
+ delete attribs["width"];
42
+ delete attribs["height"];
43
+ break;
44
+ }
45
+ default:
46
+ console.warn(
47
+ "Unexpected tag in Figma clip path:",
48
+ childNode.tagName
49
+ );
50
+ return false;
51
+ }
52
+ Object.keys(attribs).forEach((attr) => {
53
+ const value = attribs[attr];
54
+ switch (attr) {
55
+ case "transform": {
56
+ const translateStart = "translate(";
57
+ const translateEnd = ")";
58
+ if (value.startsWith(translateStart) && value.endsWith(translateEnd)) {
59
+ const translateParts = value.slice(translateStart.length, 0 - translateEnd.length).split(/\s+/);
60
+ const limit = Math.min(expectedWidth, expectedHeight) / 1e3;
61
+ if (translateParts.length === 2 && isTinyNumber(translateParts[0], limit) && isTinyNumber(translateParts[1], limit)) {
62
+ delete attribs[attr];
63
+ }
64
+ }
65
+ }
66
+ }
67
+ });
68
+ return {
69
+ node: clipNode,
70
+ attribs
71
+ };
72
+ }
73
+ const urlStart = "url(#";
74
+ const urlEnd = ")";
75
+ function removeFigmaClipPathFromSVG(svg) {
76
+ const cheerio2 = svg.$svg;
77
+ const $root = svg.$svg(":root");
78
+ const children = $root.children();
79
+ const backup = svg.toString();
80
+ const shapesToClip = [];
81
+ let clipID;
82
+ for (let i = 0; i < children.length; i++) {
83
+ const node = children[i];
84
+ if (node.type === "tag") {
85
+ const tagName = node.tagName;
86
+ if (!defsTag.has(tagName) && !maskTags.has(tagName) && !symbolTag.has(tagName)) {
87
+ const clipPath2 = node.attribs["clip-path"];
88
+ if (!clipPath2 || !clipPath2.startsWith(urlStart) || !clipPath2.endsWith(urlEnd)) {
89
+ return false;
90
+ }
91
+ const id = clipPath2.slice(urlStart.length, 0 - urlEnd.length);
92
+ if (typeof clipID === "string" && clipID !== id) {
93
+ return false;
94
+ }
95
+ clipID = id;
96
+ shapesToClip.push(node);
97
+ }
98
+ }
99
+ }
100
+ if (typeof clipID !== "string") {
101
+ return false;
102
+ }
103
+ const checkClipPath = (node) => {
104
+ const id = node.attribs["id"];
105
+ if (id !== clipID) {
106
+ return;
107
+ }
108
+ const result = checkClipPathNode(
109
+ node,
110
+ svg.viewBox.width,
111
+ svg.viewBox.height
112
+ );
113
+ cheerio2(node).remove();
114
+ return result;
115
+ };
116
+ const findClipPath = () => {
117
+ for (let i = 0; i < children.length; i++) {
118
+ const node = children[i];
119
+ if (node.type === "tag") {
120
+ const tagName = node.tagName;
121
+ if (defsTag.has(tagName)) {
122
+ const defsChildren = node.children;
123
+ for (let j = 0; j < defsChildren.length; j++) {
124
+ const childNode = defsChildren[j];
125
+ if (childNode.type === "tag" && childNode.tagName === "clipPath") {
126
+ const result = checkClipPath(childNode);
127
+ if (result !== void 0) {
128
+ const validChildren = node.children.filter(
129
+ (test) => {
130
+ if (test.type === "text") {
131
+ return false;
132
+ }
133
+ return true;
134
+ }
135
+ );
136
+ if (!validChildren.length) {
137
+ cheerio2(node).remove();
138
+ }
139
+ return result;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ if (tagName === "clipPath") {
145
+ const result = checkClipPath(node);
146
+ if (result !== void 0) {
147
+ return result;
148
+ }
149
+ }
150
+ }
151
+ }
152
+ };
153
+ const clipPath = findClipPath();
154
+ if (!clipPath) {
155
+ svg.load(backup);
156
+ return false;
157
+ }
158
+ const attribs = clipPath.attribs;
159
+ for (let i = 0; i < shapesToClip.length; i++) {
160
+ const node = shapesToClip[i];
161
+ cheerio2(node).removeAttr("clip-path");
162
+ for (const attr in attribs) {
163
+ if (node.attribs[attr] !== void 0) {
164
+ svg.load(backup);
165
+ return false;
166
+ }
167
+ cheerio2(node).attr(attr, attribs[attr]);
168
+ }
169
+ }
170
+ return true;
171
+ }
172
+
173
+ export { removeFigmaClipPathFromSVG };
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ const colors_parse = require('../colors/parse.cjs');
4
+ const utils = require('@iconify/utils');
5
+ require('@iconify/utils/lib/colors');
6
+ require('../svg/data/tags.cjs');
7
+ require('../svg/parse-style.cjs');
8
+ require('../css/parse.cjs');
9
+ require('../css/parser/tokens.cjs');
10
+ require('../css/parser/error.cjs');
11
+ require('../css/parser/strings.cjs');
12
+ require('../css/parser/text.cjs');
13
+ require('../css/parser/export.cjs');
14
+ require('../css/parser/tree.cjs');
15
+ require('../svg/parse.cjs');
16
+ require('../colors/attribs.cjs');
17
+ require('../svg/data/attributes.cjs');
18
+ require('../svg/analyse.cjs');
19
+ require('../svg/analyse/error.cjs');
20
+
21
+ const defaultBlackColors = ["black", "#000", "#000000"];
22
+ const defaultWhiteColors = ["white", "#fff", "#ffffff"];
23
+ const defaultOptions = {
24
+ color: "currentColor",
25
+ solid: [...defaultBlackColors, "currentcolor"],
26
+ transparent: defaultWhiteColors,
27
+ force: false,
28
+ id: "mask"
29
+ };
30
+ function convertSVGToMask(svg, options = {}) {
31
+ const props = {
32
+ ...defaultOptions,
33
+ ...options
34
+ };
35
+ const check = (test, value, color) => {
36
+ if (typeof test === "string") {
37
+ return value.toLowerCase() === test;
38
+ }
39
+ if (test instanceof Array) {
40
+ return test.includes(value.toLowerCase());
41
+ }
42
+ return test(value, color);
43
+ };
44
+ let foundSolid = false;
45
+ let foundTransparent = false;
46
+ let failed = false;
47
+ let hasCustomValue = false;
48
+ const backup = svg.toString();
49
+ colors_parse.parseColorsSync(svg, {
50
+ callback: (attr, colorStr, color) => {
51
+ if (!color || colors_parse.isEmptyColor(color)) {
52
+ return colorStr;
53
+ }
54
+ if (props.custom) {
55
+ let customValue = props.custom(colorStr.toLowerCase(), color);
56
+ if (typeof customValue === "number") {
57
+ const num = Math.max(
58
+ Math.min(Math.round(customValue * 255), 255),
59
+ 0
60
+ );
61
+ let str = num.toString(16);
62
+ if (str.length < 2) {
63
+ str = "0" + str;
64
+ }
65
+ if (str[0] === str[1]) {
66
+ str = str[0];
67
+ }
68
+ customValue = "#" + str + str + str;
69
+ }
70
+ if (typeof customValue === "string") {
71
+ if (defaultBlackColors.includes(customValue)) {
72
+ foundSolid = true;
73
+ } else if (defaultWhiteColors.includes(customValue)) {
74
+ foundTransparent = true;
75
+ } else {
76
+ hasCustomValue = true;
77
+ }
78
+ return customValue;
79
+ }
80
+ }
81
+ if (check(props.solid, colorStr, color)) {
82
+ foundSolid = true;
83
+ return "#fff";
84
+ }
85
+ if (check(props.transparent, colorStr, color)) {
86
+ foundTransparent = true;
87
+ return "#000";
88
+ }
89
+ failed = true;
90
+ console.warn("Unexpected color:", colorStr);
91
+ return color;
92
+ }
93
+ });
94
+ const hasColors = hasCustomValue || foundSolid && foundTransparent;
95
+ if (failed || !hasColors && !props.force) {
96
+ svg.load(backup);
97
+ return false;
98
+ }
99
+ const parsed = utils.parseSVGContent(svg.toString());
100
+ if (!parsed) {
101
+ return false;
102
+ }
103
+ const { defs, content } = utils.splitSVGDefs(parsed.body);
104
+ const newBody = `<defs>${defs}<mask id="${props.id}">${content}</mask></defs><rect mask="url(#${props.id})" ${svg.viewBox.left ? `x=${svg.viewBox.left} ` : ""}${svg.viewBox.top ? `y=${svg.viewBox.top} ` : ""}width="${svg.viewBox.width}" height="${svg.viewBox.height}" fill="${props.color}" />`;
105
+ const newContent = utils.iconToHTML(newBody, parsed.attribs);
106
+ svg.load(newContent);
107
+ return true;
108
+ }
109
+
110
+ exports.convertSVGToMask = convertSVGToMask;
@@ -0,0 +1,24 @@
1
+ import { Color } from '@iconify/utils/lib/colors/types';
2
+ import { SVG } from '../svg/index.js';
3
+ import 'cheerio';
4
+ import '@iconify/types';
5
+ import '@iconify/utils/lib/customisations/defaults';
6
+
7
+ type ColorCallback = (value: string, color: Color | null) => boolean;
8
+ type ColorCheck = string | string[] | ColorCallback;
9
+ interface SVGToMaskOptions {
10
+ color?: string;
11
+ solid?: ColorCheck;
12
+ transparent?: ColorCheck;
13
+ custom?: (value: string, color: Color | null) => string | number | undefined;
14
+ force?: boolean;
15
+ id?: string;
16
+ }
17
+ /**
18
+ * Converts SVG to mask
19
+ *
20
+ * Fixes badly designed icons, which use white shape where icon supposed to be transparent
21
+ */
22
+ declare function convertSVGToMask(svg: SVG, options?: SVGToMaskOptions): boolean;
23
+
24
+ export { convertSVGToMask };
@@ -0,0 +1,108 @@
1
+ import { parseColorsSync, isEmptyColor } from '../colors/parse.mjs';
2
+ import { parseSVGContent, splitSVGDefs, iconToHTML } from '@iconify/utils';
3
+ import '@iconify/utils/lib/colors';
4
+ import '../svg/data/tags.mjs';
5
+ import '../svg/parse-style.mjs';
6
+ import '../css/parse.mjs';
7
+ import '../css/parser/tokens.mjs';
8
+ import '../css/parser/error.mjs';
9
+ import '../css/parser/strings.mjs';
10
+ import '../css/parser/text.mjs';
11
+ import '../css/parser/export.mjs';
12
+ import '../css/parser/tree.mjs';
13
+ import '../svg/parse.mjs';
14
+ import '../colors/attribs.mjs';
15
+ import '../svg/data/attributes.mjs';
16
+ import '../svg/analyse.mjs';
17
+ import '../svg/analyse/error.mjs';
18
+
19
+ const defaultBlackColors = ["black", "#000", "#000000"];
20
+ const defaultWhiteColors = ["white", "#fff", "#ffffff"];
21
+ const defaultOptions = {
22
+ color: "currentColor",
23
+ solid: [...defaultBlackColors, "currentcolor"],
24
+ transparent: defaultWhiteColors,
25
+ force: false,
26
+ id: "mask"
27
+ };
28
+ function convertSVGToMask(svg, options = {}) {
29
+ const props = {
30
+ ...defaultOptions,
31
+ ...options
32
+ };
33
+ const check = (test, value, color) => {
34
+ if (typeof test === "string") {
35
+ return value.toLowerCase() === test;
36
+ }
37
+ if (test instanceof Array) {
38
+ return test.includes(value.toLowerCase());
39
+ }
40
+ return test(value, color);
41
+ };
42
+ let foundSolid = false;
43
+ let foundTransparent = false;
44
+ let failed = false;
45
+ let hasCustomValue = false;
46
+ const backup = svg.toString();
47
+ parseColorsSync(svg, {
48
+ callback: (attr, colorStr, color) => {
49
+ if (!color || isEmptyColor(color)) {
50
+ return colorStr;
51
+ }
52
+ if (props.custom) {
53
+ let customValue = props.custom(colorStr.toLowerCase(), color);
54
+ if (typeof customValue === "number") {
55
+ const num = Math.max(
56
+ Math.min(Math.round(customValue * 255), 255),
57
+ 0
58
+ );
59
+ let str = num.toString(16);
60
+ if (str.length < 2) {
61
+ str = "0" + str;
62
+ }
63
+ if (str[0] === str[1]) {
64
+ str = str[0];
65
+ }
66
+ customValue = "#" + str + str + str;
67
+ }
68
+ if (typeof customValue === "string") {
69
+ if (defaultBlackColors.includes(customValue)) {
70
+ foundSolid = true;
71
+ } else if (defaultWhiteColors.includes(customValue)) {
72
+ foundTransparent = true;
73
+ } else {
74
+ hasCustomValue = true;
75
+ }
76
+ return customValue;
77
+ }
78
+ }
79
+ if (check(props.solid, colorStr, color)) {
80
+ foundSolid = true;
81
+ return "#fff";
82
+ }
83
+ if (check(props.transparent, colorStr, color)) {
84
+ foundTransparent = true;
85
+ return "#000";
86
+ }
87
+ failed = true;
88
+ console.warn("Unexpected color:", colorStr);
89
+ return color;
90
+ }
91
+ });
92
+ const hasColors = hasCustomValue || foundSolid && foundTransparent;
93
+ if (failed || !hasColors && !props.force) {
94
+ svg.load(backup);
95
+ return false;
96
+ }
97
+ const parsed = parseSVGContent(svg.toString());
98
+ if (!parsed) {
99
+ return false;
100
+ }
101
+ const { defs, content } = splitSVGDefs(parsed.body);
102
+ const newBody = `<defs>${defs}<mask id="${props.id}">${content}</mask></defs><rect mask="url(#${props.id})" ${svg.viewBox.left ? `x=${svg.viewBox.left} ` : ""}${svg.viewBox.top ? `y=${svg.viewBox.top} ` : ""}width="${svg.viewBox.width}" height="${svg.viewBox.height}" fill="${props.color}" />`;
103
+ const newContent = iconToHTML(newBody, parsed.attribs);
104
+ svg.load(newContent);
105
+ return true;
106
+ }
107
+
108
+ export { convertSVGToMask };
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,5 +1,6 @@
1
1
  import { PluginConfig } from 'svgo';
2
2
  import { SVG } from '../svg/index.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
@@ -1,4 +1,5 @@
1
1
  import { ExtendedTagElement } from './types.js';
2
+ import 'cheerio';
2
3
 
3
4
  /**
4
5
  * Get tag for error message
@@ -1,3 +1,5 @@
1
+ import * as cheerio from 'cheerio';
2
+
1
3
  /**
2
4
  * Options
3
5
  */
@@ -50,7 +52,7 @@ interface ExtendedTagElementRelations {
50
52
  /**
51
53
  * Extended tag
52
54
  */
53
- interface ExtendedTagElement extends cheerio.TagElement, ExtendedTagElementUses, ExtendedTagElementRelations {
55
+ interface ExtendedTagElement extends cheerio.Element, ExtendedTagElementUses, ExtendedTagElementRelations {
54
56
  _index: number;
55
57
  _id?: string;
56
58
  _belongsTo?: ElementWithID[];
@@ -1,5 +1,6 @@
1
1
  import { SVG } from './index.js';
2
2
  import { AnalyseSVGStructureOptions, AnalyseSVGStructureResult } from './analyse/types.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -4,7 +4,7 @@ const svg_data_attributes = require('../data/attributes.cjs');
4
4
  const svg_data_tags = require('../data/tags.cjs');
5
5
 
6
6
  function cleanupSVGRoot(svg) {
7
- const cheerio = svg.$svg;
7
+ const cheerio2 = svg.$svg;
8
8
  const $root = svg.$svg(":root");
9
9
  const root = $root.get(0);
10
10
  const tagName = "svg";
@@ -61,12 +61,12 @@ function cleanupSVGRoot(svg) {
61
61
  $root.removeAttr(attr);
62
62
  });
63
63
  if (Object.keys(moveToChildren).length) {
64
- const $wrapper = cheerio("<g />");
64
+ const $wrapper = cheerio2("<g />");
65
65
  for (const key in moveToChildren) {
66
66
  $wrapper.attr(key, moveToChildren[key]);
67
67
  }
68
68
  $root.children().each((_index, child) => {
69
- const $child = cheerio(child);
69
+ const $child = cheerio2(child);
70
70
  if (child.type !== "tag") {
71
71
  $child.appendTo($wrapper);
72
72
  return;
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -2,7 +2,7 @@ import { commonAttributes, badAttributes, junkSVGAttributes, badSoftwareAttribut
2
2
  import { reusableElementsWithPalette, maskTags } from '../data/tags.mjs';
3
3
 
4
4
  function cleanupSVGRoot(svg) {
5
- const cheerio = svg.$svg;
5
+ const cheerio2 = svg.$svg;
6
6
  const $root = svg.$svg(":root");
7
7
  const root = $root.get(0);
8
8
  const tagName = "svg";
@@ -59,12 +59,12 @@ function cleanupSVGRoot(svg) {
59
59
  $root.removeAttr(attr);
60
60
  });
61
61
  if (Object.keys(moveToChildren).length) {
62
- const $wrapper = cheerio("<g />");
62
+ const $wrapper = cheerio2("<g />");
63
63
  for (const key in moveToChildren) {
64
64
  $wrapper.attr(key, moveToChildren[key]);
65
65
  }
66
66
  $root.children().each((_index, child) => {
67
- const $child = cheerio(child);
67
+ const $child = cheerio2(child);
68
68
  if (child.type !== "tag") {
69
69
  $child.appendTo($wrapper);
70
70
  return;
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,5 +1,6 @@
1
1
  import { SVG } from './index.js';
2
2
  import { CheckBadTagsOptions } from './cleanup/bad-tags.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
package/lib/svg/index.cjs CHANGED
@@ -3,9 +3,19 @@
3
3
  const cheerio = require('cheerio');
4
4
  const utils = require('@iconify/utils');
5
5
 
6
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
6
+ function _interopNamespaceCompat(e) {
7
+ if (e && typeof e === 'object' && 'default' in e) return e;
8
+ const n = Object.create(null);
9
+ if (e) {
10
+ for (const k in e) {
11
+ n[k] = e[k];
12
+ }
13
+ }
14
+ n.default = e;
15
+ return n;
16
+ }
7
17
 
8
- const cheerio__default = /*#__PURE__*/_interopDefaultCompat(cheerio);
18
+ const cheerio__namespace = /*#__PURE__*/_interopNamespaceCompat(cheerio);
9
19
 
10
20
  class SVG {
11
21
  /**
@@ -108,7 +118,7 @@ class SVG {
108
118
  );
109
119
  remove('xml:space="preserve"', "", "");
110
120
  content = content.replace(/<g>\s*<\/g>/g, "");
111
- this.$svg = cheerio__default.load(content.trim(), {
121
+ this.$svg = cheerio__namespace.load(content.trim(), {
112
122
  lowerCaseAttributeNames: false,
113
123
  xmlMode: true
114
124
  });
@@ -1,3 +1,4 @@
1
+ import * as cheerio from 'cheerio';
1
2
  import { IconifyIcon } from '@iconify/types';
2
3
  export { IconifyIcon } from '@iconify/types';
3
4
  import { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
@@ -14,7 +15,7 @@ interface ViewBox {
14
15
  * SVG class, used to manipulate icon content.
15
16
  */
16
17
  declare class SVG {
17
- $svg: cheerio.Root;
18
+ $svg: cheerio.CheerioAPI;
18
19
  viewBox: ViewBox;
19
20
  /**
20
21
  * Constructor
package/lib/svg/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import cheerio from 'cheerio';
1
+ import * as cheerio from 'cheerio';
2
2
  import { iconToSVG, trimSVG } from '@iconify/utils';
3
3
 
4
4
  class SVG {
@@ -1,6 +1,7 @@
1
1
  import { SVG } from './index.js';
2
2
  import { CSSRuleToken, CSSToken, CSSAtRuleToken } from '../css/parser/types.js';
3
3
  import { ParseSVGCallbackItem } from './parse.js';
4
+ import 'cheerio';
4
5
  import '@iconify/types';
5
6
  import '@iconify/utils/lib/customisations/defaults';
6
7
  import '../misc/cheerio.js';
package/lib/svg/parse.cjs CHANGED
@@ -5,7 +5,7 @@ function parse(svg, callback, done) {
5
5
  if (element.type !== "tag") {
6
6
  return done2();
7
7
  }
8
- const $element = cheerio(element);
8
+ const $element = cheerio2(element);
9
9
  const tagName = element.tagName;
10
10
  const item = {
11
11
  tagName,
@@ -37,7 +37,7 @@ function parse(svg, callback, done) {
37
37
  next();
38
38
  });
39
39
  }
40
- const cheerio = svg.$svg;
40
+ const cheerio2 = svg.$svg;
41
41
  const $root = svg.$svg(":root");
42
42
  checkNode($root.get(0), [], done);
43
43
  }
@@ -1,5 +1,6 @@
1
1
  import { CheerioElement, WrappedCheerioElement } from '../misc/cheerio.js';
2
2
  import { SVG } from './index.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
package/lib/svg/parse.mjs CHANGED
@@ -3,7 +3,7 @@ function parse(svg, callback, done) {
3
3
  if (element.type !== "tag") {
4
4
  return done2();
5
5
  }
6
- const $element = cheerio(element);
6
+ const $element = cheerio2(element);
7
7
  const tagName = element.tagName;
8
8
  const item = {
9
9
  tagName,
@@ -35,7 +35,7 @@ function parse(svg, callback, done) {
35
35
  next();
36
36
  });
37
37
  }
38
- const cheerio = svg.$svg;
38
+ const cheerio2 = svg.$svg;
39
39
  const $root = svg.$svg(":root");
40
40
  checkNode($root.get(0), [], done);
41
41
  }
package/package.json CHANGED
@@ -3,7 +3,10 @@
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": "3.0.5",
6
+ "version": "4.0.0-dev.1",
7
+ "publishConfig": {
8
+ "tag": "next"
9
+ },
7
10
  "license": "MIT",
8
11
  "bugs": "https://github.com/iconify/tools/issues",
9
12
  "homepage": "https://github.com/iconify/tools",
@@ -16,32 +19,31 @@
16
19
  "types": "./lib/index.d.ts",
17
20
  "dependencies": {
18
21
  "@iconify/types": "^2.0.0",
19
- "@iconify/utils": "^2.1.7",
20
- "@types/cheerio": "^0.22.31",
21
- "@types/tar": "^6.1.5",
22
- "cheerio": "^1.0.0-rc.12",
22
+ "@iconify/utils": "^2.1.12",
23
+ "@types/tar": "^6.1.10",
24
+ "cheerio": "1.0.0-rc.12",
23
25
  "extract-zip": "^2.0.1",
24
26
  "local-pkg": "^0.4.3",
25
27
  "pathe": "^1.1.1",
26
- "svgo": "^3.0.2",
27
- "tar": "^6.1.15"
28
+ "svgo": "^3.0.4",
29
+ "tar": "^6.2.0"
28
30
  },
29
31
  "devDependencies": {
30
- "@types/jest": "^29.5.3",
31
- "@types/node": "^18.17.3",
32
+ "@types/jest": "^29.5.10",
33
+ "@types/node": "^18.18.13",
32
34
  "@typescript-eslint/eslint-plugin": "^5.62.0",
33
35
  "@typescript-eslint/parser": "^5.62.0",
34
36
  "cross-env": "^7.0.3",
35
- "eslint": "^8.46.0",
37
+ "eslint": "^8.54.0",
36
38
  "eslint-config-prettier": "^8.10.0",
37
39
  "eslint-plugin-jasmine": "^4.1.3",
38
40
  "eslint-plugin-prettier": "^4.2.1",
39
41
  "jasmine": "^5.1.0",
40
- "jest": "^29.6.2",
42
+ "jest": "^29.7.0",
41
43
  "prettier": "^2.8.8",
42
- "rimraf": "^5.0.1",
44
+ "rimraf": "^5.0.5",
43
45
  "ts-jest": "^29.1.1",
44
- "typescript": "^5.1.6",
46
+ "typescript": "^5.3.2",
45
47
  "unbuild": "^1.2.1"
46
48
  },
47
49
  "exports": {
@@ -411,6 +413,11 @@
411
413
  "require": "./lib/misc/write-json.cjs",
412
414
  "import": "./lib/misc/write-json.mjs"
413
415
  },
416
+ "./lib/optimise/figma": {
417
+ "types": "./lib/optimise/figma.d.ts",
418
+ "require": "./lib/optimise/figma.cjs",
419
+ "import": "./lib/optimise/figma.mjs"
420
+ },
414
421
  "./lib/optimise/flags": {
415
422
  "types": "./lib/optimise/flags.d.ts",
416
423
  "require": "./lib/optimise/flags.cjs",
@@ -421,6 +428,11 @@
421
428
  "require": "./lib/optimise/global-style.cjs",
422
429
  "import": "./lib/optimise/global-style.mjs"
423
430
  },
431
+ "./lib/optimise/mask": {
432
+ "types": "./lib/optimise/mask.d.ts",
433
+ "require": "./lib/optimise/mask.cjs",
434
+ "import": "./lib/optimise/mask.mjs"
435
+ },
424
436
  "./lib/optimise/origin": {
425
437
  "types": "./lib/optimise/origin.d.ts",
426
438
  "require": "./lib/optimise/origin.cjs",