UNPKG

@tensorify.io/sdk

Version:

TypeScript SDK for developing Tensorify plugins with comprehensive validation, frontend enforcement, and publishing tools

136 lines 3.6 kB
/** * Settings field types for the Tensorify SDK * Defines how plugin settings are configured and validated */ /** * UI component types available for settings fields */ export declare enum SettingsUIType { INPUT_TEXT = "input-text", TEXTAREA = "textarea", INPUT_NUMBER = "input-number", SLIDER = "slider", TOGGLE = "toggle", CHECKBOX = "checkbox", DROPDOWN = "dropdown", RADIO = "radio", MULTI_SELECT = "multi-select", CODE_EDITOR = "code-editor", FILE_UPLOAD = "file-upload", COLOR_PICKER = "color-picker", DATE_PICKER = "date-picker" } /** * Data types for settings fields */ export declare enum SettingsDataType { STRING = "string", NUMBER = "number", BOOLEAN = "boolean", ARRAY = "array", OBJECT = "object", FILE = "file", DATE = "date", COLOR = "color" } /** * Options for dropdown and radio fields */ export interface SelectOption { /** Display text */ label: string; /** Actual value */ value: any; /** Optional description */ description?: string; /** Whether option is selectable */ disabled?: boolean; } /** * Validation rules for settings fields */ export interface FieldValidation { minLength?: number; maxLength?: number; /** For numeric fields */ min?: number; /** For numeric fields */ max?: number; /** Regex pattern */ pattern?: string; /** Custom validation function */ customValidator?: string; /** Custom error message */ errorMessage?: string; } /** * Conditional display rules for settings fields */ export interface ConditionalDisplay { /** Field key this depends on */ dependsOn: string; /** Condition type */ condition: "equals" | "not-equals" | "greater-than" | "less-than" | "contains" | "not-contains"; /** Value to compare against */ value: any; } /** * Complete settings field definition */ export interface SettingsField { /** Maps to settings object key */ key: string; /** UI display label */ label: string; /** UI component type */ type: SettingsUIType; /** Underlying data type */ dataType: SettingsDataType; /** Default value */ defaultValue?: any; /** Validation requirement */ required: boolean; /** Help text/tooltip */ description?: string; /** Validation rules */ validation?: FieldValidation; /** Show/hide based on other fields */ conditionalDisplay?: ConditionalDisplay; /** For dropdown/radio fields */ options?: SelectOption[]; /** Input placeholder text */ placeholder?: string; /** Grouping for UI organization */ group?: string; /** Field order within group */ order?: number; } /** * Settings field grouping for UI organization */ export interface SettingsGroup { /** Unique group identifier */ id: string; /** Display label for the group */ label: string; /** Optional description */ description?: string; /** Whether the group can be collapsed */ collapsible: boolean; /** Whether the group is expanded by default */ defaultExpanded: boolean; /** Field keys in this group */ fields: string[]; /** Display order */ order?: number; } /** * Type mapping for UI components to data types * Used for validation during plugin development */ export declare const UI_TYPE_TO_DATA_TYPE_MAP: Record<SettingsUIType, SettingsDataType[]>; /** * Default values for different data types */ export declare const DEFAULT_VALUES: Record<SettingsDataType, any>; //# sourceMappingURL=settings.d.ts.map