import { Signal } from "@preact/signals";
import * as icons from "@components/icons.tsx";

type IconKey = keyof typeof icons;

export type MenuState = {
  activeMenu: Signal<string>;
  activeState: Signal<"input" | "error" | "normal" | "loading">;
  loadingText:Signal<string>;
  commandInput: Signal<string>;
  visible: Signal<boolean>;
  menus: Record<string, Menu>;
};

export type MenuEntry = {
  cb: (state: MenuState, context: unknown) => void;
  icon?: IconKey;
  meta?: string;
  visible?: boolean | ((context: unknown) => boolean);
  title: string;
};

export type Menu = {
  title: string;
  entries: MenuEntry[];
};
