treege 3.0.0-beta.55 → 3.0.0-beta.57

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 (78) hide show
  1. package/README.md +33 -10
  2. package/dist/DefaultInputs-CoJrOYMe.js +1859 -0
  3. package/dist/ThemeContext-BhIeqgqN.js +1398 -0
  4. package/dist/editor/constants/edgeTypes.d.ts +1 -1
  5. package/dist/editor/context/TreegeEditorContext.d.ts +8 -1
  6. package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
  7. package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +1 -1
  8. package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +34 -0
  9. package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +13 -0
  10. package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +18 -2
  11. package/dist/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.d.ts +12 -0
  12. package/dist/editor/types/editor.d.ts +19 -1
  13. package/dist/editor/utils/cleanNodeConfig.d.ts +5 -0
  14. package/dist/editor/utils/edge.d.ts +37 -1
  15. package/dist/editor/utils/sensitiveHeaders.d.ts +15 -0
  16. package/dist/editor-D3cbfAxI.js +6232 -0
  17. package/dist/editor.js +2 -2
  18. package/dist/main.js +4 -4
  19. package/dist/renderer/features/TreegeRenderer/InputRendererHost.d.ts +15 -0
  20. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +2 -2
  21. package/dist/renderer/features/TreegeRenderer/native/components/DependencyHint.d.ts +15 -0
  22. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +2 -2
  23. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +2 -2
  24. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +2 -2
  25. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +2 -2
  26. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +2 -2
  27. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +2 -2
  28. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +2 -2
  29. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +2 -2
  30. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +2 -2
  31. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +2 -2
  32. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +2 -2
  33. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +2 -2
  34. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +2 -2
  35. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +2 -2
  36. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +2 -2
  37. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +2 -2
  38. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +2 -2
  39. package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +18 -18
  40. package/dist/renderer/features/TreegeRenderer/web/components/DependencyHint.d.ts +22 -0
  41. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +2 -2
  42. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +2 -2
  43. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +2 -2
  44. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +2 -2
  45. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +2 -2
  46. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +2 -2
  47. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +2 -2
  48. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +2 -2
  49. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +2 -2
  50. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +2 -2
  51. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +2 -2
  52. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +2 -2
  53. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +2 -2
  54. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +2 -2
  55. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +2 -2
  56. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +2 -2
  57. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +2 -2
  58. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +2 -2
  59. package/dist/renderer/hooks/useRenderNode.d.ts +2 -1
  60. package/dist/renderer/types/renderer.d.ts +62 -23
  61. package/dist/renderer/utils/http.d.ts +13 -1
  62. package/dist/renderer/utils/node.d.ts +11 -0
  63. package/dist/renderer/utils/templateDependencies.d.ts +17 -0
  64. package/dist/renderer-native.js +1251 -1216
  65. package/dist/renderer.js +3 -3
  66. package/dist/shared/constants/inputType.d.ts +5 -0
  67. package/dist/shared/locales/ar.json.d.ts +20 -1
  68. package/dist/shared/locales/de.json.d.ts +20 -1
  69. package/dist/shared/locales/en.json.d.ts +20 -1
  70. package/dist/shared/locales/es.json.d.ts +20 -1
  71. package/dist/shared/locales/fr.json.d.ts +20 -1
  72. package/dist/shared/locales/it.json.d.ts +20 -1
  73. package/dist/shared/locales/pt.json.d.ts +20 -1
  74. package/dist/shared/types/node.d.ts +20 -0
  75. package/package.json +1 -1
  76. package/dist/DefaultInputs-BbfholiM.js +0 -1799
  77. package/dist/ThemeContext-C9418UR6.js +0 -1354
  78. package/dist/editor-DgUCBTZ0.js +0 -5831
@@ -1,4 +1,4 @@
1
1
  export declare const EDGE_TYPES: {
2
2
  conditional: import('react').MemoExoticComponent<({ id, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, markerEnd, style, data, }: import('../features/TreegeEditor/edges/ConditionalEdge').ConditionalEdgeProps) => import("react/jsx-runtime").JSX.Element | null>;
3
- default: import('react').MemoExoticComponent<({ id, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, selected, }: import('@xyflow/react').EdgeProps) => import("react/jsx-runtime").JSX.Element>;
3
+ default: import('react').MemoExoticComponent<({ id, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, selected, }: import('@xyflow/react').EdgeProps) => import("react/jsx-runtime").JSX.Element | null>;
4
4
  };
