sudovanilla-website/public/@shoelace-style/shoelace/cdn/chunks/chunk.ZL53POKZ.js
2024-05-13 23:34:06 -04:00

44 lines
1,004 B
JavaScript

import {
library_default_default
} from "./chunk.P7ZG6EMR.js";
import {
library_system_default
} from "./chunk.3TFKS637.js";
// src/components/icon/library.ts
var registry = [library_default_default, library_system_default];
var watchedIcons = [];
function watchIcon(icon) {
watchedIcons.push(icon);
}
function unwatchIcon(icon) {
watchedIcons = watchedIcons.filter((el) => el !== icon);
}
function getIconLibrary(name) {
return registry.find((lib) => lib.name === name);
}
function registerIconLibrary(name, options) {
unregisterIconLibrary(name);
registry.push({
name,
resolver: options.resolver,
mutator: options.mutator,
spriteSheet: options.spriteSheet
});
watchedIcons.forEach((icon) => {
if (icon.library === name) {
icon.setIcon();
}
});
}
function unregisterIconLibrary(name) {
registry = registry.filter((lib) => lib.name !== name);
}
export {
watchIcon,
unwatchIcon,
getIconLibrary,
registerIconLibrary,
unregisterIconLibrary
};