treege 3.0.0-beta.47 → 3.0.0-beta.49

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 (50) hide show
  1. package/dist/DefaultInputs-CLKy3v8A.js +1761 -0
  2. package/dist/ThemeContext-Ct1JesKT.js +1353 -0
  3. package/dist/editor/constants/edgeTypes.d.ts +2 -2
  4. package/dist/editor/constants/nodeTypes.d.ts +0 -1
  5. package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +1 -1
  6. package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +1 -1
  7. package/dist/editor/features/TreegeEditor/inputs/SelectNodeGroup.d.ts +16 -1
  8. package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +2 -2
  9. package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +3 -1
  10. package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +2 -1
  11. package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +6 -1
  12. package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +2 -1
  13. package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +3 -1
  14. package/dist/editor/features/TreegeEditor/panel/MultiSelectionPanel.d.ts +7 -0
  15. package/dist/editor/hooks/useAvailableParentFields.d.ts +13 -0
  16. package/dist/editor/hooks/useFlowActions.d.ts +1 -0
  17. package/dist/editor/hooks/useIsStackedEdge.d.ts +8 -0
  18. package/dist/editor/hooks/useStackPosition.d.ts +2 -0
  19. package/dist/editor/utils/dagreLayout.d.ts +0 -12
  20. package/dist/editor/utils/stackPositionIndex.d.ts +9 -0
  21. package/dist/editor-DwBsZEzm.js +5495 -0
  22. package/dist/editor.js +2 -2
  23. package/dist/main.js +4 -4
  24. package/dist/renderer/context/TreegeRendererContext.d.ts +2 -4
  25. package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +3 -4
  26. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
  27. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
  28. package/dist/renderer/types/renderer.d.ts +23 -5
  29. package/dist/renderer/utils/flow.d.ts +1 -18
  30. package/dist/renderer/utils/step.d.ts +1 -1
  31. package/dist/renderer-native.js +950 -950
  32. package/dist/renderer.js +3 -3
  33. package/dist/shared/constants/node.d.ts +0 -1
  34. package/dist/shared/locales/ar.json.d.ts +10 -8
  35. package/dist/shared/locales/de.json.d.ts +10 -8
  36. package/dist/shared/locales/en.json.d.ts +10 -8
  37. package/dist/shared/locales/es.json.d.ts +10 -8
  38. package/dist/shared/locales/fr.json.d.ts +10 -8
  39. package/dist/shared/locales/it.json.d.ts +10 -8
  40. package/dist/shared/locales/pt.json.d.ts +10 -8
  41. package/dist/shared/types/node.d.ts +1 -7
  42. package/dist/shared/utils/inputTypeGuards.d.ts +7 -0
  43. package/dist/shared/utils/nodeTypeGuards.d.ts +1 -6
  44. package/package.json +1 -1
  45. package/dist/DefaultInputs-UkiUaJcf.js +0 -1734
  46. package/dist/ThemeContext-CNsS53ku.js +0 -1454
  47. package/dist/editor/features/TreegeEditor/forms/FlowNodeForm.d.ts +0 -2
  48. package/dist/editor/features/TreegeEditor/nodes/components/NodeOptions.d.ts +0 -12
  49. package/dist/editor/hooks/useEdgesSelection.d.ts +0 -11
  50. package/dist/editor-DrGQB__b.js +0 -5313
