@notmrabhi/flowforge 0.1.20 → 0.1.21

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 (53) hide show
  1. package/package.json +1 -1
  2. package/dist/GatewayBranchEdge-BdUVHQJc.js +0 -1263
  3. package/dist/GatewayBranchEdge-DK6kuCK2.js +0 -1
  4. package/dist/SchemaBuilderDrawer-157p-2Vj.js +0 -1136
  5. package/dist/SchemaBuilderDrawer-Wje7pVrn.js +0 -1
  6. package/dist/bpmn-CcuE2X_Q.js +0 -2
  7. package/dist/bpmn-CtfWDaOY.js +0 -33
  8. package/dist/canvas.cjs +0 -1
  9. package/dist/canvas.d.ts +0 -809
  10. package/dist/canvas.js +0 -28
  11. package/dist/canvasTokens-CAD6G24b.js +0 -32
  12. package/dist/canvasTokens-gKNYrPl4.js +0 -1
  13. package/dist/core.cjs +0 -1
  14. package/dist/core.d.ts +0 -374
  15. package/dist/core.js +0 -24
  16. package/dist/defaultUi.cjs +0 -1
  17. package/dist/defaultUi.d.ts +0 -83
  18. package/dist/defaultUi.js +0 -18
  19. package/dist/form.cjs +0 -1
  20. package/dist/form.d.ts +0 -857
  21. package/dist/form.js +0 -44
  22. package/dist/index-B31-Y5uO.js +0 -11
  23. package/dist/index-B3aHpb84.js +0 -13
  24. package/dist/index-BU09HbVh.js +0 -10176
  25. package/dist/index-BnzttJ4w.js +0 -13758
  26. package/dist/index-BysKSEtZ.js +0 -1
  27. package/dist/index-CQ0cVcHp.js +0 -2
  28. package/dist/index-CkjEllpd.js +0 -1
  29. package/dist/index-Codx5QwP.js +0 -41
  30. package/dist/index-Cw9DC-tf.js +0 -76
  31. package/dist/index-CzPi8KQC.js +0 -1310
  32. package/dist/index-D14V8rKX.js +0 -1
  33. package/dist/index-Da5NHCS2.js +0 -8132
  34. package/dist/index-a1IOaYsW.js +0 -9
  35. package/dist/index-a3QMaedZ.js +0 -2553
  36. package/dist/index-gtgq_241.js +0 -3
  37. package/dist/index-l6kvDx-m.js +0 -1360
  38. package/dist/index-lcviy90e.js +0 -613
  39. package/dist/index-wOnYb3DO.js +0 -567
  40. package/dist/index.cjs +0 -1
  41. package/dist/index.d.ts +0 -1409
  42. package/dist/index.js +0 -107
  43. package/dist/messages-CO299wPN.js +0 -22
  44. package/dist/messages-O9Tw_XXR.js +0 -1
  45. package/dist/nodeRegistry.cjs +0 -1
  46. package/dist/nodeRegistry.d.ts +0 -334
  47. package/dist/nodeRegistry.js +0 -555
  48. package/dist/style.css +0 -6
  49. package/dist/templateRegistry.cjs +0 -1
  50. package/dist/templateRegistry.d.ts +0 -83
  51. package/dist/templateRegistry.js +0 -43
  52. package/dist/templateSkeletons--Ol7Sg7H.js +0 -1
  53. package/dist/templateSkeletons-DcvDac7_.js +0 -2954
