import { IDomProp } from "../query/query"; import { IAyakashiInstance } from "../prelude"; import { IRenderlessAyakashiInstance } from "../renderlessPrelude"; export interface IExtractActions { /** * Extracts data from a prop. * Learn more here: https://ayakashi-io.github.io/docs/guide/data-extraction.html * ```js ayakashi.select("myDivProp").where({id: {eq: "myDiv"}}); const result = await ayakashi.extract("myDivProp"); ``` */ extract: (propId: string | IDomProp, extractable?: Extractable) => Promise<(T | U)[]>; /** * Extracts data from the first match of a prop. * Learn more here: https://ayakashi-io.github.io/docs/guide/data-extraction.html * ```js ayakashi.select("myDivProp").where({id: {eq: "myDiv"}}); const result = await ayakashi.extractFirst("myDivProp"); ``` */ extractFirst: (propId: string | IDomProp, extractable?: Extractable) => Promise; /** * Extracts data from the last match of a prop. * Learn more here: https://ayakashi-io.github.io/docs/guide/data-extraction.html * ```js ayakashi.select("myDivProp").where({id: {eq: "myDiv"}}); const result = await ayakashi.extractLast("myDivProp"); ``` */ extractLast: (propId: string | IDomProp, extractable?: Extractable) => Promise; } export declare type ExtractorFn = (this: Window["ayakashi"]) => { extract: (el: any) => any; isValid: (result: any) => boolean; useDefault: () => any; }; export declare type Extractable = string | ((el: HTMLElement, index: number) => T | U) | RegExp | [ string | RegExp, U ]; export declare function attachExtract(ayakashiInstance: IAyakashiInstance | IRenderlessAyakashiInstance): void;