supapup
Version:
⚡ Lightning-fast MCP browser dev tool. Navigate → Get instant structured data. No screenshots needed! Puppeteer: 📸 → CSS selectors → JS eval. Supapup: semantic IDs ready to use. 10x faster, 90% fewer tokens.
72 lines • 1.78 kB
TypeScript
/**
* Form detection and JSON template generation
* Helps agents understand what data to send for form filling
*/
export interface FormField {
id: string;
type: string;
name: string;
required: boolean;
placeholder?: string;
label?: string;
value?: any;
options?: string[];
minLength?: number;
maxLength?: number;
pattern?: string;
}
export interface FormTemplate {
formId: string;
formName: string;
fields: FormField[];
jsonTemplate: Record<string, any>;
example: Record<string, any>;
description: string;
}
export declare class FormDetector {
/**
* Detect all forms on the page and generate JSON templates
*/
static detectForms(): FormTemplate[];
/**
* Find all form containers (actual forms only)
*/
private static findFormContainers;
/**
* Extract all form fields from a container
*/
private static extractFormFields;
/**
* Get the label for a field
*/
private static getFieldLabel;
/**
* Check if field has a required indicator (like * or "required" text)
*/
private static hasRequiredIndicator;
/**
* Get current value of a field
*/
private static getCurrentValue;
/**
* Get options for a select field
*/
private static getSelectOptions;
/**
* Generate a JSON template with field types
*/
private static generateJsonTemplate;
/**
* Generate example data for the form
*/
private static generateExampleData;
/**
* Generate a description of the form
*/
private static generateFormDescription;
/**
* Try to determine form name/purpose
*/
private static getFormName;
}
//# sourceMappingURL=form-detector.d.ts.map