aboutsummaryrefslogtreecommitdiffstats
path: root/packages/excalidraw/components/CommandPalette/types.ts
blob: 957d699273ca72797c34974570c687f432861360 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import type { ActionManager } from "../../actions/manager";
import type { Action } from "../../actions/types";
import type { UIAppState } from "../../types";

export type CommandPaletteItem = {
  label: string;
  /** additional keywords to match against
   * (appended to haystack, not displayed) */
  keywords?: string[];
  /**
   * string we should match against when searching
   * (deburred name + keywords)
   */
  haystack?: string;
  icon?: React.ReactNode | ((appState: UIAppState) => React.ReactNode);
  category: string;
  order?: number;
  predicate?: boolean | Action["predicate"];
  shortcut?: string;
  /** if false, command will not show while in view mode */
  viewMode?: boolean;
  perform: (data: {
    actionManager: ActionManager;
    event: React.MouseEvent | React.KeyboardEvent | KeyboardEvent;
  }) => void;
};