@character-foundry/character-foundry 0.1.3 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/app-framework.cjs +1859 -0
- package/dist/app-framework.cjs.map +1 -0
- package/dist/app-framework.d.cts +896 -0
- package/dist/app-framework.d.ts +896 -2
- package/dist/app-framework.js +1835 -1
- package/dist/app-framework.js.map +1 -1
- package/dist/charx.cjs +979 -0
- package/dist/charx.cjs.map +1 -0
- package/dist/charx.d.cts +640 -0
- package/dist/charx.d.ts +640 -2
- package/dist/charx.js +955 -1
- package/dist/charx.js.map +1 -1
- package/dist/core.cjs +755 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +404 -0
- package/dist/core.d.ts +404 -2
- package/dist/core.js +731 -1
- package/dist/core.js.map +1 -1
- package/dist/exporter.cjs +7619 -0
- package/dist/exporter.cjs.map +1 -0
- package/dist/exporter.d.cts +681 -0
- package/dist/exporter.d.ts +681 -2
- package/dist/exporter.js +7602 -1
- package/dist/exporter.js.map +1 -1
- package/dist/federation.cjs +3916 -0
- package/dist/federation.cjs.map +1 -0
- package/dist/federation.d.cts +2951 -0
- package/dist/federation.d.ts +2951 -2
- package/dist/federation.js +3892 -1
- package/dist/federation.js.map +1 -1
- package/dist/index.cjs +9213 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1119 -0
- package/dist/index.d.ts +1113 -20
- package/dist/index.js +9196 -26
- package/dist/index.js.map +1 -1
- package/dist/loader.cjs +8951 -0
- package/dist/loader.cjs.map +1 -0
- package/dist/loader.d.cts +1037 -0
- package/dist/loader.d.ts +1037 -2
- package/dist/loader.js +8934 -1
- package/dist/loader.js.map +1 -1
- package/dist/lorebook.cjs +866 -0
- package/dist/lorebook.cjs.map +1 -0
- package/dist/lorebook.d.cts +1008 -0
- package/dist/lorebook.d.ts +1008 -2
- package/dist/lorebook.js +842 -1
- package/dist/lorebook.js.map +1 -1
- package/dist/media.cjs +6661 -0
- package/dist/media.cjs.map +1 -0
- package/dist/media.d.cts +87 -0
- package/dist/media.d.ts +87 -2
- package/dist/media.js +6644 -1
- package/dist/media.js.map +1 -1
- package/dist/normalizer.cjs +503 -0
- package/dist/normalizer.cjs.map +1 -0
- package/dist/normalizer.d.cts +1217 -0
- package/dist/normalizer.d.ts +1217 -2
- package/dist/normalizer.js +479 -1
- package/dist/normalizer.js.map +1 -1
- package/dist/png.cjs +797 -0
- package/dist/png.cjs.map +1 -0
- package/dist/png.d.cts +786 -0
- package/dist/png.d.ts +786 -2
- package/dist/png.js +773 -1
- package/dist/png.js.map +1 -1
- package/dist/schemas.cjs +879 -0
- package/dist/schemas.cjs.map +1 -0
- package/dist/schemas.d.cts +2208 -0
- package/dist/schemas.d.ts +2208 -2
- package/dist/schemas.js +855 -1
- package/dist/schemas.js.map +1 -1
- package/dist/tokenizers.cjs +153 -0
- package/dist/tokenizers.cjs.map +1 -0
- package/dist/tokenizers.d.cts +155 -0
- package/dist/tokenizers.d.ts +155 -2
- package/dist/tokenizers.js +129 -1
- package/dist/tokenizers.js.map +1 -1
- package/dist/voxta.cjs +7907 -0
- package/dist/voxta.cjs.map +1 -0
- package/dist/voxta.d.cts +1349 -0
- package/dist/voxta.d.ts +1349 -2
- package/dist/voxta.js +7890 -1
- package/dist/voxta.js.map +1 -1
- package/package.json +177 -45
- package/dist/app-framework.d.ts.map +0 -1
- package/dist/charx.d.ts.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/exporter.d.ts.map +0 -1
- package/dist/federation.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/loader.d.ts.map +0 -1
- package/dist/lorebook.d.ts.map +0 -1
- package/dist/media.d.ts.map +0 -1
- package/dist/normalizer.d.ts.map +0 -1
- package/dist/png.d.ts.map +0 -1
- package/dist/schemas.d.ts.map +0 -1
- package/dist/tokenizers.d.ts.map +0 -1
- package/dist/voxta.d.ts.map +0 -1
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Restricted context object passed to extensions during activation.
|
|
7
|
+
* Provides access to configuration and core services.
|
|
8
|
+
*/
|
|
9
|
+
export interface ExtensionContext<TConfig> {
|
|
10
|
+
/** Current configuration (validated) */
|
|
11
|
+
readonly config: TConfig;
|
|
12
|
+
/** Update configuration (triggers re-validation) */
|
|
13
|
+
setConfig: (update: Partial<TConfig>) => void;
|
|
14
|
+
/** Core services available to extensions */
|
|
15
|
+
services: ExtensionServices;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Core services available to all extensions
|
|
19
|
+
*/
|
|
20
|
+
export interface ExtensionServices {
|
|
21
|
+
/** Toast notification service */
|
|
22
|
+
toast: ToastService;
|
|
23
|
+
/** Modal dialog service */
|
|
24
|
+
dialog: DialogService;
|
|
25
|
+
/** Event bus for cross-extension communication */
|
|
26
|
+
events: EventBus;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Toast notification service interface
|
|
30
|
+
*/
|
|
31
|
+
export interface ToastService {
|
|
32
|
+
/** Show success message */
|
|
33
|
+
success(message: string): void;
|
|
34
|
+
/** Show error message */
|
|
35
|
+
error(message: string): void;
|
|
36
|
+
/** Show info message */
|
|
37
|
+
info(message: string): void;
|
|
38
|
+
/** Show warning message */
|
|
39
|
+
warning(message: string): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Modal dialog service interface
|
|
43
|
+
*/
|
|
44
|
+
export interface DialogService {
|
|
45
|
+
/** Show confirmation dialog, returns true if confirmed */
|
|
46
|
+
confirm(message: string, title?: string): Promise<boolean>;
|
|
47
|
+
/** Show alert dialog */
|
|
48
|
+
alert(message: string, title?: string): Promise<void>;
|
|
49
|
+
/** Show prompt dialog, returns input value or null if cancelled */
|
|
50
|
+
prompt(message: string, defaultValue?: string): Promise<string | null>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Event bus for cross-extension communication
|
|
54
|
+
*/
|
|
55
|
+
export interface EventBus {
|
|
56
|
+
/** Emit an event with optional payload */
|
|
57
|
+
emit(event: string, payload?: unknown): void;
|
|
58
|
+
/** Subscribe to an event, returns unsubscribe function */
|
|
59
|
+
on(event: string, handler: (payload: unknown) => void): () => void;
|
|
60
|
+
/** Subscribe to an event once */
|
|
61
|
+
once(event: string, handler: (payload: unknown) => void): () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* No-op implementations of services for testing or standalone usage
|
|
65
|
+
*/
|
|
66
|
+
export declare const noopServices: ExtensionServices;
|
|
67
|
+
/**
|
|
68
|
+
* Base extension interface - all modular pieces implement this.
|
|
69
|
+
* Extensions are the building blocks of the plugin system.
|
|
70
|
+
*
|
|
71
|
+
* @template TConfig - Zod schema type for the configuration
|
|
72
|
+
*/
|
|
73
|
+
export interface Extension<TConfig extends z.ZodType = z.ZodType> {
|
|
74
|
+
/** Unique identifier, e.g., "com.foundry.openai" */
|
|
75
|
+
id: string;
|
|
76
|
+
/** Human-readable name, e.g., "OpenAI Provider" */
|
|
77
|
+
name: string;
|
|
78
|
+
/** SemVer version string */
|
|
79
|
+
version: string;
|
|
80
|
+
/** Zod schema defining the configuration shape (source of truth) */
|
|
81
|
+
configSchema: TConfig;
|
|
82
|
+
/** Default configuration values */
|
|
83
|
+
defaultConfig?: z.infer<TConfig>;
|
|
84
|
+
/** Called when extension is activated */
|
|
85
|
+
onActivate?: (context: ExtensionContext<z.infer<TConfig>>) => void | Promise<void>;
|
|
86
|
+
/** Called when extension is deactivated */
|
|
87
|
+
onDeactivate?: () => void | Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Extension state during runtime
|
|
91
|
+
*/
|
|
92
|
+
export interface ExtensionState<TConfig = unknown> {
|
|
93
|
+
/** The extension definition */
|
|
94
|
+
extension: Extension<z.ZodType<TConfig>>;
|
|
95
|
+
/** Whether the extension is currently active */
|
|
96
|
+
active: boolean;
|
|
97
|
+
/** Current validated configuration */
|
|
98
|
+
config: TConfig;
|
|
99
|
+
/** Error message if extension failed to activate */
|
|
100
|
+
error?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Built-in widget types that AutoForm understands
|
|
104
|
+
*/
|
|
105
|
+
export type BuiltinWidget = "text" | "number" | "password" | "textarea" | "switch" | "checkbox" | "select" | "searchable-select" | "radio" | "slider" | "color-picker" | "tag-input" | "file-upload";
|
|
106
|
+
/**
|
|
107
|
+
* Props passed to custom widget components.
|
|
108
|
+
*
|
|
109
|
+
* This interface is designed to be compatible with external editors
|
|
110
|
+
* like Milkdown, CodeMirror, or any custom component. The minimum
|
|
111
|
+
* required props are `value` and `onChange`.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* // Wrapping an external editor
|
|
116
|
+
* function MilkdownWrapper({ value, onChange }: FieldWidgetProps<string>) {
|
|
117
|
+
* return <Milkdown value={value} onChange={onChange} />;
|
|
118
|
+
* }
|
|
119
|
+
*
|
|
120
|
+
* // Usage
|
|
121
|
+
* <AutoForm
|
|
122
|
+
* schema={schema}
|
|
123
|
+
* uiHints={{ content: { widget: MilkdownWrapper } }}
|
|
124
|
+
* />
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export interface FieldWidgetProps<T = unknown> {
|
|
128
|
+
/** Current field value */
|
|
129
|
+
value: T;
|
|
130
|
+
/** Callback to update the value */
|
|
131
|
+
onChange: (value: T) => void;
|
|
132
|
+
/** Field name from schema (supports dot notation for nested: "parent.child") */
|
|
133
|
+
name: string;
|
|
134
|
+
/** Label text (from hint or schema .describe()) */
|
|
135
|
+
label?: string;
|
|
136
|
+
/** Validation error message */
|
|
137
|
+
error?: string;
|
|
138
|
+
/** Whether the field is disabled */
|
|
139
|
+
disabled?: boolean;
|
|
140
|
+
/** Whether the field is required */
|
|
141
|
+
required?: boolean;
|
|
142
|
+
/** Additional UI hints for the field */
|
|
143
|
+
hint?: FieldUIHint;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Condition for showing/hiding a field based on another field's value.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* // Show only when advancedMode is true
|
|
151
|
+
* { field: 'advancedMode', equals: true }
|
|
152
|
+
*
|
|
153
|
+
* // Show only when kind is one of these values
|
|
154
|
+
* { field: 'kind', oneOf: ['openai', 'openai-compatible'] }
|
|
155
|
+
*
|
|
156
|
+
* // Show only when kind is NOT 'disabled'
|
|
157
|
+
* { field: 'kind', notEquals: 'disabled' }
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export interface FieldCondition {
|
|
161
|
+
/** The field name to check (supports dot notation for nested fields) */
|
|
162
|
+
field: string;
|
|
163
|
+
/** Show when field equals this exact value */
|
|
164
|
+
equals?: unknown;
|
|
165
|
+
/** Show when field does NOT equal this value */
|
|
166
|
+
notEquals?: unknown;
|
|
167
|
+
/** Show when field value is one of these values */
|
|
168
|
+
oneOf?: unknown[];
|
|
169
|
+
/** Show when field value is NOT one of these values */
|
|
170
|
+
notOneOf?: unknown[];
|
|
171
|
+
/** Custom predicate function for complex conditions */
|
|
172
|
+
when?: (value: unknown, allValues: Record<string, unknown>) => boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Field-level UI configuration
|
|
176
|
+
*/
|
|
177
|
+
export interface FieldUIHint {
|
|
178
|
+
/** Override the rendered widget */
|
|
179
|
+
widget?: BuiltinWidget | ComponentType<FieldWidgetProps<unknown>>;
|
|
180
|
+
/** Custom label (overrides schema .describe()) */
|
|
181
|
+
label?: string;
|
|
182
|
+
/** Helper text shown below field */
|
|
183
|
+
helperText?: string;
|
|
184
|
+
/** Placeholder text */
|
|
185
|
+
placeholder?: string;
|
|
186
|
+
/** For sliders/numbers: min value */
|
|
187
|
+
min?: number;
|
|
188
|
+
/** For sliders/numbers: max value */
|
|
189
|
+
max?: number;
|
|
190
|
+
/** For sliders/numbers: step increment */
|
|
191
|
+
step?: number;
|
|
192
|
+
/** For select/radio: explicit options (overrides z.enum) */
|
|
193
|
+
options?: Array<{
|
|
194
|
+
value: string;
|
|
195
|
+
label: string;
|
|
196
|
+
}>;
|
|
197
|
+
/** Hide this field from the form */
|
|
198
|
+
hidden?: boolean;
|
|
199
|
+
/** Make this field read-only */
|
|
200
|
+
readOnly?: boolean;
|
|
201
|
+
/** CSS class name to apply */
|
|
202
|
+
className?: string;
|
|
203
|
+
/** For textarea: number of rows */
|
|
204
|
+
rows?: number;
|
|
205
|
+
/** Custom validation message */
|
|
206
|
+
validationMessage?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Condition for showing this field.
|
|
209
|
+
* If not met, the field is hidden (not just visually - removed from DOM).
|
|
210
|
+
*/
|
|
211
|
+
condition?: FieldCondition;
|
|
212
|
+
/** For file-upload: accepted file types (e.g., "image/*", ".pdf,.doc") */
|
|
213
|
+
accept?: string;
|
|
214
|
+
/** For file-upload: allow multiple files */
|
|
215
|
+
multiple?: boolean;
|
|
216
|
+
/** For file-upload: max file size in bytes */
|
|
217
|
+
maxSize?: number;
|
|
218
|
+
/** For select: enable search/filter functionality */
|
|
219
|
+
searchable?: boolean;
|
|
220
|
+
/** For searchable-select: placeholder for search input */
|
|
221
|
+
searchPlaceholder?: string;
|
|
222
|
+
/** For searchable-select: "no results" message */
|
|
223
|
+
noResultsText?: string;
|
|
224
|
+
/** Group this field belongs to (for organization) */
|
|
225
|
+
group?: string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Props for the FieldGroup component
|
|
229
|
+
*/
|
|
230
|
+
export interface FieldGroupProps {
|
|
231
|
+
/** Group title */
|
|
232
|
+
title: string;
|
|
233
|
+
/** Group description/subtitle */
|
|
234
|
+
description?: string;
|
|
235
|
+
/** Allow collapsing the group */
|
|
236
|
+
collapsible?: boolean;
|
|
237
|
+
/** Start collapsed (requires collapsible=true) */
|
|
238
|
+
defaultCollapsed?: boolean;
|
|
239
|
+
/** CSS class name */
|
|
240
|
+
className?: string;
|
|
241
|
+
/** Children (field elements) */
|
|
242
|
+
children: React.ReactNode;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* UI hints map for a schema.
|
|
246
|
+
* Keys correspond to field names in the Zod object schema.
|
|
247
|
+
* Supports nested objects via dot notation or nested hint objects.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```tsx
|
|
251
|
+
* // Flat schema
|
|
252
|
+
* uiHints={{ name: { label: 'Full Name' } }}
|
|
253
|
+
*
|
|
254
|
+
* // Nested schema - both syntaxes work
|
|
255
|
+
* uiHints={{
|
|
256
|
+
* 'profile.name': { label: 'Profile Name' }, // dot notation
|
|
257
|
+
* profile: { name: { label: 'Profile Name' } } // nested object
|
|
258
|
+
* }}
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export type UIHints<T extends Record<string, unknown>> = {
|
|
262
|
+
[K in keyof T]?: T[K] extends Record<string, unknown> ? FieldUIHint | UIHints<T[K]> : FieldUIHint;
|
|
263
|
+
} & {
|
|
264
|
+
[key: string]: FieldUIHint | undefined;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Listener function type for registry changes
|
|
268
|
+
*/
|
|
269
|
+
export type RegistryListener<TId, TItem> = (id: TId, item: TItem | null, action: "register" | "unregister") => void;
|
|
270
|
+
/**
|
|
271
|
+
* Base options for registry items
|
|
272
|
+
*/
|
|
273
|
+
export interface RegistryItemBase {
|
|
274
|
+
/** Unique identifier */
|
|
275
|
+
id: string;
|
|
276
|
+
/** Human-readable name */
|
|
277
|
+
name?: string;
|
|
278
|
+
/** Description */
|
|
279
|
+
description?: string;
|
|
280
|
+
/** Icon identifier or URL */
|
|
281
|
+
icon?: string;
|
|
282
|
+
/** Order priority (lower = earlier) */
|
|
283
|
+
order?: number;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Generic registry pattern for managing registered items.
|
|
287
|
+
* Provides registration, lookup, and subscription capabilities.
|
|
288
|
+
*
|
|
289
|
+
* @template TId - Type of the item identifier (usually string)
|
|
290
|
+
* @template TItem - Type of the registered item
|
|
291
|
+
*/
|
|
292
|
+
export declare class Registry<TId extends string = string, TItem = unknown> {
|
|
293
|
+
private items;
|
|
294
|
+
private listeners;
|
|
295
|
+
/**
|
|
296
|
+
* Register an item with the given ID.
|
|
297
|
+
* Overwrites existing item with same ID (with warning).
|
|
298
|
+
*/
|
|
299
|
+
register(id: TId, item: TItem): void;
|
|
300
|
+
/**
|
|
301
|
+
* Unregister an item by ID.
|
|
302
|
+
* @returns true if item existed and was removed
|
|
303
|
+
*/
|
|
304
|
+
unregister(id: TId): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Get an item by ID.
|
|
307
|
+
* @returns The item or undefined if not found
|
|
308
|
+
*/
|
|
309
|
+
get(id: TId): TItem | undefined;
|
|
310
|
+
/**
|
|
311
|
+
* Check if an item with the given ID exists.
|
|
312
|
+
*/
|
|
313
|
+
has(id: TId): boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Get all registered items as a Map.
|
|
316
|
+
* Returns a copy to prevent external modification.
|
|
317
|
+
*/
|
|
318
|
+
getAll(): Map<TId, TItem>;
|
|
319
|
+
/**
|
|
320
|
+
* Get all registered item IDs.
|
|
321
|
+
*/
|
|
322
|
+
getAllIds(): TId[];
|
|
323
|
+
/**
|
|
324
|
+
* Get the number of registered items.
|
|
325
|
+
*/
|
|
326
|
+
get size(): number;
|
|
327
|
+
/**
|
|
328
|
+
* Subscribe to registry changes.
|
|
329
|
+
* @returns Unsubscribe function
|
|
330
|
+
*/
|
|
331
|
+
subscribe(listener: RegistryListener<TId, TItem>): () => void;
|
|
332
|
+
/**
|
|
333
|
+
* Clear all registered items.
|
|
334
|
+
* Notifies listeners for each removed item.
|
|
335
|
+
*/
|
|
336
|
+
clear(): void;
|
|
337
|
+
/**
|
|
338
|
+
* Iterate over all items.
|
|
339
|
+
*/
|
|
340
|
+
forEach(callback: (item: TItem, id: TId) => void): void;
|
|
341
|
+
/**
|
|
342
|
+
* Find items matching a predicate.
|
|
343
|
+
*/
|
|
344
|
+
filter(predicate: (item: TItem, id: TId) => boolean): TItem[];
|
|
345
|
+
private notify;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* A settings panel definition that can be registered.
|
|
349
|
+
* Settings panels appear in the application settings UI.
|
|
350
|
+
*
|
|
351
|
+
* @template TSchema - Zod object schema type for the settings
|
|
352
|
+
*/
|
|
353
|
+
export interface SettingsPanel<TSchema extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>> {
|
|
354
|
+
/** Unique identifier for the panel */
|
|
355
|
+
id: string;
|
|
356
|
+
/** Display title for the panel */
|
|
357
|
+
title: string;
|
|
358
|
+
/** Optional description */
|
|
359
|
+
description?: string;
|
|
360
|
+
/** Icon identifier or URL */
|
|
361
|
+
icon?: string;
|
|
362
|
+
/** Zod schema defining the settings shape */
|
|
363
|
+
schema: TSchema;
|
|
364
|
+
/** Default values for settings */
|
|
365
|
+
defaultValues?: z.infer<TSchema>;
|
|
366
|
+
/** UI hints for customizing field rendering */
|
|
367
|
+
uiHints?: UIHints<z.infer<TSchema>>;
|
|
368
|
+
/** Order priority (lower = earlier in list) */
|
|
369
|
+
order?: number;
|
|
370
|
+
/** Whether this panel is hidden from the UI */
|
|
371
|
+
hidden?: boolean;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Registry for settings panels.
|
|
375
|
+
* Allows extensions to inject settings panels into the app settings UI.
|
|
376
|
+
*/
|
|
377
|
+
export declare class SettingsRegistry extends Registry<string, SettingsPanel> {
|
|
378
|
+
/**
|
|
379
|
+
* Register a settings panel.
|
|
380
|
+
*/
|
|
381
|
+
registerPanel<T extends z.ZodObject<z.ZodRawShape>>(panel: SettingsPanel<T>): void;
|
|
382
|
+
/**
|
|
383
|
+
* Get all panels sorted by order (lower order = earlier).
|
|
384
|
+
* Hidden panels are excluded.
|
|
385
|
+
*/
|
|
386
|
+
getSortedPanels(): SettingsPanel[];
|
|
387
|
+
/**
|
|
388
|
+
* Get a panel by ID with proper typing.
|
|
389
|
+
*/
|
|
390
|
+
getPanel<T extends z.ZodObject<z.ZodRawShape>>(id: string): SettingsPanel<T> | undefined;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Default settings registry instance.
|
|
394
|
+
* Can be used directly or replaced with a custom instance.
|
|
395
|
+
*/
|
|
396
|
+
export declare const settingsRegistry: SettingsRegistry;
|
|
397
|
+
/**
|
|
398
|
+
* A provider definition that can be registered.
|
|
399
|
+
* Providers are services like LLM backends, storage adapters, etc.
|
|
400
|
+
*
|
|
401
|
+
* @template TConfig - Zod object schema type for the provider config
|
|
402
|
+
* @template TClient - Type of the client/service instance created by the provider
|
|
403
|
+
*/
|
|
404
|
+
export interface Provider<TConfig extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>, TClient = unknown> {
|
|
405
|
+
/** Unique identifier for the provider */
|
|
406
|
+
id: string;
|
|
407
|
+
/** Display name for the provider */
|
|
408
|
+
name: string;
|
|
409
|
+
/** Optional description */
|
|
410
|
+
description?: string;
|
|
411
|
+
/** Icon identifier or URL */
|
|
412
|
+
icon?: string;
|
|
413
|
+
/** Zod schema defining the configuration shape */
|
|
414
|
+
configSchema: TConfig;
|
|
415
|
+
/** Default configuration values */
|
|
416
|
+
defaultConfig?: z.infer<TConfig>;
|
|
417
|
+
/** UI hints for customizing config form rendering */
|
|
418
|
+
uiHints?: UIHints<z.infer<TConfig>>;
|
|
419
|
+
/** Factory function to create the client/service instance */
|
|
420
|
+
createClient: (config: z.infer<TConfig>) => TClient | Promise<TClient>;
|
|
421
|
+
/** Optional validation beyond Zod schema (e.g., API key verification) */
|
|
422
|
+
validateConfig?: (config: z.infer<TConfig>) => Promise<{
|
|
423
|
+
valid: boolean;
|
|
424
|
+
error?: string;
|
|
425
|
+
}>;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Registry for providers of a specific type.
|
|
429
|
+
* Use separate instances for different provider types (LLM, Storage, etc.).
|
|
430
|
+
*
|
|
431
|
+
* @template TClient - Common client interface type for this registry
|
|
432
|
+
*/
|
|
433
|
+
export declare class ProviderRegistry<TClient = unknown> extends Registry<string, Provider<z.ZodObject<z.ZodRawShape>, TClient>> {
|
|
434
|
+
private readonly providerType?;
|
|
435
|
+
constructor(providerType?: string | undefined);
|
|
436
|
+
/**
|
|
437
|
+
* Register a provider.
|
|
438
|
+
*/
|
|
439
|
+
registerProvider<T extends z.ZodObject<z.ZodRawShape>>(provider: Provider<T, TClient>): void;
|
|
440
|
+
/**
|
|
441
|
+
* Get a provider by ID with proper typing.
|
|
442
|
+
*/
|
|
443
|
+
getProvider<T extends z.ZodObject<z.ZodRawShape>>(id: string): Provider<T, TClient> | undefined;
|
|
444
|
+
/**
|
|
445
|
+
* Create a client instance for a provider.
|
|
446
|
+
* Validates config against schema and runs custom validation if provided.
|
|
447
|
+
*
|
|
448
|
+
* @throws Error if provider not found, config invalid, or custom validation fails
|
|
449
|
+
*/
|
|
450
|
+
createClient<T extends z.ZodObject<z.ZodRawShape>>(providerId: string, config: z.infer<T>): Promise<TClient>;
|
|
451
|
+
/**
|
|
452
|
+
* Get all providers as an array.
|
|
453
|
+
*/
|
|
454
|
+
getAllProviders(): Provider<z.ZodObject<z.ZodRawShape>, TClient>[];
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Create a typed provider registry for a specific client type.
|
|
458
|
+
*/
|
|
459
|
+
export declare function createProviderRegistry<TClient>(providerType?: string): ProviderRegistry<TClient>;
|
|
460
|
+
/**
|
|
461
|
+
* Widget component type for the registry.
|
|
462
|
+
*/
|
|
463
|
+
export type WidgetComponent = ComponentType<FieldWidgetProps<unknown>>;
|
|
464
|
+
/**
|
|
465
|
+
* Widget definition for registration.
|
|
466
|
+
*/
|
|
467
|
+
export interface WidgetDefinition {
|
|
468
|
+
/** Unique identifier for the widget */
|
|
469
|
+
id: string;
|
|
470
|
+
/** Display name */
|
|
471
|
+
name?: string;
|
|
472
|
+
/** The React component to render */
|
|
473
|
+
component: WidgetComponent;
|
|
474
|
+
/** Description of when to use this widget */
|
|
475
|
+
description?: string;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Registry for custom form widgets.
|
|
479
|
+
* Allows extensions to add custom field rendering components.
|
|
480
|
+
*/
|
|
481
|
+
export declare class WidgetRegistry extends Registry<string, WidgetDefinition> {
|
|
482
|
+
/**
|
|
483
|
+
* Register a custom widget.
|
|
484
|
+
*/
|
|
485
|
+
registerWidget(definition: WidgetDefinition): void;
|
|
486
|
+
/**
|
|
487
|
+
* Register a widget component directly with just an ID.
|
|
488
|
+
*/
|
|
489
|
+
registerComponent(id: string, component: WidgetComponent): void;
|
|
490
|
+
/**
|
|
491
|
+
* Get a widget component by ID.
|
|
492
|
+
* Returns the component directly, not the definition.
|
|
493
|
+
*/
|
|
494
|
+
getComponent(id: string): WidgetComponent | undefined;
|
|
495
|
+
/**
|
|
496
|
+
* Check if a widget ID is a built-in widget type.
|
|
497
|
+
* This list must stay in sync with the BuiltinWidget type in ui-hints.ts.
|
|
498
|
+
*/
|
|
499
|
+
isBuiltinWidget(id: string): id is BuiltinWidget;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Default widget registry instance.
|
|
503
|
+
*/
|
|
504
|
+
export declare const widgetRegistry: WidgetRegistry;
|
|
505
|
+
/**
|
|
506
|
+
* Props for the AutoForm component.
|
|
507
|
+
*
|
|
508
|
+
* @template T - Zod object schema type
|
|
509
|
+
*/
|
|
510
|
+
export interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
511
|
+
/** Zod object schema defining the form shape */
|
|
512
|
+
schema: T;
|
|
513
|
+
/** Current values (for controlled mode) */
|
|
514
|
+
values?: z.infer<T>;
|
|
515
|
+
/** Default values for the form */
|
|
516
|
+
defaultValues?: Partial<z.infer<T>>;
|
|
517
|
+
/** Called when values change (controlled mode) */
|
|
518
|
+
onChange?: (values: z.infer<T>) => void;
|
|
519
|
+
/** Called on form submit with validated data */
|
|
520
|
+
onSubmit?: (values: z.infer<T>) => void | Promise<void>;
|
|
521
|
+
/** UI hints for customizing field rendering */
|
|
522
|
+
uiHints?: UIHints<z.infer<T>>;
|
|
523
|
+
/** Custom field order (array of field names) */
|
|
524
|
+
fieldOrder?: Array<keyof z.infer<T>>;
|
|
525
|
+
/** Disable all fields */
|
|
526
|
+
disabled?: boolean;
|
|
527
|
+
/** Show submit button */
|
|
528
|
+
withSubmit?: boolean;
|
|
529
|
+
/** Submit button text */
|
|
530
|
+
submitText?: string;
|
|
531
|
+
/** Custom className for form container */
|
|
532
|
+
className?: string;
|
|
533
|
+
/** Custom widget registry */
|
|
534
|
+
widgetRegistry?: WidgetRegistry;
|
|
535
|
+
/**
|
|
536
|
+
* Render prop for custom form layout.
|
|
537
|
+
* If provided, you control how fields and submit button are rendered.
|
|
538
|
+
*/
|
|
539
|
+
children?: (props: {
|
|
540
|
+
/** Array of rendered field elements */
|
|
541
|
+
fields: ReactNode[];
|
|
542
|
+
/** Submit button element (null if withSubmit=false) */
|
|
543
|
+
submit: ReactNode;
|
|
544
|
+
/** Form state from react-hook-form */
|
|
545
|
+
formState: {
|
|
546
|
+
isSubmitting: boolean;
|
|
547
|
+
isValid: boolean;
|
|
548
|
+
isDirty: boolean;
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* Get a specific field by name.
|
|
552
|
+
* Supports dot notation for nested fields: getField('profile.name')
|
|
553
|
+
*/
|
|
554
|
+
getField: (name: string) => ReactNode | null;
|
|
555
|
+
/**
|
|
556
|
+
* Get fields belonging to a group (from uiHints.group).
|
|
557
|
+
*/
|
|
558
|
+
getFieldsByGroup: (group: string) => ReactNode[];
|
|
559
|
+
}) => ReactNode;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Schema-driven form component that automatically renders fields
|
|
563
|
+
* based on a Zod object schema.
|
|
564
|
+
*
|
|
565
|
+
* Features:
|
|
566
|
+
* - Nested object support
|
|
567
|
+
* - Conditional field visibility
|
|
568
|
+
* - Custom widget integration
|
|
569
|
+
* - Full react-hook-form integration
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```tsx
|
|
573
|
+
* const schema = z.object({
|
|
574
|
+
* name: z.string().describe('Your name'),
|
|
575
|
+
* profile: z.object({
|
|
576
|
+
* bio: z.string(),
|
|
577
|
+
* website: z.string().url().optional(),
|
|
578
|
+
* }),
|
|
579
|
+
* kind: z.enum(['basic', 'advanced']),
|
|
580
|
+
* advancedOption: z.string().optional(),
|
|
581
|
+
* });
|
|
582
|
+
*
|
|
583
|
+
* <AutoForm
|
|
584
|
+
* schema={schema}
|
|
585
|
+
* uiHints={{
|
|
586
|
+
* advancedOption: {
|
|
587
|
+
* condition: { field: 'kind', equals: 'advanced' }
|
|
588
|
+
* }
|
|
589
|
+
* }}
|
|
590
|
+
* onSubmit={(data) => console.log(data)}
|
|
591
|
+
* withSubmit
|
|
592
|
+
* />
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
export declare function AutoForm<T extends z.ZodObject<z.ZodRawShape>>({ schema, values, defaultValues, onChange, onSubmit, uiHints, fieldOrder, disabled, withSubmit, submitText, className, widgetRegistry, children, }: AutoFormProps<T>): react_jsx_runtime.JSX.Element;
|
|
596
|
+
/**
|
|
597
|
+
* Analyzed field information extracted from a Zod schema.
|
|
598
|
+
*/
|
|
599
|
+
export interface FieldInfo {
|
|
600
|
+
/** Field name in the schema */
|
|
601
|
+
name: string;
|
|
602
|
+
/** The Zod type (unwrapped from optional/nullable/default) */
|
|
603
|
+
zodType: z.ZodTypeAny;
|
|
604
|
+
/** Zod type constructor name (e.g., 'ZodString', 'ZodNumber', 'ZodObject') */
|
|
605
|
+
typeName: string;
|
|
606
|
+
/** Whether the field is optional */
|
|
607
|
+
isOptional: boolean;
|
|
608
|
+
/** Whether the field is nullable */
|
|
609
|
+
isNullable: boolean;
|
|
610
|
+
/** Default value if specified */
|
|
611
|
+
defaultValue?: unknown;
|
|
612
|
+
/** Description from .describe() */
|
|
613
|
+
description?: string;
|
|
614
|
+
/** Enum values for z.enum() or z.nativeEnum() */
|
|
615
|
+
enumValues?: string[];
|
|
616
|
+
/** Inner type info for arrays, optionals, etc. */
|
|
617
|
+
innerType?: FieldInfo;
|
|
618
|
+
/**
|
|
619
|
+
* For nested objects: Map of child field names to their FieldInfo.
|
|
620
|
+
* Only populated when typeName === 'ZodObject'.
|
|
621
|
+
*/
|
|
622
|
+
nestedFields?: Map<string, FieldInfo>;
|
|
623
|
+
/**
|
|
624
|
+
* For nested objects: The inner ZodObject schema.
|
|
625
|
+
* Useful for recursive AutoForm rendering.
|
|
626
|
+
*/
|
|
627
|
+
innerSchema?: z.ZodObject<z.ZodRawShape>;
|
|
628
|
+
/** Validation constraints extracted from the schema */
|
|
629
|
+
constraints?: FieldConstraints;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Validation constraints extracted from Zod checks.
|
|
633
|
+
*/
|
|
634
|
+
export interface FieldConstraints {
|
|
635
|
+
min?: number;
|
|
636
|
+
max?: number;
|
|
637
|
+
minLength?: number;
|
|
638
|
+
maxLength?: number;
|
|
639
|
+
regex?: RegExp;
|
|
640
|
+
email?: boolean;
|
|
641
|
+
url?: boolean;
|
|
642
|
+
uuid?: boolean;
|
|
643
|
+
int?: boolean;
|
|
644
|
+
positive?: boolean;
|
|
645
|
+
negative?: boolean;
|
|
646
|
+
multipleOf?: number;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Extract field information from a ZodObject schema.
|
|
650
|
+
*
|
|
651
|
+
* @param schema - Zod object schema to analyze
|
|
652
|
+
* @param prefix - Optional prefix for nested field names (e.g., "parent.")
|
|
653
|
+
* @returns Map of field names to their analyzed information
|
|
654
|
+
*/
|
|
655
|
+
export declare function analyzeSchema<T extends z.ZodRawShape>(schema: z.ZodObject<T>, prefix?: string): Map<string, FieldInfo>;
|
|
656
|
+
/**
|
|
657
|
+
* Flatten a nested schema into a single Map with dot-notation keys.
|
|
658
|
+
* Useful for forms that need flat access to all fields.
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```ts
|
|
662
|
+
* const schema = z.object({
|
|
663
|
+
* name: z.string(),
|
|
664
|
+
* profile: z.object({
|
|
665
|
+
* bio: z.string(),
|
|
666
|
+
* }),
|
|
667
|
+
* });
|
|
668
|
+
*
|
|
669
|
+
* const flat = flattenSchema(schema);
|
|
670
|
+
* // Map { 'name' => ..., 'profile' => ..., 'profile.bio' => ... }
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
export declare function flattenSchema<T extends z.ZodRawShape>(schema: z.ZodObject<T>, prefix?: string): Map<string, FieldInfo>;
|
|
674
|
+
/**
|
|
675
|
+
* Analyze a single Zod field to extract its type information.
|
|
676
|
+
*
|
|
677
|
+
* @param name - Field name (can include dots for nested paths)
|
|
678
|
+
* @param zodType - Zod type to analyze
|
|
679
|
+
* @returns Analyzed field information
|
|
680
|
+
*/
|
|
681
|
+
export declare function analyzeField(name: string, zodType: z.ZodTypeAny): FieldInfo;
|
|
682
|
+
/**
|
|
683
|
+
* Get the value at a dot-notation path from an object.
|
|
684
|
+
* SECURITY: Rejects dangerous keys (__proto__, constructor, prototype) to prevent prototype pollution.
|
|
685
|
+
*
|
|
686
|
+
* @example
|
|
687
|
+
* ```ts
|
|
688
|
+
* getValueAtPath({ profile: { name: 'John' } }, 'profile.name') // 'John'
|
|
689
|
+
* ```
|
|
690
|
+
*/
|
|
691
|
+
export declare function getValueAtPath(obj: Record<string, unknown>, path: string): unknown;
|
|
692
|
+
/**
|
|
693
|
+
* Set a value at a dot-notation path in an object (immutably).
|
|
694
|
+
* SECURITY: Rejects dangerous keys (__proto__, constructor, prototype) to prevent prototype pollution.
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```ts
|
|
698
|
+
* setValueAtPath({ profile: { name: 'John' } }, 'profile.name', 'Jane')
|
|
699
|
+
* // { profile: { name: 'Jane' } }
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
export declare function setValueAtPath(obj: Record<string, unknown>, path: string, value: unknown): Record<string, unknown>;
|
|
703
|
+
/**
|
|
704
|
+
* Determine the default widget type for a Zod field.
|
|
705
|
+
*/
|
|
706
|
+
export declare function getDefaultWidgetType(fieldInfo: FieldInfo): string;
|
|
707
|
+
/**
|
|
708
|
+
* Check if a field should be treated as a secret/password field.
|
|
709
|
+
*/
|
|
710
|
+
export declare function isSecretField(fieldInfo: FieldInfo): boolean;
|
|
711
|
+
/**
|
|
712
|
+
* Check if a field is a nested object type.
|
|
713
|
+
*/
|
|
714
|
+
export declare function isNestedObject(fieldInfo: FieldInfo): boolean;
|
|
715
|
+
/**
|
|
716
|
+
* Props for the FieldRenderer component.
|
|
717
|
+
*/
|
|
718
|
+
export interface FieldRendererProps {
|
|
719
|
+
/** Analyzed field information from Zod schema */
|
|
720
|
+
fieldInfo: FieldInfo;
|
|
721
|
+
/** UI hints for this field */
|
|
722
|
+
hint?: FieldUIHint;
|
|
723
|
+
/** Current field value */
|
|
724
|
+
value: unknown;
|
|
725
|
+
/** Callback to update the value */
|
|
726
|
+
onChange: (value: unknown) => void;
|
|
727
|
+
/** Validation error message */
|
|
728
|
+
error?: string;
|
|
729
|
+
/** Whether the field is disabled */
|
|
730
|
+
disabled?: boolean;
|
|
731
|
+
/**
|
|
732
|
+
* For nested objects: render function for nested fields.
|
|
733
|
+
* Called with the nested field info to recursively render.
|
|
734
|
+
*/
|
|
735
|
+
renderNestedField?: (fieldInfo: FieldInfo) => React.ReactNode;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Renders a single field based on its Zod type and UI hints.
|
|
739
|
+
* Automatically selects the appropriate widget component.
|
|
740
|
+
*/
|
|
741
|
+
export declare function FieldRenderer({ fieldInfo, hint, value, onChange, error, disabled, renderNestedField, }: FieldRendererProps): react_jsx_runtime.JSX.Element;
|
|
742
|
+
/**
|
|
743
|
+
* Headless field group component for organizing form sections.
|
|
744
|
+
* Can be used standalone or with AutoForm's render prop.
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```tsx
|
|
748
|
+
* // Standalone usage
|
|
749
|
+
* <FieldGroup title="Basic Settings">
|
|
750
|
+
* <TextInput ... />
|
|
751
|
+
* <NumberInput ... />
|
|
752
|
+
* </FieldGroup>
|
|
753
|
+
*
|
|
754
|
+
* // Collapsible group
|
|
755
|
+
* <FieldGroup title="Advanced" collapsible defaultCollapsed>
|
|
756
|
+
* <Switch ... />
|
|
757
|
+
* </FieldGroup>
|
|
758
|
+
*
|
|
759
|
+
* // With AutoForm render prop
|
|
760
|
+
* <AutoForm schema={schema}>
|
|
761
|
+
* {({ getField }) => (
|
|
762
|
+
* <>
|
|
763
|
+
* <FieldGroup title="Profile">
|
|
764
|
+
* {getField('name')}
|
|
765
|
+
* {getField('email')}
|
|
766
|
+
* </FieldGroup>
|
|
767
|
+
* <FieldGroup title="Preferences" collapsible>
|
|
768
|
+
* {getField('theme')}
|
|
769
|
+
* {getField('notifications')}
|
|
770
|
+
* </FieldGroup>
|
|
771
|
+
* </>
|
|
772
|
+
* )}
|
|
773
|
+
* </AutoForm>
|
|
774
|
+
* ```
|
|
775
|
+
*/
|
|
776
|
+
export declare function FieldGroup({ title, description, collapsible, defaultCollapsed, className, children, }: FieldGroupProps): react_jsx_runtime.JSX.Element;
|
|
777
|
+
/**
|
|
778
|
+
* Props for the FieldSection component (alias for FieldGroup).
|
|
779
|
+
*/
|
|
780
|
+
export type FieldSectionProps = FieldGroupProps;
|
|
781
|
+
/**
|
|
782
|
+
* Alias for FieldGroup with semantic naming.
|
|
783
|
+
* Use when you prefer "section" terminology over "group".
|
|
784
|
+
*/
|
|
785
|
+
export declare const FieldSection: typeof FieldGroup;
|
|
786
|
+
/**
|
|
787
|
+
* Context for providing a custom WidgetRegistry to AutoForm.
|
|
788
|
+
*/
|
|
789
|
+
export declare const WidgetRegistryContext: react.Context<WidgetRegistry>;
|
|
790
|
+
/**
|
|
791
|
+
* Hook to access the current WidgetRegistry.
|
|
792
|
+
* Returns the default registry if not wrapped in a provider.
|
|
793
|
+
*/
|
|
794
|
+
export declare function useWidgetRegistry(): WidgetRegistry;
|
|
795
|
+
/**
|
|
796
|
+
* Headless text input widget.
|
|
797
|
+
* Renders a basic text input with label, error display, and helper text.
|
|
798
|
+
*/
|
|
799
|
+
export declare function TextInput({ value, onChange, name, label, error, disabled, required, hint, }: FieldWidgetProps<string>): react_jsx_runtime.JSX.Element;
|
|
800
|
+
/**
|
|
801
|
+
* Headless multi-line text input widget.
|
|
802
|
+
* Renders a textarea with configurable rows.
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* ```tsx
|
|
806
|
+
* // Via uiHints
|
|
807
|
+
* <AutoForm
|
|
808
|
+
* schema={schema}
|
|
809
|
+
* uiHints={{ bio: { widget: 'textarea', rows: 5 } }}
|
|
810
|
+
* />
|
|
811
|
+
* ```
|
|
812
|
+
*/
|
|
813
|
+
export declare function Textarea({ value, onChange, name, label, error, disabled, required, hint, }: FieldWidgetProps<string>): react_jsx_runtime.JSX.Element;
|
|
814
|
+
/**
|
|
815
|
+
* Props for NumberInput - allows number | undefined since empty inputs are undefined
|
|
816
|
+
*/
|
|
817
|
+
export type NumberInputProps = Omit<FieldWidgetProps<number | undefined>, "onChange"> & {
|
|
818
|
+
/** Value can be number or undefined (empty) */
|
|
819
|
+
value: number | undefined;
|
|
820
|
+
/** onChange receives number or undefined (empty) */
|
|
821
|
+
onChange: (value: number | undefined) => void;
|
|
822
|
+
};
|
|
823
|
+
/**
|
|
824
|
+
* Headless number input widget.
|
|
825
|
+
* Renders a number input with min/max/step support.
|
|
826
|
+
*
|
|
827
|
+
* Note: This widget properly handles empty inputs as `undefined`,
|
|
828
|
+
* not as a type-cast lie. The form resolver handles validation
|
|
829
|
+
* for required fields.
|
|
830
|
+
*/
|
|
831
|
+
export declare function NumberInput({ value, onChange, name, label, error, disabled, required, hint, }: NumberInputProps): react_jsx_runtime.JSX.Element;
|
|
832
|
+
/**
|
|
833
|
+
* Headless switch/toggle widget.
|
|
834
|
+
* Renders a checkbox with switch semantics (role="switch").
|
|
835
|
+
*/
|
|
836
|
+
export declare function Switch({ value, onChange, name, label, error, disabled, hint, }: FieldWidgetProps<boolean>): react_jsx_runtime.JSX.Element;
|
|
837
|
+
/**
|
|
838
|
+
* Headless select dropdown widget.
|
|
839
|
+
* Renders a native select element with options from hint or enum values.
|
|
840
|
+
*/
|
|
841
|
+
export declare function Select({ value, onChange, name, label, error, disabled, required, hint, }: FieldWidgetProps<string>): react_jsx_runtime.JSX.Element;
|
|
842
|
+
/**
|
|
843
|
+
* Headless searchable select widget.
|
|
844
|
+
* Renders a select with search/filter functionality for large option lists.
|
|
845
|
+
*
|
|
846
|
+
* @example
|
|
847
|
+
* ```tsx
|
|
848
|
+
* // Via uiHints
|
|
849
|
+
* <AutoForm
|
|
850
|
+
* schema={z.object({ country: z.enum([...countries]) })}
|
|
851
|
+
* uiHints={{
|
|
852
|
+
* country: {
|
|
853
|
+
* widget: 'searchable-select',
|
|
854
|
+
* searchPlaceholder: 'Search countries...',
|
|
855
|
+
* noResultsText: 'No countries found',
|
|
856
|
+
* }
|
|
857
|
+
* }}
|
|
858
|
+
* />
|
|
859
|
+
* ```
|
|
860
|
+
*/
|
|
861
|
+
export declare function SearchableSelect({ value, onChange, name, label, error, disabled, required, hint, }: FieldWidgetProps<string>): react_jsx_runtime.JSX.Element;
|
|
862
|
+
/**
|
|
863
|
+
* Headless tag/chip input widget.
|
|
864
|
+
* Renders an input that converts text into tags on Enter/comma.
|
|
865
|
+
*/
|
|
866
|
+
export declare function TagInput({ value, onChange, name, label, error, disabled, required, hint, }: FieldWidgetProps<string[]>): react_jsx_runtime.JSX.Element;
|
|
867
|
+
/**
|
|
868
|
+
* Headless password/secret input widget.
|
|
869
|
+
* Renders a password input with toggle visibility button.
|
|
870
|
+
*/
|
|
871
|
+
export declare function SecretInput({ value, onChange, name, label, error, disabled, required, hint, }: FieldWidgetProps<string>): react_jsx_runtime.JSX.Element;
|
|
872
|
+
/**
|
|
873
|
+
* File or array of files depending on `multiple` hint.
|
|
874
|
+
*/
|
|
875
|
+
export type FileUploadValue = File | File[] | null;
|
|
876
|
+
/**
|
|
877
|
+
* Headless file upload widget with drag-and-drop support.
|
|
878
|
+
*
|
|
879
|
+
* @example
|
|
880
|
+
* ```tsx
|
|
881
|
+
* // Single file
|
|
882
|
+
* <AutoForm
|
|
883
|
+
* schema={z.object({ avatar: z.instanceof(File).optional() })}
|
|
884
|
+
* uiHints={{ avatar: { widget: 'file-upload', accept: 'image/*' } }}
|
|
885
|
+
* />
|
|
886
|
+
*
|
|
887
|
+
* // Multiple files
|
|
888
|
+
* <AutoForm
|
|
889
|
+
* schema={z.object({ attachments: z.array(z.instanceof(File)) })}
|
|
890
|
+
* uiHints={{ attachments: { widget: 'file-upload', multiple: true, accept: '.pdf,.doc' } }}
|
|
891
|
+
* />
|
|
892
|
+
* ```
|
|
893
|
+
*/
|
|
894
|
+
export declare function FileUpload({ value, onChange, name, label, error, disabled, required, hint, }: FieldWidgetProps<FileUploadValue>): react_jsx_runtime.JSX.Element;
|
|
895
|
+
|
|
896
|
+
export {};
|