@html-graph/html-graph 5.0.0 → 5.1.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.
@@ -17,10 +17,10 @@ declare interface AddEdgeRequest_2 {
17
17
  export declare type AddNodePorts = Iterable<MarkNodePortRequest>;
18
18
 
19
19
  export declare interface AddNodeRequest {
20
- readonly id?: Identifier;
20
+ readonly id?: Identifier | undefined;
21
21
  readonly element: HTMLElement;
22
- readonly x: number;
23
- readonly y: number;
22
+ readonly x?: number | null | undefined;
23
+ readonly y?: number | null | undefined;
24
24
  readonly ports?: AddNodePorts | undefined;
25
25
  readonly centerFn?: CenterFn | undefined;
26
26
  readonly priority?: number | undefined;
@@ -29,8 +29,8 @@ export declare interface AddNodeRequest {
29
29
  declare interface AddNodeRequest_2 {
30
30
  readonly id: Identifier;
31
31
  readonly element: HTMLElement;
32
- readonly x: number;
33
- readonly y: number;
32
+ readonly x: number | null;
33
+ readonly y: number | null;
34
34
  readonly centerFn: CenterFn;
35
35
  readonly priority: number;
36
36
  }
@@ -114,10 +114,6 @@ declare type BezierEdgeShapeConfig = {
114
114
  } & BezierEdgeParams;
115
115
 
116
116
  export declare class Canvas {
117
- private readonly graphStore;
118
- private readonly viewportStore;
119
- private readonly htmlView;
120
- private readonly params;
121
117
  /**
122
118
  * provides api for accessing model of rendered graph
123
119
  */
@@ -126,6 +122,10 @@ export declare class Canvas {
126
122
  * provides api for accessing viewport state
127
123
  */
128
124
  readonly viewport: Viewport;
125
+ private readonly graphStore;
126
+ private readonly viewportStore;
127
+ private readonly htmlView;
128
+ private readonly params;
129
129
  private readonly nodeIdGenerator;
130
130
  private readonly portIdGenerator;
131
131
  private readonly edgeIdGenerator;
@@ -147,7 +147,15 @@ export declare class Canvas {
147
147
  * emits event just before destruction of canvas
148
148
  */
149
149
  readonly onBeforeDestroy: EventHandler<void>;
150
- constructor(graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, params: CanvasParams);
150
+ constructor(
151
+ /**
152
+ * provides api for accessing model of rendered graph
153
+ */
154
+ graph: Graph,
155
+ /**
156
+ * provides api for accessing viewport state
157
+ */
158
+ viewport: Viewport, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, params: CanvasParams);
151
159
  /**
152
160
  * adds new node
153
161
  */
@@ -187,6 +195,11 @@ export declare class Canvas {
187
195
  * removes specified edge
188
196
  */
189
197
  removeEdge(edgeId: Identifier): Canvas;
198
+ /**
199
+ * clears canvas from nodes and edges
200
+ * canvas gets rolled back to initial state and can be reused
201
+ */
202
+ clear(): Canvas;
190
203
  /**
191
204
  * applies transformation for viewport matrix
192
205
  */
@@ -195,11 +208,6 @@ export declare class Canvas {
195
208
  * applies transformation for content matrix
196
209
  */
197
210
  patchContentMatrix(request: PatchMatrixRequest): Canvas;
198
- /**
199
- * clears canvas from nodes and edges
200
- * canvas gets rolled back to initial state and can be reused
201
- */
202
- clear(): Canvas;
203
211
  /**
204
212
  * destroys canvas
205
213
  * canvas element gets rolled back to initial state, and can not be reused
@@ -226,6 +234,8 @@ export declare class CanvasBuilder {
226
234
  private readonly boxRenderingTrigger;
227
235
  private readonly graphStore;
228
236
  private readonly viewportStore;
237
+ private readonly graph;
238
+ private readonly viewport;
229
239
  private readonly window;
230
240
  constructor(element: HTMLElement);
231
241
  /**
@@ -504,8 +514,8 @@ export declare interface GraphEdge {
504
514
 
505
515
  export declare interface GraphNode {
506
516
  readonly element: HTMLElement;
507
- readonly x: number;
508
- readonly y: number;
517
+ readonly x: number | null;
518
+ readonly y: number | null;
509
519
  readonly centerFn: CenterFn;
510
520
  readonly priority: number;
511
521
  }
@@ -627,13 +637,13 @@ declare interface HtmlView {
627
637
  detachNode(nodeId: Identifier): void;
628
638
  attachEdge(edgeId: Identifier): void;
629
639
  detachEdge(edgeId: Identifier): void;
630
- clear(): void;
631
- destroy(): void;
632
640
  updateNodePosition(nodeId: Identifier): void;
633
641
  updateNodePriority(nodeId: Identifier): void;
634
642
  updateEdgeShape(edgeId: Identifier): void;
635
643
  renderEdge(edgeId: Identifier): void;
636
644
  updateEdgePriority(edgeId: Identifier): void;
645
+ clear(): void;
646
+ destroy(): void;
637
647
  }
638
648
 
639
649
  export declare type Identifier = NonNullable<unknown>;
@@ -671,10 +681,10 @@ export declare type MarkNodePortRequest = {
671
681
  };
672
682
 
673
683
  export declare interface MarkPortRequest {
674
- readonly id?: Identifier;
684
+ readonly id?: Identifier | undefined;
675
685
  readonly element: HTMLElement;
676
686
  readonly nodeId: Identifier;
677
- readonly direction?: number;
687
+ readonly direction?: number | undefined;
678
688
  }
679
689
 
680
690
  export declare class MidpointEdgeShape implements StructuredEdgeShape {
@@ -737,8 +747,8 @@ declare interface StoreEdge {
737
747
  declare interface StoreNode {
738
748
  readonly element: HTMLElement;
739
749
  readonly payload: {
740
- x: number;
741
- y: number;
750
+ x: number | null;
751
+ y: number | null;
742
752
  centerFn: CenterFn;
743
753
  priority: number;
744
754
  };