{"version":3,"file":"completion.cjs","sources":["../../../src/types/completion.ts"],"sourcesContent":["import { Value } from 'slate';\nimport { Editor } from 'slate-react';\n\nimport { SearchFunctionType } from '../utils/searchFunctions';\n\n/**\n * @internal\n */\nexport type SearchFunction = (items: CompletionItem[], prefix: string) => CompletionItem[];\n\nexport interface CompletionItemGroup {\n  /**\n   * Label that will be displayed for all entries of this group.\n   */\n  label: string;\n\n  /**\n   * List of suggestions of this group.\n   */\n  items: CompletionItem[];\n\n  /**\n   * If true, match only by prefix (and not mid-word).\n   * @deprecated use searchFunctionType instead\n   */\n  prefixMatch?: boolean;\n\n  /**\n   * Function type used to create auto-complete list\n   * @alpha\n   */\n  searchFunctionType?: SearchFunctionType;\n\n  /**\n   * If true, do not filter items in this group based on the search.\n   */\n  skipFilter?: boolean;\n\n  /**\n   * If true, do not sort items.\n   */\n  skipSort?: boolean;\n}\n\nexport enum CompletionItemKind {\n  GroupTitle = 'GroupTitle',\n}\n\n/**\n * @internal\n */\nexport type HighlightPart = {\n  start: number;\n  end: number;\n};\n\nexport interface CompletionItem {\n  /**\n   * The label of this completion item. By default\n   * this is also the text that is inserted when selecting\n   * this completion.\n   */\n  label: string;\n\n  /**\n   * The kind of this completion item. An icon is chosen\n   * by the editor based on the kind.\n   */\n  kind?: CompletionItemKind | string;\n\n  /**\n   * A human-readable string with additional information\n   * about this item, like type or symbol information.\n   */\n  detail?: string;\n\n  /**\n   * A human-readable string, can be Markdown, that represents a doc-comment.\n   */\n  documentation?: string;\n\n  /**\n   * A string that should be used when comparing this item\n   * with other items. When `falsy` the `label` is used.\n   * @deprecated use sortValue instead\n   */\n  sortText?: string;\n\n  /**\n   * A string or number that should be used when comparing this\n   * item with other items. When `undefined` then `label` is used.\n   * @alpha\n   */\n  sortValue?: string | number;\n\n  /**\n   * Parts of the label to be highlighted\n   * @internal\n   */\n  highlightParts?: HighlightPart[];\n\n  /**\n   * A string that should be used when filtering a set of\n   * completion items. When `falsy` the `label` is used.\n   */\n  filterText?: string;\n\n  /**\n   * A string or snippet that should be inserted in a document when selecting\n   * this completion. When `falsy` the `label` is used.\n   */\n  insertText?: string;\n\n  /**\n   * Delete number of characters before the caret position,\n   * by default the letters from the beginning of the word.\n   */\n  deleteBackwards?: number;\n\n  /**\n   * Number of steps to move after the insertion, can be negative.\n   */\n  move?: number;\n}\n\nexport interface TypeaheadOutput {\n  context?: string;\n  suggestions: CompletionItemGroup[];\n}\n\nexport interface TypeaheadInput {\n  text: string;\n  prefix: string;\n  wrapperClasses: string[];\n  labelKey?: string;\n  value?: Value;\n  editor?: Editor;\n}\n\nexport interface SuggestionsState {\n  groupedItems: CompletionItemGroup[];\n  typeaheadPrefix: string;\n  typeaheadContext: string;\n  typeaheadText: string;\n}\n"],"names":["CompletionItemKind"],"mappings":";;;;;AA4CO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,YAAA,CAAA,GAAa,YAAA;AADH,EAAA,OAAAA,mBAAAA;AAAA,CAAA,EAAA,kBAAA,IAAA,EAAA;;;;"}