@html-graph/html-graph 3.2.0 → 3.4.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/dist/html-graph.d.ts +84 -41
- package/dist/html-graph.js +718 -454
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/html-graph.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ declare interface AddPortRequest {
|
|
|
42
42
|
readonly direction: number;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
declare interface
|
|
45
|
+
export declare interface BackgroundConfig {
|
|
46
46
|
readonly tileDimensions?: {
|
|
47
47
|
readonly width?: number;
|
|
48
48
|
readonly height?: number;
|
|
@@ -124,12 +124,15 @@ export declare class Canvas {
|
|
|
124
124
|
private readonly onBeforeEdgeRemoved;
|
|
125
125
|
private readonly onBeforeClear;
|
|
126
126
|
private readonly onBeforeDestroyEmitter;
|
|
127
|
+
/**
|
|
128
|
+
* emits event just before destruction of canvas
|
|
129
|
+
*/
|
|
127
130
|
readonly onBeforeDestroy: EventHandler<void>;
|
|
128
131
|
constructor(
|
|
129
132
|
/**
|
|
130
133
|
* @deprecated access element directly instead
|
|
131
134
|
*/
|
|
132
|
-
element: HTMLElement, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView,
|
|
135
|
+
element: HTMLElement, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, defaults: CanvasDefaults);
|
|
133
136
|
/**
|
|
134
137
|
* adds new node
|
|
135
138
|
*/
|
|
@@ -195,15 +198,23 @@ export declare class Canvas {
|
|
|
195
198
|
export declare class CanvasBuilder {
|
|
196
199
|
private element;
|
|
197
200
|
private canvasDefaults;
|
|
198
|
-
private
|
|
199
|
-
private
|
|
200
|
-
private
|
|
201
|
-
private
|
|
201
|
+
private dragConfig;
|
|
202
|
+
private transformConfig;
|
|
203
|
+
private backgroundConfig;
|
|
204
|
+
private connectablePortsConfig;
|
|
205
|
+
private virtualScrollConfig;
|
|
202
206
|
private hasDraggableNode;
|
|
203
207
|
private hasTransformableViewport;
|
|
204
208
|
private hasResizeReactiveNodes;
|
|
205
209
|
private hasBackground;
|
|
210
|
+
private hasUserConnectablePorts;
|
|
206
211
|
private boxRenderingTrigger;
|
|
212
|
+
private readonly window;
|
|
213
|
+
constructor(element?: HTMLElement);
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated
|
|
216
|
+
* use `new CanvasBuilder(element);` instead
|
|
217
|
+
*/
|
|
207
218
|
setElement(element: HTMLElement): CanvasBuilder;
|
|
208
219
|
/**
|
|
209
220
|
* specifies default values for graph entities
|
|
@@ -212,11 +223,11 @@ export declare class CanvasBuilder {
|
|
|
212
223
|
/**
|
|
213
224
|
* enables nodes draggable by user
|
|
214
225
|
*/
|
|
215
|
-
enableUserDraggableNodes(options?:
|
|
226
|
+
enableUserDraggableNodes(options?: DraggableNodesConfig): CanvasBuilder;
|
|
216
227
|
/**
|
|
217
228
|
* enables viewport transformable by user
|
|
218
229
|
*/
|
|
219
|
-
enableUserTransformableViewport(
|
|
230
|
+
enableUserTransformableViewport(config?: ViewportTransformConfig): CanvasBuilder;
|
|
220
231
|
/**
|
|
221
232
|
* enables automatic edges update on node resize
|
|
222
233
|
*/
|
|
@@ -225,8 +236,19 @@ export declare class CanvasBuilder {
|
|
|
225
236
|
* sets emitter for rendering graph inside bounded area
|
|
226
237
|
*/
|
|
227
238
|
enableBoxAreaRendering(trigger: EventSubject<RenderingBox>): CanvasBuilder;
|
|
228
|
-
|
|
229
|
-
|
|
239
|
+
/**
|
|
240
|
+
* enables built-in virtual scroll behavior, when only nodes and edges close
|
|
241
|
+
* to viewport are rendered
|
|
242
|
+
*/
|
|
243
|
+
enableVirtualScroll(config: VirtualScrollConfig): CanvasBuilder;
|
|
244
|
+
/**
|
|
245
|
+
* enables built-in background rendering
|
|
246
|
+
*/
|
|
247
|
+
enableBackground(config?: BackgroundConfig): CanvasBuilder;
|
|
248
|
+
/**
|
|
249
|
+
* enables edge creation by dragging one port to another
|
|
250
|
+
*/
|
|
251
|
+
enableUserConnectablePorts(config?: ConnectablePortsConfig): CanvasBuilder;
|
|
230
252
|
/**
|
|
231
253
|
* builds final canvas
|
|
232
254
|
*/
|
|
@@ -279,6 +301,21 @@ export declare interface CanvasDefaults {
|
|
|
279
301
|
|
|
280
302
|
export declare type CenterFn = (width: number, height: number) => Point;
|
|
281
303
|
|
|
304
|
+
declare interface ConnectablePortsConfig {
|
|
305
|
+
readonly connectionTypeResolver?: ConnectionTypeResolver;
|
|
306
|
+
readonly connectionPreprocessor?: ConnectionPreprocessor;
|
|
307
|
+
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
308
|
+
readonly events?: {
|
|
309
|
+
readonly onAfterEdgeCreated?: (edgeId: unknown) => void;
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
export { ConnectablePortsConfig }
|
|
313
|
+
export { ConnectablePortsConfig as ConnectablePortsOptions }
|
|
314
|
+
|
|
315
|
+
export declare type ConnectionPreprocessor = (request: AddEdgeRequest) => AddEdgeRequest | null;
|
|
316
|
+
|
|
317
|
+
export declare type ConnectionTypeResolver = (portId: unknown) => "direct" | "reverse" | null;
|
|
318
|
+
|
|
282
319
|
declare type ConstantPriority = number;
|
|
283
320
|
|
|
284
321
|
declare type CustomPriority = PriorityFn;
|
|
@@ -288,12 +325,12 @@ declare interface DotsRenderer {
|
|
|
288
325
|
readonly color?: string;
|
|
289
326
|
}
|
|
290
327
|
|
|
291
|
-
|
|
328
|
+
declare interface DraggableNodesConfig {
|
|
292
329
|
readonly moveOnTop?: boolean;
|
|
293
330
|
readonly mouse?: {
|
|
294
331
|
readonly dragCursor?: string | null;
|
|
295
|
-
readonly mouseDownEventVerifier?:
|
|
296
|
-
readonly mouseUpEventVerifier?:
|
|
332
|
+
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
333
|
+
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
297
334
|
};
|
|
298
335
|
readonly events?: {
|
|
299
336
|
readonly onNodeDrag?: (payload: NodeDragPayload) => void;
|
|
@@ -301,6 +338,8 @@ export declare interface DragOptions {
|
|
|
301
338
|
readonly onNodeDragFinished?: (payload: NodeDragPayload) => void;
|
|
302
339
|
};
|
|
303
340
|
}
|
|
341
|
+
export { DraggableNodesConfig as DragOptions }
|
|
342
|
+
export { DraggableNodesConfig }
|
|
304
343
|
|
|
305
344
|
declare interface EdgePayload {
|
|
306
345
|
readonly from: unknown;
|
|
@@ -560,6 +599,8 @@ export declare interface MarkPortRequest {
|
|
|
560
599
|
readonly direction?: number;
|
|
561
600
|
}
|
|
562
601
|
|
|
602
|
+
export declare type MouseEventVerifier = (event: MouseEvent) => boolean;
|
|
603
|
+
|
|
563
604
|
export declare interface NodeDragPayload {
|
|
564
605
|
readonly nodeId: unknown;
|
|
565
606
|
readonly element: HTMLElement;
|
|
@@ -665,37 +706,13 @@ declare type StraightEdgeShapeConfig = {
|
|
|
665
706
|
readonly type: "straight";
|
|
666
707
|
} & StraightEdgeParams;
|
|
667
708
|
|
|
668
|
-
export declare interface TransformOptions {
|
|
669
|
-
readonly scale?: {
|
|
670
|
-
readonly mouseWheelSensitivity?: number;
|
|
671
|
-
readonly mouseWheelEventVerifier?: (event: WheelEvent) => boolean;
|
|
672
|
-
readonly wheelFinishTimeout?: number;
|
|
673
|
-
};
|
|
674
|
-
readonly shift?: {
|
|
675
|
-
readonly cursor?: string | null;
|
|
676
|
-
readonly mouseDownEventVerifier?: (event: MouseEvent) => boolean;
|
|
677
|
-
readonly mouseUpEventVerifier?: (event: MouseEvent) => boolean;
|
|
678
|
-
};
|
|
679
|
-
readonly transformPreprocessor?: TransformPreprocessorOption | TransformPreprocessorOption[];
|
|
680
|
-
readonly events?: {
|
|
681
|
-
readonly onTransformStarted?: () => void;
|
|
682
|
-
readonly onTransformFinished?: () => void;
|
|
683
|
-
readonly onBeforeTransformChange?: () => void;
|
|
684
|
-
readonly onTransformChange?: () => void;
|
|
685
|
-
readonly onResizeTransformStarted?: () => void;
|
|
686
|
-
readonly onResizeTransformFinished?: () => void;
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
|
|
690
709
|
export declare interface TransformPayload {
|
|
691
710
|
readonly scale: number;
|
|
692
711
|
readonly x: number;
|
|
693
712
|
readonly y: number;
|
|
694
713
|
}
|
|
695
714
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
declare type TransformPreprocessorOption = {
|
|
715
|
+
declare type TransformPreprocessorConfig = {
|
|
699
716
|
readonly type: "scale-limit";
|
|
700
717
|
readonly minContentScale?: number;
|
|
701
718
|
readonly maxContentScale?: number;
|
|
@@ -707,6 +724,8 @@ declare type TransformPreprocessorOption = {
|
|
|
707
724
|
readonly maxY?: number;
|
|
708
725
|
} | TransformPreprocessorFn;
|
|
709
726
|
|
|
727
|
+
export declare type TransformPreprocessorFn = (params: TransformPreprocessorParams) => TransformPayload;
|
|
728
|
+
|
|
710
729
|
export declare interface TransformPreprocessorParams {
|
|
711
730
|
readonly prevTransform: TransformPayload;
|
|
712
731
|
readonly nextTransform: TransformPayload;
|
|
@@ -797,10 +816,10 @@ declare type VerticalEdgeShapeConfig = {
|
|
|
797
816
|
* Responsibility: Provides access to viewport state for end user
|
|
798
817
|
*/
|
|
799
818
|
export declare class Viewport {
|
|
800
|
-
private readonly
|
|
819
|
+
private readonly viewportStore;
|
|
801
820
|
readonly onBeforeUpdated: EventHandler<void>;
|
|
802
821
|
readonly onAfterUpdated: EventHandler<void>;
|
|
803
|
-
constructor(
|
|
822
|
+
constructor(viewportStore: ViewportStore);
|
|
804
823
|
getViewportMatrix(): TransformState;
|
|
805
824
|
getContentMatrix(): TransformState;
|
|
806
825
|
}
|
|
@@ -822,7 +841,31 @@ declare class ViewportStore {
|
|
|
822
841
|
patchContentMatrix(matrix: PatchTransformRequest): void;
|
|
823
842
|
}
|
|
824
843
|
|
|
825
|
-
declare interface
|
|
844
|
+
declare interface ViewportTransformConfig {
|
|
845
|
+
readonly scale?: {
|
|
846
|
+
readonly mouseWheelSensitivity?: number;
|
|
847
|
+
readonly mouseWheelEventVerifier?: (event: WheelEvent) => boolean;
|
|
848
|
+
readonly wheelFinishTimeout?: number;
|
|
849
|
+
};
|
|
850
|
+
readonly shift?: {
|
|
851
|
+
readonly cursor?: string | null;
|
|
852
|
+
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
853
|
+
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
854
|
+
};
|
|
855
|
+
readonly transformPreprocessor?: TransformPreprocessorConfig | TransformPreprocessorConfig[];
|
|
856
|
+
readonly events?: {
|
|
857
|
+
readonly onTransformStarted?: () => void;
|
|
858
|
+
readonly onTransformFinished?: () => void;
|
|
859
|
+
readonly onBeforeTransformChange?: () => void;
|
|
860
|
+
readonly onTransformChange?: () => void;
|
|
861
|
+
readonly onResizeTransformStarted?: () => void;
|
|
862
|
+
readonly onResizeTransformFinished?: () => void;
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
export { ViewportTransformConfig as TransformOptions }
|
|
866
|
+
export { ViewportTransformConfig }
|
|
867
|
+
|
|
868
|
+
export declare interface VirtualScrollConfig {
|
|
826
869
|
readonly nodeContainingRadius: {
|
|
827
870
|
readonly vertical: number;
|
|
828
871
|
readonly horizontal: number;
|