wizard-ql
Version:
WizardQL is a natural-language-like query language for constructing data queries for resources that meet conditions.
17 lines (16 loc) • 891 B
TypeScript
import { type Token, type TypeRecord } from './spec';
import { type ExpressionConstraints, parse } from './parse';
import { ConstraintError, ParseError } from './errors';
interface DOMInputOptions<T extends TypeRecord, V extends boolean> {
input: HTMLElement;
constraints?: ExpressionConstraints<T, V>;
onUpdate?: (expression: ReturnType<typeof parse<T, V>> | ParseError | ConstraintError, tokens: Token[], string: string) => void;
parseOnInitialize?: boolean;
}
/**
* Initialize an element to become a Wizard langugae input
* @warn This is a DOM function that is not meant for the backend
* @returns A destroy function (destroys listening and functionality, not the element)
*/
export declare function createDOMInput<const T extends TypeRecord, const V extends boolean>({ input, constraints, onUpdate, parseOnInitialize }: DOMInputOptions<T, V>): () => void;
export {};