package/dist/editor.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as e } from "./editor-DrGQB__b.js";
2
- import { n as t, t as n } from "./ThemeContext-CNsS53ku.js";
1
+ import { t as e } from "./editor-DwBsZEzm.js";
2
+ import { n as t, t as n } from "./ThemeContext-Ct1JesKT.js";
3
3
  export { n as ThemeProvider, e as TreegeEditor, t as useTheme };
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./editor-DrGQB__b.js";
2
- import { B as t, C as n, D as r, E as i, H as a, L as o, M as s, N as c, O as l, R as u, S as d, T as f, V as p, _ as m, a as h, b as g, c as _, g as v, i as y, l as b, n as x, o as S, s as C, t as w, w as T, x as E, z as D } from "./ThemeContext-CNsS53ku.js";
3
- import { C as O, E as k, S as A, T as j, _ as M, a as N, b as P, d as F, f as I, i as L, l as R, m as z, n as B, p as V, r as H, s as U, t as W, u as G, v as K, w as q, x as J, y as Y } from "./DefaultInputs-UkiUaJcf.js";
4
- export { k as DefaultAddressInput, j as DefaultAutocompleteInput, q as DefaultCheckboxInput, O as DefaultDateInput, A as DefaultDateRangeInput, J as DefaultFileInput, P as DefaultHiddenInput, Y as DefaultHttpInput, K as DefaultNumberInput, M as DefaultPasswordInput, z as DefaultRadioInput, V as DefaultSelectInput, U as DefaultSwitchInput, N as DefaultTextAreaInput, L as DefaultTextInput, H as DefaultTimeInput, B as DefaultTimeRangeInput, G as Divider, w as ThemeProvider, F as Title, h as TreegeConfigProvider, e as TreegeEditor, R as TreegeRenderer, T as applyReferenceTransformation, f as calculateReferenceFieldUpdates, i as checkFormFieldHasValue, r as convertFormValuesToNamedFormat, W as defaultInputRenderers, I as defaultUI, s as evaluateCondition, c as evaluateConditions, C as fileToSerializable, _ as filesToSerializable, g as findStartNode, E as getFlowRenderState, o as getStaticTranslations, u as getTranslatedText, l as isFieldEmpty, D as isFlowNode, t as isGroupNode, p as isInputNode, d as isStartNode, a as isUINode, n as mergeFlows, v as sanitize, m as sanitizeHttpResponse, b as serializableToFile, x as useTheme, S as useTreegeConfig, y as useTreegeRenderer };
1
+ import { t as e } from "./editor-DwBsZEzm.js";
2
+ import { A as t, B as n, I as r, L as i, R as a, S as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, l as g, m as _, n as v, o as y, p as b, s as x, t as S, u as C, x as w, z as T } from "./ThemeContext-Ct1JesKT.js";
3
+ import { C as E, E as D, S as O, T as k, _ as A, a as j, b as M, d as N, f as P, i as F, l as I, m as L, n as R, p as z, r as B, s as V, t as H, u as U, v as W, w as G, x as K, y as q } from "./DefaultInputs-CLKy3v8A.js";
4
+ export { D as DefaultAddressInput, k as DefaultAutocompleteInput, G as DefaultCheckboxInput, E as DefaultDateInput, O as DefaultDateRangeInput, K as DefaultFileInput, M as DefaultHiddenInput, q as DefaultHttpInput, W as DefaultNumberInput, A as DefaultPasswordInput, L as DefaultRadioInput, z as DefaultSelectInput, V as DefaultSwitchInput, j as DefaultTextAreaInput, F as DefaultTextInput, B as DefaultTimeInput, R as DefaultTimeRangeInput, U as Divider, S as ThemeProvider, N as Title, C as TreegeConfigProvider, e as TreegeEditor, I as TreegeRenderer, d as applyReferenceTransformation, b as calculateReferenceFieldUpdates, _ as checkFormFieldHasValue, p as convertFormValuesToNamedFormat, H as defaultInputRenderers, P as defaultUI, l as evaluateCondition, g as evaluateConditions, c as fileToSerializable, w as filesToSerializable, s as findStartNode, y as getFlowRenderState, r as getStaticTranslations, i as getTranslatedText, f as isFieldEmpty, a as isGroupNode, T as isInputNode, x as isStartNode, n as isUINode, h as sanitize, t as sanitizeHttpResponse, o as serializableToFile, v as useTheme, u as useTreegeConfig, m as useTreegeRenderer };
@@ -4,8 +4,7 @@ import { FormValues } from '../types/renderer';
4
4
  import { Flow, HttpHeader, InputNodeData } from '../../shared/types/node';
