@html-graph/html-graph 8.16.0 → 8.18.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 +3 -3
- package/dist/html-graph.d.ts +44 -12
- package/dist/html-graph.js +399 -354
- package/dist/html-graph.min.js +868 -830
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +399 -354
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,9 +30,9 @@ import { CanvasBuilder } from "@html-graph/html-graph";
|
|
|
30
30
|
const element = document.getElementById("canvas");
|
|
31
31
|
|
|
32
32
|
const canvas = new CanvasBuilder(element)
|
|
33
|
-
.enableUserTransformableViewport()
|
|
34
|
-
.enableUserDraggableNodes()
|
|
35
|
-
.enableBackground()
|
|
33
|
+
.enableUserTransformableViewport() // Enables viewport pan and zoom
|
|
34
|
+
.enableUserDraggableNodes() // Enables draggable nodes
|
|
35
|
+
.enableBackground() // Renders background
|
|
36
36
|
.build();
|
|
37
37
|
```
|
|
38
38
|
|
package/dist/html-graph.d.ts
CHANGED
|
@@ -291,27 +291,38 @@ export declare type CenterFn = (width: number, height: number) => Point;
|
|
|
291
291
|
export declare interface ConnectablePortsConfig {
|
|
292
292
|
readonly edgeShape?: EdgeShapeConfig;
|
|
293
293
|
readonly connectionTypeResolver?: ConnectionTypeResolver;
|
|
294
|
+
readonly connectionAllowedVerifier?: ConnectionAllowedVerifier;
|
|
294
295
|
readonly connectionPreprocessor?: ConnectionPreprocessor;
|
|
295
296
|
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
296
297
|
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
297
|
-
readonly dragPortDirection?:
|
|
298
|
+
readonly dragPortDirection?: DraggingPortDirectionConfig;
|
|
298
299
|
readonly events?: {
|
|
299
300
|
readonly onAfterEdgeCreated?: (edgeId: Identifier) => void;
|
|
300
|
-
readonly onEdgeCreationInterrupted?: (params:
|
|
301
|
-
readonly staticPortId: Identifier;
|
|
302
|
-
readonly isDirect: boolean;
|
|
303
|
-
}) => void;
|
|
301
|
+
readonly onEdgeCreationInterrupted?: (params: EdgeCreationInProgressParams) => void;
|
|
304
302
|
readonly onEdgeCreationPrevented?: (request: AddEdgeRequest) => void;
|
|
305
303
|
};
|
|
306
304
|
}
|
|
307
305
|
|
|
306
|
+
export declare type ConnectionAllowedVerifier = (request: ConnectionAllowedVerifierRequest) => boolean;
|
|
307
|
+
|
|
308
|
+
export declare interface ConnectionAllowedVerifierRequest {
|
|
309
|
+
readonly from: Identifier;
|
|
310
|
+
readonly to: Identifier;
|
|
311
|
+
}
|
|
312
|
+
|
|
308
313
|
export declare enum ConnectionCategory {
|
|
309
314
|
Line = "line",
|
|
310
315
|
NodeCycle = "node-cycle",
|
|
311
316
|
PortCycle = "port-cycle"
|
|
312
317
|
}
|
|
313
318
|
|
|
314
|
-
export declare type ConnectionPreprocessor = (request: AddEdgeRequest) => AddEdgeRequest |
|
|
319
|
+
export declare type ConnectionPreprocessor = (request: AddEdgeRequest) => AddEdgeRequest | ConnectionPreprocessorNullResponse;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @deprecated
|
|
323
|
+
* connection preprocessor should not return null
|
|
324
|
+
*/
|
|
325
|
+
declare type ConnectionPreprocessorNullResponse = null;
|
|
315
326
|
|
|
316
327
|
export declare type ConnectionTypeResolver = (portId: Identifier) => "direct" | "reverse" | null;
|
|
317
328
|
|
|
@@ -366,12 +377,14 @@ declare interface DotsRenderer {
|
|
|
366
377
|
readonly color?: string;
|
|
367
378
|
}
|
|
368
379
|
|
|
369
|
-
declare interface DraggableEdgesConfig {
|
|
380
|
+
export declare interface DraggableEdgesConfig {
|
|
370
381
|
readonly connectionPreprocessor?: ConnectionPreprocessor;
|
|
382
|
+
readonly connectionAllowedVerifier?: ConnectionAllowedVerifier;
|
|
371
383
|
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
372
384
|
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
373
385
|
readonly draggingEdgeResolver?: DraggingEdgeResolver;
|
|
374
386
|
readonly draggingEdgeShape?: EdgeShapeConfig;
|
|
387
|
+
readonly dragPortDirection?: DraggingPortDirectionConfig;
|
|
375
388
|
readonly events?: {
|
|
376
389
|
readonly onAfterEdgeReattached?: (edgeId: Identifier) => void;
|
|
377
390
|
readonly onEdgeReattachInterrupted?: (edge: GraphEdge & {
|
|
@@ -400,6 +413,13 @@ export declare interface DraggableNodesConfig {
|
|
|
400
413
|
|
|
401
414
|
export declare type DraggingEdgeResolver = (portId: Identifier) => Identifier | null;
|
|
402
415
|
|
|
416
|
+
declare type DraggingPortDirectionConfig = number | undefined | "closest-connectable-port";
|
|
417
|
+
|
|
418
|
+
export declare interface EdgeCreationInProgressParams {
|
|
419
|
+
readonly staticPortId: Identifier;
|
|
420
|
+
readonly isDirect: boolean;
|
|
421
|
+
}
|
|
422
|
+
|
|
403
423
|
declare interface EdgePath {
|
|
404
424
|
readonly path: string;
|
|
405
425
|
readonly midpoint: Point;
|
|
@@ -707,6 +727,10 @@ export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
|
707
727
|
readonly line: SVGPathElement;
|
|
708
728
|
readonly sourceArrow: SVGPathElement | null;
|
|
709
729
|
readonly targetArrow: SVGPathElement | null;
|
|
730
|
+
/**
|
|
731
|
+
* @deprecated
|
|
732
|
+
* do use shape.svg instead
|
|
733
|
+
*/
|
|
710
734
|
readonly handle: SVGGElement;
|
|
711
735
|
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
712
736
|
private readonly interactiveLine;
|
|
@@ -752,11 +776,7 @@ export declare interface LayoutAlgorithmParams {
|
|
|
752
776
|
readonly viewport: Viewport;
|
|
753
777
|
}
|
|
754
778
|
|
|
755
|
-
export declare type LayoutApplyOn =
|
|
756
|
-
type: "topologyChangeMacrotask";
|
|
757
|
-
} | {
|
|
758
|
-
type: "topologyChangeMicrotask";
|
|
759
|
-
} | EventSubject<void>;
|
|
779
|
+
export declare type LayoutApplyOn = TopologyChangeMacrotask | TopologyChangeMicrotask | EventSubject<void>;
|
|
760
780
|
|
|
761
781
|
export declare interface LayoutConfig {
|
|
762
782
|
readonly algorithm?: LayoutAlgorithmConfig | undefined;
|
|
@@ -927,6 +947,18 @@ export declare interface StructuredEdgeShape extends EdgeShape {
|
|
|
927
947
|
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
928
948
|
}
|
|
929
949
|
|
|
950
|
+
/**
|
|
951
|
+
* @deprecated
|
|
952
|
+
* use topologyChangeMicrotask instead
|
|
953
|
+
*/
|
|
954
|
+
declare type TopologyChangeMacrotask = {
|
|
955
|
+
type: "topologyChangeMacrotask";
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
declare type TopologyChangeMicrotask = {
|
|
959
|
+
type: "topologyChangeMicrotask";
|
|
960
|
+
};
|
|
961
|
+
|
|
930
962
|
export declare type TransformDeclaration = {
|
|
931
963
|
readonly a?: number | undefined;
|
|
932
964
|
readonly b?: number | undefined;
|