treege 3.0.0-beta.9 → 3.0.0-beta.91

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 (225) hide show
  1. package/LICENSE +18 -12
  2. package/README.md +598 -79
  3. package/dist/DefaultSubmitButton-NeSDqyzv.js +1909 -0
  4. package/dist/ThemeContext-CPsC8QIP.js +1008 -0
  5. package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
  6. package/dist/editor/components/styles/EditorStyles.d.ts +2 -0
  7. package/dist/editor/constants/defaultNode.d.ts +1 -1
  8. package/dist/editor/constants/edgeTypes.d.ts +3 -2
  9. package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
  10. package/dist/editor/constants/nodeSpacing.d.ts +25 -0
  11. package/dist/editor/constants/nodeTypes.d.ts +4 -5
  12. package/dist/editor/context/OpenApiContext.d.ts +79 -0
  13. package/dist/editor/context/TreegeEditorRuntimeProvider.d.ts +78 -0
  14. package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
  15. package/dist/editor/features/TreegeEditor/controls/MiniMapControl.d.ts +6 -0
  16. package/dist/editor/features/TreegeEditor/dialogs/AuthorizeDialog.d.ts +20 -0
  17. package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
  18. package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
  19. package/dist/editor/features/TreegeEditor/dialogs/HeadersDialog.d.ts +19 -0
  20. package/dist/editor/features/TreegeEditor/dialogs/OpenApiDialog.d.ts +6 -0
  21. package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
  22. package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
  23. package/dist/editor/features/TreegeEditor/forms/HttpConfigForm.d.ts +4 -1
  24. package/dist/editor/features/TreegeEditor/forms/JsonTemplateEditor.d.ts +13 -0
  25. package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +34 -0
  26. package/dist/editor/features/TreegeEditor/forms/OptionsSourceForm.d.ts +7 -0
  27. package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +13 -0
  28. package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
  29. package/dist/editor/features/TreegeEditor/inputs/ApiUrlCombobox.d.ts +20 -0
  30. package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
  31. package/dist/editor/features/TreegeEditor/inputs/DefaultFileValueField.d.ts +14 -0
  32. package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
  33. package/dist/editor/features/TreegeEditor/inputs/SelectNodeGroup.d.ts +22 -1
  34. package/dist/editor/features/TreegeEditor/inputs/TranslatableInput.d.ts +20 -0
  35. package/dist/editor/features/TreegeEditor/layout/AutoLayout.d.ts +15 -0
  36. package/dist/editor/features/TreegeEditor/listeners/FlowChangeEmitter.d.ts +19 -0
  37. package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +5 -0
  38. package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +25 -0
  39. package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +6 -0
  40. package/dist/editor/features/TreegeEditor/nodes/components/NodeImage.d.ts +5 -0
  41. package/dist/editor/features/TreegeEditor/nodes/components/NodeImageButton.d.ts +6 -0
  42. package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +12 -0
  43. package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +10 -0
  44. package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
  45. package/dist/editor/features/TreegeEditor/nodes/components/NodeRequiredButton.d.ts +6 -0
  46. package/dist/editor/features/TreegeEditor/nodes/components/NodeStackOrderButtons.d.ts +6 -0
  47. package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
  48. package/dist/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.d.ts +12 -0
  49. package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +4 -2
  50. package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
  51. package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +7 -2
  52. package/dist/editor/features/TreegeEditor/panel/MultiSelectionPanel.d.ts +7 -0
  53. package/dist/editor/hooks/useAvailableParentFields.d.ts +13 -0
  54. package/dist/editor/hooks/useFlowActions.d.ts +6 -2
  55. package/dist/editor/hooks/useFlowConnections.d.ts +14 -0
  56. package/dist/editor/hooks/useFlowContent.d.ts +16 -0
  57. package/dist/editor/hooks/useHistoryStore.d.ts +26 -0
  58. package/dist/editor/hooks/useIsStackedEdge.d.ts +8 -0
  59. package/dist/editor/hooks/useKeyValueRows.d.ts +15 -0
  60. package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
  61. package/dist/editor/hooks/useStackPosition.d.ts +14 -0
  62. package/dist/editor/hooks/useTranslate.d.ts +1 -1
  63. package/dist/editor/hooks/useUndoRedo.d.ts +31 -0
  64. package/dist/editor/types/ai.d.ts +65 -0
  65. package/dist/editor/types/editor.d.ts +106 -10
  66. package/dist/editor/types/openapi.d.ts +106 -0
  67. package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
  68. package/dist/editor/utils/cleanEmptyData.d.ts +18 -0
  69. package/dist/editor/utils/cleanNodeConfig.d.ts +5 -0
  70. package/dist/editor/utils/dagreLayout.d.ts +8 -0
  71. package/dist/editor/utils/edge.d.ts +50 -0
  72. package/dist/editor/utils/groupColor.d.ts +14 -0
  73. package/dist/editor/utils/image.d.ts +7 -0
  74. package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
  75. package/dist/editor/utils/jsonBindTarget.d.ts +15 -0
  76. package/dist/editor/utils/openApiPayload.d.ts +12 -0
  77. package/dist/editor/utils/openapi.d.ts +35 -0
  78. package/dist/editor/utils/sensitiveHeaders.d.ts +20 -0
  79. package/dist/editor/utils/stackPositionIndex.d.ts +9 -0
  80. package/dist/editor-DJbNgLSF.js +6485 -0
  81. package/dist/editor.js +3 -7
  82. package/dist/main.js +6 -52
  83. package/dist/renderer/context/TreegeRenderRuntimeProvider.d.ts +135 -0
  84. package/dist/renderer/context/TreegeRendererProvider.d.ts +15 -0
  85. package/dist/renderer/context/TreegeViewerProvider.d.ts +28 -0
  86. package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
  87. package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
  88. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputLabel.d.ts +10 -0
  89. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputWrapper.d.ts +9 -0
  90. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +20 -15
  91. package/dist/renderer/features/TreegeRenderer/native/components/DefaultLoadingSkeleton.d.ts +8 -0
  92. package/dist/renderer/features/TreegeRenderer/native/components/DefaultStep.d.ts +3 -0
  93. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
  94. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
  95. package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
  96. package/dist/renderer/features/TreegeRenderer/native/components/DependencyHint.d.ts +15 -0
  97. package/dist/renderer/features/TreegeRenderer/native/components/OptionItemContent.d.ts +17 -0
  98. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
  99. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
  100. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
  101. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
  102. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
  103. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
  104. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
  105. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
  106. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
  107. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
  108. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
  109. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
  110. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSubmitInput.d.ts +11 -0
  111. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
  112. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
  113. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
  114. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
  115. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
  116. package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +97 -24
  117. package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
  118. package/dist/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.d.ts +3 -2
  119. package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputLabel.d.ts +9 -0
  120. package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputWrapper.d.ts +9 -0
  121. package/dist/renderer/features/TreegeRenderer/web/components/DefaultLoadingSkeleton.d.ts +7 -0
  122. package/dist/renderer/features/TreegeRenderer/web/components/DefaultStep.d.ts +3 -0
  123. package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +5 -1
  124. package/dist/renderer/features/TreegeRenderer/web/components/DependencyHint.d.ts +22 -0
  125. package/dist/renderer/features/TreegeRenderer/web/components/OptionItemContent.d.ts +17 -0
  126. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
  127. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
  128. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
  129. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
  130. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
  131. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
  132. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
  133. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
  134. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
  135. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
  136. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
  137. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
  138. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +11 -0
  139. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
  140. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
  141. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
  142. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
  143. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
  144. package/dist/renderer/features/TreegeRenderer/web/components/styles/RendererStyles.d.ts +2 -0
  145. package/dist/renderer/features/TreegeViewer/utils/viewerFields.d.ts +102 -0
  146. package/dist/renderer/features/TreegeViewer/web/TreegeViewer.d.ts +94 -0
  147. package/dist/renderer/hooks/useInputOptions.d.ts +28 -0
  148. package/dist/renderer/hooks/useRenderNode.d.ts +62 -0
  149. package/dist/renderer/hooks/useSubmitHandler.d.ts +37 -0
  150. package/dist/renderer/hooks/useTranslate.d.ts +7 -5
  151. package/dist/renderer/index.d.ts +10 -2
  152. package/dist/renderer/index.native.d.ts +20 -0
  153. package/dist/renderer/types/renderer.d.ts +332 -49
  154. package/dist/renderer/utils/extraPayload.d.ts +21 -0
  155. package/dist/renderer/utils/file.d.ts +24 -10
  156. package/dist/renderer/utils/flow.d.ts +1 -18
  157. package/dist/renderer/utils/form.d.ts +54 -2
  158. package/dist/renderer/utils/http.d.ts +177 -0
  159. package/dist/renderer/utils/jsonTemplate.d.ts +30 -0
  160. package/dist/renderer/utils/node.d.ts +29 -1
  161. package/dist/renderer/utils/sanitize.d.ts +85 -0
  162. package/dist/renderer/utils/sanitize.native.d.ts +69 -0
  163. package/dist/renderer/utils/step.d.ts +27 -0
  164. package/dist/renderer/utils/submit.d.ts +50 -0
  165. package/dist/renderer/utils/templateDependencies.d.ts +17 -0
  166. package/dist/renderer-CNbSt_QW.js +446 -0
  167. package/dist/renderer-native.d.ts +2 -0
  168. package/dist/renderer-native.js +3696 -0
  169. package/dist/renderer.js +5 -45
  170. package/dist/shared/components/ui/badge.d.ts +2 -2
  171. package/dist/shared/components/ui/button.d.ts +3 -3
  172. package/dist/shared/components/ui/collapsible.d.ts +1 -1
  173. package/dist/shared/components/ui/command.d.ts +1 -1
  174. package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
  175. package/dist/shared/components/ui/field.d.ts +24 -0
  176. package/dist/shared/components/ui/form.d.ts +1 -1
  177. package/dist/shared/components/ui/item.d.ts +23 -0
  178. package/dist/shared/components/ui/popover.d.ts +10 -2
  179. package/dist/shared/components/ui/select.d.ts +3 -1
  180. package/dist/shared/components/ui/sheet.d.ts +1 -1
  181. package/dist/shared/components/ui/skeleton.d.ts +3 -0
  182. package/dist/shared/components/ui/toggle-group.d.ts +7 -0
  183. package/dist/shared/components/ui/toggle.d.ts +9 -0
  184. package/dist/shared/components/ui/tooltip.d.ts +1 -1
  185. package/dist/shared/constants/colors.d.ts +45 -0
  186. package/dist/shared/constants/inputType.d.ts +6 -0
  187. package/dist/shared/constants/node.d.ts +0 -1
  188. package/dist/shared/context/PortalContainerContext.d.ts +5 -0
  189. package/dist/shared/context/ThemeContext.d.ts +2 -0
  190. package/dist/shared/context/ThemeContext.native.d.ts +22 -0
  191. package/dist/shared/hooks/useMediaQuery.d.ts +12 -0
  192. package/dist/shared/hooks/useThemeColors.d.ts +37 -0
  193. package/dist/shared/locales/ar.json.d.ts +259 -19
  194. package/dist/shared/locales/de.json.d.ts +260 -20
  195. package/dist/shared/locales/en.json.d.ts +261 -21
  196. package/dist/shared/locales/es.json.d.ts +260 -20
  197. package/dist/shared/locales/fr.json.d.ts +260 -20
  198. package/dist/shared/locales/it.json.d.ts +260 -20
  199. package/dist/shared/locales/pt.json.d.ts +260 -20
  200. package/dist/shared/types/edge.d.ts +6 -0
  201. package/dist/shared/types/file.d.ts +14 -0
  202. package/dist/shared/types/node.d.ts +155 -19
  203. package/dist/shared/utils/httpRecord.d.ts +20 -0
  204. package/dist/shared/utils/inputTypeGuards.d.ts +7 -0
  205. package/dist/shared/utils/nodeTypeGuards.d.ts +1 -6
  206. package/dist/shared/utils/normalizeLabel.d.ts +22 -0
  207. package/dist/shared/utils/translations.d.ts +21 -1
  208. package/dist/useRenderNode-CG466pNk.js +538 -0
  209. package/package.json +54 -22
  210. package/dist/ThemeContext-BIvs8Kw-.js +0 -758
  211. package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
  212. package/dist/TreegeRenderer-BVaqgInZ.js +0 -1405
  213. package/dist/editor/context/TreegeEditorContext.d.ts +0 -12
  214. package/dist/editor/features/TreegeEditor/forms/FlowNodeForm.d.ts +0 -2
  215. package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
  216. package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
  217. package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +0 -6
  218. package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
  219. package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
  220. package/dist/editor/hooks/useEdgesSelection.d.ts +0 -11
  221. package/dist/renderer/context/TreegeConfigContext.d.ts +0 -39
  222. package/dist/renderer/context/TreegeRendererContext.d.ts +0 -25
  223. package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +0 -7
  224. package/dist/renderer/features/TreegeRenderer/web/components/DefaultGroup.d.ts +0 -6
  225. /package/dist/editor/components/{data-display/logo.d.ts → branding/Logo.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { Edge, Node } from '@xyflow/react';
2
2
  import { INPUT_TYPE } from '../constants/inputType';
3
3
  import { UI_TYPE } from '../constants/uiType';
4
+ import { SerializableFile } from './file';
4
5
  import { Translatable } from './translate';
5
6
  export type UIType = (typeof UI_TYPE)[keyof typeof UI_TYPE];
6
7
  export type InputType = (typeof INPUT_TYPE)[keyof typeof INPUT_TYPE];
@@ -18,10 +19,19 @@ export type InputOption = {
18
19
  * The label of the option, which can be translated
19
20
  */
20
21
  label: Translatable;
22
+ /**
23
+ * Optional secondary description, shown under the label (translatable)
24
+ */
25
+ description?: Translatable;
21
26
  /**
22
27
  * Whether the option is disabled and cannot be selected
23
28
  */
24
29
  disabled?: boolean;
30
+ /**
31
+ * Optional image for the option, stored as base64 data URL or remote URL.
32
+ * Currently displayed by radio inputs; uploads are automatically resized and compressed.
33
+ */
34
+ image?: string;
25
35
  };
26
36
  export type BaseNodeData = {
27
37
  /**
@@ -29,28 +39,24 @@ export type BaseNodeData = {
29
39
  */
30
40
  label?: Translatable;
31
41
  };
32
- export type FlowNodeData = BaseNodeData & {
33
- /**
34
- * The ID of the target node to connect to
35
- */
36
- targetId?: string;
37
- };
38
42
  export type GroupNodeData = BaseNodeData & {
39
43
  /**
40
44
  * A label for the group node, which can be translated
41
45
  */
42
46
  label: Translatable;
43
47
  };
44
- export type HttpHeader = {
45
- /**
46
- * The header key (e.g., "Authorization", "Content-Type")
47
- */
48
- key: string;
49
- /**
50
- * The header value
51
- */
52
- value: string;
53
- };
48
+ /**
49
+ * HTTP headers as a plain object keyed by header name, e.g.
50
+ * `{ Authorization: "Bearer xyz", "Content-Type": "application/json" }`.
51
+ * Values support template variables like `{{fieldId}}`.
52
+ */
53
+ export type HttpHeaders = Record<string, string>;
54
+ /**
55
+ * Query parameters as a plain object keyed by parameter name, e.g.
56
+ * `{ limit: "10", sort: "asc" }`. Values support template variables like
57
+ * `{{fieldId}}`.
58
+ */
59
+ export type QueryParams = Record<string, string>;
54
60
  export type HttpConfig = {
55
61
  /**
56
62
  * The HTTP method to use
@@ -63,11 +69,19 @@ export type HttpConfig = {
63
69
  /**
64
70
  * Custom headers for the HTTP request
65
71
  */
66
- headers?: HttpHeader[];
72
+ headers?: HttpHeaders;
73
+ /**
74
+ * Query parameters appended to the URL (supports template variables like {{fieldId}})
75
+ */
76
+ queryParams?: QueryParams;
67
77
  /**
68
78
  * Request body (for POST/PUT/PATCH methods)
69
79
  */
70
80
  body?: string;
81
+ /**
82
+ * If true, automatically sends all form data as JSON body (overrides custom body)
83
+ */
84
+ sendAllFormValues?: boolean;
71
85
  /**
72
86
  * JSONPath or key to extract from the response
73
87
  * Examples: "data.users", "results[0].name"
@@ -85,6 +99,14 @@ export type HttpConfig = {
85
99
  * Path to the label field in response items
86
100
  */
87
101
  labelField?: string;
102
+ /**
103
+ * Path to the field used as the option description (optional)
104
+ */
105
+ descriptionField?: string;
106
+ /**
107
+ * Path to the field used as the option image — base64 data URL or remote URL (optional)
108
+ */
109
+ imageField?: string;
88
110
  };
89
111
  /**
90
112
  * Query parameter name for search (enables combobox with search)
@@ -100,6 +122,90 @@ export type HttpConfig = {
100
122
  */
101
123
  showLoading?: boolean;
102
124
  };
