@utisha/graph-editor 1.0.3 → 1.0.5

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.
@@ -69,6 +69,10 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
69
69
  width: number;
70
70
  height: number;
71
71
  } | null>;
72
+ private resizingNode;
73
+ private resizeStartSize;
74
+ private resizeStartMousePos;
75
+ private resizeMinSize;
72
76
  transform: import("@angular/core").Signal<string>;
73
77
  gridBounds: import("@angular/core").Signal<{
74
78
  x: number;
@@ -106,6 +110,8 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
106
110
  applyLayout(direction?: 'TB' | 'LR'): Promise<void>;
107
111
  fitToScreen(padding?: number): void;
108
112
  zoomTo(level: number): void;
113
+ zoomIn(): void;
114
+ zoomOut(): void;
109
115
  getSelection(): SelectionState;
110
116
  onCanvasMouseDown(event: MouseEvent): void;
111
117
  onCanvasMouseMove(event: MouseEvent): void;
@@ -114,6 +120,7 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
114
120
  onNodeClick(event: MouseEvent, node: GraphNode): void;
115
121
  onAttachmentPointClick(event: MouseEvent, node: GraphNode, port: 'top' | 'bottom' | 'left' | 'right'): void;
116
122
  onEdgeEndpointMouseDown(event: MouseEvent, edge: GraphEdge, endpoint: 'source' | 'target'): void;
123
+ onResizeHandleMouseDown(event: MouseEvent, node: GraphNode): void;
117
124
  onWheel(event: WheelEvent): void;
118
125
  onContextMenu(event: MouseEvent): void;
119
126
  private emitGraphChange;
@@ -163,6 +170,11 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
163
170
  * Used to render multiple path elements from a single path string.
164
171
  */
165
172
  splitIconPaths(pathData: string): string[];
173
+ /**
174
+ * Split node types into columns for the palette.
175
+ * When there are too many node types to fit vertically, creates additional columns.
176
+ */
177
+ getPaletteColumns(): NodeTypeDefinition[][];
166
178
  /**
167
179
  * Get the position for the node image (top-left corner of image).
168
180
  * Uses same positioning logic as icon but accounts for image dimensions.
@@ -175,6 +187,38 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
175
187
  getImageSize(node: GraphNode): number;
176
188
  getIconPosition(node: GraphNode): Position;
177
189
  getLabelPosition(node: GraphNode): Position;
190
+ /**
191
+ * Get the bounding box for label text within a node.
192
+ * This box avoids the icon area and has proper padding.
193
+ */
194
+ getLabelBounds(node: GraphNode): {
195
+ x: number;
196
+ y: number;
197
+ width: number;
198
+ height: number;
199
+ };
200
+ /**
201
+ * Get wrapped text lines and font size for a node label.
202
+ * Uses text wrapping first, then font downsizing if needed.
203
+ */
204
+ getWrappedLabel(node: GraphNode): {
205
+ lines: string[];
206
+ fontSize: number;
207
+ lineHeight: number;
208
+ };
209
+ /**
210
+ * Wrap text into lines respecting max characters per line.
211
+ * Tries to break at word boundaries.
212
+ */
213
+ private wrapText;
214
+ /**
215
+ * Get the Y position for each line of wrapped text (centered vertically).
216
+ */
217
+ getLabelLineY(node: GraphNode, lineIndex: number, totalLines: number, lineHeight: number): number;
218
+ /**
219
+ * Get the X position for label text (centered in bounds).
220
+ */
221
+ getLabelLineX(node: GraphNode): number;
178
222
  private findNodeAtPosition;
179
223
  private findEdgeAtPosition;
180
224
  private pointToSegmentDistance;
@@ -8,6 +8,10 @@ export interface GraphNode {
8
8
  data: Record<string, any>;
9
9
  position: Position;
10
10
  metadata?: NodeMetadata;
11
+ size?: {
12
+ width: number;
13
+ height: number;
14
+ };
11
15
  }
12
16
  /**
13
17
  * 2D position on canvas.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utisha/graph-editor",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Configuration-driven visual graph editor for Angular 19+",
5
5
  "author": "Utisha",
6
6
  "license": "MIT",