treege 3.0.0-beta.54 → 3.0.0-beta.56

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.
@@ -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
  };
@@ -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;
@@ -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;
@@ -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 {};