@dschz/solid-flow 1.0.0-next.6 → 1.0.0-next.8
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 +27 -0
- package/dist/index/index.d.ts +157 -103
- package/dist/index/index.js +773 -460
- package/dist/index/index.jsx +716 -400
- package/dist/styles/index.css +16 -4
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -152,6 +152,32 @@ The stores you pass as `nodes` / `edges` props are **controlled** — a delibera
|
|
|
152
152
|
|
|
153
153
|
**Prefer letting the flow own the data?** Pass `defaultNodes` / `defaultEdges` instead of `nodes` / `edges` for an **uncontrolled** flow (React Flow parity): the arrays seed the flow once (later values are ignored), and membership belongs to the flow — commands like `addNodes` and completed connections persist with no adoption step. Read live state through `useSolidFlow()`'s `flow.nodes` / `flow.edges`. The two axes are independent, so you can control edges while leaving nodes uncontrolled (or vice versa); supplying both props on one axis is a mistake (`nodes` wins, with a dev warning).
|
|
154
154
|
|
|
155
|
+
## Loading your graph from an API
|
|
156
|
+
|
|
157
|
+
Both stores accept an async seed — pass `async () => data` instead of an array. No memo, no lifecycle juggling: reads are not-ready until the data lands (SolidJS 2.0's async model), so a `<Loading>` boundary holds the flow and swaps in the graph when it arrives. Afterwards the stores behave exactly like their array-seeded counterparts — drafts, adoption, wholesale replacement.
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { Loading } from "@solidjs/web";
|
|
161
|
+
|
|
162
|
+
const fetchNodes = async () => (await fetch("/api/graph/nodes")).json();
|
|
163
|
+
const fetchEdges = async () => (await fetch("/api/graph/edges")).json();
|
|
164
|
+
|
|
165
|
+
export const Flow = () => {
|
|
166
|
+
const [nodes] = createNodeStore(fetchNodes);
|
|
167
|
+
const [edges, setEdges] = createEdgeStore(fetchEdges);
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<Loading fallback={<div>Loading graph…</div>}>
|
|
171
|
+
<SolidFlow nodes={nodes} edges={edges} fitView>
|
|
172
|
+
<Background variant="dots" />
|
|
173
|
+
</SolidFlow>
|
|
174
|
+
</Loading>
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Where the boundary goes is your design decision (SolidJS 2.0: "fetch high, block low") — one `<Loading>` can cover the flow together with its toolbar and sidebar, or sit tight around the flow alone. Without any boundary the flow renders immediately (canvas, controls, background) and the graph pops in when the data arrives — there is deliberately no `fallback` prop. See the AsyncData playground example for the full version (including connection adoption after the async seed).
|
|
180
|
+
|
|
155
181
|
## The flow API
|
|
156
182
|
|
|
157
183
|
`useSolidFlow()` returns `{ flow, commands }` (with `commands` also spread at the top level for React/Svelte Flow familiarity). Both are stable identities — destructuring is safe.
|
|
@@ -265,6 +291,7 @@ Reconnection lifecycle callbacks (`onReconnectStart`, `onReconnect`, `onReconnec
|
|
|
265
291
|
Two complementary culling tiers keep large graphs fast:
|
|
266
292
|
|
|
267
293
|
- **CSS culling (always on):** Elements outside the (overscanned) viewport are hidden with `visibility: hidden` + `pointer-events: none`. Everything stays mounted, so component state, measurement, and accessibility semantics are untouched — this tier has no userland contract at all.
|
|
294
|
+
- **Gesture-time spatial queries:** Dragging a connection runs upstream's closest-handle search on every pointer move — a full node scan in stock React/Svelte Flow. Solid Flow snapshots node geometry into a spatial grid at gesture start (geometry is frozen mid-gesture) and answers from the pointer's neighborhood: at 10,000 nodes a connection drag went from ~422ms per move (unusable) to ~5ms median. Box selection and `getIntersectingNodes` use the same machinery.
|
|
268
295
|
- **`onlyRenderVisibleElements` (opt-in):** Off-screen elements are **unmounted entirely** and remount as the viewport reaches them. At 10,000 nodes this cuts the DOM ~16x, roughly halves memory, and makes node drags several times faster. Positions, selection, and cached measurements live in the flow's data graph — outside your components — so elements come back exactly as they left. Component-_local_ state does not survive unmounting: keep state you care about in `node.data`. Selected elements, unmeasured nodes, and the node holding focus are never unmounted — and an element whose content must keep running off-screen (media, timers, embeds) can opt out of culling entirely with `cullable: false` on the node or edge.
|
|
269
296
|
|
|
270
297
|
The MiniMap always renders the full graph in either mode — it reads the data graph, not the DOM.
|
package/dist/index/index.d.ts
CHANGED
|
@@ -368,10 +368,7 @@ type ConnectionLineProps<NodeType extends Node = Node> = {
|
|
|
368
368
|
declare const ConnectionLine: <NodeType extends Node = Node>(props: ParentProps<Partial<ConnectionLineProps<NodeType>>>) => JSX.Element;
|
|
369
369
|
//#endregion
|
|
370
370
|
//#region src/components/container/EdgeRenderer.d.ts
|
|
371
|
-
type EdgeRendererProps<EdgeType extends Edge = Edge> = EdgeEvents<EdgeType
|
|
372
|
-
readonly defaultEdgeOptions?: DefaultEdgeOptions;
|
|
373
|
-
readonly reconnectRadius: number;
|
|
374
|
-
};
|
|
371
|
+
type EdgeRendererProps<EdgeType extends Edge = Edge> = EdgeEvents<EdgeType>;
|
|
375
372
|
/** Internal renderer iterating the edge id list into `EdgeWrapper`s. */
|
|
376
373
|
declare const EdgeRenderer: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: EdgeRendererProps<EdgeType>) => JSX.Element;
|
|
377
374
|
//#endregion
|
|
@@ -864,6 +861,12 @@ type SolidFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge>
|
|
|
864
861
|
* @default false
|
|
865
862
|
*/
|
|
866
863
|
readonly panOnScroll?: boolean;
|
|
864
|
+
/**
|
|
865
|
+
* Controls how fast the viewport pans while scrolling.
|
|
866
|
+
* Only applies when `panOnScroll` is enabled.
|
|
867
|
+
* @default 0.5
|
|
868
|
+
*/
|
|
869
|
+
readonly panOnScrollSpeed?: number;
|
|
867
870
|
/**
|
|
868
871
|
* This prop is used to limit the direction of panning when panOnScroll is enabled.
|
|
869
872
|
* The "free" option allows panning in any direction.
|
|
@@ -919,6 +922,12 @@ type SolidFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge>
|
|
|
919
922
|
* @default true
|
|
920
923
|
*/
|
|
921
924
|
readonly autoPanOnNodeDrag?: boolean;
|
|
925
|
+
/**
|
|
926
|
+
* The speed at which the viewport auto-pans while dragging a node or a
|
|
927
|
+
* connection toward the edge of the viewport.
|
|
928
|
+
* @default 15
|
|
929
|
+
*/
|
|
930
|
+
readonly autoPanSpeed?: number;
|
|
922
931
|
/**
|
|
923
932
|
* Defaults to be applied to all new edges that are added to the flow.
|
|
924
933
|
* Properties on a new edge will override these defaults if they exist.
|
|
@@ -935,6 +944,11 @@ type SolidFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge>
|
|
|
935
944
|
* @example 'system' | 'light' | 'dark'
|
|
936
945
|
*/
|
|
937
946
|
readonly colorMode?: ColorMode$1;
|
|
947
|
+
/**
|
|
948
|
+
* Static message announced to screen readers via the flow's aria-live
|
|
949
|
+
* region (in addition to the built-in keyboard-interaction messages).
|
|
950
|
+
*/
|
|
951
|
+
readonly ariaLiveMessage?: string;
|
|
938
952
|
/** Fallback color mode for SSR if colorMode is set to 'system' */
|
|
939
953
|
readonly colorModeSSR?: Omit<ColorMode$1, "system">;
|
|
940
954
|
/** Class to be applied to the flow container */
|
|
@@ -1086,102 +1100,6 @@ declare const SolidFlow: <NodeType extends Node = Node, EdgeType extends Edge =
|
|
|
1086
1100
|
/** Hoists flow state above `SolidFlow` so hooks work outside the component (multi-panel UIs). */
|
|
1087
1101
|
declare const SolidFlowProvider: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: ParentProps<SolidFlowProps<NodeType, EdgeType>>) => JSX.Element;
|
|
1088
1102
|
//#endregion
|
|
1089
|
-
//#region src/core/createEdgeStore.d.ts
|
|
1090
|
-
type EdgeDataOf<T> = T extends ((props: EdgeProps<infer TData, infer _TType>) => unknown) ? TData : UnknownStruct;
|
|
1091
|
-
type AllEdgeTypes<TUserEdgeTypes extends EdgeTypes> = TUserEdgeTypes extends Record<string, never> ? BuiltInEdgeTypes : BuiltInEdgeTypes & TUserEdgeTypes;
|
|
1092
|
-
/**
|
|
1093
|
-
* The discriminated union of edge configurations for a renderer map: one
|
|
1094
|
-
* member per built-in and custom edge type, with `data` narrowed by the
|
|
1095
|
-
* `type` discriminant (the MAP KEY — what the renderer actually matches).
|
|
1096
|
-
* Use it to carry `createEdgeStore`'s guided typing anywhere a plain array
|
|
1097
|
-
* or vanilla store is typed:
|
|
1098
|
-
*
|
|
1099
|
-
* ```typescript
|
|
1100
|
-
* const initialEdges = [
|
|
1101
|
-
* { id: "e1", source: "1", target: "2", type: "labeled", data: { label: "hi" } },
|
|
1102
|
-
* ] satisfies SolidFlowEdge<typeof edgeTypes>[];
|
|
1103
|
-
* ```
|
|
1104
|
-
*/
|
|
1105
|
-
type SolidFlowEdge<TUserEdgeTypes extends EdgeTypes = Record<string, never>> = { [K in keyof AllEdgeTypes<TUserEdgeTypes>]: Edge<EdgeDataOf<AllEdgeTypes<TUserEdgeTypes>[K]>, K & string>; }[keyof AllEdgeTypes<TUserEdgeTypes>];
|
|
1106
|
-
type EdgesInput<TUserEdgeTypes extends EdgeTypes> = SolidFlowEdge<TUserEdgeTypes>;
|
|
1107
|
-
/**
|
|
1108
|
-
* Creates a type-safe reactive store of edges for use in Solid Flow.
|
|
1109
|
-
*
|
|
1110
|
-
* This utility function provides full type safety and autocomplete for creating edges,
|
|
1111
|
-
* combining both built-in edge types (default, straight, step, smoothstep) and custom user-defined
|
|
1112
|
-
* edge types. When a specific edge type is selected, TypeScript automatically infers the
|
|
1113
|
-
* required data structure and validates the edge configuration.
|
|
1114
|
-
*
|
|
1115
|
-
* @template TUserEdgeTypes - The user's custom edge types map (optional)
|
|
1116
|
-
* @param edges - Array of edge configurations to create
|
|
1117
|
-
* @returns A SolidJS store tuple [store, setStore] with properly typed Edge objects
|
|
1118
|
-
*
|
|
1119
|
-
* @example
|
|
1120
|
-
* ```typescript
|
|
1121
|
-
* // Using only built-in edge types (no generic parameter needed)
|
|
1122
|
-
* const [builtInEdges, setBuiltInEdges] = createEdgeStore([
|
|
1123
|
-
* {
|
|
1124
|
-
* id: "1",
|
|
1125
|
-
* source: "1",
|
|
1126
|
-
* target: "2",
|
|
1127
|
-
* type: "default",
|
|
1128
|
-
* data: { label: "Start" }
|
|
1129
|
-
* },
|
|
1130
|
-
* {
|
|
1131
|
-
* id: "2",
|
|
1132
|
-
* source: "2",
|
|
1133
|
-
* target: "3",
|
|
1134
|
-
* type: "default",
|
|
1135
|
-
* data: { label: "Process" }
|
|
1136
|
-
* }
|
|
1137
|
-
* ]);
|
|
1138
|
-
* ```
|
|
1139
|
-
*
|
|
1140
|
-
* @example
|
|
1141
|
-
* ```typescript
|
|
1142
|
-
* // Using custom edge types (requires generic parameter)
|
|
1143
|
-
* const customEdgeTypes = {
|
|
1144
|
-
* textEdge: (props: EdgeProps<{ content: string }, "textEdge">) =>
|
|
1145
|
-
* <div>{props.data.content}</div>,
|
|
1146
|
-
* numberEdge: (props: EdgeProps<{ value: number }, "numberEdge">) =>
|
|
1147
|
-
* <div>{props.data.value}</div>
|
|
1148
|
-
* } satisfies EdgeTypes;
|
|
1149
|
-
*
|
|
1150
|
-
* const [mixedEdges, setMixedEdges] = createEdgeStore<typeof customEdgeTypes>([
|
|
1151
|
-
* {
|
|
1152
|
-
* id: "1",
|
|
1153
|
-
* source: "1",
|
|
1154
|
-
* target: "2",
|
|
1155
|
-
* type: "default", // Built-in type
|
|
1156
|
-
* data: { label: "Input" }
|
|
1157
|
-
* },
|
|
1158
|
-
* {
|
|
1159
|
-
* id: "2",
|
|
1160
|
-
* source: "2",
|
|
1161
|
-
* target: "3",
|
|
1162
|
-
* type: "textEdge", // Custom type - gets autocomplete
|
|
1163
|
-
* data: { content: "Custom text edge" } // Type-safe data
|
|
1164
|
-
* },
|
|
1165
|
-
* {
|
|
1166
|
-
* id: "3",
|
|
1167
|
-
* source: "3",
|
|
1168
|
-
* target: "4",
|
|
1169
|
-
* type: "numberEdge", // Another custom type
|
|
1170
|
-
* data: { value: 42 }, // Type-safe data
|
|
1171
|
-
* style: { "background-color": "lightblue" } // All Edge properties available
|
|
1172
|
-
* }
|
|
1173
|
-
* ]);
|
|
1174
|
-
* ```
|
|
1175
|
-
*
|
|
1176
|
-
* @remarks
|
|
1177
|
-
* - Provides autocomplete for the `type` field with all available node types
|
|
1178
|
-
* - Validates `data` structure based on the selected node type
|
|
1179
|
-
* - Supports all Node properties (style, draggable, hidden, etc.)
|
|
1180
|
-
* - Works seamlessly with both built-in and custom node types
|
|
1181
|
-
* - Type errors prevent invalid type names or incorrect data structures
|
|
1182
|
-
*/
|
|
1183
|
-
declare const createEdgeStore: <TUserEdgeTypes extends EdgeTypes = Record<string, never>>(edges: NoInfer<EdgesInput<TUserEdgeTypes>>[]) => readonly [Store<EdgesInput<TUserEdgeTypes>[]>, StoreSetter<EdgesInput<TUserEdgeTypes>[]>];
|
|
1184
|
-
//#endregion
|
|
1185
1103
|
//#region src/core/projections/connections.d.ts
|
|
1186
1104
|
/**
|
|
1187
1105
|
* Lookup keys for the connection index. Each edge is registered under six
|
|
@@ -1335,7 +1253,109 @@ type FlowCommands<NodeType extends Node = Node, EdgeType extends Edge = Edge> =
|
|
|
1335
1253
|
};
|
|
1336
1254
|
};
|
|
1337
1255
|
//#endregion
|
|
1338
|
-
//#region src/core/
|
|
1256
|
+
//#region src/core/stores/createEdgeStore.d.ts
|
|
1257
|
+
type EdgeDataOf<T> = T extends ((props: EdgeProps<infer TData, infer _TType>) => unknown) ? TData : UnknownStruct;
|
|
1258
|
+
type AllEdgeTypes<TUserEdgeTypes extends EdgeTypes> = TUserEdgeTypes extends Record<string, never> ? BuiltInEdgeTypes : BuiltInEdgeTypes & TUserEdgeTypes;
|
|
1259
|
+
/**
|
|
1260
|
+
* The discriminated union of edge configurations for a renderer map: one
|
|
1261
|
+
* member per built-in and custom edge type, with `data` narrowed by the
|
|
1262
|
+
* `type` discriminant (the MAP KEY — what the renderer actually matches).
|
|
1263
|
+
* Use it to carry `createEdgeStore`'s guided typing anywhere a plain array
|
|
1264
|
+
* or vanilla store is typed:
|
|
1265
|
+
*
|
|
1266
|
+
* ```typescript
|
|
1267
|
+
* const initialEdges = [
|
|
1268
|
+
* { id: "e1", source: "1", target: "2", type: "labeled", data: { label: "hi" } },
|
|
1269
|
+
* ] satisfies SolidFlowEdge<typeof edgeTypes>[];
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
type SolidFlowEdge<TUserEdgeTypes extends EdgeTypes = Record<string, never>> = { [K in keyof AllEdgeTypes<TUserEdgeTypes>]: Edge<EdgeDataOf<AllEdgeTypes<TUserEdgeTypes>[K]>, K & string>; }[keyof AllEdgeTypes<TUserEdgeTypes>];
|
|
1273
|
+
type EdgesInput<TUserEdgeTypes extends EdgeTypes> = SolidFlowEdge<TUserEdgeTypes>;
|
|
1274
|
+
/**
|
|
1275
|
+
* Creates a type-safe reactive store of edges for use in Solid Flow.
|
|
1276
|
+
*
|
|
1277
|
+
* This utility function provides full type safety and autocomplete for creating edges,
|
|
1278
|
+
* combining both built-in edge types (default, straight, step, smoothstep) and custom user-defined
|
|
1279
|
+
* edge types. When a specific edge type is selected, TypeScript automatically infers the
|
|
1280
|
+
* required data structure and validates the edge configuration.
|
|
1281
|
+
*
|
|
1282
|
+
* @template TUserEdgeTypes - The user's custom edge types map (optional)
|
|
1283
|
+
* @param edges - Array of edge configurations to create
|
|
1284
|
+
* @returns A SolidJS store tuple [store, setStore] with properly typed Edge objects
|
|
1285
|
+
*
|
|
1286
|
+
* @example
|
|
1287
|
+
* ```typescript
|
|
1288
|
+
* // Using only built-in edge types (no generic parameter needed)
|
|
1289
|
+
* const [builtInEdges, setBuiltInEdges] = createEdgeStore([
|
|
1290
|
+
* {
|
|
1291
|
+
* id: "1",
|
|
1292
|
+
* source: "1",
|
|
1293
|
+
* target: "2",
|
|
1294
|
+
* type: "default",
|
|
1295
|
+
* data: { label: "Start" }
|
|
1296
|
+
* },
|
|
1297
|
+
* {
|
|
1298
|
+
* id: "2",
|
|
1299
|
+
* source: "2",
|
|
1300
|
+
* target: "3",
|
|
1301
|
+
* type: "default",
|
|
1302
|
+
* data: { label: "Process" }
|
|
1303
|
+
* }
|
|
1304
|
+
* ]);
|
|
1305
|
+
* ```
|
|
1306
|
+
*
|
|
1307
|
+
* @example
|
|
1308
|
+
* ```typescript
|
|
1309
|
+
* // Using custom edge types (requires generic parameter)
|
|
1310
|
+
* const customEdgeTypes = {
|
|
1311
|
+
* textEdge: (props: EdgeProps<{ content: string }, "textEdge">) =>
|
|
1312
|
+
* <div>{props.data.content}</div>,
|
|
1313
|
+
* numberEdge: (props: EdgeProps<{ value: number }, "numberEdge">) =>
|
|
1314
|
+
* <div>{props.data.value}</div>
|
|
1315
|
+
* } satisfies EdgeTypes;
|
|
1316
|
+
*
|
|
1317
|
+
* const [mixedEdges, setMixedEdges] = createEdgeStore<typeof customEdgeTypes>([
|
|
1318
|
+
* {
|
|
1319
|
+
* id: "1",
|
|
1320
|
+
* source: "1",
|
|
1321
|
+
* target: "2",
|
|
1322
|
+
* type: "default", // Built-in type
|
|
1323
|
+
* data: { label: "Input" }
|
|
1324
|
+
* },
|
|
1325
|
+
* {
|
|
1326
|
+
* id: "2",
|
|
1327
|
+
* source: "2",
|
|
1328
|
+
* target: "3",
|
|
1329
|
+
* type: "textEdge", // Custom type - gets autocomplete
|
|
1330
|
+
* data: { content: "Custom text edge" } // Type-safe data
|
|
1331
|
+
* },
|
|
1332
|
+
* {
|
|
1333
|
+
* id: "3",
|
|
1334
|
+
* source: "3",
|
|
1335
|
+
* target: "4",
|
|
1336
|
+
* type: "numberEdge", // Another custom type
|
|
1337
|
+
* data: { value: 42 }, // Type-safe data
|
|
1338
|
+
* style: { "background-color": "lightblue" } // All Edge properties available
|
|
1339
|
+
* }
|
|
1340
|
+
* ]);
|
|
1341
|
+
* ```
|
|
1342
|
+
*
|
|
1343
|
+
* @remarks
|
|
1344
|
+
* - Provides autocomplete for the `type` field with all available edge types
|
|
1345
|
+
* - Validates `data` structure based on the selected edge type
|
|
1346
|
+
* - Supports all Edge properties (style, animated, selectable, etc.)
|
|
1347
|
+
* - Works seamlessly with both built-in and custom edge types
|
|
1348
|
+
* - Type errors prevent invalid type names or incorrect data structures
|
|
1349
|
+
*/
|
|
1350
|
+
/**
|
|
1351
|
+
* Also accepts an async seed ("Fetch High"): pass `async () => edges`
|
|
1352
|
+
* instead of an array. Reads throw `NotReadyError` until the first value
|
|
1353
|
+
* (cover the flow with `<Loading fallback>`); afterwards the store is an
|
|
1354
|
+
* ordinary writable store. See {@link createNodeStore} for details.
|
|
1355
|
+
*/
|
|
1356
|
+
declare const createEdgeStore: <TUserEdgeTypes extends EdgeTypes = Record<string, never>>(edges: NoInfer<EdgesInput<TUserEdgeTypes>>[] | (() => Promise<NoInfer<EdgesInput<TUserEdgeTypes>>[]>)) => readonly [Store<EdgesInput<TUserEdgeTypes>[]>, StoreSetter<EdgesInput<TUserEdgeTypes>[]>];
|
|
1357
|
+
//#endregion
|
|
1358
|
+
//#region src/core/stores/createNodeStore.d.ts
|
|
1339
1359
|
type NodeDataOf<T> = T extends ((props: NodeProps<infer TData, infer _TType>) => unknown) ? TData : UnknownStruct;
|
|
1340
1360
|
type AllNodeTypes<TUserNodeTypes extends NodeTypes> = TUserNodeTypes extends Record<string, never> ? BuiltInNodeTypes : BuiltInNodeTypes & TUserNodeTypes;
|
|
1341
1361
|
/**
|
|
@@ -1424,7 +1444,16 @@ type NodesInput<TUserNodeTypes extends NodeTypes> = SolidFlowNode<TUserNodeTypes
|
|
|
1424
1444
|
* - Works seamlessly with both built-in and custom node types
|
|
1425
1445
|
* - Type errors prevent invalid type names or incorrect data structures
|
|
1426
1446
|
*/
|
|
1427
|
-
|
|
1447
|
+
/**
|
|
1448
|
+
* Also accepts an async seed ("Fetch High"): pass `async () => nodes` —
|
|
1449
|
+
* typically an API call — instead of an array. No memo required: the
|
|
1450
|
+
* function goes straight to `createStore`'s projection derive, so reads
|
|
1451
|
+
* throw `NotReadyError` until the first value (cover the flow with
|
|
1452
|
+
* `<Loading fallback>`), and the graph retries them when the data lands.
|
|
1453
|
+
* Afterwards the store is an ordinary writable store — draft writes and
|
|
1454
|
+
* wholesale replacement work exactly like the array form.
|
|
1455
|
+
*/
|
|
1456
|
+
declare const createNodeStore: <TUserNodeTypes extends NodeTypes = Record<string, never>>(nodes: NoInfer<NodesInput<TUserNodeTypes>>[] | (() => Promise<NoInfer<NodesInput<TUserNodeTypes>>[]>)) => readonly [Store<NodesInput<TUserNodeTypes>[]>, StoreSetter<NodesInput<TUserNodeTypes>[]>];
|
|
1428
1457
|
//#endregion
|
|
1429
1458
|
//#region src/hooks/useColorMode.d.ts
|
|
1430
1459
|
/**
|
|
@@ -1506,6 +1535,25 @@ declare function useViewportInitialized(): Accessor<boolean>;
|
|
|
1506
1535
|
*/
|
|
1507
1536
|
declare function useInternalNode(id: Accessor<string>): Accessor<InternalNode | undefined>;
|
|
1508
1537
|
//#endregion
|
|
1538
|
+
//#region src/hooks/useKeyPress.d.ts
|
|
1539
|
+
/**
|
|
1540
|
+
* Reactive "is this key (combo) held right now?" — the Solid Flow
|
|
1541
|
+
* counterpart of React Flow's `useKeyPress`, usable anywhere (no flow
|
|
1542
|
+
* context required).
|
|
1543
|
+
*
|
|
1544
|
+
* The definition is an Accessor per house convention — `useKeyPress(() =>
|
|
1545
|
+
* "a")`, `useKeyPress(() => ["a", "d"])`, or `useKeyPress(() => ({ key:
|
|
1546
|
+
* "s", modifier: ["meta"] }))`; swapping the definition resets the state.
|
|
1547
|
+
*
|
|
1548
|
+
* Hardened beyond upstream:
|
|
1549
|
+
* - Combos re-activate when the base key is re-pressed while the modifier
|
|
1550
|
+
* stays held (upstream's oldest open key bug, xyflow#2248).
|
|
1551
|
+
* - Stuck modifiers self-heal from the flags later keyboard/pointer/wheel
|
|
1552
|
+
* events carry (OS overlays swallow keyups without blurring — the macOS
|
|
1553
|
+
* screenshot HUD; xyflow#5679), and window blur resets.
|
|
1554
|
+
*/
|
|
1555
|
+
declare function useKeyPress(keys: Accessor<KeyDefinition | KeyDefinition[] | null>): Accessor<boolean>;
|
|
1556
|
+
//#endregion
|
|
1509
1557
|
//#region src/hooks/useNodeConnections.d.ts
|
|
1510
1558
|
type UseNodeConnectionsParams = {
|
|
1511
1559
|
id?: string;
|
|
@@ -1753,6 +1801,12 @@ type MiniMapProps<NodeType extends Node> = Omit<JSX.HTMLAttributes<HTMLDivElemen
|
|
|
1753
1801
|
readonly inversePan?: boolean;
|
|
1754
1802
|
/** Step size for zooming in/out */
|
|
1755
1803
|
readonly zoomStep?: number;
|
|
1804
|
+
/**
|
|
1805
|
+
* Scales the padding around the graph inside the minimap (multiplied by
|
|
1806
|
+
* the minimap's view scale). Upstream parity.
|
|
1807
|
+
* @default 5
|
|
1808
|
+
*/
|
|
1809
|
+
readonly offsetScale?: number;
|
|
1756
1810
|
};
|
|
1757
1811
|
/** Miniature overview map of the whole flow, with optional pan/zoom interaction. */
|
|
1758
1812
|
declare const MiniMap: <NodeType extends Node>(props: ParentProps<Partial<MiniMapProps<NodeType>>>) => JSX.Element;
|
|
@@ -1945,4 +1999,4 @@ declare const getEdgeCenter: typeof getEdgeCenter$1;
|
|
|
1945
1999
|
/** Returns the label center and offsets for a bezier edge. */
|
|
1946
2000
|
declare const getBezierEdgeCenter: typeof getBezierEdgeCenter$1;
|
|
1947
2001
|
//#endregion
|
|
1948
|
-
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, 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, 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 SolidFlowEdge, type SolidFlowInitialProps, type SolidFlowNode, 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 };
|
|
2002
|
+
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, 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, 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 SolidFlowEdge, type SolidFlowInitialProps, type SolidFlowNode, 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, useKeyPress, useNodeConnections, useNodeId, useNodes, useNodesData, useNodesInitialized, useSolidFlow, useUpdateNodeInternals, useViewport, useViewportInitialized };
|