treege 3.0.0-beta.10 → 3.0.0-beta.12

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 (52) hide show
  1. package/dist/ThemeContext-mnnnxuZU.js +758 -0
  2. package/dist/TreegeEditor-Bgl5solk.js +2734 -0
  3. package/dist/TreegeRenderer-DJaR2FqI.js +1441 -0
  4. package/dist/editor/constants/defaultNode.d.ts +1 -1
  5. package/dist/editor/constants/edgeTypes.d.ts +1 -1
  6. package/dist/editor/constants/nodeSpacing.d.ts +20 -0
  7. package/dist/editor/constants/nodeTypes.d.ts +4 -4
  8. package/dist/editor/context/TreegeEditorContext.d.ts +15 -0
  9. package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
  10. package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +1 -1
  11. package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +1 -1
  12. package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +1 -1
  13. package/dist/editor/features/TreegeEditor/nodes/hooks/useBottomHandleClick.d.ts +8 -0
  14. package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
  15. package/dist/editor/hooks/useFlowConnections.d.ts +1 -0
  16. package/dist/editor/types/ai.d.ts +65 -0
  17. package/dist/editor/types/editor.d.ts +5 -0
  18. package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
  19. package/dist/editor.js +2 -2
  20. package/dist/main.js +3 -3
  21. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
  22. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
  23. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
  24. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
  25. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
  26. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
  27. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
  28. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
  29. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
  30. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
  31. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
  32. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
  33. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
  34. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
  35. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
  36. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
  37. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
  38. package/dist/renderer/types/renderer.d.ts +9 -0
  39. package/dist/renderer/utils/form.d.ts +3 -2
  40. package/dist/renderer/utils/node.d.ts +9 -1
  41. package/dist/renderer.js +2 -2
  42. package/dist/shared/locales/ar.json.d.ts +22 -1
  43. package/dist/shared/locales/de.json.d.ts +22 -1
  44. package/dist/shared/locales/en.json.d.ts +22 -1
  45. package/dist/shared/locales/es.json.d.ts +22 -1
  46. package/dist/shared/locales/fr.json.d.ts +22 -1
  47. package/dist/shared/locales/it.json.d.ts +22 -1
  48. package/dist/shared/locales/pt.json.d.ts +22 -1
  49. package/package.json +2 -2
  50. package/dist/ThemeContext-BIvs8Kw-.js +0 -758
  51. package/dist/TreegeEditor--L4cWrS3.js +0 -2152
  52. package/dist/TreegeRenderer-BVaqgInZ.js +0 -1405
