@html-graph/html-graph 0.0.58 → 0.0.59

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 CHANGED
@@ -35,9 +35,6 @@ import { HtmlGraphBuilder } from "@html-graph/html-graph";
35
35
 
36
36
  const canvas = new HtmlGraphBuilder()
37
37
  .setOptions({
38
- background: {
39
- type: "dots",
40
- },
41
38
  edges: {
42
39
  shape: {
43
40
  hasTargetArrow: true,
package/dist/main.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- declare interface AbstractViewportTransformer {
2
- getViewportMatrix(): TransformState;
3
- getContentMatrix(): TransformState;
4
- patchViewportMatrix(scale: number | null, x: number | null, y: number | null): void;
5
- patchContentMatrix(scale: number | null, dx: number | null, dy: number | null): void;
6
- }
7
-
8
1
  export declare interface AddEdgeRequest {
9
2
  readonly id?: unknown;
10
3
  readonly from: string;
@@ -25,22 +18,6 @@ export declare interface AddNodeRequest {
25
18
  readonly priority?: number;
26
19
  }
27
20
 
28
- export declare type BackgroundDrawingFn = (ctx: CanvasRenderingContext2D, transformer: PublicViewportTransformer) => void;
29
-
30
- declare type BackgroundOptions = {
31
- readonly type: "none";
32
- } | {
33
- readonly type: "dots";
34
- readonly dotColor?: string;
35
- readonly dotGap?: number;
36
- readonly dotRadius?: number;
37
- readonly color?: string;
38
- readonly limit?: number;
39
- } | {
40
- readonly type: "custom";
41
- readonly drawingFn: BackgroundDrawingFn;
42
- };
43
-
44
21
  export declare class BezierEdgeShape implements EdgeShape {
45
22
  private readonly curvature;
46
23
  private readonly arrowLength;
@@ -180,10 +157,6 @@ export declare type CenterFn = (width: number, height: number) => Point;
180
157
  declare type ConstantPriority = number;
181
158
 
182
159
  export declare interface CoreOptions {
183
- /**
184
- * canvas background settings
185
- */
186
- readonly background?: BackgroundOptions;
187
160
  /**
188
161
  * nodes related behavior
189
162
  */
@@ -296,7 +269,6 @@ export declare class CycleCircleEdgeShape implements EdgeShape {
296
269
  private readonly radius;
297
270
  private readonly smallRadius;
298
271
  readonly svg: SVGSVGElement;
299
- private readonly group;
300
272
  private readonly line;
301
273
  private readonly arrow;
302
274
  constructor(color: string, width: number, arrowLength: number, arrowWidth: number, hasArrow: boolean, radius: number, smallRadius: number);
@@ -310,7 +282,6 @@ export declare class CycleSquareEdgeShape implements EdgeShape {
310
282
  private readonly side;
311
283
  private readonly minPortOffset;
312
284
  readonly svg: SVGSVGElement;
313
- private readonly group;
314
285
  private readonly line;
315
286
  private readonly arrow;
316
287
  private readonly roundness;
@@ -320,6 +291,22 @@ export declare class CycleSquareEdgeShape implements EdgeShape {
320
291
  private createLinePath;
321
292
  }
322
293
 
294
+ export declare class DetourBezierEdgeShape implements EdgeShape {
295
+ private readonly curvature;
296
+ private readonly arrowLength;
297
+ private readonly arrowWidth;
298
+ readonly svg: SVGSVGElement;
299
+ private readonly group;
300
+ private readonly line;
301
+ private readonly sourceArrow;
302
+ private readonly targetArrow;
303
+ private readonly detourX;
304
+ private readonly detourY;
305
+ constructor(color: string, width: number, curvature: number, arrowLength: number, arrowWidth: number, hasSourceArrow: boolean, hasTargetArrow: boolean, detourDistance: number, detourDirection: number);
306
+ update(to: Point, flipX: number, flipY: number, fromDir: number, toDir: number): void;
307
+ private createLinePath;
308
+ }
309
+
323
310
  export declare class DetourStraightEdgeShape implements EdgeShape {
324
311
  private readonly arrowLength;
325
312
  private readonly arrowWidth;
@@ -346,13 +333,6 @@ export declare interface DragOptions {
346
333
  };
347
334
  }
348
335
 
349
- declare interface EdgePayload {
350
- readonly from: unknown;
351
- readonly to: unknown;
352
- shape: EdgeShape;
353
- priority: number;
354
- }
355
-
356
336
  export declare interface EdgeShape {
357
337
  readonly svg: SVGSVGElement;
358
338
  update(to: Point, flipX: number, flipY: number, fromDir: number, toDir: number): void;
@@ -388,40 +368,6 @@ export declare interface GraphPort {
388
368
  readonly direction: number;
389
369
  }
390
370
 
391
- declare class GraphStore {
392
- private readonly nodes;
393
- private readonly ports;
394
- private readonly nodePorts;
395
- private readonly portNodeId;
396
- private readonly edges;
397
- private readonly incommingEdges;
398
- private readonly outcommingEdges;
399
- private readonly cycleEdges;
400
- addNode(nodeId: unknown, element: HTMLElement, x: number, y: number, centerFn: CenterFn, priority: number): void;
401
- getAllNodeIds(): readonly unknown[];
402
- getNode(nodeId: unknown): NodePayload | undefined;
403
- removeNode(nodeId: unknown): void;
404
- addPort(portId: unknown, element: HTMLElement, nodeId: unknown, centerFn: CenterFn, dir: number): void;
405
- getPort(portId: unknown): PortPayload | undefined;
406
- getAllPortIds(): readonly unknown[];
407
- getNodePortIds(nodeId: unknown): readonly unknown[] | undefined;
408
- getPortNodeId(portId: unknown): unknown | undefined;
409
- removePort(portId: unknown): void;
410
- addEdge(edgeId: unknown, fromPortId: unknown, toPortId: unknown, shape: EdgeShape, priority: number): void;
411
- getAllEdgeIds(): readonly unknown[];
412
- getEdge(edgeId: unknown): EdgePayload | undefined;
413
- removeEdge(edgeId: unknown): void;
414
- clear(): void;
415
- getPortIncomingEdgeIds(portId: unknown): readonly unknown[];
416
- getPortOutcomingEdgeIds(portId: unknown): readonly unknown[];
417
- getPortCycleEdgeIds(portId: unknown): readonly unknown[];
418
- getPortAdjacentEdgeIds(portId: unknown): readonly unknown[];
419
- getNodeIncomingEdgeIds(nodeId: unknown): readonly unknown[];
420
- getNodeOutcomingEdgeIds(nodeId: unknown): readonly unknown[];
421
- getNodeCycleEdgeIds(nodeId: unknown): readonly unknown[];
422
- getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[];
423
- }
424
-
425
371
  export declare class HorizontalEdgeShape implements EdgeShape {
426
372
  private readonly arrowLength;
427
373
  private readonly arrowWidth;
@@ -492,14 +438,6 @@ export declare interface NodeDragPayload {
492
438
  readonly y: number;
493
439
  }
494
440
 
495
- declare interface NodePayload {
496
- element: HTMLElement;
497
- x: number;
498
- y: number;
499
- centerFn: CenterFn;
500
- priority: number;
501
- }
502
-
503
441
  export declare interface PatchMatrixRequest {
504
442
  readonly scale?: number;
505
443
  readonly dx?: number;
@@ -511,28 +449,20 @@ export declare interface Point {
511
449
  readonly y: number;
512
450
  }
513
451
 
514
- declare interface PortPayload {
515
- readonly element: HTMLElement;
516
- centerFn: CenterFn;
517
- direction: number;
518
- }
519
-
520
452
  declare type Priority = ConstantPriority | IncrementalPriority | SharedIncrementalPriority | CustomPriority;
521
453
 
522
454
  export declare type PriorityFn = () => number;
523
455
 
524
- declare class PublicGraphStore {
525
- private readonly graphStore;
526
- constructor(graphStore: GraphStore);
456
+ export declare interface PublicGraphStore {
527
457
  getAllNodeIds(): readonly unknown[];
528
458
  getAllPortIds(): readonly unknown[];
529
459
  getNode(nodeId: unknown): GraphNode | null;
530
460
  getNodePortIds(nodeId: unknown): readonly unknown[] | undefined;
531
461
  getPort(portId: unknown): GraphPort | null;
532
- getPortNodeId(portId: string): unknown | null;
462
+ getPortNodeId(portId: unknown): unknown | null;
533
463
  getAllEdgeIds(): readonly unknown[];
534
464
  getEdge(edgeId: unknown): GraphEdge | null;
535
- getPortAdjacentEdgeIds(portId: string): readonly unknown[];
465
+ getPortAdjacentEdgeIds(portId: unknown): readonly unknown[];
536
466
  getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[];
537
467
  getPortIncomingEdgeIds(portId: unknown): readonly unknown[];
538
468
  getPortOutcomingEdgeIds(portId: unknown): readonly unknown[];
@@ -542,9 +472,7 @@ declare class PublicGraphStore {
542
472
  getNodeCycleEdgeIds(nodeId: unknown): readonly unknown[];
543
473
  }
544
474
 
545
- export declare class PublicViewportTransformer {
546
- private readonly transformer;
547
- constructor(transformer: AbstractViewportTransformer);
475
+ export declare interface PublicViewportTransformer {
548
476
  getViewportMatrix(): TransformState;
549
477
  getContentMatrix(): TransformState;
550
478
  }
@@ -581,7 +509,7 @@ declare interface StraightEdgeShape_2 {
581
509
  readonly detourDirection?: number;
582
510
  }
583
511
 
584
- export declare type TransformFinishedFn = (transform: TransformPayload) => void;
512
+ export declare type TransformFinishedFn = () => void;
585
513
 
586
514
  export declare interface TransformOptions {
587
515
  readonly scale?: {