flaming-icons
Version:
Complete icon library with tree-shaking support for Vue and Vuetify
64 lines (63 loc) • 1.22 kB
JavaScript
class t {
constructor() {
this.icons = /* @__PURE__ */ new Map();
}
/**
* Add icons to the library
*/
add(...o) {
for (const s of o)
if (this.icons.set(s.name, s), s.aliases)
for (const n of s.aliases)
this.icons.set(n, s);
}
/**
* Find icon definition by name
*/
findIconDefinition(o) {
return this.icons.get(o.iconName) || null;
}
/**
* Check if icon exists
*/
hasIcon(o) {
return this.icons.has(o);
}
/**
* Get all registered icons
*/
getIcons() {
const o = /* @__PURE__ */ new Set();
for (const s of this.icons.values())
o.add(s);
return Array.from(o);
}
/**
* Get icons by category
*/
getByCategory(o) {
const s = /* @__PURE__ */ new Set();
for (const n of this.icons.values())
n.category === o && s.add(n);
return Array.from(s);
}
/**
* Get all available categories
*/
getCategories() {
const o = /* @__PURE__ */ new Set();
for (const s of this.icons.values())
o.add(s.category);
return Array.from(o).sort();
}
/**
* Clear all icons (for testing)
*/
clear() {
this.icons.clear();
}
}
const r = new t();
export {
r as library
};