@html-graph/html-graph 3.3.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 +50 -39
- package/dist/html-graph.js +197 -192
- 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;
|
|
@@ -198,11 +198,11 @@ export declare class Canvas {
|
|
|
198
198
|
export declare class CanvasBuilder {
|
|
199
199
|
private element;
|
|
200
200
|
private canvasDefaults;
|
|
201
|
-
private
|
|
202
|
-
private
|
|
203
|
-
private
|
|
204
|
-
private
|
|
205
|
-
private
|
|
201
|
+
private dragConfig;
|
|
202
|
+
private transformConfig;
|
|
203
|
+
private backgroundConfig;
|
|
204
|
+
private connectablePortsConfig;
|
|
205
|
+
private virtualScrollConfig;
|
|
206
206
|
private hasDraggableNode;
|
|
207
207
|
private hasTransformableViewport;
|
|
208
208
|
private hasResizeReactiveNodes;
|
|
@@ -210,6 +210,11 @@ export declare class CanvasBuilder {
|
|
|
210
210
|
private hasUserConnectablePorts;
|
|
211
211
|
private boxRenderingTrigger;
|
|
212
212
|
private readonly window;
|
|
213
|
+
constructor(element?: HTMLElement);
|
|
214
|
+
/**
|
|
215
|
+
* @deprecated
|
|
216
|
+
* use `new CanvasBuilder(element);` instead
|
|
217
|
+
*/
|
|
213
218
|
setElement(element: HTMLElement): CanvasBuilder;
|
|
214
219
|
/**
|
|
215
220
|
* specifies default values for graph entities
|
|
@@ -218,11 +223,11 @@ export declare class CanvasBuilder {
|
|
|
218
223
|
/**
|
|
219
224
|
* enables nodes draggable by user
|
|
220
225
|
*/
|
|
221
|
-
enableUserDraggableNodes(options?:
|
|
226
|
+
enableUserDraggableNodes(options?: DraggableNodesConfig): CanvasBuilder;
|
|
222
227
|
/**
|
|
223
228
|
* enables viewport transformable by user
|
|
224
229
|
*/
|
|
225
|
-
enableUserTransformableViewport(
|
|
230
|
+
enableUserTransformableViewport(config?: ViewportTransformConfig): CanvasBuilder;
|
|
226
231
|
/**
|
|
227
232
|
* enables automatic edges update on node resize
|
|
228
233
|
*/
|
|
@@ -235,15 +240,15 @@ export declare class CanvasBuilder {
|
|
|
235
240
|
* enables built-in virtual scroll behavior, when only nodes and edges close
|
|
236
241
|
* to viewport are rendered
|
|
237
242
|
*/
|
|
238
|
-
enableVirtualScroll(
|
|
243
|
+
enableVirtualScroll(config: VirtualScrollConfig): CanvasBuilder;
|
|
239
244
|
/**
|
|
240
245
|
* enables built-in background rendering
|
|
241
246
|
*/
|
|
242
|
-
enableBackground(
|
|
247
|
+
enableBackground(config?: BackgroundConfig): CanvasBuilder;
|
|
243
248
|
/**
|
|
244
249
|
* enables edge creation by dragging one port to another
|
|
245
250
|
*/
|
|
246
|
-
enableUserConnectablePorts(
|
|
251
|
+
enableUserConnectablePorts(config?: ConnectablePortsConfig): CanvasBuilder;
|
|
247
252
|
/**
|
|
248
253
|
* builds final canvas
|
|
249
254
|
*/
|
|
@@ -296,7 +301,7 @@ export declare interface CanvasDefaults {
|
|
|
296
301
|
|
|
297
302
|
export declare type CenterFn = (width: number, height: number) => Point;
|
|
298
303
|
|
|
299
|
-
|
|
304
|
+
declare interface ConnectablePortsConfig {
|
|
300
305
|
readonly connectionTypeResolver?: ConnectionTypeResolver;
|
|
301
306
|
readonly connectionPreprocessor?: ConnectionPreprocessor;
|
|
302
307
|
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
@@ -304,6 +309,8 @@ export declare interface ConnectablePortsOptions {
|
|
|
304
309
|
readonly onAfterEdgeCreated?: (edgeId: unknown) => void;
|
|
305
310
|
};
|
|
306
311
|
}
|
|
312
|
+
export { ConnectablePortsConfig }
|
|
313
|
+
export { ConnectablePortsConfig as ConnectablePortsOptions }
|
|
307
314
|
|
|
308
315
|
export declare type ConnectionPreprocessor = (request: AddEdgeRequest) => AddEdgeRequest | null;
|
|
309
316
|
|
|
@@ -318,7 +325,7 @@ declare interface DotsRenderer {
|
|
|
318
325
|
readonly color?: string;
|
|
319
326
|
}
|
|
320
327
|
|
|
321
|
-
|
|
328
|
+
declare interface DraggableNodesConfig {
|
|
322
329
|
readonly moveOnTop?: boolean;
|
|
323
330
|
readonly mouse?: {
|
|
324
331
|
readonly dragCursor?: string | null;
|
|
@@ -331,6 +338,8 @@ export declare interface DragOptions {
|
|
|
331
338
|
readonly onNodeDragFinished?: (payload: NodeDragPayload) => void;
|
|
332
339
|
};
|
|
333
340
|
}
|
|
341
|
+
export { DraggableNodesConfig as DragOptions }
|
|
342
|
+
export { DraggableNodesConfig }
|
|
334
343
|
|
|
335
344
|
declare interface EdgePayload {
|
|
336
345
|
readonly from: unknown;
|
|
@@ -697,37 +706,13 @@ declare type StraightEdgeShapeConfig = {
|
|
|
697
706
|
readonly type: "straight";
|
|
698
707
|
} & StraightEdgeParams;
|
|
699
708
|
|
|
700
|
-
export declare interface TransformOptions {
|
|
701
|
-
readonly scale?: {
|
|
702
|
-
readonly mouseWheelSensitivity?: number;
|
|
703
|
-
readonly mouseWheelEventVerifier?: (event: WheelEvent) => boolean;
|
|
704
|
-
readonly wheelFinishTimeout?: number;
|
|
705
|
-
};
|
|
706
|
-
readonly shift?: {
|
|
707
|
-
readonly cursor?: string | null;
|
|
708
|
-
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
709
|
-
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
710
|
-
};
|
|
711
|
-
readonly transformPreprocessor?: TransformPreprocessorOption | TransformPreprocessorOption[];
|
|
712
|
-
readonly events?: {
|
|
713
|
-
readonly onTransformStarted?: () => void;
|
|
714
|
-
readonly onTransformFinished?: () => void;
|
|
715
|
-
readonly onBeforeTransformChange?: () => void;
|
|
716
|
-
readonly onTransformChange?: () => void;
|
|
717
|
-
readonly onResizeTransformStarted?: () => void;
|
|
718
|
-
readonly onResizeTransformFinished?: () => void;
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
|
|
722
709
|
export declare interface TransformPayload {
|
|
723
710
|
readonly scale: number;
|
|
724
711
|
readonly x: number;
|
|
725
712
|
readonly y: number;
|
|
726
713
|
}
|
|
727
714
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
declare type TransformPreprocessorOption = {
|
|
715
|
+
declare type TransformPreprocessorConfig = {
|
|
731
716
|
readonly type: "scale-limit";
|
|
732
717
|
readonly minContentScale?: number;
|
|
733
718
|
readonly maxContentScale?: number;
|
|
@@ -739,6 +724,8 @@ declare type TransformPreprocessorOption = {
|
|
|
739
724
|
readonly maxY?: number;
|
|
740
725
|
} | TransformPreprocessorFn;
|
|
741
726
|
|
|
727
|
+
export declare type TransformPreprocessorFn = (params: TransformPreprocessorParams) => TransformPayload;
|
|
728
|
+
|
|
742
729
|
export declare interface TransformPreprocessorParams {
|
|
743
730
|
readonly prevTransform: TransformPayload;
|
|
744
731
|
readonly nextTransform: TransformPayload;
|
|
@@ -854,7 +841,31 @@ declare class ViewportStore {
|
|
|
854
841
|
patchContentMatrix(matrix: PatchTransformRequest): void;
|
|
855
842
|
}
|
|
856
843
|
|
|
857
|
-
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 {
|
|
858
869
|
readonly nodeContainingRadius: {
|
|
859
870
|
readonly vertical: number;
|
|
860
871
|
readonly horizontal: number;
|