@statelyai/flow-react 0.5.0 → 0.7.0
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 +56 -11
- 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 +207 -36
- package/dist/esm/index.js +1110 -221
- package/package.json +17 -13
- package/dist/esm/FlowInstanceContext.js +0 -20
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
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
|
+
export * from "@statelyai/flow-dom";
|
|
6
6
|
//#region src/createFlowInstance.d.ts
|
|
7
7
|
type FlowSelector<T> = (context: FlowStoreContext) => T;
|
|
8
8
|
type FlowSelectorEquality<T> = (current: T, next: T) => boolean;
|
|
@@ -15,15 +15,21 @@ type FlowStoreListener<T = unknown> = {
|
|
|
15
15
|
type FlowEventListeners = {
|
|
16
16
|
connectionEnded?: (event: ConnectionEndedEvent) => void;
|
|
17
17
|
layoutRequested?: (event: LayoutRequestedEvent) => void;
|
|
18
|
+
commit?: (event: FlowCommitEvent) => void;
|
|
18
19
|
};
|
|
19
|
-
type FlowInstanceSettings = Omit<CreateFlowOptions, "graph"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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>;
|
|
23
28
|
listeners?: FlowStoreListener[];
|
|
24
29
|
events?: FlowEventListeners;
|
|
30
|
+
onCommit?: (event: FlowCommitEvent<TNodeData, TEdgeData, TLabelData>) => void;
|
|
25
31
|
};
|
|
26
|
-
type FlowInstance = FlowController & {
|
|
32
|
+
type FlowInstance<TNodeData = any, TEdgeData = any, TLabelData = any> = FlowController<TNodeData, TEdgeData, TLabelData> & {
|
|
27
33
|
getSnapshot(): FlowStoreContext;
|
|
28
34
|
/**
|
|
29
35
|
* Convert window client coordinates (e.g. `event.clientX/Y` from drops or
|
|
@@ -32,31 +38,51 @@ type FlowInstance = FlowController & {
|
|
|
32
38
|
* container-relative pixels.
|
|
33
39
|
*/
|
|
34
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"];
|
|
35
52
|
listen<T>(selector: FlowSelector<T>, listener: FlowStoreListener<T>["onChange"], options?: {
|
|
36
53
|
isEqual?: FlowSelectorEquality<T>;
|
|
37
54
|
fireImmediately?: boolean;
|
|
38
55
|
}): () => void;
|
|
39
56
|
};
|
|
40
|
-
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>;
|
|
41
58
|
//#endregion
|
|
42
59
|
//#region src/FlowInstanceContext.d.ts
|
|
43
60
|
declare function FlowInstanceProvider(props: {
|
|
44
61
|
flow: FlowInstance;
|
|
45
62
|
children: ReactNode;
|
|
46
|
-
}):
|
|
63
|
+
}): import("react").JSX.Element;
|
|
47
64
|
declare function useFlowInstance(): FlowInstance;
|
|
48
65
|
declare function useOptionalFlowInstance(): FlowInstance | null;
|
|
49
66
|
//#endregion
|
|
50
67
|
//#region src/hooks.d.ts
|
|
51
|
-
type UseCreateFlowInstanceOptions = CreateFlowInstanceOptions
|
|
52
|
-
type UseFlowOptions = UseCreateFlowInstanceOptions
|
|
53
|
-
declare function useFlow(options: UseFlowOptions): FlowInstance
|
|
54
|
-
|
|
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>;
|
|
55
73
|
declare function useFlowSelector<T>(selector: FlowSelector<T>, options?: {
|
|
56
74
|
flow?: FlowInstance;
|
|
57
75
|
isEqual?: FlowSelectorEquality<T>;
|
|
58
76
|
}): T;
|
|
59
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;
|
|
60
86
|
/**
|
|
61
87
|
* Like `useFlowSelector`, but subscribed through the entity-change notifier:
|
|
62
88
|
* the selector re-runs only when the entity with `id` may have changed, not
|
|
@@ -94,18 +120,23 @@ declare function useFlowViewport(): Viewport;
|
|
|
94
120
|
declare function useFlowMeasurement(id: string): Rect | null;
|
|
95
121
|
//#endregion
|
|
96
122
|
//#region src/useFlowInput.d.ts
|
|
123
|
+
type KeyboardTarget = "window" | "container" | HTMLElement;
|
|
97
124
|
type UseFlowInputOptions = {
|
|
98
125
|
/**
|
|
99
126
|
* Input modes, or a resolver from store context. Defaults to the store
|
|
100
127
|
* profile's input modes (when a profile is given) and otherwise to the
|
|
101
128
|
* core default set, which follows the store's `context.mode`
|
|
102
129
|
* (interactive / readonly). Initial-only: changes after mount are ignored —
|
|
103
|
-
* swap behavior at runtime via `flow.trigger.setMode(...)` or a
|
|
130
|
+
* swap behavior at runtime via `flow.internals.store.trigger.setMode(...)` or a
|
|
104
131
|
* context-aware resolver.
|
|
105
132
|
*/
|
|
106
133
|
modes?: FlowInputMode[] | ((context: FlowStoreContext) => FlowInputMode[]);
|
|
107
134
|
/** Store profile whose per-mode `input.modes` drive the runtime. */
|
|
108
135
|
profile?: FlowProfile;
|
|
136
|
+
/** Keyboard listener target. Defaults to the flow container. */
|
|
137
|
+
keyboardTarget?: KeyboardTarget;
|
|
138
|
+
/** Built-in shortcut overrides. */
|
|
139
|
+
keymap?: Partial<FlowKeymap>;
|
|
109
140
|
};
|
|
110
141
|
/**
|
|
111
142
|
* Bind a container element to the core input runtime: all pointer, wheel,
|
|
@@ -114,11 +145,18 @@ type UseFlowInputOptions = {
|
|
|
114
145
|
*/
|
|
115
146
|
declare function useFlowInput(flow: FlowInstance, containerRef: RefObject<HTMLElement | null>, options?: UseFlowInputOptions): void;
|
|
116
147
|
//#endregion
|
|
148
|
+
//#region src/useFlowView.d.ts
|
|
149
|
+
declare function useFlowView(): FlowView;
|
|
150
|
+
//#endregion
|
|
117
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>;
|
|
118
155
|
type RenderNodeProps<TNodeData = unknown> = {
|
|
119
|
-
flow: FlowInstance
|
|
156
|
+
flow: FlowInstance<TNodeData>;
|
|
120
157
|
node: FlowNode<TNodeData>;
|
|
121
158
|
bounds: Rect;
|
|
159
|
+
attrs: ReactGraphNodeAttrs;
|
|
122
160
|
selected: boolean;
|
|
123
161
|
dragging: boolean;
|
|
124
162
|
hovered: boolean;
|
|
@@ -128,9 +166,10 @@ type RenderNodeProps<TNodeData = unknown> = {
|
|
|
128
166
|
}>;
|
|
129
167
|
};
|
|
130
168
|
type RenderEdgeProps<TEdgeData = unknown> = {
|
|
131
|
-
flow: FlowInstance
|
|
169
|
+
flow: FlowInstance<any, TEdgeData>;
|
|
132
170
|
edge: FlowEdge<TEdgeData>;
|
|
133
171
|
pathData: EdgePathData;
|
|
172
|
+
attrs: ReactGraphEdgeAttrs;
|
|
134
173
|
selected: boolean;
|
|
135
174
|
hovered: boolean;
|
|
136
175
|
highlights: ReadonlyArray<{
|
|
@@ -138,14 +177,26 @@ type RenderEdgeProps<TEdgeData = unknown> = {
|
|
|
138
177
|
meta: unknown;
|
|
139
178
|
}>;
|
|
140
179
|
};
|
|
141
|
-
type
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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>;
|
|
145
192
|
listeners?: FlowStoreListener[];
|
|
146
193
|
events?: FlowEventListeners;
|
|
194
|
+
/** Controlled projection override; omit to use `flow` projection lifecycle APIs. */
|
|
195
|
+
projections?: readonly ReactActiveGraphProjection[];
|
|
147
196
|
renderNode?: (props: RenderNodeProps<TNodeData>) => ReactNode;
|
|
148
197
|
renderEdge?: (props: RenderEdgeProps<TEdgeData>) => ReactNode;
|
|
198
|
+
renderEdgeLabel?: (props: RenderEdgeLabelProps<TEdgeData>) => ReactNode;
|
|
199
|
+
renderConnectionLine?: (props: RenderConnectionLineProps) => ReactNode;
|
|
149
200
|
/**
|
|
150
201
|
* Only mount nodes/edges that intersect the viewport (plus an overscan
|
|
151
202
|
* margin). Recommended for large graphs.
|
|
@@ -164,12 +215,47 @@ type StatelyFlowProps<TNodeData = unknown, TEdgeData = unknown> = {
|
|
|
164
215
|
* ```
|
|
165
216
|
*/
|
|
166
217
|
inputModes?: FlowInputMode[] | ((context: FlowStoreContext) => FlowInputMode[]);
|
|
218
|
+
/** Keyboard listener target. Defaults to this flow's root container. */
|
|
219
|
+
keyboardTarget?: "window" | "container" | HTMLElement;
|
|
167
220
|
className?: string;
|
|
168
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;
|
|
169
226
|
background?: ReactNode;
|
|
227
|
+
/** Custom content in fixed viewport- and pane-coordinate layers. */
|
|
228
|
+
layers?: {
|
|
229
|
+
viewport?: ReactNode;
|
|
230
|
+
pane?: ReactNode;
|
|
231
|
+
};
|
|
170
232
|
children?: ReactNode;
|
|
171
233
|
};
|
|
172
|
-
|
|
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;
|
|
173
259
|
//#endregion
|
|
174
260
|
//#region src/FlowToolbar.d.ts
|
|
175
261
|
/** Border-box size of an element, kept current via ResizeObserver. */
|
|
@@ -211,7 +297,7 @@ type FlowToolbarProps = UseFlowToolbarOptions & {
|
|
|
211
297
|
* Marked `data-flow-interactive`, so its contents receive pointer events
|
|
212
298
|
* unopposed by canvas gestures.
|
|
213
299
|
*/
|
|
214
|
-
declare function FlowToolbar(props: FlowToolbarProps):
|
|
300
|
+
declare function FlowToolbar(props: FlowToolbarProps): import("react").JSX.Element | null;
|
|
215
301
|
//#endregion
|
|
216
302
|
//#region src/MiniMap.d.ts
|
|
217
303
|
type MiniMapProps = {
|
|
@@ -230,12 +316,21 @@ type MiniMapProps = {
|
|
|
230
316
|
* plain store trigger — this component is exactly what you would write in
|
|
231
317
|
* userland, kept here as a convenience.
|
|
232
318
|
*/
|
|
233
|
-
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;
|
|
234
328
|
//#endregion
|
|
235
329
|
//#region src/Controls.d.ts
|
|
236
330
|
type ControlsProps = {
|
|
237
331
|
className?: string;
|
|
238
332
|
style?: CSSProperties;
|
|
333
|
+
position?: PanelPosition;
|
|
239
334
|
/** Extra buttons appended after the built-ins. */
|
|
240
335
|
children?: ReactNode;
|
|
241
336
|
};
|
|
@@ -243,18 +338,36 @@ type ControlsProps = {
|
|
|
243
338
|
* Zoom/fit toolbar. Deliberately thin: every button is one store trigger
|
|
244
339
|
* (`zoomBy`, `fitView`) — replicate or extend it freely in userland.
|
|
245
340
|
*/
|
|
246
|
-
declare function Controls(props: ControlsProps):
|
|
341
|
+
declare function Controls(props: ControlsProps): import("react").JSX.Element;
|
|
247
342
|
//#endregion
|
|
248
343
|
//#region src/EntityAnchor.d.ts
|
|
249
|
-
type
|
|
250
|
-
|
|
251
|
-
|
|
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"> & {
|
|
252
348
|
inverseScale?: boolean;
|
|
253
|
-
|
|
254
|
-
style?: CSSProperties;
|
|
349
|
+
isVisible?: boolean;
|
|
255
350
|
children: ReactNode;
|
|
256
351
|
};
|
|
257
|
-
|
|
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;
|
|
258
371
|
//#endregion
|
|
259
372
|
//#region src/Port.d.ts
|
|
260
373
|
type PortProps = {
|
|
@@ -288,7 +401,65 @@ type PortProps = {
|
|
|
288
401
|
* observe results via `flow.on("connectionEnded", …)` or the store's
|
|
289
402
|
* `connection` state.
|
|
290
403
|
*/
|
|
291
|
-
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;
|
|
292
463
|
//#endregion
|
|
293
464
|
//#region src/ColorMode.d.ts
|
|
294
465
|
type FlowColorModeScopeProps = {
|
|
@@ -296,11 +467,11 @@ type FlowColorModeScopeProps = {
|
|
|
296
467
|
className?: string;
|
|
297
468
|
style?: CSSProperties;
|
|
298
469
|
};
|
|
299
|
-
declare function FlowColorModeScope(props: FlowColorModeScopeProps):
|
|
470
|
+
declare function FlowColorModeScope(props: FlowColorModeScopeProps): import("react").JSX.Element;
|
|
300
471
|
declare function useFlowColorMode(): {
|
|
301
472
|
colorMode: FlowColorMode;
|
|
302
473
|
resolvedColorMode: ResolvedFlowColorMode;
|
|
303
474
|
};
|
|
304
475
|
declare function useApplyFlowColorMode(element: HTMLElement | null): void;
|
|
305
476
|
//#endregion
|
|
306
|
-
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 };
|