@iconify/tools 2.0.12 → 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 +42 -20
- package/lib/download/git/reset.cjs +41 -0
- package/lib/download/git/reset.d.ts +6 -0
- package/lib/download/git/reset.mjs +37 -0
- 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 +24 -22
- package/lib/icon-set/index.cjs +589 -0
- package/lib/icon-set/index.d.ts +9 -6
- package/lib/icon-set/index.mjs +47 -57
- 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 +9 -12
- 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 +6 -16
- 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 -43
- package/lib/index.mjs +83 -92
- 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 +68 -47
- 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 -11
- 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 +102 -93
- 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 -63
- 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 -151
- package/lib/icon-set/index.js +0 -746
- package/lib/icon-set/match.js +0 -66
- package/lib/icon-set/merge.js +0 -90
- package/lib/icon-set/props.js +0 -33
- 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 -108
- 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 -101
- 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 -158
- 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 -125
- package/lib/svg/parse-style.js +0 -151
- package/lib/svg/parse.js +0 -49
package/lib/icon-set/index.mjs
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var maxIteration = 6;
|
|
14
|
-
var themeKeys = ["prefixes", "suffixes"];
|
|
1
|
+
import { fullIcon } from '@iconify/utils/lib/icon';
|
|
2
|
+
import { iconToSVG } from '@iconify/utils/lib/svg/build';
|
|
3
|
+
import { defaults } from '@iconify/utils/lib/customisations';
|
|
4
|
+
import { minifyIconSet } from '@iconify/utils/lib/icon-set/minify';
|
|
5
|
+
import { convertIconSetInfo } from '@iconify/utils/lib/icon-set/convert-info';
|
|
6
|
+
import { filterProps, extraDefaultProps } from './props.mjs';
|
|
7
|
+
import { SVG } from '../svg/index.mjs';
|
|
8
|
+
import 'cheerio';
|
|
9
|
+
import '@iconify/utils';
|
|
10
|
+
|
|
11
|
+
const maxIteration = 6;
|
|
12
|
+
const themeKeys = ["prefixes", "suffixes"];
|
|
15
13
|
function sortThemeKeys(keys) {
|
|
16
14
|
return keys.sort((a, b) => a.length === b.length ? a.localeCompare(b) : b.length - a.length);
|
|
17
15
|
}
|
|
18
|
-
|
|
16
|
+
class IconSet {
|
|
19
17
|
constructor(data) {
|
|
20
18
|
this.load(data);
|
|
21
19
|
}
|
|
22
20
|
load(data) {
|
|
23
21
|
this.prefix = data.prefix;
|
|
24
|
-
const defaultProps = filterProps(data);
|
|
25
|
-
this.entries = Object.create(null);
|
|
22
|
+
const defaultProps = filterProps(data, true);
|
|
23
|
+
this.entries = /* @__PURE__ */ Object.create(null);
|
|
26
24
|
const entries = this.entries;
|
|
27
25
|
for (const name in data.icons) {
|
|
28
26
|
const item = data.icons[name];
|
|
29
27
|
const entry = {
|
|
30
28
|
type: "icon",
|
|
31
29
|
body: item.body,
|
|
32
|
-
props:
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
props: filterProps({
|
|
31
|
+
...defaultProps,
|
|
32
|
+
...item
|
|
33
|
+
}, true),
|
|
34
|
+
chars: /* @__PURE__ */ new Set(),
|
|
35
|
+
categories: /* @__PURE__ */ new Set()
|
|
35
36
|
};
|
|
36
37
|
entries[name] = entry;
|
|
37
38
|
}
|
|
@@ -39,8 +40,8 @@ var IconSet = class {
|
|
|
39
40
|
for (const name in data.aliases) {
|
|
40
41
|
const item = data.aliases[name];
|
|
41
42
|
const parent = item.parent;
|
|
42
|
-
const props = filterProps(item);
|
|
43
|
-
const chars = new Set();
|
|
43
|
+
const props = filterProps(item, false);
|
|
44
|
+
const chars = /* @__PURE__ */ new Set();
|
|
44
45
|
if (Object.keys(props).length) {
|
|
45
46
|
const entry = {
|
|
46
47
|
type: "variation",
|
|
@@ -70,7 +71,7 @@ var IconSet = class {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
this.categories = new Set();
|
|
74
|
+
this.categories = /* @__PURE__ */ new Set();
|
|
74
75
|
if (data.categories) {
|
|
75
76
|
for (const category in data.categories) {
|
|
76
77
|
const item = {
|
|
@@ -79,7 +80,7 @@ var IconSet = class {
|
|
|
79
80
|
};
|
|
80
81
|
data.categories[category].forEach((iconName) => {
|
|
81
82
|
const icon = entries[iconName];
|
|
82
|
-
switch (icon
|
|
83
|
+
switch (icon?.type) {
|
|
83
84
|
case "icon":
|
|
84
85
|
icon.categories.add(item);
|
|
85
86
|
}
|
|
@@ -88,8 +89,8 @@ var IconSet = class {
|
|
|
88
89
|
this.listCategory(item);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
const prefixes = this.prefixes = Object.create(null);
|
|
92
|
-
const suffixes = this.suffixes = Object.create(null);
|
|
92
|
+
const prefixes = this.prefixes = /* @__PURE__ */ Object.create(null);
|
|
93
|
+
const suffixes = this.suffixes = /* @__PURE__ */ Object.create(null);
|
|
93
94
|
if (data.themes) {
|
|
94
95
|
for (const key in data.themes) {
|
|
95
96
|
const item = data.themes[key];
|
|
@@ -110,7 +111,7 @@ var IconSet = class {
|
|
|
110
111
|
themeKeys.forEach((prop) => {
|
|
111
112
|
const items = data[prop];
|
|
112
113
|
if (items) {
|
|
113
|
-
this[prop] = Object.create(null);
|
|
114
|
+
this[prop] = /* @__PURE__ */ Object.create(null);
|
|
114
115
|
for (const key in items) {
|
|
115
116
|
this[prop][key] = items[key];
|
|
116
117
|
}
|
|
@@ -186,7 +187,6 @@ var IconSet = class {
|
|
|
186
187
|
return parent;
|
|
187
188
|
}
|
|
188
189
|
default:
|
|
189
|
-
assertNever(item);
|
|
190
190
|
return null;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -213,8 +213,8 @@ var IconSet = class {
|
|
|
213
213
|
return html ? new SVG(html) : null;
|
|
214
214
|
}
|
|
215
215
|
export(validate = true) {
|
|
216
|
-
const icons = Object.create(null);
|
|
217
|
-
const aliases = Object.create(null);
|
|
216
|
+
const icons = /* @__PURE__ */ Object.create(null);
|
|
217
|
+
const aliases = /* @__PURE__ */ Object.create(null);
|
|
218
218
|
const names = Object.keys(this.entries);
|
|
219
219
|
names.sort((a, b) => a.localeCompare(b));
|
|
220
220
|
names.forEach((name) => {
|
|
@@ -241,9 +241,6 @@ var IconSet = class {
|
|
|
241
241
|
aliases[name] = alias;
|
|
242
242
|
break;
|
|
243
243
|
}
|
|
244
|
-
default: {
|
|
245
|
-
assertNever(item);
|
|
246
|
-
}
|
|
247
244
|
}
|
|
248
245
|
});
|
|
249
246
|
let info;
|
|
@@ -265,7 +262,7 @@ var IconSet = class {
|
|
|
265
262
|
if (Object.keys(chars).length) {
|
|
266
263
|
result.chars = chars;
|
|
267
264
|
}
|
|
268
|
-
const categories = Object.create(null);
|
|
265
|
+
const categories = /* @__PURE__ */ Object.create(null);
|
|
269
266
|
Array.from(this.categories).sort((a, b) => a.title.localeCompare(b.title)).forEach((item) => {
|
|
270
267
|
const names2 = this.listCategory(item);
|
|
271
268
|
if (names2) {
|
|
@@ -281,7 +278,7 @@ var IconSet = class {
|
|
|
281
278
|
const keys = Object.keys(items);
|
|
282
279
|
if (keys.length) {
|
|
283
280
|
sortThemeKeys(keys);
|
|
284
|
-
const sortedTheme = Object.create(null);
|
|
281
|
+
const sortedTheme = /* @__PURE__ */ Object.create(null);
|
|
285
282
|
const tested = this.checkTheme(prop === "prefixes");
|
|
286
283
|
keys.forEach((key) => {
|
|
287
284
|
if (tested.valid[key].length) {
|
|
@@ -297,7 +294,7 @@ var IconSet = class {
|
|
|
297
294
|
return result;
|
|
298
295
|
}
|
|
299
296
|
chars(names) {
|
|
300
|
-
const chars = Object.create(null);
|
|
297
|
+
const chars = /* @__PURE__ */ Object.create(null);
|
|
301
298
|
if (!names) {
|
|
302
299
|
names = Object.keys(this.entries);
|
|
303
300
|
}
|
|
@@ -335,7 +332,7 @@ var IconSet = class {
|
|
|
335
332
|
}
|
|
336
333
|
count() {
|
|
337
334
|
return this._filter((_key, item, icon) => {
|
|
338
|
-
if (item.type === "alias" || item.props.hidden ||
|
|
335
|
+
if (item.type === "alias" || item.props.hidden || icon?.hidden) {
|
|
339
336
|
return false;
|
|
340
337
|
}
|
|
341
338
|
return true;
|
|
@@ -380,7 +377,7 @@ var IconSet = class {
|
|
|
380
377
|
}
|
|
381
378
|
remove(name, removeDependencies = true) {
|
|
382
379
|
const entries = this.entries;
|
|
383
|
-
const names = new Set();
|
|
380
|
+
const names = /* @__PURE__ */ new Set();
|
|
384
381
|
if (typeof removeDependencies === "string") {
|
|
385
382
|
if (name === removeDependencies || !entries[removeDependencies]) {
|
|
386
383
|
return 0;
|
|
@@ -410,8 +407,6 @@ var IconSet = class {
|
|
|
410
407
|
item.parent = removeDependencies;
|
|
411
408
|
}
|
|
412
409
|
break;
|
|
413
|
-
default:
|
|
414
|
-
assertNever(item);
|
|
415
410
|
}
|
|
416
411
|
}
|
|
417
412
|
}
|
|
@@ -451,8 +446,6 @@ var IconSet = class {
|
|
|
451
446
|
item.parent = newName;
|
|
452
447
|
}
|
|
453
448
|
break;
|
|
454
|
-
default:
|
|
455
|
-
assertNever(item);
|
|
456
449
|
}
|
|
457
450
|
}
|
|
458
451
|
return true;
|
|
@@ -473,16 +466,16 @@ var IconSet = class {
|
|
|
473
466
|
return this.setItem(name, {
|
|
474
467
|
type: "icon",
|
|
475
468
|
body: icon.body,
|
|
476
|
-
props: filterProps(icon),
|
|
477
|
-
chars: new Set(),
|
|
478
|
-
categories: new Set()
|
|
469
|
+
props: filterProps(icon, true),
|
|
470
|
+
chars: /* @__PURE__ */ new Set(),
|
|
471
|
+
categories: /* @__PURE__ */ new Set()
|
|
479
472
|
});
|
|
480
473
|
}
|
|
481
474
|
setAlias(name, parent) {
|
|
482
475
|
return this.setItem(name, {
|
|
483
476
|
type: "alias",
|
|
484
477
|
parent,
|
|
485
|
-
chars: new Set()
|
|
478
|
+
chars: /* @__PURE__ */ new Set()
|
|
486
479
|
});
|
|
487
480
|
}
|
|
488
481
|
setVariation(name, parent, props) {
|
|
@@ -490,14 +483,14 @@ var IconSet = class {
|
|
|
490
483
|
type: "variation",
|
|
491
484
|
parent,
|
|
492
485
|
props,
|
|
493
|
-
chars: new Set()
|
|
486
|
+
chars: /* @__PURE__ */ new Set()
|
|
494
487
|
});
|
|
495
488
|
}
|
|
496
489
|
fromSVG(name, svg) {
|
|
497
490
|
const props = svg.viewBox;
|
|
498
491
|
const body = svg.getBody();
|
|
499
492
|
const item = this.entries[name];
|
|
500
|
-
switch (item
|
|
493
|
+
switch (item?.type) {
|
|
501
494
|
case "icon":
|
|
502
495
|
case "variation": {
|
|
503
496
|
for (const key in extraDefaultProps) {
|
|
@@ -511,7 +504,7 @@ var IconSet = class {
|
|
|
511
504
|
body,
|
|
512
505
|
props,
|
|
513
506
|
chars: item.chars,
|
|
514
|
-
categories: item.type === "icon" ? item.categories : new Set()
|
|
507
|
+
categories: item.type === "icon" ? item.categories : /* @__PURE__ */ new Set()
|
|
515
508
|
});
|
|
516
509
|
}
|
|
517
510
|
}
|
|
@@ -551,14 +544,14 @@ var IconSet = class {
|
|
|
551
544
|
const themes = prefix ? this.prefixes : this.suffixes;
|
|
552
545
|
const keys = sortThemeKeys(Object.keys(themes));
|
|
553
546
|
const results = {
|
|
554
|
-
valid: Object.create(null),
|
|
547
|
+
valid: /* @__PURE__ */ Object.create(null),
|
|
555
548
|
invalid: []
|
|
556
549
|
};
|
|
557
550
|
keys.forEach((key) => {
|
|
558
551
|
results.valid[key] = [];
|
|
559
552
|
});
|
|
560
553
|
results.invalid = this._filter((name, item, icon) => {
|
|
561
|
-
if (item.type === "alias" || item.props.hidden ||
|
|
554
|
+
if (item.type === "alias" || item.props.hidden || icon?.hidden) {
|
|
562
555
|
return false;
|
|
563
556
|
}
|
|
564
557
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -579,15 +572,12 @@ var IconSet = class {
|
|
|
579
572
|
});
|
|
580
573
|
return results;
|
|
581
574
|
}
|
|
582
|
-
}
|
|
575
|
+
}
|
|
583
576
|
function blankIconSet(prefix) {
|
|
584
577
|
return new IconSet({
|
|
585
578
|
prefix,
|
|
586
579
|
icons: {}
|
|
587
580
|
});
|
|
588
581
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
blankIconSet,
|
|
592
|
-
sortThemeKeys
|
|
593
|
-
};
|
|
582
|
+
|
|
583
|
+
export { IconSet, blankIconSet, sortThemeKeys };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const icon = require('@iconify/utils/lib/icon');
|
|
6
|
+
|
|
7
|
+
const maxIteration = 5;
|
|
8
|
+
function findMatchingIcon(iconSet, icon$1) {
|
|
9
|
+
const body = icon$1.body;
|
|
10
|
+
let hiddenMatch = null;
|
|
11
|
+
function isMatching(data) {
|
|
12
|
+
for (const key in icon.iconDefaults) {
|
|
13
|
+
const attr = key;
|
|
14
|
+
if (data[attr] !== icon$1[attr]) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
function test(name, iteration) {
|
|
21
|
+
const data = iconSet.resolve(name, true);
|
|
22
|
+
if (!data) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
if (isMatching(data)) {
|
|
26
|
+
if (data.hidden) {
|
|
27
|
+
hiddenMatch = name;
|
|
28
|
+
} else {
|
|
29
|
+
return name;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (iteration > maxIteration) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
for (const key in iconSet.entries) {
|
|
36
|
+
const item = iconSet.entries[key];
|
|
37
|
+
if (item.type === "variation" && item.parent === name) {
|
|
38
|
+
const result = test(key, iteration + 1);
|
|
39
|
+
if (typeof result === "string") {
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
for (const key in iconSet.entries) {
|
|
47
|
+
const item = iconSet.entries[key];
|
|
48
|
+
if (item.type === "icon" && item.body === body) {
|
|
49
|
+
const result = test(key, 0);
|
|
50
|
+
if (typeof result === "string") {
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return hiddenMatch;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
exports.findMatchingIcon = findMatchingIcon;
|
package/lib/icon-set/match.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { FullIconifyIcon } from '@iconify/utils/lib/icon';
|
|
2
|
+
import { IconSet } from './index.js';
|
|
3
|
+
import '@iconify/types';
|
|
4
|
+
import '@iconify/utils/lib/customisations';
|
|
5
|
+
import './types.js';
|
|
6
|
+
import '../svg/index.js';
|
|
7
|
+
|
|
3
8
|
/**
|
|
4
9
|
* Find matching icon in icon set
|
|
5
10
|
*/
|
|
6
|
-
|
|
11
|
+
declare function findMatchingIcon(iconSet: IconSet, icon: FullIconifyIcon): string | null;
|
|
12
|
+
|
|
13
|
+
export { findMatchingIcon };
|
package/lib/icon-set/match.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { iconDefaults } from '@iconify/utils/lib/icon';
|
|
2
|
+
|
|
3
|
+
const maxIteration = 5;
|
|
4
4
|
function findMatchingIcon(iconSet, icon) {
|
|
5
5
|
const body = icon.body;
|
|
6
6
|
let hiddenMatch = null;
|
|
@@ -50,6 +50,5 @@ function findMatchingIcon(iconSet, icon) {
|
|
|
50
50
|
}
|
|
51
51
|
return hiddenMatch;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
};
|
|
53
|
+
|
|
54
|
+
export { findMatchingIcon };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const iconSet_index = require('./index.cjs');
|
|
6
|
+
const iconSet_match = require('./match.cjs');
|
|
7
|
+
require('@iconify/utils/lib/icon');
|
|
8
|
+
require('@iconify/utils/lib/svg/build');
|
|
9
|
+
require('@iconify/utils/lib/customisations');
|
|
10
|
+
require('@iconify/utils/lib/icon-set/minify');
|
|
11
|
+
require('@iconify/utils/lib/icon-set/convert-info');
|
|
12
|
+
require('./props.cjs');
|
|
13
|
+
require('../svg/index.cjs');
|
|
14
|
+
require('cheerio');
|
|
15
|
+
require('@iconify/utils');
|
|
16
|
+
|
|
17
|
+
function mergeIconSets(oldIcons, newIcons) {
|
|
18
|
+
const mergedIcons = new iconSet_index.IconSet(newIcons.export());
|
|
19
|
+
const oldEntries = oldIcons.entries;
|
|
20
|
+
const entries = mergedIcons.entries;
|
|
21
|
+
function add(name) {
|
|
22
|
+
if (entries[name]) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
const item = oldEntries[name];
|
|
26
|
+
switch (item.type) {
|
|
27
|
+
case "icon": {
|
|
28
|
+
const fullIcon = oldIcons.resolve(name, true);
|
|
29
|
+
const parent = fullIcon ? iconSet_match.findMatchingIcon(mergedIcons, fullIcon) : null;
|
|
30
|
+
if (parent !== null) {
|
|
31
|
+
mergedIcons.setAlias(name, parent);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
const props = item.props;
|
|
35
|
+
mergedIcons.setItem(name, {
|
|
36
|
+
...item,
|
|
37
|
+
props: {
|
|
38
|
+
...props,
|
|
39
|
+
hidden: true
|
|
40
|
+
},
|
|
41
|
+
categories: /* @__PURE__ */ new Set()
|
|
42
|
+
});
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
case "variation":
|
|
46
|
+
case "alias": {
|
|
47
|
+
let parent = item.parent;
|
|
48
|
+
if (!add(parent)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const parentItem = entries[parent];
|
|
52
|
+
if (parentItem.type === "alias") {
|
|
53
|
+
parent = parentItem.parent;
|
|
54
|
+
}
|
|
55
|
+
if (item.type === "variation") {
|
|
56
|
+
const props = item.props;
|
|
57
|
+
mergedIcons.setItem(name, {
|
|
58
|
+
...item,
|
|
59
|
+
parent,
|
|
60
|
+
props: {
|
|
61
|
+
...props,
|
|
62
|
+
hidden: true
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
mergedIcons.setItem(name, {
|
|
67
|
+
...item,
|
|
68
|
+
parent
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
default:
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (const name in oldEntries) {
|
|
78
|
+
add(name);
|
|
79
|
+
}
|
|
80
|
+
return mergedIcons;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
exports.mergeIconSets = mergeIconSets;
|
package/lib/icon-set/merge.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { IconSet } from '.';
|
|
1
|
+
import { IconSet } from './index.js';
|
|
2
|
+
import '@iconify/types';
|
|
3
|
+
import '@iconify/utils/lib/customisations';
|
|
4
|
+
import './types.js';
|
|
5
|
+
import '../svg/index.js';
|
|
6
|
+
|
|
2
7
|
/**
|
|
3
8
|
* Merge icon sets
|
|
4
9
|
*/
|
|
5
|
-
|
|
10
|
+
declare function mergeIconSets(oldIcons: IconSet, newIcons: IconSet): IconSet;
|
|
11
|
+
|
|
12
|
+
export { mergeIconSets };
|
package/lib/icon-set/merge.mjs
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { IconSet } from './index.mjs';
|
|
2
|
+
import { findMatchingIcon } from './match.mjs';
|
|
3
|
+
import '@iconify/utils/lib/icon';
|
|
4
|
+
import '@iconify/utils/lib/svg/build';
|
|
5
|
+
import '@iconify/utils/lib/customisations';
|
|
6
|
+
import '@iconify/utils/lib/icon-set/minify';
|
|
7
|
+
import '@iconify/utils/lib/icon-set/convert-info';
|
|
8
|
+
import './props.mjs';
|
|
9
|
+
import '../svg/index.mjs';
|
|
10
|
+
import 'cheerio';
|
|
11
|
+
import '@iconify/utils';
|
|
12
|
+
|
|
6
13
|
function mergeIconSets(oldIcons, newIcons) {
|
|
7
14
|
const mergedIcons = new IconSet(newIcons.export());
|
|
8
15
|
const oldEntries = oldIcons.entries;
|
|
@@ -27,7 +34,7 @@ function mergeIconSets(oldIcons, newIcons) {
|
|
|
27
34
|
...props,
|
|
28
35
|
hidden: true
|
|
29
36
|
},
|
|
30
|
-
categories: new Set()
|
|
37
|
+
categories: /* @__PURE__ */ new Set()
|
|
31
38
|
});
|
|
32
39
|
return true;
|
|
33
40
|
}
|
|
@@ -60,7 +67,6 @@ function mergeIconSets(oldIcons, newIcons) {
|
|
|
60
67
|
return true;
|
|
61
68
|
}
|
|
62
69
|
default:
|
|
63
|
-
assertNever(item);
|
|
64
70
|
return false;
|
|
65
71
|
}
|
|
66
72
|
}
|
|
@@ -69,6 +75,5 @@ function mergeIconSets(oldIcons, newIcons) {
|
|
|
69
75
|
}
|
|
70
76
|
return mergedIcons;
|
|
71
77
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
78
|
+
|
|
79
|
+
export { mergeIconSets };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const icon = require('@iconify/utils/lib/icon');
|
|
6
|
+
|
|
7
|
+
const extraDefaultProps = {
|
|
8
|
+
hidden: false
|
|
9
|
+
};
|
|
10
|
+
const defaultCommonProps = {
|
|
11
|
+
...icon.iconDefaults,
|
|
12
|
+
...extraDefaultProps
|
|
13
|
+
};
|
|
14
|
+
const props = Object.keys(defaultCommonProps);
|
|
15
|
+
function filterProps(data, compareDefaultValues) {
|
|
16
|
+
const result = {};
|
|
17
|
+
props.forEach((attr) => {
|
|
18
|
+
const value = data[attr];
|
|
19
|
+
if (value !== void 0 && (!compareDefaultValues || value !== defaultCommonProps[attr])) {
|
|
20
|
+
result[attr] = value;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.defaultCommonProps = defaultCommonProps;
|
|
27
|
+
exports.extraDefaultProps = extraDefaultProps;
|
|
28
|
+
exports.filterProps = filterProps;
|
package/lib/icon-set/props.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ExtraIconProps, CommonIconProps } from './types.js';
|
|
2
|
+
import '@iconify/types';
|
|
3
|
+
|
|
2
4
|
/**
|
|
3
5
|
* Default properties
|
|
4
6
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
declare const extraDefaultProps: Required<ExtraIconProps>;
|
|
8
|
+
declare const defaultCommonProps: Required<CommonIconProps>;
|
|
7
9
|
/**
|
|
8
10
|
* Filter icon props: copies properties, removing undefined and default entries
|
|
9
11
|
*/
|
|
10
|
-
|
|
12
|
+
declare function filterProps(data: CommonIconProps, compareDefaultValues: boolean): CommonIconProps;
|
|
13
|
+
|
|
14
|
+
export { defaultCommonProps, extraDefaultProps, filterProps };
|
package/lib/icon-set/props.mjs
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { iconDefaults } from '@iconify/utils/lib/icon';
|
|
2
|
+
|
|
3
|
+
const extraDefaultProps = {
|
|
4
4
|
hidden: false
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
const defaultCommonProps = {
|
|
7
7
|
...iconDefaults,
|
|
8
8
|
...extraDefaultProps
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
function filterProps(data) {
|
|
10
|
+
const props = Object.keys(defaultCommonProps);
|
|
11
|
+
function filterProps(data, compareDefaultValues) {
|
|
12
12
|
const result = {};
|
|
13
13
|
props.forEach((attr) => {
|
|
14
14
|
const value = data[attr];
|
|
15
|
-
if (value !== void 0 && value !== defaultCommonProps[attr]) {
|
|
15
|
+
if (value !== void 0 && (!compareDefaultValues || value !== defaultCommonProps[attr])) {
|
|
16
16
|
result[attr] = value;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
return result;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
extraDefaultProps,
|
|
24
|
-
filterProps
|
|
25
|
-
};
|
|
21
|
+
|
|
22
|
+
export { defaultCommonProps, extraDefaultProps, filterProps };
|