@utisha/graph-editor 1.0.6 → 1.0.7

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.
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter, OnChanges, OnInit, SimpleChanges, Type } from '@angular/core';
2
2
  import { Graph, GraphEdge, GraphNode, Position } from './graph.model';
3
- import { ContextMenuEvent, GraphEditorConfig, NodeTypeDefinition, SelectionState, ValidationResult } from './graph-editor.config';
3
+ import { ContextMenuEvent, GraphEditorConfig, NodeTypeDefinition, SelectionState, ToolbarItem, ValidationResult } from './graph-editor.config';
4
4
  import { SvgIconDefinition } from './icons/workflow-icons';
5
5
  import { NodeHtmlTemplateDirective, NodeSvgTemplateDirective, EdgeTemplateDirective, NodeTemplateContext, EdgeTemplateContext } from './template.directives';
6
6
  import { ResolvedTheme } from './theme.resolver';
@@ -184,6 +184,17 @@ export declare class GraphEditorComponent implements OnInit, OnChanges {
184
184
  * When there are too many node types to fit vertically, creates additional columns.
185
185
  */
186
186
  getPaletteColumns(): NodeTypeDefinition[][];
187
+ /**
188
+ * Check whether a toolbar item should be shown.
189
+ * If `config.toolbar.items` is not set, all items are visible.
190
+ */
191
+ showToolbarItem(item: ToolbarItem): boolean;
192
+ /**
193
+ * Check whether a divider should be shown between two toolbar groups.
194
+ * A divider is shown when at least one item from the group before and
195
+ * at least one item from the group after are visible.
196
+ */
197
+ showToolbarDivider(before: ToolbarItem[], after: ToolbarItem[]): boolean;
187
198
  /**
188
199
  * Get the position for the node image (top-left corner of image).
189
200
  * Uses same positioning logic as icon but accounts for image dimensions.
@@ -18,6 +18,8 @@ export interface GraphEditorConfig {
18
18
  theme?: ThemeConfig;
19
19
  /** Palette configuration */
20
20
  palette?: PaletteConfig;
21
+ /** Top toolbar configuration */
22
+ toolbar?: ToolbarConfig;
21
23
  }
22
24
  /**
23
25
  * Node type configuration.
@@ -371,6 +373,26 @@ export interface PaletteConfig {
371
373
  collapsible?: boolean;
372
374
  groupByCategory?: boolean;
373
375
  }
376
+ /**
377
+ * Toolbar item identifiers for the top toolbar.
378
+ * - `'hand'` — Hand tool (move nodes)
379
+ * - `'line'` — Line tool (draw connections)
380
+ * - `'zoom-in'` — Zoom in
381
+ * - `'zoom-out'` — Zoom out
382
+ * - `'layout'` — Auto layout
383
+ * - `'fit'` — Fit to screen
384
+ */
385
+ export type ToolbarItem = 'hand' | 'line' | 'zoom-in' | 'zoom-out' | 'layout' | 'fit';
386
+ /**
387
+ * Top toolbar configuration.
388
+ * Controls visibility of the top toolbar and which buttons are shown.
389
+ */
390
+ export interface ToolbarConfig {
391
+ /** Show the top toolbar (default: true) */
392
+ enabled?: boolean;
393
+ /** Which toolbar buttons to show. If omitted, all buttons are shown. */
394
+ items?: ToolbarItem[];
395
+ }
374
396
  /**
375
397
  * Selection state.
376
398
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utisha/graph-editor",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Configuration-driven visual graph editor for Angular 19+",
5
5
  "author": "Utisha",
6
6
  "license": "MIT",
package/public-api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { GraphEditorComponent } from './lib/graph-editor.component';
2
2
  export type { Graph, GraphNode, GraphEdge, Position, NodeMetadata, EdgeMetadata, EdgeStyle, GraphMetadata } from './lib/graph.model';
3
- export type { GraphEditorConfig, NodesConfig, EdgesConfig, CanvasConfig, ValidationConfig, LayoutConfig, InteractionConfig, ThemeConfig, PaletteConfig, NodeTypeDefinition, PortConfig, PortDefinition, NodeConstraints, GridConfig, ZoomConfig, PanConfig, ValidationRule, ValidationError, LayoutOptions, ContextMenuConfig, ContextMenuItem, ContextMenuContext, SelectionState, ValidationResult, ContextMenuEvent, CanvasTheme, NodeTheme, NodeTypeStyle, EdgeTheme, PortTheme, SelectionTheme, FontTheme, ToolbarTheme } from './lib/graph-editor.config';
3
+ export type { GraphEditorConfig, NodesConfig, EdgesConfig, CanvasConfig, ValidationConfig, LayoutConfig, InteractionConfig, ThemeConfig, PaletteConfig, ToolbarConfig, ToolbarItem, NodeTypeDefinition, PortConfig, PortDefinition, NodeConstraints, GridConfig, ZoomConfig, PanConfig, ValidationRule, ValidationError, LayoutOptions, ContextMenuConfig, ContextMenuItem, ContextMenuContext, SelectionState, ValidationResult, ContextMenuEvent, CanvasTheme, NodeTheme, NodeTypeStyle, EdgeTheme, PortTheme, SelectionTheme, FontTheme, ToolbarTheme } from './lib/graph-editor.config';
4
4
  export type { SvgIconDefinition } from './lib/icons/workflow-icons';
5
5
  export { renderIconSvg, iconToDataUrl } from './lib/icons/workflow-icons';
6
6
  export { NodeHtmlTemplateDirective, NodeSvgTemplateDirective, EdgeTemplateDirective } from './lib/template.directives';