@@ -1,4 +1,4 @@
1
- export declare const defaultNode: {
1
+ export declare const DEFAULT_NODE: {
2
2
  data: {
3
3
  type: string;
4
4
  };
@@ -1,3 +1,3 @@
1
- export declare const edgeTypes: {
1
+ export declare const EDGE_TYPES: {
2
2
  conditional: ({ id, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, markerEnd, style, data, }: import('../features/TreegeEditor/edges/ConditionalEdge').ConditionalEdgeProps) => import("react/jsx-runtime").JSX.Element;
3
3
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Constants for node spacing and positioning in the flow editor
3
+ */
4
+ /**
5
+ * Vertical spacing between nodes (in pixels)
6
+ * Used when creating nodes via handle click or AI generation
7
+ */
8
+ export declare const VERTICAL_NODE_SPACING = 100;
9
+ /**
10
+ * Horizontal offset when placing sibling nodes (in pixels)
11
+ */
12
+ export declare const HORIZONTAL_NODE_OFFSET = 50;
13
+ /**
14
+ * Horizontal spacing for AI-generated flows (in pixels)
15
+ */
16
+ export declare const AI_HORIZONTAL_SPACING = 350;
17
+ /**
18
+ * Position tolerance for detecting nodes at the same Y position (in pixels)
19
+ */
20
+ export declare const POSITION_TOLERANCE = 20;
@@ -1,6 +1,6 @@
1
- export declare const nodeTypes: {
2
- flow: ({ data, isConnectable, type, parentId }: import('../features/TreegeEditor/nodes/FlowNode').FlowNodeProps) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const NODE_TYPES: {
2
+ flow: ({ data, isConnectable, type, parentId, id }: import('../features/TreegeEditor/nodes/FlowNode').FlowNodeProps) => import("react/jsx-runtime").JSX.Element;
3
3
  group: ({ data }: import('../features/TreegeEditor/nodes/GroupNode').GroupNodeProps) => import("react/jsx-runtime").JSX.Element;
4
- input: ({ data, isConnectable, type, parentId }: import('../features/TreegeEditor/nodes/InputNode').InputNodeProps) => import("react/jsx-runtime").JSX.Element;
5
- ui: ({ data, isConnectable, type, parentId }: import('../features/TreegeEditor/nodes/UINode').UINodeProps) => import("react/jsx-runtime").JSX.Element;
4
+ input: ({ data, isConnectable, type, parentId, id }: import('../features/TreegeEditor/nodes/InputNode').InputNodeProps) => import("react/jsx-runtime").JSX.Element;
5
+ ui: ({ data, isConnectable, type, parentId, id }: import('../features/TreegeEditor/nodes/UINode').UINodeProps) => import("react/jsx-runtime").JSX.Element;
6
6
  };
@@ -1,8 +1,23 @@
1
1
  import { PropsWithChildren } from 'react';
2
+ import { AIConfig } from '../types/ai';
2
3
  export interface TreegeEditorContextValue {
4
+ /**
5
+ * Current language
6
+ */
3
7
  language: string;
8
+ /**
9
+ * Current flow ID
10
+ */
4
11
  flowId?: string;
12
+ /**
13
+ * Function to set the current flow ID
14
+ * @param flow
15
+ */
5
16
  setFlowId?: (flow?: string) => void;
17
+ /**
18
+ * AI configuration for tree generation
19
+ */
20
+ aiConfig?: AIConfig;
6
21
  }
7
22
  export interface TreegeEditorProviderProps extends PropsWithChildren {
8
23
  value: TreegeEditorContextValue;
@@ -1,3 +1,3 @@
1
1
  import { TreegeEditorProps } from '../../types/editor';
2
- declare const TreegeEditor: ({ flow, onExportJson, onSave, theme, language }: TreegeEditorProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const TreegeEditor: ({ flow, onExportJson, onSave, theme, language, aiConfig }: TreegeEditorProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default TreegeEditor;
@@ -2,5 +2,5 @@ import { Node, NodeProps } from '@xyflow/react';
2
2
  import { FlowNodeData } from '../../../../shared/types/node';
3
3
  export type FlowNodeType = Node<FlowNodeData, "flow">;
4
4
  export type FlowNodeProps = NodeProps<FlowNodeType>;
5
- declare const FlowNode: ({ data, isConnectable, type, parentId }: FlowNodeProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const FlowNode: ({ data, isConnectable, type, parentId, id }: FlowNodeProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default FlowNode;
@@ -2,5 +2,5 @@ import { Node, NodeProps } from '@xyflow/react';
2
2
  import { InputNodeData } from '../../../../shared/types/node';
3
3
  export type InputNodeType = Node<InputNodeData, "input">;
4
4
  export type InputNodeProps = NodeProps<InputNodeType>;
5
- declare const InputNode: ({ data, isConnectable, type, parentId }: InputNodeProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const InputNode: ({ data, isConnectable, type, parentId, id }: InputNodeProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default InputNode;
@@ -2,5 +2,5 @@ import { Node, NodeProps } from '@xyflow/react';
2
2
  import { UINodeData } from '../../../../shared/types/node';
3
3
  export type UINodeType = Node<UINodeData, "ui">;
4
4
  export type UINodeProps = NodeProps<UINodeType>;
5
- declare const UINode: ({ data, isConnectable, type, parentId }: UINodeProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const UINode: ({ data, isConnectable, type, parentId, id }: UINodeProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default UINode;
@@ -0,0 +1,8 @@
1
+ import { MouseEvent } from 'react';
2
+ /**
3
+ * Custom hook to handle clicks on bottom handles of nodes
4
+ * @param nodeId - The ID of the current node
5
+ * @returns Click handler for the bottom handle
6
+ */
7
+ declare const useBottomHandleClick: (nodeId: string) => (event: MouseEvent) => void;
8
+ export default useBottomHandleClick;
@@ -0,0 +1,16 @@
1
+ import { Edge, Node } from '@xyflow/react';
2
+ import { AIConfig } from '../../../types/ai';
3
+ export interface AIGeneratorDialogProps {
4
+ /**
5
+ * AI configuration from context
6
+ */
7
+ aiConfig?: AIConfig;
8
+ /**
9
+ * Callback when tree is generated
10
+ */
11
+ onGenerate: (data: {
12
+ edges: Edge[];
13
+ nodes: Node[];
14
+ }) => void;
15
+ }
16
+ export declare const AIGeneratorDialog: ({ aiConfig, onGenerate }: AIGeneratorDialogProps) => import("react/jsx-runtime").JSX.Element;
@@ -8,6 +8,7 @@ declare const useFlowConnections: () => {
8
8
  source: string;
9
9
  target: string;
10
10
  }) => boolean;
11
+ onAddFromHandle: (sourceNodeId: string) => void;
11
12
  onConnect: OnConnect;
12
13
  onConnectEnd: OnConnectEnd;
13
14
  onEdgesDelete: OnEdgesDelete;
@@ -0,0 +1,65 @@
1
+ import { Edge, Node } from '@xyflow/react';
2
+ /**
3
+ * AI Provider types for tree generation
4
+ */
5
+ export type AIProvider = "gemini" | "openai" | "deepseek" | "claude";
6
+ /**
7
+ * AI Configuration for tree generation
8
+ */
9
+ export interface AIConfig {
10
+ /**
11
+ * The AI provider to use
12
+ * @default "gemini"
13
+ */
14
+ provider?: AIProvider;
15
+ /**
16
+ * API key for the selected provider
17
+ */
18
+ apiKey: string;
19
+ /**
20
+ * Optional model name override
21
+ * - Gemini: "gemini-2.5-flash" (default), "gemini-2.5-pro-preview-03-25"
22
+ * - OpenAI: "gpt-4o-mini" (default), "gpt-4o", "gpt-3.5-turbo"
23
+ * - DeepSeek: "deepseek-chat" (default)
24
+ * - Claude: "claude-3-5-haiku-20241022" (default), "claude-3-5-sonnet-20241022"
25
+ */
26
+ model?: string;
27
+ /**
28
+ * Temperature for generation (0-1, default: 0.7)
29
+ */
30
+ temperature?: number;
31
+ }
32
+ /**
33
+ * AI Generation request
34
+ */
35
+ export interface AIGenerationRequest {
36
+ /**
37
+ * User prompt describing the desired tree/form
38
+ */
39
+ prompt: string;
40
+ /**
41
+ * AI configuration
42
+ */
43
+ config: AIConfig;
44
+ }
45
+ /**
46
+ * AI Generation response
47
+ */
48
+ export interface AIGenerationResponse {
49
+ /**
50
+ * Generated nodes
51
+ */
52
+ nodes: Node[];
53
+ /**
54
+ * Generated edges
55
+ */
56
+ edges: Edge[];
57
+ /**
58
+ * Optional explanation or metadata
59
+ */
60
+ metadata?: {
61
+ explanation?: string;
62
+ nodesCount?: number;
63
+ edgesCount?: number;
64
+ };
65
+ }
@@ -1,4 +1,5 @@
1
1
  import { Edge, Node } from '@xyflow/react';
2
+ import { AIConfig } from './ai';
2
3
  import { Flow } from '../../shared/types/node';
3
4
  export interface TreegeEditorProps {
4
5
  /**
@@ -26,4 +27,8 @@ export interface TreegeEditorProps {
26
27
  * Language for the editor interface.
27
28
  */
28
29
  language?: string;
30
+ /**
31
+ * AI configuration for tree generation
32
+ */
33
+ aiConfig?: AIConfig;
29
34
  }
@@ -0,0 +1,5 @@
1
+ import { AIGenerationRequest, AIGenerationResponse } from '../types/ai';
2
+ /**
3
+ * Main function to generate flow using AI
4
+ */
5
+ export declare function generateFlowWithAI(request: AIGenerationRequest): Promise<AIGenerationResponse>;
package/dist/editor.js CHANGED
@@ -1,5 +1,5 @@
1
- import { T as o } from "./TreegeEditor--L4cWrS3.js";
2
- import { T as m, u as s } from "./ThemeContext-BIvs8Kw-.js";
1
+ import { T as o } from "./TreegeEditor-Bgl5solk.js";
2
+ import { T as m, u as s } from "./ThemeContext-mnnnxuZU.js";
3
3
  export {
4
4
  m as ThemeProvider,
5
5
  o as TreegeEditor,
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
- import { T as t } from "./TreegeEditor--L4cWrS3.js";
2
- import { T as u, d as l, g as r, b as o, c as i, i as n, a as d, u as f } from "./ThemeContext-BIvs8Kw-.js";
3
- import { c as D, d as I, e as T, f as m, g, h as F, D as c, i as x, j as N, k as S, l as b, m as v, n as R, o as h, p as w, q as C, r as z, s as A, v as H, w as k, T as E, b as G, J as P, K as y, t as U, x as V, y as j, z as q, A as B, C as J, F as K, G as L, I as M, E as O, H as Q, B as W, u as X, a as Y } from "./TreegeRenderer-BVaqgInZ.js";
1
+ import { T as t } from "./TreegeEditor-Bgl5solk.js";
2
+ import { T as u, d as l, g as r, b as o, c as i, i as n, a as d, u as f } from "./ThemeContext-mnnnxuZU.js";
3
+ import { c as D, d as I, e as T, f as m, g, h as F, D as c, i as x, j as N, k as S, l as b, m as v, n as R, o as h, p as w, q as C, r as z, s as A, v as H, w as k, T as E, b as G, J as P, K as y, t as U, x as V, y as j, z as q, A as B, C as J, F as K, G as L, I as M, E as O, H as Q, B as W, u as X, a as Y } from "./TreegeRenderer-DJaR2FqI.js";
4
4
  export {
5
5
  D as DefaultAddressInput,
6
6
  I as DefaultAutocompleteInput,
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultAddressInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"address">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultAddressInput: ({ node, value, setValue, error, label, placeholder, helperText, id, name }: InputRenderProps<"address">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultAddressInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultAutocompleteInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"autocomplete">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultAutocompleteInput: ({ node, value, setValue, error, label, placeholder, helperText, id, }: InputRenderProps<"autocomplete">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultAutocompleteInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultCheckboxInput: ({ node, value, setValue, error, label, helperText }: InputRenderProps<"checkbox">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultCheckboxInput: ({ node, value, setValue, error, label, helperText, id, name }: 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 DefaultDateInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"date">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultDateInput: ({ node, value, setValue, error, label, placeholder, helperText, id, name }: InputRenderProps<"date">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultDateInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultDateRangeInput: ({ node, value, setValue, error, label, helperText }: InputRenderProps<"daterange">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultDateRangeInput: ({ node, value, setValue, error, label, helperText, id }: InputRenderProps<"daterange">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultDateRangeInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultFileInput: ({ node, setValue, error, label, placeholder, helperText }: InputRenderProps<"file">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultFileInput: ({ node, setValue, error, label, placeholder, helperText, name, id }: InputRenderProps<"file">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultFileInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultHiddenInput: ({ node, value }: InputRenderProps<"hidden">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultHiddenInput: ({ value, name, id }: InputRenderProps<"hidden">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultHiddenInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultHttpInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"http">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultHttpInput: ({ node, value, setValue, error, label, placeholder, helperText, id, name }: InputRenderProps<"http">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultHttpInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultNumberInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"number">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultNumberInput: ({ node, value, setValue, error, label, placeholder, helperText, name, id }: InputRenderProps<"number">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultNumberInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultPasswordInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"password">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultPasswordInput: ({ node, value, setValue, error, label, placeholder, helperText, name, id }: InputRenderProps<"password">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultPasswordInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultRadioInput: ({ node, value, setValue, error, label, helperText }: InputRenderProps<"radio">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultRadioInput: ({ node, value, setValue, error, label, helperText, id, name }: InputRenderProps<"radio">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultRadioInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultSelectInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"select">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultSelectInput: ({ node, value, setValue, error, label, placeholder, helperText, name, id }: InputRenderProps<"select">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultSelectInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultSwitchInput: ({ node, value, setValue, error, label, helperText }: InputRenderProps<"switch">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultSwitchInput: ({ node, value, setValue, error, label, helperText, name, id }: InputRenderProps<"switch">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultSwitchInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultTextAreaInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"textarea">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultTextAreaInput: ({ node, value, setValue, error, label, placeholder, helperText, name, id }: InputRenderProps<"textarea">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultTextAreaInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultTextInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"text">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultTextInput: ({ node, value, setValue, error, label, placeholder, helperText, name, id }: InputRenderProps<"text">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultTextInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultTimeInput: ({ node, value, setValue, error, label, placeholder, helperText }: InputRenderProps<"time">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultTimeInput: ({ node, value, setValue, error, label, placeholder, helperText, name, id }: InputRenderProps<"time">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultTimeInput;
@@ -1,3 +1,3 @@
1
1
  import { InputRenderProps } from '../../../../../types/renderer';
2
- declare const DefaultTimeRangeInput: ({ node, value, setValue, error, label, helperText }: InputRenderProps<"timerange">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const DefaultTimeRangeInput: ({ node, value, setValue, error, label, helperText, id, name }: InputRenderProps<"timerange">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DefaultTimeRangeInput;
@@ -45,6 +45,15 @@ export type InputRenderProps<T extends InputType = InputType> = {
45
45
  * Current value of the input field (typed based on input type when T is specified)
46
46
  */
47
47
  value: InputValueTypeMap[T];
48
+ /**
49
+ * Unique field ID (nodeId)
50
+ */
51
+ id: string;
52
+ /**
53
+ * Field name (resolved using priority: name > label > nodeId)
54
+ * Use this for the name and id attributes of the input element
55
+ */
56
+ name: string;
48
57
  /**
49
58
  * Function to update the input value
50
59
  * @param value - The new value (typed based on input type when T is specified)
@@ -20,7 +20,8 @@ export declare const checkFormFieldHasValue: (fieldName: string | undefined, for
20
20
  /**
21
21
  * Convert internal form values (keyed by nodeId) to external format (keyed by name)
22
22
  * When multiple nodes share the same name, later values overwrite earlier ones
23
- * example: convertFormValuesToNamedFormat({ id1: 'Alice', id2: 'Bob' }, [ { id: 'id1', data: { name: 'firstName' } }, { id: 'id2', data: { name: 'lastName' } } ])
24
- * returns { firstName: 'Alice', lastName: 'Bob' }
23
+ * Priority for key naming: name > label (en) > nodeId
24
+ * example: convertFormValuesToNamedFormat({ id1: 'Alice', id2: 'Bob' }, [ { id: 'id1', data: { name: 'firstName' } }, { id: 'id2', data: { label: { en: 'Last Name' } } } ])
25
+ * returns { firstName: 'Alice', 'Last Name': 'Bob' }
25
26
  */
26
27
  export declare const convertFormValuesToNamedFormat: (formValues: FormValues, nodes: Node<InputNodeData>[]) => Record<string, unknown>;
@@ -6,9 +6,17 @@ import { InputNodeData, TreegeNodeData } from '../../shared/types/node';
6
6
  * @returns Array of input nodes only
7
7
  */
8
8
  export declare const getInputNodes: (nodes: Node<TreegeNodeData>[]) => Node<InputNodeData>[];
9
+ /**
10
+ * Resolve the key name for an input node using priority: name > label (en) > nodeId
11
+ * This is the single source of truth for key resolution across the application
12
+ * @param node - The input node
13
+ * @returns The resolved key (name, label, or node ID)
14
+ */
15
+ export declare const resolveNodeKey: (node: Node<InputNodeData>) => string;
9
16
  /**
10
17
  * Get the field name (DOM name attribute) for a given node ID
11
- * Uses node.data.name if available, otherwise falls back to nodeId
18
+ * Priority: name > label (en) > nodeId
19
+ * This must match the logic in convertFormValuesToNamedFormat for consistency
12
20
  * @param nodeId - The ID of the input node
13
21
  * @param nodes - Array of input nodes
14
22
  * @returns The field name to use in the DOM, or undefined if node not found
package/dist/renderer.js CHANGED
@@ -1,5 +1,5 @@
1
- import { c as t, d as s, e as u, f as l, g as r, h as n, D as i, i as o, j as f, k as d, l as p, m as D, n as I, o as T, p as m, q as g, r as F, s as c, v, w as x, T as R, b as S, J as b, K as h, t as C, x as w, y as z, z as A, A as H, C as N, F as k, G as P, I as y, E, H as G, B as V, u as j, a as q } from "./TreegeRenderer-BVaqgInZ.js";
2
- import { T as J, g as K, u as U } from "./ThemeContext-BIvs8Kw-.js";
1
+ import { c as t, d as s, e as u, f as l, g as r, h as n, D as i, i as o, j as f, k as d, l as p, m as D, n as I, o as T, p as m, q as g, r as F, s as c, v, w as x, T as R, b as S, J as b, K as h, t as C, x as w, y as z, z as A, A as H, C as N, F as k, G as P, I as y, E, H as G, B as V, u as j, a as q } from "./TreegeRenderer-DJaR2FqI.js";
2
+ import { T as J, g as K, u as U } from "./ThemeContext-mnnnxuZU.js";
3
3
  export {
4
4
  t as DefaultAddressInput,
5
5
  s as DefaultAutocompleteInput,
@@ -11,7 +11,7 @@ declare const _default: {
11
11
  },
12
12
  "editor": {
13
13
  "actionsPanel": {
14
- "addNode": "إضافة عقدة",
14
+ "addNode": "إضافة عنصر",
15
15
  "clear": "مسح التدفق",
16
16
  "clearSuccess": "تم مسح التدفق!",
17
17
  "clearSuccessDesc": "تم إزالة جميع العقد والحواف.",
@@ -28,6 +28,26 @@ declare const _default: {
28
28
  "parseError": "خطأ في تحليل ملف JSON.",
29
29
  "parseErrorDesc": "حاول إصلاح الملف واستيراده مرة أخرى."
30
30
  },
31
+ "aiGenerator": {
32
+ "aiNotConfigured": "الذكاء الاصطناعي غير مُهيأ",
33
+ "aiNotConfiguredDesc": "أضف خاصية {code} إلى TreegeEditorProvider",
34
+ "buttonLabel": "إنشاء باستخدام الذكاء الاصطناعي",
35
+ "cancel": "إلغاء",
36
+ "description": "الوصف",
37
+ "descriptionPlaceholder": "مثال: إنشاء نموذج اتصال مع الاسم والبريد الإلكتروني ورقم الهاتف والرسالة",
38
+ "enterDescription": "الرجاء إدخال وصف",
39
+ "failedToGenerate": "فشل في إنشاء الشجرة",
40
+ "generate": "إنشاء",
41
+ "generating": "جارٍ الإنشاء...",
42
+ "keyboardShortcut": "اضغط {cmdEnter} أو {ctrlEnter} للإنشاء",
43
+ "missingApiKey": "تكوين الذكاء الاصطناعي مفقود",
44
+ "missingApiKeyDesc": "الرجاء تكوين مفتاح API الخاص بالذكاء الاصطناعي في TreegeEditorProvider",
45
+ "successDescription": "تم إنشاء {nodes} عقدة و {edges} حافة",
46
+ "successTitle": "تم إنشاء الشجرة بنجاح!",
47
+ "title": "إنشاء تدفق باستخدام الذكاء الاصطناعي",
48
+ "titleDescription": "صف النموذج أو شجرة القرار التي تريد إنشاءها، وسيقوم الذكاء الاصطناعي بإنشائها لك.",
49
+ "unknownError": "حدث خطأ غير معروف"
50
+ },
31
51
  "comboboxPattern": {
32
52
  "custom": "مخصص: {value}",
33
53
  "search": "البحث عن أنماط...",
@@ -128,6 +148,7 @@ declare const _default: {
128
148
  "multipleFiles": "ملفات متعددة",
129
149
  "multipleSelection": "اختيار متعدد",
130
150
  "name": "الاسم",
151
+ "nameDescription": "اسم حقل مخصص اختياري لتصدير النموذج. إذا كان فارغاً، سيتم استخدام التسمية كمفتاح.",
131
152
  "noParentFieldsAvailable": "لا توجد حقول أصلية متاحة",
132
153
  "objectMapping": "تعيين الكائن",
133
154
  "objectMappingDesc": "تعيين خصائص الكائن المصدر إلى بنية جديدة",
@@ -11,7 +11,7 @@ declare const _default: {
11
11
  },
12
12
  "editor": {
13
13
  "actionsPanel": {
14
- "addNode": "Knoten hinzufügen",
14
+ "addNode": "Element hinzufügen",
15
15
  "clear": "Löschen",
16
16
  "clearSuccess": "Fluss geleert!",
17
17
  "clearSuccessDesc": "Alle Knoten und Kanten wurden entfernt.",
@@ -28,6 +28,26 @@ declare const _default: {
28
28
  "parseError": "Fehler beim Parsen der JSON-Datei.",
29
29
  "parseErrorDesc": "Versuchen Sie, die Datei zu korrigieren und erneut zu importieren."
30
30
  },
31
+ "aiGenerator": {
32
+ "aiNotConfigured": "KI nicht konfiguriert",
33
+ "aiNotConfiguredDesc": "Fügen Sie {code} Prop zu TreegeEditorProvider hinzu",
34
+ "buttonLabel": "Mit KI generieren",
35
+ "cancel": "Abbrechen",
36
+ "description": "Beschreibung",
37
+ "descriptionPlaceholder": "Beispiel: Erstellen Sie ein Kontaktformular mit Name, E-Mail, Telefonnummer und Nachricht",
38
+ "enterDescription": "Bitte geben Sie eine Beschreibung ein",
39
+ "failedToGenerate": "Fehler beim Generieren des Baums",
40
+ "generate": "Generieren",
41
+ "generating": "Wird generiert...",
42
+ "keyboardShortcut": "Drücken Sie {cmdEnter} oder {ctrlEnter} zum Generieren",
43
+ "missingApiKey": "KI-Konfiguration fehlt",
44
+ "missingApiKeyDesc": "Bitte konfigurieren Sie Ihren KI-API-Schlüssel in TreegeEditorProvider",
45
+ "successDescription": "{nodes} Knoten und {edges} Kanten erstellt",
46
+ "successTitle": "Baum erfolgreich generiert!",
47
+ "title": "Flow mit KI generieren",
48
+ "titleDescription": "Beschreiben Sie das Formular oder den Entscheidungsbaum, den Sie erstellen möchten, und die KI wird ihn für Sie generieren.",
49
+ "unknownError": "Unbekannter Fehler aufgetreten"
50
+ },
31
51
  "comboboxPattern": {
32
52
  "custom": "Benutzerdefiniert: {value}",
33
53
  "search": "Muster suchen...",
@@ -128,6 +148,7 @@ declare const _default: {
128
148
  "multipleFiles": "Mehrere Dateien",
129
149
  "multipleSelection": "Mehrfachauswahl",
130
150
  "name": "Name",
151
+ "nameDescription": "Optionaler benutzerdefinierter Feldname für den Formularexport. Falls leer, wird die Bezeichnung als Schlüssel verwendet.",
131
152
  "noParentFieldsAvailable": "Keine übergeordneten Felder verfügbar",
132
153
  "objectMapping": "Objektzuordnung",
133
154
  "objectMappingDesc": "Eigenschaften des Quellobjekts auf eine neue Struktur abbilden",
@@ -11,7 +11,7 @@ declare const _default: {
11
11
  },
12
12
  "editor": {
13
13
  "actionsPanel": {
14
- "addNode": "Add Node",
14
+ "addNode": "Add Element",
15
15
  "clear": "Clear",
16
16
  "clearSuccess": "Flow cleared!",
17
17
  "clearSuccessDesc": "All nodes and edges have been removed.",
@@ -28,6 +28,26 @@ declare const _default: {
28
28
  "parseError": "Error parsing JSON file.",
29
29
  "parseErrorDesc": "Try to fix the file and import it again."
30
30
  },
31
+ "aiGenerator": {
32
+ "aiNotConfigured": "AI not configured",
33
+ "aiNotConfiguredDesc": "Add {code} prop to TreegeEditorProvider",
34
+ "buttonLabel": "Generate with AI",
35
+ "cancel": "Cancel",
36
+ "description": "Description",
37
+ "descriptionPlaceholder": "Example: Create a contact form with name, email, phone number, and message fields",
38
+ "enterDescription": "Please enter a description",
39
+ "failedToGenerate": "Failed to generate tree",
40
+ "generate": "Generate",
41
+ "generating": "Generating...",
42
+ "keyboardShortcut": "Press {cmdEnter} or {ctrlEnter} to generate",
43
+ "missingApiKey": "AI configuration missing",
44
+ "missingApiKeyDesc": "Please configure your AI API key in TreegeEditorProvider",
45
+ "successDescription": "Created {nodes} nodes and {edges} edges",
46
+ "successTitle": "Tree generated successfully!",
47
+ "title": "Generate Flow with AI",
48
+ "titleDescription": "Describe the form or decision tree you want to create, and AI will generate it for you.",
49
+ "unknownError": "Unknown error occurred"
50
+ },
31
51
  "comboboxPattern": {
32
52
  "custom": "Custom: {value}",
33
53
  "search": "Search patterns...",
@@ -128,6 +148,7 @@ declare const _default: {
128
148
  "multipleFiles": "Multiple files",
129
149
  "multipleSelection": "Multiple selection",
130
150
  "name": "Name",
151
+ "nameDescription": "Optional custom field name for form export. If empty, the label will be used as the key.",
131
152
  "noParentFieldsAvailable": "No parent fields available",
132
153
  "objectMapping": "Object Mapping",
133
154
  "objectMappingDesc": "Map properties from the source object to a new structure",
@@ -11,7 +11,7 @@ declare const _default: {
11
11
  },
12
12
  "editor": {
13
13
  "actionsPanel": {
14
- "addNode": "Agregar nodo",
14
+ "addNode": "Agregar elemento",
15
15
  "clear": "Limpiar",
16
16
  "clearSuccess": "¡Flujo limpiado!",
17
17
  "clearSuccessDesc": "Todos los nodos y aristas han sido eliminados.",
@@ -28,6 +28,26 @@ declare const _default: {
28
28
  "parseError": "Error al analizar el archivo JSON.",
29
29
  "parseErrorDesc": "Intenta corregir el archivo e importarlo nuevamente."
30
30
  },
31
+ "aiGenerator": {
32
+ "aiNotConfigured": "IA no configurada",
33
+ "aiNotConfiguredDesc": "Agregue la prop {code} a TreegeEditorProvider",
34
+ "buttonLabel": "Generar con IA",
35
+ "cancel": "Cancelar",
36
+ "description": "Descripción",
37
+ "descriptionPlaceholder": "Ejemplo: Crear un formulario de contacto con nombre, correo electrónico, teléfono y mensaje",
38
+ "enterDescription": "Por favor ingrese una descripción",
39
+ "failedToGenerate": "Error al generar el árbol",
40
+ "generate": "Generar",
41
+ "generating": "Generando...",
42
+ "keyboardShortcut": "Presione {cmdEnter} o {ctrlEnter} para generar",
43
+ "missingApiKey": "Falta configuración de IA",
44
+ "missingApiKeyDesc": "Por favor configure su clave API de IA en TreegeEditorProvider",
45
+ "successDescription": "{nodes} nodos y {edges} aristas creados",
46
+ "successTitle": "¡Árbol generado exitosamente!",
47
+ "title": "Generar flujo con IA",
48
+ "titleDescription": "Describa el formulario o árbol de decisión que desea crear, y la IA lo generará por usted.",
49
+ "unknownError": "Error desconocido"
50
+ },
31
51
  "comboboxPattern": {
32
52
  "custom": "Personalizado: {value}",
33
53
  "search": "Buscar patrones...",
@@ -128,6 +148,7 @@ declare const _default: {
128
148
  "multipleFiles": "Archivos múltiples",
129
149
  "multipleSelection": "Selección múltiple",
130
150
  "name": "Nombre",
151
+ "nameDescription": "Nombre de campo personalizado opcional para la exportación del formulario. Si está vacío, la etiqueta se usará como clave.",
131
152
  "noParentFieldsAvailable": "No hay campos principales disponibles",
132
153
  "objectMapping": "Mapeo de objetos",
133
154
  "objectMappingDesc": "Mapear las propiedades del objeto de origen a una nueva estructura",