@principal-ai/file-city-react 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ArchitectureMapHighlightLayers.d.ts.map +1 -1
- package/dist/components/ArchitectureMapHighlightLayers.js +10 -1
- package/dist/components/CityViewWithReactFlow.d.ts.map +1 -1
- package/dist/components/CityViewWithReactFlow.js +2 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/render/client/drawLayeredBuildings.d.ts +4 -1
- package/dist/render/client/drawLayeredBuildings.d.ts.map +1 -1
- package/dist/render/client/drawLayeredBuildings.js +29 -82
- package/dist/stories/sample-data.d.ts.map +1 -1
- package/dist/stories/stress-test-data.d.ts.map +1 -1
- package/dist/stories/stress-test-data.js +4 -3
- package/dist/utils/fileColorHighlightLayers.d.ts +11 -1
- package/dist/utils/fileColorHighlightLayers.d.ts.map +1 -1
- package/dist/utils/fileColorHighlightLayers.js +28 -11
- package/dist/utils/fileColorOverrides.d.ts +19 -0
- package/dist/utils/fileColorOverrides.d.ts.map +1 -0
- package/dist/utils/fileColorOverrides.js +52 -0
- package/dist/utils/fileTypeIcons.d.ts +16 -0
- package/dist/utils/fileTypeIcons.d.ts.map +1 -0
- package/dist/utils/fileTypeIcons.js +91 -0
- package/dist/utils/lucideIconConverter.d.ts +31 -0
- package/dist/utils/lucideIconConverter.d.ts.map +1 -0
- package/dist/utils/lucideIconConverter.js +130 -0
- package/package.json +4 -2
- package/src/components/ArchitectureMapHighlightLayers.tsx +10 -0
- package/src/components/CityViewWithReactFlow.tsx +3 -1
- package/src/index.ts +7 -0
- package/src/render/client/drawLayeredBuildings.ts +33 -104
- package/src/stories/AllFileTypes.stories.tsx +389 -0
- package/src/stories/ArchitectureMapHighlightLayers.stories.tsx +1 -1
- package/src/stories/CityViewWithReactFlow.stories.tsx +1 -0
- package/src/stories/StressTest.stories.tsx +0 -4
- package/src/stories/sample-data.ts +3 -13
- package/src/stories/stress-test-data.ts +6 -15
- package/src/utils/fileColorHighlightLayers.ts +44 -8
- package/src/utils/fileColorOverrides.ts +54 -0
- package/src/utils/fileTypeIcons.ts +116 -0
- package/src/utils/lucideIconConverter.tsx +149 -0
- package/src/config/files.json +0 -1012
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchitectureMapHighlightLayers.d.ts","sourceRoot":"","sources":["../../src/components/ArchitectureMapHighlightLayers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAQjF,OAAO,EAIL,cAAc,EAGf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"ArchitectureMapHighlightLayers.d.ts","sourceRoot":"","sources":["../../src/components/ArchitectureMapHighlightLayers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAQjF,OAAO,EAIL,cAAc,EAGf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AAazC,MAAM,WAAW,mCAAmC;IAElD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAGpB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAG9B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IA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AAE,OAAO,CAAC;KACxB,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QACf,eAAe,EAAE,YAAY,GAAG,IAAI,CAAC;QACrC,eAAe,EAAE,YAAY,GAAG,IAAI,CAAC;QACrC,QAAQ,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACnC,WAAW,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QACrC,gBAAgB,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAC1C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,KAAK,IAAI,CAAC;IAGX,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAsLD,iBAAS,mCAAmC,CAAC,EAC3C,QAAQ,EACR,eAAoB,EACpB,aAAa,EACb,cAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,UAAkB,EAClB,UAAiB,EACjB,cAAc,EACd,kBAAyB,EACzB,eAAsB,EACtB,QAAgB,EAChB,QAAgB,EAChB,aAAqB,EACrB,SAAc,EACd,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,qBAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAyB,EACzB,iBAAwB,EACxB,mBAA0B,EAC1B,SAA2B,EAAE,yBAAyB;AACtD,OAAO,EACP,oBAAwB,EACxB,oBAAwB,GACzB,EAAE,mCAAmC,qBA26CrC;AA0BD,eAAO,MAAM,8BAA8B,4CAAsC,CAAC"}
|
|
@@ -38,6 +38,8 @@ const react_1 = __importStar(require("react"));
|
|
|
38
38
|
const industry_theme_1 = require("@principal-ade/industry-theme");
|
|
39
39
|
const cityDataUtils_1 = require("../builder/cityDataUtils");
|
|
40
40
|
const drawLayeredBuildings_1 = require("../render/client/drawLayeredBuildings");
|
|
41
|
+
const fileColorHighlightLayers_1 = require("../utils/fileColorHighlightLayers");
|
|
42
|
+
const fileTypeIcons_1 = require("../utils/fileTypeIcons");
|
|
41
43
|
const DEFAULT_DISPLAY_OPTIONS = {
|
|
42
44
|
showGrid: false,
|
|
43
45
|
showConnections: true,
|
|
@@ -187,6 +189,11 @@ onHover, buildingBorderRadius = 0, districtBorderRadius = 0, }) {
|
|
|
187
189
|
const resolvedDefaultBuildingColor = defaultBuildingColor ?? theme.colors.muted;
|
|
188
190
|
const canvasRef = (0, react_1.useRef)(null);
|
|
189
191
|
const containerRef = (0, react_1.useRef)(null);
|
|
192
|
+
// Extract icon configuration from file color config
|
|
193
|
+
const iconMap = (0, react_1.useMemo)(() => {
|
|
194
|
+
const colorConfig = (0, fileColorHighlightLayers_1.getDefaultFileColorConfig)();
|
|
195
|
+
return (0, fileTypeIcons_1.extractIconConfig)(colorConfig);
|
|
196
|
+
}, []);
|
|
190
197
|
const [interactionState, setInteractionState] = (0, react_1.useState)({
|
|
191
198
|
hoveredDistrict: null,
|
|
192
199
|
hoveredBuilding: null,
|
|
@@ -832,7 +839,8 @@ onHover, buildingBorderRadius = 0, districtBorderRadius = 0, }) {
|
|
|
832
839
|
(0, drawLayeredBuildings_1.drawLayeredDistricts)(ctx, visibleDistrictsMemo, worldToCanvas, scale * zoomState.scale, allLayers, interactionState.hoveredDistrict, fullSize, resolvedDefaultDirectoryColor, filteredCityData.metadata.layoutConfig, abstractedPathsSet, // Pass abstracted paths to skip labels
|
|
833
840
|
showDirectoryLabels, districtBorderRadius, layerIndex);
|
|
834
841
|
// Draw buildings with layer support
|
|
835
|
-
(0, drawLayeredBuildings_1.drawLayeredBuildings)(ctx, visibleBuildingsMemo, worldToCanvas, scale * zoomState.scale, allLayers, interactionState.hoveredBuilding, resolvedDefaultBuildingColor, showFileNames, resolvedHoverBorderColor, disableOpacityDimming, showFileTypeIcons, buildingBorderRadius, layerIndex)
|
|
842
|
+
(0, drawLayeredBuildings_1.drawLayeredBuildings)(ctx, visibleBuildingsMemo, worldToCanvas, scale * zoomState.scale, allLayers, interactionState.hoveredBuilding, resolvedDefaultBuildingColor, showFileNames, resolvedHoverBorderColor, disableOpacityDimming, showFileTypeIcons, buildingBorderRadius, layerIndex, // Pre-built index for O(1) lookups
|
|
843
|
+
iconMap);
|
|
836
844
|
// Performance monitoring end available for debugging
|
|
837
845
|
// Performance stats available but not logged to reduce console noise
|
|
838
846
|
// Uncomment for debugging: render time, buildings/districts counts, layer counts
|
|
@@ -866,6 +874,7 @@ onHover, buildingBorderRadius = 0, districtBorderRadius = 0, }) {
|
|
|
866
874
|
visibleBuildingsMemo,
|
|
867
875
|
abstractedPathsSet,
|
|
868
876
|
layerIndex,
|
|
877
|
+
iconMap,
|
|
869
878
|
]);
|
|
870
879
|
// Optimized hit testing
|
|
871
880
|
const performHitTest = (0, react_1.useCallback)((canvasX, canvasY) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CityViewWithReactFlow.d.ts","sourceRoot":"","sources":["../../src/components/CityViewWithReactFlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAepD,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAIrE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"CityViewWithReactFlow.d.ts","sourceRoot":"","sources":["../../src/components/CityViewWithReactFlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAepD,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAIrE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAiVD,eAAO,MAAM,qBAAqB,sCAA6B,CAAC"}
|
|
@@ -59,6 +59,7 @@ const CellNode = ({ data, selected }) => {
|
|
|
59
59
|
}
|
|
60
60
|
}, [fileTree, cityBuilder]);
|
|
61
61
|
return (react_1.default.createElement("div", { className: "cell-node", style: {
|
|
62
|
+
boxSizing: 'border-box',
|
|
62
63
|
background: selected
|
|
63
64
|
? `linear-gradient(135deg, ${theme.colors.primary} 0%, ${theme.colors.accent} 100%)`
|
|
64
65
|
: `linear-gradient(135deg, ${theme.colors.backgroundSecondary} 0%, ${theme.colors.background} 100%)`,
|
|
@@ -124,7 +125,7 @@ const CellNode = ({ data, selected }) => {
|
|
|
124
125
|
opacity: 1,
|
|
125
126
|
})),
|
|
126
127
|
},
|
|
127
|
-
], showGrid: false, showDirectoryLabels:
|
|
128
|
+
], showGrid: false, showDirectoryLabels: true, showFileNames: true, canvasBackgroundColor: theme.colors.background, defaultBuildingColor: theme.colors.muted, defaultDirectoryColor: theme.colors.backgroundSecondary, className: "w-full h-full",
|
|
128
129
|
// Disable interactions to prevent conflicts with React Flow
|
|
129
130
|
onFileClick: undefined }))) : (react_1.default.createElement("div", { style: {
|
|
130
131
|
display: 'flex',
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export { type LayerRenderStrategy, type LayerItem, type HighlightLayer, LayerInd
|
|
|
3
3
|
export { type MapInteractionState, type MapDisplayOptions } from './types/react-types';
|
|
4
4
|
export { filterCityDataForSelectiveRender, filterCityDataForSubdirectory, filterCityDataForMultipleDirectories, } from './builder/cityDataUtils';
|
|
5
5
|
export { createFileColorHighlightLayers, getDefaultFileColorConfig, getFileColorMapping, } from './utils/fileColorHighlightLayers';
|
|
6
|
-
export type { ColorLayerConfig, FileSuffixConfig, FileSuffixColorConfig, } from './utils/fileColorHighlightLayers';
|
|
6
|
+
export type { ColorLayerConfig, FileSuffixConfig, FileSuffixColorConfig, FileTypeIconConfig, } from './utils/fileColorHighlightLayers';
|
|
7
|
+
export { devFileColorOverrides, mergeFileColorConfig } from './utils/fileColorOverrides';
|
|
8
|
+
export { extractIconConfig, getFileTypeIcon, drawFileTypeIcon } from './utils/fileTypeIcons';
|
|
7
9
|
export type { CityData, CityBuilding, CityDistrict, SelectiveRenderOptions, Bounds2D, Position3D, } from '@principal-ai/file-city-builder';
|
|
8
10
|
export { MultiVersionCityBuilder } from '@principal-ai/file-city-builder';
|
|
9
11
|
export { useCodeCityData } from './hooks/useCodeCityData';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,8BAA8B,EAC9B,KAAK,mCAAmC,GACzC,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,UAAU,GACX,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGvF,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,oCAAoC,GACrC,MAAM,yBAAyB,CAAC;AAGjC,OAAO,E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EACrB,KAAK,0BAA0B,GAChC,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTheme = exports.ThemeProvider = exports.CityViewWithReactFlow = exports.useCodeCityData = exports.MultiVersionCityBuilder = exports.getFileColorMapping = exports.getDefaultFileColorConfig = exports.createFileColorHighlightLayers = exports.filterCityDataForMultipleDirectories = exports.filterCityDataForSubdirectory = exports.filterCityDataForSelectiveRender = exports.LayerIndex = exports.ArchitectureMapHighlightLayers = void 0;
|
|
3
|
+
exports.useTheme = exports.ThemeProvider = exports.CityViewWithReactFlow = exports.useCodeCityData = exports.MultiVersionCityBuilder = exports.drawFileTypeIcon = exports.getFileTypeIcon = exports.extractIconConfig = exports.mergeFileColorConfig = exports.devFileColorOverrides = exports.getFileColorMapping = exports.getDefaultFileColorConfig = exports.createFileColorHighlightLayers = exports.filterCityDataForMultipleDirectories = exports.filterCityDataForSubdirectory = exports.filterCityDataForSelectiveRender = exports.LayerIndex = exports.ArchitectureMapHighlightLayers = void 0;
|
|
4
4
|
// Main component export
|
|
5
5
|
var ArchitectureMapHighlightLayers_1 = require("./components/ArchitectureMapHighlightLayers");
|
|
6
6
|
Object.defineProperty(exports, "ArchitectureMapHighlightLayers", { enumerable: true, get: function () { return ArchitectureMapHighlightLayers_1.ArchitectureMapHighlightLayers; } });
|
|
@@ -17,6 +17,15 @@ var fileColorHighlightLayers_1 = require("./utils/fileColorHighlightLayers");
|
|
|
17
17
|
Object.defineProperty(exports, "createFileColorHighlightLayers", { enumerable: true, get: function () { return fileColorHighlightLayers_1.createFileColorHighlightLayers; } });
|
|
18
18
|
Object.defineProperty(exports, "getDefaultFileColorConfig", { enumerable: true, get: function () { return fileColorHighlightLayers_1.getDefaultFileColorConfig; } });
|
|
19
19
|
Object.defineProperty(exports, "getFileColorMapping", { enumerable: true, get: function () { return fileColorHighlightLayers_1.getFileColorMapping; } });
|
|
20
|
+
// File color override utilities for development
|
|
21
|
+
var fileColorOverrides_1 = require("./utils/fileColorOverrides");
|
|
22
|
+
Object.defineProperty(exports, "devFileColorOverrides", { enumerable: true, get: function () { return fileColorOverrides_1.devFileColorOverrides; } });
|
|
23
|
+
Object.defineProperty(exports, "mergeFileColorConfig", { enumerable: true, get: function () { return fileColorOverrides_1.mergeFileColorConfig; } });
|
|
24
|
+
// File type icon utilities
|
|
25
|
+
var fileTypeIcons_1 = require("./utils/fileTypeIcons");
|
|
26
|
+
Object.defineProperty(exports, "extractIconConfig", { enumerable: true, get: function () { return fileTypeIcons_1.extractIconConfig; } });
|
|
27
|
+
Object.defineProperty(exports, "getFileTypeIcon", { enumerable: true, get: function () { return fileTypeIcons_1.getFileTypeIcon; } });
|
|
28
|
+
Object.defineProperty(exports, "drawFileTypeIcon", { enumerable: true, get: function () { return fileTypeIcons_1.drawFileTypeIcon; } });
|
|
20
29
|
// Re-export MultiVersionCityBuilder which was requested
|
|
21
30
|
var file_city_builder_1 = require("@principal-ai/file-city-builder");
|
|
22
31
|
Object.defineProperty(exports, "MultiVersionCityBuilder", { enumerable: true, get: function () { return file_city_builder_1.MultiVersionCityBuilder; } });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CityBuilding, CityDistrict } from '@principal-ai/file-city-builder';
|
|
2
|
+
import { FileTypeIconConfig } from '../../utils/fileColorHighlightLayers';
|
|
2
3
|
export type LayerRenderStrategy = 'border' | 'fill' | 'glow' | 'pattern' | 'cover' | 'icon' | 'custom';
|
|
3
4
|
export interface LayerItem {
|
|
4
5
|
path: string;
|
|
@@ -13,6 +14,7 @@ export interface LayerItem {
|
|
|
13
14
|
borderRadius?: number;
|
|
14
15
|
icon?: string;
|
|
15
16
|
iconSize?: number;
|
|
17
|
+
lucideIcon?: string;
|
|
16
18
|
};
|
|
17
19
|
customRender?: (ctx: CanvasRenderingContext2D, bounds: {
|
|
18
20
|
x: number;
|
|
@@ -69,5 +71,6 @@ export declare function drawLayeredBuildings(ctx: CanvasRenderingContext2D, buil
|
|
|
69
71
|
x: number;
|
|
70
72
|
y: number;
|
|
71
73
|
}, scale: number, layers: HighlightLayer[], hoveredBuilding?: CityBuilding | null, defaultBuildingColor?: string, showFileNames?: boolean, hoverBorderColor?: string, disableOpacityDimming?: boolean, showFileTypeIcons?: boolean, borderRadius?: number, // Border radius for buildings (default: 0 - sharp corners)
|
|
72
|
-
layerIndex?: LayerIndex
|
|
74
|
+
layerIndex?: LayerIndex, // Optional pre-built index for performance
|
|
75
|
+
iconMap?: Map<string, FileTypeIconConfig>): void;
|
|
73
76
|
//# sourceMappingURL=drawLayeredBuildings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawLayeredBuildings.d.ts","sourceRoot":"","sources":["../../../src/render/client/drawLayeredBuildings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"drawLayeredBuildings.d.ts","sourceRoot":"","sources":["../../../src/render/client/drawLayeredBuildings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI1E,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,MAAM,GACN,MAAM,GACN,SAAS,GACT,OAAO,GACP,MAAM,GACN,QAAQ,CAAC;AAEb,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,cAAc,CAAC,EAAE,mBAAmB,CAAC;IAErC,YAAY,CAAC,EAAE;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,C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EAAE,MAAM,EACzB,qBAAqB,CAAC,EAAE,OAAO,EAC/B,iBAAiB,CAAC,EAAE,OAAO,EAC3B,YAAY,GAAE,MAAU,EAAE,2DAA2D;AACrF,UAAU,CAAC,EAAE,UAAU,EAAE,2CAA2C;AACpE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,QA4I1C"}
|
|
@@ -4,23 +4,8 @@ exports.LayerIndex = void 0;
|
|
|
4
4
|
exports.drawGrid = drawGrid;
|
|
5
5
|
exports.drawLayeredDistricts = drawLayeredDistricts;
|
|
6
6
|
exports.drawLayeredBuildings = drawLayeredBuildings;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (item.type === 'file') {
|
|
10
|
-
return path === item.path;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
// Directory match
|
|
14
|
-
if (checkType === 'exact') {
|
|
15
|
-
// Only match the directory itself, not its children
|
|
16
|
-
return path === item.path;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
// Match directory and all its children (original behavior)
|
|
20
|
-
return path === item.path || path.startsWith(item.path + '/');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
7
|
+
const lucideIconConverter_1 = require("../../utils/lucideIconConverter");
|
|
8
|
+
const fileTypeIcons_1 = require("../../utils/fileTypeIcons");
|
|
24
9
|
/**
|
|
25
10
|
* LayerIndex provides O(1) path lookups instead of O(n) iteration.
|
|
26
11
|
* This dramatically improves performance with large numbers of layer items.
|
|
@@ -120,21 +105,6 @@ function drawRoundedRect(ctx, x, y, width, height, radius, fill, stroke) {
|
|
|
120
105
|
if (stroke)
|
|
121
106
|
ctx.stroke();
|
|
122
107
|
}
|
|
123
|
-
// Get all layer items that apply to a given path
|
|
124
|
-
function getLayerItemsForPath(path, layers, checkType = 'children') {
|
|
125
|
-
const matches = [];
|
|
126
|
-
for (const layer of layers) {
|
|
127
|
-
if (!layer.enabled)
|
|
128
|
-
continue;
|
|
129
|
-
for (const item of layer.items) {
|
|
130
|
-
if (pathMatchesItem(path, item, checkType)) {
|
|
131
|
-
matches.push({ layer, item });
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Sort by priority (highest first)
|
|
136
|
-
return matches.sort((a, b) => b.layer.priority - a.layer.priority);
|
|
137
|
-
}
|
|
138
108
|
// Draw grid helper (copied from original)
|
|
139
109
|
function drawGrid(ctx, width, height, gridSize) {
|
|
140
110
|
ctx.save();
|
|
@@ -310,20 +280,27 @@ function renderCoverStrategy(ctx, bounds, layer, item, _scale) {
|
|
|
310
280
|
ctx.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
|
|
311
281
|
// Reset alpha for text/icon
|
|
312
282
|
ctx.globalAlpha = 1;
|
|
313
|
-
//
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
ctx.drawImage(img, imageX, imageY, imageSize, imageSize);
|
|
323
|
-
};
|
|
283
|
+
// Get image for rendering
|
|
284
|
+
let img = null;
|
|
285
|
+
// Check for lucideIcon first (new way)
|
|
286
|
+
if (coverOptions.lucideIcon) {
|
|
287
|
+
img = (0, lucideIconConverter_1.getLucideIconImage)(coverOptions.lucideIcon, '#ffffff', coverOptions.iconSize || 24);
|
|
288
|
+
}
|
|
289
|
+
// Fallback to direct image URL (old way)
|
|
290
|
+
else if (coverOptions.image) {
|
|
291
|
+
img = new Image();
|
|
324
292
|
img.src = coverOptions.image;
|
|
325
293
|
}
|
|
326
|
-
//
|
|
294
|
+
// Draw the image if we have one
|
|
295
|
+
if (img) {
|
|
296
|
+
const imageSize = coverOptions.iconSize || Math.min(bounds.width, bounds.height) * 0.4;
|
|
297
|
+
const imageX = bounds.x + bounds.width / 2 - imageSize / 2;
|
|
298
|
+
const imageY = coverOptions.text
|
|
299
|
+
? bounds.y + bounds.height * 0.25
|
|
300
|
+
: bounds.y + bounds.height / 2 - imageSize / 2;
|
|
301
|
+
ctx.drawImage(img, imageX, imageY, imageSize, imageSize);
|
|
302
|
+
}
|
|
303
|
+
// Text Icon (fallback if no image or lucideIcon)
|
|
327
304
|
else if (coverOptions.icon) {
|
|
328
305
|
const iconSize = coverOptions.iconSize || Math.min(bounds.width, bounds.height) * 0.3;
|
|
329
306
|
ctx.font = `${iconSize}px Arial`;
|
|
@@ -606,38 +583,10 @@ layerIndex) {
|
|
|
606
583
|
} // End of !hasCover check
|
|
607
584
|
});
|
|
608
585
|
}
|
|
609
|
-
/**
|
|
610
|
-
* Draw a React symbol (⚛) at the given position
|
|
611
|
-
*/
|
|
612
|
-
function drawReactSymbol(ctx, x, y, size, color = '#00D8FF', glow = true) {
|
|
613
|
-
ctx.save();
|
|
614
|
-
// Position and setup
|
|
615
|
-
ctx.translate(x, y);
|
|
616
|
-
// Glow effect for React symbol
|
|
617
|
-
if (glow) {
|
|
618
|
-
ctx.shadowColor = color;
|
|
619
|
-
ctx.shadowBlur = 8;
|
|
620
|
-
}
|
|
621
|
-
// Draw the React symbol (⚛)
|
|
622
|
-
ctx.fillStyle = color;
|
|
623
|
-
ctx.font = `${size}px Arial`;
|
|
624
|
-
ctx.textAlign = 'center';
|
|
625
|
-
ctx.textBaseline = 'middle';
|
|
626
|
-
ctx.fillText('⚛', 0, 0);
|
|
627
|
-
ctx.restore();
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Check if a file is a React file (JSX/TSX)
|
|
631
|
-
*/
|
|
632
|
-
function isReactFile(fileExtension) {
|
|
633
|
-
if (!fileExtension)
|
|
634
|
-
return false;
|
|
635
|
-
const ext = fileExtension.toLowerCase();
|
|
636
|
-
return ext === '.jsx' || ext === '.tsx';
|
|
637
|
-
}
|
|
638
586
|
// Draw buildings with layer support
|
|
639
587
|
function drawLayeredBuildings(ctx, buildings, worldToCanvas, scale, layers, hoveredBuilding, defaultBuildingColor, showFileNames, hoverBorderColor, disableOpacityDimming, showFileTypeIcons, borderRadius = 0, // Border radius for buildings (default: 0 - sharp corners)
|
|
640
|
-
layerIndex
|
|
588
|
+
layerIndex, // Optional pre-built index for performance
|
|
589
|
+
iconMap) {
|
|
641
590
|
// Build index once for all buildings (O(n) instead of O(n²))
|
|
642
591
|
const index = layerIndex || new LayerIndex(layers);
|
|
643
592
|
buildings.forEach(building => {
|
|
@@ -703,14 +652,12 @@ layerIndex) {
|
|
|
703
652
|
ctx.strokeRect(bounds.x - 1, bounds.y - 1, bounds.width + 2, bounds.height + 2);
|
|
704
653
|
}
|
|
705
654
|
}
|
|
706
|
-
// Draw
|
|
707
|
-
if (showFileTypeIcons &&
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
const reactY = pos.y;
|
|
713
|
-
drawReactSymbol(ctx, reactX, reactY, reactSize);
|
|
655
|
+
// Draw file type icon if enabled and icon map is provided
|
|
656
|
+
if (showFileTypeIcons && iconMap) {
|
|
657
|
+
const iconConfig = (0, fileTypeIcons_1.getFileTypeIcon)(building.path, iconMap);
|
|
658
|
+
if (iconConfig) {
|
|
659
|
+
(0, fileTypeIcons_1.drawFileTypeIcon)(ctx, iconConfig, pos.x, pos.y, width, height);
|
|
660
|
+
}
|
|
714
661
|
}
|
|
715
662
|
// Draw filename if enabled
|
|
716
663
|
if (showFileNames && width > 100 && height > 30) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample-data.d.ts","sourceRoot":"","sources":["../../src/stories/sample-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"sample-data.d.ts","sourceRoot":"","sources":["../../src/stories/sample-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;AA2EzC,wBAAgB,oBAAoB,IAAI,QAAQ,CAmB/C;AAaD,wBAAgB,yBAAyB,IAAI,QAAQ,CAmBpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stress-test-data.d.ts","sourceRoot":"","sources":["../../src/stories/stress-test-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"stress-test-data.d.ts","sourceRoot":"","sources":["../../src/stories/stress-test-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGT,MAAM,iCAAiC,CAAC;AA+BzC;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAoElE;AAoBD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,GAAE,MAAa,EAAE,QAAQ,GAAE,OAAc,GAAG,QAAQ,CA2BrG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
|
@@ -6,8 +6,6 @@ exports.clearStressTestCache = clearStressTestCache;
|
|
|
6
6
|
const file_city_builder_1 = require("@principal-ai/file-city-builder");
|
|
7
7
|
// Common file extensions for realistic distribution
|
|
8
8
|
const FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.css', '.json', '.md', '.test.ts', '.spec.tsx'];
|
|
9
|
-
// Top-level source directories
|
|
10
|
-
const TOP_LEVEL_DIRS = ['src', 'lib', 'packages', 'modules'];
|
|
11
9
|
// Second-level directories (domain areas)
|
|
12
10
|
const DOMAIN_DIRS = ['components', 'utils', 'services', 'hooks', 'types', 'helpers', 'core', 'api', 'features', 'pages'];
|
|
13
11
|
// Third-level directories (categories within domains)
|
|
@@ -120,7 +118,10 @@ const stressTestCache = new Map();
|
|
|
120
118
|
*/
|
|
121
119
|
function createStressTestCityData(fileCount = 8000, useCache = true) {
|
|
122
120
|
if (useCache && stressTestCache.has(fileCount)) {
|
|
123
|
-
|
|
121
|
+
const cached = stressTestCache.get(fileCount);
|
|
122
|
+
if (cached) {
|
|
123
|
+
return cached;
|
|
124
|
+
}
|
|
124
125
|
}
|
|
125
126
|
const filePaths = generateLargeFilePaths(fileCount);
|
|
126
127
|
const fileInfos = createFileInfoList(filePaths);
|
|
@@ -14,6 +14,7 @@ export interface ColorLayerConfig {
|
|
|
14
14
|
borderRadius?: number;
|
|
15
15
|
icon?: string;
|
|
16
16
|
iconSize?: number;
|
|
17
|
+
lucideIcon?: string;
|
|
17
18
|
};
|
|
18
19
|
customRender?: (ctx: CanvasRenderingContext2D, bounds: {
|
|
19
20
|
x: number;
|
|
@@ -22,9 +23,18 @@ export interface ColorLayerConfig {
|
|
|
22
23
|
height: number;
|
|
23
24
|
}, scale: number) => void;
|
|
24
25
|
}
|
|
26
|
+
export interface FileTypeIconConfig {
|
|
27
|
+
type: 'emoji' | 'lucide';
|
|
28
|
+
name: string;
|
|
29
|
+
color?: string;
|
|
30
|
+
backgroundColor?: string;
|
|
31
|
+
glow?: boolean;
|
|
32
|
+
size?: number;
|
|
33
|
+
}
|
|
25
34
|
export interface FileSuffixConfig {
|
|
26
35
|
primary: ColorLayerConfig;
|
|
27
36
|
secondary?: ColorLayerConfig;
|
|
37
|
+
icon?: FileTypeIconConfig;
|
|
28
38
|
displayName?: string;
|
|
29
39
|
description?: string;
|
|
30
40
|
category?: string;
|
|
@@ -72,7 +82,7 @@ export declare function createFileColorHighlightLayers(files: Array<{
|
|
|
72
82
|
}> | null | undefined, config?: FileSuffixColorConfig): HighlightLayer[];
|
|
73
83
|
/**
|
|
74
84
|
* Get the default file color configuration.
|
|
75
|
-
* This returns the configuration loaded from files.json.
|
|
85
|
+
* This returns the configuration loaded from files.json merged with local dev overrides.
|
|
76
86
|
*/
|
|
77
87
|
export declare function getDefaultFileColorConfig(): FileSuffixColorConfig;
|
|
78
88
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileColorHighlightLayers.d.ts","sourceRoot":"","sources":["../../src/utils/fileColorHighlightLayers.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EAEd,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CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACjD,MAAM,CAAC,EAAE,qBAAqB,GAC7B,cAAc,EAAE,CAuSlB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,qBAAqB,CAEjE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ1F"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createFileColorHighlightLayers = createFileColorHighlightLayers;
|
|
7
4
|
exports.getDefaultFileColorConfig = getDefaultFileColorConfig;
|
|
8
5
|
exports.getFileColorMapping = getFileColorMapping;
|
|
9
|
-
const
|
|
6
|
+
const file_city_builder_1 = require("@principal-ai/file-city-builder");
|
|
7
|
+
const fileColorOverrides_1 = require("./fileColorOverrides");
|
|
10
8
|
/**
|
|
11
9
|
* Creates highlight layers for files based on file extension configurations.
|
|
12
10
|
*
|
|
@@ -40,8 +38,9 @@ function createFileColorHighlightLayers(files, config) {
|
|
|
40
38
|
if (!files || files.length === 0) {
|
|
41
39
|
return [];
|
|
42
40
|
}
|
|
43
|
-
// Use provided config or fall back to default
|
|
44
|
-
const colorConfig = config ||
|
|
41
|
+
// Use provided config or fall back to default merged with dev overrides
|
|
42
|
+
const colorConfig = config ||
|
|
43
|
+
(0, fileColorOverrides_1.mergeFileColorConfig)(file_city_builder_1.defaultFileColorConfig, fileColorOverrides_1.devFileColorOverrides);
|
|
45
44
|
const { suffixConfigs, defaultConfig: defaultFileConfig, includeUnmatched = true } = colorConfig;
|
|
46
45
|
// Validation
|
|
47
46
|
if (!suffixConfigs || typeof suffixConfigs !== 'object') {
|
|
@@ -56,7 +55,6 @@ function createFileColorHighlightLayers(files, config) {
|
|
|
56
55
|
const filePath = file.path;
|
|
57
56
|
const lastSlash = filePath.lastIndexOf('/');
|
|
58
57
|
const fileName = lastSlash === -1 ? filePath : filePath.substring(lastSlash + 1);
|
|
59
|
-
const lastDot = fileName.lastIndexOf('.');
|
|
60
58
|
// Check for exact filename match first (e.g., LICENSE, Makefile)
|
|
61
59
|
if (suffixConfigs[fileName]) {
|
|
62
60
|
if (!filesBySuffix.has(fileName)) {
|
|
@@ -68,6 +66,7 @@ function createFileColorHighlightLayers(files, config) {
|
|
|
68
66
|
}
|
|
69
67
|
return;
|
|
70
68
|
}
|
|
69
|
+
const lastDot = fileName.lastIndexOf('.');
|
|
71
70
|
if (lastDot === -1 || lastDot === fileName.length - 1) {
|
|
72
71
|
// No extension or ends with dot
|
|
73
72
|
if (includeUnmatched) {
|
|
@@ -75,7 +74,24 @@ function createFileColorHighlightLayers(files, config) {
|
|
|
75
74
|
}
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
|
-
|
|
77
|
+
// Check for compound extensions first (e.g., .test.ts, .spec.tsx, .d.ts)
|
|
78
|
+
// Look for patterns like .test.ts, .spec.js, etc.
|
|
79
|
+
let extension = null;
|
|
80
|
+
const lowerFileName = fileName.toLowerCase();
|
|
81
|
+
// Sort suffixes by length (longest first) to match compound extensions before simple ones
|
|
82
|
+
// e.g., .test.ts should be checked before .ts
|
|
83
|
+
const sortedSuffixes = Object.keys(suffixConfigs).sort((a, b) => b.length - a.length);
|
|
84
|
+
// Check if any suffix config matches as a suffix of the filename
|
|
85
|
+
for (const suffix of sortedSuffixes) {
|
|
86
|
+
if (lowerFileName.endsWith(suffix)) {
|
|
87
|
+
extension = suffix;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Fallback to simple extension if no compound match found
|
|
92
|
+
if (!extension) {
|
|
93
|
+
extension = fileName.substring(lastDot).toLowerCase();
|
|
94
|
+
}
|
|
79
95
|
if (suffixConfigs[extension]) {
|
|
80
96
|
if (!filesBySuffix.has(extension)) {
|
|
81
97
|
filesBySuffix.set(extension, []);
|
|
@@ -262,10 +278,10 @@ function createFileColorHighlightLayers(files, config) {
|
|
|
262
278
|
}
|
|
263
279
|
/**
|
|
264
280
|
* Get the default file color configuration.
|
|
265
|
-
* This returns the configuration loaded from files.json.
|
|
281
|
+
* This returns the configuration loaded from files.json merged with local dev overrides.
|
|
266
282
|
*/
|
|
267
283
|
function getDefaultFileColorConfig() {
|
|
268
|
-
return
|
|
284
|
+
return (0, fileColorOverrides_1.mergeFileColorConfig)(file_city_builder_1.defaultFileColorConfig, fileColorOverrides_1.devFileColorOverrides);
|
|
269
285
|
}
|
|
270
286
|
/**
|
|
271
287
|
* Get a simple color mapping from the configuration.
|
|
@@ -275,7 +291,8 @@ function getDefaultFileColorConfig() {
|
|
|
275
291
|
* @returns Record mapping file extensions to hex color strings
|
|
276
292
|
*/
|
|
277
293
|
function getFileColorMapping(config) {
|
|
278
|
-
const colorConfig = config ||
|
|
294
|
+
const colorConfig = config ||
|
|
295
|
+
(0, fileColorOverrides_1.mergeFileColorConfig)(file_city_builder_1.defaultFileColorConfig, fileColorOverrides_1.devFileColorOverrides);
|
|
279
296
|
return Object.entries(colorConfig.suffixConfigs).reduce((acc, [extension, suffixConfig]) => {
|
|
280
297
|
acc[extension] = suffixConfig.primary.color;
|
|
281
298
|
return acc;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileSuffixColorConfig } from './fileColorHighlightLayers';
|
|
2
|
+
/**
|
|
3
|
+
* Development overrides for file color configuration.
|
|
4
|
+
* Add new file extensions here during development, then move them to
|
|
5
|
+
* @principal-ai/file-city-builder/src/config/files.json when ready to publish.
|
|
6
|
+
*
|
|
7
|
+
* These overrides will merge with (and take precedence over) the default config.
|
|
8
|
+
*/
|
|
9
|
+
export declare const devFileColorOverrides: Partial<FileSuffixColorConfig>;
|
|
10
|
+
/**
|
|
11
|
+
* Merges the default file color configuration with local development overrides.
|
|
12
|
+
* Overrides take precedence over defaults.
|
|
13
|
+
*
|
|
14
|
+
* @param defaultConfig - The default configuration from the builder package
|
|
15
|
+
* @param overrides - Local development overrides
|
|
16
|
+
* @returns Merged configuration with overrides applied
|
|
17
|
+
*/
|
|
18
|
+
export declare function mergeFileColorConfig(defaultConfig: FileSuffixColorConfig, overrides: Partial<FileSuffixColorConfig>): FileSuffixColorConfig;
|
|
19
|
+
//# sourceMappingURL=fileColorOverrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileColorOverrides.d.ts","sourceRoot":"","sources":["../../src/utils/fileColorOverrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,qBAAqB,CAoBhE,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,qBAAqB,EACpC,SAAS,EAAE,OAAO,CAAC,qBAAqB,CAAC,GACxC,qBAAqB,CAWvB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.devFileColorOverrides = void 0;
|
|
4
|
+
exports.mergeFileColorConfig = mergeFileColorConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Development overrides for file color configuration.
|
|
7
|
+
* Add new file extensions here during development, then move them to
|
|
8
|
+
* @principal-ai/file-city-builder/src/config/files.json when ready to publish.
|
|
9
|
+
*
|
|
10
|
+
* These overrides will merge with (and take precedence over) the default config.
|
|
11
|
+
*/
|
|
12
|
+
exports.devFileColorOverrides = {
|
|
13
|
+
suffixConfigs: {
|
|
14
|
+
// Add your new file extensions here during development
|
|
15
|
+
"package.json": {
|
|
16
|
+
primary: {
|
|
17
|
+
color: "#CB3837",
|
|
18
|
+
renderStrategy: "fill",
|
|
19
|
+
opacity: 1.0,
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
type: "lucide",
|
|
23
|
+
name: "Package",
|
|
24
|
+
color: "#ffffff",
|
|
25
|
+
size: 0.6,
|
|
26
|
+
},
|
|
27
|
+
displayName: "Package",
|
|
28
|
+
description: "npm package.json files",
|
|
29
|
+
category: "Configuration",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Merges the default file color configuration with local development overrides.
|
|
35
|
+
* Overrides take precedence over defaults.
|
|
36
|
+
*
|
|
37
|
+
* @param defaultConfig - The default configuration from the builder package
|
|
38
|
+
* @param overrides - Local development overrides
|
|
39
|
+
* @returns Merged configuration with overrides applied
|
|
40
|
+
*/
|
|
41
|
+
function mergeFileColorConfig(defaultConfig, overrides) {
|
|
42
|
+
return {
|
|
43
|
+
...defaultConfig,
|
|
44
|
+
...overrides,
|
|
45
|
+
suffixConfigs: {
|
|
46
|
+
...defaultConfig.suffixConfigs,
|
|
47
|
+
...(overrides.suffixConfigs || {}),
|
|
48
|
+
},
|
|
49
|
+
// Keep default config's defaultConfig unless explicitly overridden
|
|
50
|
+
...(overrides.defaultConfig && { defaultConfig: overrides.defaultConfig }),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FileSuffixColorConfig, FileTypeIconConfig } from './fileColorHighlightLayers';
|
|
2
|
+
/**
|
|
3
|
+
* Extract icon configurations from file color config
|
|
4
|
+
* This creates a map of file extensions to their icon configs
|
|
5
|
+
*/
|
|
6
|
+
export declare function extractIconConfig(colorConfig: FileSuffixColorConfig): Map<string, FileTypeIconConfig>;
|
|
7
|
+
/**
|
|
8
|
+
* Get icon configuration for a file path
|
|
9
|
+
* Uses same matching logic as file color system
|
|
10
|
+
*/
|
|
11
|
+
export declare function getFileTypeIcon(filePath: string, iconMap: Map<string, FileTypeIconConfig>): FileTypeIconConfig | null;
|
|
12
|
+
/**
|
|
13
|
+
* Draw a file type icon on the canvas
|
|
14
|
+
*/
|
|
15
|
+
export declare function drawFileTypeIcon(ctx: CanvasRenderingContext2D, icon: FileTypeIconConfig, x: number, y: number, buildingWidth: number, buildingHeight: number): void;
|
|
16
|
+
//# sourceMappingURL=fileTypeIcons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTypeIcons.d.ts","sourceRoot":"","sources":["../../src/utils/fileTypeIcons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGvF;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,qBAAqB,GACjC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAUjC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GACvC,kBAAkB,GAAG,IAAI,CA0B3B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,wBAAwB,EAC7B,IAAI,EAAE,kBAAkB,EACxB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,QAkDvB"}
|