@@ -3,9 +3,16 @@ import { AIConfig } from '../types/ai';
3
3
  import { HttpHeader } from '../../shared/types/node';
4
4
  export interface TreegeEditorContextValue {
5
5
  /**
6
- * Current language
6
+ * Current language of the editor UI. Also used as the default language for
7
+ * the per-node translation editor in `InputNodeForm`.
7
8
  */
8
9
  language: string;
10
+ /**
11
+ * Set the editor UI language at runtime (driven by the language switcher in
12
+ * the actions panel). Seeded from the `language` prop, then owned internally;
13
+ * the consumer can observe changes via `TreegeEditor`'s `onLanguageChange`.
14
+ */
15
+ setLanguage: (language: string) => void;
9
16
  /**
10
17
  * Current flow ID
11
18
  */
@@ -1,3 +1,3 @@
1
1
  import { TreegeEditorProps } from '../../types/editor';
2
- declare const TreegeEditor: ({ flow, onExportJson, onSave, theme, language, aiConfig, extraMenuItems, openApi, openApiBaseUrl, onAuthorize, headers, onHeadersChange, }: TreegeEditorProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const TreegeEditor: ({ flow, onExportJson, onSave, theme, language: controlledLanguage, defaultLanguage, onLanguageChange, aiConfig, extraMenuItems, openApi, openApiBaseUrl, onAuthorize, headers, onHeadersChange, }: TreegeEditorProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default TreegeEditor;
@@ -1,3 +1,3 @@
1
1
  import { EdgeProps } from '@xyflow/react';
2
- declare const _default: import('react').MemoExoticComponent<({ id, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, selected, }: EdgeProps) => import("react/jsx-runtime").JSX.Element>;
2
+ declare const _default: import('react').MemoExoticComponent<({ id, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, selected, }: EdgeProps) => import("react/jsx-runtime").JSX.Element | null>;
3
3
  export default _default;
@@ -0,0 +1,34 @@
1
+ import { HttpHeader, OptionsSourceMapping, QueryParam } from '../../../../shared/types/node';
2
+ type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
3
+ export interface OptionsMappingRequest {
4
+ url?: string;
5
+ method?: HttpMethod;
6
+ headers?: HttpHeader[];
7
+ queryParams?: QueryParam[];
8
+ body?: string;
9
+ responsePath?: string;
10
+ }
11
+ interface OptionsMappingFieldsProps {
12
+ /** Request config used by the "Detect fields" button to call the API. */
13
+ request: OptionsMappingRequest;
14
+ /** Current field-to-property mapping. */
15
+ mapping: Partial<OptionsSourceMapping>;
16
+ /** Called with a partial patch whenever a mapping field changes. */
17
+ onMappingChange: (patch: Partial<OptionsSourceMapping>) => void;
18
+ /** When true, also exposes the optional description/image mappings. */
19
+ showOptionalFields?: boolean;
20
+ }
21
+ /**
22
+ * Walks the first array item to enumerate field paths usable as mapping keys.
23
+ * Includes top-level keys and one level of nested object dot-paths.
24
+ */
25
+ export declare const detectFieldPaths: (response: unknown, responsePath: string) => string[];
26
+ /**
27
+ * Shared "map response to options" UI: a "Detect fields" button that probes
28
+ * the configured endpoint to enumerate response field paths, plus the
29
+ * value/label (and optionally description/image) mapping inputs. Once fields
30
+ * are detected the inputs become dropdowns of the detected paths. Used by both
31
+ * the HTTP input config and the dynamic options source so they stay identical.
32
+ */
33
+ declare const OptionsMappingFields: ({ request, mapping, onMappingChange, showOptionalFields }: OptionsMappingFieldsProps) => import("react/jsx-runtime").JSX.Element;
34
+ export default OptionsMappingFields;
@@ -0,0 +1,13 @@
1
+ import { HttpHeader } from '../../../../shared/types/node';
2
+ interface SensitiveHeaderWarningProps {
3
+ headers?: HttpHeader[];
4
+ }
5
+ /**
6
+ * Inline alert shown when a field-level header carries credentials (e.g. an
7
+ * `Authorization` bearer or API key). These headers are persisted in the
8
+ * exported/saved tree, so the user is nudged toward the non-persisted global
9
+ * headers (Authorize) for authentication. Renders nothing when no sensitive
10
+ * header is present.
11
+ */
12
+ declare const SensitiveHeaderWarning: ({ headers }: SensitiveHeaderWarningProps) => import("react/jsx-runtime").JSX.Element | null;
13
+ export default SensitiveHeaderWarning;
@@ -1,9 +1,25 @@
1
1
  interface BottomHandleDropdownProps {
2
2
  nodeId: string;
3
3
  isConnectable?: boolean;
4
+ /** Submit nodes / multi-selection: the handle stays in the DOM so edges keep an anchor, but it is invisible and non-interactive. */
4
5
  hidden?: boolean;
5
- /** Whether branching (forking into two nodes) is allowed — only for input nodes. */
6
+ /** Whether branching (a second outgoing path) is allowed — only for input nodes. */
6
7
  canBranch?: boolean;
8
+ /**
9
+ * True when the node sits before a linear successor (stack first/middle). The
10
+ * controls then reveal on hover (the bottom border overlaps the next node) and
11
+ * offer "insert between". On a tail (last/single) the controls stay visible.
12
+ */
13
+ isJunction?: boolean;
7
14
  }
8
- declare const BottomHandleDropdown: ({ nodeId, isConnectable, hidden, canBranch }: BottomHandleDropdownProps) => import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ * Bottom-of-node controls anchored on the node's bottom border.
17
+ *
18
+ * The branch/add affordance is a real React Flow source `Handle`, so dragging it
19
+ * goes through the native connection system (cursor line, target snapping, leaf
20
+ * convergence, `isValidConnection`) — both for adding a child on a tail node and
21
+ * for branching a new path on a junction node. On junctions an extra "insert
22
+ * between" button splices a node before the existing successor.
23
+ */
24
+ declare const BottomHandleDropdown: ({ nodeId, isConnectable, hidden, canBranch, isJunction }: BottomHandleDropdownProps) => import("react/jsx-runtime").JSX.Element;
9
25
  export default BottomHandleDropdown;
@@ -0,0 +1,12 @@
1
+ import { NodeInit } from '../../../../hooks/useFlowConnections';
2
+ interface NodeTypePickerMenuContentProps {
3
+ /** Called with the picked node type. */
4
+ onSelect: (nodeInit: NodeInit) => void;
5
+ }
6
+ /**
7
+ * Shared dropdown body listing every creatable node type (inputs + UI). Used by
8
+ * the bottom handle (add child / branch) and the junction insert button so the
9
+ * picker stays identical across affordances.
10
+ */
11
+ declare const NodeTypePickerMenuContent: ({ onSelect }: NodeTypePickerMenuContentProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default NodeTypePickerMenuContent;
@@ -44,9 +44,27 @@ export interface TreegeEditorProps {
44
44
  */
45
45
  theme?: "dark" | "light";
46
46
  /**
47
- * Language for the editor interface.
47
+ * Controlled editor UI language. When provided, the editor runs in controlled
48
+ * mode: this value always wins and the built-in switcher only fires
49
+ * `onLanguageChange` — you must update this prop to actually change the
50
+ * language. Leave undefined to let the editor manage it itself (see
51
+ * `defaultLanguage`).
48
52
  */
49
53
  language?: string;
54
+ /**
55
+ * Initial editor UI language in uncontrolled mode. The editor seeds its
56
+ * internal state with this value, then owns it so the user can switch at
57
+ * runtime via the actions panel. Ignored when `language` is provided.
58
+ * @default "en"
59
+ */
60
+ defaultLanguage?: string;
61
+ /**
62
+ * Called whenever the user switches the editor language via the built-in
63
+ * switcher, with the newly selected language. Required to react to the change
64
+ * in controlled mode; optional in uncontrolled mode (use it to persist or
65
+ * sync the choice).
66
+ */
67
+ onLanguageChange?: (language: string) => void;
50
68
  /**
51
69
  * AI configuration for tree generation
52
70
  */
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns a copy of `data` with config blocks that don't belong to `subType`
3
+ * removed. Pure — returns the same reference when nothing is dropped.
4
+ */
5
+ export declare const cleanConfigForSubType: <T extends Record<string, unknown>>(data: T, subType: string) => T;
@@ -1,4 +1,39 @@
1
- import { Edge } from '@xyflow/react';
1
+ import { Edge, Node } from '@xyflow/react';
2
+ /**
3
+ * Whether an edge from `source` to `target` already exists in the set.
4
+ * Used to reject duplicate connections.
5
+ */
6
+ export declare const edgeExists: (edges: Edge[], source: string, target: string) => boolean;
7
+ type LeafNode = Pick<Node, "id" | "position" | "parentId">;
8
+ interface BuildConvergenceOptions {
9
+ /** ID for the new common node. */
10
+ commonNodeId: string;
11
+ /** Base node template the common node is spread from (e.g. DEFAULT_NODE). */
12
+ baseNode: Partial<Node>;
13
+ /** Measured node height, used to place the common node below both leaves. */
14
+ nodeHeight: number;
15
+ /** Vertical gap between the leaves and the common node. */
16
+ verticalSpacing: number;
17
+ }
18
+ /**
19
+ * Build the common node that converges two leaves, plus the two edges wiring
20
+ * each leaf to it (`source → common`, `target → common`). The node is centered
21
+ * horizontally between the leaves and placed one row below the lower one. It
22
+ * inherits the group only when both leaves share the same `parentId`.
23
+ *
24
+ * Pure and deterministic — the caller supplies the new node id, base template
25
+ * and measured dimensions — so it can be unit-tested without React Flow.
26
+ */
27
+ export declare const buildConvergence: (sourceNode: LeafNode, targetNode: LeafNode, { commonNodeId, baseNode, nodeHeight, verticalSpacing }: BuildConvergenceOptions) => {
28
+ node: Node;
29
+ edges: Edge[];
30
+ };
31
+ /**
32
+ * Whether adding an edge `source` → `target` would introduce a cycle, i.e.
33
+ * `target` can already reach `source` by following outgoing edges. BFS from
34
+ * `target` over the existing edges; returns true as soon as `source` is found.
35
+ */
36
+ export declare const wouldCreateCycle: (edges: Edge[], source: string, target: string) => boolean;
2
37
  /**
3
38
  * Re-normalize outgoing edges from a set of affected parent nodes: if a parent
4
39
  * now has a single remaining child, convert its outgoing edge back to a
@@ -12,3 +47,4 @@ import { Edge } from '@xyflow/react';
12
47
  * @returns A new edges array with affected edges normalized
13
48
  */
14
49
  export declare const normalizeConditionalEdges: (edges: Edge[], affectedParents: Set<string>) => Edge[];
50
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Flow, HttpHeader } from '../../shared/types/node';
2
+ /** True when a header key is known to carry credentials/secrets. */
3
+ export declare const isSensitiveHeaderKey: (key: string) => boolean;
4
+ /** True when the list contains a sensitive header with a non-empty value. */
5
+ export declare const hasSensitiveHeader: (headers?: HttpHeader[]) => boolean;
6
+ /**
7
+ * Returns a copy of the flow with all credential-bearing field-level headers
8
+ * removed from every node's httpConfig/optionsSource/submitConfig, plus the
9
+ * number of headers stripped. The input flow is never mutated, so the live
10
+ * editor canvas keeps its values — only the exported/saved artifact is cleaned.
11
+ */
12
+ export declare const stripSensitiveHeadersFromFlow: (flow: Flow) => {
13
+ flow: Flow;
14
+ strippedCount: number;
15
+ };