codeviz 0.1.1 → 0.1.3

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/dist/index.d.mts CHANGED
@@ -1,883 +1,15 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as _xyflow_react from '@xyflow/react';
3
- import { Viewport, Node, Edge, NodeMouseHandler, OnSelectionChangeParams, NodeProps, EdgeProps } from '@xyflow/react';
4
- import { Attributes } from 'graphology-types';
1
+ import { e as DirectoryNode, d as FileNode, g as SymbolNode, F as FileMetrics, b as SourceLocation, I as ImportEdge, C as CallEdge, i as CodeGraph, d3 as ViewMode, am as Theme, Z as ZoomLevel, r as ZoomLevelConfig, k as MapNode, cQ as IOverlayPort, cx as Overlay, d4 as SigmaTheme, p as CodeMap } from './useOverlayPort-dGxZQTue.mjs';
2
+ export { cl as AbsolutePosition, cL as AgentStatus, cw as AgentWidgetOverlay, cE as AgentWidgetOverlayInput, bM as AggregateNodeComponent, A as AggregateNodeData, c6 as AggregateReactFlowNodeData, ck as AnchorPoint, s as AnimationConfig, cI as AnnotationContentType, cu as AnnotationOverlay, cC as AnnotationOverlayInput, ct as BadgeOverlay, cB as BadgeOverlayInput, cH as BadgeSize, cG as BadgeVariant, cq as BaseOverlay, B as BoundingBox, bQ as BundledEdgeComponent, cb as BundledEdgeData, cS as CalculatedPosition, bP as CallEdgeComponent, ca as CallEdgeData, aU as ClusteringOptions, aV as ClusteringResult, bD as CodeMapComponent, t as CodeMapConfig, b$ as CodeMapProps, h as CodebaseMetadata, ag as ColorPalette, b3 as ComputeLayoutOptions, cr as CursorOverlay, cz as CursorOverlayInput, w as DEFAULT_ANIMATION_CONFIG, x as DEFAULT_CODEMAP_CONFIG, v as DEFAULT_LAYOUT_CONFIG, u as DEFAULT_ZOOM_LEVELS, aQ as DirectoryEdgeAttributes, aW as DirectoryForceOptions, aX as DirectoryForceResult, aT as DirectoryGraphResult, D as DirectoryMetrics, cv as DocumentOverlay, cD as DocumentOverlayInput, cK as DocumentStatus, cJ as DocumentType, aj as EdgeColors, cU as EdgePath, cn as EdgePosition, b0 as EdgeRoutingOptions, c3 as EdgeType, aR as EntityIdMapping, bJ as FileNodeComponent, c4 as FileNodeData, bE as Flow, c0 as FlowProps, a_ as ForcePositioningOptions, aP as GraphEdgeAttributes, aO as GraphNodeAttributes, aS as GraphologyConversionResult, aY as HierarchyOptions, aZ as HierarchyResult, cs as HighlightOverlay, cA as HighlightOverlayInput, cF as HighlightStyle, bO as ImportEdgeComponent, c9 as ImportEdgeData, L as LayoutConfig, cf as LayoutProgress, b4 as LayoutProgressCallback, o as MapEdge, n as MapEdgeType, j as MapNodeData, M as MapNodeType, m as MapScope, l as MapScopeData, cT as NodeBounds, ai as NodeColors, cm as NodePosition, c2 as NodeType, a$ as NoverlapOptions, cN as OverlayBatchUpdate, cO as OverlayClickHandler, ak as OverlayColors, cM as OverlayFilter, cP as OverlayHoverHandler, cy as OverlayInput, cY as OverlayLayer, cR as OverlayLayerProps, cW as OverlayPort, co as OverlayPosition, cp as OverlayType, a as Padding, c_ as PortalOverlayLayer, P as Position, af as RGBAColor, ae as RGBColor, cc as ReactFlowEdgeData, c8 as ReactFlowNodeData, d7 as RendererType, cZ as SVGOverlayLayer, ah as ScopeDepthColors, bK as ScopeNodeComponent, c7 as ScopeNodeData, c1 as ScopeNodeProps, d6 as SigmaEdgeAttributes, d9 as SigmaEdgeColors, da as SigmaHighlightConfig, db as SigmaLabelConfig, d5 as SigmaNodeAttributes, d8 as SigmaNodeColors, S as Size, f as SymbolKind, c as SymbolMetrics, bL as SymbolNodeComponent, c5 as SymbolNodeData, an as ThemeContextValue, bF as ThemeProvider, ao as ThemeProviderProps, al as UIColors, cg as UseLayoutOptions, ch as UseLayoutResult, ci as UseOverlayPortOptions, cj as UseOverlayPortResult, cV as ViewportTransform, b2 as ZoomLevelData, q as ZoomLevelName, b1 as ZoomPrecomputeOptions, be as assignClusterColors, W as boundingBoxFromCorners, _ as boundingBoxesOverlap, b6 as buildDirectoryGraph, bq as calculateNodeSize, c$ as calculateOverlayPosition, a4 as clampPosition, b5 as codeGraphToGraphology, bY as codeMapToReactFlowEdges, bX as codeMapToReactFlowNodes, bg as computeDirectoryForces, bt as computeEdges, bk as computeHierarchy, bC as computeLayout, bw as computeZoomLevels, V as createBoundingBox, cX as createOverlayPort, aM as createScopeColorGetter, aq as darkTheme, aB as darken, bb as detectCommunities, ab as detectLanguage, a2 as distance, bR as edgeTypes, a0 as expandBoundingBox, bW as formatLoc, bV as formatNumber, H as generateCallEdgeId, z as generateDirectoryId, y as generateFileId, G as generateImportEdgeId, aH as generateScopeDepthColors, E as generateSymbolId, d0 as getAnchorOffset, Q as getBasename, X as getBoundingBoxCenter, bm as getChildScopes, bd as getClusterStats, aJ as getContrastRatio, bZ as getDefaultExpandedScopes, au as getDefaultTheme, K as getDirectory, ba as getDirectoryConnectionWeight, bi as getDirectoryPosition, bv as getEdgeLabel, bu as getEdgesAtZoomLevel, b7 as getEntityId, O as getExtension, bS as getFileIcon, N as getFilename, b9 as getFilesInDirectory, ad as getIconName, aI as getLuminance, aa as getMediumFileLabel, bf as getNodeCluster, b8 as getNodeKey, bB as getNodeOpacityAtLevel, bA as getNodeSizeAtLevel, bc as getNodesInCluster, R as getParentDirectories, T as getPathDepth, bj as getPositionsAtDepth, bn as getRootScopes, bl as getScopeByDirectoryId, aG as getScopeDepthColor, a9 as getShortFileLabel, bT as getSymbolIcon, bU as getSymbolKindLabel, aL as getTextColorForBackground, ar as getTheme, at as getThemeIds, bz as getVisibleEdges, bx as getVisibleNodes, by as getVisibleScopes, a7 as getZoomLevel, b_ as getZoomLevelFromZoom, d1 as graphToScreen, av as hexToRgb, ay as hslToHex, ax as hslToRgb, ac as isCodeFile, Y as isPointInBoundingBox, a3 as lerp, ap as lightTheme, aA as lighten, U as matchesPattern, aN as mergeTheme, aD as mix, bN as nodeTypes, J as normalizePath, bh as normalizePositions, bp as positionAllNodes, bo as positionNodesInScope, as as registerTheme, bs as removeAllOverlaps, br as removeOverlapsInScope, aw as rgbToHex, az as rgbToHsl, aF as rgbaToCss, aC as saturate, a5 as scaleSize, d2 as screenToGraph, aK as shouldUseDarkText, a1 as shrinkBoundingBox, a8 as truncateLabel, a6 as uniformPadding, $ as unionBoundingBoxes, bH as useCurrentTheme, bI as useIsDarkTheme, cd as useLayout, ce as useOverlayPort, bG as useTheme, aE as withOpacity } from './useOverlayPort-dGxZQTue.mjs';
5
3
  import * as react from 'react';
6
4
  import { ReactNode } from 'react';
7
- import { LucideIcon } from 'lucide-react';
8
5
  import Sigma from 'sigma';
9
6
  import * as Graph from 'graphology';
10
7
  import Graph__default from 'graphology';
8
+ import { Attributes } from 'graphology-types';
11
9
  import Parser from 'tree-sitter';
