@html-graph/html-graph 0.0.58 → 0.0.60

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;
@@ -157,6 +134,7 @@ export declare class CanvasCore implements Canvas {
157
134
  readonly model: PublicGraphStore;
158
135
  private readonly di;
159
136
  private readonly edgeShapeFactory;
137
+ private readonly nodeResizeObserverFactory;
160
138
  constructor(apiOptions?: CoreOptions | undefined);
161
139
  addNode(node: AddNodeRequest): CanvasCore;
162
140
  updateNode(nodeId: unknown, request: UpdateNodeRequest): CanvasCore;
@@ -180,10 +158,6 @@ export declare type CenterFn = (width: number, height: number) => Point;
180
158
  declare type ConstantPriority = number;
181
159
 
182
160
  export declare interface CoreOptions {
183
- /**
184
- * canvas background settings
185
- */
186
- readonly background?: BackgroundOptions;
187
161
  /**
188
162
  * nodes related behavior
189
163
  */
@@ -296,7 +270,6 @@ export declare class CycleCircleEdgeShape implements EdgeShape {
296
270
  private readonly radius;
297
271
  private readonly smallRadius;
298
272
  readonly svg: SVGSVGElement;
299
- private readonly group;
300
273
  private readonly line;
301
274
  private readonly arrow;
302
275
  constructor(color: string, width: number, arrowLength: number, arrowWidth: number, hasArrow: boolean, radius: number, smallRadius: number);
@@ -310,7 +283,6 @@ export declare class CycleSquareEdgeShape implements EdgeShape {
310
283
  private readonly side;
311
284
  private readonly minPortOffset;
312
285
  readonly svg: SVGSVGElement;
313
- private readonly group;
314
286
  private readonly line;
315
287
  private readonly arrow;
316
288
  private readonly roundness;
@@ -320,6 +292,22 @@ export declare class CycleSquareEdgeShape implements EdgeShape {
320
292
  private createLinePath;
321
293
  }
322
294
 
295
+ export declare class DetourBezierEdgeShape implements EdgeShape {
296
+ private readonly curvature;
297
+ private readonly arrowLength;
298
+ private readonly arrowWidth;
299
+ readonly svg: SVGSVGElement;
300
+ private readonly group;
301
+ private readonly line;
302
+ private readonly sourceArrow;
303
+ private readonly targetArrow;
304
+ private readonly detourX;
305
+ private readonly detourY;
306
+ constructor(color: string, width: number, curvature: number, arrowLength: number, arrowWidth: number, hasSourceArrow: boolean, hasTargetArrow: boolean, detourDistance: number, detourDirection: number);
307
+ update(to: Point, flipX: number, flipY: number, fromDir: number, toDir: number): void;
308
+ private createLinePath;
309
+ }
310
+
323
311
  export declare class DetourStraightEdgeShape implements EdgeShape {
324
312
  private readonly arrowLength;
325
313
  private readonly arrowWidth;
@@ -346,13 +334,6 @@ export declare interface DragOptions {
346
334
  };
347
335
  }
348
336
 
349
- declare interface EdgePayload {
350
- readonly from: unknown;
351
- readonly to: unknown;
352
- shape: EdgeShape;
353
- priority: number;
354
- }
355
-
356
337
  export declare interface EdgeShape {
357
338
  readonly svg: SVGSVGElement;
358
339
  update(to: Point, flipX: number, flipY: number, fromDir: number, toDir: number): void;
@@ -388,40 +369,6 @@ export declare interface GraphPort {
388
369
  readonly direction: number;
389
370
  }
390
371
 
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
372
  export declare class HorizontalEdgeShape implements EdgeShape {
426
373
  private readonly arrowLength;
427
374
  private readonly arrowWidth;
@@ -492,14 +439,6 @@ export declare interface NodeDragPayload {
492
439
  readonly y: number;
493
440
  }
494
441
 
495
- declare interface NodePayload {
496
- element: HTMLElement;
497
- x: number;
498
- y: number;
499
- centerFn: CenterFn;
500
- priority: number;
501
- }
502
-
503
442
  export declare interface PatchMatrixRequest {
504
443
  readonly scale?: number;
505
444
  readonly dx?: number;
@@ -511,28 +450,20 @@ export declare interface Point {
511
450
  readonly y: number;
512
451
  }
513
452
 
514
- declare interface PortPayload {
515
- readonly element: HTMLElement;
516
- centerFn: CenterFn;
517
- direction: number;
518
- }
519
-
520
453
  declare type Priority = ConstantPriority | IncrementalPriority | SharedIncrementalPriority | CustomPriority;
521
454
 
522
455
  export declare type PriorityFn = () => number;
523
456
 
524
- declare class PublicGraphStore {
525
- private readonly graphStore;
526
- constructor(graphStore: GraphStore);
457
+ export declare interface PublicGraphStore {
527
458
  getAllNodeIds(): readonly unknown[];
528
459
  getAllPortIds(): readonly unknown[];
529
460
  getNode(nodeId: unknown): GraphNode | null;
530
461
  getNodePortIds(nodeId: unknown): readonly unknown[] | undefined;
531
462
  getPort(portId: unknown): GraphPort | null;
532
- getPortNodeId(portId: string): unknown | null;
463
+ getPortNodeId(portId: unknown): unknown | null;
533
464
  getAllEdgeIds(): readonly unknown[];
534
465
  getEdge(edgeId: unknown): GraphEdge | null;
535
- getPortAdjacentEdgeIds(portId: string): readonly unknown[];
466
+ getPortAdjacentEdgeIds(portId: unknown): readonly unknown[];
536
467
  getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[];
537
468
  getPortIncomingEdgeIds(portId: unknown): readonly unknown[];
538
469
  getPortOutcomingEdgeIds(portId: unknown): readonly unknown[];
@@ -542,9 +473,7 @@ declare class PublicGraphStore {
542
473
  getNodeCycleEdgeIds(nodeId: unknown): readonly unknown[];
543
474
  }
544
475
 
545
- export declare class PublicViewportTransformer {
546
- private readonly transformer;
547
- constructor(transformer: AbstractViewportTransformer);
476
+ export declare interface PublicViewportTransformer {
548
477
  getViewportMatrix(): TransformState;
549
478
  getContentMatrix(): TransformState;
550
479
  }
@@ -581,7 +510,7 @@ declare interface StraightEdgeShape_2 {
581
510
  readonly detourDirection?: number;
582
511
  }
583
512
 
584
- export declare type TransformFinishedFn = (transform: TransformPayload) => void;
513
+ export declare type TransformFinishedFn = () => void;
585
514
 
586
515
  export declare interface TransformOptions {
587
516
  readonly scale?: {