export type MindMapNode = {
  getStyle: (key: string, checkRoot?: boolean) => unknown;
  setStyle?: (key: string, value: unknown) => void;
  setIcon?: (icons: string[]) => void;
  setImage?: (img: { url: string; title?: string; width?: number; height?: number } | null) => void;
  getData: (key: string) => unknown;
  nodeData?: { data?: Record<string, unknown> };
  data?: Record<string, unknown>;
  active?: () => void;
  parent?: { children?: unknown[] } | null;
  children?: unknown[];
  uid?: string;
  isRoot?: boolean;
  isGeneralization?: boolean;
  setHyperlink?: (url: string, title: string) => void;
  setNote?: (note: string) => void;
};

// 思维导图实例：这里仅声明本项目用到的最小形状，避免到处用 any
export type MindMapInstance = {
  renderer?: {
    activeNodeList?: MindMapNode[];
    lastActiveNodeList?: MindMapNode[];
    copy?: () => void;
    cut?: () => void;
    paste?: () => void;
  };
  execCommand?: (command: string, ...args: unknown[]) => void;
  doExport?: { export: (type: string, ...args: unknown[]) => void };
  on?: (event: string, fn: (...args: unknown[]) => void) => void;
  off?: (event: string, fn: (...args: unknown[]) => void) => void;
  setData?: (data: unknown) => void;
  command?: { clearHistory?: () => void };
};
