reactaform 1.3.0 → 1.4.2

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 CHANGED
@@ -271,6 +271,66 @@ import { ReactaFormProvider, ReactaFormRenderer } from 'reactaform';
271
271
  </ReactaFormProvider>
272
272
  ```
273
273
 
274
+ ## 🔌 Plugin Support
275
+
276
+ ReactaForm includes a plugin system to register components, validation handlers, submission handlers, and optional lifecycle hooks. Plugins let you bundle reusable form extensions and share them across projects.
277
+
278
+ Basic plugin shape (TypeScript):
279
+
280
+ ```ts
281
+ const myPlugin: ReactaFormPlugin = {
282
+ name: 'my-awesome-plugin',
283
+ version: '0.1.0',
284
+ description: 'Adds a custom field and validators',
285
+ components: {
286
+ customType: CustomInput,
287
+ },
288
+ fieldValidators: {
289
+ default: {
290
+ myValidator: (value) => (value ? null : 'Required'),
291
+ },
292
+ },
293
+ submissionHandlers: {
294
+ mySubmitHandler: async (_, __, values) => {
295
+ // Custom submission logic
296
+ return [] as string[]; // return array of errors or empty array
297
+ },
298
+ },
299
+ setup() {
300
+ // optional init logic
301
+ },
302
+ cleanup() {
303
+ // optional teardown logic
304
+ },
305
+ };
306
+ ```
307
+
308
+ Registering a plugin:
309
+
310
+ ```ts
311
+ import { registerPlugin } from 'reactaform';
312
+
313
+ registerPlugin(myPlugin, { conflictResolution: 'warn' });
314
+ ```
315
+
316
+ Options and conflict handling:
317
+
318
+ - `conflictResolution`: one of `'error'` (default), `'warn'`, `'override'`, or `'skip'`.
319
+ - `onConflict`: optional callback `(conflict: PluginConflict) => boolean` to programmatically decide whether to proceed when a conflict occurs.
320
+
321
+ Unregistering and inspecting plugins:
322
+
323
+ ```ts
324
+ import { unregisterPlugin, getPlugin, getAllPlugins, hasPlugin } from 'reactaform';
325
+
326
+ unregisterPlugin('my-awesome-plugin', true); // remove plugin and its registrations
327
+ const plugin = getPlugin('my-awesome-plugin');
328
+ const all = getAllPlugins();
329
+ const exists = hasPlugin('my-awesome-plugin');
330
+ ```
331
+
332
+ For implementation details and advanced behavior, see the plugin registry implementation: [src/core/registries/pluginRegistry.ts](src/core/registries/pluginRegistry.ts#L1-L240).
333
+
274
334
  ## 📚 API Reference
275
335
 
276
336
  ### ReactaForm Props
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare function injectReactaFormStyles(): void;
1
2
  export { default as ReactaForm } from './components/ReactaForm';
2
3
  export { default as ReactaFormRenderer } from './components/ReactaFormRenderer';
3
4
  export type { ReactaFormRendererProps } from './components/ReactaFormRenderer';
@@ -7,12 +8,16 @@ export { StandardFieldLayout } from './components/LayoutComponents';
7
8
  export { CSS_CLASSES, combineClasses } from './utils/cssClasses';
8
9
  export type { ReactaFormContextType, ReactaFormProviderProps, DefinitionPropertyField, ReactaDefinition, ReactaInstance, ReactaFormProps, FieldValueType, ErrorType, FieldValidationHandler, FormValidationHandler, FormSubmissionHandler, InputOnChange, BaseInputProps, TranslationFunction, } from './core/reactaFormTypes';
9
10
  export { registerComponent, getComponent, } from './core/registries/componentRegistry';
10
- export { validateFieldValue, validateFormValues } from './core/validation';
11
+ export { validateFieldValue } from './core/validation';
12
+ export { registerPlugin, unregisterPlugin, getPlugin, getAllPlugins, hasPlugin, registerComponents, } from './core/registries/pluginRegistry';
13
+ export type { ReactaFormPlugin, ConflictResolution, PluginRegistrationOptions, PluginConflict, } from './core/registries/pluginRegistry';
14
+ export type { LoadDefinitionOptions, DefinitionLoadResult, InstanceLoadResult, } from './core/reactaFormModel';
11
15
  export { loadJsonDefinition, createInstanceFromDefinition, // Create new instance with default values
12
16
  loadInstance, // Load existing instance (valuesMap)
13
17
  upgradeInstanceToLatestDefinition } from './core/reactaFormModel';
14
18
  export { registerSubmissionHandler, } from './core/registries/submissionHandlerRegistry';
15
19
  export { registerFieldValidationHandler, registerFormValidationHandler, } from './core/registries/validationHandlerRegistry';
20
+ export type { DebouncedCallback } from './hooks/useDebouncedCallback';
16
21
  export { useDebouncedCallback } from './hooks/useDebouncedCallback';
17
22
  export * as Units from './utils/unitValueMapper';
18
23
  export { serializeInstance, deserializeInstance, serializeDefinition, deserializeDefinition } from './utils/definitionSerializers';