@xraph/smartform-react
Version:
React library for rendering and validating SmartForms with shadcn components
20 lines (19 loc) • 1.19 kB
TypeScript
export declare function templateVariableExpression(expression: string): string;
export declare function variableRef(path: string): string;
export declare function functionCall(name: string, ...args: string[]): string;
export declare function forEachExpression(itemVar: string, collection: string, body: string): string;
export declare function forEachWithIndexExpression(itemVar: string, indexVar: string, collection: string, body: string): string;
export declare function ternaryExpression(condition: string, trueValue: string, falseValue: string): string;
export declare function nullCoalesceExpression(value: string, defaultValue: string): string;
export declare function arrayAccessExpression(array: string, index: number): string;
/**
* Creates a conditional value using the 'if' function.
* From template_utils.go
*/
export declare function conditionalValue(condition: string, trueValue: string, falseValue: string): string;
/**
* Creates a formatted value using the 'format' function.
* The format string itself should be passed as a string literal (e.g., '"Hello, %s"').
* From template_utils.go
*/
export declare function formatValue(format: string, ...args: string[]): string;