treege 3.0.0-beta.9 → 3.0.0-beta40
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.
- package/LICENSE +18 -12
- package/README.md +213 -30
- package/dist/DefaultInputs-8yJMEyMh.js +1557 -0
- package/dist/ThemeContext-Ejgu9Mwr.js +1603 -0
- package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
- package/dist/editor/constants/defaultNode.d.ts +1 -1
- package/dist/editor/constants/edgeTypes.d.ts +3 -2
- package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
- package/dist/editor/constants/nodeSpacing.d.ts +33 -0
- package/dist/editor/constants/nodeTypes.d.ts +5 -5
- package/dist/editor/context/TreegeEditorContext.d.ts +53 -1
- package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
- package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
- package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +9 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/OptionsEditor.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/RequiredBadge.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +2 -1
- package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
- package/dist/editor/hooks/useAutoLayout.d.ts +15 -0
- package/dist/editor/hooks/useFlowActions.d.ts +5 -2
- package/dist/editor/hooks/useFlowConnections.d.ts +4 -0
- package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
- package/dist/editor/types/ai.d.ts +65 -0
- package/dist/editor/types/editor.d.ts +9 -8
- package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
- package/dist/editor/utils/dagreLayout.d.ts +17 -0
- package/dist/editor/utils/edge.d.ts +14 -0
- package/dist/editor/utils/image.d.ts +7 -0
- package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
- package/dist/editor-DWJ95r4g.js +4001 -0
- package/dist/editor.js +3 -7
- package/dist/main.js +4 -52
- package/dist/renderer/context/TreegeRendererContext.d.ts +4 -1
- package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +21 -15
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +84 -24
- package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
- package/dist/renderer/hooks/useRenderNode.d.ts +55 -0
- package/dist/renderer/hooks/useSubmitHandler.d.ts +34 -0
- package/dist/renderer/hooks/useTranslate.d.ts +6 -4
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer/index.native.d.ts +19 -0
- package/dist/renderer/types/renderer.d.ts +45 -6
- package/dist/renderer/utils/form.d.ts +22 -2
- package/dist/renderer/utils/http.d.ts +101 -0
- package/dist/renderer/utils/node.d.ts +18 -1
- package/dist/renderer/utils/sanitize.d.ts +85 -0
- package/dist/renderer/utils/sanitize.native.d.ts +69 -0
- package/dist/renderer/utils/submit.d.ts +47 -0
- package/dist/renderer-native.d.ts +2 -0
- package/dist/renderer-native.js +3496 -0
- package/dist/renderer.js +3 -45
- package/dist/shared/components/ui/badge.d.ts +2 -2
- package/dist/shared/components/ui/button.d.ts +2 -2
- package/dist/shared/components/ui/collapsible.d.ts +1 -1
- package/dist/shared/components/ui/command.d.ts +1 -1
- package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/shared/components/ui/form.d.ts +1 -1
- package/dist/shared/components/ui/popover.d.ts +4 -2
- package/dist/shared/components/ui/select.d.ts +3 -1
- package/dist/shared/components/ui/sheet.d.ts +1 -1
- package/dist/shared/components/ui/tooltip.d.ts +1 -1
- package/dist/shared/constants/colors.d.ts +45 -0
- package/dist/shared/constants/inputType.d.ts +1 -0
- package/dist/shared/context/ThemeContext.d.ts +2 -0
- package/dist/shared/context/ThemeContext.native.d.ts +22 -0
- package/dist/shared/hooks/useThemeColors.d.ts +37 -0
- package/dist/shared/locales/ar.json.d.ts +117 -10
- package/dist/shared/locales/de.json.d.ts +118 -11
- package/dist/shared/locales/en.json.d.ts +119 -12
- package/dist/shared/locales/es.json.d.ts +118 -11
- package/dist/shared/locales/fr.json.d.ts +118 -11
- package/dist/shared/locales/it.json.d.ts +118 -11
- package/dist/shared/locales/pt.json.d.ts +118 -11
- package/dist/shared/types/edge.d.ts +6 -0
- package/dist/shared/types/node.d.ts +64 -0
- package/package.json +38 -12
- package/dist/ThemeContext-BIvs8Kw-.js +0 -758
- package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
- package/dist/TreegeRenderer-BVaqgInZ.js +0 -1405
- package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
- package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
|
@@ -5,7 +5,8 @@ export type ComboboxOption = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Reusable Combobox component with search, create, and clear functionality
|
|
7
7
|
*/
|
|
8
|
-
declare const ComboboxWithCreate: ({ options, value, onValueChange, placeholder, searchPlaceholder, createLabel, clearLabel, emptyLabel, className, allowClear, allowCreate, }: {
|
|
8
|
+
declare const ComboboxWithCreate: ({ options, id, value, onValueChange, placeholder, searchPlaceholder, createLabel, clearLabel, emptyLabel, className, allowClear, allowCreate, }: {
|
|
9
|
+
id?: string;
|
|
9
10
|
options: ComboboxOption[];
|
|
10
11
|
value?: string | null;
|
|
11
12
|
onValueChange?: (newValue: string) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
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
|
|
1
|
+
export declare const EDGE_TYPES: {
|
|
2
|
+
conditional: import('react').MemoExoticComponent<({ id, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, markerEnd, style, data, }: import('../features/TreegeEditor/edges/ConditionalEdge').ConditionalEdgeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
default: import('react').MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, selected }: import('@xyflow/react').EdgeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
4
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
export declare const INPUT_TYPE_ICONS: Record<string, LucideIcon>;
|
|
3
|
+
export declare const DEFAULT_INPUT_TYPE_ICON: import('react').ForwardRefExoticComponent<Omit<import('lucide-react').LucideProps, "ref"> & import('react').RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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;
|
|
21
|
+
/**
|
|
22
|
+
* Default direction for the auto-layout algorithm.
|
|
23
|
+
* "TB" = top to bottom, "LR" = left to right.
|
|
24
|
+
*/
|
|
25
|
+
export declare const LAYOUT_DIRECTION = "TB";
|
|
26
|
+
/**
|
|
27
|
+
* Vertical gap between ranks (parent → child) used by the auto-layout (in pixels).
|
|
28
|
+
*/
|
|
29
|
+
export declare const LAYOUT_VERTICAL_SPACING = 80;
|
|
30
|
+
/**
|
|
31
|
+
* Horizontal gap between siblings used by the auto-layout (in pixels).
|
|
32
|
+
*/
|
|
33
|
+
export declare const LAYOUT_HORIZONTAL_SPACING = 60;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
flow: (
|
|
3
|
-
group: ({ data }: import('../features/TreegeEditor/nodes/GroupNode').GroupNodeProps) => import("react/jsx-runtime").JSX.Element
|
|
4
|
-
input: (
|
|
5
|
-
ui: (
|
|
1
|
+
export declare const NODE_TYPES: {
|
|
2
|
+
flow: import('react').MemoExoticComponent<(props: import('../features/TreegeEditor/nodes/TreegeNode').TreegeNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
group: import('react').MemoExoticComponent<({ data, id }: import('../features/TreegeEditor/nodes/GroupNode').GroupNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
|
+
input: import('react').MemoExoticComponent<(props: import('../features/TreegeEditor/nodes/TreegeNode').TreegeNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
5
|
+
ui: import('react').MemoExoticComponent<(props: import('../features/TreegeEditor/nodes/TreegeNode').TreegeNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
6
6
|
};
|
|
@@ -1,11 +1,63 @@
|
|
|
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;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the node actions sheet is open
|
|
23
|
+
*/
|
|
24
|
+
isNodeSheetOpen: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Function to open or close the node actions sheet
|
|
27
|
+
*/
|
|
28
|
+
setIsNodeSheetOpen: (open: boolean) => void;
|
|
29
|
+
/**
|
|
30
|
+
* ID of the node pending deletion confirmation, or null if no deletion is pending
|
|
31
|
+
*/
|
|
32
|
+
pendingDeleteNodeId: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Open the deletion confirmation dialog for a given node
|
|
35
|
+
*/
|
|
36
|
+
openDeleteNodeConfirmation: (id: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Close the deletion confirmation dialog (cancels any pending deletion)
|
|
39
|
+
*/
|
|
40
|
+
closeDeleteNodeConfirmation: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Pending node type change that requires user confirmation (when the target type only supports a single outgoing edge).
|
|
43
|
+
*/
|
|
44
|
+
pendingNodeTypeChange: PendingNodeTypeChange | null;
|
|
45
|
+
/**
|
|
46
|
+
* Open the node type change confirmation dialog.
|
|
47
|
+
*/
|
|
48
|
+
openNodeTypeChangeConfirmation: (payload: PendingNodeTypeChange) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Close the node type change confirmation dialog (cancels the pending change).
|
|
51
|
+
*/
|
|
52
|
+
closeNodeTypeChangeConfirmation: () => void;
|
|
53
|
+
}
|
|
54
|
+
export interface PendingNodeTypeChange {
|
|
55
|
+
nodeId: string;
|
|
56
|
+
type: string;
|
|
57
|
+
subType?: string;
|
|
6
58
|
}
|
|
7
59
|
export interface TreegeEditorProviderProps extends PropsWithChildren {
|
|
8
|
-
value: TreegeEditorContextValue
|
|
60
|
+
value: Omit<TreegeEditorContextValue, "isNodeSheetOpen" | "setIsNodeSheetOpen" | "pendingDeleteNodeId" | "openDeleteNodeConfirmation" | "closeDeleteNodeConfirmation" | "pendingNodeTypeChange" | "openNodeTypeChangeConfirmation" | "closeNodeTypeChangeConfirmation">;
|
|
9
61
|
}
|
|
10
62
|
export declare const TreegeEditorContext: import('react').Context<TreegeEditorContextValue | null>;
|
|
11
63
|
export declare const TreegeEditorProvider: ({ children, value }: TreegeEditorProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TreegeEditorProps } from '../../types/editor';
|
|
2
|
-
declare const TreegeEditor: ({
|
|
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 { Edge, EdgeProps } from '@xyflow/react';
|
|
|
2
2
|
import { ConditionalEdgeData } from '../../../../shared/types/edge';
|
|
3
3
|
export type ConditionalEdgeType = Edge<ConditionalEdgeData, "conditional">;
|
|
4
4
|
export type ConditionalEdgeProps = EdgeProps<ConditionalEdgeType>;
|
|
5
|
-
declare const
|
|
6
|
-
export default
|
|
5
|
+
declare const _default: import('react').MemoExoticComponent<({ id, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, markerEnd, style, data, }: ConditionalEdgeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EdgeProps } from '@xyflow/react';
|
|
2
|
+
declare const _default: import('react').MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, selected }: EdgeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SubmitConfig } from '../../../../shared/types/node';
|
|
2
|
+
interface SubmitConfigFormProps {
|
|
3
|
+
value: SubmitConfig | undefined;
|
|
4
|
+
onChange: (config: SubmitConfig | undefined) => void;
|
|
5
|
+
}
|
|
6
|
+
declare const SubmitConfigForm: ({ value, onChange }: SubmitConfigFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SubmitConfigForm;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface ComboboxPatternProps {
|
|
2
2
|
value?: string | null;
|
|
3
3
|
onValueChange?: (newValue: string) => void;
|
|
4
|
+
id?: string;
|
|
4
5
|
}
|
|
5
|
-
declare const ComboboxPattern: ({ value, onValueChange }: ComboboxPatternProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const ComboboxPattern: ({ id, value, onValueChange }: ComboboxPatternProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export default ComboboxPattern;
|
|
@@ -2,5 +2,5 @@ import { Node, NodeProps } from '@xyflow/react';
|
|
|
2
2
|
import { GroupNodeData } from '../../../../shared/types/node';
|
|
3
3
|
export type GroupNodeType = Node<GroupNodeData, "group">;
|
|
4
4
|
export type GroupNodeProps = NodeProps<GroupNodeType>;
|
|
5
|
-
declare const
|
|
6
|
-
export default
|
|
5
|
+
declare const _default: import('react').MemoExoticComponent<({ data, id }: GroupNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Node, NodeProps } from '@xyflow/react';
|
|
2
|
+
import { FlowNodeData, InputNodeData, UINodeData } from '../../../../shared/types/node';
|
|
3
|
+
export type TreegeNodeType = Node<FlowNodeData, "flow"> | Node<InputNodeData, "input"> | Node<UINodeData, "ui">;
|
|
4
|
+
export type TreegeNodeProps = NodeProps<Node<FlowNodeData, "flow">> | NodeProps<Node<InputNodeData, "input">> | NodeProps<Node<UINodeData, "ui">>;
|
|
5
|
+
declare const _default: import('react').MemoExoticComponent<(props: TreegeNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InputNodeData } from '../../../../../shared/types/node';
|
|
2
|
+
interface NodeInputPreviewProps {
|
|
3
|
+
nodeId: string;
|
|
4
|
+
data: InputNodeData;
|
|
5
|
+
}
|
|
6
|
+
declare const NodeInputPreview: ({ nodeId, data }: NodeInputPreviewProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export default NodeInputPreview;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Translatable } from '../../../../../shared/types/translate';
|
|
2
|
+
interface NodeLabelInputProps {
|
|
3
|
+
nodeId: string;
|
|
4
|
+
label?: Translatable;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const NodeLabelInput: ({ nodeId, label, placeholder, className }: NodeLabelInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default NodeLabelInput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FlowNodeData, InputNodeData, UINodeData } from '../../../../../shared/types/node';
|
|
2
|
+
interface OptionsEditorProps {
|
|
3
|
+
nodeId: string;
|
|
4
|
+
data?: FlowNodeData | InputNodeData | UINodeData;
|
|
5
|
+
}
|
|
6
|
+
declare const OptionsEditor: ({ nodeId, data }: OptionsEditorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export default OptionsEditor;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
interface NodeWrapperProps extends PropsWithChildren {
|
|
3
3
|
inGroup: boolean;
|
|
4
|
+
isSubmit?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const NodeWrapper: ({ children, inGroup }: NodeWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const NodeWrapper: ({ children, inGroup, isSubmit }: NodeWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export default NodeWrapper;
|
|
@@ -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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LayoutOptions } from '../utils/dagreLayout';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps the flow laid out automatically using Dagre.
|
|
4
|
+
*
|
|
5
|
+
* Runs once all nodes have been measured, then re-runs whenever any node's
|
|
6
|
+
* measured size changes. Positions computed by Dagre replace the current
|
|
7
|
+
* `position` of each node — manual repositioning is therefore overridden,
|
|
8
|
+
* which is the expected behavior for a decision-tree editor where topology
|
|
9
|
+
* drives layout.
|
|
10
|
+
*
|
|
11
|
+
* Group children are laid out independently within their parent, preserving
|
|
12
|
+
* React Flow's parent-relative coordinate system.
|
|
13
|
+
*/
|
|
14
|
+
declare const useAutoLayout: ({ direction, horizontalSpacing, verticalSpacing }?: LayoutOptions) => void;
|
|
15
|
+
export default useAutoLayout;
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare const useFlowActions: () => {
|
|
6
6
|
clearSelection: () => void;
|
|
7
|
+
deleteNode: (id: string) => void;
|
|
8
|
+
deleteSelectedNode: () => void;
|
|
9
|
+
selectNode: (id: string) => void;
|
|
7
10
|
updateNodeData: <T extends Record<string, unknown>>(id: string, data: Partial<T>) => void;
|
|
8
|
-
updateNodeType: (id: string, type: string) => void;
|
|
11
|
+
updateNodeType: (id: string, type: string, subType?: string) => void;
|
|
9
12
|
updateSelectedNodeData: <T extends Record<string, unknown>>(data: Partial<T>) => void;
|
|
10
|
-
updateSelectedNodeType: (type: string) => void;
|
|
13
|
+
updateSelectedNodeType: (type: string, subType?: string) => void;
|
|
11
14
|
};
|
|
12
15
|
export default useFlowActions;
|
|
@@ -8,6 +8,10 @@ declare const useFlowConnections: () => {
|
|
|
8
8
|
source: string;
|
|
9
9
|
target: string;
|
|
10
10
|
}) => boolean;
|
|
11
|
+
onAddFromHandle: (sourceNodeId: string, nodeInit?: {
|
|
12
|
+
type: string;
|
|
13
|
+
data?: Record<string, unknown>;
|
|
14
|
+
}) => void;
|
|
11
15
|
onConnect: OnConnect;
|
|
12
16
|
onConnectEnd: OnConnectEnd;
|
|
13
17
|
onEdgesDelete: OnEdgesDelete;
|
|
@@ -10,10 +10,10 @@ declare const useNodesSelection: <TNodeData extends TreegeNodeData = TreegeNodeD
|
|
|
10
10
|
nodes: TreegeNode[];
|
|
11
11
|
selectedNode: ({
|
|
12
12
|
id: string;
|
|
13
|
-
position: import('@xyflow/
|
|
13
|
+
position: import('@xyflow/system').XYPosition;
|
|
14
14
|
data: TreegeNodeData;
|
|
15
|
-
sourcePosition?: import('@xyflow/
|
|
16
|
-
targetPosition?: import('@xyflow/
|
|
15
|
+
sourcePosition?: import('@xyflow/system').Position;
|
|
16
|
+
targetPosition?: import('@xyflow/system').Position;
|
|
17
17
|
hidden?: boolean;
|
|
18
18
|
selected?: boolean;
|
|
19
19
|
dragging?: boolean;
|
|
@@ -28,10 +28,10 @@ declare const useNodesSelection: <TNodeData extends TreegeNodeData = TreegeNodeD
|
|
|
28
28
|
initialHeight?: number;
|
|
29
29
|
parentId?: string;
|
|
30
30
|
zIndex?: number;
|
|
31
|
-
extent?: "parent" | import('@xyflow/
|
|
31
|
+
extent?: "parent" | import('@xyflow/system').CoordinateExtent | null;
|
|
32
32
|
expandParent?: boolean;
|
|
33
33
|
ariaLabel?: string;
|
|
34
|
-
origin?: import('@xyflow/
|
|
34
|
+
origin?: import('@xyflow/system').NodeOrigin;
|
|
35
35
|
handles?: import('@xyflow/system').NodeHandle[];
|
|
36
36
|
measured?: {
|
|
37
37
|
width?: number;
|
|
@@ -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
|
/**
|
|
@@ -6,14 +7,6 @@ export interface TreegeEditorProps {
|
|
|
6
7
|
* Note: Individual defaultNodes/defaultEdges props take precedence over this.
|
|
7
8
|
*/
|
|
8
9
|
flow?: Flow | null;
|
|
9
|
-
/**
|
|
10
|
-
* Default nodes to initialize the nodes in the flow.
|
|
11
|
-
*/
|
|
12
|
-
nodes?: Node[];
|
|
13
|
-
/**
|
|
14
|
-
* Default edges to initialize the edges in the flow.
|
|
15
|
-
*/
|
|
16
|
-
edges?: Edge[];
|
|
17
10
|
/**
|
|
18
11
|
* Callback function triggered when exporting JSON data.
|
|
19
12
|
*/
|
|
@@ -34,4 +27,12 @@ export interface TreegeEditorProps {
|
|
|
34
27
|
* Language for the editor interface.
|
|
35
28
|
*/
|
|
36
29
|
language?: string;
|
|
30
|
+
/**
|
|
31
|
+
* AI configuration for tree generation
|
|
32
|
+
*/
|
|
33
|
+
aiConfig?: AIConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Additional CSS class names for custom styling.
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
37
38
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Edge, Node } from '@xyflow/react';
|
|
2
|
+
export type LayoutDirection = "TB" | "LR";
|
|
3
|
+
export interface LayoutOptions {
|
|
4
|
+
direction?: LayoutDirection;
|
|
5
|
+
horizontalSpacing?: number;
|
|
6
|
+
verticalSpacing?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Runs Dagre to compute positions for the given nodes and returns a new
|
|
10
|
+
* `nodes` array with updated `position` fields. Nodes not yet measured by
|
|
11
|
+
* React Flow keep their current position.
|
|
12
|
+
*
|
|
13
|
+
* Respects group hierarchy: top-level nodes are laid out together, and
|
|
14
|
+
* each group's children are laid out independently using parent-relative
|
|
15
|
+
* coordinates.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getLayoutedElements: (nodes: Node[], edges: Edge[], options?: LayoutOptions) => Node[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Edge } from '@xyflow/react';
|
|
2
|
+
/**
|
|
3
|
+
* Re-normalize outgoing edges from a set of affected parent nodes: if a parent
|
|
4
|
+
* now has a single remaining child, convert its outgoing edge back to a
|
|
5
|
+
* "default" type and drop condition-specific data fields.
|
|
6
|
+
*
|
|
7
|
+
* Used after edge or node deletions to keep conditional edges in sync with the
|
|
8
|
+
* presence of siblings.
|
|
9
|
+
*
|
|
10
|
+
* @param edges - The edges remaining after deletion
|
|
11
|
+
* @param affectedParents - Source node IDs whose children changed
|
|
12
|
+
* @returns A new edges array with affected edges normalized
|
|
13
|
+
*/
|
|
14
|
+
export declare const normalizeConditionalEdges: (edges: Edge[], affectedParents: Set<string>) => Edge[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const MAX_IMAGE_INPUT_BYTES: number;
|
|
2
|
+
/**
|
|
3
|
+
* Converts an image file to a resized JPEG base64 data URL.
|
|
4
|
+
* Rejects files that are not images or exceed MAX_IMAGE_INPUT_BYTES.
|
|
5
|
+
* Dimensions are capped at MAX_DIMENSION × MAX_DIMENSION to keep the JSON small.
|
|
6
|
+
*/
|
|
7
|
+
export declare const imageFileToOptimizedDataUrl: (file: File) => Promise<string>;
|