@infinit-canvas/react 0.1.0 → 0.1.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/dist/react-infinite-canvas.cjs +2 -2
- package/dist/react-infinite-canvas.js +151 -136
- package/package.json +1 -1
- package/src/types.d.ts +131 -0
package/package.json
CHANGED
package/src/types.d.ts
CHANGED
|
@@ -8,6 +8,18 @@ export type SnapGrid = [number, number];
|
|
|
8
8
|
export type CoordinateExtent = [[number, number], [number, number]];
|
|
9
9
|
|
|
10
10
|
export type Position = 'top' | 'bottom' | 'left' | 'right';
|
|
11
|
+
export declare const Position: {
|
|
12
|
+
readonly Top: 'top';
|
|
13
|
+
readonly Bottom: 'bottom';
|
|
14
|
+
readonly Left: 'left';
|
|
15
|
+
readonly Right: 'right';
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type MarkerType = 'arrow' | 'arrowclosed';
|
|
19
|
+
export declare const MarkerType: {
|
|
20
|
+
readonly Arrow: 'arrow';
|
|
21
|
+
readonly ArrowClosed: 'arrowclosed';
|
|
22
|
+
};
|
|
11
23
|
export type HandleType = 'source' | 'target';
|
|
12
24
|
export type ConnectionMode = 'strict' | 'loose';
|
|
13
25
|
export type SelectionMode = 'full' | 'partial';
|
|
@@ -470,3 +482,122 @@ export declare function Controls(props: ControlsProps): JSX.Element;
|
|
|
470
482
|
export declare function MiniMap(props: MiniMapProps): JSX.Element;
|
|
471
483
|
export declare function Background(props: BackgroundProps): JSX.Element;
|
|
472
484
|
export declare function Panel(props: PanelProps): JSX.Element;
|
|
485
|
+
|
|
486
|
+
// ─── React Flow Compatibility Types ─────────────────────────────
|
|
487
|
+
|
|
488
|
+
export interface Box {
|
|
489
|
+
x: number;
|
|
490
|
+
y: number;
|
|
491
|
+
x2: number;
|
|
492
|
+
y2: number;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export declare function nodeToBox(node: Node): Box;
|
|
496
|
+
|
|
497
|
+
export interface InternalNode<NodeType extends Node = Node> extends NodeType {
|
|
498
|
+
_absolutePosition: XYPosition;
|
|
499
|
+
measured?: { width?: number; height?: number };
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export type BuiltInNode = Node;
|
|
503
|
+
|
|
504
|
+
export interface NodeProps<NodeType extends Node = Node> {
|
|
505
|
+
id: string;
|
|
506
|
+
data: NodeType['data'];
|
|
507
|
+
type: string;
|
|
508
|
+
selected: boolean;
|
|
509
|
+
dragging: boolean;
|
|
510
|
+
width?: number;
|
|
511
|
+
height?: number;
|
|
512
|
+
positionAbsoluteX: number;
|
|
513
|
+
positionAbsoluteY: number;
|
|
514
|
+
zIndex: number;
|
|
515
|
+
isConnectable: boolean;
|
|
516
|
+
sourcePosition?: Position;
|
|
517
|
+
targetPosition?: Position;
|
|
518
|
+
dragHandle?: string;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export interface EdgeProps<EdgeType extends Edge = Edge> {
|
|
522
|
+
id: string;
|
|
523
|
+
source: string;
|
|
524
|
+
target: string;
|
|
525
|
+
sourceX: number;
|
|
526
|
+
sourceY: number;
|
|
527
|
+
targetX: number;
|
|
528
|
+
targetY: number;
|
|
529
|
+
selected?: boolean;
|
|
530
|
+
animated?: boolean;
|
|
531
|
+
data?: EdgeType['data'];
|
|
532
|
+
label?: string;
|
|
533
|
+
type?: string;
|
|
534
|
+
sourceHandleId?: string | null;
|
|
535
|
+
targetHandleId?: string | null;
|
|
536
|
+
sourcePosition: Position;
|
|
537
|
+
targetPosition: Position;
|
|
538
|
+
style?: React.CSSProperties;
|
|
539
|
+
markerStart?: string;
|
|
540
|
+
markerEnd?: string;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export interface HandleProps {
|
|
544
|
+
type: HandleType;
|
|
545
|
+
position: Position;
|
|
546
|
+
id?: string;
|
|
547
|
+
isConnectable?: boolean;
|
|
548
|
+
isConnectableStart?: boolean;
|
|
549
|
+
isConnectableEnd?: boolean;
|
|
550
|
+
onConnect?: (connection: Connection) => void;
|
|
551
|
+
style?: React.CSSProperties;
|
|
552
|
+
className?: string;
|
|
553
|
+
children?: React.ReactNode;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export interface ConnectionLineComponentProps {
|
|
557
|
+
fromX: number;
|
|
558
|
+
fromY: number;
|
|
559
|
+
toX: number;
|
|
560
|
+
toY: number;
|
|
561
|
+
fromPosition: Position;
|
|
562
|
+
toPosition: Position;
|
|
563
|
+
fromNode?: Node;
|
|
564
|
+
toNode?: Node;
|
|
565
|
+
connectionLineType?: string;
|
|
566
|
+
connectionLineStyle?: React.CSSProperties;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export interface MiniMapNodeProps {
|
|
570
|
+
id: string;
|
|
571
|
+
x: number;
|
|
572
|
+
y: number;
|
|
573
|
+
width: number;
|
|
574
|
+
height: number;
|
|
575
|
+
selected: boolean;
|
|
576
|
+
color?: string;
|
|
577
|
+
style?: React.CSSProperties;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export type NodeTypes = Record<string, React.ComponentType<NodeProps<any>>>;
|
|
581
|
+
export type EdgeTypes = Record<string, React.ComponentType<EdgeProps<any>>>;
|
|
582
|
+
|
|
583
|
+
export type InfiniteCanvasInstance = ReactFlowInstance;
|
|
584
|
+
export type InfiniteCanvasState = {
|
|
585
|
+
nodes: Node[];
|
|
586
|
+
edges: Edge[];
|
|
587
|
+
domNode: HTMLDivElement | null;
|
|
588
|
+
width: number;
|
|
589
|
+
height: number;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
export type NodeOrigin = [number, number];
|
|
593
|
+
|
|
594
|
+
export interface ProOptions {
|
|
595
|
+
account?: string;
|
|
596
|
+
hideAttribution?: boolean;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export type SelectionDragHandler = (event: React.MouseEvent, nodes: Node[]) => void;
|
|
600
|
+
export type OnNodesDelete = (nodes: Node[]) => void;
|
|
601
|
+
export type OnEdgesDelete = (edges: Edge[]) => void;
|
|
602
|
+
|
|
603
|
+
export type useShallow = <T>(selector: (state: any) => T) => T;
|