UNPKG

1.41 kBTypeScriptView Raw
1import { MentionsProps } from './Mentions';
2import { OptionProps } from './Option';
3export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
4declare type OmitFunc = <T extends object, K extends [...(keyof T)[]]>(obj: T, ...keys: K) => {
5 [K2 in Exclude<keyof T, K[number]>]: T[K2];
6};
7export declare const omit: OmitFunc;
8/**
9 * Cut input selection into 2 part and return text before selection start
10 */
11export declare function getBeforeSelectionText(input: HTMLTextAreaElement): string;
12interface MeasureIndex {
13 location: number;
14 prefix: string;
15}
16/**
17 * Find the last match prefix index
18 */
19export declare function getLastMeasureIndex(text: string, prefix?: string | string[]): MeasureIndex;
20interface MeasureConfig {
21 measureLocation: number;
22 prefix: string;
23 targetText: string;
24 selectionStart: number;
25 split: string;
26}
27/**
28 * Paint targetText into current text:
29 * text: little@litest
30 * targetText: light
31 * => little @light test
32 */
33export declare function replaceWithMeasure(text: string, measureConfig: MeasureConfig): {
34 text: string;
35 selectionLocation: number;
36};
37export declare function setInputSelection(input: HTMLTextAreaElement, location: number): void;
38export declare function validateSearch(text: string, props: MentionsProps): boolean;
39export declare function filterOption(input: string, { value }: OptionProps): boolean;
40export {};