/** * Code generation methods for Selector and Filter inside an element * * @since 0.0.1-alpha1 */ import { UtamFilter, UtamSelector } from '@utam/types'; /** * Represents the shared properties across all declarations ASTs */ export interface BaseDeclarationAST { name: string; parentArgs: string[]; } /** * Represents the element selector AST */ export interface SelectorDeclarationAST extends BaseDeclarationAST { selector: UtamSelector; parentName?: string; nullable: boolean; parentNullable: boolean; parentSelectorReturnsList: boolean; insideShadow: boolean; isContainer: boolean; parentFilterApplicationName?: string; } export declare function validateState(declarations: SelectorDeclarationAST[], by?: string): asserts by is string; export declare function generateSelectorDeclarationCode(ast: SelectorDeclarationAST, { byId, shadowId }: { byId: string; shadowId?: string; }): string; /** * Represents the filter declaration AST */ export interface FilterDeclarationAST extends BaseDeclarationAST { filter: UtamFilter; /** name (or UID) of the element that is being filtered */ elementName: string | number; } export declare function generateFilterDeclarationCode(ast: FilterDeclarationAST, byId: string): string; /** * Represents the function that will apply the filter AST */ export interface FilterApplicationDeclarationAST extends FilterDeclarationAST { /** identifier of the hoisted filter function generated for the element */ filterFunctionName: string; } /** * Generates the code for the hoisted filter application. * * This code is being generated when an element has a filter and a nested tree of elements. * It's generated once when processing the parent element and the function name is stored in the * SelectorDeclarationAST context so that it can be referenced when generating the nested elements hoisted getters. * * @param ast AST that holds the required information for generating this function * @returns the generated code for the hoisted filter application function */ export declare function generateFilterApplicationDeclarationCode(ast: FilterApplicationDeclarationAST): string; /** * Represents the index declaration AST */ export interface IndexDeclarationAST { elementName: string; indexFunctionName: string; selectorMethod: BaseDeclarationAST; indexArgName: string; } /** * Invocation of filter inside index function AST */ export interface FilterApplicationForIndexAST { filterFunctionIdentifier: string; filterFunctionArgs: string[]; } /** * Generate code of index method for list with nested elements. * It invokes hoisted method that returns list and then returns Nth element where N is provided as index parameter. * If element has filter that returns list, Nth is applied after filter returned list. * * @param indexAst AST that holds the required information for generating this function * @param filterAst AST for filter application * @returns the generated code for the hoisted function */ export declare function generateIndexDeclarationCode(indexAst: IndexDeclarationAST, filterAst?: FilterApplicationForIndexAST): string; //# sourceMappingURL=block-declarations-generator.d.ts.map