12
-
13
- /**
14
- * Core type definitions for CodeViz
15
- *
16
- * @packageDocumentation
17
- */
18
- /** 2D position coordinates */
19
- interface Position {
20
- x: number;
21
- y: number;
22
- }
23
- /** Size dimensions */
24
- interface Size {
25
- width: number;
26
- height: number;
27
- }
28
- /** Bounding box defined by position and size */
29
- interface BoundingBox$1 {
30
- x: number;
31
- y: number;
32
- width: number;
33
- height: number;
34
- }
35
- /** Padding for containment regions */
36
- interface Padding {
37
- top: number;
38
- right: number;
39
- bottom: number;
40
- left: number;
41
- }
42
- /** Source code location within a file */
43
- interface SourceLocation {
44
- startLine: number;
45
- startColumn: number;
46
- endLine: number;
47
- endColumn: number;
48
- }
49
- /** Metrics for a single file */
50
- interface FileMetrics {
51
- /** Lines of code (excluding blank lines and comments) */
52
- loc: number;
53
- /** Total lines including blanks and comments */
54
- totalLines: number;
55
- /** Number of exported symbols */
56
- exportCount: number;
57
- /** Number of import statements */
58
- importCount: number;
59
- /** Cyclomatic complexity (if computed) */
60
- complexity?: number;
61
- }
62
- /** Metrics for a directory (aggregated from children) */
63
- interface DirectoryMetrics {
64
- /** Total files in directory (recursive) */
65
- fileCount: number;
66
- /** Total lines of code (recursive) */
67
- totalLoc: number;
68
- /** Average complexity of files */
69
- avgComplexity?: number;
70
- }
71
- /** Metrics for a code symbol */
72
- interface SymbolMetrics {
73
- /** Lines of code for this symbol */
74
- loc: number;
75
- /** Parameter count (for functions/methods) */
76
- parameterCount?: number;
77
- /** Cyclomatic complexity */
78
- complexity?: number;
79
- }
80
- /** A file in the codebase */
81
- interface FileNode$1 {
82
- /** Unique identifier (derived from path) */
83
- id: string;
84
- /** Full path relative to root */
85
- path: string;
86
- /** File name without directory */
87
- name: string;
88
- /** File extension (e.g., 'ts', 'py') */
89
- extension: string;
90
- /** ID of containing directory */
91
- directoryId: string;
92
- /** File metrics */
93
- metrics: FileMetrics;
94
- /** IDs of symbols defined in this file */
95
- symbols: string[];
96
- /** Language identifier */
97
- language: string;
98
- /** Whether file has parse errors */
99
- hasParseErrors?: boolean;
100
- /** Git conflict status */
101
- hasGitConflicts?: boolean;
102
- }
103
- /** A directory in the codebase */
104
- interface DirectoryNode {
105
- /** Unique identifier (derived from path) */
106
- id: string;
107
- /** Full path relative to root */
108
- path: string;
109
- /** Directory name */
110
- name: string;
111
- /** ID of parent directory (null for root) */
112
- parentId: string | null;
113
- /** IDs of child directories */
114
- children: string[];
115
- /** IDs of files directly in this directory */
116
- files: string[];
117
- /** Aggregated metrics */
118
- metrics: DirectoryMetrics;
119
- /** Nesting depth (0 for root) */
120
- depth: number;
121
- }
122
- /** Kind of code symbol */
123
- type SymbolKind = 'function' | 'class' | 'method' | 'variable' | 'constant' | 'type' | 'interface' | 'enum' | 'namespace' | 'property';
124
- /** A code symbol (function, class, etc.) */
125
- interface SymbolNode$1 {
126
- /** Unique identifier */
127
- id: string;
128
- /** Symbol name */
129
- name: string;
130
- /** Symbol kind */
131
- kind: SymbolKind;
132
- /** ID of containing file */
133
- fileId: string;
134
- /** Location in source file */
135
- location: SourceLocation;
136
- /** Function/method signature */
137
- signature?: string;
138
- /** Whether symbol is exported */
139
- exported: boolean;
140
- /** Symbol metrics */
141
- metrics: SymbolMetrics;
142
- /** Parent symbol ID (for methods in classes) */
143
- parentSymbolId?: string;
144
- }
145
- /** An import relationship between files */
146
- interface ImportEdge$1 {
147
- /** Unique identifier */
148
- id: string;
149
- /** Source file ID (the file with the import statement) */
150
- sourceId: string;
151
- /** Target file ID (the file being imported) */
152
- targetId: string;
153
- /** Import type */
154
- importType: 'static' | 'dynamic' | 'type-only';
155
- /** Specific symbols imported (empty for namespace imports) */
156
- importedSymbols: string[];
157
- /** Whether the import could be resolved */
158
- resolved: boolean;
159
- }
160
- /** A call relationship between symbols */
161
- interface CallEdge$1 {
162
- /** Unique identifier */
163
- id: string;
164
- /** Caller symbol ID */
165
- sourceId: string;
166
- /** Callee symbol ID */
167
- targetId: string;
168
- /** Number of call sites */
169
- callCount: number;
170
- /** Whether the call target could be resolved */
171
- resolved: boolean;
172
- }
173
- /** Metadata about the analyzed codebase */
174
- interface CodebaseMetadata {
175
- /** Root directory path */
176
- rootPath: string;
177
- /** Analysis timestamp */
178
- analyzedAt: string;
179
- /** Total file count */
180
- totalFiles: number;
181
- /** Total directory count */
182
- totalDirectories: number;
183
- /** Total symbol count */
184
- totalSymbols: number;
185
- /** Languages detected */
186
- languages: string[];
187
- /** Analysis duration in milliseconds */
188
- analysisDurationMs: number;
189
- }
190
- /** Complete code graph - input to layout computation */
191
- interface CodeGraph {
192
- /** All files in the codebase */
193
- files: FileNode$1[];
194
- /** All directories in the codebase */
195
- directories: DirectoryNode[];
196
- /** All symbols in the codebase */
197
- symbols: SymbolNode$1[];
198
- /** All import relationships */
199
- imports: ImportEdge$1[];
200
- /** All call relationships */
201
- calls: CallEdge$1[];
202
- /** Codebase metadata */
203
- metadata: CodebaseMetadata;
204
- }
205
- /** Type of entity a map node represents */
206
- type MapNodeType = 'file' | 'symbol' | 'aggregate';
207
- /** Visual data for a map node */
208
- interface MapNodeData {
209
- /** Display label */
210
- label: string;
211
- /** Truncated label for low zoom */
212
- shortLabel: string;
213
- /** Icon identifier */
214
- icon: string;
215
- /** Original entity reference */
216
- entityId: string;
217
- /** Entity type */
218
- entityType: 'file' | 'symbol';
219
- /** Metrics for sizing */
220
- metrics: FileMetrics | SymbolMetrics;
221
- /** File extension or symbol kind */
222
- subtype: string;
223
- }
224
- /** Visual data for an aggregate node */
225
- interface AggregateNodeData {
226
- /** Display label */
227
- label: string;
228
- /** Number of aggregated items */
229
- count: number;
230
- /** Total LOC of aggregated items */
231
- totalLoc: number;
232
- /** Aggregated entity IDs */
233
- entityIds: string[];
234
- }
235
- /** A positioned node on the map */
236
- interface MapNode {
237
- /** Unique identifier */
238
- id: string;
239
- /** Original entity ID from CodeGraph */
240
- entityId: string;
241
- /** Node type */
242
- type: MapNodeType;
243
- /** Computed position */
244
- position: Position;
245
- /** Computed size */
246
- size: Size;
247
- /** Containing scope ID */
248
- scopeId: string;
249
- /** Nesting depth */
250
- depth: number;
251
- /** Node visual data */
252
- data: MapNodeData | AggregateNodeData;
253
- /** Visibility by zoom level (0-4) */
254
- visibleAtLevels: number[];
255
- }
256
- /** Visual data for a scope */
257
- interface MapScopeData {
258
- /** Display label */
259
- label: string;
260
- /** File count in scope */
261
- fileCount: number;
262
- /** Total LOC in scope */
263
- totalLoc: number;
264
- /** Whether scope is expanded */
265
- expanded: boolean;
266
- }
267
- /** A containment region (directory) on the map */
268
- interface MapScope {
269
- /** Unique identifier */
270
- id: string;
271
- /** Original directory ID from CodeGraph */
272
- entityId: string;
273
- /** Parent scope ID (null for root) */
274
- parentId: string | null;
275
- /** Computed bounds */
276
- bounds: BoundingBox$1;
277
- /** Inner padding */
278
- padding: Padding;
279
- /** Nesting depth */
280
- depth: number;
281
- /** Scope visual data */
282
- data: MapScopeData;
283
- /** Child scope IDs */
284
- children: string[];
285
- /** Node IDs directly in this scope */
286
- nodes: string[];
287
- }
288
- /** Edge type for visualization */
289
- type MapEdgeType = 'import' | 'call' | 'bundled';
290
- /** A visual edge on the map */
291
- interface MapEdge {
292
- /** Unique identifier */
293
- id: string;
294
- /** Source node ID */
295
- sourceId: string;
296
- /** Target node ID */
297
- targetId: string;
298
- /** Edge type */
299
- type: MapEdgeType;
300
- /** Edge weight (for bundled edges, count of aggregated edges) */
301
- weight: number;
302
- /** Original edge IDs (for bundled edges) */
303
- originalEdgeIds?: string[];
304
- /** Visibility by zoom level (0-4) */
305
- visibleAtLevels: number[];
306
- }
307
- /** Semantic zoom level (0-4) */
308
- type ZoomLevel = 0 | 1 | 2 | 3 | 4;
309
- /** Zoom level names */
310
- type ZoomLevelName = 'overview' | 'modules' | 'files' | 'symbols' | 'code';
311
- /** Configuration for a single zoom level */
312
- interface ZoomLevelConfig {
313
- /** Zoom level number */
314
- level: ZoomLevel;
315
- /** Human-readable name */
316
- name: ZoomLevelName;
317
- /** Minimum zoom factor for this level */
318
- minZoom: number;
319
- /** Maximum zoom factor for this level */
320
- maxZoom: number;
321
- /** Whether to show file nodes at this level */
322
- showFiles: boolean;
323
- /** Minimum LOC for file to be visible (0 = all) */
324
- minFileLoc: number;
325
- /** Whether to show symbol nodes at this level */
326
- showSymbols: boolean;
327
- /** Whether to show call edges at this level */
328
- showCallEdges: boolean;
329
- /** Edge bundling strategy */
330
- edgeBundling: 'aggregate' | 'hierarchical' | 'none';
331
- /** Whether to show labels */
332
- showLabels: boolean;
333
- /** Maximum label length */
334
- maxLabelLength: number;
335
- }
336
- /** Default zoom level configurations */
337
- declare const DEFAULT_ZOOM_LEVELS: ZoomLevelConfig[];
338
- /** Layout algorithm configuration */
339
- interface LayoutConfig {
340
- /** ForceAtlas2 iterations */
341
- iterations: number;
342
- /** Gravity strength */
343
- gravity: number;
344
- /** Scaling ratio */
345
- scalingRatio: number;
346
- /** Scope padding */
347
- scopePadding: Padding;
348
- /** Minimum node size in pixels */
349
- minNodeSize: number;
350
- /** Maximum node size in pixels */
351
- maxNodeSize: number;
352
- /** Metric to use for node sizing */
353
- sizeMetric: 'loc' | 'complexity' | 'uniform';
354
- /** Minimum spacing between nodes */
355
- nodeSpacing: number;
356
- /** Random seed for reproducible layouts */
357
- seed?: number;
358
- }
359
- /** Default layout configuration */
360
- declare const DEFAULT_LAYOUT_CONFIG: LayoutConfig;
361
- /** Complete positioned code map - output of layout computation */
362
- interface CodeMap$1 {
363
- /** All positioned nodes */
364
- nodes: MapNode[];
365
- /** All scopes (directory regions) */
366
- scopes: MapScope[];
367
- /** All edges */
368
- edges: MapEdge[];
369
- /** Overall bounds of the map */
370
- bounds: BoundingBox$1;
371
- /** Zoom level configurations */
372
- zoomLevels: ZoomLevelConfig[];
373
- /** Layout configuration used */
374
- layoutConfig: LayoutConfig;
375
- /** Source code graph reference */
376
- codeGraphMetadata: CodebaseMetadata;
377
- }
378
- /** Animation configuration */
379
- interface AnimationConfig {
380
- /** Enable animations globally */
381
- enabled: boolean;
382
- /** Respect prefers-reduced-motion */
383
- respectReducedMotion: boolean;
384
- /** Zoom transition duration (ms) */
385
- zoomTransitionDuration: number;
386
- /** Scope toggle duration (ms) */
387
- scopeToggleDuration: number;
388
- /** Node appear duration (ms) */
389
- nodeAppearDuration: number;
390
- /** Cursor interpolation duration (ms) */
391
- cursorInterpolationDuration: number;
392
- }
393
- /** Default animation configuration */
394
- declare const DEFAULT_ANIMATION_CONFIG: AnimationConfig;
395
- /** Main CodeMap component configuration */
396
- interface CodeMapConfig {
397
- /** Zoom level configurations */
398
- zoomLevels?: ZoomLevelConfig[];
399
- /** Layout configuration */
400
- layout?: Partial<LayoutConfig>;
401
- /** Animation configuration */
402
- animation?: Partial<AnimationConfig>;
403
- /** Hysteresis percentage for zoom level transitions (0-1) */
404
- zoomHysteresis?: number;
405
- /** Initial zoom level */
406
- initialZoomLevel?: ZoomLevel;
407
- /** Initial viewport center */
408
- initialCenter?: Position;
409
- }
410
- /** Default CodeMap configuration */
411
- declare const DEFAULT_CODEMAP_CONFIG: Required<CodeMapConfig>;
412
-
413
- /**
414
- * Core utility functions for CodeViz
415
- *
416
- * @packageDocumentation
417
- */
418
-
419
- /**
420
- * Generate a deterministic ID from a file path.
421
- * Uses a simple hash to create a short, URL-safe identifier.
422
- */
423
- declare function generateFileId(path: string): string;
424
- /**
425
- * Generate a deterministic ID from a directory path.
426
- */
427
- declare function generateDirectoryId(path: string): string;
428
- /**
429
- * Generate a deterministic ID for a symbol.
430
- */
431
- declare function generateSymbolId(filePath: string, symbolName: string, line: number): string;
432
- /**
433
- * Generate a deterministic ID for an import edge.
434
- */
435
- declare function generateImportEdgeId(sourceId: string, targetId: string): string;
436
- /**
437
- * Generate a deterministic ID for a call edge.
438
- */
439
- declare function generateCallEdgeId(sourceId: string, targetId: string): string;
440
- /**
441
- * Normalize a path to use forward slashes and remove trailing slashes.
442
- */
443
- declare function normalizePath(path: string): string;
444
- /**
445
- * Get the directory portion of a path.
446
- */
447
- declare function getDirectory(path: string): string;
448
- /**
449
- * Get the filename from a path.
450
- */
451
- declare function getFilename(path: string): string;
452
- /**
453
- * Get the file extension (without dot).
454
- */
455
- declare function getExtension(path: string): string;
456
- /**
457
- * Get the filename without extension.
458
- */
459
- declare function getBasename(path: string): string;
460
- /**
461
- * Get all parent directories of a path.
462
- * Returns paths from immediate parent to root.
463
- */
464
- declare function getParentDirectories(path: string): string[];
465
- /**
466
- * Get the depth of a path (number of directory levels).
467
- */
468
- declare function getPathDepth(path: string): number;
469
- /**
470
- * Check if a path matches any of the given glob patterns.
471
- * Simple implementation supporting * and ** wildcards.
472
- */
473
- declare function matchesPattern(path: string, patterns: string[]): boolean;
474
- /**
475
- * Create a bounding box from position and size.
476
- */
477
- declare function createBoundingBox(position: Position, size: Size): BoundingBox$1;
478
- /**
479
- * Create a bounding box from corner points.
480
- */
481
- declare function boundingBoxFromCorners(topLeft: Position, bottomRight: Position): BoundingBox$1;
482
- /**
483
- * Get the center point of a bounding box.
484
- */
485
- declare function getBoundingBoxCenter(box: BoundingBox$1): Position;
486
- /**
487
- * Check if a point is inside a bounding box.
488
- */
489
- declare function isPointInBoundingBox(point: Position, box: BoundingBox$1): boolean;
490
- /**
491
- * Check if two bounding boxes overlap.
492
- */
493
- declare function boundingBoxesOverlap(a: BoundingBox$1, b: BoundingBox$1): boolean;
494
- /**
495
- * Get the union of multiple bounding boxes.
496
- */
497
- declare function unionBoundingBoxes(boxes: BoundingBox$1[]): BoundingBox$1;
498
- /**
499
- * Expand a bounding box by padding.
500
- */
501
- declare function expandBoundingBox(box: BoundingBox$1, padding: Padding): BoundingBox$1;
502
- /**
503
- * Shrink a bounding box by padding (inner content area).
504
- */
505
- declare function shrinkBoundingBox(box: BoundingBox$1, padding: Padding): BoundingBox$1;
506
- /**
507
- * Calculate distance between two positions.
508
- */
509
- declare function distance(a: Position, b: Position): number;
510
- /**
511
- * Linearly interpolate between two positions.
512
- */
513
- declare function lerp(a: Position, b: Position, t: number): Position;
514
- /**
515
- * Clamp a position within a bounding box.
516
- */
517
- declare function clampPosition(position: Position, bounds: BoundingBox$1): Position;
518
- /**
519
- * Scale a size uniformly.
520
- */
521
- declare function scaleSize(size: Size, factor: number): Size;
522
- /**
523
- * Create uniform padding.
524
- */
525
- declare function uniformPadding(value: number): Padding;
526
- /**
527
- * Determine the semantic zoom level from a zoom factor.
528
- * Applies hysteresis to prevent flickering at boundaries.
529
- */
530
- declare function getZoomLevel(zoomFactor: number, currentLevel: number, thresholds: {
531
- min: number;
532
- max: number;
533
- }[], hysteresis?: number): number;
534
- /**
535
- * Truncate a label to a maximum length with ellipsis.
536
- */
537
- declare function truncateLabel(label: string, maxLength: number): string;
538
- /**
539
- * Get a short label for a file (just the filename).
540
- */
541
- declare function getShortFileLabel(path: string): string;
542
- /**
543
- * Get a medium label for a file (parent/filename).
544
- */
545
- declare function getMediumFileLabel(path: string): string;
546
- /**
547
- * Detect language from file extension.
548
- */
549
- declare function detectLanguage(path: string): string;
550
- /**
551
- * Check if a file extension represents a code file.
552
- */
553
- declare function isCodeFile(path: string): boolean;
554
- /**
555
- * Get the Lucide icon name for a file or symbol.
556
- */
557
- declare function getIconName(type: string): string;
558
-
559
- /**
560
- * Theme type definitions for CodeViz
561
- *
562
- * @packageDocumentation
563
- */
564
- /** RGB color values (0-255) */
565
- interface RGBColor {
566
- r: number;
567
- g: number;
568
- b: number;
569
- }
570
- /** Color with optional alpha */
571
- interface RGBAColor extends RGBColor {
572
- a?: number;
573
- }
574
- /** Color palette for a specific element */
575
- interface ColorPalette {
576
- /** Primary/default color */
577
- primary: string;
578
- /** Secondary/muted color */
579
- secondary: string;
580
- /** Accent/highlight color */
581
- accent: string;
582
- /** Hover state color */
583
- hover: string;
584
- /** Selected state color */
585
- selected: string;
586
- /** Muted/disabled color */
587
- muted: string;
588
- }
589
- /** Colors for scope depth visualization */
590
- interface ScopeDepthColors {
591
- /** Base hue for the color family (0-360) */
592
- baseHue: number;
593
- /** Saturation range [min, max] (0-100) */
594
- saturationRange: [number, number];
595
- /** Lightness range [min, max] for light theme (0-100) */
596
- lightnessRangeLight: [number, number];
597
- /** Lightness range [min, max] for dark theme (0-100) */
598
- lightnessRangeDark: [number, number];
599
- /** Maximum depth before colors repeat */
600
- maxDepth: number;
601
- }
602
- /** Colors for different node types */
603
- interface NodeColors {
604
- /** File node colors */
605
- file: ColorPalette;
606
- /** Symbol node colors */
607
- symbol: ColorPalette;
608
- /** Aggregate node colors */
609
- aggregate: ColorPalette;
610
- /** Scope/directory colors */
611
- scope: ColorPalette;
612
- }
613
- /** Colors for different edge types */
614
- interface EdgeColors {
615
- /** Import edge color */
616
- import: string;
617
- /** Call edge color */
618
- call: string;
619
- /** Bundled/aggregated edge color */
620
- bundled: string;
621
- /** Edge hover color */
622
- hover: string;
623
- }
624
- /** Colors for overlays */
625
- interface OverlayColors {
626
- /** Cursor overlay color */
627
- cursor: string;
628
- /** Highlight overlay color */
629
- highlight: string;
630
- /** Error indicator color */
631
- error: string;
632
- /** Warning indicator color */
633
- warning: string;
634
- /** Success indicator color */
635
- success: string;
636
- /** Info indicator color */
637
- info: string;
638
- }
639
- /** Colors for UI elements */
640
- interface UIColors {
641
- /** Background color */
642
- background: string;
643
- /** Surface/card background */
644
- surface: string;
645
- /** Primary text color */
646
- text: string;
647
- /** Secondary/muted text */
648
- textMuted: string;
649
- /** Border color */
650
- border: string;
651
- /** Focus ring color */
652
- focusRing: string;
653
- }
654
- /** Sigma-specific node colors by type */
655
- interface SigmaNodeColors {
656
- directory: string;
657
- file: string;
658
- aggregate: string;
659
- function: string;
660
- class: string;
661
- method: string;
662
- interface: string;
663
- type: string;
664
- enum: string;
665
- variable: string;
666
- constant: string;
667
- namespace: string;
668
- property: string;
669
- }
670
- /** Sigma-specific edge colors by relationship type */
671
- interface SigmaEdgeColors {
672
- import: string;
673
- call: string;
674
- extends: string;
675
- implements: string;
676
- contains: string;
677
- }
678
- /** Sigma highlight configuration */
679
- interface SigmaHighlightConfig {
680
- /** Highlight color (cyan) */
681
- color: string;
682
- /** Opacity for dimmed non-highlighted nodes (0-1) */
683
- dimmedOpacity: number;
684
- /** Size multiplier for selected node */
685
- selectedScale: number;
686
- /** Size multiplier for neighbor nodes */
687
- neighborScale: number;
688
- }
689
- /** Sigma label configuration */
690
- interface SigmaLabelConfig {
691
- /** Font family */
692
- font: string;
693
- /** Base font size */
694
- size: number;
695
- /** Minimum node size to show label */
696
- threshold: number;
697
- /** Label text color */
698
- color: string;
699
- }
700
- /** Complete Sigma theme configuration */
701
- interface SigmaTheme {
702
- nodeColors: SigmaNodeColors;
703
- edgeColors: SigmaEdgeColors;
704
- highlight: SigmaHighlightConfig;
705
- label: SigmaLabelConfig;
706
- background: string;
707
- }
708
- /** Complete theme definition */
709
- interface Theme {
710
- /** Theme identifier */
711
- id: 'light' | 'dark' | string;
712
- /** Theme display name */
713
- name: string;
714
- /** Whether this is a dark theme */
715
- isDark: boolean;
716
- /** UI colors */
717
- ui: UIColors;
718
- /** Node colors */
719
- nodes: NodeColors;
720
- /** Edge colors */
721
- edges: EdgeColors;
722
- /** Overlay colors */
723
- overlays: OverlayColors;
724
- /** Scope depth color configuration */
725
- scopeDepth: ScopeDepthColors;
726
- /** Sigma renderer theme (optional for backward compatibility) */
727
- sigma?: SigmaTheme;
728
- }
729
- /** Theme context value */
730
- interface ThemeContextValue {
731
- /** Current theme */
732
- theme: Theme;
733
- /** Set theme by ID */
734
- setTheme: (themeId: string) => void;
735
- /** Toggle between light and dark */
736
- toggleTheme: () => void;
737
- /** Get color for a specific scope depth */
738
- getScopeColor: (depth: number) => string;
739
- }
740
- /** Theme provider props */
741
- interface ThemeProviderProps {
742
- /** Initial theme ID */
743
- initialTheme?: 'light' | 'dark';
744
- /** Custom themes to register */
745
- customThemes?: Theme[];
746
- /** Children to render */
747
- children?: React.ReactNode;
748
- }
749
-
750
- /**
751
- * Light theme for CodeViz
752
- *
753
- * @packageDocumentation
754
- */
755
-
756
- /** Light theme definition */
757
- declare const lightTheme: Theme;
758
-
759
- /**
760
- * Dark theme for CodeViz
761
- *
762
- * @packageDocumentation
763
- */
764
-
765
- /** Dark theme definition */
766
- declare const darkTheme: Theme;
767
-
768
- /**
769
- * Theme utility functions for CodeViz
770
- *
771
- * @packageDocumentation
772
- */
773
-
774
- /**
775
- * Parse a hex color string to RGB values.
776
- */
777
- declare function hexToRgb(hex: string): RGBColor;
778
- /**
779
- * Convert RGB values to a hex color string.
780
- */
781
- declare function rgbToHex(rgb: RGBColor): string;
782
- /**
783
- * Convert HSL values to RGB.
784
- * @param h Hue (0-360)
785
- * @param s Saturation (0-100)
786
- * @param l Lightness (0-100)
787
- */
788
- declare function hslToRgb(h: number, s: number, l: number): RGBColor;
789
- /**
790
- * Convert HSL values to a hex color string.
791
- */
792
- declare function hslToHex(h: number, s: number, l: number): string;
793
- /**
794
- * Convert RGB to HSL.
795
- */
796
- declare function rgbToHsl(rgb: RGBColor): {
797
- h: number;
798
- s: number;
799
- l: number;
800
- };
801
- /**
802
- * Lighten a color by a percentage.
803
- */
804
- declare function lighten(hex: string, amount: number): string;
805
- /**
806
- * Darken a color by a percentage.
807
- */
808
- declare function darken(hex: string, amount: number): string;
809
- /**
810
- * Adjust the saturation of a color.
811
- */
812
- declare function saturate(hex: string, amount: number): string;
813
- /**
814
- * Mix two colors together.
815
- */
816
- declare function mix(color1: string, color2: string, weight?: number): string;
817
- /**
818
- * Get a color with adjusted opacity.
819
- */
820
- declare function withOpacity(hex: string, opacity: number): string;
821
- /**
822
- * Convert RGBA color to CSS string.
823
- */
824
- declare function rgbaToCss(color: RGBAColor): string;
825
- /**
826
- * Generate a color for a specific scope depth.
827
- * Colors stay within the same color family but vary in lightness/saturation.
828
- */
829
- declare function getScopeDepthColor(depth: number, config: ScopeDepthColors, isDark: boolean): string;
830
- /**
831
- * Generate all scope depth colors for a theme.
832
- */
833
- declare function generateScopeDepthColors(config: ScopeDepthColors, isDark: boolean): string[];
834
- /**
835
- * Calculate relative luminance of a color.
836
- */
837
- declare function getLuminance(hex: string): number;
838
- /**
839
- * Calculate contrast ratio between two colors.
840
- */
841
- declare function getContrastRatio(color1: string, color2: string): number;
842
- /**
843
- * Check if text color should be light or dark based on background.
844
- */
845
- declare function shouldUseDarkText(backgroundColor: string): boolean;
846
- /**
847
- * Get appropriate text color for a background.
848
- */
849
- declare function getTextColorForBackground(backgroundColor: string, lightText?: string, darkText?: string): string;
850
- /**
851
- * Create a color getter function for a theme.
852
- */
853
- declare function createScopeColorGetter(theme: Theme): (depth: number) => string;
854
- /**
855
- * Merge a partial theme with a base theme.
856
- */
857
- declare function mergeTheme(base: Theme, partial: Partial<Theme>): Theme;
858
-
859
- /**
860
- * Theme exports for CodeViz
861
- *
862
- * @packageDocumentation
863
- */
864
-
865
- /**
866
- * Get a theme by ID.
867
- */
868
- declare function getTheme(id: string): Theme | undefined;
869
- /**
870
- * Register a custom theme.
871
- */
872
- declare function registerTheme(theme: Theme): void;
873
- /**
874
- * Get all registered theme IDs.
875
- */
876
- declare function getThemeIds(): string[];
877
- /**
878
- * Get the default theme based on system preference.
879
- */
880
- declare function getDefaultTheme(): Theme;
10
+ import 'react/jsx-runtime';
11
+ import '@xyflow/react';
12
+ import 'lucide-react';
881
13
 