package/dist/form.d.ts DELETED
@@ -1,857 +0,0 @@
1
- import { AnySchema } from 'yup';
2
- import { ComponentType } from 'react';
3
- import { default as default_2 } from 'react';
4
- import { FormikProps } from 'formik';
5
- import { GroupBase } from 'react-select';
6
- import { JSX as JSX_2 } from 'react/jsx-runtime';
7
- import { ObjectSchema } from 'yup';
8
- import { StylesConfig } from 'react-select';
9
- import { useFormik } from 'formik';
10
- import * as Yup from 'yup';
11
-
12
- declare interface ActiveField {
13
- /** The contenteditable div inside FormulaInput */
14
- editorRef: default_2.RefObject<HTMLDivElement | null>;
15
- /** Saved Range from the last selection — restored before inserting */
16
- savedRange: Range | null;
17
- fieldId: string;
18
- /** Optionally, the field can provide a direct way to insert a variable into its state */
19
- onInsert?: (path: string, label: string) => void;
20
- }
21
-
22
- /** True if the AST contains at least one non-text node. */
23
- export declare function astHasRefs(nodes: FormulaASTNode[]): boolean;
24
-
25
- /**
26
- * Convert AST nodes to the flat FormulaToken[] the DOM layer uses.
27
- * This keeps FormulaInput decoupled from the AST type directly.
28
- */
29
- export declare function astToTokens(nodes: FormulaASTNode[], configEnabled?: boolean): FormulaToken[];
30
-
31
- export declare function buildEvaluationPayload({ values, conditionConfig, }: {
32
- values: Record<string, unknown>;
33
- conditionConfig?: ConditionConfig;
34
- }): EvaluationPayload;
35
-
36
- /**
37
- * Returns an empty presence-marker object {}.
38
- * The backend uses the key's existence in FormulaConfig to know
39
- * the field value was serialized as _P('...') rather than _DE_{_P('...')}.
40
- */
41
- export declare function buildFieldConfig(): FieldFormulaConfig;
42
-
43
- /**
44
- * Build a bracket-notation path from a root and optional extra segments.
45
- * Each segment is wrapped in [\"...\"] so the path evaluator can handle
46
- * any key (camelCase, spaces, hyphens, etc.) uniformly.
47
- *
48
- * Examples:
49
- * buildFormulaPath('data.user', 'email')
50
- * → 'data.user.[\"email\"]'
51
- * buildFormulaPath('data.input', 'groupAssignPolicy', 'dmnKey')
52
- * → 'data.input.[\"groupAssignPolicy\"].[\"dmnKey\"]'
53
- * buildFormulaPath('data.trigger', 'assignee', 'email')
54
- * → 'data.trigger.[\"assignee\"].[\"email\"]'
55
- */
56
- export declare function buildFormulaPath(root: string, ...segments: string[]): string;
57
-
58
- export declare function buildSelectStyles(hasError: boolean, isMulti?: boolean): StylesConfig<any, boolean, GroupBase<any>>;
59
-
60
- /**
61
- * Builds a Yup ObjectSchema from a flat FieldDescriptor[].
62
- * Validates required fields and applies type-appropriate rules.
63
- * Recurses into object/schema children.
64
- */
65
- export declare function buildValidationSchema(fields: FieldDescriptor[]): Yup.ObjectSchema<any>;
66
-
67
- export declare interface ChildRouterProps {
68
- field: FieldDescriptor;
69
- pathPrefix: string;
70
- depth: number;
71
- values: Record<string, unknown>;
72
- errors: Record<string, unknown>;
73
- touched: Record<string, unknown>;
74
- setFieldValue: (name: string, value: unknown) => void;
75
- setFieldTouched: (name: string, touched: boolean) => void;
76
- compact?: boolean;
77
- inlineLabel?: boolean;
78
- }
79
-
80
- export declare interface ChipToken {
81
- type: 'chip';
82
- expr: string;
83
- label: string;
84
- path: string;
85
- kind: 'de-expr' | 'path-ref';
86
- }
87
-
88
- /**
89
- * Concatenation of multiple nodes (future).
90
- * Serializes by joining all child serializations.
91
- */
92
- export declare interface ConcatNode {
93
- type: 'concat';
94
- values: FormulaASTNode[];
95
- }
96
-
97
- /**
98
- * Top-level condition config map: pathPrefix → ConditionNode[].
99
- *
100
- * Example:
101
- * { "email": [
102
- * { field: "email", operator: "isNull", value: "" },
103
- * { type: "group", connector: "and", entries: [
104
- * { field: "role", operator: "equals", value: "FE" },
105
- * { field: "role", operator: "equals", value: "UX", connector: "or" },
106
- * ]},
107
- * { field: "salary", operator: "equals", value: "5000000", connector: "and" },
108
- * ]
109
- * }
110
- */
111
- export declare type ConditionConfig = Record<string, ConditionNode[]>;
112
-
113
- /**
114
- * A single condition row (leaf node).
115
- * connector: how this node joins the previous sibling ('and' | 'or'). Ignored on index 0.
116
- */
117
- export declare interface ConditionEntry {
118
- /** Discriminator — omit or set to 'leaf' for a plain condition row */
119
- type?: 'leaf';
120
- field: string;
121
- fieldLabel: string;
122
- operator: string;
123
- value: string;
124
- connector?: 'and' | 'or';
125
- }
126
-
127
- /**
128
- * Conditional expression (future).
129
- * e.g. if status == "active" then name else "unknown"
130
- */
131
- export declare interface ConditionExprNode {
132
- type: 'condition';
133
- if: FormulaASTNode;
134
- then: FormulaASTNode;
135
- else: FormulaASTNode;
136
- }
137
-
138
- /** One column in a per-field condition row */
139
- export declare interface ConditionFieldDef {
140
- /** Key used to store this column's value in ConditionEntry */
141
- id: string;
142
- /**
143
- * 'select' — native <select> with user-supplied options
144
- * 'operator' — native <select> pre-filled with the standard operator list (no options needed)
145
- * 'text' — plain <input>
146
- * any other string — falls back to <input>
147
- */
148
- type: 'select' | 'operator' | 'text' | string;
149
- colSpan?: number;
150
- label?: string;
151
- placeholder?: string;
152
- /** Options for select columns — user defines these, renderer just renders them */
153
- options?: Array<{
154
- value: string;
155
- label: string;
156
- }>;
157
- /** When true, renders a FormulaInput chip editor instead of a plain <input> */
158
- formula?: boolean;
159
- }
160
-
161
- /**
162
- * A parenthesised group of condition nodes.
163
- * Renders as an indented, bordered block — e.g. (Role = "FE" OR Role = "UX").
164
- */
165
- export declare interface ConditionGroup {
166
- type: 'group';
167
- entries: ConditionNode[];
168
- connector?: 'and' | 'or';
169
- }
170
-
171
- /** Either a leaf row or a nested group */
172
- export declare type ConditionNode = ConditionEntry | ConditionGroup;
173
-
174
- declare interface ControlledProps extends FormulaProps {
175
- schema: FormSchema;
176
- formik: FormikProps<Record<string, unknown>>;
177
- initialValues?: never;
178
- onSubmit?: never;
179
- children?: never;
180
- form?: never;
181
- }
182
-
183
- /** @deprecated Use FlowForm */
184
- export declare const DynamicFormRenderer: typeof FlowForm;
185
-
186
- /** @deprecated Use FlowFormProps */
187
- export declare type DynamicFormRendererProps = FlowFormProps;
188
-
189
- export declare const errorTextStyle: React.CSSProperties;
190
-
191
- export declare interface EvaluationConditionEntry {
192
- field: string;
193
- operator: string;
194
- value?: string;
195
- connector?: 'and' | 'or';
196
- }
197
-
198
- export declare interface EvaluationConditionGroup {
199
- type: 'group';
200
- entries: EvaluationConditionNode[];
201
- connector?: 'and' | 'or';
202
- }
203
-
204
- export declare type EvaluationConditionNode = EvaluationConditionEntry | EvaluationConditionGroup;
205
-
206
- export declare interface EvaluationPayload {
207
- values: Record<string, unknown>;
208
- conditions?: Record<string, EvaluationConditionNode[]>;
209
- }
210
-
211
- /**
212
- * Extract the display label from a path expression.
213
- * Prefers the last [\"key\"] bracket segment; falls back to the last dot-segment.
214
- *
215
- * 'data.user.[\"email\"]' → "email"
216
- * 'data.input.[\"groupAssignPolicy\"].[\"dmnKey\"]' → "dmnKey"
217
- * 'data.trigger.[\"assignee\"].[\"email\"]' → "email"
218
- */
219
- export declare function extractLabel(path: string): string;
220
-
221
- declare interface FetchResult {
222
- options: TablePickerOption[];
223
- hasNextPage: boolean;
224
- nextPage?: number;
225
- }
226
-
227
- export declare const FF: {
228
- readonly INPUT_HEIGHT: 38;
229
- readonly INPUT_PADDING: "0 12px";
230
- readonly INPUT_FONT_SIZE: 14;
231
- readonly BORDER_RADIUS: 6;
232
- readonly BORDER_COLOR: "#ced4da";
233
- readonly BORDER_COLOR_HOVER: "#adb5bd";
234
- readonly BORDER_COLOR_FOCUS: "#86b7fe";
235
- readonly BORDER_COLOR_ERROR: "#dc3545";
236
- readonly BORDER: "1px solid #ced4da";
237
- readonly BORDER_ERROR: "1px solid #dc3545";
238
- readonly FOCUS_SHADOW: "0 0 0 3px rgba(13,110,253,0.18)";
239
- readonly FOCUS_SHADOW_ERROR: "0 0 0 3px rgba(220,53,69,0.18)";
240
- readonly COLOR_LABEL: "#212529";
241
- readonly COLOR_PLACEHOLDER: "rgba(0,0,0,0.38)";
242
- readonly COLOR_HELPER: "#6c757d";
243
- readonly COLOR_ERROR: "#dc3545";
244
- readonly COLOR_DISABLED_BG: "#f8f9fa";
245
- readonly COLOR_DISABLED_TEXT: "rgba(0,0,0,0.38)";
246
- readonly FONT_SIZE_LABEL: 13;
247
- readonly FONT_SIZE_INPUT: 14;
248
- readonly FONT_SIZE_HELPER: 12;
249
- readonly FONT_WEIGHT_LABEL: 500;
250
- readonly LABEL_MB: 5;
251
- readonly HELPER_MT: 4;
252
- readonly FIELD_MB: 20;
253
- };
254
-
255
- export declare const FIELD_TYPE_OPTIONS: Array<{
256
- value: string;
257
- label: string;
258
- }>;
259
-
260
- declare type FieldComponent = ComponentType<FieldComponentProps>;
261
-
262
- export declare interface FieldComponentProps {
263
- field: FieldDescriptor;
264
- value: unknown;
265
- values: Record<string, unknown>;
266
- onChange: (value: unknown) => void;
267
- onBlur: () => void;
268
- error?: string;
269
- touched?: boolean;
270
- /** Current formula config map (host-owned). Passed down to formula-enabled fields. */
271
- formulaConfig?: FormulaConfig;
272
- /** Called by a field when its formula AST changes. Host app updates its state. */
273
- onFormulaConfigChange?: (config: FormulaConfig) => void;
274
- /**
275
- * When true: field renders label + input in a single horizontal row.
276
- * Used inside ObjectField groups for compact two-column mapping layout.
277
- */
278
- inlineLabel?: boolean;
279
- }
280
-
281
- /** Condition definition attached to a FieldDescriptor */
282
- export declare interface FieldConditionDef {
283
- fields: ConditionFieldDef[];
284
- /** Enables nested condition groups. Defaults to false. */
285
- allowGroups?: boolean;
286
- /** Optional depth limit for nested groups when allowGroups is true. */
287
- maxGroupDepth?: number;
288
- }
289
-
290
- export declare interface FieldContext {
291
- values: Record<string, unknown>;
292
- }
293
-
294
- export declare interface FieldDescriptor {
295
- /**
296
- * The formik key for this field.
297
- * Use `id` (preferred) or `name` — both are accepted.
298
- * `id` takes precedence if both are provided.
299
- */
300
- id?: string;
301
- name?: string;
302
- type: FieldType | string;
303
- /** Child field descriptors — used by type: 'object' to render a nested group. */
304
- children?: FieldDescriptor[];
305
- /** Optional per-field condition guard — renders a condition row below this field. */
306
- condition?: FieldConditionDef;
307
- label?: string;
308
- placeholder?: string;
309
- required?: boolean;
310
- showOptional?: boolean;
311
- disabled?: boolean | ((ctx: FieldContext) => boolean);
312
- hidden?: boolean;
313
- colSpan?: number;
314
- dividerAfter?: boolean;
315
- info?: string;
316
- helperText?: string;
317
- dataTestId?: string;
318
- validation?: AnySchema;
319
- shouldHide?: (ctx: FieldContext) => boolean;
320
- shouldDisable?: (ctx: FieldContext) => boolean;
321
- shouldRequire?: (ctx: FieldContext) => boolean;
322
- compute?: (ctx: FieldContext) => unknown;
323
- transform?: FieldTransform;
324
- onChange?: (value: unknown, ctx: FieldContext & {
325
- setFieldValue: (name: string, value: unknown) => void;
326
- }) => void;
327
- [key: string]: unknown;
328
- }
329
-
330
- /**
331
- * Presence marker for a field that has formula config enabled.
332
- * When a field's formula config toggle is ON, its key appears in FormulaConfig
333
- * with an empty object value. The backend uses this to detect that the value
334
- * stored in Formik was serialized as _P('...') rather than _DE_{_P('...')}.
335
- *
336
- * Example: { "dmnKey": {} }
337
- */
338
- export declare type FieldFormulaConfig = Record<string, never>;
339
-
340
- export declare const fieldRegistry: {
341
- register(type: string, component: FieldComponent): void;
342
- get(type: string): FieldComponent | undefined;
343
- has(type: string): boolean;
344
- };
345
-
346
- /** Optional pre-defined field suggestions (e.g. common fields for this node type) */
347
- export declare interface FieldSuggestion {
348
- label: string;
349
- field: FieldDescriptor;
350
- }
351
-
352
- export declare interface FieldTransform {
353
- in?: (value: unknown) => unknown;
354
- out?: (value: unknown) => unknown;
355
- }
356
-
357
- export declare type FieldType = 'text' | 'textarea' | 'number' | 'toggle' | 'radio-group' | 'select' | 'descriptive-select' | 'key-value' | 'array' | 'object' | 'reference' | 'cron' | 'schema';
358
-
359
- export declare interface FlowForgeFieldDefinition {
360
- /** The unique type identifier (e.g. 'text', 'image-upload') */
361
- type: string;
362
- /** The display name for the field picker dropdown */
363
- label: string;
364
- /**
365
- * The component used to render the field in the live form.
366
- * If omitted, relies on a previously registered component in DynamicFormRenderer.
367
- */
368
- component?: ComponentType<FieldComponentProps>;
369
- /**
370
- * Instead of a React component, you provide a FlowForm schema!
371
- * The Schema Builder Modal will automatically render this schema
372
- * to ask the user for configuration settings.
373
- */
374
- configSchema?: {
375
- fields: FieldDescriptor[];
376
- };
377
- /**
378
- * Validation builder for this field type.
379
- */
380
- buildValidation?: (field: FieldDescriptor) => Yup.Schema;
381
- }
382
-
383
- export declare const FlowForgeRegistry: Registry;
384
-
385
- export declare function FlowForm(props: FlowFormProps): JSX_2.Element;
386
-
387
- export declare interface FlowFormInstance {
388
- values: Record<string, unknown>;
389
- errors: Record<string, unknown>;
390
- isValid: boolean;
391
- isDirty: boolean;
392
- isSubmitting: boolean;
393
- formulaConfig: FormulaConfig;
394
- conditionConfig: ConditionConfig;
395
- /** Validate and submit — safe to call from any button outside the form. */
396
- submit: () => void;
397
- reset: (nextValues?: Record<string, unknown>) => void;
398
- setFieldValue: (field: string, value: unknown) => void;
399
- _schema: FormSchema;
400
- _formik: ReturnType<typeof useFormik<Record<string, unknown>>>;
401
- _formulaConfig: FormulaConfig;
402
- _onFormulaConfigChange: (config: FormulaConfig) => void;
403
- _conditionConfig: ConditionConfig;
404
- _onConditionConfigChange: (config: ConditionConfig) => void;
405
- }
406
-
407
- export declare type FlowFormProps = UncontrolledProps | ControlledProps | HookProps;
408
-
409
- declare type FormLayout = 'flat' | 'stepper' | 'tabs' | 'sections';
410
-
411
- export declare interface FormSchema {
412
- layout?: FormLayout;
413
- /**
414
- * Removes the bottom margin on every field.
415
- * Use for filter bars and inline forms where fields sit in a tight horizontal row.
416
- */
417
- compact?: boolean;
418
- fields?: FieldDescriptor[];
419
- steps?: FormStep[];
420
- }
421
-
422
- declare interface FormStep {
423
- label: string;
424
- hint?: string;
425
- fields: FieldDescriptor[];
426
- }
427
-
428
- /** Union of all AST node types */
429
- export declare type FormulaASTNode = TextNode | PathRefNode | ConcatNode | FunctionNode | ConditionExprNode;
430
-
431
- /**
432
- * Top-level formula config map: fieldId → FieldFormulaConfig (empty marker {}).
433
- * A key is present only when that field's formula config toggle is ON.
434
- *
435
- * When toggle is OFF: field key absent, Formik value = _DE_{_P('...')}
436
- * When toggle is ON: field key present as {}, Formik value = _P('...')
437
- *
438
- * Example: { "dmnKey": {} }
439
- */
440
- export declare type FormulaConfig = Record<string, FieldFormulaConfig>;
441
-
442
- export declare function FormulaInput({ expression, onExpressionChange, onBlur, placeholder, disabled, error, id, formulaConfigEnabled, onFormulaConfigToggle, onPickerOpen, compact, }: FormulaInputProps): JSX_2.Element;
443
-
444
- export declare interface FormulaInputProps {
445
- /** AST — source of truth. Host app owns this. */
446
- expression: FormulaASTNode[];
447
- /** Called with the new AST on every edit. */
448
- onExpressionChange: (nodes: FormulaASTNode[]) => void;
449
- onBlur?: () => void;
450
- placeholder?: string;
451
- disabled?: boolean;
452
- error?: boolean;
453
- id?: string;
454
- /** Whether formulaConfig emission is active (controls the { } toggle highlight). */
455
- formulaConfigEnabled?: boolean;
456
- /** Called when user clicks the { } toggle button. */
457
- onFormulaConfigToggle?: () => void;
458
- /** Future: open variable picker drawer. */
459
- onPickerOpen?: () => void;
460
- /** Compact mode — reduces height/padding to match native form controls in tight rows. */
461
- compact?: boolean;
462
- }
463
-
464
- declare interface FormulaProps {
465
- formulaConfig?: FormulaConfig;
466
- onFormulaConfigChange?: (config: FormulaConfig) => void;
467
- /**
468
- * Optional variable groups for the built-in Smart Values picker.
469
- * When provided, DynamicFormRenderer automatically wraps itself in
470
- * VariablePickerProvider — every FormulaInput gets a picker button and
471
- * drag-and-drop support with no extra setup from the host.
472
- *
473
- * For advanced layout control (picker rendered elsewhere on the page),
474
- * wrap with <VariablePickerProvider> manually instead.
475
- */
476
- variableGroups?: VariableGroup[];
477
- /** Active per-field condition guards. Key = field pathPrefix. */
478
- conditionConfig?: ConditionConfig;
479
- onConditionConfigChange?: (config: ConditionConfig) => void;
480
- }
481
-
482
- export declare type FormulaToken = TextToken | ChipToken;
483
-
484
- /**
485
- * A built-in function call (future).
486
- * e.g. upcase, format_date, number_to_text
487
- */
488
- export declare interface FunctionNode {
489
- type: 'function';
490
- name: string;
491
- args: FormulaASTNode[];
492
- }
493
-
494
- /** True if the string contains at least one formula token. */
495
- export declare function hasFormulaTokens(value: unknown): boolean;
496
-
497
- export declare const helperTextStyle: React.CSSProperties;
498
-
499
- /** Props when using the useFlowForm() hook — simplest API. */
500
- declare interface HookProps {
501
- form: FlowFormInstance;
502
- schema?: never;
503
- formik?: never;
504
- initialValues?: never;
505
- onSubmit?: never;
506
- formulaConfig?: never;
507
- onFormulaConfigChange?: never;
508
- conditionConfig?: never;
509
- onConditionConfigChange?: never;
510
- variableGroups?: never;
511
- children?: never;
512
- }
513
-
514
- export declare interface InfiniteOption {
515
- value: string;
516
- label: string;
517
- [key: string]: unknown;
518
- }
519
-
520
- export declare function InfiniteSelectField({ field: rawField, value, onChange, onBlur, error, touched, }: FieldComponentProps): JSX_2.Element;
521
-
522
- export declare function inputStyle(opts: {
523
- hasError?: boolean;
524
- isDisabled?: boolean;
525
- extraStyle?: React.CSSProperties;
526
- }): React.CSSProperties;
527
-
528
- export declare function isFormula(value: unknown): value is string;
529
-
530
- export declare interface LoadPageParams {
531
- page: number;
532
- search: string;
533
- signal: AbortSignal;
534
- }
535
-
536
- export declare interface LoadPageResult {
537
- options: InfiniteOption[];
538
- hasMore: boolean;
539
- }
540
-
541
- export declare interface ObjectFieldRendererProps {
542
- field: FieldDescriptor;
543
- pathPrefix: string;
544
- depth: number;
545
- values: Record<string, unknown>;
546
- errors: Record<string, unknown>;
547
- touched: Record<string, unknown>;
548
- setFieldValue: (name: string, value: unknown) => void;
549
- setFieldTouched: (name: string, touched: boolean) => void;
550
- compact?: boolean;
551
- renderFieldRouter: (props: ChildRouterProps) => default_2.ReactNode;
552
- }
553
-
554
- /**
555
- * Parse a raw backend string into an AST node array.
556
- *
557
- * "Hello _DE_{_P('data.input.[\"dmnKey\"]')} world"
558
- * →
559
- * [
560
- * { type: 'text', value: 'Hello ' },
561
- * { type: 'path-ref', path: 'data.input.["dmnKey"]', label: 'dmnKey' },
562
- * { type: 'text', value: ' world' },
563
- * ]
564
- */
565
- /**
566
- * Parse a raw backend string into an AST node array.
567
- *
568
- * configEnabled = false (default): only _DE_{_P(...)} tokens become chips.
569
- * _P('...') without the DE wrapper stays as plain text.
570
- * configEnabled = true: both _DE_{_P(...)} and _P('...') become chips.
571
- */
572
- export declare function parseToAST(raw: string, configEnabled?: boolean): FormulaASTNode[];
573
-
574
- /**
575
- * A reference to a value from a previous node's output.
576
- * Serializes to: _DE_{_P('path')}
577
- *
578
- * Example:
579
- * path: "data.input.[\"groupAssignPolicy\"].[\"dmnKey\"]"
580
- * label: "dmnKey" ← last ["key"] segment, for display
581
- */
582
- export declare interface PathRefNode {
583
- type: 'path-ref';
584
- path: string;
585
- label: string;
586
- }
587
-
588
- declare class Registry {
589
- private fields;
590
- constructor();
591
- register(def: FlowForgeFieldDefinition): void;
592
- get(type: string): FlowForgeFieldDefinition | undefined;
593
- getAll(): FlowForgeFieldDefinition[];
594
- /** Gets all allowed options for the Type Picker in SchemaBuilder */
595
- getTypeOptions(): Array<{
596
- value: string;
597
- label: string;
598
- }>;
599
- }
600
-
601
- export declare function SchemaBuilder({ value, onChange, suggestions, label, onPayload, validate, onValidityChange, variableGroups, initialValues: initialValuesProp, initialFormulaConfig, initialConditionConfig, }: SchemaBuilderProps): JSX_2.Element;
602
-
603
- export declare function SchemaBuilderDrawer({ value, onChange, suggestions, onPayload, onDone, validate, onValidityChange, label, drawerTitle, drawerWidth, }: SchemaBuilderDrawerProps): JSX_2.Element;
604
-
605
- export declare interface SchemaBuilderDrawerProps extends SchemaBuilderProps {
606
- label?: string;
607
- drawerTitle?: string;
608
- drawerWidth?: number;
609
- /**
610
- * Fired when the user clicks Done.
611
- * @param schema Save this to DB — pass it back to FlowForm/SchemaBuilder to restore the form
612
- * @param payload Send this to backend — contains conditionExpressions, formulaConfig, values, evaluationPayload
613
- */
614
- onDone?: (schema: FieldDescriptor[], payload: SchemaBuilderPayload | null) => void;
615
- }
616
-
617
- export declare interface SchemaBuilderPayload {
618
- /** The FieldDescriptor[] schema — save this to DB to restore the editor */
619
- schema: FieldDescriptor[];
620
- /** Formula AST per field — part of editor state */
621
- formulaConfig: FormulaConfig;
622
- /** Condition rows per field — part of editor state */
623
- conditionConfig: ConditionConfig;
624
- /** Serialized condition expression string per field — ready for backend rule engine */
625
- conditionExpressions: Record<string, string>;
626
- /** Live form values entered by the user */
627
- values: Record<string, unknown>;
628
- /** Backend-ready evaluation payload (formulas resolved against values) */
629
- evaluationPayload: ReturnType<typeof buildEvaluationPayload>;
630
- }
631
-
632
- export declare interface SchemaBuilderProps {
633
- value: FieldDescriptor[];
634
- onChange: (fields: FieldDescriptor[]) => void;
635
- suggestions?: FieldSuggestion[];
636
- label?: string;
637
- /** Fires on every change: schema edit, value input, formula/condition update */
638
- onPayload?: (payload: SchemaBuilderPayload) => void;
639
- /** Whether to auto-validate required fields (shows inline error messages) */
640
- validate?: boolean;
641
- /** Called whenever form validity changes — wire to enable/disable your Save button */
642
- onValidityChange?: (isValid: boolean) => void;
643
- /** Optional variable groups to seamlessly enable the Variable Picker for formula fields */
644
- variableGroups?: VariableGroup[];
645
- /** Saved form values to restore when reopening — keys match field ids */
646
- initialValues?: Record<string, unknown>;
647
- /** Saved formula config to restore when reopening */
648
- initialFormulaConfig?: FormulaConfig;
649
- /** Saved condition config to restore when reopening */
650
- initialConditionConfig?: ConditionConfig;
651
- }
652
-
653
- /**
654
- * Serialize an AST back to the backend expression string.
655
- * path-ref nodes always serialize as _DE_{_P('...')} (the evaluated form).
656
- *
657
- * [
658
- * { type: 'text', value: 'Hello ' },
659
- * { type: 'path-ref', path: 'data.input.["dmnKey"]', label: 'dmnKey' },
660
- * ]
661
- * → "Hello _DE_{_P('data.input.[\"dmnKey\"]')}"
662
- */
663
- export declare function serializeAST(nodes: FormulaASTNode[]): string;
664
-
665
- /**
666
- * Serialize AST to the formula-config-enabled format.
667
- * path-ref nodes → _P('...') (no _DE_ wrapper).
668
- * Used when formulaConfig toggle is ON.
669
- */
670
- export declare function serializeASTAsConfig(nodes: FormulaASTNode[]): string;
671
-
672
- /**
673
- * Serialize a ConditionConfig into a map of field → expression string.
674
- *
675
- * Example output:
676
- * {
677
- * email: "isNotPresent(_P('data.input.[\"email\"]'))",
678
- * firstName: "_P('data.input.[\"firstName\"]') == 'abhi'"
679
- * }
680
- */
681
- export declare function serializeConditionExpressions(conditionConfig: ConditionConfig): Record<string, string>;
682
-
683
- export declare function stripFormulaTokens(value: string): string;
684
-
685
- export declare interface TabDefinition {
686
- id: string;
687
- label: string;
688
- fields: FieldDescriptor[];
689
- }
690
-
691
- export declare function TablePickerField({ field: rawField, value, onChange, onBlur, error, touched }: FieldComponentProps): JSX_2.Element;
692
-
693
- export declare interface TablePickerFieldDescriptor extends FieldDescriptor {
694
- columns: Array<{
695
- key: string;
696
- label: string;
697
- width?: number;
698
- }>;
699
- fetchOptions?: (query: string, page: number) => Promise<FetchResult>;
700
- dataSource?: string;
701
- isMulti?: boolean;
702
- pageSize?: number;
703
- }
704
-
705
- export declare interface TablePickerOption {
706
- value: string;
707
- label: string;
708
- [key: string]: unknown;
709
- }
710
-
711
- export declare interface TabsFieldDescriptor extends FieldDescriptor {
712
- tabs?: TabDefinition[];
713
- variant?: 'pill' | 'line';
714
- alignment?: 'left' | 'center' | 'right' | 'center-left' | 'center-right';
715
- height?: 'auto' | 'fixed';
716
- margin?: 'normal' | 'none';
717
- activeColor?: string;
718
- activeTextColor?: string;
719
- inactiveTextColor?: string;
720
- }
721
-
722
- /**
723
- * FlowForge Formula AST
724
- *
725
- * The AST is the source of truth for formula fields.
726
- * The _DE_{_P(...)} string is a derived serialization produced at submit
727
- * time for the backend engine — it is never the primary storage format.
728
- *
729
- * Extensibility: add new node types here as the engine grows.
730
- * Current: text + path-ref (covers all real usage today)
731
- * Future: concat, function, condition
732
- */
733
- /** Plain text segment — rendered as-is */
734
- export declare interface TextNode {
735
- type: 'text';
736
- value: string;
737
- }
738
-
739
- export declare interface TextToken {
740
- type: 'text';
741
- value: string;
742
- }
743
-
744
- /** Parse a raw string to the flat token list (used for paste/input).
745
- * configEnabled mirrors the formula config toggle state. */
746
- export declare function tokenize(raw: string, configEnabled?: boolean): FormulaToken[];
747
-
748
- declare interface UncontrolledProps extends FormulaProps {
749
- schema: FormSchema;
750
- initialValues: Record<string, unknown>;
751
- onSubmit: (values: Record<string, unknown>) => void | Promise<void>;
752
- formik?: never;
753
- form?: never;
754
- validationSchema?: ObjectSchema<any>;
755
- /** Pre-mark fields as touched so validation errors show immediately */
756
- initialTouched?: Record<string, boolean>;
757
- /** Called on every values change — use to observe live form values */
758
- onValuesChange?: (values: Record<string, unknown>) => void;
759
- /** Called whenever form validity changes — use to enable/disable a parent Save button */
760
- onValidityChange?: (isValid: boolean) => void;
761
- children?: (props: {
762
- isSubmitting: boolean;
763
- }) => default_2.ReactNode;
764
- /**
765
- * Optional HTML `id` for the underlying <form> element. Use this when the
766
- * submit button lives outside the form (e.g. in a drawer footer) — a
767
- * `<button type="submit" form={formId}>` will still trigger this form's
768
- * submit via the HTML5 form attribute.
769
- */
770
- formId?: string;
771
- }
772
-
773
- export declare function unwrapFormula(value: string): string;
774
-
775
- export declare function useFlowForm({ schema, initialValues, onSubmit, showErrorsImmediately, }: UseFlowFormOptions): FlowFormInstance;
776
-
777
- export declare interface UseFlowFormOptions {
778
- schema: FormSchema;
779
- initialValues: Record<string, unknown>;
780
- /**
781
- * Called only when form is valid and submitted.
782
- * Receives raw formik values AND the fully-resolved evaluation payload
783
- * (formula chips resolved, condition expressions serialized).
784
- */
785
- onSubmit: (values: Record<string, unknown>, evaluation: EvaluationPayload) => void | Promise<void>;
786
- /** Pre-mark all fields as touched so errors show immediately (e.g. edit mode). */
787
- showErrorsImmediately?: boolean;
788
- }
789
-
790
- export declare function useVariablePickerContext(): VariablePickerContextValue | null;
791
-
792
- export declare interface VariableGroup {
793
- label: string;
794
- icon?: default_2.ReactNode;
795
- items: VariableItem[];
796
- }
797
-
798
- export declare interface VariableItem {
799
- /** Display label shown in the picker */
800
- label: string;
801
- /** Formula path used to build _DE_{_P('...')} / _P('...') */
802
- path: string;
803
- /** Optional description shown below the label */
804
- description?: string;
805
- /** Nested sub-items — renders as an expandable group in the picker */
806
- children?: VariableItem[];
807
- }
808
-
809
- export declare function VariablePicker({ width, title, mode, }: VariablePickerProps): JSX_2.Element | null;
810
-
811
- declare interface VariablePickerContextValue {
812
- groups: VariableGroup[];
813
- isOpen: boolean;
814
- openPicker: () => void;
815
- closePicker: () => void;
816
- /**
817
- * Called by FormulaOverlay when formula mode is toggled ON or OFF.
818
- * Pass the anchor HTMLElement (the toggle button) when turning ON so the
819
- * picker can position itself next to it.
820
- */
821
- notifyFormulaToggle: (on: boolean, anchor?: HTMLElement | null) => void;
822
- /** FormulaInput calls this on focus to register as the active target */
823
- registerField: (field: ActiveField) => void;
824
- /** FormulaInput calls this on selection change to save cursor position */
825
- saveRange: (range: Range | null) => void;
826
- /** Picker calls this on item click or drop — inserts chip into active field */
827
- insertVariable: (path: string, label: string) => void;
828
- /** Currently active field id — used by FormulaInput to show drop-valid state */
829
- activeFieldId: string | null;
830
- /** Signal that a field has been focused/clicked — used to auto-open picker panel */
831
- notifyFieldFocus: (fieldId: string, anchor?: HTMLElement | null) => void;
832
- /** DOM element the popover should anchor to */
833
- anchorEl: HTMLElement | null;
834
- }
835
-
836
- export declare interface VariablePickerProps {
837
- /** Panel width in px. Default: 300 */
838
- width?: number;
839
- /** Title shown in panel header. Default: 'Smart Values' */
840
- title?: string;
841
- /**
842
- * 'drawer' — always visible as a sidebar panel (default).
843
- * 'popover' — absolutely positioned, shown/hidden via isOpen.
844
- */
845
- mode?: 'drawer' | 'popover';
846
- }
847
-
848
- export declare function VariablePickerProvider({ groups, children }: VariablePickerProviderProps): JSX_2.Element;
849
-
850
- declare interface VariablePickerProviderProps {
851
- groups: VariableGroup[];
852
- children: default_2.ReactNode;
853
- }
854
-
855
- export declare function wrapFormula(expression: string): string;
856
-
857
- export { }