5
5
  export interface TreegeRendererContextValue {
6
6
  /**
7
- * The flow currently being rendered (already merged when several flows
8
- * are linked through `FlowNode`s). `null` when the renderer has no flow
7
+ * The flow currently being rendered. `null` when the renderer has no flow
9
8
  * to display yet.
10
9
  */
11
10
  flows?: Flow | null;
@@ -70,8 +69,7 @@ export declare const TreegeRendererProvider: ({ children, value }: TreegeRendere
70
69
  export declare const useTreegeRendererContext: () => {
71
70
  edges: import('@xyflow/react').Edge[];
72
71
  /**
73
- * The flow currently being rendered (already merged when several flows
74
- * are linked through `FlowNode`s). `null` when the renderer has no flow
72
+ * The flow currently being rendered. `null` when the renderer has no flow
75
73
  * to display yet.
76
74
  */
77
75
  flows?: Flow | null;
@@ -31,19 +31,19 @@ export declare const useTreegeRenderer: ({ components, flows, googleApiKey, head
31
31
  }) => import('react').ReactNode) | undefined;
32
32
  inputs: {
33
33
  number?: ((props: import('../../types/renderer').InputRenderProps<"number">) => import('react').ReactNode) | undefined;
34
+ checkbox?: ((props: import('../../types/renderer').InputRenderProps<"checkbox">) => import('react').ReactNode) | undefined;
35
+ radio?: ((props: import('../../types/renderer').InputRenderProps<"radio">) => import('react').ReactNode) | undefined;
36
+ switch?: ((props: import('../../types/renderer').InputRenderProps<"switch">) => import('react').ReactNode) | undefined;
34
37
  address?: ((props: import('../../types/renderer').InputRenderProps<"address">) => import('react').ReactNode) | undefined;
35
38
  autocomplete?: ((props: import('../../types/renderer').InputRenderProps<"autocomplete">) => import('react').ReactNode) | undefined;
36
- checkbox?: ((props: import('../../types/renderer').InputRenderProps<"checkbox">) => import('react').ReactNode) | undefined;
37
39
  date?: ((props: import('../../types/renderer').InputRenderProps<"date">) => import('react').ReactNode) | undefined;
38
40
  daterange?: ((props: import('../../types/renderer').InputRenderProps<"daterange">) => import('react').ReactNode) | undefined;
39
41
  file?: ((props: import('../../types/renderer').InputRenderProps<"file">) => import('react').ReactNode) | undefined;
40
42
  hidden?: ((props: import('../../types/renderer').InputRenderProps<"hidden">) => import('react').ReactNode) | undefined;
41
43
  http?: ((props: import('../../types/renderer').InputRenderProps<"http">) => import('react').ReactNode) | undefined;
42
44
  password?: ((props: import('../../types/renderer').InputRenderProps<"password">) => import('react').ReactNode) | undefined;
43
- radio?: ((props: import('../../types/renderer').InputRenderProps<"radio">) => import('react').ReactNode) | undefined;
44
45
  select?: ((props: import('../../types/renderer').InputRenderProps<"select">) => import('react').ReactNode) | undefined;
45
46
  submit?: ((props: import('../../types/renderer').InputRenderProps<"submit">) => import('react').ReactNode) | undefined;
46
- switch?: ((props: import('../../types/renderer').InputRenderProps<"switch">) => import('react').ReactNode) | undefined;
47
47
  text?: ((props: import('../../types/renderer').InputRenderProps<"text">) => import('react').ReactNode) | undefined;
48
48
  textarea?: ((props: import('../../types/renderer').InputRenderProps<"textarea">) => import('react').ReactNode) | undefined;
49
49
  time?: ((props: import('../../types/renderer').InputRenderProps<"time">) => import('react').ReactNode) | undefined;
@@ -90,7 +90,6 @@ export declare const useTreegeRenderer: ({ components, flows, googleApiKey, head
90
90
  isFirstStep: boolean;
91
91
  isLastStep: boolean;
92
92
  isSubmitting: boolean;
93
- mergedFlow: import('../../../shared/types/node').Flow;
94
93
  missingRequiredFields: string[];
95
94
  prevFormValuesRef: import('react').RefObject<FormValues>;
96
95
  setFieldErrors: import('react').Dispatch<import('react').SetStateAction<Record<string, string>>>;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultCheckboxInput: ({ node, value, setValue, error, label, helperText, id, name }: InputRenderProps<"checkbox">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultCheckboxInput: ({ node, value, setValue, error, label, helperText, id, name, renderOptionExtras, compactOptions, }: InputRenderProps<"checkbox">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultCheckboxInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultRadioInput: ({ node, value, setValue, error, label, helperText, id, name }: InputRenderProps<"radio">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultRadioInput: ({ node, value, setValue, error, label, helperText, id, name, renderOptionExtras, compactOptions, }: InputRenderProps<"radio">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultRadioInput;
@@ -2,7 +2,7 @@ import { Node } from '@xyflow/react';
2
2
  import { FormEvent, ReactNode } from 'react';
3
3
  import { SerializableFile } from '../utils/file';
4
4
  import { FlowStep } from '../utils/step';
5
- import { Flow, GroupNodeData, HttpHeader, InputNodeData, InputType, TreegeNodeData, UINodeData, UIType } from '../../shared/types/node';
5
+ import { Flow, GroupNodeData, HttpHeader, InputNodeData, InputOption, InputType, TreegeNodeData, UINodeData, UIType } from '../../shared/types/node';
6
6
  /**
7
7
  * Type mapping for input values based on input type
8
8
  */
@@ -88,6 +88,26 @@ export type InputRenderProps<T extends InputType = InputType> = {
88
88
  * Whether the form is currently being submitted (for submit inputs)
89
89
  */
90
90
  isSubmitting?: boolean;
91
+ /**
92
+ * Editor-only extension slot: when provided, option-based renderers (radio,
93
+ * checkbox) call this for each option to paint inline extras next to it
94
+ * (e.g. value preview, edit / delete buttons). `variant` is a renderer-side
95
+ * layout hint (e.g. `"card"` for radio cards). Returning `null` skips the
96
+ * slot for that option. Left undefined in runtime so the renderers stay
97
+ * runtime-pure.
98
+ */
99
+ renderOptionExtras?: (option: {
100
+ option: InputOption;
101
+ index: number;
102
+ variant?: string;
103
+ }) => ReactNode;
104
+ /**
105
+ * Editor-only layout flag. When `true`, option-based renderers force their
106
+ * option labels to a single truncated line (block + max-w-full + truncate)
107
+ * and reserve room on the right for the `renderOptionExtras` overlay.
108
+ * Defaults to `false` (multi-line, runtime-pure).
109
+ */
110
+ compactOptions?: boolean;
91
111
  };
92
112
  export type UiRenderProps = {
93
113
  node: Node<UINodeData>;
@@ -241,11 +261,9 @@ export interface TreegeRendererProps extends TreegeRendererConfig {
241
261
  */
242
262
  className?: string;
243
263
  /**
244
- * Flow or array of flows
245
- * - If a single Flow: renders that flow
246
- * - If an array: first flow is the main flow, others are sub-flows available for FlowNodes
264
+ * Flow to render. `null` / `undefined` renders nothing.
247
265
  */
248
- flows?: Flow | Flow[] | null;
266
+ flows?: Flow | null;
249
267
  /**
250
268
  * Initial form values
251
269
  */
@@ -1,7 +1,7 @@
1
1
  import { Edge, Node } from '@xyflow/react';
2
2
  import { FormValues } from '../types/renderer';
3
3
  import { ConditionalEdgeData } from '../../shared/types/edge';
4
- import { Flow, TreegeNodeData } from '../../shared/types/node';
4
+ import { TreegeNodeData } from '../../shared/types/node';
5
5
  /**
6
6
  * Result from computing the flow render state
7
7
  * Contains everything needed to render the form and determine its state
@@ -72,20 +72,3 @@ export declare const findStartNode: (nodes: Node<TreegeNodeData>[], edges: Edge[
72
72
  * @returns Complete flow render state (visible nodes, end-of-path flag, etc.)
73
73
  */
74
74
  export declare const getFlowRenderState: (nodes: Node<TreegeNodeData>[], edges: Edge<ConditionalEdgeData>[], formValues: FormValues) => FlowRenderState;
75
- /**
76
- * Merge multiple flows into a single flow by recursively replacing FlowNodes with their target flow's nodes
77
- *
78
- * This function takes a flow or an array of flows, automatically detects the main flow, then:
79
- * 1. Replaces each FlowNode with the nodes from its target flow
80
- * 2. Preserves the order of nodes by inserting sub-flow nodes at the FlowNode position
81
- * 3. Redirects edges that point to FlowNodes to the first node of the target flow
82
- * 4. Connects the last nodes of sub-flows to the nodes that followed the FlowNode
83
- *
84
- * Main flow detection:
85
- * - The main flow is automatically identified as the one that references other flows but is not referenced itself
86
- * - This allows flows to be passed in any order without breaking the merge logic
87
- *
88
- * @param flows - A single Flow or an array of flows (can be null/undefined)
89
- * @returns A single merged Flow containing all nodes and edges
90
- */
91
- export declare const mergeFlows: (flows?: Flow | Flow[] | null) => Flow;
@@ -22,6 +22,6 @@ export type FlowStep = {
22
22
  * time the `parentId` of the next renderable node changes (i.e. the flow
23
23
  * crosses a group boundary, or moves between an orphan and a grouped node).
24
24
  *
25
- * Group / flow nodes themselves are skipped — they're metadata only.
25
+ * Group nodes themselves are skipped — they're metadata only.
26
26
  */
27
27
  export declare const computeSteps: (visibleNodes: Node<TreegeNodeData>[]) => FlowStep[];