@industry-theme/file-city-panel 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,265 @@
1
+ # File City Panel Extension
2
+
3
+ A 3D code visualization panel extension for `@principal-ade/panel-framework-core` that displays repository structure using the File City metaphor. Files are represented as buildings and directories as city blocks, providing an intuitive and visually engaging way to explore codebases.
4
+
5
+ ## Features
6
+
7
+ - **3D Visualization**: Interactive 3D rendering of repository structure
8
+ - **File City Metaphor**: Files as buildings, directories as districts
9
+ - **Interactive Exploration**: Hover for details, click to open files
10
+ - **Highlight Layers**: Support for multiple highlight layers (git changes, file types, etc.)
11
+ - **Responsive Design**: Adapts to different panel sizes
12
+ - **Theme Integration**: Full support for industry theme system
13
+ - **Performance**: Efficient rendering for large codebases
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @principal-ade/industry-themed-file-city-panel
19
+ # or
20
+ bun install @principal-ade/industry-themed-file-city-panel
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ The panel will be automatically discovered by the host application when installed. No additional configuration is required.
26
+
27
+ ### Panel ID
28
+
29
+ ```
30
+ principal-ade.file-city-panel
31
+ ```
32
+
33
+ ### Required Data Slices
34
+
35
+ - `fileTree`: File tree structure of the repository
36
+
37
+ ## Development
38
+
39
+ ### Setup
40
+
41
+ ```bash
42
+ # Clone the repository
43
+ git clone https://github.com/principal-ade/industry-themed-file-city-panel.git
44
+ cd industry-themed-file-city-panel
45
+
46
+ # Install dependencies
47
+ bun install
48
+ ```
49
+
50
+ ### Development Workflow
51
+
52
+ ```bash
53
+ # Start Storybook for interactive development
54
+ bun run storybook
55
+
56
+ # Build for production
57
+ bun run build
58
+
59
+ # Type checking
60
+ bun run typecheck
61
+
62
+ # Linting
63
+ bun run lint
64
+ bun run lint:fix
65
+
66
+ # Format code
67
+ bun run format
68
+ bun run format:check
69
+ ```
70
+
71
+ ### Project Structure
72
+
73
+ ```
74
+ industry-themed-file-city-panel/
75
+ ├── src/
76
+ │ ├── panels/
77
+ │ │ ├── CodeCityPanel.tsx # Main panel component
78
+ │ │ └── CodeCityPanel.stories.tsx # Storybook stories
79
+ │ ├── types/
80
+ │ │ └── index.ts # TypeScript type definitions
81
+ │ ├── mocks/
82
+ │ │ └── panelContext.tsx # Mock providers for Storybook
83
+ │ └── index.tsx # Main entry - exports panels array
84
+ ├── .storybook/ # Storybook configuration
85
+ ├── dist/ # Built output (generated)
86
+ ├── package.json # Package configuration
87
+ ├── tsconfig.json # TypeScript config
88
+ ├── vite.config.ts # Build configuration
89
+ └── README.md # This file
90
+ ```
91
+
92
+ ## Component API
93
+
94
+ ### CodeCityPanel Props
95
+
96
+ The panel receives standard `PanelComponentProps`:
97
+
98
+ ```typescript
99
+ interface PanelComponentProps {
100
+ context: PanelContextValue; // Access to repository data
101
+ actions: PanelActions; // Actions for host interaction
102
+ events: PanelEventEmitter; // Event system
103
+ }
104
+ ```
105
+
106
+ ### Context Usage
107
+
108
+ ```typescript
109
+ // Access file tree data
110
+ const fileTreeSlice = context.getSlice('fileTree');
111
+
112
+ // Check repository information
113
+ const repoPath = context.currentScope.repository?.path;
114
+ const repoName = context.currentScope.repository?.name;
115
+
116
+ // Refresh data
117
+ await context.refresh('repository', 'fileTree');
118
+ ```
119
+
120
+ ### Available Actions
121
+
122
+ ```typescript
123
+ // Open a file in the editor
124
+ actions.openFile?.('src/index.ts');
125
+
126
+ // Navigate to another panel
127
+ actions.navigateToPanel?.('panel-id');
128
+ ```
129
+
130
+ ## Features in Detail
131
+
132
+ ### City Visualization
133
+
134
+ The panel uses the `@principal-ai/file-city-react` library to render an interactive 3D code city:
135
+
136
+ - **Buildings**: Each file is represented as a building
137
+ - Height: Based on file size or line count
138
+ - Color: Based on file type or highlight layers
139
+ - Position: Organized within parent directory districts
140
+
141
+ - **Districts**: Directories are represented as city blocks
142
+ - Contains buildings (files) and sub-districts (subdirectories)
143
+ - Labeled with directory name
144
+ - Interactive hover shows file count
145
+
146
+ ### Highlight Layers
147
+
148
+ The panel supports multiple highlight layers that can be toggled on/off:
149
+
150
+ - **File Type Layers**: Automatically generated based on file extensions
151
+ - **Git Layers**: Can highlight changed files, staged files, etc.
152
+ - **Custom Layers**: Support for additional custom highlight layers
153
+
154
+ ### Hover Information
155
+
156
+ When hovering over elements in the city:
157
+ - File name and full path displayed in footer
158
+ - Directory file count shown
159
+ - Building/district highlighted
160
+
161
+ ### Responsive Design
162
+
163
+ The panel automatically adapts to different sizes:
164
+ - Toolbar collapses on smaller screens
165
+ - Stats badges adjust layout
166
+ - City view scales appropriately
167
+
168
+ ## Building and Publishing
169
+
170
+ ### Build
171
+
172
+ ```bash
173
+ bun run build
174
+ ```
175
+
176
+ This creates:
177
+ - `dist/panels.bundle.js` - Main bundle
178
+ - `dist/index.d.ts` - TypeScript declarations
179
+ - Source maps for debugging
180
+
181
+ ### Local Testing
182
+
183
+ ```bash
184
+ # In this directory
185
+ bun run build
186
+ bun link
187
+
188
+ # In host application
189
+ bun link @principal-ade/industry-themed-file-city-panel
190
+ ```
191
+
192
+ ### Publishing
193
+
194
+ ```bash
195
+ # Ensure everything is built
196
+ bun run build
197
+
198
+ # Publish to NPM
199
+ npm publish --access public
200
+ ```
201
+
202
+ ## Dependencies
203
+
204
+ ### Peer Dependencies
205
+
206
+ - `react` >= 19.0.0
207
+ - `react-dom` >= 19.0.0
208
+
209
+ ### Main Dependencies
210
+
211
+ - `@principal-ai/file-city-react` - Code city visualization library
212
+ - `@principal-ade/industry-theme` - Theme system
213
+ - `@principal-ade/panel-framework-core` - Panel framework
214
+ - `lucide-react` - Icon library
215
+
216
+ ## Troubleshooting
217
+
218
+ ### Panel Not Loading
219
+
220
+ Ensure:
221
+ 1. Panel is installed in the host application
222
+ 2. Panel ID matches registration: `principal-ade.file-city-panel`
223
+ 3. Required data slice `fileTree` is available
224
+
225
+ ### Build Errors
226
+
227
+ ```bash
228
+ # Clean and rebuild
229
+ bun run clean
230
+ bun run build
231
+ ```
232
+
233
+ ### Type Errors
234
+
235
+ ```bash
236
+ # Run type checking
237
+ bun run typecheck
238
+ ```
239
+
240
+ ## Contributing
241
+
242
+ Contributions are welcome! Please:
243
+
244
+ 1. Fork the repository
245
+ 2. Create a feature branch
246
+ 3. Make your changes
247
+ 4. Add tests if applicable
248
+ 5. Run linting and type checking
249
+ 6. Submit a pull request
250
+
251
+ ## License
252
+
253
+ MIT © Principal AI
254
+
255
+ ## Support
256
+
257
+ For issues and questions:
258
+ - [GitHub Issues](https://github.com/principal-ade/industry-themed-file-city-panel/issues)
259
+ - [Documentation](https://github.com/principal-ade/panel-framework)
260
+
261
+ ## Related Projects
262
+
263
+ - [@principal-ade/panel-framework-core](https://github.com/principal-ade/panel-framework-core)
264
+ - [@principal-ai/file-city-react](https://github.com/principal-ai/file-city-react)
265
+ - [@principal-ade/industry-theme](https://github.com/principal-ade/industry-theme)
@@ -0,0 +1,30 @@
1
+ import type { PanelDefinition } from './types';
2
+ /**
3
+ * Export array of panel definitions.
4
+ * This is the required export for panel extensions.
5
+ */
6
+ export declare const panels: PanelDefinition[];
7
+ /**
8
+ * Optional: Called once when the entire package is loaded.
9
+ * Use this for package-level initialization.
10
+ */
11
+ export declare const onPackageLoad: () => Promise<void>;
12
+ /**
13
+ * Optional: Called once when the package is unloaded.
14
+ * Use this for package-level cleanup.
15
+ */
16
+ export declare const onPackageUnload: () => Promise<void>;
17
+ /**
18
+ * Export tools for server-safe imports.
19
+ * Use '@industry-theme/file-city-panel/tools' to import without React dependencies.
20
+ */
21
+ export { codeCityPanelTools, codeCityPanelToolsMetadata, focusBuildingTool, selectDistrictTool, resetViewTool, } from './tools';
22
+ /**
23
+ * Export types for host applications to create the fileCityColorModes slice.
24
+ */
25
+ export type { FileCityColorModesSliceData, QualitySliceData, ColorMode, ColorModeConfig, FileMetricData, HighlightLayer, } from './types';
26
+ /**
27
+ * Export color mode constants for host applications.
28
+ */
29
+ export { COLOR_MODES, DEFAULT_COLOR_MODES, QUALITY_COLOR_MODES, } from './panels/utils/qualityLayers';
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAGlE;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,eAAe,EAwCnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,qBAGzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,qBAG3B,CAAC;AAEF;;;GAGG;AACH,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,YAAY,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import type { PanelContextValue, PanelActions, PanelEventEmitter } from '../types';
3
+ /**
4
+ * Mock Panel Context for Storybook
5
+ */
6
+ export declare const createMockContext: (overrides?: Partial<PanelContextValue>) => PanelContextValue;
7
+ /**
8
+ * Mock Panel Actions for Storybook
9
+ */
10
+ export declare const createMockActions: (overrides?: Partial<PanelActions>) => PanelActions;
11
+ /**
12
+ * Mock Event Emitter for Storybook
13
+ */
14
+ export declare const createMockEvents: () => PanelEventEmitter;
15
+ /**
16
+ * Mock Panel Props Provider
17
+ * Wraps components with mock context for Storybook
18
+ */
19
+ interface MockPanelProviderProps {
20
+ children: React.ReactElement;
21
+ repository?: {
22
+ path: string;
23
+ name: string;
24
+ } | null;
25
+ slices?: Record<string, {
26
+ data: unknown;
27
+ loading: boolean;
28
+ error: Error | null;
29
+ }>;
30
+ contextOverrides?: Partial<PanelContextValue>;
31
+ actionsOverrides?: Partial<PanelActions>;
32
+ }
33
+ export declare const MockPanelProvider: React.FC<MockPanelProviderProps>;
34
+ export {};
35
+ //# sourceMappingURL=panelContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panelContext.d.ts","sourceRoot":"","sources":["../../src/mocks/panelContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EAIlB,MAAM,UAAU,CAAC;AA+BlB;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,OAAO,CAAC,iBAAiB,CAAC,KACrC,iBAiHF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,OAAO,CAAC,YAAY,CAAC,KAChC,YAkBD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,iBAwCnC,CAAC;AAEF;;;GAGG;AACH,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAClF,gBAAgB,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAyD9D,CAAC"}
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import type { PanelComponentProps } from '../types';
3
+ /**
4
+ * Git status data - categorized file paths
5
+ */
6
+ export interface GitStatus {
7
+ staged: string[];
8
+ unstaged: string[];
9
+ untracked: string[];
10
+ deleted: string[];
11
+ }
12
+ /**
13
+ * CodeCityPanel - A file visualization panel using the File City map.
14
+ *
15
+ * This panel shows:
16
+ * - 3D visualization of repository structure
17
+ * - File and directory hierarchy as a city metaphor
18
+ * - Interactive hover and click functionality
19
+ * - Highlight layers for different file types
20
+ *
21
+ * Note: This component expects to be rendered within a ThemeProvider from the host.
22
+ */
23
+ export declare const CodeCityPanel: React.FC<PanelComponentProps>;
24
+ /**
25
+ * Preview component for panel selection
26
+ */
27
+ export declare const CodeCityPanelPreview: React.FC;
28
+ //# sourceMappingURL=CodeCityPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeCityPanel.d.ts","sourceRoot":"","sources":["../../src/panels/CodeCityPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAuBjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAYpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AA+rCD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAEvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EA4BxC,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { CodeCityPanel } from './CodeCityPanel';
3
+ /**
4
+ * CodeCityPanel provides a 3D visualization of repository structure
5
+ * using the Code City metaphor. Files are represented as buildings
6
+ * and directories as city blocks.
7
+ */
8
+ declare const meta: Meta<typeof CodeCityPanel>;
9
+ export default meta;
10
+ type Story = StoryObj<typeof CodeCityPanel>;
11
+ /**
12
+ * Default story showing the panel with a repository loaded
13
+ */
14
+ export declare const Default: Story;
15
+ /**
16
+ * Loading state story
17
+ */
18
+ export declare const Loading: Story;
19
+ /**
20
+ * No repository loaded story
21
+ */
22
+ export declare const NoRepository: Story;
23
+ /**
24
+ * Large repository story
25
+ */
26
+ export declare const LargeRepository: Story;
27
+ /**
28
+ * With Git Changes - demonstrates git status highlighting
29
+ */
30
+ export declare const WithGitChanges: Story;
31
+ /**
32
+ * With Test Coverage - demonstrates coverage color mode
33
+ * Use the dropdown to select "Test Coverage" to see files colored by coverage %
34
+ */
35
+ export declare const WithTestCoverage: Story;
36
+ /**
37
+ * With Linting Issues - demonstrates ESLint color mode
38
+ * Use the dropdown to select "Linting" to see files colored by lint score
39
+ */
40
+ export declare const WithLintingIssues: Story;
41
+ /**
42
+ * With All Quality Metrics - demonstrates all available quality data
43
+ * Use the dropdown to switch between different quality visualizations
44
+ */
45
+ export declare const WithAllQualityMetrics: Story;
46
+ //# sourceMappingURL=CodeCityPanel.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeCityPanel.stories.d.ts","sourceRoot":"","sources":["../../src/panels/CodeCityPanel.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;GAIG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAoBpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KA6BrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAkBrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAwC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAyC5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAiD9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KA+C/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,KA0FnC,CAAC"}
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import type { ColorMode } from '../utils/qualityLayers';
3
+ export interface LegendFileType {
4
+ id: string;
5
+ name: string;
6
+ fillColor: string;
7
+ borderColor?: string;
8
+ count: number;
9
+ enabled: boolean;
10
+ }
11
+ export interface LegendGitStatus {
12
+ id: string;
13
+ name: string;
14
+ color: string;
15
+ count: number;
16
+ enabled: boolean;
17
+ }
18
+ export interface LegendAgentLayer {
19
+ id: string;
20
+ name: string;
21
+ color: string;
22
+ count: number;
23
+ enabled: boolean;
24
+ }
25
+ export interface LegendQualityMetric {
26
+ id: string;
27
+ name: string;
28
+ color: string;
29
+ count: number;
30
+ enabled: boolean;
31
+ }
32
+ interface LegendProps {
33
+ fileTypes: LegendFileType[];
34
+ gitStatus?: LegendGitStatus[];
35
+ agentLayers?: LegendAgentLayer[];
36
+ qualityMetrics?: LegendQualityMetric[];
37
+ colorMode?: ColorMode;
38
+ onItemClick?: (id: string) => void;
39
+ onGitStatusClick?: (id: string) => void;
40
+ onAgentLayerClick?: (id: string) => void;
41
+ onQualityMetricClick?: (id: string) => void;
42
+ onClearAgentLayers?: () => void;
43
+ position?: 'bottom' | 'right';
44
+ maxSize?: number;
45
+ }
46
+ /**
47
+ * Legend component that displays file type colors and layer information.
48
+ * Shows styled rectangles that mimic the actual building rendering.
49
+ * Supports both bottom and right positioning with responsive layout.
50
+ */
51
+ export declare const Legend: React.FC<LegendProps>;
52
+ export {};
53
+ //# sourceMappingURL=Legend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Legend.d.ts","sourceRoot":"","sources":["../../../src/panels/components/Legend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WA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CAAC"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Quality highlight layer generators for File City visualization
3
+ *
4
+ * Creates highlight layers from quality metrics data (coverage, linting, etc.)
5
+ */
6
+ import type { CityBuilding, LayerItem } from '@principal-ai/file-city-react';
7
+ /**
8
+ * Per-file metric data from quality lenses
9
+ */
10
+ export interface FileMetricData {
11
+ file: string;
12
+ score: number;
13
+ issueCount: number;
14
+ errorCount: number;
15
+ warningCount: number;
16
+ infoCount: number;
17
+ hintCount: number;
18
+ fixableCount?: number;
19
+ categories?: Record<string, number>;
20
+ }
21
+ /**
22
+ * Quality data slice structure
23
+ */
24
+ export interface QualitySliceData {
25
+ fileCoverage?: Record<string, number>;
26
+ fileMetrics?: {
27
+ eslint?: FileMetricData[];
28
+ typescript?: FileMetricData[];
29
+ prettier?: FileMetricData[];
30
+ knip?: FileMetricData[];
31
+ alexandria?: FileMetricData[];
32
+ };
33
+ }
34
+ /**
35
+ * Highlight layer structure
36
+ */
37
+ export interface HighlightLayer {
38
+ id: string;
39
+ name: string;
40
+ enabled: boolean;
41
+ color: string;
42
+ priority: number;
43
+ items: LayerItem[];
44
+ opacity?: number;
45
+ borderWidth?: number;
46
+ }
47
+ /**
48
+ * Color mode options for the visualization
49
+ */
50
+ export type ColorMode = 'fileTypes' | 'git' | 'coverage' | 'eslint' | 'typescript' | 'prettier' | 'knip' | 'alexandria';
51
+ /**
52
+ * Color mode configuration
53
+ */
54
+ export interface ColorModeConfig {
55
+ id: ColorMode;
56
+ name: string;
57
+ description: string;
58
+ icon?: string;
59
+ }
60
+ /**
61
+ * Available color modes
62
+ */
63
+ export declare const COLOR_MODES: ColorModeConfig[];
64
+ /**
65
+ * Default color modes (always available without quality data)
66
+ */
67
+ export declare const DEFAULT_COLOR_MODES: ColorModeConfig[];
68
+ /**
69
+ * Quality-based color modes (require quality data)
70
+ */
71
+ export declare const QUALITY_COLOR_MODES: ColorModeConfig[];
72
+ /**
73
+ * File City color modes slice data structure.
74
+ * Hosts populate this slice to control which color modes are available.
75
+ * If not populated, only default modes (fileTypes, git) are available.
76
+ */
77
+ export interface FileCityColorModesSliceData {
78
+ /** Additional color modes to enable (beyond fileTypes and git) */
79
+ enabledModes?: ColorMode[];
80
+ /** Quality data for quality-based color modes */
81
+ qualityData?: QualitySliceData;
82
+ }
83
+ /**
84
+ * Convert a score (0-100) to a color on the red-yellow-green gradient
85
+ * Higher scores = greener (better)
86
+ */
87
+ export declare function scoreToColor(score: number): string;
88
+ /**
89
+ * Convert coverage percentage to color
90
+ * High coverage = green, low coverage = red
91
+ */
92
+ export declare function coverageToColor(coverage: number): string;
93
+ /**
94
+ * Convert issue count to color (inverse - fewer issues = greener)
95
+ * Uses a log scale for better distribution
96
+ */
97
+ export declare function issueCountToColor(issueCount: number, maxIssues?: number): string;
98
+ /**
99
+ * Color thresholds for gradient legend
100
+ */
101
+ export declare const SCORE_THRESHOLDS: {
102
+ min: number;
103
+ max: number;
104
+ color: string;
105
+ label: string;
106
+ }[];
107
+ /**
108
+ * Create highlight layers for test coverage visualization
109
+ */
110
+ export declare function createCoverageHighlightLayers(buildings: CityBuilding[], fileCoverage: Record<string, number>): HighlightLayer[];
111
+ /**
112
+ * Create highlight layers for file metrics (ESLint, TypeScript, etc.)
113
+ * Uses issue-count-based categories for clarity
114
+ */
115
+ export declare function createMetricHighlightLayers(buildings: CityBuilding[], metrics: FileMetricData[], metricId: string, _metricName: string): HighlightLayer[];
116
+ /**
117
+ * Create ESLint highlight layers
118
+ */
119
+ export declare function createEslintHighlightLayers(buildings: CityBuilding[], eslintMetrics: FileMetricData[]): HighlightLayer[];
120
+ /**
121
+ * Create TypeScript highlight layers
122
+ */
123
+ export declare function createTypescriptHighlightLayers(buildings: CityBuilding[], typescriptMetrics: FileMetricData[]): HighlightLayer[];
124
+ /**
125
+ * Create Prettier highlight layers
126
+ */
127
+ export declare function createPrettierHighlightLayers(buildings: CityBuilding[], prettierMetrics: FileMetricData[]): HighlightLayer[];
128
+ /**
129
+ * Create Knip highlight layers
130
+ */
131
+ export declare function createKnipHighlightLayers(buildings: CityBuilding[], knipMetrics: FileMetricData[]): HighlightLayer[];
132
+ /**
133
+ * Create Alexandria highlight layers
134
+ */
135
+ export declare function createAlexandriaHighlightLayers(buildings: CityBuilding[], alexandriaMetrics: FileMetricData[]): HighlightLayer[];
136
+ /**
137
+ * Check if quality data is available for a given color mode
138
+ */
139
+ export declare function isColorModeAvailable(mode: ColorMode, qualityData: QualitySliceData | null | undefined, hasGitData: boolean): boolean;
140
+ /**
141
+ * Get highlight layers for a given color mode
142
+ */
143
+ export declare function getLayersForColorMode(mode: ColorMode, buildings: CityBuilding[], qualityData: QualitySliceData | null | undefined, fileColorLayers: HighlightLayer[], gitLayers: HighlightLayer[]): HighlightLayer[];
144
+ //# sourceMappingURL=qualityLayers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qualityLayers.d.ts","sourceRoot":"","sources":["../../../src/panels/utils/qualityLayers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE;QACZ,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;QAC1B,UAAU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