@dschz/solid-flow 0.3.0-next.3 → 0.3.0-next.4
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/README.md +18 -0
- package/dist/index/index.d.ts +146 -59
- package/dist/index/index.js +182 -108
- package/dist/index/index.jsx +114 -65
- package/dist/styles/index.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -184,8 +184,26 @@ const nodeData = useNodesData(["node-1", "node-2"]);
|
|
|
184
184
|
|
|
185
185
|
// Node connection information
|
|
186
186
|
const connections = useNodeConnections("node-1");
|
|
187
|
+
|
|
188
|
+
// Which node/edge a nested component is rendered inside (for building
|
|
189
|
+
// composable custom nodes and edge labels without prop drilling)
|
|
190
|
+
const nodeId = useNodeId();
|
|
191
|
+
const edgeId = useEdgeId();
|
|
187
192
|
```
|
|
188
193
|
|
|
194
|
+
#### Coming from React Flow?
|
|
195
|
+
|
|
196
|
+
Some React Flow hooks intentionally have no Solid Flow equivalent, because
|
|
197
|
+
Solid's fine-grained reactivity makes them unnecessary:
|
|
198
|
+
|
|
199
|
+
- `useOnSelectionChange` / `useOnViewportChange` — reading `flow.selection`
|
|
200
|
+
or `flow.viewport` (from `useSolidFlow()`) in a tracked scope IS the
|
|
201
|
+
subscription; wrap side effects in `createEffect` over those reads.
|
|
202
|
+
- `useNodesState` / `useEdgesState` — use `createNodeStore` /
|
|
203
|
+
`createEdgeStore` instead.
|
|
204
|
+
- `useStore` — the reactive `flow` struct is the supported read surface;
|
|
205
|
+
there is no public escape hatch into internals.
|
|
206
|
+
|
|
189
207
|
### Utility Functions
|
|
190
208
|
|
|
191
209
|
```tsx
|
package/dist/index/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { JSX } from "@solidjs/web";
|
|
|
2
2
|
import { Align as Align$1, AriaLabelConfig as AriaLabelConfig$1, BezierPathOptions as BezierPathOptions$1, Box as Box$1, ColorMode as ColorMode$1, ColorModeClass as ColorModeClass$1, Connection, Connection as Connection$1, ConnectionLineType, ConnectionLineType as ConnectionLineType$1, ConnectionMode, ConnectionMode as ConnectionMode$1, ConnectionState, ControlLinePosition, ControlPosition, ControlPosition as ControlPosition$1, CoordinateExtent, CoordinateExtent as CoordinateExtent$1, DefaultEdgeOptionsBase, Dimensions as Dimensions$1, EdgeBase, EdgeMarker, EdgeMarkerType as EdgeMarkerType$1, EdgePosition, EdgeToolbarBaseProps, FinalConnectionState, FitBounds, FitBoundsOptions as FitBoundsOptions$1, FitViewOptionsBase, GetBezierPathParams as GetBezierPathParams$1, GetSmoothStepPathParams as GetSmoothStepPathParams$1, GetStraightPathParams as GetStraightPathParams$1, Handle as Handle$1, HandleConnection, HandleConnection as HandleConnection$1, HandleProps, HandleType, InternalNodeBase, IsValidConnection as IsValidConnection$1, MarkerProps, MarkerType, NodeBase, NodeConnection, NodeConnection as NodeConnection$1, NodeOrigin, NodeOrigin as NodeOrigin$1, NodeProps as NodeProps$1, OnBeforeDeleteBase, OnConnect as OnConnect$1, OnConnectEnd as OnConnectEnd$1, OnConnectStart as OnConnectStart$1, OnConnectStartParams as OnConnectStartParams$1, OnError as OnError$1, OnMove, OnMove as OnMove$1, OnMoveEnd as OnMoveEnd$1, OnMoveStart as OnMoveStart$1, OnReconnect as OnReconnect$1, OnReconnectEnd as OnReconnectEnd$1, OnReconnectStart as OnReconnectStart$1, OnResize as OnResize$1, OnResizeEnd as OnResizeEnd$1, OnResizeStart as OnResizeStart$1, OnSelectionDrag as OnSelectionDrag$1, PanOnScrollMode, PanOnScrollMode as PanOnScrollMode$1, PanelPosition, PanelPosition as PanelPosition$1, Position, Position as Position$1, ProOptions as ProOptions$1, Rect as Rect$1, ResizeControlVariant, ResizeControlVariant as ResizeControlVariant$1, ResizeDragEvent as ResizeDragEvent$1, ResizeParams as ResizeParams$1, ResizeParamsWithDirection as ResizeParamsWithDirection$1, SelectionMode as SelectionMode$1, SelectionRect as SelectionRect$1, SetCenter, SetCenterOptions as SetCenterOptions$1, SetViewport, ShouldResize, ShouldResize as ShouldResize$1, SmoothStepPathOptions as SmoothStepPathOptions$1, SnapGrid as SnapGrid$1, StepPathOptions, Transform as Transform$1, UpdateNodeInternals, Viewport, Viewport as Viewport$1, ViewportHelperFunctionOptions as ViewportHelperFunctionOptions$1, XYPosition, XYPosition as XYPosition$1, XYZPosition as XYZPosition$1, ZIndexMode, ZoomInOut, addEdge, getBezierEdgeCenter as getBezierEdgeCenter$1, getBezierPath, getConnectedEdges, getEdgeCenter as getEdgeCenter$1, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds } from "@xyflow/system";
|
|
3
3
|
import { Accessor, ParentComponent, ParentProps, Store, StoreSetter } from "solid-js";
|
|
4
4
|
//#region src/types/custom.d.ts
|
|
5
|
+
/** An arbitrary string-keyed record — the unconstrained default for node/edge data. */
|
|
5
6
|
type UnknownStruct = Record<string, unknown>;
|
|
6
7
|
//#endregion
|
|
7
8
|
//#region src/types/node.d.ts
|
|
@@ -26,9 +27,12 @@ type Node<NodeData extends UnknownStruct = UnknownStruct, NodeType extends strin
|
|
|
26
27
|
*/
|
|
27
28
|
ariaRole?: JSX.HTMLAttributes<HTMLDivElement>["role"];
|
|
28
29
|
/**
|
|
29
|
-
* General escape hatch for adding custom attributes to the node's DOM
|
|
30
|
+
* General escape hatch for adding custom attributes to the node's DOM
|
|
31
|
+
* element. Event handlers, refs, and content-injection props are excluded
|
|
32
|
+
* (Svelte Flow parity: their omit of `keyof DOMAttributes`); interaction
|
|
33
|
+
* belongs on the node component, not here.
|
|
30
34
|
*/
|
|
31
|
-
domAttributes?: Omit<JSX.HTMLAttributes<HTMLDivElement>, "id" | "style" | "class" | "draggable" | "role" | "aria-label" | keyof JSX.
|
|
35
|
+
domAttributes?: Omit<JSX.HTMLAttributes<HTMLDivElement>, "id" | "style" | "class" | "draggable" | "role" | "aria-label" | "innerHTML" | "textContent" | "children" | keyof JSX.CustomAttributes<HTMLDivElement> | keyof JSX.EventHandlersElement<HTMLDivElement> | keyof JSX.EventHandlersWindow<HTMLDivElement>>;
|
|
32
36
|
};
|
|
33
37
|
/** Props passed to a node component (custom or built-in). */
|
|
34
38
|
type NodeProps<TData extends UnknownStruct = UnknownStruct, TType extends string | undefined = string | undefined> = NodeProps$1<Node<TData, TType>>;
|
|
@@ -449,7 +453,12 @@ type EdgeReconnectAnchorProps = {
|
|
|
449
453
|
readonly style?: JSX.CSSProperties;
|
|
450
454
|
readonly position?: XYPosition$1;
|
|
451
455
|
readonly size?: number;
|
|
456
|
+
/** Externally mark the anchor as reconnecting (hides its children), in
|
|
457
|
+
* addition to the gesture-driven internal state. */
|
|
452
458
|
readonly reconnecting?: boolean;
|
|
459
|
+
/** Called when a reconnect gesture on this anchor starts/ends — the Solid
|
|
460
|
+
* translation of Svelte Flow's `bind:reconnecting`. */
|
|
461
|
+
readonly onReconnectingChange?: (reconnecting: boolean) => void;
|
|
453
462
|
} & Omit<JSX.HTMLAttributes<HTMLDivElement>, "style">;
|
|
454
463
|
/** Grab area that lets an edge end be dragged off its handle and reconnected. */
|
|
455
464
|
declare const EdgeReconnectAnchor: (props: ParentProps<EdgeReconnectAnchorProps>) => JSX.Element;
|
|
@@ -845,13 +854,25 @@ type SolidFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge>
|
|
|
845
854
|
*/
|
|
846
855
|
readonly selectionOnDrag?: boolean;
|
|
847
856
|
/**
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
857
|
+
* Only render (mount) elements inside the overscanned viewport: nodes and
|
|
858
|
+
* edges outside it are unmounted entirely, and remount as the viewport
|
|
859
|
+
* reaches them. This is the heavy-duty tier for very large graphs — at
|
|
860
|
+
* 10k nodes it cuts the DOM by ~16x, roughly halves memory, and makes
|
|
861
|
+
* node drags ~3.7x faster (fewer live subscribers).
|
|
862
|
+
*
|
|
863
|
+
* The flow's data graph is unaffected: positions, selection, and cached
|
|
864
|
+
* measurements live outside the components, so an unmounted node comes
|
|
865
|
+
* back exactly as it left (at its measured size, still selected).
|
|
866
|
+
* Component-LOCAL state does not survive — signals created inside a
|
|
867
|
+
* custom node, uncontrolled inputs, scroll positions of inner elements.
|
|
868
|
+
* Keep state you care about in `node.data`. Never unmounted: selected
|
|
869
|
+
* elements, unmeasured nodes, and the node holding DOM focus.
|
|
870
|
+
*
|
|
871
|
+
* Independent of this prop, off-viewport elements are always CSS-culled
|
|
872
|
+
* (`visibility: hidden` + `pointer-events: none`, everything stays
|
|
873
|
+
* mounted) — that tier has no user-visible semantics beyond leaving the
|
|
874
|
+
* accessibility tree and tab order while off-screen.
|
|
875
|
+
* @default false
|
|
855
876
|
*/
|
|
856
877
|
readonly onlyRenderVisibleElements?: boolean;
|
|
857
878
|
/**
|
|
@@ -1022,22 +1043,33 @@ type SolidFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge>
|
|
|
1022
1043
|
readonly ariaLabelConfig?: Partial<AriaLabelConfig$1>;
|
|
1023
1044
|
};
|
|
1024
1045
|
//#endregion
|
|
1025
|
-
//#region src/components/SolidFlow
|
|
1046
|
+
//#region src/components/SolidFlow.d.ts
|
|
1026
1047
|
type SolidFlowComponentProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = ParentProps<SolidFlowProps<NodeType, EdgeType>> & Omit<JSX.HTMLAttributes<HTMLDivElement>, "style" | "onselectionchange" | "onSelectionChange">;
|
|
1027
1048
|
/** The flow canvas component: renders nodes and edges and wires up viewport and interactions. */
|
|
1028
1049
|
declare const SolidFlow: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: SolidFlowComponentProps<NodeType, EdgeType>) => JSX.Element;
|
|
1029
1050
|
//#endregion
|
|
1030
|
-
//#region src/components/
|
|
1051
|
+
//#region src/components/SolidFlowProvider.d.ts
|
|
1031
1052
|
/** Hoists flow state above `SolidFlow` so hooks work outside the component (multi-panel UIs). */
|
|
1032
1053
|
declare const SolidFlowProvider: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: ParentProps<SolidFlowProps<NodeType, EdgeType>>) => JSX.Element;
|
|
1033
1054
|
//#endregion
|
|
1034
1055
|
//#region src/core/createEdgeStore.d.ts
|
|
1035
|
-
type
|
|
1036
|
-
data: TData;
|
|
1037
|
-
type: TType;
|
|
1038
|
-
} : never;
|
|
1056
|
+
type EdgeDataOf<T> = T extends ((props: EdgeProps<infer TData, infer _TType>) => unknown) ? TData : UnknownStruct;
|
|
1039
1057
|
type AllEdgeTypes<TUserEdgeTypes extends EdgeTypes> = TUserEdgeTypes extends Record<string, never> ? BuiltInEdgeTypes : BuiltInEdgeTypes & TUserEdgeTypes;
|
|
1040
|
-
|
|
1058
|
+
/**
|
|
1059
|
+
* The discriminated union of edge configurations for a renderer map: one
|
|
1060
|
+
* member per built-in and custom edge type, with `data` narrowed by the
|
|
1061
|
+
* `type` discriminant (the MAP KEY — what the renderer actually matches).
|
|
1062
|
+
* Use it to carry `createEdgeStore`'s guided typing anywhere a plain array
|
|
1063
|
+
* or vanilla store is typed:
|
|
1064
|
+
*
|
|
1065
|
+
* ```typescript
|
|
1066
|
+
* const initialEdges = [
|
|
1067
|
+
* { id: "e1", source: "1", target: "2", type: "labeled", data: { label: "hi" } },
|
|
1068
|
+
* ] satisfies EdgesFor<typeof edgeTypes>[];
|
|
1069
|
+
* ```
|
|
1070
|
+
*/
|
|
1071
|
+
type EdgesFor<TUserEdgeTypes extends EdgeTypes = Record<string, never>> = { [K in keyof AllEdgeTypes<TUserEdgeTypes>]: Edge<EdgeDataOf<AllEdgeTypes<TUserEdgeTypes>[K]>, K & string>; }[keyof AllEdgeTypes<TUserEdgeTypes>];
|
|
1072
|
+
type EdgesInput<TUserEdgeTypes extends EdgeTypes> = EdgesFor<TUserEdgeTypes>;
|
|
1041
1073
|
/**
|
|
1042
1074
|
* Creates a type-safe reactive store of edges for use in Solid Flow.
|
|
1043
1075
|
*
|
|
@@ -1114,7 +1146,7 @@ type EdgesInput<TUserEdgeTypes extends EdgeTypes> = { [K in keyof AllEdgeTypes<T
|
|
|
1114
1146
|
* - Works seamlessly with both built-in and custom node types
|
|
1115
1147
|
* - Type errors prevent invalid type names or incorrect data structures
|
|
1116
1148
|
*/
|
|
1117
|
-
declare const createEdgeStore: <TUserEdgeTypes extends EdgeTypes = Record<string, never>>(edges: EdgesInput<TUserEdgeTypes
|
|
1149
|
+
declare const createEdgeStore: <TUserEdgeTypes extends EdgeTypes = Record<string, never>>(edges: NoInfer<EdgesInput<TUserEdgeTypes>>[]) => readonly [Store<EdgesInput<TUserEdgeTypes>[]>, StoreSetter<EdgesInput<TUserEdgeTypes>[]>];
|
|
1118
1150
|
//#endregion
|
|
1119
1151
|
//#region src/core/projections/connections.d.ts
|
|
1120
1152
|
/**
|
|
@@ -1270,12 +1302,23 @@ type FlowCommands<NodeType extends Node = Node, EdgeType extends Edge = Edge> =
|
|
|
1270
1302
|
};
|
|
1271
1303
|
//#endregion
|
|
1272
1304
|
//#region src/core/createNodeStore.d.ts
|
|
1273
|
-
type
|
|
1274
|
-
data: TData;
|
|
1275
|
-
type: TType;
|
|
1276
|
-
} : never;
|
|
1305
|
+
type NodeDataOf<T> = T extends ((props: NodeProps<infer TData, infer _TType>) => unknown) ? TData : UnknownStruct;
|
|
1277
1306
|
type AllNodeTypes<TUserNodeTypes extends NodeTypes> = TUserNodeTypes extends Record<string, never> ? BuiltInNodeTypes : BuiltInNodeTypes & TUserNodeTypes;
|
|
1278
|
-
|
|
1307
|
+
/**
|
|
1308
|
+
* The discriminated union of node configurations for a renderer map: one
|
|
1309
|
+
* member per built-in and custom node type, with `data` narrowed by the
|
|
1310
|
+
* `type` discriminant (the MAP KEY — what the renderer actually matches).
|
|
1311
|
+
* Use it to carry `createNodeStore`'s guided typing anywhere a plain array
|
|
1312
|
+
* or vanilla store is typed:
|
|
1313
|
+
*
|
|
1314
|
+
* ```typescript
|
|
1315
|
+
* const initialNodes = [
|
|
1316
|
+
* { id: "1", type: "custom", position: { x: 0, y: 0 }, data: { value: 1 } },
|
|
1317
|
+
* ] satisfies NodesFor<typeof nodeTypes>[];
|
|
1318
|
+
* ```
|
|
1319
|
+
*/
|
|
1320
|
+
type NodesFor<TUserNodeTypes extends NodeTypes = Record<string, never>> = { [K in keyof AllNodeTypes<TUserNodeTypes>]: Node<NodeDataOf<AllNodeTypes<TUserNodeTypes>[K]>, K & string>; }[keyof AllNodeTypes<TUserNodeTypes>];
|
|
1321
|
+
type NodesInput<TUserNodeTypes extends NodeTypes> = NodesFor<TUserNodeTypes>;
|
|
1279
1322
|
/**
|
|
1280
1323
|
* Creates a type-safe reactive store of nodes for use in Solid Flow.
|
|
1281
1324
|
*
|
|
@@ -1347,7 +1390,7 @@ type NodesInput<TUserNodeTypes extends NodeTypes> = { [K in keyof AllNodeTypes<T
|
|
|
1347
1390
|
* - Works seamlessly with both built-in and custom node types
|
|
1348
1391
|
* - Type errors prevent invalid type names or incorrect data structures
|
|
1349
1392
|
*/
|
|
1350
|
-
declare const createNodeStore: <TUserNodeTypes extends NodeTypes = Record<string, never>>(nodes: NodesInput<TUserNodeTypes
|
|
1393
|
+
declare const createNodeStore: <TUserNodeTypes extends NodeTypes = Record<string, never>>(nodes: NoInfer<NodesInput<TUserNodeTypes>>[]) => readonly [Store<NodesInput<TUserNodeTypes>[]>, StoreSetter<NodesInput<TUserNodeTypes>[]>];
|
|
1351
1394
|
//#endregion
|
|
1352
1395
|
//#region src/hooks/useColorMode.d.ts
|
|
1353
1396
|
/**
|
|
@@ -1377,14 +1420,14 @@ declare function useConnection(): Accessor<ConnectionState>;
|
|
|
1377
1420
|
* @public
|
|
1378
1421
|
* @returns store with an array of nodes
|
|
1379
1422
|
*/
|
|
1380
|
-
declare function useNodes<NodeType extends Node = Node>(): Accessor<NodeType[]>;
|
|
1423
|
+
declare function useNodes<NodeType extends Node = Node>(): Accessor<readonly NodeType[]>;
|
|
1381
1424
|
/**
|
|
1382
1425
|
* Hook for getting the current edges from the store.
|
|
1383
1426
|
*
|
|
1384
1427
|
* @public
|
|
1385
1428
|
* @returns store with an array of edges
|
|
1386
1429
|
*/
|
|
1387
|
-
declare function useEdges<EdgeType extends Edge = Edge>(): Accessor<EdgeType[]>;
|
|
1430
|
+
declare function useEdges<EdgeType extends Edge = Edge>(): Accessor<readonly EdgeType[]>;
|
|
1388
1431
|
/**
|
|
1389
1432
|
* Hook for getting the current viewport from the store.
|
|
1390
1433
|
*
|
|
@@ -1393,10 +1436,6 @@ declare function useEdges<EdgeType extends Edge = Edge>(): Accessor<EdgeType[]>;
|
|
|
1393
1436
|
*/
|
|
1394
1437
|
declare function useViewport(): Accessor<Viewport$1>;
|
|
1395
1438
|
//#endregion
|
|
1396
|
-
//#region src/hooks/useHandleEdgeSelect.d.ts
|
|
1397
|
-
/** Returns a callback applying edge-selection semantics for the given edge id. */
|
|
1398
|
-
declare function useHandleEdgeSelect(): (id: string) => void;
|
|
1399
|
-
//#endregion
|
|
1400
1439
|
//#region src/hooks/useInitialized.d.ts
|
|
1401
1440
|
/**
|
|
1402
1441
|
* Hook for seeing if all nodes have been measured.
|
|
@@ -1420,11 +1459,16 @@ declare function useViewportInitialized(): Accessor<boolean>;
|
|
|
1420
1459
|
//#endregion
|
|
1421
1460
|
//#region src/hooks/useInternalNode.d.ts
|
|
1422
1461
|
/**
|
|
1423
|
-
* Hook to get an internal node
|
|
1462
|
+
* Hook to get an internal node (the node enriched with measured dimensions,
|
|
1463
|
+
* absolute position, and z-order) by id.
|
|
1464
|
+
*
|
|
1465
|
+
* The id is an accessor (not a plain string) on purpose: passing a raw
|
|
1466
|
+
* reactive read like `props.nodeId` would capture the value once and silently
|
|
1467
|
+
* lose reactivity — `useInternalNode(() => props.nodeId)` keeps it live.
|
|
1424
1468
|
*
|
|
1425
1469
|
* @public
|
|
1426
|
-
* @param id - the node id
|
|
1427
|
-
* @returns an accessor with
|
|
1470
|
+
* @param id - a reactive accessor for the node id
|
|
1471
|
+
* @returns an accessor with the internal node, or undefined while absent
|
|
1428
1472
|
*/
|
|
1429
1473
|
declare function useInternalNode(id: Accessor<string>): Accessor<InternalNode | undefined>;
|
|
1430
1474
|
//#endregion
|
|
@@ -1467,36 +1511,16 @@ declare function useNodesData<NodeType extends Node = Node>(nodeIds: Accessor<st
|
|
|
1467
1511
|
* familiarity — `useSolidFlow().fitView()` and
|
|
1468
1512
|
* `useSolidFlow().commands.fitView()` are the same function.
|
|
1469
1513
|
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1514
|
+
* There are no imperative getters: event handlers are untracked scopes in
|
|
1515
|
+
* Solid, so reading `flow.viewport.zoom` (or `flow.internalNodes[id]`) inside
|
|
1516
|
+
* one already IS the imperative read — while the same read in a tracked scope
|
|
1517
|
+
* subscribes.
|
|
1474
1518
|
*/
|
|
1475
1519
|
type UseSolidFlowReturn<NodeType extends Node = Node, EdgeType extends Edge = Edge> = FlowCommands<NodeType, EdgeType> & {
|
|
1476
1520
|
/** The flow's data graph as one reactive struct — the canonical read surface. */
|
|
1477
1521
|
readonly flow: FlowState<NodeType, EdgeType>;
|
|
1478
1522
|
/** The flow's write surface (same functions as the spread members). */
|
|
1479
1523
|
readonly commands: FlowCommands<NodeType, EdgeType>;
|
|
1480
|
-
/** @deprecated Read `flow.internalNodes[id]` instead. */
|
|
1481
|
-
readonly getInternalNode: (id: string) => InternalNode<NodeType> | undefined;
|
|
1482
|
-
/** @deprecated Read `flow.internalNodes[id]?.internals.userNode` (or find in `flow.nodes`) instead. */
|
|
1483
|
-
readonly getNode: (id: string) => NodeType | undefined;
|
|
1484
|
-
/** @deprecated Read `flow.nodes` (or map ids over `flow.internalNodes`) instead. */
|
|
1485
|
-
readonly getNodes: (ids?: string[]) => NodeType[];
|
|
1486
|
-
/** @deprecated Read `flow.edges` (or find by id) instead. */
|
|
1487
|
-
readonly getEdge: (id: string) => EdgeType | undefined;
|
|
1488
|
-
/** @deprecated Read `flow.edges` (or filter by ids) instead. */
|
|
1489
|
-
readonly getEdges: (ids?: string[]) => EdgeType[];
|
|
1490
|
-
/** @deprecated Read `flow.viewport` instead. */
|
|
1491
|
-
readonly getViewport: () => Viewport$1;
|
|
1492
|
-
/** @deprecated Read `flow.viewport.zoom` instead. */
|
|
1493
|
-
readonly getZoom: () => number;
|
|
1494
|
-
/** @deprecated Read `flow.connections[connectionKey(nodeId, type, id)]` (or use `useNodeConnections`) instead. */
|
|
1495
|
-
readonly getHandleConnections: (params: {
|
|
1496
|
-
type: HandleType;
|
|
1497
|
-
nodeId: string;
|
|
1498
|
-
id?: string | null;
|
|
1499
|
-
}) => HandleConnection$1[];
|
|
1500
1524
|
};
|
|
1501
1525
|
/**
|
|
1502
1526
|
* Hook for accessing the flow instance: `{ flow, commands }` plus the
|
|
@@ -1506,7 +1530,7 @@ type UseSolidFlowReturn<NodeType extends Node = Node, EdgeType extends Edge = Ed
|
|
|
1506
1530
|
* `const { flow, commands } = useSolidFlow()`.
|
|
1507
1531
|
*
|
|
1508
1532
|
* @public
|
|
1509
|
-
* @returns the flow's read struct
|
|
1533
|
+
* @returns the flow's read struct and write surface
|
|
1510
1534
|
*/
|
|
1511
1535
|
declare function useSolidFlow<NodeType extends Node = Node, EdgeType extends Edge = Edge>(): UseSolidFlowReturn<NodeType, EdgeType>;
|
|
1512
1536
|
//#endregion
|
|
@@ -1519,6 +1543,30 @@ declare function useSolidFlow<NodeType extends Node = Node, EdgeType extends Edg
|
|
|
1519
1543
|
*/
|
|
1520
1544
|
declare function useUpdateNodeInternals(): UpdateNodeInternals;
|
|
1521
1545
|
//#endregion
|
|
1546
|
+
//#region src/contexts/edgeId.d.ts
|
|
1547
|
+
/**
|
|
1548
|
+
* Returns the id of the edge this component is rendered inside. Available
|
|
1549
|
+
* anywhere in a custom edge's subtree (provided by the edge wrapper), so
|
|
1550
|
+
* nested components — like a custom edge label — can learn their host edge
|
|
1551
|
+
* without prop drilling.
|
|
1552
|
+
*
|
|
1553
|
+
* @public
|
|
1554
|
+
* @returns a reactive accessor for the surrounding edge's id
|
|
1555
|
+
*/
|
|
1556
|
+
declare function useEdgeId(): Accessor<string>;
|
|
1557
|
+
//#endregion
|
|
1558
|
+
//#region src/contexts/nodeId.d.ts
|
|
1559
|
+
/**
|
|
1560
|
+
* Returns the id of the node this component is rendered inside. Available
|
|
1561
|
+
* anywhere in a custom node's subtree (provided by the node wrapper), so
|
|
1562
|
+
* nested components — like a custom `Handle` — can learn their host node
|
|
1563
|
+
* without prop drilling.
|
|
1564
|
+
*
|
|
1565
|
+
* @public
|
|
1566
|
+
* @returns a reactive accessor for the surrounding node's id
|
|
1567
|
+
*/
|
|
1568
|
+
declare function useNodeId(): Accessor<string>;
|
|
1569
|
+
//#endregion
|
|
1522
1570
|
//#region src/plugins/background/types.d.ts
|
|
1523
1571
|
/** Available background pattern styles. */
|
|
1524
1572
|
type BackgroundVariant = "lines" | "dots" | "cross";
|
|
@@ -1592,9 +1640,39 @@ type ControlsProps = {
|
|
|
1592
1640
|
/** Viewport control panel: zoom in/out, fit view, and interactivity lock. */
|
|
1593
1641
|
declare const Controls: (props: ParentProps<ControlsProps>) => JSX.Element;
|
|
1594
1642
|
//#endregion
|
|
1643
|
+
//#region src/plugins/minimap/MiniMapNode.d.ts
|
|
1644
|
+
/**
|
|
1645
|
+
* Props passed to a minimap node renderer — the default `MiniMapNode` or a
|
|
1646
|
+
* custom component supplied via the `MiniMap` `nodeComponent` prop. Position
|
|
1647
|
+
* and dimensions are in flow coordinates (the minimap svg's viewBox space).
|
|
1648
|
+
*/
|
|
1649
|
+
type MiniMapNodeProps = {
|
|
1650
|
+
/** The id of the node this minimap representation stands for. */
|
|
1651
|
+
readonly id: string;
|
|
1652
|
+
readonly class?: string;
|
|
1653
|
+
readonly x: number;
|
|
1654
|
+
readonly y: number;
|
|
1655
|
+
readonly width?: number;
|
|
1656
|
+
readonly height?: number;
|
|
1657
|
+
readonly borderRadius?: number;
|
|
1658
|
+
readonly color?: string;
|
|
1659
|
+
readonly shapeRendering: JSX.RectSVGAttributes<SVGRectElement>["shape-rendering"];
|
|
1660
|
+
readonly strokeColor?: string;
|
|
1661
|
+
readonly strokeWidth?: number;
|
|
1662
|
+
readonly selected?: boolean;
|
|
1663
|
+
/** The node's own style; its background feeds the default fill fallback. */
|
|
1664
|
+
readonly style?: JSX.CSSProperties;
|
|
1665
|
+
/** Click handler (wired when the `MiniMap` has `onNodeClick`); call with the node id. */
|
|
1666
|
+
readonly onClick?: (event: MouseEvent, id: string) => void;
|
|
1667
|
+
};
|
|
1668
|
+
/** The default minimap node: a rounded rect. Custom `nodeComponent`s can wrap it. */
|
|
1669
|
+
declare const MiniMapNode: (props: MiniMapNodeProps) => JSX.Element;
|
|
1670
|
+
//#endregion
|
|
1595
1671
|
//#region src/plugins/minimap/MiniMap.d.ts
|
|
1672
|
+
/** Derives a per-node minimap attribute (color, stroke, class) from the node. */
|
|
1596
1673
|
type GetMiniMapNodeAttribute<NodeType extends Node> = (node: NodeType) => string;
|
|
1597
|
-
|
|
1674
|
+
/** Props for the `MiniMap` plugin. */
|
|
1675
|
+
type MiniMapProps<NodeType extends Node> = Omit<JSX.HTMLAttributes<HTMLDivElement>, "style" | "onClick"> & {
|
|
1598
1676
|
/** Background color of minimap */
|
|
1599
1677
|
readonly bgColor?: string;
|
|
1600
1678
|
/** Color of nodes on the minimap */
|
|
@@ -1626,8 +1704,17 @@ type MiniMapProps<NodeType extends Node> = Omit<JSX.HTMLAttributes<HTMLDivElemen
|
|
|
1626
1704
|
readonly width?: number;
|
|
1627
1705
|
/** Height of minimap */
|
|
1628
1706
|
readonly height?: number;
|
|
1707
|
+
/** Called when the minimap pane is clicked, with the position in flow coordinates. */
|
|
1708
|
+
readonly onClick?: (event: MouseEvent, position: XYPosition$1) => void;
|
|
1709
|
+
/** Called when a node on the minimap is clicked. */
|
|
1710
|
+
readonly onNodeClick?: (event: MouseEvent, node: NodeType) => void;
|
|
1629
1711
|
readonly pannable?: boolean;
|
|
1630
1712
|
readonly zoomable?: boolean;
|
|
1713
|
+
/**
|
|
1714
|
+
* Custom component rendering each node on the minimap (receives
|
|
1715
|
+
* {@link MiniMapNodeProps}); defaults to the built-in rounded rect.
|
|
1716
|
+
*/
|
|
1717
|
+
readonly nodeComponent?: (props: MiniMapNodeProps) => JSX.Element;
|
|
1631
1718
|
/** Invert the direction when panning the minimap viewport */
|
|
1632
1719
|
readonly inversePan?: boolean;
|
|
1633
1720
|
/** Step size for zooming in/out */
|
|
@@ -1824,4 +1911,4 @@ declare const getEdgeCenter: typeof getEdgeCenter$1;
|
|
|
1824
1911
|
/** Returns the label center and offsets for a bezier edge. */
|
|
1825
1912
|
declare const getBezierEdgeCenter: typeof getBezierEdgeCenter$1;
|
|
1826
1913
|
//#endregion
|
|
1827
|
-
export { Align, AriaLabelConfig, Background, type BackgroundProps, type BackgroundVariant, BaseEdge, BezierEdge, BezierEdgeInternal, type BezierEdgeProps, BezierPathOptions, Box, type BuiltInEdge, type BuiltInNode, type BuiltInNodeTypes, ColorMode, ColorModeClass, type Connection, ConnectionData, ConnectionLine, ConnectionLineComponentProps, ConnectionLineType, ConnectionMode, type ConnectionsRecord, ControlButton, type ControlLinePosition, type ControlPosition, Controls, type CoordinateExtent, type DefaultEdgeOptions, DefaultNode, DeleteEvents, Dimensions, type Edge, EdgeConnection, EdgeEvents, EdgeLabel, EdgeLabelRenderer, type EdgeMarker, EdgeMarkerType, type EdgeProps, EdgeReconnectAnchor, EdgeReconnectEvents, EdgeRenderer, EdgeToolbar, EdgeToolbarProps, type EdgeTypes, EdgeWrapper, type FitBounds, FitBoundsOptions, FitViewOptions, type FlowCommands, type FlowSelection, type FlowState, GetBezierPathParams, GetSmoothStepPathParams, GetStraightPathParams, GroupNode, Handle, type HandleConnection, InputNode, type InternalNode, IsValidConnection, KeyDefinition, KeyDefinitionObject, KeyModifier, Marker, MarkerDefinition, MarkerType, MiniMap, type Node, type NodeConnection, NodeEvents, NodeGraph, type NodeOrigin, type NodeProps, NodeRenderer, NodeResizer, NodeSelection, NodeSelectionEvents, NodeToolbar, NodeToolbarProps, type NodeTypes, NodeWrapper, OnBeforeDelete, OnBeforeEdgeConnect, OnBeforeReconnect, OnConnect, OnConnectEnd, OnConnectStart, OnConnectStartParams, OnDelete, OnEdgeConnect, OnEdgeCreate, OnError, type OnMove, OnMoveEnd, OnMoveStart, OnReconnect, OnReconnectEnd, OnReconnectStart, OnResize, OnResizeEnd, OnResizeStart, OnSelectionChange, OnSelectionDrag, OutputNode, PanOnScrollMode, Pane, PaneEvents, Panel, type PanelPosition, Position, ProOptions, Rect, ResizeControl, ResizeControlVariant, ResizeDragEvent, ResizeParams, ResizeParamsWithDirection, Selection, SelectionMode, SelectionRect, type SetCenter, SetCenterOptions, type SetViewport, ShortcutModifier, ShortcutModifierDefinition, type ShouldResize, SmoothStepEdge, SmoothStepEdgeInternal, type SmoothStepEdgeProps, SmoothStepPathOptions, SnapGrid, SolidFlow, type SolidFlowInitialProps, type SolidFlowProps, SolidFlowProvider, StepEdge, StepEdgeInternal, type StepEdgeProps, StraightEdge, StraightEdgeInternal, type StraightEdgeProps, Transform, UseSolidFlowReturn, Viewport, ViewportHelperFunctionOptions, ViewportPortal, type XYPosition, XYZPosition, Zoom, addEdge, connectionKey, createEdgeStore, createNodeStore, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, useColorMode, useConnection,
|
|
1914
|
+
export { Align, AriaLabelConfig, Background, type BackgroundProps, type BackgroundVariant, BaseEdge, BezierEdge, BezierEdgeInternal, type BezierEdgeProps, BezierPathOptions, Box, type BuiltInEdge, type BuiltInNode, type BuiltInNodeTypes, ColorMode, ColorModeClass, type Connection, ConnectionData, ConnectionLine, ConnectionLineComponentProps, ConnectionLineType, ConnectionMode, type ConnectionsRecord, ControlButton, type ControlLinePosition, type ControlPosition, Controls, type CoordinateExtent, type DefaultEdgeOptions, DefaultNode, DeleteEvents, Dimensions, type Edge, EdgeConnection, EdgeEvents, EdgeLabel, EdgeLabelRenderer, type EdgeMarker, EdgeMarkerType, type EdgeProps, EdgeReconnectAnchor, EdgeReconnectEvents, EdgeRenderer, EdgeToolbar, EdgeToolbarProps, type EdgeTypes, EdgeWrapper, type EdgesFor, type FitBounds, FitBoundsOptions, FitViewOptions, type FlowCommands, type FlowSelection, type FlowState, GetBezierPathParams, type GetMiniMapNodeAttribute, GetSmoothStepPathParams, GetStraightPathParams, GroupNode, Handle, type HandleConnection, InputNode, type InternalNode, IsValidConnection, KeyDefinition, KeyDefinitionObject, KeyModifier, Marker, MarkerDefinition, MarkerType, MiniMap, MiniMapNode, type MiniMapNodeProps, type MiniMapProps, type Node, type NodeConnection, NodeEvents, NodeGraph, type NodeOrigin, type NodeProps, NodeRenderer, NodeResizer, NodeSelection, NodeSelectionEvents, NodeToolbar, NodeToolbarProps, type NodeTypes, NodeWrapper, type NodesFor, OnBeforeDelete, OnBeforeEdgeConnect, OnBeforeReconnect, OnConnect, OnConnectEnd, OnConnectStart, OnConnectStartParams, OnDelete, OnEdgeConnect, OnEdgeCreate, OnError, type OnMove, OnMoveEnd, OnMoveStart, OnReconnect, OnReconnectEnd, OnReconnectStart, OnResize, OnResizeEnd, OnResizeStart, OnSelectionChange, OnSelectionDrag, OutputNode, PanOnScrollMode, Pane, PaneEvents, Panel, type PanelPosition, Position, ProOptions, Rect, ResizeControl, ResizeControlVariant, ResizeDragEvent, ResizeParams, ResizeParamsWithDirection, Selection, SelectionMode, SelectionRect, type SetCenter, SetCenterOptions, type SetViewport, ShortcutModifier, ShortcutModifierDefinition, type ShouldResize, SmoothStepEdge, SmoothStepEdgeInternal, type SmoothStepEdgeProps, SmoothStepPathOptions, SnapGrid, SolidFlow, type SolidFlowInitialProps, type SolidFlowProps, SolidFlowProvider, StepEdge, StepEdgeInternal, type StepEdgeProps, StraightEdge, StraightEdgeInternal, type StraightEdgeProps, Transform, UseSolidFlowReturn, Viewport, ViewportHelperFunctionOptions, ViewportPortal, type XYPosition, XYZPosition, Zoom, addEdge, connectionKey, createEdgeStore, createNodeStore, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, useColorMode, useConnection, useEdgeId, useEdges, useInternalNode, useNodeConnections, useNodeId, useNodes, useNodesData, useNodesInitialized, useSolidFlow, useUpdateNodeInternals, useViewport, useViewportInitialized };
|