@ankhzet/graph 0.5.0 → 0.5.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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +34 -2
- package/dist/index.js +233 -232
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/ManagedGraph.tsx +9 -5
- package/src/index.ts +1 -0
- package/src/utils.ts +0 -4
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,27 @@ export declare type ConnectorPoint<Node extends GraphNodeInterface, Input extend
|
|
|
70
70
|
connector?: Connector<Node['id']>;
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
+
export declare class Coordinates implements Coordinator {
|
|
74
|
+
grid: number;
|
|
75
|
+
gridSize: Position;
|
|
76
|
+
sizes: {
|
|
77
|
+
grid: Position;
|
|
78
|
+
port: number;
|
|
79
|
+
lane: number;
|
|
80
|
+
space: number;
|
|
81
|
+
};
|
|
82
|
+
constructor({ grid, port, lane, space, }?: Partial<SizeOverrides>);
|
|
83
|
+
snap(value: number): number;
|
|
84
|
+
toGraph({ x, y }: Position): {
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
};
|
|
88
|
+
toData({ x, y }: Position): {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
73
94
|
export declare type Coordinator = {
|
|
74
95
|
grid: number;
|
|
75
96
|
gridSize: Position;
|
|
@@ -244,12 +265,16 @@ export declare type GraphRef<Node extends GraphNodeInterface> = {
|
|
|
244
265
|
element?: HTMLDivElement;
|
|
245
266
|
};
|
|
246
267
|
|
|
268
|
+
export declare const GRID_SIZE = 16;
|
|
269
|
+
|
|
247
270
|
declare interface GroupableItem<ID> {
|
|
248
271
|
id: ID;
|
|
249
272
|
}
|
|
250
273
|
|
|
251
274
|
export declare type GroupResolver<T extends GroupableItem<any>> = (node: T) => null | undefined | ItemsGroup<T['id']>;
|
|
252
275
|
|
|
276
|
+
export declare const groupResolver: ({ description: { item } }: ManagedGraphNode) => string | null;
|
|
277
|
+
|
|
253
278
|
export declare interface HitTestResult<Node extends GraphNodeInterface> extends Position {
|
|
254
279
|
node: Node;
|
|
255
280
|
width: number;
|
|
@@ -313,6 +338,8 @@ export declare type ItemsGroup<ID> = {
|
|
|
313
338
|
ids: ID[];
|
|
314
339
|
};
|
|
315
340
|
|
|
341
|
+
export declare const LANE_SIZE = 16;
|
|
342
|
+
|
|
316
343
|
export declare interface Layer<Node extends GraphNodeInterface> {
|
|
317
344
|
[id: string]: Node;
|
|
318
345
|
}
|
|
@@ -358,7 +385,7 @@ export declare type Line = {
|
|
|
358
385
|
update(): void;
|
|
359
386
|
};
|
|
360
387
|
|
|
361
|
-
export declare const ManagedGraph: <Graph extends IGraph<Item>, Item extends IItem, DTO extends GraphDTO>({ innerRef, graph, selected, sizes, handlers, children, onExport, ...rest }: PropsWithChildren<ManagedGraphProps<Graph, Item, DTO>>) => JSX.Element;
|
|
388
|
+
export declare const ManagedGraph: <Graph extends IGraph<Item>, Item extends IItem, DTO extends GraphDTO>({ innerRef, graph, layouter, selected, sizes, handlers, children, onExport, ...rest }: PropsWithChildren<ManagedGraphProps<Graph, Item, DTO>>) => JSX.Element;
|
|
362
389
|
|
|
363
390
|
export declare class ManagedGraphNode<Item extends IItem = IItem> extends GraphNode<TypeId, NodeData<Item>, Container> implements IMenuProvider<MenuAction> {
|
|
364
391
|
#private;
|
|
@@ -396,6 +423,7 @@ export declare interface ManagedGraphProps<Graph extends IGraph<Item>, Item exte
|
|
|
396
423
|
}>;
|
|
397
424
|
graph: Graph;
|
|
398
425
|
selected?: Item[];
|
|
426
|
+
layouter?: Layouter<ManagedGraphNode<Item>>;
|
|
399
427
|
className?: string;
|
|
400
428
|
sizes?: SizeOverrides;
|
|
401
429
|
handlers?: Partial<GraphHandlers<DTO, Item>>;
|
|
@@ -528,6 +556,8 @@ declare class PIXIText extends Container {
|
|
|
528
556
|
set tint(color: ColorSource);
|
|
529
557
|
}
|
|
530
558
|
|
|
559
|
+
export declare const PORT_SIZE = 8;
|
|
560
|
+
|
|
531
561
|
export declare type Position = {
|
|
532
562
|
x: number;
|
|
533
563
|
y: number;
|
|
@@ -609,13 +639,15 @@ export declare type RequestedConnection<ID, Node> = {
|
|
|
609
639
|
|
|
610
640
|
export declare type Resolver<Item> = (id: TypeId) => Item | undefined;
|
|
611
641
|
|
|
612
|
-
declare type SizeOverrides = {
|
|
642
|
+
export declare type SizeOverrides = {
|
|
613
643
|
grid: number;
|
|
614
644
|
port: number;
|
|
615
645
|
lane: number;
|
|
616
646
|
space: number;
|
|
617
647
|
};
|
|
618
648
|
|
|
649
|
+
export declare const SPACE_SIZE = 32;
|
|
650
|
+
|
|
619
651
|
export declare class Store<Item extends {
|
|
620
652
|
id: TypeId;
|
|
621
653
|
}> extends DisposableEventSource implements StoreInterface<Item> {
|