import { IEditor, IServiceID } from "../../../types/kernel.js"; import "../../../types/index.js"; import "../utils/utils.js"; import { MenuItemType } from "@lobehub/ui"; import { ReactNode } from "react"; import Fuse, { IFuseOptions } from "fuse.js"; type ISlashDividerOption = { type: 'divider'; }; interface ISlashMenuOption extends MenuItemType { description?: ReactNode; layout?: 'compact' | 'tile' | 'wide'; metadata?: Record; onSelect?: (editor: IEditor, matchingString: string) => void; shortcut?: ReactNode; } interface ISlashSectionOption { items: ISlashMenuOption[]; key?: string; label: ReactNode; type: 'section'; } type ISlashOption = ISlashMenuOption | ISlashDividerOption | ISlashSectionOption; declare const isSlashDividerOption: (option: ISlashOption) => option is ISlashDividerOption; declare const isSlashSectionOption: (option: ISlashOption) => option is ISlashSectionOption; declare const isSlashMenuOption: (option: ISlashOption) => option is ISlashMenuOption; declare const flattenSlashOptions: (options: ISlashOption[]) => ISlashMenuOption[]; interface SlashOptions { allowWhitespace?: boolean; /** * Complete Fuse.js configuration options * @example * { * keys: ['key', 'label', 'description'], * threshold: 0.3, * includeScore: true, * includeMatches: true * } */ fuseOptions?: IFuseOptions; items: Array | ((search: { leadOffset: number; matchingString: string; replaceableString: string; } | null) => Promise>); maxLength?: number; minLength?: number; punctuation?: string; /** * Fuse.js search keys for fuzzy matching * Default is ['key'] * @example ['key', 'label', 'description'] * @deprecated Use fuseOptions instead */ searchKeys?: string[]; trigger: string; } interface SlashTriggerResolution { leadOffset: number; trigger: string; } interface ISlashService { registerSlash(options: SlashOptions): void; resolveTrigger(text: string): SlashTriggerResolution | null; updateOptions(options: SlashOptions[]): void; } declare const ISlashService: IServiceID; export { ISlashDividerOption, ISlashMenuOption, ISlashOption, ISlashSectionOption, ISlashService, SlashOptions, SlashTriggerResolution, flattenSlashOptions, isSlashDividerOption, isSlashMenuOption, isSlashSectionOption };