@digiform/wizard 0.1.7 → 0.2.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.
Files changed (105) hide show
  1. package/FormWizard.d.ts +10 -0
  2. package/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.d.ts +23 -0
  3. package/features/api-integration/index.d.ts +12 -0
  4. package/features/api-integration/services/ActionExecutor.d.ts +18 -0
  5. package/features/api-integration/services/ApiCallExecutor.d.ts +2 -0
  6. package/features/api-integration/services/ApiCallService.d.ts +40 -0
  7. package/features/api-integration/services/DialogExecutor.d.ts +2 -0
  8. package/features/api-integration/services/GenericTriggerService.d.ts +118 -0
  9. package/features/api-integration/services/NavigationExecutor.d.ts +2 -0
  10. package/features/dialog-system/components/ActionDialog/ActionDialog.d.ts +11 -0
  11. package/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.d.ts +11 -0
  12. package/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.d.ts +11 -0
  13. package/features/dialog-system/index.d.ts +8 -0
  14. package/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.d.ts +19 -0
  15. package/features/form-runtime/FormWizard/FormWizard.d.ts +10 -0
  16. package/features/form-runtime/components/FormField.d.ts +7 -0
  17. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  18. package/features/form-runtime/components/FormHeader.d.ts +9 -0
  19. package/features/form-runtime/components/FormSection/FormSection.d.ts +6 -0
  20. package/features/form-runtime/components/FormStep/FormStep.d.ts +2 -0
  21. package/features/form-runtime/components/ProgressLoaderRuntime.d.ts +12 -0
  22. package/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.d.ts +2 -0
  23. package/features/form-runtime/components/displayValue/displayValue.d.ts +21 -0
  24. package/features/form-runtime/components/index.d.ts +3 -0
  25. package/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.d.ts +7 -0
  26. package/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.d.ts +13 -0
  27. package/features/form-runtime/config/configResolver.d.ts +14 -0
  28. package/features/form-runtime/config/index.d.ts +9 -0
  29. package/features/form-runtime/config/templateConfig.d.ts +148 -0
  30. package/features/form-runtime/config/templateLoader.d.ts +25 -0
  31. package/features/form-runtime/config/templateUtils.d.ts +12 -0
  32. package/features/form-runtime/context/LoaderContext.d.ts +31 -0
  33. package/features/form-runtime/hooks/index.d.ts +1 -0
  34. package/features/form-runtime/hooks/useApiActions.d.ts +42 -0
  35. package/features/form-runtime/hooks/useComponentTriggers.d.ts +42 -0
  36. package/features/form-runtime/hooks/useComponentVisibility.d.ts +13 -0
  37. package/features/form-runtime/hooks/useFieldEventHandlers.d.ts +14 -0
  38. package/features/form-runtime/hooks/useFormContext.d.ts +4 -0
  39. package/features/form-runtime/hooks/useFormFieldState.d.ts +13 -0
  40. package/features/form-runtime/hooks/useValidationEvents.d.ts +13 -0
  41. package/features/form-runtime/index.d.ts +12 -0
  42. package/features/form-runtime/utils/componentDisplayValue.d.ts +9 -0
  43. package/features/form-runtime/utils/errorUtils.d.ts +13 -0
  44. package/features/form-runtime/utils/fieldHelpers.d.ts +38 -0
  45. package/features/form-runtime/utils/formDataBuilder.d.ts +7 -0
  46. package/features/form-runtime/utils/formDirtyStateSync.d.ts +77 -0
  47. package/features/form-runtime/utils/formSaver.d.ts +22 -0
  48. package/features/form-runtime/utils/index.d.ts +4 -0
  49. package/features/form-runtime/utils/logger.d.ts +70 -0
  50. package/features/form-runtime/utils/validation.d.ts +3 -0
  51. package/features/form-runtime/utils/validationUX.d.ts +70 -0
  52. package/features/form-runtime/utils/visibilityUtils.d.ts +13 -0
  53. package/features/index.d.ts +11 -0
  54. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +9 -0
  55. package/features/state-management/index.d.ts +8 -0
  56. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  57. package/features/state-management/machines/__tests__/testUtils.d.ts +78 -0
  58. package/features/state-management/machines/__tests__/vitest.config.d.ts +2 -0
  59. package/features/state-management/machines/actions/componentActions.d.ts +10 -0
  60. package/features/state-management/machines/actions/navigationActions.d.ts +50 -0
  61. package/features/state-management/machines/actions/saveActions.d.ts +38 -0
  62. package/features/state-management/machines/actions/validationActions.d.ts +68 -0
  63. package/features/state-management/machines/componentTriggerEngine.d.ts +90 -0
  64. package/features/state-management/machines/formMachine.d.ts +216 -0
  65. package/features/state-management/machines/guards/navigationGuards.d.ts +32 -0
  66. package/features/state-management/machines/guards/saveGuards.d.ts +55 -0
  67. package/features/state-management/machines/guards/triggerGuards.d.ts +24 -0
  68. package/features/state-management/machines/helpers/triggerHelpers.d.ts +14 -0
  69. package/features/state-management/machines/index.d.ts +4 -0
  70. package/features/state-management/machines/lazyLoading.d.ts +34 -0
  71. package/features/state-management/machines/performance.d.ts +80 -0
  72. package/features/state-management/machines/types.d.ts +315 -0
  73. package/features/state-management/machines/useFormMachine.d.ts +1508 -0
  74. package/features/state-management/machines/validation/index.d.ts +5 -0
  75. package/features/state-management/machines/validation/validateField.d.ts +2 -0
  76. package/features/state-management/machines/validation/validateForm.d.ts +2 -0
  77. package/features/state-management/machines/validation/validateSection.d.ts +2 -0
  78. package/features/state-management/machines/validation/validateStep.d.ts +2 -0
  79. package/features/state-management/machines/validation/validationTypes.d.ts +1 -0
  80. package/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.d.ts +8 -0
  81. package/features/trigger-action-system/components/ActionManager.d.ts +6 -0
  82. package/features/trigger-action-system/components/ComponentAlert/ComponentAlert.d.ts +10 -0
  83. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +20 -0
  84. package/features/trigger-action-system/index.d.ts +10 -0
  85. package/features/trigger-action-system/utils/GenericTriggerEngine.d.ts +118 -0
  86. package/features/trigger-action-system/utils/triggerActionSystem.d.ts +193 -0
  87. package/features/validation-system/components/ValidationDebugger.d.ts +2 -0
  88. package/features/validation-system/index.d.ts +7 -0
  89. package/features/validation-system/validation/ActionValidation.d.ts +54 -0
  90. package/features/validation-system/validation/SchemaBuilder.d.ts +36 -0
  91. package/features/validation-system/validation/ValidationCache.d.ts +36 -0
  92. package/features/validation-system/validation/ValidationEngine.d.ts +86 -0
  93. package/features/validation-system/validation/ValidationExecutor.d.ts +36 -0
  94. package/features/validation-system/validation/index.d.ts +38 -0
  95. package/features/validation-system/validation/secureValidatorEngine.d.ts +64 -0
  96. package/features/validation-system/validation/tanstackSchemaAdapter.d.ts +15 -0
  97. package/features/validation-system/validation/validationService.d.ts +43 -0
  98. package/index.cjs +231 -284
  99. package/index.cjs.map +1 -1
  100. package/index.d.ts +8 -0
  101. package/index.js +231 -284
  102. package/index.js.map +1 -1
  103. package/package.json +1 -1
  104. package/styles/index.d.ts +0 -0
  105. package/styles.css +10 -18
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Performance optimization utilities for form machine
3
+ * Provides conditional imports and optimizations based on environment
4
+ */
5
+ export declare const isDevelopment: boolean;
6
+ export declare const isProduction: boolean;
7
+ export declare const devOnlyLogger: {
8
+ log: {
9
+ (...data: any[]): void;
10
+ (message?: any, ...optionalParams: any[]): void;
11
+ };
12
+ warn: {
13
+ (...data: any[]): void;
14
+ (message?: any, ...optionalParams: any[]): void;
15
+ };
16
+ error: {
17
+ (...data: any[]): void;
18
+ (message?: any, ...optionalParams: any[]): void;
19
+ };
20
+ group: {
21
+ (...data: any[]): void;
22
+ (...label: any[]): void;
23
+ };
24
+ groupEnd: {
25
+ (): void;
26
+ (): void;
27
+ };
28
+ };
29
+ export declare const performanceMonitor: {
30
+ mark: (name: string) => PerformanceMark;
31
+ measure: (name: string, start: string, end?: string) => PerformanceMeasure;
32
+ now: () => number;
33
+ } | {
34
+ mark: () => void;
35
+ measure: () => void;
36
+ now: () => number;
37
+ };
38
+ export declare const memoryUtils: {
39
+ /**
40
+ * Efficient object comparison for React optimization
41
+ */
42
+ shallowEqual<T extends Record<string, any>>(obj1: T, obj2: T): boolean;
43
+ /**
44
+ * Deep object comparison with depth limit for performance
45
+ */
46
+ deepEqual(obj1: any, obj2: any, maxDepth?: number): boolean;
47
+ /**
48
+ * Optimized object merging
49
+ */
50
+ fastMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T;
51
+ /**
52
+ * Create optimized cache key
53
+ */
54
+ createCacheKey(...parts: (string | number | boolean | null | undefined)[]): string;
55
+ };
56
+ export declare const lazyUtils: {
57
+ /**
58
+ * Memoized lazy loading
59
+ */
60
+ memoizedImport<T>(importFn: () => Promise<T>): () => Promise<T>;
61
+ /**
62
+ * Conditional import based on feature flags
63
+ */
64
+ conditionalImport<T>(condition: boolean, importFn: () => Promise<T>, fallback: T): Promise<T>;
65
+ };
66
+ export declare const features: {
67
+ advancedTriggers: boolean;
68
+ complexValidation: boolean;
69
+ debugging: boolean;
70
+ monitoring: boolean;
71
+ };
72
+ export declare const optimizationConstants: {
73
+ readonly TRIGGER_CACHE_TTL: 1000;
74
+ readonly GUARD_CACHE_TTL: 500;
75
+ readonly CONFIG_CACHE_TTL: 5000;
76
+ readonly MAX_CACHE_SIZE: 100;
77
+ readonly MAX_EXECUTION_TIME: 1000;
78
+ readonly GC_INTERVAL: 30000;
79
+ readonly MAX_RETAINED_OBJECTS: 50;
80
+ };
@@ -0,0 +1,315 @@
1
+ import { ActionExecution, ActionTrigger, ComponentAction, DialogConfig, FieldChangeState, FieldValidationState, FieldWarning, FormData, FormErrors, FormFieldValue, FormWizardConfig, VerificationConfig, VerificationStatus } from '../../../../../core/src/index.ts';
2
+ import { ContextExecutionPlan, TriggerExecution } from './componentTriggerEngine';
3
+ export interface MinimalFormApi {
4
+ getFieldValue: (id: string) => unknown;
5
+ resetField: (id: string) => void;
6
+ setFieldValue: (id: string, value: unknown, options?: {
7
+ dontUpdateMeta?: boolean;
8
+ }) => void;
9
+ state?: {
10
+ isDirty?: boolean;
11
+ };
12
+ getFieldMeta?: (id: string) => unknown;
13
+ }
14
+ export type { FormFieldValue, FieldValidationState, VerificationStatus };
15
+ export interface ComponentTriggerState {
16
+ componentId: string;
17
+ triggerId: string;
18
+ lastEvaluated?: number;
19
+ lastTriggered?: number;
20
+ isActive: boolean;
21
+ originalValue?: unknown;
22
+ }
23
+ export interface ComponentOriginalValue {
24
+ value: unknown;
25
+ timestamp: number;
26
+ source: "initialized" | "api_populated" | "user_reset" | "user_verified" | "dialog_verified" | "edit_start";
27
+ isPopulated: boolean;
28
+ }
29
+ export interface ComponentActionExecution {
30
+ actionId: string;
31
+ componentId: string;
32
+ status: "pending" | "executing" | "completed" | "failed";
33
+ startTime: number;
34
+ endTime?: number;
35
+ result?: unknown;
36
+ error?: Error;
37
+ }
38
+ export interface ComponentAlert {
39
+ id: string;
40
+ componentId: string;
41
+ message: string;
42
+ type: "info" | "warning" | "error" | "success";
43
+ position: "inline" | "tooltip" | "sidebar";
44
+ dismissible: boolean;
45
+ timestamp: number;
46
+ autoHide?: boolean;
47
+ autoHideDelay?: number;
48
+ }
49
+ export interface FormMachineContext {
50
+ config: FormWizardConfig;
51
+ currentStepId: string;
52
+ currentStepIndex: number;
53
+ data: FormData;
54
+ errors: FormErrors;
55
+ dirtyFields: Record<string, boolean>;
56
+ touchedFields: Record<string, boolean>;
57
+ isValid: boolean;
58
+ isSubmitting: boolean;
59
+ fieldStates: Record<string, {
60
+ value: unknown;
61
+ error: string | null;
62
+ isDirty: boolean;
63
+ isTouched: boolean;
64
+ isValidating: boolean;
65
+ }>;
66
+ sectionBackups: Record<string, Record<string, FormFieldValue>>;
67
+ activeActions: Record<string, ActionExecution>;
68
+ actionResults: Record<string, unknown>;
69
+ activeDialog: DialogConfig | null;
70
+ executingTrigger: ActionTrigger | null;
71
+ pendingNavigation: {
72
+ type: "next" | "previous" | "step";
73
+ stepId?: string;
74
+ } | null;
75
+ canNavigate: boolean;
76
+ waitingForActions: boolean;
77
+ fieldChangeState: Record<string, FieldChangeState>;
78
+ fieldValidationState: FieldValidationState;
79
+ componentTriggerState: Record<string, ComponentTriggerState>;
80
+ activeComponentActions: Record<string, ComponentActionExecution[]>;
81
+ componentAlerts: Record<string, ComponentAlert[]>;
82
+ componentOriginalValues: Record<string, ComponentOriginalValue>;
83
+ activeExecutionPlan: ContextExecutionPlan | null;
84
+ executionResults: Record<string, unknown>;
85
+ contextActionCompletions: Record<string, {
86
+ componentId: string;
87
+ actionId: string;
88
+ result: unknown;
89
+ timestamp: number;
90
+ }>;
91
+ saveState: {
92
+ saveInProgress: boolean;
93
+ saveInitiator: "sectionButton" | "navigation" | null;
94
+ savingSection: string | null;
95
+ executionPlan: ContextExecutionPlan | null;
96
+ pendingVerifications: string[];
97
+ completedVerifications: string[];
98
+ validationErrors: Record<string, string[]>;
99
+ saveStartTimestamp: number | null;
100
+ };
101
+ }
102
+ export type FormMachineEvents = {
103
+ type: "SET_DATA";
104
+ key: string;
105
+ value: FormFieldValue;
106
+ } | {
107
+ type: "SET_FIELD_STATE";
108
+ componentId: string;
109
+ state: Partial<FormMachineContext["fieldStates"][string]>;
110
+ } | {
111
+ type: "VALIDATE_FIELD";
112
+ componentId: string;
113
+ } | {
114
+ type: "VALIDATE_SECTION";
115
+ sectionId: string;
116
+ } | {
117
+ type: "VALIDATE_STEP";
118
+ stepId: string;
119
+ } | {
120
+ type: "VALIDATE_FORM";
121
+ } | {
122
+ type: "START_SECTION_EDIT";
123
+ sectionId: string;
124
+ componentIds: string[];
125
+ } | {
126
+ type: "CANCEL_SECTION_EDIT";
127
+ sectionId: string;
128
+ } | {
129
+ type: "NEXT";
130
+ } | {
131
+ type: "PREVIOUS";
132
+ } | {
133
+ type: "GO_TO_STEP";
134
+ stepId: string;
135
+ } | {
136
+ type: "REQUEST_NAVIGATION";
137
+ navigationType: "next" | "previous" | "step";
138
+ stepId?: string;
139
+ } | {
140
+ type: "SUBMIT";
141
+ } | {
142
+ type: "SUBMIT_SUCCESS";
143
+ } | {
144
+ type: "SUBMIT_ERROR";
145
+ error: Error;
146
+ } | {
147
+ type: "RESET";
148
+ } | {
149
+ type: "EXECUTE_ACTIONS";
150
+ trigger: ActionTrigger;
151
+ } | {
152
+ type: "EXECUTE_TRIGGER";
153
+ trigger: ActionTrigger;
154
+ } | {
155
+ type: "ACTION_START";
156
+ actionId: string;
157
+ } | {
158
+ type: "ACTION_SUCCESS";
159
+ actionId: string;
160
+ result: unknown;
161
+ } | {
162
+ type: "ACTION_ERROR";
163
+ actionId: string;
164
+ error: Error;
165
+ } | {
166
+ type: "ACTIONS_COMPLETED";
167
+ results: Record<string, unknown>;
168
+ } | {
169
+ type: "SHOW_ACTION_DIALOG";
170
+ dialogConfig: DialogConfig;
171
+ } | {
172
+ type: "HIDE_ACTION_DIALOG";
173
+ } | {
174
+ type: "DIALOG_BUTTON_CLICK";
175
+ buttonAction: string;
176
+ } | {
177
+ type: "FIELD_CHANGED";
178
+ fieldId: string;
179
+ oldValue: unknown;
180
+ newValue: unknown;
181
+ } | {
182
+ type: "TRIGGER_FIELD_WARNING";
183
+ fieldId: string;
184
+ warning: FieldWarning;
185
+ } | {
186
+ type: "DISMISS_FIELD_WARNING";
187
+ fieldId: string;
188
+ warningId?: string;
189
+ } | {
190
+ type: "SHOW_FIELD_WARNING";
191
+ fieldId: string;
192
+ warningId: string;
193
+ message: string;
194
+ warningType?: "warning" | "error" | "info";
195
+ } | {
196
+ type: "START_FIELD_VERIFICATION";
197
+ fieldId: string;
198
+ config: VerificationConfig;
199
+ } | {
200
+ type: "FIELD_VERIFICATION_COMPLETE";
201
+ fieldId: string;
202
+ result: unknown;
203
+ success: boolean;
204
+ } | {
205
+ type: "CLEAR_FIELD_CHANGES";
206
+ fieldId?: string;
207
+ } | {
208
+ type: "EVALUATE_COMPONENT_TRIGGERS";
209
+ componentId: string;
210
+ eventType: "valueChange" | "focus" | "blur";
211
+ value?: unknown;
212
+ } | {
213
+ type: "TRIGGER_COMPONENT_ACTION";
214
+ componentId: string;
215
+ triggerId: string;
216
+ actionId: string;
217
+ eventType?: "valueChange" | "focus" | "blur" | "navigationAttempt" | "sectionSave";
218
+ } | {
219
+ type: "COMPONENT_ACTION_START";
220
+ componentId: string;
221
+ actionId: string;
222
+ } | {
223
+ type: "COMPONENT_ACTION_COMPLETE";
224
+ componentId: string;
225
+ actionId: string;
226
+ result?: unknown;
227
+ } | {
228
+ type: "COMPONENT_ACTION_FAILED";
229
+ componentId: string;
230
+ actionId: string;
231
+ error: Error;
232
+ } | {
233
+ type: "SHOW_COMPONENT_ALERT";
234
+ componentId: string;
235
+ alert: ComponentAlert;
236
+ } | {
237
+ type: "DISMISS_COMPONENT_ALERT";
238
+ componentId: string;
239
+ alertId?: string;
240
+ } | {
241
+ type: "CLEAR_COMPONENT_ALERT";
242
+ componentId: string;
243
+ } | {
244
+ type: "SET_COMPONENT_ORIGINAL_VALUE";
245
+ componentId: string;
246
+ value: unknown;
247
+ source?: "initialized" | "api_populated" | "user_reset" | "user_verified" | "edit_start";
248
+ } | {
249
+ type: "MARK_COMPONENT_AS_POPULATED";
250
+ componentId: string;
251
+ value: unknown;
252
+ } | {
253
+ type: "EXECUTE_CONTEXT_ACTION";
254
+ execution: TriggerExecution;
255
+ action: ComponentAction;
256
+ } | {
257
+ type: "CONTEXT_ACTION_COMPLETE";
258
+ componentId: string;
259
+ actionId: string;
260
+ result: unknown;
261
+ } | {
262
+ type: "CONTEXT_ACTIONS_COMPLETE";
263
+ results?: Record<string, unknown>;
264
+ } | {
265
+ type: "EXECUTE_CONTEXT_ACTIONS";
266
+ executionPlan: ContextExecutionPlan;
267
+ } | {
268
+ type: "EXECUTE_FIELD_CHANGE_ACTIONS";
269
+ executionPlan: ContextExecutionPlan;
270
+ componentId: string;
271
+ eventType: string;
272
+ value: unknown;
273
+ } | {
274
+ type: "SHOW_DIALOG";
275
+ dialog: DialogConfig;
276
+ } | {
277
+ type: "TRIGGER_ACTIONS_COMPLETE";
278
+ } | {
279
+ type: "DIALOG_VERIFIED";
280
+ } | {
281
+ type: "DIALOG_CANCELLED";
282
+ } | {
283
+ type: "RESET_FIELD_TANSTACK_STATE";
284
+ componentId: string;
285
+ form?: MinimalFormApi;
286
+ } | {
287
+ type: "UPDATE_COMPONENT_ORIGINAL_VALUE";
288
+ componentId: string;
289
+ } | {
290
+ type: "COMPONENT_ACTION_ERROR";
291
+ componentId: string;
292
+ actionId: string;
293
+ error: Error;
294
+ } | {
295
+ type: "START_SAVE";
296
+ initiator: "sectionButton" | "navigation";
297
+ sectionId: string;
298
+ } | {
299
+ type: "SAVE_VALIDATION_SUCCESS";
300
+ sectionId: string;
301
+ executionPlan: ContextExecutionPlan;
302
+ } | {
303
+ type: "SAVE_VALIDATION_FAILED";
304
+ sectionId: string;
305
+ errors: Record<string, string[]>;
306
+ } | {
307
+ type: "SAVE_DIALOG_SHOWN";
308
+ componentId: string;
309
+ actionId: string;
310
+ dialogId: string;
311
+ } | {
312
+ type: "SAVE_ACTIONS_COMPLETE";
313
+ sectionId: string;
314
+ results: Record<string, unknown>;
315
+ };