@utisha/graph-editor 1.0.3 → 1.0.4

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;
@@ -114,6 +118,7 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
114
118
  onNodeClick(event: MouseEvent, node: GraphNode): void;
115
119
  onAttachmentPointClick(event: MouseEvent, node: GraphNode, port: 'top' | 'bottom' | 'left' | 'right'): void;
116
120
  onEdgeEndpointMouseDown(event: MouseEvent, edge: GraphEdge, endpoint: 'source' | 'target'): void;
121
+ onResizeHandleMouseDown(event: MouseEvent, node: GraphNode): void;
117
122
  onWheel(event: WheelEvent): void;
118
123
  onContextMenu(event: MouseEvent): void;
119
124
  private emitGraphChange;
@@ -175,6 +180,38 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
175
180
  getImageSize(node: GraphNode): number;
176
181
  getIconPosition(node: GraphNode): Position;
177
182
  getLabelPosition(node: GraphNode): Position;
183
+ /**
184
+ * Get the bounding box for label text within a node.
185
+ * This box avoids the icon area and has proper padding.
186
+ */
187
+ getLabelBounds(node: GraphNode): {
188
+ x: number;
189
+ y: number;
190
+ width: number;
191
+ height: number;
192
+ };
193
+ /**
194
+ * Get wrapped text lines and font size for a node label.
195
+ * Uses text wrapping first, then font downsizing if needed.
196
+ */
197
+ getWrappedLabel(node: GraphNode): {
198
+ lines: string[];
199
+ fontSize: number;
200
+ lineHeight: number;
201
+ };
202
+ /**
203
+ * Wrap text into lines respecting max characters per line.
204
+ * Tries to break at word boundaries.
205
+ */
206
+ private wrapText;
207
+ /**
208
+ * Get the Y position for each line of wrapped text (centered vertically).
209
+ */
210
+ getLabelLineY(node: GraphNode, lineIndex: number, totalLines: number, lineHeight: number): number;
211
+ /**
212
+ * Get the X position for label text (centered in bounds).
213
+ */
214
+ getLabelLineX(node: GraphNode): number;
178
215
  private findNodeAtPosition;
179
216
  private findEdgeAtPosition;
180
217
  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.4",
4
4
  "description": "Configuration-driven visual graph editor for Angular 19+",
5
5
  "author": "Utisha",
6
6
  "license": "MIT",