@statelyai/flow-react 0.6.0 → 0.7.1
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 +51 -8
- package/dist/esm/backgrounds.d.ts +13 -7
- package/dist/esm/backgrounds.js +1 -95
- package/dist/esm/backgrounds2.js +124 -0
- package/dist/esm/index.d.ts +206 -36
- package/dist/esm/index.js +1109 -221
- package/package.json +14 -11
- package/dist/esm/FlowInstanceContext.js +0 -20
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Background, BackgroundProps, BackgroundVariant, CrossBackground, DotsBackground, LinesBackground } from "./backgrounds.js";
|
|
2
|
+
import { FlowView, ResolvedFlowColorMode } from "@statelyai/flow-dom";
|
|
3
|
+
import { ActiveGraphProjection, AnchorSpec, ConnectionEndedEvent, ConnectionState, CreateEdgeInput, CreateFlowOptions, EdgePathData, FlowColorMode, FlowCommitEvent, FlowConnection, FlowController, FlowEdge, FlowGraph, FlowInputMode, FlowKeymap, FlowNode, FlowProfile, FlowStoreContext, GraphEdgeAttrs, GraphNodeAttrs, LayoutRequestedEvent, Point, Rect, ResizeHandle, Viewport, VisualPort } from "@statelyai/flow";
|
|
4
|
+
import { CSSProperties, ComponentPropsWithoutRef, HTMLAttributes, ReactNode, Ref, RefObject } from "react";
|
|
5
5
|
export * from "@statelyai/flow-dom";
|
|
6
|
-
|
|
7
6
|
//#region src/createFlowInstance.d.ts
|
|
8
7
|
type FlowSelector<T> = (context: FlowStoreContext) => T;
|
|
9
8
|
type FlowSelectorEquality<T> = (current: T, next: T) => boolean;
|
|
@@ -16,15 +15,21 @@ type FlowStoreListener<T = unknown> = {
|
|
|
16
15
|
type FlowEventListeners = {
|
|
17
16
|
connectionEnded?: (event: ConnectionEndedEvent) => void;
|
|
18
17
|
layoutRequested?: (event: LayoutRequestedEvent) => void;
|
|
18
|
+
commit?: (event: FlowCommitEvent) => void;
|
|
19
19
|
};
|
|
20
|
-
type FlowInstanceSettings = Omit<CreateFlowOptions, "graph"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
type FlowInstanceSettings<TNodeData = any, TEdgeData = any, TLabelData = any> = Omit<CreateFlowOptions<TNodeData, TEdgeData, TLabelData>, "graph"> & {
|
|
21
|
+
defaultEdgeOptions?: Partial<CreateEdgeInput>;
|
|
22
|
+
keymap?: Partial<FlowKeymap>;
|
|
23
|
+
};
|
|
24
|
+
type CreateFlowInstanceOptions<TNodeData = any, TEdgeData = any, TLabelData = any> = {
|
|
25
|
+
/** Initial graph seed. After creation, the flow instance owns the graph. */
|
|
26
|
+
initialGraph?: FlowGraph<TNodeData, TEdgeData, TLabelData>;
|
|
27
|
+
settings?: FlowInstanceSettings<TNodeData, TEdgeData, TLabelData>;
|
|
24
28
|
listeners?: FlowStoreListener[];
|
|
25
29
|
events?: FlowEventListeners;
|
|
30
|
+
onCommit?: (event: FlowCommitEvent<TNodeData, TEdgeData, TLabelData>) => void;
|
|
26
31
|
};
|
|
27
|
-
type FlowInstance = FlowController & {
|
|
32
|
+
type FlowInstance<TNodeData = any, TEdgeData = any, TLabelData = any> = FlowController<TNodeData, TEdgeData, TLabelData> & {
|
|
28
33
|
getSnapshot(): FlowStoreContext;
|
|
29
34
|
/**
|
|
30
35
|
* Convert window client coordinates (e.g. `event.clientX/Y` from drops or
|
|
@@ -33,31 +38,51 @@ type FlowInstance = FlowController & {
|
|
|
33
38
|
* container-relative pixels.
|
|
34
39
|
*/
|
|
35
40
|
clientToCanvas(point: Point): Point;
|
|
41
|
+
/**
|
|
42
|
+
* Input-layer defaults consumed by `useFlowInput`/`StatelyFlow`. Not part of
|
|
43
|
+
* the core store/engine — these settings are applied when a container is
|
|
44
|
+
* bound to the input runtime. `keymap` here acts as the instance-level
|
|
45
|
+
* default; an explicit `<StatelyFlow settings.keymap>` (or `useFlowInput`
|
|
46
|
+
* `keymap` option) takes precedence.
|
|
47
|
+
*/
|
|
48
|
+
inputSettings: {
|
|
49
|
+
keymap?: Partial<FlowKeymap>;
|
|
50
|
+
};
|
|
51
|
+
configure: FlowController<TNodeData, TEdgeData, TLabelData>["configure"];
|
|
36
52
|
listen<T>(selector: FlowSelector<T>, listener: FlowStoreListener<T>["onChange"], options?: {
|
|
37
53
|
isEqual?: FlowSelectorEquality<T>;
|
|
38
54
|
fireImmediately?: boolean;
|
|
39
55
|
}): () => void;
|
|
40
56
|
};
|
|
41
|
-
declare function createFlowInstance(options: CreateFlowInstanceOptions): FlowInstance
|
|
57
|
+
declare function createFlowInstance<TNodeData = any, TEdgeData = any, TLabelData = any>(options: CreateFlowInstanceOptions<TNodeData, TEdgeData, TLabelData>): FlowInstance<TNodeData, TEdgeData, TLabelData>;
|
|
42
58
|
//#endregion
|
|
43
59
|
//#region src/FlowInstanceContext.d.ts
|
|
44
60
|
declare function FlowInstanceProvider(props: {
|
|
45
61
|
flow: FlowInstance;
|
|
46
62
|
children: ReactNode;
|
|
47
|
-
}):
|
|
63
|
+
}): import("react").JSX.Element;
|
|
48
64
|
declare function useFlowInstance(): FlowInstance;
|
|
49
65
|
declare function useOptionalFlowInstance(): FlowInstance | null;
|
|
50
66
|
//#endregion
|
|
51
67
|
//#region src/hooks.d.ts
|
|
52
|
-
type UseCreateFlowInstanceOptions = CreateFlowInstanceOptions
|
|
53
|
-
type UseFlowOptions = UseCreateFlowInstanceOptions
|
|
54
|
-
declare function useFlow(options: UseFlowOptions): FlowInstance
|
|
55
|
-
|
|
68
|
+
type UseCreateFlowInstanceOptions<TNodeData = any, TEdgeData = any, TLabelData = any> = CreateFlowInstanceOptions<TNodeData, TEdgeData, TLabelData>;
|
|
69
|
+
type UseFlowOptions<TNodeData = any, TEdgeData = any, TLabelData = any> = UseCreateFlowInstanceOptions<TNodeData, TEdgeData, TLabelData>;
|
|
70
|
+
declare function useFlow<TNodeData = any, TEdgeData = any, TLabelData = any>(options: UseFlowOptions<TNodeData, TEdgeData, TLabelData>): FlowInstance<TNodeData, TEdgeData, TLabelData>;
|
|
71
|
+
/** @deprecated Use `useFlow(options)`. */
|
|
72
|
+
declare function useCreateFlowInstance<TNodeData = any, TEdgeData = any, TLabelData = any>(options: UseCreateFlowInstanceOptions<TNodeData, TEdgeData, TLabelData>): FlowInstance<TNodeData, TEdgeData, TLabelData>;
|
|
56
73
|
declare function useFlowSelector<T>(selector: FlowSelector<T>, options?: {
|
|
57
74
|
flow?: FlowInstance;
|
|
58
75
|
isEqual?: FlowSelectorEquality<T>;
|
|
59
76
|
}): T;
|
|
60
77
|
declare function useFlowContext(): FlowStoreContext;
|
|
78
|
+
declare function useConnection(): FlowStoreContext['connection'];
|
|
79
|
+
declare function useFlowConnections(input: {
|
|
80
|
+
nodeId: string;
|
|
81
|
+
port?: string | null;
|
|
82
|
+
direction?: 'in' | 'out' | 'both';
|
|
83
|
+
}): FlowConnection[];
|
|
84
|
+
declare function useNodesInitialized(): boolean;
|
|
85
|
+
declare function useKeyPress(keys: string | string[]): boolean;
|
|
61
86
|
/**
|
|
62
87
|
* Like `useFlowSelector`, but subscribed through the entity-change notifier:
|
|
63
88
|
* the selector re-runs only when the entity with `id` may have changed, not
|
|
@@ -95,18 +120,23 @@ declare function useFlowViewport(): Viewport;
|
|
|
95
120
|
declare function useFlowMeasurement(id: string): Rect | null;
|
|
96
121
|
//#endregion
|
|
97
122
|
//#region src/useFlowInput.d.ts
|
|
123
|
+
type KeyboardTarget = "window" | "container" | HTMLElement;
|
|
98
124
|
type UseFlowInputOptions = {
|
|
99
125
|
/**
|
|
100
126
|
* Input modes, or a resolver from store context. Defaults to the store
|
|
101
127
|
* profile's input modes (when a profile is given) and otherwise to the
|
|
102
128
|
* core default set, which follows the store's `context.mode`
|
|
103
129
|
* (interactive / readonly). Initial-only: changes after mount are ignored —
|
|
104
|
-
* swap behavior at runtime via `flow.trigger.setMode(...)` or a
|
|
130
|
+
* swap behavior at runtime via `flow.internals.store.trigger.setMode(...)` or a
|
|
105
131
|
* context-aware resolver.
|
|
106
132
|
*/
|
|
107
133
|
modes?: FlowInputMode[] | ((context: FlowStoreContext) => FlowInputMode[]);
|
|
108
134
|
/** Store profile whose per-mode `input.modes` drive the runtime. */
|
|
109
135
|
profile?: FlowProfile;
|
|
136
|
+
/** Keyboard listener target. Defaults to the flow container. */
|
|
137
|
+
keyboardTarget?: KeyboardTarget;
|
|
138
|
+
/** Built-in shortcut overrides. */
|
|
139
|
+
keymap?: Partial<FlowKeymap>;
|
|
110
140
|
};
|
|
111
141
|
/**
|
|
112
142
|
* Bind a container element to the core input runtime: all pointer, wheel,
|
|
@@ -115,11 +145,18 @@ type UseFlowInputOptions = {
|
|
|
115
145
|
*/
|
|
116
146
|
declare function useFlowInput(flow: FlowInstance, containerRef: RefObject<HTMLElement | null>, options?: UseFlowInputOptions): void;
|
|
117
147
|
//#endregion
|
|
148
|
+
//#region src/useFlowView.d.ts
|
|
149
|
+
declare function useFlowView(): FlowView;
|
|
150
|
+
//#endregion
|
|
118
151
|
//#region src/StatelyFlow.d.ts
|
|
152
|
+
type ReactGraphNodeAttrs = GraphNodeAttrs<CSSProperties, ReactNode>;
|
|
153
|
+
type ReactGraphEdgeAttrs = GraphEdgeAttrs<CSSProperties, ReactNode>;
|
|
154
|
+
type ReactActiveGraphProjection = ActiveGraphProjection<any, any, CSSProperties, ReactNode>;
|
|
119
155
|
type RenderNodeProps<TNodeData = unknown> = {
|
|
120
|
-
flow: FlowInstance
|
|
156
|
+
flow: FlowInstance<TNodeData>;
|
|
121
157
|
node: FlowNode<TNodeData>;
|
|
122
158
|
bounds: Rect;
|
|
159
|
+
attrs: ReactGraphNodeAttrs;
|
|
123
160
|
selected: boolean;
|
|
124
161
|
dragging: boolean;
|
|
125
162
|
hovered: boolean;
|
|
@@ -129,9 +166,10 @@ type RenderNodeProps<TNodeData = unknown> = {
|
|
|
129
166
|
}>;
|
|
130
167
|
};
|
|
131
168
|
type RenderEdgeProps<TEdgeData = unknown> = {
|
|
132
|
-
flow: FlowInstance
|
|
169
|
+
flow: FlowInstance<any, TEdgeData>;
|
|
133
170
|
edge: FlowEdge<TEdgeData>;
|
|
134
171
|
pathData: EdgePathData;
|
|
172
|
+
attrs: ReactGraphEdgeAttrs;
|
|
135
173
|
selected: boolean;
|
|
136
174
|
hovered: boolean;
|
|
137
175
|
highlights: ReadonlyArray<{
|
|
@@ -139,14 +177,26 @@ type RenderEdgeProps<TEdgeData = unknown> = {
|
|
|
139
177
|
meta: unknown;
|
|
140
178
|
}>;
|
|
141
179
|
};
|
|
142
|
-
type
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
180
|
+
type RenderEdgeLabelProps<TEdgeData = unknown> = RenderEdgeProps<TEdgeData> & {
|
|
181
|
+
bounds: Rect;
|
|
182
|
+
dragging: boolean;
|
|
183
|
+
};
|
|
184
|
+
type RenderConnectionLineProps = {
|
|
185
|
+
connection: ConnectionState;
|
|
186
|
+
pathData: EdgePathData;
|
|
187
|
+
isValid: boolean;
|
|
188
|
+
};
|
|
189
|
+
type StatelyFlowRootProps = Omit<ComponentPropsWithoutRef<"div">, "children" | "ref">;
|
|
190
|
+
type StatelyFlowBaseProps<TNodeData = unknown, TEdgeData = unknown> = {
|
|
191
|
+
settings?: FlowInstanceSettings<TNodeData, TEdgeData>;
|
|
146
192
|
listeners?: FlowStoreListener[];
|
|
147
193
|
events?: FlowEventListeners;
|
|
194
|
+
/** Controlled projection override; omit to use `flow` projection lifecycle APIs. */
|
|
195
|
+
projections?: readonly ReactActiveGraphProjection[];
|
|
148
196
|
renderNode?: (props: RenderNodeProps<TNodeData>) => ReactNode;
|
|
149
197
|
renderEdge?: (props: RenderEdgeProps<TEdgeData>) => ReactNode;
|
|
198
|
+
renderEdgeLabel?: (props: RenderEdgeLabelProps<TEdgeData>) => ReactNode;
|
|
199
|
+
renderConnectionLine?: (props: RenderConnectionLineProps) => ReactNode;
|
|
150
200
|
/**
|
|
151
201
|
* Only mount nodes/edges that intersect the viewport (plus an overscan
|
|
152
202
|
* margin). Recommended for large graphs.
|
|
@@ -165,12 +215,47 @@ type StatelyFlowProps<TNodeData = unknown, TEdgeData = unknown> = {
|
|
|
165
215
|
* ```
|
|
166
216
|
*/
|
|
167
217
|
inputModes?: FlowInputMode[] | ((context: FlowStoreContext) => FlowInputMode[]);
|
|
218
|
+
/** Keyboard listener target. Defaults to this flow's root container. */
|
|
219
|
+
keyboardTarget?: "window" | "container" | HTMLElement;
|
|
168
220
|
className?: string;
|
|
169
221
|
style?: CSSProperties;
|
|
222
|
+
/** Ref to the same root element owned by Flow's input runtime. */
|
|
223
|
+
rootRef?: Ref<HTMLDivElement>;
|
|
224
|
+
/** Native root div attributes and events; className/style merge with the top-level props. */
|
|
225
|
+
rootProps?: StatelyFlowRootProps;
|
|
170
226
|
background?: ReactNode;
|
|
227
|
+
/** Custom content in fixed viewport- and pane-coordinate layers. */
|
|
228
|
+
layers?: {
|
|
229
|
+
viewport?: ReactNode;
|
|
230
|
+
pane?: ReactNode;
|
|
231
|
+
};
|
|
171
232
|
children?: ReactNode;
|
|
172
233
|
};
|
|
173
|
-
|
|
234
|
+
type StatelyFlowWithInstanceProps<TNodeData = unknown, TEdgeData = unknown> = StatelyFlowBaseProps<TNodeData, TEdgeData> & {
|
|
235
|
+
/** Existing owned flow instance. Do not pass graph props with this mode. */
|
|
236
|
+
flow: FlowInstance<TNodeData, TEdgeData>;
|
|
237
|
+
initialGraph?: never;
|
|
238
|
+
onCommit?: never;
|
|
239
|
+
};
|
|
240
|
+
type StatelyFlowInitialGraphProps<TNodeData = unknown, TEdgeData = unknown> = StatelyFlowBaseProps<TNodeData, TEdgeData> & {
|
|
241
|
+
flow?: never;
|
|
242
|
+
/** Initial graph seed. After creation, the flow instance owns the graph. */
|
|
243
|
+
initialGraph?: FlowGraph<TNodeData, TEdgeData>;
|
|
244
|
+
/** Observe graph changes from the owned instance for persistence/sync. */
|
|
245
|
+
onCommit?: FlowEventListeners["commit"];
|
|
246
|
+
};
|
|
247
|
+
type StatelyFlowProps<TNodeData = unknown, TEdgeData = unknown> = StatelyFlowWithInstanceProps<TNodeData, TEdgeData> | StatelyFlowInitialGraphProps<TNodeData, TEdgeData>;
|
|
248
|
+
declare function StatelyFlow<TNodeData = unknown, TEdgeData = unknown>(props: StatelyFlowProps<TNodeData, TEdgeData>): import("react").JSX.Element;
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/LayerPortals.d.ts
|
|
251
|
+
/** Render canvas-coordinate content in the transformed viewport layer. */
|
|
252
|
+
declare function ViewportPortal(props: {
|
|
253
|
+
children: ReactNode;
|
|
254
|
+
}): import("react").ReactPortal | null;
|
|
255
|
+
/** Render screen-coordinate content in the untransformed pane layer. */
|
|
256
|
+
declare function PanePortal(props: {
|
|
257
|
+
children: ReactNode;
|
|
258
|
+
}): import("react").ReactPortal | null;
|
|
174
259
|
//#endregion
|
|
175
260
|
//#region src/FlowToolbar.d.ts
|
|
176
261
|
/** Border-box size of an element, kept current via ResizeObserver. */
|
|
@@ -212,7 +297,7 @@ type FlowToolbarProps = UseFlowToolbarOptions & {
|
|
|
212
297
|
* Marked `data-flow-interactive`, so its contents receive pointer events
|
|
213
298
|
* unopposed by canvas gestures.
|
|
214
299
|
*/
|
|
215
|
-
declare function FlowToolbar(props: FlowToolbarProps):
|
|
300
|
+
declare function FlowToolbar(props: FlowToolbarProps): import("react").JSX.Element | null;
|
|
216
301
|
//#endregion
|
|
217
302
|
//#region src/MiniMap.d.ts
|
|
218
303
|
type MiniMapProps = {
|
|
@@ -231,12 +316,21 @@ type MiniMapProps = {
|
|
|
231
316
|
* plain store trigger — this component is exactly what you would write in
|
|
232
317
|
* userland, kept here as a convenience.
|
|
233
318
|
*/
|
|
234
|
-
declare function MiniMap(props: MiniMapProps):
|
|
319
|
+
declare function MiniMap(props: MiniMapProps): import("react").JSX.Element;
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/Panel.d.ts
|
|
322
|
+
type PanelPosition = "top-left" | "top-center" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
323
|
+
type PanelProps = Omit<HTMLAttributes<HTMLDivElement>, "style"> & {
|
|
324
|
+
position?: PanelPosition;
|
|
325
|
+
style?: CSSProperties;
|
|
326
|
+
};
|
|
327
|
+
declare function Panel(props: PanelProps): import("react").JSX.Element;
|
|
235
328
|
//#endregion
|
|
236
329
|
//#region src/Controls.d.ts
|
|
237
330
|
type ControlsProps = {
|
|
238
331
|
className?: string;
|
|
239
332
|
style?: CSSProperties;
|
|
333
|
+
position?: PanelPosition;
|
|
240
334
|
/** Extra buttons appended after the built-ins. */
|
|
241
335
|
children?: ReactNode;
|
|
242
336
|
};
|
|
@@ -244,18 +338,36 @@ type ControlsProps = {
|
|
|
244
338
|
* Zoom/fit toolbar. Deliberately thin: every button is one store trigger
|
|
245
339
|
* (`zoomBy`, `fitView`) — replicate or extend it freely in userland.
|
|
246
340
|
*/
|
|
247
|
-
declare function Controls(props: ControlsProps):
|
|
341
|
+
declare function Controls(props: ControlsProps): import("react").JSX.Element;
|
|
248
342
|
//#endregion
|
|
249
343
|
//#region src/EntityAnchor.d.ts
|
|
250
|
-
type
|
|
251
|
-
|
|
252
|
-
|
|
344
|
+
type EntityAnchorPoint = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
345
|
+
type EntityAnchorSide = "top" | "bottom" | "left" | "right";
|
|
346
|
+
type EntityAnchorAlign = "start" | "center" | "end";
|
|
347
|
+
type EntityAnchorBaseProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
253
348
|
inverseScale?: boolean;
|
|
254
|
-
|
|
255
|
-
style?: CSSProperties;
|
|
349
|
+
isVisible?: boolean;
|
|
256
350
|
children: ReactNode;
|
|
257
351
|
};
|
|
258
|
-
|
|
352
|
+
type EntityAnchorProps = EntityAnchorBaseProps & ({
|
|
353
|
+
/** Canvas-space bounds for a free-standing anchor. */
|
|
354
|
+
bounds: Rect;
|
|
355
|
+
anchor: AnchorSpec;
|
|
356
|
+
side?: never;
|
|
357
|
+
align?: never;
|
|
358
|
+
offset?: never;
|
|
359
|
+
} | {
|
|
360
|
+
/** Side of the containing entity. The anchor follows its parent DOM transform. */
|
|
361
|
+
side: EntityAnchorSide;
|
|
362
|
+
/** Point on the child placed at the entity-side location. */
|
|
363
|
+
anchor?: EntityAnchorPoint;
|
|
364
|
+
/** Cross-axis placement on the entity side. */
|
|
365
|
+
align?: EntityAnchorAlign;
|
|
366
|
+
/** Outward screen-pixel gap from the entity side. */
|
|
367
|
+
offset?: number;
|
|
368
|
+
bounds?: never;
|
|
369
|
+
});
|
|
370
|
+
declare function EntityAnchor(props: EntityAnchorProps): import("react").JSX.Element | null;
|
|
259
371
|
//#endregion
|
|
260
372
|
//#region src/Port.d.ts
|
|
261
373
|
type PortProps = {
|
|
@@ -289,7 +401,65 @@ type PortProps = {
|
|
|
289
401
|
* observe results via `flow.on("connectionEnded", …)` or the store's
|
|
290
402
|
* `connection` state.
|
|
291
403
|
*/
|
|
292
|
-
declare function Port(props: PortProps):
|
|
404
|
+
declare function Port(props: PortProps): import("react").JSX.Element;
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/DragHandle.d.ts
|
|
407
|
+
type DragHandleProps = HTMLAttributes<HTMLDivElement> & {
|
|
408
|
+
children?: ReactNode;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Marks a region inside a custom node as the *only* draggable area. When a node
|
|
412
|
+
* renders a `<DragHandle>`, pointer presses elsewhere on the node no longer
|
|
413
|
+
* start a drag (they select/pass through) — the input runtime only begins a
|
|
414
|
+
* move when the press lands inside an element carrying `data-flow-drag-handle`.
|
|
415
|
+
*
|
|
416
|
+
* Render it anywhere inside your node's markup:
|
|
417
|
+
*
|
|
418
|
+
* ```tsx
|
|
419
|
+
* function MyNode(props) {
|
|
420
|
+
* return (
|
|
421
|
+
* <div>
|
|
422
|
+
* <DragHandle>⠿ title bar</DragHandle>
|
|
423
|
+
* <div>…non-draggable body…</div>
|
|
424
|
+
* </div>
|
|
425
|
+
* );
|
|
426
|
+
* }
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
declare function DragHandle({ children, style, ...rest }: DragHandleProps): import("react").JSX.Element;
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/NodeResizer.d.ts
|
|
432
|
+
type NodeResizerProps = {
|
|
433
|
+
handles?: ResizeHandle[];
|
|
434
|
+
/** Defaults to node selection state. Constraints belong on `node.resize`. */
|
|
435
|
+
isVisible?: boolean;
|
|
436
|
+
className?: string;
|
|
437
|
+
style?: CSSProperties;
|
|
438
|
+
};
|
|
439
|
+
declare function NodeResizer(props: NodeResizerProps): import("react").JSX.Element | null;
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/baseStyles.d.ts
|
|
442
|
+
/**
|
|
443
|
+
* Minimal base stylesheet for the flow canvas. Intentionally tiny and
|
|
444
|
+
* inert-by-default: it only styles elements that opt in via `data-flow-*`
|
|
445
|
+
* attributes, and every visual value is a namespaced `--flow-*` CSS variable
|
|
446
|
+
* so consumers can theme it (set the variable on the canvas root or any
|
|
447
|
+
* ancestor) without overriding rules.
|
|
448
|
+
*
|
|
449
|
+
* Attributes:
|
|
450
|
+
* - `data-flow-interactive-when-selected` — the element ignores all pointer /
|
|
451
|
+
* wheel input (so canvas pan/zoom and box-select pass straight through it,
|
|
452
|
+
* e.g. over an embedded `<iframe>`) until its node/edge is selected, at which
|
|
453
|
+
* point it becomes fully interactive. Mark the embedded content, not the
|
|
454
|
+
* whole node, so ports and the selecting click still work. Don't also set an
|
|
455
|
+
* inline `pointer-events` on the same element — inline wins over this rule.
|
|
456
|
+
* - `data-flow-selection-box` — the box-select marquee (styled here; geometry
|
|
457
|
+
* is set inline by the renderer).
|
|
458
|
+
*/
|
|
459
|
+
declare const FLOW_BASE_STYLES_ID = "flow-base-styles";
|
|
460
|
+
declare const FLOW_BASE_CSS = "\n[data-flow-root] {\n --flow-selection-color: #2563eb;\n --flow-selection-bg: rgba(37, 99, 235, 0.12);\n touch-action: none;\n}\n\n[data-flow-interactive-when-selected] {\n pointer-events: none;\n}\n[data-flow-selected=\"true\"] [data-flow-interactive-when-selected] {\n pointer-events: auto;\n}\n\n[data-flow-selection-box] {\n position: absolute;\n box-sizing: border-box;\n border: calc(1px / var(--flow-zoom, 1)) solid var(--flow-selection-color);\n border-radius: calc(2px / var(--flow-zoom, 1));\n background: var(--flow-selection-bg);\n pointer-events: none;\n}\n";
|
|
461
|
+
/** Inject the base stylesheet once per document (deduped by element id). */
|
|
462
|
+
declare function useFlowBaseStyles(): void;
|
|
293
463
|
//#endregion
|
|
294
464
|
//#region src/ColorMode.d.ts
|
|
295
465
|
type FlowColorModeScopeProps = {
|
|
@@ -297,11 +467,11 @@ type FlowColorModeScopeProps = {
|
|
|
297
467
|
className?: string;
|
|
298
468
|
style?: CSSProperties;
|
|
299
469
|
};
|
|
300
|
-
declare function FlowColorModeScope(props: FlowColorModeScopeProps):
|
|
470
|
+
declare function FlowColorModeScope(props: FlowColorModeScopeProps): import("react").JSX.Element;
|
|
301
471
|
declare function useFlowColorMode(): {
|
|
302
472
|
colorMode: FlowColorMode;
|
|
303
473
|
resolvedColorMode: ResolvedFlowColorMode;
|
|
304
474
|
};
|
|
305
475
|
declare function useApplyFlowColorMode(element: HTMLElement | null): void;
|
|
306
476
|
//#endregion
|
|
307
|
-
export { Controls, type ControlsProps, type CreateFlowInstanceOptions, EntityAnchor, type EntityAnchorProps, FlowColorModeScope, type FlowColorModeScopeProps, type FlowEdgeBinding, type FlowEventListeners, type FlowInstance, FlowInstanceProvider, type FlowInstanceSettings, type FlowNodeBinding, type FlowPortBinding, type FlowSelector, type FlowSelectorEquality, type FlowStoreListener, FlowToolbar, type FlowToolbarProps, type FlowToolbarState, MiniMap, type MiniMapProps, Port, type PortProps, type RenderEdgeProps, type RenderNodeProps, StatelyFlow, type StatelyFlowProps, type UseCreateFlowInstanceOptions, type UseFlowInputOptions, type UseFlowOptions, type UseFlowToolbarOptions, createFlowInstance, useApplyFlowColorMode, useCreateFlowInstance, useFlow, useFlowColorMode, useFlowContext, useFlowEdge, useFlowEntity, useFlowInput, useFlowInstance, useFlowMeasurement, useFlowNode, useFlowPort, useFlowSelector, useFlowToolbar, useFlowValue, useFlowViewport, useMeasuredSize, useOptionalFlowInstance };
|
|
477
|
+
export { Background, type BackgroundProps, type BackgroundVariant, Controls, type ControlsProps, type CreateFlowInstanceOptions, CrossBackground, DotsBackground, DragHandle, type DragHandleProps, EntityAnchor, type EntityAnchorAlign, type EntityAnchorPoint, type EntityAnchorProps, type EntityAnchorSide, FLOW_BASE_CSS, FLOW_BASE_STYLES_ID, FlowColorModeScope, type FlowColorModeScopeProps, type FlowEdgeBinding, type FlowEventListeners, type FlowInstance, FlowInstanceProvider, type FlowInstanceSettings, type FlowNodeBinding, type FlowPortBinding, type FlowSelector, type FlowSelectorEquality, type FlowStoreListener, FlowToolbar, type FlowToolbarProps, type FlowToolbarState, LinesBackground, MiniMap, type MiniMapProps, NodeResizer, type NodeResizerProps, PanePortal, Panel, type PanelPosition, type PanelProps, Port, type PortProps, type ReactActiveGraphProjection, type ReactGraphEdgeAttrs, type ReactGraphNodeAttrs, type RenderConnectionLineProps, type RenderEdgeLabelProps, type RenderEdgeProps, type RenderNodeProps, StatelyFlow, type StatelyFlowProps, type StatelyFlowRootProps, type UseCreateFlowInstanceOptions, type UseFlowInputOptions, type UseFlowOptions, type UseFlowToolbarOptions, ViewportPortal, createFlowInstance, useApplyFlowColorMode, useConnection, useCreateFlowInstance, useFlow, useFlowBaseStyles, useFlowColorMode, useFlowConnections, useFlowContext, useFlowEdge, useFlowEntity, useFlowInput, useFlowInstance, useFlowMeasurement, useFlowNode, useFlowPort, useFlowSelector, useFlowToolbar, useFlowValue, useFlowView, useFlowViewport, useKeyPress, useMeasuredSize, useNodesInitialized, useOptionalFlowInstance };
|