import { type Component } from "vue";
import { markRaw } from "vue";

export const modules = import.meta.glob("./icons/*.vue", { eager: true });

// 创建图标映射
export const iconMap = new Map<
  string,
  {
    title: string;
    component: Component;
  }
>();

Object.values(modules).forEach((module: any) => {
  const component = module.default;
  if (component?.name) {
    iconMap.set(component.name, {
      title: component.title,
      component: markRaw(component),
    });
  }
});
