@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.
- package/lib/colors/attribs.cjs +30 -0
- package/lib/colors/attribs.d.ts +13 -10
- package/lib/colors/attribs.mjs +7 -13
- package/lib/colors/parse.cjs +269 -0
- package/lib/colors/parse.d.ts +15 -11
- package/lib/colors/parse.mjs +27 -31
- package/lib/colors/validate.cjs +52 -0
- package/lib/colors/validate.d.ts +11 -4
- package/lib/colors/validate.mjs +19 -6
- package/lib/css/parse.cjs +26 -0
- package/lib/css/parse.d.ts +3 -1
- package/lib/css/parse.mjs +8 -6
- package/lib/css/parser/error.cjs +25 -0
- package/lib/css/parser/error.d.ts +4 -2
- package/lib/css/parser/error.mjs +2 -4
- package/lib/css/parser/export.cjs +48 -0
- package/lib/css/parser/export.d.ts +5 -2
- package/lib/css/parser/export.mjs +4 -6
- package/lib/css/parser/strings.cjs +77 -0
- package/lib/css/parser/strings.d.ts +6 -3
- package/lib/css/parser/strings.mjs +4 -6
- package/lib/css/parser/text.cjs +135 -0
- package/lib/css/parser/text.d.ts +8 -5
- package/lib/css/parser/text.mjs +3 -8
- package/lib/css/parser/tokens.cjs +184 -0
- package/lib/css/parser/tokens.d.ts +6 -3
- package/lib/css/parser/tokens.mjs +7 -13
- package/lib/css/parser/tree.cjs +42 -0
- package/lib/css/parser/tree.d.ts +5 -2
- package/lib/css/parser/tree.mjs +2 -4
- package/lib/css/parser/types.cjs +2 -0
- package/lib/css/parser/types.d.ts +13 -11
- package/lib/css/parser/types.mjs +1 -0
- package/lib/download/api/cache.cjs +86 -0
- package/lib/download/api/cache.d.ts +8 -5
- package/lib/download/api/cache.mjs +14 -19
- package/lib/download/api/download.cjs +28 -0
- package/lib/download/api/download.d.ts +5 -2
- package/lib/download/api/download.mjs +8 -9
- package/lib/download/api/index.cjs +51 -0
- package/lib/download/api/index.d.ts +5 -2
- package/lib/download/api/index.mjs +8 -6
- package/lib/download/api/types.cjs +2 -0
- package/lib/download/api/types.d.ts +4 -2
- package/lib/download/api/types.mjs +1 -0
- package/lib/download/git/branch.cjs +22 -0
- package/lib/download/git/branch.d.ts +5 -2
- package/lib/download/git/branch.mjs +5 -5
- package/lib/download/git/hash.cjs +15 -0
- package/lib/download/git/hash.d.ts +5 -2
- package/lib/download/git/hash.mjs +5 -5
- package/lib/download/git/index.cjs +76 -0
- package/lib/download/git/index.d.ts +10 -8
- package/lib/download/git/index.mjs +41 -26
- package/lib/download/git/reset.cjs +41 -0
- package/lib/download/git/reset.d.ts +3 -1
- package/lib/download/git/reset.mjs +29 -5
- package/lib/download/github/hash.cjs +32 -0
- package/lib/download/github/hash.d.ts +5 -2
- package/lib/download/github/hash.mjs +10 -7
- package/lib/download/github/index.cjs +98 -0
- package/lib/download/github/index.d.ts +11 -9
- package/lib/download/github/index.mjs +23 -17
- package/lib/download/github/types.cjs +2 -0
- package/lib/download/github/types.d.ts +3 -1
- package/lib/download/github/types.mjs +1 -0
- package/lib/download/gitlab/hash.cjs +32 -0
- package/lib/download/gitlab/hash.d.ts +5 -2
- package/lib/download/gitlab/hash.mjs +10 -6
- package/lib/download/gitlab/index.cjs +98 -0
- package/lib/download/gitlab/index.d.ts +11 -9
- package/lib/download/gitlab/index.mjs +24 -18
- package/lib/download/gitlab/types.cjs +7 -0
- package/lib/download/gitlab/types.d.ts +4 -2
- package/lib/download/gitlab/types.mjs +3 -5
- package/lib/download/helpers/untar.cjs +14 -0
- package/lib/download/helpers/untar.d.ts +3 -1
- package/lib/download/helpers/untar.mjs +4 -5
- package/lib/download/helpers/unzip.cjs +19 -0
- package/lib/download/helpers/unzip.d.ts +3 -1
- package/lib/download/helpers/unzip.mjs +6 -7
- package/lib/download/index.cjs +64 -0
- package/lib/download/index.d.ts +18 -13
- package/lib/download/index.mjs +46 -19
- package/lib/download/npm/index.cjs +82 -0
- package/lib/download/npm/index.d.ts +10 -8
- package/lib/download/npm/index.mjs +16 -13
- package/lib/download/npm/types.cjs +2 -0
- package/lib/download/npm/types.d.ts +3 -1
- package/lib/download/npm/types.mjs +1 -0
- package/lib/download/npm/version.cjs +23 -0
- package/lib/download/npm/version.d.ts +7 -4
- package/lib/download/npm/version.mjs +8 -10
- package/lib/download/types/modified.cjs +2 -0
- package/lib/download/types/modified.d.ts +3 -1
- package/lib/download/types/modified.mjs +1 -0
- package/lib/download/types/sources.cjs +2 -0
- package/lib/download/types/sources.d.ts +4 -2
- package/lib/download/types/sources.mjs +1 -0
- package/lib/export/directory.cjs +45 -0
- package/lib/export/directory.d.ts +11 -4
- package/lib/export/directory.mjs +8 -8
- package/lib/export/helpers/custom-files.cjs +28 -0
- package/lib/export/helpers/custom-files.d.ts +4 -2
- package/lib/export/helpers/custom-files.mjs +8 -9
- package/lib/export/helpers/prepare.cjs +36 -0
- package/lib/export/helpers/prepare.d.ts +5 -3
- package/lib/export/helpers/prepare.mjs +7 -9
- package/lib/export/helpers/types-version.cjs +22 -0
- package/lib/export/helpers/types-version.d.ts +3 -1
- package/lib/export/helpers/types-version.mjs +15 -37
- package/lib/export/icon-package.cjs +59 -0
- package/lib/export/icon-package.d.ts +12 -5
- package/lib/export/icon-package.mjs +15 -16
- package/lib/export/json-package.cjs +133 -0
- package/lib/export/json-package.d.ts +12 -5
- package/lib/export/json-package.mjs +20 -21
- package/lib/icon-set/index.cjs +589 -0
- package/lib/icon-set/index.d.ts +9 -6
- package/lib/icon-set/index.mjs +40 -53
- package/lib/icon-set/match.cjs +58 -0
- package/lib/icon-set/match.d.ts +10 -3
- package/lib/icon-set/match.mjs +5 -6
- package/lib/icon-set/merge.cjs +83 -0
- package/lib/icon-set/merge.d.ts +9 -2
- package/lib/icon-set/merge.mjs +15 -10
- package/lib/icon-set/props.cjs +28 -0
- package/lib/icon-set/props.d.ts +8 -4
- package/lib/icon-set/props.mjs +7 -10
- package/lib/icon-set/types.cjs +2 -0
- package/lib/icon-set/types.d.ts +19 -17
- package/lib/icon-set/types.mjs +1 -0
- package/lib/import/directory.cjs +76 -0
- package/lib/import/directory.d.ts +11 -5
- package/lib/import/directory.mjs +36 -11
- package/lib/import/figma/index.cjs +105 -0
- package/lib/import/figma/index.d.ts +15 -5
- package/lib/import/figma/index.mjs +40 -13
- package/lib/import/figma/nodes.cjs +86 -0
- package/lib/import/figma/nodes.d.ts +13 -4
- package/lib/import/figma/nodes.mjs +3 -11
- package/lib/import/figma/query.cjs +218 -0
- package/lib/import/figma/query.d.ts +18 -9
- package/lib/import/figma/query.mjs +9 -12
- package/lib/import/figma/types/api.cjs +2 -0
- package/lib/import/figma/types/api.d.ts +8 -7
- package/lib/import/figma/types/api.mjs +1 -0
- package/lib/import/figma/types/nodes.cjs +2 -0
- package/lib/import/figma/types/nodes.d.ts +16 -9
- package/lib/import/figma/types/nodes.mjs +1 -0
- package/lib/import/figma/types/options.cjs +2 -0
- package/lib/import/figma/types/options.d.ts +17 -10
- package/lib/import/figma/types/options.mjs +1 -0
- package/lib/import/figma/types/result.cjs +2 -0
- package/lib/import/figma/types/result.d.ts +12 -5
- package/lib/import/figma/types/result.mjs +1 -0
- package/lib/index.cjs +137 -0
- package/lib/index.d.ts +65 -44
- package/lib/index.mjs +83 -94
- package/lib/misc/bump-version.cjs +17 -0
- package/lib/misc/bump-version.d.ts +3 -1
- package/lib/misc/bump-version.mjs +2 -4
- package/lib/misc/compare-dirs.cjs +75 -0
- package/lib/misc/compare-dirs.d.ts +4 -2
- package/lib/misc/compare-dirs.mjs +12 -12
- package/lib/misc/exec.cjs +25 -0
- package/lib/misc/exec.d.ts +6 -4
- package/lib/misc/exec.mjs +4 -5
- package/lib/misc/keyword.cjs +19 -0
- package/lib/misc/keyword.d.ts +3 -1
- package/lib/misc/keyword.mjs +2 -4
- package/lib/misc/scan.cjs +51 -0
- package/lib/misc/scan.d.ts +7 -6
- package/lib/misc/scan.mjs +6 -7
- package/lib/misc/write-json.cjs +11 -0
- package/lib/misc/write-json.d.ts +3 -1
- package/lib/misc/write-json.mjs +5 -6
- package/lib/optimise/flags.cjs +252 -0
- package/lib/optimise/flags.d.ts +7 -2
- package/lib/optimise/flags.mjs +18 -19
- package/lib/optimise/global-style.cjs +154 -0
- package/lib/optimise/global-style.d.ts +7 -2
- package/lib/optimise/global-style.mjs +18 -15
- package/lib/optimise/scale.cjs +26 -0
- package/lib/optimise/scale.d.ts +7 -2
- package/lib/optimise/scale.mjs +5 -5
- package/lib/optimise/svgo.cjs +83 -0
- package/lib/optimise/svgo.d.ts +10 -6
- package/lib/optimise/svgo.mjs +6 -9
- package/lib/svg/analyse/error.cjs +18 -0
- package/lib/svg/analyse/error.d.ts +5 -2
- package/lib/svg/analyse/error.mjs +2 -4
- package/lib/svg/analyse/types.cjs +2 -0
- package/lib/svg/analyse/types.d.ts +11 -11
- package/lib/svg/analyse/types.mjs +1 -0
- package/lib/svg/analyse.cjs +291 -0
- package/lib/svg/analyse.d.ts +8 -3
- package/lib/svg/analyse.mjs +15 -30
- package/lib/svg/cleanup/attribs.cjs +41 -0
- package/lib/svg/cleanup/attribs.d.ts +7 -2
- package/lib/svg/cleanup/attribs.mjs +6 -12
- package/lib/svg/cleanup/bad-tags.cjs +51 -0
- package/lib/svg/cleanup/bad-tags.d.ts +7 -2
- package/lib/svg/cleanup/bad-tags.mjs +10 -25
- package/lib/svg/cleanup/inline-style.cjs +64 -0
- package/lib/svg/cleanup/inline-style.d.ts +7 -2
- package/lib/svg/cleanup/inline-style.mjs +14 -19
- package/lib/svg/cleanup/root-svg.cjs +81 -0
- package/lib/svg/cleanup/root-svg.d.ts +7 -2
- package/lib/svg/cleanup/root-svg.mjs +7 -18
- package/lib/svg/cleanup/svgo-style.cjs +38 -0
- package/lib/svg/cleanup/svgo-style.d.ts +7 -2
- package/lib/svg/cleanup/svgo-style.mjs +16 -11
- package/lib/svg/cleanup.cjs +32 -0
- package/lib/svg/cleanup.d.ts +7 -2
- package/lib/svg/cleanup.mjs +21 -9
- package/lib/svg/data/attributes.cjs +355 -0
- package/lib/svg/data/attributes.d.ts +27 -25
- package/lib/svg/data/attributes.mjs +90 -115
- package/lib/svg/data/tags.cjs +137 -0
- package/lib/svg/data/tags.d.ts +25 -23
- package/lib/svg/data/tags.mjs +25 -49
- package/lib/svg/index.cjs +130 -0
- package/lib/svg/index.d.ts +16 -5
- package/lib/svg/index.mjs +48 -14
- package/lib/svg/parse-style.cjs +134 -0
- package/lib/svg/parse-style.d.ts +12 -8
- package/lib/svg/parse-style.mjs +11 -9
- package/lib/svg/parse.cjs +42 -0
- package/lib/svg/parse.d.ts +11 -7
- package/lib/svg/parse.mjs +2 -4
- package/package.json +99 -94
- package/lib/colors/attribs.js +0 -26
- package/lib/colors/parse.js +0 -341
- package/lib/colors/validate.js +0 -48
- package/lib/css/parse.js +0 -23
- package/lib/css/parser/error.js +0 -27
- package/lib/css/parser/export.js +0 -69
- package/lib/css/parser/strings.js +0 -93
- package/lib/css/parser/text.js +0 -171
- package/lib/css/parser/tokens.js +0 -200
- package/lib/css/parser/tree.js +0 -44
- package/lib/css/parser/types.js +0 -2
- package/lib/download/api/cache.js +0 -108
- package/lib/download/api/download.js +0 -27
- package/lib/download/api/index.js +0 -52
- package/lib/download/api/types.js +0 -2
- package/lib/download/git/branch.js +0 -22
- package/lib/download/git/hash.js +0 -14
- package/lib/download/git/index.js +0 -75
- package/lib/download/git/reset.js +0 -16
- package/lib/download/github/hash.js +0 -28
- package/lib/download/github/index.js +0 -116
- package/lib/download/github/types.js +0 -2
- package/lib/download/gitlab/hash.js +0 -27
- package/lib/download/gitlab/index.js +0 -115
- package/lib/download/gitlab/types.js +0 -7
- package/lib/download/helpers/untar.js +0 -14
- package/lib/download/helpers/unzip.js +0 -18
- package/lib/download/index.js +0 -27
- package/lib/download/npm/index.js +0 -91
- package/lib/download/npm/types.js +0 -2
- package/lib/download/npm/version.js +0 -27
- package/lib/download/types/modified.js +0 -2
- package/lib/download/types/sources.js +0 -2
- package/lib/export/directory.js +0 -52
- package/lib/export/helpers/custom-files.js +0 -32
- package/lib/export/helpers/prepare.js +0 -49
- package/lib/export/helpers/types-version.js +0 -12
- package/lib/export/icon-package.js +0 -77
- package/lib/export/json-package.js +0 -156
- package/lib/icon-set/index.js +0 -749
- package/lib/icon-set/match.js +0 -66
- package/lib/icon-set/merge.js +0 -90
- package/lib/icon-set/props.js +0 -34
- package/lib/icon-set/types.js +0 -2
- package/lib/import/directory.js +0 -59
- package/lib/import/figma/index.js +0 -90
- package/lib/import/figma/nodes.js +0 -106
- package/lib/import/figma/query.js +0 -244
- package/lib/import/figma/types/api.js +0 -12
- package/lib/import/figma/types/nodes.js +0 -2
- package/lib/import/figma/types/options.js +0 -2
- package/lib/import/figma/types/result.js +0 -2
- package/lib/index.js +0 -103
- package/lib/misc/bump-version.js +0 -19
- package/lib/misc/compare-dirs.js +0 -84
- package/lib/misc/exec.js +0 -26
- package/lib/misc/keyword.js +0 -31
- package/lib/misc/scan.js +0 -55
- package/lib/misc/write-json.js +0 -11
- package/lib/optimise/flags.js +0 -312
- package/lib/optimise/global-style.js +0 -185
- package/lib/optimise/scale.js +0 -42
- package/lib/optimise/svgo.js +0 -99
- package/lib/svg/analyse/error.js +0 -22
- package/lib/svg/analyse/types.js +0 -2
- package/lib/svg/analyse.js +0 -352
- package/lib/svg/cleanup/attribs.js +0 -51
- package/lib/svg/cleanup/bad-tags.js +0 -65
- package/lib/svg/cleanup/inline-style.js +0 -77
- package/lib/svg/cleanup/root-svg.js +0 -107
- package/lib/svg/cleanup/svgo-style.js +0 -35
- package/lib/svg/cleanup.js +0 -24
- package/lib/svg/data/attributes.js +0 -403
- package/lib/svg/data/tags.js +0 -188
- package/lib/svg/index.js +0 -134
- package/lib/svg/parse-style.js +0 -151
- package/lib/svg/parse.js +0 -49
package/lib/svg/cleanup.js
DELETED
|
@@ -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
|
-
};
|
package/lib/svg/data/tags.js
DELETED
|
@@ -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
|
-
]);
|