882
14
  /**
883
15
  * Directory scanner with gitignore support
@@ -907,7 +39,7 @@ interface SkippedFile {
907
39
  */
908
40
  interface ScanResult {
909
41
  directories: DirectoryNode[];
910
- files: FileNode$1[];
42
+ files: FileNode[];
911
43
  skipped: SkippedFile[];
912
44
  rootPath: string;
913
45
  }
@@ -926,7 +58,7 @@ declare function scanDirectory(config: ScannerConfig): Promise<ScanResult>;
926
58
  * Result of symbol extraction
927
59
  */
928
60
  interface SymbolExtractionResult {
929
- symbols: SymbolNode$1[];
61
+ symbols: SymbolNode[];
930
62
  metrics: FileMetrics;
931
63
  parseErrors?: string[];
932
64
  }
@@ -958,7 +90,7 @@ interface ImportInfo {
958
90
  * Resolved import with edge information
959
91
  */
960
92
  interface ResolvedImport {
961
- edge: ImportEdge$1;
93
+ edge: ImportEdge;
962
94
  resolved: boolean;
963
95
  resolvedPath?: string;
964
96
  }
@@ -1006,25 +138,25 @@ interface RawCall {
1006
138
  * Resolved call with edge information
1007
139
  */
1008
140
  interface ResolvedCall {
1009
- edge: CallEdge$1;
141
+ edge: CallEdge;
1010
142
  resolved: boolean;
1011
143
  }
1012
144
  /**
1013
145
  * Symbol index for resolving calls
1014
146
  */
1015
- type SymbolIndex = Map<string, SymbolNode$1>;
147
+ type SymbolIndex = Map<string, SymbolNode>;
1016
148
  /**
1017
149
  * Extract calls from a source file
1018
150
  */
1019
- declare function extractCalls(filePath: string, content: string, symbols: SymbolNode$1[]): Promise<RawCall[]>;
151
+ declare function extractCalls(filePath: string, content: string, symbols: SymbolNode[]): Promise<RawCall[]>;
1020
152
  /**
1021
153
  * Resolve all calls for a file
1022
154
  */
1023
- declare function resolveFileCalls(filePath: string, content: string, fileSymbols: SymbolNode$1[], globalSymbolIndex: SymbolIndex): Promise<ResolvedCall[]>;
155
+ declare function resolveFileCalls(filePath: string, content: string, fileSymbols: SymbolNode[], globalSymbolIndex: SymbolIndex): Promise<ResolvedCall[]>;
1024
156
  /**
1025
157
  * Build a global symbol index from all files
1026
158
  */
1027
- declare function buildGlobalSymbolIndex(allSymbols: SymbolNode$1[]): SymbolIndex;
159
+ declare function buildGlobalSymbolIndex(allSymbols: SymbolNode[]): SymbolIndex;
1028
160
 
1029
161
  /**
1030
162
  * Language registry for tree-sitter grammars
@@ -1247,1575 +379,6 @@ declare function analyzeCodebase(config: AnalyzerConfig): Promise<AnalysisResult
1247
379
  */
1248
380
  declare function resetAnalyzer(): void;
1249
381
 
1250
- /**
1251
- * Graphology Integration
1252
- *
1253
- * Converts CodeGraph to graphology graph for layout algorithms.
1254
- * Provides bidirectional mapping between entity IDs and graph nodes.
1255
- */
1256
-
1257
- /**
1258
- * Node attributes stored in graphology graph
1259
- */
1260
- interface GraphNodeAttributes {
1261
- /** Original entity ID */
1262
- entityId: string;
1263
- /** Node type */
1264
- type: 'file' | 'directory';
1265
- /** Directory ID (for files) or parent ID (for directories) */
1266
- parentId: string | null;
1267
- /** Lines of code */
1268
- loc: number;
1269
- /** Nesting depth */
1270
- depth: number;
1271
- }
1272
- /**
1273
- * Edge attributes stored in graphology graph
1274
- */
1275
- interface GraphEdgeAttributes {
1276
- /** Original edge ID */
1277
- edgeId: string;
1278
- /** Edge weight based on import frequency */
1279
- weight: number;
1280
- /** Edge type */
1281
- type: 'import';
1282
- /** Whether the import was resolved */
1283
- resolved: boolean;
1284
- }
1285
- /**
1286
- * Directory edge attributes for aggregated edges
1287
- */
1288
- interface DirectoryEdgeAttributes {
1289
- /** Aggregated edge weight */
1290
- weight: number;
1291
- /** Count of individual edges aggregated */
1292
- edgeCount: number;
1293
- /** Original edge IDs */
1294
- sourceEdgeIds: string[];
1295
- }
1296
- /**
1297
- * Bidirectional mapping between entity IDs and graph node keys
1298
- */
1299
- interface EntityIdMapping {
1300
- /** Map from entity ID to graph node key */
1301
- entityToNode: Map<string, string>;
1302
- /** Map from graph node key to entity ID */
1303
- nodeToEntity: Map<string, string>;
1304
- }
1305
- /**
1306
- * Result of converting CodeGraph to graphology
1307
- */
1308
- interface GraphologyConversionResult {
1309
- /** The graphology graph instance */
1310
- graph: Graph__default<GraphNodeAttributes, GraphEdgeAttributes>;
1311
- /** Bidirectional ID mapping */
1312
- mapping: EntityIdMapping;
1313
- /** File ID to directory ID lookup */
1314
- fileToDirectory: Map<string, string>;
1315
- }
1316
- /**
1317
- * Result of building directory-level graph
1318
- */
1319
- interface DirectoryGraphResult {
1320
- /** The directory-level graphology graph */
1321
- graph: Graph__default<GraphNodeAttributes, DirectoryEdgeAttributes>;
1322
- /** Bidirectional ID mapping for directories */
1323
- mapping: EntityIdMapping;
1324
- }
1325
- /**
1326
- * Convert CodeGraph to graphology graph (file-level)
1327
- *
1328
- * Creates a graph where:
1329
- * - Nodes are files
1330
- * - Edges are import relationships
1331
- * - Edge weights reflect import frequency/importance
1332
- */
1333
- declare function codeGraphToGraphology(codeGraph: CodeGraph): GraphologyConversionResult;
1334
- /**
1335
- * Build directory-level aggregate graph
1336
- *
1337
- * Creates a graph where:
1338
- * - Nodes are directories
1339
- * - Edges are aggregated imports between directories
1340
- * - Edge weights reflect total import weight between directories
1341
- */
1342
- declare function buildDirectoryGraph(codeGraph: CodeGraph, fileGraph: GraphologyConversionResult): DirectoryGraphResult;
1343
- /**
1344
- * Get entity ID from graph node key
1345
- */
1346
- declare function getEntityId(mapping: EntityIdMapping, nodeKey: string): string | undefined;
1347
- /**
1348
- * Get graph node key from entity ID
1349
- */
1350
- declare function getNodeKey(mapping: EntityIdMapping, entityId: string): string | undefined;
1351
- /**
1352
- * Get all file IDs in a directory (direct children only)
1353
- */
1354
- declare function getFilesInDirectory(fileGraph: GraphologyConversionResult, directoryId: string): string[];
1355
- /**
1356
- * Get total edge weight between two directories
1357
- */
1358
- declare function getDirectoryConnectionWeight(directoryGraph: DirectoryGraphResult, sourceDir: string, targetDir: string): number;
1359
-
1360
- /**
1361
- * Community Detection
1362
- *
1363
- * Runs Louvain algorithm on file dependency graph to cluster related files.
1364
- * Cluster IDs are used for coloring and grouping in visualization.
1365
- */
1366
-
1367
- /**
1368
- * Result of community detection
1369
- */
1370
- interface ClusteringResult {
1371
- /** Map from node ID to cluster ID */
1372
- clusters: Map<string, number>;
1373
- /** Number of communities detected */
1374
- communityCount: number;
1375
- /** Modularity score (quality of clustering) */
1376
- modularity: number;
1377
- }
1378
- /**
1379
- * Options for community detection
1380
- */
1381
- interface ClusteringOptions {
1382
- /** Resolution parameter (higher = more communities) */
1383
- resolution?: number;
1384
- /** Use random walk for reproducibility */
1385
- randomWalk?: boolean;
1386
- /** Whether to use edge weights (defaults to true) */
1387
- useEdgeWeight?: boolean;
1388
- }
1389
- /**
1390
- * Detect communities in the file dependency graph using Louvain algorithm
1391
- *
1392
- * @param graph - The file-level graphology graph
1393
- * @param options - Clustering options
1394
- * @returns ClusteringResult with cluster assignments
1395
- */
1396
- declare function detectCommunities(graph: Graph__default<GraphNodeAttributes, GraphEdgeAttributes>, options?: ClusteringOptions): ClusteringResult;
1397
- /**
1398
- * Get all nodes in a specific cluster
1399
- *
1400
- * @param result - The clustering result
1401
- * @param clusterId - The cluster ID to query
1402
- * @returns Array of node IDs in the cluster
1403
- */
1404
- declare function getNodesInCluster(result: ClusteringResult, clusterId: number): string[];
1405
- /**
1406
- * Get cluster statistics
1407
- *
1408
- * @param result - The clustering result
1409
- * @returns Statistics about the clustering
1410
- */
1411
- declare function getClusterStats(result: ClusteringResult): {
1412
- clusterSizes: Map<number, number>;
1413
- avgClusterSize: number;
1414
- maxClusterSize: number;
1415
- minClusterSize: number;
1416
- };
1417
- /**
1418
- * Assign colors to clusters
1419
- * Uses a predefined palette with good visual separation
1420
- *
1421
- * @param communityCount - Number of communities
1422
- * @returns Map from cluster ID to color hex code
1423
- */
1424
- declare function assignClusterColors(communityCount: number): Map<number, string>;
1425
- /**
1426
- * Get the cluster ID for a specific node
1427
- *
1428
- * @param result - The clustering result
1429
- * @param nodeId - The node ID to query
1430
- * @returns The cluster ID, or undefined if node not found
1431
- */
1432
- declare function getNodeCluster(result: ClusteringResult, nodeId: string): number | undefined;
1433
-
1434
- /**
1435
- * Directory Force Simulation
1436
- *
1437
- * Computes directory positions using ForceAtlas2 algorithm.
1438
- * Directories with more cross-imports are positioned closer together.
1439
- * Output positions are used as hints for hierarchical layout.
1440
- */
1441
-
1442
- /**
1443
- * Directory position result
1444
- */
1445
- interface DirectoryPosition {
1446
- /** Directory entity ID */
1447
- directoryId: string;
1448
- /** Computed position */
1449
- position: Position;
1450
- /** Nesting depth */
1451
- depth: number;
1452
- }
1453
- /**
1454
- * Result of directory force simulation
1455
- */
1456
- interface DirectoryForceResult {
1457
- /** Map from directory ID to position */
1458
- positions: Map<string, Position>;
1459
- /** Ordered list of positions with metadata */
1460
- directoryPositions: DirectoryPosition[];
1461
- }
1462
- /**
1463
- * Options for directory force simulation
1464
- */
1465
- interface DirectoryForceOptions {
1466
- /** Number of iterations */
1467
- iterations?: number;
1468
- /** Gravity strength */
1469
- gravity?: number;
1470
- /** Scaling ratio */
1471
- scalingRatio?: number;
1472
- /** Edge weight influence */
1473
- edgeWeightInfluence?: number;
1474
- /** Random seed for initial positions */
1475
- seed?: number;
1476
- }
1477
- /**
1478
- * Compute directory positions using ForceAtlas2
1479
- *
1480
- * @param directoryGraph - Directory-level graph from buildDirectoryGraph
1481
- * @param options - Force simulation options
1482
- * @returns Directory positions
1483
- */
1484
- declare function computeDirectoryForces(directoryGraph: DirectoryGraphResult, options?: DirectoryForceOptions): DirectoryForceResult;
1485
- /**
1486
- * Normalize positions to fit within a bounding box
1487
- *
1488
- * @param result - Directory force result
1489
- * @param width - Target width
1490
- * @param height - Target height
1491
- * @param padding - Padding around edges
1492
- * @returns New result with normalized positions
1493
- */
1494
- declare function normalizePositions(result: DirectoryForceResult, width: number, height: number, padding?: number): DirectoryForceResult;
1495
- /**
1496
- * Get position for a specific directory
1497
- *
1498
- * @param result - Directory force result
1499
- * @param directoryId - Directory ID
1500
- * @returns Position or undefined if not found
1501
- */
1502
- declare function getDirectoryPosition(result: DirectoryForceResult, directoryId: string): Position | undefined;
1503
- /**
1504
- * Get all child directory positions
1505
- *
1506
- * @param result - Directory force result
1507
- * @param depth - Depth level to filter
1508
- * @returns Positions at the specified depth
1509
- */
1510
- declare function getPositionsAtDepth(result: DirectoryForceResult, depth: number): DirectoryPosition[];
1511
-
1512
- /**
1513
- * Hierarchical Layout (ELK)
1514
- *
1515
- * Converts directory tree to ELK graph and computes MapScope bounds.
1516
- * Uses directory force positions as layout hints.
1517
- */
1518
-
1519
- /**
1520
- * Result of hierarchical layout computation
1521
- */
1522
- interface HierarchyResult {
1523
- /** All scopes with computed bounds */
1524
- scopes: MapScope[];
1525
- /** Map from directory ID to scope */
1526
- scopeMap: Map<string, MapScope>;
1527
- /** Overall bounds */
1528
- bounds: BoundingBox$1;
1529
- }
1530
- /**
1531
- * Options for hierarchical layout
1532
- */
1533
- interface HierarchyOptions {
1534
- /** Padding inside scopes */
1535
- scopePadding?: Padding;
1536
- /** Spacing between sibling scopes */
1537
- scopeSpacing?: number;
1538
- /** Minimum scope width */
1539
- minScopeWidth?: number;
1540
- /** Minimum scope height */
1541
- minScopeHeight?: number;
1542
- /** Use directory force positions as hints */
1543
- useForceHints?: boolean;
1544
- }
1545
- /**
1546
- * Compute hierarchical layout for directory tree
1547
- *
1548
- * @param codeGraph - The code graph
1549
- * @param forceResult - Optional directory force positions
1550
- * @param options - Layout options
1551
- * @returns Hierarchy result with scopes
1552
- */
1553
- declare function computeHierarchy(codeGraph: CodeGraph, forceResult?: DirectoryForceResult, options?: HierarchyOptions): Promise<HierarchyResult>;
1554
- /**
1555
- * Get scope by directory ID
1556
- */
1557
- declare function getScopeByDirectoryId(result: HierarchyResult, directoryId: string): MapScope | undefined;
1558
- /**
1559
- * Get all child scopes of a parent
1560
- */
1561
- declare function getChildScopes(result: HierarchyResult, parentScopeId: string): MapScope[];
1562
- /**
1563
- * Get root scopes (no parent)
1564
- */
1565
- declare function getRootScopes(result: HierarchyResult): MapScope[];
1566
-
1567
- /**
1568
- * Force-Directed Positioning
1569
- *
1570
- * Runs ForceAtlas2 independently per scope to position nodes within bounds.
1571
- * Nodes are constrained to stay within their parent scope.
1572
- */
1573
-
1574
- /**
1575
- * Options for force-directed positioning
1576
- */
1577
- interface ForcePositioningOptions {
1578
- /** Number of iterations */
1579
- iterations?: number;
1580
- /** Gravity strength */
1581
- gravity?: number;
1582
- /** Scaling ratio */
1583
- scalingRatio?: number;
1584
- /** Edge weight influence */
1585
- edgeWeightInfluence?: number;
1586
- /** Random seed */
1587
- seed?: number;
1588
- }
1589
- /**
1590
- * Calculate node size based on LOC using quantile buckets
1591
- */
1592
- declare function calculateNodeSize(loc: number, allLocs: number[], minSize?: number, maxSize?: number): number;
1593
- /**
1594
- * Position nodes within a single scope using ForceAtlas2
1595
- */
1596
- declare function positionNodesInScope(scope: MapScope, files: FileNode$1[], edges: ImportEdge$1[], allLocs: number[], options?: ForcePositioningOptions): MapNode[];
1597
- /**
1598
- * Position all nodes across all scopes
1599
- */
1600
- declare function positionAllNodes(scopes: MapScope[], files: FileNode$1[], edges: ImportEdge$1[], options?: ForcePositioningOptions): MapNode[];
1601
-
1602
- /**
1603
- * Overlap Removal
1604
- *
1605
- * Uses graphology-layout-noverlap to ensure minimum spacing between nodes
1606
- * while respecting scope boundaries.
1607
- */
1608
-
1609
- /**
1610
- * Options for overlap removal
1611
- */
1612
- interface NoverlapOptions {
1613
- /** Maximum iterations */
1614
- maxIterations?: number;
1615
- /** Margin between nodes */
1616
- margin?: number;
1617
- /** Expansion ratio per iteration */
1618
- ratio?: number;
1619
- /** Speed of adjustment */
1620
- speed?: number;
1621
- }
1622
- /**
1623
- * Remove overlaps for nodes within a single scope
1624
- */
1625
- declare function removeOverlapsInScope(nodes: MapNode[], scope: MapScope, options?: NoverlapOptions): MapNode[];
1626
- /**
1627
- * Remove overlaps for all nodes, grouped by scope
1628
- */
1629
- declare function removeAllOverlaps(nodes: MapNode[], scopes: MapScope[], options?: NoverlapOptions): MapNode[];
1630
-
1631
- /**
1632
- * Edge Routing
1633
- *
1634
- * Computes visual edges for the map with aggregation at low zoom levels
1635
- * and direct edges at high zoom levels.
1636
- */
1637
-
1638
- /**
1639
- * Options for edge routing
1640
- */
1641
- interface EdgeRoutingOptions {
1642
- /** Threshold for aggregation (edges between scopes) */
1643
- aggregationThreshold?: number;
1644
- }
1645
- /**
1646
- * Compute all edges for the map
1647
- */
1648
- declare function computeEdges(nodes: MapNode[], scopes: MapScope[], imports: ImportEdge$1[], calls?: CallEdge$1[], _options?: EdgeRoutingOptions): MapEdge[];
1649
- /**
1650
- * Get edges visible at a specific zoom level
1651
- */
1652
- declare function getEdgesAtZoomLevel(edges: MapEdge[], zoomLevel: ZoomLevel): MapEdge[];
1653
- /**
1654
- * Get edge count label for aggregated edges
1655
- */
1656
- declare function getEdgeLabel(edge: MapEdge): string;
1657
-
1658
- /**
1659
- * Zoom Level Pre-computation
1660
- *
1661
- * Pre-computes visibility and styling for each zoom level.
1662
- */
1663
-
1664
- /**
1665
- * Pre-computed zoom level data
1666
- */
1667
- interface ZoomLevelData {
1668
- /** Zoom level */
1669
- level: ZoomLevel;
1670
- /** Visible node IDs */
1671
- visibleNodeIds: Set<string>;
1672
- /** Visible scope IDs */
1673
- visibleScopeIds: Set<string>;
1674
- /** Visible edge IDs */
1675
- visibleEdgeIds: Set<string>;
1676
- /** Node sizes at this level */
1677
- nodeSizes: Map<string, {
1678
- width: number;
1679
- height: number;
1680
- }>;
1681
- /** Node opacities at this level */
1682
- nodeOpacities: Map<string, number>;
1683
- /** Label visibility */
1684
- labelVisibility: Map<string, boolean>;
1685
- }
1686
- /**
1687
- * Options for zoom pre-computation
1688
- */
1689
- interface ZoomPrecomputeOptions {
1690
- /** Large file LOC threshold */
1691
- largeFileThreshold?: number;
1692
- /** Zoom level configurations */
1693
- zoomLevels?: ZoomLevelConfig[];
1694
- }
1695
- /**
1696
- * Pre-compute all zoom levels
1697
- */
1698
- declare function computeZoomLevels(nodes: MapNode[], scopes: MapScope[], edges: MapEdge[], zoomConfigs: ZoomLevelConfig[], options?: ZoomPrecomputeOptions): Map<ZoomLevel, ZoomLevelData>;
1699
- /**
1700
- * Get visible nodes at a zoom level
1701
- */
1702
- declare function getVisibleNodes(zoomData: Map<ZoomLevel, ZoomLevelData>, level: ZoomLevel, nodes: MapNode[]): MapNode[];
1703
- /**
1704
- * Get visible scopes at a zoom level
1705
- */
1706
- declare function getVisibleScopes(zoomData: Map<ZoomLevel, ZoomLevelData>, level: ZoomLevel, scopes: MapScope[]): MapScope[];
1707
- /**
1708
- * Get visible edges at a zoom level
1709
- */
1710
- declare function getVisibleEdges(zoomData: Map<ZoomLevel, ZoomLevelData>, level: ZoomLevel, edges: MapEdge[]): MapEdge[];
1711
- /**
1712
- * Get node size at a zoom level
1713
- */
1714
- declare function getNodeSizeAtLevel(zoomData: Map<ZoomLevel, ZoomLevelData>, level: ZoomLevel, nodeId: string): {
1715
- width: number;
1716
- height: number;
1717
- } | undefined;
1718
- /**
1719
- * Get node opacity at a zoom level
1720
- */
1721
- declare function getNodeOpacityAtLevel(zoomData: Map<ZoomLevel, ZoomLevelData>, level: ZoomLevel, nodeId: string): number;
1722
-
1723
- /**
1724
- * Layout Orchestrator
1725
- *
1726
- * Pipelines all layout stages to produce a complete CodeMap.
1727
- * Handles errors gracefully and always produces renderable output.
1728
- */
1729
-
1730
- /**
1731
- * Layout progress callback
1732
- */
1733
- type LayoutProgressCallback = (stage: string, percent: number) => void;
1734
- /**
1735
- * Layout options with progress callback
1736
- */
1737
- interface ComputeLayoutOptions {
1738
- /** Layout configuration */
1739
- config?: Partial<LayoutConfig>;
1740
- /** Progress callback */
1741
- onProgress?: LayoutProgressCallback;
1742
- /** Cancellation check */
1743
- isCancelled?: () => boolean;
1744
- }
1745
- /**
1746
- * Compute complete layout from CodeGraph to CodeMap
1747
- *
1748
- * Pipeline:
1749
- * 1. Graphology conversion (0-10%)
1750
- * 2. Community detection (10-20%)
1751
- * 3. Directory force simulation (20-35%)
1752
- * 4. Hierarchical layout (35-50%)
1753
- * 5. Force-directed positioning (50-75%)
1754
- * 6. Overlap removal (75-85%)
1755
- * 7. Edge routing (85-95%)
1756
- * 8. Zoom pre-computation (95-100%)
1757
- */
1758
- declare function computeLayout(codeGraph: CodeGraph, options?: ComputeLayoutOptions): Promise<CodeMap$1>;
1759
-
1760
- /**
1761
- * Overlay System Types
1762
- *
1763
- * Type definitions for the overlay system that renders visual indicators,
1764
- * annotations, documents, and agent widgets on top of the CodeMap.
1765
- */
1766
- /**
1767
- * Anchor points for positioning overlays relative to nodes
1768
- */
1769
- type AnchorPoint = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
1770
- /**
1771
- * Absolute position in viewport coordinates
1772
- */
1773
- interface AbsolutePosition {
1774
- type: 'absolute';
1775
- x: number;
1776
- y: number;
1777
- }
1778
- /**
1779
- * Position relative to a node
1780
- */
1781
- interface NodePosition {
1782
- type: 'node';
1783
- nodeId: string;
1784
- anchor?: AnchorPoint;
1785
- offset?: {
1786
- x: number;
1787
- y: number;
1788
- };
1789
- }
1790
- /**
1791
- * Position along an edge (t = 0 to 1)
1792
- */
1793
- interface EdgePosition {
1794
- type: 'edge';
1795
- edgeId: string;
1796
- t?: number;
1797
- offset?: {
1798
- x: number;
1799
- y: number;
1800
- };
1801
- }
1802
- /**
1803
- * Union of all position types
1804
- */
1805
- type OverlayPosition = AbsolutePosition | NodePosition | EdgePosition;
1806
- /**
1807
- * All overlay types
1808
- */
1809
- type OverlayType = 'cursor' | 'highlight' | 'badge' | 'annotation' | 'document' | 'agent';
1810
- /**
1811
- * Base interface for all overlays
1812
- */
1813
- interface BaseOverlay {
1814
- id: string;
1815
- type: OverlayType;
1816
- position: OverlayPosition;
1817
- zIndex?: number;
1818
- visible?: boolean;
1819
- metadata?: Record<string, unknown>;
1820
- }
1821
- /**
1822
- * Cursor overlay for showing user/agent presence
1823
- */
1824
- interface CursorOverlay extends BaseOverlay {
1825
- type: 'cursor';
1826
- /** Display label (user/agent name) */
1827
- label?: string;
1828
- /** Cursor color */
1829
- color: string;
1830
- /** Avatar URL */
1831
- avatar?: string;
1832
- /** Show movement trail */
1833
- trail?: boolean;
1834
- }
1835
- /**
1836
- * Bounding box for region highlights
1837
- */
1838
- interface BoundingBox {
1839
- x: number;
1840
- y: number;
1841
- width: number;
1842
- height: number;
1843
- }
1844
- /**
1845
- * Style configuration for highlights
1846
- */
1847
- interface HighlightStyle {
1848
- /** Highlight color */
1849
- color: string;
1850
- /** Opacity (0-1) */
1851
- opacity?: number;
1852
- /** Stroke width for outlines */
1853
- strokeWidth?: number;
1854
- /** Animated pulse effect */
1855
- pulse?: boolean;
1856
- /** Glow effect */
1857
- glow?: boolean;
1858
- /** Fill the shape (vs just outline) */
1859
- fill?: boolean;
1860
- }
1861
- /**
1862
- * Highlight overlay for visual emphasis
1863
- */
1864
- interface HighlightOverlay extends BaseOverlay {
1865
- type: 'highlight';
1866
- /** What to highlight */
1867
- targetType: 'node' | 'edge' | 'region';
1868
- /** Target node or edge ID */
1869
- targetId?: string;
1870
- /** Bounding box for region highlights */
1871
- region?: BoundingBox;
1872
- /** Visual style */
1873
- style: HighlightStyle;
1874
- }
1875
- /**
1876
- * Badge variant types
1877
- */
1878
- type BadgeVariant = 'count' | 'icon' | 'dot' | 'text';
1879
- /**
1880
- * Badge size options
1881
- */
1882
- type BadgeSize = 'small' | 'medium' | 'large';
1883
- /**
1884
- * Badge overlay for small indicators on nodes
1885
- */
1886
- interface BadgeOverlay extends BaseOverlay {
1887
- type: 'badge';
1888
- /** Badge display variant */
1889
- variant: BadgeVariant;
1890
- /** Value for count/text variants */
1891
- value?: string | number;
1892
- /** Icon name or URL for icon variant */
1893
- icon?: string;
1894
- /** Badge color */
1895
- color?: string;
1896
- /** Badge size */
1897
- size?: BadgeSize;
1898
- }
1899
- /**
1900
- * Content type for annotations
1901
- */
1902
- type AnnotationContentType = 'text' | 'markdown';
1903
- /**
1904
- * Annotation overlay for text content attached to positions
1905
- */
1906
- interface AnnotationOverlay extends BaseOverlay {
1907
- type: 'annotation';
1908
- /** Text or markdown content */
1909
- content: string;
1910
- /** Content format */
1911
- contentType?: AnnotationContentType;
1912
- /** Maximum width in pixels */
1913
- maxWidth?: number;
1914
- /** Can be collapsed */
1915
- collapsible?: boolean;
1916
- /** Current collapsed state */
1917
- collapsed?: boolean;
1918
- }
1919
- /**
1920
- * Document types for document overlays
1921
- */
1922
- type DocumentType = 'design-doc' | 'work-item' | 'spec' | 'custom';
1923
- /**
1924
- * Document status
1925
- */
1926
- type DocumentStatus = 'draft' | 'in-progress' | 'review' | 'done';
1927
- /**
1928
- * Document overlay for showing related documents
1929
- */
1930
- interface DocumentOverlay extends BaseOverlay {
1931
- type: 'document';
1932
- /** Type of document */
1933
- documentType: DocumentType;
1934
- /** Document title */
1935
- title: string;
1936
- /** Inline content (markdown) */
1937
- content?: string;
1938
- /** External link */
1939
- url?: string;
1940
- /** Document status */
1941
- status?: DocumentStatus;
1942
- /** Keep visible during pan/zoom */
1943
- pinned?: boolean;
1944
- /** Panel width */
1945
- width?: number;
1946
- /** Panel height */
1947
- height?: number;
1948
- }
1949
- /**
1950
- * Agent status types
1951
- */
1952
- type AgentStatus = 'idle' | 'thinking' | 'working' | 'waiting' | 'error';
1953
- /**
1954
- * Agent widget overlay for visualizing coding agents
1955
- */
1956
- interface AgentWidgetOverlay extends BaseOverlay {
1957
- type: 'agent';
1958
- /** Unique agent identifier */
1959
- agentId: string;
1960
- /** Agent display name */
1961
- name: string;
1962
- /** Avatar URL */
1963
- avatar?: string;
1964
- /** Current status */
1965
- status: AgentStatus;
1966
- /** Current activity description */
1967
- activity?: string;
1968
- /** Progress percentage (0-100) */
1969
- progress?: number;
1970
- /** Nodes the agent is working on */
1971
- targetNodes?: string[];
1972
- /** Can be expanded for details */
1973
- expandable?: boolean;
1974
- /** Current expanded state */
1975
- expanded?: boolean;
1976
- }
1977
- /**
1978
- * Union of all overlay types
1979
- */
1980
- type Overlay = CursorOverlay | HighlightOverlay | BadgeOverlay | AnnotationOverlay | DocumentOverlay | AgentWidgetOverlay;
1981
- /**
1982
- * Input types for creating overlays (without ID)
1983
- * Uses distributive conditional to properly handle union types
1984
- */
1985
- type CursorOverlayInput = Omit<CursorOverlay, 'id'>;
1986
- type HighlightOverlayInput = Omit<HighlightOverlay, 'id'>;
1987
- type BadgeOverlayInput = Omit<BadgeOverlay, 'id'>;
1988
- type AnnotationOverlayInput = Omit<AnnotationOverlay, 'id'>;
1989
- type DocumentOverlayInput = Omit<DocumentOverlay, 'id'>;
1990
- type AgentWidgetOverlayInput = Omit<AgentWidgetOverlay, 'id'>;
1991
- /**
1992
- * Union of all overlay input types (for creating new overlays)
1993
- */
1994
- type OverlayInput = CursorOverlayInput | HighlightOverlayInput | BadgeOverlayInput | AnnotationOverlayInput | DocumentOverlayInput | AgentWidgetOverlayInput;
1995
- /**
1996
- * Filter for querying overlays
1997
- */
1998
- interface OverlayFilter {
1999
- /** Filter by overlay type(s) */
2000
- type?: OverlayType | OverlayType[];
2001
- /** Filter by associated node ID */
2002
- nodeId?: string;
2003
- /** Filter by visibility */
2004
- visible?: boolean;
2005
- /** Filter by metadata properties */
2006
- metadata?: Record<string, unknown>;
2007
- }
2008
- /**
2009
- * Batch update operation
2010
- */
2011
- interface OverlayBatchUpdate {
2012
- id: string;
2013
- changes: Partial<Overlay>;
2014
- }
2015
- /**
2016
- * Event handler for overlay clicks
2017
- */
2018
- type OverlayClickHandler = (id: string, overlay: Overlay) => void;
2019
- /**
2020
- * Event handler for overlay hover
2021
- */
2022
- type OverlayHoverHandler = (id: string, overlay: Overlay, isHovering: boolean) => void;
2023
- /**
2024
- * OverlayPort interface for managing overlays imperatively
2025
- */
2026
- interface IOverlayPort {
2027
- /** Add a new overlay, returns generated ID */
2028
- bind(overlay: OverlayInput): string;
2029
- /** Update an existing overlay */
2030
- update(id: string, changes: Partial<Overlay>): void;
2031
- /** Remove an overlay */
2032
- remove(id: string): void;
2033
- /** Remove overlays matching filter (all if no filter) */
2034
- clear(filter?: OverlayFilter): void;
2035
- /** Get overlays matching filter (all if no filter) */
2036
- getOverlays(filter?: OverlayFilter): Overlay[];
2037
- /** Get a specific overlay by ID */
2038
- getOverlayById(id: string): Overlay | undefined;
2039
- /** Apply multiple updates at once */
2040
- batchUpdate(updates: OverlayBatchUpdate[]): void;
2041
- /** Handler called when an overlay is clicked */
2042
- onOverlayClick?: OverlayClickHandler;
2043
- /** Handler called when an overlay is hovered */
2044
- onOverlayHover?: OverlayHoverHandler;
2045
- /** Trigger click event for an overlay */
2046
- triggerClick?(id: string): void;
2047
- /** Trigger hover event for an overlay */
2048
- triggerHover?(id: string, isHovering: boolean): void;
2049
- /** Subscribe to overlay changes */
2050
- subscribe(listener: (overlays: Overlay[]) => void): () => void;
2051
- }
2052
-
2053
- /**
2054
- * OverlayPort Implementation
2055
- *
2056
- * Manages overlay state and provides an imperative API for external systems
2057
- * to add, update, and remove overlays on the CodeMap.
2058
- */
2059
-
2060
- /**
2061
- * OverlayPort class for managing overlay state
2062
- */
2063
- declare class OverlayPort implements IOverlayPort {
2064
- private overlays;
2065
- private listeners;
2066
- /** Handler called when an overlay is clicked */
2067
- onOverlayClick?: OverlayClickHandler;
2068
- /** Handler called when an overlay is hovered */
2069
- onOverlayHover?: OverlayHoverHandler;
2070
- /**
2071
- * Create a new OverlayPort
2072
- */
2073
- constructor(options?: {
2074
- onOverlayClick?: OverlayClickHandler;
2075
- onOverlayHover?: OverlayHoverHandler;
2076
- });
2077
- /**
2078
- * Notify all listeners of overlay changes
2079
- */
2080
- private notifyListeners;
2081
- /**
2082
- * Add a new overlay
2083
- * @param overlay - Overlay data without ID
2084
- * @returns Generated overlay ID
2085
- */
2086
- bind(overlay: OverlayInput): string;
2087
- /**
2088
- * Update an existing overlay
2089
- * @param id - Overlay ID
2090
- * @param changes - Partial overlay data to merge
2091
- */
2092
- update(id: string, changes: Partial<Overlay>): void;
2093
- /**
2094
- * Remove an overlay
2095
- * @param id - Overlay ID to remove
2096
- */
2097
- remove(id: string): void;
2098
- /**
2099
- * Remove overlays matching a filter
2100
- * @param filter - Filter to match overlays (all if undefined)
2101
- */
2102
- clear(filter?: OverlayFilter): void;
2103
- /**
2104
- * Get overlays matching a filter
2105
- * @param filter - Filter to match overlays (all if undefined)
2106
- * @returns Array of matching overlays
2107
- */
2108
- getOverlays(filter?: OverlayFilter): Overlay[];
2109
- /**
2110
- * Get a specific overlay by ID
2111
- * @param id - Overlay ID
2112
- * @returns Overlay or undefined
2113
- */
2114
- getOverlayById(id: string): Overlay | undefined;
2115
- /**
2116
- * Apply multiple updates at once
2117
- * @param updates - Array of update operations
2118
- */
2119
- batchUpdate(updates: OverlayBatchUpdate[]): void;
2120
- /**
2121
- * Subscribe to overlay changes
2122
- * @param listener - Callback function
2123
- * @returns Unsubscribe function
2124
- */
2125
- subscribe(listener: (overlays: Overlay[]) => void): () => void;
2126
- /**
2127
- * Get the current overlay count
2128
- */
2129
- get size(): number;
2130
- /**
2131
- * Check if an overlay exists
2132
- * @param id - Overlay ID
2133
- */
2134
- has(id: string): boolean;
2135
- /**
2136
- * Get overlays by type
2137
- * @param type - Overlay type
2138
- */
2139
- getByType(type: OverlayType): Overlay[];
2140
- /**
2141
- * Get overlays for a specific node
2142
- * @param nodeId - Node ID
2143
- */
2144
- getByNode(nodeId: string): Overlay[];
2145
- /**
2146
- * Trigger click event for an overlay
2147
- * @param id - Overlay ID
2148
- */
2149
- triggerClick(id: string): void;
2150
- /**
2151
- * Trigger hover event for an overlay
2152
- * @param id - Overlay ID
2153
- * @param isHovering - Whether hovering or leaving
2154
- */
2155
- triggerHover(id: string, isHovering: boolean): void;
2156
- }
2157
- /**
2158
- * Create a new OverlayPort instance
2159
- */
2160
- declare function createOverlayPort(options?: {
2161
- onOverlayClick?: OverlayClickHandler;
2162
- onOverlayHover?: OverlayHoverHandler;
2163
- }): OverlayPort;
2164
-
2165
- /**
2166
- * Overlay Positioning Utilities
2167
- *
2168
- * Functions for calculating overlay positions relative to nodes, edges, and viewport.
2169
- */
2170
-
2171
- /**
2172
- * Calculated position in screen/viewport coordinates
2173
- */
2174
- interface CalculatedPosition {
2175
- x: number;
2176
- y: number;
2177
- }
2178
- /**
2179
- * Node bounds information for position calculation
2180
- */
2181
- interface NodeBounds {
2182
- x: number;
2183
- y: number;
2184
- width: number;
2185
- height: number;
2186
- }
2187
- /**
2188
- * Edge path information for position calculation
2189
- */
2190
- interface EdgePath {
2191
- sourceX: number;
2192
- sourceY: number;
2193
- targetX: number;
2194
- targetY: number;
2195
- }
2196
- /**
2197
- * Viewport transform for coordinate conversion
2198
- */
2199
- interface ViewportTransform {
2200
- x: number;
2201
- y: number;
2202
- zoom: number;
2203
- }
2204
- /**
2205
- * Get the offset for an anchor point relative to node bounds
2206
- */
2207
- declare function getAnchorOffset(anchor: AnchorPoint, bounds: NodeBounds): CalculatedPosition;
2208
- /**
2209
- * Transform a position from graph coordinates to screen coordinates
2210
- */
2211
- declare function graphToScreen(position: CalculatedPosition, viewport: ViewportTransform): CalculatedPosition;
2212
- /**
2213
- * Transform a position from screen coordinates to graph coordinates
2214
- */
2215
- declare function screenToGraph(position: CalculatedPosition, viewport: ViewportTransform): CalculatedPosition;
2216
- /**
2217
- * Calculate the final overlay position based on position type
2218
- */
2219
- declare function calculateOverlayPosition(position: OverlayPosition, context: {
2220
- getNodeBounds?: (nodeId: string) => NodeBounds | undefined;
2221
- getEdgePath?: (edgeId: string) => EdgePath | undefined;
2222
- viewport?: ViewportTransform;
2223
- }): CalculatedPosition | null;
2224
-
2225
- /**
2226
- * Props for OverlayLayer
2227
- */
2228
- interface OverlayLayerProps {
2229
- /** Overlay port for managing overlays */
2230
- port?: IOverlayPort;
2231
- /** Declarative overlays (alternative to port) */
2232
- overlays?: Overlay[];
2233
- /** Get node bounds by ID (from React Flow) */
2234
- getNodeBounds?: (nodeId: string) => NodeBounds | undefined;
2235
- /** Get edge path by ID (from React Flow) */
2236
- getEdgePath?: (edgeId: string) => EdgePath | undefined;
2237
- /** Viewport transform for coordinate conversion */
2238
- viewport?: ViewportTransform;
2239
- /** Theme (light or dark) */
2240
- theme?: 'light' | 'dark';
2241
- /** Click handler */
2242
- onOverlayClick?: (id: string, overlay: Overlay) => void;
2243
- /** Hover handler */
2244
- onOverlayHover?: (id: string, overlay: Overlay, isHovering: boolean) => void;
2245
- }
2246
- /**
2247
- * Overlay Layer Component
2248
- *
2249
- * Renders overlays on top of the CodeMap visualization using a hybrid approach:
2250
- * - SVG layer for simple, high-performance overlays (cursors, badges, highlights)
2251
- * - Portal layer for rich, interactive overlays (annotations, documents, agents)
2252
- */
2253
- declare function OverlayLayer({ port, overlays: declarativeOverlays, getNodeBounds, getEdgePath, viewport, theme, onOverlayClick, onOverlayHover, }: OverlayLayerProps): react_jsx_runtime.JSX.Element | null;
2254
-
2255
- /**
2256
- * Props for SVGOverlayLayer
2257
- */
2258
- interface SVGOverlayLayerProps {
2259
- /** Overlays to render (filtered to SVG-compatible types) */
2260
- overlays: Overlay[];
2261
- /** Get node bounds by ID */
2262
- getNodeBounds?: (nodeId: string) => NodeBounds | undefined;
2263
- /** Get edge path by ID */
2264
- getEdgePath?: (edgeId: string) => {
2265
- sourceX: number;
2266
- sourceY: number;
2267
- targetX: number;
2268
- targetY: number;
2269
- } | undefined;
2270
- /** Click handler */
2271
- onOverlayClick?: (id: string) => void;
2272
- /** Hover handler */
2273
- onOverlayHover?: (id: string, isHovering: boolean) => void;
2274
- }
2275
- /**
2276
- * SVG Overlay Layer Component
2277
- */
2278
- declare function SVGOverlayLayer({ overlays, getNodeBounds, getEdgePath, onOverlayClick, onOverlayHover, }: SVGOverlayLayerProps): react_jsx_runtime.JSX.Element | null;
2279
-
2280
- /**
2281
- * Props for PortalOverlayLayer
2282
- */
2283
- interface PortalOverlayLayerProps {
2284
- /** Overlays to render (filtered to portal-compatible types) */
2285
- overlays: Overlay[];
2286
- /** Get node bounds by ID */
2287
- getNodeBounds?: (nodeId: string) => NodeBounds | undefined;
2288
- /** Get edge path by ID */
2289
- getEdgePath?: (edgeId: string) => {
2290
- sourceX: number;
2291
- sourceY: number;
2292
- targetX: number;
2293
- targetY: number;
2294
- } | undefined;
2295
- /** Theme (light or dark) */
2296
- theme?: 'light' | 'dark';
2297
- /** Click handler */
2298
- onOverlayClick?: (id: string) => void;
2299
- /** Hover handler */
2300
- onOverlayHover?: (id: string, isHovering: boolean) => void;
2301
- }
2302
- /**
2303
- * Portal Overlay Layer Component
2304
- */
2305
- declare function PortalOverlayLayer({ overlays, getNodeBounds, getEdgePath, theme, onOverlayClick, onOverlayHover, }: PortalOverlayLayerProps): react_jsx_runtime.JSX.Element | null;
2306
-
2307
- /**
2308
- * Sigma-specific type definitions for CodeViz
2309
- */
2310
-
2311
- /**
2312
- * Node attributes used by Sigma for rendering
2313
- */
2314
- interface SigmaNodeAttributes extends Attributes {
2315
- x: number;
2316
- y: number;
2317
- size: number;
2318
- color: string;
2319
- label: string;
2320
- nodeType: 'directory' | 'file' | 'symbol' | 'aggregate';
2321
- entityId: string;
2322
- scopeId?: string;
2323
- depth?: number;
2324
- visibleAtLevels?: number[];
2325
- symbolKind?: string;
2326
- metrics?: FileMetrics;
2327
- hidden?: boolean;
2328
- zIndex?: number;
2329
- mass?: number;
2330
- }
2331
- /**
2332
- * Edge attributes used by Sigma for rendering
2333
- */
2334
- interface SigmaEdgeAttributes extends Attributes {
2335
- size: number;
2336
- color: string;
2337
- type: 'curved';
2338
- edgeType: 'import' | 'call' | 'extends' | 'implements' | 'contains';
2339
- visibleAtLevels?: number[];
2340
- hidden?: boolean;
2341
- zIndex?: number;
2342
- }
2343
- /**
2344
- * View modes for Sigma renderer
2345
- */
2346
- type ViewMode = 'structure' | 'nexus';
2347
- /**
2348
- * Renderer types for CodeMap component
2349
- */
2350
- type RendererType = 'react-flow' | 'sigma';
2351
-
2352
- /**
2353
- * CodeMap component props
2354
- */
2355
- interface CodeMapProps {
2356
- /** Pre-computed layout data */
2357
- codeMap: CodeMap$1;
2358
- /** Theme ID or custom theme */
2359
- theme?: 'light' | 'dark' | Theme;
2360
- /** Node click handler */
2361
- onNodeClick?: (nodeId: string, node: MapNode) => void;
2362
- /** Node hover handler */
2363
- onNodeHover?: (nodeId: string | null, node: MapNode | null) => void;
2364
- /** Scope expand/collapse handler */
2365
- onScopeToggle?: (scopeId: string, expanded: boolean) => void;
2366
- /** Viewport change handler */
2367
- onViewportChange?: (viewport: Viewport) => void;
2368
- /** Zoom level change handler */
2369
- onZoomLevelChange?: (level: ZoomLevel) => void;
2370
- /** Selection change handler */
2371
- onSelectionChange?: (selectedIds: string[]) => void;
2372
- /** Initially selected node IDs */
2373
- defaultSelectedIds?: string[];
2374
- /** Controlled selected node IDs */
2375
- selectedIds?: string[];
2376
- /** Initial viewport */
2377
- defaultViewport?: Viewport;
2378
- /** Configuration overrides */
2379
- config?: Partial<CodeMapConfig>;
2380
- /** Container className */
2381
- className?: string;
2382
- /** Container style */
2383
- style?: React.CSSProperties;
2384
- /** Overlay port for managing overlays */
2385
- overlayPort?: IOverlayPort;
2386
- /** Declarative overlays (alternative to port) */
2387
- overlays?: Overlay[];
2388
- /** Overlay click handler */
2389
- onOverlayClick?: (id: string, overlay: Overlay) => void;
2390
- /** Overlay hover handler */
2391
- onOverlayHover?: (id: string, overlay: Overlay, isHovering: boolean) => void;
2392
- /**
2393
- * Renderer to use for visualization
2394
- * - 'react-flow': DOM-based rendering (default, better for <1000 nodes)
2395
- * - 'sigma': WebGL-based rendering (better for 1000+ nodes)
2396
- */
2397
- renderer?: RendererType;
2398
- /**
2399
- * View mode for Sigma renderer
2400
- * - 'structure': File system hierarchy with directory scopes
2401
- * - 'nexus': Flat relationship graph (calls, imports, extends)
2402
- * Only used when renderer='sigma'
2403
- */
2404
- view?: ViewMode;
2405
- /**
2406
- * CodeGraph data (required for nexus view)
2407
- * Provides symbols and relationships for the nexus visualization
2408
- */
2409
- codeGraph?: CodeGraph;
2410
- }
2411
- /**
2412
- * CodeMap component
2413
- *
2414
- * Visualizes a codebase as an interactive 2D map with:
2415
- * - Semantic zoom levels (overview → files → symbols → code)
2416
- * - Expandable/collapsible directory scopes
2417
- * - Import and call edges
2418
- * - Light and dark theme support
2419
- * - Two renderers: React Flow (DOM) and Sigma (WebGL)
2420
- */
2421
- declare function CodeMap({ codeMap, theme, onNodeClick, onNodeHover: _onNodeHover, onScopeToggle, onViewportChange: _onViewportChange, onZoomLevelChange, onSelectionChange, defaultSelectedIds: _defaultSelectedIds, selectedIds: _selectedIds, defaultViewport, config, className, style, overlayPort, overlays, onOverlayClick, onOverlayHover, renderer, view, codeGraph, }: CodeMapProps): react_jsx_runtime.JSX.Element;
2422
-
2423
- /**
2424
- * Flow component props
2425
- */
2426
- interface FlowProps {
2427
- /** React Flow nodes */
2428
- nodes: Node[];
2429
- /** React Flow edges */
2430
- edges: Edge[];
2431
- /** Zoom level configurations */
2432
- zoomLevels: ZoomLevelConfig[];
2433
- /** Hysteresis percentage (0-1) */
2434
- hysteresis?: number;
2435
- /** Current zoom level */
2436
- zoomLevel: ZoomLevel;
2437
- /** Zoom level change callback */
2438
- onZoomLevelChange?: (level: ZoomLevel) => void;
2439
- /** Node click callback */
2440
- onNodeClick?: NodeMouseHandler;
2441
- /** Selection change callback */
2442
- onSelectionChange?: (params: OnSelectionChangeParams) => void;
2443
- /** Initial viewport */
2444
- defaultViewport?: Viewport;
2445
- /** Show minimap */
2446
- showMinimap?: boolean;
2447
- /** Show controls */
2448
- showControls?: boolean;
2449
- /** Show background grid */
2450
- showBackground?: boolean;
2451
- }
2452
- /**
2453
- * Flow component - React Flow wrapper with zoom level management
2454
- *
2455
- * Handles:
2456
- * - Custom node/edge types registration
2457
- * - Zoom level detection with hysteresis
2458
- * - Viewport change forwarding
2459
- * - Selection management
2460
- */
2461
- declare function Flow(props: FlowProps): react_jsx_runtime.JSX.Element;
2462
-
2463
- /**
2464
- * Theme Provider component
2465
- *
2466
- * Provides theme context to child components with support for:
2467
- * - Light/dark theme switching
2468
- * - System preference detection
2469
- * - Custom theme registration
2470
- * - Scope depth color computation
2471
- */
2472
- declare function ThemeProvider({ initialTheme, customThemes, children, }: ThemeProviderProps): ReactNode;
2473
- /**
2474
- * Hook to access theme context
2475
- *
2476
- * @throws Error if used outside ThemeProvider
2477
- */
2478
- declare function useTheme(): ThemeContextValue;
2479
- /**
2480
- * Hook to access current theme (convenience)
2481
- */
2482
- declare function useCurrentTheme(): Theme;
2483
- /**
2484
- * Hook to check if current theme is dark
2485
- */
2486
- declare function useIsDarkTheme(): boolean;
2487
-
2488
- /**
2489
- * FileNode component for React Flow
2490
- */
2491
- declare function FileNodeComponent({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
2492
- declare const FileNode: react.MemoExoticComponent<typeof FileNodeComponent>;
2493
-
2494
- /**
2495
- * CodeMap to React Flow Converters
2496
- *
2497
- * Converts CodeMap data structures to React Flow nodes and edges.
2498
- */
2499
-
2500
- /**
2501
- * Data passed to custom node components
2502
- * Using Record<string, unknown> compatible types for React Flow
2503
- */
2504
- type FileNodeData = {
2505
- type: 'file';
2506
- label: string;
2507
- shortLabel: string;
2508
- extension: string;
2509
- entityId: string;
2510
- loc: number;
2511
- scopeId: string;
2512
- [key: string]: unknown;
2513
- };
2514
- type SymbolNodeData = {
2515
- type: 'symbol';
2516
- label: string;
2517
- shortLabel: string;
2518
- symbolKind: string;
2519
- entityId: string;
2520
- exported: boolean;
2521
- signature?: string;
2522
- [key: string]: unknown;
2523
- };
2524
- type AggregateReactFlowNodeData = {
2525
- type: 'aggregate';
2526
- label: string;
2527
- count: number;
2528
- totalLoc: number;
2529
- entityIds: string[];
2530
- scopeId: string;
2531
- [key: string]: unknown;
2532
- };
2533
- type ScopeNodeData = {
2534
- type: 'scope';
2535
- label: string;
2536
- entityId: string;
2537
- depth: number;
2538
- fileCount: number;
2539
- totalLoc: number;
2540
- expanded: boolean;
2541
- [key: string]: unknown;
2542
- };
2543
- type ReactFlowNodeData = FileNodeData | SymbolNodeData | AggregateReactFlowNodeData | ScopeNodeData;
2544
- /**
2545
- * Convert CodeMap nodes and scopes to React Flow nodes
2546
- *
2547
- * Handles:
2548
- * - Scope to group node conversion
2549
- * - Node positioning relative to parent scopes
2550
- * - Visibility filtering by zoom level
2551
- */
2552
- declare function codeMapToReactFlowNodes(codeMap: CodeMap$1, zoomLevel: ZoomLevel, expandedScopes?: Set<string>): Node<ReactFlowNodeData>[];
2553
- /**
2554
- * Edge data for custom edge components
2555
- * Using Record<string, unknown> compatible types for React Flow
2556
- */
2557
- type ImportEdgeData = {
2558
- type: 'import';
2559
- weight: number;
2560
- [key: string]: unknown;
2561
- };
2562
- type CallEdgeData = {
2563
- type: 'call';
2564
- weight: number;
2565
- [key: string]: unknown;
2566
- };
2567
- type BundledEdgeData = {
2568
- type: 'bundled';
2569
- weight: number;
2570
- originalEdgeIds: string[];
2571
- [key: string]: unknown;
2572
- };
2573
- type ReactFlowEdgeData = ImportEdgeData | CallEdgeData | BundledEdgeData;
2574
- /**
2575
- * Convert CodeMap edges to React Flow edges
2576
- *
2577
- * Handles:
2578
- * - Visibility filtering by zoom level
2579
- * - Edge type mapping
2580
- */
2581
- declare function codeMapToReactFlowEdges(codeMap: CodeMap$1, zoomLevel: ZoomLevel): Edge<ReactFlowEdgeData>[];
2582
- /**
2583
- * Get all scope IDs that should be expanded by default
2584
- */
2585
- declare function getDefaultExpandedScopes(codeMap: CodeMap$1): Set<string>;
2586
- /**
2587
- * Calculate zoom level from React Flow zoom value
2588
- */
2589
- declare function getZoomLevelFromZoom(zoom: number, currentLevel: ZoomLevel, hysteresis: number, zoomLevels: CodeMap$1['zoomLevels']): ZoomLevel;
2590
-
2591
- interface ScopeNodeProps extends NodeProps {
2592
- data: ScopeNodeData;
2593
- onToggle?: (scopeId: string, expanded: boolean) => void;
2594
- }
2595
- /**
2596
- * ScopeNode component for React Flow
2597
- *
2598
- * Renders as a container with header bar showing directory name,
2599
- * file count, and expand/collapse toggle.
2600
- */
2601
- declare function ScopeNodeComponent({ data, selected }: ScopeNodeProps): react_jsx_runtime.JSX.Element;
2602
- declare const ScopeNode: react.MemoExoticComponent<typeof ScopeNodeComponent>;
2603
-
2604
- /**
2605
- * SymbolNode component for React Flow
2606
- *
2607
- * Smaller than FileNode, shows symbol icon, name, and export badge.
2608
- */
2609
- declare function SymbolNodeComponent({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
2610
- declare const SymbolNode: react.MemoExoticComponent<typeof SymbolNodeComponent>;
2611
-
2612
- /**
2613
- * AggregateNode component for React Flow
2614
- *
2615
- * Shows collapsed content summary with count and LOC.
2616
- */
2617
- declare function AggregateNodeComponent({ data, selected }: NodeProps): react_jsx_runtime.JSX.Element;
2618
- declare const AggregateNode: react.MemoExoticComponent<typeof AggregateNodeComponent>;
2619
-
2620
- /**
2621
- * Node types object for React Flow configuration
2622
- */
2623
- declare const nodeTypes: {
2624
- readonly file: react.MemoExoticComponent<({ data, selected }: _xyflow_react.NodeProps) => react_jsx_runtime.JSX.Element>;
2625
- readonly scope: react.MemoExoticComponent<({ data, selected }: ScopeNodeProps) => react_jsx_runtime.JSX.Element>;
2626
- readonly symbol: react.MemoExoticComponent<({ data, selected }: _xyflow_react.NodeProps) => react_jsx_runtime.JSX.Element>;
2627
- readonly aggregate: react.MemoExoticComponent<({ data, selected }: _xyflow_react.NodeProps) => react_jsx_runtime.JSX.Element>;
2628
- };
2629
- type NodeType = keyof typeof nodeTypes;
2630
-
2631
- /**
2632
- * ImportEdge component for React Flow
2633
- *
2634
- * Solid line with arrow marker showing import dependencies.
2635
- */
2636
- declare function ImportEdgeComponent({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, }: EdgeProps): react_jsx_runtime.JSX.Element;
2637
- declare const ImportEdge: react.MemoExoticComponent<typeof ImportEdgeComponent>;
2638
-
2639
- /**
2640
- * CallEdge component for React Flow
2641
- *
2642
- * Dashed line style for call graph edges.
2643
- */
2644
- declare function CallEdgeComponent({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, }: EdgeProps): react_jsx_runtime.JSX.Element;
2645
- declare const CallEdge: react.MemoExoticComponent<typeof CallEdgeComponent>;
2646
-
2647
- /**
2648
- * BundledEdge component for React Flow
2649
- *
2650
- * Thicker line with count label for aggregated edges.
2651
- */
2652
- declare function BundledEdgeComponent({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, }: EdgeProps): react_jsx_runtime.JSX.Element;
2653
- declare const BundledEdge: react.MemoExoticComponent<typeof BundledEdgeComponent>;
2654
-
2655
- /**
2656
- * Edge types object for React Flow configuration
2657
- */
2658
- declare const edgeTypes: {
2659
- readonly import: react.MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, }: _xyflow_react.EdgeProps) => react_jsx_runtime.JSX.Element>;
2660
- readonly call: react.MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, }: _xyflow_react.EdgeProps) => react_jsx_runtime.JSX.Element>;
2661
- readonly bundled: react.MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, }: _xyflow_react.EdgeProps) => react_jsx_runtime.JSX.Element>;
2662
- };
2663
- type EdgeType = keyof typeof edgeTypes;
2664
-
2665
- /**
2666
- * Component Utilities
2667
- *
2668
- * Icon mappings and label utilities for node components.
2669
- */
2670
-
2671
- /**
2672
- * Map file extension to Lucide icon component
2673
- */
2674
- declare function getFileIcon(extension: string): LucideIcon;
2675
- /**
2676
- * Map symbol kind to Lucide icon component
2677
- */
2678
- declare function getSymbolIcon(kind: SymbolKind): LucideIcon;
2679
- /**
2680
- * Get a display-friendly label for a symbol kind
2681
- */
2682
- declare function getSymbolKindLabel(kind: SymbolKind): string;
2683
- /**
2684
- * Format a number with K/M suffixes for large values
2685
- */
2686
- declare function formatNumber(value: number): string;
2687
- /**
2688
- * Format lines of code for display
2689
- */
2690
- declare function formatLoc(loc: number): string;
2691
-
2692
- /**
2693
- * useLayout Hook
2694
- *
2695
- * React hook for computing layout from CodeGraph to CodeMap.
2696
- * Features debouncing, cancellation, and progress reporting.
2697
- */
2698
-
2699
- /**
2700
- * Layout computation progress
2701
- */
2702
- interface LayoutProgress {
2703
- stage: string;
2704
- percent: number;
2705
- }
2706
- /**
2707
- * Options for useLayout hook
2708
- */
2709
- interface UseLayoutOptions {
2710
- /** Layout configuration overrides */
2711
- config?: Partial<LayoutConfig>;
2712
- /** Debounce delay in milliseconds (default: 100) */
2713
- debounceMs?: number;
2714
- /** Whether computation is enabled (default: true) */
2715
- enabled?: boolean;
2716
- }
2717
- /**
2718
- * Result of useLayout hook
2719
- */
2720
- interface UseLayoutResult {
2721
- /** Computed CodeMap, null if not yet computed or on error */
2722
- codeMap: CodeMap$1 | null;
2723
- /** Whether computation is currently in progress */
2724
- isComputing: boolean;
2725
- /** Error from last computation attempt, null if successful */
2726
- error: Error | null;
2727
- /** Current computation progress, null if not computing */
2728
- progress: LayoutProgress | null;
2729
- /** Manually trigger recomputation */
2730
- recompute: () => void;
2731
- }
2732
- /**
2733
- * Hook for computing layout from CodeGraph
2734
- *
2735
- * @param codeGraph - The CodeGraph to compute layout for, or null
2736
- * @param options - Configuration options
2737
- * @returns Layout computation state and controls
2738
- *
2739
- * @example
2740
- * ```tsx
2741
- * function App({ codeGraph }: { codeGraph: CodeGraph }) {
2742
- * const { codeMap, isComputing, error, progress } = useLayout(codeGraph);
2743
- *
2744
- * if (isComputing) {
2745
- * return <Progress stage={progress?.stage} percent={progress?.percent} />;
2746
- * }
2747
- * if (error) return <Error message={error.message} />;
2748
- * if (!codeMap) return null;
2749
- *
2750
- * return <CodeMap codeMap={codeMap} theme="dark" />;
2751
- * }
2752
- * ```
2753
- */
2754
- declare function useLayout(codeGraph: CodeGraph | null, options?: UseLayoutOptions): UseLayoutResult;
2755
-
2756
- /**
2757
- * useOverlayPort Hook
2758
- *
2759
- * React hook for managing overlays using the OverlayPort API.
2760
- * Provides a stable port instance and reactive overlay state.
2761
- */
2762
-
2763
- /**
2764
- * Options for useOverlayPort hook
2765
- */
2766
- interface UseOverlayPortOptions {
2767
- /** Handler called when an overlay is clicked */
2768
- onOverlayClick?: OverlayClickHandler;
2769
- /** Handler called when an overlay is hovered */
2770
- onOverlayHover?: OverlayHoverHandler;
2771
- /** Initial overlays to add */
2772
- initialOverlays?: Omit<Overlay, 'id'>[];
2773
- }
2774
- /**
2775
- * Result of useOverlayPort hook
2776
- */
2777
- interface UseOverlayPortResult {
2778
- /** The OverlayPort instance for imperative control */
2779
- port: OverlayPort;
2780
- /** Current list of overlays (reactive) */
2781
- overlays: Overlay[];
2782
- /** Clear all overlays */
2783
- clearAll: () => void;
2784
- /** Get overlay by ID */
2785
- getOverlay: (id: string) => Overlay | undefined;
2786
- /** Check if overlay exists */
2787
- hasOverlay: (id: string) => boolean;
2788
- /** Get overlay count */
2789
- count: number;
2790
- }
2791
- /**
2792
- * Hook for managing overlays with OverlayPort
2793
- *
2794
- * @example
2795
- * ```tsx
2796
- * function MyComponent() {
2797
- * const { port, overlays, clearAll } = useOverlayPort({
2798
- * onOverlayClick: (id, overlay) => console.log('Clicked:', id),
2799
- * });
2800
- *
2801
- * // Add a cursor overlay
2802
- * const addCursor = () => {
2803
- * port.bind({
2804
- * type: 'cursor',
2805
- * position: { type: 'absolute', x: 100, y: 100 },
2806
- * color: '#ff0000',
2807
- * label: 'User 1',
2808
- * });
2809
- * };
2810
- *
2811
- * return (
2812
- * <CodeMap codeMap={codeMap} overlayPort={port} />
2813
- * );
2814
- * }
2815
- * ```
2816
- */
2817
- declare function useOverlayPort(options?: UseOverlayPortOptions): UseOverlayPortResult;
2818
-
2819
382
  /**
2820
383
  * Position options for the controls panel
2821
384
  */
