@industry-theme/file-city-panel 0.2.31 → 0.2.33

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.
@@ -11131,7 +11131,7 @@ const createGitTab = (content, count2) => ({
11131
11131
  });
11132
11132
  var dist$1 = {};
11133
11133
  var ArchitectureMapHighlightLayers = {};
11134
- const require$$6 = /* @__PURE__ */ getAugmentedNamespace(esm$1);
11134
+ const require$$7 = /* @__PURE__ */ getAugmentedNamespace(esm$1);
11135
11135
  var cityDataUtils = {};
11136
11136
  var hasRequiredCityDataUtils;
11137
11137
  function requireCityDataUtils() {
@@ -11421,20 +11421,71 @@ function requireDrawLayeredBuildings() {
11421
11421
  if (hasRequiredDrawLayeredBuildings) return drawLayeredBuildings;
11422
11422
  hasRequiredDrawLayeredBuildings = 1;
11423
11423
  Object.defineProperty(drawLayeredBuildings, "__esModule", { value: true });
11424
+ drawLayeredBuildings.LayerIndex = void 0;
11424
11425
  drawLayeredBuildings.drawGrid = drawGrid;
11425
11426
  drawLayeredBuildings.drawLayeredDistricts = drawLayeredDistricts;
11426
11427
  drawLayeredBuildings.drawLayeredBuildings = drawLayeredBuildings$1;
11427
- function pathMatchesItem(path, item, checkType = "children") {
11428
- if (item.type === "file") {
11429
- return path === item.path;
11430
- } else {
11428
+ class LayerIndex {
11429
+ constructor(layers) {
11430
+ this.exactIndex = /* @__PURE__ */ new Map();
11431
+ this.directoryPaths = [];
11432
+ this.sortedCache = /* @__PURE__ */ new Map();
11433
+ this.buildIndex(layers);
11434
+ }
11435
+ buildIndex(layers) {
11436
+ for (const layer of layers) {
11437
+ if (!layer.enabled)
11438
+ continue;
11439
+ for (const item of layer.items) {
11440
+ const entry = { layer, item };
11441
+ if (item.type === "file") {
11442
+ const existing = this.exactIndex.get(item.path);
11443
+ if (existing) {
11444
+ existing.push(entry);
11445
+ } else {
11446
+ this.exactIndex.set(item.path, [entry]);
11447
+ }
11448
+ } else {
11449
+ this.directoryPaths.push({ path: item.path, layer, item });
11450
+ }
11451
+ }
11452
+ }
11453
+ this.directoryPaths.sort((a, b) => b.path.length - a.path.length);
11454
+ }
11455
+ /**
11456
+ * Get all layer items that apply to a given path.
11457
+ * For 'exact' mode: only matches the exact path.
11458
+ * For 'children' mode: matches exact path OR parent directories that contain this path.
11459
+ */
11460
+ getItemsForPath(path, checkType = "children") {
11461
+ const cacheKey = `${path}:${checkType}`;
11462
+ const cached = this.sortedCache.get(cacheKey);
11463
+ if (cached)
11464
+ return cached;
11465
+ const matches = [];
11466
+ const exactMatches = this.exactIndex.get(path);
11467
+ if (exactMatches) {
11468
+ matches.push(...exactMatches);
11469
+ }
11431
11470
  if (checkType === "exact") {
11432
- return path === item.path;
11471
+ for (const dir of this.directoryPaths) {
11472
+ if (dir.path === path) {
11473
+ matches.push({ layer: dir.layer, item: dir.item });
11474
+ }
11475
+ }
11433
11476
  } else {
11434
- return path === item.path || path.startsWith(item.path + "/");
11477
+ for (const dir of this.directoryPaths) {
11478
+ if (path === dir.path || path.startsWith(dir.path + "/")) {
11479
+ matches.push({ layer: dir.layer, item: dir.item });
11480
+ }
11481
+ }
11435
11482
  }
11483
+ const sorted = matches.sort((a, b) => b.layer.priority - a.layer.priority);
11484
+ this.sortedCache.set(cacheKey, sorted);
11485
+ return sorted;
11436
11486
  }
11437
11487
  }
11488
+ drawLayeredBuildings.LayerIndex = LayerIndex;
11438
11489
  function drawRoundedRect(ctx, x, y, width, height, radius, fill, stroke) {
11439
11490
  ctx.beginPath();
11440
11491
  ctx.moveTo(x + radius, y);
@@ -11452,19 +11503,6 @@ function requireDrawLayeredBuildings() {
11452
11503
  if (stroke)
11453
11504
  ctx.stroke();
11454
11505
  }
11455
- function getLayerItemsForPath(path, layers, checkType = "children") {
11456
- const matches = [];
11457
- for (const layer of layers) {
11458
- if (!layer.enabled)
11459
- continue;
11460
- for (const item of layer.items) {
11461
- if (pathMatchesItem(path, item, checkType)) {
11462
- matches.push({ layer, item });
11463
- }
11464
- }
11465
- }
11466
- return matches.sort((a, b) => b.layer.priority - a.layer.priority);
11467
- }
11468
11506
  function drawGrid(ctx, width, height, gridSize) {
11469
11507
  ctx.save();
11470
11508
  ctx.strokeStyle = "rgba(255, 255, 255, 0.05)";
@@ -11697,12 +11735,13 @@ function requireDrawLayeredBuildings() {
11697
11735
  break;
11698
11736
  }
11699
11737
  }
11700
- function drawLayeredDistricts(ctx, districts, worldToCanvas, scale, layers, hoveredDistrict, fullSize, defaultDirectoryColor, layoutConfig, abstractedPaths, showDirectoryLabels = true, borderRadius = 0) {
11738
+ function drawLayeredDistricts(ctx, districts, worldToCanvas, scale, layers, hoveredDistrict, fullSize, defaultDirectoryColor, layoutConfig, abstractedPaths, showDirectoryLabels = true, borderRadius = 0, layerIndex) {
11739
+ const index = layerIndex || new LayerIndex(layers);
11701
11740
  districts.forEach((district) => {
11702
11741
  var _a, _b;
11703
11742
  const districtPath = district.path || "";
11704
11743
  const isRoot = !districtPath || districtPath === "";
11705
- const rootLayerMatches = getLayerItemsForPath(districtPath, layers, "exact");
11744
+ const rootLayerMatches = index.getItemsForPath(districtPath, "exact");
11706
11745
  const hasLayerRendering = rootLayerMatches.length > 0;
11707
11746
  if (isRoot && !hasLayerRendering)
11708
11747
  return;
@@ -11723,7 +11762,7 @@ function requireDrawLayeredBuildings() {
11723
11762
  const baseColor = hexToRgb(baseColorHex);
11724
11763
  let opacity = 0.3;
11725
11764
  let borderOpacity = 0.6;
11726
- const layerMatches = getLayerItemsForPath(districtPath, layers, "exact");
11765
+ const layerMatches = index.getItemsForPath(districtPath, "exact");
11727
11766
  const hasLayerHighlight = layerMatches.length > 0;
11728
11767
  if (hasLayerHighlight) {
11729
11768
  opacity = 0.5;
@@ -11856,7 +11895,8 @@ function requireDrawLayeredBuildings() {
11856
11895
  const ext = fileExtension.toLowerCase();
11857
11896
  return ext === ".jsx" || ext === ".tsx";
11858
11897
  }
11859
- function drawLayeredBuildings$1(ctx, buildings, worldToCanvas, scale, layers, hoveredBuilding, defaultBuildingColor, showFileNames, hoverBorderColor, disableOpacityDimming, showFileTypeIcons, borderRadius = 0) {
11898
+ function drawLayeredBuildings$1(ctx, buildings, worldToCanvas, scale, layers, hoveredBuilding, defaultBuildingColor, showFileNames, hoverBorderColor, disableOpacityDimming, showFileTypeIcons, borderRadius = 0, layerIndex) {
11899
+ const index = layerIndex || new LayerIndex(layers);
11860
11900
  buildings.forEach((building) => {
11861
11901
  const pos = worldToCanvas(building.position.x, building.position.z);
11862
11902
  let width, height;
@@ -11874,7 +11914,7 @@ function requireDrawLayeredBuildings() {
11874
11914
  width,
11875
11915
  height
11876
11916
  };
11877
- const layerMatches = getLayerItemsForPath(building.path, layers).filter((match) => match.item.type === "file");
11917
+ const layerMatches = index.getItemsForPath(building.path).filter((match) => match.item.type === "file");
11878
11918
  const hasLayerHighlight = layerMatches.length > 0;
11879
11919
  const isHovered = hoveredBuilding === building;
11880
11920
  let color2;
@@ -11982,7 +12022,7 @@ function requireArchitectureMapHighlightLayers() {
11982
12022
  Object.defineProperty(ArchitectureMapHighlightLayers, "__esModule", { value: true });
11983
12023
  ArchitectureMapHighlightLayers.ArchitectureMapHighlightLayers = void 0;
11984
12024
  const react_1 = __importStar(React);
11985
- const industry_theme_1 = require$$6;
12025
+ const industry_theme_1 = require$$7;
11986
12026
  const cityDataUtils_1 = requireCityDataUtils();
11987
12027
  const drawLayeredBuildings_1 = requireDrawLayeredBuildings();
11988
12028
  const DEFAULT_DISPLAY_OPTIONS = {
@@ -12581,6 +12621,7 @@ ${projectInfo.currentBranch}`;
12581
12621
  }
12582
12622
  return layers;
12583
12623
  }, [stableLayers, dynamicLayers, abstractionLayer]);
12624
+ const layerIndex = (0, react_1.useMemo)(() => new drawLayeredBuildings_1.LayerIndex(allLayers), [allLayers]);
12584
12625
  const { abstractedPathsSet, abstractedPathLookup } = (0, react_1.useMemo)(() => {
12585
12626
  const pathsSet = /* @__PURE__ */ new Set();
12586
12627
  const abstractionLayerDef = allLayers.find((l) => l.id === "directory-abstraction");
@@ -12703,9 +12744,10 @@ ${projectInfo.currentBranch}`;
12703
12744
  abstractedPathsSet,
12704
12745
  // Pass abstracted paths to skip labels
12705
12746
  showDirectoryLabels,
12706
- districtBorderRadius
12747
+ districtBorderRadius,
12748
+ layerIndex
12707
12749
  );
12708
- (0, drawLayeredBuildings_1.drawLayeredBuildings)(ctx, visibleBuildingsMemo, worldToCanvas, scale * zoomState.scale, allLayers, interactionState.hoveredBuilding, resolvedDefaultBuildingColor, showFileNames, resolvedHoverBorderColor, disableOpacityDimming, showFileTypeIcons, buildingBorderRadius);
12750
+ (0, drawLayeredBuildings_1.drawLayeredBuildings)(ctx, visibleBuildingsMemo, worldToCanvas, scale * zoomState.scale, allLayers, interactionState.hoveredBuilding, resolvedDefaultBuildingColor, showFileNames, resolvedHoverBorderColor, disableOpacityDimming, showFileTypeIcons, buildingBorderRadius, layerIndex);
12709
12751
  }, [
12710
12752
  filteredCityData,
12711
12753
  canvasSize,
@@ -12734,7 +12776,8 @@ ${projectInfo.currentBranch}`;
12734
12776
  // Memoized values for performance (don't recalculate on hover)
12735
12777
  visibleDistrictsMemo,
12736
12778
  visibleBuildingsMemo,
12737
- abstractedPathsSet
12779
+ abstractedPathsSet,
12780
+ layerIndex
12738
12781
  ]);
12739
12782
  const performHitTest = (0, react_1.useCallback)((canvasX, canvasY) => {
12740
12783
  var _a, _b;
@@ -14932,7 +14975,7 @@ const dist = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
14932
14975
  buildMultiVersionCity,
14933
14976
  getFilesFromGitHubTree
14934
14977
  }, Symbol.toStringTag, { value: "Module" }));
14935
- const require$$3 = /* @__PURE__ */ getAugmentedNamespace(dist);
14978
+ const require$$4 = /* @__PURE__ */ getAugmentedNamespace(dist);
14936
14979
  var useCodeCityData = {};
14937
14980
  var hasRequiredUseCodeCityData;
14938
14981
  function requireUseCodeCityData() {
@@ -14941,7 +14984,7 @@ function requireUseCodeCityData() {
14941
14984
  Object.defineProperty(useCodeCityData, "__esModule", { value: true });
14942
14985
  useCodeCityData.useCodeCityData = useCodeCityData$1;
14943
14986
  const react_1 = React;
14944
- const file_city_builder_1 = require$$3;
14987
+ const file_city_builder_1 = require$$4;
14945
14988
  function useCodeCityData$1({ fileSystemTree, autoUpdate = true }) {
14946
14989
  const [cityData, setCityData] = (0, react_1.useState)(null);
14947
14990
  const [isLoading, setIsLoading] = (0, react_1.useState)(false);
@@ -22524,8 +22567,8 @@ function requireCityViewWithReactFlow() {
22524
22567
  CityViewWithReactFlow.CityViewWithReactFlow = void 0;
22525
22568
  const react_1 = __importStar(React);
22526
22569
  const reactflow_1 = __importStar(require$$1);
22527
- const industry_theme_1 = require$$6;
22528
- const file_city_builder_1 = require$$3;
22570
+ const industry_theme_1 = require$$7;
22571
+ const file_city_builder_1 = require$$4;
22529
22572
  const ArchitectureMapHighlightLayers_1 = requireArchitectureMapHighlightLayers();
22530
22573
  const CellNode = ({ data, selected }) => {
22531
22574
  const { label, fileTree, fileCount, directoryCount } = data;
@@ -22780,11 +22823,15 @@ function requireDist() {
22780
22823
  hasRequiredDist = 1;
22781
22824
  (function(exports$1) {
22782
22825
  Object.defineProperty(exports$1, "__esModule", { value: true });
22783
- exports$1.useTheme = exports$1.ThemeProvider = exports$1.CityViewWithReactFlow = exports$1.useCodeCityData = exports$1.MultiVersionCityBuilder = exports$1.getFileColorMapping = exports$1.getDefaultFileColorConfig = exports$1.createFileColorHighlightLayers = exports$1.filterCityDataForMultipleDirectories = exports$1.filterCityDataForSubdirectory = exports$1.filterCityDataForSelectiveRender = exports$1.ArchitectureMapHighlightLayers = void 0;
22826
+ exports$1.useTheme = exports$1.ThemeProvider = exports$1.CityViewWithReactFlow = exports$1.useCodeCityData = exports$1.MultiVersionCityBuilder = exports$1.getFileColorMapping = exports$1.getDefaultFileColorConfig = exports$1.createFileColorHighlightLayers = exports$1.filterCityDataForMultipleDirectories = exports$1.filterCityDataForSubdirectory = exports$1.filterCityDataForSelectiveRender = exports$1.LayerIndex = exports$1.ArchitectureMapHighlightLayers = void 0;
22784
22827
  var ArchitectureMapHighlightLayers_1 = requireArchitectureMapHighlightLayers();
22785
22828
  Object.defineProperty(exports$1, "ArchitectureMapHighlightLayers", { enumerable: true, get: function() {
22786
22829
  return ArchitectureMapHighlightLayers_1.ArchitectureMapHighlightLayers;
22787
22830
  } });
22831
+ var drawLayeredBuildings_1 = requireDrawLayeredBuildings();
22832
+ Object.defineProperty(exports$1, "LayerIndex", { enumerable: true, get: function() {
22833
+ return drawLayeredBuildings_1.LayerIndex;
22834
+ } });
22788
22835
  var cityDataUtils_1 = requireCityDataUtils();
22789
22836
  Object.defineProperty(exports$1, "filterCityDataForSelectiveRender", { enumerable: true, get: function() {
22790
22837
  return cityDataUtils_1.filterCityDataForSelectiveRender;
@@ -22805,7 +22852,7 @@ function requireDist() {
22805
22852
  Object.defineProperty(exports$1, "getFileColorMapping", { enumerable: true, get: function() {
22806
22853
  return fileColorHighlightLayers_1.getFileColorMapping;
22807
22854
  } });
22808
- var file_city_builder_1 = require$$3;
22855
+ var file_city_builder_1 = require$$4;
22809
22856
  Object.defineProperty(exports$1, "MultiVersionCityBuilder", { enumerable: true, get: function() {
22810
22857
  return file_city_builder_1.MultiVersionCityBuilder;
22811
22858
  } });
@@ -22817,7 +22864,7 @@ function requireDist() {
22817
22864
  Object.defineProperty(exports$1, "CityViewWithReactFlow", { enumerable: true, get: function() {
22818
22865
  return CityViewWithReactFlow_1.CityViewWithReactFlow;
22819
22866
  } });
22820
- var industry_theme_1 = require$$6;
22867
+ var industry_theme_1 = require$$7;
22821
22868
  Object.defineProperty(exports$1, "ThemeProvider", { enumerable: true, get: function() {
22822
22869
  return industry_theme_1.ThemeProvider;
22823
22870
  } });
@@ -24246,6 +24293,7 @@ function getLayersForColorMode(mode, buildings, qualityData, fileColorLayers, gi
24246
24293
  var _a;
24247
24294
  if (mode === "fileTypes") return fileColorLayers;
24248
24295
  if (mode === "git") return gitLayers;
24296
+ if (mode === "pr") return [];
24249
24297
  if (usesCoverageData(mode)) {
24250
24298
  if (qualityData == null ? void 0 : qualityData.fileCoverage) {
24251
24299
  return createCoverageHighlightLayers(buildings, qualityData.fileCoverage);
@@ -24287,12 +24335,22 @@ const GIT_STATUS_COLORS = {
24287
24335
  deleted: "#ef4444"
24288
24336
  // Red
24289
24337
  };
24338
+ const PR_STATUS_COLORS = {
24339
+ added: "#22c55e",
24340
+ // Green
24341
+ modified: "#f59e0b",
24342
+ // Yellow/amber (consistent with git unstaged)
24343
+ removed: "#ef4444",
24344
+ // Red
24345
+ renamed: "#8b5cf6"
24346
+ // Purple
24347
+ };
24290
24348
  const CodeCityPanelContent = ({
24291
24349
  context,
24292
24350
  actions: actions2,
24293
24351
  events
24294
24352
  }) => {
24295
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
24353
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
24296
24354
  const { theme: theme2 } = useTheme();
24297
24355
  const [cityData, setCityData] = useState(null);
24298
24356
  const [hoverInfo, setHoverInfo] = useState(null);
@@ -24342,11 +24400,13 @@ const CodeCityPanelContent = ({
24342
24400
  }, [containerSize]);
24343
24401
  const fileTreeSlice = context.getSlice("fileTree");
24344
24402
  const gitSlice = context.getSlice("git");
24403
+ const prFilesSlice = context.getSlice("prFiles");
24345
24404
  const agentHighlightLayersSlice = context.getSlice("agentHighlightLayers");
24346
24405
  const colorModesSlice = context.getSlice("fileCityColorModes");
24347
24406
  const qualityData = (_c = colorModesSlice == null ? void 0 : colorModesSlice.data) == null ? void 0 : _c.qualityData;
24348
24407
  const fileColorLayersRegistered = useRef(false);
24349
24408
  const gitLayersRegistered = useRef(false);
24409
+ const prFilesLayersRegistered = useRef(false);
24350
24410
  const agentLayersRegistered = useRef(false);
24351
24411
  const lastHasGitOrAgentLayers = useRef(null);
24352
24412
  const currentRepoPath = (_d = context.currentScope.repository) == null ? void 0 : _d.path;
@@ -24356,11 +24416,13 @@ const CodeCityPanelContent = ({
24356
24416
  setHighlightLayers([]);
24357
24417
  fileColorLayersRegistered.current = false;
24358
24418
  gitLayersRegistered.current = false;
24419
+ prFilesLayersRegistered.current = false;
24359
24420
  agentLayersRegistered.current = false;
24360
24421
  lastHasGitOrAgentLayers.current = null;
24361
24422
  lastRepoPath.current = currentRepoPath;
24362
24423
  }
24363
24424
  }, [currentRepoPath]);
24425
+ const [prFilesVersion, setPrFilesVersion] = useState(0);
24364
24426
  useEffect(() => {
24365
24427
  if (!events) return;
24366
24428
  const cleanupHover = events.on("package:hover", (event) => {
@@ -24371,9 +24433,19 @@ const CodeCityPanelContent = ({
24371
24433
  const payload = event.payload;
24372
24434
  setSelectedPackagePath((payload == null ? void 0 : payload.packagePath) ?? null);
24373
24435
  });
24436
+ const cleanupPrFiles = events.on("prFiles:updated", () => {
24437
+ console.log("[CodeCityPanel] PR files updated, triggering re-render");
24438
+ setPrFilesVersion((v) => v + 1);
24439
+ });
24440
+ const cleanupPrFilesCleared = events.on("prFiles:cleared", () => {
24441
+ console.log("[CodeCityPanel] PR files cleared, triggering re-render");
24442
+ setPrFilesVersion((v) => v + 1);
24443
+ });
24374
24444
  return () => {
24375
24445
  cleanupHover == null ? void 0 : cleanupHover();
24376
24446
  cleanupSelect == null ? void 0 : cleanupSelect();
24447
+ cleanupPrFiles == null ? void 0 : cleanupPrFiles();
24448
+ cleanupPrFilesCleared == null ? void 0 : cleanupPrFilesCleared();
24377
24449
  };
24378
24450
  }, [events]);
24379
24451
  useEffect(() => {
@@ -24392,7 +24464,7 @@ const CodeCityPanelContent = ({
24392
24464
  return COLOR_MODES.find((m) => m.id === colorMode) || COLOR_MODES[0];
24393
24465
  }, [colorMode]);
24394
24466
  const hoveredFileMetric = useMemo(() => {
24395
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o, _p;
24467
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p;
24396
24468
  if (!((_a2 = hoverInfo == null ? void 0 : hoverInfo.hoveredBuilding) == null ? void 0 : _a2.path)) return null;
24397
24469
  const filePath = hoverInfo.hoveredBuilding.path;
24398
24470
  if (!qualityData) return null;
@@ -24457,7 +24529,7 @@ const CodeCityPanelContent = ({
24457
24529
  return { type: "knip", value: null, label: "No dead code data" };
24458
24530
  }
24459
24531
  case "alexandria": {
24460
- const metric = (_p = (_o = qualityData.fileMetrics) == null ? void 0 : _o.alexandria) == null ? void 0 : _p.find((m) => m.file === filePath);
24532
+ const metric = (_p = (_o2 = qualityData.fileMetrics) == null ? void 0 : _o2.alexandria) == null ? void 0 : _p.find((m) => m.file === filePath);
24461
24533
  if (metric) {
24462
24534
  const issues = metric.issueCount;
24463
24535
  return { type: "alexandria", value: metric, label: issues > 0 ? `${issues} doc issue${issues > 1 ? "s" : ""}` : "Well documented" };
@@ -24606,9 +24678,88 @@ const CodeCityPanelContent = ({
24606
24678
  }
24607
24679
  return layers;
24608
24680
  }, [cityData, gitSlice == null ? void 0 : gitSlice.data]);
24681
+ const prFilesLayers = useMemo(() => {
24682
+ var _a2;
24683
+ if (!cityData || !cityData.buildings || !((_a2 = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _a2.filesByStatus)) {
24684
+ return [];
24685
+ }
24686
+ const prFiles = prFilesSlice.data.filesByStatus;
24687
+ const buildingsByPath = new Map(
24688
+ cityData.buildings.map((b) => [b.path, b])
24689
+ );
24690
+ const createLayerItems = (paths) => {
24691
+ const items2 = [];
24692
+ for (const path of paths) {
24693
+ const building = buildingsByPath.get(path);
24694
+ if (building) {
24695
+ items2.push({
24696
+ path: building.path,
24697
+ type: "file",
24698
+ renderStrategy: "fill"
24699
+ });
24700
+ }
24701
+ }
24702
+ return items2;
24703
+ };
24704
+ const layers = [];
24705
+ if (prFiles.added.length > 0) {
24706
+ const items2 = createLayerItems(prFiles.added);
24707
+ if (items2.length > 0) {
24708
+ layers.push({
24709
+ id: "pr-highlight-added",
24710
+ name: "PR Added",
24711
+ enabled: true,
24712
+ color: PR_STATUS_COLORS.added,
24713
+ priority: 85,
24714
+ items: items2
24715
+ });
24716
+ }
24717
+ }
24718
+ if (prFiles.modified.length > 0) {
24719
+ const items2 = createLayerItems(prFiles.modified);
24720
+ if (items2.length > 0) {
24721
+ layers.push({
24722
+ id: "pr-highlight-modified",
24723
+ name: "PR Modified",
24724
+ enabled: true,
24725
+ color: PR_STATUS_COLORS.modified,
24726
+ priority: 95,
24727
+ items: items2
24728
+ });
24729
+ }
24730
+ }
24731
+ if (prFiles.removed.length > 0) {
24732
+ const items2 = createLayerItems(prFiles.removed);
24733
+ if (items2.length > 0) {
24734
+ layers.push({
24735
+ id: "pr-highlight-removed",
24736
+ name: "PR Removed",
24737
+ enabled: true,
24738
+ color: PR_STATUS_COLORS.removed,
24739
+ priority: 105,
24740
+ items: items2
24741
+ });
24742
+ }
24743
+ }
24744
+ if (prFiles.renamed.length > 0) {
24745
+ const renamedPaths = prFiles.renamed.map((r) => r.filename);
24746
+ const items2 = createLayerItems(renamedPaths);
24747
+ if (items2.length > 0) {
24748
+ layers.push({
24749
+ id: "pr-highlight-renamed",
24750
+ name: "PR Renamed",
24751
+ enabled: true,
24752
+ color: PR_STATUS_COLORS.renamed,
24753
+ priority: 88,
24754
+ items: items2
24755
+ });
24756
+ }
24757
+ }
24758
+ return layers;
24759
+ }, [cityData, (_f = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _f.filesByStatus, prFilesVersion]);
24609
24760
  const qualityLayers = useMemo(() => {
24610
24761
  if (!(cityData == null ? void 0 : cityData.buildings)) return [];
24611
- if (colorMode === "fileTypes" || colorMode === "git") return [];
24762
+ if (colorMode === "fileTypes" || colorMode === "git" || colorMode === "pr") return [];
24612
24763
  return getLayersForColorMode(
24613
24764
  colorMode,
24614
24765
  cityData.buildings,
@@ -24824,7 +24975,7 @@ const CodeCityPanelContent = ({
24824
24975
  const hasAgentLayers = formattedAgentLayers.length > 0;
24825
24976
  let modeLayers = [];
24826
24977
  if (hasAgentLayers) {
24827
- modeLayers = [...gitStatusLayers, ...formattedAgentLayers];
24978
+ modeLayers = [...gitStatusLayers, ...prFilesLayers, ...formattedAgentLayers];
24828
24979
  } else {
24829
24980
  switch (colorMode) {
24830
24981
  case "fileTypes":
@@ -24842,18 +24993,20 @@ const CodeCityPanelContent = ({
24842
24993
  case "git":
24843
24994
  modeLayers = gitStatusLayers;
24844
24995
  break;
24996
+ case "pr":
24997
+ modeLayers = prFilesLayers;
24998
+ break;
24845
24999
  default:
24846
25000
  modeLayers = qualityLayers;
24847
25001
  break;
24848
25002
  }
24849
25003
  }
24850
25004
  setBaseLayers(modeLayers);
24851
- const activePackagePath = selectedPackagePath ?? hoveredPackagePath;
24852
- if (activePackagePath && activePackagePath !== "" && activePackagePath !== "/" && modeLayers.length > 0) {
25005
+ if (selectedPackagePath && selectedPackagePath !== "" && selectedPackagePath !== "/" && modeLayers.length > 0) {
24853
25006
  const packageFilteredLayers = [];
24854
25007
  modeLayers.forEach((layer) => {
24855
25008
  const insidePackage = layer.items.filter(
24856
- (item) => isFileInPackage(item.path, activePackagePath)
25009
+ (item) => isFileInPackage(item.path, selectedPackagePath)
24857
25010
  );
24858
25011
  if (insidePackage.length > 0) {
24859
25012
  packageFilteredLayers.push({
@@ -24863,64 +25016,30 @@ const CodeCityPanelContent = ({
24863
25016
  });
24864
25017
  }
24865
25018
  });
24866
- if (hoveredPackagePath && hoveredPackagePath !== selectedPackagePath) {
24867
- packageFilteredLayers.push({
24868
- id: "hovered-package-highlight",
24869
- name: "Hovered Package",
24870
- enabled: true,
24871
- color: "#6b7280",
24872
- // Gray highlight for hover
24873
- priority: 190,
24874
- items: [{
24875
- path: hoveredPackagePath,
24876
- type: "directory",
24877
- renderStrategy: "border"
24878
- }],
24879
- borderWidth: 2
24880
- });
24881
- }
24882
- if (selectedPackagePath) {
24883
- packageFilteredLayers.push({
24884
- id: "selected-package-highlight",
24885
- name: "Selected Package",
24886
- enabled: true,
24887
- color: "#3b82f6",
24888
- // Blue highlight
24889
- priority: 200,
24890
- // High priority to show on top
24891
- items: [{
24892
- path: selectedPackagePath,
24893
- type: "directory",
24894
- renderStrategy: "border"
24895
- }],
24896
- borderWidth: 3
24897
- });
24898
- }
25019
+ packageFilteredLayers.push({
25020
+ id: "selected-package-highlight",
25021
+ name: "Selected Package",
25022
+ enabled: true,
25023
+ color: "#3b82f6",
25024
+ // Blue highlight
25025
+ priority: 200,
25026
+ // High priority to show on top
25027
+ items: [{
25028
+ path: selectedPackagePath,
25029
+ type: "directory",
25030
+ renderStrategy: "border"
25031
+ }],
25032
+ borderWidth: 3
25033
+ });
24899
25034
  setHighlightLayers(packageFilteredLayers);
24900
25035
  } else {
24901
- const layersWithHover = [...modeLayers];
24902
- if (hoveredPackagePath) {
24903
- layersWithHover.push({
24904
- id: "hovered-package-highlight",
24905
- name: "Hovered Package",
24906
- enabled: true,
24907
- color: "#6b7280",
24908
- // Gray highlight for hover
24909
- priority: 190,
24910
- items: [{
24911
- path: hoveredPackagePath,
24912
- type: "directory",
24913
- renderStrategy: "border"
24914
- }],
24915
- borderWidth: 2
24916
- });
24917
- }
24918
- setHighlightLayers(layersWithHover);
25036
+ setHighlightLayers(modeLayers);
24919
25037
  }
24920
25038
  fileColorLayersRegistered.current = !hasAgentLayers && colorMode === "fileTypes";
24921
25039
  gitLayersRegistered.current = hasAgentLayers || colorMode === "git";
25040
+ prFilesLayersRegistered.current = hasAgentLayers || colorMode === "pr";
24922
25041
  agentLayersRegistered.current = hasAgentLayers;
24923
- }, [colorMode, fileColorLayers, gitStatusLayers, qualityLayers, agentHighlightLayersSlice == null ? void 0 : agentHighlightLayersSlice.data, hoveredPackagePath, selectedPackagePath, isFileInPackage]);
25042
+ }, [colorMode, fileColorLayers, gitStatusLayers, prFilesLayers, qualityLayers, agentHighlightLayersSlice == null ? void 0 : agentHighlightLayersSlice.data, selectedPackagePath, isFileInPackage]);
24924
25043
  useEffect(() => {
24925
25044
  if (!(fileTreeSlice == null ? void 0 : fileTreeSlice.data) || !fileTreeSlice.data.allFiles) {
24926
25045
  setLoading(false);
@@ -24954,7 +25073,7 @@ const CodeCityPanelContent = ({
24954
25073
  } finally {
24955
25074
  setLoading(false);
24956
25075
  }
24957
- }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, fileTreeSlice == null ? void 0 : fileTreeSlice.loading, (_f = context.currentScope.repository) == null ? void 0 : _f.path]);
25076
+ }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, fileTreeSlice == null ? void 0 : fileTreeSlice.loading, (_g = context.currentScope.repository) == null ? void 0 : _g.path]);
24958
25077
  const handleFileClick = useCallback(
24959
25078
  (filePath) => {
24960
25079
  if (actions2.openFile) {
@@ -25242,7 +25361,7 @@ const CodeCityPanelContent = ({
25242
25361
  textOverflow: "ellipsis",
25243
25362
  whiteSpace: "nowrap"
25244
25363
  },
25245
- children: ((_g = hoverInfo.fileTooltip) == null ? void 0 : _g.text) || ((_i = (_h = hoverInfo.hoveredDistrict) == null ? void 0 : _h.path) == null ? void 0 : _i.split("/").pop()) || ((_j = hoverInfo.hoveredDistrict) == null ? void 0 : _j.path) || "Unknown"
25364
+ children: ((_h = hoverInfo.fileTooltip) == null ? void 0 : _h.text) || ((_j = (_i = hoverInfo.hoveredDistrict) == null ? void 0 : _i.path) == null ? void 0 : _j.split("/").pop()) || ((_k = hoverInfo.hoveredDistrict) == null ? void 0 : _k.path) || "Unknown"
25246
25365
  }
25247
25366
  ),
25248
25367
  /* @__PURE__ */ jsx(
@@ -25256,7 +25375,7 @@ const CodeCityPanelContent = ({
25256
25375
  textOverflow: "ellipsis",
25257
25376
  whiteSpace: "nowrap"
25258
25377
  },
25259
- children: ((_k = hoverInfo.hoveredBuilding) == null ? void 0 : _k.path) || ((_l = hoverInfo.hoveredDistrict) == null ? void 0 : _l.path) || "/"
25378
+ children: ((_l = hoverInfo.hoveredBuilding) == null ? void 0 : _l.path) || ((_m = hoverInfo.hoveredDistrict) == null ? void 0 : _m.path) || "/"
25260
25379
  }
25261
25380
  )
25262
25381
  ]
@@ -25383,7 +25502,7 @@ const CodeCityPanelContent = ({
25383
25502
  fileTypes: [],
25384
25503
  gitStatus: gitSlice == null ? void 0 : gitSlice.data,
25385
25504
  fileTree: fileTreeSlice == null ? void 0 : fileTreeSlice.data,
25386
- rootPath: (_m = context.currentScope.repository) == null ? void 0 : _m.path,
25505
+ rootPath: (_n = context.currentScope.repository) == null ? void 0 : _n.path,
25387
25506
  onGitFileClick: handleFileClick,
25388
25507
  onGitNodeHover: handleGitNodeHover,
25389
25508
  position: layout.legendPosition
@@ -25401,7 +25520,7 @@ const CodeCityPanelContent = ({
25401
25520
  fileTypes: legendFileTypes,
25402
25521
  gitStatus: gitSlice == null ? void 0 : gitSlice.data,
25403
25522
  fileTree: fileTreeSlice == null ? void 0 : fileTreeSlice.data,
25404
- rootPath: (_n = context.currentScope.repository) == null ? void 0 : _n.path,
25523
+ rootPath: (_o = context.currentScope.repository) == null ? void 0 : _o.path,
25405
25524
  agentLayers: legendAgentLayers,
25406
25525
  qualityMetrics: legendQualityMetrics,
25407
25526
  colorMode,