@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
36 lines (34 loc) • 895 B
JavaScript
import { defaultIcons } from "./consts.js";
//#region src/icons/cache.ts
/**
* Holds the collection of selected predefined icons. Can be extended with more icons by the consumer.
* When using icons, they will be checked in library before loading them from CDN.
*/
var IconsCache = class {
cache = /* @__PURE__ */ new Map();
add = (...icons) => {
icons.forEach((icon) => {
this.cache.set(icon.name, icon);
});
};
get = (name) => {
const icon = this.cache.get(name);
if (!icon) console.error(`Icon ${name} does not exist in the library.`);
return icon;
};
has = (name) => {
return this.cache.has(name);
};
init = () => {
this.add(...Object.values(defaultIcons));
};
reset = () => {
this.cache.clear();
};
};
const cache = new IconsCache();
cache.init();
//#endregion
export { cache as default };
globalThis.__vuiVersion__ = "5.3.1"
//# sourceMappingURL=cache.js.map