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