@iconify/tools 2.0.14 → 2.0.15

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 (309) hide show
  1. package/lib/colors/attribs.cjs +30 -0
  2. package/lib/colors/attribs.d.ts +13 -10
  3. package/lib/colors/attribs.mjs +7 -13
  4. package/lib/colors/parse.cjs +269 -0
  5. package/lib/colors/parse.d.ts +15 -11
  6. package/lib/colors/parse.mjs +27 -31
  7. package/lib/colors/validate.cjs +52 -0
  8. package/lib/colors/validate.d.ts +11 -4
  9. package/lib/colors/validate.mjs +19 -6
  10. package/lib/css/parse.cjs +26 -0
  11. package/lib/css/parse.d.ts +3 -1
  12. package/lib/css/parse.mjs +8 -6
  13. package/lib/css/parser/error.cjs +25 -0
  14. package/lib/css/parser/error.d.ts +4 -2
  15. package/lib/css/parser/error.mjs +2 -4
  16. package/lib/css/parser/export.cjs +48 -0
  17. package/lib/css/parser/export.d.ts +5 -2
  18. package/lib/css/parser/export.mjs +4 -6
  19. package/lib/css/parser/strings.cjs +77 -0
  20. package/lib/css/parser/strings.d.ts +6 -3
  21. package/lib/css/parser/strings.mjs +4 -6
  22. package/lib/css/parser/text.cjs +135 -0
  23. package/lib/css/parser/text.d.ts +8 -5
  24. package/lib/css/parser/text.mjs +3 -8
  25. package/lib/css/parser/tokens.cjs +184 -0
  26. package/lib/css/parser/tokens.d.ts +6 -3
  27. package/lib/css/parser/tokens.mjs +7 -13
  28. package/lib/css/parser/tree.cjs +42 -0
  29. package/lib/css/parser/tree.d.ts +5 -2
  30. package/lib/css/parser/tree.mjs +2 -4
  31. package/lib/css/parser/types.cjs +2 -0
  32. package/lib/css/parser/types.d.ts +13 -11
  33. package/lib/css/parser/types.mjs +1 -0
  34. package/lib/download/api/cache.cjs +86 -0
  35. package/lib/download/api/cache.d.ts +8 -5
  36. package/lib/download/api/cache.mjs +14 -19
  37. package/lib/download/api/download.cjs +28 -0
  38. package/lib/download/api/download.d.ts +5 -2
  39. package/lib/download/api/download.mjs +8 -9
  40. package/lib/download/api/index.cjs +51 -0
  41. package/lib/download/api/index.d.ts +5 -2
  42. package/lib/download/api/index.mjs +8 -6
  43. package/lib/download/api/types.cjs +2 -0
  44. package/lib/download/api/types.d.ts +4 -2
  45. package/lib/download/api/types.mjs +1 -0
  46. package/lib/download/git/branch.cjs +22 -0
  47. package/lib/download/git/branch.d.ts +5 -2
  48. package/lib/download/git/branch.mjs +5 -5
  49. package/lib/download/git/hash.cjs +15 -0
  50. package/lib/download/git/hash.d.ts +5 -2
  51. package/lib/download/git/hash.mjs +5 -5
  52. package/lib/download/git/index.cjs +76 -0
  53. package/lib/download/git/index.d.ts +10 -8
  54. package/lib/download/git/index.mjs +41 -26
  55. package/lib/download/git/reset.cjs +41 -0
  56. package/lib/download/git/reset.d.ts +3 -1
  57. package/lib/download/git/reset.mjs +29 -5
  58. package/lib/download/github/hash.cjs +32 -0
  59. package/lib/download/github/hash.d.ts +5 -2
  60. package/lib/download/github/hash.mjs +10 -7
  61. package/lib/download/github/index.cjs +98 -0
  62. package/lib/download/github/index.d.ts +11 -9
  63. package/lib/download/github/index.mjs +23 -17
  64. package/lib/download/github/types.cjs +2 -0
  65. package/lib/download/github/types.d.ts +3 -1
  66. package/lib/download/github/types.mjs +1 -0
  67. package/lib/download/gitlab/hash.cjs +32 -0
  68. package/lib/download/gitlab/hash.d.ts +5 -2
  69. package/lib/download/gitlab/hash.mjs +10 -6
  70. package/lib/download/gitlab/index.cjs +98 -0
  71. package/lib/download/gitlab/index.d.ts +11 -9
  72. package/lib/download/gitlab/index.mjs +24 -18
  73. package/lib/download/gitlab/types.cjs +7 -0
  74. package/lib/download/gitlab/types.d.ts +4 -2
  75. package/lib/download/gitlab/types.mjs +3 -5
  76. package/lib/download/helpers/untar.cjs +14 -0
  77. package/lib/download/helpers/untar.d.ts +3 -1
  78. package/lib/download/helpers/untar.mjs +4 -5
  79. package/lib/download/helpers/unzip.cjs +19 -0
  80. package/lib/download/helpers/unzip.d.ts +3 -1
  81. package/lib/download/helpers/unzip.mjs +6 -7
  82. package/lib/download/index.cjs +64 -0
  83. package/lib/download/index.d.ts +18 -13
  84. package/lib/download/index.mjs +46 -19
  85. package/lib/download/npm/index.cjs +82 -0
  86. package/lib/download/npm/index.d.ts +10 -8
  87. package/lib/download/npm/index.mjs +16 -13
  88. package/lib/download/npm/types.cjs +2 -0
  89. package/lib/download/npm/types.d.ts +3 -1
  90. package/lib/download/npm/types.mjs +1 -0
  91. package/lib/download/npm/version.cjs +23 -0
  92. package/lib/download/npm/version.d.ts +7 -4
  93. package/lib/download/npm/version.mjs +8 -10
  94. package/lib/download/types/modified.cjs +2 -0
  95. package/lib/download/types/modified.d.ts +3 -1
  96. package/lib/download/types/modified.mjs +1 -0
  97. package/lib/download/types/sources.cjs +2 -0
  98. package/lib/download/types/sources.d.ts +4 -2
  99. package/lib/download/types/sources.mjs +1 -0
  100. package/lib/export/directory.cjs +45 -0
  101. package/lib/export/directory.d.ts +11 -4
  102. package/lib/export/directory.mjs +8 -8
  103. package/lib/export/helpers/custom-files.cjs +28 -0
  104. package/lib/export/helpers/custom-files.d.ts +4 -2
  105. package/lib/export/helpers/custom-files.mjs +8 -9
  106. package/lib/export/helpers/prepare.cjs +36 -0
  107. package/lib/export/helpers/prepare.d.ts +5 -3
  108. package/lib/export/helpers/prepare.mjs +7 -9
  109. package/lib/export/helpers/types-version.cjs +22 -0
  110. package/lib/export/helpers/types-version.d.ts +3 -1
  111. package/lib/export/helpers/types-version.mjs +15 -37
  112. package/lib/export/icon-package.cjs +59 -0
  113. package/lib/export/icon-package.d.ts +12 -5
  114. package/lib/export/icon-package.mjs +15 -16
  115. package/lib/export/json-package.cjs +133 -0
  116. package/lib/export/json-package.d.ts +12 -5
  117. package/lib/export/json-package.mjs +20 -21
  118. package/lib/icon-set/index.cjs +589 -0
  119. package/lib/icon-set/index.d.ts +9 -6
  120. package/lib/icon-set/index.mjs +40 -53
  121. package/lib/icon-set/match.cjs +58 -0
  122. package/lib/icon-set/match.d.ts +10 -3
  123. package/lib/icon-set/match.mjs +5 -6
  124. package/lib/icon-set/merge.cjs +83 -0
  125. package/lib/icon-set/merge.d.ts +9 -2
  126. package/lib/icon-set/merge.mjs +15 -10
  127. package/lib/icon-set/props.cjs +28 -0
  128. package/lib/icon-set/props.d.ts +8 -4
  129. package/lib/icon-set/props.mjs +7 -10
  130. package/lib/icon-set/types.cjs +2 -0
  131. package/lib/icon-set/types.d.ts +19 -17
  132. package/lib/icon-set/types.mjs +1 -0
  133. package/lib/import/directory.cjs +76 -0
  134. package/lib/import/directory.d.ts +11 -5
  135. package/lib/import/directory.mjs +36 -11
  136. package/lib/import/figma/index.cjs +105 -0
  137. package/lib/import/figma/index.d.ts +15 -5
  138. package/lib/import/figma/index.mjs +40 -13
  139. package/lib/import/figma/nodes.cjs +86 -0
  140. package/lib/import/figma/nodes.d.ts +13 -4
  141. package/lib/import/figma/nodes.mjs +3 -11
  142. package/lib/import/figma/query.cjs +218 -0
  143. package/lib/import/figma/query.d.ts +18 -9
  144. package/lib/import/figma/query.mjs +9 -12
  145. package/lib/import/figma/types/api.cjs +2 -0
  146. package/lib/import/figma/types/api.d.ts +8 -7
  147. package/lib/import/figma/types/api.mjs +1 -0
  148. package/lib/import/figma/types/nodes.cjs +2 -0
  149. package/lib/import/figma/types/nodes.d.ts +16 -9
  150. package/lib/import/figma/types/nodes.mjs +1 -0
  151. package/lib/import/figma/types/options.cjs +2 -0
  152. package/lib/import/figma/types/options.d.ts +17 -10
  153. package/lib/import/figma/types/options.mjs +1 -0
  154. package/lib/import/figma/types/result.cjs +2 -0
  155. package/lib/import/figma/types/result.d.ts +12 -5
  156. package/lib/import/figma/types/result.mjs +1 -0
  157. package/lib/index.cjs +137 -0
  158. package/lib/index.d.ts +65 -44
  159. package/lib/index.mjs +83 -94
  160. package/lib/misc/bump-version.cjs +17 -0
  161. package/lib/misc/bump-version.d.ts +3 -1
  162. package/lib/misc/bump-version.mjs +2 -4
  163. package/lib/misc/compare-dirs.cjs +75 -0
  164. package/lib/misc/compare-dirs.d.ts +4 -2
  165. package/lib/misc/compare-dirs.mjs +12 -12
  166. package/lib/misc/exec.cjs +25 -0
  167. package/lib/misc/exec.d.ts +6 -4
  168. package/lib/misc/exec.mjs +4 -5
  169. package/lib/misc/keyword.cjs +19 -0
  170. package/lib/misc/keyword.d.ts +3 -1
  171. package/lib/misc/keyword.mjs +2 -4
  172. package/lib/misc/scan.cjs +51 -0
  173. package/lib/misc/scan.d.ts +7 -6
  174. package/lib/misc/scan.mjs +6 -7
  175. package/lib/misc/write-json.cjs +11 -0
  176. package/lib/misc/write-json.d.ts +3 -1
  177. package/lib/misc/write-json.mjs +5 -6
  178. package/lib/optimise/flags.cjs +252 -0
  179. package/lib/optimise/flags.d.ts +7 -2
  180. package/lib/optimise/flags.mjs +18 -19
  181. package/lib/optimise/global-style.cjs +154 -0
  182. package/lib/optimise/global-style.d.ts +7 -2
  183. package/lib/optimise/global-style.mjs +18 -15
  184. package/lib/optimise/scale.cjs +26 -0
  185. package/lib/optimise/scale.d.ts +7 -2
  186. package/lib/optimise/scale.mjs +5 -5
  187. package/lib/optimise/svgo.cjs +83 -0
  188. package/lib/optimise/svgo.d.ts +10 -6
  189. package/lib/optimise/svgo.mjs +6 -9
  190. package/lib/svg/analyse/error.cjs +18 -0
  191. package/lib/svg/analyse/error.d.ts +5 -2
  192. package/lib/svg/analyse/error.mjs +2 -4
  193. package/lib/svg/analyse/types.cjs +2 -0
  194. package/lib/svg/analyse/types.d.ts +11 -11
  195. package/lib/svg/analyse/types.mjs +1 -0
  196. package/lib/svg/analyse.cjs +291 -0
  197. package/lib/svg/analyse.d.ts +8 -3
  198. package/lib/svg/analyse.mjs +15 -30
  199. package/lib/svg/cleanup/attribs.cjs +41 -0
  200. package/lib/svg/cleanup/attribs.d.ts +7 -2
  201. package/lib/svg/cleanup/attribs.mjs +6 -12
  202. package/lib/svg/cleanup/bad-tags.cjs +51 -0
  203. package/lib/svg/cleanup/bad-tags.d.ts +7 -2
  204. package/lib/svg/cleanup/bad-tags.mjs +10 -25
  205. package/lib/svg/cleanup/inline-style.cjs +64 -0
  206. package/lib/svg/cleanup/inline-style.d.ts +7 -2
  207. package/lib/svg/cleanup/inline-style.mjs +14 -19
  208. package/lib/svg/cleanup/root-svg.cjs +81 -0
  209. package/lib/svg/cleanup/root-svg.d.ts +7 -2
  210. package/lib/svg/cleanup/root-svg.mjs +7 -18
  211. package/lib/svg/cleanup/svgo-style.cjs +38 -0
  212. package/lib/svg/cleanup/svgo-style.d.ts +7 -2
  213. package/lib/svg/cleanup/svgo-style.mjs +16 -11
  214. package/lib/svg/cleanup.cjs +32 -0
  215. package/lib/svg/cleanup.d.ts +7 -2
  216. package/lib/svg/cleanup.mjs +21 -9
  217. package/lib/svg/data/attributes.cjs +355 -0
  218. package/lib/svg/data/attributes.d.ts +27 -25
  219. package/lib/svg/data/attributes.mjs +90 -115
  220. package/lib/svg/data/tags.cjs +137 -0
  221. package/lib/svg/data/tags.d.ts +25 -23
  222. package/lib/svg/data/tags.mjs +25 -49
  223. package/lib/svg/index.cjs +130 -0
  224. package/lib/svg/index.d.ts +16 -5
  225. package/lib/svg/index.mjs +48 -14
  226. package/lib/svg/parse-style.cjs +134 -0
  227. package/lib/svg/parse-style.d.ts +12 -8
  228. package/lib/svg/parse-style.mjs +11 -9
  229. package/lib/svg/parse.cjs +42 -0
  230. package/lib/svg/parse.d.ts +11 -7
  231. package/lib/svg/parse.mjs +2 -4
  232. package/package.json +99 -94
  233. package/lib/colors/attribs.js +0 -26
  234. package/lib/colors/parse.js +0 -341
  235. package/lib/colors/validate.js +0 -48
  236. package/lib/css/parse.js +0 -23
  237. package/lib/css/parser/error.js +0 -27
  238. package/lib/css/parser/export.js +0 -69
  239. package/lib/css/parser/strings.js +0 -93
  240. package/lib/css/parser/text.js +0 -171
  241. package/lib/css/parser/tokens.js +0 -200
  242. package/lib/css/parser/tree.js +0 -44
  243. package/lib/css/parser/types.js +0 -2
  244. package/lib/download/api/cache.js +0 -108
  245. package/lib/download/api/download.js +0 -27
  246. package/lib/download/api/index.js +0 -52
  247. package/lib/download/api/types.js +0 -2
  248. package/lib/download/git/branch.js +0 -22
  249. package/lib/download/git/hash.js +0 -14
  250. package/lib/download/git/index.js +0 -75
  251. package/lib/download/git/reset.js +0 -16
  252. package/lib/download/github/hash.js +0 -28
  253. package/lib/download/github/index.js +0 -116
  254. package/lib/download/github/types.js +0 -2
  255. package/lib/download/gitlab/hash.js +0 -27
  256. package/lib/download/gitlab/index.js +0 -115
  257. package/lib/download/gitlab/types.js +0 -7
  258. package/lib/download/helpers/untar.js +0 -14
  259. package/lib/download/helpers/unzip.js +0 -18
  260. package/lib/download/index.js +0 -27
  261. package/lib/download/npm/index.js +0 -91
  262. package/lib/download/npm/types.js +0 -2
  263. package/lib/download/npm/version.js +0 -27
  264. package/lib/download/types/modified.js +0 -2
  265. package/lib/download/types/sources.js +0 -2
  266. package/lib/export/directory.js +0 -52
  267. package/lib/export/helpers/custom-files.js +0 -32
  268. package/lib/export/helpers/prepare.js +0 -49
  269. package/lib/export/helpers/types-version.js +0 -12
  270. package/lib/export/icon-package.js +0 -77
  271. package/lib/export/json-package.js +0 -156
  272. package/lib/icon-set/index.js +0 -749
  273. package/lib/icon-set/match.js +0 -66
  274. package/lib/icon-set/merge.js +0 -90
  275. package/lib/icon-set/props.js +0 -34
  276. package/lib/icon-set/types.js +0 -2
  277. package/lib/import/directory.js +0 -59
  278. package/lib/import/figma/index.js +0 -90
  279. package/lib/import/figma/nodes.js +0 -106
  280. package/lib/import/figma/query.js +0 -244
  281. package/lib/import/figma/types/api.js +0 -12
  282. package/lib/import/figma/types/nodes.js +0 -2
  283. package/lib/import/figma/types/options.js +0 -2
  284. package/lib/import/figma/types/result.js +0 -2
  285. package/lib/index.js +0 -103
  286. package/lib/misc/bump-version.js +0 -19
  287. package/lib/misc/compare-dirs.js +0 -84
  288. package/lib/misc/exec.js +0 -26
  289. package/lib/misc/keyword.js +0 -31
  290. package/lib/misc/scan.js +0 -55
  291. package/lib/misc/write-json.js +0 -11
  292. package/lib/optimise/flags.js +0 -312
  293. package/lib/optimise/global-style.js +0 -185
  294. package/lib/optimise/scale.js +0 -42
  295. package/lib/optimise/svgo.js +0 -99
  296. package/lib/svg/analyse/error.js +0 -22
  297. package/lib/svg/analyse/types.js +0 -2
  298. package/lib/svg/analyse.js +0 -352
  299. package/lib/svg/cleanup/attribs.js +0 -51
  300. package/lib/svg/cleanup/bad-tags.js +0 -65
  301. package/lib/svg/cleanup/inline-style.js +0 -77
  302. package/lib/svg/cleanup/root-svg.js +0 -107
  303. package/lib/svg/cleanup/svgo-style.js +0 -35
  304. package/lib/svg/cleanup.js +0 -24
  305. package/lib/svg/data/attributes.js +0 -403
  306. package/lib/svg/data/tags.js +0 -188
  307. package/lib/svg/index.js +0 -134
  308. package/lib/svg/parse-style.js +0 -151
  309. package/lib/svg/parse.js +0 -49
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cleanupSVG = void 0;
4
- const attribs_1 = require("./cleanup/attribs");
5
- const bad_tags_1 = require("./cleanup/bad-tags");
6
- const inline_style_1 = require("./cleanup/inline-style");
7
- const root_svg_1 = require("./cleanup/root-svg");
8
- const svgo_style_1 = require("./cleanup/svgo-style");
9
- /**
10
- * Clean up SVG before parsing/optimising it
11
- */
12
- async function cleanupSVG(svg) {
13
- // Remove junk from style
14
- await (0, inline_style_1.cleanupInlineStyle)(svg);
15
- // Expand style
16
- await (0, svgo_style_1.convertStyleToAttrs)(svg);
17
- // Cleanup <svg> element
18
- await (0, root_svg_1.cleanupSVGRoot)(svg);
19
- // Check for bad tags
20
- await (0, bad_tags_1.checkBadTags)(svg);
21
- // Remove attributes
22
- await (0, attribs_1.removeBadAttributes)(svg);
23
- }
24
- exports.cleanupSVG = cleanupSVG;
@@ -1,403 +0,0 @@
1
- "use strict";
2
- /**
3
- * This list is highly opinionated. It is designed to handle icons that can be safely embedded in HTML and linked as external source.
4
- * Icons cannot have anything that requires external resources, anything that renders inconsistently.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.tagSpecificNonPresentationalAttributes = exports.tagSpecificPresentationalAttributes = exports.tagSpecificAnimatedAttributes = exports.feFuncAttributes = exports.commonFeAttributes = exports.commonGradientAttributes = exports.otherAnimationAttributes = exports.animationValueAttributes = exports.animationTimingAttributes = exports.otherShapeAttributes = exports.markerAttributes = exports.presentationalAttributes = exports.otherPresentationalAttributes = exports.commonColorPresentationalAttributes = exports.visibilityPresentationalAttributes = exports.urlPresentationalAttributes = exports.strokePresentationalAttributes = exports.fillPresentationalAttributes = exports.insideClipPathAttributes = exports.stylingAttributes = exports.commonAttributes = exports.badAttributePrefixes = exports.badSoftwareAttributes = exports.junkSVGAttributes = exports.badAttributes = void 0;
8
- const tags_1 = require("./tags");
9
- /***** Attributes that are not part of tag specific stuff *****/
10
- /**
11
- * Attributes that icons should not mess with or that are irrelevant. They should be removed
12
- */
13
- exports.badAttributes = new Set([
14
- 'cursor',
15
- 'pointer-events',
16
- 'shape-rendering',
17
- 'tabindex',
18
- 'requiredExtensions',
19
- 'requiredFeatures',
20
- 'systemLanguage',
21
- 'role',
22
- 'title',
23
- ]);
24
- /**
25
- * Attributes for SVG element that should be removed
26
- */
27
- exports.junkSVGAttributes = new Set([
28
- 'xmlns:xlink',
29
- 'baseProfile',
30
- 'contentScriptType',
31
- 'contentStyleType',
32
- 'version',
33
- 'x',
34
- 'y',
35
- 'zoomAndPan',
36
- ]);
37
- /**
38
- * Attributes and styles often added by bad software to wrong tags, such as Adobe Illustrator and Inkscape
39
- */
40
- exports.badSoftwareAttributes = new Set([
41
- 'color-interpolation-filters',
42
- 'isolation',
43
- 'enable-background',
44
- 'overflow',
45
- 'marker',
46
- 'white-space',
47
- // Font stuff
48
- 'direction',
49
- ]);
50
- // Prefixes. First part of attribute before '-', where all possible attributes that start with prefix are invalid
51
- exports.badAttributePrefixes = new Set([
52
- 'image',
53
- 'mix',
54
- 'block',
55
- 'data',
56
- 'aria',
57
- // Font stuff
58
- 'text',
59
- 'font',
60
- 'letter',
61
- 'baseline',
62
- 'word',
63
- 'line',
64
- 'writing',
65
- // Prefix for browser specific stuff
66
- '',
67
- ]);
68
- /**
69
- * Common attributes that can exist on any element
70
- */
71
- exports.commonAttributes = new Set(['id']);
72
- exports.stylingAttributes = new Set(['class', 'style']);
73
- /**
74
- * Attributes that exist only on child elements of <clipPath>
75
- */
76
- exports.insideClipPathAttributes = new Set(['clip-rule']);
77
- /***** Other attributes, added to tagSpecificAttributes variable below *****/
78
- /**
79
- * Presentational attributes
80
- */
81
- // Attributes used for shapes with fill to change fill style
82
- exports.fillPresentationalAttributes = new Set([
83
- 'fill-opacity',
84
- 'fill-rule',
85
- ]);
86
- // Attributes used for shapes with stroke to change stroke style
87
- exports.strokePresentationalAttributes = new Set([
88
- 'stroke-dasharray',
89
- 'stroke-dashoffset',
90
- 'stroke-linecap',
91
- 'stroke-linejoin',
92
- 'stroke-miterlimit',
93
- 'stroke-opacity',
94
- 'stroke-width',
95
- ]);
96
- // Attributes where value is an url()
97
- exports.urlPresentationalAttributes = new Set([
98
- 'clip-path',
99
- 'filter',
100
- 'mask',
101
- ]);
102
- // Visibility
103
- exports.visibilityPresentationalAttributes = new Set([
104
- 'display',
105
- 'opacity',
106
- 'visibility',
107
- ]);
108
- // Color values
109
- exports.commonColorPresentationalAttributes = new Set([
110
- 'color',
111
- 'fill',
112
- 'stroke',
113
- ]);
114
- // Other presentational attributes
115
- exports.otherPresentationalAttributes = new Set([
116
- 'color-interpolation',
117
- 'color-rendering',
118
- 'transform',
119
- 'vector-effect',
120
- ]);
121
- // All presentational attributes
122
- exports.presentationalAttributes = new Set([
123
- ...exports.fillPresentationalAttributes,
124
- ...exports.strokePresentationalAttributes,
125
- ...exports.urlPresentationalAttributes,
126
- ...exports.visibilityPresentationalAttributes,
127
- ...exports.commonColorPresentationalAttributes,
128
- ...exports.otherPresentationalAttributes,
129
- ]);
130
- /**
131
- * Markers
132
- *
133
- * Presentational attributes
134
- */
135
- exports.markerAttributes = new Set([
136
- 'marker-start',
137
- 'marker-mid',
138
- 'marker-end',
139
- ]);
140
- /**
141
- * Shapes
142
- *
143
- * Not presentational
144
- */
145
- exports.otherShapeAttributes = new Set(['pathLength']);
146
- /**
147
- * Animations
148
- */
149
- exports.animationTimingAttributes = new Set([
150
- 'begin',
151
- 'dur',
152
- 'end',
153
- 'min',
154
- 'max',
155
- 'restart',
156
- 'repeatCount',
157
- 'repeatDur',
158
- 'fill',
159
- ]);
160
- exports.animationValueAttributes = new Set([
161
- 'calcMode',
162
- 'values',
163
- 'keyTimes',
164
- 'keySplines',
165
- 'from',
166
- 'to',
167
- 'by',
168
- ]);
169
- exports.otherAnimationAttributes = new Set([
170
- 'attributeName',
171
- 'additive',
172
- 'accumulate',
173
- ]);
174
- /**
175
- * Gradients
176
- */
177
- exports.commonGradientAttributes = new Set([
178
- 'gradientUnits',
179
- 'gradientTransform',
180
- 'href',
181
- 'spreadMethod',
182
- ]);
183
- /**
184
- * Filters
185
- */
186
- // Presentational, supported by most filters
187
- exports.commonFeAttributes = new Set([
188
- 'x',
189
- 'y',
190
- 'width',
191
- 'height',
192
- 'color-interpolation-filters',
193
- ]);
194
- exports.feFuncAttributes = new Set([
195
- 'type',
196
- 'tableValues',
197
- 'slope',
198
- 'intercept',
199
- 'amplitude',
200
- 'exponent',
201
- 'offset',
202
- ...exports.commonFeAttributes,
203
- ]);
204
- /**
205
- * Tag specific attributes
206
- */
207
- // Attributes, can be used in animations
208
- // Most attributes can also be used in style
209
- exports.tagSpecificAnimatedAttributes = {
210
- circle: new Set(['cx', 'cy', 'r']),
211
- ellipse: new Set(['cx', 'cy', 'rx', 'ry']),
212
- line: new Set(['x1', 'x2', 'y1', 'y2']),
213
- path: new Set(['d']),
214
- polygon: new Set(['points']),
215
- polyline: new Set(['points']),
216
- rect: new Set(['x', 'y', 'width', 'height', 'rx', 'ry']),
217
- };
218
- // Presentational attributes supported by tags
219
- exports.tagSpecificPresentationalAttributes = {
220
- // SVG
221
- svg: new Set(['width', 'height', ...exports.presentationalAttributes]),
222
- // Defnitions, containers and masks
223
- clipPath: new Set([...exports.presentationalAttributes]),
224
- defs: new Set([]),
225
- g: new Set([...exports.presentationalAttributes]),
226
- mask: new Set(['x', 'y', 'width', 'height', ...exports.presentationalAttributes]),
227
- symbol: new Set(['x', 'y', 'width', 'height', ...exports.presentationalAttributes]),
228
- // Use
229
- use: new Set([
230
- 'x',
231
- 'y',
232
- 'width',
233
- 'height',
234
- 'refX',
235
- 'refY',
236
- ...exports.presentationalAttributes,
237
- ]),
238
- // Marker
239
- marker: new Set([...exports.presentationalAttributes]),
240
- // Gradients
241
- linearGradient: new Set([
242
- 'x1',
243
- 'x2',
244
- 'y1',
245
- 'y2',
246
- ...exports.presentationalAttributes,
247
- ]),
248
- radialGradient: new Set([
249
- 'cx',
250
- 'cy',
251
- 'fr',
252
- 'fx',
253
- 'fy',
254
- 'r',
255
- ...exports.presentationalAttributes,
256
- ]),
257
- stop: new Set(['offset', 'stop-color', 'stop-opacity']),
258
- // Filters
259
- feFlood: new Set(['flood-color', 'flood-opacity']),
260
- feDropShadow: new Set(['flood-color', 'flood-opacity']),
261
- };
262
- tags_1.shapeTags.forEach((tag) => {
263
- exports.tagSpecificPresentationalAttributes[tag] = new Set([
264
- ...exports.presentationalAttributes,
265
- ...exports.markerAttributes,
266
- ...(exports.tagSpecificPresentationalAttributes[tag] || []),
267
- ]);
268
- });
269
- tags_1.filterChildTags.forEach((tag) => {
270
- exports.tagSpecificPresentationalAttributes[tag] = new Set([
271
- ...exports.commonFeAttributes,
272
- ...(exports.tagSpecificPresentationalAttributes[tag] || []),
273
- ]);
274
- });
275
- // Non-presentational attributes supported by tags
276
- exports.tagSpecificNonPresentationalAttributes = {
277
- // SVG
278
- svg: new Set(['xmlns', 'viewBox', 'preserveAspectRatio']),
279
- // Defnitions, containers and masks
280
- clipPath: new Set(['clipPathUnits']),
281
- mask: new Set(['maskContentUnits', 'maskUnits']),
282
- symbol: new Set(['viewBox', 'preserveAspectRatio']),
283
- // Shapes
284
- circle: new Set([...exports.otherShapeAttributes]),
285
- ellipse: new Set([...exports.otherShapeAttributes]),
286
- line: new Set([...exports.otherShapeAttributes]),
287
- path: new Set([...exports.otherShapeAttributes]),
288
- polygon: new Set([...exports.otherShapeAttributes]),
289
- polyline: new Set([...exports.otherShapeAttributes]),
290
- rect: new Set([...exports.otherShapeAttributes]),
291
- // Use
292
- use: new Set(['href']),
293
- // Marker
294
- marker: new Set([
295
- 'markerHeight',
296
- 'markerUnits',
297
- 'markerWidth',
298
- 'orient',
299
- 'preserveAspectRatio',
300
- 'refX',
301
- 'refY',
302
- 'viewBox',
303
- ]),
304
- // Animations
305
- animate: new Set([
306
- ...exports.animationTimingAttributes,
307
- ...exports.animationValueAttributes,
308
- ...exports.otherAnimationAttributes,
309
- ]),
310
- animateMotion: new Set([
311
- 'keyPoints',
312
- 'path',
313
- 'rotate',
314
- ...exports.animationTimingAttributes,
315
- ...exports.animationValueAttributes,
316
- ...exports.otherAnimationAttributes,
317
- ]),
318
- animateTransform: new Set([
319
- 'by',
320
- 'from',
321
- 'to',
322
- 'type',
323
- ...exports.animationTimingAttributes,
324
- ...exports.animationValueAttributes,
325
- ...exports.otherAnimationAttributes,
326
- ]),
327
- discard: new Set(['begin', 'href']),
328
- set: new Set([
329
- 'to',
330
- ...exports.animationTimingAttributes,
331
- ...exports.otherAnimationAttributes,
332
- ]),
333
- mpath: new Set(['href']),
334
- // Gradients
335
- linearGradient: new Set([...exports.commonGradientAttributes]),
336
- radialGradient: new Set([...exports.commonGradientAttributes]),
337
- // Filters
338
- feSpotLight: new Set([
339
- 'x',
340
- 'y',
341
- 'z',
342
- 'pointsAtX',
343
- 'pointsAtY',
344
- 'pointsAtZ',
345
- 'specularExponent',
346
- 'limitingConeAngle',
347
- ]),
348
- feBlend: new Set(['in', 'in2', 'mode']),
349
- feColorMatrix: new Set(['in', 'type', 'values']),
350
- feComponentTransfer: new Set(['in']),
351
- feComposite: new Set(['in', 'in2', 'operator', 'k1', 'k2', 'k3', 'k4']),
352
- feConvolveMatrix: new Set([
353
- 'in',
354
- 'order',
355
- 'kernelMatrix',
356
- 'divisor',
357
- 'bias',
358
- 'targetX',
359
- 'targetY',
360
- 'edgeMode',
361
- 'kernelUnitLength',
362
- 'preserveAlpha',
363
- ]),
364
- feDiffuseLighting: new Set([
365
- 'in',
366
- 'surfaceScale',
367
- 'diffuseConstant',
368
- 'kernelUnitLength',
369
- ]),
370
- feDisplacementMap: new Set([
371
- 'in',
372
- 'in2',
373
- 'scale',
374
- 'xChannelSelector',
375
- 'yChannelSelector',
376
- ]),
377
- feDistantLight: new Set(['azimuth', 'elevation']),
378
- feDropShadow: new Set(['dx', 'dy', 'stdDeviation']),
379
- feGaussianBlur: new Set(['in', 'stdDeviation', 'edgeMode']),
380
- feFuncA: exports.feFuncAttributes,
381
- feFuncR: exports.feFuncAttributes,
382
- feFuncG: exports.feFuncAttributes,
383
- feFuncB: exports.feFuncAttributes,
384
- feMergeNode: new Set(['in']),
385
- feMorphology: new Set(['in', 'operator', 'radius']),
386
- feOffset: new Set(['in', 'dx', 'dy']),
387
- fePointLight: new Set(['x', 'y', 'z']),
388
- feSpecularLighting: new Set([
389
- 'in',
390
- 'surfaceScale',
391
- 'specularConstant',
392
- 'specularExponent',
393
- 'kernelUnitLength',
394
- ]),
395
- feTile: new Set(['in']),
396
- feTurbulence: new Set([
397
- 'baseFrequency',
398
- 'numOctaves',
399
- 'seed',
400
- 'stitchTiles',
401
- 'type',
402
- ]),
403
- };
@@ -1,188 +0,0 @@
1
- "use strict";
2
- /**
3
- * This list is highly opinionated. It is designed to handle icons that can be safely embedded in HTML and linked as external source.
4
- * Icons cannot have anything that requires external resources, anything that renders inconsistently.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.allValidTags = exports.reusableElementsWithPalette = exports.feMergeChildTags = exports.feLightningChildTags = exports.feComponentTransferChildTag = exports.filterChildTags = exports.feLightningTags = exports.filterTag = exports.patternTag = exports.gradientChildTags = exports.gradientTags = exports.animateMotionChildTags = exports.animateTags = exports.markerTag = exports.groupTag = exports.useTag = exports.shapeTags = exports.symbolTag = exports.maskTags = exports.defsTag = exports.styleTag = exports.unsupportedTags = exports.badTags = void 0;
8
- /**
9
- * Bad tags
10
- *
11
- * Parser should throw error if one of these tags is found
12
- *
13
- * List includes text tags because:
14
- * - it usuaully uses custom font, which makes things much more complex
15
- * - it renders differently on different operating systems and browsers
16
- *
17
- * View tag is not allowed because it requires targeting view by id from external source, making it unusable in embedded icons.
18
- */
19
- exports.badTags = new Set([
20
- // Nasty stuff or external resource
21
- 'foreignObject',
22
- 'script',
23
- 'image',
24
- 'feImage',
25
- // Deprecated
26
- 'animateColor',
27
- 'altGlyph',
28
- // Text
29
- 'text',
30
- 'tspan',
31
- 'switch',
32
- 'textPath',
33
- // Font
34
- 'font',
35
- 'font-face',
36
- 'glyph',
37
- 'missing-glyph',
38
- 'hkern',
39
- 'vhern',
40
- // View
41
- 'view',
42
- // Link
43
- 'a',
44
- ]);
45
- /**
46
- * Deprecated or irrelevant tags
47
- *
48
- * Tags that are quietly removed
49
- */
50
- exports.unsupportedTags = new Set(['metadata', 'desc', 'title']);
51
- /**
52
- * Style
53
- */
54
- exports.styleTag = new Set(['style']);
55
- /**
56
- * Definitions: reusable elements inside
57
- */
58
- exports.defsTag = new Set(['defs']);
59
- /**
60
- * Masks: colors are ignored, elements must have id
61
- */
62
- exports.maskTags = new Set(['clipPath', 'mask']);
63
- /**
64
- * Symbol
65
- */
66
- exports.symbolTag = new Set(['symbol']);
67
- /**
68
- * SVG shapes
69
- */
70
- exports.shapeTags = new Set([
71
- 'circle',
72
- 'ellipse',
73
- 'line',
74
- 'path',
75
- 'polygon',
76
- 'polyline',
77
- 'rect',
78
- ]);
79
- /**
80
- * Use
81
- */
82
- exports.useTag = new Set(['use']);
83
- /**
84
- * Groups
85
- */
86
- exports.groupTag = new Set(['g']);
87
- /**
88
- * Marker, should be inside <defs>
89
- */
90
- exports.markerTag = new Set(['marker']);
91
- /**
92
- * SVG animations
93
- */
94
- exports.animateTags = new Set([
95
- 'animate',
96
- 'animateMotion',
97
- 'animateTransform',
98
- 'discard',
99
- 'set',
100
- ]);
101
- exports.animateMotionChildTags = new Set(['mpath']);
102
- /**
103
- * Gradients, should be inside <defs>
104
- */
105
- exports.gradientTags = new Set(['linearGradient', 'radialGradient']);
106
- /**
107
- * Gradient color, must be inside one of gradientTags
108
- */
109
- exports.gradientChildTags = new Set(['stop']);
110
- /**
111
- * Pattern, should be inside <defs>
112
- */
113
- exports.patternTag = new Set(['pattern']);
114
- /**
115
- * Filters
116
- */
117
- exports.filterTag = new Set(['filter']);
118
- exports.feLightningTags = new Set([
119
- 'feDiffuseLighting',
120
- 'feSpecularLighting',
121
- ]);
122
- exports.filterChildTags = new Set([
123
- 'feBlend',
124
- 'feColorMatrix',
125
- 'feComponentTransfer',
126
- 'feComposite',
127
- 'feConvolveMatrix',
128
- 'feDisplacementMap',
129
- 'feDropShadow',
130
- 'feFlood',
131
- 'feGaussianBlur',
132
- 'feMerge',
133
- 'feMorphology',
134
- 'feOffset',
135
- 'feTile',
136
- 'feTurbulence',
137
- ...exports.feLightningTags,
138
- ]);
139
- exports.feComponentTransferChildTag = new Set([
140
- 'feFuncR',
141
- 'feFuncG',
142
- 'feFuncB',
143
- 'feFuncA',
144
- ]);
145
- exports.feLightningChildTags = new Set([
146
- 'feSpotLight',
147
- 'fePointLight',
148
- 'feDistantLight',
149
- ]);
150
- exports.feMergeChildTags = new Set(['feMergeNode']);
151
- /***** Combination of tags *****/
152
- /**
153
- * Reusable elements that use colors
154
- *
155
- * Most are used via color attributes like `fill`
156
- * Some are used via custom attributes like `marker-start`
157
- * Filter is used via `filter`
158
- */
159
- exports.reusableElementsWithPalette = new Set([
160
- ...exports.gradientTags,
161
- ...exports.patternTag,
162
- ...exports.markerTag,
163
- ...exports.symbolTag,
164
- ...exports.filterTag,
165
- ]);
166
- /**
167
- * All supported tags
168
- */
169
- exports.allValidTags = new Set([
170
- ...exports.styleTag,
171
- ...exports.defsTag,
172
- ...exports.maskTags,
173
- ...exports.symbolTag,
174
- ...exports.shapeTags,
175
- ...exports.useTag,
176
- ...exports.groupTag,
177
- ...exports.markerTag,
178
- ...exports.animateTags,
179
- ...exports.animateMotionChildTags,
180
- ...exports.gradientTags,
181
- ...exports.gradientChildTags,
182
- ...exports.patternTag,
183
- ...exports.filterTag,
184
- ...exports.filterChildTags,
185
- ...exports.feComponentTransferChildTag,
186
- ...exports.feLightningChildTags,
187
- ...exports.feMergeChildTags,
188
- ]);