@html-graph/html-graph 0.0.52 → 0.0.54
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 +18 -13
- package/dist/main.d.ts +168 -94
- package/dist/main.js +609 -673
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,12 +10,10 @@
|
|
|
10
10
|
<img width="100%" src="https://raw.githubusercontent.com/html-graph/html-graph/master/media/full-demo.gif"/>
|
|
11
11
|
</a>
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
Port is an entity of a node to which edge can be attached to.
|
|
15
|
-
|
|
16
|
-
This library fits for tasks where easy nodes customization and interactiveness are required.
|
|
13
|
+
Visit <a target="_blank" href="https://html-graph.github.io">live demo</a>.
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
Instead of connecting nodes directly this library uses concept of ports, which provide greater fexibility at managing edges.
|
|
16
|
+
Port is an entity of a node to which edge can be attached to.
|
|
19
17
|
|
|
20
18
|
## Features:
|
|
21
19
|
|
|
@@ -37,8 +35,14 @@ import { AddNodePorts, HtmlGraphBuilder } from "@html-graph/html-graph";
|
|
|
37
35
|
|
|
38
36
|
const canvas = new HtmlGraphBuilder()
|
|
39
37
|
.setOptions({
|
|
40
|
-
background: {
|
|
41
|
-
|
|
38
|
+
background: {
|
|
39
|
+
type: "dots",
|
|
40
|
+
},
|
|
41
|
+
edges: {
|
|
42
|
+
shape: {
|
|
43
|
+
hasTargetArrow: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
42
46
|
})
|
|
43
47
|
.setUserDraggableNodes()
|
|
44
48
|
.setUserTransformableCanvas()
|
|
@@ -64,12 +68,13 @@ function createNode(
|
|
|
64
68
|
backPort.classList.add("port");
|
|
65
69
|
node.appendChild(backPort);
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
[
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
return [
|
|
72
|
+
node,
|
|
73
|
+
[
|
|
74
|
+
[frontPortId, frontPort],
|
|
75
|
+
[backPortId, backPort],
|
|
76
|
+
],
|
|
77
|
+
];
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
const [node1, ports1] = createNode("Node 1", "port-1-1", "port-1-2");
|
package/dist/main.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export declare interface AddEdgeRequest {
|
|
|
2
2
|
id?: unknown;
|
|
3
3
|
from: string;
|
|
4
4
|
to: string;
|
|
5
|
-
options?:
|
|
5
|
+
options?: EdgeShape_2;
|
|
6
6
|
priority?: number;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export declare type AddNodePorts =
|
|
9
|
+
export declare type AddNodePorts = Iterable<readonly [unknown, MarkNodePortRequest]>;
|
|
10
10
|
|
|
11
11
|
export declare interface AddNodeRequest {
|
|
12
12
|
id?: unknown;
|
|
@@ -22,9 +22,6 @@ export declare type BackgroundDrawingFn = (ctx: CanvasRenderingContext2D, transf
|
|
|
22
22
|
|
|
23
23
|
declare type BackgroundOptions = {
|
|
24
24
|
readonly type: "none";
|
|
25
|
-
} | {
|
|
26
|
-
readonly type: "color";
|
|
27
|
-
readonly color?: string;
|
|
28
25
|
} | {
|
|
29
26
|
readonly type: "dots";
|
|
30
27
|
readonly dotColor?: string;
|
|
@@ -36,7 +33,7 @@ declare type BackgroundOptions = {
|
|
|
36
33
|
readonly drawingFn: BackgroundDrawingFn;
|
|
37
34
|
};
|
|
38
35
|
|
|
39
|
-
export declare class
|
|
36
|
+
export declare class BezierEdgeShape implements EdgeShape {
|
|
40
37
|
private readonly color;
|
|
41
38
|
private readonly width;
|
|
42
39
|
private readonly curvature;
|
|
@@ -51,7 +48,7 @@ export declare class BezierEdgeController implements EdgeController {
|
|
|
51
48
|
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
declare interface
|
|
51
|
+
declare interface BezierEdgeShape_2 {
|
|
55
52
|
readonly type?: "bezier";
|
|
56
53
|
readonly color?: string;
|
|
57
54
|
readonly width?: number;
|
|
@@ -67,6 +64,10 @@ declare interface BezierEdgeOptions {
|
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
export declare interface Canvas {
|
|
67
|
+
/**
|
|
68
|
+
* provides api for accessing graph model
|
|
69
|
+
*/
|
|
70
|
+
readonly model: PublicGraphStore;
|
|
70
71
|
/**
|
|
71
72
|
* provides api for canvas transformation
|
|
72
73
|
*/
|
|
@@ -113,15 +114,11 @@ export declare interface Canvas {
|
|
|
113
114
|
/**
|
|
114
115
|
* applies transformation for viewport
|
|
115
116
|
*/
|
|
116
|
-
patchViewportState(request:
|
|
117
|
+
patchViewportState(request: PatchTransformRequest): Canvas;
|
|
117
118
|
/**
|
|
118
|
-
*
|
|
119
|
+
* applies transformation for content
|
|
119
120
|
*/
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* moves specified node on top
|
|
123
|
-
*/
|
|
124
|
-
moveNodeOnTop(nodeId: unknown): Canvas;
|
|
121
|
+
patchContentState(request: PatchTransformRequest): Canvas;
|
|
125
122
|
/**
|
|
126
123
|
* attaches canvas to given element
|
|
127
124
|
*/
|
|
@@ -150,21 +147,21 @@ export declare interface Canvas {
|
|
|
150
147
|
export declare class CanvasCore implements Canvas {
|
|
151
148
|
private readonly apiOptions?;
|
|
152
149
|
readonly transformation: PublicViewportTransformer;
|
|
150
|
+
readonly model: PublicGraphStore;
|
|
153
151
|
private readonly di;
|
|
154
|
-
private readonly
|
|
152
|
+
private readonly edgeShapeFactory;
|
|
155
153
|
constructor(apiOptions?: CoreOptions | undefined);
|
|
156
154
|
addNode(node: AddNodeRequest): CanvasCore;
|
|
157
155
|
updateNode(nodeId: unknown, request: UpdateNodeRequest): CanvasCore;
|
|
158
156
|
removeNode(nodeId: unknown): CanvasCore;
|
|
159
|
-
moveNodeOnTop(nodeId: unknown): CanvasCore;
|
|
160
157
|
markPort(port: MarkPortRequest): CanvasCore;
|
|
161
158
|
updatePort(portId: string, request: UpdatePortRequest): CanvasCore;
|
|
162
159
|
unmarkPort(portId: string): CanvasCore;
|
|
163
160
|
addEdge(edge: AddEdgeRequest): CanvasCore;
|
|
164
161
|
updateEdge(edgeId: unknown, request: UpdateEdgeRequest): CanvasCore;
|
|
165
162
|
removeEdge(edgeId: unknown): CanvasCore;
|
|
166
|
-
patchViewportState(request:
|
|
167
|
-
|
|
163
|
+
patchViewportState(request: PatchTransformRequest): CanvasCore;
|
|
164
|
+
patchContentState(request: PatchTransformRequest): CanvasCore;
|
|
168
165
|
clear(): CanvasCore;
|
|
169
166
|
attach(element: HTMLElement): CanvasCore;
|
|
170
167
|
detach(): CanvasCore;
|
|
@@ -173,6 +170,8 @@ export declare class CanvasCore implements Canvas {
|
|
|
173
170
|
|
|
174
171
|
export declare type CenterFn = (width: number, height: number) => [number, number];
|
|
175
172
|
|
|
173
|
+
declare type ConstantPriority = number;
|
|
174
|
+
|
|
176
175
|
export declare interface CoreOptions {
|
|
177
176
|
/**
|
|
178
177
|
* canvas background settings
|
|
@@ -187,6 +186,10 @@ export declare interface CoreOptions {
|
|
|
187
186
|
* center of nodes specified in addNode method by x and y
|
|
188
187
|
*/
|
|
189
188
|
readonly centerFn?: CenterFn;
|
|
189
|
+
/**
|
|
190
|
+
* specifies default z-index value
|
|
191
|
+
*/
|
|
192
|
+
readonly priority?: Priority;
|
|
190
193
|
};
|
|
191
194
|
/**
|
|
192
195
|
* ports related behavior
|
|
@@ -205,19 +208,19 @@ export declare interface CoreOptions {
|
|
|
205
208
|
/**
|
|
206
209
|
*edges related behavior
|
|
207
210
|
*/
|
|
208
|
-
readonly edges?:
|
|
209
|
-
/**
|
|
210
|
-
* layers related behavior
|
|
211
|
-
*/
|
|
212
|
-
readonly layers?: {
|
|
211
|
+
readonly edges?: {
|
|
213
212
|
/**
|
|
214
|
-
*
|
|
213
|
+
* specifies default controller
|
|
215
214
|
*/
|
|
216
|
-
readonly
|
|
215
|
+
readonly shape?: EdgeShape_2;
|
|
216
|
+
/**
|
|
217
|
+
* specifies default z-index value
|
|
218
|
+
*/
|
|
219
|
+
readonly priority?: Priority;
|
|
217
220
|
};
|
|
218
221
|
}
|
|
219
222
|
|
|
220
|
-
export declare const
|
|
223
|
+
export declare const createBezierEdgeShapeFactory: (options: {
|
|
221
224
|
color: string;
|
|
222
225
|
width: number;
|
|
223
226
|
arrowLength: number;
|
|
@@ -229,9 +232,9 @@ export declare const createBezierEdgeControllerFactory: (options: {
|
|
|
229
232
|
smallCycleRadius: number;
|
|
230
233
|
detourDistance: number;
|
|
231
234
|
detourDirection: number;
|
|
232
|
-
}) =>
|
|
235
|
+
}) => EdgeShapeFactory;
|
|
233
236
|
|
|
234
|
-
export declare const
|
|
237
|
+
export declare const createHorizontalEdgeShapeFactory: (options: {
|
|
235
238
|
color: string;
|
|
236
239
|
width: number;
|
|
237
240
|
arrowLength: number;
|
|
@@ -243,9 +246,9 @@ export declare const createHorizontalEdgeControllerFactory: (options: {
|
|
|
243
246
|
roundness: number;
|
|
244
247
|
detourDistance: number;
|
|
245
248
|
detourDirection: number;
|
|
246
|
-
}) =>
|
|
249
|
+
}) => EdgeShapeFactory;
|
|
247
250
|
|
|
248
|
-
export declare const
|
|
251
|
+
export declare const createStraightEdgeShareFactory: (options: {
|
|
249
252
|
color: string;
|
|
250
253
|
width: number;
|
|
251
254
|
arrowLength: number;
|
|
@@ -257,9 +260,9 @@ export declare const createStraightEdgeControllerFactory: (options: {
|
|
|
257
260
|
roundness: number;
|
|
258
261
|
detourDistance: number;
|
|
259
262
|
detourDirection: number;
|
|
260
|
-
}) =>
|
|
263
|
+
}) => EdgeShapeFactory;
|
|
261
264
|
|
|
262
|
-
export declare const
|
|
265
|
+
export declare const createVerticalEdgeShapeFactory: (options: {
|
|
263
266
|
color: string;
|
|
264
267
|
width: number;
|
|
265
268
|
arrowLength: number;
|
|
@@ -271,14 +274,16 @@ export declare const createVerticalEdgeControllerFactory: (options: {
|
|
|
271
274
|
roundness: number;
|
|
272
275
|
detourDistance: number;
|
|
273
276
|
detourDirection: number;
|
|
274
|
-
}) =>
|
|
277
|
+
}) => EdgeShapeFactory;
|
|
275
278
|
|
|
276
|
-
declare interface
|
|
279
|
+
declare interface CustomEdgeShape {
|
|
277
280
|
readonly type: "custom";
|
|
278
|
-
readonly controllerFactory:
|
|
281
|
+
readonly controllerFactory: EdgeShapeFactory;
|
|
279
282
|
}
|
|
280
283
|
|
|
281
|
-
|
|
284
|
+
declare type CustomPriority = PriorityFn;
|
|
285
|
+
|
|
286
|
+
export declare class CycleCircleEdgeShape implements EdgeShape {
|
|
282
287
|
private readonly color;
|
|
283
288
|
private readonly width;
|
|
284
289
|
private readonly arrowLength;
|
|
@@ -293,7 +298,7 @@ export declare class CycleCircleEdgeController implements EdgeController {
|
|
|
293
298
|
update(x: number, y: number, _width: number, _height: number, from: PortPayload): void;
|
|
294
299
|
}
|
|
295
300
|
|
|
296
|
-
export declare class
|
|
301
|
+
export declare class CycleSquareEdgeShape implements EdgeShape {
|
|
297
302
|
private readonly color;
|
|
298
303
|
private readonly width;
|
|
299
304
|
private readonly arrowLength;
|
|
@@ -310,7 +315,7 @@ export declare class CycleSquareEdgeController implements EdgeController {
|
|
|
310
315
|
update(x: number, y: number, _width: number, _height: number, from: PortPayload): void;
|
|
311
316
|
}
|
|
312
317
|
|
|
313
|
-
export declare class
|
|
318
|
+
export declare class DetourStraightEdgeShape implements EdgeShape {
|
|
314
319
|
private readonly color;
|
|
315
320
|
private readonly width;
|
|
316
321
|
private readonly arrowLength;
|
|
@@ -329,20 +334,28 @@ export declare class DetourStraightEdgeController implements EdgeController {
|
|
|
329
334
|
}
|
|
330
335
|
|
|
331
336
|
export declare interface DragOptions {
|
|
337
|
+
grabPriorityStrategy?: "freeze" | "move-on-top";
|
|
332
338
|
events?: {
|
|
333
339
|
onNodeDrag?: (payload: NodeDragPayload) => void;
|
|
334
340
|
onBeforeNodeDrag?: (payload: NodeDragPayload) => boolean;
|
|
335
341
|
};
|
|
336
342
|
}
|
|
337
343
|
|
|
338
|
-
|
|
344
|
+
declare interface EdgePayload {
|
|
345
|
+
from: string;
|
|
346
|
+
to: string;
|
|
347
|
+
shape: EdgeShape;
|
|
348
|
+
priority: number;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export declare interface EdgeShape {
|
|
339
352
|
readonly svg: SVGSVGElement;
|
|
340
353
|
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
341
354
|
}
|
|
342
355
|
|
|
343
|
-
declare type
|
|
356
|
+
declare type EdgeShape_2 = BezierEdgeShape_2 | StraightEdgeShape_2 | CustomEdgeShape | HorizontalEdgeShape_2 | VerticalEdgeShape_2;
|
|
344
357
|
|
|
345
|
-
declare type
|
|
358
|
+
declare type EdgeShapeFactory = (type: EdgeType) => EdgeShape;
|
|
346
359
|
|
|
347
360
|
export declare enum EdgeType {
|
|
348
361
|
Regular = "regular",
|
|
@@ -350,7 +363,57 @@ export declare enum EdgeType {
|
|
|
350
363
|
NodeCycle = "node-cycle"
|
|
351
364
|
}
|
|
352
365
|
|
|
353
|
-
export declare
|
|
366
|
+
export declare interface GraphEdge {
|
|
367
|
+
readonly from: unknown;
|
|
368
|
+
readonly to: unknown;
|
|
369
|
+
readonly priority: number;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export declare interface GraphNode {
|
|
373
|
+
readonly element: HTMLElement;
|
|
374
|
+
readonly x: number;
|
|
375
|
+
readonly y: number;
|
|
376
|
+
readonly centerFn: CenterFn;
|
|
377
|
+
readonly priority: number;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export declare interface GraphPort {
|
|
381
|
+
readonly element: HTMLElement;
|
|
382
|
+
readonly centerFn: CenterFn;
|
|
383
|
+
readonly direction: number;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
declare class GraphStore {
|
|
387
|
+
private readonly nodes;
|
|
388
|
+
private readonly ports;
|
|
389
|
+
private readonly nodePorts;
|
|
390
|
+
private readonly portNodeId;
|
|
391
|
+
private readonly edges;
|
|
392
|
+
private readonly incommingEdges;
|
|
393
|
+
private readonly outcommingEdges;
|
|
394
|
+
private readonly cycleEdges;
|
|
395
|
+
addNode(nodeId: unknown, element: HTMLElement, x: number, y: number, centerFn: CenterFn, priority: number): void;
|
|
396
|
+
getNode(nodeId: unknown): NodePayload | undefined;
|
|
397
|
+
removeNode(nodeId: unknown): void;
|
|
398
|
+
addPort(portId: unknown, element: HTMLElement, nodeId: unknown, centerFn: CenterFn, dir: number): void;
|
|
399
|
+
getPort(portId: unknown): PortPayload | undefined;
|
|
400
|
+
getPortNode(portId: string): unknown | undefined;
|
|
401
|
+
removePort(portId: string): void;
|
|
402
|
+
addEdge(edgeId: unknown, fromPortId: string, toPortId: string, shape: EdgeShape, priority: number): void;
|
|
403
|
+
getEdge(edgeId: unknown): EdgePayload | undefined;
|
|
404
|
+
removeEdge(edgeId: unknown): void;
|
|
405
|
+
getPortAdjacentEdges(portId: string): readonly unknown[];
|
|
406
|
+
getNodeAdjacentEdges(nodeId: unknown): readonly unknown[];
|
|
407
|
+
clear(): void;
|
|
408
|
+
getPortIncomingEdges(portId: unknown): readonly unknown[];
|
|
409
|
+
getPortOutcomingEdges(portId: unknown): readonly unknown[];
|
|
410
|
+
getPortCycleEdges(portId: unknown): readonly unknown[];
|
|
411
|
+
getNodeIncomingEdges(nodeId: unknown): readonly unknown[];
|
|
412
|
+
getNodeOutcomingEdges(nodeId: unknown): readonly unknown[];
|
|
413
|
+
getNodeCycleEdges(nodeId: unknown): readonly unknown[];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export declare class HorizontalEdgeShape implements EdgeShape {
|
|
354
417
|
private readonly color;
|
|
355
418
|
private readonly width;
|
|
356
419
|
private readonly arrowLength;
|
|
@@ -366,7 +429,7 @@ export declare class HorizontalEdgeController implements EdgeController {
|
|
|
366
429
|
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
367
430
|
}
|
|
368
431
|
|
|
369
|
-
declare interface
|
|
432
|
+
declare interface HorizontalEdgeShape_2 {
|
|
370
433
|
readonly type: "horizontal";
|
|
371
434
|
readonly color?: string;
|
|
372
435
|
readonly width?: number;
|
|
@@ -393,7 +456,7 @@ export declare class HtmlGraphBuilder {
|
|
|
393
456
|
build(): Canvas;
|
|
394
457
|
}
|
|
395
458
|
|
|
396
|
-
declare type
|
|
459
|
+
declare type IncrementalPriority = "incremental";
|
|
397
460
|
|
|
398
461
|
export declare type MarkNodePortRequest = HTMLElement | {
|
|
399
462
|
readonly element: HTMLElement;
|
|
@@ -416,20 +479,15 @@ export declare interface NodeDragPayload {
|
|
|
416
479
|
readonly y: number;
|
|
417
480
|
}
|
|
418
481
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
export declare interface NodeResponse {
|
|
427
|
-
readonly x: number;
|
|
428
|
-
readonly y: number;
|
|
429
|
-
readonly element: HTMLElement;
|
|
482
|
+
declare interface NodePayload {
|
|
483
|
+
element: HTMLElement;
|
|
484
|
+
x: number;
|
|
485
|
+
y: number;
|
|
486
|
+
centerFn: CenterFn;
|
|
487
|
+
priority: number;
|
|
430
488
|
}
|
|
431
489
|
|
|
432
|
-
export declare interface
|
|
490
|
+
export declare interface PatchTransformRequest {
|
|
433
491
|
scale?: number;
|
|
434
492
|
x?: number;
|
|
435
493
|
y?: number;
|
|
@@ -441,32 +499,37 @@ export declare interface PortPayload {
|
|
|
441
499
|
direction: number;
|
|
442
500
|
}
|
|
443
501
|
|
|
502
|
+
declare type Priority = ConstantPriority | IncrementalPriority | SharedIncrementalPriority | CustomPriority;
|
|
503
|
+
|
|
504
|
+
export declare type PriorityFn = () => number;
|
|
505
|
+
|
|
506
|
+
declare class PublicGraphStore {
|
|
507
|
+
private readonly graphStore;
|
|
508
|
+
constructor(graphStore: GraphStore);
|
|
509
|
+
getNode(nodeId: unknown): GraphNode | null;
|
|
510
|
+
getPort(portId: unknown): GraphPort | null;
|
|
511
|
+
getPortNode(portId: string): unknown | null;
|
|
512
|
+
getEdge(edgeId: unknown): GraphEdge | null;
|
|
513
|
+
getPortAdjacentEdges(portId: string): readonly unknown[];
|
|
514
|
+
getNodeAdjacentEdges(nodeId: unknown): readonly unknown[];
|
|
515
|
+
getPortIncomingEdges(portId: unknown): readonly unknown[];
|
|
516
|
+
getPortOutcomingEdges(portId: unknown): readonly unknown[];
|
|
517
|
+
getPortCycleEdges(portId: unknown): readonly unknown[];
|
|
518
|
+
getNodeIncomingEdges(nodeId: unknown): readonly unknown[];
|
|
519
|
+
getNodeOutcomingEdges(nodeId: unknown): readonly unknown[];
|
|
520
|
+
getNodeCycleEdges(nodeId: unknown): readonly unknown[];
|
|
521
|
+
}
|
|
522
|
+
|
|
444
523
|
export declare class PublicViewportTransformer {
|
|
445
524
|
private readonly transformer;
|
|
446
525
|
constructor(transformer: ViewportTransformer);
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
* viewport coordinated represent actual coordinates on screen for given absolute coordinates
|
|
450
|
-
*/
|
|
451
|
-
getViewCoords(xa: number, ya: number): [number, number];
|
|
452
|
-
/**
|
|
453
|
-
* returns viewport scale
|
|
454
|
-
* it represents scale at which entities on canvas should be scaled to fit current scale
|
|
455
|
-
*/
|
|
456
|
-
getViewScale(): number;
|
|
457
|
-
/**
|
|
458
|
-
* for given viewport coordinates returns absolute coordinates
|
|
459
|
-
* absolute coordinates represent actual coordinates, which stay constant even for transformed canvas
|
|
460
|
-
*/
|
|
461
|
-
getAbsCoords(xv: number, yv: number): [number, number];
|
|
462
|
-
/**
|
|
463
|
-
* returns absolute scale
|
|
464
|
-
* it represents scale at which current viewport was scaled compared to initial state
|
|
465
|
-
*/
|
|
466
|
-
getAbsScale(): number;
|
|
526
|
+
getViewportMatrix(): TransformState;
|
|
527
|
+
getContentMatrix(): TransformState;
|
|
467
528
|
}
|
|
468
529
|
|
|
469
|
-
|
|
530
|
+
declare type SharedIncrementalPriority = "shared-incremental";
|
|
531
|
+
|
|
532
|
+
export declare class StraightEdgeShape implements EdgeShape {
|
|
470
533
|
private readonly color;
|
|
471
534
|
private readonly width;
|
|
472
535
|
private readonly arrowLength;
|
|
@@ -482,7 +545,7 @@ export declare class StraightEdgeController implements EdgeController {
|
|
|
482
545
|
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
483
546
|
}
|
|
484
547
|
|
|
485
|
-
declare interface
|
|
548
|
+
declare interface StraightEdgeShape_2 {
|
|
486
549
|
readonly type: "straight";
|
|
487
550
|
readonly color?: string;
|
|
488
551
|
readonly width?: number;
|
|
@@ -519,8 +582,14 @@ export declare interface TransformPayload {
|
|
|
519
582
|
readonly y: number;
|
|
520
583
|
}
|
|
521
584
|
|
|
585
|
+
declare interface TransformState {
|
|
586
|
+
scale: number;
|
|
587
|
+
x: number;
|
|
588
|
+
y: number;
|
|
589
|
+
}
|
|
590
|
+
|
|
522
591
|
export declare interface UpdateEdgeRequest {
|
|
523
|
-
readonly controller?:
|
|
592
|
+
readonly controller?: EdgeShape;
|
|
524
593
|
readonly priority?: number;
|
|
525
594
|
}
|
|
526
595
|
|
|
@@ -538,7 +607,9 @@ declare interface UpdatePortRequest {
|
|
|
538
607
|
|
|
539
608
|
export declare class UserDraggableNodesCanvas implements Canvas {
|
|
540
609
|
private readonly canvas;
|
|
610
|
+
readonly model: PublicGraphStore;
|
|
541
611
|
readonly transformation: PublicViewportTransformer;
|
|
612
|
+
private maxNodePriority;
|
|
542
613
|
private readonly nodes;
|
|
543
614
|
private grabbedNodeId;
|
|
544
615
|
private onNodeDrag;
|
|
@@ -551,8 +622,9 @@ export declare class UserDraggableNodesCanvas implements Canvas {
|
|
|
551
622
|
private readonly onCanvasTouchMove;
|
|
552
623
|
private readonly onCanvasTouchEnd;
|
|
553
624
|
private previousTouchCoords;
|
|
625
|
+
private freezePriority;
|
|
554
626
|
constructor(canvas: Canvas, dragOptions?: DragOptions);
|
|
555
|
-
addNode(
|
|
627
|
+
addNode(request: AddNodeRequest): UserDraggableNodesCanvas;
|
|
556
628
|
updateNode(nodeId: unknown, request: UpdateNodeRequest): UserDraggableNodesCanvas;
|
|
557
629
|
removeNode(nodeId: unknown): UserDraggableNodesCanvas;
|
|
558
630
|
markPort(port: MarkPortRequest): UserDraggableNodesCanvas;
|
|
@@ -561,20 +633,22 @@ export declare class UserDraggableNodesCanvas implements Canvas {
|
|
|
561
633
|
addEdge(edge: AddEdgeRequest): UserDraggableNodesCanvas;
|
|
562
634
|
updateEdge(edgeId: unknown, request: UpdateEdgeRequest): UserDraggableNodesCanvas;
|
|
563
635
|
removeEdge(edgeId: unknown): UserDraggableNodesCanvas;
|
|
564
|
-
patchViewportState(request:
|
|
565
|
-
|
|
566
|
-
moveNodeOnTop(nodeId: string): UserDraggableNodesCanvas;
|
|
636
|
+
patchViewportState(request: PatchTransformRequest): UserDraggableNodesCanvas;
|
|
637
|
+
patchContentState(request: PatchTransformRequest): UserDraggableNodesCanvas;
|
|
567
638
|
clear(): UserDraggableNodesCanvas;
|
|
568
639
|
attach(element: HTMLElement): UserDraggableNodesCanvas;
|
|
569
640
|
detach(): UserDraggableNodesCanvas;
|
|
570
641
|
destroy(): void;
|
|
571
642
|
private setCursor;
|
|
572
643
|
private dragNode;
|
|
644
|
+
private updateMaxNodePriority;
|
|
645
|
+
private moveNodeOnTop;
|
|
573
646
|
}
|
|
574
647
|
|
|
575
648
|
export declare class UserTransformableCanvas implements Canvas {
|
|
576
649
|
private readonly canvas;
|
|
577
650
|
private readonly options?;
|
|
651
|
+
readonly model: PublicGraphStore;
|
|
578
652
|
readonly transformation: PublicViewportTransformer;
|
|
579
653
|
private element;
|
|
580
654
|
private isMoving;
|
|
@@ -603,9 +677,8 @@ export declare class UserTransformableCanvas implements Canvas {
|
|
|
603
677
|
addEdge(edge: AddEdgeRequest): UserTransformableCanvas;
|
|
604
678
|
updateEdge(edgeId: unknown, request: UpdateEdgeRequest): UserTransformableCanvas;
|
|
605
679
|
removeEdge(edgeId: unknown): UserTransformableCanvas;
|
|
606
|
-
patchViewportState(request:
|
|
607
|
-
|
|
608
|
-
moveNodeOnTop(nodeId: string): UserTransformableCanvas;
|
|
680
|
+
patchViewportState(request: PatchTransformRequest): UserTransformableCanvas;
|
|
681
|
+
patchContentState(request: PatchTransformRequest): UserTransformableCanvas;
|
|
609
682
|
clear(): UserTransformableCanvas;
|
|
610
683
|
attach(element: HTMLElement): UserTransformableCanvas;
|
|
611
684
|
detach(): UserTransformableCanvas;
|
|
@@ -616,7 +689,7 @@ export declare class UserTransformableCanvas implements Canvas {
|
|
|
616
689
|
private scaleViewport;
|
|
617
690
|
}
|
|
618
691
|
|
|
619
|
-
export declare class
|
|
692
|
+
export declare class VerticalEdgeShape implements EdgeShape {
|
|
620
693
|
private readonly color;
|
|
621
694
|
private readonly width;
|
|
622
695
|
private readonly arrowLength;
|
|
@@ -632,7 +705,7 @@ export declare class VerticalEdgeController implements EdgeController {
|
|
|
632
705
|
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
633
706
|
}
|
|
634
707
|
|
|
635
|
-
declare interface
|
|
708
|
+
declare interface VerticalEdgeShape_2 {
|
|
636
709
|
readonly type: "vertical";
|
|
637
710
|
readonly color?: string;
|
|
638
711
|
readonly width?: number;
|
|
@@ -648,12 +721,13 @@ declare interface VerticalEdgeOptions {
|
|
|
648
721
|
}
|
|
649
722
|
|
|
650
723
|
declare class ViewportTransformer {
|
|
651
|
-
private
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
724
|
+
private viewportMatrix;
|
|
725
|
+
private contentMatrix;
|
|
726
|
+
getViewportMatrix(): TransformState;
|
|
727
|
+
getContentMatrix(): TransformState;
|
|
728
|
+
patchViewportState(scale: number | null, x: number | null, y: number | null): void;
|
|
729
|
+
patchContentState(scale: number | null, x: number | null, y: number | null): void;
|
|
730
|
+
private calculateReverseMatrix;
|
|
657
731
|
}
|
|
658
732
|
|
|
659
733
|
export { }
|