125
+ /**
126
+ * Maps response item fields to InputOption properties.
127
+ * Each value is a path expression (e.g., "id", "user.name", "items[0].title").
128
+ */
129
+ export type OptionsSourceMapping = {
130
+ /** Path to the field used as InputOption.value */
131
+ valueField: string;
132
+ /** Path to the field used as InputOption.label */
133
+ labelField: string;
134
+ /** Path to the field used as InputOption.description (optional) */
135
+ descriptionField?: string;
136
+ /** Path to the field used as InputOption.image (optional) */
137
+ imageField?: string;
138
+ };
139
+ /**
140
+ * Dynamic options source — fetches the option list from an HTTP endpoint
141
+ * at runtime. Applies to inputs that use options (radio, checkbox, select,
142
+ * autocomplete). When set, overrides the static `options` array.
143
+ */
144
+ export type OptionsSource = {
145
+ /** API URL (supports template variables like {{fieldId}}) */
146
+ url?: string;
147
+ /** HTTP method */
148
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
149
+ /** Custom headers (merged with global headers; field-level wins) */
150
+ headers?: HttpHeaders;
151
+ /** Query parameters appended to the URL (supports template variables like {{fieldId}}) */
152
+ queryParams?: QueryParams;
153
+ /** Request body (for POST/PUT/PATCH; supports template variables) */
154
+ body?: string;
155
+ /** JSONPath to extract the array from the response (e.g., "data.users") */
156
+ responsePath?: string;
157
+ /** Field-to-property mapping for each response item */
158
+ mapping?: OptionsSourceMapping;
159
+ };
160
+ export type SubmitConfig = {
161
+ /**
162
+ * The HTTP method to use for form submission
163
+ */
164
+ method?: "POST" | "PUT" | "PATCH" | "DELETE";
165
+ /**
166
+ * The API URL to call on submit (supports template variables like {{fieldId}})
167
+ */
168
+ url?: string;
169
+ /**
170
+ * Custom headers for the HTTP request
171
+ */
172
+ headers?: HttpHeaders;
173
+ /**
174
+ * Query parameters appended to the URL (supports template variables like {{fieldId}})
175
+ */
176
+ queryParams?: QueryParams;
177
+ /**
178
+ * Free-form JSON template that defines the submitted payload. Field tokens
179
+ * sit inside string positions, e.g. `{"data": {"name": "{{firstName}}"}}`,
180
+ * where `{{token}}` is a field's node id (or its token-safe `name`) and is
181
+ * replaced by the field value with its JSON type preserved.
182
+ *
183
+ * This is the single source of truth for the payload: it is delivered to the
184
+ * `onSubmit` callback AND, when a `url` is configured, sent as the HTTP request
185
+ * body. Takes precedence over `sendAllFormValues`.
186
+ */
187
+ payloadTemplate?: string;
188
+ /**
189
+ * If true, automatically sends all form data as JSON body (overrides custom body)
190
+ */
191
+ sendAllFormValues?: boolean;
192
+ /**
193
+ * URL to redirect to after successful submission (supports template variables from response)
194
+ */
195
+ redirectUrl?: string;
196
+ /**
197
+ * Success message to display after successful submission (translatable)
198
+ */
199
+ successMessage?: Translatable;
200
+ /**
201
+ * Error message to display if submission fails (translatable)
202
+ */
203
+ errorMessage?: Translatable;
204
+ /**
205
+ * Whether to show a loading state while submitting
206
+ */
207
+ showLoading?: boolean;
208
+ };
103
209
  export type InputNodeData = BaseNodeData & {
104
210
  /**
105
211
  * The name of the input field, used for identification and form submission
@@ -137,12 +243,20 @@ export type InputNodeData = BaseNodeData & {
137
243
  * Whether multiple selections are allowed (for select and checkbox types)
138
244
  */
139
245
  multiple?: boolean;
246
+ /**
247
+ * Visual variant (currently used by radio inputs)
248
+ */
249
+ variant?: "default" | "card";
250
+ /**
251
+ * Whether past dates should be disabled (for date and daterange types)
252
+ */
253
+ disablePast?: boolean;
140
254
  /**
141
255
  * The default value config for the input field
142
256
  */
143
257
  defaultValue?: null | {
144
258
  type?: "static" | "reference";
145
- staticValue?: string | string[] | boolean;
259
+ staticValue?: string | string[] | boolean | SerializableFile | SerializableFile[];
146
260
  referenceField?: string;
147
261
  transformFunction?: null | "toString" | "toNumber" | "toBoolean" | "toArray" | "toObject";
148
262
  objectMapping?: Array<{
@@ -154,6 +268,28 @@ export type InputNodeData = BaseNodeData & {
154
268
  * HTTP configuration for the input field (used with type="http")
155
269
  */
156
270
  httpConfig?: HttpConfig;
271
+ /**
272
+ * Dynamic options source — fetches the option list from an HTTP endpoint
273
+ * at runtime. Used by option-based inputs (radio, checkbox, select, autocomplete).
274
+ * When set, overrides the static `options` array.
275
+ */
276
+ optionsSource?: OptionsSource;
277
+ /**
278
+ * Whether labels fetched from an API (dynamic `optionsSource` or an `http`
279
+ * input's `responseMapping`) are normalized to a uniform, readable Title Case
280
+ * form (e.g. "DUPONT JEAN" -> "Dupont Jean"). Manually-typed static option
281
+ * labels are never affected. Defaults to `true` when unset.
282
+ */
283
+ normalizeOptionLabels?: boolean;
284
+ /**
285
+ * Submit configuration for the input field (used with type="submit")
286
+ */
287
+ submitConfig?: SubmitConfig;
288
+ /**
289
+ * Optional illustrative image displayed above the input label.
290
+ * Stored as a base64 data URL (uploads are resized/compressed) or a remote URL.
291
+ */
292
+ image?: string;
157
293
  };
158
294
  export type UINodeData = BaseNodeData & {
159
295
  /**
@@ -164,7 +300,7 @@ export type UINodeData = BaseNodeData & {
164
300
  /**
165
301
  * Union type representing all possible node data types in the Treege system
166
302
  */
167
- export type TreegeNodeData = InputNodeData | UINodeData | FlowNodeData | GroupNodeData;
303
+ export type TreegeNodeData = InputNodeData | UINodeData | GroupNodeData;
168
304
  /**
169
305
  * A TreegeNode represents a node in the flowchart with specific data and properties
170
306
  */
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A single editable key/value row. Editor forms work on lists of these while
3
+ * the user types (they tolerate transient empty keys), then serialize back to
4
+ * the persisted `Record<string, string>` form via `entriesToRecord`.
5
+ */
6
+ export type KeyValueEntry = {
7
+ key: string;
8
+ value: string;
9
+ };
10
+ /**
11
+ * Expand a `{ key: value }` record into editor rows, preserving insertion
12
+ * order. Returns an empty list for `undefined`.
13
+ */
14
+ export declare const recordToEntries: (record?: Record<string, string>) => KeyValueEntry[];
15
+ /**
16
+ * Collapse editor rows back into a `{ key: value }` record. Rows with an empty
17
+ * key are dropped (they're transient editing artifacts), and on duplicate keys
18
+ * the last occurrence wins.
19
+ */
20
+ export declare const entriesToRecord: (entries?: KeyValueEntry[]) => Record<string, string>;
@@ -0,0 +1,7 @@
1
+ import { InputNodeData, TreegeNodeData } from '../types/node';
2
+ /**
3
+ * Type guard: narrows the node `data` to an `InputNodeData` whose type
4
+ * supports an option list. After a truthy check, `data.options`,
5
+ * `data.optionsSource`, etc. are accessible without casts.
6
+ */
7
+ export declare const isOptionsInputData: (data: TreegeNodeData | undefined) => data is InputNodeData;
@@ -1,5 +1,5 @@
1
1
  import { Node } from '@xyflow/react';
2
- import { FlowNodeData, GroupNodeData, InputNodeData, TreegeNode, UINodeData } from '../types/node';
2
+ import { GroupNodeData, InputNodeData, TreegeNode, UINodeData } from '../types/node';
3
3
  /**
4
4
  * Type guard to check if a node is an InputNode
5
5
  * @param node
@@ -10,11 +10,6 @@ export declare const isInputNode: (node: TreegeNode | undefined) => node is Node
10
10
  * @param node
11
11
  */
12
12
  export declare const isUINode: (node: TreegeNode | undefined) => node is Node<UINodeData, "ui">;
13
- /**
14
- * Type guard to check if a node is a FlowNode
15
- * @param node
16
- */
17
- export declare const isFlowNode: (node: TreegeNode | undefined) => node is Node<FlowNodeData, "flow">;
18
13
  /**
19
14
  * Type guard to check if a node is a GroupNode
20
15
  * @param node
@@ -0,0 +1,22 @@
1
+ import { Translatable } from '../types/translate';
2
+ /**
3
+ * Normalizes a raw label string into a uniform, readable Title Case form.
4
+ *
5
+ * Designed for labels coming from an API where casing is often inconsistent
6
+ * (ALL CAPS, snake_case, kebab-case, camelCase). Each word gets an uppercase
7
+ * first letter and a lowercase remainder, with separators collapsed to single
8
+ * spaces:
9
+ *
10
+ * "DUPONT JEAN" -> "Dupont Jean"
11
+ * "admin_user" -> "Admin User"
12
+ * "dateNaissance" -> "Date Naissance"
13
+ *
14
+ * Empty/whitespace-only input is returned unchanged.
15
+ */
16
+ export declare const normalizeLabel: (text: string) => string;
17
+ /**
18
+ * Applies {@link normalizeLabel} to every language entry of a `Translatable`
19
+ * label, preserving its shape. Labels are always the object form here — plain
20
+ * strings are coerced upstream by `normalizeFlowLabels` on ingestion.
21
+ */
22
+ export declare const normalizeTranslatableLabel: (label: Translatable) => Translatable;
@@ -21,7 +21,27 @@ export type TranslationKey = DotNotationKeys<typeof en>;
21
21
  * @param language - Optional preferred language (defaults to 'en')
22
22
  * @returns The translated string or empty string if none available
23
23
  */
24
- export declare const getTranslatedText: (text?: Translatable | string, language?: string) => string;
24
+ export declare const getTranslatedText: (text?: Translatable, language?: string) => string;
25
+ /**
26
+ * Reads the value of a translatable field for a given language while tolerating a
27
+ * value for a language. Returns "" when the value or the language entry is absent.
28
+ *
29
+ * Use this for editor inputs instead of `value?.[language]` so reads/writes stay
30
+ * consistent with {@link setTranslatableValue}.
31
+ */
32
+ export declare const getTranslatableValue: (value: Translatable | undefined, language: string) => string;
33
+ /**
34
+ * Sets `language` to `next` on a translatable field and returns a NEW Translatable,
35
+ * preserving the other language entries. Always use this when writing a
36
+ * translatable field from the editor rather than spreading the previous value
37
+ * inline.
38
+ *
39
+ * The `typeof === "object"` guard is purely defensive: the type system guarantees
40
+ * an object, but should a stray non-object (e.g. unsupported legacy string data)
41
+ * reach this at runtime, it is dropped rather than spread into indexed character
42
+ * keys (`"Hi"` → `{ "0": "H", "1": "i" }`).
43
+ */
44
+ export declare const setTranslatableValue: (value: Translatable | undefined, language: string, next: string) => Translatable;
25
45
  /**
26
46
  * Get static translations for a specific language
27
47
  * Falls back to English if language not found