@iconify/tools 2.0.17 → 2.0.18
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/icon-set/index.cjs
CHANGED
|
@@ -42,6 +42,9 @@ class IconSet {
|
|
|
42
42
|
}
|
|
43
43
|
if (data.aliases) {
|
|
44
44
|
for (const name in data.aliases) {
|
|
45
|
+
if (entries[name]) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
45
48
|
const item = data.aliases[name];
|
|
46
49
|
const parent = item.parent;
|
|
47
50
|
const props = iconSet_props.filterProps(item, false);
|
|
@@ -341,7 +344,7 @@ class IconSet {
|
|
|
341
344
|
return true;
|
|
342
345
|
}).length;
|
|
343
346
|
}
|
|
344
|
-
|
|
347
|
+
findCategory(title, add) {
|
|
345
348
|
const categoryItem = Array.from(this.categories).find((item) => item.title === title);
|
|
346
349
|
if (categoryItem) {
|
|
347
350
|
return categoryItem;
|
|
@@ -357,7 +360,7 @@ class IconSet {
|
|
|
357
360
|
return null;
|
|
358
361
|
}
|
|
359
362
|
listCategory(category) {
|
|
360
|
-
const categoryItem = typeof category === "string" ? this.
|
|
363
|
+
const categoryItem = typeof category === "string" ? this.findCategory(category, false) : category;
|
|
361
364
|
if (!categoryItem) {
|
|
362
365
|
return null;
|
|
363
366
|
}
|
|
@@ -529,7 +532,7 @@ class IconSet {
|
|
|
529
532
|
}
|
|
530
533
|
toggleCategory(iconName, category, add) {
|
|
531
534
|
const item = this.entries[iconName];
|
|
532
|
-
const categoryItem = this.
|
|
535
|
+
const categoryItem = this.findCategory(category, add);
|
|
533
536
|
if (!item || !categoryItem) {
|
|
534
537
|
return false;
|
|
535
538
|
}
|
package/lib/icon-set/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ declare class IconSet {
|
|
|
75
75
|
/**
|
|
76
76
|
* Find category by title
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
findCategory(title: string, add: boolean): IconCategory | null;
|
|
79
79
|
/**
|
|
80
80
|
* Count icons in category, remove category if empty
|
|
81
81
|
*
|
package/lib/icon-set/index.mjs
CHANGED
|
@@ -38,6 +38,9 @@ class IconSet {
|
|
|
38
38
|
}
|
|
39
39
|
if (data.aliases) {
|
|
40
40
|
for (const name in data.aliases) {
|
|
41
|
+
if (entries[name]) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
41
44
|
const item = data.aliases[name];
|
|
42
45
|
const parent = item.parent;
|
|
43
46
|
const props = filterProps(item, false);
|
|
@@ -337,7 +340,7 @@ class IconSet {
|
|
|
337
340
|
return true;
|
|
338
341
|
}).length;
|
|
339
342
|
}
|
|
340
|
-
|
|
343
|
+
findCategory(title, add) {
|
|
341
344
|
const categoryItem = Array.from(this.categories).find((item) => item.title === title);
|
|
342
345
|
if (categoryItem) {
|
|
343
346
|
return categoryItem;
|
|
@@ -353,7 +356,7 @@ class IconSet {
|
|
|
353
356
|
return null;
|
|
354
357
|
}
|
|
355
358
|
listCategory(category) {
|
|
356
|
-
const categoryItem = typeof category === "string" ? this.
|
|
359
|
+
const categoryItem = typeof category === "string" ? this.findCategory(category, false) : category;
|
|
357
360
|
if (!categoryItem) {
|
|
358
361
|
return null;
|
|
359
362
|
}
|
|
@@ -525,7 +528,7 @@ class IconSet {
|
|
|
525
528
|
}
|
|
526
529
|
toggleCategory(iconName, category, add) {
|
|
527
530
|
const item = this.entries[iconName];
|
|
528
|
-
const categoryItem = this.
|
|
531
|
+
const categoryItem = this.findCategory(category, add);
|
|
529
532
|
if (!item || !categoryItem) {
|
|
530
533
|
return false;
|
|
531
534
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Collection of functions for cleaning up and parsing SVG for Iconify project",
|
|
5
5
|
"author": "Vjacheslav Trushkin",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.18",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": "https://github.com/iconify/tools/issues",
|
|
9
9
|
"homepage": "https://github.com/iconify/tools",
|