@@ -3002,7 +565,7 @@ declare function getSigmaTheme(theme: Theme): SigmaTheme;
3002
565
  * @param theme - Optional theme for colors
3003
566
  * @returns Graphology graph configured for Sigma rendering
3004
567
  */
3005
- declare function structureToGraphology(codeMap: CodeMap$1, theme?: Theme): Graph__default;
568
+ declare function structureToGraphology(codeMap: CodeMap, theme?: Theme): Graph__default;
3006
569
  /**
3007
570
  * Options for nexusToGraphology conversion
3008
571
  */
@@ -3171,4 +734,4 @@ declare function createEdgeReducer(state: ReducerState | ZoomReducerState, theme
3171
734
  */
3172
735
  declare const VERSION = "0.1.0";
3173
736
 
3174
- export { type AbsolutePosition, type AgentStatus, type AgentWidgetOverlay, type AgentWidgetOverlayInput, AggregateNode as AggregateNodeComponent, type AggregateNodeData, type AggregateReactFlowNodeData, type AnalysisError, type AnalysisProgress, type AnalysisResult, type AnalysisStats, type AnalyzerConfig, type AnchorPoint, type AnimationConfig, type AnnotationContentType, type AnnotationOverlay, type AnnotationOverlayInput, type BadgeOverlay, type BadgeOverlayInput, type BadgeSize, type BadgeVariant, type BaseOverlay, type BoundingBox$1 as BoundingBox, BundledEdge as BundledEdgeComponent, type BundledEdgeData, type CalculatedPosition, type CallEdge$1 as CallEdge, CallEdge as CallEdgeComponent, type CallEdgeData, type ClusteringOptions, type ClusteringResult, type CodeGraph, type CodeMap$1 as CodeMap, CodeMap as CodeMapComponent, type CodeMapConfig, type CodeMapProps, type CodebaseMetadata, type ColorPalette, type ComputeLayoutOptions, type CursorOverlay, type CursorOverlayInput, DEFAULT_ANIMATION_CONFIG, DEFAULT_CODEMAP_CONFIG, DEFAULT_DARK_SIGMA_THEME, DEFAULT_LAYOUT_CONFIG, DEFAULT_LIGHT_SIGMA_THEME, DEFAULT_SIGMA_THEME, DEFAULT_ZOOM_LEVELS, type DirectoryEdgeAttributes, type DirectoryForceOptions, type DirectoryForceResult, type DirectoryGraphResult, type DirectoryMetrics, type DirectoryNode, type DocumentOverlay, type DocumentOverlayInput, type DocumentStatus, type DocumentType, EDGE_SIZES, type EdgeColors, type EdgePath, type EdgePosition, type EdgeRoutingOptions, type EdgeType, type EntityIdMapping, type FA2Settings, type FileMetrics, type FileNode$1 as FileNode, FileNode as FileNodeComponent, type FileNodeData, Flow, type FlowProps, type ForcePositioningOptions, type GraphEdgeAttributes, type GraphNodeAttributes, type GraphologyConversionResult, type HierarchyOptions, type HierarchyResult, type HighlightOverlay, type HighlightOverlayInput, type HighlightStyle, type IOverlayPort, type ImportEdge$1 as ImportEdge, ImportEdge as ImportEdgeComponent, type ImportEdgeData, type InitialPositionOptions, type LayoutConfig, type LayoutProgress, type LayoutProgressCallback, type MapEdge, type MapEdgeType, type MapNode, type MapNodeData, type MapNodeType, type MapScope, type MapScopeData, NODE_SIZES, type NodeBounds, type NodeColors, type NodePosition, type NodeType, type NoverlapOptions, type Overlay, type OverlayBatchUpdate, type OverlayClickHandler, type OverlayColors, type OverlayFilter, type OverlayHoverHandler, type OverlayInput, OverlayLayer, type OverlayLayerProps, OverlayPort, type OverlayPosition, type OverlayType, type Padding, PortalOverlayLayer, type Position, type RGBAColor, type RGBColor, type ReactFlowEdgeData, type ReactFlowNodeData, type ReducerState, type RendererType, SVGOverlayLayer, type ScanResult, type ScannerConfig, type ScopeDepthColors, ScopeNode as ScopeNodeComponent, type ScopeNodeData, type ScopeNodeProps, type SigmaEdgeAttributes, type SigmaEdgeColors, type SigmaHighlightConfig, type SigmaLabelConfig, type SigmaNodeAttributes, type SigmaNodeColors, SigmaRenderer, type SigmaRendererHandle, type SigmaRendererProps, type SigmaTheme, type Size, type SourceLocation, type SymbolExtractionResult, type SymbolKind, type SymbolMetrics, type SymbolNode$1 as SymbolNode, SymbolNode as SymbolNodeComponent, type SymbolNodeData, type Theme, type ThemeContextValue, ThemeProvider, type ThemeProviderProps, type UIColors, type UseLayoutOptions, type UseLayoutResult, type UseOverlayPortOptions, type UseOverlayPortResult, type UseSigmaOptions, type UseSigmaReturn, VERSION, type ViewMode, type ViewportTransform, type ZoomLevel, type ZoomLevelConfig, type ZoomLevelData, type ZoomLevelName, type ZoomPrecomputeOptions, analyzeCodebase, assignClusterColors, assignInitialPositions, boundingBoxFromCorners, boundingBoxesOverlap, brightenColor, buildDirectoryGraph, buildFileIndex, buildGlobalSymbolIndex, calculateNodeSize, calculateOverlayPosition, clampPosition, codeGraphToGraphology, codeMapToReactFlowEdges, codeMapToReactFlowNodes, computeDirectoryForces, computeEdges, computeHierarchy, computeLayout, computeZoomLevels, createBoundingBox, createEdgeReducer, createNodeReducer, createOverlayPort, createScopeColorGetter, darkTheme, darken, detectCommunities, detectLanguage, dimColor, distance, edgeTypes, expandBoundingBox, extractCalls, extractImports, extractSymbols, extractSymbolsFromFile, formatLoc, formatNumber, generateCallEdgeId, generateDirectoryId, generateFileId, generateImportEdgeId, generateScopeDepthColors, generateSymbolId, getAnchorOffset, getBasename, getBoundingBoxCenter, getChildScopes, getClusterStats, getContrastRatio, getDefaultExpandedScopes, getDefaultTheme, getDirectory, getDirectoryConnectionWeight, getDirectoryPosition, getEdgeLabel, getEdgesAtZoomLevel, getEntityId, getExtension, getFA2Settings, getFileIcon, getFilename, getFilesInDirectory, getIconName, getLanguageRegistry, getLayoutDuration, getLuminance, getMediumFileLabel, getNodeCluster, getNodeKey, getNodeMass, getNodeOpacityAtLevel, getNodeSizeAtLevel, getNodesInCluster, getParentDirectories, getParserManager, getPathDepth, getPositionsAtDepth, getRootScopes, getScaledNodeSize, getScopeByDirectoryId, getScopeDepthColor, getShortFileLabel, getSigmaTheme, getSymbolIcon, getSymbolKindLabel, getTextColorForBackground, getTheme, getThemeIds, getVisibleEdges, getVisibleNodes, getVisibleScopes, getZoomLevel, getZoomLevelFromZoom, graphToScreen, hexToRgb, hslToHex, hslToRgb, isCodeFile, isPointInBoundingBox, lerp, lightTheme, lighten, matchesPattern, mergeTheme, mix, nexusToGraphology, nodeTypes, normalizePath, normalizePositions, positionAllNodes, positionNodesInScope, registerTheme, removeAllOverlaps, removeOverlapsInScope, resetAnalyzer, resetLanguageRegistry, resetParserManager, resolveFileCalls, resolveImport, rgbToHex, rgbToHsl, rgbaToCss, saturate, scaleSize, scanDirectory, screenToGraph, shouldUseDarkText, shrinkBoundingBox, structureToGraphology, truncateLabel, uniformPadding, unionBoundingBoxes, useCurrentTheme, useIsDarkTheme, useLayout, useOverlayPort, useSigma, useTheme, withOpacity };
737
+ export { type AnalysisError, type AnalysisProgress, type AnalysisResult, type AnalysisStats, type AnalyzerConfig, CallEdge, CodeGraph, CodeMap, DEFAULT_DARK_SIGMA_THEME, DEFAULT_LIGHT_SIGMA_THEME, DEFAULT_SIGMA_THEME, DirectoryNode, EDGE_SIZES, type FA2Settings, FileMetrics, FileNode, IOverlayPort, ImportEdge, type InitialPositionOptions, MapNode, NODE_SIZES, Overlay, type ReducerState, type ScanResult, type ScannerConfig, SigmaRenderer, type SigmaRendererHandle, type SigmaRendererProps, SigmaTheme, SourceLocation, type SymbolExtractionResult, SymbolNode, Theme, type UseSigmaOptions, type UseSigmaReturn, VERSION, ViewMode, ZoomLevel, ZoomLevelConfig, analyzeCodebase, assignInitialPositions, brightenColor, buildFileIndex, buildGlobalSymbolIndex, createEdgeReducer, createNodeReducer, dimColor, extractCalls, extractImports, extractSymbols, extractSymbolsFromFile, getFA2Settings, getLanguageRegistry, getLayoutDuration, getNodeMass, getParserManager, getScaledNodeSize, getSigmaTheme, nexusToGraphology, resetAnalyzer, resetLanguageRegistry, resetParserManager, resolveFileCalls, resolveImport, scanDirectory, structureToGraphology, useSigma };