@html-graph/html-graph 0.0.50 → 0.0.51
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 +2 -2
- package/dist/main.d.ts +37 -17
- package/dist/main.js +416 -292
- package/dist/main.umd.cjs +1 -1
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</a>
|
|
12
12
|
|
|
13
13
|
Instead of connecting nodes dirrectly this library uses concept of ports, which provide greater fexibility at managing edges.
|
|
14
|
-
Port is an entity of
|
|
14
|
+
Port is an entity of a node to which edge can be attached to.
|
|
15
15
|
|
|
16
16
|
This library fits for tasks where easy nodes customization and interactiveness are required.
|
|
17
17
|
|
|
@@ -81,7 +81,7 @@ canvas
|
|
|
81
81
|
|
|
82
82
|
Refer to [Examples](examples) for more.
|
|
83
83
|
|
|
84
|
-
## Run examples
|
|
84
|
+
## Run examples
|
|
85
85
|
|
|
86
86
|
Use node version >= 20
|
|
87
87
|
|
package/dist/main.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ declare interface BezierEdgeOptions {
|
|
|
58
58
|
readonly hasTargetArrow?: boolean;
|
|
59
59
|
readonly cycleRadius?: number;
|
|
60
60
|
readonly smallCycleRadius?: number;
|
|
61
|
+
readonly detourDistance?: number;
|
|
62
|
+
readonly detourDirection?: number;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export declare interface Canvas {
|
|
@@ -191,6 +193,10 @@ export declare interface CoreOptions {
|
|
|
191
193
|
* center of port determines point to which edge attaches
|
|
192
194
|
*/
|
|
193
195
|
readonly centerFn?: CenterFn;
|
|
196
|
+
/**
|
|
197
|
+
* specifies default direction of port
|
|
198
|
+
*/
|
|
199
|
+
readonly direction?: number;
|
|
194
200
|
};
|
|
195
201
|
/**
|
|
196
202
|
*edges related behavior
|
|
@@ -217,6 +223,8 @@ export declare const createBezierEdgeControllerFactory: (options: {
|
|
|
217
223
|
hasTargetArrow: boolean;
|
|
218
224
|
cycleRadius: number;
|
|
219
225
|
smallCycleRadius: number;
|
|
226
|
+
detourDistance: number;
|
|
227
|
+
detourDirection: number;
|
|
220
228
|
}) => EdgeControllerFactory;
|
|
221
229
|
|
|
222
230
|
export declare const createStraightEdgeControllerFactory: (options: {
|
|
@@ -229,6 +237,8 @@ export declare const createStraightEdgeControllerFactory: (options: {
|
|
|
229
237
|
hasTargetArrow: boolean;
|
|
230
238
|
cycleSquareSide: number;
|
|
231
239
|
roundness: number;
|
|
240
|
+
detourDistance: number;
|
|
241
|
+
detourDirection: number;
|
|
232
242
|
}) => EdgeControllerFactory;
|
|
233
243
|
|
|
234
244
|
declare interface CustomEdgeOptions {
|
|
@@ -263,11 +273,29 @@ export declare class CycleSquareEdgeController implements EdgeController {
|
|
|
263
273
|
private readonly line;
|
|
264
274
|
private readonly arrow;
|
|
265
275
|
private readonly roundness;
|
|
266
|
-
private readonly
|
|
276
|
+
private readonly linePoints;
|
|
267
277
|
constructor(color: string, width: number, arrowLength: number, arrowWidth: number, hasArrow: boolean, side: number, minPortOffset: number, roundness: number);
|
|
268
278
|
update(x: number, y: number, _width: number, _height: number, from: PortPayload): void;
|
|
269
279
|
}
|
|
270
280
|
|
|
281
|
+
export declare class DetourStraightEdgeController implements EdgeController {
|
|
282
|
+
private readonly color;
|
|
283
|
+
private readonly width;
|
|
284
|
+
private readonly arrowLength;
|
|
285
|
+
private readonly arrowWidth;
|
|
286
|
+
private readonly arrowOffset;
|
|
287
|
+
private readonly roundness;
|
|
288
|
+
readonly svg: SVGSVGElement;
|
|
289
|
+
private readonly group;
|
|
290
|
+
private readonly line;
|
|
291
|
+
private readonly sourceArrow;
|
|
292
|
+
private readonly targetArrow;
|
|
293
|
+
private readonly detourX;
|
|
294
|
+
private readonly detourY;
|
|
295
|
+
constructor(color: string, width: number, arrowLength: number, arrowWidth: number, arrowOffset: number, hasSourceArrow: boolean, hasTargetArrow: boolean, roundness: number, detourDistance: number, detourDirection: number);
|
|
296
|
+
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
297
|
+
}
|
|
298
|
+
|
|
271
299
|
export declare interface DragOptions {
|
|
272
300
|
events?: {
|
|
273
301
|
onNodeDrag?: (payload: NodeDragPayload) => void;
|
|
@@ -286,16 +314,8 @@ declare type EdgeOptions = BezierEdgeOptions | StraightEdgeOptions | CustomEdgeO
|
|
|
286
314
|
|
|
287
315
|
export declare enum EdgeType {
|
|
288
316
|
Regular = "regular",
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
export declare class EdgeUtils {
|
|
293
|
-
static getPortCenter(port: PortPayload): Point;
|
|
294
|
-
static rotate(point: Point, vector: Point, center: Point): Point;
|
|
295
|
-
static getDirectionVector(direction: number | null, flipX: number, flipY: number): Point;
|
|
296
|
-
static getArrowPath(vect: Point, shiftX: number, shiftY: number, arrowLength: number, arrowWidth: number): string;
|
|
297
|
-
static getArrowOffsetPath(vect: Point, shiftX: number, shiftY: number, arrowLength: number, arrowOffset: number): string;
|
|
298
|
-
static createStraightPath(ps: Point[]): string;
|
|
317
|
+
PortCycle = "port-cycle",
|
|
318
|
+
NodeCycle = "node-cycle"
|
|
299
319
|
}
|
|
300
320
|
|
|
301
321
|
export declare class HtmlGraphBuilder {
|
|
@@ -315,7 +335,7 @@ declare type LayersMode = "edges-on-top" | "nodes-on-top" | "edges-follow-node";
|
|
|
315
335
|
export declare type MarkNodePortRequest = HTMLElement | {
|
|
316
336
|
readonly element: HTMLElement;
|
|
317
337
|
readonly centerFn?: CenterFn;
|
|
318
|
-
readonly direction?: number
|
|
338
|
+
readonly direction?: number;
|
|
319
339
|
};
|
|
320
340
|
|
|
321
341
|
export declare interface MarkPortRequest {
|
|
@@ -323,7 +343,7 @@ export declare interface MarkPortRequest {
|
|
|
323
343
|
readonly element: HTMLElement;
|
|
324
344
|
readonly nodeId: string;
|
|
325
345
|
readonly centerFn?: CenterFn;
|
|
326
|
-
readonly direction?: number
|
|
346
|
+
readonly direction?: number;
|
|
327
347
|
}
|
|
328
348
|
|
|
329
349
|
export declare interface NodeDragPayload {
|
|
@@ -352,12 +372,10 @@ export declare interface PatchViewportRequest {
|
|
|
352
372
|
y?: number;
|
|
353
373
|
}
|
|
354
374
|
|
|
355
|
-
declare type Point = [number, number];
|
|
356
|
-
|
|
357
375
|
export declare interface PortPayload {
|
|
358
376
|
readonly element: HTMLElement;
|
|
359
377
|
readonly centerFn: CenterFn;
|
|
360
|
-
readonly direction: number
|
|
378
|
+
readonly direction: number;
|
|
361
379
|
}
|
|
362
380
|
|
|
363
381
|
export declare class PublicViewportTransformer {
|
|
@@ -391,12 +409,12 @@ export declare class StraightEdgeController implements EdgeController {
|
|
|
391
409
|
private readonly arrowLength;
|
|
392
410
|
private readonly arrowWidth;
|
|
393
411
|
private readonly arrowOffset;
|
|
412
|
+
private readonly roundness;
|
|
394
413
|
readonly svg: SVGSVGElement;
|
|
395
414
|
private readonly group;
|
|
396
415
|
private readonly line;
|
|
397
416
|
private readonly sourceArrow;
|
|
398
417
|
private readonly targetArrow;
|
|
399
|
-
private readonly roundness;
|
|
400
418
|
constructor(color: string, width: number, arrowLength: number, arrowWidth: number, arrowOffset: number, hasSourceArrow: boolean, hasTargetArrow: boolean, roundness: number);
|
|
401
419
|
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
402
420
|
}
|
|
@@ -412,6 +430,8 @@ declare interface StraightEdgeOptions {
|
|
|
412
430
|
readonly hasTargetArrow?: boolean;
|
|
413
431
|
readonly cycleSquareSide?: number;
|
|
414
432
|
readonly roundness?: number;
|
|
433
|
+
readonly detourDistance?: number;
|
|
434
|
+
readonly detourDirection?: number;
|
|
415
435
|
}
|
|
416
436
|
|
|
417
437
|
export declare interface TransformOptions {
|